Example usage for org.objectweb.asm Opcodes ANEWARRAY

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

Introduction

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

Prototype

int ANEWARRAY

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

Click Source Link

Usage

From source file:org.openquark.cal.internal.javamodel.AsmJavaBytecodeGenerator.java

License:Open Source License

/**
 * Create the Java code for a given class instance creation expression. The new object reference will be pushed onto
 * the operand stack. //from  ww w . j av  a 2 s.  c  om
 * 
 * @param cice the class instance creation expression
 * @param context 
 * @return JavaTypeName    
 * @throws JavaGenerationException
 */
private static JavaTypeName encodeClassInstanceCreationExpr(
        final JavaExpression.ClassInstanceCreationExpression cice, final GenerationContext context)
        throws JavaGenerationException {

    final MethodVisitor mv = context.getMethodVisitor();
    final JavaTypeName classType = cice.getClassName();
    if (classType instanceof JavaTypeName.Reference.Array) {

        final JavaTypeName.Reference.Array arrayType = (JavaTypeName.Reference.Array) classType;
        final int nSizedDims = cice.getNArgs();
        if (nSizedDims == 1) {

            //for example, new String[10][][] will hit this case since it has 1 sized dimension (even though a multi-dimensional array is 
            //being created

            //push the size of the dimension
            encodeExpr(cice.getArg(0), context);

            final JavaTypeName arrayElementType = arrayType.getIncrementalElementType();
            switch (arrayElementType.getTag()) {

            case JavaTypeName.VOID_TAG:
                throw new JavaGenerationException("Cannot have an array of with void element types.");

            case JavaTypeName.BOOLEAN_TAG:
            case JavaTypeName.BYTE_TAG:
            case JavaTypeName.SHORT_TAG:
            case JavaTypeName.CHAR_TAG:
            case JavaTypeName.INT_TAG:
            case JavaTypeName.LONG_TAG:
            case JavaTypeName.DOUBLE_TAG:
            case JavaTypeName.FLOAT_TAG: {
                //push the instruction to create a 1-dimensonal array of primitive values
                mv.visitIntInsn(Opcodes.NEWARRAY, getNewArrayArgCode(arrayElementType));
                break;
            }

            case JavaTypeName.ARRAY_TAG:
            case JavaTypeName.OBJECT_TAG: {
                //push the instruction to create a 1-dimensonal array of reference values
                mv.visitTypeInsn(Opcodes.ANEWARRAY, arrayElementType.getJVMInternalName());
                break;
            }

            default: {
                throw new IllegalArgumentException();
            }
            }

            return arrayType;

        } else {
            //the case of multi-dimensional arrays where more than 1 sizing dimension is supplied.

            // push args onto the stack
            for (int i = 0; i < nSizedDims; i++) {
                encodeExpr(cice.getArg(i), context);
            }

            mv.visitMultiANewArrayInsn(arrayType.getJVMInternalName(), nSizedDims);

            return arrayType;
        }

    } else if (classType instanceof JavaTypeName.Reference.Object) {

        String internalClassName = classType.getJVMInternalName();

        // create uninitialized object, duplicate the ref.
        mv.visitTypeInsn(Opcodes.NEW, internalClassName);
        mv.visitInsn(Opcodes.DUP);

        // push args onto the stack
        for (int i = 0, nArgs = cice.getNArgs(); i < nArgs; i++) {
            encodeExpr(cice.getArg(i), context);
        }

        //descriptor for the constructor
        StringBuilder descriptor = new StringBuilder("(");
        for (int i = 0, nArgs = cice.getNArgs(); i < nArgs; ++i) {
            descriptor.append(cice.getParamType(i).getJVMDescriptor());
        }
        descriptor.append(")V");

        // initialize - consumes the args and the duplicate reference.
        mv.visitMethodInsn(Opcodes.INVOKESPECIAL, internalClassName, "<init>", descriptor.toString());

        return classType;

    } else {
        throw new JavaGenerationException("cannot create a new instance of a primitive type.");
    }
}

From source file:org.sonar.java.bytecode.se.BytecodeEGWalkerExecuteTest.java

License:Open Source License

@Test
public void test_newarray() throws Exception {
    SymbolicValue size = new SymbolicValue();
    int[] opcodes = { Opcodes.NEWARRAY, Opcodes.ANEWARRAY };
    for (int opcode : opcodes) {
        ProgramState programState = execute(new Instruction(opcode), ProgramState.EMPTY_STATE.stackValue(size));
        assertThat(programState.peekValue()).isNotEqualTo(size);
        assertStack(programState, ObjectConstraint.NOT_NULL);

        assertThatThrownBy(() -> execute(new Instruction(opcode), ProgramState.EMPTY_STATE))
                .hasMessage(Printer.OPCODES[opcode] + " needs 1 values on stack");
    }//from   ww w .  j  a  v a 2s.  c  om
}

From source file:org.springsource.loaded.test.infra.MethodPrinter.java

License:Apache License

public void visitTypeInsn(int opcode, String type) {
    if (opcode == Opcodes.NEW) { // 187
        to.println("    NEW " + type);
    } else if (opcode == Opcodes.ANEWARRAY) { // 189
        to.println("    ANEWARRAY " + type);
    } else if (opcode == Opcodes.CHECKCAST) { // 192
        to.println("    CHECKCAST " + type);
    } else if (opcode == Opcodes.INSTANCEOF) { // 193
        to.println("    INSTANCEOF " + type);
    } else {/*www  .ja  v  a  2 s.  c  om*/
        throw new IllegalStateException(":" + opcode);
    }
}

From source file:pl.clareo.coroutines.core.ClassTransformer.java

License:Apache License

@SuppressWarnings("unchecked")
private static InsnList createDebugFrame(MethodNode coroutine) {
    InsnList insn = new InsnList();
    int nLocals = coroutine.maxLocals;
    String[] names = new String[nLocals];
    List<LocalVariableNode> locals = coroutine.localVariables;
    fillVariableNames(names, locals);//from  w  ww. ja v a 2s.co m
    insn.add(new TypeInsnNode(Opcodes.NEW, FRAME_NAME));
    insn.add(new InsnNode(Opcodes.DUP));
    insn.add(makeInt(nLocals));
    insn.add(makeInt(nLocals));
    insn.add(new TypeInsnNode(Opcodes.ANEWARRAY, "java/lang/String"));
    for (LocalVariableNode local : locals) {
        int i = local.index;
        String name = names[i];
        insn.add(new InsnNode(Opcodes.DUP));
        insn.add(makeInt(i));
        if (name != null) {
            insn.add(new LdcInsnNode(name));
        } else {
            insn.add(new InsnNode(Opcodes.ACONST_NULL));
        }
        insn.add(new InsnNode(Opcodes.AASTORE));
    }
    insn.add(new MethodInsnNode(Opcodes.INVOKESPECIAL, FRAME_NAME, "<init>", "(I[Ljava/lang/String;)V"));
    return insn;
}

From source file:scouter.agent.asm.ApicallASM.java

License:Apache License

public void visitCode() {
    int sidx = isStatic ? 0 : 1;
    int arrVarIdx = newLocal(Type.getType("[Ljava/lang/Object;"));
    AsmUtil.PUSH(mv, paramTypes.length);
    mv.visitTypeInsn(Opcodes.ANEWARRAY, "java/lang/Object");
    mv.visitVarInsn(Opcodes.ASTORE, arrVarIdx);
    for (int i = 0; i < paramTypes.length; i++) {
        Type tp = paramTypes[i];/* w  w  w . j a va2s  .  co  m*/
        mv.visitVarInsn(Opcodes.ALOAD, arrVarIdx);
        AsmUtil.PUSH(mv, i);
        switch (tp.getSort()) {
        case Type.BOOLEAN:
            mv.visitVarInsn(Opcodes.ILOAD, sidx);
            mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Boolean", "valueOf", "(Z)Ljava/lang/Boolean;",
                    false);
            break;
        case Type.BYTE:
            mv.visitVarInsn(Opcodes.ILOAD, sidx);
            mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Byte", "valueOf", "(B)Ljava/lang/Byte;", false);
            break;
        case Type.CHAR:
            mv.visitVarInsn(Opcodes.ILOAD, sidx);
            mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Character", "valueOf",
                    "(C)Ljava/lang/Character;", false);
            break;
        case Type.SHORT:
            mv.visitVarInsn(Opcodes.ILOAD, sidx);
            mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Short", "valueOf", "(S)Ljava/lang/Short;",
                    false);
            break;
        case Type.INT:
            mv.visitVarInsn(Opcodes.ILOAD, sidx);
            mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Integer", "valueOf", "(I)Ljava/lang/Integer;",
                    false);
            break;
        case Type.LONG:
            mv.visitVarInsn(Opcodes.LLOAD, sidx);
            mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Long", "valueOf", "(J)Ljava/lang/Long;", false);
            break;
        case Type.FLOAT:
            mv.visitVarInsn(Opcodes.FLOAD, sidx);
            mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Float", "valueOf", "(F)Ljava/lang/Float;",
                    false);
            break;
        case Type.DOUBLE:
            mv.visitVarInsn(Opcodes.DLOAD, sidx);
            mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Double", "valueOf", "(D)Ljava/lang/Double;",
                    false);
            break;
        default:
            mv.visitVarInsn(Opcodes.ALOAD, sidx);
        }
        mv.visitInsn(Opcodes.AASTORE);
        sidx += tp.getSize();
    }
    AsmUtil.PUSH(mv, className);
    AsmUtil.PUSH(mv, methodName);
    AsmUtil.PUSH(mv, methodDesc);
    if (isStatic) {
        AsmUtil.PUSHNULL(mv);
    } else {
        mv.visitVarInsn(Opcodes.ALOAD, 0);
    }
    mv.visitVarInsn(Opcodes.ALOAD, arrVarIdx);
    mv.visitMethodInsn(Opcodes.INVOKESTATIC, TRACESUBCALL, START_METHOD, START_SIGNATURE, false);
    statIdx = newLocal(Type.getType(Object.class));
    mv.visitVarInsn(Opcodes.ASTORE, statIdx);
    mv.visitLabel(startFinally);
    mv.visitCode();
}

From source file:scouter.agent.asm.ApicallInfoASM.java

License:Apache License

public void visitCode() {
    int sidx = isStatic ? 0 : 1;
    int arrVarIdx = newLocal(Type.getType("[Ljava/lang/Object;"));
    AsmUtil.PUSH(mv, paramTypes.length);
    mv.visitTypeInsn(Opcodes.ANEWARRAY, "java/lang/Object");
    mv.visitVarInsn(Opcodes.ASTORE, arrVarIdx);
    for (int i = 0; i < paramTypes.length; i++) {
        Type tp = paramTypes[i];/*  w  ww . ja v a  2s.com*/
        mv.visitVarInsn(Opcodes.ALOAD, arrVarIdx);
        AsmUtil.PUSH(mv, i);
        switch (tp.getSort()) {
        case Type.BOOLEAN:
            mv.visitVarInsn(Opcodes.ILOAD, sidx);
            mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Boolean", "valueOf", "(Z)Ljava/lang/Boolean;",
                    false);
            break;
        case Type.BYTE:
            mv.visitVarInsn(Opcodes.ILOAD, sidx);
            mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Byte", "valueOf", "(B)Ljava/lang/Byte;", false);
            break;
        case Type.CHAR:
            mv.visitVarInsn(Opcodes.ILOAD, sidx);
            mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Character", "valueOf",
                    "(C)Ljava/lang/Character;", false);
            break;
        case Type.SHORT:
            mv.visitVarInsn(Opcodes.ILOAD, sidx);
            mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Short", "valueOf", "(S)Ljava/lang/Short;",
                    false);
            break;
        case Type.INT:
            mv.visitVarInsn(Opcodes.ILOAD, sidx);
            mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Integer", "valueOf", "(I)Ljava/lang/Integer;",
                    false);
            break;
        case Type.LONG:
            mv.visitVarInsn(Opcodes.LLOAD, sidx);
            mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Long", "valueOf", "(J)Ljava/lang/Long;", false);
            break;
        case Type.FLOAT:
            mv.visitVarInsn(Opcodes.FLOAD, sidx);
            mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Float", "valueOf", "(F)Ljava/lang/Float;",
                    false);
            break;
        case Type.DOUBLE:
            mv.visitVarInsn(Opcodes.DLOAD, sidx);
            mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Double", "valueOf", "(D)Ljava/lang/Double;",
                    false);
            break;
        default:
            mv.visitVarInsn(Opcodes.ALOAD, sidx);
        }
        mv.visitInsn(Opcodes.AASTORE);
        sidx += tp.getSize();
    }
    AsmUtil.PUSH(mv, className);
    AsmUtil.PUSH(mv, methodName);
    AsmUtil.PUSH(mv, methodDesc);
    if (isStatic) {
        AsmUtil.PUSHNULL(mv);
    } else {
        mv.visitVarInsn(Opcodes.ALOAD, 0);
    }
    mv.visitVarInsn(Opcodes.ALOAD, arrVarIdx);
    mv.visitMethodInsn(Opcodes.INVOKESTATIC, TRACESUBCALL, START_METHOD, START_SIGNATURE, false);
    mv.visitCode();
}

From source file:scouter.agent.asm.asyncsupport.LambdaFormASM.java

License:Apache License

@Override
public void visitCode() {
    int sidx = 1;
    mv.visitVarInsn(Opcodes.ALOAD, 0);//from ww w  . j  av  a 2 s .  c o  m
    AsmUtil.PUSH(mv, fullName);
    AsmUtil.PUSH(mv, className);
    AsmUtil.PUSH(mv, name);
    AsmUtil.PUSH(mv, desc);
    mv.visitVarInsn(Opcodes.ALOAD, 0);

    int arrVarIdx = newLocal(Type.getType("[Ljava/lang/Object;"));
    AsmUtil.PUSH(mv, paramTypes.length);
    mv.visitTypeInsn(Opcodes.ANEWARRAY, "java/lang/Object");
    mv.visitVarInsn(Opcodes.ASTORE, arrVarIdx);

    for (int i = 0; i < paramTypes.length; i++) {
        Type tp = paramTypes[i];
        mv.visitVarInsn(Opcodes.ALOAD, arrVarIdx);
        AsmUtil.PUSH(mv, i);

        AsmUtil.loadForArrayElement(mv, tp, sidx);
        mv.visitInsn(Opcodes.AASTORE);
        sidx += tp.getSize();
    }
    mv.visitVarInsn(Opcodes.ALOAD, arrVarIdx);
    mv.visitMethodInsn(Opcodes.INVOKESTATIC, TARGET, START_METHOD, START_METHOD_DESC, false);

    statIdx = newLocal(Type.getType(Object.class));
    mv.visitVarInsn(Opcodes.ASTORE, statIdx);
    mv.visitLabel(startFinally);
    mv.visitCode();
}

From source file:scouter.agent.asm.CapArgsASM.java

License:Apache License

@Override
public void visitCode() {

    int sidx = isStatic ? 0 : 1;

    int arrVarIdx = newLocal(Type.getType("[Ljava/lang/Object;"));
    AsmUtil.PUSH(mv, paramTypes.length);
    mv.visitTypeInsn(Opcodes.ANEWARRAY, "java/lang/Object");
    mv.visitVarInsn(Opcodes.ASTORE, arrVarIdx);

    for (int i = 0; i < paramTypes.length; i++) {
        Type type = paramTypes[i];
        mv.visitVarInsn(Opcodes.ALOAD, arrVarIdx);
        AsmUtil.PUSH(mv, i);//from  w  w w  . j  a  v a2s . com

        switch (type.getSort()) {
        case Type.BOOLEAN:
            mv.visitVarInsn(Opcodes.ILOAD, sidx);
            mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Boolean", "valueOf", "(Z)Ljava/lang/Boolean;",
                    false);
            break;
        case Type.BYTE:
            mv.visitVarInsn(Opcodes.ILOAD, sidx);
            mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Byte", "valueOf", "(B)Ljava/lang/Byte;", false);
            break;
        case Type.CHAR:
            mv.visitVarInsn(Opcodes.ILOAD, sidx);
            mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Character", "valueOf",
                    "(C)Ljava/lang/Character;", false);
            break;
        case Type.SHORT:
            mv.visitVarInsn(Opcodes.ILOAD, sidx);
            mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Short", "valueOf", "(S)Ljava/lang/Short;",
                    false);
            break;
        case Type.INT:
            mv.visitVarInsn(Opcodes.ILOAD, sidx);
            mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Integer", "valueOf", "(I)Ljava/lang/Integer;",
                    false);
            break;
        case Type.LONG:
            mv.visitVarInsn(Opcodes.LLOAD, sidx);
            mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Long", "valueOf", "(J)Ljava/lang/Long;", false);
            break;
        case Type.FLOAT:
            mv.visitVarInsn(Opcodes.FLOAD, sidx);
            mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Float", "valueOf", "(F)Ljava/lang/Float;",
                    false);
            break;
        case Type.DOUBLE:
            mv.visitVarInsn(Opcodes.DLOAD, sidx);
            mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Double", "valueOf", "(D)Ljava/lang/Double;",
                    false);
            break;
        default:
            mv.visitVarInsn(Opcodes.ALOAD, sidx);
        }
        mv.visitInsn(Opcodes.AASTORE);
        sidx += type.getSize();
    }
    AsmUtil.PUSH(mv, className);
    AsmUtil.PUSH(mv, methodName);
    AsmUtil.PUSH(mv, methodDesc);
    if (isStatic) {
        AsmUtil.PUSHNULL(mv);
    } else {
        mv.visitVarInsn(Opcodes.ALOAD, 0);
    }
    mv.visitVarInsn(Opcodes.ALOAD, arrVarIdx);

    mv.visitMethodInsn(Opcodes.INVOKESTATIC, CLASS, METHOD, SIGNATURE, false);
    mv.visitCode();
}

From source file:scouter.agent.asm.JspServletASM.java

License:Apache License

@Override
public void visitCode() {

    int sidx = isStatic ? 0 : 1;

    int arrVarIdx = newLocal(Type.getType("[Ljava/lang/Object;"));
    AsmUtil.PUSH(mv, paramTypes.length);
    mv.visitTypeInsn(Opcodes.ANEWARRAY, "java/lang/Object");
    mv.visitVarInsn(Opcodes.ASTORE, arrVarIdx);

    for (int i = 0; i < paramTypes.length; i++) {
        Type tp = paramTypes[i];//  w  w w  .  j  ava  2s.c om
        mv.visitVarInsn(Opcodes.ALOAD, arrVarIdx);
        AsmUtil.PUSH(mv, i);

        switch (tp.getSort()) {
        case Type.BOOLEAN:
            mv.visitVarInsn(Opcodes.ILOAD, sidx);
            mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Boolean", "valueOf", "(Z)Ljava/lang/Boolean;",
                    false);
            break;
        case Type.BYTE:
            mv.visitVarInsn(Opcodes.ILOAD, sidx);
            mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Byte", "valueOf", "(B)Ljava/lang/Byte;", false);
            break;
        case Type.CHAR:
            mv.visitVarInsn(Opcodes.ILOAD, sidx);
            mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Character", "valueOf",
                    "(C)Ljava/lang/Character;", false);
            break;
        case Type.SHORT:
            mv.visitVarInsn(Opcodes.ILOAD, sidx);
            mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Short", "valueOf", "(S)Ljava/lang/Short;",
                    false);
            break;
        case Type.INT:
            mv.visitVarInsn(Opcodes.ILOAD, sidx);
            mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Integer", "valueOf", "(I)Ljava/lang/Integer;",
                    false);
            break;
        case Type.LONG:
            mv.visitVarInsn(Opcodes.LLOAD, sidx);
            mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Long", "valueOf", "(J)Ljava/lang/Long;", false);
            break;
        case Type.FLOAT:
            mv.visitVarInsn(Opcodes.FLOAD, sidx);
            mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Float", "valueOf", "(F)Ljava/lang/Float;",
                    false);
            break;
        case Type.DOUBLE:
            mv.visitVarInsn(Opcodes.DLOAD, sidx);
            mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Double", "valueOf", "(D)Ljava/lang/Double;",
                    false);
            break;
        default:
            mv.visitVarInsn(Opcodes.ALOAD, sidx);
        }
        mv.visitInsn(Opcodes.AASTORE);
        sidx += tp.getSize();
    }
    mv.visitVarInsn(Opcodes.ALOAD, arrVarIdx);

    mv.visitMethodInsn(Opcodes.INVOKESTATIC, CLASS, METHOD, SIGNATURE, false);
    super.visitCode();
}

From source file:scouter.agent.asm.ServiceASM.java

License:Apache License

@Override
public void visitCode() {
    int sidx = isStatic ? 0 : 1;
    if (strArgIdx >= 0) {
        mv.visitVarInsn(Opcodes.ALOAD, strArgIdx);
    } else {// ww  w . j  a va 2  s  .c o  m
        AsmUtil.PUSH(mv, fullname);
    }

    int arrVarIdx = newLocal(Type.getType("[Ljava/lang/Object;"));
    AsmUtil.PUSH(mv, paramTypes.length);
    mv.visitTypeInsn(Opcodes.ANEWARRAY, "java/lang/Object");
    mv.visitVarInsn(Opcodes.ASTORE, arrVarIdx);

    for (int i = 0; i < paramTypes.length; i++) {
        Type tp = paramTypes[i];
        mv.visitVarInsn(Opcodes.ALOAD, arrVarIdx);
        AsmUtil.PUSH(mv, i);

        switch (tp.getSort()) {
        case Type.BOOLEAN:
            mv.visitVarInsn(Opcodes.ILOAD, sidx);
            mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Boolean", "valueOf", "(Z)Ljava/lang/Boolean;",
                    false);
            break;
        case Type.BYTE:
            mv.visitVarInsn(Opcodes.ILOAD, sidx);
            mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Byte", "valueOf", "(B)Ljava/lang/Byte;", false);
            break;
        case Type.CHAR:
            mv.visitVarInsn(Opcodes.ILOAD, sidx);
            mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Character", "valueOf",
                    "(C)Ljava/lang/Character;", false);
            break;
        case Type.SHORT:
            mv.visitVarInsn(Opcodes.ILOAD, sidx);
            mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Short", "valueOf", "(S)Ljava/lang/Short;",
                    false);
            break;
        case Type.INT:
            mv.visitVarInsn(Opcodes.ILOAD, sidx);
            mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Integer", "valueOf", "(I)Ljava/lang/Integer;",
                    false);
            break;
        case Type.LONG:
            mv.visitVarInsn(Opcodes.LLOAD, sidx);
            mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Long", "valueOf", "(J)Ljava/lang/Long;", false);
            break;
        case Type.FLOAT:
            mv.visitVarInsn(Opcodes.FLOAD, sidx);
            mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Float", "valueOf", "(F)Ljava/lang/Float;",
                    false);
            break;
        case Type.DOUBLE:
            mv.visitVarInsn(Opcodes.DLOAD, sidx);
            mv.visitMethodInsn(Opcodes.INVOKESTATIC, "java/lang/Double", "valueOf", "(D)Ljava/lang/Double;",
                    false);
            break;
        default:
            mv.visitVarInsn(Opcodes.ALOAD, sidx);
        }
        mv.visitInsn(Opcodes.AASTORE);
        sidx += tp.getSize();
    }

    AsmUtil.PUSH(mv, className);
    AsmUtil.PUSH(mv, methodName);
    AsmUtil.PUSH(mv, methodDesc);

    if (isStatic) {
        AsmUtil.PUSHNULL(mv);
    } else {
        mv.visitVarInsn(Opcodes.ALOAD, 0);
    }
    mv.visitVarInsn(Opcodes.ALOAD, arrVarIdx);

    AsmUtil.PUSH(mv, xType);
    mv.visitMethodInsn(Opcodes.INVOKESTATIC, TRACEMAIN, START_METHOD, START_SIGNATURE, false);

    statIdx = newLocal(Type.getType(Object.class));
    mv.visitVarInsn(Opcodes.ASTORE, statIdx);
    mv.visitLabel(startFinally);
    mv.visitCode();
}