RFR: 8348171: Refactor GenerationCounters and its subclasses [v3]

Thomas Schatzl tschatzl at openjdk.org
Fri Jan 31 10:03:57 UTC 2025


On Thu, 30 Jan 2025 14:59:04 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

>> Simple refactoring of removing the use of `virtual` method and use concrete subclasses when needed.
>> 
>> Test: tier1-5
>
> Albert Mingkun Yang has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains four commits:
> 
>  - review
>  - Merge branch 'master' into gen-counter
>  - merge
>  - gen-counter

I looked at the change and I recommend additional related refactoring:
* have the `update_all` method of the subclasses call the `update_all(size_t)` method instead of using the `_current_size` (which should probably be called `_cur_capacity`?) to be more OO.
* this allows hiding that member as `private`
* and `_name_space` can also be made `private`

I prepared a commit for such change: https://github.com/openjdk/jdk/commit/331bc9c6e7d0a6402fb627216c1da6d5f6b50c9f

Fwiw, I wouldn't mind renaming `update_all` to `update_capacity` here because it seems trivial anyway.

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

PR Review: https://git.openjdk.org/jdk/pull/23209#pullrequestreview-2586171924


More information about the hotspot-gc-dev mailing list