# HG changeset patch # User Roland Schatz # Date 1444307506 -7200 # Node ID 60d59d17d4194a211c9fd0fa18fe624a39676e0a # Parent 7ffade01e1fff66beab9bd69603c9e88c7f80c16 Move options to inner classes. diff -r 7ffade01e1ff -r 60d59d17d419 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalDebugInitializationPropertyProvider.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalDebugInitializationPropertyProvider.java Thu Oct 08 14:29:02 2015 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalDebugInitializationPropertyProvider.java Thu Oct 08 14:31:46 2015 +0200 @@ -40,13 +40,13 @@ if (GraalDebugConfig.areDebugScopePatternsEnabled()) { System.setProperty(Debug.Initialization.INITIALIZER_PROPERTY_NAME, "true"); } - if ("".equals(GraalDebugConfig.Meter.getValue())) { + if ("".equals(GraalDebugConfig.Options.Meter.getValue())) { System.setProperty(Debug.ENABLE_UNSCOPED_METRICS_PROPERTY_NAME, "true"); } - if ("".equals(GraalDebugConfig.Time.getValue())) { + if ("".equals(GraalDebugConfig.Options.Time.getValue())) { System.setProperty(Debug.ENABLE_UNSCOPED_TIMERS_PROPERTY_NAME, "true"); } - if ("".equals(GraalDebugConfig.TrackMemUse.getValue())) { + if ("".equals(GraalDebugConfig.Options.TrackMemUse.getValue())) { System.setProperty(Debug.ENABLE_UNSCOPED_MEM_USE_TRACKERS_PROPERTY_NAME, "true"); } } diff -r 7ffade01e1ff -r 60d59d17d419 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/NodeLIRBuilder.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/NodeLIRBuilder.java Thu Oct 08 14:29:02 2015 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/NodeLIRBuilder.java Thu Oct 08 14:31:46 2015 +0200 @@ -24,7 +24,7 @@ import static com.oracle.graal.compiler.common.BackendOptions.ConstructionSSAlirDuringLirBuilding; import static com.oracle.graal.compiler.common.GraalOptions.MatchExpressions; -import static com.oracle.graal.debug.GraalDebugConfig.LogVerbose; +import static com.oracle.graal.debug.GraalDebugConfig.Options.LogVerbose; import static com.oracle.graal.lir.LIR.verifyBlock; import static jdk.internal.jvmci.code.ValueUtil.asRegister; import static jdk.internal.jvmci.code.ValueUtil.isLegal; diff -r 7ffade01e1ff -r 60d59d17d419 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchContext.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchContext.java Thu Oct 08 14:29:02 2015 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchContext.java Thu Oct 08 14:31:46 2015 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,7 @@ */ package com.oracle.graal.compiler.match; -import static com.oracle.graal.debug.GraalDebugConfig.LogVerbose; +import static com.oracle.graal.debug.GraalDebugConfig.Options.LogVerbose; import java.util.ArrayList; import java.util.Arrays; diff -r 7ffade01e1ff -r 60d59d17d419 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchRuleRegistry.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchRuleRegistry.java Thu Oct 08 14:29:02 2015 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchRuleRegistry.java Thu Oct 08 14:31:46 2015 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,7 @@ */ package com.oracle.graal.compiler.match; -import static com.oracle.graal.debug.GraalDebugConfig.LogVerbose; +import static com.oracle.graal.debug.GraalDebugConfig.Options.LogVerbose; import java.util.ArrayList; import java.util.HashMap; diff -r 7ffade01e1ff -r 60d59d17d419 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchStatement.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchStatement.java Thu Oct 08 14:29:02 2015 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchStatement.java Thu Oct 08 14:31:46 2015 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,7 @@ */ package com.oracle.graal.compiler.match; -import static com.oracle.graal.debug.GraalDebugConfig.LogVerbose; +import static com.oracle.graal.debug.GraalDebugConfig.Options.LogVerbose; import java.util.List; diff -r 7ffade01e1ff -r 60d59d17d419 graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugEnvironment.java --- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugEnvironment.java Thu Oct 08 14:29:02 2015 +0200 +++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugEnvironment.java Thu Oct 08 14:31:46 2015 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,13 +22,13 @@ */ package com.oracle.graal.debug; -import static com.oracle.graal.debug.GraalDebugConfig.Dump; -import static com.oracle.graal.debug.GraalDebugConfig.Log; -import static com.oracle.graal.debug.GraalDebugConfig.Meter; -import static com.oracle.graal.debug.GraalDebugConfig.MethodFilter; -import static com.oracle.graal.debug.GraalDebugConfig.Time; -import static com.oracle.graal.debug.GraalDebugConfig.TrackMemUse; -import static com.oracle.graal.debug.GraalDebugConfig.Verify; +import static com.oracle.graal.debug.GraalDebugConfig.Options.Dump; +import static com.oracle.graal.debug.GraalDebugConfig.Options.Log; +import static com.oracle.graal.debug.GraalDebugConfig.Options.Meter; +import static com.oracle.graal.debug.GraalDebugConfig.Options.MethodFilter; +import static com.oracle.graal.debug.GraalDebugConfig.Options.Time; +import static com.oracle.graal.debug.GraalDebugConfig.Options.TrackMemUse; +import static com.oracle.graal.debug.GraalDebugConfig.Options.Verify; import java.io.PrintStream; import java.util.ArrayList; diff -r 7ffade01e1ff -r 60d59d17d419 graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugFilter.java --- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugFilter.java Thu Oct 08 14:29:02 2015 +0200 +++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugFilter.java Thu Oct 08 14:31:46 2015 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,19 +25,18 @@ import java.util.Arrays; import java.util.regex.Pattern; +import com.oracle.graal.debug.GraalDebugConfig.Options; import com.oracle.graal.debug.internal.DebugScope; /** - * Implements the filter specified by the {@link GraalDebugConfig#Dump}, - * {@link GraalDebugConfig#Log}, {@link GraalDebugConfig#Meter} and {@link GraalDebugConfig#Time} - * options. + * Implements the filter specified by the {@link Options#Dump}, {@link Options#Log}, + * {@link Options#Meter} and {@link Options#Time} options. *

* These options enable the associated debug facility if their filter matches the * {@linkplain DebugScope#getQualifiedName() name} of the {@linkplain Debug#currentScope() current - * scope}. For the {@link GraalDebugConfig#Dump} and {@link GraalDebugConfig#Log} options, the log - * or dump level is set. The {@link GraalDebugConfig#Meter} and {@link GraalDebugConfig#Time} - * options don't have a level, for them {@code level = 0} means disabled and a {@code level > 0} - * means enabled. + * scope}. For the {@link Options#Dump} and {@link Options#Log} options, the log or dump level is + * set. The {@link Options#Meter} and {@link Options#Time} options don't have a level, for them + * {@code level = 0} means disabled and a {@code level > 0} means enabled. *

* A filter is a list of comma-separated terms of the form {@code [:]}. * {@code } is interpreted as a glob pattern if it contains a "*" or "?" character. diff -r 7ffade01e1ff -r 60d59d17d419 graal/com.oracle.graal.debug/src/com/oracle/graal/debug/GraalDebugConfig.java --- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/GraalDebugConfig.java Thu Oct 08 14:29:02 2015 +0200 +++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/GraalDebugConfig.java Thu Oct 08 14:31:46 2015 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,64 +43,66 @@ return assertionsEnabled; } - // @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 Dump = new OptionValue<>(null); - @Option(help = "Pattern for scope(s) in which metering is enabled (see DebugFilter and Debug.metric). " + - "An empty value enables all metrics unconditionally.", type = OptionType.Debug) - public static final OptionValue Meter = 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 Verify = new OptionValue() { - @Override - protected String defaultValue() { - return assertionsEnabled() ? "" : null; - } - }; - @Option(help = "Pattern for scope(s) in which memory use tracking is enabled (see DebugFilter and Debug.metric). " + - "An empty value enables all memory use trackers unconditionally.", type = OptionType.Debug) - public static final OptionValue 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 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 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 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 MethodFilterRootOnly = new OptionValue<>(false); + 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 Dump = new OptionValue<>(null); + @Option(help = "Pattern for scope(s) in which metering is enabled (see DebugFilter and Debug.metric). " + + "An empty value enables all metrics unconditionally.", type = OptionType.Debug) + public static final OptionValue Meter = 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 Verify = new OptionValue() { + @Override + protected String defaultValue() { + return assertionsEnabled() ? "" : null; + } + }; + @Option(help = "Pattern for scope(s) in which memory use tracking is enabled (see DebugFilter and Debug.metric). " + + "An empty value enables all memory use trackers unconditionally.", type = OptionType.Debug) + public static final OptionValue 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 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 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 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 MethodFilterRootOnly = new OptionValue<>(false); - @Option(help = "How to print metric 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 DebugValueSummary = new OptionValue<>("Name"); - @Option(help = "Omit reporting 0-value metrics", type = OptionType.Debug) - public static final OptionValue SuppressZeroDebugValues = new OptionValue<>(true); - @Option(help = "Only report debug values for maps which match the regular expression.", type = OptionType.Debug) - public static final OptionValue DebugValueThreadFilter = new OptionValue<>(null); - @Option(help = "Send JVMCI compiler IR to dump handlers on error", type = OptionType.Debug) - public static final OptionValue DumpOnError = new OptionValue<>(false); - @Option(help = "Intercept also bailout exceptions", type = OptionType.Debug) - public static final OptionValue InterceptBailout = new OptionValue<>(false); - @Option(help = "Enable more verbose log output when available", type = OptionType.Debug) - public static final OptionValue LogVerbose = new OptionValue<>(false); - // @formatter:on + @Option(help = "How to print metric 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 DebugValueSummary = new OptionValue<>("Name"); + @Option(help = "Omit reporting 0-value metrics", type = OptionType.Debug) + public static final OptionValue SuppressZeroDebugValues = new OptionValue<>(true); + @Option(help = "Only report debug values for maps which match the regular expression.", type = OptionType.Debug) + public static final OptionValue DebugValueThreadFilter = new OptionValue<>(null); + @Option(help = "Send JVMCI compiler IR to dump handlers on error", type = OptionType.Debug) + public static final OptionValue DumpOnError = new OptionValue<>(false); + @Option(help = "Intercept also bailout exceptions", type = OptionType.Debug) + public static final OptionValue InterceptBailout = new OptionValue<>(false); + @Option(help = "Enable more verbose log output when available", type = OptionType.Debug) + public static final OptionValue LogVerbose = new OptionValue<>(false); + // @formatter:on + } static boolean isNotEmpty(OptionValue option) { return option.getValue() != null && !option.getValue().isEmpty(); } public static boolean areDebugScopePatternsEnabled() { - return DumpOnError.getValue() || Dump.getValue() != null || Log.getValue() != null || areScopedMetricsOrTimersEnabled(); + return Options.DumpOnError.getValue() || Options.Dump.getValue() != null || Options.Log.getValue() != null || areScopedMetricsOrTimersEnabled(); } /** - * Determines if any of {@link #Meter}, {@link #Time} or {@link #TrackMemUse} has a non-null, - * non-empty value. + * Determines if any of {@link Options#Meter}, {@link Options#Time} or + * {@link Options#TrackMemUse} has a non-null, non-empty value. */ public static boolean areScopedMetricsOrTimersEnabled() { - return isNotEmpty(Meter) || isNotEmpty(Time) || isNotEmpty(TrackMemUse); + return isNotEmpty(Options.Meter) || isNotEmpty(Options.Time) || isNotEmpty(Options.TrackMemUse); } private final DebugFilter logFilter; @@ -222,7 +224,7 @@ } else if (methodFilter != null) { JavaMethod method = asJavaMethod(o); if (method != null) { - if (!MethodFilterRootOnly.getValue()) { + if (!Options.MethodFilterRootOnly.getValue()) { if (com.oracle.graal.debug.MethodFilter.matches(methodFilter, method)) { return true; } @@ -271,13 +273,13 @@ @Override public RuntimeException interceptException(Throwable e) { - if (e instanceof BailoutException && !InterceptBailout.getValue()) { + if (e instanceof BailoutException && !Options.InterceptBailout.getValue()) { return null; } Debug.setConfig(Debug.fixedConfig(Debug.DEFAULT_LOG_LEVEL, Debug.DEFAULT_LOG_LEVEL, false, false, false, false, dumpHandlers, verifyHandlers, output)); Debug.log(String.format("Exception occurred in scope: %s", Debug.currentScope())); for (Object o : Debug.context()) { - if (DumpOnError.getValue()) { + if (Options.DumpOnError.getValue()) { Debug.dump(o, "Exception: " + e.toString()); } else { Debug.log("Context obj %s", o); diff -r 7ffade01e1ff -r 60d59d17d419 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java Thu Oct 08 14:29:02 2015 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompileTheWorld.java Thu Oct 08 14:31:46 2015 +0200 @@ -227,8 +227,8 @@ */ public void compile() throws Throwable { // By default only report statistics for the CTW threads themselves - if (GraalDebugConfig.DebugValueThreadFilter.hasDefaultValue()) { - GraalDebugConfig.DebugValueThreadFilter.setValue("^CompileTheWorld"); + if (GraalDebugConfig.Options.DebugValueThreadFilter.hasDefaultValue()) { + GraalDebugConfig.Options.DebugValueThreadFilter.setValue("^CompileTheWorld"); } if (SUN_BOOT_CLASS_PATH.equals(files)) { diff -r 7ffade01e1ff -r 60d59d17d419 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/DebugValuesPrinter.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/DebugValuesPrinter.java Thu Oct 08 14:29:02 2015 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/DebugValuesPrinter.java Thu Oct 08 14:31:46 2015 +0200 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,9 +22,9 @@ */ package com.oracle.graal.hotspot; -import static com.oracle.graal.debug.GraalDebugConfig.DebugValueSummary; -import static com.oracle.graal.debug.GraalDebugConfig.DebugValueThreadFilter; -import static com.oracle.graal.debug.GraalDebugConfig.SuppressZeroDebugValues; +import static com.oracle.graal.debug.GraalDebugConfig.Options.DebugValueSummary; +import static com.oracle.graal.debug.GraalDebugConfig.Options.DebugValueThreadFilter; +import static com.oracle.graal.debug.GraalDebugConfig.Options.SuppressZeroDebugValues; import java.io.PrintStream; import java.util.ArrayList; diff -r 7ffade01e1ff -r 60d59d17d419 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java Thu Oct 08 14:29:02 2015 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java Thu Oct 08 14:31:46 2015 +0200 @@ -22,11 +22,11 @@ */ package com.oracle.graal.hotspot; -import static com.oracle.graal.debug.GraalDebugConfig.DebugValueSummary; -import static com.oracle.graal.debug.GraalDebugConfig.Dump; -import static com.oracle.graal.debug.GraalDebugConfig.Log; -import static com.oracle.graal.debug.GraalDebugConfig.MethodFilter; -import static com.oracle.graal.debug.GraalDebugConfig.Verify; +import static com.oracle.graal.debug.GraalDebugConfig.Options.DebugValueSummary; +import static com.oracle.graal.debug.GraalDebugConfig.Options.Dump; +import static com.oracle.graal.debug.GraalDebugConfig.Options.Log; +import static com.oracle.graal.debug.GraalDebugConfig.Options.MethodFilter; +import static com.oracle.graal.debug.GraalDebugConfig.Options.Verify; import static com.oracle.graal.debug.GraalDebugConfig.areScopedMetricsOrTimersEnabled; import static jdk.internal.jvmci.hotspot.HotSpotJVMCIRuntime.runtime; import static jdk.internal.jvmci.hotspot.HotSpotJVMCIRuntimeProvider.getArrayIndexScale;