diff graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java @ 11674:8505bcff4bdc

New graph duplication mechanism that allows in-place fixing of edges.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Mon, 16 Sep 2013 23:17:56 +0200
parents 3967f9f306f8
children 435c8b984680
line wrap: on
line diff
--- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java	Mon Sep 16 20:37:44 2013 +0200
+++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java	Mon Sep 16 23:17:56 2013 +0200
@@ -594,6 +594,10 @@
     static int count = 0;
 
     public Node clone(Graph into) {
+        return clone(into, true);
+    }
+
+    Node clone(Graph into, boolean clearInputsAndSuccessors) {
         NodeClass nodeClass = getNodeClass();
         if (nodeClass.valueNumberable() && nodeClass.isLeafNode()) {
             Node otherNode = into.findNodeInCache(this);
@@ -608,8 +612,10 @@
         } catch (CloneNotSupportedException e) {
             throw new GraalInternalError(e).addContext(this);
         }
-        nodeClass.clearInputs(newNode);
-        nodeClass.clearSuccessors(newNode);
+        if (clearInputsAndSuccessors) {
+            nodeClass.clearInputs(newNode);
+            nodeClass.clearSuccessors(newNode);
+        }
         newNode.graph = into;
         newNode.typeCacheNext = null;
         newNode.id = INITIAL_ID;