# HG changeset patch # User Doug Simon # Date 1432912994 -7200 # Node ID 7a7cf422160b041bdbed2026c76c5153c19fd1c4 # Parent 93f282187d90a0df7c19351f074f65f5d678e316 replaced OptionsParsed with DebugInitializationPropertyProvider diff -r 93f282187d90 -r 7a7cf422160b graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalDebugConfigOptionsParsed.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalDebugConfigOptionsParsed.java Fri May 29 17:01:57 2015 +0200 +++ /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.jvmci.debug.*; -import com.oracle.jvmci.runtime.*; -import com.oracle.jvmci.service.*; - -/** - * Implementation of {@link OptionsParsed} for setting system properties used in the initialization - * of {@link Debug} based on the values specified for various {@link GraalDebugConfig} options. - */ -@ServiceProvider(OptionsParsed.class) -class GraalDebugConfigOptionsParsed implements OptionsParsed { - - @Override - public void run() { - assert !Debug.Initialization.isDebugInitialized(); - if (GraalDebugConfig.areDebugScopePatternsEnabled()) { - System.setProperty(Debug.Initialization.INITIALIZER_PROPERTY_NAME, "true"); - } - if ("".equals(GraalDebugConfig.Meter.getValue())) { - System.setProperty(Debug.ENABLE_UNSCOPED_METRICS_PROPERTY_NAME, "true"); - } - if ("".equals(GraalDebugConfig.Time.getValue())) { - System.setProperty(Debug.ENABLE_UNSCOPED_TIMERS_PROPERTY_NAME, "true"); - } - if ("".equals(GraalDebugConfig.TrackMemUse.getValue())) { - System.setProperty(Debug.ENABLE_UNSCOPED_MEM_USE_TRACKERS_PROPERTY_NAME, "true"); - } - } -} diff -r 93f282187d90 -r 7a7cf422160b graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalDebugInitializationPropertyProvider.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalDebugInitializationPropertyProvider.java Fri May 29 17:23:14 2015 +0200 @@ -0,0 +1,50 @@ +/* + * 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.jvmci.debug.*; +import com.oracle.jvmci.service.*; + +/** + * Sets system properties used in the initialization of {@link Debug} based on the values specified + * for various {@link GraalDebugConfig} options. + */ +@ServiceProvider(DebugInitializationPropertyProvider.class) +class GraalDebugInitializationPropertyProvider implements DebugInitializationPropertyProvider { + + @Override + public void apply() { + if (GraalDebugConfig.areDebugScopePatternsEnabled()) { + System.setProperty(Debug.Initialization.INITIALIZER_PROPERTY_NAME, "true"); + } + if ("".equals(GraalDebugConfig.Meter.getValue())) { + System.setProperty(Debug.ENABLE_UNSCOPED_METRICS_PROPERTY_NAME, "true"); + } + if ("".equals(GraalDebugConfig.Time.getValue())) { + System.setProperty(Debug.ENABLE_UNSCOPED_TIMERS_PROPERTY_NAME, "true"); + } + if ("".equals(GraalDebugConfig.TrackMemUse.getValue())) { + System.setProperty(Debug.ENABLE_UNSCOPED_MEM_USE_TRACKERS_PROPERTY_NAME, "true"); + } + } +} diff -r 93f282187d90 -r 7a7cf422160b graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/Debug.java --- a/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/Debug.java Fri May 29 17:01:57 2015 +0200 +++ b/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/Debug.java Fri May 29 17:23:14 2015 +0200 @@ -32,6 +32,7 @@ import com.oracle.jvmci.debug.DelegatingDebugConfig.Level; import com.oracle.jvmci.debug.internal.*; +import com.oracle.jvmci.service.*; /** * Scope based debugging facility. This facility is {@link #isEnabled()} if assertions are enabled @@ -40,6 +41,12 @@ */ public class Debug { + static { + for (DebugInitializationPropertyProvider p : Services.load(DebugInitializationPropertyProvider.class)) { + p.apply(); + } + } + /** * Class to assist with initialization of {@link Debug}. */ diff -r 93f282187d90 -r 7a7cf422160b graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugInitializationPropertyProvider.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.jvmci.debug/src/com/oracle/jvmci/debug/DebugInitializationPropertyProvider.java Fri May 29 17:23:14 2015 +0200 @@ -0,0 +1,32 @@ +/* + * 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.jvmci.debug; + +import com.oracle.jvmci.service.*; + +/** + * Sets one or more system properties used during initialization of the {@link Debug} class. + */ +public interface DebugInitializationPropertyProvider extends Service { + void apply(); +} diff -r 93f282187d90 -r 7a7cf422160b graal/com.oracle.jvmci.runtime/src/com/oracle/jvmci/runtime/OptionsParsed.java --- a/graal/com.oracle.jvmci.runtime/src/com/oracle/jvmci/runtime/OptionsParsed.java Fri May 29 17:01:57 2015 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +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.jvmci.runtime; - -import com.oracle.jvmci.service.*; - -/** - * Extension for doing post-processing once all JVMCI options have been parsed and initialized. - */ -public interface OptionsParsed extends Service { - - /** - * Notifies this service that all JVMCI options have been parsed and initialized. - */ - void run(); -} diff -r 93f282187d90 -r 7a7cf422160b make/defs.make --- a/make/defs.make Fri May 29 17:01:57 2015 +0200 +++ b/make/defs.make Fri May 29 17:23:14 2015 +0200 @@ -365,7 +365,7 @@ EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)/com.oracle.jvmci.hotspot.HotSpotJVMCIBackendFactory EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)/com.oracle.jvmci.hotspot.HotSpotVMEventListener -EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)/com.oracle.jvmci.runtime.OptionsParsed +EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)/com.oracle.jvmci.debug.DebugInitializationPropertyProvider EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)/com.oracle.graal.api.runtime.GraalRuntimeFactory EXPORT_LIST += $(EXPORT_JRE_LIB_JVMCI_SERVICES_DIR)/com.oracle.graal.compiler.match.MatchStatementSet diff -r 93f282187d90 -r 7a7cf422160b mx/suite.py --- a/mx/suite.py Fri May 29 17:01:57 2015 +0200 +++ b/mx/suite.py Fri May 29 17:23:14 2015 +0200 @@ -173,7 +173,6 @@ "subDir" : "graal", "sourceDirs" : ["src"], "dependencies" : [ - "com.oracle.jvmci.service", "com.oracle.jvmci.code" ], "checkstyle" : "com.oracle.graal.graph", @@ -518,6 +517,9 @@ "subDir" : "graal", "sourceDirs" : ["src"], "checkstyle" : "com.oracle.graal.graph", + "dependencies" : [ + "com.oracle.jvmci.service", + ], "javaCompliance" : "1.8", "workingSets" : "Graal,Debug", }, @@ -751,7 +753,6 @@ "subDir" : "graal", "sourceDirs" : ["src"], "dependencies" : [ - "com.oracle.jvmci.runtime", "com.oracle.graal.virtual", "com.oracle.graal.loop", ], diff -r 93f282187d90 -r 7a7cf422160b src/share/vm/jvmci/jvmciRuntime.cpp --- a/src/share/vm/jvmci/jvmciRuntime.cpp Fri May 29 17:01:57 2015 +0200 +++ b/src/share/vm/jvmci/jvmciRuntime.cpp Fri May 29 17:23:14 2015 +0200 @@ -1045,8 +1045,6 @@ if (closure.is_aborted()) { vm_abort(false); } - - notify_options_set(THREAD); } OptionValue* printFlags = options->get(PRINT_FLAGS_ARG); if (printFlags != NULL && printFlags->boolean_value) { @@ -1054,22 +1052,6 @@ } } -void JVMCIRuntime::notify_options_set(TRAPS) { - HandleMark hm(THREAD); - TempNewSymbol optionsParsedName = SymbolTable::new_symbol("com/oracle/jvmci/runtime/OptionsParsed", CHECK_ABORT); - KlassHandle optionsParsedClass = load_required_class(optionsParsedName); - objArrayHandle impls = get_service_impls(optionsParsedClass, THREAD); - int implsLen = impls->length(); - if (implsLen != 0) { - for (int i = 0; i < implsLen; i++) { - JavaValue result(T_VOID); - JavaCallArguments args; - args.push_oop(impls->obj_at(i)); - JavaCalls::call_interface(&result, optionsParsedClass, vmSymbols::run_method_name(), vmSymbols::void_method_signature(), &args, CHECK_ABORT); - } - } -} - void JVMCIRuntime::print_flags_helper(TRAPS) { // TODO(gd) write this in C++? HandleMark hm(THREAD); diff -r 93f282187d90 -r 7a7cf422160b src/share/vm/jvmci/jvmciRuntime.hpp --- a/src/share/vm/jvmci/jvmciRuntime.hpp Fri May 29 17:01:57 2015 +0200 +++ b/src/share/vm/jvmci/jvmciRuntime.hpp Fri May 29 17:23:14 2015 +0200 @@ -69,11 +69,6 @@ */ static void parse_jvmci_options_file(OptionsValueTable* options); - /** - * Called after all options have been set to notify OptionsParsed providers. - */ - static void notify_options_set(TRAPS); - static void print_flags_helper(TRAPS); /**