List of usage examples for org.objectweb.asm Opcodes DRETURN
int DRETURN
To view the source code for org.objectweb.asm Opcodes DRETURN.
Click Source Link
From source file:org.jacoco.core.internal.flow.LabelFlowAnalyzer.java
License:Open Source License
@Override public void visitInsn(final int opcode) { switch (opcode) { case Opcodes.RET: throw new AssertionError("Subroutines not supported."); case Opcodes.IRETURN: case Opcodes.LRETURN: case Opcodes.FRETURN: case Opcodes.DRETURN: case Opcodes.ARETURN: case Opcodes.RETURN: case Opcodes.ATHROW: successor = false;//ww w .j av a 2s. c om break; default: successor = true; break; } first = false; }
From source file:org.jacoco.core.internal.flow.MethodProbesAdapter.java
License:Open Source License
@Override public void visitInsn(final int opcode) { switch (opcode) { case Opcodes.IRETURN: case Opcodes.LRETURN: case Opcodes.FRETURN: case Opcodes.DRETURN: case Opcodes.ARETURN: case Opcodes.RETURN: case Opcodes.ATHROW: probesVisitor.visitInsnWithProbe(opcode, idGenerator.nextId()); break;/*from ww w .ja va 2s .c om*/ default: probesVisitor.visitInsn(opcode); break; } }
From source file:org.jacoco.core.internal.instr.FrameTracker.java
License:Open Source License
@Override public void visitInsn(final int opcode) { final Object t1, t2, t3, t4; switch (opcode) { case Opcodes.NOP: case Opcodes.RETURN: break;/*from www . ja v a 2 s. co m*/ case Opcodes.ARETURN: case Opcodes.ATHROW: case Opcodes.FRETURN: case Opcodes.IRETURN: case Opcodes.MONITORENTER: case Opcodes.MONITOREXIT: case Opcodes.POP: pop(1); break; case Opcodes.DRETURN: case Opcodes.LRETURN: case Opcodes.POP2: pop(2); break; case Opcodes.AASTORE: case Opcodes.BASTORE: case Opcodes.CASTORE: case Opcodes.FASTORE: case Opcodes.IASTORE: case Opcodes.SASTORE: pop(3); break; case Opcodes.LASTORE: case Opcodes.DASTORE: pop(4); break; case Opcodes.ICONST_M1: case Opcodes.ICONST_0: case Opcodes.ICONST_1: case Opcodes.ICONST_2: case Opcodes.ICONST_3: case Opcodes.ICONST_4: case Opcodes.ICONST_5: push(Opcodes.INTEGER); break; case Opcodes.ARRAYLENGTH: case Opcodes.F2I: case Opcodes.I2B: case Opcodes.I2C: case Opcodes.I2S: case Opcodes.INEG: pop(1); push(Opcodes.INTEGER); break; case Opcodes.BALOAD: case Opcodes.CALOAD: case Opcodes.D2I: case Opcodes.FCMPG: case Opcodes.FCMPL: case Opcodes.IADD: case Opcodes.IALOAD: case Opcodes.IAND: case Opcodes.IDIV: case Opcodes.IMUL: case Opcodes.IOR: case Opcodes.IREM: case Opcodes.ISHL: case Opcodes.ISHR: case Opcodes.ISUB: case Opcodes.IUSHR: case Opcodes.IXOR: case Opcodes.L2I: case Opcodes.SALOAD: pop(2); push(Opcodes.INTEGER); break; case Opcodes.DCMPG: case Opcodes.DCMPL: case Opcodes.LCMP: pop(4); push(Opcodes.INTEGER); break; case Opcodes.FCONST_0: case Opcodes.FCONST_1: case Opcodes.FCONST_2: push(Opcodes.FLOAT); break; case Opcodes.FNEG: case Opcodes.I2F: pop(1); push(Opcodes.FLOAT); break; case Opcodes.D2F: case Opcodes.FADD: case Opcodes.FALOAD: case Opcodes.FDIV: case Opcodes.FMUL: case Opcodes.FREM: case Opcodes.FSUB: case Opcodes.L2F: pop(2); push(Opcodes.FLOAT); break; case Opcodes.LCONST_0: case Opcodes.LCONST_1: push(Opcodes.LONG); push(Opcodes.TOP); break; case Opcodes.F2L: case Opcodes.I2L: pop(1); push(Opcodes.LONG); push(Opcodes.TOP); break; case Opcodes.D2L: case Opcodes.LALOAD: case Opcodes.LNEG: pop(2); push(Opcodes.LONG); push(Opcodes.TOP); break; case Opcodes.LSHL: case Opcodes.LSHR: case Opcodes.LUSHR: pop(3); push(Opcodes.LONG); push(Opcodes.TOP); break; case Opcodes.LADD: case Opcodes.LAND: case Opcodes.LDIV: case Opcodes.LMUL: case Opcodes.LOR: case Opcodes.LREM: case Opcodes.LSUB: case Opcodes.LXOR: pop(4); push(Opcodes.LONG); push(Opcodes.TOP); break; case Opcodes.DCONST_0: case Opcodes.DCONST_1: push(Opcodes.DOUBLE); push(Opcodes.TOP); break; case Opcodes.F2D: case Opcodes.I2D: pop(1); push(Opcodes.DOUBLE); push(Opcodes.TOP); break; case Opcodes.DALOAD: case Opcodes.DNEG: case Opcodes.L2D: pop(2); push(Opcodes.DOUBLE); push(Opcodes.TOP); break; case Opcodes.DADD: case Opcodes.DDIV: case Opcodes.DMUL: case Opcodes.DREM: case Opcodes.DSUB: pop(4); push(Opcodes.DOUBLE); push(Opcodes.TOP); break; case Opcodes.ACONST_NULL: push(Opcodes.NULL); break; case Opcodes.AALOAD: pop(1); t1 = pop(); push(Type.getType(((String) t1).substring(1))); break; case Opcodes.DUP: t1 = pop(); push(t1); push(t1); break; case Opcodes.DUP_X1: t1 = pop(); t2 = pop(); push(t1); push(t2); push(t1); break; case Opcodes.DUP_X2: t1 = pop(); t2 = pop(); t3 = pop(); push(t1); push(t3); push(t2); push(t1); break; case Opcodes.DUP2: t1 = pop(); t2 = pop(); push(t2); push(t1); push(t2); push(t1); break; case Opcodes.DUP2_X1: t1 = pop(); t2 = pop(); t3 = pop(); push(t2); push(t1); push(t3); push(t2); push(t1); break; case Opcodes.DUP2_X2: t1 = pop(); t2 = pop(); t3 = pop(); t4 = pop(); push(t2); push(t1); push(t4); push(t3); push(t2); push(t1); break; case Opcodes.SWAP: t1 = pop(); t2 = pop(); push(t1); push(t2); break; default: throw new IllegalArgumentException(); } mv.visitInsn(opcode); }
From source file:org.jacoco.core.test.validation.java5.StructuredLockingTest.java
License:Open Source License
private void assertStructuredLocking(String owner, MethodNode mn) throws Exception { Analyzer<BasicValue> analyzer = new Analyzer<BasicValue>(new BasicInterpreter()) { @Override//w w w . j a va 2 s . c o m protected Frame<BasicValue> newFrame(int nLocals, int nStack) { return new LockFrame(nLocals, nStack); } @Override protected Frame<BasicValue> newFrame(Frame<? extends BasicValue> src) { return new LockFrame(src); } }; Frame<BasicValue>[] frames = analyzer.analyze(owner, mn); // Make sure no locks are left when method exits: for (int i = 0; i < frames.length; i++) { AbstractInsnNode insn = mn.instructions.get(i); switch (insn.getOpcode()) { case Opcodes.IRETURN: case Opcodes.LRETURN: case Opcodes.FRETURN: case Opcodes.DRETURN: case Opcodes.ARETURN: case Opcodes.RETURN: ((LockFrame) frames[i]).assertNoLock("Exit with lock"); break; case Opcodes.ATHROW: List<TryCatchBlockNode> handlers = analyzer.getHandlers(i); if (handlers == null || handlers.isEmpty()) { ((LockFrame) frames[i]).assertNoLock("Exit with lock"); } break; } } // Only instructions protected by a catch-all handler can hold locks: for (int i = 0; i < frames.length; i++) { AbstractInsnNode insn = mn.instructions.get(i); if (insn.getOpcode() > 0) { boolean catchAll = false; List<TryCatchBlockNode> handlers = analyzer.getHandlers(i); if (handlers != null) { for (TryCatchBlockNode node : handlers) { catchAll |= node.type == null; } } if (!catchAll) { ((LockFrame) frames[i]).assertNoLock("No handlers for insn with lock"); } } } }
From source file:org.jboss.byteman.agent.adapter.RuleTriggerMethodAdapter.java
License:Open Source License
@Override public void visitInsn(int opcode) { super.visitInsn(opcode); // look for interesting instructions which need inserting into the CFG switch (opcode) { case Opcodes.IRETURN: case Opcodes.LRETURN: case Opcodes.FRETURN: case Opcodes.DRETURN: case Opcodes.ARETURN: case Opcodes.RETURN: case Opcodes.ATHROW: { // add this instruction to the current block and then start a new current block cfg.add(opcode);/*from w ww .ja v a 2s .c o m*/ Label newStart = super.newLabel(); // must call split before visiting the label cfg.split(newStart); visitLabel(newStart); } break; case Opcodes.MONITORENTER: case Opcodes.MONITOREXIT: { // just add this instruction to the current block cfg.add(opcode); } break; default: { cfg.add(opcode); } } }
From source file:org.mbte.groovypp.compiler.bytecode.BytecodeExpr.java
License:Apache License
public static void doReturn(MethodVisitor mv, ClassNode returnType) { if (returnType == double_TYPE) { mv.visitInsn(Opcodes.DRETURN); } else if (returnType == float_TYPE) { mv.visitInsn(Opcodes.FRETURN);/* w w w . j a va2s . c o m*/ } else if (returnType == long_TYPE) { mv.visitInsn(Opcodes.LRETURN); } else if (returnType == boolean_TYPE || returnType == char_TYPE || returnType == byte_TYPE || returnType == int_TYPE || returnType == short_TYPE) { //byte,short,boolean,int are all IRETURN mv.visitInsn(Opcodes.IRETURN); } else if (returnType == VOID_TYPE) { mv.visitInsn(Opcodes.RETURN); } else { mv.visitInsn(Opcodes.ARETURN); } }
From source file:org.openquark.cal.internal.javamodel.AsmJavaBytecodeGenerator.java
License:Open Source License
/** * @param type/* w ww .jav a 2s. co m*/ * @return the RETURN, IRETURN,... op code, depending on type. */ private static int getReturnOpCode(JavaTypeName type) { switch (type.getTag()) { case JavaTypeName.VOID_TAG: return Opcodes.RETURN; case JavaTypeName.BOOLEAN_TAG: case JavaTypeName.BYTE_TAG: case JavaTypeName.SHORT_TAG: case JavaTypeName.CHAR_TAG: case JavaTypeName.INT_TAG: return Opcodes.IRETURN; case JavaTypeName.LONG_TAG: return Opcodes.LRETURN; case JavaTypeName.DOUBLE_TAG: return Opcodes.DRETURN; case JavaTypeName.FLOAT_TAG: return Opcodes.FRETURN; case JavaTypeName.ARRAY_TAG: case JavaTypeName.OBJECT_TAG: return Opcodes.ARETURN; default: { throw new IllegalArgumentException("invalid type: " + type); } } }
From source file:org.pitest.mutationtest.engine.gregor.mutators.ReturnValsMutator.java
License:Apache License
private static ZeroOperandMutation dreturnMutation() { return new ZeroOperandMutation() { public void apply(final int opCode, final MethodVisitor mv) { // Strategy translated from jumble BCEL code // The following is complicated by the problem of NaNs. By default // the new value is -(x + 1), but this doesn't work for NaNs. But // for a NaN x != x is true, and we use this to detect them. mv.visitInsn(Opcodes.DUP2);/* w w w. ja v a2 s . c o m*/ mv.visitInsn(Opcodes.DUP2); mv.visitInsn(Opcodes.DCMPG); final Label l1 = new Label(); mv.visitJumpInsn(Opcodes.IFEQ, l1); mv.visitInsn(Opcodes.POP2); mv.visitInsn(Opcodes.DCONST_0); mv.visitLabel(l1); mv.visitInsn(Opcodes.DCONST_1); mv.visitInsn(Opcodes.DADD); mv.visitInsn(Opcodes.DNEG); mv.visitInsn(Opcodes.DRETURN); } public String decribe(final int opCode, final MethodInfo methodInfo) { return "replaced return of double value with -(x + 1) for " + methodInfo.getDescription(); } }; }
From source file:org.sonar.java.bytecode.se.BytecodeEGWalkerExecuteTest.java
License:Open Source License
@Test public void test_xReturn() throws Exception { SymbolicValue returnValue = new SymbolicValue(); int[] opcodes = { Opcodes.IRETURN, Opcodes.LRETURN, Opcodes.FRETURN, Opcodes.DRETURN, Opcodes.ARETURN }; for (int opcode : opcodes) { ProgramState programState = execute(new Instruction(opcode), ProgramState.EMPTY_STATE.stackValue(returnValue)); assertThat(programState.peekValue()).isNull(); assertThat(programState.exitValue()).isEqualTo(returnValue); }/*from w w w . j av a 2s .com*/ }
From source file:org.spongepowered.despector.emitter.bytecode.statement.BytecodeReturnEmitter.java
License:Open Source License
@Override public void emit(BytecodeEmitterContext ctx, Return stmt, boolean semicolon) { MethodVisitor mv = ctx.getMethodVisitor(); if (!stmt.getValue().isPresent()) { mv.visitInsn(Opcodes.RETURN);//from w w w . ja v a 2 s . c o m } else { ctx.updateStack(-1); Instruction insn = stmt.getValue().get(); ctx.emitInstruction(insn, ctx.getMethod().getReturnType()); TypeSignature ret = ctx.getMethod().getReturnType(); if (ret == ClassTypeSignature.INT || ret == ClassTypeSignature.BOOLEAN || ret == ClassTypeSignature.BYTE || ret == ClassTypeSignature.SHORT || ret == ClassTypeSignature.CHAR) { mv.visitInsn(Opcodes.IRETURN); } else if (ret == ClassTypeSignature.LONG) { mv.visitInsn(Opcodes.LRETURN); } else if (ret == ClassTypeSignature.FLOAT) { mv.visitInsn(Opcodes.FRETURN); } else if (ret == ClassTypeSignature.DOUBLE) { mv.visitInsn(Opcodes.DRETURN); } else { mv.visitInsn(Opcodes.ARETURN); } } }