Skip to content
This repository was archived by the owner on Aug 16, 2023. It is now read-only.

Commit dc1d526

Browse files
committed
[GR-8577] Introduce EagerJVMCI flag to force eager JVMCI initialization.
PullRequest: graal-jvmci-8/40
2 parents c0cc87c + bd5bbf2 commit dc1d526

File tree

5 files changed

+23
-2
lines changed

5 files changed

+23
-2
lines changed

jvmci/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotJVMCIRuntime.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ static class DelayedInit {
7070
static {
7171
try (InitTimer t = timer("HotSpotJVMCIRuntime.<init>")) {
7272
instance = new HotSpotJVMCIRuntime();
73+
74+
// Can only do eager initialization of the JVMCI compiler
75+
// once the singleton instance is available.
76+
if (instance.config.getFlag("EagerJVMCI", Boolean.class)) {
77+
instance.getCompiler();
78+
}
7379
}
7480
}
7581
}

src/share/vm/compiler/compileBroker.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -944,8 +944,9 @@ void CompileBroker::compilation_init(TRAPS) {
944944
#if INCLUDE_JVMCI
945945
if (EnableJVMCI) {
946946
JVMCICompiler* jvmci = new JVMCICompiler();
947-
if (JVMCIPrintProperties) {
948-
// Initialize JVMCI eagerly if JVMCIPrintProperties is enabled.
947+
if (EagerJVMCI || JVMCIPrintProperties) {
948+
// Initialize JVMCI eagerly when it is explicitly requested
949+
// or if JVMCIPrintProperties is enabled.
949950
// The JVMCI Java initialization code will read this flag and
950951
// do the printing if it's set.
951952
JVMCIRuntime::ensure_jvmci_class_loader_is_initialized();

src/share/vm/jvmci/jvmciCompilerToVM.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ objArrayHandle CompilerToVM::initialize_intrinsics(TRAPS) {
284284
do_intx_flag(HugeMethodLimit) \
285285
do_bool_flag(Inline) \
286286
do_intx_flag(JVMCICounterSize) \
287+
do_bool_flag(EagerJVMCI) \
287288
do_bool_flag(JVMCIPrintProperties) \
288289
do_bool_flag(JVMCIUseFastLocking) \
289290
do_intx_flag(MethodProfileWidth) \

src/share/vm/jvmci/jvmci_globals.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,16 @@ bool JVMCIGlobals::check_jvmci_flags_are_consistent() {
151151
}
152152
FLAG_SET_DEFAULT(EnableJVMCI, true);
153153
}
154+
155+
if (!EnableJVMCI) {
156+
// Switch off eager JVMCI initialization if JVMCI is disabled.
157+
// To simplify testing, don't throw error if EagerJVMCI is set.
158+
if (EagerJVMCI) {
159+
FLAG_SET_DEFAULT(EagerJVMCI, false);
160+
}
161+
}
162+
JVMCI_FLAG_CHECKED(EagerJVMCI)
163+
154164
CHECK_NOT_SET(UseJVMCIClassLoader, EnableJVMCI)
155165
CHECK_NOT_SET(CodeInstallSafepointChecks, EnableJVMCI)
156166
CHECK_NOT_SET(JVMCITraceLevel, EnableJVMCI)

src/share/vm/jvmci/jvmci_globals.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@
6666
product(bool, PrintBootstrap, true, \
6767
"Print JVMCI bootstrap progress and summary") \
6868
\
69+
product(bool, EagerJVMCI, false, \
70+
"Force eager initialization of the JVMCI compiler") \
71+
\
6972
product(intx, JVMCIThreads, 1, \
7073
"Force number of JVMCI compiler threads to use") \
7174
\

0 commit comments

Comments
 (0)