RFR: 8311648: Refactor the Arena/Chunk/ChunkPool interface [v4]

Coleen Phillimore coleenp at openjdk.org
Tue Jul 11 19:58:56 UTC 2023


On Mon, 10 Jul 2023 11:43:19 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:
> 
>   Move stuff around to make diffs smaller

Looks good but I had one request.

src/hotspot/share/memory/arena.cpp line 214:

> 212: 
> 213: Arena::Arena(MEMFLAGS flag) : _flags(flag), _size_in_bytes(0) {
> 214:   _first = _chunk = ChunkPool::allocate_chunk(AllocFailStrategy::EXIT_OOM, Chunk::init_size);

I have one request - can you make the AllocFailStrategy the last parameter?

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

Marked as reviewed by coleenp (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/14803#pullrequestreview-1525063949
PR Review Comment: https://git.openjdk.org/jdk/pull/14803#discussion_r1260215281


More information about the hotspot-runtime-dev mailing list