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