Mercurial > hg > truffle
changeset 19510:3446ae32a2d8
Simplify LoopBeginNode#orderedLoopEnds.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Thu, 19 Feb 2015 21:26:31 +0100 |
parents | caad3adc5fde |
children | 2d045c20b1fd |
files | graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LoopBeginNode.java |
diffstat | 1 files changed, 10 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- 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<LoopEndNode> orderedLoopEnds() { - List<LoopEndNode> snapshot = loopEnds().snapshot(); - Collections.sort(snapshot, new Comparator<LoopEndNode>() { - - @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; }