public final class ConstantTreeAnalyzer extends Object
ConstantTree and marks potential materialization positions.| Modifier and Type | Field and Description |
|---|---|
private ConstantTree |
tree |
private BitSet |
visited |
| Modifier | Constructor and Description |
|---|---|
private |
ConstantTreeAnalyzer(ConstantTree tree) |
| Modifier and Type | Method and Description |
|---|---|
static ConstantTree.NodeCost |
analyze(ConstantTree tree,
AbstractBlockBase<?> startBlock) |
private void |
analyzeBlocks(AbstractBlockBase<?> startBlock)
Queues all relevant blocks for processing.
|
private void |
filteredPush(Deque<AbstractBlockBase<?>> worklist,
AbstractBlockBase<?> block) |
private boolean |
isLeafBlock(AbstractBlockBase<?> block) |
private boolean |
isMarked(AbstractBlockBase<?> block) |
private void |
leafCost(AbstractBlockBase<?> block) |
private void |
process(AbstractBlockBase<?> block)
Calculates the cost of a
block. |
private static boolean |
shouldMaterializerInCurrentBlock(double probabilityBlock,
double probabilityChildren,
int numMat)
This is the cost function that decides whether a materialization should be inserted in the
current block.
|
private final ConstantTree tree
private ConstantTreeAnalyzer(ConstantTree tree)
public static ConstantTree.NodeCost analyze(ConstantTree tree, AbstractBlockBase<?> startBlock)
private void analyzeBlocks(AbstractBlockBase<?> startBlock)
startBlock - The start block of the dominator subtree.private void process(AbstractBlockBase<?> block)
block - The block to be processed.private static boolean shouldMaterializerInCurrentBlock(double probabilityBlock, double probabilityChildren, int numMat)
Note that this function does not take into account if a materialization is required despite the probabilities (e.g. there are usages in the current block).
probabilityBlock - Probability of the current block.probabilityChildren - Accumulated probability of the children.numMat - Number of materializations along the subtrees. We use numMat - 1 to
insert materializations as late as possible if the probabilities are the same.private void filteredPush(Deque<AbstractBlockBase<?>> worklist, AbstractBlockBase<?> block)
private void leafCost(AbstractBlockBase<?> block)
private boolean isMarked(AbstractBlockBase<?> block)
private boolean isLeafBlock(AbstractBlockBase<?> block)