# HG changeset patch # User Doug Simon # Date 1454276349 -3600 # Node ID f41d4011035dfc227ae12d3b022311478b264af2 # Parent c3ebefa1c743c943a81c8445f72970a742f22352 reduced delta against jvmci-9 diff -r c3ebefa1c743 -r f41d4011035d src/share/vm/compiler/compileBroker.cpp --- a/src/share/vm/compiler/compileBroker.cpp Fri Jan 29 22:55:42 2016 +0100 +++ b/src/share/vm/compiler/compileBroker.cpp Sun Jan 31 22:39:09 2016 +0100 @@ -51,6 +51,7 @@ #endif #if INCLUDE_JVMCI #include "jvmci/jvmciCompiler.hpp" +#include "jvmci/jvmciJavaClasses.hpp" #ifdef COMPILERJVMCI #include "jvmci/jvmciRuntime.hpp" #include "runtime/vframe.hpp" @@ -930,7 +931,7 @@ // CompileBroker::compilation_init // // Initialize the Compilation object -void CompileBroker::compilation_init() { +void CompileBroker::compilation_init(TRAPS) { _last_method_compiled[0] = '\0'; // No need to initialize compilation system if we do not use it. @@ -959,6 +960,17 @@ } else { c1_count = JVMCIHostThreads; } + if (!UseInterpreter || !BackgroundCompilation) { + // Force initialization of JVMCI compiler otherwise JVMCI + // compilations will not block until JVMCI is initialized + JVMCIRuntime::ensure_jvmci_class_loader_is_initialized(); + ResourceMark rm; + TempNewSymbol getCompiler = SymbolTable::new_symbol("getCompiler", CHECK); + TempNewSymbol sig = SymbolTable::new_symbol("()Ljdk/vm/ci/runtime/JVMCICompiler;", CHECK); + Handle jvmciRuntime = JVMCIRuntime::get_HotSpotJVMCIRuntime(CHECK); + JavaValue result(T_OBJECT); + JavaCalls::call_virtual(&result, jvmciRuntime, HotSpotJVMCIRuntime::klass(), getCompiler, sig, CHECK); + } #endif // COMPILERJVMCI #ifdef COMPILER1 @@ -1733,7 +1745,8 @@ bool CompileBroker::wait_for_jvmci_completion(CompileTask* task, JavaThread* thread) { MutexLocker waiter(task->lock(), thread); int consecutively_blocked = 0; - while (task->lock()->wait(!Mutex::_no_safepoint_check_flag, BLOCKING_JVMCI_COMPILATION_WAIT_TIMESLICE)) { + while (!task->is_complete() && !is_compilation_disabled_forever() && + task->lock()->wait(!Mutex::_no_safepoint_check_flag, BLOCKING_JVMCI_COMPILATION_WAIT_TIMESLICE)) { CompilerThread* jvmci_compiler_thread = task->jvmci_compiler_thread(); if (jvmci_compiler_thread != NULL) { JavaThreadState state; diff -r c3ebefa1c743 -r f41d4011035d src/share/vm/compiler/compileBroker.hpp --- a/src/share/vm/compiler/compileBroker.hpp Fri Jan 29 22:55:42 2016 +0100 +++ b/src/share/vm/compiler/compileBroker.hpp Sun Jan 31 22:39:09 2016 +0100 @@ -415,7 +415,7 @@ CompileQueue *q = compile_queue(comp_level); return q != NULL ? q->size() : 0; } - static void compilation_init(); + static void compilation_init(TRAPS); static void init_compiler_thread_log(); static nmethod* compile_method(methodHandle method, int osr_bci, diff -r c3ebefa1c743 -r f41d4011035d src/share/vm/jvmci/jvmciCompiler.cpp --- a/src/share/vm/jvmci/jvmciCompiler.cpp Fri Jan 29 22:55:42 2016 +0100 +++ b/src/share/vm/jvmci/jvmciCompiler.cpp Sun Jan 31 22:39:09 2016 +0100 @@ -127,7 +127,6 @@ } JVMCIRuntime::ensure_jvmci_class_loader_is_initialized(); - JVMCIJavaClasses::compute_offsets(THREAD); HandleMark hm; Handle receiver = JVMCIRuntime::get_HotSpotJVMCIRuntime(CHECK_ABORT); diff -r c3ebefa1c743 -r f41d4011035d src/share/vm/jvmci/jvmciRuntime.cpp --- a/src/share/vm/jvmci/jvmciRuntime.cpp Fri Jan 29 22:55:42 2016 +0100 +++ b/src/share/vm/jvmci/jvmciRuntime.cpp Sun Jan 31 22:39:09 2016 +0100 @@ -763,8 +763,6 @@ JVMCIRuntime::ensure_jvmci_class_loader_is_initialized(); - JVMCIJavaClasses::compute_offsets(thread); - { ThreadToNativeFromVM trans(thread); @@ -820,6 +818,8 @@ klass->initialize(CHECK_ABORT); _FactoryKlass = klass(); assert(!UseJVMCIClassLoader || SystemDictionary::jvmci_loader() != NULL, "JVMCI classloader should have been initialized"); + + JVMCIJavaClasses::compute_offsets(THREAD); } } @@ -978,10 +978,12 @@ } Klass* JVMCIRuntime::resolve_or_null(Symbol* name, TRAPS) { + assert(!UseJVMCIClassLoader || SystemDictionary::jvmci_loader() != NULL, "JVMCI classloader should have been initialized"); return SystemDictionary::resolve_or_null(name, SystemDictionary::jvmci_loader(), Handle(), CHECK_NULL); } Klass* JVMCIRuntime::resolve_or_fail(Symbol* name, TRAPS) { + assert(!UseJVMCIClassLoader || SystemDictionary::jvmci_loader() != NULL, "JVMCI classloader should have been initialized"); return SystemDictionary::resolve_or_fail(name, SystemDictionary::jvmci_loader(), Handle(), true, CHECK_NULL); } diff -r c3ebefa1c743 -r f41d4011035d src/share/vm/runtime/thread.cpp --- a/src/share/vm/runtime/thread.cpp Fri Jan 29 22:55:42 2016 +0100 +++ b/src/share/vm/runtime/thread.cpp Sun Jan 31 22:39:09 2016 +0100 @@ -3714,7 +3714,10 @@ // initialize compiler(s) #if defined(COMPILER1) || defined(COMPILER2) || defined(SHARK) || defined(COMPILERJVMCI) - CompileBroker::compilation_init(); + CompileBroker::compilation_init(THREAD); + if (HAS_PENDING_EXCEPTION) { + vm_exit_during_initialization(Handle(THREAD, PENDING_EXCEPTION)); + } #endif if (EnableInvokeDynamic) {