RFR: 8261941: Use ClassLoader for unregistered classes during -Xshare:dump [v3]

Calvin Cheung ccheung at openjdk.java.net
Wed Sep 15 18:06:20 UTC 2021


On Wed, 15 Sep 2021 05:35:31 GMT, Ioi Lam <iklam at openjdk.org> wrote:

>> Calvin Cheung has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   1. revert changes to jvm.cpp since SystemDictionaryShared::set_shared_class_misc_info() is being called in ClassLoader::record_result();
>>   2. remove UnregisteredClasses::seen_classloader();
>>   3. remove call to ClassLoaderExt::record_result() in ClassListParser::load_class_from_source() since it is being called in ClassLoader::record_result().
>
> src/hotspot/share/cds/classListParser.cpp line 477:
> 
>> 475:   }
>> 476: 
>> 477:   k->clear_shared_class_loader_type();
> 
> I think this may not be necessary, as the correct loader type should have been set inside  ClassLoaderExt::record_result(). Maybe change this to?
> 
> 
> assert(k->is_shared_unregistered_class(), "must be");

I've changed it to assert. Also removed the `clear_shared_class_loader_type()` since it is not used anymore.
The class loader type is not set not due to the call to `ClassLoaderExt::record_result()` which will default the loader type to boot loader. For unregistered classes, the `ClassLoaderExt::record_result()` won't be called in `ClassLoader::record_result()`.

> src/hotspot/share/classfile/systemDictionaryShared.cpp line 454:
> 
>> 452: bool SystemDictionaryShared::add_unregistered_class_for_static_archive(Thread* current, InstanceKlass* k) {
>> 453:   assert(DumpSharedSpaces, "only when dumping");
>> 454:   return add_unregistered_class(current, k);
> 
> Since this function is now just a pass-through to `add_unregistered_class()`, maybe we should delete this function, and make `add_unregistered_class()` public?

I've made the change. The `add_unregistered_class()` is already declared public.

-------------

PR: https://git.openjdk.java.net/jdk/pull/5458


More information about the hotspot-runtime-dev mailing list