Class AbstractAnalysis.Worklist

  • Enclosing class:
    AbstractAnalysis<V extends AbstractValue<V>,​S extends Store<S>,​T extends TransferFunction<V,​S>>

    protected static class AbstractAnalysis.Worklist
    extends java.lang.Object
    A worklist is a priority queue of blocks in which the order is given by depth-first ordering to place non-loop predecessors ahead of successors.
    • Field Detail

      • depthFirstOrder

        protected final java.util.IdentityHashMap<Block,​java.lang.Integer> depthFirstOrder
        Map all blocks in the CFG to their depth-first order.
      • queue

        protected final java.util.PriorityQueue<Block> queue
        The backing priority queue.
    • Constructor Detail

      • Worklist

        public Worklist​(Analysis.Direction direction)
        Create a Worklist.
        Parameters:
        direction - the direction (forward or backward)
    • Method Detail

      • process

        public void process​(ControlFlowGraph cfg)
        Process the control flow graph, add the blocks to depthFirstOrder.
        Parameters:
        cfg - the control flow graph to process
      • contains

        public boolean contains​(Block block)
        Check if queue contains the block which is passed as the argument.
        Parameters:
        block - the given block to check
        Returns:
        true if queue contains the given block
      • add

        public void add​(Block block)
        Add the given block to queue. Adds unconditionally: does not check containment first.
        Parameters:
        block - the block to add to queue
      • poll

        @Pure
        public @Nullable Block poll()
        See PriorityQueue.poll().
        Returns:
        the head of queue
        See Also:
        PriorityQueue.poll()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object