RFR: 8287788: reuse intermediate segments allocated during FFM stub invocations [v4]

Maurizio Cimadamore mcimadamore at openjdk.org
Mon Jan 20 17:37:41 UTC 2025


On Mon, 20 Jan 2025 17:33:01 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

> An even higher-level alternative here would be for this method to return a custom arena, whose `close` implementation does the `release`. This way, no cleanup action is needed. The arena could use a slicing allocator on a pre-allocated, per-thread segment. If the segment is not big enough for the allocation the linker wants to do, we can just return a plain confined arena.

The observation here is that you have an acquire/release "lifetime". And then you have a client that wants to use the Arena API. So we could actually fold these two use cases, and create an Arena that has a better allocation strategy (because it recycles memory) and does the right thing when it is closed. This is kind of why custom arenas were allowed by the FFM API.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23142#discussion_r1922711068


More information about the core-libs-dev mailing list