RFR(S) 8240244 Avoid calling resolve_super_or_fail in SystemDictionary::load_shared_class

Ioi Lam ioi.lam at oracle.com
Tue Mar 3 17:09:09 UTC 2020



On 3/3/20 8:49 AM, Lois Foltan wrote:
> On 3/3/2020 1:34 AM, Ioi Lam wrote:
>> https://bugs.openjdk.java.net/browse/JDK-8240244
>> http://cr.openjdk.java.net/~iklam/jdk15/8240244-reduce-resolve-super.v01/ 
>>
>>
>> When loading shared classes from the CDS archive, we need to test if the
>> actually loaded super types are the same as those used during CDS 
>> dumping.
>> That was done with a pretty expensive call to resolve_super_or_fail.
>>
>> In most cases, the super type has already been loaded (about 350 out 
>> of 400
>> cases when running HelloWorld), so we can quickly determine that by
>> doing a look up in the super type's dictionary.
>>
>> This saves about 250,000 out of about 112M instructions (about 0.22%) 
>> when
>> running HelloWorld with the default archive on Linux/x64.
>>
>> I also renamed a few functions in instanceKlass.hpp to 
>> _xxx_shared_xxx since
>> they are used only for CDS.
>>
>> Thanks
>> - Ioi
>>
>>
> Hi Ioi,
>
> Looks good, I like the move to consolidate the calls to resolve_super 
> or fail into SystemDictionary::check_shared_class_super_type().  I 
> have a minor comment about checking the loader against NULL.
>
> classfile/systemDictionary.cpp line #1266 & #1272, please consider 
> using ClassLoaderData::is_the_boot_class_loader_data()
>

Hi Lois,

Thanks for the review.

The intention of the code is to read loader_data->dictionary() only if 
InstanceKlass::class_loader_data() is not NULL.

If a class X has been loaded by the boot class loader, 
X->class_loader_data()  is non-null. It's only X->class_loader() that is 
NULL.

Thanks
- Ioi

> Thanks,
> Lois



More information about the hotspot-runtime-dev mailing list