@@ -627,12 +627,16 @@ class CollectCLDClosure : public CLDClosure {
627
627
// Check if we can eagerly link this class at dump time, so we can avoid the
628
628
// runtime linking overhead (especially verification)
629
629
bool MetaspaceShared::may_be_eagerly_linked (InstanceKlass* ik) {
630
+ if (CDSConfig::preserve_all_dumptime_verification_states (ik)) {
631
+ assert (ik->can_be_verified_at_dumptime (), " sanity" );
632
+ }
630
633
if (!ik->can_be_verified_at_dumptime ()) {
631
634
// For old classes, try to leave them in the unlinked state, so
632
635
// we can still store them in the archive. They must be
633
636
// linked/verified at runtime.
634
637
return false ;
635
638
}
639
+
636
640
if (CDSConfig::is_dumping_dynamic_archive () && ik->is_shared_unregistered_class ()) {
637
641
// Linking of unregistered classes at this stage may cause more
638
642
// classes to be resolved, resulting in calls to ClassLoader.loadClass()
@@ -875,7 +879,6 @@ void MetaspaceShared::preload_and_dump_impl(StaticArchiveBuilder& builder, TRAPS
875
879
876
880
#if INCLUDE_CDS_JAVA_HEAP
877
881
if (CDSConfig::is_dumping_heap ()) {
878
- StringTable::allocate_shared_strings_array (CHECK);
879
882
if (!HeapShared::is_archived_boot_layer_available (THREAD)) {
880
883
log_info (cds)(" archivedBootLayer not available, disabling full module graph" );
881
884
CDSConfig::disable_dumping_full_module_graph ();
@@ -885,6 +888,10 @@ void MetaspaceShared::preload_and_dump_impl(StaticArchiveBuilder& builder, TRAPS
885
888
if (CDSConfig::is_dumping_full_module_graph ()) {
886
889
HeapShared::reset_archived_object_states (CHECK);
887
890
}
891
+
892
+ // Do this at the very end, when no Java code will be executed. Otherwise
893
+ // some new strings may be added to the intern table.
894
+ StringTable::allocate_shared_strings_array (CHECK);
888
895
}
889
896
#endif
890
897
0 commit comments