Class AbstractAnalysis.Worklist

java.lang.Object
org.checkerframework.dataflow.analysis.AbstractAnalysis.Worklist
Enclosing class:
AbstractAnalysis<V extends AbstractValue<V>,S extends Store<S>,T extends TransferFunction<V,S>>

protected static class AbstractAnalysis.Worklist extends 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 Details

    • depthFirstOrder

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

      protected final PriorityQueue<Block> queue
      The backing priority queue.
    • queueSet

      protected final Set<Block> queueSet
      Contains the same elements as queue, for faster lookup.
  • Constructor Details

    • Worklist

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

    • process

      public void process(ControlFlowGraph cfg)
      Process the control flow graph.

      This implementation sets the depth-first order for each block, by adding the blocks to depthFirstOrder.

      Parameters:
      cfg - the control flow graph to process
    • isEmpty

      @Pure @EnsuresNonNullIf(result=false, expression="poll()") public boolean isEmpty()
      Returns:
      true if this Worklist is empty
      See Also:
    • contains

      public boolean contains(Block block)
      Returns true if this Worklist contains the given block.
      Parameters:
      block - the given block to check
      Returns:
      true if this Worklist contains the given block
    • add

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

      @Pure public @Nullable Block poll()
      Returns the head of this Worklist.
      Returns:
      the head of this Worklist
      See Also:
    • remove

      @Pure public Block remove()
      Returns the head of this Worklist.
      Returns:
      the head of this Worklist
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class Object