RFR: 8324584: Optimize Symbol and char* handling in ClassLoader

David Holmes dholmes at openjdk.org
Thu Feb 8 06:54:53 UTC 2024


On Wed, 7 Feb 2024 22:22:22 GMT, Matias Saavedra Silva <matsaave at openjdk.org> wrote:

> The call to `ClassLoader::load_class()` currently takes a Symbol* for the name and later extracts the string only to change it back into a Symbol* inside `ClassLoader::search_module_entries()` while also recalculating the package entry. This patch simply passes the string directly along with the package entry from the caller. Verified with tier1-5 tests.

Thanks for taking on this cleanup.

I think there is a further simplification here.

src/hotspot/share/classfile/classLoader.cpp line 1034:

> 1032: ClassFileStream* ClassLoader::search_module_entries(JavaThread* current,
> 1033:                                                     const GrowableArray<ModuleClassPathList*>* const module_list,
> 1034:                                                     Symbol* name,

AFAICS `name` is never actually used. The class name was only used to get the package entry, which we already have.

The comment on L1031 also needs updating as no class is involved.

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

Changes requested by dholmes (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/17761#pullrequestreview-1869367927
PR Review Comment: https://git.openjdk.org/jdk/pull/17761#discussion_r1482473136


More information about the hotspot-runtime-dev mailing list