diff graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopPolicies.java @ 20069:2dbfa1ed5efa

Reduce usages of fixed node probability cache.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Mon, 30 Mar 2015 00:54:07 +0200
parents fdb93d2ed5c8
children b1530a6cce8c
line wrap: on
line diff
--- a/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopPolicies.java	Sun Mar 29 20:51:22 2015 +0200
+++ b/graal/com.oracle.graal.loop/src/com/oracle/graal/loop/LoopPolicies.java	Mon Mar 30 00:54:07 2015 +0200
@@ -25,7 +25,6 @@
 import static com.oracle.graal.compiler.common.GraalOptions.*;
 
 import java.util.*;
-import java.util.function.*;
 
 import com.oracle.graal.debug.*;
 import com.oracle.graal.graph.*;
@@ -49,12 +48,12 @@
     }
 
     // TODO (gd) change when inversion is available
-    public static boolean shouldPeel(LoopEx loop, ToDoubleFunction<FixedNode> probabilities) {
+    public static boolean shouldPeel(LoopEx loop, ControlFlowGraph cfg) {
         if (loop.detectCounted()) {
             return false;
         }
         LoopBeginNode loopBegin = loop.loopBegin();
-        double entryProbability = probabilities.applyAsDouble(loopBegin.forwardEnd());
+        double entryProbability = cfg.blockFor(loopBegin.forwardEnd()).probability();
         if (entryProbability > MinimumPeelProbability.getValue() && loop.size() + loopBegin.graph().getNodeCount() < MaximumDesiredSize.getValue()) {
             // check whether we're allowed to peel this loop
             for (Node node : loop.inside().nodes()) {
@@ -120,7 +119,7 @@
                 // this may count twice because of fall-through in switches
                 inBranchTotal += loop.nodesInLoopBranch(branch).count();
             }
-            Block postDomBlock = loop.loopsData().controlFlowGraph().blockFor(controlSplit).getPostdominator();
+            Block postDomBlock = loop.loopsData().getCFG().blockFor(controlSplit).getPostdominator();
             if (postDomBlock != null) {
                 IsolatedInitialization.UNSWITCH_SPLIT_WITH_PHIS.increment();
                 phis += ((MergeNode) postDomBlock.getBeginNode()).phis().count();