8315818: vmTestbase/nsk/jvmti/Allocate/alloc001/alloc001.java fails on libgraal

Reviewed-by: never
This commit is contained in:
Doug Simon 2023-09-08 11:55:54 +00:00
parent 4a6bd81432
commit ebc718f5c0
4 changed files with 18 additions and 22 deletions
src/hotspot/share

@ -1320,6 +1320,13 @@ nmethod* CompileBroker::compile_method(const methodHandle& method, int osr_bci,
AbstractCompiler *comp = CompileBroker::compiler(comp_level);
assert(comp != nullptr, "Ensure we have a compiler");
#if INCLUDE_JVMCI
if (comp->is_jvmci() && !JVMCI::can_initialize_JVMCI()) {
// JVMCI compilation is not yet initializable.
return nullptr;
}
#endif
DirectiveSet* directive = DirectivesStack::getMatchingDirective(method, comp);
// CompileBroker::compile_method can trap and can have pending async exception.
nmethod* nm = CompileBroker::compile_method(method, osr_bci, comp_level, hot_method, hot_count, compile_reason, directive, THREAD);
@ -1348,12 +1355,6 @@ nmethod* CompileBroker::compile_method(const methodHandle& method, int osr_bci,
return nullptr;
}
#if INCLUDE_JVMCI
if (comp->is_jvmci() && !JVMCI::can_initialize_JVMCI()) {
return nullptr;
}
#endif
if (osr_bci == InvocationEntryBci) {
// standard compilation
CompiledMethod* method_code = method->code();

@ -301,7 +301,7 @@ public:
int hot_count,
CompileTask::CompileReason compile_reason,
TRAPS);
private:
static nmethod* compile_method(const methodHandle& method,
int osr_bci,
int comp_level,
@ -311,6 +311,7 @@ public:
DirectiveSet* directive,
TRAPS);
public:
// Acquire any needed locks and assign a compile id
static int assign_compile_id_unlocked(Thread* thread, const methodHandle& method, int osr_bci);

@ -56,6 +56,11 @@ const char* JVMCI::_fatal_log_filename = nullptr;
void jvmci_vmStructs_init() NOT_DEBUG_RETURN;
bool JVMCI::can_initialize_JVMCI() {
if (UseJVMCINativeLibrary) {
// Initializing libjvmci does not execute Java code so
// can be done any time.
return true;
}
// Initializing JVMCI requires the module system to be initialized past phase 3.
// The JVMCI API itself isn't available until phase 2 and ServiceLoader (which
// JVMCI initialization requires) isn't usable until after phase 3. Testing

@ -693,25 +693,15 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
// initialize compiler(s)
#if defined(COMPILER1) || COMPILER2_OR_JVMCI
#if INCLUDE_JVMCI
bool force_JVMCI_intialization = false;
bool force_JVMCI_initialization = false;
if (EnableJVMCI) {
// Initialize JVMCI eagerly when it is explicitly requested.
// Or when JVMCILibDumpJNIConfig or JVMCIPrintProperties is enabled.
force_JVMCI_intialization = EagerJVMCI || JVMCIPrintProperties || JVMCILibDumpJNIConfig;
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);
}
force_JVMCI_initialization = EagerJVMCI || JVMCIPrintProperties || JVMCILibDumpJNIConfig;
}
#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();
}
CompileBroker::compilation_init_phase2();
#endif
// Start string deduplication thread if requested.
@ -754,9 +744,8 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
#endif
#if INCLUDE_JVMCI
if (force_JVMCI_intialization) {
if (force_JVMCI_initialization) {
JVMCI::initialize_compiler(CHECK_JNI_ERR);
CompileBroker::compilation_init_phase2();
}
#endif