8213439: Run class initialization for boot loader classes with registered subgraph archiving entry field during CDS dump time.
Summary: Run class initialization for boot classes with registered subgraph archiving entry fieldi(s) at CDS dump time.
Reviewed-by: dholmes, iklam
--- a/src/hotspot/share/memory/heapShared.cpp Thu Nov 08 15:19:14 2018 -0800
+++ b/src/hotspot/share/memory/heapShared.cpp Thu Nov 08 19:16:16 2018 -0500
@@ -886,6 +886,10 @@
Klass* k = SystemDictionary::resolve_or_null(klass_name, THREAD);
assert(k != NULL && !HAS_PENDING_EXCEPTION, "class must exist");
InstanceKlass* ik = InstanceKlass::cast(k);
+ assert(InstanceKlass::cast(ik)->is_shared_boot_class(),
+ "Only support boot classes");
+ ik->initialize(THREAD);
+ guarantee(!HAS_PENDING_EXCEPTION, "exception in initialize");
ArchivableStaticFieldFinder finder(ik, field_name);
ik->do_local_static_fields(&finder);
--- a/src/hotspot/share/memory/metaspaceShared.cpp Thu Nov 08 15:19:14 2018 -0800
+++ b/src/hotspot/share/memory/metaspaceShared.cpp Thu Nov 08 19:16:16 2018 -0500
@@ -1703,6 +1703,8 @@
log_info(cds)("Shared spaces: preloaded %d classes", class_count);
+ HeapShared::init_subgraph_entry_fields(THREAD);
+
// Rewrite and link classes
tty->print_cr("Rewriting and linking classes ...");
@@ -1714,7 +1716,6 @@
tty->print_cr("Rewriting and linking classes: done");
SystemDictionary::clear_invoke_method_table();
- HeapShared::init_subgraph_entry_fields(THREAD);
VM_PopulateDumpSharedSpace op;
VMThread::execute(&op);