Details
-
Enhancement
-
Resolution: Fixed
-
P4
-
15
-
b09
Description
In SystemDictionary::resolve_super_or_fail()
http://hg.openjdk.java.net/jdk/jdk/file/5ac19bd3a1e2/src/hotspot/share/classfile/systemDictionary.cpp#l338
It seems that we should first check if the super class has already been loaded. That way, we don't need the expensive operation of updating the placeholder for the child class, etc:
E.g.,
ClassLoaderData* loader_data = class_loader_data(class_loader);
Dictionary* dictionary = loader_data->dictionary();
+ {
+ unsigned int sd_hash = dictionary->compute_hash(super_name);
+ InstanceKlass* squick = dictionary->find(sd_hash, super_name, protection_domain);
+ if (squick != NULL) {
+ return squick;
+ }
+ }
unsigned int d_hash = dictionary->compute_hash(child_name);
unsigned int p_hash = placeholders()->compute_hash(child_name);
The placeholder code in this function is for checking ClassCircularityError. However, if the super has already been loaded (i.e., super doesn't have ClassCircularityError), we cannot cause ClassCircularityError by simply adding a sub class the to super.
http://hg.openjdk.java.net/jdk/jdk/file/5ac19bd3a1e2/src/hotspot/share/classfile/systemDictionary.cpp#l338
It seems that we should first check if the super class has already been loaded. That way, we don't need the expensive operation of updating the placeholder for the child class, etc:
E.g.,
ClassLoaderData* loader_data = class_loader_data(class_loader);
Dictionary* dictionary = loader_data->dictionary();
+ {
+ unsigned int sd_hash = dictionary->compute_hash(super_name);
+ InstanceKlass* squick = dictionary->find(sd_hash, super_name, protection_domain);
+ if (squick != NULL) {
+ return squick;
+ }
+ }
unsigned int d_hash = dictionary->compute_hash(child_name);
unsigned int p_hash = placeholders()->compute_hash(child_name);
The placeholder code in this function is for checking ClassCircularityError. However, if the super has already been loaded (i.e., super doesn't have ClassCircularityError), we cannot cause ClassCircularityError by simply adding a sub class the to super.
Attachments
Issue Links
- relates to
-
JDK-8240613 InstanceKlass::set_init_state failed with "assert(good_state || state == allocated): illegal state transition"
- Resolved
-
JDK-8240244 Avoid calling resolve_super_or_fail in SystemDictionary::load_shared_class
- Resolved
-
JDK-8298470 Short cut java.lang.Object super class loading
- Resolved