changeset 2996:4025f436a2e4

Clean up scheduler. Remove test for HIR loop end in LIRGenerator.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Thu, 16 Jun 2011 14:20:20 +0200
parents 00e0c0928e7c
children a100e097a675
files graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRGenerator.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRBlock.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/GraphBuilderPhase.java graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/schedule/IdentifyBlocksPhase.java
diffstat 4 files changed, 12 insertions(+), 48 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRGenerator.java	Thu Jun 16 13:45:16 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/gen/LIRGenerator.java	Thu Jun 16 14:20:20 2011 +0200
@@ -267,7 +267,7 @@
                 }
             }
         }
-        if (block.blockSuccessors().size() >= 1 && !jumpsToNextBlock(block.lastInstruction())) {
+        if (block.blockSuccessors().size() >= 1 && !block.endsWithJump()) {
             block.lir().jump(getLIRBlock((FixedNode) block.lastInstruction().successors().get(0)));
         }
 
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRBlock.java	Thu Jun 16 13:45:16 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/lir/LIRBlock.java	Thu Jun 16 14:20:20 2011 +0200
@@ -256,4 +256,13 @@
     public void setLastInstruction(Node n) {
         last = n;
     }
+
+    public boolean endsWithJump() {
+        List<LIRInstruction> instructionsList = lir.instructionsList();
+        if (instructionsList.size() == 0) {
+            return false;
+        }
+        LIROpcode code = instructionsList.get(instructionsList.size() - 1).code;
+        return code == LIROpcode.Branch || code == LIROpcode.TableSwitch;
+    }
 }
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/GraphBuilderPhase.java	Thu Jun 16 13:45:16 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/phases/GraphBuilderPhase.java	Thu Jun 16 14:20:20 2011 +0200
@@ -1279,7 +1279,6 @@
         stream.setBCI(block.startBci);
 
         int endBCI = stream.endBCI();
-        boolean blockStart = true;
 
         int bci = block.startBci;
         while (bci < endBCI) {
@@ -1292,9 +1291,8 @@
             }
             // read the opcode
             int opcode = stream.currentBC();
-
             traceState();
-            traceInstruction(bci, opcode, blockStart);
+            traceInstruction(bci, opcode, bci == block.startBci);
             processBytecode(bci, opcode);
 
             if (IdentifyBlocksPhase.isBlockEnd(lastInstr) || lastInstr.next() != null) {
@@ -1309,7 +1307,6 @@
                     stateSplit.setStateAfter(frameState.create(bci));
                 }
             }
-            blockStart = false;
         }
     }
 
--- a/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/schedule/IdentifyBlocksPhase.java	Thu Jun 16 13:45:16 2011 +0200
+++ b/graal/com.oracle.max.graal.compiler/src/com/oracle/max/graal/compiler/schedule/IdentifyBlocksPhase.java	Thu Jun 16 14:20:20 2011 +0200
@@ -65,39 +65,6 @@
         return b;
     }
 
-    private Block assignBlock(Node n) {
-        Block curBlock = nodeToBlock.get(n);
-        if (curBlock == null) {
-            curBlock = createBlock();
-            return assignBlock(n, curBlock);
-        }
-        return curBlock;
-    }
-
-
-    private Block assignBlock(Node n, Block b) {
-        assert nodeToBlock.get(n) == null;
-        nodeToBlock.set(n, b);
-        for (Node input : n.inputs()) {
-            if (input instanceof FrameState) {
-                assert nodeToBlock.get(n) == null;
-                nodeToBlock.set(n, b);
-            }
-        }
-
-        if (b.firstNode() == null) {
-            b.setFirstNode(n);
-            b.setLastNode(n);
-        } else {
-            if (b.lastNode() != null) {
-                b.getInstructions().add(b.lastNode());
-            }
-            b.setLastNode(n);
-        }
-        b.setLastNode(n);
-        return b;
-    }
-
     private Block assignBlockNew(Node n, Block b) {
         if (b == null) {
             b = createBlock();
@@ -377,13 +344,8 @@
             return;
         }
 
-        FrameState state = null;
         for (Node input : i.inputs()) {
-//            if (input instanceof FrameState) {
-//               state = (FrameState) input;
-//            } else {
-                addToSorting(b, input, sortedInstructions, map);
-//            }
+            addToSorting(b, input, sortedInstructions, map);
         }
 
         for (Node pred : i.predecessors()) {
@@ -392,10 +354,6 @@
 
         map.mark(i);
 
-        if (state != null) {
-            addToSorting(b, state, sortedInstructions, map);
-        }
-
         for (Node succ : i.successors()) {
             if (succ instanceof FrameState) {
                 addToSorting(b, succ, sortedInstructions, map);