author | Claus Gittinger <cg@exept.de> |
Sun, 08 Sep 2019 16:07:18 +0200 | |
branch | cvs_MAIN |
changeset 3959 | bcd66dbe495d |
parent 3951 | b343448aa8aa |
permissions | -rw-r--r-- |
3951 | 1 |
"{ Encoding: utf8 }" |
2 |
||
454 | 3 |
" |
3324
a58245c0e83a
Updated copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3228
diff
changeset
|
4 |
COPYRIGHT (c) 1996-2015 by Claus Gittinger |
454 | 5 |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
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:
2304
diff
changeset
|
7 |
|
3324
a58245c0e83a
Updated copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3228
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:
2304
diff
changeset
|
9 |
SWING Research Group, Czech Technical University in Prague |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
10 |
|
454 | 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. |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
17 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
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:
2304
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:
2304
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:
2304
diff
changeset
|
21 |
as of 1.9.2010 |
2151 | 22 |
" |
680 | 23 |
"{ Package: 'stx:libjava' }" |
24 |
||
3384
98eb8443f4f4
Use new Logger API (use Logger severityXXX instead of symbols)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3324
diff
changeset
|
25 |
"{ NameSpace: Smalltalk }" |
98eb8443f4f4
Use new Logger API (use Logger severityXXX instead of symbols)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3324
diff
changeset
|
26 |
|
2678
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
27 |
Context variableSubclass:#JavaContext |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
28 |
instanceVariableNames:'exArg exPC byteCode constPool acqrMonitors' |
28 | 29 |
classVariableNames:'' |
30 |
poolDictionaries:'' |
|
713 | 31 |
category:'Languages-Java-Support' |
28 | 32 |
! |
33 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
34 |
Object subclass:#FinallyToken |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
35 |
instanceVariableNames:'context exception selector value' |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
36 |
classVariableNames:'' |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
37 |
poolDictionaries:'' |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
38 |
privateIn:JavaContext |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
39 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
40 |
|
454 | 41 |
!JavaContext class methodsFor:'documentation'! |
42 |
||
43 |
copyright |
|
44 |
" |
|
3324
a58245c0e83a
Updated copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3228
diff
changeset
|
45 |
COPYRIGHT (c) 1996-2015 by Claus Gittinger |
454 | 46 |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
47 |
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:
2304
diff
changeset
|
48 |
|
3324
a58245c0e83a
Updated copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3228
diff
changeset
|
49 |
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:
2304
diff
changeset
|
50 |
SWING Research Group, Czech Technical University in Prague |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
51 |
|
454 | 52 |
This software is furnished under a license and may be used |
53 |
only in accordance with the terms of that license and with the |
|
54 |
inclusion of the above copyright notice. This software may not |
|
55 |
be provided or otherwise made available to, or used by, any |
|
56 |
other person. No title to or ownership of the software is |
|
57 |
hereby transferred. |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
58 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
59 |
[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:
2304
diff
changeset
|
60 |
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:
2304
diff
changeset
|
61 |
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:
2304
diff
changeset
|
62 |
as of 1.9.2010 |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
63 |
|
2151 | 64 |
" |
65 |
! ! |
|
66 |
||
2678
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
67 |
!JavaContext class methodsFor:'accessing'! |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
68 |
|
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
69 |
finallyTokenClass |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
70 |
^FinallyToken |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
71 |
|
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
72 |
"Created: / 18-04-2013 / 23:46:42 / 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:
2396
diff
changeset
|
73 |
! ! |
2396
fadc6d7a2f5b
Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2353
diff
changeset
|
74 |
|
2151 | 75 |
!JavaContext methodsFor:'* As yet uncategorized *'! |
76 |
||
77 |
markForException |
|
78 |
"set the exception handler flag in the receiver. |
|
79 |
The JVM needs this to enter an exception handler instead of restarting |
|
80 |
from the beginning (when the context is restarted). |
|
81 |
- a highly internal mechanism and not for public use." |
|
82 |
" |
|
83 |
%{ /* NOCONTEXT */ |
|
84 |
#ifdef __JAVA_EX_PEND |
|
85 |
/* actually no longer - only a non-nil exPC is now used as marker */ |
|
86 |
__INST(flags) = (OBJ)((INT)__INST(flags) | __MASKSMALLINT(__JAVA_EX_PEND)); |
|
87 |
#endif |
|
88 |
%} |
|
454 | 89 |
" |
90 |
||
2151 | 91 |
"Modified: / 13-12-1995 / 19:05:22 / cg" |
92 |
"Modified: / 25-10-2010 / 17:19:23 / 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:
2304
diff
changeset
|
93 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
94 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
95 |
shouldExecuteFinallyOnUnwind |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
96 |
"Return true, if a finally block should be executed |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
97 |
upon force unwind" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
98 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
99 |
| m pc | |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
100 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
101 |
m := self method. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
102 |
pc := self pc. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
103 |
self assert: m notNil. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
104 |
m hasFinally ifFalse:[ ^ false ]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
105 |
^(method handlerFor: nil at: pc) notNil. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
106 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
107 |
"Created: / 10-04-2012 / 11:09:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
454 | 108 |
! ! |
28 | 109 |
|
110 |
!JavaContext methodsFor:'ST context mimicri'! |
|
111 |
||
261 | 112 |
arg1Index |
113 |
"the java stack contains the receiver in a non-static |
|
114 |
method, as slot 0. Therefore, the first arg is found at slot2 |
|
115 |
if this is for a non-static method" |
|
252 | 116 |
|
117 |
self method isStatic ifTrue:[ |
|
261 | 118 |
^ 1 |
252 | 119 |
]. |
261 | 120 |
^ 2 |
121 |
! |
|
122 |
||
123 |
argAt:n |
|
124 |
"return the i'th argument (1..nArgs)" |
|
125 |
||
126 |
^ self at:(self arg1Index - 1 + n) |
|
252 | 127 |
|
128 |
"Created: / 2.1.1998 / 17:54:13 / cg" |
|
129 |
"Modified: / 2.1.1998 / 21:39:30 / cg" |
|
130 |
! |
|
117 | 131 |
|
252 | 132 |
argAt:n put:value |
261 | 133 |
"change the i'th argument (1..nArgs)" |
216 | 134 |
|
261 | 135 |
^ super argAt:(self arg1Index - 1 + n) put:value |
252 | 136 |
|
137 |
"Created: / 2.1.1998 / 17:54:34 / cg" |
|
138 |
"Modified: / 2.1.1998 / 21:35:19 / cg" |
|
139 |
! |
|
140 |
||
141 |
args |
|
142 |
"return an array filled with the arguments of this context" |
|
143 |
||
261 | 144 |
|n| |
28 | 145 |
|
252 | 146 |
n := self numArgs. |
147 |
n == 0 ifTrue:[ |
|
261 | 148 |
"/ little optimization here - avoid creating empty containers |
255 | 149 |
^ #() |
252 | 150 |
]. |
151 |
||
261 | 152 |
^ (Array new:n) replaceFrom:1 to:n with:self startingAt:(self arg1Index). |
252 | 153 |
|
154 |
"Created: / 2.1.1998 / 17:54:57 / cg" |
|
155 |
"Modified: / 2.1.1998 / 21:34:44 / cg" |
|
156 |
! |
|
157 |
||
3951 | 158 |
argumentCount |
159 |
"return the number of args. |
|
160 |
Redefined since Java keeps the receiver of a non-static method |
|
161 |
at local slot 1." |
|
162 |
||
163 |
|n| |
|
164 |
||
165 |
n := super argumentCount. |
|
166 |
self method isStatic ifFalse:[ |
|
167 |
n := n - 1 |
|
168 |
]. |
|
169 |
^ n |
|
170 |
||
171 |
"Created: / 08-03-2018 / 11:40:10 / stefan" |
|
172 |
! |
|
173 |
||
252 | 174 |
lineNumber |
175 |
|nr pc| |
|
156 | 176 |
|
252 | 177 |
pc := self pc. |
43 | 178 |
|
211 | 179 |
"/ 'ask line for pc:' print. pc printCR. |
255 | 180 |
pc isNil ifTrue:[ |
363 | 181 |
nr := self lineNumberFromMethod. |
182 |
nr notNil ifTrue:[ |
|
183 |
^ nr |
|
184 |
]. |
|
2150 | 185 |
" '-> 0 [a]' printCR. " |
363 | 186 |
^0 |
255 | 187 |
]. |
43 | 188 |
|
252 | 189 |
nr := self method lineNumberForPC:pc. |
255 | 190 |
nr isNil ifTrue:[ |
363 | 191 |
nr := self lineNumberFromMethod. |
192 |
nr notNil ifTrue:[ |
|
193 |
^ nr |
|
194 |
]. |
|
2150 | 195 |
" '-> 0 [b]' printCR. " |
363 | 196 |
^ 0 |
255 | 197 |
]. |
211 | 198 |
"/ '-> ' print. nr printCR. |
210 | 199 |
^ nr. |
28 | 200 |
|
252 | 201 |
"Created: / 1.5.1996 / 15:05:47 / cg" |
261 | 202 |
"Modified: / 15.1.1998 / 15:25:29 / cg" |
28 | 203 |
! |
204 |
||
252 | 205 |
lineNumberFromMethod |
206 |
|m| |
|
207 |
||
208 |
m := self method. |
|
209 |
m notNil ifTrue:[ |
|
255 | 210 |
^ m lineNumber |
252 | 211 |
]. |
212 |
^ nil |
|
28 | 213 |
|
252 | 214 |
"Created: / 4.1.1998 / 23:34:45 / cg" |
215 |
"Modified: / 4.1.1998 / 23:35:55 / cg" |
|
216 |
! |
|
217 |
||
218 |
method |
|
219 |
"the method may be found in the interpreter temps ..." |
|
220 |
||
614 | 221 |
method isJavaMethod ifTrue:[^ method]. |
252 | 222 |
^ super method |
223 |
||
224 |
"Created: / 1.5.1996 / 15:03:43 / cg" |
|
614 | 225 |
"Modified: / 25.9.1999 / 23:26:40 / cg" |
28 | 226 |
! |
227 |
||
228 |
numArgs |
|
252 | 229 |
"return the number of args. |
230 |
Redefined since Java keeps the receiver of a non-static method |
|
261 | 231 |
at local slot 1." |
28 | 232 |
|
252 | 233 |
|n| |
198 | 234 |
|
252 | 235 |
n := super numArgs. |
236 |
self method isStatic ifFalse:[ |
|
255 | 237 |
n := n - 1 |
252 | 238 |
]. |
239 |
^ n |
|
28 | 240 |
|
252 | 241 |
"Created: / 2.1.1998 / 22:21:24 / cg" |
28 | 242 |
! |
243 |
||
261 | 244 |
numTemps |
245 |
"return the number of temporary variables of the Method. |
|
246 |
Redefined since Java keeps the receiver of a non-static method |
|
247 |
at local slot 1." |
|
248 |
||
249 |
|n| |
|
250 |
||
251 |
n := self size - super numVars - super numArgs. |
|
252 |
^ n |
|
253 |
||
254 |
"Created: / 13.1.1998 / 16:52:32 / cg" |
|
255 |
"Modified: / 13.1.1998 / 17:23:27 / cg" |
|
256 |
! |
|
257 |
||
32 | 258 |
pc |
252 | 259 |
lineNr isNil ifTrue:[^ nil]. |
429 | 260 |
^ lineNr bitAnd:16rFFFF |
28 | 261 |
|
252 | 262 |
"Created: / 4.1.1998 / 23:33:48 / cg" |
429 | 263 |
"Modified: / 10.11.1998 / 13:20:12 / cg" |
264 |
! |
|
265 |
||
252 | 266 |
selector |
267 |
"the selector can be extracted from the method. |
|
268 |
the method may be found in the interpreter temps ..." |
|
269 |
||
270 |
|s m| |
|
271 |
||
272 |
selector isNil ifTrue:[ |
|
273 |
m := self method. |
|
274 |
m notNil ifTrue:[ |
|
275 |
^ m name |
|
276 |
] |
|
277 |
]. |
|
278 |
^ super selector |
|
279 |
||
280 |
"Modified: / 30.12.1997 / 17:22:06 / cg" |
|
281 |
"Created: / 30.12.1997 / 17:23:47 / cg" |
|
125 | 282 |
! |
283 |
||
252 | 284 |
setPC:newPC |
285 |
lineNr := newPC |
|
286 |
||
287 |
"Created: / 5.1.1998 / 00:09:02 / cg" |
|
261 | 288 |
! |
289 |
||
290 |
temporaries |
|
291 |
"return an array filled with the arguments and variables of this context" |
|
292 |
||
293 |
|n nSkipped| |
|
294 |
||
295 |
"/ the flas-numVars includes the receiver and args |
|
296 |
nSkipped := super numVars "self numArgs + self numVars". |
|
297 |
"/ but my context setup is args+numvars. |
|
298 |
nSkipped := super numArgs + super numVars. |
|
299 |
||
300 |
n := self size - nSkipped. |
|
301 |
n == 0 ifTrue:[ |
|
363 | 302 |
"/ little optimization here - avaoid creating empty containers |
303 |
^ #() |
|
261 | 304 |
]. |
305 |
||
306 |
^ (Array new:n) replaceFrom:1 to:n with:self startingAt:nSkipped+1. |
|
307 |
||
308 |
"Created: / 13.1.1998 / 15:44:12 / cg" |
|
309 |
"Modified: / 13.1.1998 / 17:22:54 / cg" |
|
310 |
! |
|
311 |
||
2150 | 312 |
vars |
261 | 313 |
"return an array filled with the local variables of this context" |
314 |
||
315 |
|nonVars mySize| |
|
316 |
||
317 |
mySize := self numVars. |
|
318 |
mySize == 0 ifTrue:[ |
|
363 | 319 |
"/ little optimization here - avaoid creating empty containers |
320 |
^ #() |
|
261 | 321 |
]. |
322 |
nonVars := (self arg1Index-1) + self numArgs. |
|
323 |
^ (Array new:mySize) replaceFrom:1 to:mySize with:self startingAt:nonVars+1 |
|
324 |
||
325 |
"Created: / 13.1.1998 / 16:48:16 / cg" |
|
252 | 326 |
! ! |
327 |
||
2151 | 328 |
!JavaContext methodsFor:'accessing'! |
329 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
330 |
acquiredMonitors |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
331 |
^acqrMonitors |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
332 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
333 |
"Created: / 08-11-2011 / 12:23:18 / 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:
2304
diff
changeset
|
334 |
"Modified (format): / 27-08-2012 / 16:46:27 / 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:
2304
diff
changeset
|
335 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
336 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
337 |
acquiredMonitorsDo: aBlock |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
338 |
"/ acqrMonitors isNil ifTrue: [ ^self ]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
339 |
"/ acqrMonitors copy reverseDo: aBlock. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
340 |
aBlock value: self receiver. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
341 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
342 |
"Created: / 08-11-2011 / 15:03:31 / 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:
2304
diff
changeset
|
343 |
"Modified: / 26-08-2012 / 19:28:00 / 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:
2304
diff
changeset
|
344 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
345 |
|
3196
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3083
diff
changeset
|
346 |
addMonitor:mon |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3083
diff
changeset
|
347 |
self assert:(acqrMonitors isNil or:[ acqrMonitors isOrderedCollection ]). |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3083
diff
changeset
|
348 |
acqrMonitors isNil ifTrue:[ |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3083
diff
changeset
|
349 |
acqrMonitors := Stack new |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3083
diff
changeset
|
350 |
]. |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3083
diff
changeset
|
351 |
acqrMonitors push:mon. |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
352 |
self markForUnwind. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
353 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
354 |
"Created: / 08-11-2011 / 14:19:21 / 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:
2304
diff
changeset
|
355 |
"Modified: / 17-11-2011 / 19:13:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
3196
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3083
diff
changeset
|
356 |
"Modified: / 04-08-2014 / 15:54:58 / 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:
2304
diff
changeset
|
357 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
358 |
|
2902
b7070e447ed0
Fixes for displaying local variables in debugger.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2887
diff
changeset
|
359 |
argsAndVars |
b7070e447ed0
Fixes for displaying local variables in debugger.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2887
diff
changeset
|
360 |
"return an array filled with the arguments and variables of this context" |
b7070e447ed0
Fixes for displaying local variables in debugger.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2887
diff
changeset
|
361 |
|
3083 | 362 |
|rawArgsAndVars| |
363 |
||
364 |
rawArgsAndVars := self method originalMethodIfWrapped methodArgAndVarValuesInContext: self. |
|
3228
a35cc585bb5a
Fix in JavaContext>>argsAndVars: do not strip receiver (this) from arg-and-vars
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3196
diff
changeset
|
365 |
"/ self method isStatic ifFalse:[^ rawArgsAndVars copyFrom:2]. |
3083 | 366 |
^ rawArgsAndVars |
2902
b7070e447ed0
Fixes for displaying local variables in debugger.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2887
diff
changeset
|
367 |
|
b7070e447ed0
Fixes for displaying local variables in debugger.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2887
diff
changeset
|
368 |
"Created: / 04-11-2013 / 18:45:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
3228
a35cc585bb5a
Fix in JavaContext>>argsAndVars: do not strip receiver (this) from arg-and-vars
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3196
diff
changeset
|
369 |
"Modified: / 12-08-2014 / 23:04:21 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2902
b7070e447ed0
Fixes for displaying local variables in debugger.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2887
diff
changeset
|
370 |
! |
b7070e447ed0
Fixes for displaying local variables in debugger.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2887
diff
changeset
|
371 |
|
2678
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
372 |
methodFromClass |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
373 |
"Return the up-to-date method. Actyally, it fetches the method |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
374 |
from receiver's class" |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
375 |
|
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
376 |
|c sender sendersSelector m| |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
377 |
|
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
378 |
"mhmh - maybe I am a context for an unbound method (as generated by doIt); |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
379 |
look in the sender's context. Consider this a kludge. |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
380 |
Future versions of ST/X's message lookup may store the method in |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
381 |
the context. |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
382 |
" |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
383 |
sender := self sender. |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
384 |
sender notNil ifTrue:[ |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
385 |
sendersSelector := sender selector. |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
386 |
sendersSelector notNil ifTrue:[ |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
387 |
(sendersSelector startsWith:'valueWithReceiver:') ifTrue:[ |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
388 |
m := sender receiver. |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
389 |
m isMethod ifTrue:[ |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
390 |
method := m. |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
391 |
^ m |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
392 |
] |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
393 |
] |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
394 |
] |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
395 |
]. |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
396 |
|
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
397 |
c := self searchClass. |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
398 |
" |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
399 |
the below cannot happen in normal circumstances |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
400 |
(added to avoid recursive errors in case of a broken sender chain) |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
401 |
" |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
402 |
c isBehavior ifFalse:[ |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
403 |
'Context [error]: non class in searchClass' errorPrintCR. |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
404 |
' selector: ' errorPrint. selector errorPrint. |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
405 |
' receiver: ' errorPrint. receiver errorPrintCR. |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
406 |
^ nil |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
407 |
]. |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
408 |
|
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
409 |
c := c whichClassIncludesSelector:selector. |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
410 |
c notNil ifTrue:[ |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
411 |
method := c compiledMethodAt:selector. |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
412 |
^ method |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
413 |
]. |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
414 |
|
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
415 |
^ nil |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
416 |
|
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
417 |
"Created: / 09-08-2013 / 02:25:06 / 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:
2396
diff
changeset
|
418 |
! |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
419 |
|
2151 | 420 |
programmingLanguage |
421 |
||
422 |
^JavaLanguage instance |
|
423 |
||
424 |
"Created: / 17-03-2011 / 10:17:45 / 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:
2304
diff
changeset
|
425 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
426 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
427 |
removeMonitor: mon |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
428 |
| poppedObject | |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
429 |
acqrMonitors isNil ifTrue: [ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
430 |
Logger |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
431 |
log: ('removeMonitor: called but no monitors in acqrMonitors (%1)' |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
432 |
bindWith: self) |
3384
98eb8443f4f4
Use new Logger API (use Logger severityXXX instead of symbols)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3324
diff
changeset
|
433 |
severity: Logger severityWARN |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
434 |
facility: #JVM. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
435 |
self breakPoint: #mh. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
436 |
^ self. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
437 |
]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
438 |
poppedObject := acqrMonitors top. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
439 |
self assert: (poppedObject == mon). |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
440 |
acqrMonitors remove: mon |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
441 |
ifAbsent: [ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
442 |
Logger |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
443 |
log: ('removeMonitor: called but no such monitor in acqrMonitors (%1)' |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
444 |
bindWith: self) |
3384
98eb8443f4f4
Use new Logger API (use Logger severityXXX instead of symbols)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3324
diff
changeset
|
445 |
severity: Logger severityWARN |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
446 |
facility: #JVM. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
447 |
self breakPoint: #mh. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
448 |
^ self. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
449 |
]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
450 |
acqrMonitors isEmpty ifTrue: [self unmarkForUnwind]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
451 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
452 |
"Created: / 08-11-2011 / 14:19:58 / 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:
2304
diff
changeset
|
453 |
"Modified: / 17-11-2011 / 19:14:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
3384
98eb8443f4f4
Use new Logger API (use Logger severityXXX instead of symbols)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3324
diff
changeset
|
454 |
"Modified: / 02-03-2015 / 14:07:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2151 | 455 |
! ! |
456 |
||
252 | 457 |
!JavaContext methodsFor:'exception handler support'! |
117 | 458 |
|
255 | 459 |
exceptionArg:aJavaException |
511 | 460 |
exArg := aJavaException. |
461 |
||
462 |
"Created: / 7.1.1998 / 21:36:56 / cg" |
|
463 |
! |
|
464 |
||
465 |
exceptionArg:aJavaException pc:newPc |
|
466 |
exArg := aJavaException. |
|
467 |
exPC := newPc. |
|
255 | 468 |
|
469 |
"Created: / 7.1.1998 / 21:36:56 / cg" |
|
28 | 470 |
! ! |
471 |
||
2678
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
472 |
!JavaContext methodsFor:'non local control flow'! |
2396
fadc6d7a2f5b
Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2353
diff
changeset
|
473 |
|
2678
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
474 |
restart |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
475 |
"Update the bytecode before restarting so |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
476 |
bytecode interpreter can execute new code, if any" |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
477 |
|
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
478 |
| m | |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
479 |
|
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
480 |
m := self methodFromClass. |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
481 |
m notNil ifTrue:[ |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
482 |
byteCode := m byteCode. |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
483 |
constPool := m constantPool. |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
484 |
]. |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
485 |
^super restart. |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
486 |
|
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
487 |
"Created: / 19-04-2013 / 13:33:19 / 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:
2396
diff
changeset
|
488 |
"Modified: / 09-08-2013 / 02:33:20 / 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:
2396
diff
changeset
|
489 |
! |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
490 |
|
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
491 |
return |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
492 |
selector last == $V ifTrue:[ ^ self return:nil ]. |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
493 |
selector last == $; ifTrue:[ ^ self return:nil ]. |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
494 |
selector last == $D ifTrue:[ ^ self return:0.0 ]. |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
495 |
selector last == $F ifTrue:[ ^ self return:0.0 asShortFloat ]. |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
496 |
^self return: 0 |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
497 |
|
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
498 |
"Created: / 18-04-2013 / 23:52:39 / 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:
2396
diff
changeset
|
499 |
! |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
500 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
501 |
unwindAndRestartForJavaException |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
502 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
503 |
"Called by JavaVM>>throwException: unwinds the stack |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
504 |
up to this context and restarts it so an exception handler |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
505 |
executes" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
506 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
507 |
| con wasMarked | |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
508 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
509 |
"Each context that has a monitor acquired has |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
510 |
and unwind action that release all monitors acquired. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
511 |
However, we DONT want my monitors to be released, |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
512 |
so we temporarily unmark this context for unwind and |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
513 |
then mark it again, eventually" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
514 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
515 |
wasMarked := self isUnwindContext. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
516 |
wasMarked ifTrue:[self unmarkForUnwind]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
517 |
self senderIsNil ifFalse:[ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
518 |
con := thisContext evaluateUnwindActionsUpTo:self. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
519 |
]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
520 |
wasMarked ifTrue:[self markForUnwind]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
521 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
522 |
"oops, if nil, I am not on the calling chain; |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
523 |
(bad bad, unwind action have already been performed. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
524 |
should we check for this situation first and NOT evaluate |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
525 |
the unwind actions in this case ?) |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
526 |
" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
527 |
con isNil ifTrue:[ |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
528 |
" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
529 |
tried to return to a context which is already dead |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
530 |
(i.e. the method/block has already executed a return) |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
531 |
" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
532 |
^ self invalidReturnOrRestartError:#'unwindAndRestart:' with:nil |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
533 |
]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
534 |
" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
535 |
now, that all unwind-actions are done, I can use the |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
536 |
low-level restart ... |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
537 |
" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
538 |
^ self restart |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
539 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
540 |
"Created: / 08-11-2011 / 22:00:56 / 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:
2304
diff
changeset
|
541 |
! ! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
542 |
|
28 | 543 |
!JavaContext methodsFor:'printing & storing'! |
544 |
||
2729
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2726
diff
changeset
|
545 |
printOn:aStream |
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2726
diff
changeset
|
546 |
"append a brief description (excl. arguments) of the receiver onto aStream" |
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2726
diff
changeset
|
547 |
|
3951 | 548 |
self printReceiverWithSeparator:'»' on:aStream. |
2729
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2726
diff
changeset
|
549 |
"/ aStream nextPutAll:' '. |
3951 | 550 |
aStream nextPutAll:' » '. |
2729
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2726
diff
changeset
|
551 |
|
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2726
diff
changeset
|
552 |
aStream bold. |
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2726
diff
changeset
|
553 |
self selector printOn:aStream. "show as string (as symbol looks too ugly in browser ...)" |
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2726
diff
changeset
|
554 |
"/ self selector storeOn:aStream. "show as symbol" |
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2726
diff
changeset
|
555 |
aStream normal. |
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2726
diff
changeset
|
556 |
aStream space. |
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2726
diff
changeset
|
557 |
(method notNil and:[method isWrapped]) ifTrue:[ |
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2726
diff
changeset
|
558 |
aStream nextPutAll:'(wrapped) ' |
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2726
diff
changeset
|
559 |
]. |
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2726
diff
changeset
|
560 |
aStream nextPutAll:' ['; nextPutAll:(self method lineNumberForPC0: lineNr) printString; nextPutAll:']' . |
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2726
diff
changeset
|
561 |
|
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2726
diff
changeset
|
562 |
"Created: / 12-09-2013 / 23:02:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2726
diff
changeset
|
563 |
! |
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2726
diff
changeset
|
564 |
|
252 | 565 |
receiverPrintString |
2150 | 566 |
"return a string describing the receiver of the context" |
52 | 567 |
|
680 | 568 |
|receiverClass receiverClassName newString implementorClass searchClass| |
28 | 569 |
|
363 | 570 |
"/ %{ |
571 |
"/ /* |
|
572 |
"/ * special handling for (invalid) free objects. |
|
573 |
"/ * these only appear if some primitiveCode does not correctly use SEND macros, |
|
574 |
"/ * which may lead to sends to free objects. In normal operation, this 'cannot' happen. |
|
2150 | 575 |
"/ */ |
363 | 576 |
"/ if (__isNonNilObject(__INST(receiver)) && (__qClass(__INST(receiver))==nil)) { |
577 |
"/ receiverClassName = __MKSTRING("FreeObject"); |
|
578 |
"/ } |
|
579 |
"/ %}. |
|
680 | 580 |
"/ receiverClassName notNil ifTrue:[^ receiverClassName]. |
228 | 581 |
|
252 | 582 |
receiverClass := receiver class. |
680 | 583 |
"/ java has no class-methods ... |
584 |
receiverClass := receiverClass theNonMetaclass. |
|
585 |
||
586 |
receiverClassName := receiverClass nameInBrowser. |
|
252 | 587 |
(receiverClass == SmallInteger) ifTrue:[ |
2150 | 588 |
newString := '(' , receiver printString , ') ' , receiverClassName |
228 | 589 |
] ifFalse:[ |
2150 | 590 |
newString := receiverClassName |
228 | 591 |
]. |
592 |
||
252 | 593 |
" |
594 |
kludge to avoid slow search for containing class |
|
595 |
" |
|
596 |
(selector ~~ #doIt and:[selector ~~ #doIt:]) ifTrue:[ |
|
2150 | 597 |
implementorClass := self methodClass. |
252 | 598 |
]. |
599 |
implementorClass notNil ifTrue: [ |
|
2150 | 600 |
(implementorClass ~~ receiverClass) ifTrue: [ |
601 |
newString := newString , '>>>', |
|
602 |
implementorClass nameInBrowser printString |
|
603 |
] |
|
252 | 604 |
] ifFalse:[ |
2150 | 605 |
searchClass := self searchClass. |
606 |
searchClass ~~ receiverClass ifTrue:[ |
|
607 |
newString := newString , '>>>' , searchClass nameInBrowser |
|
608 |
]. |
|
252 | 609 |
"/ " |
610 |
"/ kludge for doIt - these unbound methods are not |
|
611 |
"/ found in the classes methodDictionary |
|
612 |
"/ " |
|
613 |
"/ (selector ~~ #doIt and:[selector ~~ #doIt:]) ifTrue:[ |
|
614 |
"/ newString := newString , '>>>**NONE**' |
|
615 |
"/ ] |
|
28 | 616 |
]. |
617 |
||
252 | 618 |
^ newString |
28 | 619 |
! ! |
620 |
||
343 | 621 |
!JavaContext methodsFor:'queries'! |
622 |
||
623 |
hasStackToShow |
|
624 |
"private interface to the debugger. |
|
625 |
Smalltalk contexts return false here - other language frames |
|
626 |
(i.e. Java frames) may want to show the evaluation stack" |
|
627 |
||
628 |
^ true |
|
629 |
||
630 |
"Modified: / 13.5.1997 / 16:31:12 / cg" |
|
631 |
"Created: / 7.5.1998 / 01:23:57 / cg" |
|
632 |
! |
|
633 |
||
346 | 634 |
isJavaContext |
635 |
"return true, if this is a javaContext." |
|
636 |
||
637 |
^ true |
|
638 |
||
639 |
"Created: / 8.5.1998 / 21:23:47 / cg" |
|
640 |
! |
|
641 |
||
343 | 642 |
stackFrame |
643 |
"private interface to the debugger." |
|
644 |
||
645 |
^ (1 to:self size) collect:[:i | self at:i] |
|
646 |
||
647 |
"Created: / 7.5.1998 / 01:26:19 / cg" |
|
648 |
! ! |
|
649 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
650 |
!JavaContext::FinallyToken methodsFor:'accessing'! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
651 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
652 |
context |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
653 |
^ context |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
654 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
655 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
656 |
context:something |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
657 |
context := something. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
658 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
659 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
660 |
exception |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
661 |
^ exception |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
662 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
663 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
664 |
exception:something |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
665 |
exception := something. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
666 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
667 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
668 |
selector |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
669 |
^ selector |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
670 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
671 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
672 |
selector:something |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
673 |
selector := something. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
674 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
675 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
676 |
value |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
677 |
^ value |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
678 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
679 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
680 |
value:something |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
681 |
value := something. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
682 |
! ! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
683 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
684 |
!JavaContext::FinallyToken methodsFor:'actions'! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
685 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
686 |
pass |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
687 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
688 |
selector == #return ifTrue:[ |
2841
6fa1bcf9c997
JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2732
diff
changeset
|
689 |
thisContext evaluateUnwindActionsUpTo:context. |
6fa1bcf9c997
JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2732
diff
changeset
|
690 |
context return |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
691 |
]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
692 |
selector == #return: ifTrue:[ |
2841
6fa1bcf9c997
JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2732
diff
changeset
|
693 |
thisContext evaluateUnwindActionsUpTo:context. |
6fa1bcf9c997
JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2732
diff
changeset
|
694 |
context return: value |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
695 |
]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
696 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
697 |
self error:'Should never be reached'. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
698 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
699 |
"Created: / 04-04-2012 / 20:24:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2843
36f000314bcd
Fix in mixed exception handling.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2841
diff
changeset
|
700 |
"Modified: / 10-10-2013 / 10:13:15 / 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:
2304
diff
changeset
|
701 |
! ! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
702 |
|
129 | 703 |
!JavaContext class methodsFor:'documentation'! |
28 | 704 |
|
705 |
version |
|
3579 | 706 |
^ '$Header$' |
2304
73806b718f4e
fixed: #version_SVN ($ to §)
Claus Gittinger <cg@exept.de>
parents:
2168
diff
changeset
|
707 |
! |
73806b718f4e
fixed: #version_SVN ($ to §)
Claus Gittinger <cg@exept.de>
parents:
2168
diff
changeset
|
708 |
|
73806b718f4e
fixed: #version_SVN ($ to §)
Claus Gittinger <cg@exept.de>
parents:
2168
diff
changeset
|
709 |
version_CVS |
3579 | 710 |
^ '$Header$' |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
711 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
712 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
713 |
version_HG |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
714 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
715 |
^ '$Changeset: <not expanded> $' |
2151 | 716 |
! |
717 |
||
718 |
version_SVN |
|
3579 | 719 |
^ '$Id$' |
2108 | 720 |
! ! |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
721 |