# HG changeset patch # User Thomas Wuerthinger # Date 1400887946 -7200 # Node ID e5e7d9dfff1ac3e32ca290663ad245728759de80 # Parent 4d18c6bb6b3a6da8144c14ade4444df4580827bb LinearScan: Clean up interval comparator and replace with lambda form. diff -r 4d18c6bb6b3a -r e5e7d9dfff1a graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java Sat May 24 01:16:09 2014 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java Sat May 24 01:32:26 2014 +0200 @@ -1366,7 +1366,7 @@ int newLen = newList.length; // conventional sort-algorithm for new intervals - Arrays.sort(newList, INTERVAL_COMPARATOR); + Arrays.sort(newList, (Interval a, Interval b) -> a.from() - b.from()); // merge old and new list (both already sorted) into one combined list Interval[] combinedList = new Interval[oldLen + newLen]; @@ -1386,25 +1386,6 @@ sortedIntervals = combinedList; } - private static final Comparator INTERVAL_COMPARATOR = new Comparator() { - - public int compare(Interval a, Interval b) { - if (a != null) { - if (b != null) { - return a.from() - b.from(); - } else { - return -1; - } - } else { - if (b != null) { - return 1; - } else { - return 0; - } - } - } - }; - public void allocateRegisters() { try (Indent indent = Debug.logAndIndent("allocate registers")) { Interval precoloredIntervals;