8268778: CDS check_excluded_classes needs DumpTimeTable_lock

Reviewed-by: ccheung, minqi
This commit is contained in:
Ioi Lam 2021-06-16 16:05:19 +00:00
parent 72b3b0af08
commit e4908a439a
3 changed files with 7 additions and 5 deletions

View file

@ -107,9 +107,11 @@ public:
verify_universe("Before CDS dynamic dump"); verify_universe("Before CDS dynamic dump");
DEBUG_ONLY(SystemDictionaryShared::NoClassLoadingMark nclm); DEBUG_ONLY(SystemDictionaryShared::NoClassLoadingMark nclm);
// Block concurrent class unloading from changing the _dumptime_table
MutexLocker ml(DumpTimeTable_lock, Mutex::_no_safepoint_check_flag);
SystemDictionaryShared::check_excluded_classes(); SystemDictionaryShared::check_excluded_classes();
MutexLocker ml(DumpTimeTable_lock, Mutex::_no_safepoint_check_flag);
init_header(); init_header();
gather_source_objs(); gather_source_objs();
reserve_buffer(); reserve_buffer();

View file

@ -484,12 +484,10 @@ void VM_PopulateDumpSharedSpace::doit() {
NOT_PRODUCT(SystemDictionary::verify();) NOT_PRODUCT(SystemDictionary::verify();)
// At this point, many classes have been loaded. // Block concurrent class unloading from changing the _dumptime_table
// Gather systemDictionary classes in a global array and do everything to MutexLocker ml(DumpTimeTable_lock, Mutex::_no_safepoint_check_flag);
// that so we don't have to walk the SystemDictionary again.
SystemDictionaryShared::check_excluded_classes(); SystemDictionaryShared::check_excluded_classes();
MutexLocker ml(DumpTimeTable_lock, Mutex::_no_safepoint_check_flag);
StaticArchiveBuilder builder; StaticArchiveBuilder builder;
builder.gather_source_objs(); builder.gather_source_objs();
builder.reserve_buffer(); builder.reserve_buffer();

View file

@ -1485,6 +1485,8 @@ public:
}; };
void SystemDictionaryShared::check_excluded_classes() { void SystemDictionaryShared::check_excluded_classes() {
assert(no_class_loading_should_happen(), "sanity");
assert_lock_strong(DumpTimeTable_lock);
ExcludeDumpTimeSharedClasses excl; ExcludeDumpTimeSharedClasses excl;
_dumptime_table->iterate(&excl); _dumptime_table->iterate(&excl);
_dumptime_table->update_counts(); _dumptime_table->update_counts();