RFR(XS): 8242134: Consolidate the get_package_entry() in SystemDictionaryShared and ClassLoader

Claes Redestad claes.redestad at oracle.com
Tue Apr 7 20:21:14 UTC 2020


Hi,

one suggestion is that I think we should try to keep the invariant
that loader_data can't be NULL in ClassLoader::get_package_entry and
avoid adding a NULL check there.

The only call site that needs to be fixed appears to be the one in
systemDictionaryShared. Maybe something like this:

        ClassLoaderData* platform_loader = 
ClassLoaderData::class_loader_data_or_null(SystemDictionary::java_platform_loader()); 
// can be NULL during bootstrap
        if ((platform_loader == NULL ||
             ClassLoader::get_package_entry(pkg_name, platform_loader) 
== NULL) &&
             ClassLoader::get_package_entry(pkg_name, 
ClassLoaderData::the_null_class_loader_data()) == NULL) {

What do you think?

/Claes

On 2020-04-07 19:39, Calvin Cheung wrote:
> JBS: https://bugs.openjdk.java.net/browse/JDK-8242134
> webrev: http://cr.openjdk.java.net/~ccheung/jdk15/8242134/webrev.00/
> 
> The above proposed change removes get_package_entry() from 
> SystemDictionaryShared.
> The ClassLoader::get_package_entry() is being modified slightly so that 
> it could be used in SystemDictionaryShared.
> 
> Passed tier 1 - 4 tests.
> 
> thanks,
> Calvin


More information about the hotspot-runtime-dev mailing list