changeset 5792:fa6ed51ac198

more aggressive tail duplication
author Lukas Stadler <lukas.stadler@jku.at>
date Mon, 09 Jul 2012 16:44:03 +0200
parents 506e76281145
children 6c80d73cf81a
files graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalOptions.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/TailDuplicationPhase.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/util/InliningUtil.java
diffstat 3 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalOptions.java	Sat Jul 07 12:53:00 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalOptions.java	Mon Jul 09 16:44:03 2012 +0200
@@ -71,7 +71,8 @@
     public static int     ForcedInlineEscapeWeight           = 10;
     public static boolean PrintEscapeAnalysis                = ____;
 
-    public static double TailDuplicationProbability          = 0.5;
+    public static double TailDuplicationProbability          = 0.2;
+    public static int    TailDuplicationTrivialSize          = 6;
 
     // absolute probability analysis
     public static boolean ProbabilityAnalysis                = true;
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/TailDuplicationPhase.java	Sat Jul 07 12:53:00 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/TailDuplicationPhase.java	Mon Jul 09 16:44:03 2012 +0200
@@ -74,6 +74,9 @@
     public static final TailDuplicationDecision DEFAULT_DECISION = new TailDuplicationDecision() {
 
         public boolean doTransform(MergeNode merge, int fixedNodeCount) {
+            if (fixedNodeCount < GraalOptions.TailDuplicationTrivialSize) {
+                return true;
+            }
             HashSet<PhiNode> improvements = new HashSet<>();
             for (PhiNode phi : merge.phis()) {
                 Stamp phiStamp = phi.stamp();
@@ -157,13 +160,13 @@
             if (fixed instanceof EndNode && !(((EndNode) fixed).merge() instanceof LoopBeginNode)) {
                 metricDuplicationEnd.increment();
                 if (decision.doTransform(merge, fixedCount)) {
-                    metricDuplicationEndPerformed.add(fixedCount);
+                    metricDuplicationEndPerformed.increment();
                     new DuplicationOperation(merge, replacements).duplicate();
                 }
             } else if (merge.stateAfter() != null) {
                 metricDuplicationOther.increment();
                 if (decision.doTransform(merge, fixedCount)) {
-                    metricDuplicationOtherPerformed.add(fixedCount);
+                    metricDuplicationOtherPerformed.increment();
                     new DuplicationOperation(merge, replacements).duplicate();
                 }
             }
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/util/InliningUtil.java	Sat Jul 07 12:53:00 2012 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/util/InliningUtil.java	Mon Jul 09 16:44:03 2012 +0200
@@ -367,7 +367,7 @@
             }
             if (GraalOptions.OptTailDuplication) {
                 /*
-                 * We might want to perform tail duplication at the merge after a type switch, is there are invokes that would
+                 * We might want to perform tail duplication at the merge after a type switch, if there are invokes that would
                  * benefit from the improvement in type information.
                  */
                 FixedNode current = returnMerge;