# HG changeset patch # User Doug Simon # Date 1378893398 -7200 # Node ID 73dbd282ad3abd4b8997fc4935330e56000b87e2 # Parent ceecc37b44d795d7b1a7c0d60605b5d3682ae32e# Parent 72379668554638d9d00cad14d34fbcf41d919fb5 Merge. diff -r 723796685546 -r 73dbd282ad3a graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalDebugConfig.java --- 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 DebugValueSummary = new OptionValue<>("Complete"); + public static final OptionValue DebugValueSummary = new OptionValue<>("Name"); @Option(help = "Send Graal IR to dump handlers on error") public static final OptionValue DumpOnError = new OptionValue<>(false); @Option(help = "Enable expensive assertions") diff -r 723796685546 -r 73dbd282ad3a graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java --- 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); diff -r 723796685546 -r 73dbd282ad3a graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/LoweringPhase.java --- 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(); } diff -r 723796685546 -r 73dbd282ad3a graal/com.oracle.graal.phases/src/com/oracle/graal/phases/BasePhase.java --- 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 { - 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() {