8160121: [JVMCI] JvmciNotifyBootstrapFinishedEventTest.java failed NoClassDefFoundError: jdk/vm/ci/runtime/JVMCI

Reviewed-by: kvn
This commit is contained in:
Tom Rodriguez 2016-06-28 17:22:56 +00:00
parent 490625cd8b
commit b4aef2060b
8 changed files with 35 additions and 14 deletions

View File

@ -551,17 +551,6 @@ void CompileBroker::compilation_init(TRAPS) {
} else {
c1_count = JVMCIHostThreads;
}
if (!UseInterpreter || !BackgroundCompilation) {
// Force initialization of JVMCI compiler otherwise JVMCI
// compilations will not block until JVMCI 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 // INCLUDE_JVMCI

View File

@ -612,6 +612,17 @@ JRT_ENTRY(jint, JVMCIRuntime::test_deoptimize_call_int(JavaThread* thread, int v
return value;
JRT_END
void JVMCIRuntime::force_initialization(TRAPS) {
JVMCIRuntime::initialize_well_known_classes(CHECK);
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);
}
// private static JVMCIRuntime JVMCI.initializeRuntime()
JVM_ENTRY(jobject, JVM_GetJVMCIRuntime(JNIEnv *env, jclass c))
if (!EnableJVMCI) {

View File

@ -157,6 +157,9 @@ class JVMCIRuntime: public AllStatic {
static void throw_klass_external_name_exception(JavaThread* thread, const char* exception, Klass* klass);
static void throw_class_cast_exception(JavaThread* thread, const char* exception, Klass* caster_klass, Klass* target_klass);
// Forces initialization of the JVMCI runtime.
static void force_initialization(TRAPS);
// Test only function
static int test_deoptimize_call_int(JavaThread* thread, int value);
};

View File

@ -238,9 +238,14 @@ void SimpleThresholdPolicy::compile(const methodHandle& mh, int bci, CompLevel l
}
#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;
// We can't compile with a JVMCI compiler until the module system is initialized past
// phase 3. The JVMCI API itself isn't available until phase 2 and ServiceLoader isn't
// usable until after phase 3.
if (level == CompLevel_full_optimization && EnableJVMCI && UseJVMCICompiler) {
if (SystemDictionary::java_system_loader() == NULL) {
return;
}
assert(Universe::is_module_initialized(), "must be");
}
#endif

View File

@ -3770,6 +3770,13 @@ jint Threads::create_vm(JavaVMInitArgs* args, bool* canTryAgain) {
// Final system initialization including security manager and system class loader
call_initPhase3(CHECK_JNI_ERR);
#if INCLUDE_JVMCI
if (EnableJVMCI && UseJVMCICompiler && (!UseInterpreter || !BackgroundCompilation)) {
// 8145270: Force initialization of JVMCI runtime otherwise requests for blocking
// compilations via JVMCI will not actually block until JVMCI is initialized.
JVMCIRuntime::force_initialization(CHECK_JNI_ERR);
}
#endif
// cache the system class loader
SystemDictionary::compute_java_system_loader(CHECK_(JNI_ERR));

View File

@ -43,6 +43,8 @@
* @run main ClassFileInstaller
* compiler.jvmci.common.JVMCIHelpers$EmptyHotspotCompiler
* compiler.jvmci.common.JVMCIHelpers$EmptyCompilerFactory
* compiler.jvmci.common.JVMCIHelpers$EmptyCompilationRequestResult
* compiler.jvmci.common.JVMCIHelpers$EmptyVMEventListener
* compiler.jvmci.events.JvmciNotifyBootstrapFinishedEventTest
* jdk.test.lib.Asserts
* jdk.test.lib.Utils

View File

@ -44,6 +44,8 @@
* @run main ClassFileInstaller
* compiler.jvmci.common.JVMCIHelpers$EmptyHotspotCompiler
* compiler.jvmci.common.JVMCIHelpers$EmptyCompilerFactory
* compiler.jvmci.common.JVMCIHelpers$EmptyCompilationRequestResult
* compiler.jvmci.common.JVMCIHelpers$EmptyVMEventListener
* compiler.jvmci.events.JvmciNotifyInstallEventTest
* compiler.jvmci.common.CTVMUtilities
* compiler.jvmci.common.testcases.SimpleClass

View File

@ -40,6 +40,8 @@
* @run main ClassFileInstaller
* compiler.jvmci.common.JVMCIHelpers$EmptyHotspotCompiler
* compiler.jvmci.common.JVMCIHelpers$EmptyCompilerFactory
* compiler.jvmci.common.JVMCIHelpers$EmptyCompilationRequestResult
* compiler.jvmci.common.JVMCIHelpers$EmptyVMEventListener
* compiler.jvmci.events.JvmciShutdownEventListener
* @run main/othervm compiler.jvmci.events.JvmciShutdownEventTest
*/