RFR: 8296433: Encountered null CLD while loading shared lambda proxy class

Ioi Lam iklam at openjdk.org
Tue Nov 8 03:19:22 UTC 2022


On Tue, 8 Nov 2022 00:18:54 GMT, Calvin Cheung <ccheung at openjdk.org> wrote:

> Please review this simple fix for calling `load_shared_class()`, which initializes `class_loader_data` prior to `set_nest_host()` in `SystemDictionary::load_shared_lambda_proxy_class()`.  Otherwise, a null `class_loader_data` would be encountered in `set_nest_host()`; it would fail the added assertion in `set_nest_host()`.
> 
> Passed tiers 1 and 2 testing on Oracle supported platforms.

Looks good.

I think the reason that we've never crashed is because we return at line 431:

https://github.com/openjdk/jdk/blob/1169dc066c0257da1a237960b8c0cc4782ef8d14/src/hotspot/share/classfile/classLoaderData.cpp#L420-L432

CDS only supports lambda proxy classes for the built-in loaders. So when we call `ClassLoaderData::record_dependency` with a NULL this, the `this` pointer is never dereferenced (at least for our current C++ compilers).

Anyway, passing a NULL this is undefined behavior, so it's good to get rid of it.

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

Marked as reviewed by iklam (Reviewer).

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


More information about the hotspot-runtime-dev mailing list