# HG changeset patch # User Doug Simon # Date 1444923139 -7200 # Node ID 3039e5bb94cbaba522436188bdc1ee344a224a3d # Parent ceca35d52380507b1d487e71bf267ef5ecc90661 initialize JVMCI eagerly if either the PrintFlags or ShowFlags JVMCI option is present diff -r ceca35d52380 -r 3039e5bb94cb jvmci/jdk.vm.ci.options/src/jdk/vm/ci/options/OptionsParser.java --- a/jvmci/jdk.vm.ci.options/src/jdk/vm/ci/options/OptionsParser.java Thu Oct 15 17:30:42 2015 +0200 +++ b/jvmci/jdk.vm.ci.options/src/jdk/vm/ci/options/OptionsParser.java Thu Oct 15 17:32:19 2015 +0200 @@ -47,6 +47,7 @@ public class OptionsParser { private static final OptionValue PrintFlags = new OptionValue<>(false); + private static final OptionValue ShowFlags = new OptionValue<>(false); /** * A service for looking up {@link OptionDescriptor}s. @@ -153,8 +154,12 @@ public static void parseOption(String name, String valueString, OptionConsumer setter, OptionDescriptorsProvider odp, SortedMap options) { OptionDescriptor desc = odp != null ? odp.get(name) : resolveOptions(options).get(name); - if (desc == null && name.equals("PrintFlags")) { - desc = OptionDescriptor.create("PrintFlags", Boolean.class, "Prints all JVMCI flags and exits", OptionsParser.class, "PrintFlags", PrintFlags); + if (desc == null) { + if (name.equals("PrintFlags")) { + desc = OptionDescriptor.create("PrintFlags", Boolean.class, "Prints all JVMCI flags and exits", OptionsParser.class, "PrintFlags", PrintFlags); + } else if (name.equals("ShowFlags")) { + desc = OptionDescriptor.create("ShowFlags", Boolean.class, "Prints all JVMCI flags and continues", OptionsParser.class, "ShowFlags", ShowFlags); + } } if (desc == null) { List matches = fuzzyMatch(resolveOptions(options), name); @@ -198,9 +203,11 @@ setter.set(desc, value); } - if (PrintFlags.getValue()) { + if (PrintFlags.getValue() || ShowFlags.getValue()) { printFlags(resolveOptions(options), "JVMCI", System.out); - System.exit(0); + if (PrintFlags.getValue()) { + System.exit(0); + } } } diff -r ceca35d52380 -r 3039e5bb94cb src/share/vm/jvmci/jvmciRuntime.cpp --- a/src/share/vm/jvmci/jvmciRuntime.cpp Thu Oct 15 17:30:42 2015 +0200 +++ b/src/share/vm/jvmci/jvmciRuntime.cpp Thu Oct 15 17:32:19 2015 +0200 @@ -940,6 +940,23 @@ _compiler = compiler; } +void JVMCIRuntime::maybe_print_flags(TRAPS) { + if (_options != NULL) { + for (int i = 0; i < _options_count; i++) { + SystemProperty* p = _options[i]; + const char* name = p->key() + OPTION_PREFIX_LEN; + if (strcmp(name, "PrintFlags") == 0 || strcmp(name, "ShowFlags") == 0) { + JVMCIRuntime::ensure_jvmci_class_loader_is_initialized(); + jvmci_compute_offsets(); + HandleMark hm; + ResourceMark rm; + JVMCIRuntime::get_HotSpotJVMCIRuntime(CHECK); + return; + } + } + } +} + void JVMCIRuntime::save_options(SystemProperty* props) { int count = 0; SystemProperty* first = NULL; diff -r ceca35d52380 -r 3039e5bb94cb src/share/vm/jvmci/jvmciRuntime.hpp --- a/src/share/vm/jvmci/jvmciRuntime.hpp Thu Oct 15 17:30:42 2015 +0200 +++ b/src/share/vm/jvmci/jvmciRuntime.hpp Thu Oct 15 17:32:19 2015 +0200 @@ -96,6 +96,12 @@ static void save_options(SystemProperty* props); /** + * If either the PrintFlags or ShowFlags JVMCI option is present, + * then JVMCI is initialized to show the help message. + */ + static void maybe_print_flags(TRAPS); + + /** * Ensures that the JVMCI class loader is initialized and the well known JVMCI classes are loaded. */ static void ensure_jvmci_class_loader_is_initialized(); diff -r ceca35d52380 -r 3039e5bb94cb src/share/vm/runtime/thread.cpp --- a/src/share/vm/runtime/thread.cpp Thu Oct 15 17:30:42 2015 +0200 +++ b/src/share/vm/runtime/thread.cpp Thu Oct 15 17:32:19 2015 +0200 @@ -3706,6 +3706,10 @@ if (jvmciCompiler != NULL) { JVMCIRuntime::save_compiler(jvmciCompiler); } + JVMCIRuntime::maybe_print_flags(THREAD); + if (HAS_PENDING_EXCEPTION) { + vm_exit_during_initialization(Handle(THREAD, PENDING_EXCEPTION)); + } #endif // initialize compiler(s)