13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "jvm.h"
27 #include "aot/aotLoader.hpp"
28 #include "classfile/classFileParser.hpp"
29 #include "classfile/classFileStream.hpp"
30 #include "classfile/classLoader.hpp"
31 #include "classfile/classLoaderData.inline.hpp"
32 #include "classfile/classLoaderDataGraph.inline.hpp"
33 #include "classfile/classLoaderDataShared.hpp"
34 #include "classfile/classLoaderExt.hpp"
35 #include "classfile/dictionary.hpp"
36 #include "classfile/javaClasses.inline.hpp"
37 #include "classfile/klassFactory.hpp"
38 #include "classfile/loaderConstraints.hpp"
39 #include "classfile/packageEntry.hpp"
40 #include "classfile/placeholders.hpp"
41 #include "classfile/protectionDomainCache.hpp"
42 #include "classfile/resolutionErrors.hpp"
43 #include "classfile/stringTable.hpp"
44 #include "classfile/symbolTable.hpp"
45 #include "classfile/systemDictionary.hpp"
46 #include "classfile/vmSymbols.hpp"
47 #include "code/codeCache.hpp"
48 #include "compiler/compileBroker.hpp"
49 #include "gc/shared/gcTraceTime.inline.hpp"
50 #include "interpreter/bytecodeStream.hpp"
51 #include "interpreter/interpreter.hpp"
52 #include "jfr/jfrEvents.hpp"
53 #include "logging/log.hpp"
2096 WKID scan = FIRST_WKID;
2097 // first do Object, then String, Class
2098 #if INCLUDE_CDS
2099 if (UseSharedSpaces) {
2100 resolve_wk_klasses_through(WK_KLASS_ENUM_NAME(Object_klass), scan, CHECK);
2101
2102 // It's unsafe to access the archived heap regions before they
2103 // are fixed up, so we must do the fixup as early as possible
2104 // before the archived java objects are accessed by functions
2105 // such as java_lang_Class::restore_archived_mirror and
2106 // ConstantPool::restore_unshareable_info (restores the archived
2107 // resolved_references array object).
2108 //
2109 // HeapShared::fixup_mapped_heap_regions() fills the empty
2110 // spaces in the archived heap regions and may use
2111 // SystemDictionary::Object_klass(), so we can do this only after
2112 // Object_klass is resolved. See the above resolve_wk_klasses_through()
2113 // call. No mirror objects are accessed/restored in the above call.
2114 // Mirrors are restored after java.lang.Class is loaded.
2115 HeapShared::fixup_mapped_heap_regions();
2116 CDS_JAVA_HEAP_ONLY(ClassLoaderDataShared::restore_archived_oops_for_null_class_loader_data());
2117
2118 // Initialize the constant pool for the Object_class
2119 assert(Object_klass()->is_shared(), "must be");
2120 Object_klass()->constants()->restore_unshareable_info(CHECK);
2121 resolve_wk_klasses_through(WK_KLASS_ENUM_NAME(Class_klass), scan, CHECK);
2122 } else
2123 #endif
2124 {
2125 resolve_wk_klasses_through(WK_KLASS_ENUM_NAME(Class_klass), scan, CHECK);
2126 }
2127
2128 assert(WK_KLASS(Object_klass) != NULL, "well-known classes should now be initialized");
2129
2130 java_lang_Object::register_natives(CHECK);
2131
2132 // Calculate offsets for String and Class classes since they are loaded and
2133 // can be used after this point.
2134 java_lang_String::compute_offsets();
2135 java_lang_Class::compute_offsets();
2136
|
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26 #include "jvm.h"
27 #include "aot/aotLoader.hpp"
28 #include "classfile/classFileParser.hpp"
29 #include "classfile/classFileStream.hpp"
30 #include "classfile/classLoader.hpp"
31 #include "classfile/classLoaderData.inline.hpp"
32 #include "classfile/classLoaderDataGraph.inline.hpp"
33 #include "classfile/classLoaderExt.hpp"
34 #include "classfile/dictionary.hpp"
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/symbolTable.hpp"
44 #include "classfile/systemDictionary.hpp"
45 #include "classfile/vmSymbols.hpp"
46 #include "code/codeCache.hpp"
47 #include "compiler/compileBroker.hpp"
48 #include "gc/shared/gcTraceTime.inline.hpp"
49 #include "interpreter/bytecodeStream.hpp"
50 #include "interpreter/interpreter.hpp"
51 #include "jfr/jfrEvents.hpp"
52 #include "logging/log.hpp"
2095 WKID scan = FIRST_WKID;
2096 // first do Object, then String, Class
2097 #if INCLUDE_CDS
2098 if (UseSharedSpaces) {
2099 resolve_wk_klasses_through(WK_KLASS_ENUM_NAME(Object_klass), scan, CHECK);
2100
2101 // It's unsafe to access the archived heap regions before they
2102 // are fixed up, so we must do the fixup as early as possible
2103 // before the archived java objects are accessed by functions
2104 // such as java_lang_Class::restore_archived_mirror and
2105 // ConstantPool::restore_unshareable_info (restores the archived
2106 // resolved_references array object).
2107 //
2108 // HeapShared::fixup_mapped_heap_regions() fills the empty
2109 // spaces in the archived heap regions and may use
2110 // SystemDictionary::Object_klass(), so we can do this only after
2111 // Object_klass is resolved. See the above resolve_wk_klasses_through()
2112 // call. No mirror objects are accessed/restored in the above call.
2113 // Mirrors are restored after java.lang.Class is loaded.
2114 HeapShared::fixup_mapped_heap_regions();
2115
2116 // Initialize the constant pool for the Object_class
2117 assert(Object_klass()->is_shared(), "must be");
2118 Object_klass()->constants()->restore_unshareable_info(CHECK);
2119 resolve_wk_klasses_through(WK_KLASS_ENUM_NAME(Class_klass), scan, CHECK);
2120 } else
2121 #endif
2122 {
2123 resolve_wk_klasses_through(WK_KLASS_ENUM_NAME(Class_klass), scan, CHECK);
2124 }
2125
2126 assert(WK_KLASS(Object_klass) != NULL, "well-known classes should now be initialized");
2127
2128 java_lang_Object::register_natives(CHECK);
2129
2130 // Calculate offsets for String and Class classes since they are loaded and
2131 // can be used after this point.
2132 java_lang_String::compute_offsets();
2133 java_lang_Class::compute_offsets();
2134
|