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

Ioi Lam iklam at openjdk.java.net
Wed Sep 15 05:40:43 UTC 2021


On Wed, 15 Sep 2021 03:58:40 GMT, Calvin Cheung <ccheung at openjdk.org> wrote:

>> Before this change, unregistered classes are loaded by the boot class loader during CDS dump time.
>> This RFE creates an URLClassLoader based on the source specified in the classlist and uses the URLClassLoader to load the unregistered class during CDS dump time. The URLClassLoader instances will be cached in a hash table with the source as the key so that classes associated with the same source will be loaded by the same instance of class loader.
>> 
>> Passed tiers 1 - 4 testing.
>
> 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().

Looks good overall. Just two minor comments.

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");

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?

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

Marked as reviewed by iklam (Reviewer).

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


More information about the hotspot-runtime-dev mailing list