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 Unit
s 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
:
ExceptionalUnitGraph
, the edges to
Trap
s are associated with Unit
s 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
.
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 Unit
s.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
.body, heads, method, tails, unitChain, unitToPreds, unitToSuccs
Constructor and Description |
---|
TrapUnitGraph(Body body)
Constructs the graph from a given Body instance.
|
Modifier and Type | Method and Description |
---|---|
protected void |
buildExceptionalEdges(java.util.Map<Unit,java.util.List<Unit>> unitToSuccs,
java.util.Map<Unit,java.util.List<Unit>> unitToPreds)
Method to compute the edges corresponding to exceptional
control flow.
|
addEdge, buildHeadsAndTails, buildUnexceptionalEdges, combineMapValues, getBody, getExtendedBasicBlockPathBetween, getHeads, getPredsOf, getSuccsOf, getTails, iterator, size, toString
public TrapUnitGraph(Body body)
the
- Body instance from which the graph is built.protected void buildExceptionalEdges(java.util.Map<Unit,java.util.List<Unit>> unitToSuccs, java.util.Map<Unit,java.util.List<Unit>> unitToPreds)
unitToSuccs
- A Map
from Unit
s to List
s of Unit
s. This is an “out
parameter”; buildExceptionalEdges
will add a mapping for every Unit
within the scope of one or more Trap
s to a List
of the handler
units of those Trap
s.unitToPreds
- A Map
from Unit
s to
List
s of Unit
s. This is an
“out parameter”;
buildExceptionalEdges
will add a
mapping for every Trap
handler to
all the Unit
s within the scope of
that Trap
.