List of usage examples for org.objectweb.asm Opcodes FSTORE
int FSTORE
To view the source code for org.objectweb.asm Opcodes FSTORE.
Click Source Link
From source file:org.jacoco.core.internal.flow.FrameSnapshotTest.java
License:Open Source License
@Test public void should_combine_slots_when_doube_or_long_types_are_given() { analyzer.visitInsn(Opcodes.DCONST_0); analyzer.visitVarInsn(Opcodes.DSTORE, 1); analyzer.visitInsn(Opcodes.FCONST_0); analyzer.visitVarInsn(Opcodes.FSTORE, 3); analyzer.visitInsn(Opcodes.ICONST_0); analyzer.visitInsn(Opcodes.LCONST_0); analyzer.visitInsn(Opcodes.ICONST_0); analyzer.visitInsn(Opcodes.DCONST_0); frame = FrameSnapshot.create(analyzer, 0); final Object[] vars = arr("Foo", Opcodes.DOUBLE, Opcodes.FLOAT); final Object[] stack = arr(Opcodes.INTEGER, Opcodes.LONG, Opcodes.INTEGER, Opcodes.DOUBLE); expectedVisitor.visitFrame(Opcodes.F_FULL, 3, vars, 4, stack); }
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;// 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.jacoco.core.internal.instr.ProbeInserterTest.java
License:Open Source License
@Test public void testVisitVarIns() { ProbeInserter pi = new ProbeInserter(0, "(II)V", actualVisitor, arrayStrategy); pi.visitVarInsn(Opcodes.ALOAD, 0);//from w w w.j a va 2 s .c o m pi.visitVarInsn(Opcodes.ILOAD, 1); pi.visitVarInsn(Opcodes.ILOAD, 2); pi.visitVarInsn(Opcodes.ISTORE, 3); pi.visitVarInsn(Opcodes.FSTORE, 4); // Argument variables stay at the same position: expectedVisitor.visitVarInsn(Opcodes.ALOAD, 0); expectedVisitor.visitVarInsn(Opcodes.ILOAD, 1); expectedVisitor.visitVarInsn(Opcodes.ILOAD, 2); // Local variables are shifted by one: expectedVisitor.visitVarInsn(Opcodes.ISTORE, 4); expectedVisitor.visitVarInsn(Opcodes.FSTORE, 5); }
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/* www. j a v a 2s . c o 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 {/* www. j a va 2 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); }//from ww w. j av a 2s. co m 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:/* ww w .j a va 2 s .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./* w w w. j av a2 s .co m*/ 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); } } }
From source file:org.pitest.mutationtest.engine.gregor.mutators.experimental.extended.AODMutator2.java
License:Apache License
@Override public void visitInsn(int opcode) { switch (opcode) { case Opcodes.IADD: case Opcodes.ISUB: case Opcodes.IMUL: case Opcodes.IDIV: case Opcodes.IREM: if (this.shouldMutate(OpcodeToType.typeOfOpcode(opcode))) { int storage = this.newLocal(Type.INT_TYPE); mv.visitVarInsn(Opcodes.ISTORE, storage); mv.visitInsn(Opcodes.POP);//from w w w.j a v a2 s .co m mv.visitVarInsn(Opcodes.ILOAD, storage); /* * Alternative : mv.visitInsn(Opcodes.SWAP); * mv.visitInsn(Opcodes.POP); * mv.visitVarInsn(Opcodes.ILOAD,storage); */ } else { mv.visitInsn(opcode); } break; case Opcodes.FADD: case Opcodes.FSUB: case Opcodes.FMUL: case Opcodes.FDIV: case Opcodes.FREM: if (this.shouldMutate(OpcodeToType.typeOfOpcode(opcode))) { int storage = this.newLocal(Type.FLOAT_TYPE); mv.visitVarInsn(Opcodes.FSTORE, storage); mv.visitInsn(Opcodes.POP); mv.visitVarInsn(Opcodes.FLOAD, storage); } else { mv.visitInsn(opcode); } break; case Opcodes.LADD: case Opcodes.LSUB: case Opcodes.LMUL: case Opcodes.LDIV: case Opcodes.LREM: if (this.shouldMutate(OpcodeToType.typeOfOpcode(opcode))) { int storage = this.newLocal(Type.LONG_TYPE); mv.visitVarInsn(Opcodes.LSTORE, storage); mv.visitInsn(Opcodes.POP2); mv.visitVarInsn(Opcodes.LLOAD, storage); } else { mv.visitInsn(opcode); } break; case Opcodes.DADD: case Opcodes.DSUB: case Opcodes.DMUL: case Opcodes.DDIV: case Opcodes.DREM: if (this.shouldMutate(OpcodeToType.typeOfOpcode(opcode))) { int storage = this.newLocal(Type.DOUBLE_TYPE); mv.visitVarInsn(Opcodes.DSTORE, storage); mv.visitInsn(Opcodes.POP2); mv.visitVarInsn(Opcodes.DLOAD, storage); } else { mv.visitInsn(opcode); } break; default: mv.visitInsn(opcode); break; } }
From source file:org.pitest.mutationtest.engine.gregor.mutators.experimental.extended.UOIMutator1.java
License:Apache License
@Override public void visitVarInsn(int opcode, int var) { mv.visitVarInsn(opcode, var); switch (opcode) { case Opcodes.ILOAD: if (this.shouldMutate("Incremented (a++) integer local variable number " + var)) { mv.visitIincInsn(var, 1); }/*from w ww . j a v a 2 s .c om*/ break; case Opcodes.FLOAD: if (this.shouldMutate("Incremented (a++) float local variable number " + var)) { mv.visitInsn(Opcodes.DUP); mv.visitInsn(Opcodes.FCONST_1); mv.visitInsn(Opcodes.FADD); mv.visitVarInsn(Opcodes.FSTORE, var); } break; case Opcodes.LLOAD: if (this.shouldMutate("Incremented (a++) long local variable number " + var)) { mv.visitInsn(Opcodes.DUP2); mv.visitInsn(Opcodes.LCONST_1); mv.visitInsn(Opcodes.LADD); mv.visitVarInsn(Opcodes.LSTORE, var); } break; case Opcodes.DLOAD: if (this.shouldMutate("Incremented (a++) double local variable number " + var)) { mv.visitInsn(Opcodes.DUP2); mv.visitInsn(Opcodes.DCONST_1); mv.visitInsn(Opcodes.DADD); mv.visitVarInsn(Opcodes.DSTORE, var); } break; default: break; } }