Skip to content

Commit

Permalink
8290739: Simplify storage of dump-time class information
Browse files Browse the repository at this point in the history
Reviewed-by: ccheung
  • Loading branch information
iklam committed Jul 27, 2022
1 parent 16a1275 commit bc6a3c7
Show file tree
Hide file tree
Showing 8 changed files with 119 additions and 148 deletions.
32 changes: 15 additions & 17 deletions src/hotspot/share/cds/dumpTimeClassInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,23 +169,21 @@ bool DumpTimeClassInfo::is_builtin() {
return SystemDictionaryShared::is_builtin(_klass);
}

DumpTimeClassInfo* DumpTimeSharedClassTable::find_or_allocate_info_for(InstanceKlass* k, bool dump_in_progress) {
bool created = false;
DumpTimeClassInfo* p;
if (!dump_in_progress) {
p = put_if_absent(k, &created);
} else {
p = get(k);
}
if (created) {
assert(!SystemDictionaryShared::no_class_loading_should_happen(),
"no new classes can be loaded while dumping archive");
p->_klass = k;
} else {
if (!dump_in_progress) {
assert(p->_klass == k, "Sanity");
}
}
DumpTimeClassInfo* DumpTimeSharedClassTable::allocate_info(InstanceKlass* k) {
assert(!k->is_shared(), "Do not call with shared classes");
bool created;
DumpTimeClassInfo* p = put_if_absent(k, &created);
assert(created, "must not exist in table");
p->_klass = k;
return p;
}

DumpTimeClassInfo* DumpTimeSharedClassTable::get_info(InstanceKlass* k) {
assert(!k->is_shared(), "Do not call with shared classes");
DumpTimeClassInfo* p = get(k);
assert(p != NULL, "we must not see any non-shared InstanceKlass* that's "
"not stored with SystemDictionaryShared::init_dumptime_info");
assert(p->_klass == k, "Sanity");
return p;
}

Expand Down
3 changes: 2 additions & 1 deletion src/hotspot/share/cds/dumpTimeClassInfo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@ class DumpTimeSharedClassTable: public DumpTimeSharedClassTableBaseType
_builtin_count = 0;
_unregistered_count = 0;
}
DumpTimeClassInfo* find_or_allocate_info_for(InstanceKlass* k, bool dump_in_progress);
DumpTimeClassInfo* allocate_info(InstanceKlass* k);
DumpTimeClassInfo* get_info(InstanceKlass* k);
void inc_builtin_count() { _builtin_count++; }
void inc_unregistered_count() { _unregistered_count++; }
void update_counts();
Expand Down
4 changes: 0 additions & 4 deletions src/hotspot/share/cds/dynamicArchive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@ class DynamicArchiveBuilder : public ArchiveBuilder {
}

void doit() {
SystemDictionaryShared::start_dumping();

verify_universe("Before CDS dynamic dump");
DEBUG_ONLY(SystemDictionaryShared::NoClassLoadingMark nclm);

Expand All @@ -117,7 +115,6 @@ class DynamicArchiveBuilder : public ArchiveBuilder {

if (SystemDictionaryShared::is_dumptime_table_empty()) {
log_warning(cds, dynamic)("There is no class to be included in the dynamic archive.");
SystemDictionaryShared::stop_dumping();
return;
}

Expand Down Expand Up @@ -177,7 +174,6 @@ class DynamicArchiveBuilder : public ArchiveBuilder {

assert(_num_dump_regions_used == _total_dump_regions, "must be");
verify_universe("After CDS dynamic dump");
SystemDictionaryShared::stop_dumping();
}

virtual void iterate_roots(MetaspaceClosure* it, bool is_relocating_pointers) {
Expand Down
5 changes: 3 additions & 2 deletions src/hotspot/share/cds/lambdaFormInvokers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,9 @@ void LambdaFormInvokers::regenerate_class(char* class_name, ClassFileStream& st,
assert(!HAS_PENDING_EXCEPTION, "Invariant");

result->set_is_generated_shared_class();
SystemDictionaryShared::set_excluded(InstanceKlass::cast(klass)); // exclude the existing class from dump
SystemDictionaryShared::init_dumptime_info(result);
if (!klass->is_shared()) {
SystemDictionaryShared::set_excluded(InstanceKlass::cast(klass)); // exclude the existing class from dump
}
log_info(cds, lambda)("Regenerated class %s, old: " INTPTR_FORMAT " new: " INTPTR_FORMAT,
class_name, p2i(klass), p2i(result));
}
Expand Down
4 changes: 4 additions & 0 deletions src/hotspot/share/classfile/systemDictionary.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1649,6 +1649,10 @@ void SystemDictionary::initialize(TRAPS) {
_invoke_method_table = new SymbolPropertyTable(_invoke_method_size);
_pd_cache_table = new ProtectionDomainCacheTable(defaultProtectionDomainCacheSize);

#if INCLUDE_CDS
SystemDictionaryShared::initialize();
#endif

// Resolve basic classes
vmClasses::resolve_all(CHECK);
// Resolve classes used by archived heap objects
Expand Down
Loading

1 comment on commit bc6a3c7

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.