changeset 24593:b782b87860c2

[GR-8577] Introduce EagerJVMCI flag to force eager JVMCI initialization. PullRequest: graal-jvmci-8/40
author Doug Simon <doug.simon@oracle.com>
date Tue, 06 Mar 2018 00:34:57 -0800
parents 8a20922361f8 4f6f070b1201
children 9b0ecd1b2118 df8925c0999c 7ba86f69c363
files
diffstat 5 files changed, 23 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java	Mon Mar 05 13:31:00 2018 -0800
+++ b/jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java	Tue Mar 06 00:34:57 2018 -0800
@@ -70,6 +70,12 @@
         static {
             try (InitTimer t = timer("HotSpotJVMCIRuntime.<init>")) {
                 instance = new HotSpotJVMCIRuntime();
+
+                // Can only do eager initialization of the JVMCI compiler
+                // once the singleton instance is available.
+                if (instance.config.getFlag("EagerJVMCI", Boolean.class)) {
+                    instance.getCompiler();
+                }
             }
         }
     }
--- a/src/share/vm/compiler/compileBroker.cpp	Mon Mar 05 13:31:00 2018 -0800
+++ b/src/share/vm/compiler/compileBroker.cpp	Tue Mar 06 00:34:57 2018 -0800
@@ -944,8 +944,9 @@
 #if INCLUDE_JVMCI
   if (EnableJVMCI) {
     JVMCICompiler* jvmci = new JVMCICompiler();
-    if (JVMCIPrintProperties) {
-      // Initialize JVMCI eagerly if JVMCIPrintProperties is enabled.
+    if (EagerJVMCI || JVMCIPrintProperties) {
+      // Initialize JVMCI eagerly when it is explicitly requested
+      // or if JVMCIPrintProperties is enabled.
       // The JVMCI Java initialization code will read this flag and
       // do the printing if it's set.
       JVMCIRuntime::ensure_jvmci_class_loader_is_initialized();
--- a/src/share/vm/jvmci/jvmciCompilerToVM.cpp	Mon Mar 05 13:31:00 2018 -0800
+++ b/src/share/vm/jvmci/jvmciCompilerToVM.cpp	Tue Mar 06 00:34:57 2018 -0800
@@ -284,6 +284,7 @@
   do_intx_flag(HugeMethodLimit)                                            \
   do_bool_flag(Inline)                                                     \
   do_intx_flag(JVMCICounterSize)                                           \
+  do_bool_flag(EagerJVMCI)                                                 \
   do_bool_flag(JVMCIPrintProperties)                                       \
   do_bool_flag(JVMCIUseFastLocking)                                        \
   do_intx_flag(MethodProfileWidth)                                         \
--- a/src/share/vm/jvmci/jvmci_globals.cpp	Mon Mar 05 13:31:00 2018 -0800
+++ b/src/share/vm/jvmci/jvmci_globals.cpp	Tue Mar 06 00:34:57 2018 -0800
@@ -151,6 +151,16 @@
     }
     FLAG_SET_DEFAULT(EnableJVMCI, true);
   }
+
+  if (!EnableJVMCI) {
+    // Switch off eager JVMCI initialization if JVMCI is disabled.
+    // To simplify testing, don't throw error if EagerJVMCI is set.
+    if (EagerJVMCI) {
+      FLAG_SET_DEFAULT(EagerJVMCI, false);
+    }
+  }
+  JVMCI_FLAG_CHECKED(EagerJVMCI)
+
   CHECK_NOT_SET(UseJVMCIClassLoader,          EnableJVMCI)
   CHECK_NOT_SET(CodeInstallSafepointChecks,   EnableJVMCI)
   CHECK_NOT_SET(JVMCITraceLevel,              EnableJVMCI)
--- a/src/share/vm/jvmci/jvmci_globals.hpp	Mon Mar 05 13:31:00 2018 -0800
+++ b/src/share/vm/jvmci/jvmci_globals.hpp	Tue Mar 06 00:34:57 2018 -0800
@@ -66,6 +66,9 @@
   product(bool, PrintBootstrap, true,                                       \
           "Print JVMCI bootstrap progress and summary")                     \
                                                                             \
+  product(bool, EagerJVMCI, false,                                          \
+          "Force eager initialization of the JVMCI compiler")               \
+                                                                            \
   product(intx, JVMCIThreads, 1,                                            \
           "Force number of JVMCI compiler threads to use")                  \
                                                                             \