(final int opcode, final Label label)
| 743 | } |
| 744 | |
| 745 | public void visitJumpInsn (final int opcode, final Label label) { |
| 746 | if (CHECK) { |
| 747 | if (label.owner == null) { |
| 748 | label.owner = this; |
| 749 | } else if (label.owner != this) { |
| 750 | throw new IllegalArgumentException(); |
| 751 | } |
| 752 | } |
| 753 | if (computeMaxs) { |
| 754 | if (opcode == Constants.GOTO) { |
| 755 | // no stack change, but end of current block (with one new successor) |
| 756 | if (currentBlock != null) { |
| 757 | currentBlock.maxStackSize = maxStackSize; |
| 758 | addSuccessor(stackSize, label); |
| 759 | currentBlock = null; |
| 760 | } |
| 761 | } else if (opcode == Constants.JSR) { |
| 762 | if (currentBlock != null) { |
| 763 | addSuccessor(stackSize + 1, label); |
| 764 | } |
| 765 | } else { |
| 766 | // updates current stack size (max stack size unchanged because stack |
| 767 | // size variation always negative in this case) |
| 768 | stackSize += SIZE[opcode]; |
| 769 | if (currentBlock != null) { |
| 770 | addSuccessor(stackSize, label); |
| 771 | } |
| 772 | } |
| 773 | } |
| 774 | // adds the instruction to the bytecode of the method |
| 775 | if (label.resolved && label.position - code.length < Short.MIN_VALUE) { |
| 776 | // case of a backward jump with an offset < -32768. In this case we |
| 777 | // automatically replace GOTO with GOTO_W, JSR with JSR_W and IFxxx <l> |
| 778 | // with IFNOTxxx <l'> GOTO_W <l>, where IFNOTxxx is the "opposite" opcode |
| 779 | // of IFxxx (i.e., IFNE for IFEQ) and where <l'> designates the |
| 780 | // instruction just after the GOTO_W. |
| 781 | if (opcode == Constants.GOTO) { |
| 782 | code.put1(200); // GOTO_W |
| 783 | } else if (opcode == Constants.JSR) { |
| 784 | code.put1(201); // JSR_W |
| 785 | } else { |
| 786 | code.put1(opcode <= 166 ? ((opcode + 1) ^ 1) - 1 : opcode ^ 1); |
| 787 | code.put2(8); // jump offset |
| 788 | code.put1(200); // GOTO_W |
| 789 | } |
| 790 | label.put(this, code, code.length - 1, true); |
| 791 | } else { |
| 792 | // case of a backward jump with an offset >= -32768, or of a forward jump |
| 793 | // with, of course, an unknown offset. In these cases we store the offset |
| 794 | // in 2 bytes (which will be increased in resizeInstructions, if needed). |
| 795 | code.put1(opcode); |
| 796 | label.put(this, code, code.length - 1, false); |
| 797 | } |
| 798 | } |
| 799 | |
| 800 | public void visitLabel (final Label label) { |
| 801 | if (CHECK) { |
nothing calls this directly
no test coverage detected