Example usage for org.objectweb.asm Opcodes BIPUSH

List of usage examples for org.objectweb.asm Opcodes BIPUSH

Introduction

In this page you can find the example usage for org.objectweb.asm Opcodes BIPUSH.

Prototype

int BIPUSH

To view the source code for org.objectweb.asm Opcodes BIPUSH.

Click Source Link

Usage

From source file:com.geeksaga.light.profiler.util.ASMUtil.java

License:Apache License

public static AbstractInsnNode createPushNode(int value) {
    if (value == -1) {
        return new InsnNode(Opcodes.ICONST_M1);
    } else if (value == 0) {
        return new InsnNode(Opcodes.ICONST_0);
    } else if (value == 1) {
        return new InsnNode(Opcodes.ICONST_1);
    } else if (value == 2) {
        return new InsnNode(Opcodes.ICONST_2);
    } else if (value == 3) {
        return new InsnNode(Opcodes.ICONST_3);
    } else if (value == 4) {
        return new InsnNode(Opcodes.ICONST_4);
    } else if (value == 5) {
        return new InsnNode(Opcodes.ICONST_5);
    } else if ((value >= -128) && (value <= 127)) {
        return new IntInsnNode(Opcodes.BIPUSH, value);
    } else if ((value >= -32768) && (value <= 32767)) {
        return new IntInsnNode(Opcodes.SIPUSH, value);
    } else {/* w w w  .j a  v a  2  s . c  o m*/
        return new LdcInsnNode(value);
    }
}

From source file:com.github.anba.es6draft.compiler.assembler.InstructionAssembler.java

License:Open Source License

public void bipush(int value) {
    methodVisitor.visitIntInsn(Opcodes.BIPUSH, value);
    stack.bipush();
}

From source file:com.github.jasmo.util.BytecodeHelper.java

License:Open Source License

public static AbstractInsnNode newIntegerNode(int i) {
    if (i >= -1 && i <= 5) {
        return new InsnNode(Opcodes.ICONST_0 + i);
    } else if (i >= Byte.MIN_VALUE && i <= Byte.MAX_VALUE) {
        return new IntInsnNode(Opcodes.BIPUSH, i);
    } else if (i >= Short.MIN_VALUE && i <= Short.MAX_VALUE) {
        return new IntInsnNode(Opcodes.SIPUSH, i);
    } else {//from  w  w  w.  j a v  a  2 s  . co m
        return new LdcInsnNode(i);
    }
}

From source file:com.google.code.jconts.instrument.gen.AsyncMethodAdapter.java

License:Apache License

@Override
public void visitMethodInsn(int opcode, String owner, String name, String desc) {
    checkProlog();//w  w  w .j av  a 2  s  . co  m

    if (opcode == Opcodes.INVOKESTATIC && ASYNC_NAME.equals(owner) && ARETURN_NAME.equals(name)) {

        if (ARETURN_VOID_DESC.equals(desc)) {
            mv.visitInsn(Opcodes.ACONST_NULL);
        }

        // state variable
        target.visitVarInsn(Opcodes.ALOAD, info.isStatic() ? 0 : 1);
        mv.visitFieldInsn(Opcodes.GETFIELD, info.stateClassName, CONTINUATION_FIELD, CONTINUATION_DESC);
        mv.visitInsn(Opcodes.SWAP);
        mv.visitMethodInsn(Opcodes.INVOKEINTERFACE, CONTINUATION_NAME, CONTINUATION_INVOKE_NAME,
                CONTINUATION_INVOKE_DESC);

        // Will be dropped while replacing ARETURN with RETURN.
        // FIXME: Should verify this value is NOT used.
        mv.visitInsn(Opcodes.ACONST_NULL);
        return;
    }
    if (opcode == Opcodes.INVOKESTATIC && ASYNC_NAME.equals(owner) && AWAIT_NAME.equals(name)
            && AWAIT_DESC.equals(desc)) {

        // Computation<T> is on stack

        // FIXME: ...
        // if (stack.size() != 1) {
        // throw new IllegalStateException(
        // "Stack preserving is not supported!");
        // }

        int index = dispatchTable.size();

        // Save state
        List<Type> l = new ArrayList<Type>(locals);
        if (!info.isStatic()) {
            l.remove(0);
        }

        // state.varX = locX
        String[] vars = info.tracker.stateFields(l.toArray(new Type[0]));
        for (int i = 0; i < vars.length; ++i) {
            // state variable
            target.visitVarInsn(Opcodes.ALOAD, info.isStatic() ? 0 : 1);
            mv.visitVarInsn(l.get(i).getOpcode(Opcodes.ILOAD), i + info.thisOffset);
            mv.visitFieldInsn(Opcodes.PUTFIELD, info.stateClassName, vars[i], l.get(i).getDescriptor());
        }

        // Create instance of continuation
        // new Continuation([this, ]state, index);
        mv.visitTypeInsn(Opcodes.NEW, info.continuationClassName);
        mv.visitInsn(Opcodes.DUP);

        // "this' for new Continuation([this, ]state, index)
        if (!info.isStatic()) {
            mv.visitVarInsn(Opcodes.ALOAD, 0);
        }

        // state and index
        target.visitVarInsn(Opcodes.ALOAD, 0 + info.thisOffset);
        mv.visitIntInsn(Opcodes.BIPUSH, index);

        String ctorDesc;
        if (info.isStatic()) {
            ctorDesc = Type.getMethodDescriptor(Type.VOID_TYPE, new Type[] { info.stateType, Type.INT_TYPE });
        } else {
            ctorDesc = Type.getMethodDescriptor(Type.VOID_TYPE,
                    new Type[] { Type.getObjectType(info.owner), info.stateType, Type.INT_TYPE });
        }
        mv.visitMethodInsn(Opcodes.INVOKESPECIAL, info.continuationClassName, CTOR_NAME, ctorDesc);

        mv.visitMethodInsn(Opcodes.INVOKEINTERFACE, COMPUTATION_NAME, COMPUTATION_EXECUTE_NAME,
                COMPUTATION_EXECUTE_DESC);
        super.visitInsn(Opcodes.RETURN);

        // Restore state
        // mv.visitFrame(Opcodes.F_SAME, 0, new Object[0], 0, new
        // Object[0]);
        Label label = new Label();

        int invokeIndex = dispatchTable.size();
        dispatchTable.add(label); // for invoke
        dispatchTable.add(label); // for setException
        mv.visitLabel(label);
        for (int i = 0; i < vars.length; ++i) {
            // state variable
            target.visitVarInsn(Opcodes.ALOAD, info.isStatic() ? 0 : 1);
            mv.visitFieldInsn(Opcodes.GETFIELD, info.stateClassName, vars[i], l.get(i).getDescriptor());
            mv.visitVarInsn(l.get(i).getOpcode(Opcodes.ISTORE), i + info.thisOffset);
        }

        // if (index == invokeIndex) goto invokeLabel;
        Label invokeLabel = new Label();
        target.visitVarInsn(Opcodes.ILOAD, 1 + info.thisOffset);
        mv.visitIntInsn(Opcodes.BIPUSH, invokeIndex);
        mv.visitJumpInsn(Opcodes.IF_ICMPEQ, invokeLabel);

        // Throw exception
        target.visitVarInsn(Opcodes.ALOAD, info.isStatic() ? 0 : 1);
        mv.visitFieldInsn(Opcodes.GETFIELD, info.stateClassName, "exception", THROWABLE_DESC);
        mv.visitInsn(Opcodes.ATHROW);

        // Push result value
        // invokeLabel:
        mv.visitLabel(invokeLabel);
        target.visitVarInsn(Opcodes.ALOAD, info.isStatic() ? 0 : 1);
        mv.visitFieldInsn(Opcodes.GETFIELD, info.stateClassName, "result", OBJECT_DESC);
        return;
    }
    super.visitMethodInsn(opcode, owner, name, desc);
}

From source file:com.google.code.jconts.instrument.gen.ComputationClassGenerator.java

License:Apache License

private void generateExecute(ClassVisitor cv) {
    final String name = info.computationClassName;
    final Type outerType = Type.getObjectType(info.owner);

    // Generate execute(Continuation<T> cont);
    MethodVisitor mv = cv.visitMethod(Opcodes.ACC_FINAL | Opcodes.ACC_PUBLIC, COMPUTATION_EXECUTE_NAME,
            COMPUTATION_EXECUTE_DESC, executeSignature(), null);
    mv.visitCode();/*ww w. j av  a2s  .  c o m*/
    Label start = new Label();
    Label end = new Label();
    mv.visitLabel(start);

    // Load outer this
    if (!info.isStatic()) {
        mv.visitVarInsn(Opcodes.ALOAD, 0);
        mv.visitFieldInsn(Opcodes.GETFIELD, name, "this$0", outerType.getDescriptor());
    }

    // Load state field
    mv.visitVarInsn(Opcodes.ALOAD, 0);
    mv.visitFieldInsn(Opcodes.GETFIELD, name, "state", stateDesc);

    // state.continuation = continuation
    mv.visitVarInsn(Opcodes.ALOAD, 0);
    mv.visitFieldInsn(Opcodes.GETFIELD, name, "state", stateDesc);
    mv.visitVarInsn(Opcodes.ALOAD, 1);
    mv.visitFieldInsn(Opcodes.PUTFIELD, info.stateClassName, CONTINUATION_FIELD, CONTINUATION_DESC);

    // Initial state (0)
    mv.visitIntInsn(Opcodes.BIPUSH, 0);
    mv.visitMethodInsn(info.isStatic() ? Opcodes.INVOKESTATIC : Opcodes.INVOKEVIRTUAL, info.owner,
            info.name + "$async",
            Type.getMethodDescriptor(Type.VOID_TYPE, new Type[] { info.stateType, Type.INT_TYPE }));

    mv.visitInsn(Opcodes.RETURN);
    mv.visitLabel(end);

    mv.visitLocalVariable("this", 'L' + name + ';', signature, start, end, 0);
    if (!info.isStatic()) {
        mv.visitLocalVariable("this$0", outerType.getDescriptor(), null, start, end, 1);
    }

    SignatureWriter sign = new SignatureWriter();
    contSignature(sign);
    mv.visitLocalVariable("continuation", CONTINUATION_DESC, sign.toString(), start, end, 1 + info.thisOffset);

    mv.visitMaxs(3 + info.thisOffset, 2 + info.thisOffset);
    mv.visitEnd();
}

From source file:com.google.devtools.build.android.desugar.BytecodeTypeInference.java

License:Open Source License

@Override
public void visitIntInsn(int opcode, int operand) {
    switch (opcode) {
    case Opcodes.BIPUSH:
    case Opcodes.SIPUSH:
        push(InferredType.INT);//from w  w w . j  a  v  a  2s.co m
        break;
    case Opcodes.NEWARRAY:
        pop();
        switch (operand) {
        case Opcodes.T_BOOLEAN:
            pushDescriptor("[Z");
            break;
        case Opcodes.T_CHAR:
            pushDescriptor("[C");
            break;
        case Opcodes.T_FLOAT:
            pushDescriptor("[F");
            break;
        case Opcodes.T_DOUBLE:
            pushDescriptor("[D");
            break;
        case Opcodes.T_BYTE:
            pushDescriptor("[B");
            break;
        case Opcodes.T_SHORT:
            pushDescriptor("[S");
            break;
        case Opcodes.T_INT:
            pushDescriptor("[I");
            break;
        case Opcodes.T_LONG:
            pushDescriptor("[J");
            break;
        default:
            throw new RuntimeException("Unhandled operand value: " + operand);
        }
        break;
    default:
        throw new RuntimeException("Unhandled opcode " + opcode);
    }
    super.visitIntInsn(opcode, operand);
}

From source file:com.google.test.metric.asm.MethodVisitorBuilder.java

License:Apache License

public void visitIntInsn(int opcode, int operand) {
    switch (opcode) {
    case Opcodes.NEWARRAY:
        newArray(operand, toType(operand));
        break;// w w  w  .jav  a 2s  .  c o m
    case Opcodes.BIPUSH:
        loadConstant(operand, JavaType.INT);
        break;
    case Opcodes.SIPUSH:
        loadConstant(operand, JavaType.INT);
        break;
    default:
        throw new UnsupportedOperationException("Unexpected opcode: " + opcode);
    }
}

From source file:com.khubla.jvmbasic.jvmbasicc.compiler.RTLHelper.java

License:Open Source License

/**
 * push a value onto the Execution Context stack
 * <p>//w ww  . ja v a 2s .  c  o m
 * <code>
 * executionContext.push(i);
 * </code>
 * </p>
 */
public static void push(GenerationContext generationContext, int i) {
    generationContext.getMethodVisitor().visitVarInsn(Opcodes.ALOAD, 0);
    generationContext.getMethodVisitor().visitFieldInsn(Opcodes.GETFIELD, generationContext.getClassName(),
            EXECUTIONCONTEXT_NAME, JASIC_RUNTIME_EXECUTIONCONTEXT_TYPE);
    generationContext.getMethodVisitor().visitIntInsn(Opcodes.BIPUSH, i);
    generationContext.getMethodVisitor().visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Integer", "valueOf",
            "(I)Ljava/lang/Integer;");
    generationContext.getMethodVisitor().visitMethodInsn(Opcodes.INVOKEVIRTUAL, JASIC_RUNTIME_EXECUTIONCONTEXT,
            "push", "(Ljava/lang/Integer;)V");
}

From source file:com.liferay.alloy.mvc.jsonwebservice.AlloyControllerInvokerManager.java

License:Open Source License

protected byte[] generateAlloyControllerInvokerClassData(Class<?> controllerClass,
        String alloyControllerInvokerClassName) throws NoClassNecessaryException {

    boolean jsonWebServiceMethodsPresent = false;

    ClassWriter classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES);

    String alloyControllerInvokerClassBinaryName = getClassBinaryName(alloyControllerInvokerClassName);

    String baseAlloyControllerInvokerClassBinaryName = getClassBinaryName(
            BaseAlloyControllerInvokerImpl.class.getName());

    classWriter.visit(Opcodes.V1_5, Opcodes.ACC_PUBLIC | Opcodes.ACC_SUPER,
            alloyControllerInvokerClassBinaryName, null, baseAlloyControllerInvokerClassBinaryName, null);

    MethodVisitor methodVisitor = classWriter.visitMethod(Opcodes.ACC_PUBLIC, "<init>", "()V", null, null);

    methodVisitor.visitCode();//ww w. j ava2 s .co  m
    methodVisitor.visitVarInsn(Opcodes.ALOAD, 0);
    methodVisitor.visitMethodInsn(Opcodes.INVOKESPECIAL, baseAlloyControllerInvokerClassBinaryName, "<init>",
            "()V");
    methodVisitor.visitInsn(Opcodes.RETURN);
    methodVisitor.visitMaxs(1, 1);
    methodVisitor.visitEnd();

    Method[] methods = controllerClass.getDeclaredMethods();

    for (Method method : methods) {
        if (!Modifier.isPublic(method.getModifiers())) {
            continue;
        }

        JSONWebServiceMethod jsonWebServiceMethod = method.getAnnotation(JSONWebServiceMethod.class);

        if (jsonWebServiceMethod == null) {
            continue;
        }

        jsonWebServiceMethodsPresent = true;

        Class<?>[] parameterTypes = jsonWebServiceMethod.parameterTypes();

        StringBundler sb = new StringBundler(parameterTypes.length + 3);

        sb.append(StringPool.OPEN_PARENTHESIS);

        for (Class<?> parameterType : parameterTypes) {
            sb.append(Type.getDescriptor(parameterType));
        }

        sb.append(StringPool.CLOSE_PARENTHESIS);
        sb.append(Type.getDescriptor(JSONSerializable.class));

        String methodDescriptor = sb.toString();

        methodVisitor = classWriter.visitMethod(Opcodes.ACC_PUBLIC, method.getName(), methodDescriptor, null,
                new String[] { getClassBinaryName(Exception.class.getName()) });

        methodVisitor.visitCode();

        for (int i = 0; i < parameterTypes.length; i++) {
            String parameterName = jsonWebServiceMethod.parameterNames()[i];
            Class<?> parameterType = parameterTypes[i];

            methodVisitor.visitLocalVariable(parameterName, Type.getDescriptor(parameterType), null,
                    new Label(), new Label(), i + 1);
        }

        methodVisitor.visitVarInsn(Opcodes.ALOAD, 0);
        methodVisitor.visitLdcInsn(jsonWebServiceMethod.lifecycle());

        methodVisitor.visitIntInsn(Opcodes.BIPUSH, parameterTypes.length * 2 + 2);
        methodVisitor.visitTypeInsn(Opcodes.ANEWARRAY, getClassBinaryName(Object.class.getName()));

        methodVisitor.visitInsn(Opcodes.DUP);
        methodVisitor.visitInsn(Opcodes.ICONST_0);
        methodVisitor.visitLdcInsn("action");
        methodVisitor.visitInsn(Opcodes.AASTORE);

        methodVisitor.visitInsn(Opcodes.DUP);
        methodVisitor.visitInsn(Opcodes.ICONST_1);
        methodVisitor.visitLdcInsn(method.getName());
        methodVisitor.visitInsn(Opcodes.AASTORE);

        for (int i = 0; i < parameterTypes.length; i++) {
            String parameterName = jsonWebServiceMethod.parameterNames()[i];

            methodVisitor.visitInsn(Opcodes.DUP);
            methodVisitor.visitIntInsn(Opcodes.BIPUSH, (i + 1) * 2);
            methodVisitor.visitLdcInsn(parameterName);
            methodVisitor.visitInsn(Opcodes.AASTORE);

            methodVisitor.visitInsn(Opcodes.DUP);
            methodVisitor.visitIntInsn(Opcodes.BIPUSH, (i + 1) * 2 + 1);
            methodVisitor.visitVarInsn(Opcodes.ALOAD, i + 1);
            methodVisitor.visitInsn(Opcodes.AASTORE);
        }

        sb = new StringBundler(5);

        sb.append(StringPool.OPEN_PARENTHESIS);
        sb.append(Type.getDescriptor(String.class));
        sb.append(Type.getDescriptor(Object[].class));
        sb.append(StringPool.CLOSE_PARENTHESIS);
        sb.append(Type.getDescriptor(JSONSerializable.class));

        methodVisitor.visitMethodInsn(Opcodes.INVOKEVIRTUAL, alloyControllerInvokerClassBinaryName,
                "invokeAlloyController", sb.toString());

        methodVisitor.visitInsn(Opcodes.ARETURN);

        methodVisitor.visitMaxs(-1, -1);
        methodVisitor.visitEnd();
    }

    classWriter.visitEnd();

    if (!jsonWebServiceMethodsPresent) {
        throw new NoClassNecessaryException();
    }

    return classWriter.toByteArray();
}

From source file:com.liferay.portal.nio.intraband.proxy.IntrabandProxyUtilTest.java

License:Open Source License

private void _doTestCreateProxyMethodNode(Method method, int index, String skeletonId,
        String stubInternalName) {

    MethodNode proxyMethodNode = IntrabandProxyUtil.createProxyMethodNode(method, index, skeletonId,
            Type.getType(stubInternalName));

    _assertMethodNodeSignature(proxyMethodNode, method.getModifiers() & ~Modifier.ABSTRACT, method.getName(),
            Type.getMethodDescriptor(method), method.getExceptionTypes());

    InsnList insnList = proxyMethodNode.instructions;

    Iterator<AbstractInsnNode> iterator = insnList.iterator();

    // NEW com/liferay/portal/kernel/io/Serializer

    _assertTypeInsnNode(iterator.next(), Opcodes.NEW, Serializer.class);

    // DUP/*from  ww w .j a v  a  2  s .c  o m*/

    _assertInsnNode(iterator.next(), Opcodes.DUP);

    // INVOKESPECIAL com/liferay/portal/kernel/io/Serializer <init> ()V

    _assertMethodInsnNode(iterator.next(), Opcodes.INVOKESPECIAL, Type.getInternalName(Serializer.class),
            "<init>", Type.VOID_TYPE);

    // ASTORE argumentsSize

    Type methodType = Type.getType(method);

    int argumentsAndReturnSizes = methodType.getArgumentsAndReturnSizes();

    int argumentsSize = argumentsAndReturnSizes >> 2;

    _assertVarInsnNode(iterator.next(), Opcodes.ASTORE, argumentsSize);

    // ALOAD argumentsSize

    _assertVarInsnNode(iterator.next(), Opcodes.ALOAD, argumentsSize);

    // LDC skeletonId

    _assertLdcInsnNode(iterator.next(), Opcodes.LDC, skeletonId);

    // INVOKEVIRTUAL com/liferay/portal/kernel/io/Serializer writeString
    // (Ljava/lang/String;)V

    _assertMethodInsnNode(iterator.next(), Opcodes.INVOKEVIRTUAL, Type.getInternalName(Serializer.class),
            "writeString", Type.VOID_TYPE, Type.getType(String.class));

    // ALOAD argumentsSize

    _assertVarInsnNode(iterator.next(), Opcodes.ALOAD, argumentsSize);

    // ALOAD 0

    _assertVarInsnNode(iterator.next(), Opcodes.ALOAD, 0);

    // GETFIELD stubInternalName _id Ljava/lang/String;

    _assertFieldInsnNode(iterator.next(), Opcodes.GETFIELD, stubInternalName, "_id", String.class);

    // INVOKEVIRTUAL com/liferay/portal/kernel/io/Serializer writeString
    // (Ljava/lang/String;)V

    _assertMethodInsnNode(iterator.next(), Opcodes.INVOKEVIRTUAL, Type.getInternalName(Serializer.class),
            "writeString", Type.VOID_TYPE, Type.getType(String.class));

    // ALOAD argumentsSize

    _assertVarInsnNode(iterator.next(), Opcodes.ALOAD, argumentsSize);

    if (index <= 5) {

        // ICONST_index

        _assertInsnNode(iterator.next(), Opcodes.ICONST_0 + index);
    } else {

        // BIPUSH index

        _assertIntInsnNode(iterator.next(), Opcodes.BIPUSH, index);
    }

    // INVOKEVIRTUAL com/liferay/portal/kernel/io/Serializer writeInt (I)V

    _assertMethodInsnNode(iterator.next(), Opcodes.INVOKEVIRTUAL, Type.getInternalName(Serializer.class),
            "writeInt", Type.VOID_TYPE, Type.INT_TYPE);

    Class<?>[] parameterTypes = method.getParameterTypes();

    int offset = 1;

    for (int i = 0; i < parameterTypes.length; i++) {
        Class<?> parameterClass = parameterTypes[i];

        // ALOAD argumentsSize

        _assertVarInsnNode(iterator.next(), Opcodes.ALOAD, argumentsSize);

        // xLOAD i

        Type parameterType = Type.getType(parameterClass);

        _assertVarInsnNode(iterator.next(), parameterType.getOpcode(Opcodes.ILOAD), offset);

        offset += parameterType.getSize();

        if (parameterClass.isPrimitive() || (parameterClass == String.class)) {

            String name = TextFormatter.format(parameterClass.getSimpleName(), TextFormatter.G);

            _assertMethodInsnNode(iterator.next(), Opcodes.INVOKEVIRTUAL,
                    Type.getInternalName(Serializer.class), "write".concat(name), Type.VOID_TYPE,
                    parameterType);
        } else {
            _assertMethodInsnNode(iterator.next(), Opcodes.INVOKEVIRTUAL,
                    Type.getInternalName(Serializer.class), "writeObject", Type.VOID_TYPE,
                    Type.getType(Serializable.class));
        }
    }

    // ALOAD 0

    _assertVarInsnNode(iterator.next(), Opcodes.ALOAD, 0);

    // ALOAD argumentsSize

    _assertVarInsnNode(iterator.next(), Opcodes.ALOAD, argumentsSize);

    Class<?> returnClass = method.getReturnType();

    Type returnType = Type.getType(returnClass);

    if (returnClass == void.class) {

        // INVOKESPECIAL stubInternalName _send
        // (Lcom/liferay/portal/kernel/io/Serializer;)V

        _assertMethodInsnNode(iterator.next(), Opcodes.INVOKESPECIAL, stubInternalName, "_send", Type.VOID_TYPE,
                Type.getType(Serializer.class));

        _assertInsnNode(iterator.next(), Opcodes.RETURN);
    } else {

        // INVOKESPECIAL stubInternalName _syncSend
        // (Lcom/liferay/portal/kernel/io/Serializer;)Ljava/io/Serializable;

        _assertMethodInsnNode(iterator.next(), Opcodes.INVOKESPECIAL, stubInternalName, "_syncSend",
                Type.getType(Serializable.class), Type.getType(Serializer.class));

        if (returnClass.isPrimitive()) {

            // ASTORE argumentsSize + 1

            _assertVarInsnNode(iterator.next(), Opcodes.ASTORE, argumentsSize + 1);

            // ALOAD argumentsSize + 1

            _assertVarInsnNode(iterator.next(), Opcodes.ALOAD, argumentsSize + 1);

            // IFNULL nullCheckLabel

            LabelNode nullCheckLabelNode = _assertJumpInsnNode(iterator.next(), Opcodes.IFNULL);

            // ALOAD argumentsSize + 1

            _assertVarInsnNode(iterator.next(), Opcodes.ALOAD, argumentsSize + 1);

            // CHECKCAST returnType

            _assertTypeInsnNode(iterator.next(), Opcodes.CHECKCAST, _autoboxingMap.get(returnClass));

            if (returnClass == boolean.class) {

                // INVOKEVIRTUAL java/lang/Boolean booleanValue ()Z

                _assertMethodInsnNode(iterator.next(), Opcodes.INVOKEVIRTUAL,
                        Type.getInternalName(Boolean.class), "booleanValue", Type.BOOLEAN_TYPE);
            } else if (returnClass == byte.class) {

                // INVOKEVIRTUAL java/lang/Number intValue ()I

                _assertMethodInsnNode(iterator.next(), Opcodes.INVOKEVIRTUAL,
                        Type.getInternalName(Number.class), "intValue", Type.INT_TYPE);
            } else if (returnClass == char.class) {

                // INVOKEVIRTUAL java/lang/Character charValue ()C

                _assertMethodInsnNode(iterator.next(), Opcodes.INVOKEVIRTUAL,
                        Type.getInternalName(Character.class), "charValue", Type.CHAR_TYPE);
            } else if (returnClass == double.class) {

                // INVOKEVIRTUAL java/lang/Number doubleValue ()D

                _assertMethodInsnNode(iterator.next(), Opcodes.INVOKEVIRTUAL,
                        Type.getInternalName(Number.class), "doubleValue", Type.DOUBLE_TYPE);
            } else if (returnClass == float.class) {

                // INVOKEVIRTUAL java/lang/Number floatValue ()F

                _assertMethodInsnNode(iterator.next(), Opcodes.INVOKEVIRTUAL,
                        Type.getInternalName(Number.class), "floatValue", Type.FLOAT_TYPE);
            } else if (returnClass == int.class) {

                // INVOKEVIRTUAL java/lang/Number intValue ()I

                _assertMethodInsnNode(iterator.next(), Opcodes.INVOKEVIRTUAL,
                        Type.getInternalName(Number.class), "intValue", Type.INT_TYPE);
            } else if (returnClass == long.class) {

                // INVOKEVIRTUAL java/lang/Number longValue ()J

                _assertMethodInsnNode(iterator.next(), Opcodes.INVOKEVIRTUAL,
                        Type.getInternalName(Number.class), "longValue", Type.LONG_TYPE);
            } else if (returnClass == short.class) {

                // INVOKEVIRTUAL java/lang/Number intValue ()I

                _assertMethodInsnNode(iterator.next(), Opcodes.INVOKEVIRTUAL,
                        Type.getInternalName(Number.class), "intValue", Type.INT_TYPE);
            }

            // xRETURN

            _assertInsnNode(iterator.next(), returnType.getOpcode(Opcodes.IRETURN));

            // nullCheckLabel

            Assert.assertSame(nullCheckLabelNode, iterator.next());

            // xRETURN null/0

            if (!returnClass.isPrimitive()) {
                _assertInsnNode(iterator.next(), Opcodes.ACONST_NULL);
                _assertInsnNode(iterator.next(), Opcodes.ARETURN);
            } else if (returnClass == void.class) {
                _assertInsnNode(iterator.next(), Opcodes.RETURN);
            } else if (returnClass == float.class) {
                _assertInsnNode(iterator.next(), Opcodes.FCONST_0);
                _assertInsnNode(iterator.next(), Opcodes.FRETURN);
            } else if (returnClass == double.class) {
                _assertInsnNode(iterator.next(), Opcodes.DCONST_0);
                _assertInsnNode(iterator.next(), Opcodes.DRETURN);
            } else if (returnClass == long.class) {
                _assertInsnNode(iterator.next(), Opcodes.LCONST_0);
                _assertInsnNode(iterator.next(), Opcodes.LRETURN);
            } else {
                _assertInsnNode(iterator.next(), Opcodes.ICONST_0);
                _assertInsnNode(iterator.next(), Opcodes.IRETURN);
            }
        } else {
            if (returnClass != Object.class) {

                // CHECKCAST

                _assertTypeInsnNode(iterator.next(), Opcodes.CHECKCAST, returnClass);
            }

            // ARETURN

            _assertInsnNode(iterator.next(), Opcodes.ARETURN);
        }
    }

    Assert.assertFalse(iterator.hasNext());
}