Java 类org.apache.bcel.generic.ARETURN 实例源码

项目:Android_Code_Arbiter    文件:TaintFrameModelingVisitor.java   
@Override
public void visitARETURN(ARETURN obj) {
    try {
        Taint returnTaint = getFrame().getTopValue();
        Taint currentTaint = analyzedMethodConfig.getOutputTaint();
        analyzedMethodConfig.setOuputTaint(Taint.merge(returnTaint, currentTaint));
    } catch (DataflowAnalysisException ex) {
        throw new InvalidBytecodeException("empty stack before reference return", ex);
    }
    handleNormalInstruction(obj);
}
项目:findbugs-all-the-bugs    文件:ResourceValueFrameModelingVisitor.java   
@Override
public void visitARETURN(ARETURN ins) {
    try {
        ResourceValueFrame frame = getFrame();
        ResourceValue topValue = frame.getTopValue();
        if (topValue.equals(ResourceValue.instance()))
            frame.setStatus(ResourceValueFrame.ESCAPED);
    } catch (DataflowAnalysisException e) {
        throw new InvalidBytecodeException("Stack underflow", e);
    }

    handleNormalInstruction(ins);
}
项目:FindBug-for-Domino-Designer    文件:ResourceValueFrameModelingVisitor.java   
@Override
public void visitARETURN(ARETURN ins) {
    try {
        ResourceValueFrame frame = getFrame();
        ResourceValue topValue = frame.getTopValue();
        if (topValue.equals(ResourceValue.instance()))
            frame.setStatus(ResourceValueFrame.ESCAPED);
    } catch (DataflowAnalysisException e) {
        throw new InvalidBytecodeException("Stack underflow", e);
    }

    handleNormalInstruction(ins);
}
项目:cn1    文件:JavaByteCodeOutputProcess.java   
@SuppressWarnings("unused")
// Called using reflection
private Instruction createInstructionAreturn(Element inst) {
    return new ARETURN();
}
项目:findbugs-all-the-bugs    文件:UnconditionalValueDerefAnalysis.java   
@Override
public void transferInstruction(InstructionHandle handle, BasicBlock basicBlock, UnconditionalValueDerefSet fact)
        throws DataflowAnalysisException {

    Instruction instruction = handle.getInstruction();
    if (fact.isTop())
        return;
    Location location = new Location(handle, basicBlock);

    // If this is a call to an assertion method,
    // change the dataflow value to be TOP.
    // We don't want to report future derefs that would
    // be guaranteed only if the assertion methods
    // returns normally.
    // TODO: at some point, evaluate whether we should revisit this
    if (isAssertion(handle) // || handle.getInstruction() instanceof ATHROW
    ) {
        if (DEBUG)
            System.out.println("MAKING BOTTOM0 AT: " + location);
        fact.clear();
        return;
    }

    // Get value number frame
    ValueNumberFrame vnaFrame = vnaDataflow.getFactAtLocation(location);
    if (!vnaFrame.isValid()) {
        if (DEBUG)
            System.out.println("MAKING TOP1 AT: " + location);
        // Probably dead code.
        // Assume this location can't be reached.
        makeFactTop(fact);
        return;
    }
    if (isNullCheck(handle, methodGen.getConstantPool())) {
        handleNullCheck(location, vnaFrame, fact);
    }

    // Check for calls to a method that unconditionally dereferences
    // a parameter. Mark any such arguments as derefs.
    if (CHECK_CALLS && instruction instanceof InvokeInstruction) {
        checkUnconditionalDerefDatabase(location, vnaFrame, fact);
    }

    // If this is a method call instruction,
    // check to see if any of the parameters are @NonNull,
    // and treat them as dereferences.
    if (CHECK_ANNOTATIONS && instruction instanceof InvokeInstruction) {
        checkNonNullParams(location, vnaFrame, fact);
    }

    if (CHECK_ANNOTATIONS && instruction instanceof ARETURN) {
        XMethod thisMethod = XFactory.createXMethod(methodGen);
        checkNonNullReturnValue(thisMethod, location, vnaFrame, fact);
    }

    if (CHECK_ANNOTATIONS && (instruction instanceof PUTFIELD || instruction instanceof PUTSTATIC)) {
        checkNonNullPutField(location, vnaFrame, fact);
    }

    // Check to see if an instance value is dereferenced here
    checkInstance(location, vnaFrame, fact);

    if (false)
        fact.cleanDerefSet(location, vnaFrame);

    if (DEBUG && fact.isTop())
        System.out.println("MAKING TOP2 At: " + location);

}
项目:FindBug-for-Domino-Designer    文件:UnconditionalValueDerefAnalysis.java   
@Override
public void transferInstruction(InstructionHandle handle, BasicBlock basicBlock, UnconditionalValueDerefSet fact)
        throws DataflowAnalysisException {

    Instruction instruction = handle.getInstruction();
    if (fact.isTop())
        return;
    Location location = new Location(handle, basicBlock);

    // If this is a call to an assertion method,
    // change the dataflow value to be TOP.
    // We don't want to report future derefs that would
    // be guaranteed only if the assertion methods
    // returns normally.
    // TODO: at some point, evaluate whether we should revisit this
    if (isAssertion(handle) // || handle.getInstruction() instanceof ATHROW
    ) {
        if (DEBUG)
            System.out.println("MAKING BOTTOM0 AT: " + location);
        fact.clear();
        return;
    }

    // Get value number frame
    ValueNumberFrame vnaFrame = vnaDataflow.getFactAtLocation(location);
    if (!vnaFrame.isValid()) {
        if (DEBUG)
            System.out.println("MAKING TOP1 AT: " + location);
        // Probably dead code.
        // Assume this location can't be reached.
        makeFactTop(fact);
        return;
    }
    if (isNullCheck(handle, methodGen.getConstantPool())) {
        handleNullCheck(location, vnaFrame, fact);
    }

    // Check for calls to a method that unconditionally dereferences
    // a parameter. Mark any such arguments as derefs.
    if (CHECK_CALLS && instruction instanceof InvokeInstruction) {
        checkUnconditionalDerefDatabase(location, vnaFrame, fact);
    }

    // If this is a method call instruction,
    // check to see if any of the parameters are @NonNull,
    // and treat them as dereferences.
    if (CHECK_ANNOTATIONS && instruction instanceof InvokeInstruction) {
        checkNonNullParams(location, vnaFrame, fact);
    }

    if (CHECK_ANNOTATIONS && instruction instanceof ARETURN) {
        XMethod thisMethod = XFactory.createXMethod(methodGen);
        checkNonNullReturnValue(thisMethod, location, vnaFrame, fact);
    }

    if (CHECK_ANNOTATIONS && (instruction instanceof PUTFIELD || instruction instanceof PUTSTATIC)) {
        checkNonNullPutField(location, vnaFrame, fact);
    }

    // Check to see if an instance value is dereferenced here
    checkInstance(location, vnaFrame, fact);

    if (false)
        fact.cleanDerefSet(location, vnaFrame);

    if (DEBUG && fact.isTop())
        System.out.println("MAKING TOP2 At: " + location);

}