Package edu.umd.cs.findbugs.ba

Examples of edu.umd.cs.findbugs.ba.BasicBlock


                // If the edge is an exception thrown from a method that
                // tries to discharge an obligation, then that obligation needs
                // to
                // be removed from all states.
                //
                BasicBlock sourceBlock = edge.getSource();
                InstructionHandle handle = sourceBlock.getExceptionThrower();
                fact.setOnExceptionPath(true);

                // Apply only the actions which delete obligations
                Collection<ObligationPolicyDatabaseAction> actions = actionCache.getActions(sourceBlock, handle);
                for (ObligationPolicyDatabaseAction action : actions) {
View Full Code Here


    private boolean isPossibleIfComparison(Edge edge) {
        return edge.getType() == EdgeTypes.IFCMP_EDGE || edge.getType() == EdgeTypes.FALL_THROUGH_EDGE;
    }

    private Obligation comparesObligationTypeToNull(Edge edge) throws DataflowAnalysisException {
        BasicBlock sourceBlock = edge.getSource();
        InstructionHandle last = sourceBlock.getLastInstruction();
        if (last == null) {
            if (DEBUG_NULL_CHECK) {
                System.out.println("no last instruction in source block of " + edge + " ???");
            }
            return null;
View Full Code Here

            copy(inputFact, result);
        } else if (inputFact.isOnExceptionPath()
                && !result.isOnExceptionPath()) {
            if (DEBUG) {
                System.out.println("Ignoring " + inputFact + " in favor of " + result);
                BasicBlock from = edge.getSource();
                BasicBlock to = edge.getTarget();
                System.out.printf("  edge %s -> %s%n", from, to);
            }
            // Nothing to do
        } else if(!inputFact.isOnExceptionPath() && !inputFact.isEmpty()
                && result.isOnExceptionPath()) {
View Full Code Here

            LinkedList<Edge> edgesToRemove = new LinkedList<Edge>();
            for (Iterator<Edge> i = cfg.edgeIterator(); i.hasNext();) {
                Edge e = i.next();
                if (e.getType() == EdgeTypes.IFCMP_EDGE) {
                    try {
                        BasicBlock source = e.getSource();
                        InstructionHandle last = source.getLastInstruction();
                        Instruction lastInstruction = last.getInstruction();
                        InstructionHandle prev = last.getPrev();
                        Instruction prevInstruction = prev.getInstruction();
                        if (prevInstruction instanceof GETSTATIC && lastInstruction instanceof IFNE) {
                            GETSTATIC getStatic = (GETSTATIC) prevInstruction;
View Full Code Here

            CFG cfg = classContext.getCFG(method);

            Iterator<BasicBlock> bbi = cfg.blockIterator();
            while (bbi.hasNext()) {
                BasicBlock bb = bbi.next();

                int numOutgoing = cfg.getNumOutgoingEdges(bb);
                if (numOutgoing == 2) {
                    findIfElseDuplicates(cfg, method, bb);
                } else if (numOutgoing > 2) {
View Full Code Here

        pendingBugs.clear();

    }

    private void findIfElseDuplicates(CFG cfg, Method method, BasicBlock bb) {
        BasicBlock thenBB = null, elseBB = null;

        Iterator<Edge> iei = cfg.outgoingEdgeIterator(bb);
        while (iei.hasNext()) {
            Edge e = iei.next();
            if (e.getType() == EdgeTypes.IFCMP_EDGE) {
View Full Code Here

        while (iei.hasNext()) {
            Edge e = iei.next();
            int eType = e.getType();
            if (eType == EdgeTypes.SWITCH_EDGE || eType == EdgeTypes.SWITCH_DEFAULT_EDGE) {
                BasicBlock target = e.getTarget();
                InstructionHandle firstIns = getDeepFirstInstruction(cfg, target);
                if (firstIns == null)
                {
                    continue; // give up on this edge
                }
View Full Code Here

     * determine the end position (exclusive) of the final case by looking at
     * the gotos at the ends of the other cases
     */
    private static int getFinalTarget(CFG cfg, int myPos, Collection<InstructionHandle> prevs) {
        int maxGoto = 0;
        BasicBlock myBB = null;
        // note: InstructionHandle doesn't override equals(), so use
        // prevs.contains() with caution.
        Iterator<BasicBlock> bbi = cfg.blockIterator();
        while (bbi.hasNext()) {
            BasicBlock bb = bbi.next();
            InstructionHandle last = bb.getLastInstruction(); // may be null
            if (prevs.contains(last)) { // danger will robinson
                Iterator<Edge> iei = cfg.outgoingEdgeIterator(bb);
                while (iei.hasNext()) {
                    Edge e = iei.next();
                    int eType = e.getType();
                    String aab = e.toString();
                    if (eType == EdgeTypes.GOTO_EDGE) {
                        BasicBlock target = e.getTarget();
                        InstructionHandle targetFirst = getDeepFirstInstruction(cfg, target);
                        if (targetFirst != null) {
                            int targetPos = targetFirst.getPosition();
                            if (targetPos > maxGoto) {
                                maxGoto = targetPos;
View Full Code Here

            // an exception handler, we clear the stack and push a
            // single entry for the exception object. That way, the locals
            // can still be merged.

            // Get the value number for the exception
            BasicBlock handlerBlock = edge.getTarget();
            ValueNumber exceptionValueNumber = getExceptionValueNumber(handlerBlock);

            // Set up the stack frame
            ValueNumberFrame tmpFact = createFact();
            tmpFact.copyFrom(fact);
View Full Code Here

            return;
        }
        if (invDataflow == null) {
            return;
        }
        BasicBlock fallThroughPredecessor = cfg.getPredecessorWithEdgeType(location.getBasicBlock(), EdgeTypes.FALL_THROUGH_EDGE);
        if (fallThroughPredecessor == null || !fallThroughPredecessor.isNullCheck()) {
            return;
        }

        // Get the null-checked value
        ValueNumber vn = vnaFrame.getInstance(location.getHandle().getInstruction(), methodGen.getConstantPool());
View Full Code Here

TOP

Related Classes of edu.umd.cs.findbugs.ba.BasicBlock

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.