Mercurial > hg > graal-jvmci-8
diff src/share/vm/jvmci/jvmciRuntime.cpp @ 23784:19222d463306
JVMCI re-initialization check is in the wrong location (JDK-8167353)
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Fri, 07 Oct 2016 16:18:19 +0200 |
parents | b1b5c71c04b7 |
children | a81ca24b52bc |
line wrap: on
line diff
--- a/src/share/vm/jvmci/jvmciRuntime.cpp Wed Oct 05 22:07:45 2016 +0200 +++ b/src/share/vm/jvmci/jvmciRuntime.cpp Fri Oct 07 16:18:19 2016 +0200 @@ -638,8 +638,6 @@ JVM_END Handle JVMCIRuntime::callStatic(const char* className, const char* methodName, const char* signature, JavaCallArguments* args, TRAPS) { - guarantee(!_HotSpotJVMCIRuntime_initialized, "cannot reinitialize HotSpotJVMCIRuntime"); - TempNewSymbol name = SymbolTable::new_symbol(className, CHECK_(Handle())); KlassHandle klass = resolve_or_fail(name, CHECK_(Handle())); TempNewSymbol runtime = SymbolTable::new_symbol(methodName, CHECK_(Handle())); @@ -654,43 +652,37 @@ } void JVMCIRuntime::initialize_HotSpotJVMCIRuntime(TRAPS) { - if (JNIHandles::resolve(_HotSpotJVMCIRuntime_instance) == NULL) { - Thread* THREAD = Thread::current(); - ResourceMark rm; -#ifdef ASSERT - // This should only be called in the context of the JVMCI class being initialized - TempNewSymbol name = SymbolTable::new_symbol("jdk/vm/ci/runtime/JVMCI", CHECK); - Klass* k = resolve_or_fail(name, CHECK); - instanceKlassHandle klass = InstanceKlass::cast(k); - assert(klass->is_being_initialized() && klass->is_reentrant_initialization(THREAD), - "HotSpotJVMCIRuntime initialization should only be triggered through JVMCI initialization"); -#endif + guarantee(!_HotSpotJVMCIRuntime_initialized, "cannot reinitialize HotSpotJVMCIRuntime"); + JVMCIRuntime::ensure_jvmci_class_loader_is_initialized(); + // This should only be called in the context of the JVMCI class being initialized + instanceKlassHandle klass = InstanceKlass::cast(SystemDictionary::JVMCI_klass()); + guarantee(klass->is_being_initialized() && klass->is_reentrant_initialization(THREAD), + "HotSpotJVMCIRuntime initialization should only be triggered through JVMCI initialization"); - Handle result = callStatic("jdk/vm/ci/hotspot/HotSpotJVMCIRuntime", - "runtime", - "()Ljdk/vm/ci/hotspot/HotSpotJVMCIRuntime;", NULL, CHECK); - objArrayOop trivial_prefixes = HotSpotJVMCIRuntime::trivialPrefixes(result); - if (trivial_prefixes != NULL) { - char** prefixes = NEW_C_HEAP_ARRAY(char*, trivial_prefixes->length(), mtCompiler); - for (int i = 0; i < trivial_prefixes->length(); i++) { - oop str = trivial_prefixes->obj_at(i); - if (str == NULL) { - THROW(vmSymbols::java_lang_NullPointerException()); - } else { - prefixes[i] = strdup(java_lang_String::as_utf8_string(str)); - } + Handle result = callStatic("jdk/vm/ci/hotspot/HotSpotJVMCIRuntime", + "runtime", + "()Ljdk/vm/ci/hotspot/HotSpotJVMCIRuntime;", NULL, CHECK); + objArrayOop trivial_prefixes = HotSpotJVMCIRuntime::trivialPrefixes(result); + if (trivial_prefixes != NULL) { + char** prefixes = NEW_C_HEAP_ARRAY(char*, trivial_prefixes->length(), mtCompiler); + for (int i = 0; i < trivial_prefixes->length(); i++) { + oop str = trivial_prefixes->obj_at(i); + if (str == NULL) { + THROW(vmSymbols::java_lang_NullPointerException()); + } else { + prefixes[i] = strdup(java_lang_String::as_utf8_string(str)); } - _trivial_prefixes = prefixes; - _trivial_prefixes_count = trivial_prefixes->length(); } - int adjustment = HotSpotJVMCIRuntime::compilationLevelAdjustment(result); - assert(adjustment >= JVMCIRuntime::none && - adjustment <= JVMCIRuntime::by_full_signature, - "compilation level adjustment out of bounds"); - _comp_level_adjustment = (CompLevelAdjustment) adjustment; - _HotSpotJVMCIRuntime_initialized = true; - _HotSpotJVMCIRuntime_instance = JNIHandles::make_global(result()); + _trivial_prefixes = prefixes; + _trivial_prefixes_count = trivial_prefixes->length(); } + int adjustment = HotSpotJVMCIRuntime::compilationLevelAdjustment(result); + assert(adjustment >= JVMCIRuntime::none && + adjustment <= JVMCIRuntime::by_full_signature, + "compilation level adjustment out of bounds"); + _comp_level_adjustment = (CompLevelAdjustment) adjustment; + _HotSpotJVMCIRuntime_initialized = true; + _HotSpotJVMCIRuntime_instance = JNIHandles::make_global(result()); } void JVMCIRuntime::initialize_JVMCI(TRAPS) {