Skip to content

Commit bc6a3c7

Browse files
committed
8290739: Simplify storage of dump-time class information
Reviewed-by: ccheung
1 parent 16a1275 commit bc6a3c7

File tree

8 files changed

+119
-148
lines changed

8 files changed

+119
-148
lines changed

src/hotspot/share/cds/dumpTimeClassInfo.cpp

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -169,23 +169,21 @@ bool DumpTimeClassInfo::is_builtin() {
169169
return SystemDictionaryShared::is_builtin(_klass);
170170
}
171171

172-
DumpTimeClassInfo* DumpTimeSharedClassTable::find_or_allocate_info_for(InstanceKlass* k, bool dump_in_progress) {
173-
bool created = false;
174-
DumpTimeClassInfo* p;
175-
if (!dump_in_progress) {
176-
p = put_if_absent(k, &created);
177-
} else {
178-
p = get(k);
179-
}
180-
if (created) {
181-
assert(!SystemDictionaryShared::no_class_loading_should_happen(),
182-
"no new classes can be loaded while dumping archive");
183-
p->_klass = k;
184-
} else {
185-
if (!dump_in_progress) {
186-
assert(p->_klass == k, "Sanity");
187-
}
188-
}
172+
DumpTimeClassInfo* DumpTimeSharedClassTable::allocate_info(InstanceKlass* k) {
173+
assert(!k->is_shared(), "Do not call with shared classes");
174+
bool created;
175+
DumpTimeClassInfo* p = put_if_absent(k, &created);
176+
assert(created, "must not exist in table");
177+
p->_klass = k;
178+
return p;
179+
}
180+
181+
DumpTimeClassInfo* DumpTimeSharedClassTable::get_info(InstanceKlass* k) {
182+
assert(!k->is_shared(), "Do not call with shared classes");
183+
DumpTimeClassInfo* p = get(k);
184+
assert(p != NULL, "we must not see any non-shared InstanceKlass* that's "
185+
"not stored with SystemDictionaryShared::init_dumptime_info");
186+
assert(p->_klass == k, "Sanity");
189187
return p;
190188
}
191189

src/hotspot/share/cds/dumpTimeClassInfo.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,8 @@ class DumpTimeSharedClassTable: public DumpTimeSharedClassTableBaseType
196196
_builtin_count = 0;
197197
_unregistered_count = 0;
198198
}
199-
DumpTimeClassInfo* find_or_allocate_info_for(InstanceKlass* k, bool dump_in_progress);
199+
DumpTimeClassInfo* allocate_info(InstanceKlass* k);
200+
DumpTimeClassInfo* get_info(InstanceKlass* k);
200201
void inc_builtin_count() { _builtin_count++; }
201202
void inc_unregistered_count() { _unregistered_count++; }
202203
void update_counts();

src/hotspot/share/cds/dynamicArchive.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,6 @@ class DynamicArchiveBuilder : public ArchiveBuilder {
106106
}
107107

108108
void doit() {
109-
SystemDictionaryShared::start_dumping();
110-
111109
verify_universe("Before CDS dynamic dump");
112110
DEBUG_ONLY(SystemDictionaryShared::NoClassLoadingMark nclm);
113111

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

118116
if (SystemDictionaryShared::is_dumptime_table_empty()) {
119117
log_warning(cds, dynamic)("There is no class to be included in the dynamic archive.");
120-
SystemDictionaryShared::stop_dumping();
121118
return;
122119
}
123120

@@ -177,7 +174,6 @@ class DynamicArchiveBuilder : public ArchiveBuilder {
177174

178175
assert(_num_dump_regions_used == _total_dump_regions, "must be");
179176
verify_universe("After CDS dynamic dump");
180-
SystemDictionaryShared::stop_dumping();
181177
}
182178

183179
virtual void iterate_roots(MetaspaceClosure* it, bool is_relocating_pointers) {

src/hotspot/share/cds/lambdaFormInvokers.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,9 @@ void LambdaFormInvokers::regenerate_class(char* class_name, ClassFileStream& st,
218218
assert(!HAS_PENDING_EXCEPTION, "Invariant");
219219

220220
result->set_is_generated_shared_class();
221-
SystemDictionaryShared::set_excluded(InstanceKlass::cast(klass)); // exclude the existing class from dump
222-
SystemDictionaryShared::init_dumptime_info(result);
221+
if (!klass->is_shared()) {
222+
SystemDictionaryShared::set_excluded(InstanceKlass::cast(klass)); // exclude the existing class from dump
223+
}
223224
log_info(cds, lambda)("Regenerated class %s, old: " INTPTR_FORMAT " new: " INTPTR_FORMAT,
224225
class_name, p2i(klass), p2i(result));
225226
}

src/hotspot/share/classfile/systemDictionary.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1649,6 +1649,10 @@ void SystemDictionary::initialize(TRAPS) {
16491649
_invoke_method_table = new SymbolPropertyTable(_invoke_method_size);
16501650
_pd_cache_table = new ProtectionDomainCacheTable(defaultProtectionDomainCacheSize);
16511651

1652+
#if INCLUDE_CDS
1653+
SystemDictionaryShared::initialize();
1654+
#endif
1655+
16521656
// Resolve basic classes
16531657
vmClasses::resolve_all(CHECK);
16541658
// Resolve classes used by archived heap objects

0 commit comments

Comments
 (0)