/** * Generates a RET instruction. * * @param local * a local variable identifier, as returned by * {@link LocalVariablesSorter#newLocal(Type) newLocal()}. */ public void ret(final int local) { mv.visitVarInsn(Opcodes.RET, local); }
public void ret(final int var) { mv.visitVarInsn(Opcodes.RET, var); }
/** * Generates the instruction to load 'this' on the stack. */ public void loadThis(){ if((access & Opcodes.ACC_STATIC) != 0) { throw new IllegalStateException("no 'this' pointer within static method"); } mv.visitVarInsn(Opcodes.ALOAD, 0); }
@Override public void visitVarInsn(final int opcode, final int var) { if (var < 4 && opcode != RET) { minSize += 1; maxSize += 1; } else if (var >= 256) { minSize += 4; maxSize += 4; } else { minSize += 2; maxSize += 2; } if (mv != null) { mv.visitVarInsn(opcode, var); } }
/** * Visits a local variable instruction. A local variable instruction is an * instruction that loads or stores the value of a local variable. * * @param opcode * the opcode of the local variable instruction to be visited. * This opcode is either ILOAD, LLOAD, FLOAD, DLOAD, ALOAD, * ISTORE, LSTORE, FSTORE, DSTORE, ASTORE or RET. * @param var * the operand of the instruction to be visited. This operand is * the index of a local variable. */ public void visitVarInsn(int opcode, int var) { if (mv != null) { mv.visitVarInsn(opcode, var); } }
/** * Generates the instruction to load 'this' on the stack. */ public void loadThis() { if ((access & Opcodes.ACC_STATIC) != 0) { throw new IllegalStateException( "no 'this' pointer within static method"); } mv.visitVarInsn(Opcodes.ALOAD, 0); }
@Override public void visitVarInsn(final int opcode, final int var) { if (mv != null) { mv.visitVarInsn(opcode, var); } execute(opcode, var, null); }
/** * Generates the instruction to store the top stack value in a local * variable. * * @param type the type of the local variable to be stored. * @param index an index in the frame's local variables array. */ private void storeInsn(final Type type, final int index){ mv.visitVarInsn(type.getOpcode(Opcodes.ISTORE), index); }
public void store(final int var, final Type type) { mv.visitVarInsn(type.getOpcode(Opcodes.ISTORE), var); }
/** * Generates the instruction to push a local variable on the stack. * * @param type * the type of the local variable to be loaded. * @param index * an index in the frame's local variables array. */ private void loadInsn(final Type type, final int index) { mv.visitVarInsn(type.getOpcode(Opcodes.ILOAD), index); }
/** * Generates the instruction to store the top stack value in a local * variable. * * @param type * the type of the local variable to be stored. * @param index * an index in the frame's local variables array. */ private void storeInsn(final Type type, final int index) { mv.visitVarInsn(type.getOpcode(Opcodes.ISTORE), index); }
public void load(final int var, final Type type) { mv.visitVarInsn(type.getOpcode(Opcodes.ILOAD), var); }
@Override public void visitVarInsn(final int opcode, final int var) { Type type; switch (opcode) { case Opcodes.LLOAD: case Opcodes.LSTORE: type = Type.LONG_TYPE; break; case Opcodes.DLOAD: case Opcodes.DSTORE: type = Type.DOUBLE_TYPE; break; case Opcodes.FLOAD: case Opcodes.FSTORE: type = Type.FLOAT_TYPE; break; case Opcodes.ILOAD: case Opcodes.ISTORE: type = Type.INT_TYPE; break; default: // case Opcodes.ALOAD: // case Opcodes.ASTORE: // case RET: type = OBJECT_TYPE; break; } mv.visitVarInsn(opcode, remap(var, type)); }
type = Type.VOID_TYPE; mv.visitVarInsn(opcode, remap(var, type));
Class k = tagClass(tagOf(s.first())); mv.visitVarInsn(ALOAD, 0); mv.visitLdcInsn(bName); mv.visitMethodInsn(INVOKESTATIC, "clojure/lang/Keyword", "intern", "(Ljava/lang/String;)Lclojure/lang/Keyword;"); mv.visitVarInsn(ASTORE, i); mv.visitVarInsn(ALOAD, 0); mv.visitLdcInsn(bName); mv.visitMethodInsn(INVOKESTATIC, "clojure/lang/Keyword", "intern", "(Ljava/lang/String;)Lclojure/lang/Keyword;"); mv.visitMethodInsn(INVOKEINTERFACE, "clojure/lang/IPersistentMap", "without", "(Ljava/lang/Object;)Lclojure/lang/IPersistentMap;"); mv.visitVarInsn(ASTORE, 0); for(i=1; i<=fieldCount; i++) mv.visitVarInsn(ALOAD, i); Class k = tagClass(tagOf(hintedFields.nth(i-1))); if(k.isPrimitive()) mv.visitVarInsn(ALOAD, 0); mv.visitMethodInsn(INVOKESTATIC, "clojure/lang/RT", "seqOrElse", "(Ljava/lang/Object;)Ljava/lang/Object;"); mv.visitMethodInsn(INVOKESPECIAL, className, "<init>", ctor.getDescriptor());
if (opcode > Opcodes.ISTORE) { opcode -= 59; // ISTORE_0 mv.visitVarInsn(Opcodes.ISTORE + (opcode >> 2), opcode & 0x3); } else { opcode -= 26; // ILOAD_0 mv.visitVarInsn(Opcodes.ILOAD + (opcode >> 2), opcode & 0x3); u += 6; } else { mv.visitVarInsn(opcode, readUnsignedShort(u + 2)); u += 4; mv.visitVarInsn(opcode, b[u + 1] & 0xFF); u += 2; break;