Mercurial > hg > graal-compiler
changeset 6667:e54aeb000ad7
Directly return the NodeSuccessorList in ControlSplitNode.blockSuccessors instead of creating a new Iterable
Add comments to LoopBeginNode.loopEnds()/orderedLoopEnds()
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Tue, 06 Nov 2012 13:57:04 +0100 |
parents | 6b71c116b370 |
children | eaca0ecbf0ca |
files | graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ControlSplitNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoopBeginNode.java |
diffstat | 2 files changed, 11 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ControlSplitNode.java Mon Nov 05 12:58:32 2012 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/ControlSplitNode.java Tue Nov 06 13:57:04 2012 +0100 @@ -62,27 +62,7 @@ } public Iterable<BeginNode> blockSuccessors() { - return new Iterable<BeginNode>() { - @Override - public Iterator<BeginNode> iterator() { - return new Iterator<BeginNode>() { - int i = 0; - @Override - public void remove() { - throw new UnsupportedOperationException(); - } - @Override - public BeginNode next() { - return ControlSplitNode.this.blockSuccessor(i++); - } - - @Override - public boolean hasNext() { - return i < ControlSplitNode.this.blockSuccessorCount(); - } - }; - } - }; + return blockSuccessors; } public int blockSuccessorIndex(BeginNode successor) {
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoopBeginNode.java Mon Nov 05 12:58:32 2012 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoopBeginNode.java Tue Nov 06 13:57:04 2012 +0100 @@ -48,6 +48,11 @@ this.loopFrequency = loopFrequency; } + /** + * Returns the <b>unordered</b> set of {@link LoopEndNode} that correspond to back-edges for this loop. + * The order of the back-edges is unspecified, if you need to get an ordering compatible for {@link PhiNode} creation, use {@link #orderedLoopEnds()}. + * @return the set of {@code LoopEndNode} that correspond to back-edges for this loop + */ public NodeIterable<LoopEndNode> loopEnds() { return usages().filter(LoopEndNode.class); } @@ -61,6 +66,11 @@ return super.anchored().filter(isNotA(LoopEndNode.class).nor(LoopExitNode.class)); } + /** + * Returns the set of {@link LoopEndNode} that correspond to back-edges for this loop, ordered in increasing {@link #phiPredecessorIndex}. + * This method is suited to create new loop {@link PhiNode}. + * @return the set of {@code LoopEndNode} that correspond to back-edges for this loop + */ public List<LoopEndNode> orderedLoopEnds() { List<LoopEndNode> snapshot = loopEnds().snapshot(); Collections.sort(snapshot, new Comparator<LoopEndNode>() {