# HG changeset patch # User Thomas Wuerthinger # Date 1424377591 -3600 # Node ID 3446ae32a2d80fecd5783209f3fc02f77e428f18 # Parent caad3adc5fdefb8803e870d6cbb115e846ea60d9 Simplify LoopBeginNode#orderedLoopEnds. diff -r caad3adc5fde -r 3446ae32a2d8 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoopBeginNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoopBeginNode.java Thu Feb 19 21:06:37 2015 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoopBeginNode.java Thu Feb 19 21:26:31 2015 +0100 @@ -98,16 +98,12 @@ * * @return the set of {@code LoopEndNode} that correspond to back-edges for this loop */ - public List orderedLoopEnds() { - List snapshot = loopEnds().snapshot(); - Collections.sort(snapshot, new Comparator() { - - @Override - public int compare(LoopEndNode o1, LoopEndNode o2) { - return o1.endIndex() - o2.endIndex(); - } - }); - return snapshot; + public LoopEndNode[] orderedLoopEnds() { + LoopEndNode[] result = new LoopEndNode[this.getLoopEndCount()]; + for (LoopEndNode end : loopEnds()) { + result[end.endIndex()] = end; + } + return result; } public AbstractEndNode forwardEnd() { @@ -183,6 +179,10 @@ return nextEndIndex++; } + public int getLoopEndCount() { + return nextEndIndex; + } + public int unswitches() { return unswitches; }