Mercurial > hg > graal-compiler
changeset 23288:13fab147f1ea
removed remaining uses of "jvmci." prefixed system properties in Graal
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Mon, 11 Jan 2016 22:48:38 +0100 |
parents | d2c1517a2487 |
children | 468184cf7b34 |
files | graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalDebugInitializationParticipant.java graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalDebugInitializationPropertyProvider.java graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Debug.java graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugEnvironment.java graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugInitializationParticipant.java graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugInitializationPropertyProvider.java graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Fingerprint.java |
diffstat | 7 files changed, 122 insertions(+), 119 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalDebugInitializationParticipant.java Mon Jan 11 22:48:38 2016 +0100 @@ -0,0 +1,53 @@ +/* + * Copyright (c) 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.compiler; + +import com.oracle.graal.debug.Debug; +import com.oracle.graal.debug.Debug.Params; +import com.oracle.graal.debug.DebugInitializationParticipant; +import com.oracle.graal.debug.GraalDebugConfig; +import com.oracle.graal.serviceprovider.ServiceProvider; + +/** + * A service provider that may modify the initialization of {@link Debug} based on the values + * specified for various {@link GraalDebugConfig} options. + */ +@ServiceProvider(DebugInitializationParticipant.class) +public class GraalDebugInitializationParticipant implements DebugInitializationParticipant { + + @Override + public void apply(Params params) { + if (GraalDebugConfig.areDebugScopePatternsEnabled()) { + params.enable = true; + } + if ("".equals(GraalDebugConfig.Options.Meter.getValue())) { + params.enableUnscopedMetrics = true; + } + if ("".equals(GraalDebugConfig.Options.Time.getValue())) { + params.enableUnscopedTimers = true; + } + if ("".equals(GraalDebugConfig.Options.TrackMemUse.getValue())) { + params.enableUnscopedMemUseTrackers = true; + } + } +}
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalDebugInitializationPropertyProvider.java Mon Jan 11 16:05:45 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -/* - * Copyright (c) 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.compiler; - -import com.oracle.graal.debug.Debug; -import com.oracle.graal.debug.DebugInitializationPropertyProvider; -import com.oracle.graal.debug.GraalDebugConfig; -import com.oracle.graal.serviceprovider.ServiceProvider; - -/** - * Sets system properties used in the initialization of {@link Debug} based on the values specified - * for various {@link GraalDebugConfig} options. - */ -@ServiceProvider(DebugInitializationPropertyProvider.class) -public class GraalDebugInitializationPropertyProvider implements DebugInitializationPropertyProvider { - - @Override - public void apply() { - if (GraalDebugConfig.areDebugScopePatternsEnabled()) { - System.setProperty(Debug.Initialization.INITIALIZER_PROPERTY_NAME, "true"); - } - if ("".equals(GraalDebugConfig.Options.Meter.getValue())) { - System.setProperty(Debug.ENABLE_UNSCOPED_METRICS_PROPERTY_NAME, "true"); - } - if ("".equals(GraalDebugConfig.Options.Time.getValue())) { - System.setProperty(Debug.ENABLE_UNSCOPED_TIMERS_PROPERTY_NAME, "true"); - } - if ("".equals(GraalDebugConfig.Options.TrackMemUse.getValue())) { - System.setProperty(Debug.ENABLE_UNSCOPED_MEM_USE_TRACKERS_PROPERTY_NAME, "true"); - } - } -}
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Debug.java Mon Jan 11 16:05:45 2016 +0100 +++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Debug.java Mon Jan 11 22:48:38 2016 +0100 @@ -22,7 +22,6 @@ */ package com.oracle.graal.debug; -import static com.oracle.graal.debug.Debug.Initialization.INITIALIZER_PROPERTY_NAME; import static com.oracle.graal.debug.DelegatingDebugConfig.Feature.INTERCEPT; import static com.oracle.graal.debug.DelegatingDebugConfig.Feature.LOG_METHOD; import static java.util.FormattableFlags.LEFT_JUSTIFY; @@ -50,42 +49,46 @@ import com.oracle.graal.debug.internal.TimerImpl; /** - * Scope based debugging facility. This facility is {@link #isEnabled()} if assertions are enabled - * for the {@link Debug} class or the {@value Initialization#INITIALIZER_PROPERTY_NAME} system - * property is {@code "true"} when {@link Debug} is initialized. + * Scope based debugging facility. + * + * This facility is {@linkplain #isEnabled() enabled} if any of the following hold when the + * {@link Debug} class is initialized: + * <ul> + * <li>assertions are enabled for the {@link Debug} class</li> + * <li>{@link Debug#params}{@code .enable} is {@code true}</li> + * </ul> */ public class Debug { + private static final Params params = new Params(); + static { - for (DebugInitializationPropertyProvider p : Services.load(DebugInitializationPropertyProvider.class)) { - p.apply(); + // Load the service providers that may want to modify any of the + // parameters encapsulated by the Initialization class below. + for (DebugInitializationParticipant p : Services.load(DebugInitializationParticipant.class)) { + p.apply(params); + } + if (!params.enable && (params.enableUnscopedMetrics || params.enableUnscopedTimers || params.enableUnscopedMemUseTrackers)) { + params.enable = true; } } /** - * Class to assist with initialization of {@link Debug}. + * The parameters for configuring the initialization of {@link Debug} class. */ - public static class Initialization { - - public static final String INITIALIZER_PROPERTY_NAME = "jvmci.debug.enable"; - - private static boolean initialized; + public static class Params { - /** - * Determines if {@link Debug} has been initialized. - */ - public static boolean isDebugInitialized() { - return initialized; - } - + public boolean enable; + public boolean enableUnscopedTimers; + public boolean enableUnscopedMetrics; + public boolean enableUnscopedMemUseTrackers; } @SuppressWarnings("all") private static boolean initialize() { boolean assertionsEnabled = false; assert assertionsEnabled = true; - Initialization.initialized = true; - return assertionsEnabled || Boolean.getBoolean(INITIALIZER_PROPERTY_NAME); + return assertionsEnabled || params.enable; } private static final boolean ENABLED = initialize(); @@ -1118,7 +1121,7 @@ /** * Creates a {@linkplain DebugMetric metric} that is enabled iff debugging is - * {@linkplain #isEnabled() enabled} or the system property whose name is formed by adding to + * {@linkplain #isEnabled() enabled} or the system property whose name is formed by adding * {@value #ENABLE_METRIC_PROPERTY_NAME_PREFIX} to {@code name} is * {@linkplain Boolean#getBoolean(String) true}. If the latter condition is true, then the * returned metric is {@linkplain DebugMetric#isConditional() unconditional} otherwise it is @@ -1347,19 +1350,15 @@ } }; - public static final String ENABLE_UNSCOPED_TIMERS_PROPERTY_NAME = "jvmci.debug.unscopedTimers"; - public static final String ENABLE_UNSCOPED_METRICS_PROPERTY_NAME = "jvmci.debug.unscopedMetrics"; - public static final String ENABLE_UNSCOPED_MEM_USE_TRACKERS_PROPERTY_NAME = "jvmci.debug.unscopedMemUseTrackers"; - /** * @see #timer(CharSequence) */ - public static final String ENABLE_TIMER_PROPERTY_NAME_PREFIX = "jvmci.debug.timer."; + public static final String ENABLE_TIMER_PROPERTY_NAME_PREFIX = "graaldebug.timer."; /** * @see #metric(CharSequence) */ - public static final String ENABLE_METRIC_PROPERTY_NAME_PREFIX = "jvmci.debug.metric."; + public static final String ENABLE_METRIC_PROPERTY_NAME_PREFIX = "graaldebug.metric."; /** * Set of unconditionally enabled metrics. Possible values and their meanings: @@ -1392,15 +1391,15 @@ parseMetricAndTimerSystemProperties(metrics, timers, enabledMetricsSubstrings, enabledTimersSubstrings); metrics = metrics.isEmpty() && enabledMetricsSubstrings.isEmpty() ? null : metrics; timers = timers.isEmpty() && enabledTimersSubstrings.isEmpty() ? null : timers; - if (metrics == null && Boolean.getBoolean(ENABLE_UNSCOPED_METRICS_PROPERTY_NAME)) { + if (metrics == null && params.enableUnscopedMetrics) { metrics = Collections.emptySet(); } - if (timers == null && Boolean.getBoolean(ENABLE_UNSCOPED_TIMERS_PROPERTY_NAME)) { + if (timers == null && params.enableUnscopedTimers) { timers = Collections.emptySet(); } enabledMetrics = metrics; enabledTimers = timers; - isUnconditionalMemUseTrackingEnabled = Boolean.getBoolean(ENABLE_UNSCOPED_MEM_USE_TRACKERS_PROPERTY_NAME); + isUnconditionalMemUseTrackingEnabled = params.enableUnscopedMemUseTrackers; } private static boolean findMatch(Set<String> haystack, Set<String> haystackSubstrings, String needle) { @@ -1459,7 +1458,7 @@ /** * Creates a {@linkplain DebugTimer timer} that is enabled iff debugging is - * {@linkplain #isEnabled() enabled} or the system property whose name is formed by adding to + * {@linkplain #isEnabled() enabled} or the system property whose name is formed by adding * {@value #ENABLE_TIMER_PROPERTY_NAME_PREFIX} to {@code name} is * {@linkplain Boolean#getBoolean(String) true}. If the latter condition is true, then the * returned timer is {@linkplain DebugMetric#isConditional() unconditional} otherwise it is
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugEnvironment.java Mon Jan 11 16:05:45 2016 +0100 +++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugEnvironment.java Mon Jan 11 22:48:38 2016 +0100 @@ -40,11 +40,10 @@ public class DebugEnvironment { public static GraalDebugConfig initialize(PrintStream log) { - // Initialize JVMCI before loading class Debug to make sure, properties are loaded - // (especially Debug=...) + // Initialize JVMCI before loading class Debug JVMCI.initialize(); if (!Debug.isEnabled()) { - log.println("WARNING: Scope debugging needs to be enabled with -esa or -D" + Debug.Initialization.INITIALIZER_PROPERTY_NAME + "=true"); + log.println("WARNING: Scope debugging needs to be enabled with -esa"); return null; } List<DebugDumpHandler> dumpHandlers = new ArrayList<>();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugInitializationParticipant.java Mon Jan 11 22:48:38 2016 +0100 @@ -0,0 +1,36 @@ +/* + * Copyright (c) 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.debug; + +import com.oracle.graal.debug.Debug.Params; + +/** + * Defines a service that can modify the {@linkplain Params parameters} for {@link Debug}. + */ +public interface DebugInitializationParticipant { + + /** + * Modifies the given {@link Debug} initialization parameters as necessary. + */ + void apply(Params params); +}
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/DebugInitializationPropertyProvider.java Mon Jan 11 16:05:45 2016 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* - * Copyright (c) 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.debug; - -/** - * Sets one or more system properties used during initialization of the {@link Debug} class. - */ -public interface DebugInitializationPropertyProvider { - void apply(); -}
--- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Fingerprint.java Mon Jan 11 16:05:45 2016 +0100 +++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/Fingerprint.java Mon Jan 11 22:48:38 2016 +0100 @@ -44,8 +44,6 @@ public static final OptionValue<Integer> FingerprintingBreakpointEvent = new OptionValue<>(-1); } - // public static final String ENABLED_PROPERTY_NAME = "jvmci.fingerprint"; - /** * Determines whether fingerprinting is enabled. */