author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Mon, 02 Mar 2015 17:50:49 +0100 | |
branch | cvs_MAIN |
changeset 3386 | ddcff50a1fdc |
parent 3360 | 1a8899091305 |
parent 3384 | 98eb8443f4f4 |
child 3412 | df11bb428463 |
permissions | -rw-r--r-- |
3384
98eb8443f4f4
Use new Logger API (use Logger severityXXX instead of symbols)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3325
diff
changeset
|
1 |
"{ Encoding: utf8 }" |
98eb8443f4f4
Use new Logger API (use Logger severityXXX instead of symbols)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3325
diff
changeset
|
2 |
|
2151 | 3 |
" |
3324
a58245c0e83a
Updated copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3213
diff
changeset
|
4 |
COPYRIGHT (c) 1996-2015 by Claus Gittinger |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
5 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
6 |
New code and modifications done at SWING Research Group [1]: |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
7 |
|
3324
a58245c0e83a
Updated copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3213
diff
changeset
|
8 |
COPYRIGHT (c) 2010-2015 by Jan Vrany, Jan Kurs and Marcel Hlopko |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
9 |
SWING Research Group, Czech Technical University in Prague |
2151 | 10 |
|
11 |
This software is furnished under a license and may be used |
|
12 |
only in accordance with the terms of that license and with the |
|
13 |
inclusion of the above copyright notice. This software may not |
|
14 |
be provided or otherwise made available to, or used by, any |
|
15 |
other person. No title to or ownership of the software is |
|
16 |
hereby transferred. |
|
17 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
18 |
[1] Code written at SWING Research Group contains a signature |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
19 |
of one of the above copright owners. For exact set of such code, |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
20 |
see the differences between this version and version stx:libjava |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
21 |
as of 1.9.2010 |
2151 | 22 |
" |
703 | 23 |
"{ Package: 'stx:libjava' }" |
24 |
||
3325
d9297d724fa0
Fix for D116331: Do not write to a changefile when compiling new native method
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3324
diff
changeset
|
25 |
"{ NameSpace: Smalltalk }" |
d9297d724fa0
Fix for D116331: Do not write to a changefile when compiling new native method
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3324
diff
changeset
|
26 |
|
2426 | 27 |
JavaMethodWithHandler variableSubclass:#JavaNativeMethod |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
28 |
instanceVariableNames:'nativeImplementation nCalls' |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
29 |
classVariableNames:'CacheNativeImplementation Verbose TrampolineSelectors' |
611 | 30 |
poolDictionaries:'' |
2107 | 31 |
category:'Languages-Java-Classes' |
611 | 32 |
! |
33 |
||
2151 | 34 |
!JavaNativeMethod class methodsFor:'documentation'! |
35 |
||
36 |
copyright |
|
37 |
" |
|
3324
a58245c0e83a
Updated copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3213
diff
changeset
|
38 |
COPYRIGHT (c) 1996-2015 by Claus Gittinger |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
39 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
40 |
New code and modifications done at SWING Research Group [1]: |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
41 |
|
3324
a58245c0e83a
Updated copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3213
diff
changeset
|
42 |
COPYRIGHT (c) 2010-2015 by Jan Vrany, Jan Kurs and Marcel Hlopko |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
43 |
SWING Research Group, Czech Technical University in Prague |
2151 | 44 |
|
45 |
This software is furnished under a license and may be used |
|
46 |
only in accordance with the terms of that license and with the |
|
47 |
inclusion of the above copyright notice. This software may not |
|
48 |
be provided or otherwise made available to, or used by, any |
|
49 |
other person. No title to or ownership of the software is |
|
50 |
hereby transferred. |
|
51 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
52 |
[1] Code written at SWING Research Group contains a signature |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
53 |
of one of the above copright owners. For exact set of such code, |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
54 |
see the differences between this version and version stx:libjava |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
55 |
as of 1.9.2010 |
2151 | 56 |
|
57 |
" |
|
58 |
! ! |
|
642 | 59 |
|
616 | 60 |
!JavaNativeMethod class methodsFor:'initialization'! |
61 |
||
2151 | 62 |
cacheNativeImplementation |
63 |
||
64 |
"For details, see #cacheNativeImplementation:" |
|
65 |
||
66 |
^CacheNativeImplementation |
|
67 |
||
68 |
"Created: / 30-04-2011 / 23:38:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
69 |
! |
|
70 |
||
71 |
cacheNativeImplementation: aBoolean |
|
72 |
||
73 |
"If set, native implementations are cached, resulting |
|
74 |
in better performance when calling native methods. |
|
75 |
Hower, no change in native method implemenetaion will |
|
76 |
not be visible then, unless #flushAllCachedNativeMethods |
|
77 |
is explictely called" |
|
78 |
||
79 |
CacheNativeImplementation := aBoolean |
|
80 |
||
81 |
"Created: / 30-04-2011 / 23:38:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
82 |
! |
|
83 |
||
616 | 84 |
initialize |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
85 |
"/self flags: ((self flags bitClear: Behavior flagMethod) bitOr: Behavior flagJavaMethod). |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
86 |
self flags: ((self flags bitClear: Behavior flagJavaMethod) bitOr: Behavior flagMethod). |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
87 |
" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
88 |
self flags bitAnd: Behavior flagJavaMethod |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
89 |
self flags bitAnd: Behavior flagMethod |
2151 | 90 |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
91 |
" |
2151 | 92 |
"By default, do not cache native impls while developing" |
93 |
CacheNativeImplementation := Smalltalk isStandAloneApp. |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
94 |
Verbose := false. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
95 |
" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
96 |
Verbose := true. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
97 |
" |
2151 | 98 |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
99 |
TrampolineSelectors := #( |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
100 |
"/0 |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
101 |
#trampoline: |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
102 |
#trampoline:_: |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
103 |
#trampoline:_:_: |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
104 |
#trampoline:_:_:_: |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
105 |
"/4 |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
106 |
#trampoline:_:_:_: |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
107 |
#trampoline:_:_:_:_: |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
108 |
#trampoline:_:_:_:_:_: |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
109 |
#trampoline:_:_:_:_:_:_: |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
110 |
"/8 |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
111 |
#trampoline:_:_:_:_:_:_: |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
112 |
#trampoline:_:_:_:_:_:_:_: |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
113 |
#trampoline:_:_:_:_:_:_:_:_: |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
114 |
#trampoline:_:_:_:_:_:_:_:_:_: |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
115 |
"/13 |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
116 |
#trampoline:_:_:_:_:_:_:_:_:_: |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
117 |
#trampoline:_:_:_:_:_:_:_:_:_:_: |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
118 |
#trampoline:_:_:_:_:_:_:_:_:_:_:_: |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
119 |
#trampoline:_:_:_:_:_:_:_:_:_:_:_:_: |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
120 |
). |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
121 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
122 |
"Modified (comment): / 03-11-2011 / 10:48:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
123 |
"Modified: / 31-01-2013 / 14:40:58 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
124 |
! ! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
125 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
126 |
!JavaNativeMethod class methodsFor:'instance creation'! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
127 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
128 |
new |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
129 |
"Redefined again, since since trampoline methods need |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
130 |
literals" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
131 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
132 |
^ self basicNew:1. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
133 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
134 |
"Created: / 31-01-2013 / 13:26:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
616 | 135 |
! ! |
136 |
||
654 | 137 |
!JavaNativeMethod class methodsFor:'cleanup'! |
138 |
||
139 |
flushAllCachedNativeMethods |
|
140 |
self allInstancesDo:[:aNativeMethod | |
|
141 |
aNativeMethod nativeImplementation:nil |
|
142 |
]. |
|
143 |
||
144 |
" |
|
145 |
self flushAllCachedNativeMethods |
|
146 |
" |
|
147 |
||
148 |
"Created: / 24.12.1999 / 03:10:38 / cg" |
|
149 |
"Modified: / 24.12.1999 / 03:10:51 / cg" |
|
150 |
! ! |
|
151 |
||
2435
915b234397f0
Don't compile native method stub when native implementatio is not initialized.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2426
diff
changeset
|
152 |
!JavaNativeMethod class methodsFor:'others'! |
915b234397f0
Don't compile native method stub when native implementatio is not initialized.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2426
diff
changeset
|
153 |
|
915b234397f0
Don't compile native method stub when native implementatio is not initialized.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2426
diff
changeset
|
154 |
version_HG |
915b234397f0
Don't compile native method stub when native implementatio is not initialized.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2426
diff
changeset
|
155 |
|
2678
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
156 |
^ '$Changeset: <not expanded> $' |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
157 |
! ! |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
158 |
|
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
159 |
!JavaNativeMethod methodsFor:'* As yet uncategorized *'! |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
160 |
|
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
161 |
messagesSentToSuper |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
162 |
^#() |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
163 |
|
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
164 |
"Created: / 30-03-2013 / 09:58:38 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2435
915b234397f0
Don't compile native method stub when native implementatio is not initialized.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2426
diff
changeset
|
165 |
! ! |
915b234397f0
Don't compile native method stub when native implementatio is not initialized.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2426
diff
changeset
|
166 |
|
611 | 167 |
!JavaNativeMethod methodsFor:'accessing'! |
168 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
169 |
nCalls |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
170 |
^ nCalls ? 0 |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
171 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
172 |
"Modified: / 27-10-2012 / 18:05:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
173 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
174 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
175 |
nCallsReset |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
176 |
nCalls := 0 |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
177 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
178 |
"Modified: / 27-10-2012 / 18:05:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
179 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
180 |
|
611 | 181 |
nativeImplementation |
182 |
"return the value of the instance variable 'nativeImplementation' (automatically generated)" |
|
183 |
||
184 |
^ nativeImplementation |
|
185 |
||
186 |
"Created: / 25.9.1999 / 23:08:00 / cg" |
|
187 |
! |
|
188 |
||
189 |
nativeImplementation:something |
|
190 |
"set the value of the instance variable 'nativeImplementation' (automatically generated)" |
|
191 |
||
192 |
nativeImplementation := something. |
|
193 |
||
194 |
"Created: / 25.9.1999 / 23:08:00 / cg" |
|
2151 | 195 |
! |
196 |
||
197 |
sourceLineNumber |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
198 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
199 |
^super sourceLineNumber |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
200 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
201 |
"/ ForceByteCodeDisplay == true ifTrue:[ ^ 1]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
202 |
"/ lineNumberTable notNil ifTrue:[ ^ lineNumberTable at:2]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
203 |
"/ ^1 |
2151 | 204 |
|
205 |
||
206 |
" |
|
207 |
^ (JavaSourceCodeCache new) |
|
208 |
findLineForMethod:(self selector) |
|
209 |
inClass:javaClass. |
|
210 |
" |
|
211 |
||
212 |
"Modified: / 13-12-2010 / 13:55:55 / Jan Kurs <kurs.jan@post.cz>" |
|
213 |
"Modified: / 13-12-2010 / 23:46:30 / Marcel Hlopko <hlopik@gmail.com>" |
|
214 |
"Created: / 17-12-2010 / 10:34:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
215 |
! ! |
|
216 |
||
217 |
!JavaNativeMethod methodsFor:'private'! |
|
218 |
||
3196
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
219 |
compileNativeImplementation:sel dispatchingTo:oldSel |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
220 |
| src arg converted header | |
2151 | 221 |
|
3196
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
222 |
src := (JavaVM class compiledMethodAt:oldSel) source. |
2151 | 223 |
src := src asStringCollection. |
3196
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
224 |
(src first includesString:'aJavaContext') ifTrue:[ |
2151 | 225 |
arg := 'aJavaContext' |
226 |
] ifFalse:[ |
|
3196
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
227 |
(src first includesString:'nativeContext') ifTrue:[ |
2151 | 228 |
arg := 'nativeContext' |
229 |
] |
|
230 |
]. |
|
3196
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
231 |
arg isNil ifTrue:[ |
2151 | 232 |
arg := 'nativeContext'. |
233 |
src := ' self breakPoint: #jv info: ''Convert it to new-style natives''. |
|
234 |
||
3196
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
235 |
^ self ' |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
236 |
, oldSel , ' nativeContext'. |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
237 |
converted := false. |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
238 |
] ifFalse:[ |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
239 |
src removeFirst asString. |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
240 |
converted := true. |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
241 |
]. |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
242 |
header := String |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
243 |
streamContents:[:s | |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
244 |
sel numArgs == 2 ifTrue:[ |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
245 |
s |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
246 |
nextPutAll:sel; |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
247 |
space; |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
248 |
nextPutAll:'this '. |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
249 |
] ifFalse:[ |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
250 |
| kw | |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
251 |
|
3196
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
252 |
kw := sel keywords. |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
253 |
s nextPutAll:kw first. |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
254 |
s nextPutAll:' this '. |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
255 |
2 to:kw size - 1 do:[:i | |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
256 |
sel |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
257 |
nextPutAll:(kw at:i); |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
258 |
space; |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
259 |
nextPut:$a; |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
260 |
nextPutAll:i printString; |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
261 |
space. |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
262 |
]. |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
263 |
] |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
264 |
]. |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
265 |
(JavaVM class compile:(self nativeMethodTemplate |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
266 |
bindWith:header |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
267 |
with:arg |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
268 |
with:src asString) |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
269 |
classified:'native - ' |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
270 |
, ((javaClass javaPackage upTo:$$) replaceAll:$/ with:$.)) |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
271 |
package:JavaVM package. |
2151 | 272 |
converted ifTrue:[ |
3196
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
273 |
(JavaVM class compiledMethodAt:oldSel) |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
274 |
category:'native - old-style (converted)' |
2151 | 275 |
] ifFalse:[ |
3196
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
276 |
(JavaVM class compiledMethodAt:oldSel) |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
277 |
category:'native - old-style (FAILED to convert)' |
2151 | 278 |
] |
279 |
||
280 |
"Created: / 01-05-2011 / 00:08:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3196
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
281 |
"Modified: / 04-08-2014 / 15:51:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2151 | 282 |
! |
283 |
||
284 |
compileNativeImplementationStub: sel |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
285 |
| header | |
2151 | 286 |
|
2435
915b234397f0
Don't compile native method stub when native implementatio is not initialized.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2426
diff
changeset
|
287 |
"/No natives, no fun... |
915b234397f0
Don't compile native method stub when native implementatio is not initialized.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2426
diff
changeset
|
288 |
JavaVM natives isNil ifTrue:[ ^ self ]. |
915b234397f0
Don't compile native method stub when native implementatio is not initialized.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2426
diff
changeset
|
289 |
|
915b234397f0
Don't compile native method stub when native implementatio is not initialized.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2426
diff
changeset
|
290 |
header := String streamContents:[:s| |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
291 |
| kw | |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
292 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
293 |
kw := sel keywords. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
294 |
s nextPutAll: kw first. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
295 |
s nextPutAll: ' this '. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
296 |
2 to: kw size do:[:i| |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
297 |
s nextPutAll: (kw at: i); space; nextPut:$a; nextPutAll: (i - 1) printString; space. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
298 |
]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
299 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
300 |
]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
301 |
|
3325
d9297d724fa0
Fix for D116331: Do not write to a changefile when compiling new native method
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3324
diff
changeset
|
302 |
Class updateChangeFileQuerySignal answer: false do:[ |
d9297d724fa0
Fix for D116331: Do not write to a changefile when compiling new native method
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3324
diff
changeset
|
303 |
(JavaVM natives class |
d9297d724fa0
Fix for D116331: Do not write to a changefile when compiling new native method
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3324
diff
changeset
|
304 |
compile: |
d9297d724fa0
Fix for D116331: Do not write to a changefile when compiling new native method
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3324
diff
changeset
|
305 |
(self nativeMethodTemplate bindWith:header with: 'nativeContext' with:('^ JavaVM unimplementedNativeMethodSignal raise')) |
d9297d724fa0
Fix for D116331: Do not write to a changefile when compiling new native method
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3324
diff
changeset
|
306 |
classified: |
d9297d724fa0
Fix for D116331: Do not write to a changefile when compiling new native method
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3324
diff
changeset
|
307 |
'native - ', ((javaClass javaPackage upTo:$$) replaceAll:$/ with:$.)) |
d9297d724fa0
Fix for D116331: Do not write to a changefile when compiling new native method
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3324
diff
changeset
|
308 |
package: JavaVM package. |
d9297d724fa0
Fix for D116331: Do not write to a changefile when compiling new native method
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3324
diff
changeset
|
309 |
]. |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
310 |
self assert: (JavaVM natives respondsTo: sel). |
2151 | 311 |
|
312 |
"Created: / 01-05-2011 / 00:08:59 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3325
d9297d724fa0
Fix for D116331: Do not write to a changefile when compiling new native method
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3324
diff
changeset
|
313 |
"Modified: / 06-01-2015 / 09:14:57 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
314 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
315 |
|
2151 | 316 |
nativeMethodTemplate |
317 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
318 |
^'%1 |
2151 | 319 |
|
2556
31d0c6fa875f
Changed usage of deprecated #copyWithoutLast: to #copyButLast:
Stefan Vogel <sv@exept.de>
parents:
2435
diff
changeset
|
320 |
<javanative: ''', javaClass name , ''' name: ''', (selector copyButLast:signature size), '''> |
2151 | 321 |
|
322 |
%3' |
|
323 |
||
324 |
"Created: / 01-05-2011 / 00:12:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
325 |
"Modified: / 31-01-2013 / 15:07:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2151 | 326 |
! |
327 |
||
328 |
searchNativeImplementation |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
329 |
<resource: #obsolete> |
2151 | 330 |
|
331 |
"Returns a SELECTOR of native method implementation. |
|
332 |
For now, two naming schemes are used. The onld one uses |
|
333 |
just a class name and selector as a name for native method impl. |
|
334 |
The new one uses fully qualified class name. |
|
335 |
" |
|
336 |
||
337 |
| nm newStyleSel oldStyleSel | |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
338 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
339 |
self error: 'Should no longer be called!!'. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
340 |
|
2151 | 341 |
nm := selector upTo: $(. |
342 |
newStyleSel := ('_' , ((javaClass name copyReplaceAll:$/ with:$_) replaceAll:$$ with:$_), '_' , nm , ':') asSymbol. |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
343 |
(JavaVM natives class canUnderstand: newStyleSel) ifTrue:[ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
344 |
"Good, a JavaVM understands new style native selectors" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
345 |
^newStyleSel |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
346 |
]. |
2151 | 347 |
|
348 |
oldStyleSel := ('_' , (javaClass lastName copyReplaceAll:$$ with:$_) , '_' , nm , ':') asSymbol. |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
349 |
(JavaVM natives canUnderstand: oldStyleSel) ifTrue:[ |
2151 | 350 |
"Convert method on the fly only if Im Jan Vrany |
351 |
(to avoid confusion of other developers :-)" |
|
352 |
OperatingSystem getLoginName = 'jv' ifTrue:[ |
|
353 |
"OK, old style method has not yet been converted to a newstyle one. |
|
354 |
Converts old-style method to a new-style one" |
|
355 |
self compileNativeImplementation: newStyleSel dispatchingTo: oldStyleSel. |
|
356 |
^newStyleSel |
|
357 |
] ifFalse:[ |
|
358 |
^oldStyleSel |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
359 |
] |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
360 |
]. |
2151 | 361 |
self compileNativeImplementationStub: newStyleSel. |
362 |
^newStyleSel |
|
363 |
||
364 |
"Created: / 30-04-2011 / 23:50:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
365 |
"Modified: / 19-01-2013 / 23:31:20 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
366 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
367 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
368 |
searchNativeImplementation: numArgs |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
369 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
370 |
"Returns a SELECTOR of native method implementation." |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
371 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
372 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
373 |
| nm newStyleSel args | |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
374 |
nm := selector upTo: $(. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
375 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
376 |
numArgs > 14 ifTrue:[ ^ nil ]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
377 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
378 |
args := #( |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
379 |
"0" '' |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
380 |
"1" '_:' |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
381 |
"2" '_:_:' |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
382 |
"3" '_:_:_:' |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
383 |
"4" '_:_:_:_:' |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
384 |
"5" '_:_:_:_:_:' |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
385 |
"6" '_:_:_:_:_:_:' |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
386 |
"7" '_:_:_:_:_:_:_:' |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
387 |
"8" '_:_:_:_:_:_:_:_:' |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
388 |
"9" '_:_:_:_:_:_:_:_:_:' |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
389 |
"10" '_:_:_:_:_:_:_:_:_:_:' |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
390 |
"11" '_:_:_:_:_:_:_:_:_:_:_:' |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
391 |
"12" '_:_:_:_:_:_:_:_:_:_:_:_:' |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
392 |
"13" '_:_:_:_:_:_:_:_:_:_:_:_:_:' |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
393 |
"14" '_:_:_:_:_:_:_:_:_:_:_:_:_:_:' |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
394 |
) at: numArgs + 1. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
395 |
|
2841
6fa1bcf9c997
JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2731
diff
changeset
|
396 |
newStyleSel := ('_' , ((javaClass binaryName copyReplaceAll:$/ with:$_) replaceAll:$$ with:$_), '_' , nm , ':' , args) asSymbol. |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
397 |
(JavaVM natives class canUnderstand: newStyleSel) ifTrue:[ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
398 |
"Good, a JavaVM understands new style native selectors" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
399 |
"No checke whether the descriptor is the same." |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
400 |
| m a | |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
401 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
402 |
m := JavaVM natives class lookupMethodFor: newStyleSel. |
2678
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
403 |
m isWrapped ifTrue:[ m := m originalMethod ]. |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
404 |
a := m annotationsAt: #javanative:name:. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
405 |
a do:[:each| |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
406 |
each arguments second = selector ifTrue:[ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
407 |
^newStyleSel |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
408 |
]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
409 |
]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
410 |
m mclass == JavaVM natives class ifTrue:[ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
411 |
self breakPoint: #jv. "/no descriptor annotation!!!!!!" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
412 |
^newStyleSel. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
413 |
]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
414 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
415 |
]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
416 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
417 |
self compileNativeImplementationStub: newStyleSel. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
418 |
^newStyleSel |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
419 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
420 |
"Created: / 19-01-2013 / 22:11:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2841
6fa1bcf9c997
JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2731
diff
changeset
|
421 |
"Modified: / 09-10-2013 / 01:43:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
422 |
! ! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
423 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
424 |
!JavaNativeMethod methodsFor:'private-compiler interface'! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
425 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
426 |
numberOfArgs:aNumber |
2678
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
427 |
| args sendTree trampolineTree compiler trampoline | |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
428 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
429 |
super numberOfArgs:aNumber. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
430 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
431 |
aNumber > 14 ifTrue:[ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
432 |
^self. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
433 |
]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
434 |
(self class flags bitAnd:Behavior flagJavaMethod) ~~ 0 ifTrue:[ ^ self ]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
435 |
javaClass isNil ifTrue:[ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
436 |
self error: 'Cannot install trampoline - no Java class yet'. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
437 |
^self. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
438 |
]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
439 |
selector isNil ifTrue:[ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
440 |
self error: 'Cannot install trampoline - no selector yet'. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
441 |
^self. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
442 |
]. |
2678
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
443 |
|
2426 | 444 |
MethodNode isNil ifTrue:[ |
445 |
self error: 'Cannot install trampoline - no MethodNode class'. |
|
446 |
^self. |
|
447 |
]. |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
448 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
449 |
"Create the trampoline" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
450 |
args := (1 to: aNumber) collect:[:i|(VariableNode methodArgumentNamed: ('arg_' , i printString)) index: i]. |
2678
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
451 |
|
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
452 |
sendTree := MessageNode |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
453 |
receiver: (VariableNode globalNamed:#'JavaVM:NativeMethodsImplementation') |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
454 |
selector: (self searchNativeImplementation: aNumber) |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
455 |
args: (Array with: (SelfNode value: #self)) , args. |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
456 |
self isSynchronized ifTrue:[ |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
457 |
sendTree := |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
458 |
MessageNode |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
459 |
receiver: ((BlockNode |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
460 |
arguments: #() |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
461 |
home: nil |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
462 |
variables: #()) |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
463 |
statements: ( |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
464 |
(StatementNode expression: |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
465 |
(MessageNode |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
466 |
receiver: (VariableNode globalNamed:#'JavaVM') |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
467 |
selector: #monitorEnter:in: |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
468 |
args: (Array with: (SelfNode value: #self) with: (VariableNode type: #ThisContext name: #thisContext) ))) |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
469 |
nextStatement: (StatementNode expression:sendTree) |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
470 |
) |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
471 |
) |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
472 |
|
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
473 |
selector: #ensure: |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
474 |
args: { |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
475 |
(BlockNode |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
476 |
arguments: #() |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
477 |
home: nil |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
478 |
variables: #()) |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
479 |
statements: |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
480 |
(StatementNode expression: |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
481 |
(MessageNode |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
482 |
receiver: (VariableNode globalNamed:#'JavaVM') |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
483 |
selector: #monitorExit:in: |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
484 |
args: (Array with: (SelfNode value: #self) with: (VariableNode type: #ThisContext name: #thisContext)) |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
485 |
) |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
486 |
) |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
487 |
|
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
488 |
} |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
489 |
]. |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
490 |
trampolineTree := MethodNode new |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
491 |
arguments: args; |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
492 |
selector: (TrampolineSelectors at: aNumber + 1); |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
493 |
statements: |
2678
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
494 |
{ (ReturnNode expression: sendTree) }; |
2435
915b234397f0
Don't compile native method stub when native implementatio is not initialized.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2426
diff
changeset
|
495 |
yourself. |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
496 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
497 |
compiler := ByteCodeCompiler new. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
498 |
compiler methodClass: Method. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
499 |
trampoline := compiler |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
500 |
compileTree: trampolineTree |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
501 |
forClass: javaClass |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
502 |
ifFail:[self error: 'Failed to compile tampoline']. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
503 |
"Install the trampoline" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
504 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
505 |
self byteCode: trampoline byteCode. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
506 |
self literals: trampoline literals. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
507 |
|
2678
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
508 |
%{ |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
509 |
/* Now, try to bind to C-optimized native method */ |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
510 |
__jbindnative(self); |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
511 |
%}. |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
512 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
513 |
|
2678
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
514 |
"Created: / 31-01-2013 / 12:44:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
515 |
"Modified: / 10-03-2013 / 01:39:49 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
611 | 516 |
! ! |
517 |
||
3213
d3094b384e55
Fix in JavaNativeMethod: compute line number by searching the source.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3196
diff
changeset
|
518 |
!JavaNativeMethod methodsFor:'queries'! |
d3094b384e55
Fix in JavaNativeMethod: compute line number by searching the source.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3196
diff
changeset
|
519 |
|
d3094b384e55
Fix in JavaNativeMethod: compute line number by searching the source.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3196
diff
changeset
|
520 |
lineNumberForPC0: pc |
d3094b384e55
Fix in JavaNativeMethod: compute line number by searching the source.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3196
diff
changeset
|
521 |
| src name lineNumber | |
d3094b384e55
Fix in JavaNativeMethod: compute line number by searching the source.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3196
diff
changeset
|
522 |
|
d3094b384e55
Fix in JavaNativeMethod: compute line number by searching the source.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3196
diff
changeset
|
523 |
src := javaClass source. |
d3094b384e55
Fix in JavaNativeMethod: compute line number by searching the source.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3196
diff
changeset
|
524 |
src notNil ifTrue:[ |
d3094b384e55
Fix in JavaNativeMethod: compute line number by searching the source.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3196
diff
changeset
|
525 |
name := self name. |
d3094b384e55
Fix in JavaNativeMethod: compute line number by searching the source.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3196
diff
changeset
|
526 |
src asStringCollection withIndexDo:[:l :lno| |
d3094b384e55
Fix in JavaNativeMethod: compute line number by searching the source.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3196
diff
changeset
|
527 |
((l includesString: 'native') and:[l includesString: name]) ifTrue:[ |
d3094b384e55
Fix in JavaNativeMethod: compute line number by searching the source.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3196
diff
changeset
|
528 |
lineNumber := lno. |
d3094b384e55
Fix in JavaNativeMethod: compute line number by searching the source.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3196
diff
changeset
|
529 |
^ lineNumber |
d3094b384e55
Fix in JavaNativeMethod: compute line number by searching the source.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3196
diff
changeset
|
530 |
]. |
d3094b384e55
Fix in JavaNativeMethod: compute line number by searching the source.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3196
diff
changeset
|
531 |
]. |
d3094b384e55
Fix in JavaNativeMethod: compute line number by searching the source.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3196
diff
changeset
|
532 |
]. |
d3094b384e55
Fix in JavaNativeMethod: compute line number by searching the source.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3196
diff
changeset
|
533 |
lineNumber := 1. |
d3094b384e55
Fix in JavaNativeMethod: compute line number by searching the source.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3196
diff
changeset
|
534 |
^ lineNumber |
d3094b384e55
Fix in JavaNativeMethod: compute line number by searching the source.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3196
diff
changeset
|
535 |
|
d3094b384e55
Fix in JavaNativeMethod: compute line number by searching the source.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3196
diff
changeset
|
536 |
"Created: / 08-08-2014 / 07:30:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
d3094b384e55
Fix in JavaNativeMethod: compute line number by searching the source.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3196
diff
changeset
|
537 |
! ! |
d3094b384e55
Fix in JavaNativeMethod: compute line number by searching the source.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3196
diff
changeset
|
538 |
|
611 | 539 |
!JavaNativeMethod methodsFor:'vm support'! |
540 |
||
541 |
nativeMethodInvokation |
|
2151 | 542 |
"Called by the VM when a native method is |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
543 |
to be executed - old (slow) implementation" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
544 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
545 |
^self nativeMethodInvokation: thisContext sender. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
546 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
547 |
" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
548 |
JavaNativeMethod flushAllCachedNativeMethods" |
2151 | 549 |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
550 |
"Modified: / 27-01-2000 / 13:34:53 / cg" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
551 |
"Modified: / 03-11-2011 / 10:47:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
552 |
"Modified: / 27-10-2012 / 15:15:54 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
553 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
554 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
555 |
nativeMethodInvokation: context |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
556 |
"Called by the VM when a native method is |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
557 |
to be executed. |
611 | 558 |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
559 |
'context' is the context of being-invoked native method" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
560 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
561 |
| sel mthd sender nArgs receiverAndArgsAndContext | |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
562 |
nCalls := (nCalls ? 0) + 1. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
563 |
receiverAndArgsAndContext := Array new: (nArgs := context numArgs) + 1"receiver". |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
564 |
receiverAndArgsAndContext replaceFrom:2 to:1 + nArgs with: context startingAt: context arg1Index. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
565 |
receiverAndArgsAndContext at: 1 put: context receiver. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
566 |
|
611 | 567 |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
568 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
569 |
(mthd := nativeImplementation) isNil ifTrue: [ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
570 |
sel := self searchNativeImplementation: nArgs. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
571 |
mthd := (JavaVM natives class compiledMethodAt: sel). |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
572 |
(mthd isNil or: [ mthd isLazyMethod ]) ifTrue: [ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
573 |
sender := context. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
574 |
sender sender selector == #noByteCode ifTrue: [ |
660 | 575 |
sender := sender sender. |
663 | 576 |
sender := sender sender. |
577 |
sender := sender sender. |
|
660 | 578 |
]. |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
579 |
^ JavaVM natives perform: sel withArguments: receiverAndArgsAndContext |
642 | 580 |
]. |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
581 |
CacheNativeImplementation ifTrue: [ nativeImplementation := mthd. ] |
611 | 582 |
]. |
3384
98eb8443f4f4
Use new Logger API (use Logger severityXXX instead of symbols)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3325
diff
changeset
|
583 |
Verbose ifTrue: [Logger log: 'Native method invokation: ' , sel severity: Logger severityDEBUG facility: #JVM]. |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
584 |
^ mthd |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
585 |
valueWithReceiver: JavaVM natives |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
586 |
arguments: receiverAndArgsAndContext |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
587 |
selector: selector |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
588 |
search: JavaVM natives class |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
589 |
sender: nil |
611 | 590 |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
591 |
" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
592 |
JavaNativeMethod flushAllCachedNativeMethods" |
611 | 593 |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
594 |
"Created: / 27-10-2012 / 15:13:35 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
3384
98eb8443f4f4
Use new Logger API (use Logger severityXXX instead of symbols)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3325
diff
changeset
|
595 |
"Modified: / 02-03-2015 / 14:06:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
611 | 596 |
! ! |
597 |
||
598 |
!JavaNativeMethod class methodsFor:'documentation'! |
|
599 |
||
600 |
version |
|
3386
ddcff50a1fdc
Merged with mercurial revision 58d72cc6d5f (3 changesets total)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
601 |
^ '$Header: /cvs/stx/stx/libjava/JavaNativeMethod.st,v 1.19 2015-03-02 16:50:49 vrany Exp $' |
2198 | 602 |
! |
603 |
||
604 |
version_CVS |
|
3386
ddcff50a1fdc
Merged with mercurial revision 58d72cc6d5f (3 changesets total)
Jan Vrany <jan.vrany@fit.cvut.cz>
diff
changeset
|
605 |
^ '$Header: /cvs/stx/stx/libjava/JavaNativeMethod.st,v 1.19 2015-03-02 16:50:49 vrany Exp $' |
2151 | 606 |
! |
607 |
||
608 |
version_SVN |
|
2678
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2556
diff
changeset
|
609 |
^ 'Id' |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
610 |
|
611 | 611 |
! ! |
2107 | 612 |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2272
diff
changeset
|
613 |
|
2097 | 614 |
JavaNativeMethod initialize! |