RFR: 8311648: Refactor the Arena/Chunk/ChunkPool interface [v2]
Thomas Stuefe
stuefe at openjdk.org
Sat Jul 8 09:53:08 UTC 2023
On Fri, 7 Jul 2023 13:59:06 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:
>> Hi,
>>
>> This PR refactors the Arena code without introducing any changes in behavior. I believe that this leads to a much clearer API and that this will in turn simplify the maintenance of this code. `Chunk` is now much more "dumb", mainly acting as a way of interrogating the chunk of data that it is holding. The `ChunkPool` gains a more prominent role, being entirely responsible for the memory allocation strategy used. `Arena` is basically unchanged, as it orchestrates the usage of these two APIs. The `chop` and `next_chop` methods are re-defined to be static inside of `Chunk`, having an object `delete` itself is very surprising, so I'm happy to get rid of that.
>>
>> I hope that you agree with me on these changes!
>>
>> Cheers,
>> Johan
>
> Johan Sjölen has updated the pull request incrementally with one additional commit since the last revision:
>
> Hide ChunkPool, make ChunkPoolCleaner be started from Arena
Hi Johan,
cursory review.
Could you please give this a massage and minimize deltas a bit? Would make review and backporting easier. Seems several things moved without much reason to move.
Thanks!
src/hotspot/share/memory/arena.cpp line 52:
> 50: static ChunkPool _pools[_num_pools];
> 51:
> 52: Chunk* _first; // first cached Chunk; its first word points to next chunk
I'd probably leave out the comment since its pretty obvious how this works.
src/hotspot/share/memory/arena.cpp line 60:
> 58: void return_to_pool(Chunk* chunk);
> 59: // Prune the pool
> 60: void prune();
Comment just repeats the name. I'd either omit it or describe what the function is doing.
-------------
PR Review: https://git.openjdk.org/jdk/pull/14803#pullrequestreview-1520679898
PR Review Comment: https://git.openjdk.org/jdk/pull/14803#discussion_r1257199238
PR Review Comment: https://git.openjdk.org/jdk/pull/14803#discussion_r1257199011
More information about the hotspot-runtime-dev
mailing list