< prev index next >
src/hotspot/share/classfile/systemDictionary.cpp
Print this page
*** 2026,2035 ****
--- 2026,2052 ----
WKID scan = FIRST_WKID;
// first do Object, then String, Class
#if INCLUDE_CDS
if (UseSharedSpaces) {
resolve_wk_klasses_through(WK_KLASS_ENUM_NAME(Object_klass), scan, CHECK);
+
+ // Fixup the mapped archive heap regions after resolving Object_klass.
+ // Empty spaces in the regions are filled with dummy objects. During
+ // the process it may need to access SystemDictionary::Object_klass(),
+ // so MetaspaceShared::fixup_mapped_heap_regions() must be called after
+ // resolve_wk_klasses_through(WK_KLASS_ENUM_NAME(Object_klass)...), but
+ // before any of the archived java objects is accessed.
+ //
+ // No mirror object is access/restored during
+ // resolve_wk_klasses_through(WK_KLASS_ENUM_NAME(Object_klass)...).
+ // Mirrors are restored after java.lang.Class is loaded.
+ //
+ // Object_klass()->constants()->restore_unshareable_info() restores the
+ // constant pool resolved_references array for Object klass. It must be
+ // done after MetaspaceShared::fixup_mapped_heap_regions().
+ MetaspaceShared::fixup_mapped_heap_regions();
+
// Initialize the constant pool for the Object_class
Object_klass()->constants()->restore_unshareable_info(CHECK);
resolve_wk_klasses_through(WK_KLASS_ENUM_NAME(Class_klass), scan, CHECK);
} else
#endif
< prev index next >