changeset 2808:189ffb7d1d84

enable PhiSimplifier, schedule values used in a merge's stateBefore in the dominator
author Lukas Stadler <lukas.stadler@jku.at>
date Mon, 30 May 2011 13:42:23 +0200
parents 50b5db2c3e68
children b003ea36fa12
files graal/GraalCompiler/src/com/oracle/max/graal/schedule/Schedule.java graal/GraalCompiler/src/com/sun/c1x/alloc/LinearScan.java graal/GraalCompiler/src/com/sun/c1x/gen/PhiSimplifier.java graal/GraalCompiler/src/com/sun/c1x/value/FrameState.java runscimark.sh
diffstat 5 files changed, 29 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/graal/GraalCompiler/src/com/oracle/max/graal/schedule/Schedule.java	Fri May 27 23:47:23 2011 +0200
+++ b/graal/GraalCompiler/src/com/oracle/max/graal/schedule/Schedule.java	Mon May 30 13:42:23 2011 +0200
@@ -243,6 +243,13 @@
                         block = getCommonDominator(block, mergeBlock.getPredecessors().get(i));
                     }
                 }
+            } else if (usage instanceof FrameState && ((FrameState) usage).block() != null) {
+                Merge merge = ((FrameState) usage).block();
+                for (Node pred : merge.predecessors()) {
+                    if (isCFG(pred)) {
+                        block = getCommonDominator(block, nodeToBlock.get(pred));
+                    }
+                }
             } else {
                 block = getCommonDominator(block, assignLatestPossibleBlockToNode(usage));
             }
--- a/graal/GraalCompiler/src/com/sun/c1x/alloc/LinearScan.java	Fri May 27 23:47:23 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/alloc/LinearScan.java	Mon May 30 13:42:23 2011 +0200
@@ -849,9 +849,15 @@
                     LIRBlock block = blockAt(j);
                     if (block.liveGen.get(operandNum)) {
                         TTY.println("  used in block B%d", block.blockID());
+                        for (LIRInstruction ins : block.lir().instructionsList()) {
+                            TTY.println(ins.id + ": " + ins.result() + " " + ins.toString());
+                        }
                     }
                     if (block.liveKill.get(operandNum)) {
                         TTY.println("  defined in block B%d", block.blockID());
+                        for (LIRInstruction ins : block.lir().instructionsList()) {
+                            TTY.println(ins.id + ": " + ins.result() + " " + ins.toString());
+                        }
                     }
                 }
             }
--- a/graal/GraalCompiler/src/com/sun/c1x/gen/PhiSimplifier.java	Fri May 27 23:47:23 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/gen/PhiSimplifier.java	Mon May 30 13:42:23 2011 +0200
@@ -45,7 +45,7 @@
         }
         Phi phi = (Phi) x;
 
-        if (phi.valueCount() == 1) {
+        if (phi.valueCount() == 1 && !phi.checkFlag(Value.Flag.PhiCannotSimplify)) {
             return (Value) phi.replace(phi.valueAt(0));
         }
 
@@ -105,6 +105,10 @@
             // successfully simplified the phi
             assert phiSubst != null : "illegal phi function";
             phi.clearFlag(Value.Flag.PhiVisited);
+
+            phi.replace(phiSubst);
+//            System.out.printf("replaced phi with %d inputs\n", max);
+
             return phiSubst;
         }
     }
--- a/graal/GraalCompiler/src/com/sun/c1x/value/FrameState.java	Fri May 27 23:47:23 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/value/FrameState.java	Mon May 30 13:42:23 2011 +0200
@@ -381,6 +381,16 @@
         }
     }
 
+    public Merge block() {
+        if (usages().size() > 0) {
+            assert usages().size() == 1;
+            Node node = usages().get(0);
+            if (node instanceof Merge) {
+                return (Merge) node;
+            }
+        }
+        return null;
+    }
 
     /**
      * The interface implemented by a client of {@link FrameState#forEachPhi(Merge, PhiProcedure)} and
--- a/runscimark.sh	Fri May 27 23:47:23 2011 +0200
+++ b/runscimark.sh	Mon May 30 13:42:23 2011 +0200
@@ -23,5 +23,5 @@
 for (( i = 1; i <= ${COUNT}; i++ ))      ### Outer for loop ###
 do
   echo "$i "
-  ${JDK7}/jre/bin/java -client -d64 -graal -esa -ea -Xms32m -Xmx100m -Xbootclasspath/a:${SCIMARK} -C1X:+PrintTimers $@ jnt.scimark2.commandline -large
+  ${JDK7}/jre/bin/java -client -d64 -graal -esa -ea -Xms32m -Xmx100m -Xbootclasspath/a:${SCIMARK} -C1X:+PrintTimers $@ jnt.scimark2.commandline
 done