changeset 3016:2f5f6ffbafa0

Fixed a bug in the dead code eliminator when removing inputs from dead phis.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Sat, 18 Jun 2011 12:19:51 +0200
parents 02a3d70f6fc0
children b4ba003eb11d
files graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Merge.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Phi.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/Phase.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/schedule/IdentifyBlocksPhase.java graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/VMExitsNative.java rundacapo.sh
diffstat 6 files changed, 26 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Merge.java	Sat Jun 18 11:33:58 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Merge.java	Sat Jun 18 12:19:51 2011 +0200
@@ -290,7 +290,9 @@
         for (Node usage : usages()) {
             if (usage instanceof Phi) {
                 Phi phi = (Phi) usage;
-                phi.removeInput(predIndex);
+                if (!phi.isDead()) {
+                    phi.removeInput(predIndex);
+                }
             }
         }
     }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Phi.java	Sat Jun 18 11:33:58 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/ir/Phi.java	Sat Jun 18 12:19:51 2011 +0200
@@ -67,6 +67,15 @@
         setMerge(merge);
     }
 
+    @Override
+    public boolean verify() {
+        assertTrue(merge() != null);
+        if (!isDead()) {
+            assertTrue(merge().endCount() + (merge() instanceof LoopBegin ? 1 : 0) == valueCount());
+        }
+        return true;
+    }
+
     /**
      * Get the instruction that produces the value associated with the i'th predecessor
      * of the join block.
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/Phase.java	Sat Jun 18 11:33:58 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/Phase.java	Sat Jun 18 12:19:51 2011 +0200
@@ -31,17 +31,24 @@
 
     private final String name;
     private static final ThreadLocal<Phase> currentPhase = new ThreadLocal<Phase>();
+    private final boolean shouldVerify;
 
     public Phase() {
         this.name = this.getClass().getSimpleName();
+        this.shouldVerify = true;
     }
 
     public Phase(String name) {
+        this(name, true);
+    }
+
+    public Phase(String name, boolean shouldVerify) {
         this.name = name;
+        this.shouldVerify = shouldVerify;
     }
 
     public final void apply(Graph graph) {
-        assert graph != null && graph.verify();
+        assert graph != null && (!shouldVerify || graph.verify());
 
         int startDeletedNodeCount = graph.getDeletedNodeCount();
         int startNodeCount = graph.getNodeCount();
@@ -74,7 +81,7 @@
             compilation.compiler.fireCompilationEvent(new CompilationEvent(compilation, "After " + getName(), graph, true, false));
         }
 
-        assert graph.verify();
+        assert !shouldVerify || graph.verify();
 
         // (Item|Graph|Phase|Value)
     }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/schedule/IdentifyBlocksPhase.java	Sat Jun 18 11:33:58 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/schedule/IdentifyBlocksPhase.java	Sat Jun 18 12:19:51 2011 +0200
@@ -39,7 +39,7 @@
     private boolean scheduleAllNodes;
 
     public IdentifyBlocksPhase(boolean scheduleAllNodes) {
-        super(scheduleAllNodes ? "FullSchedule" : "PartSchedule");
+        super(scheduleAllNodes ? "FullSchedule" : "PartSchedule", false);
         this.scheduleAllNodes = scheduleAllNodes;
     }
 
--- a/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/VMExitsNative.java	Sat Jun 18 11:33:58 2011 +0200
+++ b/graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/VMExitsNative.java	Sat Jun 18 12:19:51 2011 +0200
@@ -29,6 +29,7 @@
 
 import com.oracle.max.graal.compiler.*;
 import com.oracle.max.graal.compiler.debug.*;
+import com.oracle.max.graal.compiler.graph.*;
 import com.oracle.max.graal.runtime.logging.*;
 import com.oracle.max.graal.runtime.server.*;
 import com.sun.cri.ci.*;
@@ -152,7 +153,7 @@
 
                     if (result.bailout() != null) {
                         Throwable cause = result.bailout().getCause();
-                        if (!GraalOptions.QuietBailout) {
+                        if (!GraalOptions.QuietBailout && !(result.bailout() instanceof JSRNotSupportedBailout)) {
                             StringWriter out = new StringWriter();
                             result.bailout().printStackTrace(new PrintWriter(out));
                             TTY.println("Bailout:\n" + out.toString());
@@ -179,7 +180,7 @@
                 } catch (Throwable t) {
                     StringWriter out = new StringWriter();
                     t.printStackTrace(new PrintWriter(out));
-                    TTY.println("Compilation interrupted: (" + method.name() + ")\n" + out.toString());
+                    TTY.println("Compilation interrupted: (" + method + ")\n" + out.toString());
                     throw t;
                 }
             }
--- a/rundacapo.sh	Sat Jun 18 11:33:58 2011 +0200
+++ b/rundacapo.sh	Sat Jun 18 12:19:51 2011 +0200
@@ -15,4 +15,4 @@
   echo "DACAPO is not defined. It must point to a Dacapo benchmark directory."
   exit 1;
 fi
-${JDK7}/bin/java -client -d64 -graal -XX:-GraalBailoutIsFatal -XX:+PrintCompilation -Xms1g -Xmx2g -esa -classpath ${DACAPO}/dacapo-9.12-bach.jar Harness --preserve $*
+${JDK7}/bin/java -client -d64 -graal -XX:-GraalBailoutIsFatal -XX:MaxPermSize=512m -XX:+PrintCompilation -Xms1g -Xmx2g -esa -classpath ${DACAPO}/dacapo-9.12-bach.jar Harness --preserve $*