Mercurial > hg > truffle
diff graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/TailDuplicationPhase.java @ 15470:c55f44b3c5e5
remove NodesToDoubles, refactoring of node probability and inlining relevance computation
author | Lukas Stadler <lukas.stadler@oracle.com> |
---|---|
date | Fri, 02 May 2014 12:02:27 +0200 |
parents | 882f4cb7cfcf |
children | 5d468add216f |
line wrap: on
line diff
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/TailDuplicationPhase.java Fri May 02 14:10:16 2014 +0200 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/TailDuplicationPhase.java Fri May 02 12:02:27 2014 +0200 @@ -25,6 +25,7 @@ import static com.oracle.graal.compiler.common.GraalOptions.*; import java.util.*; +import java.util.function.*; import com.oracle.graal.compiler.common.*; import com.oracle.graal.compiler.common.type.*; @@ -153,13 +154,15 @@ @Override protected void run(StructuredGraph graph, PhaseContext phaseContext) { - NodesToDoubles nodeProbabilities = new ComputeProbabilityClosure(graph).apply(); + if (graph.hasNode(MergeNode.class)) { + ToDoubleFunction<FixedNode> nodeProbabilities = new FixedNodeProbabilityCache(); - // A snapshot is taken here, so that new MergeNode instances aren't considered for tail - // duplication. - for (MergeNode merge : graph.getNodes(MergeNode.class).snapshot()) { - if (!(merge instanceof LoopBeginNode) && nodeProbabilities.get(merge) >= TailDuplicationProbability.getValue()) { - tailDuplicate(merge, DEFAULT_DECISION, null, phaseContext, canonicalizer); + // A snapshot is taken here, so that new MergeNode instances aren't considered for tail + // duplication. + for (MergeNode merge : graph.getNodes(MergeNode.class).snapshot()) { + if (!(merge instanceof LoopBeginNode) && nodeProbabilities.applyAsDouble(merge) >= TailDuplicationProbability.getValue()) { + tailDuplicate(merge, DEFAULT_DECISION, null, phaseContext, canonicalizer); + } } } }