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

Coleen Phillimore coleenp at openjdk.org
Fri Aug 11 01:30:28 UTC 2023


On Wed, 9 Aug 2023 12:20: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 two additional commits since the last revision:
> 
>  - Mention that it's null-terminated
>  - Comments etc

Looks good relying on prior review and current review of fixed allocate_chunk.

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

> 147:     chunk = (Chunk*)p;
> 148:   }
> 149:   ::new(chunk) Chunk(length);

You need to do this because if you find and take a chunk out of the pool, it's not properly initialized?

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

Marked as reviewed by coleenp (Reviewer).

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


More information about the hotspot-runtime-dev mailing list