Class ExceptionalBlockGraph

    • Constructor Detail

      • ExceptionalBlockGraph

        public 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.

        Parameters:
        body - The underlying body we want to make a graph for.
      • ExceptionalBlockGraph

        public ExceptionalBlockGraph​(ExceptionalUnitGraph unitGraph)
        Constructs a graph for the blocks found by partitioning the the Units in an ExceptionalUnitGraph.
        Parameters:
        unitGraph - The ExceptionalUnitGraph whose Units are to be split into blocks.
    • Method Detail

      • buildBlocks

        protected Map<Unit,​Block> buildBlocks​(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.

        Overrides:
        buildBlocks in class BlockGraph
        Parameters:
        leaders - Contains Units which are to be block leaders.
        uncastUnitGraph - Provides information about the predecessors and successors of each Unit in the Body, for determining the predecessors and successors of each created Block.
        Returns:
        a Map from Units which begin or end a block to the block which contains them.
      • getUnexceptionalPredsOf

        public List<Block> getUnexceptionalPredsOf​(Block b)
        Description copied from interface: ExceptionalGraph
        Returns a list of nodes which are predecessors of a given node when only unexceptional control flow is considered.
        Specified by:
        getUnexceptionalPredsOf in interface ExceptionalGraph<Block>
        Parameters:
        b - The node whose predecessors are to be returned.
        Returns:
        a List of the nodes in this graph from which there is an unexceptional edge to n.
      • getUnexceptionalSuccsOf

        public List<Block> getUnexceptionalSuccsOf​(Block b)
        Description copied from interface: ExceptionalGraph
        Returns a list of nodes which are successors of a given node when only unexceptional control flow is considered.
        Specified by:
        getUnexceptionalSuccsOf in interface ExceptionalGraph<Block>
        Parameters:
        b - The node whose successors are to be returned.
        Returns:
        a List of nodes in this graph to which there is an unexceptional edge from n.
      • getExceptionalPredsOf

        public List<Block> getExceptionalPredsOf​(Block b)
        Description copied from interface: ExceptionalGraph
        Returns a list of nodes which are predecessors of a given node when only exceptional control flow is considered.
        Specified by:
        getExceptionalPredsOf in interface ExceptionalGraph<Block>
        Parameters:
        b - The node whose predecessors are to be returned.
        Returns:
        a List of nodes in this graph from which there is an exceptional edge to n.
      • getExceptionalSuccsOf

        public List<Block> getExceptionalSuccsOf​(Block b)
        Description copied from interface: ExceptionalGraph
        Returns a list of nodes which are successors of a given node when only exceptional control flow is considered.
        Specified by:
        getExceptionalSuccsOf in interface ExceptionalGraph<Block>
        Parameters:
        b - The node whose successors are to be returned.
        Returns:
        a List of nodes in this graph to which there is an exceptional edge from n.