8227647: [Graal] Test8009761.java fails due to "RuntimeException: static java.lang.Object compiler.uncommontrap.Test8009761.m3(boolean,boolean) not compiled"

Wait Graal compilation to finish if request came from testing environment.

Reviewed-by: thartmann, iignatyev
This commit is contained in:
Vladimir Kozlov 2020-06-04 10:59:06 -07:00
parent a351ebd40b
commit dd016c34dd
2 changed files with 16 additions and 1 deletions

View File

@ -1655,7 +1655,8 @@ void CompileBroker::wait_for_completion(CompileTask* task) {
bool free_task;
#if INCLUDE_JVMCI
AbstractCompiler* comp = compiler(task->comp_level());
if (comp->is_jvmci()) {
if (comp->is_jvmci() && !task->should_wait_for_compilation()) {
// It may return before compilation is completed.
free_task = wait_for_jvmci_completion((JVMCICompiler*) comp, task, thread);
} else
#endif

View File

@ -134,6 +134,20 @@ class CompileTask : public CHeapObj<mtCompiler> {
}
}
#if INCLUDE_JVMCI
bool should_wait_for_compilation() const {
// Wait for blocking compilation to finish.
switch (_compile_reason) {
case Reason_CTW:
case Reason_Replay:
case Reason_Whitebox:
case Reason_MustBeCompiled:
case Reason_Bootstrap:
return _is_blocking;
default:
return false;
}
}
bool has_waiter() const { return _has_waiter; }
void clear_waiter() { _has_waiter = false; }
CompilerThread* jvmci_compiler_thread() const { return _jvmci_compiler_thread; }