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