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

项目:findbugs-all-the-bugs    文件:BetterCFGBuilder2.java   
/**
 * Return whether or not the given instruction can throw exceptions.
 *
 * @param handle
 *            the instruction
 * @return true if the instruction can throw an exception, false otherwise
 */
private boolean isPEI(InstructionHandle handle) {
    Instruction ins = handle.getInstruction();

    if (!(ins instanceof ExceptionThrower))
        return false;

    if (ins instanceof NEW)
        return false;
    // if (ins instanceof ATHROW) return false;
    if (ins instanceof GETSTATIC)
        return false;
    if (ins instanceof PUTSTATIC)
        return false;
    if (ins instanceof ReturnInstruction)
        return false;
    if (ins instanceof INSTANCEOF)
        return false;
    if (ins instanceof MONITOREXIT)
        return false;
    if (ins instanceof LDC)
        return false;
    return true;

}
项目:FindBug-for-Domino-Designer    文件:BetterCFGBuilder2.java   
/**
 * Return whether or not the given instruction can throw exceptions.
 *
 * @param handle
 *            the instruction
 * @return true if the instruction can throw an exception, false otherwise
 */
private boolean isPEI(InstructionHandle handle) {
    Instruction ins = handle.getInstruction();

    if (!(ins instanceof ExceptionThrower))
        return false;

    if (ins instanceof NEW)
        return false;
    // if (ins instanceof ATHROW) return false;
    if (ins instanceof GETSTATIC)
        return false;
    if (ins instanceof PUTSTATIC)
        return false;
    if (ins instanceof ReturnInstruction)
        return false;
    if (ins instanceof INSTANCEOF)
        return false;
    if (ins instanceof MONITOREXIT)
        return false;
    if (ins instanceof LDC)
        return false;
    return true;

}
项目:parabuild-ci    文件:OtherLockCountAnalysis.java   
public int getDelta(Instruction ins, ValueNumberFrame frame) throws DataflowAnalysisException {
    int delta = 0;

    if (ins instanceof MONITORENTER) {
        if (frame == null || !isThisValue(frame.getTopValue()))
            ++delta;
    } else if (ins instanceof MONITOREXIT) {
        if (frame == null || !isThisValue(frame.getTopValue()))
            --delta;
    }

    return delta;
}
项目:parabuild-ci    文件:AnyLockCountAnalysis.java   
public int getDelta(Instruction ins, ValueNumberFrame frame) throws DataflowAnalysisException {
    int delta = 0;
    if (ins instanceof MONITORENTER)
        ++delta;
    else if (ins instanceof MONITOREXIT)
        --delta;
    return delta;
}
项目:findbugs-all-the-bugs    文件:SelfCalls.java   
/**
 * Scan a method for self call sites.
 * 
 * @param node
 *            the CallGraphNode for the method to be scanned
 */
private void scan(CallGraphNode node) throws CFGBuilderException {
    Method method = node.getMethod();
    CFG cfg = classContext.getCFG(method);

    if (method.isSynchronized())
        hasSynchronization = true;

    Iterator<BasicBlock> i = cfg.blockIterator();
    while (i.hasNext()) {
        BasicBlock block = i.next();
        Iterator<InstructionHandle> j = block.instructionIterator();
        while (j.hasNext()) {
            InstructionHandle handle = j.next();

            Instruction ins = handle.getInstruction();
            if (ins instanceof InvokeInstruction) {
                InvokeInstruction inv = (InvokeInstruction) ins;
                Method called = isSelfCall(inv);
                if (called != null) {
                    // Add edge to call graph
                    CallSite callSite = new CallSite(method, block, handle);
                    callGraph.createEdge(node, callGraph.getNodeForMethod(called), callSite);

                    // Add to called method set
                    calledMethodSet.add(called);
                }
            } else if (ins instanceof MONITORENTER || ins instanceof MONITOREXIT) {
                hasSynchronization = true;
            }
        }
    }
}
项目:FindBug-for-Domino-Designer    文件:SelfCalls.java   
/**
 * Scan a method for self call sites.
 * 
 * @param node
 *            the CallGraphNode for the method to be scanned
 */
private void scan(CallGraphNode node) throws CFGBuilderException {
    Method method = node.getMethod();
    CFG cfg = classContext.getCFG(method);

    if (method.isSynchronized())
        hasSynchronization = true;

    Iterator<BasicBlock> i = cfg.blockIterator();
    while (i.hasNext()) {
        BasicBlock block = i.next();
        Iterator<InstructionHandle> j = block.instructionIterator();
        while (j.hasNext()) {
            InstructionHandle handle = j.next();

            Instruction ins = handle.getInstruction();
            if (ins instanceof InvokeInstruction) {
                InvokeInstruction inv = (InvokeInstruction) ins;
                Method called = isSelfCall(inv);
                if (called != null) {
                    // Add edge to call graph
                    CallSite callSite = new CallSite(method, block, handle);
                    callGraph.createEdge(node, callGraph.getNodeForMethod(called), callSite);

                    // Add to called method set
                    calledMethodSet.add(called);
                }
            } else if (ins instanceof MONITORENTER || ins instanceof MONITOREXIT) {
                hasSynchronization = true;
            }
        }
    }
}