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

Stefan Karlsson stefank at openjdk.org
Thu Aug 1 06:47:38 UTC 2024


On Wed, 31 Jul 2024 20:41:47 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> How does this rename look?  Instead of ClassLoaderData::keep_alive() and a _keep_alive refcount, it's been renamed to _strongly_reachable and is_strongly_reachable().
>> Tested with tier1 on Oracle supported platforms.
>
> Coleen Phillimore has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Rename to keep_alive_ref_count

Me and Coleen talked about and agreed on the keep_alive_ref_count name. I think this looks good. I'll Approve the PR when the Windows compilation error has been fixed. Thanks!

src/hotspot/share/classfile/classLoaderData.hpp line 215:

> 213: 
> 214:  private:
> 215:   bool keep_alive_ref_count() const { return _keep_alive_ref_count; }

keep_alive_ref_count() should return an int. The Windows GHA build complains about this.

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?

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

PR Review: https://git.openjdk.org/jdk/pull/20408#pullrequestreview-2211769698
PR Review Comment: https://git.openjdk.org/jdk/pull/20408#discussion_r1699518844
PR Review Comment: https://git.openjdk.org/jdk/pull/20408#discussion_r1699523957


More information about the hotspot-dev mailing list