8200230: [Graal] Compilations should not be enqueued before Graal is initialized
Split compiler initialization into two phases to avoid compilations being enqueued before Graal is initialized. Reviewed-by: kvn, dnsimon
This commit is contained in:
parent
32668d954e
commit
c530e2724d
@ -524,7 +524,7 @@ CompilerCounters::CompilerCounters() {
|
|||||||
// CompileBroker::compilation_init
|
// CompileBroker::compilation_init
|
||||||
//
|
//
|
||||||
// Initialize the Compilation object
|
// Initialize the Compilation object
|
||||||
void CompileBroker::compilation_init(TRAPS) {
|
void CompileBroker::compilation_init_phase1(TRAPS) {
|
||||||
_last_method_compiled[0] = '\0';
|
_last_method_compiled[0] = '\0';
|
||||||
|
|
||||||
// No need to initialize compilation system if we do not use it.
|
// No need to initialize compilation system if we do not use it.
|
||||||
@ -671,10 +671,13 @@ void CompileBroker::compilation_init(TRAPS) {
|
|||||||
(jlong)CompileBroker::no_compile,
|
(jlong)CompileBroker::no_compile,
|
||||||
CHECK);
|
CHECK);
|
||||||
}
|
}
|
||||||
|
|
||||||
_initialized = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Completes compiler initialization. Compilation requests submitted
|
||||||
|
// prior to this will be silently ignored.
|
||||||
|
void CompileBroker::compilation_init_phase2() {
|
||||||
|
_initialized = true;
|
||||||
|
}
|
||||||
|
|
||||||
JavaThread* CompileBroker::make_thread(const char* name, CompileQueue* queue, CompilerCounters* counters,
|
JavaThread* CompileBroker::make_thread(const char* name, CompileQueue* queue, CompilerCounters* counters,
|
||||||
AbstractCompiler* comp, bool compiler_thread, TRAPS) {
|
AbstractCompiler* comp, bool compiler_thread, TRAPS) {
|
||||||
|
@ -282,7 +282,8 @@ public:
|
|||||||
CompileQueue *q = compile_queue(comp_level);
|
CompileQueue *q = compile_queue(comp_level);
|
||||||
return q != NULL ? q->size() : 0;
|
return q != NULL ? q->size() : 0;
|
||||||
}
|
}
|
||||||
static void compilation_init(TRAPS);
|
static void compilation_init_phase1(TRAPS);
|
||||||
|
static void compilation_init_phase2();
|
||||||
static void init_compiler_thread_log();
|
static void init_compiler_thread_log();
|
||||||
static nmethod* compile_method(const methodHandle& method,
|
static nmethod* compile_method(const methodHandle& method,
|
||||||
int osr_bci,
|
int osr_bci,
|
||||||
|
@ -3835,7 +3835,28 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
|
|||||||
|
|
||||||
// initialize compiler(s)
|
// initialize compiler(s)
|
||||||
#if defined(COMPILER1) || COMPILER2_OR_JVMCI
|
#if defined(COMPILER1) || COMPILER2_OR_JVMCI
|
||||||
CompileBroker::compilation_init(CHECK_JNI_ERR);
|
#if INCLUDE_JVMCI
|
||||||
|
bool force_JVMCI_intialization = false;
|
||||||
|
if (EnableJVMCI) {
|
||||||
|
// Initialize JVMCI eagerly when it is explicitly requested.
|
||||||
|
// Or when JVMCIPrintProperties is enabled.
|
||||||
|
// The JVMCI Java initialization code will read this flag and
|
||||||
|
// do the printing if it's set.
|
||||||
|
force_JVMCI_intialization = EagerJVMCI || JVMCIPrintProperties;
|
||||||
|
|
||||||
|
if (!force_JVMCI_intialization) {
|
||||||
|
// 8145270: Force initialization of JVMCI runtime otherwise requests for blocking
|
||||||
|
// compilations via JVMCI will not actually block until JVMCI is initialized.
|
||||||
|
force_JVMCI_intialization = UseJVMCICompiler && (!UseInterpreter || !BackgroundCompilation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
CompileBroker::compilation_init_phase1(CHECK_JNI_ERR);
|
||||||
|
// Postpone completion of compiler initialization to after JVMCI
|
||||||
|
// is initialized to avoid timeouts of blocking compilations.
|
||||||
|
if (JVMCI_ONLY(!force_JVMCI_intialization) NOT_JVMCI(true)) {
|
||||||
|
CompileBroker::compilation_init_phase2();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Pre-initialize some JSR292 core classes to avoid deadlock during class loading.
|
// Pre-initialize some JSR292 core classes to avoid deadlock during class loading.
|
||||||
@ -3862,22 +3883,9 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
|
|||||||
SystemDictionary::compute_java_loaders(CHECK_JNI_ERR);
|
SystemDictionary::compute_java_loaders(CHECK_JNI_ERR);
|
||||||
|
|
||||||
#if INCLUDE_JVMCI
|
#if INCLUDE_JVMCI
|
||||||
if (EnableJVMCI) {
|
if (force_JVMCI_intialization) {
|
||||||
// Initialize JVMCI eagerly when it is explicitly requested.
|
JVMCIRuntime::force_initialization(CHECK_JNI_ERR);
|
||||||
// Or when JVMCIPrintProperties is enabled.
|
CompileBroker::compilation_init_phase2();
|
||||||
// The JVMCI Java initialization code will read this flag and
|
|
||||||
// do the printing if it's set.
|
|
||||||
bool init = EagerJVMCI || JVMCIPrintProperties;
|
|
||||||
|
|
||||||
if (!init) {
|
|
||||||
// 8145270: Force initialization of JVMCI runtime otherwise requests for blocking
|
|
||||||
// compilations via JVMCI will not actually block until JVMCI is initialized.
|
|
||||||
init = UseJVMCICompiler && (!UseInterpreter || !BackgroundCompilation);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (init) {
|
|
||||||
JVMCIRuntime::force_initialization(CHECK_JNI_ERR);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user