changeset 21093:a11325faa4d9

Distinguish ends in the scheduling phase that always have to be the last node from other ends.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Thu, 23 Apr 2015 13:37:11 +0200
parents 87aac173f09d
children 56668f0816f7
files graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java
diffstat 1 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java	Wed Apr 22 21:58:23 2015 +0200
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java	Thu Apr 23 13:37:11 2015 +0200
@@ -314,7 +314,7 @@
         }
         FixedNode endNode = b.getEndNode();
         FixedNode fixedEndNode = null;
-        if (endNode instanceof ControlSplitNode || endNode instanceof AbstractEndNode) {
+        if (isFixedEnd(endNode)) {
             // Only if the end node is either a control split or an end node, we need to force it to
             // be the last node in the schedule.
             fixedEndNode = endNode;
@@ -497,8 +497,10 @@
         // Start analysis with control flow ends.
         for (Block b : cfg.postOrder()) {
             FixedNode endNode = b.getEndNode();
-            stack.push(endNode);
-            nodeToBlock.set(endNode, b);
+            if (isFixedEnd(endNode)) {
+                stack.push(endNode);
+                nodeToBlock.set(endNode, b);
+            }
         }
 
         processStack(cfg, blockToNodes, nodeToBlock, visited, floatingReads, stack);
@@ -545,8 +547,10 @@
         // Add end nodes as the last nodes in each block.
         for (Block b : cfg.getBlocks()) {
             FixedNode endNode = b.getEndNode();
-            if (endNode != b.getBeginNode()) {
-                addNode(blockToNodes, b, endNode);
+            if (isFixedEnd(endNode)) {
+                if (endNode != b.getBeginNode()) {
+                    addNode(blockToNodes, b, endNode);
+                }
             }
         }
 
@@ -561,6 +565,10 @@
         assert MemoryScheduleVerification.check(cfg.getStartBlock(), blockToNodes);
     }
 
+    private static boolean isFixedEnd(FixedNode endNode) {
+        return endNode instanceof ControlSplitNode || endNode instanceof ControlSinkNode || endNode instanceof AbstractEndNode;
+    }
+
     private static void resortEarliestWithinBlock(Block b, BlockMap<List<Node>> blockToNodes, NodeMap<Block> nodeToBlock, NodeBitMap unprocessed) {
         ArrayList<FloatingReadNode> watchList = new ArrayList<>();
         List<Node> oldList = blockToNodes.get(b);