changeset 11602:73dbd282ad3a

Merge.
author Doug Simon <doug.simon@oracle.com>
date Wed, 11 Sep 2013 11:56:38 +0200
parents ceecc37b44d7 (diff) 723796685546 (current diff)
children 152b4146f05b
files
diffstat 4 files changed, 39 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalDebugConfig.java	Wed Sep 11 09:13:27 2013 +0200
+++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalDebugConfig.java	Wed Sep 11 11:56:38 2013 +0200
@@ -51,7 +51,7 @@
                    "Partial - aggregate by partially qualified name (e.g., A.B.C.D.Counter and X.Y.Z.D.Counter will be merged to D.Counter)%n" +
                    "Complete - aggregate by qualified name%n" +
                    "Thread - aggregate by qualified name and thread")
-    public static final OptionValue<String> DebugValueSummary = new OptionValue<>("Complete");
+    public static final OptionValue<String> DebugValueSummary = new OptionValue<>("Name");
     @Option(help = "Send Graal IR to dump handlers on error")
     public static final OptionValue<Boolean> DumpOnError = new OptionValue<>(false);
     @Option(help = "Enable expensive assertions")
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java	Wed Sep 11 09:13:27 2013 +0200
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java	Wed Sep 11 11:56:38 2013 +0200
@@ -67,7 +67,7 @@
     private static final DebugMetric metricInliningPerformed = Debug.metric("InliningPerformed");
     private static final DebugMetric metricInliningConsidered = Debug.metric("InliningConsidered");
     private static final DebugMetric metricInliningStoppedByMaxDesiredSize = Debug.metric("InliningStoppedByMaxDesiredSize");
-    private static final DebugMetric metricInliningRuns = Debug.metric("Runs");
+    private static final DebugMetric metricInliningRuns = Debug.metric("InliningRuns");
 
     public InliningPhase(CanonicalizerPhase canonicalizer) {
         this(new GreedyInliningPolicy(null), canonicalizer);
--- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java	Wed Sep 11 09:13:27 2013 +0200
+++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java	Wed Sep 11 11:56:38 2013 +0200
@@ -167,7 +167,7 @@
         private final SchedulePhase schedule;
 
         private Round(int iteration, PhaseContext context) {
-            super(String.format("Lowering iteration %d", iteration));
+            super("LoweringIteration" + iteration);
             this.context = context;
             this.schedule = new SchedulePhase();
         }
--- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/BasePhase.java	Wed Sep 11 09:13:27 2013 +0200
+++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/BasePhase.java	Wed Sep 11 11:56:38 2013 +0200
@@ -22,7 +22,10 @@
  */
 package com.oracle.graal.phases;
 
+import java.util.regex.*;
+
 import com.oracle.graal.debug.*;
+import com.oracle.graal.debug.internal.*;
 import com.oracle.graal.nodes.*;
 
 /**
@@ -32,19 +35,35 @@
  */
 public abstract class BasePhase<C> {
 
-    private String name;
+    private final String name;
+
+    private final DebugTimer phaseTimer;
+    private final DebugMetric phaseMetric;
 
-    private static final DebugMetric metricPhaseRuns = Debug.metric("Runs");
+    private static final Pattern NAME_PATTERN = Pattern.compile("[A-Z][A-Za-z0-9]+");
+
+    private static boolean checkName(String name) {
+        assert NAME_PATTERN.matcher(name).matches() : "illegal phase name: " + name;
+        return true;
+    }
 
     protected BasePhase() {
-        this.name = this.getClass().getSimpleName();
-        if (name.endsWith("Phase")) {
-            name = name.substring(0, name.length() - "Phase".length());
+        String nm = this.getClass().getSimpleName();
+        if (nm.endsWith("Phase")) {
+            name = nm.substring(0, nm.length() - "Phase".length());
+        } else {
+            name = nm;
         }
+        assert checkName(name);
+        phaseTimer = Debug.timer("Phase_" + name);
+        phaseMetric = Debug.metric("Phase_" + name);
     }
 
     protected BasePhase(String name) {
+        assert checkName(name);
         this.name = name;
+        phaseTimer = Debug.timer("Phase_" + name);
+        phaseMetric = Debug.metric("Phase_" + name);
     }
 
     protected String getDetailedName() {
@@ -56,17 +75,20 @@
     }
 
     public final void apply(final StructuredGraph graph, final C context, final boolean dumpGraph) {
-        Debug.scope(name, this, new Runnable() {
+        try (TimerCloseable a = phaseTimer.start()) {
+
+            Debug.scope(name, this, new Runnable() {
 
-            public void run() {
-                BasePhase.this.run(graph, context);
-                metricPhaseRuns.increment();
-                if (dumpGraph) {
-                    Debug.dump(graph, "After phase %s", name);
+                public void run() {
+                    BasePhase.this.run(graph, context);
+                    phaseMetric.increment();
+                    if (dumpGraph) {
+                        Debug.dump(graph, "After phase %s", name);
+                    }
+                    assert graph.verify();
                 }
-                assert graph.verify();
-            }
-        });
+            });
+        }
     }
 
     public final String getName() {