/** * Generates the instruction to push a handle on the stack. * * @param handle * the handle to be pushed on the stack. */ public void push(final Handle handle) { mv.visitLdcInsn(handle); }
@Override public void visitLdcInsn(final Object cst) { if (cst instanceof Long || cst instanceof Double) { minSize += 3; maxSize += 3; } else { minSize += 2; maxSize += 3; } if (mv != null) { mv.visitLdcInsn(cst); } }
public void tconst(final Type type) { mv.visitLdcInsn(type); }
public void hconst(final Handle handle) { mv.visitLdcInsn(handle); }
@Override public void visitLdcInsn(final Object cst) { p.visitLdcInsn(cst); super.visitLdcInsn(cst); }
public void lconst(final long cst) { if (cst == 0L || cst == 1L) { mv.visitInsn(Opcodes.LCONST_0 + (int) cst); } else { mv.visitLdcInsn(new Long(cst)); } }
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)); } }
public void fconst(final float cst) { int bits = Float.floatToIntBits(cst); if (bits == 0L || bits == 0x3f800000 || bits == 0x40000000) { // 0..2 mv.visitInsn(Opcodes.FCONST_0 + (int) cst); } else { mv.visitLdcInsn(new Float(cst)); } }
/** * Generates the instruction to push the given value on the stack. * * @param value * the value to be pushed on the stack. */ public void push(final long value) { if (value == 0L || value == 1L) { mv.visitInsn(Opcodes.LCONST_0 + (int) value); } else { mv.visitLdcInsn(new Long(value)); } }
@Override public void accept(final MethodVisitor mv) { mv.visitLdcInsn(cst); acceptAnnotations(mv); }
/** * Generates the instruction to push the given value on the stack. * * @param value * the value to be pushed on the stack. */ public void push(final float value) { int bits = Float.floatToIntBits(value); if (bits == 0L || bits == 0x3f800000 || bits == 0x40000000) { // 0..2 mv.visitInsn(Opcodes.FCONST_0 + (int) value); } else { mv.visitLdcInsn(new Float(value)); } }
/** * Generates the instruction to push the given value on the stack. * * @param value * the value to be pushed on the stack. */ public void push(final double value) { long bits = Double.doubleToLongBits(value); if (bits == 0L || bits == 0x3ff0000000000000L) { // +0.0d and 1.0d mv.visitInsn(Opcodes.DCONST_0 + (int) value); } else { mv.visitLdcInsn(new Double(value)); } }
/** * Generates the instruction to push the given value on the stack. * * @param value * the value to be pushed on the stack. May be <tt>null</tt>. */ public void push(final String value) { if (value == null) { mv.visitInsn(Opcodes.ACONST_NULL); } else { mv.visitLdcInsn(value); } }
@Override public void visitLdcInsn(final Object cst) { mv.visitLdcInsn(cst); if (constructor) { pushValue(OTHER); if (cst instanceof Double || cst instanceof Long) { pushValue(OTHER); } } }
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)); } }
/** * Generates the instruction to push the given value on the stack. * * @param value * the value to be pushed on the stack. */ public void push(final int value) { if (value >= -1 && value <= 5) { mv.visitInsn(Opcodes.ICONST_0 + value); } else if (value >= Byte.MIN_VALUE && value <= Byte.MAX_VALUE) { mv.visitIntInsn(Opcodes.BIPUSH, value); } else if (value >= Short.MIN_VALUE && value <= Short.MAX_VALUE) { mv.visitIntInsn(Opcodes.SIPUSH, value); } else { mv.visitLdcInsn(new Integer(value)); } }
protected void instrumentSetClassName(ClassReader cr,MethodVisitor mv){ mv.visitFieldInsn(Opcodes.GETSTATIC, cr.getClassName(), "className", "Ljava/lang/ThreadLocal;"); mv.visitLdcInsn(cr.getClassName().replace('/', '.')); mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/lang/ThreadLocal", "set", "(Ljava/lang/Object;)V",false); }
@Override public void visitCode() { super.visitCode(); mv.visitLdcInsn(PROVIDER_TYPE); mv.visitMethodInsn(Opcodes.INVOKESTATIC, "leap/lang/Factory", "getInstance", "(Ljava/lang/Class;)Ljava/lang/Object;", false); checkCast(PROVIDER_TYPE); putStatic(type, PROVIDER_FIELD, PROVIDER_TYPE); } }
protected void startMonitor() { //get the field of monitor provider. if(!methodBodyOnly) { getStatic(type,PROVIDER_FIELD,PROVIDER_TYPE); }else{ getStatic(MonitorInst.TYPE,"PROVIDER",PROVIDER_TYPE); } //Call startMethodMonitor mv.visitLdcInsn(type.getClassName()); //classname mv.visitLdcInsn(mn.name); //methodDesc if(argumentTypes.length > 0) { loadArgArray(); invokeInterface(PROVIDER_TYPE, START_MONITOR_METHOD_WITH_ARGS); }else{ invokeInterface(PROVIDER_TYPE, START_MONITOR_METHOD_NO_ARGS); } //store local variable. monitorLocal = newLocal(MONITOR_TYPE); storeLocal(monitorLocal); }