Example usage for org.objectweb.asm Opcodes RET

List of usage examples for org.objectweb.asm Opcodes RET

Introduction

In this page you can find the example usage for org.objectweb.asm Opcodes RET.

Prototype

int RET

To view the source code for org.objectweb.asm Opcodes RET.

Click Source Link

Usage

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;//from   w  w w  . ja v  a  2 s  .c o m
        break;
    default:
        successor = true;
        break;
    }
    first = false;
}

From source file:org.jboss.byteman.agent.adapter.RuleGeneratorAdapter.java

License:Open Source License

/**
 * Generates a RET instruction.//  w  ww  .  j av  a 2 s  . co m
 *
 * @param local a local variable identifier, as returned by
 *        {@link org.objectweb.asm.commons.LocalVariablesSorter#newLocal(org.objectweb.asm.Type) newLocal()}.
 */
public void ret(final int local) {
    visitVarInsn(Opcodes.RET, local);
}

From source file:org.mutabilitydetector.checkers.settermethod.AssignmentGuardFinder.java

License:Apache License

private static boolean isConditionCheckInstruction(final AbstractInsnNode insn) {
    final int opcode = insn.getOpcode();
    return AbstractInsnNode.JUMP_INSN == insn.getType() && opcode != Opcodes.GOTO && opcode != Opcodes.JSR
            && opcode != Opcodes.RET;
}

From source file:pku.sei.checkedcoverage.slicing.Slicer.java

License:Creative Commons License

/**
 * select the last location that was not checked, and create new slice criterion for it.
 * remove the relative lines from unchecked lines, until all location are sliced.
 * @return the new created slice location for every class.
 *//*from ww w. j a v  a  2 s .co m*/
public static HashMap<String, TreeSet<Long>> sliceForUnchecked() {
    System.out.println("Trying to add checks");
    HashMap<String, TreeSet<Long>> sliceCreated = new HashMap<String, TreeSet<Long>>();
    HashMap<String, HashSet<Instruction>> uncheckedMap = getUncheckedMap();
    Iterator<String> it = uncheckedMap.keySet().iterator();
    List<String> cris = new ArrayList<String>();
    int crisNr = 0;
    while (it.hasNext()) {
        String key = it.next();
        sliceCreated.put(key, new TreeSet<Long>());
        HashSet<Instruction> insts = uncheckedMap.get(key);
        TreeSet<Integer> unchecked = new TreeSet<Integer>();
        HashMap<Integer, String> critInfoMap = new HashMap<Integer, String>();
        HashMap<Integer, HashSet<String>> varsMap = new HashMap<Integer, HashSet<String>>();
        for (Instruction inst : insts) {
            if (inst.getType().equals(InstructionType.FIELD) || inst.getType().equals(InstructionType.VAR)) {
                unchecked.add(inst.getLineNumber());
                if (!critInfoMap.containsKey(inst.getLineNumber())) {
                    critInfoMap.put(inst.getLineNumber(),
                            inst.getMethod().getReadClass().getName() + "." + inst.getMethod().getName());
                }
                if (!varsMap.containsKey(inst.getLineNumber())) {
                    varsMap.put(inst.getLineNumber(), new HashSet<String>());
                }
                if (inst.getType().equals(InstructionType.FIELD)) {
                    FieldInstruction fieldinst = (FieldInstruction) inst;
                    varsMap.get(inst.getLineNumber()).add(fieldinst.getFieldName());
                } else if (inst.getType().equals(InstructionType.VAR)) {
                    VarInstruction varinst = (VarInstruction) inst;
                    if (varinst.getOpcode() == Opcodes.DSTORE || varinst.getOpcode() == Opcodes.ASTORE
                            || varinst.getOpcode() == Opcodes.LSTORE || varinst.getOpcode() == Opcodes.ISTORE
                            || varinst.getOpcode() == Opcodes.FSTORE || varinst.getOpcode() == Opcodes.RET) {
                        String varname = inst.getMethod().getLocalVariables()[varinst.getLocalVarIndex()]
                                .getName();
                        varsMap.get(inst.getLineNumber()).add(varname);
                    }
                }
            }
        }
        while (!unchecked.isEmpty()) {
            int last = unchecked.last();
            String cri = critInfoMap.get(last) + ":" + last + ":*";
            cris.add(cri);
            System.out.println(++crisNr + " new check(s) added!" + cri);
            unchecked.removeAll(sliceUnchecked(cri));
            sliceCreated.get(key).add((long) last);
            unchecked.remove(last);
        }
    }
    System.out.println("Done!");
    return sliceCreated;
}

From source file:serianalyzer.JVMImpl.java

License:Open Source License

/**
 * @param opcode/*  w w  w .j a va2s  . c om*/
 * @param var
 * @param s
 */
static void handleVarInsn(int opcode, int var, JVMStackState s) {
    Set<BaseType> v;
    switch (opcode) {
    case Opcodes.LLOAD:
    case Opcodes.ILOAD:
    case Opcodes.FLOAD:
    case Opcodes.DLOAD:
    case Opcodes.ALOAD:
        v = s.getVariable(var);
        if (log.isTraceEnabled()) {
            log.trace("LOAD " + opcode + "@" + var + ":" + v); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
        }
        if (v == null || v.isEmpty()) {
            s.push(new BasicVariable(toType(opcode), "unknown " + var, true)); //$NON-NLS-1$
        } else if (v.size() == 1) {
            s.push(v.iterator().next());
        } else {
            Set<BaseType> alts = new HashSet<>();
            for (BaseType o : v) {
                if (o instanceof MultiAlternatives && !((MultiAlternatives) o).getAlternatives().isEmpty()) {
                    alts.addAll(((MultiAlternatives) o).getAlternatives());
                } else {
                    alts.add(o);
                }
            }
            s.push(new MultiAlternatives(alts));
        }
        break;
    case Opcodes.LSTORE:
    case Opcodes.ISTORE:
    case Opcodes.FSTORE:
    case Opcodes.DSTORE:
    case Opcodes.ASTORE:
        s.getVariable(var).add(s.pop());
        break;
    case Opcodes.RET:
        break;
    default:
        log.warn("Unimplemented opcode " + opcode); //$NON-NLS-1$
    }
}