< prev index next >

src/hotspot/share/classfile/systemDictionary.cpp

Print this page




2011     resolve_wk_klass((WKID)id, opt, CHECK);
2012   }
2013 
2014   // move the starting value forward to the limit:
2015   start_id = limit_id;
2016 }
2017 
2018 void SystemDictionary::resolve_preloaded_classes(TRAPS) {
2019   assert(WK_KLASS(Object_klass) == NULL, "preloaded classes should only be initialized once");
2020 
2021   // Create the ModuleEntry for java.base.  This call needs to be done here,
2022   // after vmSymbols::initialize() is called but before any classes are pre-loaded.
2023   ClassLoader::classLoader_init2(CHECK);
2024 
2025   // Preload commonly used klasses
2026   WKID scan = FIRST_WKID;
2027   // first do Object, then String, Class
2028 #if INCLUDE_CDS
2029   if (UseSharedSpaces) {
2030     resolve_wk_klasses_through(WK_KLASS_ENUM_NAME(Object_klass), scan, CHECK);

















2031     // Initialize the constant pool for the Object_class
2032     Object_klass()->constants()->restore_unshareable_info(CHECK);
2033     resolve_wk_klasses_through(WK_KLASS_ENUM_NAME(Class_klass), scan, CHECK);
2034   } else
2035 #endif
2036   {
2037     resolve_wk_klasses_through(WK_KLASS_ENUM_NAME(Class_klass), scan, CHECK);
2038   }
2039 
2040   // Calculate offsets for String and Class classes since they are loaded and
2041   // can be used after this point.
2042   java_lang_String::compute_offsets();
2043   java_lang_Class::compute_offsets();
2044 
2045   // Fixup mirrors for classes loaded before java.lang.Class.
2046   // These calls iterate over the objects currently in the perm gen
2047   // so calling them at this point is matters (not before when there
2048   // are fewer objects and not later after there are more objects
2049   // in the perm gen.
2050   Universe::initialize_basic_type_mirrors(CHECK);




2011     resolve_wk_klass((WKID)id, opt, CHECK);
2012   }
2013 
2014   // move the starting value forward to the limit:
2015   start_id = limit_id;
2016 }
2017 
2018 void SystemDictionary::resolve_preloaded_classes(TRAPS) {
2019   assert(WK_KLASS(Object_klass) == NULL, "preloaded classes should only be initialized once");
2020 
2021   // Create the ModuleEntry for java.base.  This call needs to be done here,
2022   // after vmSymbols::initialize() is called but before any classes are pre-loaded.
2023   ClassLoader::classLoader_init2(CHECK);
2024 
2025   // Preload commonly used klasses
2026   WKID scan = FIRST_WKID;
2027   // first do Object, then String, Class
2028 #if INCLUDE_CDS
2029   if (UseSharedSpaces) {
2030     resolve_wk_klasses_through(WK_KLASS_ENUM_NAME(Object_klass), scan, CHECK);
2031 
2032     // It's unsafe to access the archived heap regions before they
2033     // are fixed up, so we must do the fixup as early as possible
2034     // before the archived java objects are accessed by functions
2035     // such as java_lang_Class::restore_archived_mirror and
2036     // ConstantPool::restore_unshareable_info (restores the archived
2037     // resolved_references array object).
2038     //
2039     // MetaspaceShared::fixup_mapped_heap_regions() fills the empty
2040     // spaces in the archived heap regions and may use
2041     // SystemDictionary::Object_klass(), so we can do this only after
2042     // Object_klass is resolved.
2043     // See the above resolve_wk_klasses_through() call. No mirror
2044     // objects are accessed/restored in the above call. Mirrors are
2045     // restored after java.lang.Class is loaded.
2046     MetaspaceShared::fixup_mapped_heap_regions();
2047 
2048     // Initialize the constant pool for the Object_class
2049     Object_klass()->constants()->restore_unshareable_info(CHECK);
2050     resolve_wk_klasses_through(WK_KLASS_ENUM_NAME(Class_klass), scan, CHECK);
2051   } else
2052 #endif
2053   {
2054     resolve_wk_klasses_through(WK_KLASS_ENUM_NAME(Class_klass), scan, CHECK);
2055   }
2056 
2057   // Calculate offsets for String and Class classes since they are loaded and
2058   // can be used after this point.
2059   java_lang_String::compute_offsets();
2060   java_lang_Class::compute_offsets();
2061 
2062   // Fixup mirrors for classes loaded before java.lang.Class.
2063   // These calls iterate over the objects currently in the perm gen
2064   // so calling them at this point is matters (not before when there
2065   // are fewer objects and not later after there are more objects
2066   // in the perm gen.
2067   Universe::initialize_basic_type_mirrors(CHECK);


< prev index next >