List of usage examples for org.objectweb.asm Opcodes LLOAD
int LLOAD
To view the source code for org.objectweb.asm Opcodes LLOAD.
Click Source Link
From source file:lucee.transformer.bytecode.util.ASMUtil.java
License:Open Source License
public static int loadFor(Type type) { if (type.equals(Types.BOOLEAN_VALUE) || type.equals(Types.INT_VALUE) || type.equals(Types.CHAR) || type.equals(Types.SHORT_VALUE)) return Opcodes.ILOAD; if (type.equals(Types.FLOAT_VALUE)) return Opcodes.FLOAD; if (type.equals(Types.LONG_VALUE)) return Opcodes.LLOAD; if (type.equals(Types.DOUBLE_VALUE)) return Opcodes.DLOAD; return Opcodes.ALOAD; }
From source file:net.sourceforge.cobertura.instrument.pass1.DetectIgnoredCodeMethodVisitor.java
License:GNU General Public License
public void visitVarInsn(int opcode, int i1) { super.visitVarInsn(opcode, i1); if (ignoredStatus.isTrivial() && opcode != Opcodes.ILOAD && opcode != Opcodes.LLOAD && opcode != Opcodes.FLOAD && opcode != Opcodes.DLOAD && opcode != Opcodes.ALOAD) { markNotTrivial();//w w w. j ava 2 s . c o m } }
From source file:org.adjective.stout.tools.StackVisualiserMethodVisitor.java
License:Apache License
public void visitVarInsn(int opcode, int var) { String description = (var == 0 ? "this" : "v" + var); switch (opcode) { case Opcodes.ISTORE: case Opcodes.LSTORE: case Opcodes.FSTORE: case Opcodes.DSTORE: case Opcodes.ASTORE: { Type type = getType(Opcodes.ISTORE, opcode); pop(type);//from w ww.j a va 2s. co m } break; case Opcodes.ILOAD: case Opcodes.LLOAD: case Opcodes.FLOAD: case Opcodes.DLOAD: case Opcodes.ALOAD: { Type type = getType(Opcodes.ILOAD, opcode); if (_isStatic) { var++; } if (var == 0) { type = _this; } else if (var <= _arguments.length) { type = _arguments[var - 1]; } push(description, type); } break; default: throw new IllegalArgumentException("Unsupported opcode " + OPCODES[opcode]); } print(opcode, description); }
From source file:org.apache.tuscany.sca.interfacedef.java.jaxrs.CodeGenerationHelper.java
License:Apache License
public static int getLoadOPCode(String signature) { if ("Z".equals(signature) || "B".equals(signature) || "C".equals(signature) || "S".equals(signature) || "I".equals(signature)) { return Opcodes.ILOAD; }/* w w w . j a v a 2 s. c o m*/ if ("J".equals(signature)) { return Opcodes.LLOAD; } if ("F".equals(signature)) { return Opcodes.FLOAD; } if ("D".equals(signature)) { return Opcodes.DLOAD; } return Opcodes.ALOAD; }
From source file:org.batoo.jpa.core.impl.instance.Enhancer.java
License:Open Source License
private static int getLoadType(Class<?> paramClass) { if (!paramClass.isPrimitive() || paramClass.isArray()) { return Opcodes.ALOAD; }//from www .j av a 2s .c o m if (Long.TYPE == paramClass) { return Opcodes.LLOAD; } if (Float.TYPE == paramClass) { return Opcodes.FLOAD; } if (Double.TYPE == paramClass) { return Opcodes.DLOAD; } return Opcodes.ILOAD; }
From source file:org.boretti.drools.integration.drools5.DroolsAbstractMethodVisitor.java
License:Open Source License
private void addCondition(boolean preCondition, String type, String resourceName, Type error) { droolsGoalExecutionLog.getLogs()/* ww w . java 2s. c o m*/ .add(new DroolsGoalExecutionLog(droolsGoalExecutionLog.getFileName(), droolsGoalExecutionLog.getAction(), "Method instrumentalization for " + ((preCondition) ? "pre" : "post") + "-condition " + name + "/" + desc)); visitor.setMethodChange(true); Type types[] = Type.getArgumentTypes(super.methodDesc); //runPreCondition this.visitVarInsn(Opcodes.ALOAD, 0); this.visitMethodInsn(Opcodes.INVOKEVIRTUAL, Type.getObjectType(parent).getInternalName(), "getClass", "()Ljava/lang/Class;"); if (type == null) type = "COMPILED"; this.visitFieldInsn(Opcodes.GETSTATIC, Type.getInternalName(DroolsServiceType.class), type, Type.getDescriptor(DroolsServiceType.class)); this.visitLdcInsn(resourceName); this.visitLdcInsn(error); this.visitVarInsn(Opcodes.ALOAD, 0); this.visitIntInsn(Opcodes.BIPUSH, types.length); this.visitTypeInsn(Opcodes.ANEWARRAY, "java/lang/Object"); int position = 1; for (int i = 0; i < types.length; i++) { this.visitInsn(Opcodes.DUP); this.visitIntInsn(Opcodes.BIPUSH, i); if (types[i].equals(Type.BOOLEAN_TYPE)) { this.visitVarInsn(Opcodes.ILOAD, position); this.visitMethodInsn(Opcodes.INVOKESTATIC, Type.getInternalName(Boolean.class), "valueOf", "(Z)Ljava/lang/Boolean;"); position += 1; } else if (types[i].equals(Type.BYTE_TYPE)) { this.visitTypeInsn(Opcodes.NEW, "java/lang/Byte"); this.visitInsn(Opcodes.DUP); this.visitVarInsn(Opcodes.ILOAD, position); this.visitMethodInsn(Opcodes.INVOKESPECIAL, Type.getInternalName(Byte.class), "<init>", "(B)V"); position += 1; } else if (types[i].equals(Type.CHAR_TYPE)) { this.visitTypeInsn(Opcodes.NEW, "java/lang/Character"); this.visitInsn(Opcodes.DUP); this.visitVarInsn(Opcodes.ILOAD, position); this.visitMethodInsn(Opcodes.INVOKESPECIAL, Type.getInternalName(Character.class), "<init>", "(C)V"); position += 1; } else if (types[i].equals(Type.DOUBLE_TYPE)) { this.visitTypeInsn(Opcodes.NEW, "java/lang/Double"); this.visitInsn(Opcodes.DUP); this.visitVarInsn(Opcodes.DLOAD, position); this.visitMethodInsn(Opcodes.INVOKESPECIAL, Type.getInternalName(Double.class), "<init>", "(D)V"); position += 2; } else if (types[i].equals(Type.FLOAT_TYPE)) { this.visitTypeInsn(Opcodes.NEW, "java/lang/Float"); this.visitInsn(Opcodes.DUP); this.visitVarInsn(Opcodes.FLOAD, position); this.visitMethodInsn(Opcodes.INVOKESPECIAL, Type.getInternalName(Float.class), "<init>", "(F)V"); position += 1; } else if (types[i].equals(Type.INT_TYPE)) { this.visitTypeInsn(Opcodes.NEW, "java/lang/Integer"); this.visitInsn(Opcodes.DUP); this.visitVarInsn(Opcodes.ILOAD, position); this.visitMethodInsn(Opcodes.INVOKESPECIAL, Type.getInternalName(Integer.class), "<init>", "(I)V"); position += 1; } else if (types[i].equals(Type.LONG_TYPE)) { this.visitTypeInsn(Opcodes.NEW, "java/lang/Long"); this.visitInsn(Opcodes.DUP); this.visitVarInsn(Opcodes.LLOAD, position); this.visitMethodInsn(Opcodes.INVOKESPECIAL, Type.getInternalName(Long.class), "<init>", "(J)V"); position += 2; } else if (types[i].equals(Type.SHORT_TYPE)) { this.visitTypeInsn(Opcodes.NEW, "java/lang/Short"); this.visitInsn(Opcodes.DUP); this.visitVarInsn(Opcodes.ILOAD, position); this.visitMethodInsn(Opcodes.INVOKESPECIAL, Type.getInternalName(Short.class), "<init>", "(S)V"); position += 1; } else { this.visitVarInsn(Opcodes.ALOAD, position); position += 1; } this.visitInsn(Opcodes.AASTORE); } if (preCondition) this.visitMethodInsn(Opcodes.INVOKESTATIC, Type.getInternalName(DroolsProvider.class), "runPreCondition", "(Ljava/lang/Class;Lorg/boretti/drools/integration/drools5/DroolsServiceType;Ljava/lang/String;Ljava/lang/Class;Ljava/lang/Object;[Ljava/lang/Object;)V"); else this.visitMethodInsn(Opcodes.INVOKESTATIC, Type.getInternalName(DroolsProvider.class), "runPostCondition", "(Ljava/lang/Class;Lorg/boretti/drools/integration/drools5/DroolsServiceType;Ljava/lang/String;Ljava/lang/Class;Ljava/lang/Object;[Ljava/lang/Object;)V"); }
From source file:org.brutusin.instrumentation.utils.TreeInstructions.java
License:Apache License
public static VarInsnNode getLoadInst(Type type, int position) { int opCode = -1; switch (type.getDescriptor().charAt(0)) { case 'B': opCode = Opcodes.ILOAD;/*from www .j av a 2 s.c o m*/ break; case 'C': opCode = Opcodes.ILOAD; break; case 'D': opCode = Opcodes.DLOAD; break; case 'F': opCode = Opcodes.FLOAD; break; case 'I': opCode = Opcodes.ILOAD; break; case 'J': opCode = Opcodes.LLOAD; break; case 'L': opCode = Opcodes.ALOAD; break; case '[': opCode = Opcodes.ALOAD; break; case 'Z': opCode = Opcodes.ILOAD; break; case 'S': opCode = Opcodes.ILOAD; break; default: throw new ClassFormatError("Invalid method signature: " + type.getDescriptor()); } return new VarInsnNode(opCode, position); }
From source file:org.cacheonix.impl.transformer.ByteInstructionTest.java
License:LGPL
/** * Test method for {@link ByteInstruction#getInstruction(ByteInstruction, Type)} . *//*from w ww .java 2 s . c o m*/ public void testGetInstruction() { final int code = Opcodes.NOP; final ByteInstruction bi = new ByteInstruction(code, ByteInstruction.START_STACK_INDEX); ByteInstruction.getInstruction(bi, Type.INT_TYPE); assertEquals(Opcodes.ILOAD, bi.code); assertEquals(ByteInstruction.START_STACK_INDEX, bi.stackIndex); assertEquals(ByteInstruction.START_STACK_INDEX + 1, bi.nextStackIndex); int stackIndex = bi.nextStackIndex; ByteInstruction.getInstruction(bi, Type.LONG_TYPE); assertEquals(Opcodes.LLOAD, bi.code); assertEquals(stackIndex, bi.stackIndex); assertEquals(stackIndex + 2, bi.nextStackIndex); stackIndex = bi.nextStackIndex; ByteInstruction.getInstruction(bi, Type.DOUBLE_TYPE); assertEquals(Opcodes.DLOAD, bi.code); assertEquals(stackIndex, bi.stackIndex); assertEquals(stackIndex + 2, bi.nextStackIndex); }
From source file:org.decojer.cavaj.readers.asm.ReadMethodVisitor.java
License:Open Source License
@Override public void visitVarInsn(final int opcode, final int var) { T t = null;/*w w w . j a v a 2s.c o m*/ switch (opcode) { /******** * LOAD * ********/ case Opcodes.ALOAD: t = T.REF; // fall through case Opcodes.DLOAD: if (t == null) { t = T.DOUBLE; } // fall through case Opcodes.FLOAD: if (t == null) { t = T.FLOAT; } // fall through case Opcodes.ILOAD: if (t == null) { t = T.AINT; } // fall through case Opcodes.LLOAD: if (t == null) { t = T.LONG; } add(new LOAD(this.ops.size(), opcode, this.line, t, var)); break; /********* * STORE * *********/ case Opcodes.ASTORE: t = T.AREF; // RET allowed too // fall through case Opcodes.DSTORE: if (t == null) { t = T.DOUBLE; } // fall through case Opcodes.FSTORE: if (t == null) { t = T.FLOAT; } // fall through case Opcodes.ISTORE: if (t == null) { t = T.AINT; } // fall through case Opcodes.LSTORE: if (t == null) { t = T.LONG; } add(new STORE(this.ops.size(), opcode, this.line, t, var)); break; /******* * RET * *******/ case Opcodes.RET: { add(new RET(this.ops.size(), opcode, this.line, var)); break; } default: log.warn(getM() + ": Unknown var insn opcode '" + opcode + "'!"); } }
From source file:org.evosuite.graphs.cfg.ASMWrapper.java
License:Open Source License
/** * <p>// w w w.ja va 2 s . c o m * isLocalVarUse * </p> * * @return a boolean. */ public boolean isLocalVariableUse() { return asmNode.getOpcode() == Opcodes.ILOAD || asmNode.getOpcode() == Opcodes.LLOAD || asmNode.getOpcode() == Opcodes.FLOAD || asmNode.getOpcode() == Opcodes.DLOAD || asmNode.getOpcode() == Opcodes.IINC || (asmNode.getOpcode() == Opcodes.ALOAD && !loadsReferenceToThis()); }