Mercurial > hg > truffle
changeset 6469:ec2211254419
Merge.
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 01 Oct 2012 16:12:45 +0200 |
parents | afe7d46f1311 (current diff) 6f2b35ef59b0 (diff) |
children | b1010f7bc0bf |
files | |
diffstat | 2 files changed, 10 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler.phases/src/com/oracle/graal/compiler/phases/FloatingReadPhase.java Mon Oct 01 16:12:28 2012 +0200 +++ b/graal/com.oracle.graal.compiler.phases/src/com/oracle/graal/compiler/phases/FloatingReadPhase.java Mon Oct 01 16:12:45 2012 +0200 @@ -102,17 +102,17 @@ keys.add(key); } } + @SuppressWarnings("unchecked") + IdentityHashMap<Object, ValueNode> newMemorySnapshot = (IdentityHashMap<Object, ValueNode>) lastMemorySnapshot.clone(); for (Object key : keys) { ValueNode merged = lastMemorySnapshot.get(key); if (merged == null) { merged = lastMemorySnapshot.get(LocationNode.ANY_LOCATION); } - Iterator<MemoryMap> it = withStates.iterator(); - int i = 1; + int mergedStatesCount = 1; boolean isPhi = false; - while (it.hasNext()) { - MemoryMap other = it.next(); + for (MemoryMap other : withStates) { ValueNode otherValue = other.lastMemorySnapshot.get(key); if (otherValue == null) { otherValue = other.lastMemorySnapshot.get(LocationNode.ANY_LOCATION); @@ -121,17 +121,19 @@ ((PhiNode) merged).addInput(otherValue); } else if (merged != otherValue) { PhiNode phi = merge.graph().add(new PhiNode(PhiType.Memory, merge)); - for (int j = 0; j < i; j++) { + for (int j = 0; j < mergedStatesCount; j++) { phi.addInput(merged); } phi.addInput(otherValue); merged = phi; isPhi = true; - lastMemorySnapshot.put(key, phi); + newMemorySnapshot.put(key, phi); } - i++; + mergedStatesCount++; } } + + lastMemorySnapshot = newMemorySnapshot; return true; }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PhiNode.java Mon Oct 01 16:12:28 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PhiNode.java Mon Oct 01 16:12:45 2012 +0200 @@ -179,6 +179,7 @@ } public void addInput(ValueNode x) { + assert !(x instanceof PhiNode) || ((PhiNode) x).merge() instanceof LoopBeginNode || ((PhiNode) x).merge() != this.merge(); values.add(x); }