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