Mercurial > hg > graal-compiler
changeset 7551:68a59067974a
made DebugValue implement Comparable and removed comparator that sorted the "Runs" metric before all others
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 24 Jan 2013 16:58:53 +0100 |
parents | 2820060df953 |
children | a200d10867f1 |
files | graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugValue.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java |
diffstat | 2 files changed, 6 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugValue.java Thu Jan 24 16:44:40 2013 +0100 +++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugValue.java Thu Jan 24 16:58:53 2013 +0100 @@ -22,23 +22,8 @@ */ package com.oracle.graal.debug.internal; -import java.util.*; -public abstract class DebugValue { - - public static final Comparator<DebugValue> ORDER_BY_NAME = new Comparator<DebugValue>() { - @Override - public int compare(DebugValue o1, DebugValue o2) { - // this keeps the "Runs" metric at the top of the list - if (o1.getName().equals("Runs")) { - return o2.getName().equals("Runs") ? 0 : -1; - } - if (o2.getName().equals("Runs")) { - return o1.getName().equals("Runs") ? 0 : 1; - } - return o1.getName().compareTo(o2.getName()); - } - }; +public abstract class DebugValue implements Comparable<DebugValue> { private String name; private int index; @@ -76,5 +61,9 @@ return name; } + public int compareTo(DebugValue o) { + return name.compareTo(o.name); + } + public abstract String toString(long value); }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java Thu Jan 24 16:44:40 2013 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java Thu Jan 24 16:58:53 2013 +0100 @@ -285,7 +285,7 @@ List<DebugValue> debugValues = KeyRegistry.getDebugValues(); if (debugValues.size() > 0) { ArrayList<DebugValue> sortedValues = new ArrayList<>(debugValues); - Collections.sort(sortedValues, DebugValue.ORDER_BY_NAME); + Collections.sort(sortedValues); if (GraalOptions.SummarizeDebugValues) { printSummary(topLevelMaps, sortedValues);