List of usage examples for org.objectweb.asm Opcodes ILOAD
int ILOAD
To view the source code for org.objectweb.asm Opcodes ILOAD.
Click Source Link
From source file:com.mogujie.instantrun.IncrementalChangeVisitor.java
License:Apache License
/** * To each class, add the dispatch method called by the original code that acts as a trampoline to * invoke the changed methods./*from w w w.j a va 2s. c om*/ * <p/> * Pseudo code: * <code> * Object access$dispatch(String name, object[] args) { * if (name.equals( * "firstMethod.(L$type;Ljava/lang/String;Ljava/lang/Object;)Ljava/lang/Object;")) { * return firstMethod(($type)arg[0], (String)arg[1], arg[2]); * } * if (name.equals("secondMethod.(L$type;Ljava/lang/String;I;)V")) { * secondMethod(($type)arg[0], (String)arg[1], (int)arg[2]); * return; * } * ... * StringBuilder $local1 = new StringBuilder(); * $local1.append("Method not found "); * $local1.append(name); * $local1.append(" in " + visitedClassName + * "$dispatch implementation, restart the application"); * throw new $package/InstantReloadException($local1.toString()); * } * </code> */ private void addDispatchMethod() { int access = Opcodes.ACC_PUBLIC | Opcodes.ACC_VARARGS; Method m = new Method("access$dispatch", "(I[Ljava/lang/Object;)Ljava/lang/Object;"); MethodVisitor visitor = super.visitMethod(access, m.getName(), m.getDescriptor(), null, null); final GeneratorAdapter mv = new GeneratorAdapter(access, m, visitor); if (TRACING_ENABLED) { mv.push("Redirecting "); mv.loadArg(0); trace(mv, 2); } List<MethodNode> allMethods = new ArrayList(); // if we are disabled, do not generate any dispatch, the method will throw an exception // if invoked which should never happen. if (!instantRunDisabled) { //noinspection unchecked allMethods.addAll(classNode.methods); allMethods.addAll(addedMethods); } final Map<String, MethodNode> methods = new HashMap(); for (MethodNode methodNode : allMethods) { if (methodNode.name.equals("<clinit>") || methodNode.name.equals("<init>")) { continue; } if (!isAccessCompatibleWithInstantRun(methodNode.access)) { continue; } methods.put(methodNode.name + "." + methodNode.desc, methodNode); } new IntSwitch() { @Override void visitString() { mv.visitVarInsn(Opcodes.ALOAD, 1); } @Override void visitInt() { mv.visitVarInsn(Opcodes.ILOAD, 1); } @Override void visitCase(String methodName) { MethodNode methodNode = methods.get(methodName); String name = methodNode.name; boolean isStatic = (methodNode.access & Opcodes.ACC_STATIC) != 0; String newDesc = computeOverrideMethodDesc(methodNode.desc, isStatic); if (TRACING_ENABLED) { trace(mv, "M: " + name + " P:" + newDesc); } Type[] args = Type.getArgumentTypes(newDesc); int argc = 0; for (Type t : args) { mv.visitVarInsn(Opcodes.ALOAD, 2); mv.push(argc); mv.visitInsn(Opcodes.AALOAD); ByteCodeUtils.unbox(mv, t); argc++; } mv.visitMethodInsn(Opcodes.INVOKESTATIC, visitedClassName + "$override", isStatic ? computeOverrideMethodName(name, methodNode.desc) : name, newDesc, false); Type ret = Type.getReturnType(methodNode.desc); if (ret.getSort() == Type.VOID) { mv.visitInsn(Opcodes.ACONST_NULL); } else { mv.box(ret); } mv.visitInsn(Opcodes.ARETURN); } @Override void visitDefault() { writeMissingMessageWithHash(mv, visitedClassName); } }.visit(mv, methods.keySet(), visitedClassName); mv.visitMaxs(0, 0); mv.visitEnd(); }
From source file:com.mogujie.instantrun.SuperHelperVisitor.java
License:Apache License
public void start() { visit(Opcodes.V1_7, ACC_PUBLIC + ACC_SUPER, visitor.visitedClassName + "$helper", null, visitor.visitedSuperName, null); for (int nodeIndex = 0; nodeIndex < superNode.methods.size(); nodeIndex++) { MethodNode methodNode = (MethodNode) superNode.methods.get(nodeIndex); if ("<init>".equals(methodNode.name)) { String[] exceptions = null; if (methodNode.exceptions != null) { exceptions = (String[]) methodNode.exceptions.toArray(new String[0]); }/* w ww .j ava 2 s. c om*/ MethodVisitor mv = visitMethod(ACC_PUBLIC, methodNode.name, methodNode.desc, methodNode.signature, exceptions); mv.visitCode(); Type[] args = Type.getArgumentTypes(methodNode.desc); List<LocalVariable> variables = ByteCodeUtils.toLocalVariables(Arrays.asList(args)); mv.visitVarInsn(ALOAD, 0); int local = 1; for (int i = 0; i < variables.size(); i++) { mv.visitVarInsn(variables.get(i).type.getOpcode(Opcodes.ILOAD), variables.get(i).var + 1); local = variables.get(i).var + 1 + variables.get(i).type.getSize(); } mv.visitMethodInsn(INVOKESPECIAL, superNode.name, methodNode.name, methodNode.desc, false); mv.visitInsn(RETURN); mv.visitMaxs(local, local); mv.visitEnd(); } } for (InstantMethod method : visitor.superMethods) { MethodVisitor mv = visitMethod(ACC_PUBLIC + ACC_STATIC, method.getName(), method.getDescriptor(), null, null); mv.visitCode(); Type[] args = Type.getArgumentTypes(method.getDescriptor()); List<LocalVariable> variables = ByteCodeUtils.toLocalVariables(Arrays.asList(args)); int totSize = 1; for (LocalVariable variable : variables) { mv.visitVarInsn(variable.type.getOpcode(Opcodes.ILOAD), variable.var); totSize = variable.var; } mv.visitMethodInsn(INVOKESPECIAL, method.getOwner(), method.getName(), method.getOriDesc(), false); Type returnType = Type.getReturnType(method.getDescriptor()); mv.visitInsn(returnType.getOpcode(Opcodes.IRETURN)); mv.visitMaxs(totSize + 1, totSize + 1); mv.visitEnd(); } visitEnd(); }
From source file:com.navercorp.pinpoint.profiler.instrument.ASMClassNodeAdapter.java
License:Apache License
public void addSetterMethod(final String methodName, final ASMFieldNodeAdapter fieldNode) { if (methodName == null || fieldNode == null) { throw new IllegalArgumentException("method name or fieldNode annotation must not be null."); }/*from w w w.j av a 2s. com*/ // void is V. final String desc = "(" + fieldNode.getDesc() + ")V"; final MethodNode methodNode = new MethodNode(Opcodes.ACC_PUBLIC, methodName, desc, null, null); if (methodNode.instructions == null) { methodNode.instructions = new InsnList(); } final InsnList instructions = methodNode.instructions; // load this. instructions.add(new VarInsnNode(Opcodes.ALOAD, 0)); final Type type = Type.getType(fieldNode.getDesc()); // put field. instructions.add(new VarInsnNode(type.getOpcode(Opcodes.ILOAD), 1)); instructions .add(new FieldInsnNode(Opcodes.PUTFIELD, classNode.name, fieldNode.getName(), fieldNode.getDesc())); // return. instructions.add(new InsnNode(Opcodes.RETURN)); if (this.classNode.methods == null) { this.classNode.methods = new ArrayList<MethodNode>(); } this.classNode.methods.add(methodNode); }
From source file:com.navercorp.pinpoint.profiler.instrument.ASMMethodVariables.java
License:Apache License
void loadInt(final InsnList instructions, final int index) { instructions.add(new VarInsnNode(Opcodes.ILOAD, index)); }
From source file:com.navercorp.pinpoint.profiler.instrument.ASMMethodVariables.java
License:Apache License
void loadArg(final InsnList instructions, Type[] argumentTypes, int i) { final int index = getArgIndex(argumentTypes, i); final Type type = argumentTypes[i]; instructions.add(new VarInsnNode(type.getOpcode(Opcodes.ILOAD), index)); }
From source file:com.nginious.http.xsp.expr.SubstrFunction.java
License:Apache License
/** * Creates bytecode for evaluating this substring function. The specified method visitor * and type are used for generating bytecode. * //from w ww .j a v a2 s .c om * @param visitor the method visitor * @param type the type */ void compile(MethodVisitor visitor, Type type) { value.compile(visitor, Type.STRING); visitor.visitVarInsn(Opcodes.ASTORE, 1); value2.compile(visitor, Type.INT); visitor.visitVarInsn(Opcodes.ISTORE, 2); value3.compile(visitor, Type.INT); visitor.visitVarInsn(Opcodes.ISTORE, 3); Label nullLabel = new Label(); Label notNullLabel = new Label(); // check for null string visitor.visitVarInsn(Opcodes.ALOAD, 1); visitor.visitJumpInsn(Opcodes.IFNULL, nullLabel); // start < 0 Label label1 = new Label(); visitor.visitLdcInsn(0); visitor.visitVarInsn(Opcodes.ILOAD, 2); visitor.visitJumpInsn(Opcodes.IF_ICMPLT, label1); visitor.visitLdcInsn(0); visitor.visitVarInsn(Opcodes.ISTORE, 2); // start > value.length Label label2 = new Label(); visitor.visitLabel(label1); visitor.visitVarInsn(Opcodes.ALOAD, 1); visitor.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/lang/String", "length", "()I"); visitor.visitVarInsn(Opcodes.ILOAD, 2); visitor.visitJumpInsn(Opcodes.IF_ICMPGT, label2); visitor.visitVarInsn(Opcodes.ALOAD, 1); visitor.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/lang/String", "length", "()I"); visitor.visitVarInsn(Opcodes.ISTORE, 2); // end < start Label label3 = new Label(); visitor.visitLabel(label2); visitor.visitVarInsn(Opcodes.ILOAD, 2); visitor.visitVarInsn(Opcodes.ILOAD, 3); visitor.visitJumpInsn(Opcodes.IF_ICMPLT, label3); visitor.visitVarInsn(Opcodes.ILOAD, 2); visitor.visitVarInsn(Opcodes.ISTORE, 3); // end > value1.length Label label4 = new Label(); visitor.visitLabel(label3); visitor.visitVarInsn(Opcodes.ALOAD, 1); visitor.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/lang/String", "length", "()I"); visitor.visitVarInsn(Opcodes.ILOAD, 3); visitor.visitJumpInsn(Opcodes.IF_ICMPGT, label4); visitor.visitVarInsn(Opcodes.ALOAD, 1); visitor.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/lang/String", "length", "()I"); visitor.visitVarInsn(Opcodes.ISTORE, 3); // substr visitor.visitLabel(label4); visitor.visitVarInsn(Opcodes.ALOAD, 1); visitor.visitVarInsn(Opcodes.ILOAD, 2); visitor.visitVarInsn(Opcodes.ILOAD, 3); visitor.visitMethodInsn(Opcodes.INVOKEVIRTUAL, "java/lang/String", "substring", "(II)Ljava/lang/String;"); visitor.visitJumpInsn(Opcodes.GOTO, notNullLabel); visitor.visitLabel(nullLabel); visitor.visitInsn(Opcodes.ACONST_NULL); visitor.visitLabel(notNullLabel); }
From source file:com.nginious.http.xsp.ForEachTagPart.java
License:Apache License
/** * Creates bytecode in a separate method for evaluating this for each tag part. * // w w w.j av a2s .com * @param intClassName the binary class name of the class being created * @param writer the class writer * @throws XspException if unable to create bytecode */ void compileMethod(String intClassName, ClassWriter writer) throws XspException { String[] exceptions = { "com/nginious/http/xsp/XspException" }; MethodVisitor visitor = writer.visitMethod(Opcodes.ACC_PRIVATE, this.methodName, "(Lcom/nginious/http/HttpRequest;Lcom/nginious/http/HttpResponse;Ljava/lang/StringBuffer;)V", null, exceptions); visitor.visitCode(); Label tryLabel = new Label(); Label startCatchLabel = new Label(); // Start try block visitor.visitTryCatchBlock(tryLabel, startCatchLabel, startCatchLabel, "java/lang/Exception"); visitor.visitLabel(tryLabel); try { String expression = setValue.getExpressionContent(); ExpressionParser parser = new ExpressionParser(); TreeExpression expr = parser.parse(expression); if (expr.getType() != Type.ANY) { throw new XspException("Expression in attribute set in tag " + getName() + " is not an attribute or bean property " + " at line " + getLocationDescriptor()); } expr.compile(visitor, Type.ANY); visitor.visitTypeInsn(Opcodes.CHECKCAST, "java/util/Collection"); visitor.visitVarInsn(Opcodes.ASTORE, 4); } catch (ExpressionException e) { throw new XspException("Invalid expression in attribute set in tag " + getName() + " at line " + getLocationDescriptor(), e); } Label labelOut = new Label(); visitor.visitVarInsn(Opcodes.ALOAD, 4); visitor.visitJumpInsn(Opcodes.IFNULL, labelOut); // Start if (this.start != null) { start.compile(visitor, Type.INT); } else { visitor.visitLdcInsn((int) 0); } visitor.visitVarInsn(Opcodes.ISTORE, 5); // End if (this.end != null) { end.compile(visitor, Type.INT); } else { visitor.visitVarInsn(Opcodes.ALOAD, 4); visitor.visitMethodInsn(Opcodes.INVOKEINTERFACE, "java/util/Collection", "size", "()I"); } visitor.visitVarInsn(Opcodes.ISTORE, 6); // Step if (this.step != null) { step.compile(visitor, Type.INT); } else { visitor.visitLdcInsn((int) 1); } visitor.visitVarInsn(Opcodes.ISTORE, 7); // Current pos visitor.visitLdcInsn(0); visitor.visitVarInsn(Opcodes.ISTORE, 8); visitor.visitVarInsn(Opcodes.ALOAD, 4); visitor.visitMethodInsn(Opcodes.INVOKEINTERFACE, "java/util/Collection", "iterator", "()Ljava/util/Iterator;"); visitor.visitVarInsn(Opcodes.ASTORE, 9); Label labelStart = new Label(); // Start of loop visitor.visitLabel(labelStart); // iterator.hasNext(); visitor.visitVarInsn(Opcodes.ALOAD, 9); visitor.visitMethodInsn(Opcodes.INVOKEINTERFACE, "java/util/Iterator", "hasNext", "()Z"); visitor.visitJumpInsn(Opcodes.IFEQ, labelOut); // iterator.next(); visitor.visitVarInsn(Opcodes.ALOAD, 9); visitor.visitMethodInsn(Opcodes.INVOKEINTERFACE, "java/util/Iterator", "next", "()Ljava/lang/Object;"); visitor.visitVarInsn(Opcodes.ASTORE, 10); // pos >= start && pos <= end && (pos - start) % step == 0 Label labelIncr = new Label(); visitor.visitVarInsn(Opcodes.ILOAD, 8); visitor.visitVarInsn(Opcodes.ILOAD, 5); visitor.visitJumpInsn(Opcodes.IF_ICMPLT, labelIncr); visitor.visitVarInsn(Opcodes.ILOAD, 8); visitor.visitVarInsn(Opcodes.ILOAD, 6); visitor.visitJumpInsn(Opcodes.IF_ICMPGT, labelIncr); visitor.visitVarInsn(Opcodes.ILOAD, 8); visitor.visitVarInsn(Opcodes.ILOAD, 5); visitor.visitInsn(Opcodes.ISUB); visitor.visitVarInsn(Opcodes.ILOAD, 7); visitor.visitInsn(Opcodes.IREM); visitor.visitJumpInsn(Opcodes.IFNE, labelIncr); visitor.visitVarInsn(Opcodes.ALOAD, 1); varName.compile(visitor, Type.STRING); visitor.visitVarInsn(Opcodes.ALOAD, 10); visitor.visitMethodInsn(Opcodes.INVOKEINTERFACE, "com/nginious/http/HttpRequest", "setAttribute", "(Ljava/lang/String;Ljava/lang/Object;)V"); // Call sub parts for (XspPart part : this.contentParts) { part.compile(intClassName, writer, visitor); } // pos++ visitor.visitLabel(labelIncr); visitor.visitIincInsn(8, 1); visitor.visitJumpInsn(Opcodes.GOTO, labelStart); visitor.visitLabel(labelOut); visitor.visitInsn(Opcodes.RETURN); visitor.visitLabel(startCatchLabel); visitor.visitVarInsn(Opcodes.ASTORE, 3); visitor.visitTypeInsn(Opcodes.NEW, "com/nginious/http/xsp/XspException"); visitor.visitInsn(Opcodes.DUP); visitor.visitLdcInsn("Attribute set contains an invalid collection for tag " + getName() + " at " + getLocationDescriptor()); visitor.visitVarInsn(Opcodes.ALOAD, 3); visitor.visitMethodInsn(Opcodes.INVOKESPECIAL, "com/nginious/http/xsp/XspException", "<init>", "(Ljava/lang/String;Ljava/lang/Throwable;)V"); visitor.visitInsn(Opcodes.ATHROW); visitor.visitMaxs(11, 11); visitor.visitEnd(); }
From source file:com.offbynull.coroutines.instrumenter.asm.InstructionUtils.java
License:Open Source License
/** * Copies a local variable on to the stack. * @param variable variable within the local variable table to load from * @return instructions to load a local variable on to the stack * @throws NullPointerException if any argument is {@code null} * @throws IllegalArgumentException if {@code variable} has been released *//* w w w . java2s .com*/ public static InsnList loadVar(Variable variable) { Validate.notNull(variable); InsnList ret = new InsnList(); switch (variable.getType().getSort()) { case Type.BOOLEAN: case Type.BYTE: case Type.CHAR: case Type.SHORT: case Type.INT: ret.add(new VarInsnNode(Opcodes.ILOAD, variable.getIndex())); break; case Type.LONG: ret.add(new VarInsnNode(Opcodes.LLOAD, variable.getIndex())); break; case Type.FLOAT: ret.add(new VarInsnNode(Opcodes.FLOAD, variable.getIndex())); break; case Type.DOUBLE: ret.add(new VarInsnNode(Opcodes.DLOAD, variable.getIndex())); break; case Type.OBJECT: case Type.ARRAY: ret.add(new VarInsnNode(Opcodes.ALOAD, variable.getIndex())); ret.add(new TypeInsnNode(Opcodes.CHECKCAST, variable.getType().getInternalName())); break; default: throw new IllegalStateException(); // should never happen, there is code in Variable/VariableTable to make sure invalid // types aren't set } return ret; }
From source file:com.offbynull.coroutines.instrumenter.asm.InstructionUtils.java
License:Open Source License
/** * For each element in an object array, performs an action. * @param counterVar parameter used to keep track of count in loop * @param arrayLenVar parameter used to keep track of array length * @param array object array instruction list -- must leave an array on top of the stack * @param action action to perform on each element -- element will be at top of stack and must be consumed by these instructions * @return instructions instruction list to perform some action if two ints are equal * @throws NullPointerException if any argument is {@code null} *//*from w w w. j a va2s. c o m*/ public static InsnList forEach(Variable counterVar, Variable arrayLenVar, InsnList array, InsnList action) { Validate.notNull(counterVar); Validate.notNull(arrayLenVar); Validate.notNull(array); Validate.notNull(action); Validate.isTrue(counterVar.getType().equals(Type.INT_TYPE)); Validate.isTrue(arrayLenVar.getType().equals(Type.INT_TYPE)); InsnList ret = new InsnList(); LabelNode doneLabelNode = new LabelNode(); LabelNode loopLabelNode = new LabelNode(); // put zero in to counterVar ret.add(new LdcInsnNode(0)); // int ret.add(new VarInsnNode(Opcodes.ISTORE, counterVar.getIndex())); // // load array we'll be traversing over ret.add(array); // object[] // put array length in to arrayLenVar ret.add(new InsnNode(Opcodes.DUP)); // object[], object[] ret.add(new InsnNode(Opcodes.ARRAYLENGTH)); // object[], int ret.add(new VarInsnNode(Opcodes.ISTORE, arrayLenVar.getIndex())); // object[] // loopLabelNode: test if counterVar == arrayLenVar, if it does then jump to doneLabelNode ret.add(loopLabelNode); ret.add(new VarInsnNode(Opcodes.ILOAD, counterVar.getIndex())); // object[], int ret.add(new VarInsnNode(Opcodes.ILOAD, arrayLenVar.getIndex())); // object[], int, int ret.add(new JumpInsnNode(Opcodes.IF_ICMPEQ, doneLabelNode)); // object[] // load object from object[] ret.add(new InsnNode(Opcodes.DUP)); // object[], object[] ret.add(new VarInsnNode(Opcodes.ILOAD, counterVar.getIndex())); // object[], object[], int ret.add(new InsnNode(Opcodes.AALOAD)); // object[], object // call action ret.add(action); // object[] // increment counter var and goto loopLabelNode ret.add(new IincInsnNode(counterVar.getIndex(), 1)); // object[] ret.add(new JumpInsnNode(Opcodes.GOTO, loopLabelNode)); // object[] // doneLabelNode: pop object[] off of stack ret.add(doneLabelNode); ret.add(new InsnNode(Opcodes.POP)); // return ret; }
From source file:com.offbynull.coroutines.instrumenter.asm.InstructionUtils.java
License:Open Source License
/** * Generates instructions to save the local variables table to an object array. * * @param arrayLocalsVar variable that the object array containing local variables table is stored * @param tempObjectVar variable to use for temporary objects * @param frame execution frame at the instruction where the local variables table is to be saved * @return instructions to save the local variables table in to an array * @throws NullPointerException if any argument is {@code null} * @throws IllegalArgumentException if variables have the same index, or if variables have been released, or if variables are of wrong * type/*from w ww. java 2s . c o m*/ */ public static InsnList saveLocalVariableTable(Variable arrayLocalsVar, Variable tempObjectVar, Frame<BasicValue> frame) { Validate.notNull(arrayLocalsVar); Validate.notNull(tempObjectVar); Validate.notNull(frame); Validate.isTrue(arrayLocalsVar.getType().equals(Type.getType(Object[].class))); Validate.isTrue(tempObjectVar.getType().equals(Type.getType(Object.class))); validateLocalIndicies(arrayLocalsVar.getIndex(), tempObjectVar.getIndex()); InsnList ret = new InsnList(); // Create array and save it in local vars table ret.add(new LdcInsnNode(frame.getLocals())); ret.add(new TypeInsnNode(Opcodes.ANEWARRAY, "java/lang/Object")); ret.add(new VarInsnNode(Opcodes.ASTORE, arrayLocalsVar.getIndex())); // Save the locals for (int i = 0; i < frame.getLocals(); i++) { BasicValue basicValue = frame.getLocal(i); Type type = basicValue.getType(); // If type == null, basicValue is pointing to uninitialized var -- basicValue.toString() will return '.'. This means that this // slot contains nothing to save. So, skip this slot if we encounter it. if (type == null) { continue; } // If type is 'Lnull;', this means that the slot has been assigned null and that "there has been no merge yet that would 'raise' // the type toward some class or interface type" (from ASM mailing list). We know this slot will always contain null at this // point in the code so we can avoid saving it. When we load it back up, we can simply push a null in to that slot, thereby // keeping the same 'Lnull;' type. if ("Lnull;".equals(type.getDescriptor())) { continue; } // Convert the item to an object (if not already an object) and stores it in array. switch (type.getSort()) { case Type.BOOLEAN: ret.add(new VarInsnNode(Opcodes.ILOAD, i)); ret.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "java/lang/Boolean", "valueOf", "(Z)Ljava/lang/Boolean;")); ret.add(new VarInsnNode(Opcodes.ASTORE, tempObjectVar.getIndex())); break; case Type.BYTE: ret.add(new VarInsnNode(Opcodes.ILOAD, i)); ret.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "java/lang/Byte", "valueOf", "(B)Ljava/lang/Byte;", false)); ret.add(new VarInsnNode(Opcodes.ASTORE, tempObjectVar.getIndex())); break; case Type.SHORT: ret.add(new VarInsnNode(Opcodes.ILOAD, i)); ret.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "java/lang/Short", "valueOf", "(S)Ljava/lang/Short;", false)); ret.add(new VarInsnNode(Opcodes.ASTORE, tempObjectVar.getIndex())); break; case Type.CHAR: ret.add(new VarInsnNode(Opcodes.ILOAD, i)); ret.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "java/lang/Character", "valueOf", "(C)Ljava/lang/Character;", false)); ret.add(new VarInsnNode(Opcodes.ASTORE, tempObjectVar.getIndex())); break; case Type.INT: ret.add(new VarInsnNode(Opcodes.ILOAD, i)); ret.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "java/lang/Integer", "valueOf", "(I)Ljava/lang/Integer;", false)); ret.add(new VarInsnNode(Opcodes.ASTORE, tempObjectVar.getIndex())); break; case Type.FLOAT: ret.add(new VarInsnNode(Opcodes.FLOAD, i)); ret.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "java/lang/Float", "valueOf", "(F)Ljava/lang/Float;", false)); ret.add(new VarInsnNode(Opcodes.ASTORE, tempObjectVar.getIndex())); break; case Type.LONG: ret.add(new VarInsnNode(Opcodes.LLOAD, i)); ret.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "java/lang/Long", "valueOf", "(J)Ljava/lang/Long;", false)); ret.add(new VarInsnNode(Opcodes.ASTORE, tempObjectVar.getIndex())); break; case Type.DOUBLE: ret.add(new VarInsnNode(Opcodes.DLOAD, i)); ret.add(new MethodInsnNode(Opcodes.INVOKESTATIC, "java/lang/Double", "valueOf", "(D)Ljava/lang/Double;", false)); ret.add(new VarInsnNode(Opcodes.ASTORE, tempObjectVar.getIndex())); break; case Type.ARRAY: case Type.OBJECT: ret.add(new VarInsnNode(Opcodes.ALOAD, i)); ret.add(new VarInsnNode(Opcodes.ASTORE, tempObjectVar.getIndex())); break; case Type.METHOD: case Type.VOID: default: throw new IllegalStateException(); } // Store item in to locals storage array ret.add(new VarInsnNode(Opcodes.ALOAD, arrayLocalsVar.getIndex())); ret.add(new LdcInsnNode(i)); ret.add(new VarInsnNode(Opcodes.ALOAD, tempObjectVar.getIndex())); ret.add(new InsnNode(Opcodes.AASTORE)); } return ret; }