/** * Generates a POP instruction. */ public void pop() { mv.visitInsn(Opcodes.POP); }
/** * Generates a POP2 instruction. */ public void pop2() { mv.visitInsn(Opcodes.POP2); }
/** * Generates the instruction to release the monitor of the top stack value. */ public void monitorExit() { mv.visitInsn(Opcodes.MONITOREXIT); }
/** * Generates a DUP instruction. */ public void dup(){ mv.visitInsn(Opcodes.DUP); }
@Override public void visitInsn(final int opcode) { minSize += 1; maxSize += 1; if (mv != null) { mv.visitInsn(opcode); } }
/** * Generates a SWAP instruction. */ public void swap() { mv.visitInsn(Opcodes.SWAP); }
/** * Generates a POP instruction. */ public void pop(){ mv.visitInsn(Opcodes.POP); }
/** * Generates a POP2 instruction. */ public void pop2(){ mv.visitInsn(Opcodes.POP2); }
/** * Generates a DUP2_X2 instruction. */ public void dup2X2(){ mv.visitInsn(Opcodes.DUP2_X2); }
/** * Generates a DUP2 instruction. */ public void dup2() { mv.visitInsn(Opcodes.DUP2); }
/** * Generates a DUP_X1 instruction. */ public void dupX1() { mv.visitInsn(Opcodes.DUP_X1); }
/** * Generates the instruction to compute the length of an array. */ public void arrayLength() { mv.visitInsn(Opcodes.ARRAYLENGTH); }
/** * Generates the instruction to throw an exception. */ public void throwException() { mv.visitInsn(Opcodes.ATHROW); }
@Override public void visitInsn(final int opcode) { if (mv != null) { mv.visitInsn(opcode); } execute(opcode, 0, null); if ((opcode >= Opcodes.IRETURN && opcode <= Opcodes.RETURN) || opcode == Opcodes.ATHROW) { this.locals = null; this.stack = null; } }
/** * Generates the instruction to store an element in an array. * * @param type * the type of the array element to be stored. */ public void arrayStore(final Type type) { mv.visitInsn(type.getOpcode(Opcodes.IASTORE)); }
/** * Generates the instruction to load an element from an array. * * @param type * the type of the array element to be loaded. */ public void arrayLoad(final Type type) { mv.visitInsn(type.getOpcode(Opcodes.IALOAD)); }
public void aconst(final Object cst) { if (cst == null) { mv.visitInsn(Opcodes.ACONST_NULL); } else { mv.visitLdcInsn(cst); } }
public void dconst(final double cst) { long bits = Double.doubleToLongBits(cst); if (bits == 0L || bits == 0x3ff0000000000000L) { // +0.0d and 1.0d mv.visitInsn(Opcodes.DCONST_0 + (int) cst); } else { mv.visitLdcInsn(new Double(cst)); } }
@Override public void visitEnd() { if (clinit != null) { clinit.visitInsn(Opcodes.RETURN); clinit.visitMaxs(0, 0); } cv.visitEnd(); } }
public void iconst(final int cst) { if (cst >= -1 && cst <= 5) { mv.visitInsn(Opcodes.ICONST_0 + cst); } else if (cst >= Byte.MIN_VALUE && cst <= Byte.MAX_VALUE) { mv.visitIntInsn(Opcodes.BIPUSH, cst); } else if (cst >= Short.MIN_VALUE && cst <= Short.MAX_VALUE) { mv.visitIntInsn(Opcodes.SIPUSH, cst); } else { mv.visitLdcInsn(new Integer(cst)); } }