35 #include "classfile/javaClasses.inline.hpp"
36 #include "classfile/klassFactory.hpp"
37 #include "classfile/loaderConstraints.hpp"
38 #include "classfile/packageEntry.hpp"
39 #include "classfile/placeholders.hpp"
40 #include "classfile/protectionDomainCache.hpp"
41 #include "classfile/resolutionErrors.hpp"
42 #include "classfile/stringTable.hpp"
43 #include "classfile/systemDictionary.hpp"
44 #include "classfile/vmSymbols.hpp"
45 #include "code/codeCache.hpp"
46 #include "compiler/compileBroker.hpp"
47 #include "gc/shared/gcTraceTime.inline.hpp"
48 #include "gc/shared/oopStorage.inline.hpp"
49 #include "interpreter/bytecodeStream.hpp"
50 #include "interpreter/interpreter.hpp"
51 #include "jfr/jfrEvents.hpp"
52 #include "logging/log.hpp"
53 #include "logging/logStream.hpp"
54 #include "memory/filemap.hpp"
55 #include "memory/metaspaceClosure.hpp"
56 #include "memory/oopFactory.hpp"
57 #include "memory/resourceArea.hpp"
58 #include "oops/access.inline.hpp"
59 #include "oops/instanceKlass.hpp"
60 #include "oops/instanceRefKlass.hpp"
61 #include "oops/klass.inline.hpp"
62 #include "oops/method.inline.hpp"
63 #include "oops/methodData.hpp"
64 #include "oops/objArrayKlass.hpp"
65 #include "oops/objArrayOop.inline.hpp"
66 #include "oops/oop.inline.hpp"
67 #include "oops/symbol.hpp"
68 #include "oops/typeArrayKlass.hpp"
69 #include "prims/jvmtiEnvBase.hpp"
70 #include "prims/resolvedMethodTable.hpp"
71 #include "prims/methodHandles.hpp"
72 #include "runtime/arguments.hpp"
73 #include "runtime/arguments_ext.hpp"
74 #include "runtime/biasedLocking.hpp"
2020 assert(WK_KLASS(Object_klass) == NULL, "preloaded classes should only be initialized once");
2021
2022 // Create the ModuleEntry for java.base. This call needs to be done here,
2023 // after vmSymbols::initialize() is called but before any classes are pre-loaded.
2024 ClassLoader::classLoader_init2(CHECK);
2025
2026 // Preload commonly used klasses
2027 WKID scan = FIRST_WKID;
2028 // first do Object, then String, Class
2029 #if INCLUDE_CDS
2030 if (UseSharedSpaces) {
2031 resolve_wk_klasses_through(WK_KLASS_ENUM_NAME(Object_klass), scan, CHECK);
2032
2033 // It's unsafe to access the archived heap regions before they
2034 // are fixed up, so we must do the fixup as early as possible
2035 // before the archived java objects are accessed by functions
2036 // such as java_lang_Class::restore_archived_mirror and
2037 // ConstantPool::restore_unshareable_info (restores the archived
2038 // resolved_references array object).
2039 //
2040 // MetaspaceShared::fixup_mapped_heap_regions() fills the empty
2041 // spaces in the archived heap regions and may use
2042 // SystemDictionary::Object_klass(), so we can do this only after
2043 // Object_klass is resolved. See the above resolve_wk_klasses_through()
2044 // call. No mirror objects are accessed/restored in the above call.
2045 // Mirrors are 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.
|
35 #include "classfile/javaClasses.inline.hpp"
36 #include "classfile/klassFactory.hpp"
37 #include "classfile/loaderConstraints.hpp"
38 #include "classfile/packageEntry.hpp"
39 #include "classfile/placeholders.hpp"
40 #include "classfile/protectionDomainCache.hpp"
41 #include "classfile/resolutionErrors.hpp"
42 #include "classfile/stringTable.hpp"
43 #include "classfile/systemDictionary.hpp"
44 #include "classfile/vmSymbols.hpp"
45 #include "code/codeCache.hpp"
46 #include "compiler/compileBroker.hpp"
47 #include "gc/shared/gcTraceTime.inline.hpp"
48 #include "gc/shared/oopStorage.inline.hpp"
49 #include "interpreter/bytecodeStream.hpp"
50 #include "interpreter/interpreter.hpp"
51 #include "jfr/jfrEvents.hpp"
52 #include "logging/log.hpp"
53 #include "logging/logStream.hpp"
54 #include "memory/filemap.hpp"
55 #include "memory/heapShared.hpp"
56 #include "memory/metaspaceClosure.hpp"
57 #include "memory/oopFactory.hpp"
58 #include "memory/resourceArea.hpp"
59 #include "oops/access.inline.hpp"
60 #include "oops/instanceKlass.hpp"
61 #include "oops/instanceRefKlass.hpp"
62 #include "oops/klass.inline.hpp"
63 #include "oops/method.inline.hpp"
64 #include "oops/methodData.hpp"
65 #include "oops/objArrayKlass.hpp"
66 #include "oops/objArrayOop.inline.hpp"
67 #include "oops/oop.inline.hpp"
68 #include "oops/symbol.hpp"
69 #include "oops/typeArrayKlass.hpp"
70 #include "prims/jvmtiEnvBase.hpp"
71 #include "prims/resolvedMethodTable.hpp"
72 #include "prims/methodHandles.hpp"
73 #include "runtime/arguments.hpp"
74 #include "runtime/arguments_ext.hpp"
75 #include "runtime/biasedLocking.hpp"
2021 assert(WK_KLASS(Object_klass) == NULL, "preloaded classes should only be initialized once");
2022
2023 // Create the ModuleEntry for java.base. This call needs to be done here,
2024 // after vmSymbols::initialize() is called but before any classes are pre-loaded.
2025 ClassLoader::classLoader_init2(CHECK);
2026
2027 // Preload commonly used klasses
2028 WKID scan = FIRST_WKID;
2029 // first do Object, then String, Class
2030 #if INCLUDE_CDS
2031 if (UseSharedSpaces) {
2032 resolve_wk_klasses_through(WK_KLASS_ENUM_NAME(Object_klass), scan, CHECK);
2033
2034 // It's unsafe to access the archived heap regions before they
2035 // are fixed up, so we must do the fixup as early as possible
2036 // before the archived java objects are accessed by functions
2037 // such as java_lang_Class::restore_archived_mirror and
2038 // ConstantPool::restore_unshareable_info (restores the archived
2039 // resolved_references array object).
2040 //
2041 // HeapShared::fixup_mapped_heap_regions() fills the empty
2042 // spaces in the archived heap regions and may use
2043 // SystemDictionary::Object_klass(), so we can do this only after
2044 // Object_klass is resolved. See the above resolve_wk_klasses_through()
2045 // call. No mirror objects are accessed/restored in the above call.
2046 // Mirrors are restored after java.lang.Class is loaded.
2047 HeapShared::fixup_mapped_heap_regions();
2048
2049 // Initialize the constant pool for the Object_class
2050 Object_klass()->constants()->restore_unshareable_info(CHECK);
2051 resolve_wk_klasses_through(WK_KLASS_ENUM_NAME(Class_klass), scan, CHECK);
2052 } else
2053 #endif
2054 {
2055 resolve_wk_klasses_through(WK_KLASS_ENUM_NAME(Class_klass), scan, CHECK);
2056 }
2057
2058 // Calculate offsets for String and Class classes since they are loaded and
2059 // can be used after this point.
2060 java_lang_String::compute_offsets();
2061 java_lang_Class::compute_offsets();
2062
2063 // Fixup mirrors for classes loaded before java.lang.Class.
2064 // These calls iterate over the objects currently in the perm gen
2065 // so calling them at this point is matters (not before when there
2066 // are fewer objects and not later after there are more objects
2067 // in the perm gen.
|