public class ExceptionalBlockGraph extends BlockGraph implements ExceptionalGraph<Block>
Represents a CFG where the nodes are Blocks and the
edges are derived from control flow. Control flow associated with
exceptions is taken into account: when a Unit may throw
an exception that is caught by a Trap within the
Body, the excepting Unit starts a new basic
block (Units do not start a new block when all the exceptions
they might throw would escape the method without being caught).
| Modifier and Type | Class and Description |
|---|---|
static class |
ExceptionalBlockGraph.ExceptionDest |
| Constructor and Description |
|---|
ExceptionalBlockGraph(Body body)
Constructs an
ExceptionalBlockGraph for the
blocks found by partitioning the the units of the provided
Body instance into basic blocks. |
ExceptionalBlockGraph(ExceptionalUnitGraph unitGraph)
Constructs a graph for the blocks found by partitioning the
the
Units in an ExceptionalUnitGraph. |
| Modifier and Type | Method and Description |
|---|---|
protected java.util.Map<Unit,Block> |
buildBlocks(java.util.Set<Unit> leaders,
UnitGraph uncastUnitGraph)
A utility method that does most of the work of constructing basic blocks,
once the set of block leaders has been determined, and which designates
the heads and tails of the graph.
|
java.util.List<Block> |
getExceptionalPredsOf(Block b)
Returns a list of nodes which are predecessors of a given
node when only exceptional control flow is considered.
|
java.util.List<Block> |
getExceptionalSuccsOf(Block b)
Returns a list of nodes which are successors of a given
node when only exceptional control flow is considered.
|
java.util.Collection<ExceptionalBlockGraph.ExceptionDest> |
getExceptionDests(Block b)
Returns a collection of
ExceptionDest
objects which represent how exceptions thrown by a specified
node will be handled. |
java.util.List<Block> |
getUnexceptionalPredsOf(Block b)
Returns a list of nodes which are predecessors of a given
node when only unexceptional control flow is considered.
|
java.util.List<Block> |
getUnexceptionalSuccsOf(Block b)
Returns a list of nodes which are successors of a given
node when only unexceptional control flow is considered.
|
computeLeaders, getBlocks, getBody, getHeads, getPredsOf, getSuccsOf, getTails, iterator, size, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetBodygetHeads, getPredsOf, getSuccsOf, getTails, iterator, sizepublic ExceptionalBlockGraph(Body body)
Constructs an ExceptionalBlockGraph for the
blocks found by partitioning the the units of the provided
Body instance into basic blocks.
Note that this constructor builds an ExceptionalUnitGraph internally when splitting body's
Units into Blocks. Callers who already have
an ExceptionalUnitGraph to hand can use the constructor
taking an ExceptionalUnitGraph as a parameter, as a
minor optimization.
body - The underlying body we want to make a graph for.public ExceptionalBlockGraph(ExceptionalUnitGraph unitGraph)
Units in an ExceptionalUnitGraph.unitGraph - The ExceptionalUnitGraph whose
Units are to be split into blocks.protected java.util.Map<Unit,Block> buildBlocks(java.util.Set<Unit> leaders, UnitGraph uncastUnitGraph)
A utility method that does most of the work of constructing basic blocks, once the set of block leaders has been determined, and which designates the heads and tails of the graph.
BlockGraph provides an implementation of
buildBlocks() which splits the Units in
unitGraph so that each Unit in the passed set
of block leaders is the first unit in a block. It defines as heads the
blocks which begin with Units which are heads in
unitGraph, and defines as tails the blocks which end with
Units which are tails in unitGraph. Subclasses
might override this behavior.
This implementation calls the inherited implementation to split
units into blocks, before adding the distinctions between
exceptional and unexceptional control flow.
buildBlocks in class BlockGraph{@inheritDoc} - Map from Units which begin or end a block to
the block which contains them.public java.util.List<Block> getUnexceptionalPredsOf(Block b)
ExceptionalGraphgetUnexceptionalPredsOf in interface ExceptionalGraph<Block>b - The node whose predecessors are to be returned.List of the nodes in this graph from which
there is an unexceptional edge to n.public java.util.List<Block> getUnexceptionalSuccsOf(Block b)
ExceptionalGraphgetUnexceptionalSuccsOf in interface ExceptionalGraph<Block>b - The node whose successors are to be returned.List of nodes in this graph to which
there is an unexceptional edge from n.public java.util.List<Block> getExceptionalPredsOf(Block b)
ExceptionalGraphgetExceptionalPredsOf in interface ExceptionalGraph<Block>b - The node whose predecessors are to be returned.List of nodes in this graph from which
there is an exceptional edge to n.public java.util.List<Block> getExceptionalSuccsOf(Block b)
ExceptionalGraphgetExceptionalSuccsOf in interface ExceptionalGraph<Block>b - The node whose successors are to be returned.List of nodes in this graph to which
there is an exceptional edge from n.public java.util.Collection<ExceptionalBlockGraph.ExceptionDest> getExceptionDests(Block b)
ExceptionalGraphExceptionDest
objects which represent how exceptions thrown by a specified
node will be handled.getExceptionDests in interface ExceptionalGraph<Block>b - The node for which to provide exception information.ExceptionDest objects describing
the traps and handlers, if any, which catch the exceptions
which may be thrown by n.