/** * Creates a new {@link Label}. * * @return a new {@link Label}. */ public Label newLabel() { return new Label(); }
if (!l.inSameSubroutine(JSR)) { Edge e = new Edge(); e.info = l.inputStackTop; if (l.inSubroutine(id)) { continue; l.addToSubroutine(id, nbSubroutines);
/** * Ends the current basic block. This method must be used in the case where * the current basic block does not have any successor. */ private void noSuccessor() { if (compute == FRAMES) { Label l = new Label(); l.frame = new Frame(); l.frame.owner = l; l.resolve(this, code.length, code.data); previousBlock.successor = l; previousBlock = l; } else { currentBlock.outputStackMax = maxStackSize; } currentBlock = null; }
currentBlock.frame.execute(opcode, 0, null, null); label.getFirst().status |= Label.TARGET; nextInsn = new Label(); addSuccessor(stackSize + 1, label); nextInsn = new Label(); code.putByte(200); // GOTO_W label.put(this, code, code.length - 1, true); } else { label.put(this, code, code.length - 1, false);
Label l = handler.start.getFirst(); Label h = handler.handler.getFirst(); Label e = handler.end.getFirst(); Label n = e.successor.getFirst(); boolean change = f.merge(cw, n.frame, e.info); if (change && n.next == null) { labels.visitSubroutine(null, 1, subroutines); subroutine.visitSubroutine(null, (id / 32L) << 32 | (1L << (id % 32)), subroutines); subroutine.visitSubroutine(l, 0, subroutines);
@Override 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.putByteArray(null, 0, (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); }
if ((status & RESOLVED) == 0) { if (wideOffset) { addReference(-1 - source, out.length); out.putInt(-1); } else { addReference(source, out.length); out.putShort(-1);
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 block 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 block successors addSuccessor(stackSize, dflt); for (int i = 0; i < labels.length; ++i) { addSuccessor(stackSize, labels[i]); } } // ends current block noSuccessor(); } }
@Override public void visitLabel(final Label label) { resize |= label.resolve(this, code.length, code.data);
@Override 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.putByteArray(null, 0, (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); }
/** * Returns the label corresponding to the given offset. The default * implementation of this method creates a label for the given offset if it * has not been already created. * * @param offset * a bytecode offset in a method. * @param labels * the already created labels, indexed by their offset. If a * label already exists for offset this method must not create a * new one. Otherwise it must store the new label in this array. * @return a non null Label, which must be equal to labels[offset]. */ protected Label readLabel(int offset, Label[] labels) { if (labels[offset] == null) { labels[offset] = new Label(); } return labels[offset]; }
addSuccessor(stackSize + 1, label); nextInsn = new Label();
/** * Marks the current code position with a new label. * * @return the label that was created to mark the current code position. */ public Label mark() { Label label = new Label(); mv.visitLabel(label); return label; }
@Override public void visitTypeInsn(final int opcode, final String type) { if (opcode == Opcodes.NEW) { if (labels == null) { Label l = new Label(); labels = new ArrayList<Label>(3); labels.add(l); if (mv != null) { mv.visitLabel(l); } } for (int i = 0; i < labels.size(); ++i) { uninitializedTypes.put(labels.get(i), type); } } if (mv != null) { mv.visitTypeInsn(opcode, type); } execute(opcode, 0, type); }
currentLocals = size; labels = new Label(); labels.status |= Label.PUSHED; visitLabel(labels);
visitLabel(new Label());
labels[label] = new Label(); labels[label] = new Label(); labels[label] = new Label(); labels[label] = new Label(); labels[label] = new Label(); labels[label] = new Label(); labels[label] = start = new Label(); labels[label] = end = new Label(); labels[label] = handler = new Label(); labels[label] = new Label(true); labels[label] = new Label(true); labels[label] = new Label(true); labels[frameOffset] = new Label(); labels[offset] = new Label();