703
|
1 |
"{ Package: 'stx:libjava' }"
|
|
2 |
|
611
|
3 |
JavaMethodWithHandler variableSubclass:#JavaNativeMethod
|
|
4 |
instanceVariableNames:'nativeImplementation'
|
2097
|
5 |
classVariableNames:''
|
611
|
6 |
poolDictionaries:''
|
2107
|
7 |
category:'Languages-Java-Classes'
|
611
|
8 |
!
|
|
9 |
|
642
|
10 |
|
616
|
11 |
!JavaNativeMethod class methodsFor:'initialization'!
|
|
12 |
|
|
13 |
initialize
|
|
14 |
self flags:(self flags bitOr:Behavior flagJavaMethod).
|
|
15 |
! !
|
|
16 |
|
654
|
17 |
!JavaNativeMethod class methodsFor:'cleanup'!
|
|
18 |
|
|
19 |
flushAllCachedNativeMethods
|
|
20 |
self allInstancesDo:[:aNativeMethod |
|
|
21 |
aNativeMethod nativeImplementation:nil
|
|
22 |
].
|
|
23 |
|
|
24 |
"
|
|
25 |
self flushAllCachedNativeMethods
|
|
26 |
"
|
|
27 |
|
|
28 |
"Created: / 24.12.1999 / 03:10:38 / cg"
|
|
29 |
"Modified: / 24.12.1999 / 03:10:51 / cg"
|
|
30 |
! !
|
|
31 |
|
611
|
32 |
!JavaNativeMethod methodsFor:'accessing'!
|
|
33 |
|
|
34 |
nativeImplementation
|
|
35 |
"return the value of the instance variable 'nativeImplementation' (automatically generated)"
|
|
36 |
|
|
37 |
^ nativeImplementation
|
|
38 |
|
|
39 |
"Created: / 25.9.1999 / 23:08:00 / cg"
|
|
40 |
!
|
|
41 |
|
|
42 |
nativeImplementation:something
|
|
43 |
"set the value of the instance variable 'nativeImplementation' (automatically generated)"
|
|
44 |
|
|
45 |
nativeImplementation := something.
|
|
46 |
|
|
47 |
"Created: / 25.9.1999 / 23:08:00 / cg"
|
|
48 |
! !
|
|
49 |
|
|
50 |
!JavaNativeMethod methodsFor:'vm support'!
|
|
51 |
|
|
52 |
nativeMethodInvokation
|
2097
|
53 |
|nm sel mthd sender|
|
611
|
54 |
|
642
|
55 |
(mthd := nativeImplementation) isNil ifTrue:[
|
2097
|
56 |
nm := selector copyWithoutLast:signature size.
|
|
57 |
sel := ('_' , javaClass lastName , '_' , nm , ':') asSymbol.
|
611
|
58 |
|
642
|
59 |
mthd := (JavaVM class compiledMethodAt:sel).
|
|
60 |
(mthd isNil or:[mthd isLazyMethod]) ifTrue:[
|
660
|
61 |
sender := thisContext sender.
|
|
62 |
sender sender selector == #noByteCode ifTrue:[
|
|
63 |
sender := sender sender.
|
663
|
64 |
sender := sender sender.
|
|
65 |
sender := sender sender.
|
660
|
66 |
].
|
642
|
67 |
^ JavaVM
|
|
68 |
perform:sel
|
660
|
69 |
with:sender.
|
642
|
70 |
].
|
2097
|
71 |
nativeImplementation := mthd.
|
611
|
72 |
].
|
|
73 |
|
642
|
74 |
^ mthd
|
|
75 |
valueWithReceiver:JavaVM
|
|
76 |
arguments:(Array with:thisContext sender)
|
|
77 |
selector:selector
|
|
78 |
search:JavaVM class
|
|
79 |
sender:nil
|
611
|
80 |
|
703
|
81 |
"
|
|
82 |
JavaNativeMethod flushAllCachedNativeMethods
|
|
83 |
"
|
|
84 |
|
2097
|
85 |
"Modified: / 27.1.2000 / 13:34:53 / cg"
|
611
|
86 |
! !
|
|
87 |
|
|
88 |
!JavaNativeMethod class methodsFor:'documentation'!
|
|
89 |
|
|
90 |
version
|
2107
|
91 |
^ '$Header: /cvs/stx/stx/libjava/JavaNativeMethod.st,v 1.8 2002-11-22 20:09:13 cg Exp $'
|
611
|
92 |
! !
|
2107
|
93 |
|
2097
|
94 |
JavaNativeMethod initialize!
|