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