@Override public final MethodVisitor visitMethod(final int access, final String name, final String desc, final String signature, final String[] exceptions) { return new MethodWriter(this, access, name, desc, signature, exceptions, compute); }
private void visitSwitchInsn(final Label dflt, final Label[] labels) { // Label currentBlock = this.currentBlock; if (currentBlock != null) { if (compute == FRAMES) { currentBlock.frame.execute(Opcodes.LOOKUPSWITCH, 0, null, null); // adds current ast successors addSuccessor(Edge.NORMAL, dflt); dflt.getFirst().status |= Label.TARGET; for (int i = 0; i < labels.length; ++i) { addSuccessor(Edge.NORMAL, labels[i]); labels[i].getFirst().status |= Label.TARGET; } } else { // updates current stack size (max stack size unchanged) --stackSize; // adds current ast successors addSuccessor(stackSize, dflt); for (int i = 0; i < labels.length; ++i) { addSuccessor(stackSize, labels[i]); } } // ends current ast noSuccessor(); } }
int frameIndex = startFrame(f.owner.position, nLocal, nStack); for (i = 0; nLocal > 0; ++i, --nLocal) { t = locals[i]; endFrame();
currentBlock.frame.initInputFrame(cw, access, Type.getArgumentTypes(descriptor), nLocal); visitImplicitFirstFrame(); } else { if (type == Opcodes.F_NEW) { visitFrame(currentBlock.frame); visitImplicitFirstFrame(); int frameIndex = startFrame(code.length, nLocal, nStack); for (int i = 0; i < nLocal; ++i) { if (local[i] instanceof String) { endFrame(); } else { int delta; stackMap.putByte(FULL_FRAME).putShort(delta).putShort(nLocal); for (int i = 0; i < nLocal; ++i) { writeFrameType(local[i]); writeFrameType(stack[i]); stackMap.putByte(SAME_FRAME_EXTENDED + nLocal).putShort(delta); for (int i = 0; i < nLocal; ++i) { writeFrameType(local[i]); writeFrameType(stack[0]);
Type[] args = Type.getArgumentTypes(descriptor); f.initInputFrame(cw, access, args, this.maxLocals); visitFrame(f); f = l.frame; if ((l.status & Label.STORE) != 0) { visitFrame(f); startFrame(start, 0, 1); frame[frameIndex++] = Frame.OBJECT | cw.addType("java/lang/Throwable"); endFrame(); findSubroutine(labels, id); findSubroutine(subroutine, id); findSubroutineSuccessors(0x1000, new Label[10], 0);
addSuccessor(Edge.NORMAL, label); if (opcode != Opcodes.GOTO) { jsr = true; currentBlock.status |= Label.JSR; addSuccessor(stackSize + 1, label); addSuccessor(stackSize, label); visitLabel(nextInsn); noSuccessor();
label = u + readUnsignedShort(b, u + 1); label = u + readShort(b, u + 1); newOffset = getNewOffset(allIndexes, allSizes, u, label); if (newOffset < Short.MIN_VALUE || newOffset > Short.MAX_VALUE) { newOffset = getNewOffset(allIndexes, allSizes, 0, u); insert = -(newOffset & 3); u += 4 * (readInt(b, u + 8) - readInt(b, u + 4) + 1) + 12; break; case ClassWriter.LOOK_INSN: if (state == 1) { newOffset = getNewOffset(allIndexes, allSizes, 0, u); insert = -(newOffset & 3); u += 8 * readInt(b, u + 4) + 8; break; case ClassWriter.WIDE_INSN: label = u + readUnsignedShort(b, u + 1); label = u + readShort(b, u + 1); newOffset = getNewOffset(allIndexes, allSizes, u, label); if (resize[u]) {
startFrame(code.length, nLocal, nStack); for (int i = 0; i < nLocal; ++i) { if (local[i] instanceof String) { endFrame(); .putShort(nLocal); for (int i = 0; i < nLocal; ++i) { writeFrameType(local[i]); writeFrameType(stack[i]); .putShort(delta); for (int i = 0; i < nLocal; ++i) { writeFrameType(local[i]); .putShort(delta); writeFrameType(stack[0]); break;
public void visitTableSwitchInsn( final int min, final int max, final Label dflt, final Label labels[]) { // adds the instruction to the bytecode of the method int source = code.length; code.putByte(Opcodes.TABLESWITCH); code.length += (4 - code.length % 4) % 4; dflt.put(this, code, source, true); code.putInt(min).putInt(max); for (int i = 0; i < labels.length; ++i) { labels[i].put(this, code, source, true); } // updates currentBlock visitSwitchInsn(dflt, labels); }
f.initInputFrame(cw, access, Type.getArgumentTypes(descriptor), this.maxLocals); visitFrame(f); f = l.frame; if ((l.status & Label.STORE) != 0) { visitFrame(f); int frameIndex = startFrame(start, 0, 1); frame[frameIndex] = Frame.OBJECT | cw.addType("java/lang/Throwable"); endFrame();
noSuccessor(); visitLabel(new Label());
addSuccessorToCurrentBasicBlock(Edge.JUMP, label); if (baseOpcode != Opcodes.GOTO) { addSuccessorToCurrentBasicBlock(relativeStackSize + 1, label); addSuccessorToCurrentBasicBlock(relativeStackSize, label); nextBasicBlock.flags |= Label.FLAG_JUMP_TARGET; visitLabel(nextBasicBlock); endCurrentBasicBlockWithNoSuccessor();
int size = getArgumentsAndReturnSizes(descriptor) >> 2; if ((access & Opcodes.ACC_STATIC) != 0) { --size; visitLabel(labels);
endCurrentBasicBlockWithNoSuccessor(); } else { // xLOAD or xSTORE int size = relativeStackSize + STACK_SIZE_DELTA[opcode]; visitLabel(new Label());
public void visitInsn(final int opcode) { // adds the instruction to the bytecode of the method code.putByte(opcode); // update currentBlock // Label currentBlock = this.currentBlock; if (currentBlock != null) { if (compute == FRAMES) { currentBlock.frame.execute(opcode, 0, null, null); } else { // updates current and max stack sizes int size = stackSize + Frame.SIZE[opcode]; if (size > maxStackSize) { maxStackSize = size; } stackSize = size; } // if opcode == ATHROW or xRETURN, ends current ast (no successor) if ((opcode >= Opcodes.IRETURN && opcode <= Opcodes.RETURN) || opcode == Opcodes.ATHROW) { noSuccessor(); } } }
addSuccessor(Edge.NORMAL, label); addSuccessor(stackSize, label);
addSuccessor(Edge.NORMAL, label); if (opcode != Opcodes.GOTO) { addSuccessor(stackSize + 1, label); addSuccessor(stackSize, label); visitLabel(nextInsn); noSuccessor();
public void visitLookupSwitchInsn( final Label dflt, final int keys[], final Label labels[]) { // adds the instruction to the bytecode of the method int source = code.length; code.putByte(Opcodes.LOOKUPSWITCH); code.length += (4 - code.length % 4) % 4; dflt.put(this, code, source, true); code.putInt(labels.length); for (int i = 0; i < labels.length; ++i) { code.putInt(keys[i]); labels[i].put(this, code, source, true); } // updates currentBlock visitSwitchInsn(dflt, labels); }