src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/GraalDebugConfig.java
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
hotspot Cdiff src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/GraalDebugConfig.java
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/GraalDebugConfig.java
Print this page
*** 30,189 ****
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.graalvm.compiler.options.Option;
import org.graalvm.compiler.options.OptionType;
! import org.graalvm.compiler.options.OptionValue;
import jdk.vm.ci.code.BailoutException;
import jdk.vm.ci.meta.JavaMethod;
public class GraalDebugConfig implements DebugConfig {
- @SuppressWarnings("all")
- private static boolean assertionsEnabled() {
- boolean assertionsEnabled = false;
- assert assertionsEnabled = true;
- return assertionsEnabled;
- }
public static class Options {
// @formatter:off
@Option(help = "Pattern for scope(s) in which dumping is enabled (see DebugFilter and Debug.dump)", type = OptionType.Debug)
! public static final OptionValue<String> Dump = new OptionValue<>(null);
@Option(help = "Pattern for scope(s) in which counting is enabled (see DebugFilter and Debug.counter). " +
"An empty value enables all counters unconditionally.", type = OptionType.Debug)
! public static final OptionValue<String> Count = new OptionValue<>(null);
@Option(help = "Pattern for scope(s) in which verification is enabled (see DebugFilter and Debug.verify).", type = OptionType.Debug)
! public static final OptionValue<String> Verify = new OptionValue<String>() {
! @Override
! protected String defaultValue() {
! return assertionsEnabled() ? "" : null;
! }
! };
@Option(help = "Pattern for scope(s) in which memory use tracking is enabled (see DebugFilter and Debug.counter). " +
"An empty value enables all memory use trackers unconditionally.", type = OptionType.Debug)
! public static final OptionValue<String> TrackMemUse = new OptionValue<>(null);
@Option(help = "Pattern for scope(s) in which timing is enabled (see DebugFilter and Debug.timer). " +
"An empty value enables all timers unconditionally.", type = OptionType.Debug)
! public static final OptionValue<String> Time = new OptionValue<>(null);
@Option(help = "Pattern for scope(s) in which logging is enabled (see DebugFilter and Debug.log)", type = OptionType.Debug)
! public static final OptionValue<String> Log = new OptionValue<>(null);
@Option(help = "Pattern for filtering debug scope output based on method context (see MethodFilter)", type = OptionType.Debug)
! public static final OptionValue<String> MethodFilter = new OptionValue<>(null);
@Option(help = "Only check MethodFilter against the root method in the context if true, otherwise check all methods", type = OptionType.Debug)
! public static final OptionValue<Boolean> MethodFilterRootOnly = new OptionValue<>(false);
@Option(help = "How to print counters and timing values:%n" +
"Name - aggregate by unqualified name%n" +
"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", type = OptionType.Debug)
! public static final OptionValue<String> DebugValueSummary = new OptionValue<>("Name");
@Option(help = "Print counters and timers in a human readable form.", type = OptionType.Debug)
! public static final OptionValue<Boolean> DebugValueHumanReadable = new OptionValue<>(true);
@Option(help = "Omit reporting 0-value counters", type = OptionType.Debug)
! public static final OptionValue<Boolean> SuppressZeroDebugValues = new OptionValue<>(true);
@Option(help = "Only report debug values for maps which match the regular expression.", type = OptionType.Debug)
! public static final OptionValue<String> DebugValueThreadFilter = new OptionValue<>(null);
@Option(help = "Write debug values into a file instead of the terminal. " +
"If DebugValueSummary is Thread, the thread name will be prepended.", type = OptionType.Debug)
! public static final OptionValue<String> DebugValueFile = new OptionValue<>(null);
@Option(help = "Send Graal compiler IR to dump handlers on error", type = OptionType.Debug)
! public static final OptionValue<Boolean> DumpOnError = new OptionValue<>(false);
@Option(help = "Intercept also bailout exceptions", type = OptionType.Debug)
! public static final OptionValue<Boolean> InterceptBailout = new OptionValue<>(false);
@Option(help = "Enable more verbose log output when available", type = OptionType.Debug)
! public static final OptionValue<Boolean> LogVerbose = new OptionValue<>(false);
@Option(help = "The directory where various Graal dump files are written.")
! public static final OptionValue<String> DumpPath = new OptionValue<>(".");
@Option(help = "Enable dumping to the C1Visualizer. Enabling this option implies PrintBackendCFG.", type = OptionType.Debug)
! public static final OptionValue<Boolean> PrintCFG = new OptionValue<>(false);
@Option(help = "Enable dumping LIR, register allocation and code generation info to the C1Visualizer.", type = OptionType.Debug)
! public static final OptionValue<Boolean> PrintBackendCFG = new OptionValue<>(true);
@Option(help = "Base filename when dumping C1Visualizer output to files.", type = OptionType.Debug)
! public static final OptionValue<String> PrintCFGFileName = new OptionValue<>("compilations");
! @Option(help = "Output probabilities for fixed nodes during binary graph dumping", type = OptionType.Debug)
! public static final OptionValue<Boolean> PrintGraphProbabilities = new OptionValue<>(false);
@Option(help = "Enable dumping to the IdealGraphVisualizer.", type = OptionType.Debug)
! public static final OptionValue<Boolean> PrintIdealGraph = new OptionValue<>(true);
! @Option(help = "Dump IdealGraphVisualizer output in binary format", type = OptionType.Debug)
! public static final OptionValue<Boolean> PrintBinaryGraphs = new OptionValue<>(true);
! @Option(help = "Print Ideal graphs as opposed to sending them over the network.", type = OptionType.Debug)
! public static final OptionValue<Boolean> PrintIdealGraphFile = new OptionValue<>(false);
! @Option(help = "Base filename when dumping Ideal graphs to files.", type = OptionType.Debug)
! public static final OptionValue<String> PrintIdealGraphFileName = new OptionValue<>("runtime-graphs");
!
! @Option(help = "", type = OptionType.Debug)
! public static final OptionValue<String> PrintIdealGraphAddress = new OptionValue<>("127.0.0.1");
! @Option(help = "", type = OptionType.Debug)
! public static final OptionValue<Integer> PrintIdealGraphPort = new OptionValue<>(4444);
! @Option(help = "", type = OptionType.Debug)
! public static final OptionValue<Integer> PrintBinaryGraphPort = new OptionValue<>(4445);
! @Option(help = "", type = OptionType.Debug)
! public static final OptionValue<Boolean> PrintIdealGraphSchedule = new OptionValue<>(false);
@Option(help = "Enable dumping Truffle ASTs to the IdealGraphVisualizer.", type = OptionType.Debug)
! public static final OptionValue<Boolean> PrintTruffleTrees = new OptionValue<>(true);
@Option(help = "Enable dumping canonical text from for graphs.", type = OptionType.Debug)
! public static final OptionValue<Boolean> PrintCanonicalGraphStrings = new OptionValue<>(false);
@Option(help = "Base directory when dumping graphs strings to files.", type = OptionType.Debug)
! public static final OptionValue<String> PrintCanonicalGraphStringsDirectory = new OptionValue<>("graph-strings");
@Option(help = "Choose format used when dumping canonical text for graphs: " +
"0 gives a scheduled graph (better for spotting changes involving the schedule)" +
"while 1 gives a CFG containing expressions rooted at fixed nodes (better for spotting small structure differences)", type = OptionType.Debug)
! public static final OptionValue<Integer> PrintCanonicalGraphStringFlavor = new OptionValue<>(0);
@Option(help = "Exclude virtual nodes when dumping canonical text for graphs.", type = OptionType.Debug)
! public static final OptionValue<Boolean> CanonicalGraphStringsExcludeVirtuals = new OptionValue<>(true);
@Option(help = "Exclude virtual nodes when dumping canonical text for graphs.", type = OptionType.Debug)
! public static final OptionValue<Boolean> CanonicalGraphStringsCheckConstants = new OptionValue<>(false);
@Option(help = "Attempts to remove object identity hashes when dumping canonical text for graphs.", type = OptionType.Debug)
! public static final OptionValue<Boolean> CanonicalGraphStringsRemoveIdentities = new OptionValue<>(true);
@Option(help = "Enable per method metrics that are collected across all compilations of a method." +
"Pattern for scope(s) in which method metering is enabled (see DebugFilter and Debug.metric).", type = OptionType.Debug)
! public static final OptionValue<String> MethodMeter = new OptionValue<>(null);
@Option(help = "If a global metric (DebugTimer, DebugCounter or DebugMemUseTracker) is enabled in the same scope as a method metric, " +
"use the global metric to update the method metric for the current compilation. " +
"This option enables the re-use of global metrics on per-compilation basis. " +
"Whenever a value is added to a global metric, the value is also added to a MethodMetric under the same name " +
"as the global metric. " +
"This option incurs a small but constant overhead due to the context method lookup at each metric update. " +
"Format to specify GlobalMetric interception:(Timers|Counters|MemUseTrackers)(,Timers|,Counters|,MemUseTrackers)*", type = OptionType.Debug)
! public static final OptionValue<String> GlobalMetricsInterceptedByMethodMetrics = new OptionValue<>(null);
@Option(help = "Force-enable debug code paths", type = OptionType.Debug)
! public static final OptionValue<Boolean> ForceDebugEnable = new OptionValue<>(false);
@Option(help = "Clear the debug metrics after bootstrap.", type = OptionType.Debug)
! public static final OptionValue<Boolean> ClearMetricsAfterBootstrap = new OptionValue<>(false);
@Option(help = "Do not compile anything on bootstrap but just initialize the compiler.", type = OptionType.Debug)
! public static final OptionValue<Boolean> BootstrapInitializeOnly = new OptionValue<>(false);
// @formatter:on
}
! public static boolean isNotEmpty(OptionValue<String> option) {
! return option.getValue() != null && !option.getValue().isEmpty();
}
! public static boolean areDebugScopePatternsEnabled() {
! return Options.DumpOnError.getValue() || Options.Dump.getValue() != null || Options.Log.getValue() != null || areScopedGlobalMetricsEnabled();
}
! public static boolean isGlobalMetricsInterceptedByMethodMetricsEnabled() {
! return isNotEmpty(Options.GlobalMetricsInterceptedByMethodMetrics);
}
/**
* Determines if any of {@link Options#Count}, {@link Options#Time} or
* {@link Options#TrackMemUse} has a non-null, non-empty value.
*/
! public static boolean areScopedGlobalMetricsEnabled() {
! return isNotEmpty(Options.Count) || isNotEmpty(Options.Time) || isNotEmpty(Options.TrackMemUse) || isNotEmpty(Options.MethodMeter);
}
private final DebugFilter countFilter;
private final DebugFilter logFilter;
private final DebugFilter methodMetricsFilter;
private final DebugFilter trackMemUseFilter;
private final DebugFilter timerFilter;
--- 30,217 ----
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.graalvm.compiler.options.Option;
+ import org.graalvm.compiler.options.OptionKey;
import org.graalvm.compiler.options.OptionType;
! import org.graalvm.compiler.options.OptionValues;
! import org.graalvm.util.EconomicMap;
import jdk.vm.ci.code.BailoutException;
import jdk.vm.ci.meta.JavaMethod;
public class GraalDebugConfig implements DebugConfig {
public static class Options {
// @formatter:off
@Option(help = "Pattern for scope(s) in which dumping is enabled (see DebugFilter and Debug.dump)", type = OptionType.Debug)
! public static final OptionKey<String> Dump = new OptionKey<>(null);
@Option(help = "Pattern for scope(s) in which counting is enabled (see DebugFilter and Debug.counter). " +
"An empty value enables all counters unconditionally.", type = OptionType.Debug)
! public static final OptionKey<String> Count = new OptionKey<>(null);
@Option(help = "Pattern for scope(s) in which verification is enabled (see DebugFilter and Debug.verify).", type = OptionType.Debug)
! public static final OptionKey<String> Verify = new OptionKey<>(Assertions.ENABLED ? "" : null);
@Option(help = "Pattern for scope(s) in which memory use tracking is enabled (see DebugFilter and Debug.counter). " +
"An empty value enables all memory use trackers unconditionally.", type = OptionType.Debug)
! public static final OptionKey<String> TrackMemUse = new OptionKey<>(null);
@Option(help = "Pattern for scope(s) in which timing is enabled (see DebugFilter and Debug.timer). " +
"An empty value enables all timers unconditionally.", type = OptionType.Debug)
! public static final OptionKey<String> Time = new OptionKey<>(null);
@Option(help = "Pattern for scope(s) in which logging is enabled (see DebugFilter and Debug.log)", type = OptionType.Debug)
! public static final OptionKey<String> Log = new OptionKey<>(null);
@Option(help = "Pattern for filtering debug scope output based on method context (see MethodFilter)", type = OptionType.Debug)
! public static final OptionKey<String> MethodFilter = new OptionKey<>(null);
@Option(help = "Only check MethodFilter against the root method in the context if true, otherwise check all methods", type = OptionType.Debug)
! public static final OptionKey<Boolean> MethodFilterRootOnly = new OptionKey<>(false);
@Option(help = "How to print counters and timing values:%n" +
"Name - aggregate by unqualified name%n" +
"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", type = OptionType.Debug)
! public static final OptionKey<String> DebugValueSummary = new OptionKey<>("Name");
@Option(help = "Print counters and timers in a human readable form.", type = OptionType.Debug)
! public static final OptionKey<Boolean> DebugValueHumanReadable = new OptionKey<>(true);
@Option(help = "Omit reporting 0-value counters", type = OptionType.Debug)
! public static final OptionKey<Boolean> SuppressZeroDebugValues = new OptionKey<>(true);
@Option(help = "Only report debug values for maps which match the regular expression.", type = OptionType.Debug)
! public static final OptionKey<String> DebugValueThreadFilter = new OptionKey<>(null);
@Option(help = "Write debug values into a file instead of the terminal. " +
"If DebugValueSummary is Thread, the thread name will be prepended.", type = OptionType.Debug)
! public static final OptionKey<String> DebugValueFile = new OptionKey<>(null);
@Option(help = "Send Graal compiler IR to dump handlers on error", type = OptionType.Debug)
! public static final OptionKey<Boolean> DumpOnError = new OptionKey<>(false);
@Option(help = "Intercept also bailout exceptions", type = OptionType.Debug)
! public static final OptionKey<Boolean> InterceptBailout = new OptionKey<>(false);
@Option(help = "Enable more verbose log output when available", type = OptionType.Debug)
! public static final OptionKey<Boolean> LogVerbose = new OptionKey<>(false);
@Option(help = "The directory where various Graal dump files are written.")
! public static final OptionKey<String> DumpPath = new OptionKey<>(".");
@Option(help = "Enable dumping to the C1Visualizer. Enabling this option implies PrintBackendCFG.", type = OptionType.Debug)
! public static final OptionKey<Boolean> PrintCFG = new OptionKey<>(false);
@Option(help = "Enable dumping LIR, register allocation and code generation info to the C1Visualizer.", type = OptionType.Debug)
! public static final OptionKey<Boolean> PrintBackendCFG = new OptionKey<>(true);
@Option(help = "Base filename when dumping C1Visualizer output to files.", type = OptionType.Debug)
! public static final OptionKey<String> PrintCFGFileName = new OptionKey<>("compilations");
! @Option(help = "Output probabilities for fixed nodes during binary graph dumping.", type = OptionType.Debug)
! public static final OptionKey<Boolean> PrintGraphProbabilities = new OptionKey<>(false);
@Option(help = "Enable dumping to the IdealGraphVisualizer.", type = OptionType.Debug)
! public static final OptionKey<Boolean> PrintGraph = new OptionKey<>(true);
! @Option(help = "Dump graphs in binary format instead of XML format.", type = OptionType.Debug)
! public static final OptionKey<Boolean> PrintBinaryGraphs = new OptionKey<>(true);
! @Option(help = "Print graphs to files instead of sending them over the network.", type = OptionType.Debug)
! public static final OptionKey<Boolean> PrintGraphFile = new OptionKey<>(false);
! @Option(help = "Base filename when dumping graphs to files.", type = OptionType.Debug)
! public static final OptionKey<String> PrintGraphFileName = new OptionKey<>("runtime-graphs");
!
! @Option(help = "Host part of the address to which graphs are dumped.", type = OptionType.Debug)
! public static final OptionKey<String> PrintGraphHost = new OptionKey<>("127.0.0.1");
! @Option(help = "Port part of the address to which graphs are dumped in XML format (ignored if PrintBinaryGraphs=true).", type = OptionType.Debug)
! public static final OptionKey<Integer> PrintXmlGraphPort = new OptionKey<>(4444);
! @Option(help = "Port part of the address to which graphs are dumped in binary format (ignored if PrintBinaryGraphs=false).", type = OptionType.Debug)
! public static final OptionKey<Integer> PrintBinaryGraphPort = new OptionKey<>(4445);
! @Option(help = "Schedule graphs as they are dumped.", type = OptionType.Debug)
! public static final OptionKey<Boolean> PrintGraphWithSchedule = new OptionKey<>(false);
@Option(help = "Enable dumping Truffle ASTs to the IdealGraphVisualizer.", type = OptionType.Debug)
! public static final OptionKey<Boolean> PrintTruffleTrees = new OptionKey<>(true);
!
! @Option(help = "Treat any exceptions during dumping as fatal.", type = OptionType.Debug)
! public static final OptionKey<Boolean> DumpingErrorsAreFatal = new OptionKey<>(false);
@Option(help = "Enable dumping canonical text from for graphs.", type = OptionType.Debug)
! public static final OptionKey<Boolean> PrintCanonicalGraphStrings = new OptionKey<>(false);
@Option(help = "Base directory when dumping graphs strings to files.", type = OptionType.Debug)
! public static final OptionKey<String> PrintCanonicalGraphStringsDirectory = new OptionKey<>("graph-strings");
@Option(help = "Choose format used when dumping canonical text for graphs: " +
"0 gives a scheduled graph (better for spotting changes involving the schedule)" +
"while 1 gives a CFG containing expressions rooted at fixed nodes (better for spotting small structure differences)", type = OptionType.Debug)
! public static final OptionKey<Integer> PrintCanonicalGraphStringFlavor = new OptionKey<>(0);
@Option(help = "Exclude virtual nodes when dumping canonical text for graphs.", type = OptionType.Debug)
! public static final OptionKey<Boolean> CanonicalGraphStringsExcludeVirtuals = new OptionKey<>(true);
@Option(help = "Exclude virtual nodes when dumping canonical text for graphs.", type = OptionType.Debug)
! public static final OptionKey<Boolean> CanonicalGraphStringsCheckConstants = new OptionKey<>(false);
@Option(help = "Attempts to remove object identity hashes when dumping canonical text for graphs.", type = OptionType.Debug)
! public static final OptionKey<Boolean> CanonicalGraphStringsRemoveIdentities = new OptionKey<>(true);
@Option(help = "Enable per method metrics that are collected across all compilations of a method." +
"Pattern for scope(s) in which method metering is enabled (see DebugFilter and Debug.metric).", type = OptionType.Debug)
! public static final OptionKey<String> MethodMeter = new OptionKey<>(null);
@Option(help = "If a global metric (DebugTimer, DebugCounter or DebugMemUseTracker) is enabled in the same scope as a method metric, " +
"use the global metric to update the method metric for the current compilation. " +
"This option enables the re-use of global metrics on per-compilation basis. " +
"Whenever a value is added to a global metric, the value is also added to a MethodMetric under the same name " +
"as the global metric. " +
"This option incurs a small but constant overhead due to the context method lookup at each metric update. " +
"Format to specify GlobalMetric interception:(Timers|Counters|MemUseTrackers)(,Timers|,Counters|,MemUseTrackers)*", type = OptionType.Debug)
! public static final OptionKey<String> GlobalMetricsInterceptedByMethodMetrics = new OptionKey<>(null);
@Option(help = "Force-enable debug code paths", type = OptionType.Debug)
! public static final OptionKey<Boolean> ForceDebugEnable = new OptionKey<>(false);
@Option(help = "Clear the debug metrics after bootstrap.", type = OptionType.Debug)
! public static final OptionKey<Boolean> ClearMetricsAfterBootstrap = new OptionKey<>(false);
@Option(help = "Do not compile anything on bootstrap but just initialize the compiler.", type = OptionType.Debug)
! public static final OptionKey<Boolean> BootstrapInitializeOnly = new OptionKey<>(false);
!
! // These
! @Option(help = "Deprecated - use PrintGraphHost instead.", type = OptionType.Debug)
! static final OptionKey<String> PrintIdealGraphAddress = new DeprecatedOptionKey<>(PrintGraphHost);
! @Option(help = "Deprecated - use PrintGraphWithSchedule instead.", type = OptionType.Debug)
! static final OptionKey<Boolean> PrintIdealGraphSchedule = new DeprecatedOptionKey<>(PrintGraphWithSchedule);
! @Option(help = "Deprecated - use PrintGraph instead.", type = OptionType.Debug)
! static final OptionKey<Boolean> PrintIdealGraph = new DeprecatedOptionKey<>(PrintGraph);
! @Option(help = "Deprecated - use PrintGraphFile instead.", type = OptionType.Debug)
! static final OptionKey<Boolean> PrintIdealGraphFile = new DeprecatedOptionKey<>(PrintGraphFile);
! @Option(help = "Deprecated - use PrintGraphFileName instead.", type = OptionType.Debug)
! static final OptionKey<String> PrintIdealGraphFileName = new DeprecatedOptionKey<>(PrintGraphFileName);
! @Option(help = "Deprecated - use PrintXmlGraphPort instead.", type = OptionType.Debug)
! static final OptionKey<Integer> PrintIdealGraphPort = new DeprecatedOptionKey<>(PrintXmlGraphPort);
// @formatter:on
}
! static class DeprecatedOptionKey<T> extends OptionKey<T> {
! private final OptionKey<T> replacement;
!
! DeprecatedOptionKey(OptionKey<T> replacement) {
! super(replacement.getDefaultValue());
! this.replacement = replacement;
! }
!
! @Override
! protected void onValueUpdate(EconomicMap<OptionKey<?>, Object> values, T oldValue, T newValue) {
! // Ideally we'd use TTY here but it may not yet be initialized.
! System.err.printf("Warning: the %s option is deprecated - use %s instead%n", getName(), replacement.getName());
! replacement.update(values, newValue);
! }
! }
!
! public static boolean isNotEmpty(OptionKey<String> option, OptionValues options) {
! return option.getValue(options) != null && !option.getValue(options).isEmpty();
}
! public static boolean areDebugScopePatternsEnabled(OptionValues options) {
! return Options.DumpOnError.getValue(options) || Options.Dump.getValue(options) != null || Options.Log.getValue(options) != null || areScopedGlobalMetricsEnabled(options);
}
! public static boolean isGlobalMetricsInterceptedByMethodMetricsEnabled(OptionValues options) {
! return isNotEmpty(Options.GlobalMetricsInterceptedByMethodMetrics, options);
}
/**
* Determines if any of {@link Options#Count}, {@link Options#Time} or
* {@link Options#TrackMemUse} has a non-null, non-empty value.
+ *
+ * @param options
*/
! public static boolean areScopedGlobalMetricsEnabled(OptionValues options) {
! return isNotEmpty(Options.Count, options) || isNotEmpty(Options.Time, options) || isNotEmpty(Options.TrackMemUse, options) || isNotEmpty(Options.MethodMeter, options);
}
+ private final OptionValues options;
+
private final DebugFilter countFilter;
private final DebugFilter logFilter;
private final DebugFilter methodMetricsFilter;
private final DebugFilter trackMemUseFilter;
private final DebugFilter timerFilter;
*** 195,206 ****
private final PrintStream output;
// Use an identity set to handle context objects that don't support hashCode().
private final Set<Object> extraFilters = Collections.newSetFromMap(new IdentityHashMap<>());
! public GraalDebugConfig(String logFilter, String countFilter, String trackMemUseFilter, String timerFilter, String dumpFilter, String verifyFilter, String methodFilter,
String methodMetricsFilter, PrintStream output, List<DebugDumpHandler> dumpHandlers, List<DebugVerifyHandler> verifyHandlers) {
this.logFilter = DebugFilter.parse(logFilter);
this.countFilter = DebugFilter.parse(countFilter);
this.trackMemUseFilter = DebugFilter.parse(trackMemUseFilter);
this.timerFilter = DebugFilter.parse(timerFilter);
this.dumpFilter = DebugFilter.parse(dumpFilter);
--- 223,235 ----
private final PrintStream output;
// Use an identity set to handle context objects that don't support hashCode().
private final Set<Object> extraFilters = Collections.newSetFromMap(new IdentityHashMap<>());
! public GraalDebugConfig(OptionValues options, String logFilter, String countFilter, String trackMemUseFilter, String timerFilter, String dumpFilter, String verifyFilter, String methodFilter,
String methodMetricsFilter, PrintStream output, List<DebugDumpHandler> dumpHandlers, List<DebugVerifyHandler> verifyHandlers) {
+ this.options = options;
this.logFilter = DebugFilter.parse(logFilter);
this.countFilter = DebugFilter.parse(countFilter);
this.trackMemUseFilter = DebugFilter.parse(trackMemUseFilter);
this.timerFilter = DebugFilter.parse(timerFilter);
this.dumpFilter = DebugFilter.parse(dumpFilter);
*** 210,229 ****
this.methodFilter = null;
} else {
this.methodFilter = org.graalvm.compiler.debug.MethodFilter.parse(methodFilter);
}
- // Report the filters that have been configured so the user can verify it's what they expect
- if (logFilter != null || countFilter != null || timerFilter != null || dumpFilter != null || methodFilter != null) {
- // TTY.println(Thread.currentThread().getName() + ": " + toString());
- }
this.dumpHandlers = dumpHandlers;
this.verifyHandlers = verifyHandlers;
this.output = output;
}
@Override
public int getLogLevel() {
return getLevel(logFilter);
}
@Override
--- 239,259 ----
this.methodFilter = null;
} else {
this.methodFilter = org.graalvm.compiler.debug.MethodFilter.parse(methodFilter);
}
this.dumpHandlers = dumpHandlers;
this.verifyHandlers = verifyHandlers;
this.output = output;
}
@Override
+ public OptionValues getOptions() {
+ return options;
+ }
+
+ @Override
public int getLogLevel() {
return getLevel(logFilter);
}
@Override
*** 321,331 ****
if (extraFilters.contains(o)) {
return true;
} else if (methodFilter != null) {
JavaMethod method = asJavaMethod(o);
if (method != null) {
! if (!Options.MethodFilterRootOnly.getValue()) {
if (org.graalvm.compiler.debug.MethodFilter.matches(methodFilter, method)) {
return true;
}
} else {
/*
--- 351,361 ----
if (extraFilters.contains(o)) {
return true;
} else if (methodFilter != null) {
JavaMethod method = asJavaMethod(o);
if (method != null) {
! if (!Options.MethodFilterRootOnly.getValue(options)) {
if (org.graalvm.compiler.debug.MethodFilter.matches(methodFilter, method)) {
return true;
}
} else {
/*
*** 371,391 ****
}
}
@Override
public RuntimeException interceptException(Throwable e) {
! if (e instanceof BailoutException && !Options.InterceptBailout.getValue()) {
return null;
}
! Debug.setConfig(Debug.fixedConfig(Debug.BASIC_LOG_LEVEL, Debug.BASIC_LOG_LEVEL, false, false, false, false, false, dumpHandlers, verifyHandlers, output));
Debug.log("Exception occurred in scope: %s", Debug.currentScope());
Map<Object, Object> firstSeen = new IdentityHashMap<>();
for (Object o : Debug.context()) {
// Only dump a context object once.
if (!firstSeen.containsKey(o)) {
firstSeen.put(o, o);
! if (Options.DumpOnError.getValue()) {
Debug.dump(Debug.BASIC_LOG_LEVEL, o, "Exception: %s", e);
} else {
Debug.log("Context obj %s", o);
}
}
--- 401,421 ----
}
}
@Override
public RuntimeException interceptException(Throwable e) {
! if (e instanceof BailoutException && !Options.InterceptBailout.getValue(options)) {
return null;
}
! Debug.setConfig(Debug.fixedConfig(options, Debug.BASIC_LOG_LEVEL, Debug.BASIC_LOG_LEVEL, false, false, false, false, false, dumpHandlers, verifyHandlers, output));
Debug.log("Exception occurred in scope: %s", Debug.currentScope());
Map<Object, Object> firstSeen = new IdentityHashMap<>();
for (Object o : Debug.context()) {
// Only dump a context object once.
if (!firstSeen.containsKey(o)) {
firstSeen.put(o, o);
! if (Options.DumpOnError.getValue(options) || Options.Dump.getValue(options) != null) {
Debug.dump(Debug.BASIC_LOG_LEVEL, o, "Exception: %s", e);
} else {
Debug.log("Context obj %s", o);
}
}
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/GraalDebugConfig.java
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File