RFR: 8291840: Avoid JavaCalls for setting up _java_system_loader and _java_platform_loader

Ioi Lam iklam at openjdk.org
Wed Aug 3 23:04:05 UTC 2022


On Wed, 3 Aug 2022 19:04:56 GMT, Calvin Cheung <ccheung at openjdk.org> wrote:

> Please review this small optimization for setting up the `_java_system_loader `and `_java_platform_loader`.
> 
> I saw startup perf improvements with HelloWorld on linux-x64 like the following:
> 
> 
> instr delta =      -102248    -0.1226%
> time  delta =       -0.125 ms -0.3507%
> 
> 
> Passed tiers 1,2,3 testing.

src/hotspot/share/classfile/modules.cpp line 506:

> 504: 
> 505:   ClassLoaderData* system_loader_data = SystemDictionary::register_loader(h_system_loader);
> 506:   SystemDictionary::set_system_loader(system_loader_data);

I think we should add an assert here:


// system_loader_data here is always an instance of jdk.internal.loader.ClassLoader$AppClassLoader.
// However, if -Djava.system.class.loader=xxx is specified, java_platform_loader() would
// be an instance of a user-defined class, so make sure this never happens.
assert(Arguments::get_property("java.system.class.loader") == NULL,
         "archived full module should have been disabled");

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

PR: https://git.openjdk.org/jdk/pull/9734


More information about the hotspot-runtime-dev mailing list