Skip to content

Commit 689a9fb

Browse files
committed
report hot metrics phase: add before phase running as well, also tie to
method filter if set
1 parent cf72b57 commit 689a9fb

File tree

1 file changed

+18
-4
lines changed
  • compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/phases

1 file changed

+18
-4
lines changed

compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/phases/BasePhase.java

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,9 @@ public static class PhaseOptions {
205205
@Option(help = "Exclude certain phases from compilation based on the given phase filter(s)." + PhaseFilterKey.HELP, type = OptionType.Debug)
206206
public static final PhaseFilterKey CompilationExcludePhases = new PhaseFilterKey(null, null);
207207
@Option(help = "Report hot metrics after each phase matching the given phase filter(s).", type = OptionType.Debug)
208-
public static final PhaseFilterKey ReportHotMetricsAfterPhases = new PhaseFilterKey("DominatorBasedGlobalValueNumberingPhase=*", null);
208+
public static final PhaseFilterKey ReportHotMetricsAfterPhases = new PhaseFilterKey(null, null);
209+
@Option(help = "Report hot metrics before each phase matching the given phase filter(s).", type = OptionType.Debug)
210+
public static final PhaseFilterKey ReportHotMetricsBeforePhases = new PhaseFilterKey("HighTierLoweringPhase=*", null);
209211
@Option(help = "Report hot metrics extracted from compiler IR.", type = OptionType.Debug)
210212
public static final OptionKey<Boolean> ReportHotMetrics = new OptionKey<>(false);
211213
// @formatter:on
@@ -454,6 +456,15 @@ public final void apply(final StructuredGraph graph, final C context, final bool
454456
dumpedBefore = dumpBefore(graph, context, isTopLevel, true);
455457
}
456458

459+
if (PhaseOptions.ReportHotMetrics.getValue(options) && PhaseOptions.ReportHotMetricsBeforePhases.matches(options, this, graph)) {
460+
// if there is a method filter set we must also match that one
461+
if (graph.getDebug().methodFilterMatchesCurrentMethod()) {
462+
String label = graph.name != null ? graph.name : graph.method().format("%H.%n(%p)");
463+
TTY.println("Reporting hot metrics before " + getName() + " during compilation of " + label);
464+
new ReportHotCodePhase().apply(graph, context);
465+
}
466+
}
467+
457468
// This is a manual version of a try/resource pattern since the close operation might
458469
// want to know whether the run call completed with an exception or not.
459470
ApplyScope applyScope = applyScope(graph, context);
@@ -501,9 +512,12 @@ public final void apply(final StructuredGraph graph, final C context, final bool
501512
}
502513

503514
if (PhaseOptions.ReportHotMetrics.getValue(options) && PhaseOptions.ReportHotMetricsAfterPhases.matches(options, this, graph)) {
504-
String label = graph.name != null ? graph.name : graph.method().format("%H.%n(%p)");
505-
TTY.println("Reporting hot metrics after " + getName() + " during compilation of " + label);
506-
new ReportHotCodePhase().apply(graph, context);
515+
// if there is a method filter set we must also match that one
516+
if (graph.getDebug().methodFilterMatchesCurrentMethod()) {
517+
String label = graph.name != null ? graph.name : graph.method().format("%H.%n(%p)");
518+
TTY.println("Reporting hot metrics after " + getName() + " during compilation of " + label);
519+
new ReportHotCodePhase().apply(graph, context);
520+
}
507521
}
508522

509523
} catch (Throwable t) {

0 commit comments

Comments
 (0)