author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Thu, 31 Jan 2013 13:45:17 +0000 | |
branch | refactoring-vmdata |
changeset 2019 | e1291a81f215 |
parent 2016 | 6afb298c7403 |
child 2020 | 985ca70cdcad |
permissions | -rw-r--r-- |
877 | 1 |
" |
2 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
|
1152 | 3 |
|
1155 | 4 |
New code and modifications done at SWING Research Group [1]: |
1152 | 5 |
|
877 | 6 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
7 |
SWING Research Group, Czech Technical University in Prague |
|
8 |
||
9 |
This software is furnished under a license and may be used |
|
10 |
only in accordance with the terms of that license and with the |
|
11 |
inclusion of the above copyright notice. This software may not |
|
12 |
be provided or otherwise made available to, or used by, any |
|
13 |
other person. No title to or ownership of the software is |
|
14 |
hereby transferred. |
|
15 |
||
1155 | 16 |
[1] Code written at SWING Research Group contains a signature |
17 |
of one of the above copright owners. For exact set of such code, |
|
18 |
see the differences between this version and version stx:libjava |
|
1152 | 19 |
as of 1.9.2010 |
877 | 20 |
" |
752 | 21 |
"{ Package: 'stx:libjava' }" |
22 |
||
23 |
JavaMethodWithHandler variableSubclass:#JavaNativeMethod |
|
1749 | 24 |
instanceVariableNames:'nativeImplementation nCalls' |
1075
927aeb3649fc
Fix in native method imp -> class loading java tests all pass.. I'm getting drunk tonight :)
hlopkmar
parents:
1073
diff
changeset
|
25 |
classVariableNames:'CacheNativeImplementation Verbose' |
752 | 26 |
poolDictionaries:'' |
27 |
category:'Languages-Java-Classes' |
|
28 |
! |
|
29 |
||
877 | 30 |
!JavaNativeMethod class methodsFor:'documentation'! |
31 |
||
32 |
copyright |
|
33 |
" |
|
34 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
|
1152 | 35 |
|
1155 | 36 |
New code and modifications done at SWING Research Group [1]: |
1152 | 37 |
|
877 | 38 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
39 |
SWING Research Group, Czech Technical University in Prague |
|
40 |
||
41 |
This software is furnished under a license and may be used |
|
42 |
only in accordance with the terms of that license and with the |
|
43 |
inclusion of the above copyright notice. This software may not |
|
44 |
be provided or otherwise made available to, or used by, any |
|
45 |
other person. No title to or ownership of the software is |
|
46 |
hereby transferred. |
|
47 |
||
1155 | 48 |
[1] Code written at SWING Research Group contains a signature |
49 |
of one of the above copright owners. For exact set of such code, |
|
50 |
see the differences between this version and version stx:libjava |
|
1152 | 51 |
as of 1.9.2010 |
877 | 52 |
|
53 |
" |
|
54 |
! ! |
|
752 | 55 |
|
56 |
!JavaNativeMethod class methodsFor:'initialization'! |
|
57 |
||
761 | 58 |
cacheNativeImplementation |
59 |
||
60 |
"For details, see #cacheNativeImplementation:" |
|
61 |
||
62 |
^CacheNativeImplementation |
|
63 |
||
64 |
"Created: / 30-04-2011 / 23:38:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
65 |
! |
|
66 |
||
67 |
cacheNativeImplementation: aBoolean |
|
68 |
||
69 |
"If set, native implementations are cached, resulting |
|
70 |
in better performance when calling native methods. |
|
71 |
Hower, no change in native method implemenetaion will |
|
72 |
not be visible then, unless #flushAllCachedNativeMethods |
|
73 |
is explictely called" |
|
74 |
||
75 |
CacheNativeImplementation := aBoolean |
|
76 |
||
77 |
"Created: / 30-04-2011 / 23:38:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
78 |
! |
|
79 |
||
752 | 80 |
initialize |
2019
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
81 |
"/self flags: ((self flags bitClear: Behavior flagMethod) bitOr: Behavior flagJavaMethod). |
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
82 |
self flags: ((self flags bitClear: Behavior flagJavaMethod) bitOr: Behavior flagMethod). |
2016
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
83 |
" |
2019
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
84 |
self flags bitAnd: Behavior flagJavaMethod |
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
85 |
self flags bitAnd: Behavior flagMethod |
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
86 |
|
2016
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
87 |
" |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
88 |
"By default, do not cache native impls while developing" |
761 | 89 |
CacheNativeImplementation := Smalltalk isStandAloneApp. |
1075
927aeb3649fc
Fix in native method imp -> class loading java tests all pass.. I'm getting drunk tonight :)
hlopkmar
parents:
1073
diff
changeset
|
90 |
Verbose := false. |
927aeb3649fc
Fix in native method imp -> class loading java tests all pass.. I'm getting drunk tonight :)
hlopkmar
parents:
1073
diff
changeset
|
91 |
" |
2016
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
92 |
Verbose := true. |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
93 |
" |
761 | 94 |
|
1075
927aeb3649fc
Fix in native method imp -> class loading java tests all pass.. I'm getting drunk tonight :)
hlopkmar
parents:
1073
diff
changeset
|
95 |
"Modified (comment): / 03-11-2011 / 10:48:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
2019
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
96 |
"Modified: / 31-01-2013 / 13:41:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
97 |
! ! |
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
98 |
|
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
99 |
!JavaNativeMethod class methodsFor:'instance creation'! |
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
100 |
|
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
101 |
new |
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
102 |
"Redefined again, since since trampoline methods need |
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
103 |
literals" |
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
104 |
|
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
105 |
^ self basicNew:1. |
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
106 |
|
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
107 |
"Created: / 31-01-2013 / 13:26:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 108 |
! ! |
109 |
||
110 |
!JavaNativeMethod class methodsFor:'cleanup'! |
|
111 |
||
112 |
flushAllCachedNativeMethods |
|
113 |
self allInstancesDo:[:aNativeMethod | |
|
114 |
aNativeMethod nativeImplementation:nil |
|
115 |
]. |
|
116 |
||
117 |
" |
|
118 |
self flushAllCachedNativeMethods |
|
119 |
" |
|
120 |
||
121 |
"Created: / 24.12.1999 / 03:10:38 / cg" |
|
122 |
"Modified: / 24.12.1999 / 03:10:51 / cg" |
|
123 |
! ! |
|
124 |
||
125 |
!JavaNativeMethod methodsFor:'accessing'! |
|
126 |
||
1749 | 127 |
nCalls |
128 |
^ nCalls ? 0 |
|
129 |
||
130 |
"Modified: / 27-10-2012 / 18:05:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
131 |
! |
|
132 |
||
1754
b3cde0c1c2b1
- do not enforce Java native code optimization off
vranyj1
parents:
1749
diff
changeset
|
133 |
nCallsReset |
b3cde0c1c2b1
- do not enforce Java native code optimization off
vranyj1
parents:
1749
diff
changeset
|
134 |
nCalls := 0 |
b3cde0c1c2b1
- do not enforce Java native code optimization off
vranyj1
parents:
1749
diff
changeset
|
135 |
|
b3cde0c1c2b1
- do not enforce Java native code optimization off
vranyj1
parents:
1749
diff
changeset
|
136 |
"Modified: / 27-10-2012 / 18:05:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
b3cde0c1c2b1
- do not enforce Java native code optimization off
vranyj1
parents:
1749
diff
changeset
|
137 |
! |
b3cde0c1c2b1
- do not enforce Java native code optimization off
vranyj1
parents:
1749
diff
changeset
|
138 |
|
752 | 139 |
nativeImplementation |
140 |
"return the value of the instance variable 'nativeImplementation' (automatically generated)" |
|
141 |
||
142 |
^ nativeImplementation |
|
143 |
||
144 |
"Created: / 25.9.1999 / 23:08:00 / cg" |
|
145 |
! |
|
146 |
||
147 |
nativeImplementation:something |
|
148 |
"set the value of the instance variable 'nativeImplementation' (automatically generated)" |
|
149 |
||
150 |
nativeImplementation := something. |
|
151 |
||
152 |
"Created: / 25.9.1999 / 23:08:00 / cg" |
|
153 |
! |
|
154 |
||
155 |
sourceLineNumber |
|
1213
fc90769151e8
- fix in reflection over methods (signature is nil for non-generic methods)
vranyj1
parents:
1155
diff
changeset
|
156 |
|
fc90769151e8
- fix in reflection over methods (signature is nil for non-generic methods)
vranyj1
parents:
1155
diff
changeset
|
157 |
^super sourceLineNumber |
fc90769151e8
- fix in reflection over methods (signature is nil for non-generic methods)
vranyj1
parents:
1155
diff
changeset
|
158 |
|
fc90769151e8
- fix in reflection over methods (signature is nil for non-generic methods)
vranyj1
parents:
1155
diff
changeset
|
159 |
"/ ForceByteCodeDisplay == true ifTrue:[ ^ 1]. |
fc90769151e8
- fix in reflection over methods (signature is nil for non-generic methods)
vranyj1
parents:
1155
diff
changeset
|
160 |
"/ lineNumberTable notNil ifTrue:[ ^ lineNumberTable at:2]. |
fc90769151e8
- fix in reflection over methods (signature is nil for non-generic methods)
vranyj1
parents:
1155
diff
changeset
|
161 |
"/ ^1 |
752 | 162 |
|
163 |
||
164 |
" |
|
165 |
^ (JavaSourceCodeCache new) |
|
166 |
findLineForMethod:(self selector) |
|
167 |
inClass:javaClass. |
|
168 |
" |
|
169 |
||
170 |
"Modified: / 13-12-2010 / 13:55:55 / Jan Kurs <kurs.jan@post.cz>" |
|
171 |
"Modified: / 13-12-2010 / 23:46:30 / Marcel Hlopko <hlopik@gmail.com>" |
|
172 |
"Created: / 17-12-2010 / 10:34:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
173 |
! ! |
|
174 |
||
761 | 175 |
!JavaNativeMethod methodsFor:'private'! |
176 |
||
177 |
compileNativeImplementation: sel dispatchingTo: oldSel |
|
178 |
||
1985
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
179 |
| src arg converted header | |
761 | 180 |
src := (JavaVM class compiledMethodAt: oldSel) source. |
181 |
src := src asStringCollection. |
|
182 |
(src first includesString: 'aJavaContext') ifTrue:[ |
|
183 |
arg := 'aJavaContext' |
|
184 |
] ifFalse:[ |
|
185 |
(src first includesString: 'nativeContext') ifTrue:[ |
|
186 |
arg := 'nativeContext' |
|
187 |
] |
|
188 |
]. |
|
189 |
arg ifNotNil:[ |
|
190 |
src removeFirst asString. |
|
191 |
converted := true. |
|
192 |
] ifNil:[ |
|
193 |
arg := 'nativeContext'. |
|
194 |
src := ' self breakPoint: #jv info: ''Convert it to new-style natives''. |
|
195 |
||
196 |
^ self ', oldSel, ' nativeContext'. |
|
197 |
converted := false. |
|
1985
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
198 |
]. |
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
199 |
|
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
200 |
header := String streamContents:[:s| |
1986
9e63ab553922
JavaNativeMethod & their implementation transformed to pass a reveiver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1985
diff
changeset
|
201 |
sel numArgs == 2 ifTrue:[ |
2010
9bacff8c53de
The 'nativeContext' argument removed from all native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1993
diff
changeset
|
202 |
s nextPutAll: sel; space; nextPutAll: 'this '. |
1985
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
203 |
] ifFalse:[ |
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
204 |
| kw | |
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
205 |
|
2010
9bacff8c53de
The 'nativeContext' argument removed from all native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1993
diff
changeset
|
206 |
kw := sel keywords. |
1986
9e63ab553922
JavaNativeMethod & their implementation transformed to pass a reveiver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1985
diff
changeset
|
207 |
s nextPutAll: kw first. |
9e63ab553922
JavaNativeMethod & their implementation transformed to pass a reveiver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1985
diff
changeset
|
208 |
s nextPutAll: ' this '. |
9e63ab553922
JavaNativeMethod & their implementation transformed to pass a reveiver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1985
diff
changeset
|
209 |
2 to: kw size - 1 do:[:i| |
1985
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
210 |
sel nextPutAll: (kw at: i); space; nextPut:$a; nextPutAll: i printString; space. |
2010
9bacff8c53de
The 'nativeContext' argument removed from all native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1993
diff
changeset
|
211 |
]. |
1985
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
212 |
] |
761 | 213 |
]. |
214 |
||
215 |
(JavaVM class |
|
216 |
compile: |
|
1985
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
217 |
(self nativeMethodTemplate bindWith:header with: arg with: src asString) |
761 | 218 |
classified: |
219 |
'native - ', ((javaClass javaPackage upTo:$$) replaceAll:$/ with:$. )) |
|
220 |
package: JavaVM package. |
|
221 |
||
222 |
converted ifTrue:[ |
|
223 |
(JavaVM class compiledMethodAt: oldSel) category: 'native - old-style (converted)' |
|
224 |
] ifFalse:[ |
|
225 |
(JavaVM class compiledMethodAt: oldSel) category: 'native - old-style (FAILED to convert)' |
|
226 |
] |
|
227 |
||
228 |
"Created: / 01-05-2011 / 00:08:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1986
9e63ab553922
JavaNativeMethod & their implementation transformed to pass a reveiver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1985
diff
changeset
|
229 |
"Modified: / 19-01-2013 / 23:29:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
761 | 230 |
! |
231 |
||
232 |
compileNativeImplementationStub: sel |
|
1985
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
233 |
| header | |
761 | 234 |
|
1986
9e63ab553922
JavaNativeMethod & their implementation transformed to pass a reveiver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1985
diff
changeset
|
235 |
header := String streamContents:[:s| |
9e63ab553922
JavaNativeMethod & their implementation transformed to pass a reveiver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1985
diff
changeset
|
236 |
sel numArgs == 2 ifTrue:[ |
2010
9bacff8c53de
The 'nativeContext' argument removed from all native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1993
diff
changeset
|
237 |
s nextPutAll: sel keywords first. |
1985
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
238 |
] ifFalse:[ |
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
239 |
| kw | |
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
240 |
|
2010
9bacff8c53de
The 'nativeContext' argument removed from all native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1993
diff
changeset
|
241 |
kw := sel keywords. |
1986
9e63ab553922
JavaNativeMethod & their implementation transformed to pass a reveiver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1985
diff
changeset
|
242 |
s nextPutAll: kw first. |
9e63ab553922
JavaNativeMethod & their implementation transformed to pass a reveiver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1985
diff
changeset
|
243 |
s nextPutAll: ' this '. |
9e63ab553922
JavaNativeMethod & their implementation transformed to pass a reveiver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1985
diff
changeset
|
244 |
2 to: kw size - 1 do:[:i| |
1990
f37fb2129089
Fixed natives. Java VM boots & Groovy 1+1 works.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1986
diff
changeset
|
245 |
s nextPutAll: (kw at: i); space; nextPut:$a; nextPutAll: (i - 1) printString; space. |
2010
9bacff8c53de
The 'nativeContext' argument removed from all native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1993
diff
changeset
|
246 |
]. |
1985
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
247 |
] |
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
248 |
]. |
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
249 |
|
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
250 |
(JavaVM natives class |
761 | 251 |
compile: |
1985
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
252 |
(self nativeMethodTemplate bindWith:header with: 'nativeContext' with:('^ JavaVM unimplementedNativeMethodSignal raise')) |
761 | 253 |
classified: |
254 |
'native - ', ((javaClass javaPackage upTo:$$) replaceAll:$/ with:$.)) |
|
255 |
package: JavaVM package |
|
256 |
||
257 |
"Created: / 01-05-2011 / 00:08:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1990
f37fb2129089
Fixed natives. Java VM boots & Groovy 1+1 works.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1986
diff
changeset
|
258 |
"Modified: / 20-01-2013 / 20:56:44 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
761 | 259 |
! |
260 |
||
2019
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
261 |
installTrampoline: trampoline |
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
262 |
| l m | |
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
263 |
|
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
264 |
m := trampoline asByteCodeMethod. |
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
265 |
m ~~ trampoline ifTrue:[ |
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
266 |
"Cache it" |
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
267 |
self class methodDictionary at: trampoline selector put: m. |
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
268 |
]. |
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
269 |
l := m literals. |
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
270 |
1 to: l size do:[:i| |
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
271 |
(l at: i) == #__placeholder__ ifTrue:[ |
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
272 |
l at: i put: self. |
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
273 |
]. |
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
274 |
]. |
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
275 |
m isNil ifTrue:[ |
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
276 |
self error: 'Cannot find trampoline method'. |
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
277 |
]. |
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
278 |
self byteCode: m byteCode. |
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
279 |
self literals: l. |
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
280 |
|
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
281 |
"Created: / 31-01-2013 / 13:31:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
282 |
! |
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
283 |
|
761 | 284 |
nativeMethodTemplate |
285 |
||
286 |
^'%1 %2 |
|
287 |
||
288 |
<javanative: ''', javaClass name , ''' name: ''', (selector copyWithoutLast:signature size), '''> |
|
289 |
||
290 |
%3' |
|
291 |
||
292 |
"Created: / 01-05-2011 / 00:12:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1985
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
293 |
"Modified: / 19-01-2013 / 22:20:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
761 | 294 |
! |
295 |
||
296 |
searchNativeImplementation |
|
1986
9e63ab553922
JavaNativeMethod & their implementation transformed to pass a reveiver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1985
diff
changeset
|
297 |
<resource: #obsolete> |
761 | 298 |
|
299 |
"Returns a SELECTOR of native method implementation. |
|
300 |
For now, two naming schemes are used. The onld one uses |
|
301 |
just a class name and selector as a name for native method impl. |
|
302 |
The new one uses fully qualified class name. |
|
303 |
" |
|
304 |
||
305 |
| nm newStyleSel oldStyleSel | |
|
1986
9e63ab553922
JavaNativeMethod & their implementation transformed to pass a reveiver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1985
diff
changeset
|
306 |
|
9e63ab553922
JavaNativeMethod & their implementation transformed to pass a reveiver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1985
diff
changeset
|
307 |
self error: 'Should no longer be called!!'. |
9e63ab553922
JavaNativeMethod & their implementation transformed to pass a reveiver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1985
diff
changeset
|
308 |
|
912
e651488f5741
Many fixes in reflection, expecially for generic types support
vranyj1
parents:
877
diff
changeset
|
309 |
nm := selector upTo: $(. |
761 | 310 |
newStyleSel := ('_' , ((javaClass name copyReplaceAll:$/ with:$_) replaceAll:$$ with:$_), '_' , nm , ':') asSymbol. |
1974 | 311 |
(JavaVM natives class canUnderstand: newStyleSel) ifTrue:[ |
312 |
"Good, a JavaVM understands new style native selectors" |
|
313 |
^newStyleSel |
|
314 |
]. |
|
761 | 315 |
|
316 |
oldStyleSel := ('_' , (javaClass lastName copyReplaceAll:$$ with:$_) , '_' , nm , ':') asSymbol. |
|
1974 | 317 |
(JavaVM natives canUnderstand: oldStyleSel) ifTrue:[ |
761 | 318 |
"Convert method on the fly only if Im Jan Vrany |
319 |
(to avoid confusion of other developers :-)" |
|
320 |
OperatingSystem getLoginName = 'jv' ifTrue:[ |
|
321 |
"OK, old style method has not yet been converted to a newstyle one. |
|
322 |
Converts old-style method to a new-style one" |
|
323 |
self compileNativeImplementation: newStyleSel dispatchingTo: oldStyleSel. |
|
324 |
^newStyleSel |
|
325 |
] ifFalse:[ |
|
326 |
^oldStyleSel |
|
1974 | 327 |
] |
328 |
]. |
|
761 | 329 |
self compileNativeImplementationStub: newStyleSel. |
330 |
^newStyleSel |
|
331 |
||
332 |
"Created: / 30-04-2011 / 23:50:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1986
9e63ab553922
JavaNativeMethod & their implementation transformed to pass a reveiver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1985
diff
changeset
|
333 |
"Modified: / 19-01-2013 / 23:31:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1985
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
334 |
! |
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
335 |
|
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
336 |
searchNativeImplementation: numArgs |
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
337 |
|
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
338 |
"Returns a SELECTOR of native method implementation." |
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
339 |
|
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
340 |
|
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
341 |
| nm newStyleSel args | |
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
342 |
nm := selector upTo: $(. |
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
343 |
|
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
344 |
args := #( |
2010
9bacff8c53de
The 'nativeContext' argument removed from all native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1993
diff
changeset
|
345 |
"0" '' |
9bacff8c53de
The 'nativeContext' argument removed from all native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1993
diff
changeset
|
346 |
"1" '_:' |
9bacff8c53de
The 'nativeContext' argument removed from all native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1993
diff
changeset
|
347 |
"2" '_:_:' |
9bacff8c53de
The 'nativeContext' argument removed from all native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1993
diff
changeset
|
348 |
"3" '_:_:_:' |
9bacff8c53de
The 'nativeContext' argument removed from all native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1993
diff
changeset
|
349 |
"4" '_:_:_:_:' |
9bacff8c53de
The 'nativeContext' argument removed from all native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1993
diff
changeset
|
350 |
"5" '_:_:_:_:_:' |
9bacff8c53de
The 'nativeContext' argument removed from all native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1993
diff
changeset
|
351 |
"6" '_:_:_:_:_:_:' |
9bacff8c53de
The 'nativeContext' argument removed from all native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1993
diff
changeset
|
352 |
"7" '_:_:_:_:_:_:_:' |
9bacff8c53de
The 'nativeContext' argument removed from all native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1993
diff
changeset
|
353 |
"8" '_:_:_:_:_:_:_:_:' |
9bacff8c53de
The 'nativeContext' argument removed from all native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1993
diff
changeset
|
354 |
"9" '_:_:_:_:_:_:_:_:_:' |
9bacff8c53de
The 'nativeContext' argument removed from all native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1993
diff
changeset
|
355 |
"10" '_:_:_:_:_:_:_:_:_:_:' |
9bacff8c53de
The 'nativeContext' argument removed from all native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1993
diff
changeset
|
356 |
"11" '_:_:_:_:_:_:_:_:_:_:_:' |
9bacff8c53de
The 'nativeContext' argument removed from all native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1993
diff
changeset
|
357 |
"12" '_:_:_:_:_:_:_:_:_:_:_:_:' |
1985
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
358 |
) at: numArgs + 1. |
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
359 |
|
1986
9e63ab553922
JavaNativeMethod & their implementation transformed to pass a reveiver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1985
diff
changeset
|
360 |
newStyleSel := ('_' , ((javaClass name copyReplaceAll:$/ with:$_) replaceAll:$$ with:$_), '_' , nm , ':' , args) asSymbol. |
1985
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
361 |
(JavaVM natives class canUnderstand: newStyleSel) ifTrue:[ |
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
362 |
"Good, a JavaVM understands new style native selectors" |
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
363 |
^newStyleSel |
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
364 |
]. |
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
365 |
|
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
366 |
self compileNativeImplementationStub: newStyleSel. |
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
367 |
^newStyleSel |
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
368 |
|
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
369 |
"Created: / 19-01-2013 / 22:11:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1986
9e63ab553922
JavaNativeMethod & their implementation transformed to pass a reveiver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1985
diff
changeset
|
370 |
"Modified: / 19-01-2013 / 23:39:17 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
761 | 371 |
! ! |
372 |
||
2016
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
373 |
!JavaNativeMethod methodsFor:'private-compiler interface'! |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
374 |
|
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
375 |
numberOfArgs:aNumber |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
376 |
| sel m | |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
377 |
|
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
378 |
super numberOfArgs:aNumber. |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
379 |
|
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
380 |
(self class flags bitAnd:Behavior flagJavaMethod) ~~ 0 ifTrue:[ ^ self ]. |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
381 |
|
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
382 |
"Now, install the trampoline..." |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
383 |
sel := #( |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
384 |
"00" #trampolineUncached: |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
385 |
"01" #trampolineUncached: |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
386 |
"02" #trampolineUncached:_: |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
387 |
"03" #trampolineUncached:_:_: |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
388 |
|
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
389 |
"04" #trampolineUncached:_:_:_: |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
390 |
"05" #trampolineUncached:_:_:_:_: |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
391 |
"06" #trampolineUncached:_:_:_:_:_: |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
392 |
"07" #trampolineUncached:_:_:_:_:_:_: |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
393 |
|
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
394 |
"08" #trampolineUncached:_:_:_:_:_:_:_: |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
395 |
"09" #trampolineUncached:_:_:_:_:_:_:_:_: |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
396 |
"10" #trampolineUncached:_:_:_:_:_:_:_:_:_: |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
397 |
"11" #trampolineUncached:_:_:_:_:_:_:_:_:_:_: |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
398 |
|
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
399 |
"12" #trampolineUncached:_:_:_:_:_:_:_:_:_:_:_: |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
400 |
"13" #trampolineUncached:_:_:_:_:_:_:_:_:_:_:_:_: |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
401 |
"14" #trampolineUncached:_:_:_:_:_:_:_:_:_:_:_:_:_: |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
402 |
"15" #trampolineUncached:_:_:_:_:_:_:_:_:_:_:_:_:_:_: |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
403 |
) at: aNumber + 1. |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
404 |
|
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
405 |
m := self class compiledMethodAt: sel. |
2019
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
406 |
self installTrampoline: m. |
2016
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
407 |
|
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
408 |
"Created: / 31-01-2013 / 12:44:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
409 |
! ! |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
410 |
|
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
411 |
!JavaNativeMethod methodsFor:'private-trampolines'! |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
412 |
|
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
413 |
trampolineUncached |
2019
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
414 |
^#__placeholder__ nativeMethodInvokation: thisContext. |
2016
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
415 |
|
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
416 |
"Created: / 31-01-2013 / 12:55:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
417 |
! |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
418 |
|
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
419 |
trampolineUncached: a1 |
2019
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
420 |
^#__placeholder__ nativeMethodInvokation: thisContext. |
2016
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
421 |
|
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
422 |
"Created: / 31-01-2013 / 12:55:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
423 |
! |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
424 |
|
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
425 |
trampolineUncached: a1 _: a2 |
2019
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
426 |
^#__placeholder__ nativeMethodInvokation: thisContext. |
2016
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
427 |
|
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
428 |
"Created: / 31-01-2013 / 12:55:26 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
429 |
! |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
430 |
|
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
431 |
trampolineUncached: a1 _: a2 _: a3 |
2019
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
432 |
^#__placeholder__ nativeMethodInvokation: thisContext. |
2016
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
433 |
|
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
434 |
"Created: / 31-01-2013 / 12:55:34 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
435 |
! |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
436 |
|
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
437 |
trampolineUncached: a1 _: a2 _: a3 _: a4 |
2019
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
438 |
^#__placeholder__ nativeMethodInvokation: thisContext. |
2016
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
439 |
|
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
440 |
"Created: / 31-01-2013 / 12:55:47 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
441 |
! |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
442 |
|
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
443 |
trampolineUncached: a1 _: a2 _: a3 _: a4 _: a5 |
2019
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
444 |
^#__placeholder__ nativeMethodInvokation: thisContext. |
2016
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
445 |
|
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
446 |
"Created: / 31-01-2013 / 12:55:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
447 |
! |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
448 |
|
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
449 |
trampolineUncached: a1 _: a2 _: a3 _: a4 _: a5 _: a6 |
2019
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
450 |
^#__placeholder__ nativeMethodInvokation: thisContext. |
2016
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
451 |
|
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
452 |
"Created: / 31-01-2013 / 12:55:53 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
453 |
! |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
454 |
|
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
455 |
trampolineUncached: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 |
2019
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
456 |
^#__placeholder__ nativeMethodInvokation: thisContext. |
2016
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
457 |
|
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
458 |
"Created: / 31-01-2013 / 12:55:55 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
459 |
! |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
460 |
|
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
461 |
trampolineUncached: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8 |
2019
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
462 |
^#__placeholder__ nativeMethodInvokation: thisContext. |
2016
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
463 |
|
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
464 |
"Created: / 31-01-2013 / 12:56:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
465 |
! |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
466 |
|
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
467 |
trampolineUncached: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8 _: a9 |
2019
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
468 |
^#__placeholder__ nativeMethodInvokation: thisContext. |
2016
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
469 |
|
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
470 |
"Created: / 31-01-2013 / 12:56:03 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
471 |
! |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
472 |
|
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
473 |
trampolineUncached: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8 _: a9 _: a10 |
2019
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
474 |
^#__placeholder__ nativeMethodInvokation: thisContext. |
2016
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
475 |
|
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
476 |
"Created: / 31-01-2013 / 12:56:08 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
477 |
! |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
478 |
|
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
479 |
trampolineUncached: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8 _: a9 _: a10 _: a11 |
2019
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
480 |
^#__placeholder__ nativeMethodInvokation: thisContext. |
2016
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
481 |
|
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
482 |
"Created: / 31-01-2013 / 12:56:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
483 |
! |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
484 |
|
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
485 |
trampolineUncached: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8 _: a9 _: a10 _: a11 _: a12 |
2019
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
486 |
^#__placeholder__ nativeMethodInvokation: thisContext. |
2016
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
487 |
|
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
488 |
"Created: / 31-01-2013 / 12:56:15 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
489 |
! |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
490 |
|
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
491 |
trampolineUncached: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8 _: a9 _: a10 _: a11 _: a12 _: a13 |
2019
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
492 |
^#__placeholder__ nativeMethodInvokation: thisContext. |
2016
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
493 |
|
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
494 |
"Created: / 31-01-2013 / 12:56:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
495 |
! |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
496 |
|
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
497 |
trampolineUncached: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8 _: a9 _: a10 _: a11 _: a12 _: a13 _: a14 |
2019
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
498 |
^#__placeholder__ nativeMethodInvokation: thisContext. |
2016
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
499 |
|
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
500 |
"Created: / 31-01-2013 / 12:56:48 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
501 |
! |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
502 |
|
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
503 |
trampolineUncached: a1 _: a2 _: a3 _: a4 _: a5 _: a6 _: a7 _: a8 _: a9 _: a10 _: a11 _: a12 _: a13 _: a14 _: a15 |
2019
e1291a81f215
Finished uncached trampoline.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2016
diff
changeset
|
504 |
^#__placeholder__ nativeMethodInvokation: thisContext. |
2016
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
505 |
|
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
506 |
"Created: / 31-01-2013 / 12:56:36 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
507 |
! ! |
6afb298c7403
Added simple trampoline methods to JavaNativeMethod.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2010
diff
changeset
|
508 |
|
752 | 509 |
!JavaNativeMethod methodsFor:'vm support'! |
510 |
||
511 |
nativeMethodInvokation |
|
761 | 512 |
"Called by the VM when a native method is |
1748 | 513 |
to be executed - old (slow) implementation" |
514 |
||
515 |
^self nativeMethodInvokation: thisContext sender. |
|
516 |
||
517 |
" |
|
518 |
JavaNativeMethod flushAllCachedNativeMethods" |
|
519 |
||
520 |
"Modified: / 27-01-2000 / 13:34:53 / cg" |
|
521 |
"Modified: / 03-11-2011 / 10:47:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
522 |
"Modified: / 27-10-2012 / 15:15:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
523 |
! |
|
524 |
||
525 |
nativeMethodInvokation: context |
|
526 |
"Called by the VM when a native method is |
|
527 |
to be executed. |
|
528 |
||
529 |
'context' is the context of being-invoked native method" |
|
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1022
diff
changeset
|
530 |
|
1986
9e63ab553922
JavaNativeMethod & their implementation transformed to pass a reveiver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1985
diff
changeset
|
531 |
| sel mthd sender nArgs receiverAndArgsAndContext | |
1749 | 532 |
nCalls := (nCalls ? 0) + 1. |
2010
9bacff8c53de
The 'nativeContext' argument removed from all native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1993
diff
changeset
|
533 |
receiverAndArgsAndContext := Array new: (nArgs := context numArgs) + 1"receiver". |
1993
6cb676a913a8
Native methods now use arguments instead of fetching them from context.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1990
diff
changeset
|
534 |
receiverAndArgsAndContext replaceFrom:2 to:1 + nArgs with: context startingAt: context arg1Index. |
1986
9e63ab553922
JavaNativeMethod & their implementation transformed to pass a reveiver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1985
diff
changeset
|
535 |
receiverAndArgsAndContext at: 1 put: context receiver. |
2010
9bacff8c53de
The 'nativeContext' argument removed from all native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1993
diff
changeset
|
536 |
|
1985
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
537 |
|
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
538 |
|
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1022
diff
changeset
|
539 |
(mthd := nativeImplementation) isNil ifTrue: [ |
1985
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
540 |
sel := self searchNativeImplementation: nArgs. |
1971
e75c1790521c
Java native implementation refactoring (phase 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1864
diff
changeset
|
541 |
mthd := (JavaVM natives class compiledMethodAt: sel). |
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1022
diff
changeset
|
542 |
(mthd isNil or: [ mthd isLazyMethod ]) ifTrue: [ |
1748 | 543 |
sender := context. |
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1022
diff
changeset
|
544 |
sender sender selector == #noByteCode ifTrue: [ |
752 | 545 |
sender := sender sender. |
546 |
sender := sender sender. |
|
547 |
sender := sender sender. |
|
548 |
]. |
|
1986
9e63ab553922
JavaNativeMethod & their implementation transformed to pass a reveiver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1985
diff
changeset
|
549 |
^ JavaVM natives perform: sel withArguments: receiverAndArgsAndContext |
752 | 550 |
]. |
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1022
diff
changeset
|
551 |
CacheNativeImplementation ifTrue: [ nativeImplementation := mthd. ] |
752 | 552 |
]. |
1075
927aeb3649fc
Fix in native method imp -> class loading java tests all pass.. I'm getting drunk tonight :)
hlopkmar
parents:
1073
diff
changeset
|
553 |
Verbose ifTrue: [Logger log: 'Native method invokation: ' , sel severity: #debug facility: #JVM]. |
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1022
diff
changeset
|
554 |
^ mthd |
1971
e75c1790521c
Java native implementation refactoring (phase 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1864
diff
changeset
|
555 |
valueWithReceiver: JavaVM natives |
1986
9e63ab553922
JavaNativeMethod & their implementation transformed to pass a reveiver.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1985
diff
changeset
|
556 |
arguments: receiverAndArgsAndContext |
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1022
diff
changeset
|
557 |
selector: selector |
1971
e75c1790521c
Java native implementation refactoring (phase 1)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1864
diff
changeset
|
558 |
search: JavaVM natives class |
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1022
diff
changeset
|
559 |
sender: nil |
752 | 560 |
|
1073
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1022
diff
changeset
|
561 |
" |
e842ab17fe16
quite big class loaders rewrite.. javavm/groovy boots, almost all tests pass.. hope you will like it..
hlopkmar
parents:
1022
diff
changeset
|
562 |
JavaNativeMethod flushAllCachedNativeMethods" |
752 | 563 |
|
1748 | 564 |
"Created: / 27-10-2012 / 15:13:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1993
6cb676a913a8
Native methods now use arguments instead of fetching them from context.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1990
diff
changeset
|
565 |
"Modified: / 21-01-2013 / 17:35:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 566 |
! ! |
567 |
||
568 |
!JavaNativeMethod class methodsFor:'documentation'! |
|
569 |
||
570 |
version |
|
1864 | 571 |
^ '$Header$' |
572 |
! |
|
573 |
||
574 |
version_HG |
|
575 |
||
576 |
^ '$Changeset: <not expanded> $' |
|
752 | 577 |
! |
578 |
||
579 |
version_SVN |
|
1864 | 580 |
^ '§Id§' |
923 | 581 |
|
752 | 582 |
! ! |
583 |
||
1985
7c5a14d663ba
Temporary commit. JavaNativeMethod refactored to use new-style native methods.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1974
diff
changeset
|
584 |
|
752 | 585 |
JavaNativeMethod initialize! |