8144964: JVMCI compilations need to be disabled until the module system is initialized

Reviewed-by: kvn
This commit is contained in:
Christian Thalinger 2016-03-31 15:52:07 -10:00
parent b75d50cc75
commit 879c8b43c6
6 changed files with 45 additions and 13 deletions

View file

@ -2063,7 +2063,18 @@ bool SystemDictionary::initialize_wk_klass(WKID id, int init_opt, TRAPS) {
int sid = (info >> CEIL_LG_OPTION_LIMIT); int sid = (info >> CEIL_LG_OPTION_LIMIT);
Symbol* symbol = vmSymbols::symbol_at((vmSymbols::SID)sid); Symbol* symbol = vmSymbols::symbol_at((vmSymbols::SID)sid);
InstanceKlass** klassp = &_well_known_klasses[id]; InstanceKlass** klassp = &_well_known_klasses[id];
bool must_load = (init_opt < SystemDictionary::Opt);
bool must_load;
#if INCLUDE_JVMCI
if (EnableJVMCI) {
// If JVMCI is enabled we require its classes to be found.
must_load = (init_opt < SystemDictionary::Opt) || (init_opt == SystemDictionary::Jvmci);
} else
#endif
{
must_load = (init_opt < SystemDictionary::Opt);
}
if ((*klassp) == NULL) { if ((*klassp) == NULL) {
Klass* k; Klass* k;
if (must_load) { if (must_load) {

View file

@ -241,7 +241,7 @@ class SystemDictionary : AllStatic {
Opt, // preload tried; NULL if not present Opt, // preload tried; NULL if not present
#if INCLUDE_JVMCI #if INCLUDE_JVMCI
Jvmci, // preload tried; error if not present, use only with JVMCI Jvmci, // preload tried; error if not present if JVMCI enabled
#endif #endif
OPTION_LIMIT, OPTION_LIMIT,
CEIL_LG_OPTION_LIMIT = 2 // OPTION_LIMIT <= (1<<CEIL_LG_OPTION_LIMIT) CEIL_LG_OPTION_LIMIT = 2 // OPTION_LIMIT <= (1<<CEIL_LG_OPTION_LIMIT)

View file

@ -386,6 +386,7 @@ CompileTask* CompileQueue::get() {
task = CompilationPolicy::policy()->select_task(this); task = CompilationPolicy::policy()->select_task(this);
} }
if (task != NULL) {
// Save method pointers across unlock safepoint. The task is removed from // Save method pointers across unlock safepoint. The task is removed from
// the compilation queue, which is walked during RedefineClasses. // the compilation queue, which is walked during RedefineClasses.
save_method = methodHandle(task->method()); save_method = methodHandle(task->method());
@ -393,6 +394,8 @@ CompileTask* CompileQueue::get() {
remove(task); remove(task);
purge_stale_tasks(); // may temporarily release MCQ lock purge_stale_tasks(); // may temporarily release MCQ lock
}
return task; return task;
} }
@ -1781,7 +1784,8 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) {
bool is_osr = (osr_bci != standard_entry_bci); bool is_osr = (osr_bci != standard_entry_bci);
bool should_log = (thread->log() != NULL); bool should_log = (thread->log() != NULL);
bool should_break = false; bool should_break = false;
int task_level = task->comp_level(); const int task_level = task->comp_level();
AbstractCompiler* comp = task->compiler();
DirectiveSet* directive; DirectiveSet* directive;
{ {
@ -1793,7 +1797,7 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) {
assert(!method->is_native(), "no longer compile natives"); assert(!method->is_native(), "no longer compile natives");
// Look up matching directives // Look up matching directives
directive = DirectivesStack::getMatchingDirective(method, compiler(task_level)); directive = DirectivesStack::getMatchingDirective(method, comp);
// Save information about this method in case of failure. // Save information about this method in case of failure.
set_last_compile(thread, method, is_osr, task_level); set_last_compile(thread, method, is_osr, task_level);
@ -1812,13 +1816,13 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) {
int compilable = ciEnv::MethodCompilable; int compilable = ciEnv::MethodCompilable;
const char* failure_reason = NULL; const char* failure_reason = NULL;
const char* retry_message = NULL; const char* retry_message = NULL;
AbstractCompiler *comp = compiler(task_level);
int system_dictionary_modification_counter; int system_dictionary_modification_counter;
{ {
MutexLocker locker(Compile_lock, thread); MutexLocker locker(Compile_lock, thread);
system_dictionary_modification_counter = SystemDictionary::number_of_modifications(); system_dictionary_modification_counter = SystemDictionary::number_of_modifications();
} }
#if INCLUDE_JVMCI #if INCLUDE_JVMCI
if (UseJVMCICompiler && comp != NULL && comp->is_jvmci()) { if (UseJVMCICompiler && comp != NULL && comp->is_jvmci()) {
JVMCICompiler* jvmci = (JVMCICompiler*) comp; JVMCICompiler* jvmci = (JVMCICompiler*) comp;

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -122,6 +122,13 @@ void CompileTask::initialize(int compile_id,
_next = NULL; _next = NULL;
} }
/**
* Returns the compiler for this task.
*/
AbstractCompiler* CompileTask::compiler() {
return CompileBroker::compiler(_comp_level);
}
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// CompileTask::code/set_code // CompileTask::code/set_code
// //

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -115,6 +115,8 @@ class CompileTask : public CHeapObj<mtCompiler> {
int comp_level() { return _comp_level;} int comp_level() { return _comp_level;}
void set_comp_level(int comp_level) { _comp_level = comp_level;} void set_comp_level(int comp_level) { _comp_level = comp_level;}
AbstractCompiler* compiler();
int num_inlined_bytecodes() const { return _num_inlined_bytecodes; } int num_inlined_bytecodes() const { return _num_inlined_bytecodes; }
void set_num_inlined_bytecodes(int n) { _num_inlined_bytecodes = n; } void set_num_inlined_bytecodes(int n) { _num_inlined_bytecodes = n; }

View file

@ -233,6 +233,14 @@ void SimpleThresholdPolicy::compile(const methodHandle& mh, int bci, CompLevel l
if (level == CompLevel_none) { if (level == CompLevel_none) {
return; return;
} }
#if INCLUDE_JVMCI
// We can't compile with a JVMCI compiler until the module system is initialized.
if (level == CompLevel_full_optimization && UseJVMCICompiler && !Universe::is_module_initialized()) {
return;
}
#endif
// Check if the method can be compiled. If it cannot be compiled with C1, continue profiling // Check if the method can be compiled. If it cannot be compiled with C1, continue profiling
// in the interpreter and then compile with C2 (the transition function will request that, // in the interpreter and then compile with C2 (the transition function will request that,
// see common() ). If the method cannot be compiled with C2 but still can with C1, compile it with // see common() ). If the method cannot be compiled with C2 but still can with C1, compile it with