Package soot

Examples of soot.Trap


  {   
   
    //Do some preparation for each trap in the method
    for (Iterator<Trap> trapIt = body.getTraps().iterator(); trapIt.hasNext(); )
    {
        Trap trap = trapIt.next();       
       
        /**
         * Find the real header of this handler block
         *
         */
        Unit handler = trap.getHandlerUnit();
       
        Unit pred = handler;
        while(this.unitToPreds.get(pred).size() > 0)
          pred = this.unitToPreds.get(pred).get(0);
       
       
        handler2header.put(handler, pred);
        /***********/
       
        /*
         * Keep this here for possible future changes.
         */
        /*GuardedBlock gb = new GuardedBlock(trap.getBeginUnit(), trap.getEndUnit());
        Unit ehnop;
        if(try2nop.containsKey(gb))
          ehnop = try2nop.get(gb);
        else
        {
          ehnop = new EHNopStmt();
          try2nop.put(gb, ehnop);
        }*/
       
       
        Unit ehnop;
        if(try2nop.containsKey(trap.getBeginUnit()))
          ehnop = try2nop.get(trap.getBeginUnit());
        else
        {
          ehnop = new EHNopStmt();
          try2nop.put(trap.getBeginUnit(), ehnop);
        }
               
    }
   
    //Only add a nop once
    Hashtable<Unit, Boolean> nop2added = new Hashtable<Unit, Boolean>();

    // Now actually add the edge
AddExceptionalEdge:
    for (Iterator<Trap> trapIt = body.getTraps().iterator(); trapIt.hasNext(); )
    {

        Trap trap = trapIt.next();
        Unit b = trap.getBeginUnit();
        Unit handler = trap.getHandlerUnit();
        handler = handler2header.get(handler);
       
       
        /**
         * Check if this trap is a finally trap that handles exceptions of an adjacent catch block;
View Full Code Here


        Iterator i = _trapChain.iterator();

        // Record all traps beginning here as active
        while (i.hasNext()) {
            Trap ThisTrap = (Trap) i.next();

            if (ThisTrap.getBeginUnit() == u) {
                _currently_active_traps.addLast(ThisTrap);
            }
        }
    }
View Full Code Here

        Iterator i = _trapChain.iterator();

        // Record all traps ending here as inactive.
        while (i.hasNext()) {
            Trap ThisTrap = (Trap) i.next();

            if (ThisTrap.getEndUnit() == u) {
                _currently_active_traps.remove(ThisTrap);
            }
        }
    }
View Full Code Here

        LinkedList ListOfTraps = (LinkedList) _trapsForEachEpc.get(epc);
        LinkedList ListOfHandlers = new LinkedList();
        Iterator i = ListOfTraps.listIterator();

        while (i.hasNext()) {
            Trap t = (Trap) i.next();
            ListOfHandlers.add(t.getHandlerUnit());
        }

        return ListOfHandlers;
    }
View Full Code Here

        _currently_active_traps = new LinkedList();
        _trapsForEachEpc = new LinkedList();

        while (i.hasNext()) {
            Trap CurrentTrap = (Trap) i.next();

            Unit BeginUnit = CurrentTrap.getBeginUnit();
            Unit EndUnit = CurrentTrap.getEndUnit();
            Unit HandlerUnit = CurrentTrap.getHandlerUnit();

            _beginUnitList.add(BeginUnit);
            _endUnitList.add(EndUnit);
            _handlerUnitList.add(HandlerUnit);
        }
View Full Code Here

            JimpleBody body = (JimpleBody) method.retrieveActiveBody();
            Scene.v().releaseActiveHierarchy();

            // Grab the types of all traps.
            for (Iterator it = body.getTraps().iterator(); it.hasNext();) {
                Trap t = (Trap) it.next();
                _addClass(t.getException());
            }

            // Grab the classes of all referenced fields, invoked
            // methods, and created classes.
            for (Iterator units = body.getUnits().iterator(); units.hasNext();) {
View Full Code Here

                    && !OverriddenMethodGenerator.isOverridden(method)) {
                Iterator traps = method.retrieveActiveBody().getTraps()
                        .iterator();

                while (traps.hasNext()) {
                    Trap trap = (Trap) traps.next();
                    _add(trap.getException());
                }
            }
        }

        // Add all exception classes that can be thrown by this method.
View Full Code Here

                Iterator j = tracker.getTrapsForEpc(i).listIterator();

                code.append(_indent(4));

                while (j.hasNext()) {
                    Trap currentTrap = (Trap) j.next();
                    code.append("if (PCCG_instanceof("
                            + "(PCCG_CLASS_INSTANCE*)exception_id, "
                            + CNames.hashNumberOf(currentTrap.getException())
                            + "))\n");
                    code.append(_indent(4) + "{\n");
                    code.append(_indent(5) + "goto "
                            + visitor.getLabel(currentTrap.getHandlerUnit())
                            + ";\n");
                    code.append(_indent(4) + "}\n");
                    code.append(_indent(4) + "else ");
                }

View Full Code Here

                // System.out.println("method = " + method);
                JimpleBody body = (JimpleBody) method.retrieveActiveBody();

                for (Iterator traps = body.getTraps().iterator(); traps
                        .hasNext();) {
                    Trap trap = (Trap) traps.next();
                    SootClass exception = trap.getException();

                    if (_isPtolemyException(exception)) {
                        trap.setException(PtolemyUtilities.exceptionClass);
                    }
                }

                _replaceExceptions(body);
            }
View Full Code Here

TOP

Related Classes of soot.Trap

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.