changeset 19960:999430bcc941

Small fix for memory schedule verification. The begin node is not always the first node in the block if it is at the same time also the end node.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Thu, 19 Mar 2015 15:38:33 +0100
parents 812fc403db8c
children 71040f48cc34
files graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/MemoryScheduleVerification.java
diffstat 1 files changed, 12 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/MemoryScheduleVerification.java	Thu Mar 19 12:47:06 2015 +0100
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/MemoryScheduleVerification.java	Thu Mar 19 15:38:33 2015 +0100
@@ -55,18 +55,17 @@
 
     @Override
     protected Set<FloatingReadNode> processBlock(Block block, Set<FloatingReadNode> currentState) {
+        AbstractBeginNode beginNode = block.getBeginNode();
+        if (beginNode instanceof AbstractMergeNode) {
+            AbstractMergeNode abstractMergeNode = (AbstractMergeNode) beginNode;
+            for (PhiNode phi : abstractMergeNode.phis()) {
+                if (phi instanceof MemoryPhiNode) {
+                    MemoryPhiNode memoryPhiNode = (MemoryPhiNode) phi;
+                    addFloatingReadUsages(currentState, memoryPhiNode);
+                }
+            }
+        }
         for (Node n : blockToNodesMap.get(block)) {
-            if (n instanceof AbstractMergeNode) {
-                AbstractMergeNode abstractMergeNode = (AbstractMergeNode) n;
-                for (PhiNode phi : abstractMergeNode.phis()) {
-                    if (phi instanceof MemoryPhiNode) {
-                        MemoryPhiNode memoryPhiNode = (MemoryPhiNode) phi;
-                        addFloatingReadUsages(currentState, memoryPhiNode);
-                    }
-                }
-
-            }
-
             if (n instanceof MemoryCheckpoint) {
                 if (n instanceof MemoryCheckpoint.Single) {
                     MemoryCheckpoint.Single single = (MemoryCheckpoint.Single) n;
@@ -88,7 +87,8 @@
                         // Floating read was found in the state.
                         currentState.remove(floatingReadNode);
                     } else {
-                        throw new RuntimeException("Floating read node " + n + " was not found in the state, i.e., it was killed by a memory check point before its place in the schedule");
+                        throw new RuntimeException("Floating read node " + n + " was not found in the state, i.e., it was killed by a memory check point before its place in the schedule. Block=" +
+                                        block + ", block begin: " + block.getBeginNode() + " block loop: " + block.getLoop() + ", " + blockToNodesMap.get(block).get(0));
                     }
                 }