public class ComputeInliningRelevance extends Object
Modifier and Type | Class and Description |
---|---|
private class |
ComputeInliningRelevance.Scope
A scope holds information for the contents of one loop or of the root of the method.
|
Modifier and Type | Field and Description |
---|---|
private static double |
EPSILON |
private static int |
EXPECTED_INVOKE_RATIO |
private static int |
EXPECTED_LOOP_COUNT |
private static int |
EXPECTED_MIN_INVOKE_COUNT |
private StructuredGraph |
graph |
private ToDoubleFunction<FixedNode> |
nodeProbabilities |
private Map<FixedNode,Double> |
nodeRelevances
Node relevances are pre-computed for all invokes if the graph contains loops.
|
private ComputeInliningRelevance.Scope |
rootScope
This scope is non-null if (and only if) there are no loops in the graph.
|
private static double |
UNINITIALIZED |
Constructor and Description |
---|
ComputeInliningRelevance(StructuredGraph graph,
ToDoubleFunction<FixedNode> nodeProbabilities) |
Modifier and Type | Method and Description |
---|---|
void |
compute()
Initializes or updates the relevance computation.
|
private double |
computeFastPathMinProbability(FixedNode scopeStart)
Computes the minimum probability along the most probable path within the scope.
|
private ComputeInliningRelevance.Scope |
createLoopScope(LoopBeginNode loopBegin,
Map<LoopBeginNode,ComputeInliningRelevance.Scope> loops)
Determines the parent of the given loop and creates a
ComputeInliningRelevance.Scope object for each one. |
private Node |
getMaxProbabilityLoopExit(LoopBeginNode loopBegin,
ArrayList<FixedNode> pathBeginNodes)
Returns the most probable loop exit.
|
private static Node |
getMaxProbabilitySux(ControlSplitNode controlSplit,
ArrayList<FixedNode> pathBeginNodes)
Returns the most probable successor.
|
private double |
getMinPathProbability(FixedNode current,
double minPathProbability) |
double |
getRelevance(Invoke invoke) |
private static void |
truncate(ArrayList<FixedNode> pathBeginNodes,
int pathBeginCount) |
private static final double EPSILON
private static final double UNINITIALIZED
private static final int EXPECTED_MIN_INVOKE_COUNT
private static final int EXPECTED_INVOKE_RATIO
private static final int EXPECTED_LOOP_COUNT
private final StructuredGraph graph
private final ToDoubleFunction<FixedNode> nodeProbabilities
private Map<FixedNode,Double> nodeRelevances
rootScope
.private ComputeInliningRelevance.Scope rootScope
public ComputeInliningRelevance(StructuredGraph graph, ToDoubleFunction<FixedNode> nodeProbabilities)
public void compute()
public double getRelevance(Invoke invoke)
private ComputeInliningRelevance.Scope createLoopScope(LoopBeginNode loopBegin, Map<LoopBeginNode,ComputeInliningRelevance.Scope> loops)
ComputeInliningRelevance.Scope
object for each one. This
method will call itself recursively if no ComputeInliningRelevance.Scope
for the parent loop exists.private double computeFastPathMinProbability(FixedNode scopeStart)
private double getMinPathProbability(FixedNode current, double minPathProbability)
private static Node getMaxProbabilitySux(ControlSplitNode controlSplit, ArrayList<FixedNode> pathBeginNodes)
private Node getMaxProbabilityLoopExit(LoopBeginNode loopBegin, ArrayList<FixedNode> pathBeginNodes)