List of usage examples for org.objectweb.asm Opcodes LSTORE
int LSTORE
To view the source code for org.objectweb.asm Opcodes LSTORE.
Click Source Link
From source file:org.evosuite.instrumentation.mutation.ReplaceBitwiseOperator.java
License:Open Source License
/** * <p>getInfectionDistance</p> * * @param opcodeOrig a int.//from w ww .jav a 2s . c o m * @param opcodeNew a int. * @return a {@link org.objectweb.asm.tree.InsnList} object. */ public InsnList getInfectionDistance(int opcodeOrig, int opcodeNew) { InsnList distance = new InsnList(); if (opcodesInt.contains(opcodeOrig)) { distance.add(new InsnNode(Opcodes.DUP2)); distance.add(new LdcInsnNode(opcodeOrig)); distance.add(new LdcInsnNode(opcodeNew)); distance.add(new MethodInsnNode(Opcodes.INVOKESTATIC, PackageInfo.getNameWithSlash(ReplaceBitwiseOperator.class), "getInfectionDistanceInt", "(IIII)D", false)); } else if (opcodesIntShift.contains(opcodeOrig)) { distance.add(new InsnNode(Opcodes.DUP2)); distance.add(new LdcInsnNode(opcodeOrig)); distance.add(new LdcInsnNode(opcodeNew)); distance.add(new MethodInsnNode(Opcodes.INVOKESTATIC, PackageInfo.getNameWithSlash(ReplaceBitwiseOperator.class), "getInfectionDistanceInt", "(IIII)D", false)); } else if (opcodesLong.contains(opcodeOrig)) { distance.add(new VarInsnNode(Opcodes.LSTORE, numVariable)); distance.add(new InsnNode(Opcodes.DUP2)); distance.add(new VarInsnNode(Opcodes.LLOAD, numVariable)); distance.add(new InsnNode(Opcodes.DUP2_X2)); distance.add(new LdcInsnNode(opcodeOrig)); distance.add(new LdcInsnNode(opcodeNew)); distance.add(new MethodInsnNode(Opcodes.INVOKESTATIC, PackageInfo.getNameWithSlash(ReplaceBitwiseOperator.class), "getInfectionDistanceLong", "(JJII)D", false)); numVariable += 2; } else if (opcodesLongShift.contains(opcodeOrig)) { distance.add(new VarInsnNode(Opcodes.ISTORE, numVariable)); distance.add(new InsnNode(Opcodes.DUP2)); distance.add(new VarInsnNode(Opcodes.ILOAD, numVariable)); distance.add(new InsnNode(Opcodes.DUP_X2)); distance.add(new LdcInsnNode(opcodeOrig)); distance.add(new LdcInsnNode(opcodeNew)); distance.add(new MethodInsnNode(Opcodes.INVOKESTATIC, PackageInfo.getNameWithSlash(ReplaceBitwiseOperator.class), "getInfectionDistanceLong", "(JIII)D", false)); numVariable += 1; } return distance; }
From source file:org.glassfish.pfl.tf.spi.Util.java
License:Open Source License
public void initLocal(MethodVisitor mv, LocalVariableNode var) { info(2, "Initializing variable " + var); Type type = Type.getType(var.desc); switch (type.getSort()) { case Type.BYTE: case Type.BOOLEAN: case Type.CHAR: case Type.SHORT: case Type.INT: mv.visitInsn(Opcodes.ICONST_0);//from w w w.ja v a 2 s .c o m mv.visitVarInsn(Opcodes.ISTORE, var.index); break; case Type.LONG: mv.visitInsn(Opcodes.LCONST_0); mv.visitVarInsn(Opcodes.LSTORE, var.index); break; case Type.FLOAT: mv.visitInsn(Opcodes.FCONST_0); mv.visitVarInsn(Opcodes.FSTORE, var.index); break; case Type.DOUBLE: mv.visitInsn(Opcodes.DCONST_0); mv.visitVarInsn(Opcodes.DSTORE, var.index); break; default: mv.visitInsn(Opcodes.ACONST_NULL); mv.visitVarInsn(Opcodes.ASTORE, var.index); } }
From source file:org.glassfish.pfl.tf.spi.Util.java
License:Open Source License
public void storeFromXReturn(MethodVisitor mv, int returnOpcode, LocalVariableNode holder) { switch (returnOpcode) { case Opcodes.RETURN: // NOP// w ww .j a va2s.c om break; case Opcodes.ARETURN: mv.visitVarInsn(Opcodes.ASTORE, holder.index); break; case Opcodes.IRETURN: mv.visitVarInsn(Opcodes.ISTORE, holder.index); break; case Opcodes.LRETURN: mv.visitVarInsn(Opcodes.LSTORE, holder.index); break; case Opcodes.FRETURN: mv.visitVarInsn(Opcodes.FSTORE, holder.index); break; case Opcodes.DRETURN: mv.visitVarInsn(Opcodes.DSTORE, holder.index); break; } }
From source file:org.iobserve.mobile.instrument.bytecode.SensorBytecodeInstrumenter.java
License:Apache License
/** * {@inheritDoc}/* w w w .j a va2 s .c om*/ */ @Override public void onMethodEnter(final String owner, final String name, final String desc, final AdviceAdapter parent, final MethodVisitor mv) { // add sensor call mv.visitLdcInsn(sensor); mv.visitLdcInsn(name + desc); mv.visitLdcInsn(owner); mv.visitMethodInsn(Opcodes.INVOKESTATIC, ANDROIDAGENT_TYPE.getInternalName(), enterBodyMethod.getName(), enterBodyType.getDescriptor(), false); index = parent.newLocal(Type.LONG_TYPE); mv.visitVarInsn(Opcodes.LSTORE, index); }
From source file:org.jacoco.core.internal.instr.FrameTracker.java
License:Open Source License
@Override public void visitVarInsn(final int opcode, final int var) { final Object t; switch (opcode) { case Opcodes.ALOAD: push(get(var)); break;//from w w w. j av a 2 s . c om case Opcodes.ILOAD: push(Opcodes.INTEGER); break; case Opcodes.FLOAD: push(Opcodes.FLOAT); break; case Opcodes.LLOAD: push(Opcodes.LONG); push(Opcodes.TOP); break; case Opcodes.DLOAD: push(Opcodes.DOUBLE); push(Opcodes.TOP); break; case Opcodes.ASTORE: case Opcodes.ISTORE: case Opcodes.FSTORE: t = pop(); set(var, t); break; case Opcodes.LSTORE: case Opcodes.DSTORE: pop(1); t = pop(); set(var, t); set(var + 1, Opcodes.TOP); break; default: throw new IllegalArgumentException(); } mv.visitVarInsn(opcode, var); }
From source file:org.jboss.byteman.agent.adapter.RuleGeneratorAdapter.java
License:Open Source License
/** * override this so we can see track which local var slots are in use and avoid overwriting them * @param opcode//from w w w. jav a 2 s . co m * @param var */ public void visitVarInsn(final int opcode, final int var) { if (var >= nextLocal || localTypes.get(var) == null) { int size = 1; Type type = null; switch (opcode) { case Opcodes.ISTORE: type = Type.INT_TYPE; break; case Opcodes.LSTORE: type = Type.LONG_TYPE; size = 2; break; case Opcodes.FSTORE: type = Type.FLOAT_TYPE; break; case Opcodes.DSTORE: type = Type.DOUBLE_TYPE; size = 2; break; case Opcodes.ASTORE: // we don't know exactly what type this is but at least we know it is an object { String name = getTriggerClassName().replace('.', '/'); type = Type.getType("L" + name + ";"); } // type = Type.getType(Object.class); break; } if (var < nextLocal) { // just fill in the missing type localTypes.set(var, type); } else { // we may not have seen some of the locals so leave a blank spot for them in the types array for (int i = nextLocal; i < var; i++) { localTypes.add(null); } // now add entry for var localTypes.add(type); if (size > 1) { localTypes.add(null); } nextLocal = var + size; if (nextLocal > localHighWater) { localHighWater = nextLocal; } } } super.visitVarInsn(opcode, var); }
From source file:org.mbte.groovypp.compiler.bytecode.BytecodeExpr.java
License:Apache License
public static void store(ClassNode type, int idx, MethodVisitor mv) { if (type == double_TYPE) { mv.visitVarInsn(Opcodes.DSTORE, idx); } else if (type == float_TYPE) { mv.visitVarInsn(Opcodes.FSTORE, idx); } else if (type == long_TYPE) { mv.visitVarInsn(Opcodes.LSTORE, idx); } else if (type == boolean_TYPE || type == char_TYPE || type == byte_TYPE || type == int_TYPE || type == short_TYPE) { mv.visitVarInsn(Opcodes.ISTORE, idx); } else {/* ww w.j a va2 s . c o m*/ mv.visitVarInsn(Opcodes.ASTORE, idx); } }
From source file:org.mbte.groovypp.compiler.StaticCompiler.java
License:Apache License
private void tailRecursive(ResolvedMethodBytecodeExpr resolvedMethodBytecodeExpr) { Parameter[] parameters = methodNode.getParameters(); int varIndex = methodNode.isStatic() ? 0 : 1; if (varIndex != 0) { resolvedMethodBytecodeExpr.getObject().visit(mv); }// w w w .j a va2 s . c om for (int i = 0; i != parameters.length; ++i) { BytecodeExpr be = (BytecodeExpr) resolvedMethodBytecodeExpr.getBargs().getExpressions().get(i); be.visit(mv); final ClassNode paramType = parameters[i].getType(); final ClassNode type = be.getType(); BytecodeExpr.box(type, mv); BytecodeExpr.cast(TypeUtil.wrapSafely(type), TypeUtil.wrapSafely(paramType), mv); BytecodeExpr.unbox(paramType, mv); varIndex += (paramType == ClassHelper.long_TYPE || paramType == ClassHelper.double_TYPE) ? 2 : 1; } for (int i = parameters.length - 1; i >= 0; --i) { final ClassNode paramType = parameters[i].getType(); varIndex -= (paramType == ClassHelper.long_TYPE || paramType == ClassHelper.double_TYPE) ? 2 : 1; if (paramType == double_TYPE) { mv.visitVarInsn(Opcodes.DSTORE, varIndex); } else if (paramType == float_TYPE) { mv.visitVarInsn(Opcodes.FSTORE, varIndex); } else if (paramType == long_TYPE) { mv.visitVarInsn(Opcodes.LSTORE, varIndex); } else if (paramType == boolean_TYPE || paramType == char_TYPE || paramType == byte_TYPE || paramType == int_TYPE || paramType == short_TYPE) { mv.visitVarInsn(Opcodes.ISTORE, varIndex); } else { mv.visitVarInsn(Opcodes.ASTORE, varIndex); } } if (!methodNode.isStatic()) { mv.visitVarInsn(ASTORE, 0); } mv.visitJumpInsn(GOTO, startLabel); return; }
From source file:org.mutabilitydetector.checkers.settermethod.EffectiveAssignmentInsnVerifier.java
License:Apache License
private static boolean isAliasStoreInstruction(final AbstractInsnNode insn, final int aliasLocalVariable) { switch (insn.getOpcode()) { case Opcodes.ISTORE: case Opcodes.LSTORE: case Opcodes.FSTORE: case Opcodes.DSTORE: case Opcodes.ASTORE: final VarInsnNode varInsnNode = (VarInsnNode) insn; return aliasLocalVariable == varInsnNode.var; default://from ww w. j ava2s . c o m return false; } }
From source file:org.openquark.cal.internal.javamodel.AsmJavaBytecodeGenerator.java
License:Open Source License
private static int getStoreOpCode(JavaTypeName varType) { //ASM automatically handles replacing ISTORE 0, ISTORE 1, ISTORE 2 and ISTORE 3 by the special //0 argument op codes ISTORE_0, ISTORE_1, ISTORE_2, and ISTORE_3 and similarly for the other //types./*from w w w. j a va 2 s.c om*/ switch (varType.getTag()) { case JavaTypeName.VOID_TAG: throw new IllegalArgumentException("Cannot load a local variable of void type."); case JavaTypeName.BOOLEAN_TAG: case JavaTypeName.BYTE_TAG: case JavaTypeName.SHORT_TAG: case JavaTypeName.CHAR_TAG: case JavaTypeName.INT_TAG: return Opcodes.ISTORE; case JavaTypeName.LONG_TAG: return Opcodes.LSTORE; case JavaTypeName.DOUBLE_TAG: return Opcodes.DSTORE; case JavaTypeName.FLOAT_TAG: return Opcodes.FSTORE; case JavaTypeName.ARRAY_TAG: case JavaTypeName.OBJECT_TAG: return Opcodes.ASTORE; default: { throw new IllegalArgumentException("Cannot load a local variable of type " + varType); } } }