author | mawalch |
Thu, 08 Jun 2017 14:04:24 +0200 | |
branch | cvs_MAIN |
changeset 3724 | 8184529b4866 |
parent 3579 | df828a35c541 |
child 3951 | b343448aa8aa |
permissions | -rw-r--r-- |
454 | 1 |
" |
3324
a58245c0e83a
Updated copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3228
diff
changeset
|
2 |
COPYRIGHT (c) 1996-2015 by Claus Gittinger |
454 | 3 |
|
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
|
4 |
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
|
5 |
|
3324
a58245c0e83a
Updated copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3228
diff
changeset
|
6 |
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
|
7 |
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
|
8 |
|
454 | 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. |
|
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
|
15 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
16 |
[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
|
17 |
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
|
18 |
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
|
19 |
as of 1.9.2010 |
2151 | 20 |
" |
680 | 21 |
"{ Package: 'stx:libjava' }" |
22 |
||
3384
98eb8443f4f4
Use new Logger API (use Logger severityXXX instead of symbols)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3324
diff
changeset
|
23 |
"{ NameSpace: Smalltalk }" |
98eb8443f4f4
Use new Logger API (use Logger severityXXX instead of symbols)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3324
diff
changeset
|
24 |
|
2678
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
25 |
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
|
26 |
instanceVariableNames:'exArg exPC byteCode constPool acqrMonitors' |
28 | 27 |
classVariableNames:'' |
28 |
poolDictionaries:'' |
|
713 | 29 |
category:'Languages-Java-Support' |
28 | 30 |
! |
31 |
||
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
|
32 |
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
|
33 |
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
|
34 |
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
|
35 |
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
|
36 |
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
|
37 |
! |
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 |
|
454 | 39 |
!JavaContext class methodsFor:'documentation'! |
40 |
||
41 |
copyright |
|
42 |
" |
|
3324
a58245c0e83a
Updated copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3228
diff
changeset
|
43 |
COPYRIGHT (c) 1996-2015 by Claus Gittinger |
454 | 44 |
|
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
|
45 |
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
|
46 |
|
3324
a58245c0e83a
Updated copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3228
diff
changeset
|
47 |
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
|
48 |
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
|
49 |
|
454 | 50 |
This software is furnished under a license and may be used |
51 |
only in accordance with the terms of that license and with the |
|
52 |
inclusion of the above copyright notice. This software may not |
|
53 |
be provided or otherwise made available to, or used by, any |
|
54 |
other person. No title to or ownership of the software is |
|
55 |
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
|
56 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
57 |
[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
|
58 |
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
|
59 |
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
|
60 |
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
|
61 |
|
2151 | 62 |
" |
63 |
! ! |
|
64 |
||
2678
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
65 |
!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
|
66 |
|
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
67 |
finallyTokenClass |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
68 |
^FinallyToken |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
69 |
|
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
70 |
"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
|
71 |
! ! |
2396
fadc6d7a2f5b
Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2353
diff
changeset
|
72 |
|
2151 | 73 |
!JavaContext methodsFor:'* As yet uncategorized *'! |
74 |
||
75 |
markForException |
|
76 |
"set the exception handler flag in the receiver. |
|
77 |
The JVM needs this to enter an exception handler instead of restarting |
|
78 |
from the beginning (when the context is restarted). |
|
79 |
- a highly internal mechanism and not for public use." |
|
80 |
" |
|
81 |
%{ /* NOCONTEXT */ |
|
82 |
#ifdef __JAVA_EX_PEND |
|
83 |
/* actually no longer - only a non-nil exPC is now used as marker */ |
|
84 |
__INST(flags) = (OBJ)((INT)__INST(flags) | __MASKSMALLINT(__JAVA_EX_PEND)); |
|
85 |
#endif |
|
86 |
%} |
|
454 | 87 |
" |
88 |
||
2151 | 89 |
"Modified: / 13-12-1995 / 19:05:22 / cg" |
90 |
"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
|
91 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
92 |
|
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 |
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
|
94 |
"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
|
95 |
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
|
96 |
|
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 |
| 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
|
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 := 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
|
100 |
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
|
101 |
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
|
102 |
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
|
103 |
^(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
|
104 |
|
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 |
"Created: / 10-04-2012 / 11:09:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
454 | 106 |
! ! |
28 | 107 |
|
108 |
!JavaContext methodsFor:'ST context mimicri'! |
|
109 |
||
261 | 110 |
arg1Index |
111 |
"the java stack contains the receiver in a non-static |
|
112 |
method, as slot 0. Therefore, the first arg is found at slot2 |
|
113 |
if this is for a non-static method" |
|
252 | 114 |
|
115 |
self method isStatic ifTrue:[ |
|
261 | 116 |
^ 1 |
252 | 117 |
]. |
261 | 118 |
^ 2 |
119 |
! |
|
120 |
||
121 |
argAt:n |
|
122 |
"return the i'th argument (1..nArgs)" |
|
123 |
||
124 |
^ self at:(self arg1Index - 1 + n) |
|
252 | 125 |
|
126 |
"Created: / 2.1.1998 / 17:54:13 / cg" |
|
127 |
"Modified: / 2.1.1998 / 21:39:30 / cg" |
|
128 |
! |
|
117 | 129 |
|
252 | 130 |
argAt:n put:value |
261 | 131 |
"change the i'th argument (1..nArgs)" |
216 | 132 |
|
261 | 133 |
^ super argAt:(self arg1Index - 1 + n) put:value |
252 | 134 |
|
135 |
"Created: / 2.1.1998 / 17:54:34 / cg" |
|
136 |
"Modified: / 2.1.1998 / 21:35:19 / cg" |
|
137 |
! |
|
138 |
||
139 |
args |
|
140 |
"return an array filled with the arguments of this context" |
|
141 |
||
261 | 142 |
|n| |
28 | 143 |
|
252 | 144 |
n := self numArgs. |
145 |
n == 0 ifTrue:[ |
|
261 | 146 |
"/ little optimization here - avoid creating empty containers |
255 | 147 |
^ #() |
252 | 148 |
]. |
149 |
||
261 | 150 |
^ (Array new:n) replaceFrom:1 to:n with:self startingAt:(self arg1Index). |
252 | 151 |
|
152 |
"Created: / 2.1.1998 / 17:54:57 / cg" |
|
153 |
"Modified: / 2.1.1998 / 21:34:44 / cg" |
|
154 |
! |
|
155 |
||
156 |
lineNumber |
|
157 |
|nr pc| |
|
156 | 158 |
|
252 | 159 |
pc := self pc. |
43 | 160 |
|
211 | 161 |
"/ 'ask line for pc:' print. pc printCR. |
255 | 162 |
pc isNil ifTrue:[ |
363 | 163 |
nr := self lineNumberFromMethod. |
164 |
nr notNil ifTrue:[ |
|
165 |
^ nr |
|
166 |
]. |
|
2150 | 167 |
" '-> 0 [a]' printCR. " |
363 | 168 |
^0 |
255 | 169 |
]. |
43 | 170 |
|
252 | 171 |
nr := self method lineNumberForPC:pc. |
255 | 172 |
nr isNil ifTrue:[ |
363 | 173 |
nr := self lineNumberFromMethod. |
174 |
nr notNil ifTrue:[ |
|
175 |
^ nr |
|
176 |
]. |
|
2150 | 177 |
" '-> 0 [b]' printCR. " |
363 | 178 |
^ 0 |
255 | 179 |
]. |
211 | 180 |
"/ '-> ' print. nr printCR. |
210 | 181 |
^ nr. |
28 | 182 |
|
252 | 183 |
"Created: / 1.5.1996 / 15:05:47 / cg" |
261 | 184 |
"Modified: / 15.1.1998 / 15:25:29 / cg" |
28 | 185 |
! |
186 |
||
252 | 187 |
lineNumberFromMethod |
188 |
|m| |
|
189 |
||
190 |
m := self method. |
|
191 |
m notNil ifTrue:[ |
|
255 | 192 |
^ m lineNumber |
252 | 193 |
]. |
194 |
^ nil |
|
28 | 195 |
|
252 | 196 |
"Created: / 4.1.1998 / 23:34:45 / cg" |
197 |
"Modified: / 4.1.1998 / 23:35:55 / cg" |
|
198 |
! |
|
199 |
||
200 |
method |
|
201 |
"the method may be found in the interpreter temps ..." |
|
202 |
||
614 | 203 |
method isJavaMethod ifTrue:[^ method]. |
252 | 204 |
^ super method |
205 |
||
206 |
"Created: / 1.5.1996 / 15:03:43 / cg" |
|
614 | 207 |
"Modified: / 25.9.1999 / 23:26:40 / cg" |
28 | 208 |
! |
209 |
||
210 |
numArgs |
|
252 | 211 |
"return the number of args. |
212 |
Redefined since Java keeps the receiver of a non-static method |
|
261 | 213 |
at local slot 1." |
28 | 214 |
|
252 | 215 |
|n| |
198 | 216 |
|
252 | 217 |
n := super numArgs. |
218 |
self method isStatic ifFalse:[ |
|
255 | 219 |
n := n - 1 |
252 | 220 |
]. |
221 |
^ n |
|
28 | 222 |
|
252 | 223 |
"Created: / 2.1.1998 / 22:21:24 / cg" |
28 | 224 |
! |
225 |
||
261 | 226 |
numTemps |
227 |
"return the number of temporary variables of the Method. |
|
228 |
Redefined since Java keeps the receiver of a non-static method |
|
229 |
at local slot 1." |
|
230 |
||
231 |
|n| |
|
232 |
||
233 |
n := self size - super numVars - super numArgs. |
|
234 |
^ n |
|
235 |
||
236 |
"Created: / 13.1.1998 / 16:52:32 / cg" |
|
237 |
"Modified: / 13.1.1998 / 17:23:27 / cg" |
|
238 |
! |
|
239 |
||
32 | 240 |
pc |
252 | 241 |
lineNr isNil ifTrue:[^ nil]. |
429 | 242 |
^ lineNr bitAnd:16rFFFF |
28 | 243 |
|
252 | 244 |
"Created: / 4.1.1998 / 23:33:48 / cg" |
429 | 245 |
"Modified: / 10.11.1998 / 13:20:12 / cg" |
246 |
! |
|
247 |
||
252 | 248 |
selector |
249 |
"the selector can be extracted from the method. |
|
250 |
the method may be found in the interpreter temps ..." |
|
251 |
||
252 |
|s m| |
|
253 |
||
254 |
selector isNil ifTrue:[ |
|
255 |
m := self method. |
|
256 |
m notNil ifTrue:[ |
|
257 |
^ m name |
|
258 |
] |
|
259 |
]. |
|
260 |
^ super selector |
|
261 |
||
262 |
"Modified: / 30.12.1997 / 17:22:06 / cg" |
|
263 |
"Created: / 30.12.1997 / 17:23:47 / cg" |
|
125 | 264 |
! |
265 |
||
252 | 266 |
setPC:newPC |
267 |
lineNr := newPC |
|
268 |
||
269 |
"Created: / 5.1.1998 / 00:09:02 / cg" |
|
261 | 270 |
! |
271 |
||
272 |
temporaries |
|
273 |
"return an array filled with the arguments and variables of this context" |
|
274 |
||
275 |
|n nSkipped| |
|
276 |
||
277 |
"/ the flas-numVars includes the receiver and args |
|
278 |
nSkipped := super numVars "self numArgs + self numVars". |
|
279 |
"/ but my context setup is args+numvars. |
|
280 |
nSkipped := super numArgs + super numVars. |
|
281 |
||
282 |
n := self size - nSkipped. |
|
283 |
n == 0 ifTrue:[ |
|
363 | 284 |
"/ little optimization here - avaoid creating empty containers |
285 |
^ #() |
|
261 | 286 |
]. |
287 |
||
288 |
^ (Array new:n) replaceFrom:1 to:n with:self startingAt:nSkipped+1. |
|
289 |
||
290 |
"Created: / 13.1.1998 / 15:44:12 / cg" |
|
291 |
"Modified: / 13.1.1998 / 17:22:54 / cg" |
|
292 |
! |
|
293 |
||
2150 | 294 |
vars |
261 | 295 |
"return an array filled with the local variables of this context" |
296 |
||
297 |
|nonVars mySize| |
|
298 |
||
299 |
mySize := self numVars. |
|
300 |
mySize == 0 ifTrue:[ |
|
363 | 301 |
"/ little optimization here - avaoid creating empty containers |
302 |
^ #() |
|
261 | 303 |
]. |
304 |
nonVars := (self arg1Index-1) + self numArgs. |
|
305 |
^ (Array new:mySize) replaceFrom:1 to:mySize with:self startingAt:nonVars+1 |
|
306 |
||
307 |
"Created: / 13.1.1998 / 16:48:16 / cg" |
|
252 | 308 |
! ! |
309 |
||
2151 | 310 |
!JavaContext methodsFor:'accessing'! |
311 |
||
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
|
312 |
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
|
313 |
^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
|
314 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
315 |
"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
|
316 |
"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
|
317 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
318 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
319 |
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
|
320 |
"/ 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
|
321 |
"/ 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
|
322 |
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
|
323 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
324 |
"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
|
325 |
"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
|
326 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
327 |
|
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
|
328 |
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
|
329 |
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
|
330 |
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
|
331 |
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
|
332 |
]. |
d617b4590431
(Class reading) optimization [2/4]: rewrite slow ifNil:... by faster isNil ifTrue:...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
3083
diff
changeset
|
333 |
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
|
334 |
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
|
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 |
"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
|
337 |
"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
|
338 |
"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
|
339 |
! |
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 |
|
2902
b7070e447ed0
Fixes for displaying local variables in debugger.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2887
diff
changeset
|
341 |
argsAndVars |
b7070e447ed0
Fixes for displaying local variables in debugger.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2887
diff
changeset
|
342 |
"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
|
343 |
|
3083 | 344 |
|rawArgsAndVars| |
345 |
||
346 |
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
|
347 |
"/ self method isStatic ifFalse:[^ rawArgsAndVars copyFrom:2]. |
3083 | 348 |
^ rawArgsAndVars |
2902
b7070e447ed0
Fixes for displaying local variables in debugger.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2887
diff
changeset
|
349 |
|
b7070e447ed0
Fixes for displaying local variables in debugger.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2887
diff
changeset
|
350 |
"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
|
351 |
"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
|
352 |
! |
b7070e447ed0
Fixes for displaying local variables in debugger.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2887
diff
changeset
|
353 |
|
2678
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
354 |
methodFromClass |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
355 |
"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
|
356 |
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
|
357 |
|
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
358 |
|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
|
359 |
|
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
360 |
"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
|
361 |
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
|
362 |
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
|
363 |
the context. |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
364 |
" |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
365 |
sender := self sender. |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
366 |
sender notNil ifTrue:[ |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
367 |
sendersSelector := sender selector. |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
368 |
sendersSelector notNil ifTrue:[ |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
369 |
(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
|
370 |
m := sender receiver. |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
371 |
m isMethod ifTrue:[ |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
372 |
method := m. |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
373 |
^ m |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
374 |
] |
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 |
] |
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 |
|
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
379 |
c := self searchClass. |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
380 |
" |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
381 |
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
|
382 |
(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
|
383 |
" |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
384 |
c isBehavior ifFalse:[ |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
385 |
'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
|
386 |
' 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
|
387 |
' 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
|
388 |
^ nil |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
389 |
]. |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
390 |
|
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
391 |
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
|
392 |
c notNil ifTrue:[ |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
393 |
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
|
394 |
^ method |
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 |
^ nil |
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 |
"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
|
400 |
! |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
401 |
|
2151 | 402 |
programmingLanguage |
403 |
||
404 |
^JavaLanguage instance |
|
405 |
||
406 |
"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
|
407 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
408 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
409 |
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
|
410 |
| 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
|
411 |
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
|
412 |
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
|
413 |
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
|
414 |
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
|
415 |
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
|
416 |
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
|
417 |
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
|
418 |
^ 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
|
419 |
]. |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
420 |
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
|
421 |
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
|
422 |
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
|
423 |
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
|
424 |
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
|
425 |
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
|
426 |
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
|
427 |
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
|
428 |
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
|
429 |
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
|
430 |
^ 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
|
431 |
]. |
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 |
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
|
433 |
|
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 |
"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
|
435 |
"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
|
436 |
"Modified: / 02-03-2015 / 14:07:33 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
2151 | 437 |
! ! |
438 |
||
252 | 439 |
!JavaContext methodsFor:'exception handler support'! |
117 | 440 |
|
255 | 441 |
exceptionArg:aJavaException |
511 | 442 |
exArg := aJavaException. |
443 |
||
444 |
"Created: / 7.1.1998 / 21:36:56 / cg" |
|
445 |
! |
|
446 |
||
447 |
exceptionArg:aJavaException pc:newPc |
|
448 |
exArg := aJavaException. |
|
449 |
exPC := newPc. |
|
255 | 450 |
|
451 |
"Created: / 7.1.1998 / 21:36:56 / cg" |
|
28 | 452 |
! ! |
453 |
||
2678
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
454 |
!JavaContext methodsFor:'non local control flow'! |
2396
fadc6d7a2f5b
Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2353
diff
changeset
|
455 |
|
2678
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
456 |
restart |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
457 |
"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
|
458 |
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
|
459 |
|
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
460 |
| m | |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
461 |
|
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
462 |
m := self methodFromClass. |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
463 |
m notNil ifTrue:[ |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
464 |
byteCode := m byteCode. |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
465 |
constPool := m constantPool. |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
466 |
]. |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
467 |
^super restart. |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
468 |
|
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
469 |
"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
|
470 |
"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
|
471 |
! |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
472 |
|
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
473 |
return |
c865275e48a7
Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2396
diff
changeset
|
474 |
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
|
475 |
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
|
476 |
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
|
477 |
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
|
478 |
^self return: 0 |
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 |
"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
|
481 |
! |
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
|
482 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
483 |
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
|
484 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
485 |
"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
|
486 |
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
|
487 |
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
|
488 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
489 |
| 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
|
490 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
491 |
"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
|
492 |
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
|
493 |
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
|
494 |
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
|
495 |
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
|
496 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
497 |
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
|
498 |
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
|
499 |
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
|
500 |
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
|
501 |
]. |
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 |
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
|
503 |
|
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 |
"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
|
505 |
(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
|
506 |
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
|
507 |
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
|
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 |
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
|
510 |
" |
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 |
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
|
512 |
(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
|
513 |
" |
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 |
^ 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
|
515 |
]. |
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 |
" |
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 |
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
|
518 |
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
|
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 |
^ 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
|
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 |
"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
|
523 |
! ! |
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 |
|
28 | 525 |
!JavaContext methodsFor:'printing & storing'! |
526 |
||
2729
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2726
diff
changeset
|
527 |
printOn:aStream |
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2726
diff
changeset
|
528 |
"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
|
529 |
|
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2726
diff
changeset
|
530 |
self printReceiverOn:aStream. |
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2726
diff
changeset
|
531 |
"/ aStream nextPutAll:' '. |
3579 | 532 |
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
|
533 |
|
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2726
diff
changeset
|
534 |
aStream bold. |
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2726
diff
changeset
|
535 |
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
|
536 |
"/ 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
|
537 |
aStream normal. |
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2726
diff
changeset
|
538 |
aStream space. |
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2726
diff
changeset
|
539 |
(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
|
540 |
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
|
541 |
]. |
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2726
diff
changeset
|
542 |
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
|
543 |
|
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2726
diff
changeset
|
544 |
"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
|
545 |
! |
ac412f6ea6d4
More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2726
diff
changeset
|
546 |
|
252 | 547 |
receiverPrintString |
2150 | 548 |
"return a string describing the receiver of the context" |
52 | 549 |
|
680 | 550 |
|receiverClass receiverClassName newString implementorClass searchClass| |
28 | 551 |
|
363 | 552 |
"/ %{ |
553 |
"/ /* |
|
554 |
"/ * special handling for (invalid) free objects. |
|
555 |
"/ * these only appear if some primitiveCode does not correctly use SEND macros, |
|
556 |
"/ * which may lead to sends to free objects. In normal operation, this 'cannot' happen. |
|
2150 | 557 |
"/ */ |
363 | 558 |
"/ if (__isNonNilObject(__INST(receiver)) && (__qClass(__INST(receiver))==nil)) { |
559 |
"/ receiverClassName = __MKSTRING("FreeObject"); |
|
560 |
"/ } |
|
561 |
"/ %}. |
|
680 | 562 |
"/ receiverClassName notNil ifTrue:[^ receiverClassName]. |
228 | 563 |
|
252 | 564 |
receiverClass := receiver class. |
680 | 565 |
"/ java has no class-methods ... |
566 |
receiverClass := receiverClass theNonMetaclass. |
|
567 |
||
568 |
receiverClassName := receiverClass nameInBrowser. |
|
252 | 569 |
(receiverClass == SmallInteger) ifTrue:[ |
2150 | 570 |
newString := '(' , receiver printString , ') ' , receiverClassName |
228 | 571 |
] ifFalse:[ |
2150 | 572 |
newString := receiverClassName |
228 | 573 |
]. |
574 |
||
252 | 575 |
" |
576 |
kludge to avoid slow search for containing class |
|
577 |
" |
|
578 |
(selector ~~ #doIt and:[selector ~~ #doIt:]) ifTrue:[ |
|
2150 | 579 |
implementorClass := self methodClass. |
252 | 580 |
]. |
581 |
implementorClass notNil ifTrue: [ |
|
2150 | 582 |
(implementorClass ~~ receiverClass) ifTrue: [ |
583 |
newString := newString , '>>>', |
|
584 |
implementorClass nameInBrowser printString |
|
585 |
] |
|
252 | 586 |
] ifFalse:[ |
2150 | 587 |
searchClass := self searchClass. |
588 |
searchClass ~~ receiverClass ifTrue:[ |
|
589 |
newString := newString , '>>>' , searchClass nameInBrowser |
|
590 |
]. |
|
252 | 591 |
"/ " |
592 |
"/ kludge for doIt - these unbound methods are not |
|
593 |
"/ found in the classes methodDictionary |
|
594 |
"/ " |
|
595 |
"/ (selector ~~ #doIt and:[selector ~~ #doIt:]) ifTrue:[ |
|
596 |
"/ newString := newString , '>>>**NONE**' |
|
597 |
"/ ] |
|
28 | 598 |
]. |
599 |
||
252 | 600 |
^ newString |
28 | 601 |
! ! |
602 |
||
343 | 603 |
!JavaContext methodsFor:'queries'! |
604 |
||
605 |
hasStackToShow |
|
606 |
"private interface to the debugger. |
|
607 |
Smalltalk contexts return false here - other language frames |
|
608 |
(i.e. Java frames) may want to show the evaluation stack" |
|
609 |
||
610 |
^ true |
|
611 |
||
612 |
"Modified: / 13.5.1997 / 16:31:12 / cg" |
|
613 |
"Created: / 7.5.1998 / 01:23:57 / cg" |
|
614 |
! |
|
615 |
||
346 | 616 |
isJavaContext |
617 |
"return true, if this is a javaContext." |
|
618 |
||
619 |
^ true |
|
620 |
||
621 |
"Created: / 8.5.1998 / 21:23:47 / cg" |
|
622 |
! |
|
623 |
||
343 | 624 |
stackFrame |
625 |
"private interface to the debugger." |
|
626 |
||
627 |
^ (1 to:self size) collect:[:i | self at:i] |
|
628 |
||
629 |
"Created: / 7.5.1998 / 01:26:19 / cg" |
|
630 |
! ! |
|
631 |
||
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
|
632 |
!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
|
633 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
634 |
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
|
635 |
^ 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
|
636 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
637 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
638 |
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
|
639 |
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
|
640 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
641 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
642 |
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
|
643 |
^ 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
|
644 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
645 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
646 |
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
|
647 |
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
|
648 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
649 |
|
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 |
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
|
651 |
^ 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
|
652 |
! |
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 |
|
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 |
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
|
655 |
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
|
656 |
! |
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 |
|
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 |
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
|
659 |
^ 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
|
660 |
! |
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 |
|
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 |
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
|
663 |
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
|
664 |
! ! |
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 |
|
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 |
!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
|
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 |
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
|
669 |
|
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 |
selector == #return ifTrue:[ |
2841
6fa1bcf9c997
JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2732
diff
changeset
|
671 |
thisContext evaluateUnwindActionsUpTo:context. |
6fa1bcf9c997
JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2732
diff
changeset
|
672 |
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
|
673 |
]. |
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 |
selector == #return: ifTrue:[ |
2841
6fa1bcf9c997
JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2732
diff
changeset
|
675 |
thisContext evaluateUnwindActionsUpTo:context. |
6fa1bcf9c997
JavaClass>>#name vs. #binaryName refactoring
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2732
diff
changeset
|
676 |
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
|
677 |
]. |
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 |
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
|
680 |
|
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 |
"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
|
682 |
"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
|
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 |
|
129 | 685 |
!JavaContext class methodsFor:'documentation'! |
28 | 686 |
|
687 |
version |
|
3579 | 688 |
^ '$Header$' |
2304
73806b718f4e
fixed: #version_SVN ($ to §)
Claus Gittinger <cg@exept.de>
parents:
2168
diff
changeset
|
689 |
! |
73806b718f4e
fixed: #version_SVN ($ to §)
Claus Gittinger <cg@exept.de>
parents:
2168
diff
changeset
|
690 |
|
73806b718f4e
fixed: #version_SVN ($ to §)
Claus Gittinger <cg@exept.de>
parents:
2168
diff
changeset
|
691 |
version_CVS |
3579 | 692 |
^ '$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
|
693 |
! |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2304
diff
changeset
|
694 |
|
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 |
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
|
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 |
^ '$Changeset: <not expanded> $' |
2151 | 698 |
! |
699 |
||
700 |
version_SVN |
|
3579 | 701 |
^ '$Id$' |
2108 | 702 |
! ! |
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
|
703 |