author | Marcel Hlopko <marcel.hlopko@fit.cvut.cz> |
Tue, 18 Dec 2012 19:02:51 +0100 | |
branch | development |
changeset 1910 | 278ceba64f94 |
parent 1864 | 60a8dc26c8c6 |
child 1914 | 6d0f663767ee |
permissions | -rw-r--r-- |
752 | 1 |
" |
877 | 2 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
1152 | 3 |
|
1155 | 4 |
New code and modifications done at SWING Research Group [1]: |
1152 | 5 |
|
877 | 6 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
7 |
SWING Research Group, Czech Technical University in Prague |
|
8 |
||
752 | 9 |
This software is furnished under a license and may be used |
10 |
only in accordance with the terms of that license and with the |
|
11 |
inclusion of the above copyright notice. This software may not |
|
12 |
be provided or otherwise made available to, or used by, any |
|
13 |
other person. No title to or ownership of the software is |
|
14 |
hereby transferred. |
|
877 | 15 |
|
1155 | 16 |
[1] Code written at SWING Research Group contains a signature |
17 |
of one of the above copright owners. For exact set of such code, |
|
18 |
see the differences between this version and version stx:libjava |
|
1152 | 19 |
as of 1.9.2010 |
752 | 20 |
" |
21 |
"{ Package: 'stx:libjava' }" |
|
22 |
||
23 |
Context variableSubclass:#JavaContext |
|
1093 | 24 |
instanceVariableNames:'exArg exPC byteCode constPool acqrMonitors' |
752 | 25 |
classVariableNames:'' |
26 |
poolDictionaries:'' |
|
27 |
category:'Languages-Java-Support' |
|
28 |
! |
|
29 |
||
1455 | 30 |
Object subclass:#FinallyToken |
31 |
instanceVariableNames:'context exception selector value' |
|
32 |
classVariableNames:'' |
|
33 |
poolDictionaries:'' |
|
34 |
privateIn:JavaContext |
|
35 |
! |
|
36 |
||
752 | 37 |
!JavaContext class methodsFor:'documentation'! |
38 |
||
39 |
copyright |
|
40 |
" |
|
877 | 41 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
1152 | 42 |
|
1155 | 43 |
New code and modifications done at SWING Research Group [1]: |
1152 | 44 |
|
877 | 45 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
46 |
SWING Research Group, Czech Technical University in Prague |
|
47 |
||
752 | 48 |
This software is furnished under a license and may be used |
49 |
only in accordance with the terms of that license and with the |
|
50 |
inclusion of the above copyright notice. This software may not |
|
51 |
be provided or otherwise made available to, or used by, any |
|
52 |
other person. No title to or ownership of the software is |
|
53 |
hereby transferred. |
|
877 | 54 |
|
1155 | 55 |
[1] Code written at SWING Research Group contains a signature |
56 |
of one of the above copright owners. For exact set of such code, |
|
57 |
see the differences between this version and version stx:libjava |
|
1152 | 58 |
as of 1.9.2010 |
877 | 59 |
|
60 |
" |
|
752 | 61 |
! ! |
62 |
||
63 |
!JavaContext methodsFor:'* As yet uncategorized *'! |
|
64 |
||
65 |
markForException |
|
66 |
"set the exception handler flag in the receiver. |
|
67 |
The JVM needs this to enter an exception handler instead of restarting |
|
68 |
from the beginning (when the context is restarted). |
|
69 |
- a highly internal mechanism and not for public use." |
|
70 |
" |
|
71 |
%{ /* NOCONTEXT */ |
|
72 |
#ifdef __JAVA_EX_PEND |
|
73 |
/* actually no longer - only a non-nil exPC is now used as marker */ |
|
74 |
__INST(flags) = (OBJ)((INT)__INST(flags) | __MASKSMALLINT(__JAVA_EX_PEND)); |
|
75 |
#endif |
|
76 |
%} |
|
77 |
" |
|
78 |
||
79 |
"Modified: / 13-12-1995 / 19:05:22 / cg" |
|
80 |
"Modified: / 25-10-2010 / 17:19:23 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1461 | 81 |
! |
82 |
||
83 |
shouldExecuteFinallyOnUnwind |
|
84 |
"Return true, if a finally block should be executed |
|
85 |
upon force unwind" |
|
86 |
||
87 |
| m pc | |
|
88 |
||
89 |
m := self method. |
|
90 |
pc := self pc. |
|
91 |
self assert: m notNil. |
|
92 |
m hasFinally ifFalse:[ ^ false ]. |
|
93 |
^(method handlerFor: nil at: pc) notNil. |
|
94 |
||
95 |
"Created: / 10-04-2012 / 11:09:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
752 | 96 |
! ! |
97 |
||
98 |
!JavaContext methodsFor:'ST context mimicri'! |
|
99 |
||
100 |
arg1Index |
|
101 |
"the java stack contains the receiver in a non-static |
|
102 |
method, as slot 0. Therefore, the first arg is found at slot2 |
|
103 |
if this is for a non-static method" |
|
104 |
||
105 |
self method isStatic ifTrue:[ |
|
106 |
^ 1 |
|
107 |
]. |
|
108 |
^ 2 |
|
109 |
! |
|
110 |
||
111 |
argAt:n |
|
112 |
"return the i'th argument (1..nArgs)" |
|
113 |
||
114 |
^ self at:(self arg1Index - 1 + n) |
|
115 |
||
116 |
"Created: / 2.1.1998 / 17:54:13 / cg" |
|
117 |
"Modified: / 2.1.1998 / 21:39:30 / cg" |
|
118 |
! |
|
119 |
||
120 |
argAt:n put:value |
|
121 |
"change the i'th argument (1..nArgs)" |
|
122 |
||
123 |
^ super argAt:(self arg1Index - 1 + n) put:value |
|
124 |
||
125 |
"Created: / 2.1.1998 / 17:54:34 / cg" |
|
126 |
"Modified: / 2.1.1998 / 21:35:19 / cg" |
|
127 |
! |
|
128 |
||
129 |
args |
|
130 |
"return an array filled with the arguments of this context" |
|
131 |
||
132 |
|n| |
|
133 |
||
134 |
n := self numArgs. |
|
135 |
n == 0 ifTrue:[ |
|
136 |
"/ little optimization here - avoid creating empty containers |
|
137 |
^ #() |
|
138 |
]. |
|
139 |
||
140 |
^ (Array new:n) replaceFrom:1 to:n with:self startingAt:(self arg1Index). |
|
141 |
||
142 |
"Created: / 2.1.1998 / 17:54:57 / cg" |
|
143 |
"Modified: / 2.1.1998 / 21:34:44 / cg" |
|
144 |
! |
|
145 |
||
146 |
argsAndVars |
|
147 |
"return an array filled with the arguments and variables of this context" |
|
148 |
||
149 |
|n| |
|
150 |
||
151 |
n := self numArgs + self numVars. |
|
152 |
n == 0 ifTrue:[ |
|
153 |
"/ little optimization here - avoid creating empty containers |
|
154 |
^ #() |
|
155 |
]. |
|
156 |
^ (Array new:n) replaceFrom:1 to:n with:self startingAt:(self arg1Index). |
|
157 |
||
158 |
"Created: / 2.1.1998 / 17:55:14 / cg" |
|
159 |
"Modified: / 13.1.1998 / 15:44:56 / cg" |
|
160 |
! |
|
161 |
||
162 |
lineNumber |
|
163 |
|nr pc| |
|
164 |
||
165 |
pc := self pc. |
|
166 |
||
167 |
"/ 'ask line for pc:' print. pc printCR. |
|
168 |
pc isNil ifTrue:[ |
|
169 |
nr := self lineNumberFromMethod. |
|
170 |
nr notNil ifTrue:[ |
|
171 |
^ nr |
|
172 |
]. |
|
173 |
" '-> 0 [a]' printCR. " |
|
174 |
^0 |
|
175 |
]. |
|
176 |
||
177 |
nr := self method lineNumberForPC:pc. |
|
178 |
nr isNil ifTrue:[ |
|
179 |
nr := self lineNumberFromMethod. |
|
180 |
nr notNil ifTrue:[ |
|
181 |
^ nr |
|
182 |
]. |
|
183 |
" '-> 0 [b]' printCR. " |
|
184 |
^ 0 |
|
185 |
]. |
|
186 |
"/ '-> ' print. nr printCR. |
|
187 |
^ nr. |
|
188 |
||
189 |
"Created: / 1.5.1996 / 15:05:47 / cg" |
|
190 |
"Modified: / 15.1.1998 / 15:25:29 / cg" |
|
191 |
! |
|
192 |
||
193 |
lineNumberFromMethod |
|
194 |
|m| |
|
195 |
||
196 |
m := self method. |
|
197 |
m notNil ifTrue:[ |
|
198 |
^ m lineNumber |
|
199 |
]. |
|
200 |
^ nil |
|
201 |
||
202 |
"Created: / 4.1.1998 / 23:34:45 / cg" |
|
203 |
"Modified: / 4.1.1998 / 23:35:55 / cg" |
|
204 |
! |
|
205 |
||
206 |
method |
|
207 |
"the method may be found in the interpreter temps ..." |
|
208 |
||
209 |
method isJavaMethod ifTrue:[^ method]. |
|
210 |
^ super method |
|
211 |
||
212 |
"Created: / 1.5.1996 / 15:03:43 / cg" |
|
213 |
"Modified: / 25.9.1999 / 23:26:40 / cg" |
|
214 |
! |
|
215 |
||
216 |
numArgs |
|
217 |
"return the number of args. |
|
218 |
Redefined since Java keeps the receiver of a non-static method |
|
219 |
at local slot 1." |
|
220 |
||
221 |
|n| |
|
222 |
||
223 |
n := super numArgs. |
|
224 |
self method isStatic ifFalse:[ |
|
225 |
n := n - 1 |
|
226 |
]. |
|
227 |
^ n |
|
228 |
||
229 |
"Created: / 2.1.1998 / 22:21:24 / cg" |
|
230 |
! |
|
231 |
||
232 |
numTemps |
|
233 |
"return the number of temporary variables of the Method. |
|
234 |
Redefined since Java keeps the receiver of a non-static method |
|
235 |
at local slot 1." |
|
236 |
||
237 |
|n| |
|
238 |
||
239 |
n := self size - super numVars - super numArgs. |
|
240 |
^ n |
|
241 |
||
242 |
"Created: / 13.1.1998 / 16:52:32 / cg" |
|
243 |
"Modified: / 13.1.1998 / 17:23:27 / cg" |
|
244 |
! |
|
245 |
||
246 |
numVars |
|
247 |
"return the number of locals. |
|
248 |
Redefined since Java keeps the receiver of a non-static method |
|
249 |
at local slot 0 and holds the args as locals." |
|
250 |
||
251 |
|n| |
|
252 |
||
253 |
n := super numVars. |
|
254 |
^ (n - self numArgs) max:0 |
|
255 |
||
256 |
"Created: / 13.1.1998 / 17:03:08 / cg" |
|
257 |
"Modified: / 13.1.1998 / 17:25:16 / cg" |
|
258 |
! |
|
259 |
||
260 |
pc |
|
261 |
lineNr isNil ifTrue:[^ nil]. |
|
262 |
^ lineNr bitAnd:16rFFFF |
|
263 |
||
264 |
"Created: / 4.1.1998 / 23:33:48 / cg" |
|
265 |
"Modified: / 10.11.1998 / 13:20:12 / cg" |
|
266 |
! |
|
267 |
||
268 |
quickLineNumber |
|
269 |
"the lineNumber - without decompiling" |
|
270 |
||
271 |
^ self method quickLineNumberForPC:self pc |
|
272 |
||
273 |
"Created: / 10.11.1998 / 14:20:30 / cg" |
|
274 |
! |
|
275 |
||
276 |
selector |
|
277 |
"the selector can be extracted from the method. |
|
278 |
the method may be found in the interpreter temps ..." |
|
279 |
||
280 |
|s m| |
|
281 |
||
282 |
selector isNil ifTrue:[ |
|
283 |
m := self method. |
|
284 |
m notNil ifTrue:[ |
|
285 |
^ m name |
|
286 |
] |
|
287 |
]. |
|
288 |
^ super selector |
|
289 |
||
290 |
"Modified: / 30.12.1997 / 17:22:06 / cg" |
|
291 |
"Created: / 30.12.1997 / 17:23:47 / cg" |
|
292 |
! |
|
293 |
||
294 |
setPC:newPC |
|
295 |
lineNr := newPC |
|
296 |
||
297 |
"Created: / 5.1.1998 / 00:09:02 / cg" |
|
298 |
! |
|
299 |
||
300 |
temporaries |
|
301 |
"return an array filled with the arguments and variables of this context" |
|
302 |
||
303 |
|n nSkipped| |
|
304 |
||
305 |
"/ the flas-numVars includes the receiver and args |
|
306 |
nSkipped := super numVars "self numArgs + self numVars". |
|
307 |
"/ but my context setup is args+numvars. |
|
308 |
nSkipped := super numArgs + super numVars. |
|
309 |
||
310 |
n := self size - nSkipped. |
|
311 |
n == 0 ifTrue:[ |
|
312 |
"/ little optimization here - avaoid creating empty containers |
|
313 |
^ #() |
|
314 |
]. |
|
315 |
||
316 |
^ (Array new:n) replaceFrom:1 to:n with:self startingAt:nSkipped+1. |
|
317 |
||
318 |
"Created: / 13.1.1998 / 15:44:12 / cg" |
|
319 |
"Modified: / 13.1.1998 / 17:22:54 / cg" |
|
320 |
! |
|
321 |
||
322 |
vars |
|
323 |
"return an array filled with the local variables of this context" |
|
324 |
||
325 |
|nonVars mySize| |
|
326 |
||
327 |
mySize := self numVars. |
|
328 |
mySize == 0 ifTrue:[ |
|
329 |
"/ little optimization here - avaoid creating empty containers |
|
330 |
^ #() |
|
331 |
]. |
|
332 |
nonVars := (self arg1Index-1) + self numArgs. |
|
333 |
^ (Array new:mySize) replaceFrom:1 to:mySize with:self startingAt:nonVars+1 |
|
334 |
||
335 |
"Created: / 13.1.1998 / 16:48:16 / cg" |
|
336 |
! ! |
|
337 |
||
338 |
!JavaContext methodsFor:'accessing'! |
|
339 |
||
1093 | 340 |
acquiredMonitors |
1691 | 341 |
^acqrMonitors |
1093 | 342 |
|
343 |
"Created: / 08-11-2011 / 12:23:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1691 | 344 |
"Modified (format): / 27-08-2012 / 16:46:27 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1093 | 345 |
! |
346 |
||
1096
c543f127c67a
fixed some stupid mistakes, but still not working
hlopkmar
parents:
1095
diff
changeset
|
347 |
acquiredMonitorsDo: aBlock |
1691 | 348 |
"/ acqrMonitors isNil ifTrue: [ ^self ]. |
349 |
"/ acqrMonitors copy reverseDo: aBlock. |
|
350 |
aBlock value: self receiver. |
|
1094 | 351 |
|
352 |
"Created: / 08-11-2011 / 15:03:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1691 | 353 |
"Modified: / 26-08-2012 / 19:28:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1094 | 354 |
! |
355 |
||
1095 | 356 |
addMonitor: mon |
1100 | 357 |
self assert: (acqrMonitors isNil or: [ acqrMonitors isOrderedCollection ]). |
358 |
acqrMonitors ifNil: [ acqrMonitors := Stack new ]. |
|
359 |
acqrMonitors push: mon. |
|
1122 | 360 |
self markForUnwind. |
1093 | 361 |
|
362 |
"Created: / 08-11-2011 / 14:19:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1098 | 363 |
"Modified: / 08-11-2011 / 21:40:30 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1122 | 364 |
"Modified: / 17-11-2011 / 19:13:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
1093 | 365 |
! |
366 |
||
752 | 367 |
programmingLanguage |
368 |
||
369 |
^JavaLanguage instance |
|
370 |
||
371 |
"Created: / 17-03-2011 / 10:17:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1093 | 372 |
! |
373 |
||
374 |
removeMonitor: mon |
|
1122 | 375 |
| poppedObject | |
1095 | 376 |
acqrMonitors isNil ifTrue: [ |
1100 | 377 |
Logger |
378 |
log: ('removeMonitor: called but no monitors in acqrMonitors (%1)' |
|
379 |
bindWith: self) |
|
380 |
severity: #warn |
|
381 |
facility: #JVM. |
|
382 |
self breakPoint: #mh. |
|
383 |
^ self. |
|
1094 | 384 |
]. |
1100 | 385 |
poppedObject := acqrMonitors top. |
386 |
self assert: (poppedObject == mon). |
|
387 |
acqrMonitors remove: mon |
|
388 |
ifAbsent: [ |
|
389 |
Logger |
|
390 |
log: ('removeMonitor: called but no such monitor in acqrMonitors (%1)' |
|
391 |
bindWith: self) |
|
392 |
severity: #warn |
|
393 |
facility: #JVM. |
|
394 |
self breakPoint: #mh. |
|
395 |
^ self. |
|
1122 | 396 |
]. |
397 |
acqrMonitors isEmpty ifTrue: [self unmarkForUnwind]. |
|
1093 | 398 |
|
399 |
"Created: / 08-11-2011 / 14:19:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1098 | 400 |
"Modified: / 08-11-2011 / 21:39:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1122 | 401 |
"Modified: / 17-11-2011 / 19:14:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 402 |
! ! |
403 |
||
404 |
!JavaContext methodsFor:'exception handler support'! |
|
405 |
||
406 |
exceptionArg:aJavaException |
|
407 |
exArg := aJavaException. |
|
408 |
||
409 |
"Created: / 7.1.1998 / 21:36:56 / cg" |
|
410 |
! |
|
411 |
||
412 |
exceptionArg:aJavaException pc:newPc |
|
413 |
exArg := aJavaException. |
|
414 |
exPC := newPc. |
|
415 |
||
416 |
"Created: / 7.1.1998 / 21:36:56 / cg" |
|
417 |
! ! |
|
418 |
||
1098 | 419 |
!JavaContext methodsFor:'non local control flow'! |
420 |
||
421 |
unwindAndRestartForJavaException |
|
1102
df54d5b34c6b
i broke something important in last commit - quickly reverting back :)
hlopkmar
parents:
1101
diff
changeset
|
422 |
|
1098 | 423 |
"Called by JavaVM>>throwException: unwinds the stack |
424 |
up to this context and restarts it so an exception handler |
|
425 |
executes" |
|
1102
df54d5b34c6b
i broke something important in last commit - quickly reverting back :)
hlopkmar
parents:
1101
diff
changeset
|
426 |
|
df54d5b34c6b
i broke something important in last commit - quickly reverting back :)
hlopkmar
parents:
1101
diff
changeset
|
427 |
| con wasMarked | |
df54d5b34c6b
i broke something important in last commit - quickly reverting back :)
hlopkmar
parents:
1101
diff
changeset
|
428 |
|
1098 | 429 |
"Each context that has a monitor acquired has |
430 |
and unwind action that release all monitors acquired. |
|
431 |
However, we DONT want my monitors to be released, |
|
432 |
so we temporarily unmark this context for unwind and |
|
433 |
then mark it again, eventually" |
|
1102
df54d5b34c6b
i broke something important in last commit - quickly reverting back :)
hlopkmar
parents:
1101
diff
changeset
|
434 |
|
1098 | 435 |
wasMarked := self isUnwindContext. |
1102
df54d5b34c6b
i broke something important in last commit - quickly reverting back :)
hlopkmar
parents:
1101
diff
changeset
|
436 |
wasMarked ifTrue:[self unmarkForUnwind]. |
df54d5b34c6b
i broke something important in last commit - quickly reverting back :)
hlopkmar
parents:
1101
diff
changeset
|
437 |
self senderIsNil ifFalse:[ |
df54d5b34c6b
i broke something important in last commit - quickly reverting back :)
hlopkmar
parents:
1101
diff
changeset
|
438 |
con := thisContext evaluateUnwindActionsUpTo:self. |
1098 | 439 |
]. |
1476 | 440 |
wasMarked ifTrue:[self markForUnwind]. |
1102
df54d5b34c6b
i broke something important in last commit - quickly reverting back :)
hlopkmar
parents:
1101
diff
changeset
|
441 |
|
df54d5b34c6b
i broke something important in last commit - quickly reverting back :)
hlopkmar
parents:
1101
diff
changeset
|
442 |
"oops, if nil, I am not on the calling chain; |
1098 | 443 |
(bad bad, unwind action have already been performed. |
1102
df54d5b34c6b
i broke something important in last commit - quickly reverting back :)
hlopkmar
parents:
1101
diff
changeset
|
444 |
should we check for this situation first and NOT evaluate |
df54d5b34c6b
i broke something important in last commit - quickly reverting back :)
hlopkmar
parents:
1101
diff
changeset
|
445 |
the unwind actions in this case ?) |
1098 | 446 |
" |
1102
df54d5b34c6b
i broke something important in last commit - quickly reverting back :)
hlopkmar
parents:
1101
diff
changeset
|
447 |
con isNil ifTrue:[ |
1098 | 448 |
" |
449 |
tried to return to a context which is already dead |
|
1102
df54d5b34c6b
i broke something important in last commit - quickly reverting back :)
hlopkmar
parents:
1101
diff
changeset
|
450 |
(i.e. the method/block has already executed a return) |
df54d5b34c6b
i broke something important in last commit - quickly reverting back :)
hlopkmar
parents:
1101
diff
changeset
|
451 |
" |
df54d5b34c6b
i broke something important in last commit - quickly reverting back :)
hlopkmar
parents:
1101
diff
changeset
|
452 |
^ self invalidReturnOrRestartError:#'unwindAndRestart:' with:nil |
1098 | 453 |
]. |
1102
df54d5b34c6b
i broke something important in last commit - quickly reverting back :)
hlopkmar
parents:
1101
diff
changeset
|
454 |
" |
1098 | 455 |
now, that all unwind-actions are done, I can use the |
456 |
low-level restart ... |
|
457 |
" |
|
458 |
^ self restart |
|
459 |
||
460 |
"Created: / 08-11-2011 / 22:00:56 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
461 |
! ! |
|
462 |
||
752 | 463 |
!JavaContext methodsFor:'printing & storing'! |
464 |
||
465 |
receiverPrintString |
|
466 |
"return a string describing the receiver of the context" |
|
467 |
||
468 |
|receiverClass receiverClassName newString implementorClass searchClass| |
|
469 |
||
470 |
"/ %{ |
|
471 |
"/ /* |
|
472 |
"/ * special handling for (invalid) free objects. |
|
473 |
"/ * these only appear if some primitiveCode does not correctly use SEND macros, |
|
474 |
"/ * which may lead to sends to free objects. In normal operation, this 'cannot' happen. |
|
475 |
"/ */ |
|
476 |
"/ if (__isNonNilObject(__INST(receiver)) && (__qClass(__INST(receiver))==nil)) { |
|
477 |
"/ receiverClassName = __MKSTRING("FreeObject"); |
|
478 |
"/ } |
|
479 |
"/ %}. |
|
480 |
"/ receiverClassName notNil ifTrue:[^ receiverClassName]. |
|
481 |
||
482 |
receiverClass := receiver class. |
|
483 |
"/ java has no class-methods ... |
|
484 |
receiverClass := receiverClass theNonMetaclass. |
|
485 |
||
486 |
receiverClassName := receiverClass nameInBrowser. |
|
487 |
(receiverClass == SmallInteger) ifTrue:[ |
|
488 |
newString := '(' , receiver printString , ') ' , receiverClassName |
|
489 |
] ifFalse:[ |
|
490 |
newString := receiverClassName |
|
491 |
]. |
|
492 |
||
493 |
" |
|
494 |
kludge to avoid slow search for containing class |
|
495 |
" |
|
496 |
(selector ~~ #doIt and:[selector ~~ #doIt:]) ifTrue:[ |
|
497 |
implementorClass := self methodClass. |
|
498 |
]. |
|
499 |
implementorClass notNil ifTrue: [ |
|
500 |
(implementorClass ~~ receiverClass) ifTrue: [ |
|
501 |
newString := newString , '>>>', |
|
502 |
implementorClass nameInBrowser printString |
|
503 |
] |
|
504 |
] ifFalse:[ |
|
505 |
searchClass := self searchClass. |
|
506 |
searchClass ~~ receiverClass ifTrue:[ |
|
507 |
newString := newString , '>>>' , searchClass nameInBrowser |
|
508 |
]. |
|
509 |
"/ " |
|
510 |
"/ kludge for doIt - these unbound methods are not |
|
511 |
"/ found in the classes methodDictionary |
|
512 |
"/ " |
|
513 |
"/ (selector ~~ #doIt and:[selector ~~ #doIt:]) ifTrue:[ |
|
514 |
"/ newString := newString , '>>>**NONE**' |
|
515 |
"/ ] |
|
516 |
]. |
|
517 |
||
518 |
^ newString |
|
519 |
! ! |
|
520 |
||
521 |
!JavaContext methodsFor:'queries'! |
|
522 |
||
523 |
hasStackToShow |
|
524 |
"private interface to the debugger. |
|
525 |
Smalltalk contexts return false here - other language frames |
|
526 |
(i.e. Java frames) may want to show the evaluation stack" |
|
527 |
||
528 |
^ true |
|
529 |
||
530 |
"Modified: / 13.5.1997 / 16:31:12 / cg" |
|
531 |
"Created: / 7.5.1998 / 01:23:57 / cg" |
|
532 |
! |
|
533 |
||
534 |
isJavaContext |
|
535 |
"return true, if this is a javaContext." |
|
536 |
||
537 |
^ true |
|
538 |
||
539 |
"Created: / 8.5.1998 / 21:23:47 / cg" |
|
540 |
! |
|
541 |
||
542 |
stackFrame |
|
543 |
"private interface to the debugger." |
|
544 |
||
545 |
^ (1 to:self size) collect:[:i | self at:i] |
|
546 |
||
547 |
"Created: / 7.5.1998 / 01:26:19 / cg" |
|
548 |
! ! |
|
549 |
||
1455 | 550 |
!JavaContext::FinallyToken methodsFor:'accessing'! |
551 |
||
552 |
context |
|
553 |
^ context |
|
554 |
! |
|
555 |
||
556 |
context:something |
|
557 |
context := something. |
|
558 |
! |
|
559 |
||
560 |
exception |
|
561 |
^ exception |
|
562 |
! |
|
563 |
||
564 |
exception:something |
|
565 |
exception := something. |
|
566 |
! |
|
567 |
||
568 |
selector |
|
569 |
^ selector |
|
570 |
! |
|
571 |
||
572 |
selector:something |
|
573 |
selector := something. |
|
574 |
! |
|
575 |
||
576 |
value |
|
577 |
^ value |
|
578 |
! |
|
579 |
||
580 |
value:something |
|
581 |
value := something. |
|
582 |
! ! |
|
583 |
||
584 |
!JavaContext::FinallyToken methodsFor:'actions'! |
|
585 |
||
586 |
pass |
|
587 |
||
1459 | 588 |
"First, release all leftover acquired monitors" |
589 |
JavaVM releaseMonitorsOfUnwindingContext: context. |
|
590 |
||
1455 | 591 |
selector == #return ifTrue:[ |
592 |
exception return |
|
593 |
]. |
|
594 |
selector == #return: ifTrue:[ |
|
595 |
exception return: value |
|
596 |
]. |
|
597 |
||
598 |
self error:'Should never be reached'. |
|
599 |
||
600 |
"Created: / 04-04-2012 / 20:24:51 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
601 |
! ! |
|
602 |
||
752 | 603 |
!JavaContext class methodsFor:'documentation'! |
604 |
||
605 |
version |
|
1864 | 606 |
^ '$Header$' |
607 |
! |
|
608 |
||
609 |
version_HG |
|
610 |
||
611 |
^ '$Changeset: <not expanded> $' |
|
752 | 612 |
! |
613 |
||
614 |
version_SVN |
|
1864 | 615 |
^ '§Id§' |
1093 | 616 |
! ! |