1
2
3
4 package joeq.Compiler.BytecodeAnalysis;
5
6 import java.io.PrintStream;
7 import joeq.Class.jq_Array;
8 import joeq.Class.jq_Class;
9 import joeq.Class.jq_ClassFileConstants;
10 import joeq.Class.jq_InstanceField;
11 import joeq.Class.jq_InstanceMethod;
12 import joeq.Class.jq_Member;
13 import joeq.Class.jq_Method;
14 import joeq.Class.jq_Primitive;
15 import joeq.Class.jq_StaticField;
16 import joeq.Class.jq_StaticMethod;
17 import joeq.Class.jq_Type;
18 import joeq.Compiler.CompilationConstants;
19 import joeq.Compiler.CompilationState;
20 import jwutil.strings.Strings;
21 import jwutil.util.Assert;
22
23
24
25
26
27 public class BytecodeVisitor implements jq_ClassFileConstants, CompilationConstants {
28
29 protected final CompilationState state;
30 protected final jq_Class clazz;
31 protected final jq_Method method;
32 protected final byte[] bcs;
33 protected int i_start, i_end;
34 protected boolean TRACE = false;
35 protected PrintStream out = System.out;
36
37 /*** Creates new BytecodeVisitor */
38 public BytecodeVisitor(jq_Method method) {
39 this(CompilationState.DEFAULT, method);
40 }
41
42 /*** Creates new BytecodeVisitor */
43 public BytecodeVisitor(CompilationState state, jq_Method method) {
44 this.state = state;
45 this.clazz = method.getDeclaringClass();
46 this.method = method;
47 this.bcs = method.getBytecode();
48 Assert._assert(this.bcs != null, "Method "+this.method+" has no bytecode!");
49 }
50
51 public void forwardTraversal() throws VerifyError {
52 for (i_end=-1; ; ) {
53 i_start = i_end+1;
54 if (i_start >= bcs.length) break;
55 this.visitBytecode();
56 }
57 }
58
59 public jq_StaticField tryResolve(jq_StaticField m) {
60 try {
61 jq_StaticField m2 = (jq_StaticField) state.tryResolve(m);
62 if (m != m2) updateMemberReference(m2, CONSTANT_ResolvedSFieldRef);
63 return m2;
64 } catch (Error e) {
65 System.err.println("Method "+method+" bc index "+i_start+": Error when resolving "+m+": "+e);
66 throw e;
67 }
68 }
69
70 public jq_InstanceField tryResolve(jq_InstanceField m) {
71 try {
72 jq_InstanceField m2 = (jq_InstanceField) state.tryResolve(m);
73 if (m != m2) updateMemberReference(m2, CONSTANT_ResolvedIFieldRef);
74 return m2;
75 } catch (Error e) {
76 System.err.println("Method "+method+" bc index "+i_start+": Error when resolving "+m+": "+e);
77 throw e;
78 }
79 }
80
81 public jq_StaticMethod tryResolve(jq_StaticMethod m) {
82 try {
83 jq_StaticMethod m2 = (jq_StaticMethod) state.tryResolve(m);
84 if (m != m2) updateMemberReference(m2, CONSTANT_ResolvedSMethodRef);
85 return m2;
86 } catch (Error e) {
87 System.err.println("Method "+method+" bc index "+i_start+": Error when resolving "+m+": "+e);
88 throw e;
89 }
90 }
91
92 public jq_InstanceMethod tryResolve(jq_InstanceMethod m) {
93 try {
94 jq_InstanceMethod m2 = (jq_InstanceMethod) state.tryResolve(m);
95 if (m != m2) updateMemberReference(m2, CONSTANT_ResolvedIMethodRef);
96 return m2;
97 } catch (Error e) {
98 System.err.println("Method "+method+" bc index "+i_start+": Error when resolving "+m+": "+e);
99 throw e;
100 }
101 }
102
103 public jq_Member tryResolve(jq_Member m) {
104 try {
105 jq_Member m2 = state.tryResolve(m);
106 if (m != m2) {
107 byte tag = 0;
108 if (m instanceof jq_InstanceField)
109 tag = CONSTANT_ResolvedIFieldRef;
110 else if (m instanceof jq_StaticField)
111 tag = CONSTANT_ResolvedSFieldRef;
112 else if (m instanceof jq_InstanceMethod)
113 tag = CONSTANT_ResolvedIMethodRef;
114 else if (m instanceof jq_StaticMethod)
115 tag = CONSTANT_ResolvedSMethodRef;
116 else Assert.UNREACHABLE();
117 updateMemberReference(m2, tag);
118 }
119 return m2;
120 } catch (Error e) {
121 System.err.println("Method "+method+" bc index "+i_start+": Error when resolving "+m+": "+e);
122 throw e;
123 }
124 }
125
126 public void updateCPIndex(char index) {
127 int i_size = i_end - i_start;
128 char op = (char)(bcs[i_start] & 0xff);
129 switch (i_size) {
130 case 1:
131
132 Assert._assert(op == 0x12);
133 Assert._assert(index <= 127);
134 bcs[i_end] = (byte)index;
135 break;
136 case 2:
137
138
139
140
141
142
143 Assert._assert(op == 0x13 || op == 0x14 ||
144 op == 0xb2 || op == 0xb3 ||
145 op == 0xb4 || op == 0xb5 ||
146 op == 0xb6 || op == 0xb7 || op == 0xb8 ||
147 op == 0xbb || op == 0xbd ||
148 op == 0xc0 || op == 0xc1);
149 bcs[i_end-1] = (byte)(index >> 8);
150 bcs[i_end] = (byte)index;
151 break;
152 case 3:
153
154 Assert._assert(op == 0xc5);
155 bcs[i_end-2] = (byte)(index >> 8);
156 bcs[i_end-1] = (byte)index;
157 break;
158 case 4:
159
160 Assert._assert(op == 0xb9);
161 bcs[i_end-3] = (byte)(index >> 8);
162 bcs[i_end-2] = (byte)index;
163 break;
164 default:
165 Assert.UNREACHABLE(Strings.hex(op));
166 return;
167 }
168 }
169
170 public void updateMemberReference(jq_Member m, byte tag) {
171 char index;
172 int i_size = i_end - i_start;
173 char op = (char)(bcs[i_start] & 0xff);
174 switch (i_size) {
175 case 1:
176
177 Assert._assert(op == 0x12);
178 --i_end; index = getUnsignedByte();
179 break;
180 case 2:
181
182
183
184
185
186
187 Assert._assert(op == 0x13 || op == 0x14 ||
188 op == 0xb2 || op == 0xb3 ||
189 op == 0xb4 || op == 0xb5 ||
190 op == 0xb6 || op == 0xb7 || op == 0xb8 ||
191 op == 0xbb || op == 0xbd ||
192 op == 0xc0 || op == 0xc1);
193 i_end-=2; index = getUnsignedWord();
194 break;
195 case 3:
196
197 Assert._assert(op == 0xc5);
198 i_end-=3; index = getUnsignedWord(); getUnsignedByte();
199 break;
200 case 4:
201
202 Assert._assert(op == 0xb9);
203 i_end-=4; index = getUnsignedWord(); getUnsignedByte(); getSignedByte();
204 break;
205 default:
206 Assert.UNREACHABLE(Strings.hex(op));
207 return;
208 }
209 clazz.getCP().set(index, m, tag);
210 }
211
212 public void visitBytecode() throws VerifyError {
213 char bc = getUnsignedByte();
214 switch (bc) {
215 case 0x00:
216 this.visitNOP();
217 break;
218 }
219 case 0x01:
220 this.visitACONST(null);
221 break;
222 }
223 case 0x02:
224 case 0x03:
225 case 0x04:
226 case 0x05:
227 case 0x06:
228 case 0x07:
229 case 0x08:
230 this.visitICONST(bc-0x03);
231 break;
232 }
233 case 0x09:
234 case 0x0a:
235 this.visitLCONST((long)(bc-0x09));
236 break;
237 }
238 case 0x0b:
239 this.visitFCONST(0.f);
240 break;
241 }
242 case 0x0c:
243 this.visitFCONST(1.f);
244 break;
245 }
246 case 0x0d:
247 this.visitFCONST(2.f);
248 break;
249 }
250 case 0x0e:
251 this.visitDCONST(0.);
252 break;
253 }
254 case 0x0f:
255 this.visitDCONST(1.);
256 break;
257 }
258 case 0x10:
259 byte v = getSignedByte();
260 this.visitICONST(v);
261 break;
262 }
263 case 0x11:
264 short v = getSignedWord();
265 this.visitICONST(v);
266 break;
267 }
268 case 0x12:
269 char index = getUnsignedByte();
270 byte tt = clazz.getCPtag(index);
271 if (tt == CONSTANT_Integer)
272 this.visitICONST(clazz.getCPasInt(index).intValue());
273 else if (tt == CONSTANT_Float)
274 this.visitFCONST(clazz.getCPasFloat(index).floatValue());
275 else if (tt == CONSTANT_String || tt == CONSTANT_ResolvedClass)
276 this.visitACONST(clazz.getCPasObjectConstant(index));
277 else
278 throw new VerifyError("bad ldc tag: "+tt);
279 break;
280 }
281 case 0x13:
282 char index = getUnsignedWord();
283 byte tt = clazz.getCPtag(index);
284 if (tt == CONSTANT_Integer)
285 this.visitICONST(clazz.getCPasInt(index).intValue());
286 else if (tt == CONSTANT_Float)
287 this.visitFCONST(clazz.getCPasFloat(index).floatValue());
288 else if (tt == CONSTANT_String || tt == CONSTANT_ResolvedClass)
289 this.visitACONST(clazz.getCPasObjectConstant(index));
290 else
291 throw new VerifyError("bad ldc_w tag: "+tt);
292 break;
293 }
294 case 0x14:
295 char index = getUnsignedWord();
296 byte tt = clazz.getCPtag(index);
297 if (tt == CONSTANT_Long)
298 this.visitLCONST(clazz.getCPasLong(index).longValue());
299 else if (tt == CONSTANT_Double)
300 this.visitDCONST(clazz.getCPasDouble(index).doubleValue());
301 else
302 throw new VerifyError();
303 break;
304 }
305 case 0x15:
306 char index = getUnsignedByte();
307 this.visitILOAD(index);
308 break;
309 }
310 case 0x17:
311 char index = getUnsignedByte();
312 this.visitFLOAD(index);
313 break;
314 }
315 case 0x19:
316 char index = getUnsignedByte();
317 this.visitALOAD(index);
318 break;
319 }
320 case 0x16:
321 char index = getUnsignedByte();
322 this.visitLLOAD(index);
323 break;
324 }
325 case 0x18:
326 char index = getUnsignedByte();
327 this.visitDLOAD(index);
328 break;
329 }
330 case 0x1a:
331 case 0x1b:
332 case 0x1c:
333 case 0x1d:
334 int index = bc-0x1a;
335 this.visitILOAD(index);
336 break;
337 }
338 case 0x22:
339 case 0x23:
340 case 0x24:
341 case 0x25:
342 int index = bc-0x22;
343 this.visitFLOAD(index);
344 break;
345 }
346 case 0x2a:
347 case 0x2b:
348 case 0x2c:
349 case 0x2d:
350 int index = bc-0x2a;
351 this.visitALOAD(index);
352 break;
353 }
354 case 0x1e:
355 case 0x1f:
356 case 0x20:
357 case 0x21:
358 int index = bc-0x1e;
359 this.visitLLOAD(index);
360 break;
361 }
362 case 0x26:
363 case 0x27:
364 case 0x28:
365 case 0x29:
366 int index = bc-0x26;
367 this.visitDLOAD(index);
368 break;
369 }
370 case 0x2e:
371 this.visitPEI();
372 this.visitIALOAD();
373 break;
374 }
375 case 0x30:
376 this.visitPEI();
377 this.visitFALOAD();
378 break;
379 }
380 case 0x32:
381 this.visitPEI();
382 this.visitAALOAD();
383 break;
384 }
385 case 0x2f:
386 this.visitPEI();
387 this.visitLALOAD();
388 break;
389 }
390 case 0x31:
391 this.visitPEI();
392 this.visitDALOAD();
393 break;
394 }
395 case 0x33:
396 this.visitPEI();
397 this.visitBALOAD();
398 break;
399 }
400 case 0x34:
401 this.visitPEI();
402 this.visitCALOAD();
403 break;
404 }
405 case 0x35:
406 this.visitPEI();
407 this.visitSALOAD();
408 break;
409 }
410 case 0x36:
411 char index = getUnsignedByte();
412 this.visitISTORE(index);
413 break;
414 }
415 case 0x38:
416 char index = getUnsignedByte();
417 this.visitFSTORE(index);
418 break;
419 }
420 case 0x3a:
421 char index = getUnsignedByte();
422 this.visitASTORE(index);
423 break;
424 }
425 case 0x37:
426 char index = getUnsignedByte();
427 this.visitLSTORE(index);
428 break;
429 }
430 case 0x39:
431 char index = getUnsignedByte();
432 this.visitDSTORE(index);
433 break;
434 }
435 case 0x3b:
436 case 0x3c:
437 case 0x3d:
438 case 0x3e:
439 int index = bc-0x3b;
440 this.visitISTORE(index);
441 break;
442 }
443 case 0x43:
444 case 0x44:
445 case 0x45:
446 case 0x46:
447 int index = bc-0x43;
448 this.visitFSTORE(index);
449 break;
450 }
451 case 0x4b:
452 case 0x4c:
453 case 0x4d:
454 case 0x4e:
455 int index = bc-0x4b;
456 this.visitASTORE(index);
457 break;
458 }
459 case 0x3f:
460 case 0x40:
461 case 0x41:
462 case 0x42:
463 int index = bc-0x3f;
464 this.visitLSTORE(index);
465 break;
466 }
467 case 0x47:
468 case 0x48:
469 case 0x49:
470 case 0x4a:
471 int index = bc-0x47;
472 this.visitDSTORE(index);
473 break;
474 }
475 case 0x4f:
476 this.visitPEI();
477 this.visitIASTORE();
478 break;
479 }
480 case 0x51:
481 this.visitPEI();
482 this.visitFASTORE();
483 break;
484 }
485 case 0x50:
486 this.visitPEI();
487 this.visitLASTORE();
488 break;
489 }
490 case 0x52:
491 this.visitPEI();
492 this.visitDASTORE();
493 break;
494 }
495 case 0x53:
496 this.visitPEI();
497 this.visitAASTORE();
498 break;
499 }
500 case 0x54:
501 this.visitPEI();
502 this.visitBASTORE();
503 break;
504 }
505 case 0x55:
506 this.visitPEI();
507 this.visitCASTORE();
508 break;
509 }
510 case 0x56:
511 this.visitPEI();
512 this.visitSASTORE();
513 break;
514 }
515 case 0x57:
516 this.visitPOP();
517 break;
518 }
519 case 0x58:
520 this.visitPOP2();
521 break;
522 }
523 case 0x59:
524 this.visitDUP();
525 break;
526 }
527 case 0x5a:
528 this.visitDUP_x1();
529 break;
530 }
531 case 0x5b:
532 this.visitDUP_x2();
533 break;
534 }
535 case 0x5c:
536 this.visitDUP2();
537 break;
538 }
539 case 0x5d:
540 this.visitDUP2_x1();
541 break;
542 }
543 case 0x5e:
544 this.visitDUP2_x2();
545 break;
546 }
547 case 0x5f:
548 this.visitSWAP();
549 break;
550 }
551 case 0x60:
552 this.visitIBINOP(BINOP_ADD);
553 break;
554 }
555 case 0x61:
556 this.visitLBINOP(BINOP_ADD);
557 break;
558 }
559 case 0x62:
560 this.visitFBINOP(BINOP_ADD);
561 break;
562 }
563 case 0x63:
564 this.visitDBINOP(BINOP_ADD);
565 break;
566 }
567 case 0x64:
568 this.visitIBINOP(BINOP_SUB);
569 break;
570 }
571 case 0x65:
572 this.visitLBINOP(BINOP_SUB);
573 break;
574 }
575 case 0x66:
576 this.visitFBINOP(BINOP_SUB);
577 break;
578 }
579 case 0x67:
580 this.visitDBINOP(BINOP_SUB);
581 break;
582 }
583 case 0x68:
584 this.visitIBINOP(BINOP_MUL);
585 break;
586 }
587 case 0x69:
588 this.visitLBINOP(BINOP_MUL);
589 break;
590 }
591 case 0x6a:
592 this.visitFBINOP(BINOP_MUL);
593 break;
594 }
595 case 0x6b:
596 this.visitDBINOP(BINOP_MUL);
597 break;
598 }
599 case 0x6c:
600 this.visitPEI();
601 this.visitIBINOP(BINOP_DIV);
602 break;
603 }
604 case 0x6d:
605 this.visitPEI();
606 this.visitLBINOP(BINOP_DIV);
607 break;
608 }
609 case 0x6e:
610 this.visitFBINOP(BINOP_DIV);
611 break;
612 }
613 case 0x6f:
614 this.visitDBINOP(BINOP_DIV);
615 break;
616 }
617 case 0x70:
618 this.visitPEI();
619 this.visitIBINOP(BINOP_REM);
620 break;
621 }
622 case 0x71:
623 this.visitPEI();
624 this.visitLBINOP(BINOP_REM);
625 break;
626 }
627 case 0x72:
628 this.visitFBINOP(BINOP_REM);
629 break;
630 }
631 case 0x73:
632 this.visitDBINOP(BINOP_REM);
633 break;
634 }
635 case 0x74:
636 this.visitIUNOP(UNOP_NEG);
637 break;
638 }
639 case 0x75:
640 this.visitLUNOP(UNOP_NEG);
641 break;
642 }
643 case 0x76:
644 this.visitFUNOP(UNOP_NEG);
645 break;
646 }
647 case 0x77:
648 this.visitDUNOP(UNOP_NEG);
649 break;
650 }
651 case 0x78:
652 this.visitISHIFT(SHIFT_LEFT);
653 break;
654 }
655 case 0x79:
656 this.visitLSHIFT(SHIFT_LEFT);
657 break;
658 }
659 case 0x7a:
660 this.visitISHIFT(SHIFT_RIGHT);
661 break;
662 }
663 case 0x7b:
664 this.visitLSHIFT(SHIFT_RIGHT);
665 break;
666 }
667 case 0x7c:
668 this.visitISHIFT(SHIFT_URIGHT);
669 break;
670 }
671 case 0x7d:
672 this.visitLSHIFT(SHIFT_URIGHT);
673 break;
674 }
675 case 0x7e:
676 this.visitIBINOP(BINOP_AND);
677 break;
678 }
679 case 0x7f:
680 this.visitLBINOP(BINOP_AND);
681 break;
682 }
683 case 0x80:
684 this.visitIBINOP(BINOP_OR);
685 break;
686 }
687 case 0x81:
688 this.visitLBINOP(BINOP_OR);
689 break;
690 }
691 case 0x82:
692 this.visitIBINOP(BINOP_XOR);
693 break;
694 }
695 case 0x83:
696 this.visitLBINOP(BINOP_XOR);
697 break;
698 }
699 case 0x84:
700 char index = getUnsignedByte();
701 byte v = getSignedByte();
702 this.visitIINC(index, v);
703 break;
704 }
705 case 0x85:
706 this.visitI2L();
707 break;
708 }
709 case 0x86:
710 this.visitI2F();
711 break;
712 }
713 case 0x87:
714 this.visitI2D();
715 break;
716 }
717 case 0x88:
718 this.visitL2I();
719 break;
720 }
721 case 0x89:
722 this.visitL2F();
723 break;
724 }
725 case 0x8a:
726 this.visitL2D();
727 break;
728 }
729 case 0x8b:
730 this.visitF2I();
731 break;
732 }
733 case 0x8c:
734 this.visitF2L();
735 break;
736 }
737 case 0x8d:
738 this.visitF2D();
739 break;
740 }
741 case 0x8e:
742 this.visitD2I();
743 break;
744 }
745 case 0x8f:
746 this.visitD2L();
747 break;
748 }
749 case 0x90:
750 this.visitD2F();
751 break;
752 }
753 case 0x91:
754 this.visitI2B();
755 break;
756 }
757 case 0x92:
758 this.visitI2C();
759 break;
760 }
761 case 0x93:
762 this.visitI2S();
763 break;
764 }
765 case 0x94:
766 this.visitLCMP2();
767 break;
768 }
769 case 0x95:
770 this.visitFCMP2(CMP_L);
771 break;
772 }
773 case 0x96:
774 this.visitFCMP2(CMP_G);
775 break;
776 }
777 case 0x97:
778 this.visitDCMP2(CMP_L);
779 break;
780 }
781 case 0x98:
782 this.visitDCMP2(CMP_G);
783 break;
784 }
785 case 0x99:
786 int offset = getSignedWord();
787 int target = i_start + offset;
788 this.visitIF(CMP_EQ, target);
789 break;
790 }
791 case 0xc6:
792 int offset = getSignedWord();
793 int target = i_start + offset;
794 this.visitIFREF(CMP_EQ, target);
795 break;
796 }
797 case 0x9a:
798 int offset = getSignedWord();
799 int target = i_start + offset;
800 this.visitIF(CMP_NE, target);
801 break;
802 }
803 case 0xc7:
804 int offset = getSignedWord();
805 int target = i_start + offset;
806 this.visitIFREF(CMP_NE, target);
807 break;
808 }
809 case 0x9b:
810 int offset = getSignedWord();
811 int target = i_start + offset;
812 this.visitIF(CMP_LT, target);
813 break;
814 }
815 case 0x9c:
816 int offset = getSignedWord();
817 int target = i_start + offset;
818 this.visitIF(CMP_GE, target);
819 break;
820 }
821 case 0x9d:
822 int offset = getSignedWord();
823 int target = i_start + offset;
824 this.visitIF(CMP_GT, target);
825 break;
826 }
827 case 0x9e:
828 int offset = getSignedWord();
829 int target = i_start + offset;
830 this.visitIF(CMP_LE, target);
831 break;
832 }
833 case 0x9f:
834 int offset = getSignedWord();
835 int target = i_start + offset;
836 this.visitIFCMP(CMP_EQ, target);
837 break;
838 }
839 case 0xa5:
840 int offset = getSignedWord();
841 int target = i_start + offset;
842 this.visitIFREFCMP(CMP_EQ, target);
843 break;
844 }
845 case 0xa0:
846 int offset = getSignedWord();
847 int target = i_start + offset;
848 this.visitIFCMP(CMP_NE, target);
849 break;
850 }
851 case 0xa6:
852 int offset = getSignedWord();
853 int target = i_start + offset;
854 this.visitIFREFCMP(CMP_NE, target);
855 break;
856 }
857 case 0xa1:
858 int offset = getSignedWord();
859 int target = i_start + offset;
860 this.visitIFCMP(CMP_LT, target);
861 break;
862 }
863 case 0xa2:
864 int offset = getSignedWord();
865 int target = i_start + offset;
866 this.visitIFCMP(CMP_GE, target);
867 break;
868 }
869 case 0xa3:
870 int offset = getSignedWord();
871 int target = i_start + offset;
872 this.visitIFCMP(CMP_GT, target);
873 break;
874 }
875 case 0xa4:
876 int offset = getSignedWord();
877 int target = i_start + offset;
878 this.visitIFCMP(CMP_LE, target);
879 break;
880 }
881 case 0xa7:
882 int offset = getSignedWord();
883 int target = i_start + offset;
884 this.visitGOTO(target);
885 break;
886 }
887 case 0xa8:
888 int offset = getSignedWord();
889 int target = i_start + offset;
890 this.visitJSR(target);
891 break;
892 }
893 case 0xa9:
894 char index = getUnsignedByte();
895 this.visitRET(index);
896 break;
897 }
898 case 0xaa:
899 int align = (i_end+1) & 3;
900 if (align != 0) i_end += 4-align;
901 int offset = getSignedDWord();
902 int target = i_start + offset;
903 int low = getSignedDWord();
904 int high = getSignedDWord();
905 int count = high-low+1;
906 int[] targets = new int[count];
907 for (int i=0; i<count; ++i) {
908 offset = getSignedDWord();
909 targets[i] = i_start + offset;
910 }
911 this.visitTABLESWITCH(target, low, high, targets);
912 break;
913 }
914 case 0xab:
915 int align = (i_end+1) & 3;
916 if (align != 0) i_end += 4-align;
917 int doffset = getSignedDWord();
918 int dtarget = i_start + doffset;
919 int npairs = getSignedDWord();
920 int[] values = new int[npairs];
921 int[] targets = new int[npairs];
922 for (int i=0; i<npairs; ++i) {
923 values[i] = getSignedDWord();
924 int offset = getSignedDWord();
925 targets[i] = i_start + offset;
926 }
927 this.visitLOOKUPSWITCH(dtarget, values, targets);
928 break;
929 }
930 case 0xac:
931 this.visitIRETURN();
932 break;
933 }
934 case 0xae:
935 this.visitFRETURN();
936 break;
937 }
938 case 0xb0:
939 this.visitARETURN();
940 break;
941 }
942 case 0xad:
943 this.visitLRETURN();
944 break;
945 }
946 case 0xaf:
947 this.visitDRETURN();
948 break;
949 }
950 case 0xb1:
951 this.visitVRETURN();
952 break;
953 }
954 case 0xb2:
955 this.visitPEI();
956 char cpi = getUnsignedWord();
957 jq_StaticField f = clazz.getCPasStaticField(cpi);
958 jq_Type t = f.getType();
959 if (t.isReferenceType())
960 this.visitAGETSTATIC(f);
961 else if (t == jq_Primitive.INT)
962 this.visitIGETSTATIC(f);
963 else if (t == jq_Primitive.FLOAT)
964 this.visitFGETSTATIC(f);
965 else if (t == jq_Primitive.LONG)
966 this.visitLGETSTATIC(f);
967 else if (t == jq_Primitive.DOUBLE)
968 this.visitDGETSTATIC(f);
969 else if (t == jq_Primitive.BOOLEAN)
970 this.visitZGETSTATIC(f);
971 else if (t == jq_Primitive.BYTE)
972 this.visitBGETSTATIC(f);
973 else if (t == jq_Primitive.CHAR)
974 this.visitCGETSTATIC(f);
975 else if (t == jq_Primitive.SHORT)
976 this.visitSGETSTATIC(f);
977 else
978 Assert.UNREACHABLE();
979 break;
980 }
981 case 0xb3:
982 this.visitPEI();
983 char cpi = getUnsignedWord();
984 jq_StaticField f = clazz.getCPasStaticField(cpi);
985 jq_Type t = f.getType();
986 if (t.isReferenceType())
987 this.visitAPUTSTATIC(f);
988 else if (t == jq_Primitive.INT)
989 this.visitIPUTSTATIC(f);
990 else if (t == jq_Primitive.FLOAT)
991 this.visitFPUTSTATIC(f);
992 else if (t == jq_Primitive.LONG)
993 this.visitLPUTSTATIC(f);
994 else if (t == jq_Primitive.DOUBLE)
995 this.visitDPUTSTATIC(f);
996 else if (t == jq_Primitive.BOOLEAN)
997 this.visitZPUTSTATIC(f);
998 else if (t == jq_Primitive.BYTE)
999 this.visitBPUTSTATIC(f);
1000 else if (t == jq_Primitive.CHAR)
1001 this.visitCPUTSTATIC(f);
1002 else if (t == jq_Primitive.SHORT)
1003 this.visitSPUTSTATIC(f);
1004 else
1005 Assert.UNREACHABLE();
1006 break;
1007 }
1008 case 0xb4:
1009 this.visitPEI();
1010 char cpi = getUnsignedWord();
1011 jq_InstanceField f = clazz.getCPasInstanceField(cpi);
1012 jq_Type t = f.getType();
1013 if (t.isReferenceType())
1014 this.visitAGETFIELD(f);
1015 else if (t == jq_Primitive.INT)
1016 this.visitIGETFIELD(f);
1017 else if (t == jq_Primitive.FLOAT)
1018 this.visitFGETFIELD(f);
1019 else if (t == jq_Primitive.LONG)
1020 this.visitLGETFIELD(f);
1021 else if (t == jq_Primitive.DOUBLE)
1022 this.visitDGETFIELD(f);
1023 else if (t == jq_Primitive.BYTE)
1024 this.visitBGETFIELD(f);
1025 else if (t == jq_Primitive.CHAR)
1026 this.visitCGETFIELD(f);
1027 else if (t == jq_Primitive.SHORT)
1028 this.visitSGETFIELD(f);
1029 else if (t == jq_Primitive.BOOLEAN)
1030 this.visitZGETFIELD(f);
1031 else
1032 Assert.UNREACHABLE();
1033 break;
1034 }
1035 case 0xb5:
1036 this.visitPEI();
1037 char cpi = getUnsignedWord();
1038 jq_InstanceField f = clazz.getCPasInstanceField(cpi);
1039 jq_Type t = f.getType();
1040 if (t.isReferenceType())
1041 this.visitAPUTFIELD(f);
1042 else if (t == jq_Primitive.INT)
1043 this.visitIPUTFIELD(f);
1044 else if (t == jq_Primitive.FLOAT)
1045 this.visitFPUTFIELD(f);
1046 else if (t == jq_Primitive.LONG)
1047 this.visitLPUTFIELD(f);
1048 else if (t == jq_Primitive.DOUBLE)
1049 this.visitDPUTFIELD(f);
1050 else if (t == jq_Primitive.BYTE)
1051 this.visitBPUTFIELD(f);
1052 else if (t == jq_Primitive.CHAR)
1053 this.visitCPUTFIELD(f);
1054 else if (t == jq_Primitive.SHORT)
1055 this.visitSPUTFIELD(f);
1056 else if (t == jq_Primitive.BOOLEAN)
1057 this.visitZPUTFIELD(f);
1058 else
1059 Assert.UNREACHABLE();
1060 break;
1061 }
1062 case 0xb6:
1063 this.visitPEI();
1064 char cpi = getUnsignedWord();
1065 jq_InstanceMethod f = clazz.getCPasInstanceMethod(cpi);
1066 jq_Type t = f.getReturnType();
1067 if (t == jq_Primitive.VOID)
1068 this.visitVINVOKE(INVOKE_VIRTUAL, f);
1069 else if (t.isReferenceType())
1070 this.visitAINVOKE(INVOKE_VIRTUAL, f);
1071 else if (t == jq_Primitive.FLOAT)
1072 this.visitFINVOKE(INVOKE_VIRTUAL, f);
1073 else if (t == jq_Primitive.LONG)
1074 this.visitLINVOKE(INVOKE_VIRTUAL, f);
1075 else if (t == jq_Primitive.DOUBLE)
1076 this.visitDINVOKE(INVOKE_VIRTUAL, f);
1077 else
1078 this.visitIINVOKE(INVOKE_VIRTUAL, f);
1079 break;
1080 }
1081 case 0xb7:
1082 this.visitPEI();
1083 char cpi = getUnsignedWord();
1084 jq_InstanceMethod f = clazz.getCPasInstanceMethod(cpi);
1085 jq_Type t = f.getReturnType();
1086 if (t == jq_Primitive.VOID)
1087 this.visitVINVOKE(INVOKE_SPECIAL, f);
1088 else if (t.isReferenceType())
1089 this.visitAINVOKE(INVOKE_SPECIAL, f);
1090 else if (t == jq_Primitive.FLOAT)
1091 this.visitFINVOKE(INVOKE_SPECIAL, f);
1092 else if (t == jq_Primitive.LONG)
1093 this.visitLINVOKE(INVOKE_SPECIAL, f);
1094 else if (t == jq_Primitive.DOUBLE)
1095 this.visitDINVOKE(INVOKE_SPECIAL, f);
1096 else
1097 this.visitIINVOKE(INVOKE_SPECIAL, f);
1098 break;
1099 }
1100 case 0xb8:
1101 this.visitPEI();
1102 char cpi = getUnsignedWord();
1103 jq_StaticMethod f = clazz.getCPasStaticMethod(cpi);
1104 jq_Type t = f.getReturnType();
1105 if (t == jq_Primitive.VOID)
1106 this.visitVINVOKE(INVOKE_STATIC, f);
1107 else if (t.isReferenceType())
1108 this.visitAINVOKE(INVOKE_STATIC, f);
1109 else if (t == jq_Primitive.FLOAT)
1110 this.visitFINVOKE(INVOKE_STATIC, f);
1111 else if (t == jq_Primitive.LONG)
1112 this.visitLINVOKE(INVOKE_STATIC, f);
1113 else if (t == jq_Primitive.DOUBLE)
1114 this.visitDINVOKE(INVOKE_STATIC, f);
1115 else
1116 this.visitIINVOKE(INVOKE_STATIC, f);
1117 break;
1118 }
1119 case 0xb9:
1120 this.visitPEI();
1121 char cpi = getUnsignedWord();
1122 jq_InstanceMethod f = clazz.getCPasInstanceMethod(cpi);
1123 getUnsignedByte();
1124 getSignedByte();
1125 jq_Type t = f.getReturnType();
1126 if (t == jq_Primitive.VOID)
1127 this.visitVINVOKE(INVOKE_INTERFACE, f);
1128 else if (t.isReferenceType())
1129 this.visitAINVOKE(INVOKE_INTERFACE, f);
1130 else if (t == jq_Primitive.FLOAT)
1131 this.visitFINVOKE(INVOKE_INTERFACE, f);
1132 else if (t == jq_Primitive.LONG)
1133 this.visitLINVOKE(INVOKE_INTERFACE, f);
1134 else if (t == jq_Primitive.DOUBLE)
1135 this.visitDINVOKE(INVOKE_INTERFACE, f);
1136 else
1137 this.visitIINVOKE(INVOKE_INTERFACE, f);
1138 break;
1139 }
1140 case 0xba:
1141 throw new VerifyError();
1142 }
1143 case 0xbb:
1144 char cpi = getUnsignedWord();
1145 jq_Type f = clazz.getCPasType(cpi);
1146 this.visitNEW(f);
1147 break;
1148 }
1149 case 0xbc:
1150 this.visitPEI();
1151 byte atype = getSignedByte();
1152 jq_Array array = jq_Array.getPrimitiveArrayType(atype);
1153 array.load(); array.prepare();
1154 this.visitNEWARRAY(array);
1155 break;
1156 }
1157 case 0xbd:
1158 this.visitPEI();
1159 char cpi = getUnsignedWord();
1160 jq_Type element = clazz.getCPasType(cpi);
1161 jq_Array array = element.getArrayTypeForElementType();
1162 array.load(); array.prepare();
1163 this.visitNEWARRAY(array);
1164 break;
1165 }
1166 case 0xbe:
1167 this.visitPEI();
1168 this.visitARRAYLENGTH();
1169 break;
1170 }
1171 case 0xbf:
1172 this.visitPEI();
1173 this.visitATHROW();
1174 break;
1175 }
1176 case 0xc0:
1177 this.visitPEI();
1178 char cpi = getUnsignedWord();
1179 jq_Type f = clazz.getCPasType(cpi);
1180 this.visitCHECKCAST(f);
1181 break;
1182 }
1183 case 0xc1:
1184 this.visitPEI();
1185 char cpi = getUnsignedWord();
1186 jq_Type f = clazz.getCPasType(cpi);
1187 this.visitINSTANCEOF(f);
1188 break;
1189 }
1190 case 0xc2:
1191 this.visitPEI();
1192 this.visitMONITOR(MONITOR_ENTER);
1193 break;
1194 }
1195 case 0xc3:
1196 this.visitPEI();
1197 this.visitMONITOR(MONITOR_EXIT);
1198 break;
1199 }
1200 case 0xc4:
1201 char widecode = getUnsignedByte();
1202 char index = getUnsignedWord();
1203 switch (widecode) {
1204 case 0x15:
1205 this.visitILOAD(index);
1206 break;
1207 }
1208 case 0x17:
1209 this.visitFLOAD(index);
1210 break;
1211 }
1212 case 0x19:
1213 this.visitALOAD(index);
1214 break;
1215 }
1216 case 0x16:
1217 this.visitLLOAD(index);
1218 break;
1219 }
1220 case 0x18:
1221 this.visitDLOAD(index);
1222 break;
1223 }
1224 case 0x36:
1225 this.visitISTORE(index);
1226 break;
1227 }
1228 case 0x38:
1229 this.visitFSTORE(index);
1230 break;
1231 }
1232 case 0x3a:
1233 this.visitASTORE(index);
1234 break;
1235 }
1236 case 0x37:
1237 this.visitLSTORE(index);
1238 break;
1239 }
1240 case 0x39:
1241 this.visitDSTORE(index);
1242 break;
1243 }
1244 case 0x84:
1245 short v = getSignedWord();
1246 this.visitIINC(index, v);
1247 break;
1248 }
1249 case 0x9a:
1250 this.visitRET(index);
1251 break;
1252 }
1253 default:
1254 throw new VerifyError();
1255 }
1256 break;
1257 }
1258 case 0xc5:
1259 this.visitPEI();
1260 char cpi = getUnsignedWord();
1261 char dim = getUnsignedByte();
1262 jq_Type array = clazz.getCPasType(cpi);
1263 array.load(); array.prepare();
1264 this.visitMULTINEWARRAY(array, dim);
1265 break;
1266 }
1267 case 0xc8:
1268 int offset = getSignedDWord();
1269 int target = i_start + offset;
1270 this.visitGOTO(target);
1271 break;
1272 }
1273 case 0xc9:
1274 int offset = getSignedDWord();
1275 int target = i_start + offset;
1276 this.visitJSR(target);
1277 break;
1278 }
1279 default:
1280 throw new VerifyError();
1281 }
1282 }
1283
1284 public static final byte BINOP_ADD = 0;
1285 public static final byte BINOP_SUB = 1;
1286 public static final byte BINOP_MUL = 2;
1287 public static final byte BINOP_DIV = 3;
1288 public static final byte BINOP_REM = 4;
1289 public static final byte BINOP_AND = 5;
1290 public static final byte BINOP_OR = 6;
1291 public static final byte BINOP_XOR = 7;
1292 public static final String binopnames[] = {"ADD","SUB","MUL","DIV","REM","AND","OR","XOR"};
1293
1294 public static final byte UNOP_NEG = 0;
1295 public static final String unopnames[] = {"NEG"};
1296
1297 public static final byte SHIFT_LEFT = 0;
1298 public static final byte SHIFT_RIGHT = 1;
1299 public static final byte SHIFT_URIGHT = 2;
1300 public static final String shiftopnames[] = {"LEFT", "RIGHT", "URIGHT"};
1301
1302 public static final byte CMP_L = 0;
1303 public static final byte CMP_G = 1;
1304 public static final String fcmpopnames[] = {"L", "G"};
1305
1306 public static final byte CMP_EQ = 0;
1307 public static final byte CMP_NE = 1;
1308 public static final byte CMP_LT = 2;
1309 public static final byte CMP_GE = 3;
1310 public static final byte CMP_LE = 4;
1311 public static final byte CMP_GT = 5;
1312 public static final byte CMP_AE = 6;
1313 public static final byte CMP_UNCOND = 7;
1314 public static final String cmpopnames[] = {"EQ", "NE", "LT", "GE", "LE", "GT", "AE", "UNCOND"};
1315
1316 public static final byte INVOKE_VIRTUAL = 0;
1317 public static final byte INVOKE_STATIC = 1;
1318 public static final byte INVOKE_SPECIAL = 2;
1319 public static final byte INVOKE_INTERFACE = 3;
1320 public static final String invokeopnames[] = {"VIRTUAL", "STATIC", "SPECIAL", "INTERFACE"};
1321
1322 public static final byte MONITOR_ENTER = 0;
1323 public static final byte MONITOR_EXIT = 1;
1324 public static final String monitoropnames[] = {"ENTER", "EXIT"};
1325
1326
1327 public void visitPEI() {
1328 if (TRACE) out.println(this+": "+i_start+" is a PEI");
1329 }
1330
1331 public void visitNOP() {
1332 if (TRACE) out.println(this+": "+i_start+" NOP");
1333 }
1334 public void visitACONST(Object s) {
1335 if (TRACE) out.println(this+": "+i_start+" ACONST \""+s+"\"");
1336 }
1337 public void visitICONST(int c) {
1338 if (TRACE) out.println(this+": "+i_start+" ICONST "+c);
1339 }
1340 public void visitLCONST(long c) {
1341 if (TRACE) out.println(this+": "+i_start+" LCONST "+c);
1342 }
1343 public void visitFCONST(float c) {
1344 if (TRACE) out.println(this+": "+i_start+" FCONST "+c);
1345 }
1346 public void visitDCONST(double c) {
1347 if (TRACE) out.println(this+": "+i_start+" DCONST "+c);
1348 }
1349 public void visitILOAD(int i) {
1350 if (TRACE) out.println(this+": "+i_start+" ILOAD "+i);
1351 }
1352 public void visitLLOAD(int i) {
1353 if (TRACE) out.println(this+": "+i_start+" LLOAD "+i);
1354 }
1355 public void visitFLOAD(int i) {
1356 if (TRACE) out.println(this+": "+i_start+" FLOAD "+i);
1357 }
1358 public void visitDLOAD(int i) {
1359 if (TRACE) out.println(this+": "+i_start+" DLOAD "+i);
1360 }
1361 public void visitALOAD(int i) {
1362 if (TRACE) out.println(this+": "+i_start+" ALOAD "+i);
1363 }
1364 public void visitISTORE(int i) {
1365 if (TRACE) out.println(this+": "+i_start+" ISTORE "+i);
1366 }
1367 public void visitLSTORE(int i) {
1368 if (TRACE) out.println(this+": "+i_start+" LSTORE "+i);
1369 }
1370 public void visitFSTORE(int i) {
1371 if (TRACE) out.println(this+": "+i_start+" FSTORE "+i);
1372 }
1373 public void visitDSTORE(int i) {
1374 if (TRACE) out.println(this+": "+i_start+" DSTORE "+i);
1375 }
1376 public void visitASTORE(int i) {
1377 if (TRACE) out.println(this+": "+i_start+" ASTORE "+i);
1378 }
1379 public void visitIALOAD() {
1380 if (TRACE) out.println(this+": "+i_start+" IALOAD");
1381 }
1382 public void visitLALOAD() {
1383 if (TRACE) out.println(this+": "+i_start+" LALOAD");
1384 }
1385 public void visitFALOAD() {
1386 if (TRACE) out.println(this+": "+i_start+" FALOAD");
1387 }
1388 public void visitDALOAD() {
1389 if (TRACE) out.println(this+": "+i_start+" DALOAD");
1390 }
1391 public void visitAALOAD() {
1392 if (TRACE) out.println(this+": "+i_start+" AALOAD");
1393 }
1394 public void visitBALOAD() {
1395 if (TRACE) out.println(this+": "+i_start+" BALOAD");
1396 }
1397 public void visitCALOAD() {
1398 if (TRACE) out.println(this+": "+i_start+" CALOAD");
1399 }
1400 public void visitSALOAD() {
1401 if (TRACE) out.println(this+": "+i_start+" SALOAD");
1402 }
1403 public void visitIASTORE() {
1404 if (TRACE) out.println(this+": "+i_start+" IASTORE");
1405 }
1406 public void visitLASTORE() {
1407 if (TRACE) out.println(this+": "+i_start+" LASTORE");
1408 }
1409 public void visitFASTORE() {
1410 if (TRACE) out.println(this+": "+i_start+" FASTORE");
1411 }
1412 public void visitDASTORE() {
1413 if (TRACE) out.println(this+": "+i_start+" DASTORE");
1414 }
1415 public void visitAASTORE() {
1416 if (TRACE) out.println(this+": "+i_start+" AASTORE");
1417 }
1418 public void visitBASTORE() {
1419 if (TRACE) out.println(this+": "+i_start+" BASTORE");
1420 }
1421 public void visitCASTORE() {
1422 if (TRACE) out.println(this+": "+i_start+" CASTORE");
1423 }
1424 public void visitSASTORE() {
1425 if (TRACE) out.println(this+": "+i_start+" SASTORE");
1426 }
1427 public void visitPOP() {
1428 if (TRACE) out.println(this+": "+i_start+" POP");
1429 }
1430 public void visitPOP2() {
1431 if (TRACE) out.println(this+": "+i_start+" POP2");
1432 }
1433 public void visitDUP() {
1434 if (TRACE) out.println(this+": "+i_start+" DUP");
1435 }
1436 public void visitDUP_x1() {
1437 if (TRACE) out.println(this+": "+i_start+" DUP_x1");
1438 }
1439 public void visitDUP_x2() {
1440 if (TRACE) out.println(this+": "+i_start+" DUP_x2");
1441 }
1442 public void visitDUP2() {
1443 if (TRACE) out.println(this+": "+i_start+" DUP2");
1444 }
1445 public void visitDUP2_x1() {
1446 if (TRACE) out.println(this+": "+i_start+" DUP2_x1");
1447 }
1448 public void visitDUP2_x2() {
1449 if (TRACE) out.println(this+": "+i_start+" DUP2_x2");
1450 }
1451 public void visitSWAP() {
1452 if (TRACE) out.println(this+": "+i_start+" SWAP");
1453 }
1454 public void visitIBINOP(byte op) {
1455 if (TRACE) out.println(this+": "+i_start+" I"+binopnames[op]);
1456 }
1457 public void visitLBINOP(byte op) {
1458 if (TRACE) out.println(this+": "+i_start+" L"+binopnames[op]);
1459 }
1460 public void visitFBINOP(byte op) {
1461 if (TRACE) out.println(this+": "+i_start+" F"+binopnames[op]);
1462 }
1463 public void visitDBINOP(byte op) {
1464 if (TRACE) out.println(this+": "+i_start+" D"+binopnames[op]);
1465 }
1466 public void visitIUNOP(byte op) {
1467 if (TRACE) out.println(this+": "+i_start+" I"+binopnames[op]);
1468 }
1469 public void visitLUNOP(byte op) {
1470 if (TRACE) out.println(this+": "+i_start+" L"+binopnames[op]);
1471 }
1472 public void visitFUNOP(byte op) {
1473 if (TRACE) out.println(this+": "+i_start+" F"+binopnames[op]);
1474 }
1475 public void visitDUNOP(byte op) {
1476 if (TRACE) out.println(this+": "+i_start+" D"+binopnames[op]);
1477 }
1478 public void visitISHIFT(byte op) {
1479 if (TRACE) out.println(this+": "+i_start+" ISHIFT "+shiftopnames[op]);
1480 }
1481 public void visitLSHIFT(byte op) {
1482 if (TRACE) out.println(this+": "+i_start+" LSHIFT "+shiftopnames[op]);
1483 }
1484 public void visitIINC(int i, int v) {
1485 if (TRACE) out.println(this+": "+i_start+" IINC "+i+" "+v);
1486 }
1487 public void visitI2L() {
1488 if (TRACE) out.println(this+": "+i_start+" I2L");
1489 }
1490 public void visitI2F() {
1491 if (TRACE) out.println(this+": "+i_start+" I2F");
1492 }
1493 public void visitI2D() {
1494 if (TRACE) out.println(this+": "+i_start+" I2D");
1495 }
1496 public void visitL2I() {
1497 if (TRACE) out.println(this+": "+i_start+" L2I");
1498 }
1499 public void visitL2F() {
1500 if (TRACE) out.println(this+": "+i_start+" L2F");
1501 }
1502 public void visitL2D() {
1503 if (TRACE) out.println(this+": "+i_start+" L2D");
1504 }
1505 public void visitF2I() {
1506 if (TRACE) out.println(this+": "+i_start+" F2I");
1507 }
1508 public void visitF2L() {
1509 if (TRACE) out.println(this+": "+i_start+" F2L");
1510 }
1511 public void visitF2D() {
1512 if (TRACE) out.println(this+": "+i_start+" F2D");
1513 }
1514 public void visitD2I() {
1515 if (TRACE) out.println(this+": "+i_start+" D2I");
1516 }
1517 public void visitD2L() {
1518 if (TRACE) out.println(this+": "+i_start+" D2L");
1519 }
1520 public void visitD2F() {
1521 if (TRACE) out.println(this+": "+i_start+" D2F");
1522 }
1523 public void visitI2B() {
1524 if (TRACE) out.println(this+": "+i_start+" I2B");
1525 }
1526 public void visitI2C() {
1527 if (TRACE) out.println(this+": "+i_start+" I2C");
1528 }
1529 public void visitI2S() {
1530 if (TRACE) out.println(this+": "+i_start+" I2S");
1531 }
1532 public void visitLCMP2() {
1533 if (TRACE) out.println(this+": "+i_start+" LCMP2");
1534 }
1535 public void visitFCMP2(byte op) {
1536 if (TRACE) out.println(this+": "+i_start+" FCMP2 "+fcmpopnames[op]);
1537 }
1538 public void visitDCMP2(byte op) {
1539 if (TRACE) out.println(this+": "+i_start+" DCMP2 "+fcmpopnames[op]);
1540 }
1541 public void visitIF(byte op, int target) {
1542 if (TRACE) out.println(this+": "+i_start+" IF"+cmpopnames[op]+" "+target);
1543 }
1544 public void visitIFREF(byte op, int target) {
1545 if (TRACE) out.println(this+": "+i_start+" IFREF"+cmpopnames[op]+" "+target);
1546 }
1547 public void visitIFCMP(byte op, int target) {
1548 if (TRACE) out.println(this+": "+i_start+" IFCMP"+cmpopnames[op]+" "+target);
1549 }
1550 public void visitIFREFCMP(byte op, int target) {
1551 if (TRACE) out.println(this+": "+i_start+" IFREFCMP"+cmpopnames[op]+" "+target);
1552 }
1553 public void visitGOTO(int target) {
1554 if (TRACE) out.println(this+": "+i_start+" GOTO "+target);
1555 }
1556 public void visitJSR(int target) {
1557 if (TRACE) out.println(this+": "+i_start+" JSR "+target);
1558 }
1559 public void visitRET(int i) {
1560 if (TRACE) out.println(this+": "+i_start+" RET "+i);
1561 }
1562 public void visitTABLESWITCH(int default_target, int low, int high, int[] targets) {
1563 if (TRACE) out.println(this+": "+i_start+" TABLESWITCH("+low+".."+high+",def:"+default_target+")");
1564 }
1565 public void visitLOOKUPSWITCH(int default_target, int[] values, int[] targets) {
1566 Assert._assert(values.length == targets.length);
1567 if (TRACE) out.println(this+": "+i_start+" LOOKUPSWITCH("+values.length+" entries,def:"+default_target+")");
1568 }
1569 public void visitIRETURN() {
1570 if (TRACE) out.println(this+": "+i_start+" IRETURN");
1571 }
1572 public void visitLRETURN() {
1573 if (TRACE) out.println(this+": "+i_start+" LRETURN");
1574 }
1575 public void visitFRETURN() {
1576 if (TRACE) out.println(this+": "+i_start+" FRETURN");
1577 }
1578 public void visitDRETURN() {
1579 if (TRACE) out.println(this+": "+i_start+" DRETURN");
1580 }
1581 public void visitARETURN() {
1582 if (TRACE) out.println(this+": "+i_start+" ARETURN");
1583 }
1584 public void visitVRETURN() {
1585 if (TRACE) out.println(this+": "+i_start+" VRETURN");
1586 }
1587 public void visitIGETSTATIC(jq_StaticField f) {
1588 if (TRACE) out.println(this+": "+i_start+" IGETSTATIC "+f);
1589 }
1590 public void visitLGETSTATIC(jq_StaticField f) {
1591 if (TRACE) out.println(this+": "+i_start+" LGETSTATIC "+f);
1592 }
1593 public void visitFGETSTATIC(jq_StaticField f) {
1594 if (TRACE) out.println(this+": "+i_start+" FGETSTATIC "+f);
1595 }
1596 public void visitDGETSTATIC(jq_StaticField f) {
1597 if (TRACE) out.println(this+": "+i_start+" DGETSTATIC "+f);
1598 }
1599 public void visitAGETSTATIC(jq_StaticField f) {
1600 if (TRACE) out.println(this+": "+i_start+" AGETSTATIC "+f);
1601 }
1602 public void visitZGETSTATIC(jq_StaticField f) {
1603 if (TRACE) out.println(this+": "+i_start+" ZGETSTATIC "+f);
1604 }
1605 public void visitBGETSTATIC(jq_StaticField f) {
1606 if (TRACE) out.println(this+": "+i_start+" BGETSTATIC "+f);
1607 }
1608 public void visitCGETSTATIC(jq_StaticField f) {
1609 if (TRACE) out.println(this+": "+i_start+" CGETSTATIC "+f);
1610 }
1611 public void visitSGETSTATIC(jq_StaticField f) {
1612 if (TRACE) out.println(this+": "+i_start+" SGETSTATIC "+f);
1613 }
1614 public void visitIPUTSTATIC(jq_StaticField f) {
1615 if (TRACE) out.println(this+": "+i_start+" IPUTSTATIC "+f);
1616 }
1617 public void visitLPUTSTATIC(jq_StaticField f) {
1618 if (TRACE) out.println(this+": "+i_start+" LPUTSTATIC "+f);
1619 }
1620 public void visitFPUTSTATIC(jq_StaticField f) {
1621 if (TRACE) out.println(this+": "+i_start+" FPUTSTATIC "+f);
1622 }
1623 public void visitDPUTSTATIC(jq_StaticField f) {
1624 if (TRACE) out.println(this+": "+i_start+" DPUTSTATIC "+f);
1625 }
1626 public void visitAPUTSTATIC(jq_StaticField f) {
1627 if (TRACE) out.println(this+": "+i_start+" APUTSTATIC "+f);
1628 }
1629 public void visitZPUTSTATIC(jq_StaticField f) {
1630 if (TRACE) out.println(this+": "+i_start+" ZPUTSTATIC "+f);
1631 }
1632 public void visitBPUTSTATIC(jq_StaticField f) {
1633 if (TRACE) out.println(this+": "+i_start+" BPUTSTATIC "+f);
1634 }
1635 public void visitCPUTSTATIC(jq_StaticField f) {
1636 if (TRACE) out.println(this+": "+i_start+" CPUTSTATIC "+f);
1637 }
1638 public void visitSPUTSTATIC(jq_StaticField f) {
1639 if (TRACE) out.println(this+": "+i_start+" SPUTSTATIC "+f);
1640 }
1641 public void visitIGETFIELD(jq_InstanceField f) {
1642 if (TRACE) out.println(this+": "+i_start+" IGETFIELD "+f);
1643 }
1644 public void visitLGETFIELD(jq_InstanceField f) {
1645 if (TRACE) out.println(this+": "+i_start+" LGETFIELD "+f);
1646 }
1647 public void visitFGETFIELD(jq_InstanceField f) {
1648 if (TRACE) out.println(this+": "+i_start+" FGETFIELD "+f);
1649 }
1650 public void visitDGETFIELD(jq_InstanceField f) {
1651 if (TRACE) out.println(this+": "+i_start+" DGETFIELD "+f);
1652 }
1653 public void visitAGETFIELD(jq_InstanceField f) {
1654 if (TRACE) out.println(this+": "+i_start+" AGETFIELD "+f);
1655 }
1656 public void visitBGETFIELD(jq_InstanceField f) {
1657 if (TRACE) out.println(this+": "+i_start+" BGETFIELD "+f);
1658 }
1659 public void visitCGETFIELD(jq_InstanceField f) {
1660 if (TRACE) out.println(this+": "+i_start+" CGETFIELD "+f);
1661 }
1662 public void visitSGETFIELD(jq_InstanceField f) {
1663 if (TRACE) out.println(this+": "+i_start+" SGETFIELD "+f);
1664 }
1665 public void visitZGETFIELD(jq_InstanceField f) {
1666 if (TRACE) out.println(this+": "+i_start+" ZGETFIELD "+f);
1667 }
1668 public void visitIPUTFIELD(jq_InstanceField f) {
1669 if (TRACE) out.println(this+": "+i_start+" IPUTFIELD "+f);
1670 }
1671 public void visitLPUTFIELD(jq_InstanceField f) {
1672 if (TRACE) out.println(this+": "+i_start+" LPUTFIELD "+f);
1673 }
1674 public void visitFPUTFIELD(jq_InstanceField f) {
1675 if (TRACE) out.println(this+": "+i_start+" FPUTFIELD "+f);
1676 }
1677 public void visitDPUTFIELD(jq_InstanceField f) {
1678 if (TRACE) out.println(this+": "+i_start+" DPUTFIELD "+f);
1679 }
1680 public void visitAPUTFIELD(jq_InstanceField f) {
1681 if (TRACE) out.println(this+": "+i_start+" APUTFIELD "+f);
1682 }
1683 public void visitBPUTFIELD(jq_InstanceField f) {
1684 if (TRACE) out.println(this+": "+i_start+" BPUTFIELD "+f);
1685 }
1686 public void visitCPUTFIELD(jq_InstanceField f) {
1687 if (TRACE) out.println(this+": "+i_start+" CPUTFIELD "+f);
1688 }
1689 public void visitSPUTFIELD(jq_InstanceField f) {
1690 if (TRACE) out.println(this+": "+i_start+" SPUTFIELD "+f);
1691 }
1692 public void visitZPUTFIELD(jq_InstanceField f) {
1693 if (TRACE) out.println(this+": "+i_start+" ZPUTFIELD "+f);
1694 }
1695 public void visitIINVOKE(byte op, jq_Method f) {
1696 if (TRACE) out.println(this+": "+i_start+" IINVOKE"+invokeopnames[op]+" "+f);
1697 }
1698 public void visitLINVOKE(byte op, jq_Method f) {
1699 if (TRACE) out.println(this+": "+i_start+" LINVOKE"+invokeopnames[op]+" "+f);
1700 }
1701 public void visitFINVOKE(byte op, jq_Method f) {
1702 if (TRACE) out.println(this+": "+i_start+" FINVOKE"+invokeopnames[op]+" "+f);
1703 }
1704 public void visitDINVOKE(byte op, jq_Method f) {
1705 if (TRACE) out.println(this+": "+i_start+" DINVOKE"+invokeopnames[op]+" "+f);
1706 }
1707 public void visitAINVOKE(byte op, jq_Method f) {
1708 if (TRACE) out.println(this+": "+i_start+" AINVOKE"+invokeopnames[op]+" "+f);
1709 }
1710 public void visitVINVOKE(byte op, jq_Method f) {
1711 if (TRACE) out.println(this+": "+i_start+" VINVOKE"+invokeopnames[op]+" "+f);
1712 }
1713 public void visitNEW(jq_Type f) {
1714 if (TRACE) out.println(this+": "+i_start+" NEW "+f);
1715 }
1716 public void visitNEWARRAY(jq_Array f) {
1717 if (TRACE) out.println(this+": "+i_start+" NEWARRAY "+f);
1718 }
1719 public void visitCHECKCAST(jq_Type f) {
1720 if (TRACE) out.println(this+": "+i_start+" CHECKCAST "+f);
1721 }
1722 public void visitINSTANCEOF(jq_Type f) {
1723 if (TRACE) out.println(this+": "+i_start+" INSTANCEOF "+f);
1724 }
1725 public void visitARRAYLENGTH() {
1726 if (TRACE) out.println(this+": "+i_start+" ARRAYLENGTH");
1727 }
1728 public void visitATHROW() {
1729 if (TRACE) out.println(this+": "+i_start+" ATHROW");
1730 }
1731 public void visitMONITOR(byte op) {
1732 if (TRACE) out.println(this+": "+i_start+" MONITOR "+monitoropnames[op]);
1733 }
1734 public void visitMULTINEWARRAY(jq_Type f, char dim) {
1735 if (TRACE) out.println(this+": "+i_start+" MULTINEWARRAY "+f+" (dim:"+(int)dim+")");
1736 }
1737
1738
1739 private final byte getSignedByte() { return bcs[++i_end]; }
1740 private final char getUnsignedByte() { return (char)(bcs[++i_end] & 0xFF); }
1741 private final short getSignedWord() {
1742 int i = bcs[++i_end] << 8;
1743 i |= bcs[++i_end] & 0xFF;
1744 return (short)i;
1745 }
1746 private final char getUnsignedWord() {
1747 int i = (bcs[++i_end] & 0xFF) << 8;
1748 i |= (bcs[++i_end] & 0xFF);
1749 return (char)i;
1750 }
1751 private final int getSignedDWord() {
1752 int i = bcs[++i_end] << 24;
1753 i |= (bcs[++i_end] & 0xFF) << 16;
1754 i |= (bcs[++i_end] & 0xFF) << 8;
1755 i |= (bcs[++i_end] & 0xFF);
1756 return i;
1757 }
1758
1759 }
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190