RFR: 8335059: Consider renaming ClassLoaderData::keep_alive [v2]

Coleen Phillimore coleenp at openjdk.org
Thu Aug 1 12:35:00 UTC 2024


On Thu, 1 Aug 2024 06:43:14 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:

>> Coleen Phillimore has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Rename to keep_alive_ref_count
>
> src/hotspot/share/classfile/classLoaderData.hpp line 308:
> 
>> 306: 
>> 307:   // Used to refcount a non-strong hidden class's s CLD in order to indicate their aliveness.
>> 308:   void inc_keep_alive_ref_count();
> 
> This comment is slightly misleading. We have two mechanisms to determine a CLDs aliveness. The first is this ref-counting mechanism, the other is the GC tracing. One can misinterpret this comment to mean that we only use the ref-count to determine the aliveness.
> 
> Could we tweak this comment to say something that the ref-count is used to *force* the aliveness of CLDs?

How about:
    // Used to refcount a non-strong hidden class's CLD in order to force its aliveness during
    // loading, when gc tracing may not find this CLD alive through the holder.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20408#discussion_r1700056669


More information about the hotspot-dev mailing list