public class FixedNodeProbabilityCache extends Object implements ToDoubleFunction<FixedNode>
AbstractBeginNode
s.Modifier and Type | Field and Description |
---|---|
private Map<FixedNode,Double> |
cache |
private static DebugMetric |
metricComputeNodeProbability |
Constructor and Description |
---|
FixedNodeProbabilityCache() |
Modifier and Type | Method and Description |
---|---|
double |
applyAsDouble(FixedNode node)
Given a
FixedNode this method finds the most immediate AbstractBeginNode
preceding it that either:
has no predecessor (ie, the begin-node is a merge, in particular a loop-begin, or the
start-node)
has a control-split predecessor
|
private static FixedNode |
findBegin(FixedNode node) |
private double |
handleMerge(FixedNode current,
double probability) |
private static final DebugMetric metricComputeNodeProbability
public FixedNodeProbabilityCache()
public double applyAsDouble(FixedNode node)
Given a FixedNode
this method finds the most immediate AbstractBeginNode
preceding it that either:
The thus found AbstractBeginNode
is equi-probable with the FixedNode
it was
obtained from. When computed for the first time (afterwards a cache lookup returns it) that
probability is computed as follows, again depending on the begin-node's predecessor:
As an exception to all the above, a probability of 1 is assumed for a FixedNode
that
appears to be dead-code (ie, lacks a predecessor).
applyAsDouble
in interface ToDoubleFunction<FixedNode>
private double handleMerge(FixedNode current, double probability)