author | jv |
Thu, 23 Sep 2010 13:52:13 +0000 | |
changeset 748 | da0840b7798c |
parent 713 | 75e92ac63bf1 |
child 749 | e898eaeff091 |
permissions | -rw-r--r-- |
703 | 1 |
"{ Package: 'stx:libjava' }" |
2 |
||
611 | 3 |
JavaMethodWithHandler variableSubclass:#JavaNativeMethod |
4 |
instanceVariableNames:'nativeImplementation' |
|
5 |
classVariableNames:'' |
|
6 |
poolDictionaries:'' |
|
713 | 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 |
|
660 | 53 |
|nm sel mthd sender| |
611 | 54 |
|
642 | 55 |
(mthd := nativeImplementation) isNil ifTrue:[ |
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 |
]. |
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 |
||
663 | 85 |
"Modified: / 27.1.2000 / 13:34:53 / cg" |
611 | 86 |
! ! |
87 |
||
88 |
!JavaNativeMethod class methodsFor:'documentation'! |
|
89 |
||
90 |
version |
|
748
da0840b7798c
Manufactured by SVN::ImportFromCVSTask to fix repository layout
jv
parents:
713
diff
changeset
|
91 |
^ '$Id$' |
611 | 92 |
! ! |
713 | 93 |
|
642 | 94 |
JavaNativeMethod initialize! |