Novos arquivos necessarios
[JavaDecompiler.git] / src / main / java / br / org / javadecompiler / decoder / Disassembler.java
blob2b32963c7a762d11504d75c984c5ad8c54f9c9e8
1 package br.org.javadecompiler.decoder;
3 import br.org.javadecompiler.classfile.attribute.CodeAttribute;
5 public class Disassembler {
6 public static final int
7 INSN_AALOAD = 0x32,
8 INSN_AASTORE = 0x53,
9 INSN_ACONST_NULL = 0x01,
10 INSN_ALOAD = 0x19,
11 INSN_ALOAD_0 = 0x2A,
12 INSN_ALOAD_1 = 0x2B,
13 INSN_ALOAD_2 = 0x2C,
14 INSN_ALOAD_3 = 0x2D,
15 INSN_ANEWARRAY = 0xBD,
16 INSN_ARETURN = 0xB0,
17 INSN_ARRAYLENGTH = 0xBE,
18 INSN_ASTORE = 0x3A,
19 INSN_ASTORE_0 = 0x4B,
20 INSN_ASTORE_1 = 0x4c,
21 INSN_ASTORE_2 = 0x4D,
22 INSN_ASTORE_3 = 0x4E,
23 INSN_ATHROW = 0xBF,
24 INSN_BALOAD = 0x33,
25 INSN_BASTORE = 0x54,
26 INSN_BIPUSH = 0x10,
27 INSN_CALOAD = 0x34,
28 INSN_CASTORE = 0x55,
29 INSN_CHECKCAST = 0xC0,
30 INSN_D2F = 0x90,
31 INSN_D2I = 0x8E,
32 INSN_D2L = 0x8F,
33 INSN_DADD = 0x63,
34 INSN_DALOAD = 0x31,
35 INSN_DASTORE = 0x52,
36 INSN_DCMPG = 0x98,
37 INSN_DCMPL = 0x97,
38 INSN_DCONST_0 = 0x0E,
39 INSN_DCONST_1 = 0x0F,
40 INSN_DDIV = 0x6F,
41 INSN_DLOAD = 0x18,
42 INSN_DLOAD_0 = 0x26,
43 INSN_DLOAD_1 = 0x27,
44 INSN_DLOAD_2 = 0x28,
45 INSN_DLOAD_3 = 0x29,
46 INSN_DMUL = 0x6B,
47 INSN_DNEG = 0x77,
48 INSN_DREM = 0x73,
49 INSN_DRETURN = 0xAF,
50 INSN_DSTORE = 0x39,
51 INSN_DSTORE_0 = 0x47,
52 INSN_DSTORE_1 = 0x48,
53 INSN_DSTORE_2 = 0x49,
54 INSN_DSTORE_3 = 0x4A,
55 INSN_DSUB = 0x67,
56 INSN_DUP = 0x59,
57 INSN_DUP_X1 = 0x5A,
58 INSN_DUP_X2 = 0x5B,
59 INSN_DUP2 = 0x5C,
60 INSN_DUP2_X1 = 0x5D,
61 INSN_DUP2_X2 = 0x5E,
62 INSN_F2D = 0x8D,
63 INSN_F2I = 0x8B,
64 INSN_F2L = 0x8C,
65 INSN_FADD = 0x62,
66 INSN_FALOAD = 0x30,
67 INSN_FASTORE = 0x51,
68 INSN_FCMPG = 0x96,
69 INSN_FCMPL = 0x95,
70 INSN_FCONST_0 = 0x0B,
71 INSN_FCONST_1 = 0x0C,
72 INSN_FCONST_2 = 0x0D,
73 INSN_FDIV = 0x6E,
74 INSN_FLOAD = 0x17,
75 INSN_FLOAD_0 = 0x22,
76 INSN_FLOAD_1 = 0x23,
77 INSN_FLOAD_2 = 0x24,
78 INSN_FLOAD_3 = 0x25,
79 INSN_FMUL = 0x6A,
80 INSN_FNEG = 0x76,
81 INSN_FREM = 0x72,
82 INSN_FRETURN = 0xAE,
83 INSN_FSTORE = 0x38,
84 INSN_FSTORE_0 = 0x43,
85 INSN_FSTORE_1 = 0x44,
86 INSN_FSTORE_2 = 0x45,
87 INSN_FSTORE_3 = 0x46,
88 INSN_FSUB = 0x66,
89 INSN_GETFIELD = 0xB4,
90 INSN_GETSTATIC = 0xB2,
91 INSN_GOTO = 0xA7,
92 INSN_GOTO_W = 0xC8,
93 INSN_I2B = 0x91,
94 INSN_I2C = 0x92,
95 INSN_I2D = 0x87,
96 INSN_I2F = 0x86,
97 INSN_I2L = 0x85,
98 INSN_I2S = 0x93,
99 INSN_IADD = 0x60,
100 INSN_IALOAD = 0x2E,
101 INSN_IAND = 0x7E,
102 INSN_IASTORE = 0x4F,
103 INSN_ICONST_M1 = 0x02,
104 INSN_ICONST_0 = 0x03,
105 INSN_ICONST_1 = 0x04,
106 INSN_ICONST_2 = 0x05,
107 INSN_ICONST_3 = 0x06,
108 INSN_ICONST_4 = 0x07,
109 INSN_ICONST_5 = 0x08,
110 INSN_IDIV = 0x6C,
111 INSN_IF_ACMPEQ = 0xA5,
112 INSN_IF_ACMPNE = 0xA6,
113 INSN_IF_ICMPEQ = 0x9F,
114 INSN_IF_ICMPNE = 0xA0,
115 INSN_IF_ICMPLT = 0xA1,
116 INSN_IF_ICMPGE = 0xA2,
117 INSN_IF_ICMPGT = 0xA3,
118 INSN_IF_ICMPLE = 0xA4,
119 INSN_IFEQ = 0x99,
120 INSN_IFNE = 0x9A,
121 INSN_IFLT = 0x9B,
122 INSN_IFGE = 0x9C,
123 INSN_IFGT = 0x9D,
124 INSN_IFLE = 0x9E,
125 INSN_IFNONNULL = 0xC7,
126 INSN_IFNULL = 0xC6,
127 INSN_IINC = 0x84,
128 INSN_ILOAD = 0x15,
129 INSN_ILOAD_0 = 0x1A,
130 INSN_ILOAD_1 = 0x1B,
131 INSN_ILOAD_2 = 0x1C,
132 INSN_ILOAD_3 = 0x1D,
133 INSN_IMUL = 0x68,
134 INSN_INEG = 0x74,
135 INSN_INSTANCEOF = 0xC1,
136 INSN_INVOKEDYNAMIC = 0xBA,
137 INSN_INVOKEINTERFACE = 0xB9,
138 INSN_INVOKESPECIAL = 0xB7,
139 INSN_INVOKESTATIC = 0xB8,
140 INSN_INVOKEVIRTUAL = 0xB6,
141 INSN_IOR = 0x80,
142 INSN_IREM = 0x70,
143 INSN_IRETURN = 0xAC,
144 INSN_ISHL = 0x78,
145 INSN_ISHR = 0x7A,
146 INSN_ISTORE = 0x36,
147 INSN_ISTORE_0 = 0x3B,
148 INSN_ISTORE_1 = 0x3C,
149 INSN_ISTORE_2 = 0x3D,
150 INSN_ISTORE_3 = 0x3E,
151 INSN_ISUB = 0x64,
152 INSN_IUSHR = 0x7C,
153 INSN_IXOR = 0x82,
154 INSN_JSR = 0xA8,
155 INSN_JSR_W = 0xC9,
156 INSN_L2D = 0x8A,
157 INSN_L2F = 0x89,
158 INSN_L2I = 0x88,
159 INSN_LADD = 0x61,
160 INSN_LALOAD = 0x2F,
161 INSN_LAND = 0x7F,
162 INSN_LASTORE = 0x50,
163 INSN_LCMP = 0x94,
164 INSN_LCONST_0 = 0x09,
165 INSN_LCONST_1 = 0x0A,
166 INSN_LDC = 0x12,
167 INSN_LDC_W = 0x13,
168 INSN_LDC2_W = 0x14,
169 INSN_LDIV = 0x6D,
170 INSN_LLOAD = 0x16,
171 INSN_LLOAD_0 = 0x1E,
172 INSN_LLOAD_1 = 0x1F,
173 INSN_LLOAD_2 = 0x20,
174 INSN_LLOAD_3 = 0x21,
175 INSN_LMUL = 0x69,
176 INSN_LNEG = 0x75,
177 INSN_LOOKUPSWITCH = 0xAB,
178 INSN_LOR = 0x81,
179 INSN_LREM = 0x71,
180 INSN_LRETURN = 0xAD,
181 INSN_LSHL = 0x79,
182 INSN_LSHR = 0x7B,
183 INSN_LSTORE = 0x37,
184 INSN_LSTORE_0 = 0x3F,
185 INSN_LSTORE_1 = 0x40,
186 INSN_LSTORE_2 = 0x41,
187 INSN_LSTORE_3 = 0x42,
188 INSN_LSUB = 0x65,
189 INSN_LUSHR = 0x7D,
190 INSN_LXOR = 0x83,
191 INSN_MONITORENTER = 0xC2,
192 INSN_MONITOREXIT = 0xC3,
193 INSN_MULTIANEWARRAY = 0xC5,
194 INSN_NEW = 0xBB,
195 INSN_NEWARRAY = 0xBC,
196 INSN_NOP = 0x00,
197 INSN_POP = 0x57,
198 INSN_POP2 = 0x58,
199 INSN_PUTFIELD = 0xB5,
200 INSN_PUTSTATIC = 0xB3,
201 INSN_RET = 0xA9,
202 INSN_RETURN = 0xB1,
203 INSN_SALOAD = 0x35,
204 INSN_SASTORE = 0x56,
205 INSN_SIPUSH = 0x11,
206 INSN_SWAP = 0x5F,
207 INSN_TABLESWITCH = 0xAA,
208 INSN_WIDE = 0xC4;
210 private static final String[] names = {
211 /* 0x00 */ "nop",
212 /* 0x01 */ "aconst_null",
213 /* 0x02 */ "iconst_m1",
214 /* 0x03 */ "iconst_0",
215 /* 0x04 */ "iconst_1",
216 /* 0x05 */ "iconst_2",
217 /* 0x06 */ "iconst_3",
218 /* 0x07 */ "iconst_4",
219 /* 0x08 */ "iconst_5",
220 /* 0x09 */ "lconst_0",
221 /* 0x0a */ "lconst_1",
222 /* 0x0b */ "fconst_0",
223 /* 0x0c */ "fconst_1",
224 /* 0x0d */ "fconst_2",
225 /* 0x0e */ "dconst_0",
226 /* 0x0f */ "dconst_1",
227 /* 0x10 */ "bipush",
228 /* 0x11 */ "sipush",
229 /* 0x12 */ "ldc",
230 /* 0x13 */ "ldc_w",
231 /* 0x14 */ "ldc2_w",
232 /* 0x15 */ "iload",
233 /* 0x16 */ "lload",
234 /* 0x17 */ "fload",
235 /* 0x18 */ "dload",
236 /* 0x19 */ "aload",
237 /* 0x1a */ "iload_0",
238 /* 0x1b */ "iload_1",
239 /* 0x1c */ "iload_2",
240 /* 0x1d */ "iload_3",
241 /* 0x1e */ "lload_0",
242 /* 0x1f */ "lload_1",
243 /* 0x20 */ "lload_2",
244 /* 0x21 */ "lload_3",
245 /* 0x22 */ "fload_0",
246 /* 0x23 */ "fload_1",
247 /* 0x24 */ "fload_2",
248 /* 0x25 */ "fload_3",
249 /* 0x26 */ "dload_0",
250 /* 0x27 */ "dload_1",
251 /* 0x28 */ "dload_2",
252 /* 0x29 */ "dload_3",
253 /* 0x2a */ "aload_0",
254 /* 0x2b */ "aload_1",
255 /* 0x2c */ "aload_2",
256 /* 0x2d */ "aload_3",
257 /* 0x2e */ "iaload",
258 /* 0x2f */ "laload",
259 /* 0x30 */ "faload",
260 /* 0x31 */ "daload",
261 /* 0x32 */ "aaload",
262 /* 0x33 */ "baload",
263 /* 0x34 */ "caload",
264 /* 0x35 */ "saload",
265 /* 0x36 */ "istore",
266 /* 0x37 */ "lstore",
267 /* 0x38 */ "fstore",
268 /* 0x39 */ "dstore",
269 /* 0x3a */ "astore",
270 /* 0x3b */ "istore_0",
271 /* 0x3c */ "istore_1",
272 /* 0x3d */ "istore_2",
273 /* 0x3e */ "istore_3",
274 /* 0x3f */ "lstore_0",
275 /* 0x40 */ "lstore_1",
276 /* 0x41 */ "lstore_2",
277 /* 0x42 */ "lstore_3",
278 /* 0x43 */ "fstore_0",
279 /* 0x44 */ "fstore_1",
280 /* 0x45 */ "fstore_2",
281 /* 0x46 */ "fstore_3",
282 /* 0x47 */ "dstore_0",
283 /* 0x48 */ "dstore_1",
284 /* 0x49 */ "dstore_2",
285 /* 0x4a */ "dstore_3",
286 /* 0x4b */ "astore_0",
287 /* 0x4c */ "astore_1",
288 /* 0x4d */ "astore_2",
289 /* 0x4e */ "astore_3",
290 /* 0x4f */ "iastore",
291 /* 0x50 */ "lastore",
292 /* 0x51 */ "fastore",
293 /* 0x52 */ "dastore",
294 /* 0x53 */ "aastore",
295 /* 0x54 */ "bastore",
296 /* 0x55 */ "castore",
297 /* 0x56 */ "sastore",
298 /* 0x57 */ "pop",
299 /* 0x58 */ "pop2",
300 /* 0x59 */ "dup",
301 /* 0x5a */ "dup_x1",
302 /* 0x5b */ "dup_x2",
303 /* 0x5c */ "dup2",
304 /* 0x5d */ "dup2_x1",
305 /* 0x5e */ "dup2_x2",
306 /* 0x5f */ "swap",
307 /* 0x60 */ "iadd",
308 /* 0x61 */ "ladd",
309 /* 0x62 */ "fadd",
310 /* 0x63 */ "dadd",
311 /* 0x64 */ "isub",
312 /* 0x65 */ "lsub",
313 /* 0x66 */ "fsub",
314 /* 0x67 */ "dsub",
315 /* 0x68 */ "imul",
316 /* 0x69 */ "lmul",
317 /* 0x6a */ "fmul",
318 /* 0x6b */ "dmul",
319 /* 0x6c */ "idiv",
320 /* 0x6d */ "ldiv",
321 /* 0x6e */ "fdiv",
322 /* 0x6f */ "ddiv",
323 /* 0x70 */ "irem",
324 /* 0x71 */ "lrem",
325 /* 0x72 */ "frem",
326 /* 0x73 */ "drem",
327 /* 0x74 */ "ineg",
328 /* 0x75 */ "lneg",
329 /* 0x76 */ "fneg",
330 /* 0x77 */ "dneg",
331 /* 0x78 */ "ishl",
332 /* 0x79 */ "lshl",
333 /* 0x7a */ "ishr",
334 /* 0x7b */ "lshr",
335 /* 0x7c */ "iushr",
336 /* 0x7d */ "lushr",
337 /* 0x7e */ "iand",
338 /* 0x7f */ "land",
339 /* 0x80 */ "ior",
340 /* 0x81 */ "lor",
341 /* 0x82 */ "ixor",
342 /* 0x83 */ "lxor",
343 /* 0x84 */ "iinc",
344 /* 0x85 */ "i2l",
345 /* 0x86 */ "i2f",
346 /* 0x87 */ "i2d",
347 /* 0x88 */ "l2i",
348 /* 0x89 */ "l2f",
349 /* 0x8a */ "l2d",
350 /* 0x8b */ "f2i",
351 /* 0x8c */ "f2l",
352 /* 0x8d */ "f2d",
353 /* 0x8e */ "d2i",
354 /* 0x8f */ "d2l",
355 /* 0x90 */ "d2f",
356 /* 0x91 */ "i2b",
357 /* 0x92 */ "i2c",
358 /* 0x93 */ "i2s",
359 /* 0x94 */ "lcmp",
360 /* 0x95 */ "fcmpl",
361 /* 0x96 */ "fcmpg",
362 /* 0x97 */ "dcmpl",
363 /* 0x98 */ "dcmpg",
364 /* 0x99 */ "ifeq",
365 /* 0x9a */ "ifne",
366 /* 0x9b */ "iflt",
367 /* 0x9c */ "ifge",
368 /* 0x9d */ "ifgt",
369 /* 0x9e */ "ifle",
370 /* 0x9f */ "if_icmpeq",
371 /* 0xa0 */ "if_icmpne",
372 /* 0xa1 */ "if_icmplt",
373 /* 0xa2 */ "if_icmpge",
374 /* 0xa3 */ "if_icmpgt",
375 /* 0xa4 */ "if_icmple",
376 /* 0xa5 */ "if_acmpeq",
377 /* 0xa6 */ "if_acmpne",
378 /* 0xa7 */ "goto",
379 /* 0xa8 */ "jsr",
380 /* 0xa9 */ "ret",
381 /* 0xaa */ "tableswitch",
382 /* 0xab */ "lookupswitch",
383 /* 0xac */ "ireturn",
384 /* 0xad */ "lreturn",
385 /* 0xae */ "freturn",
386 /* 0xaf */ "dreturn",
387 /* 0xb0 */ "areturn",
388 /* 0xb1 */ "return",
389 /* 0xb2 */ "getstatic",
390 /* 0xb3 */ "putstatic",
391 /* 0xb4 */ "getfield",
392 /* 0xb5 */ "putfield",
393 /* 0xb6 */ "invokevirtual",
394 /* 0xb7 */ "invokespecial",
395 /* 0xb8 */ "invokestatic",
396 /* 0xb9 */ "invokeinterface",
397 /* 0xba */ "invokedynamic",
398 /* 0xbb */ "new",
399 /* 0xbc */ "newarray",
400 /* 0xbd */ "anewarray",
401 /* 0xbe */ "arraylength",
402 /* 0xbf */ "athrow",
403 /* 0xc0 */ "checkcast",
404 /* 0xc1 */ "instanceof",
405 /* 0xc2 */ "monitorenter",
406 /* 0xc3 */ "monitorexit",
407 /* 0xc4 */ "wide",
408 /* 0xc5 */ "multianewarray",
409 /* 0xc6 */ "ifnull",
410 /* 0xc7 */ "ifnonnull",
411 /* 0xc8 */ "goto_w",
412 /* 0xc9 */ "jsr_w",
413 /* 0xca */ null,
414 /* 0xcb */ null,
415 /* 0xcc */ null,
416 /* 0xcd */ null,
417 /* 0xce */ null,
418 /* 0xcf */ null,
419 /* 0xd0 */ null,
420 /* 0xd1 */ null,
421 /* 0xd2 */ null,
422 /* 0xd3 */ null,
423 /* 0xd4 */ null,
424 /* 0xd5 */ null,
425 /* 0xd6 */ null,
426 /* 0xd7 */ null,
427 /* 0xd8 */ null,
428 /* 0xd9 */ null,
429 /* 0xda */ null,
430 /* 0xdb */ null,
431 /* 0xdc */ null,
432 /* 0xdd */ null,
433 /* 0xde */ null,
434 /* 0xdf */ null,
435 /* 0xe0 */ null,
436 /* 0xe1 */ null,
437 /* 0xe2 */ null,
438 /* 0xe3 */ null,
439 /* 0xe4 */ null,
440 /* 0xe5 */ null,
441 /* 0xe6 */ null,
442 /* 0xe7 */ null,
443 /* 0xe8 */ null,
444 /* 0xe9 */ null,
445 /* 0xea */ null,
446 /* 0xeb */ null,
447 /* 0xec */ null,
448 /* 0xed */ null,
449 /* 0xee */ null,
450 /* 0xef */ null,
451 /* 0xf0 */ null,
452 /* 0xf1 */ null,
453 /* 0xf2 */ null,
454 /* 0xf3 */ null,
455 /* 0xf4 */ null,
456 /* 0xf5 */ null,
457 /* 0xf6 */ null,
458 /* 0xf7 */ null,
459 /* 0xf8 */ null,
460 /* 0xf9 */ null,
461 /* 0xfa */ null,
462 /* 0xfb */ null,
463 /* 0xfc */ null,
464 /* 0xfd */ null,
465 /* 0xfe */ null,
466 /* 0xff */ null
469 private static final int
470 FORMAT_INVALID = 0,
471 FORMAT_NOARGS = 1,
472 FORMAT_LOCALVAR = 2,
473 FORMAT_CONSTANT = 3,
474 FORMAT_CONSTANT_W = 4,
475 FORMAT_IINC = 5,
476 FORMAT_BRANCH = 6,
477 FORMAT_BRANCH_W = 7,
478 FORMAT_TABLESWITCH = 8,
479 FORMAT_LOOKUPSWITCH = 9,
480 FORMAT_ARRAY = 10,
481 FORMAT_MULTIARRAY = 11,
482 FORMAT_WIDE = 12;
484 private static final int[] byteCodeFormat = {
485 /* 0x00 */ FORMAT_NOARGS,
486 /* 0x01 */ FORMAT_NOARGS,
487 /* 0x02 */ FORMAT_NOARGS,
488 /* 0x03 */ FORMAT_NOARGS,
489 /* 0x04 */ FORMAT_NOARGS,
490 /* 0x05 */ FORMAT_NOARGS,
491 /* 0x06 */ FORMAT_NOARGS,
492 /* 0x07 */ FORMAT_NOARGS,
493 /* 0x08 */ FORMAT_NOARGS,
494 /* 0x09 */ FORMAT_NOARGS,
495 /* 0x0a */ FORMAT_NOARGS,
496 /* 0x0b */ FORMAT_NOARGS,
497 /* 0x0c */ FORMAT_NOARGS,
498 /* 0x0d */ FORMAT_NOARGS,
499 /* 0x0e */ FORMAT_NOARGS,
500 /* 0x0f */ FORMAT_NOARGS,
501 /* 0x10 */ FORMAT_LOCALVAR,
502 /* 0x11 */ FORMAT_LOCALVAR,
503 /* 0x12 */ FORMAT_CONSTANT,
504 /* 0x13 */ FORMAT_CONSTANT_W,
505 /* 0x14 */ FORMAT_CONSTANT_W,
506 /* 0x15 */ FORMAT_LOCALVAR,
507 /* 0x16 */ FORMAT_LOCALVAR,
508 /* 0x17 */ FORMAT_LOCALVAR,
509 /* 0x18 */ FORMAT_LOCALVAR,
510 /* 0x19 */ FORMAT_LOCALVAR,
511 /* 0x1a */ FORMAT_NOARGS,
512 /* 0x1b */ FORMAT_NOARGS,
513 /* 0x1c */ FORMAT_NOARGS,
514 /* 0x1d */ FORMAT_NOARGS,
515 /* 0x1e */ FORMAT_NOARGS,
516 /* 0x1f */ FORMAT_NOARGS,
517 /* 0x20 */ FORMAT_NOARGS,
518 /* 0x21 */ FORMAT_NOARGS,
519 /* 0x22 */ FORMAT_NOARGS,
520 /* 0x23 */ FORMAT_NOARGS,
521 /* 0x24 */ FORMAT_NOARGS,
522 /* 0x25 */ FORMAT_NOARGS,
523 /* 0x26 */ FORMAT_NOARGS,
524 /* 0x27 */ FORMAT_NOARGS,
525 /* 0x28 */ FORMAT_NOARGS,
526 /* 0x29 */ FORMAT_NOARGS,
527 /* 0x2a */ FORMAT_NOARGS,
528 /* 0x2b */ FORMAT_NOARGS,
529 /* 0x2c */ FORMAT_NOARGS,
530 /* 0x2d */ FORMAT_NOARGS,
531 /* 0x2e */ FORMAT_NOARGS,
532 /* 0x2f */ FORMAT_NOARGS,
533 /* 0x30 */ FORMAT_NOARGS,
534 /* 0x31 */ FORMAT_NOARGS,
535 /* 0x32 */ FORMAT_NOARGS,
536 /* 0x33 */ FORMAT_NOARGS,
537 /* 0x34 */ FORMAT_NOARGS,
538 /* 0x35 */ FORMAT_NOARGS,
539 /* 0x36 */ FORMAT_LOCALVAR,
540 /* 0x37 */ FORMAT_LOCALVAR,
541 /* 0x38 */ FORMAT_LOCALVAR,
542 /* 0x39 */ FORMAT_LOCALVAR,
543 /* 0x3a */ FORMAT_LOCALVAR,
544 /* 0x3b */ FORMAT_NOARGS,
545 /* 0x3c */ FORMAT_NOARGS,
546 /* 0x3d */ FORMAT_NOARGS,
547 /* 0x3e */ FORMAT_NOARGS,
548 /* 0x3f */ FORMAT_NOARGS,
549 /* 0x40 */ FORMAT_NOARGS,
550 /* 0x41 */ FORMAT_NOARGS,
551 /* 0x42 */ FORMAT_NOARGS,
552 /* 0x43 */ FORMAT_NOARGS,
553 /* 0x44 */ FORMAT_NOARGS,
554 /* 0x45 */ FORMAT_NOARGS,
555 /* 0x46 */ FORMAT_NOARGS,
556 /* 0x47 */ FORMAT_NOARGS,
557 /* 0x48 */ FORMAT_NOARGS,
558 /* 0x49 */ FORMAT_NOARGS,
559 /* 0x4a */ FORMAT_NOARGS,
560 /* 0x4b */ FORMAT_NOARGS,
561 /* 0x4c */ FORMAT_NOARGS,
562 /* 0x4d */ FORMAT_NOARGS,
563 /* 0x4e */ FORMAT_NOARGS,
564 /* 0x4f */ FORMAT_NOARGS,
565 /* 0x50 */ FORMAT_NOARGS,
566 /* 0x51 */ FORMAT_NOARGS,
567 /* 0x52 */ FORMAT_NOARGS,
568 /* 0x53 */ FORMAT_NOARGS,
569 /* 0x54 */ FORMAT_NOARGS,
570 /* 0x55 */ FORMAT_NOARGS,
571 /* 0x56 */ FORMAT_NOARGS,
572 /* 0x57 */ FORMAT_NOARGS,
573 /* 0x58 */ FORMAT_NOARGS,
574 /* 0x59 */ FORMAT_NOARGS,
575 /* 0x5a */ FORMAT_NOARGS,
576 /* 0x5b */ FORMAT_NOARGS,
577 /* 0x5c */ FORMAT_NOARGS,
578 /* 0x5d */ FORMAT_NOARGS,
579 /* 0x5e */ FORMAT_NOARGS,
580 /* 0x5f */ FORMAT_NOARGS,
581 /* 0x60 */ FORMAT_NOARGS,
582 /* 0x61 */ FORMAT_NOARGS,
583 /* 0x62 */ FORMAT_NOARGS,
584 /* 0x63 */ FORMAT_NOARGS,
585 /* 0x64 */ FORMAT_NOARGS,
586 /* 0x65 */ FORMAT_NOARGS,
587 /* 0x66 */ FORMAT_NOARGS,
588 /* 0x67 */ FORMAT_NOARGS,
589 /* 0x68 */ FORMAT_NOARGS,
590 /* 0x69 */ FORMAT_NOARGS,
591 /* 0x6a */ FORMAT_NOARGS,
592 /* 0x6b */ FORMAT_NOARGS,
593 /* 0x6c */ FORMAT_NOARGS,
594 /* 0x6d */ FORMAT_NOARGS,
595 /* 0x6e */ FORMAT_NOARGS,
596 /* 0x6f */ FORMAT_NOARGS,
597 /* 0x70 */ FORMAT_NOARGS,
598 /* 0x71 */ FORMAT_NOARGS,
599 /* 0x72 */ FORMAT_NOARGS,
600 /* 0x73 */ FORMAT_NOARGS,
601 /* 0x74 */ FORMAT_NOARGS,
602 /* 0x75 */ FORMAT_NOARGS,
603 /* 0x76 */ FORMAT_NOARGS,
604 /* 0x77 */ FORMAT_NOARGS,
605 /* 0x78 */ FORMAT_NOARGS,
606 /* 0x79 */ FORMAT_NOARGS,
607 /* 0x7a */ FORMAT_NOARGS,
608 /* 0x7b */ FORMAT_NOARGS,
609 /* 0x7c */ FORMAT_NOARGS,
610 /* 0x7d */ FORMAT_NOARGS,
611 /* 0x7e */ FORMAT_NOARGS,
612 /* 0x7f */ FORMAT_NOARGS,
613 /* 0x80 */ FORMAT_NOARGS,
614 /* 0x81 */ FORMAT_NOARGS,
615 /* 0x82 */ FORMAT_NOARGS,
616 /* 0x83 */ FORMAT_NOARGS,
617 /* 0x84 */ FORMAT_IINC ,
618 /* 0x85 */ FORMAT_NOARGS,
619 /* 0x86 */ FORMAT_NOARGS,
620 /* 0x87 */ FORMAT_NOARGS,
621 /* 0x88 */ FORMAT_NOARGS,
622 /* 0x89 */ FORMAT_NOARGS,
623 /* 0x8a */ FORMAT_NOARGS,
624 /* 0x8b */ FORMAT_NOARGS,
625 /* 0x8c */ FORMAT_NOARGS,
626 /* 0x8d */ FORMAT_NOARGS,
627 /* 0x8e */ FORMAT_NOARGS,
628 /* 0x8f */ FORMAT_NOARGS,
629 /* 0x90 */ FORMAT_NOARGS,
630 /* 0x91 */ FORMAT_NOARGS,
631 /* 0x92 */ FORMAT_NOARGS,
632 /* 0x93 */ FORMAT_NOARGS,
633 /* 0x94 */ FORMAT_NOARGS,
634 /* 0x95 */ FORMAT_NOARGS,
635 /* 0x96 */ FORMAT_NOARGS,
636 /* 0x97 */ FORMAT_NOARGS,
637 /* 0x98 */ FORMAT_NOARGS,
638 /* 0x99 */ FORMAT_BRANCH,
639 /* 0x9a */ FORMAT_BRANCH,
640 /* 0x9b */ FORMAT_BRANCH,
641 /* 0x9c */ FORMAT_BRANCH,
642 /* 0x9d */ FORMAT_BRANCH,
643 /* 0x9e */ FORMAT_BRANCH,
644 /* 0x9f */ FORMAT_BRANCH,
645 /* 0xa0 */ FORMAT_BRANCH,
646 /* 0xa1 */ FORMAT_BRANCH,
647 /* 0xa2 */ FORMAT_BRANCH,
648 /* 0xa3 */ FORMAT_BRANCH,
649 /* 0xa4 */ FORMAT_BRANCH,
650 /* 0xa5 */ FORMAT_BRANCH,
651 /* 0xa6 */ FORMAT_BRANCH,
652 /* 0xa7 */ FORMAT_BRANCH,
653 /* 0xa8 */ FORMAT_BRANCH,
654 /* 0xa9 */ FORMAT_LOCALVAR,
655 /* 0xaa */ FORMAT_TABLESWITCH,
656 /* 0xab */ FORMAT_LOOKUPSWITCH,
657 /* 0xac */ FORMAT_NOARGS,
658 /* 0xad */ FORMAT_NOARGS,
659 /* 0xae */ FORMAT_NOARGS,
660 /* 0xaf */ FORMAT_NOARGS,
661 /* 0xb0 */ FORMAT_NOARGS,
662 /* 0xb1 */ FORMAT_NOARGS,
663 /* 0xb2 */ FORMAT_CONSTANT_W,
664 /* 0xb3 */ FORMAT_CONSTANT_W,
665 /* 0xb4 */ FORMAT_CONSTANT_W,
666 /* 0xb5 */ FORMAT_CONSTANT_W,
667 /* 0xb6 */ FORMAT_CONSTANT_W,
668 /* 0xb7 */ FORMAT_CONSTANT_W,
669 /* 0xb8 */ FORMAT_CONSTANT_W,
670 /* 0xb9 */ FORMAT_CONSTANT_W,
671 /* 0xba */ FORMAT_CONSTANT_W,
672 /* 0xbb */ FORMAT_CONSTANT_W,
673 /* 0xbc */ FORMAT_ARRAY ,
674 /* 0xbd */ FORMAT_CONSTANT_W,
675 /* 0xbe */ FORMAT_NOARGS,
676 /* 0xbf */ FORMAT_NOARGS,
677 /* 0xc0 */ FORMAT_CONSTANT_W,
678 /* 0xc1 */ FORMAT_CONSTANT_W,
679 /* 0xc2 */ FORMAT_NOARGS,
680 /* 0xc3 */ FORMAT_NOARGS,
681 /* 0xc4 */ FORMAT_WIDE ,
682 /* 0xc5 */ FORMAT_MULTIARRAY,
683 /* 0xc6 */ FORMAT_BRANCH,
684 /* 0xc7 */ FORMAT_BRANCH,
685 /* 0xc8 */ FORMAT_BRANCH_W,
686 /* 0xc9 */ FORMAT_BRANCH_W,
687 /* 0xca */ FORMAT_INVALID,
688 /* 0xcb */ FORMAT_INVALID,
689 /* 0xcc */ FORMAT_INVALID,
690 /* 0xcd */ FORMAT_INVALID,
691 /* 0xce */ FORMAT_INVALID,
692 /* 0xcf */ FORMAT_INVALID,
693 /* 0xd0 */ FORMAT_INVALID,
694 /* 0xd1 */ FORMAT_INVALID,
695 /* 0xd2 */ FORMAT_INVALID,
696 /* 0xd3 */ FORMAT_INVALID,
697 /* 0xd4 */ FORMAT_INVALID,
698 /* 0xd5 */ FORMAT_INVALID,
699 /* 0xd6 */ FORMAT_INVALID,
700 /* 0xd7 */ FORMAT_INVALID,
701 /* 0xd8 */ FORMAT_INVALID,
702 /* 0xd9 */ FORMAT_INVALID,
703 /* 0xda */ FORMAT_INVALID,
704 /* 0xdb */ FORMAT_INVALID,
705 /* 0xdc */ FORMAT_INVALID,
706 /* 0xdd */ FORMAT_INVALID,
707 /* 0xde */ FORMAT_INVALID,
708 /* 0xdf */ FORMAT_INVALID,
709 /* 0xe0 */ FORMAT_INVALID,
710 /* 0xe1 */ FORMAT_INVALID,
711 /* 0xe2 */ FORMAT_INVALID,
712 /* 0xe3 */ FORMAT_INVALID,
713 /* 0xe4 */ FORMAT_INVALID,
714 /* 0xe5 */ FORMAT_INVALID,
715 /* 0xe6 */ FORMAT_INVALID,
716 /* 0xe7 */ FORMAT_INVALID,
717 /* 0xe8 */ FORMAT_INVALID,
718 /* 0xe9 */ FORMAT_INVALID,
719 /* 0xea */ FORMAT_INVALID,
720 /* 0xeb */ FORMAT_INVALID,
721 /* 0xec */ FORMAT_INVALID,
722 /* 0xed */ FORMAT_INVALID,
723 /* 0xee */ FORMAT_INVALID,
724 /* 0xef */ FORMAT_INVALID,
725 /* 0xf0 */ FORMAT_INVALID,
726 /* 0xf1 */ FORMAT_INVALID,
727 /* 0xf2 */ FORMAT_INVALID,
728 /* 0xf3 */ FORMAT_INVALID,
729 /* 0xf4 */ FORMAT_INVALID,
730 /* 0xf5 */ FORMAT_INVALID,
731 /* 0xf6 */ FORMAT_INVALID,
732 /* 0xf7 */ FORMAT_INVALID,
733 /* 0xf8 */ FORMAT_INVALID,
734 /* 0xf9 */ FORMAT_INVALID,
735 /* 0xfa */ FORMAT_INVALID,
736 /* 0xfb */ FORMAT_INVALID,
737 /* 0xfc */ FORMAT_INVALID,
738 /* 0xfd */ FORMAT_INVALID,
739 /* 0xfe */ FORMAT_INVALID,
740 /* 0xff */ FORMAT_INVALID
743 public static String disassemble(CodeAttribute code) {
744 int pos;
745 StringBuffer sb = new StringBuffer();
746 for (pos = 0; pos < code.getByteCode().length; ) {
747 short bc;
748 int format;
749 sb.append(Utils.formatHex(pos, 3)).append(": ");
750 bc = code.getByteCode(pos++);
751 format = byteCodeFormat[bc];
752 if (format == FORMAT_INVALID) {
753 throw new RuntimeException("Invalid bytecode");
754 } else if (format == FORMAT_WIDE) {
756 } else {
757 short arg1;
758 short arg2;
759 int warg1;
760 sb.append(names[bc]).append("\t");
761 switch(format) {
762 case FORMAT_NOARGS:
763 break;
764 case FORMAT_LOCALVAR:
765 arg1 = code.getByteCode(pos++);
766 sb.append(Integer.toString(arg1));
767 break;
768 case FORMAT_CONSTANT:
769 arg1 = code.getByteCode(pos++);
770 sb.append("#").append(Integer.toString(arg1));
771 sb.append("// ").append(code.getOnwerClass().getConstantPool().getConstant(arg1));
772 break;
773 case FORMAT_CONSTANT_W:
774 warg1 = code.getByteCode(pos) * 256 + code.getByteCode(pos + 1);
775 pos += 2;
776 sb.append("#").append(Integer.toString(warg1));
777 sb.append("// ").append(code.getOnwerClass().getConstantPool().getConstant(warg1));
778 break;
779 case FORMAT_IINC:
780 case FORMAT_BRANCH:
781 case FORMAT_BRANCH_W:
782 case FORMAT_TABLESWITCH:
783 case FORMAT_LOOKUPSWITCH:
784 case FORMAT_ARRAY:
785 case FORMAT_MULTIARRAY:
786 break;
789 sb.append("\n");
791 return sb.toString();