Mercurial > hg > graal-jvmci-8
changeset 5420:44c378aa4c47
Merge
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Tue, 22 May 2012 11:37:07 +0200 |
parents | 3c16d338888e (current diff) d3dec1a05a80 (diff) |
children | ce2398984e39 |
files | |
diffstat | 2 files changed, 19 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/FloatingReadPhase.java Tue May 22 11:36:45 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/FloatingReadPhase.java Tue May 22 11:37:07 2012 +0200 @@ -50,7 +50,7 @@ map.putAll(other.map); } - public void mergeLoopEntryWith(MemoryMap otherMemoryMap, LoopBeginNode begin) { + public void mergeLoopEntryWith(MemoryMap otherMemoryMap, LoopBeginNode begin, EndNode pred) { for (Object keyInOther : otherMemoryMap.map.keySet()) { assert loopEntryMap.containsKey(keyInOther) || map.get(keyInOther) == otherMemoryMap.map.get(keyInOther) : keyInOther + ", " + map.get(keyInOther) + " vs " + otherMemoryMap.map.get(keyInOther) + " " + begin; } @@ -65,7 +65,10 @@ other = otherMemoryMap.map.get(LocationNode.ANY_LOCATION); } - phiNode.addInput((ValueNode) other); + // this explicitly honors the phi input index, since the iteration order will not always adhere to the end index ordering. + // TODO(ls) check for instances of this problem in other places. + int index = begin.phiPredecessorIndex(pred); + phiNode.initializeValueAt(index, (ValueNode) other); } } @@ -114,6 +117,7 @@ assert phi.valueCount() <= phi.merge().forwardEndCount() : phi.merge(); } else { PhiNode phi = m.graph().unique(new PhiNode(CiKind.Illegal, m, PhiType.Memory)); + // TODO(ls) how does this work? add documentation ... for (int i = 0; i < mergeOperationCount + 1; ++i) { phi.addInput((ValueNode) original); } @@ -293,7 +297,7 @@ MemoryMap memoryMap = memoryMaps[beginBlock.getId()]; assert memoryMap != null; assert memoryMap.getLoopEntryMap() != null; - memoryMap.mergeLoopEntryWith(map, begin); + memoryMap.mergeLoopEntryWith(map, begin, (EndNode) b.getEndNode()); } }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PhiNode.java Tue May 22 11:36:45 2012 +0200 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/PhiNode.java Tue May 22 11:37:07 2012 +0200 @@ -93,6 +93,18 @@ return values.get(i); } + /** + * Sets the value at the given index and makes sure that the values list is large enough. + * @param i the index at which to set the value + * @param x the new phi input value for the given location + */ + public void initializeValueAt(int i, ValueNode x) { + while (values().size() <= i) { + values.add(null); + } + values.set(i, x); + } + public void setValueAt(int i, ValueNode x) { values.set(i, x); }