changeset 2806:f35c6f8f0f5d

Fixed two regressions due to the flexible scheduling.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Fri, 27 May 2011 23:38:52 +0200
parents c3f64b66fc78
children 50b5db2c3e68
files graal/GraalCompiler/src/com/oracle/max/graal/schedule/Schedule.java graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java
diffstat 2 files changed, 9 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/graal/GraalCompiler/src/com/oracle/max/graal/schedule/Schedule.java	Fri May 27 19:57:56 2011 +0200
+++ b/graal/GraalCompiler/src/com/oracle/max/graal/schedule/Schedule.java	Fri May 27 23:38:52 2011 +0200
@@ -95,7 +95,7 @@
                     return false;
                 }
 
-                if (n instanceof LoopBegin) {
+                if (n instanceof LoopBegin || n instanceof LoopEnd) {
                     // a LoopBegin is always a merge
                     assignBlock(n);
                     blockBeginNodes.add(n);
@@ -221,14 +221,12 @@
         if (prevBlock != null) {
             return prevBlock;
         }
-        TTY.println("handling " + n);
 
         Block block = null;
         for (Node succ : n.successors()) {
             block = getCommonDominator(block, assignLatestPossibleBlockToNode(succ));
         }
         for (Node usage : n.usages()) {
-            TTY.println("usaged at: " + usage.id() + ", " + nodeToBlock.get(usage));
             if (usage instanceof Phi) {
                 Phi phi = (Phi) usage;
                 Merge merge = phi.block();
@@ -244,7 +242,6 @@
             }
         }
 
-        TTY.println("assigning block " + block + " to node " + n);
         nodeToBlock.set(n, block);
         if (block != null) {
             block.getInstructions().add(n);
@@ -273,7 +270,9 @@
         List<Node> instructions = b.getInstructions();
         List<Node> sortedInstructions = new ArrayList<Node>();
         assert !map.isMarked(b.firstNode()) && nodeToBlock.get(b.firstNode()) == b;
-        addToSorting(b, b.firstNode(), sortedInstructions, map);
+        if (b.firstNode() != b.lastNode()) {
+            addToSorting(b, b.firstNode(), sortedInstructions, map);
+        }
         for (Node i : instructions) {
             addToSorting(b, i, sortedInstructions, map);
         }
@@ -281,10 +280,10 @@
         //assert b.firstNode() == sortedInstructions.get(0) : b.firstNode();
     //    assert b.lastNode() == sortedInstructions.get(sortedInstructions.size() - 1);
         b.setInstructions(sortedInstructions);
-        TTY.println("Block " + b);
-        for (Node n : sortedInstructions) {
-            TTY.println("Node: " + n);
-        }
+//        TTY.println("Block " + b);
+//        for (Node n : sortedInstructions) {
+//            TTY.println("Node: " + n);
+//        }
     }
 
     private void addToSorting(Block b, Node i, List<Node> sortedInstructions, NodeBitMap map) {
--- a/graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java	Fri May 27 19:57:56 2011 +0200
+++ b/graal/GraalCompiler/src/com/sun/c1x/gen/LIRGenerator.java	Fri May 27 23:38:52 2011 +0200
@@ -1291,7 +1291,7 @@
 
     private List<Phi> getPhis(LIRBlock block) {
         if (block.getInstructions().size() > 0) {
-            Node i = block.getInstructions().get(0);
+            Node i = block.firstInstruction();
             if (i instanceof Merge) {
                 List<Phi> result = new ArrayList<Phi>();
                 for (Node n : i.usages()) {