author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Wed, 30 Jan 2013 13:27:16 +0000 | |
branch | refactoring-vmdata |
changeset 2008 | c348b894fbfe |
parent 1864 | 60a8dc26c8c6 |
child 2069 | 75d40b7b986f |
permissions | -rw-r--r-- |
752 | 1 |
" |
877 | 2 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
1152 | 3 |
|
1155 | 4 |
New code and modifications done at SWING Research Group [1]: |
1152 | 5 |
|
877 | 6 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
7 |
SWING Research Group, Czech Technical University in Prague |
|
8 |
||
752 | 9 |
This software is furnished under a license and may be used |
10 |
only in accordance with the terms of that license and with the |
|
11 |
inclusion of the above copyright notice. This software may not |
|
12 |
be provided or otherwise made available to, or used by, any |
|
13 |
other person. No title to or ownership of the software is |
|
14 |
hereby transferred. |
|
877 | 15 |
|
1155 | 16 |
[1] Code written at SWING Research Group contains a signature |
17 |
of one of the above copright owners. For exact set of such code, |
|
18 |
see the differences between this version and version stx:libjava |
|
1152 | 19 |
as of 1.9.2010 |
752 | 20 |
" |
21 |
"{ Package: 'stx:libjava' }" |
|
22 |
||
23 |
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 |
" |
|
877 | 34 |
COPYRIGHT (c) 1996-2011 by Claus Gittinger |
1152 | 35 |
|
1155 | 36 |
New code and modifications done at SWING Research Group [1]: |
1152 | 37 |
|
877 | 38 |
COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko |
39 |
SWING Research Group, Czech Technical University in Prague |
|
40 |
||
752 | 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 |
||
1155 | 48 |
[1] Code written at SWING Research Group contains a signature |
49 |
of one of the above copright owners. For exact set of such code, |
|
50 |
see the differences between this version and version stx:libjava |
|
1152 | 51 |
as of 1.9.2010 |
877 | 52 |
|
752 | 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 |
|
803 | 303 |
writeInstructionWithArgs: (self prettyPrintField: index) |
752 | 304 |
stackBefore: self whatever |
803 | 305 |
after: self whatever. |
752 | 306 |
|
307 |
"Created: / 20-03-2011 / 20:44:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
803 | 308 |
"Modified: / 19-05-2011 / 10:38:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 309 |
! |
310 |
||
311 |
indexedFieldStorer |
|
805 | 312 |
| index | |
752 | 313 |
|
314 |
wide |
|
315 |
ifTrue: |
|
316 |
[ index := self fetchIndex2. |
|
317 |
wide := false. ] |
|
805 | 318 |
ifFalse: [ index := self fetchIndex ]. |
319 |
self |
|
320 |
writeInstructionWithArgs: (self prettyPrintField: index) |
|
321 |
stackBefore: (self prettyPrintValue:'newVal') |
|
322 |
after: self whatever. |
|
752 | 323 |
|
324 |
"Created: / 20-03-2011 / 20:53:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
805 | 325 |
"Modified: / 19-05-2011 / 13:04:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 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: [ ^ '' ]. |
|
837
8f42226d82c0
slightly refactored exceptionTable methods and their callers.. no typechanging side effects
hlopkmar
parents:
805
diff
changeset
|
408 |
^ 'Throws:' |
8f42226d82c0
slightly refactored exceptionTable methods and their callers.. no typechanging side effects
hlopkmar
parents:
805
diff
changeset
|
409 |
, (table inject: '' into: [:acc :each | acc , ' ' , each name ]). |
752 | 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>" |
|
837
8f42226d82c0
slightly refactored exceptionTable methods and their callers.. no typechanging side effects
hlopkmar
parents:
805
diff
changeset
|
413 |
"Modified: / 04-06-2011 / 17:19:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
752 | 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; |
|
1717 | 431 |
print: '# arg slots: ' , javaMethod numArgs printString , ', '; |
432 |
print: '# var slots: ' , javaMethod numVars printString , ', '; |
|
433 |
print: '# stack slots: ', javaMethod stackSize printString , ' '; |
|
752 | 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>" |
|
1717 | 439 |
"Modified: / 12-10-2012 / 11:58:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 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| |
|
458 |
lineNumber := method quickLineNumberForPC: instrPointer. |
|
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>" |
|
464 |
! |
|
465 |
||
466 |
prettyPrintLookupSwitchMadness |
|
467 |
| paddingSize default npairs result | |
|
468 |
result := TextStream on: ''. |
|
469 |
paddingSize := self skipPadding. |
|
470 |
default := self fetchBytes4. |
|
471 |
npairs := self fetchBytes4. |
|
472 |
result |
|
473 |
print: 'PADDING: '; |
|
474 |
print: paddingSize printString; |
|
475 |
print: ' NPAIRS: '; |
|
476 |
print: npairs printString; |
|
477 |
cr. |
|
478 |
result |
|
891 | 479 |
print: (' [ '); |
752 | 480 |
cr. |
481 |
npairs timesRepeat: |
|
482 |
||
483 |
[ result |
|
891 | 484 |
print: ' '; |
485 |
print: (self fetchBytes4 printString); |
|
752 | 486 |
print: ': '; |
487 |
print: (self prettyPrintJump: self fetchBytes4); |
|
488 |
cr. ]. |
|
489 |
result |
|
891 | 490 |
print: (' default'); |
752 | 491 |
print: ': '; |
492 |
print: (self prettyPrintJump: default); |
|
493 |
cr. |
|
494 |
result |
|
891 | 495 |
print: (' ]'); |
752 | 496 |
cr. |
497 |
^ result stringContents. |
|
498 |
||
499 |
"Created: / 20-03-2011 / 21:23:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
500 |
"Modified: / 22-03-2011 / 15:03:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
891 | 501 |
"Modified: / 08-08-2011 / 17:31:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 502 |
! |
503 |
||
504 |
prettyPrintRef: ref |
|
915 | 505 |
|
506 |
^ ref prettyPrintString. |
|
752 | 507 |
|
508 |
"Created: / 20-03-2011 / 17:20:25 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
915 | 509 |
"Modified: / 14-08-2011 / 21:12:43 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 510 |
! |
511 |
||
512 |
prettyPrintStackBefore: beforeString after: afterString |
|
513 |
^ 'STACK: [' , beforeString printString , ' -> ' , afterString printString , ']'. |
|
514 |
||
515 |
"Created: / 20-03-2011 / 17:24:47 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
516 |
! |
|
517 |
||
518 |
prettyPrintTableSwitchMadness |
|
519 |
| paddingSize default low high result | |
|
520 |
||
521 |
result := TextStream on: ''. |
|
522 |
paddingSize := self skipPadding. |
|
523 |
default := self fetchBytes4. |
|
524 |
low := self fetchBytes4. |
|
525 |
high := self fetchBytes4. |
|
526 |
result |
|
527 |
print: 'PADDING: '; |
|
528 |
print: paddingSize printString; |
|
529 |
print: ' LOW: '; |
|
530 |
print: low printString; |
|
531 |
print: ' HIGH: '; |
|
532 |
print: high printString; |
|
533 |
cr. |
|
534 |
result |
|
891 | 535 |
print: (' [ '); |
752 | 536 |
cr. |
537 |
low to: high |
|
538 |
do: |
|
539 |
[:index | |
|
540 |
result |
|
891 | 541 |
nextPutAll:' '; print: (index printString); |
752 | 542 |
print: ': '; |
543 |
print: (self prettyPrintJump: self fetchBytes4); |
|
544 |
cr. ]. |
|
545 |
result |
|
891 | 546 |
print: (' default'); |
752 | 547 |
print: ': '; |
548 |
print: (self prettyPrintJump: default); |
|
549 |
cr. |
|
550 |
result |
|
891 | 551 |
print: (' ]'); |
752 | 552 |
cr. |
553 |
^ result stringContents. |
|
554 |
||
555 |
"Created: / 20-03-2011 / 21:34:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
556 |
"Modified: / 21-03-2011 / 15:01:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
891 | 557 |
"Modified: / 08-08-2011 / 17:29:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
752 | 558 |
! |
559 |
||
560 |
prettyPrintType: type |
|
561 |
type = 4 ifTrue: [ ^ 'boolean']. |
|
562 |
type = 5 ifTrue: [ ^'char']. |
|
563 |
type = 6 ifTrue: [ ^ 'float' ]. |
|
564 |
type = 7 ifTrue: [ ^'double' ]. |
|
565 |
type = 8 ifTrue: [ ^ 'byte' ]. |
|
566 |
type = 9 ifTrue: [ ^ 'short' ]. |
|
567 |
type = 10 ifTrue: [ ^'int' ]. |
|
568 |
type = 11 ifTrue: [ ^ 'long' ]. |
|
569 |
||
570 |
"Created: / 20-03-2011 / 20:12:08 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
571 |
! |
|
572 |
||
573 |
prettyPrintValue: val |
|
574 |
^ val printString. |
|
575 |
||
576 |
"Created: / 20-03-2011 / 18:16:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
577 |
! |
|
578 |
||
579 |
writeInstructionWithArgs: argsString stackBefore: stackBefore after: stackAfter |
|
580 |
placeholders |
|
581 |
at: 'PC' |
|
582 |
put: (instrPointer printString leftPaddedTo: 3 with: Character space); |
|
583 |
at: 'LINENUMBER' put: self prettyPrintLineNumber; |
|
584 |
at: 'OPCODE' put: (op printString leftPaddedTo: 3 with: Character space); |
|
585 |
at: 'ISN' |
|
586 |
put: ((OpSwitchTable at: op + 1) asUppercase printString paddedTo: 10); |
|
587 |
at: 'OPERANDS' put: ((self prettyPrintArgs: argsString) paddedTo: 25); |
|
588 |
at: 'STACK' |
|
589 |
put: (self prettyPrintStackBefore: stackBefore after: stackAfter). |
|
590 |
format expandPlaceholdersWith: placeholders on: outStream. |
|
591 |
outStream cr. |
|
592 |
||
593 |
"Created: / 20-03-2011 / 19:56:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
594 |
"Modified: / 21-03-2011 / 20:56:40 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
595 |
"Modified: / 22-03-2011 / 17:00:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
596 |
! |
|
597 |
||
598 |
writeLine: lno |
|
599 |
||
600 |
outStream nextPutAll: 'LINE '. |
|
601 |
lno printOn: outStream. |
|
602 |
outStream cr. |
|
603 |
||
604 |
"Modified: / 22-03-2011 / 17:00:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
605 |
"Created: / 22-03-2011 / 20:53:29 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
606 |
! ! |
|
607 |
||
608 |
!JavaByteCodeDisassembler methodsFor:'initialization'! |
|
609 |
||
610 |
initialize |
|
611 |
"Invoked when a new instance is created." |
|
612 |
||
613 |
"/ please change as required (and remove this comment) |
|
614 |
"/ outStream := nil. |
|
615 |
placeholders := Dictionary new. |
|
616 |
format := StandardFormat. |
|
617 |
"/ExtendedFormat. |
|
618 |
||
619 |
"/ super initialize. -- commented since inherited method does nothing |
|
620 |
||
621 |
"Modified: / 22-03-2011 / 20:53:50 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
622 |
! ! |
|
623 |
||
624 |
!JavaByteCodeDisassembler methodsFor:'instructions'! |
|
625 |
||
626 |
aaload |
|
627 |
self |
|
628 |
arrayValueLoader. |
|
629 |
||
630 |
"Modified: / 20-03-2011 / 19:59:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
631 |
! |
|
632 |
||
633 |
aastore |
|
634 |
self |
|
635 |
arrayValueStorer. |
|
636 |
||
637 |
"Modified: / 20-03-2011 / 20:01:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
638 |
! |
|
639 |
||
640 |
aconst_null |
|
641 |
self |
|
642 |
constPusher: 'null'. |
|
643 |
||
644 |
"Modified: / 20-03-2011 / 20:39:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
645 |
! |
|
646 |
||
647 |
aload |
|
648 |
||
649 |
self |
|
650 |
writeInstructionWithArgs: (self prettyPrintField: self fetchIndex) |
|
651 |
stackBefore: self whatever |
|
652 |
after: self objRef. |
|
653 |
||
654 |
"Modified: / 21-03-2011 / 15:45:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
655 |
! |
|
656 |
||
657 |
aload: arg |
|
658 |
self |
|
659 |
writeInstructionWithArgs: self nothing |
|
660 |
stackBefore: self whatever |
|
661 |
after: (self prettyPrintField: arg). |
|
662 |
||
663 |
"Modified: / 21-03-2011 / 16:30:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
664 |
! |
|
665 |
||
666 |
anewarray |
|
667 |
self |
|
668 |
writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex2) |
|
669 |
stackBefore: self size |
|
670 |
after: self arrayRef. |
|
671 |
||
672 |
"Modified: / 20-03-2011 / 20:09:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
673 |
! |
|
674 |
||
675 |
areturn |
|
676 |
self |
|
677 |
writeInstructionWithArgs: self nothing |
|
678 |
stackBefore: self objRef |
|
679 |
after: self empty. |
|
680 |
self returnIfFinished. |
|
681 |
||
682 |
"Modified: / 21-03-2011 / 14:55:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
683 |
! |
|
684 |
||
685 |
arraylength |
|
686 |
self |
|
687 |
writeInstructionWithArgs: self nothing |
|
688 |
stackBefore: self arrayRef |
|
689 |
after: self arrayLength. |
|
690 |
||
691 |
"Modified: / 20-03-2011 / 20:16:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
692 |
! |
|
693 |
||
694 |
astore |
|
695 |
self |
|
696 |
writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex) |
|
697 |
stackBefore: self objRef |
|
698 |
after: self whatever. |
|
699 |
||
700 |
"Modified: / 20-03-2011 / 20:19:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
701 |
! |
|
702 |
||
703 |
astore: arg |
|
704 |
self |
|
705 |
writeInstructionWithArgs: self nothing |
|
706 |
stackBefore: self objRef |
|
707 |
after: self whatever. |
|
708 |
||
709 |
"Modified: / 20-03-2011 / 20:19:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
710 |
! |
|
711 |
||
712 |
athrow |
|
713 |
self |
|
714 |
writeInstructionWithArgs: self nothing |
|
715 |
stackBefore: self objRef |
|
716 |
after: self empty , self sep , self excRef. |
|
717 |
self returnIfFinished. |
|
718 |
||
719 |
"Modified: / 22-03-2011 / 14:24:36 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
720 |
! |
|
721 |
||
722 |
baload |
|
723 |
self arrayValueLoader. |
|
724 |
||
725 |
"Modified: / 20-03-2011 / 19:59:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
726 |
! |
|
727 |
||
728 |
bastore |
|
729 |
self |
|
730 |
arrayValueStorer. |
|
731 |
||
732 |
"Modified: / 20-03-2011 / 20:01:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
733 |
! |
|
734 |
||
735 |
bipush |
|
736 |
self |
|
737 |
writeInstructionWithArgs: (self prettyPrintByte: self fetchByte) |
|
738 |
stackBefore: self whatever |
|
739 |
after: self value. |
|
740 |
||
741 |
"Modified: / 20-03-2011 / 21:32:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
742 |
! |
|
743 |
||
744 |
breakpoint |
|
745 |
self |
|
746 |
writeInstructionWithArgs: self nothing |
|
747 |
stackBefore: self whatever |
|
748 |
after: self whatever. |
|
749 |
||
750 |
"Modified: / 20-03-2011 / 20:26:43 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
751 |
! |
|
752 |
||
753 |
caload |
|
754 |
self arrayValueLoader. |
|
755 |
||
756 |
"Modified: / 20-03-2011 / 19:59:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
757 |
! |
|
758 |
||
759 |
castore |
|
760 |
self |
|
761 |
arrayValueStorer. |
|
762 |
||
763 |
"Modified: / 20-03-2011 / 20:02:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
764 |
! |
|
765 |
||
766 |
checkcast |
|
767 |
self |
|
768 |
writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex2) |
|
769 |
stackBefore: self objRef |
|
770 |
after: self objRef. |
|
771 |
||
772 |
"Modified: / 20-03-2011 / 20:23:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
773 |
! |
|
774 |
||
775 |
d2f |
|
776 |
self |
|
777 |
valueManipulator. |
|
778 |
||
779 |
"Modified: / 20-03-2011 / 20:27:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
780 |
! |
|
781 |
||
782 |
d2i |
|
783 |
self valueManipulator. |
|
784 |
||
785 |
"Modified: / 20-03-2011 / 20:27:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
786 |
! |
|
787 |
||
788 |
d2l |
|
789 |
self valueManipulator. |
|
790 |
||
791 |
"Modified: / 20-03-2011 / 20:28:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
792 |
! |
|
793 |
||
794 |
dadd |
|
795 |
self twoValuesManipulator. |
|
796 |
||
797 |
"Modified: / 20-03-2011 / 20:31:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
798 |
! |
|
799 |
||
800 |
daload |
|
801 |
self arrayValueLoader. |
|
802 |
||
803 |
"Modified: / 20-03-2011 / 19:59:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
804 |
! |
|
805 |
||
806 |
dastore |
|
807 |
self |
|
808 |
arrayValueStorer. |
|
809 |
||
810 |
"Modified: / 20-03-2011 / 20:01:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
811 |
! |
|
812 |
||
813 |
dcmpg |
|
814 |
self twoValuesManipulator. |
|
815 |
||
816 |
"Modified: / 20-03-2011 / 20:31:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
817 |
! |
|
818 |
||
819 |
dcmpl |
|
820 |
self twoValuesManipulator. |
|
821 |
||
822 |
"Modified: / 20-03-2011 / 20:31:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
823 |
! |
|
824 |
||
825 |
dconst: arg |
|
826 |
self constPusher: arg. |
|
827 |
||
828 |
"Modified: / 20-03-2011 / 20:39:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
829 |
! |
|
830 |
||
831 |
ddiv |
|
832 |
self twoValuesManipulator. |
|
833 |
||
834 |
"Modified: / 20-03-2011 / 20:31:37 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
835 |
! |
|
836 |
||
837 |
dload |
|
838 |
self indexedFieldLoader. |
|
839 |
||
840 |
"Modified: / 20-03-2011 / 20:44:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
841 |
! |
|
842 |
||
843 |
dload: arg |
|
844 |
self fieldLoader: arg. |
|
845 |
||
846 |
"Modified: / 20-03-2011 / 20:45:59 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
847 |
! |
|
848 |
||
849 |
dmul |
|
850 |
self twoValuesManipulator. |
|
851 |
||
852 |
"Modified: / 20-03-2011 / 20:31:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
853 |
! |
|
854 |
||
855 |
dneg |
|
856 |
self valueManipulator. |
|
857 |
||
858 |
"Modified: / 20-03-2011 / 20:28:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
859 |
! |
|
860 |
||
861 |
drem |
|
862 |
self twoValuesManipulator. |
|
863 |
||
864 |
"Modified: / 20-03-2011 / 20:31:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
865 |
! |
|
866 |
||
867 |
dreturn |
|
868 |
self valueReturner. |
|
869 |
||
870 |
"Modified: / 20-03-2011 / 20:47:47 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
871 |
! |
|
872 |
||
873 |
dstore |
|
874 |
self indexedFieldStorer. |
|
875 |
||
876 |
"Modified: / 20-03-2011 / 20:54:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
877 |
! |
|
878 |
||
879 |
dstore: arg |
|
880 |
self fieldStorer: arg. |
|
881 |
||
882 |
"Modified: / 20-03-2011 / 20:55:25 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
883 |
! |
|
884 |
||
885 |
dsub |
|
886 |
self twoValuesManipulator. |
|
887 |
||
888 |
"Modified: / 20-03-2011 / 20:32:00 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
889 |
! |
|
890 |
||
891 |
dup |
|
892 |
self |
|
893 |
writeInstructionWithArgs: self nothing |
|
894 |
stackBefore: self value |
|
895 |
after: self valueMarked , self sep , self valueMarked. |
|
896 |
||
897 |
"Modified: / 20-03-2011 / 20:58:59 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
898 |
! |
|
899 |
||
900 |
dup2 |
|
901 |
self |
|
902 |
writeInstructionWithArgs: self nothing |
|
903 |
stackBefore: self stackGroupOpen , self value , self sep , self value , self stackGroupClose |
|
904 |
after: self stackGroupOpen , self value , self sep , self value , self stackGroupClose , self sep , self stackGroupOpen , self value , self sep , self value , self stackGroupClose. |
|
905 |
||
906 |
"Modified: / 20-03-2011 / 21:03:25 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
907 |
! |
|
908 |
||
909 |
dup2_x1 |
|
910 |
self |
|
911 |
writeInstructionWithArgs: self nothing |
|
912 |
stackBefore: self stackGroupOpen , self value , self sep , self value |
|
913 |
, self stackGroupClose |
|
914 |
after: self stackGroupOpen , self value , self sep , self value |
|
915 |
, self stackGroupClose , self sep |
|
916 |
, self stackGroupOpen , self value |
|
917 |
, self sep , self value |
|
918 |
, self stackGroupClose. |
|
919 |
||
920 |
"Modified: / 20-03-2011 / 21:06:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
921 |
! |
|
922 |
||
923 |
dup2_x2 |
|
924 |
self |
|
925 |
writeInstructionWithArgs: self nothing |
|
926 |
stackBefore: self stackGroupOpen , self value , self sep , self value |
|
927 |
, self stackGroupClose , self sep , self stackGroupOpen , self valueMarked , self sep , self valueMarked |
|
928 |
, self stackGroupClose |
|
929 |
after: self stackGroupOpen , self valueMarked , self sep , self valueMarked |
|
930 |
, self stackGroupClose , self sep |
|
931 |
, self stackGroupOpen , self value |
|
932 |
, self sep , self value |
|
933 |
, self stackGroupClose , self sep , self stackGroupOpen , self valueMarked , self sep , self valueMarked |
|
934 |
, self stackGroupClose. |
|
935 |
||
936 |
"Modified: / 20-03-2011 / 21:07:26 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
937 |
! |
|
938 |
||
939 |
dup_x1 |
|
940 |
self |
|
941 |
writeInstructionWithArgs: self nothing |
|
942 |
stackBefore: self value , self sep , self valueMarked |
|
943 |
after: self valueMarked , self sep , self value , self sep |
|
944 |
, self valueMarked. |
|
945 |
||
946 |
"Modified: / 20-03-2011 / 21:00:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
947 |
! |
|
948 |
||
949 |
dup_x2 |
|
950 |
self |
|
951 |
writeInstructionWithArgs: self nothing |
|
952 |
stackBefore: self value , self sep , self value , self sep , self valueMarked |
|
953 |
after: self valueMarked , self sep , self value , self sep , self value , self sep , |
|
954 |
self valueMarked. |
|
955 |
||
956 |
"Modified: / 20-03-2011 / 21:01:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
957 |
! |
|
958 |
||
959 |
f2d |
|
960 |
self valueManipulator. |
|
961 |
||
962 |
"Modified: / 20-03-2011 / 20:28:25 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
963 |
! |
|
964 |
||
965 |
f2i |
|
966 |
self valueManipulator. |
|
967 |
||
968 |
"Modified: / 20-03-2011 / 20:28:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
969 |
! |
|
970 |
||
971 |
f2l |
|
972 |
self valueManipulator. |
|
973 |
||
974 |
"Modified: / 20-03-2011 / 20:28:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
975 |
! |
|
976 |
||
977 |
fadd |
|
978 |
self twoValuesManipulator. |
|
979 |
||
980 |
"Modified: / 20-03-2011 / 20:32:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
981 |
! |
|
982 |
||
983 |
faload |
|
984 |
self arrayValueLoader. |
|
985 |
||
986 |
"Modified: / 20-03-2011 / 20:00:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
987 |
! |
|
988 |
||
989 |
fastore |
|
990 |
self |
|
991 |
arrayValueStorer. |
|
992 |
||
993 |
"Modified: / 20-03-2011 / 20:01:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
994 |
! |
|
995 |
||
996 |
fcmpg |
|
997 |
self twoValuesManipulator. |
|
998 |
||
999 |
"Modified: / 20-03-2011 / 20:32:32 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1000 |
! |
|
1001 |
||
1002 |
fcmpl |
|
1003 |
self twoValuesManipulator. |
|
1004 |
||
1005 |
"Modified: / 20-03-2011 / 20:32:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1006 |
! |
|
1007 |
||
1008 |
fconst: arg |
|
1009 |
self constPusher: arg. |
|
1010 |
||
1011 |
"Modified: / 20-03-2011 / 20:39:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1012 |
! |
|
1013 |
||
1014 |
fdiv |
|
1015 |
self twoValuesManipulator. |
|
1016 |
||
1017 |
"Modified: / 20-03-2011 / 20:32:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1018 |
! |
|
1019 |
||
1020 |
fload |
|
1021 |
self indexedFieldLoader. |
|
1022 |
||
1023 |
"Modified: / 20-03-2011 / 20:44:31 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1024 |
! |
|
1025 |
||
1026 |
fload: arg |
|
1027 |
self fieldLoader: arg. |
|
1028 |
||
1029 |
"Modified: / 20-03-2011 / 20:45:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1030 |
! |
|
1031 |
||
1032 |
fmul |
|
1033 |
self twoValuesManipulator. |
|
1034 |
||
1035 |
"Modified: / 20-03-2011 / 20:32:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1036 |
! |
|
1037 |
||
1038 |
fneg |
|
1039 |
self valueManipulator. |
|
1040 |
||
1041 |
"Modified: / 20-03-2011 / 20:28:53 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1042 |
! |
|
1043 |
||
1044 |
frem |
|
1045 |
self twoValuesManipulator. |
|
1046 |
||
1047 |
"Modified: / 20-03-2011 / 20:32:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1048 |
! |
|
1049 |
||
1050 |
freturn |
|
1051 |
self valueReturner. |
|
1052 |
||
1053 |
"Modified: / 20-03-2011 / 20:48:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1054 |
! |
|
1055 |
||
1056 |
fstore |
|
1057 |
self indexedFieldStorer. |
|
1058 |
||
1059 |
"Modified: / 20-03-2011 / 20:54:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1060 |
! |
|
1061 |
||
1062 |
fstore: arg |
|
1063 |
self fieldStorer: arg. |
|
1064 |
||
1065 |
"Modified: / 20-03-2011 / 20:55:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1066 |
! |
|
1067 |
||
1068 |
fsub |
|
1069 |
self twoValuesManipulator. |
|
1070 |
||
1071 |
"Modified: / 20-03-2011 / 20:32:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1072 |
! |
|
1073 |
||
1074 |
getfield |
|
1075 |
| index | |
|
1076 |
||
1077 |
index := self fetchIndex2. |
|
1078 |
self |
|
1079 |
writeInstructionWithArgs: (self prettyPrintIndex: index) |
|
1080 |
stackBefore: self objRef |
|
1081 |
after: self objRef. |
|
1082 |
||
1083 |
"Modified: / 21-03-2011 / 16:25:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1084 |
! |
|
1085 |
||
1086 |
getstatic |
|
1087 |
| index | |
|
1088 |
||
1089 |
index := self fetchIndex2. |
|
1090 |
self |
|
1091 |
writeInstructionWithArgs: (self prettyPrintIndex: index) |
|
1092 |
stackBefore: self whatever |
|
1093 |
after: self objRef. |
|
1094 |
||
1095 |
"Modified: / 21-03-2011 / 16:25:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1096 |
! |
|
1097 |
||
1098 |
goto |
|
1099 |
||
1100 |
self |
|
1101 |
writeInstructionWithArgs: (self prettyPrintJump: self fetchBytes2) |
|
1102 |
stackBefore: self whatever |
|
1103 |
after: self whatever. |
|
1104 |
self returnIfFinished. |
|
1105 |
||
1106 |
"Modified: / 22-03-2011 / 14:30:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1107 |
! |
|
1108 |
||
1109 |
goto_w |
|
1110 |
self |
|
1111 |
writeInstructionWithArgs: (self prettyPrintJump: self fetchBytes4) |
|
1112 |
stackBefore: self whatever |
|
1113 |
after: self whatever. |
|
1114 |
self returnIfFinished. |
|
1115 |
||
1116 |
"Modified: / 22-03-2011 / 14:30:08 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1117 |
! |
|
1118 |
||
1119 |
i2d |
|
1120 |
self valueManipulator. |
|
1121 |
||
1122 |
"Modified: / 20-03-2011 / 20:28:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1123 |
! |
|
1124 |
||
1125 |
i2f |
|
1126 |
self valueManipulator. |
|
1127 |
||
1128 |
"Modified: / 20-03-2011 / 20:29:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1129 |
! |
|
1130 |
||
1131 |
i2l |
|
1132 |
self valueManipulator. |
|
1133 |
||
1134 |
"Modified: / 20-03-2011 / 20:29:06 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1135 |
! |
|
1136 |
||
1137 |
i_dup |
|
1138 |
"raise an error: must be redefined in concrete subclass(es)" |
|
1139 |
||
1140 |
^ self shouldImplement |
|
1141 |
! |
|
1142 |
||
1143 |
iadd |
|
1144 |
self twoValuesManipulator. |
|
1145 |
||
1146 |
"Modified: / 20-03-2011 / 20:33:02 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1147 |
! |
|
1148 |
||
1149 |
iaload |
|
1150 |
self arrayValueLoader. |
|
1151 |
||
1152 |
"Modified: / 20-03-2011 / 20:00:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1153 |
! |
|
1154 |
||
1155 |
iand |
|
1156 |
self twoValuesManipulator. |
|
1157 |
||
1158 |
"Modified: / 20-03-2011 / 20:33:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1159 |
! |
|
1160 |
||
1161 |
iastore |
|
1162 |
self |
|
1163 |
arrayValueStorer. |
|
1164 |
||
1165 |
"Modified: / 20-03-2011 / 20:02:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1166 |
! |
|
1167 |
||
1168 |
iconst: arg |
|
1169 |
self constPusher: arg. |
|
1170 |
||
1171 |
"Created: / 20-03-2011 / 20:41:17 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1172 |
! |
|
1173 |
||
1174 |
idiv |
|
1175 |
self twoValuesManipulator. |
|
1176 |
||
1177 |
"Modified: / 20-03-2011 / 20:33:19 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1178 |
! |
|
1179 |
||
1180 |
ifacmpeq |
|
1181 |
self twoValuesBasedJumper. |
|
1182 |
||
1183 |
"Modified: / 20-03-2011 / 21:11:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1184 |
! |
|
1185 |
||
1186 |
ifacmpne |
|
1187 |
self twoValuesBasedJumper. |
|
1188 |
||
1189 |
"Modified: / 20-03-2011 / 21:11:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1190 |
! |
|
1191 |
||
1192 |
ifeq |
|
1193 |
self valueBasedJumper. |
|
1194 |
||
1195 |
"Modified: / 20-03-2011 / 21:11:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1196 |
! |
|
1197 |
||
1198 |
ifge |
|
1199 |
self valueBasedJumper. |
|
1200 |
||
1201 |
"Modified: / 20-03-2011 / 21:11:37 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1202 |
! |
|
1203 |
||
1204 |
ifgt |
|
1205 |
self valueBasedJumper. |
|
1206 |
||
1207 |
"Modified: / 20-03-2011 / 21:11:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1208 |
! |
|
1209 |
||
1210 |
ificmpeq |
|
1211 |
self twoValuesBasedJumper. |
|
1212 |
||
1213 |
"Modified: / 20-03-2011 / 21:10:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1214 |
! |
|
1215 |
||
1216 |
ificmpge |
|
1217 |
self twoValuesBasedJumper. |
|
1218 |
||
1219 |
"Modified: / 20-03-2011 / 21:11:09 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1220 |
! |
|
1221 |
||
1222 |
ificmpgt |
|
1223 |
self twoValuesBasedJumper. |
|
1224 |
||
1225 |
"Modified: / 20-03-2011 / 21:11:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1226 |
! |
|
1227 |
||
1228 |
ificmple |
|
1229 |
self twoValuesBasedJumper. |
|
1230 |
||
1231 |
"Modified: / 20-03-2011 / 21:11:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1232 |
! |
|
1233 |
||
1234 |
ificmplt |
|
1235 |
self twoValuesBasedJumper. |
|
1236 |
||
1237 |
"Modified: / 20-03-2011 / 21:11:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1238 |
! |
|
1239 |
||
1240 |
ificmpne |
|
1241 |
self twoValuesBasedJumper. |
|
1242 |
||
1243 |
"Modified: / 20-03-2011 / 21:11:21 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1244 |
! |
|
1245 |
||
1246 |
ifle |
|
1247 |
self valueBasedJumper. |
|
1248 |
||
1249 |
"Modified: / 20-03-2011 / 21:11:46 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1250 |
! |
|
1251 |
||
1252 |
iflt |
|
1253 |
self valueBasedJumper. |
|
1254 |
||
1255 |
"Modified: / 20-03-2011 / 21:11:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1256 |
! |
|
1257 |
||
1258 |
ifne |
|
1259 |
self valueBasedJumper. |
|
1260 |
||
1261 |
"Modified: / 20-03-2011 / 21:11:51 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1262 |
! |
|
1263 |
||
1264 |
ifnonnull |
|
1265 |
self valueBasedJumper. |
|
1266 |
||
1267 |
"Modified: / 20-03-2011 / 21:11:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1268 |
! |
|
1269 |
||
1270 |
ifnull |
|
1271 |
self valueBasedJumper. |
|
1272 |
||
1273 |
"Modified: / 20-03-2011 / 21:12:03 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1274 |
! |
|
1275 |
||
1276 |
iinc |
|
1277 |
||
1278 |
wide |
|
1279 |
ifTrue: |
|
1280 |
[ self |
|
1281 |
writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex2) |
|
1282 |
, self sep , (self prettyPrintByte: self fetchBytes2) |
|
1283 |
stackBefore: self objRef |
|
1284 |
after: self result. |
|
1285 |
wide := false. ] |
|
1286 |
ifFalse: |
|
1287 |
[ self |
|
1288 |
writeInstructionWithArgs: (self prettyPrintField: self fetchIndex) |
|
1289 |
, self sep , (self prettyPrintByte: self fetchByte) |
|
1290 |
stackBefore: self objRef |
|
1291 |
after: self result. ]. |
|
1292 |
||
1293 |
"Modified: / 21-03-2011 / 16:23:39 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1294 |
! |
|
1295 |
||
1296 |
iload |
|
1297 |
self indexedFieldLoader. |
|
1298 |
||
1299 |
"Modified: / 20-03-2011 / 20:44:43 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1300 |
! |
|
1301 |
||
1302 |
iload: index |
|
1303 |
self fieldLoader: index. |
|
1304 |
||
1305 |
"Modified: / 20-03-2011 / 20:45:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1306 |
! |
|
1307 |
||
1308 |
imul |
|
1309 |
self twoValuesManipulator. |
|
1310 |
||
1311 |
"Modified: / 20-03-2011 / 20:33:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1312 |
! |
|
1313 |
||
1314 |
ineg |
|
1315 |
self valueManipulator. |
|
1316 |
||
1317 |
"Modified: / 20-03-2011 / 20:30:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1318 |
! |
|
1319 |
||
1320 |
instanceof |
|
1321 |
self |
|
1322 |
writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex2) |
|
1323 |
stackBefore: self objRef |
|
1324 |
after: self result. |
|
1325 |
||
1326 |
"Modified: / 20-03-2011 / 20:21:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1327 |
! |
|
1328 |
||
1329 |
int2byte |
|
1330 |
self valueManipulator. |
|
1331 |
||
1332 |
"Modified: / 20-03-2011 / 20:29:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1333 |
! |
|
1334 |
||
1335 |
int2char |
|
1336 |
self valueManipulator. |
|
1337 |
||
1338 |
"Modified: / 20-03-2011 / 20:29:16 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1339 |
! |
|
1340 |
||
1341 |
int2short |
|
1342 |
self valueManipulator. |
|
1343 |
||
1344 |
"Modified: / 20-03-2011 / 20:29:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1345 |
! |
|
1346 |
||
1347 |
invinterface |
|
1348 |
self |
|
1349 |
writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex2) , self sep , ( self prettyPrintByte: self fetchByte) , self sep , 0 printString |
|
1350 |
stackBefore: self objRef , self sep , self varArgs |
|
1351 |
after: self whatever. |
|
1352 |
||
1353 |
"Modified: / 20-03-2011 / 21:15:49 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1354 |
! |
|
1355 |
||
1356 |
invnonvirt |
|
1357 |
self |
|
1358 |
writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex2) |
|
1359 |
||
1360 |
stackBefore: self objRef , self sep , self varArgs |
|
1361 |
after: self whatever. |
|
1362 |
||
1363 |
"Modified: / 20-03-2011 / 21:17:35 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1364 |
! |
|
1365 |
||
1366 |
invstatic |
|
1367 |
self |
|
1368 |
writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex2) |
|
1369 |
stackBefore: self varArgs |
|
1370 |
after: self whatever. |
|
1371 |
||
1372 |
"Modified: / 20-03-2011 / 21:17:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1373 |
! |
|
1374 |
||
1375 |
invvirt |
|
1376 |
self |
|
1377 |
writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex2) |
|
1378 |
stackBefore: self objRef , self sep , self varArgs |
|
1379 |
after: self whatever. |
|
1380 |
||
1381 |
"Modified: / 20-03-2011 / 21:18:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1382 |
! |
|
1383 |
||
1384 |
ior |
|
1385 |
self twoValuesManipulator. |
|
1386 |
||
1387 |
"Modified: / 20-03-2011 / 20:33:52 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1388 |
! |
|
1389 |
||
1390 |
irem |
|
1391 |
self twoValuesManipulator. |
|
1392 |
||
1393 |
"Modified: / 20-03-2011 / 20:33:56 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1394 |
! |
|
1395 |
||
1396 |
ireturn |
|
1397 |
self valueReturner. |
|
1398 |
||
1399 |
"Modified: / 20-03-2011 / 20:48:30 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1400 |
! |
|
1401 |
||
1402 |
ishl |
|
1403 |
self twoValuesManipulator. |
|
1404 |
||
1405 |
"Modified: / 20-03-2011 / 20:34:07 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1406 |
! |
|
1407 |
||
1408 |
ishr |
|
1409 |
self twoValuesManipulator. |
|
1410 |
||
1411 |
"Modified: / 20-03-2011 / 20:34:11 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1412 |
! |
|
1413 |
||
1414 |
istore |
|
1415 |
self indexedFieldStorer. |
|
1416 |
||
1417 |
"Modified: / 20-03-2011 / 20:54:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1418 |
! |
|
1419 |
||
1420 |
istore: arg |
|
1421 |
self fieldStorer: arg. |
|
1422 |
||
1423 |
"Modified: / 20-03-2011 / 20:55:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1424 |
! |
|
1425 |
||
1426 |
isub |
|
1427 |
self twoValuesManipulator. |
|
1428 |
||
1429 |
"Modified: / 20-03-2011 / 20:34:19 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1430 |
! |
|
1431 |
||
1432 |
iushr |
|
1433 |
self twoValuesManipulator. |
|
1434 |
||
1435 |
"Modified: / 20-03-2011 / 20:34:23 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1436 |
! |
|
1437 |
||
1438 |
ixor |
|
1439 |
self twoValuesManipulator. |
|
1440 |
||
1441 |
"Modified: / 20-03-2011 / 20:34:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1442 |
! |
|
1443 |
||
1444 |
jsr |
|
1445 |
self |
|
1446 |
writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex2) |
|
1447 |
stackBefore: self whatever |
|
1448 |
after: self address. |
|
1449 |
||
1450 |
"Modified: / 20-03-2011 / 21:20:24 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1451 |
! |
|
1452 |
||
1453 |
jsr_w |
|
1454 |
self |
|
1455 |
writeInstructionWithArgs: (self prettyPrintIndex: self fetchBytes4) |
|
1456 |
stackBefore: self whatever |
|
1457 |
after: self address. |
|
1458 |
||
1459 |
"Modified: / 21-03-2011 / 13:03:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1460 |
! |
|
1461 |
||
1462 |
l2d |
|
1463 |
self valueManipulator. |
|
1464 |
||
1465 |
"Modified: / 20-03-2011 / 20:29:50 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1466 |
! |
|
1467 |
||
1468 |
l2f |
|
1469 |
self valueManipulator. |
|
1470 |
||
1471 |
"Modified: / 20-03-2011 / 20:29:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1472 |
! |
|
1473 |
||
1474 |
l2i |
|
1475 |
self valueManipulator. |
|
1476 |
||
1477 |
"Modified: / 20-03-2011 / 20:29:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1478 |
! |
|
1479 |
||
1480 |
ladd |
|
1481 |
self twoValuesManipulator. |
|
1482 |
||
1483 |
"Modified: / 20-03-2011 / 20:35:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1484 |
! |
|
1485 |
||
1486 |
laload |
|
1487 |
self arrayValueLoader. |
|
1488 |
||
1489 |
"Modified: / 20-03-2011 / 20:00:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1490 |
! |
|
1491 |
||
1492 |
land |
|
1493 |
self twoValuesManipulator. |
|
1494 |
||
1495 |
"Modified: / 20-03-2011 / 20:35:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1496 |
! |
|
1497 |
||
1498 |
lastore |
|
1499 |
self |
|
1500 |
arrayValueStorer. |
|
1501 |
||
1502 |
"Modified: / 20-03-2011 / 20:02:47 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1503 |
! |
|
1504 |
||
1505 |
lcmp |
|
1506 |
self twoValuesManipulator. |
|
1507 |
||
1508 |
"Modified: / 20-03-2011 / 20:35:45 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1509 |
! |
|
1510 |
||
1511 |
lconst: arg |
|
1512 |
self constPusher: arg. |
|
1513 |
||
1514 |
"Modified: / 20-03-2011 / 20:41:30 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1515 |
! |
|
1516 |
||
1517 |
ldc1 |
|
1518 |
self |
|
1519 |
writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex) |
|
1520 |
stackBefore: self whatever |
|
1521 |
after: self value. |
|
1522 |
||
1523 |
"Modified: / 20-03-2011 / 21:21:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1524 |
! |
|
1525 |
||
1526 |
ldc2 |
|
1527 |
self |
|
1528 |
writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex2) |
|
1529 |
stackBefore: self whatever |
|
1530 |
after: self value. |
|
1531 |
||
1532 |
"Modified: / 20-03-2011 / 21:21:55 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1533 |
! |
|
1534 |
||
1535 |
ldc2w |
|
1536 |
self |
|
1537 |
writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex2) |
|
1538 |
stackBefore: self whatever |
|
1539 |
after: self value. |
|
1540 |
||
1541 |
"Modified: / 22-03-2011 / 14:18:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1542 |
! |
|
1543 |
||
1544 |
ldiv |
|
1545 |
self twoValuesManipulator. |
|
1546 |
||
1547 |
"Modified: / 20-03-2011 / 20:36:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1548 |
! |
|
1549 |
||
1550 |
lload |
|
1551 |
self indexedFieldLoader. |
|
1552 |
||
1553 |
"Modified: / 20-03-2011 / 20:44:52 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1554 |
! |
|
1555 |
||
1556 |
lload: arg |
|
1557 |
self fieldLoader: arg. |
|
1558 |
||
1559 |
"Modified: / 20-03-2011 / 20:45:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1560 |
! |
|
1561 |
||
1562 |
lmul |
|
1563 |
self twoValuesManipulator. |
|
1564 |
||
1565 |
"Modified: / 20-03-2011 / 20:36:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1566 |
! |
|
1567 |
||
1568 |
lneg |
|
1569 |
self valueManipulator. |
|
1570 |
||
1571 |
"Modified: / 20-03-2011 / 20:29:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1572 |
! |
|
1573 |
||
1574 |
lookupswtch |
|
1575 |
self |
|
1576 |
writeInstructionWithArgs: (self prettyPrintLookupSwitchMadness) |
|
1577 |
stackBefore: self key |
|
1578 |
after: self whatever. |
|
1579 |
||
1580 |
"Modified: / 20-03-2011 / 21:24:10 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1581 |
! |
|
1582 |
||
1583 |
lor |
|
1584 |
self twoValuesManipulator. |
|
1585 |
||
1586 |
"Modified: / 20-03-2011 / 20:36:15 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1587 |
! |
|
1588 |
||
1589 |
lrem |
|
1590 |
self twoValuesManipulator. |
|
1591 |
||
1592 |
"Modified: / 20-03-2011 / 20:36:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1593 |
! |
|
1594 |
||
1595 |
lreturn |
|
1596 |
self valueReturner. |
|
1597 |
||
1598 |
"Modified: / 20-03-2011 / 20:48:38 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1599 |
! |
|
1600 |
||
1601 |
lshl |
|
1602 |
self twoValuesManipulator. |
|
1603 |
||
1604 |
"Modified: / 20-03-2011 / 20:36:22 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1605 |
! |
|
1606 |
||
1607 |
lshr |
|
1608 |
self twoValuesManipulator. |
|
1609 |
||
1610 |
"Modified: / 20-03-2011 / 20:36:27 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1611 |
! |
|
1612 |
||
1613 |
lstore |
|
1614 |
self indexedFieldStorer. |
|
1615 |
||
1616 |
"Modified: / 20-03-2011 / 20:54:29 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1617 |
! |
|
1618 |
||
1619 |
lstore: arg |
|
1620 |
self fieldStorer: arg. |
|
1621 |
||
1622 |
"Modified: / 20-03-2011 / 20:55:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1623 |
! |
|
1624 |
||
1625 |
lsub |
|
1626 |
self twoValuesManipulator. |
|
1627 |
||
1628 |
"Modified: / 20-03-2011 / 20:36:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1629 |
! |
|
1630 |
||
1631 |
lushr |
|
1632 |
self twoValuesManipulator. |
|
1633 |
||
1634 |
"Modified: / 20-03-2011 / 20:36:37 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1635 |
! |
|
1636 |
||
1637 |
lxor |
|
1638 |
self twoValuesManipulator. |
|
1639 |
||
1640 |
"Modified: / 20-03-2011 / 20:36:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1641 |
! |
|
1642 |
||
1643 |
monenter |
|
1644 |
self |
|
1645 |
writeInstructionWithArgs: self nothing |
|
1646 |
stackBefore: self objRef |
|
1647 |
after: self whatever. |
|
1648 |
||
1649 |
"Modified: / 20-03-2011 / 20:20:44 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1650 |
! |
|
1651 |
||
1652 |
monexit |
|
1653 |
self |
|
1654 |
writeInstructionWithArgs: self nothing |
|
1655 |
stackBefore: self objRef |
|
1656 |
after: self whatever. |
|
1657 |
||
1658 |
"Modified: / 20-03-2011 / 20:20:51 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1659 |
! |
|
1660 |
||
1661 |
multianewarray |
|
1662 |
self |
|
1663 |
writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex2) |
|
1664 |
, self sep , (self prettyPrintByte: self fetchByte) |
|
1665 |
stackBefore: self dimensions |
|
1666 |
after: self arrayRef. |
|
1667 |
||
1668 |
"Modified: / 20-03-2011 / 21:25:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1669 |
! |
|
1670 |
||
1671 |
new |
|
1672 |
self |
|
1673 |
writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex2) |
|
1674 |
stackBefore: self whatever |
|
1675 |
after: self objRef. |
|
1676 |
||
1677 |
"Modified: / 20-03-2011 / 20:07:28 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1678 |
! |
|
1679 |
||
1680 |
newarray |
|
1681 |
self |
|
1682 |
writeInstructionWithArgs: (self prettyPrintType: self fetchByte) |
|
1683 |
stackBefore: self size |
|
1684 |
after: self arrayRef. |
|
1685 |
||
1686 |
"Modified: / 20-03-2011 / 20:10:52 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1687 |
! |
|
1688 |
||
1689 |
nop |
|
1690 |
self |
|
1691 |
writeInstructionWithArgs: self nothing |
|
1692 |
stackBefore: self whatever |
|
1693 |
after: self whatever. |
|
1694 |
||
1695 |
"Modified: / 20-03-2011 / 21:26:58 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1696 |
! |
|
1697 |
||
1698 |
pop1 |
|
1699 |
self |
|
1700 |
writeInstructionWithArgs: self nothing |
|
1701 |
stackBefore: self value |
|
1702 |
after: self whatever. |
|
1703 |
||
1704 |
"Modified: / 20-03-2011 / 21:27:33 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1705 |
! |
|
1706 |
||
1707 |
pop2 |
|
1708 |
self |
|
1709 |
writeInstructionWithArgs: self nothing |
|
1710 |
stackBefore: self value , self sep , self value |
|
1711 |
after: self whatever. |
|
1712 |
||
1713 |
"Modified: / 20-03-2011 / 21:27:48 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1714 |
! |
|
1715 |
||
1716 |
putfield |
|
1717 |
| index | |
|
1718 |
||
1719 |
index := self fetchIndex2. |
|
1720 |
self |
|
1721 |
writeInstructionWithArgs: (self prettyPrintIndex: index) |
|
1722 |
stackBefore: self objRef , self sep , self value |
|
1723 |
after: self whatever. |
|
1724 |
||
1725 |
"Modified: / 21-03-2011 / 16:26:14 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1726 |
! |
|
1727 |
||
1728 |
putstatic |
|
1729 |
| index | |
|
1730 |
||
1731 |
index := self fetchIndex2. |
|
1732 |
self |
|
1733 |
writeInstructionWithArgs: (self prettyPrintIndex: index) |
|
1734 |
stackBefore: self value |
|
1735 |
after: self whatever. |
|
1736 |
||
1737 |
"Modified: / 21-03-2011 / 16:26:19 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1738 |
! |
|
1739 |
||
1740 |
ret |
|
1741 |
wide |
|
1742 |
ifTrue: |
|
1743 |
[ self |
|
1744 |
writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex2) |
|
1745 |
stackBefore: self whatever |
|
1746 |
after: self whatever. |
|
1747 |
wide := false. ] |
|
1748 |
ifFalse: |
|
1749 |
[ self |
|
1750 |
writeInstructionWithArgs: (self prettyPrintIndex: self fetchIndex) |
|
1751 |
stackBefore: self whatever |
|
1752 |
after: self whatever. ]. |
|
1753 |
self returnIfFinished. |
|
1754 |
||
1755 |
"Modified: / 21-03-2011 / 14:57:04 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1756 |
! |
|
1757 |
||
1758 |
ret_w |
|
1759 |
self halt: 'spec doesnt know about me, what shall I do?'. |
|
1760 |
||
1761 |
"Modified: / 20-03-2011 / 21:31:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1762 |
! |
|
1763 |
||
1764 |
return |
|
1765 |
self |
|
1766 |
writeInstructionWithArgs: self nothing |
|
1767 |
stackBefore: self whatever |
|
1768 |
after: self empty. |
|
1769 |
self returnIfFinished. |
|
1770 |
||
1771 |
"Modified: / 21-03-2011 / 14:56:54 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1772 |
! |
|
1773 |
||
1774 |
saload |
|
1775 |
self arrayValueLoader. |
|
1776 |
||
1777 |
"Modified: / 20-03-2011 / 20:00:41 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1778 |
! |
|
1779 |
||
1780 |
sastore |
|
1781 |
self |
|
1782 |
arrayValueStorer. |
|
1783 |
||
1784 |
"Modified: / 20-03-2011 / 20:03:05 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1785 |
! |
|
1786 |
||
1787 |
sipush |
|
1788 |
self |
|
1789 |
writeInstructionWithArgs: (self prettyPrintByte: self fetchBytes2) |
|
1790 |
stackBefore: self whatever |
|
1791 |
after: self value. |
|
1792 |
||
1793 |
"Modified: / 20-03-2011 / 21:33:01 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1794 |
! |
|
1795 |
||
1796 |
swap |
|
1797 |
self |
|
1798 |
writeInstructionWithArgs: (self prettyPrintByte: self fetchByte) |
|
1799 |
stackBefore: self valueMarked , self sep , self valueMarked2 |
|
1800 |
after: self valueMarked2 , self sep , self valueMarked. |
|
1801 |
||
1802 |
"Modified: / 20-03-2011 / 21:33:42 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1803 |
! |
|
1804 |
||
1805 |
tableswtch |
|
1806 |
self |
|
1807 |
writeInstructionWithArgs: (self prettyPrintTableSwitchMadness) |
|
1808 |
stackBefore: self index |
|
1809 |
after: self whatever. |
|
1810 |
||
1811 |
"Modified: / 20-03-2011 / 21:34:57 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1812 |
! |
|
1813 |
||
1814 |
wide |
|
1815 |
wide := true. |
|
1816 |
self |
|
1817 |
writeInstructionWithArgs: self nothing |
|
1818 |
stackBefore: self whatever |
|
1819 |
after: self whatever. |
|
1820 |
||
1821 |
"Modified: / 20-03-2011 / 21:48:20 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1822 |
! ! |
|
1823 |
||
1824 |
!JavaByteCodeDisassembler methodsFor:'processing loop'! |
|
1825 |
||
1826 |
handleAbstractMethod |
|
1827 |
^nil. |
|
1828 |
||
1829 |
"Created: / 22-03-2011 / 14:51:13 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1830 |
! |
|
1831 |
||
1832 |
initializeContextVars |
|
1833 |
1 to: numVars |
|
1834 |
do: [:idx | context at: (numArgs + idx) put: 'Var ' , idx printString. ] |
|
1835 |
||
1836 |
"Modified: / 21-03-2011 / 15:28:12 / Marcel Hlopko <hlopkmar@fel.cvut.cz>" |
|
1837 |
! |
|
1838 |
||
1712 | 1839 |
switch: opcode |
752 | 1840 |
|
1841 |
| lno | |
|
1712 | 1842 |
"bytecode positions in line number table starts with 0, not 1" |
1843 |
lno := method quickLineNumberForPC: instrPointer - 1. |
|
752 | 1844 |
lastLno ~~ lno ifTrue:[self writeLine: (lastLno := lno)]. |
1712 | 1845 |
^super switch: opcode |
752 | 1846 |
|
1847 |
"Created: / 22-03-2011 / 20:57:42 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1848 |
! ! |
|
1849 |
||
1850 |
!JavaByteCodeDisassembler class methodsFor:'documentation'! |
|
1851 |
||
1864 | 1852 |
version_HG |
1853 |
||
1854 |
^ '$Changeset: <not expanded> $' |
|
1855 |
! |
|
1856 |
||
752 | 1857 |
version_SVN |
1864 | 1858 |
^ '§Id§' |
752 | 1859 |
! ! |
1860 |
||
1861 |
JavaByteCodeDisassembler initialize! |