author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Thu, 18 Apr 2013 17:46:56 +0200 | |
branch | development |
changeset 2522 | 88de19714cfb |
parent 2429 | ebece4dcaab9 |
child 2711 | a00302fe5083 |
child 2726 | 6971720de5a4 |
permissions | -rw-r--r-- |
749 | 1 |
" |
2 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2313
diff
changeset
|
3 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2313
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:
2313
diff
changeset
|
5 |
|
749 | 6 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
7 |
SWING Research Group, Czech Technical University in Prague |
|
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. |
|
15 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2313
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:
2313
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:
2313
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:
2313
diff
changeset
|
19 |
as of 1.9.2010 |
749 | 20 |
" |
21 |
"{ Package: 'stx:libjava' }" |
|
22 |
||
23 |
JavaByteCodeProcessor subclass:#JavaByteCodeDisassembler |
|
24 |
instanceVariableNames:'outStream placeholders format lastLno' |
|
25 |
classVariableNames:'StandardFormat ExtendedFormat' |
|
26 |
poolDictionaries:'' |
|
27 |
category:'Languages-Java-Bytecode' |
|
28 |
! |
|
29 |
||
30 |
!JavaByteCodeDisassembler class methodsFor:'documentation'! |
|
31 |
||
32 |
copyright |
|
33 |
" |
|
34 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2313
diff
changeset
|
35 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2313
diff
changeset
|
36 |
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:
2313
diff
changeset
|
37 |
|
749 | 38 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
39 |
SWING Research Group, Czech Technical University in Prague |
|
40 |
||
41 |
This software is furnished under a license and may be used |
|
42 |
only in accordance with the terms of that license and with the |
|
43 |
inclusion of the above copyright notice. This software may not |
|
44 |
be provided or otherwise made available to, or used by, any |
|
45 |
other person. No title to or ownership of the software is |
|
46 |
hereby transferred. |
|
47 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2313
diff
changeset
|
48 |
[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:
2313
diff
changeset
|
49 |
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:
2313
diff
changeset
|
50 |
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:
2313
diff
changeset
|
51 |
as of 1.9.2010 |
749 | 52 |
|
53 |
" |
|
54 |
! ! |
|
55 |
||
2396
fadc6d7a2f5b
Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2353
diff
changeset
|
56 |
|
749 | 57 |
!JavaByteCodeDisassembler class methodsFor:'initialization'! |
58 |
||
59 |
initialize |
|
60 |
super initialize. |
|
61 |
Verbose := false. |
|
62 |
StandardFormat := ' %(PC) %(ISN) %(OPERANDS)'. |
|
63 |
ExtendedFormat := ' %(PC) [%(OPCODE)] %(ISN) %(OPERANDS) %(STACK)'. |
|
64 |
||
65 |
"Modified: / 22-03-2011 / 17:07:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
66 |
"Modified: / 22-03-2011 / 20:53:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
67 |
! ! |
|
68 |
||
2396
fadc6d7a2f5b
Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2353
diff
changeset
|
69 |
|
749 | 70 |
!JavaByteCodeDisassembler class methodsFor:'instance creation'! |
71 |
||
72 |
new |
|
73 |
"return an initialized instance" |
|
74 |
||
75 |
^ self basicNew initialize. |
|
76 |
! ! |
|
77 |
||
2396
fadc6d7a2f5b
Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2353
diff
changeset
|
78 |
|
749 | 79 |
!JavaByteCodeDisassembler class methodsFor:'disassembling'! |
80 |
||
81 |
diassemble:aMethod |
|
82 |
^ self new diassemble:aMethod. |
|
83 |
||
84 |
"Created: / 17-03-2011 / 17:41:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
85 |
! |
|
86 |
||
87 |
diassemble:aMethod to: aStream |
|
88 |
^ self new diassemble:aMethod to: aStream |
|
89 |
||
90 |
"Created: / 22-03-2011 / 21:13:06 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
91 |
! ! |
|
92 |
||
2396
fadc6d7a2f5b
Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2353
diff
changeset
|
93 |
|
749 | 94 |
!JavaByteCodeDisassembler methodsFor:'disassembling'! |
95 |
||
96 |
diassemble:aJavaMethod |
|
97 |
self diassemble:aJavaMethod to:Transcript. |
|
98 |
||
99 |
"Created: / 17-03-2011 / 17:42:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
100 |
"Modified: / 20-03-2011 / 22:43:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
101 |
! |
|
102 |
||
103 |
diassemble:aJavaMethod to:aStream |
|
104 |
|fakeArgArray size| |
|
105 |
||
106 |
outStream := aStream. |
|
107 |
size := aJavaMethod javaNumArgs. |
|
108 |
fakeArgArray := Array new:size. |
|
109 |
1 to:size |
|
110 |
do:[:index | fakeArgArray at:index put:('Arg ' , index printString) ]. |
|
111 |
self prettyPrintHeaderFor:aJavaMethod. |
|
112 |
self |
|
113 |
process:aJavaMethod |
|
114 |
receiver:aJavaMethod javaClass |
|
115 |
arguments:fakeArgArray. |
|
116 |
||
117 |
"Created: / 17-03-2011 / 22:21:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
118 |
"Modified: / 22-03-2011 / 15:59:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
119 |
! ! |
|
120 |
||
2396
fadc6d7a2f5b
Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2353
diff
changeset
|
121 |
|
749 | 122 |
!JavaByteCodeDisassembler methodsFor:'helpers - constants'! |
123 |
||
124 |
address |
|
125 |
^ 'address'. |
|
126 |
||
127 |
"Created: / 20-03-2011 / 21:20:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
128 |
! |
|
129 |
||
130 |
arrayLength |
|
131 |
^ 'arrayLength' |
|
132 |
||
133 |
"Created: / 20-03-2011 / 18:31:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
134 |
! |
|
135 |
||
136 |
arrayRef |
|
137 |
^ 'arrayRef' |
|
138 |
||
139 |
"Created: / 20-03-2011 / 18:24:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
140 |
! |
|
141 |
||
142 |
dimensions |
|
143 |
^'count1, [count2,...]'. |
|
144 |
||
145 |
"Created: / 20-03-2011 / 21:26:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
146 |
! |
|
147 |
||
148 |
empty |
|
149 |
^ 'EMPTY' |
|
150 |
||
151 |
"Created: / 20-03-2011 / 18:30:47 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
152 |
! |
|
153 |
||
154 |
excRef |
|
155 |
^ 'exceptionRef' |
|
156 |
||
157 |
"Created: / 20-03-2011 / 18:36:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
158 |
! |
|
159 |
||
160 |
index |
|
161 |
^ 'index' |
|
162 |
||
163 |
"Created: / 20-03-2011 / 18:28:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
164 |
! |
|
165 |
||
166 |
key |
|
167 |
^'key'. |
|
168 |
||
169 |
"Created: / 20-03-2011 / 21:24:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
170 |
! |
|
171 |
||
172 |
nothing |
|
173 |
^ '' |
|
174 |
||
175 |
"Created: / 20-03-2011 / 18:31:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
176 |
! |
|
177 |
||
178 |
null |
|
179 |
^ 'null' |
|
180 |
||
181 |
"Created: / 20-03-2011 / 18:29:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
182 |
! |
|
183 |
||
184 |
objRef |
|
185 |
^ 'objectRef' |
|
186 |
||
187 |
"Created: / 20-03-2011 / 18:24:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
188 |
! |
|
189 |
||
190 |
result |
|
191 |
^ 'result' |
|
192 |
||
193 |
"Created: / 20-03-2011 / 18:40:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
194 |
! |
|
195 |
||
196 |
sep |
|
197 |
^ ', '. |
|
198 |
||
199 |
"Created: / 20-03-2011 / 18:28:24 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
200 |
! |
|
201 |
||
202 |
size |
|
203 |
^ 'size' |
|
204 |
||
205 |
"Created: / 20-03-2011 / 18:30:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
206 |
! |
|
207 |
||
208 |
stackGroupClose |
|
209 |
^ '}'. |
|
210 |
||
211 |
"Created: / 20-03-2011 / 21:02:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
212 |
! |
|
213 |
||
214 |
stackGroupOpen |
|
215 |
^'{'. |
|
216 |
||
217 |
"Created: / 20-03-2011 / 21:02:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
218 |
! |
|
219 |
||
220 |
value |
|
221 |
^ 'value' |
|
222 |
||
223 |
"Created: / 20-03-2011 / 18:24:52 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
224 |
! |
|
225 |
||
226 |
valueMarked |
|
227 |
^ 'valueX' |
|
228 |
||
229 |
"Created: / 20-03-2011 / 20:58:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
230 |
! |
|
231 |
||
232 |
valueMarked2 |
|
233 |
^ 'valueY' |
|
234 |
||
235 |
"Created: / 20-03-2011 / 21:33:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
236 |
! |
|
237 |
||
238 |
varArgs |
|
239 |
^'[arg1, arg2, ...] '. |
|
240 |
||
241 |
"Created: / 20-03-2011 / 21:16:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
242 |
! |
|
243 |
||
244 |
whatever |
|
245 |
^ '..' |
|
246 |
||
247 |
"Created: / 20-03-2011 / 18:31:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
248 |
! ! |
|
249 |
||
2396
fadc6d7a2f5b
Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2353
diff
changeset
|
250 |
|
749 | 251 |
!JavaByteCodeDisassembler methodsFor:'helpers - instruction groups'! |
252 |
||
253 |
arrayValueLoader |
|
254 |
self |
|
255 |
writeInstructionWithArgs: self nothing |
|
256 |
stackBefore: self arrayRef , self sep , self index |
|
257 |
after: self value. |
|
258 |
||
259 |
"Created: / 20-03-2011 / 19:58:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
260 |
! |
|
261 |
||
262 |
arrayValueStorer |
|
263 |
self |
|
264 |
writeInstructionWithArgs: self nothing |
|
265 |
stackBefore: self arrayRef , self sep , self index , self sep , self value |
|
266 |
after: self whatever. |
|
267 |
||
268 |
"Created: / 20-03-2011 / 20:01:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
269 |
! |
|
270 |
||
271 |
constPusher: const |
|
272 |
self |
|
273 |
writeInstructionWithArgs: self nothing |
|
274 |
stackBefore: self whatever |
|
275 |
after: const. |
|
276 |
||
277 |
"Created: / 20-03-2011 / 20:39:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
278 |
! |
|
279 |
||
280 |
fieldLoader: index |
|
281 |
self |
|
282 |
writeInstructionWithArgs: self nothing |
|
283 |
stackBefore: self whatever |
|
284 |
after: (self prettyPrintField: index). |
|
285 |
||
286 |
"Created: / 20-03-2011 / 20:43:24 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
287 |
"Modified: / 21-03-2011 / 15:23:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
288 |
! |
|
289 |
||
290 |
fieldStorer: index |
|
291 |
self |
|
292 |
writeInstructionWithArgs: self nothing |
|
293 |
stackBefore: (self prettyPrintField: index) |
|
294 |
after: self whatever. |
|
295 |
||
296 |
"Created: / 20-03-2011 / 20:53:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
297 |
"Modified: / 21-03-2011 / 15:23:22 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
298 |
! |
|
299 |
||
300 |
indexedFieldLoader |
|
301 |
| index | |
|
302 |
||
303 |
wide |
|
304 |
ifTrue: |
|
305 |
[ index := self fetchIndex2. |
|
306 |
wide := false. ] |
|
307 |
ifFalse: [ index := self fetchIndex ]. |
|
308 |
self |
|
309 |
writeInstructionWithArgs: (self prettyPrintField: index) |
|
310 |
stackBefore: self whatever |
|
311 |
after: self whatever. |
|
312 |
||
313 |
"Created: / 20-03-2011 / 20:44:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
314 |
"Modified: / 19-05-2011 / 10:38:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
315 |
! |
|
316 |
||
317 |
indexedFieldStorer |
|
318 |
| index | |
|
319 |
||
320 |
wide |
|
321 |
ifTrue: |
|
322 |
[ index := self fetchIndex2. |
|
323 |
wide := false. ] |
|
324 |
ifFalse: [ index := self fetchIndex ]. |
|
325 |
self |
|
326 |
writeInstructionWithArgs: (self prettyPrintField: index) |
|
327 |
stackBefore: (self prettyPrintValue:'newVal') |
|
328 |
after: self whatever. |
|
329 |
||
330 |
"Created: / 20-03-2011 / 20:53:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
331 |
"Modified: / 19-05-2011 / 13:04:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
332 |
! |
|
333 |
||
334 |
returnIfFinished |
|
335 |
(pc >= byteCode size) ifTrue: [ self leaveProcessorWith: nil ]. |
|
336 |
||
337 |
"Created: / 21-03-2011 / 14:54:52 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
338 |
! |
|
339 |
||
340 |
twoValuesBasedJumper |
|
341 |
self |
|
342 |
writeInstructionWithArgs: (self prettyPrintJump: self fetchBytes2) |
|
343 |
stackBefore: self value , self sep , self value |
|
344 |
after: self whatever. |
|
345 |
||
346 |
"Created: / 20-03-2011 / 21:10:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
347 |
"Modified: / 20-03-2011 / 23:03:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
348 |
! |
|
349 |
||
350 |
twoValuesManipulator |
|
351 |
self |
|
352 |
writeInstructionWithArgs: self nothing |
|
353 |
stackBefore: self value , self sep , self value after: self result. |
|
354 |
||
355 |
"Created: / 20-03-2011 / 20:31:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
356 |
! |
|
357 |
||
358 |
valueBasedJumper |
|
359 |
self |
|
360 |
writeInstructionWithArgs: (self prettyPrintJump: self fetchBytes2) |
|
361 |
stackBefore: self value |
|
362 |
after: self whatever. |
|
363 |
||
364 |
"Created: / 20-03-2011 / 21:09:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
365 |
"Modified: / 21-03-2011 / 13:03:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
366 |
! |
|
367 |
||
368 |
valueLoader |
|
369 |
self |
|
370 |
writeInstructionWithArgs: self nothing |
|
371 |
stackBefore: self whatever |
|
372 |
after: self value. |
|
373 |
||
374 |
"Created: / 20-03-2011 / 20:25:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
375 |
! |
|
376 |
||
377 |
valueManipulator |
|
378 |
self |
|
379 |
writeInstructionWithArgs: self nothing |
|
380 |
stackBefore: self value |
|
381 |
after: self result. |
|
382 |
||
383 |
"Created: / 20-03-2011 / 20:27:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
384 |
! |
|
385 |
||
386 |
valueReturner |
|
387 |
self |
|
388 |
writeInstructionWithArgs: self nothing |
|
389 |
stackBefore: self value |
|
390 |
after: self empty. |
|
391 |
self returnIfFinished. |
|
392 |
||
393 |
"Created: / 20-03-2011 / 20:48:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
394 |
"Modified: / 21-03-2011 / 14:55:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
395 |
! ! |
|
396 |
||
2396
fadc6d7a2f5b
Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2353
diff
changeset
|
397 |
|
749 | 398 |
!JavaByteCodeDisassembler methodsFor:'helpers - printing'! |
399 |
||
400 |
prettyPrintArgs: argsString |
|
401 |
^argsString printString |
|
402 |
||
403 |
"Created: / 20-03-2011 / 17:30:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
404 |
"Modified: / 21-03-2011 / 20:42:14 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
405 |
! |
|
406 |
||
407 |
prettyPrintByte: val |
|
408 |
^ self prettyPrintValue: val. |
|
409 |
||
410 |
"Created: / 20-03-2011 / 21:46:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
411 |
! |
|
412 |
||
413 |
prettyPrintExceptionTable: table |
|
414 |
table isNil ifTrue: [ ^ '' ]. |
|
415 |
^ 'Throws:' |
|
416 |
, (table inject: '' into: [:acc :each | acc , ' ' , each name ]). |
|
417 |
||
418 |
"Created: / 22-03-2011 / 16:16:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
419 |
"Modified: / 22-03-2011 / 20:59:39 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
420 |
"Modified: / 04-06-2011 / 17:19:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
421 |
! |
|
422 |
||
423 |
prettyPrintField: fieldIndex |
|
424 |
^ 'FIELD ' , fieldIndex printString , ': ' |
|
425 |
, (context at: fieldIndex + 1) displayString. |
|
426 |
||
427 |
"Created: / 20-03-2011 / 17:31:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
428 |
"Modified: / 21-03-2011 / 15:57:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
429 |
! |
|
430 |
||
431 |
prettyPrintHeaderFor: javaMethod |
|
432 |
outStream |
|
433 |
cr; |
|
434 |
print: (javaMethod signatureNameWithModifiers); |
|
435 |
cr; |
|
436 |
print: ('defined in: ' , javaMethod javaClass printString); |
|
437 |
cr; |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2313
diff
changeset
|
438 |
print: '# arg slots: ' , javaMethod numArgs printString , ', '; |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2313
diff
changeset
|
439 |
print: '# var slots: ' , javaMethod numVars printString , ', '; |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2313
diff
changeset
|
440 |
print: '# stack slots: ', javaMethod stackSize printString , ' '; |
749 | 441 |
cr; |
442 |
print: (self prettyPrintExceptionTable: javaMethod exceptionTable); |
|
443 |
cr. |
|
444 |
||
445 |
"Created: / 22-03-2011 / 15:59:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2313
diff
changeset
|
446 |
"Modified: / 12-10-2012 / 11:58:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
749 | 447 |
! |
448 |
||
449 |
prettyPrintIndex: index |
|
450 |
^ (constantPool at: index) displayString , ' [' , index printString |
|
451 |
, '@CP]'. |
|
452 |
||
453 |
"Created: / 20-03-2011 / 17:20:34 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
454 |
"Modified: / 22-03-2011 / 16:48:32 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
455 |
! |
|
456 |
||
457 |
prettyPrintJump: jmpNum |
|
458 |
^ 'JMP to: ' , (instrPointer + jmpNum ) printString. |
|
459 |
||
460 |
"Modified: / 21-03-2011 / 14:25:52 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
461 |
! |
|
462 |
||
463 |
prettyPrintLineNumber |
|
464 |
|lineNumber| |
|
465 |
lineNumber := method quickLineNumberForPC: instrPointer. |
|
466 |
lineNumber isNil ifTrue: [^'']. |
|
467 |
^ (lineNumber printString leftPaddedTo: 4 |
|
468 |
with: Character space) |
|
469 |
||
470 |
"Modified: / 22-03-2011 / 17:04:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
471 |
! |
|
472 |
||
473 |
prettyPrintLookupSwitchMadness |
|
474 |
| paddingSize default npairs result | |
|
475 |
result := TextStream on: ''. |
|
476 |
paddingSize := self skipPadding. |
|
477 |
default := self fetchBytes4. |
|
478 |
npairs := self fetchBytes4. |
|
479 |
result |
|
480 |
print: 'PADDING: '; |
|
481 |
print: paddingSize printString; |
|
482 |
print: ' NPAIRS: '; |
|
483 |
print: npairs printString; |
|
484 |
cr. |
|
485 |
result |
|
486 |
print: (' [ '); |
|
487 |
cr. |
|
488 |
npairs timesRepeat: |
|
489 |
||
490 |
[ result |
|
491 |
print: ' '; |
|
492 |
print: (self fetchBytes4 printString); |
|
493 |
print: ': '; |
|
494 |
print: (self prettyPrintJump: self fetchBytes4); |
|
495 |
cr. ]. |
|
496 |
result |
|
497 |
print: (' default'); |
|
498 |
print: ': '; |
|
499 |
print: (self prettyPrintJump: default); |
|
500 |
cr. |
|
501 |
result |
|
502 |
print: (' ]'); |
|
503 |
cr. |
|
504 |
^ result stringContents. |
|
505 |
||
506 |
"Created: / 20-03-2011 / 21:23:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
507 |
"Modified: / 22-03-2011 / 15:03:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
508 |
"Modified: / 08-08-2011 / 17:31:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
509 |
! |
|
510 |
||
511 |
prettyPrintRef: ref |
|
512 |
||
513 |
^ ref prettyPrintString. |
|
514 |
||
515 |
"Created: / 20-03-2011 / 17:20:25 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
516 |
"Modified: / 14-08-2011 / 21:12:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
517 |
! |
|
518 |
||
519 |
prettyPrintStackBefore: beforeString after: afterString |
|
520 |
^ 'STACK: [' , beforeString printString , ' -> ' , afterString printString , ']'. |
|
521 |
||
522 |
"Created: / 20-03-2011 / 17:24:47 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
523 |
! |
|
524 |
||
525 |
prettyPrintTableSwitchMadness |
|
526 |
| paddingSize default low high result | |
|
527 |
||
528 |
result := TextStream on: ''. |
|
529 |
paddingSize := self skipPadding. |
|
530 |
default := self fetchBytes4. |
|
531 |
low := self fetchBytes4. |
|
532 |
high := self fetchBytes4. |
|
533 |
result |
|
534 |
print: 'PADDING: '; |
|
535 |
print: paddingSize printString; |
|
536 |
print: ' LOW: '; |
|
537 |
print: low printString; |
|
538 |
print: ' HIGH: '; |
|
539 |
print: high printString; |
|
540 |
cr. |
|
541 |
result |
|
542 |
print: (' [ '); |
|
543 |
cr. |
|
544 |
low to: high |
|
545 |
do: |
|
546 |
[:index | |
|
547 |
result |
|
548 |
nextPutAll:' '; print: (index printString); |
|
549 |
print: ': '; |
|
550 |
print: (self prettyPrintJump: self fetchBytes4); |
|
551 |
cr. ]. |
|
552 |
result |
|
553 |
print: (' default'); |
|
554 |
print: ': '; |
|
555 |
print: (self prettyPrintJump: default); |
|
556 |
cr. |
|
557 |
result |
|
558 |
print: (' ]'); |
|
559 |
cr. |
|
560 |
^ result stringContents. |
|
561 |
||
562 |
"Created: / 20-03-2011 / 21:34:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
563 |
"Modified: / 21-03-2011 / 15:01:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
564 |
"Modified: / 08-08-2011 / 17:29:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
565 |
! |
|
566 |
||
567 |
prettyPrintType: type |
|
568 |
type = 4 ifTrue: [ ^ 'boolean']. |
|
569 |
type = 5 ifTrue: [ ^'char']. |
|
570 |
type = 6 ifTrue: [ ^ 'float' ]. |
|
571 |
type = 7 ifTrue: [ ^'double' ]. |
|
572 |
type = 8 ifTrue: [ ^ 'byte' ]. |
|
573 |
type = 9 ifTrue: [ ^ 'short' ]. |
|
574 |
type = 10 ifTrue: [ ^'int' ]. |
|
575 |
type = 11 ifTrue: [ ^ 'long' ]. |
|
576 |
||
577 |
"Created: / 20-03-2011 / 20:12:08 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
578 |
! |
|
579 |
||
580 |
prettyPrintValue: val |
|
581 |
^ val printString. |
|
582 |
||
583 |
"Created: / 20-03-2011 / 18:16:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
584 |
! |
|
585 |
||
586 |
writeInstructionWithArgs: argsString stackBefore: stackBefore after: stackAfter |
|
587 |
placeholders |
|
588 |
at: 'PC' |
|
589 |
put: (instrPointer printString leftPaddedTo: 3 with: Character space); |
|
590 |
at: 'LINENUMBER' put: self prettyPrintLineNumber; |
|
591 |
at: 'OPCODE' put: (op printString leftPaddedTo: 3 with: Character space); |
|
592 |
at: 'ISN' |
|
593 |
put: ((OpSwitchTable at: op + 1) asUppercase printString paddedTo: 10); |
|
594 |
at: 'OPERANDS' put: ((self prettyPrintArgs: argsString) paddedTo: 25); |
|
595 |
at: 'STACK' |
|
596 |
put: (self prettyPrintStackBefore: stackBefore after: stackAfter). |
|
597 |
format expandPlaceholdersWith: placeholders on: outStream. |
|
598 |
outStream cr. |
|
599 |
||
600 |
"Created: / 20-03-2011 / 19:56:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
601 |
"Modified: / 21-03-2011 / 20:56:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
602 |
"Modified: / 22-03-2011 / 17:00:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
603 |
! |
|
604 |
||
605 |
writeLine: lno |
|
606 |
||
607 |
outStream nextPutAll: 'LINE '. |
|
608 |
lno printOn: outStream. |
|
609 |
outStream cr. |
|
610 |
||
611 |
"Modified: / 22-03-2011 / 17:00:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
612 |
"Created: / 22-03-2011 / 20:53:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
613 |
! ! |
|
614 |
||
2396
fadc6d7a2f5b
Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2353
diff
changeset
|
615 |
|
749 | 616 |
!JavaByteCodeDisassembler methodsFor:'initialization'! |
617 |
||
618 |
initialize |
|
619 |
"Invoked when a new instance is created." |
|
620 |
||
621 |
"/ please change as required (and remove this comment) |
|
622 |
"/ outStream := nil. |
|
623 |
placeholders := Dictionary new. |
|
624 |
format := StandardFormat. |
|
625 |
"/ExtendedFormat. |
|
626 |
||
627 |
"/ super initialize. -- commented since inherited method does nothing |
|
628 |
||
629 |
"Modified: / 22-03-2011 / 20:53:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
630 |
! ! |
|
631 |
||
2396
fadc6d7a2f5b
Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2353
diff
changeset
|
632 |
|
749 | 633 |
!JavaByteCodeDisassembler methodsFor:'instructions'! |
634 |
||
635 |
aaload |
|
636 |
self |
|
637 |
arrayValueLoader. |
|
638 |
||
639 |
"Modified: / 20-03-2011 / 19:59:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
640 |
! |
|
641 |
||
642 |
aastore |
|
643 |
self |
|
644 |
arrayValueStorer. |
|
645 |
||
646 |
"Modified: / 20-03-2011 / 20:01:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
647 |
! |
|
648 |
||
649 |
aconst_null |
|
650 |
self |
|
651 |
constPusher: 'null'. |
|
652 |
||
653 |
"Modified: / 20-03-2011 / 20:39:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
654 |
! |
|
655 |
||
656 |
aload |
|
657 |
||
658 |
self |
|
659 |
writeInstructionWithArgs: (self prettyPrintField: self fetchIndex) |
|
660 |
stackBefore: self whatever |
|
661 |
after: self objRef. |
|
662 |
||
663 |
"Modified: / 21-03-2011 / 15:45:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
664 |
! |
|
665 |
||
666 |
aload: arg |
|
667 |
self |
|
668 |
writeInstructionWithArgs: self nothing |
|
669 |
stackBefore: self whatever |
|
670 |
after: (self prettyPrintField: arg). |
|
671 |
||
672 |
"Modified: / 21-03-2011 / 16:30:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
673 |
! |
|
674 |
||
675 |
anewarray |
|
676 |
self |
|
677 |
writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex2) |
|
678 |
stackBefore: self size |
|
679 |
after: self arrayRef. |
|
680 |
||
681 |
"Modified: / 20-03-2011 / 20:09:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
682 |
! |
|
683 |
||
684 |
areturn |
|
685 |
self |
|
686 |
writeInstructionWithArgs: self nothing |
|
687 |
stackBefore: self objRef |
|
688 |
after: self empty. |
|
689 |
self returnIfFinished. |
|
690 |
||
691 |
"Modified: / 21-03-2011 / 14:55:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
692 |
! |
|
693 |
||
694 |
arraylength |
|
695 |
self |
|
696 |
writeInstructionWithArgs: self nothing |
|
697 |
stackBefore: self arrayRef |
|
698 |
after: self arrayLength. |
|
699 |
||
700 |
"Modified: / 20-03-2011 / 20:16:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
701 |
! |
|
702 |
||
703 |
astore |
|
704 |
self |
|
705 |
writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex) |
|
706 |
stackBefore: self objRef |
|
707 |
after: self whatever. |
|
708 |
||
709 |
"Modified: / 20-03-2011 / 20:19:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
710 |
! |
|
711 |
||
712 |
astore: arg |
|
713 |
self |
|
714 |
writeInstructionWithArgs: self nothing |
|
715 |
stackBefore: self objRef |
|
716 |
after: self whatever. |
|
717 |
||
718 |
"Modified: / 20-03-2011 / 20:19:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
719 |
! |
|
720 |
||
721 |
athrow |
|
722 |
self |
|
723 |
writeInstructionWithArgs: self nothing |
|
724 |
stackBefore: self objRef |
|
725 |
after: self empty , self sep , self excRef. |
|
726 |
self returnIfFinished. |
|
727 |
||
728 |
"Modified: / 22-03-2011 / 14:24:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
729 |
! |
|
730 |
||
731 |
baload |
|
732 |
self arrayValueLoader. |
|
733 |
||
734 |
"Modified: / 20-03-2011 / 19:59:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
735 |
! |
|
736 |
||
737 |
bastore |
|
738 |
self |
|
739 |
arrayValueStorer. |
|
740 |
||
741 |
"Modified: / 20-03-2011 / 20:01:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
742 |
! |
|
743 |
||
744 |
bipush |
|
745 |
self |
|
746 |
writeInstructionWithArgs: (self prettyPrintByte: self fetchByte) |
|
747 |
stackBefore: self whatever |
|
748 |
after: self value. |
|
749 |
||
750 |
"Modified: / 20-03-2011 / 21:32:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
751 |
! |
|
752 |
||
753 |
breakpoint |
|
754 |
self |
|
755 |
writeInstructionWithArgs: self nothing |
|
756 |
stackBefore: self whatever |
|
757 |
after: self whatever. |
|
758 |
||
759 |
"Modified: / 20-03-2011 / 20:26:43 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
760 |
! |
|
761 |
||
762 |
caload |
|
763 |
self arrayValueLoader. |
|
764 |
||
765 |
"Modified: / 20-03-2011 / 19:59:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
766 |
! |
|
767 |
||
768 |
castore |
|
769 |
self |
|
770 |
arrayValueStorer. |
|
771 |
||
772 |
"Modified: / 20-03-2011 / 20:02:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
773 |
! |
|
774 |
||
775 |
checkcast |
|
776 |
self |
|
777 |
writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex2) |
|
778 |
stackBefore: self objRef |
|
779 |
after: self objRef. |
|
780 |
||
781 |
"Modified: / 20-03-2011 / 20:23:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
782 |
! |
|
783 |
||
784 |
d2f |
|
785 |
self |
|
786 |
valueManipulator. |
|
787 |
||
788 |
"Modified: / 20-03-2011 / 20:27:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
789 |
! |
|
790 |
||
791 |
d2i |
|
792 |
self valueManipulator. |
|
793 |
||
794 |
"Modified: / 20-03-2011 / 20:27:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
795 |
! |
|
796 |
||
797 |
d2l |
|
798 |
self valueManipulator. |
|
799 |
||
800 |
"Modified: / 20-03-2011 / 20:28:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
801 |
! |
|
802 |
||
803 |
dadd |
|
804 |
self twoValuesManipulator. |
|
805 |
||
806 |
"Modified: / 20-03-2011 / 20:31:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
807 |
! |
|
808 |
||
809 |
daload |
|
810 |
self arrayValueLoader. |
|
811 |
||
812 |
"Modified: / 20-03-2011 / 19:59:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
813 |
! |
|
814 |
||
815 |
dastore |
|
816 |
self |
|
817 |
arrayValueStorer. |
|
818 |
||
819 |
"Modified: / 20-03-2011 / 20:01:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
820 |
! |
|
821 |
||
822 |
dcmpg |
|
823 |
self twoValuesManipulator. |
|
824 |
||
825 |
"Modified: / 20-03-2011 / 20:31:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
826 |
! |
|
827 |
||
828 |
dcmpl |
|
829 |
self twoValuesManipulator. |
|
830 |
||
831 |
"Modified: / 20-03-2011 / 20:31:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
832 |
! |
|
833 |
||
834 |
dconst: arg |
|
835 |
self constPusher: arg. |
|
836 |
||
837 |
"Modified: / 20-03-2011 / 20:39:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
838 |
! |
|
839 |
||
840 |
ddiv |
|
841 |
self twoValuesManipulator. |
|
842 |
||
843 |
"Modified: / 20-03-2011 / 20:31:37 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
844 |
! |
|
845 |
||
846 |
dload |
|
847 |
self indexedFieldLoader. |
|
848 |
||
849 |
"Modified: / 20-03-2011 / 20:44:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
850 |
! |
|
851 |
||
852 |
dload: arg |
|
853 |
self fieldLoader: arg. |
|
854 |
||
855 |
"Modified: / 20-03-2011 / 20:45:59 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
856 |
! |
|
857 |
||
858 |
dmul |
|
859 |
self twoValuesManipulator. |
|
860 |
||
861 |
"Modified: / 20-03-2011 / 20:31:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
862 |
! |
|
863 |
||
864 |
dneg |
|
865 |
self valueManipulator. |
|
866 |
||
867 |
"Modified: / 20-03-2011 / 20:28:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
868 |
! |
|
869 |
||
870 |
drem |
|
871 |
self twoValuesManipulator. |
|
872 |
||
873 |
"Modified: / 20-03-2011 / 20:31:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
874 |
! |
|
875 |
||
876 |
dreturn |
|
877 |
self valueReturner. |
|
878 |
||
879 |
"Modified: / 20-03-2011 / 20:47:47 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
880 |
! |
|
881 |
||
882 |
dstore |
|
883 |
self indexedFieldStorer. |
|
884 |
||
885 |
"Modified: / 20-03-2011 / 20:54:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
886 |
! |
|
887 |
||
888 |
dstore: arg |
|
889 |
self fieldStorer: arg. |
|
890 |
||
891 |
"Modified: / 20-03-2011 / 20:55:25 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
892 |
! |
|
893 |
||
894 |
dsub |
|
895 |
self twoValuesManipulator. |
|
896 |
||
897 |
"Modified: / 20-03-2011 / 20:32:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
898 |
! |
|
899 |
||
900 |
dup |
|
901 |
self |
|
902 |
writeInstructionWithArgs: self nothing |
|
903 |
stackBefore: self value |
|
904 |
after: self valueMarked , self sep , self valueMarked. |
|
905 |
||
906 |
"Modified: / 20-03-2011 / 20:58:59 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
907 |
! |
|
908 |
||
909 |
dup2 |
|
910 |
self |
|
911 |
writeInstructionWithArgs: self nothing |
|
912 |
stackBefore: self stackGroupOpen , self value , self sep , self value , self stackGroupClose |
|
913 |
after: self stackGroupOpen , self value , self sep , self value , self stackGroupClose , self sep , self stackGroupOpen , self value , self sep , self value , self stackGroupClose. |
|
914 |
||
915 |
"Modified: / 20-03-2011 / 21:03:25 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
916 |
! |
|
917 |
||
918 |
dup2_x1 |
|
919 |
self |
|
920 |
writeInstructionWithArgs: self nothing |
|
921 |
stackBefore: self stackGroupOpen , self value , self sep , self value |
|
922 |
, self stackGroupClose |
|
923 |
after: self stackGroupOpen , self value , self sep , self value |
|
924 |
, self stackGroupClose , self sep |
|
925 |
, self stackGroupOpen , self value |
|
926 |
, self sep , self value |
|
927 |
, self stackGroupClose. |
|
928 |
||
929 |
"Modified: / 20-03-2011 / 21:06:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
930 |
! |
|
931 |
||
932 |
dup2_x2 |
|
933 |
self |
|
934 |
writeInstructionWithArgs: self nothing |
|
935 |
stackBefore: self stackGroupOpen , self value , self sep , self value |
|
936 |
, self stackGroupClose , self sep , self stackGroupOpen , self valueMarked , self sep , self valueMarked |
|
937 |
, self stackGroupClose |
|
938 |
after: self stackGroupOpen , self valueMarked , self sep , self valueMarked |
|
939 |
, self stackGroupClose , self sep |
|
940 |
, self stackGroupOpen , self value |
|
941 |
, self sep , self value |
|
942 |
, self stackGroupClose , self sep , self stackGroupOpen , self valueMarked , self sep , self valueMarked |
|
943 |
, self stackGroupClose. |
|
944 |
||
945 |
"Modified: / 20-03-2011 / 21:07:26 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
946 |
! |
|
947 |
||
948 |
dup_x1 |
|
949 |
self |
|
950 |
writeInstructionWithArgs: self nothing |
|
951 |
stackBefore: self value , self sep , self valueMarked |
|
952 |
after: self valueMarked , self sep , self value , self sep |
|
953 |
, self valueMarked. |
|
954 |
||
955 |
"Modified: / 20-03-2011 / 21:00:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
956 |
! |
|
957 |
||
958 |
dup_x2 |
|
959 |
self |
|
960 |
writeInstructionWithArgs: self nothing |
|
961 |
stackBefore: self value , self sep , self value , self sep , self valueMarked |
|
962 |
after: self valueMarked , self sep , self value , self sep , self value , self sep , |
|
963 |
self valueMarked. |
|
964 |
||
965 |
"Modified: / 20-03-2011 / 21:01:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
966 |
! |
|
967 |
||
968 |
f2d |
|
969 |
self valueManipulator. |
|
970 |
||
971 |
"Modified: / 20-03-2011 / 20:28:25 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
972 |
! |
|
973 |
||
974 |
f2i |
|
975 |
self valueManipulator. |
|
976 |
||
977 |
"Modified: / 20-03-2011 / 20:28:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
978 |
! |
|
979 |
||
980 |
f2l |
|
981 |
self valueManipulator. |
|
982 |
||
983 |
"Modified: / 20-03-2011 / 20:28:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
984 |
! |
|
985 |
||
986 |
fadd |
|
987 |
self twoValuesManipulator. |
|
988 |
||
989 |
"Modified: / 20-03-2011 / 20:32:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
990 |
! |
|
991 |
||
992 |
faload |
|
993 |
self arrayValueLoader. |
|
994 |
||
995 |
"Modified: / 20-03-2011 / 20:00:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
996 |
! |
|
997 |
||
998 |
fastore |
|
999 |
self |
|
1000 |
arrayValueStorer. |
|
1001 |
||
1002 |
"Modified: / 20-03-2011 / 20:01:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1003 |
! |
|
1004 |
||
1005 |
fcmpg |
|
1006 |
self twoValuesManipulator. |
|
1007 |
||
1008 |
"Modified: / 20-03-2011 / 20:32:32 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1009 |
! |
|
1010 |
||
1011 |
fcmpl |
|
1012 |
self twoValuesManipulator. |
|
1013 |
||
1014 |
"Modified: / 20-03-2011 / 20:32:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1015 |
! |
|
1016 |
||
1017 |
fconst: arg |
|
1018 |
self constPusher: arg. |
|
1019 |
||
1020 |
"Modified: / 20-03-2011 / 20:39:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1021 |
! |
|
1022 |
||
1023 |
fdiv |
|
1024 |
self twoValuesManipulator. |
|
1025 |
||
1026 |
"Modified: / 20-03-2011 / 20:32:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1027 |
! |
|
1028 |
||
1029 |
fload |
|
1030 |
self indexedFieldLoader. |
|
1031 |
||
1032 |
"Modified: / 20-03-2011 / 20:44:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1033 |
! |
|
1034 |
||
1035 |
fload: arg |
|
1036 |
self fieldLoader: arg. |
|
1037 |
||
1038 |
"Modified: / 20-03-2011 / 20:45:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1039 |
! |
|
1040 |
||
1041 |
fmul |
|
1042 |
self twoValuesManipulator. |
|
1043 |
||
1044 |
"Modified: / 20-03-2011 / 20:32:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1045 |
! |
|
1046 |
||
1047 |
fneg |
|
1048 |
self valueManipulator. |
|
1049 |
||
1050 |
"Modified: / 20-03-2011 / 20:28:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1051 |
! |
|
1052 |
||
1053 |
frem |
|
1054 |
self twoValuesManipulator. |
|
1055 |
||
1056 |
"Modified: / 20-03-2011 / 20:32:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1057 |
! |
|
1058 |
||
1059 |
freturn |
|
1060 |
self valueReturner. |
|
1061 |
||
1062 |
"Modified: / 20-03-2011 / 20:48:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1063 |
! |
|
1064 |
||
1065 |
fstore |
|
1066 |
self indexedFieldStorer. |
|
1067 |
||
1068 |
"Modified: / 20-03-2011 / 20:54:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1069 |
! |
|
1070 |
||
1071 |
fstore: arg |
|
1072 |
self fieldStorer: arg. |
|
1073 |
||
1074 |
"Modified: / 20-03-2011 / 20:55:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1075 |
! |
|
1076 |
||
1077 |
fsub |
|
1078 |
self twoValuesManipulator. |
|
1079 |
||
1080 |
"Modified: / 20-03-2011 / 20:32:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1081 |
! |
|
1082 |
||
1083 |
getfield |
|
1084 |
| index | |
|
1085 |
||
1086 |
index := self fetchIndex2. |
|
1087 |
self |
|
1088 |
writeInstructionWithArgs: (self prettyPrintIndex: index) |
|
1089 |
stackBefore: self objRef |
|
1090 |
after: self objRef. |
|
1091 |
||
1092 |
"Modified: / 21-03-2011 / 16:25:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1093 |
! |
|
1094 |
||
1095 |
getstatic |
|
1096 |
| index | |
|
1097 |
||
1098 |
index := self fetchIndex2. |
|
1099 |
self |
|
1100 |
writeInstructionWithArgs: (self prettyPrintIndex: index) |
|
1101 |
stackBefore: self whatever |
|
1102 |
after: self objRef. |
|
1103 |
||
1104 |
"Modified: / 21-03-2011 / 16:25:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1105 |
! |
|
1106 |
||
1107 |
goto |
|
1108 |
||
1109 |
self |
|
1110 |
writeInstructionWithArgs: (self prettyPrintJump: self fetchBytes2) |
|
1111 |
stackBefore: self whatever |
|
1112 |
after: self whatever. |
|
1113 |
self returnIfFinished. |
|
1114 |
||
1115 |
"Modified: / 22-03-2011 / 14:30:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1116 |
! |
|
1117 |
||
1118 |
goto_w |
|
1119 |
self |
|
1120 |
writeInstructionWithArgs: (self prettyPrintJump: self fetchBytes4) |
|
1121 |
stackBefore: self whatever |
|
1122 |
after: self whatever. |
|
1123 |
self returnIfFinished. |
|
1124 |
||
1125 |
"Modified: / 22-03-2011 / 14:30:08 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1126 |
! |
|
1127 |
||
1128 |
i2d |
|
1129 |
self valueManipulator. |
|
1130 |
||
1131 |
"Modified: / 20-03-2011 / 20:28:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1132 |
! |
|
1133 |
||
1134 |
i2f |
|
1135 |
self valueManipulator. |
|
1136 |
||
1137 |
"Modified: / 20-03-2011 / 20:29:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1138 |
! |
|
1139 |
||
1140 |
i2l |
|
1141 |
self valueManipulator. |
|
1142 |
||
1143 |
"Modified: / 20-03-2011 / 20:29:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1144 |
! |
|
1145 |
||
1146 |
i_dup |
|
1147 |
"raise an error: must be redefined in concrete subclass(es)" |
|
1148 |
||
1149 |
^ self shouldImplement |
|
1150 |
! |
|
1151 |
||
1152 |
iadd |
|
1153 |
self twoValuesManipulator. |
|
1154 |
||
1155 |
"Modified: / 20-03-2011 / 20:33:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1156 |
! |
|
1157 |
||
1158 |
iaload |
|
1159 |
self arrayValueLoader. |
|
1160 |
||
1161 |
"Modified: / 20-03-2011 / 20:00:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1162 |
! |
|
1163 |
||
1164 |
iand |
|
1165 |
self twoValuesManipulator. |
|
1166 |
||
1167 |
"Modified: / 20-03-2011 / 20:33:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1168 |
! |
|
1169 |
||
1170 |
iastore |
|
1171 |
self |
|
1172 |
arrayValueStorer. |
|
1173 |
||
1174 |
"Modified: / 20-03-2011 / 20:02:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1175 |
! |
|
1176 |
||
1177 |
iconst: arg |
|
1178 |
self constPusher: arg. |
|
1179 |
||
1180 |
"Created: / 20-03-2011 / 20:41:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1181 |
! |
|
1182 |
||
1183 |
idiv |
|
1184 |
self twoValuesManipulator. |
|
1185 |
||
1186 |
"Modified: / 20-03-2011 / 20:33:19 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1187 |
! |
|
1188 |
||
1189 |
ifacmpeq |
|
1190 |
self twoValuesBasedJumper. |
|
1191 |
||
1192 |
"Modified: / 20-03-2011 / 21:11:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1193 |
! |
|
1194 |
||
1195 |
ifacmpne |
|
1196 |
self twoValuesBasedJumper. |
|
1197 |
||
1198 |
"Modified: / 20-03-2011 / 21:11:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1199 |
! |
|
1200 |
||
1201 |
ifeq |
|
1202 |
self valueBasedJumper. |
|
1203 |
||
1204 |
"Modified: / 20-03-2011 / 21:11:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1205 |
! |
|
1206 |
||
1207 |
ifge |
|
1208 |
self valueBasedJumper. |
|
1209 |
||
1210 |
"Modified: / 20-03-2011 / 21:11:37 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1211 |
! |
|
1212 |
||
1213 |
ifgt |
|
1214 |
self valueBasedJumper. |
|
1215 |
||
1216 |
"Modified: / 20-03-2011 / 21:11:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1217 |
! |
|
1218 |
||
1219 |
ificmpeq |
|
1220 |
self twoValuesBasedJumper. |
|
1221 |
||
1222 |
"Modified: / 20-03-2011 / 21:10:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1223 |
! |
|
1224 |
||
1225 |
ificmpge |
|
1226 |
self twoValuesBasedJumper. |
|
1227 |
||
1228 |
"Modified: / 20-03-2011 / 21:11:09 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1229 |
! |
|
1230 |
||
1231 |
ificmpgt |
|
1232 |
self twoValuesBasedJumper. |
|
1233 |
||
1234 |
"Modified: / 20-03-2011 / 21:11:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1235 |
! |
|
1236 |
||
1237 |
ificmple |
|
1238 |
self twoValuesBasedJumper. |
|
1239 |
||
1240 |
"Modified: / 20-03-2011 / 21:11:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1241 |
! |
|
1242 |
||
1243 |
ificmplt |
|
1244 |
self twoValuesBasedJumper. |
|
1245 |
||
1246 |
"Modified: / 20-03-2011 / 21:11:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1247 |
! |
|
1248 |
||
1249 |
ificmpne |
|
1250 |
self twoValuesBasedJumper. |
|
1251 |
||
1252 |
"Modified: / 20-03-2011 / 21:11:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1253 |
! |
|
1254 |
||
1255 |
ifle |
|
1256 |
self valueBasedJumper. |
|
1257 |
||
1258 |
"Modified: / 20-03-2011 / 21:11:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1259 |
! |
|
1260 |
||
1261 |
iflt |
|
1262 |
self valueBasedJumper. |
|
1263 |
||
1264 |
"Modified: / 20-03-2011 / 21:11:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1265 |
! |
|
1266 |
||
1267 |
ifne |
|
1268 |
self valueBasedJumper. |
|
1269 |
||
1270 |
"Modified: / 20-03-2011 / 21:11:51 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1271 |
! |
|
1272 |
||
1273 |
ifnonnull |
|
1274 |
self valueBasedJumper. |
|
1275 |
||
1276 |
"Modified: / 20-03-2011 / 21:11:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1277 |
! |
|
1278 |
||
1279 |
ifnull |
|
1280 |
self valueBasedJumper. |
|
1281 |
||
1282 |
"Modified: / 20-03-2011 / 21:12:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1283 |
! |
|
1284 |
||
1285 |
iinc |
|
1286 |
||
1287 |
wide |
|
1288 |
ifTrue: |
|
1289 |
[ self |
|
1290 |
writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex2) |
|
1291 |
, self sep , (self prettyPrintByte: self fetchBytes2) |
|
1292 |
stackBefore: self objRef |
|
1293 |
after: self result. |
|
1294 |
wide := false. ] |
|
1295 |
ifFalse: |
|
1296 |
[ self |
|
1297 |
writeInstructionWithArgs: (self prettyPrintField: self fetchIndex) |
|
1298 |
, self sep , (self prettyPrintByte: self fetchByte) |
|
1299 |
stackBefore: self objRef |
|
1300 |
after: self result. ]. |
|
1301 |
||
1302 |
"Modified: / 21-03-2011 / 16:23:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1303 |
! |
|
1304 |
||
1305 |
iload |
|
1306 |
self indexedFieldLoader. |
|
1307 |
||
1308 |
"Modified: / 20-03-2011 / 20:44:43 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1309 |
! |
|
1310 |
||
1311 |
iload: index |
|
1312 |
self fieldLoader: index. |
|
1313 |
||
1314 |
"Modified: / 20-03-2011 / 20:45:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1315 |
! |
|
1316 |
||
1317 |
imul |
|
1318 |
self twoValuesManipulator. |
|
1319 |
||
1320 |
"Modified: / 20-03-2011 / 20:33:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1321 |
! |
|
1322 |
||
1323 |
ineg |
|
1324 |
self valueManipulator. |
|
1325 |
||
1326 |
"Modified: / 20-03-2011 / 20:30:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1327 |
! |
|
1328 |
||
1329 |
instanceof |
|
1330 |
self |
|
1331 |
writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex2) |
|
1332 |
stackBefore: self objRef |
|
1333 |
after: self result. |
|
1334 |
||
1335 |
"Modified: / 20-03-2011 / 20:21:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1336 |
! |
|
1337 |
||
1338 |
int2byte |
|
1339 |
self valueManipulator. |
|
1340 |
||
1341 |
"Modified: / 20-03-2011 / 20:29:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1342 |
! |
|
1343 |
||
1344 |
int2char |
|
1345 |
self valueManipulator. |
|
1346 |
||
1347 |
"Modified: / 20-03-2011 / 20:29:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1348 |
! |
|
1349 |
||
1350 |
int2short |
|
1351 |
self valueManipulator. |
|
1352 |
||
1353 |
"Modified: / 20-03-2011 / 20:29:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1354 |
! |
|
1355 |
||
1356 |
invinterface |
|
1357 |
self |
|
1358 |
writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex2) , self sep , ( self prettyPrintByte: self fetchByte) , self sep , 0 printString |
|
1359 |
stackBefore: self objRef , self sep , self varArgs |
|
1360 |
after: self whatever. |
|
1361 |
||
1362 |
"Modified: / 20-03-2011 / 21:15:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1363 |
! |
|
1364 |
||
1365 |
invnonvirt |
|
1366 |
self |
|
1367 |
writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex2) |
|
1368 |
||
1369 |
stackBefore: self objRef , self sep , self varArgs |
|
1370 |
after: self whatever. |
|
1371 |
||
1372 |
"Modified: / 20-03-2011 / 21:17:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1373 |
! |
|
1374 |
||
1375 |
invstatic |
|
1376 |
self |
|
1377 |
writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex2) |
|
1378 |
stackBefore: self varArgs |
|
1379 |
after: self whatever. |
|
1380 |
||
1381 |
"Modified: / 20-03-2011 / 21:17:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1382 |
! |
|
1383 |
||
1384 |
invvirt |
|
1385 |
self |
|
1386 |
writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex2) |
|
1387 |
stackBefore: self objRef , self sep , self varArgs |
|
1388 |
after: self whatever. |
|
1389 |
||
1390 |
"Modified: / 20-03-2011 / 21:18:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1391 |
! |
|
1392 |
||
1393 |
ior |
|
1394 |
self twoValuesManipulator. |
|
1395 |
||
1396 |
"Modified: / 20-03-2011 / 20:33:52 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1397 |
! |
|
1398 |
||
1399 |
irem |
|
1400 |
self twoValuesManipulator. |
|
1401 |
||
1402 |
"Modified: / 20-03-2011 / 20:33:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1403 |
! |
|
1404 |
||
1405 |
ireturn |
|
1406 |
self valueReturner. |
|
1407 |
||
1408 |
"Modified: / 20-03-2011 / 20:48:30 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1409 |
! |
|
1410 |
||
1411 |
ishl |
|
1412 |
self twoValuesManipulator. |
|
1413 |
||
1414 |
"Modified: / 20-03-2011 / 20:34:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1415 |
! |
|
1416 |
||
1417 |
ishr |
|
1418 |
self twoValuesManipulator. |
|
1419 |
||
1420 |
"Modified: / 20-03-2011 / 20:34:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1421 |
! |
|
1422 |
||
1423 |
istore |
|
1424 |
self indexedFieldStorer. |
|
1425 |
||
1426 |
"Modified: / 20-03-2011 / 20:54:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1427 |
! |
|
1428 |
||
1429 |
istore: arg |
|
1430 |
self fieldStorer: arg. |
|
1431 |
||
1432 |
"Modified: / 20-03-2011 / 20:55:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1433 |
! |
|
1434 |
||
1435 |
isub |
|
1436 |
self twoValuesManipulator. |
|
1437 |
||
1438 |
"Modified: / 20-03-2011 / 20:34:19 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1439 |
! |
|
1440 |
||
1441 |
iushr |
|
1442 |
self twoValuesManipulator. |
|
1443 |
||
1444 |
"Modified: / 20-03-2011 / 20:34:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1445 |
! |
|
1446 |
||
1447 |
ixor |
|
1448 |
self twoValuesManipulator. |
|
1449 |
||
1450 |
"Modified: / 20-03-2011 / 20:34:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1451 |
! |
|
1452 |
||
1453 |
jsr |
|
1454 |
self |
|
1455 |
writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex2) |
|
1456 |
stackBefore: self whatever |
|
1457 |
after: self address. |
|
1458 |
||
1459 |
"Modified: / 20-03-2011 / 21:20:24 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1460 |
! |
|
1461 |
||
1462 |
jsr_w |
|
1463 |
self |
|
1464 |
writeInstructionWithArgs: (self prettyPrintIndex: self fetchBytes4) |
|
1465 |
stackBefore: self whatever |
|
1466 |
after: self address. |
|
1467 |
||
1468 |
"Modified: / 21-03-2011 / 13:03:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1469 |
! |
|
1470 |
||
1471 |
l2d |
|
1472 |
self valueManipulator. |
|
1473 |
||
1474 |
"Modified: / 20-03-2011 / 20:29:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1475 |
! |
|
1476 |
||
1477 |
l2f |
|
1478 |
self valueManipulator. |
|
1479 |
||
1480 |
"Modified: / 20-03-2011 / 20:29:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1481 |
! |
|
1482 |
||
1483 |
l2i |
|
1484 |
self valueManipulator. |
|
1485 |
||
1486 |
"Modified: / 20-03-2011 / 20:29:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1487 |
! |
|
1488 |
||
1489 |
ladd |
|
1490 |
self twoValuesManipulator. |
|
1491 |
||
1492 |
"Modified: / 20-03-2011 / 20:35:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1493 |
! |
|
1494 |
||
1495 |
laload |
|
1496 |
self arrayValueLoader. |
|
1497 |
||
1498 |
"Modified: / 20-03-2011 / 20:00:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1499 |
! |
|
1500 |
||
1501 |
land |
|
1502 |
self twoValuesManipulator. |
|
1503 |
||
1504 |
"Modified: / 20-03-2011 / 20:35:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1505 |
! |
|
1506 |
||
1507 |
lastore |
|
1508 |
self |
|
1509 |
arrayValueStorer. |
|
1510 |
||
1511 |
"Modified: / 20-03-2011 / 20:02:47 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1512 |
! |
|
1513 |
||
1514 |
lcmp |
|
1515 |
self twoValuesManipulator. |
|
1516 |
||
1517 |
"Modified: / 20-03-2011 / 20:35:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1518 |
! |
|
1519 |
||
1520 |
lconst: arg |
|
1521 |
self constPusher: arg. |
|
1522 |
||
1523 |
"Modified: / 20-03-2011 / 20:41:30 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1524 |
! |
|
1525 |
||
1526 |
ldc1 |
|
1527 |
self |
|
1528 |
writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex) |
|
1529 |
stackBefore: self whatever |
|
1530 |
after: self value. |
|
1531 |
||
1532 |
"Modified: / 20-03-2011 / 21:21:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1533 |
! |
|
1534 |
||
1535 |
ldc2 |
|
1536 |
self |
|
1537 |
writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex2) |
|
1538 |
stackBefore: self whatever |
|
1539 |
after: self value. |
|
1540 |
||
1541 |
"Modified: / 20-03-2011 / 21:21:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1542 |
! |
|
1543 |
||
1544 |
ldc2w |
|
1545 |
self |
|
1546 |
writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex2) |
|
1547 |
stackBefore: self whatever |
|
1548 |
after: self value. |
|
1549 |
||
1550 |
"Modified: / 22-03-2011 / 14:18:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1551 |
! |
|
1552 |
||
1553 |
ldiv |
|
1554 |
self twoValuesManipulator. |
|
1555 |
||
1556 |
"Modified: / 20-03-2011 / 20:36:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1557 |
! |
|
1558 |
||
1559 |
lload |
|
1560 |
self indexedFieldLoader. |
|
1561 |
||
1562 |
"Modified: / 20-03-2011 / 20:44:52 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1563 |
! |
|
1564 |
||
1565 |
lload: arg |
|
1566 |
self fieldLoader: arg. |
|
1567 |
||
1568 |
"Modified: / 20-03-2011 / 20:45:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1569 |
! |
|
1570 |
||
1571 |
lmul |
|
1572 |
self twoValuesManipulator. |
|
1573 |
||
1574 |
"Modified: / 20-03-2011 / 20:36:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1575 |
! |
|
1576 |
||
1577 |
lneg |
|
1578 |
self valueManipulator. |
|
1579 |
||
1580 |
"Modified: / 20-03-2011 / 20:29:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1581 |
! |
|
1582 |
||
1583 |
lookupswtch |
|
1584 |
self |
|
1585 |
writeInstructionWithArgs: (self prettyPrintLookupSwitchMadness) |
|
1586 |
stackBefore: self key |
|
1587 |
after: self whatever. |
|
1588 |
||
1589 |
"Modified: / 20-03-2011 / 21:24:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1590 |
! |
|
1591 |
||
1592 |
lor |
|
1593 |
self twoValuesManipulator. |
|
1594 |
||
1595 |
"Modified: / 20-03-2011 / 20:36:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1596 |
! |
|
1597 |
||
1598 |
lrem |
|
1599 |
self twoValuesManipulator. |
|
1600 |
||
1601 |
"Modified: / 20-03-2011 / 20:36:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1602 |
! |
|
1603 |
||
1604 |
lreturn |
|
1605 |
self valueReturner. |
|
1606 |
||
1607 |
"Modified: / 20-03-2011 / 20:48:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1608 |
! |
|
1609 |
||
1610 |
lshl |
|
1611 |
self twoValuesManipulator. |
|
1612 |
||
1613 |
"Modified: / 20-03-2011 / 20:36:22 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1614 |
! |
|
1615 |
||
1616 |
lshr |
|
1617 |
self twoValuesManipulator. |
|
1618 |
||
1619 |
"Modified: / 20-03-2011 / 20:36:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1620 |
! |
|
1621 |
||
1622 |
lstore |
|
1623 |
self indexedFieldStorer. |
|
1624 |
||
1625 |
"Modified: / 20-03-2011 / 20:54:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1626 |
! |
|
1627 |
||
1628 |
lstore: arg |
|
1629 |
self fieldStorer: arg. |
|
1630 |
||
1631 |
"Modified: / 20-03-2011 / 20:55:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1632 |
! |
|
1633 |
||
1634 |
lsub |
|
1635 |
self twoValuesManipulator. |
|
1636 |
||
1637 |
"Modified: / 20-03-2011 / 20:36:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1638 |
! |
|
1639 |
||
1640 |
lushr |
|
1641 |
self twoValuesManipulator. |
|
1642 |
||
1643 |
"Modified: / 20-03-2011 / 20:36:37 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1644 |
! |
|
1645 |
||
1646 |
lxor |
|
1647 |
self twoValuesManipulator. |
|
1648 |
||
1649 |
"Modified: / 20-03-2011 / 20:36:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1650 |
! |
|
1651 |
||
1652 |
monenter |
|
1653 |
self |
|
1654 |
writeInstructionWithArgs: self nothing |
|
1655 |
stackBefore: self objRef |
|
1656 |
after: self whatever. |
|
1657 |
||
1658 |
"Modified: / 20-03-2011 / 20:20:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1659 |
! |
|
1660 |
||
1661 |
monexit |
|
1662 |
self |
|
1663 |
writeInstructionWithArgs: self nothing |
|
1664 |
stackBefore: self objRef |
|
1665 |
after: self whatever. |
|
1666 |
||
1667 |
"Modified: / 20-03-2011 / 20:20:51 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1668 |
! |
|
1669 |
||
1670 |
multianewarray |
|
1671 |
self |
|
1672 |
writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex2) |
|
1673 |
, self sep , (self prettyPrintByte: self fetchByte) |
|
1674 |
stackBefore: self dimensions |
|
1675 |
after: self arrayRef. |
|
1676 |
||
1677 |
"Modified: / 20-03-2011 / 21:25:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1678 |
! |
|
1679 |
||
1680 |
new |
|
1681 |
self |
|
1682 |
writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex2) |
|
1683 |
stackBefore: self whatever |
|
1684 |
after: self objRef. |
|
1685 |
||
1686 |
"Modified: / 20-03-2011 / 20:07:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1687 |
! |
|
1688 |
||
1689 |
newarray |
|
1690 |
self |
|
1691 |
writeInstructionWithArgs: (self prettyPrintType: self fetchByte) |
|
1692 |
stackBefore: self size |
|
1693 |
after: self arrayRef. |
|
1694 |
||
1695 |
"Modified: / 20-03-2011 / 20:10:52 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1696 |
! |
|
1697 |
||
1698 |
nop |
|
1699 |
self |
|
1700 |
writeInstructionWithArgs: self nothing |
|
1701 |
stackBefore: self whatever |
|
1702 |
after: self whatever. |
|
1703 |
||
1704 |
"Modified: / 20-03-2011 / 21:26:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1705 |
! |
|
1706 |
||
1707 |
pop1 |
|
1708 |
self |
|
1709 |
writeInstructionWithArgs: self nothing |
|
1710 |
stackBefore: self value |
|
1711 |
after: self whatever. |
|
1712 |
||
1713 |
"Modified: / 20-03-2011 / 21:27:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1714 |
! |
|
1715 |
||
1716 |
pop2 |
|
1717 |
self |
|
1718 |
writeInstructionWithArgs: self nothing |
|
1719 |
stackBefore: self value , self sep , self value |
|
1720 |
after: self whatever. |
|
1721 |
||
1722 |
"Modified: / 20-03-2011 / 21:27:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1723 |
! |
|
1724 |
||
1725 |
putfield |
|
1726 |
| index | |
|
1727 |
||
1728 |
index := self fetchIndex2. |
|
1729 |
self |
|
1730 |
writeInstructionWithArgs: (self prettyPrintIndex: index) |
|
1731 |
stackBefore: self objRef , self sep , self value |
|
1732 |
after: self whatever. |
|
1733 |
||
1734 |
"Modified: / 21-03-2011 / 16:26:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1735 |
! |
|
1736 |
||
1737 |
putstatic |
|
1738 |
| index | |
|
1739 |
||
1740 |
index := self fetchIndex2. |
|
1741 |
self |
|
1742 |
writeInstructionWithArgs: (self prettyPrintIndex: index) |
|
1743 |
stackBefore: self value |
|
1744 |
after: self whatever. |
|
1745 |
||
1746 |
"Modified: / 21-03-2011 / 16:26:19 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1747 |
! |
|
1748 |
||
1749 |
ret |
|
1750 |
wide |
|
1751 |
ifTrue: |
|
1752 |
[ self |
|
1753 |
writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex2) |
|
1754 |
stackBefore: self whatever |
|
1755 |
after: self whatever. |
|
1756 |
wide := false. ] |
|
1757 |
ifFalse: |
|
1758 |
[ self |
|
1759 |
writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex) |
|
1760 |
stackBefore: self whatever |
|
1761 |
after: self whatever. ]. |
|
1762 |
self returnIfFinished. |
|
1763 |
||
1764 |
"Modified: / 21-03-2011 / 14:57:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1765 |
! |
|
1766 |
||
1767 |
ret_w |
|
1768 |
self halt: 'spec doesnt know about me, what shall I do?'. |
|
1769 |
||
1770 |
"Modified: / 20-03-2011 / 21:31:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1771 |
! |
|
1772 |
||
1773 |
return |
|
1774 |
self |
|
1775 |
writeInstructionWithArgs: self nothing |
|
1776 |
stackBefore: self whatever |
|
1777 |
after: self empty. |
|
1778 |
self returnIfFinished. |
|
1779 |
||
1780 |
"Modified: / 21-03-2011 / 14:56:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1781 |
! |
|
1782 |
||
1783 |
saload |
|
1784 |
self arrayValueLoader. |
|
1785 |
||
1786 |
"Modified: / 20-03-2011 / 20:00:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1787 |
! |
|
1788 |
||
1789 |
sastore |
|
1790 |
self |
|
1791 |
arrayValueStorer. |
|
1792 |
||
1793 |
"Modified: / 20-03-2011 / 20:03:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1794 |
! |
|
1795 |
||
1796 |
sipush |
|
1797 |
self |
|
1798 |
writeInstructionWithArgs: (self prettyPrintByte: self fetchBytes2) |
|
1799 |
stackBefore: self whatever |
|
1800 |
after: self value. |
|
1801 |
||
1802 |
"Modified: / 20-03-2011 / 21:33:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1803 |
! |
|
1804 |
||
1805 |
swap |
|
1806 |
self |
|
1807 |
writeInstructionWithArgs: (self prettyPrintByte: self fetchByte) |
|
1808 |
stackBefore: self valueMarked , self sep , self valueMarked2 |
|
1809 |
after: self valueMarked2 , self sep , self valueMarked. |
|
1810 |
||
1811 |
"Modified: / 20-03-2011 / 21:33:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1812 |
! |
|
1813 |
||
1814 |
tableswtch |
|
1815 |
self |
|
1816 |
writeInstructionWithArgs: (self prettyPrintTableSwitchMadness) |
|
1817 |
stackBefore: self index |
|
1818 |
after: self whatever. |
|
1819 |
||
1820 |
"Modified: / 20-03-2011 / 21:34:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1821 |
! |
|
1822 |
||
1823 |
wide |
|
1824 |
wide := true. |
|
1825 |
self |
|
1826 |
writeInstructionWithArgs: self nothing |
|
1827 |
stackBefore: self whatever |
|
1828 |
after: self whatever. |
|
1829 |
||
1830 |
"Modified: / 20-03-2011 / 21:48:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1831 |
! ! |
|
1832 |
||
2396
fadc6d7a2f5b
Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2353
diff
changeset
|
1833 |
|
749 | 1834 |
!JavaByteCodeDisassembler methodsFor:'processing loop'! |
1835 |
||
1836 |
handleAbstractMethod |
|
1837 |
^nil. |
|
1838 |
||
1839 |
"Created: / 22-03-2011 / 14:51:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1840 |
! |
|
1841 |
||
1842 |
initializeContextVars |
|
1843 |
1 to: numVars |
|
1844 |
do: [:idx | context at: (numArgs + idx) put: 'Var ' , idx printString. ] |
|
1845 |
||
1846 |
"Modified: / 21-03-2011 / 15:28:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1847 |
! |
|
1848 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2313
diff
changeset
|
1849 |
switch: opcode |
749 | 1850 |
|
1851 |
| lno | |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2313
diff
changeset
|
1852 |
"bytecode positions in line number table starts with 0, not 1" |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2313
diff
changeset
|
1853 |
lno := method quickLineNumberForPC: instrPointer - 1. |
749 | 1854 |
lastLno ~~ lno ifTrue:[self writeLine: (lastLno := lno)]. |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2313
diff
changeset
|
1855 |
^super switch: opcode |
749 | 1856 |
|
1857 |
"Created: / 22-03-2011 / 20:57:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1858 |
! ! |
|
1859 |
||
2396
fadc6d7a2f5b
Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2353
diff
changeset
|
1860 |
|
749 | 1861 |
!JavaByteCodeDisassembler class methodsFor:'documentation'! |
1862 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2313
diff
changeset
|
1863 |
version_CVS |
2396
fadc6d7a2f5b
Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2353
diff
changeset
|
1864 |
^ '$Header: /cvs/stx/stx/libjava/JavaByteCodeDisassembler.st,v 1.5 2013-02-25 11:15:31 vrany Exp $' |
2313
23e9c0bdcf57
fixed: #version_SVN ($ to §)
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
1865 |
! |
23e9c0bdcf57
fixed: #version_SVN ($ to §)
Claus Gittinger <cg@exept.de>
parents:
2187
diff
changeset
|
1866 |
|
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2313
diff
changeset
|
1867 |
version_HG |
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2313
diff
changeset
|
1868 |
|
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2313
diff
changeset
|
1869 |
^ '$Changeset: <not expanded> $' |
2187 | 1870 |
! |
1871 |
||
749 | 1872 |
version_SVN |
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2313
diff
changeset
|
1873 |
^ '§Id§' |
749 | 1874 |
! ! |
1875 |
||
2353
fa7400d022a0
Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2313
diff
changeset
|
1876 |
|
2152 | 1877 |
JavaByteCodeDisassembler initialize! |