soot.toolkits.graph
Class TrapUnitGraph

java.lang.Object
  extended by soot.toolkits.graph.UnitGraph
      extended by soot.toolkits.graph.TrapUnitGraph
All Implemented Interfaces:
Iterable<Unit>, DirectedGraph<Unit>
Direct Known Subclasses:
ClassicCompleteUnitGraph, SimpleExceptionalGraph

public class TrapUnitGraph
extends UnitGraph

Represents a CFG for a Body instance where the nodes are Unit instances, and where, in additional to unexceptional control flow edges, edges are added from every trapped Unit to the Trap's handler Unit, regardless of whether the trapped Units may actually throw the exception caught by the Trap.

There are three distinctions between the exceptional edges added in TrapUnitGraph and the exceptional edges added in ExceptionalUnitGraph:

  1. In ExceptionalUnitGraph, the edges to Traps are associated with Units which may actually throw an exception which the Trap catches (according to the ThrowAnalysis used in the construction of the graph). In TrapUnitGraph, there are edges from every trapped Unit to the Trap, regardless of whether it can throw an exception caught by the Trap.
  2. In ExceptionalUnitGraph, when a Unit may throw an exception that is caught by a Trap there are edges from every predecessor of the excepting Unit to the Trap's handler. In TrapUnitGraph, edges are not added from the predecessors of excepting Units.
  3. In ExceptionalUnitGraph, when a Unit may throw an exception that is caught by a Trap, there may be no edge from the excepting Unit itself to the Trap (depending on the possibility of side effects and the setting of the omitExceptingUnitEdges parameter). In TrapUnitGraph, there is always an edge from the excepting Unit to the Trap.


Field Summary
 
Fields inherited from class soot.toolkits.graph.UnitGraph
body, heads, method, tails, unitChain, unitToPreds, unitToSuccs
 
Constructor Summary
TrapUnitGraph(Body body)
          Constructs the graph from a given Body instance.
 
Method Summary
protected  void buildExceptionalEdges(Map unitToSuccs, Map unitToPreds)
          Method to compute the edges corresponding to exceptional control flow.
 
Methods inherited from class soot.toolkits.graph.UnitGraph
addEdge, buildHeadsAndTails, buildUnexceptionalEdges, combineMapValues, getBody, getExtendedBasicBlockPathBetween, getHeads, getPredsOf, getSuccsOf, getTails, iterator, makeMappedListsUnmodifiable, size, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TrapUnitGraph

public TrapUnitGraph(Body body)
Constructs the graph from a given Body instance.

Parameters:
the - Body instance from which the graph is built.
Method Detail

buildExceptionalEdges

protected void buildExceptionalEdges(Map unitToSuccs,
                                     Map unitToPreds)
Method to compute the edges corresponding to exceptional control flow.

Parameters:
unitToSuccs - A Map from Units to Lists of Units. This is an “out parameter”; buildExceptionalEdges will add a mapping for every Unit within the scope of one or more Traps to a List of the handler units of those Traps.
unitToPreds - A Map from Units to Lists of Units. This is an “out parameter”; buildExceptionalEdges will add a mapping for every Trap handler to all the Units within the scope of that Trap.