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>>
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassA comparator to allow the priority queue to order blocks by their depth-first order, used by backward analysis.classA comparator to allow the priority queue to order blocks by their depth-first order, used by forward analysis. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final IdentityHashMap<Block, Integer> Map all blocks in the CFG to their depth-first order.protected final PriorityQueue<Block> The backing priority queue.Contains the same elements asqueue, for faster lookup. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds the given block to this Worklist.booleanReturns true if this Worklist contains the given block.booleanisEmpty()poll()Removes and returns the head of this Worklist, or null if this Worklist is empty.voidprocess(ControlFlowGraph cfg) Processes the control flow graph.remove()Removes and returns the head of this Worklist.toString()
-
Field Details
-
depthFirstOrder
Map all blocks in the CFG to their depth-first order. -
queue
The backing priority queue. -
queueSet
Contains the same elements asqueue, for faster lookup.
-
-
Constructor Details
-
Worklist
Creates a Worklist.- Parameters:
direction- the direction (forward or backward)
-
-
Method Details
-
process
Processes 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
- Returns:
- true if this Worklist is empty
- See Also:
-
contains
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
Adds the given block to this Worklist. Adds unconditionally: does not check containment first.- Parameters:
block- the block to add to this Worklist
-
poll
Removes and returns the head of this Worklist, or null if this Worklist is empty.- Returns:
- the head of this Worklist, or null if this Worklist is empty
- See Also:
-
remove
Removes and returns the head of this Worklist.- Returns:
- the head of this Worklist
- See Also:
-
toString
-