Skip to content
This repository was archived by the owner on Aug 27, 2022. It is now read-only.
/ lanai Public archive

Commit 5bfb814

Browse files
committedFeb 29, 2020
8240258: SystemDictionary::quick_resolve need guarded by INCLUDE_CDS
Supplemental fix for 8236604 to guard SystemDictionary::quick_resolve with CDS Reviewed-by: iklam, ccheung
1 parent f176fae commit 5bfb814

File tree

2 files changed

+34
-32
lines changed

2 files changed

+34
-32
lines changed
 

‎src/hotspot/share/classfile/systemDictionary.cpp

+33-31
Original file line numberDiff line numberDiff line change
@@ -1378,6 +1378,37 @@ void SystemDictionary::load_shared_class_misc(InstanceKlass* ik, ClassLoaderData
13781378
}
13791379
}
13801380
}
1381+
1382+
void SystemDictionary::quick_resolve(InstanceKlass* klass, ClassLoaderData* loader_data, Handle domain, TRAPS) {
1383+
assert(!Universe::is_fully_initialized(), "We can make short cuts only during VM initialization");
1384+
assert(klass->is_shared(), "Must be shared class");
1385+
if (klass->class_loader_data() != NULL) {
1386+
return;
1387+
}
1388+
1389+
// add super and interfaces first
1390+
Klass* super = klass->super();
1391+
if (super != NULL && super->class_loader_data() == NULL) {
1392+
assert(super->is_instance_klass(), "Super should be instance klass");
1393+
quick_resolve(InstanceKlass::cast(super), loader_data, domain, CHECK);
1394+
}
1395+
1396+
Array<InstanceKlass*>* ifs = klass->local_interfaces();
1397+
for (int i = 0; i < ifs->length(); i++) {
1398+
InstanceKlass* ik = ifs->at(i);
1399+
if (ik->class_loader_data() == NULL) {
1400+
quick_resolve(ik, loader_data, domain, CHECK);
1401+
}
1402+
}
1403+
1404+
klass->restore_unshareable_info(loader_data, domain, THREAD);
1405+
load_shared_class_misc(klass, loader_data, CHECK);
1406+
Dictionary* dictionary = loader_data->dictionary();
1407+
unsigned int hash = dictionary->compute_hash(klass->name());
1408+
dictionary->add_klass(hash, klass->name(), klass);
1409+
add_to_hierarchy(klass, CHECK);
1410+
assert(klass->is_loaded(), "Must be in at least loaded state");
1411+
}
13811412
#endif // INCLUDE_CDS
13821413

13831414
InstanceKlass* SystemDictionary::load_instance_class(Symbol* class_name, Handle class_loader, TRAPS) {
@@ -1918,43 +1949,13 @@ bool SystemDictionary::is_well_known_klass(Symbol* class_name) {
19181949
}
19191950
#endif
19201951

1921-
void SystemDictionary::quick_resolve(InstanceKlass* klass, ClassLoaderData* loader_data, Handle domain, TRAPS) {
1922-
assert(!Universe::is_fully_initialized(), "We can make short cuts only during VM initialization");
1923-
assert(klass->is_shared(), "Must be shared class");
1924-
if (klass->class_loader_data() != NULL) {
1925-
return;
1926-
}
1927-
1928-
// add super and interfaces first
1929-
Klass* super = klass->super();
1930-
if (super != NULL && super->class_loader_data() == NULL) {
1931-
assert(super->is_instance_klass(), "Super should be instance klass");
1932-
quick_resolve(InstanceKlass::cast(super), loader_data, domain, CHECK);
1933-
}
1934-
1935-
Array<InstanceKlass*>* ifs = klass->local_interfaces();
1936-
for (int i = 0; i < ifs->length(); i++) {
1937-
InstanceKlass* ik = ifs->at(i);
1938-
if (ik->class_loader_data() == NULL) {
1939-
quick_resolve(ik, loader_data, domain, CHECK);
1940-
}
1941-
}
1942-
1943-
klass->restore_unshareable_info(loader_data, domain, THREAD);
1944-
load_shared_class_misc(klass, loader_data, CHECK);
1945-
Dictionary* dictionary = loader_data->dictionary();
1946-
unsigned int hash = dictionary->compute_hash(klass->name());
1947-
dictionary->add_klass(hash, klass->name(), klass);
1948-
add_to_hierarchy(klass, CHECK);
1949-
assert(klass->is_loaded(), "Must be in at least loaded state");
1950-
}
1951-
19521952
bool SystemDictionary::resolve_wk_klass(WKID id, TRAPS) {
19531953
assert(id >= (int)FIRST_WKID && id < (int)WKID_LIMIT, "oob");
19541954
int sid = wk_init_info[id - FIRST_WKID];
19551955
Symbol* symbol = vmSymbols::symbol_at((vmSymbols::SID)sid);
19561956
InstanceKlass** klassp = &_well_known_klasses[id];
19571957

1958+
#if INCLUDE_CDS
19581959
if (UseSharedSpaces && !JvmtiExport::should_post_class_prepare()) {
19591960
InstanceKlass* k = *klassp;
19601961
assert(k->is_shared_boot_class(), "must be");
@@ -1963,6 +1964,7 @@ bool SystemDictionary::resolve_wk_klass(WKID id, TRAPS) {
19631964
quick_resolve(k, loader_data, Handle(), CHECK_false);
19641965
return true;
19651966
}
1967+
#endif // INCLUDE_CDS
19661968

19671969
if (!is_wk_klass_loaded(*klassp)) {
19681970
Klass* k = resolve_or_fail(symbol, true, CHECK_false);

‎src/hotspot/share/classfile/systemDictionary.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -634,7 +634,7 @@ class SystemDictionary : AllStatic {
634634
// Resolve well-known classes so they can be used like SystemDictionary::String_klass()
635635
static void resolve_well_known_classes(TRAPS);
636636
// quick resolve using CDS for well-known classes only.
637-
static void quick_resolve(InstanceKlass* klass, ClassLoaderData* loader_data, Handle domain, TRAPS);
637+
static void quick_resolve(InstanceKlass* klass, ClassLoaderData* loader_data, Handle domain, TRAPS) NOT_CDS_RETURN;
638638

639639
// Class loader constraints
640640
static void check_constraints(unsigned int hash,

0 commit comments

Comments
 (0)
This repository has been archived.