changeset 19610:4f8226c98a02

Improve node error messges when nodes are inserted with non-alive inputs or successors.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Wed, 25 Feb 2015 21:00:59 +0100
parents b964772c43bd
children 820c8ab479e5
files graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java
diffstat 1 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java	Wed Feb 25 18:14:35 2015 +0100
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java	Wed Feb 25 21:00:59 2015 +0100
@@ -521,8 +521,18 @@
         assert assertTrue(id == INITIAL_ID, "unexpected id: %d", id);
         this.graph = newGraph;
         newGraph.register(this);
-        this.acceptInputs((n, i) -> n.updateUsages(null, i));
-        this.acceptSuccessors((n, s) -> n.updatePredecessor(null, s));
+        this.acceptInputs((n, i) -> {
+            if (!i.isAlive()) {
+                throw new IllegalStateException(String.format("Input %s of newly created node %s is not alive.", i, n));
+            }
+            n.updateUsages(null, i);
+        });
+        this.acceptSuccessors((n, s) -> {
+            if (!s.isAlive()) {
+                throw new IllegalStateException(String.format("Successor %s of newly created node %s is not alive.", s, n));
+            }
+            n.updatePredecessor(null, s);
+        });
     }
 
     public final NodeClass<? extends Node> getNodeClass() {