@Override public void visitIntInsn(final int opcode, final int operand) { if (opcode == SIPUSH) { minSize += 3; maxSize += 3; } else { minSize += 2; maxSize += 2; } if (mv != null) { mv.visitIntInsn(opcode, operand); } }
public void visitIntInsn(final int opcode, final int operand) { mv.visitIntInsn(opcode, operand); }
/** * Visits an instruction with a single int operand. * * @param opcode the opcode of the instruction to be visited. This opcode is either BIPUSH, SIPUSH * or NEWARRAY. * @param operand the operand of the instruction to be visited.<br> * When opcode is BIPUSH, operand value should be between Byte.MIN_VALUE and Byte.MAX_VALUE. * <br> * When opcode is SIPUSH, operand value should be between Short.MIN_VALUE and Short.MAX_VALUE. * <br> * When opcode is NEWARRAY, operand value should be one of {@link Opcodes#T_BOOLEAN}, {@link * Opcodes#T_CHAR}, {@link Opcodes#T_FLOAT}, {@link Opcodes#T_DOUBLE}, {@link Opcodes#T_BYTE}, * {@link Opcodes#T_SHORT}, {@link Opcodes#T_INT} or {@link Opcodes#T_LONG}. */ public void visitIntInsn(final int opcode, final int operand) { if (mv != null) { mv.visitIntInsn(opcode, operand); } }
/** * Visits an instruction with a single int operand. * * @param opcode * the opcode of the instruction to be visited. This opcode is * either BIPUSH, SIPUSH or NEWARRAY. * @param operand * the operand of the instruction to be visited.<br> * When opcode is BIPUSH, operand value should be between * Byte.MIN_VALUE and Byte.MAX_VALUE.<br> * When opcode is SIPUSH, operand value should be between * Short.MIN_VALUE and Short.MAX_VALUE.<br> * When opcode is NEWARRAY, operand value should be one of * {@link Opcodes#T_BOOLEAN}, {@link Opcodes#T_CHAR}, * {@link Opcodes#T_FLOAT}, {@link Opcodes#T_DOUBLE}, * {@link Opcodes#T_BYTE}, {@link Opcodes#T_SHORT}, * {@link Opcodes#T_INT} or {@link Opcodes#T_LONG}. */ public void visitIntInsn(int opcode, int operand) { if (mv != null) { mv.visitIntInsn(opcode, operand); } }
@Override public void accept(final MethodVisitor mv) { mv.visitIntInsn(opcode, operand); acceptAnnotations(mv); }
@Override public void visitIntInsn(final int opcode, final int operand) { if (mv != null) { mv.visitIntInsn(opcode, operand); } execute(opcode, operand, null); }
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(cst); } }
@Override public void visitIntInsn(final int opcode, final int operand) { mv.visitIntInsn(opcode, operand); if (constructor && opcode != NEWARRAY) { pushValue(OTHER); } }
@Override public void visitIntInsn(final int opcode, final int operand) { p.visitIntInsn(opcode, operand); super.visitIntInsn(opcode, operand); }
public void visitIntInsn(final int opcode, final int operand) { buf.setLength(0); buf.append(tab2) .append(OPCODES[opcode]) .append(' ') .append(opcode == Opcodes.NEWARRAY ? TYPES[operand] : Integer.toString(operand)) .append('\n'); text.add(buf.toString()); if (mv != null) { mv.visitIntInsn(opcode, operand); } }
/** * 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(value); } }
protected final void createArray(Class<?> componentType, int size) { mv.visitLdcInsn(size); if (componentType.isPrimitive()) { int newPrimitiveArrayType = T_BOOLEAN; if (componentType == int.class) { newPrimitiveArrayType = T_INT; } else if (componentType == long.class) { newPrimitiveArrayType = T_LONG; } else if (componentType == double.class) { newPrimitiveArrayType = T_DOUBLE; } else if (componentType == float.class) { newPrimitiveArrayType = T_FLOAT; } else if (componentType == char.class) { newPrimitiveArrayType = T_CHAR; } else if (componentType == short.class) { newPrimitiveArrayType = T_SHORT; } else if (componentType == byte.class) { newPrimitiveArrayType = T_BYTE; } mv.visitIntInsn(NEWARRAY, newPrimitiveArrayType); } else { mv.visitTypeInsn(ANEWARRAY, internalName(componentType)); } }
protected final void push(Object obj, Class<?> type) { if (obj == null) { mv.visitInsn(ACONST_NULL); return; } if (type == String.class || type == Object.class) { mv.visitLdcInsn(obj); } else if (type == char.class) { mv.visitIntInsn(BIPUSH, (int)((Character)obj).charValue()); } else if (type.isPrimitive()) { if (obj instanceof String) { obj = coerceStringToPrimitive(type, (String)obj); } else { obj = coercePrimitiveToPrimitive(type, obj); } mv.visitLdcInsn(obj); } else if (type == Class.class) { mv.visitLdcInsn(classGenerator.toType((Class<?>) obj)); } else if (type == Character.class) { invokeConstructor(Character.class, new Object[]{ obj.toString().charAt(0) }, char.class); } else if (type.isInterface() || isAbstract(type.getModifiers())) { push(obj, obj.getClass()); } else { invokeConstructor(type, new Object[]{ obj.toString() }, String.class); } }
return; mv.visitIntInsn(Opcodes.NEWARRAY, typ);
return; mv.visitIntInsn(Opcodes.NEWARRAY, typ);
@Override public void visitIntInsn(final int opcode, final int operand) { checkStartCode(); checkEndCode(); checkOpcode(opcode, 1); switch (opcode) { case Opcodes.BIPUSH: checkSignedByte(operand, "Invalid operand"); break; case Opcodes.SIPUSH: checkSignedShort(operand, "Invalid operand"); break; // case Constants.NEWARRAY: default: if (operand < Opcodes.T_BOOLEAN || operand > Opcodes.T_LONG) { throw new IllegalArgumentException( "Invalid operand (must be an array type code T_...): " + operand); } } super.visitIntInsn(opcode, operand); ++insnCount; }
public static void pushInt(MethodVisitor mv, int j) { switch ( j ) { case 0 : mv.visitInsn( Opcodes.ICONST_0 ); break; case 1 : mv.visitInsn( Opcodes.ICONST_1 ); break; case 2 : mv.visitInsn( Opcodes.ICONST_2 ); break; case 3 : mv.visitInsn( Opcodes.ICONST_3 ); break; case 4 : mv.visitInsn( Opcodes.ICONST_4 ); break; case 5 : mv.visitInsn( Opcodes.ICONST_5 ); break; default : mv.visitIntInsn( Opcodes.BIPUSH, j ); } }
mv.visitIntInsn(BIPUSH, index); mv.visitIntInsn(SIPUSH, index);
mv.visitIntInsn(BIPUSH, index); mv.visitIntInsn(SIPUSH, index);
mv.visitIntInsn(BIPUSH, index); mv.visitIntInsn(SIPUSH, index);