RFR: 8368727: CDS custom loader support causes asserts during class unloading
Ioi Lam
iklam at openjdk.org
Wed Oct 1 04:34:49 UTC 2025
On Mon, 29 Sep 2025 02:26:58 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> src/hotspot/share/classfile/systemDictionaryShared.cpp line 177:
>>
>>> 175: // No longer holding SharedDictionary_lock
>>> 176: // No need to lock, as <ik> can be held only by a single thread.
>>> 177: loader_data->add_class(ik);
>>
>> Are the comments pertaining to the `add_class` call?
>
> Why not just move this to after the successful `load_shared_class` below? It is very hard to see the complete call sequence to when `restore_unshareable_info` gets called, to know that moving it there makes sense.
The comment is about all that could happen to `ik` after the current thread have gotten exclusive ownership of `ik`. I.e., no other thread will modify the contents of `ik` or store `ik` into a `ClassLoaderData`.
The `loader_data->add_class(ik)` for all other shared classes are done inside `restore_unshareable_info()`, so we should do the same thing in this case. This means the same sequence of actions will happen (e.g., `loader_data->add_class(ik)` happens before the the Java mirror is created.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27511#discussion_r2393426301
More information about the hotspot-dev
mailing list