public void opc_ifnonnull(short bciOffset) { emitByte(opc_ifnonnull); emitShort(bciOffset); decStack(); } /** Control flow with forward-reference BCI. Stack assumes straight control flow. */ public void opc_ifnonnull(Label l) { short instrBCI = getLength(); emitByte(opc_ifnonnull); l.add(this, instrBCI, getLength(), getStack() - 1); emitShort((short) -1); // Must be patched later decStack(); } ///////////////////////// // Return instructions // ///////////////////////// public void opc_ireturn() { emitByte(opc_ireturn); setStack(0); } public void opc_lreturn() { emitByte(opc_lreturn); setStack(0); } public void opc_freturn() { emitByte(opc_freturn); setStack(0); } public void opc_dreturn() { emitByte(opc_dreturn); setStack(0); } public void opc_areturn() { emitByte(opc_areturn); setStack(0); } public void opc_return() { emitByte(opc_return); setStack(0); } ////////////////////// // Field operations // ////////////////////// public void opc_getstatic(short fieldIndex, int fieldSizeInStackSlots) { emitByte(opc_getstatic); emitShort(fieldIndex); setStack(getStack() + fieldSizeInStackSlots); } public void opc_putstatic(short fieldIndex, int fieldSizeInStackSlots) { emitByte(opc_putstatic); emitShort(fieldIndex); setStack(getStack() - fieldSizeInStackSlots); } public void opc_getfield(short fieldIndex, int fieldSizeInStackSlots) { emitByte(opc_getfield); emitShort(fieldIndex); setStack(getStack() + fieldSizeInStackSlots - 1); } public void opc_putfield(short fieldIndex, int fieldSizeInStackSlots) { emitByte(opc_putfield); emitShort(fieldIndex); setStack(getStack() - fieldSizeInStackSlots - 1); } //////////////////////// // Method invocations // //////////////////////// /** Long and double arguments and return types count as 2 arguments; other values count as 1. */ public void opc_invokevirtual(short methodIndex, int numArgs, int numReturnValues) { emitByte(opc_invokevirtual); emitShort(methodIndex); setStack(getStack() - numArgs - 1 + numReturnValues); } /** Long and double arguments and return types count as 2 arguments; other values count as 1. */ public void opc_invokespecial(short methodIndex, int numArgs, int numReturnValues) { emitByte(opc_invokespecial); emitShort(methodIndex); setStack(getStack() - numArgs - 1 + numReturnValues); } /** Long and double arguments and return types count as 2 arguments; other values count as 1. */ public void opc_invokestatic(short methodIndex, int numArgs, int numReturnValues) { emitByte(opc_invokestatic); emitShort(methodIndex); setStack(getStack() - numArgs + numReturnValues); } /** Long and double arguments and return types count as 2 arguments; other values count as 1. */ public void opc_invokeinterface(short methodIndex, int numArgs, byte count, int numReturnValues) { emitByte(opc_invokeinterface); emitShort(methodIndex); emitByte(count); emitByte((byte) 0); setStack(getStack() - numArgs - 1 + numReturnValues); } ////////////////// // Array length // ////////////////// public void opc_arraylength() { emitByte(opc_arraylength); } ///////// // New // ///////// public void opc_new(short classIndex) { emitByte(opc_new); emitShort(classIndex); incStack(); } //////////// // Athrow // //////////// public void opc_athrow() { emitByte(opc_athrow); setStack(1); } ////////////////////////////// // Checkcast and instanceof // ////////////////////////////// /** Assumes the checkcast succeeds */ public void opc_checkcast(short classIndex) { emitByte(opc_checkcast); emitShort(classIndex); } public void opc_instanceof(short classIndex) { emitByte(opc_instanceof); emitShort(classIndex); }}Lines 501–671 of 671. Previous lines
public void opc_ifnonnull(short bciOffset) { emitByte(opc_ifnonnull); emitShort(bciOffset); decStack(); } /** Control flow with forward-reference BCI. Stack assumes straight control flow. */ public void opc_ifnonnull(Label l) { short instrBCI = getLength(); emitByte(opc_ifnonnull); l.add(this, instrBCI, getLength(), getStack() - 1); emitShort((short) -1); // Must be patched later decStack(); } ///////////////////////// // Return instructions // ///////////////////////// public void opc_ireturn() { emitByte(opc_ireturn); setStack(0); } public void opc_lreturn() { emitByte(opc_lreturn); setStack(0); } public void opc_freturn() { emitByte(opc_freturn); setStack(0); } public void opc_dreturn() { emitByte(opc_dreturn); setStack(0); } public void opc_areturn() { emitByte(opc_areturn); setStack(0); } public void opc_return() { emitByte(opc_return); setStack(0); } ////////////////////// // Field operations // ////////////////////// public void opc_getstatic(short fieldIndex, int fieldSizeInStackSlots) { emitByte(opc_getstatic); emitShort(fieldIndex); setStack(getStack() + fieldSizeInStackSlots); } public void opc_putstatic(short fieldIndex, int fieldSizeInStackSlots) { emitByte(opc_putstatic); emitShort(fieldIndex); setStack(getStack() - fieldSizeInStackSlots); } public void opc_getfield(short fieldIndex, int fieldSizeInStackSlots) { emitByte(opc_getfield); emitShort(fieldIndex); setStack(getStack() + fieldSizeInStackSlots - 1); } public void opc_putfield(short fieldIndex, int fieldSizeInStackSlots) { emitByte(opc_putfield); emitShort(fieldIndex); setStack(getStack() - fieldSizeInStackSlots - 1); } //////////////////////// // Method invocations // //////////////////////// /** Long and double arguments and return types count as 2 arguments; other values count as 1. */ public void opc_invokevirtual(short methodIndex, int numArgs, int numReturnValues) { emitByte(opc_invokevirtual); emitShort(methodIndex); setStack(getStack() - numArgs - 1 + numReturnValues); } /** Long and double arguments and return types count as 2 arguments; other values count as 1. */ public void opc_invokespecial(short methodIndex, int numArgs, int numReturnValues) { emitByte(opc_invokespecial); emitShort(methodIndex); setStack(getStack() - numArgs - 1 + numReturnValues); } /** Long and double arguments and return types count as 2 arguments; other values count as 1. */ public void opc_invokestatic(short methodIndex, int numArgs, int numReturnValues) { emitByte(opc_invokestatic); emitShort(methodIndex); setStack(getStack() - numArgs + numReturnValues); } /** Long and double arguments and return types count as 2 arguments; other values count as 1. */ public void opc_invokeinterface(short methodIndex, int numArgs, byte count, int numReturnValues) { emitByte(opc_invokeinterface); emitShort(methodIndex); emitByte(count); emitByte((byte) 0); setStack(getStack() - numArgs - 1 + numReturnValues); } ////////////////// // Array length // ////////////////// public void opc_arraylength() { emitByte(opc_arraylength); } ///////// // New // ///////// public void opc_new(short classIndex) { emitByte(opc_new); emitShort(classIndex); incStack(); } //////////// // Athrow // //////////// public void opc_athrow() { emitByte(opc_athrow); setStack(1); } ////////////////////////////// // Checkcast and instanceof // ////////////////////////////// /** Assumes the checkcast succeeds */ public void opc_checkcast(short classIndex) { emitByte(opc_checkcast); emitShort(classIndex); } public void opc_instanceof(short classIndex) { emitByte(opc_instanceof); emitShort(classIndex); } }