# HG changeset patch # User Thomas Wuerthinger # Date 1379378152 -7200 # Node ID 9d341b6e47e50d49bfa12bf64fd5a91218b99108 # Parent 435c8b98468075086dcc34287c165090bfee1d99 Correct custom clone implementations after change of Node base class clone method. diff -r 435c8b984680 -r 9d341b6e47e5 graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java Tue Sep 17 01:14:21 2013 +0200 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java Tue Sep 17 02:35:52 2013 +0200 @@ -593,11 +593,11 @@ static int count = 0; - public Node clone(Graph into) { + public final Node clone(Graph into) { return clone(into, true); } - Node clone(Graph into, boolean clearInputsAndSuccessors) { + final Node clone(Graph into, boolean clearInputsAndSuccessors) { NodeClass nodeClass = getNodeClass(); if (nodeClass.valueNumberable() && nodeClass.isLeafNode()) { Node otherNode = into.findNodeInCache(this); @@ -628,9 +628,13 @@ if (nodeClass.valueNumberable() && nodeClass.isLeafNode()) { into.putNodeIntoCache(newNode); } + newNode.afterClone(this); return newNode; } + protected void afterClone(@SuppressWarnings("unused") Node other) { + } + public boolean verify() { assertTrue(isAlive(), "cannot verify inactive nodes (id=%d)", id); assertTrue(graph() != null, "null graph"); diff -r 435c8b984680 -r 9d341b6e47e5 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/SwitchNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/SwitchNode.java Tue Sep 17 01:14:21 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/SwitchNode.java Tue Sep 17 02:35:52 2013 +0200 @@ -170,10 +170,9 @@ } @Override - public SwitchNode clone(Graph into) { - SwitchNode newSwitch = (SwitchNode) super.clone(into); - newSwitch.keyProbabilities = Arrays.copyOf(keyProbabilities, keyProbabilities.length); - newSwitch.keySuccessors = Arrays.copyOf(keySuccessors, keySuccessors.length); - return newSwitch; + public void afterClone(Node other) { + SwitchNode oldSwitch = (SwitchNode) other; + keyProbabilities = Arrays.copyOf(oldSwitch.keyProbabilities, oldSwitch.keyProbabilities.length); + keySuccessors = Arrays.copyOf(oldSwitch.keySuccessors, oldSwitch.keySuccessors.length); } } diff -r 435c8b984680 -r 9d341b6e47e5 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/CommitAllocationNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/CommitAllocationNode.java Tue Sep 17 01:14:21 2013 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/CommitAllocationNode.java Tue Sep 17 02:35:52 2013 +0200 @@ -55,7 +55,7 @@ @Override public boolean verify() { - assertTrue(virtualObjects.size() == locks.size(), "lockCounts size doesn't match"); + assertTrue(virtualObjects.size() == locks.size(), "lockCounts size doesn't match " + virtualObjects + ", " + locks); int valueCount = 0; for (VirtualObjectNode virtual : virtualObjects) { valueCount += virtual.entryCount(); @@ -70,10 +70,8 @@ } @Override - public Node clone(Graph into) { - CommitAllocationNode clone = (CommitAllocationNode) super.clone(into); - clone.locks = new ArrayList<>(locks); - return clone; + public void afterClone(Node other) { + locks = new ArrayList<>(((CommitAllocationNode) other).locks); } @Override