soot.toolkits.graph
Class ZonedBlockGraph
java.lang.Object
soot.toolkits.graph.BlockGraph
soot.toolkits.graph.ZonedBlockGraph
- All Implemented Interfaces:
- Iterable<Block>, DirectedGraph<Block>
public class ZonedBlockGraph
- extends BlockGraph
A CFG where the nodes are Block
instances, and where
exception boundaries are taken into account when finding the
Blocks for the provided Body. Any Unit
which is
the first Unit to be convered by some exception handler
will start a new Block, and any which is the last
Unit to be covered a some exception handler, will end the
block it is part of. These ``zones'', however, are not split up
to indicate the possibility that an exception will lead to control
exiting the zone before it is completed.
ZonedBlockGraph
public ZonedBlockGraph(Body body)
Constructs a ZonedBlockGraph for the Units
comprising the passed Body
.
Note that this constructor builds a BriefUnitGraph
internally when splitting body's
Unit
s into Block
s. Callers who need both a
BriefUnitGraph
and a ZonedBlockGraph
can use the constructor taking the BriefUnitGraph as a
parameter, as a minor optimization.
- Parameters:
body
- The Body for which to produce
a ZonedBlockGraph.
ZonedBlockGraph
public ZonedBlockGraph(BriefUnitGraph unitGraph)
- Constructs a ZonedBlockGraph corresponding to the
Unit-level control flow represented by the
passed
BriefUnitGraph
.
- Parameters:
unitGraph
- The BriefUnitGraph for which to produce
a ZonedBlockGraph.
computeLeaders
protected Set<Unit> computeLeaders(UnitGraph unitGraph)
Utility method for computing the basic block leaders for a
Body
, given its UnitGraph
(i.e., the
instructions which begin new basic blocks).
This implementation chooses as block leaders all
the Units that BlockGraph.computerLeaders()
,
and adds:
- The first Unit covered by each
Trap
(i.e.,
the Unit returned by Trap.getBeginUnit()
.
- The first Unit not covered by each
Trap
(i.e.,
the Unit returned by Trap.getEndUnit()
.
- Overrides:
computeLeaders
in class BlockGraph
- Parameters:
unitGraph
- is the Unit-level CFG which is to be split
into basic blocks.
- Returns:
- the
Set
of Unit
s in unitGraph which
are block leaders.