comparison src/share/vm/jvmci/jvmciRuntime.cpp @ 22543:97ca867d3622

Fix assertion failure in JVMCIRuntime::metadata_do
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Wed, 09 Sep 2015 11:17:58 -0700
parents ea6d1727fdc6
children b87d1bf3cd9a
comparison
equal deleted inserted replaced
22542:15579668ec3a 22543:97ca867d3622
722 } 722 }
723 assert(_HotSpotJVMCIRuntime_initialized == true, "what?"); 723 assert(_HotSpotJVMCIRuntime_initialized == true, "what?");
724 } 724 }
725 725
726 void JVMCIRuntime::metadata_do(void f(Metadata*)) { 726 void JVMCIRuntime::metadata_do(void f(Metadata*)) {
727 if (!is_HotSpotJVMCIRuntime_initialized()) { 727 // For simplicity, the existence of HotSpotJVMCIMetaAccessContext in
728 assert(HotSpotJVMCIMetaAccessContext::klass() == NULL || 728 // the SystemDictionary well known classes should ensure the other
729 !HotSpotJVMCIMetaAccessContext::klass()->is_linked() || 729 // classes have already been loaded, so make sure their order in the
730 HotSpotJVMCIMetaAccessContext::allContexts() == NULL, "shouldn't be anything registered yet"); 730 // table enforces that.
731 assert(SystemDictionary::WK_KLASS_ENUM_NAME(jdk_internal_jvmci_hotspot_HotSpotResolvedJavaMethodImpl) <
732 SystemDictionary::WK_KLASS_ENUM_NAME(jdk_internal_jvmci_hotspot_HotSpotJVMCIMetaAccessContext), "must be loaded earlier");
733 assert(SystemDictionary::WK_KLASS_ENUM_NAME(jdk_internal_jvmci_hotspot_HotSpotConstantPool) <
734 SystemDictionary::WK_KLASS_ENUM_NAME(jdk_internal_jvmci_hotspot_HotSpotJVMCIMetaAccessContext), "must be loaded earlier");
735 assert(SystemDictionary::WK_KLASS_ENUM_NAME(jdk_internal_jvmci_hotspot_HotSpotResolvedObjectTypeImpl) <
736 SystemDictionary::WK_KLASS_ENUM_NAME(jdk_internal_jvmci_hotspot_HotSpotJVMCIMetaAccessContext), "must be loaded earlier");
737
738 if (HotSpotJVMCIMetaAccessContext::klass() == NULL ||
739 !HotSpotJVMCIMetaAccessContext::klass()->is_linked()) {
740 // Nothing could be registered yet
731 return; 741 return;
732 } 742 }
733 743
734 // WeakReference<HotSpotJVMCIMetaAccessContext>[] 744 // WeakReference<HotSpotJVMCIMetaAccessContext>[]
735 objArrayOop allContexts = HotSpotJVMCIMetaAccessContext::allContexts(); 745 objArrayOop allContexts = HotSpotJVMCIMetaAccessContext::allContexts();
736 if (allContexts == NULL) { 746 if (allContexts == NULL) {
737 return; 747 return;
738 } 748 }
749
750 // These must be loaded at this point but the linking state doesn't matter.
751 assert(SystemDictionary::HotSpotResolvedJavaMethodImpl_klass() != NULL, "must be loaded");
752 assert(SystemDictionary::HotSpotConstantPool_klass() != NULL, "must be loaded");
753 assert(SystemDictionary::HotSpotResolvedObjectTypeImpl_klass() != NULL, "must be loaded");
754
739 for (int i = 0; i < allContexts->length(); i++) { 755 for (int i = 0; i < allContexts->length(); i++) {
740 oop ref = allContexts->obj_at(i); 756 oop ref = allContexts->obj_at(i);
741 if (ref != NULL) { 757 if (ref != NULL) {
742 oop referent = java_lang_ref_Reference::referent(ref); 758 oop referent = java_lang_ref_Reference::referent(ref);
743 if (referent != NULL) { 759 if (referent != NULL) {