Mercurial > hg > graal-compiler
changeset 11677:9d341b6e47e5
Correct custom clone implementations after change of Node base class clone method.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Tue, 17 Sep 2013 02:35:52 +0200 |
parents | 435c8b984680 |
children | 89e9476040de |
files | graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/SwitchNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/CommitAllocationNode.java |
diffstat | 3 files changed, 13 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- 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");
--- 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); } }
--- 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