[foreign-memaccess+abi] Integrated: 8267240: Bounded arena allocator doesn't work if bounded size > BLOCK_SIZE
Maurizio Cimadamore
mcimadamore at openjdk.java.net
Mon May 17 15:34:45 UTC 2021
On Mon, 17 May 2021 11:43:05 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
> This patch follows the discussion in [1], and splits the unbounded allocator from the bounded one, as attempts to reusing logic were causing issues when bounded arena allocators were created with bounded size > BLOCK_SIZE.
>
> I have looked for simplifications of the `trySlice` logic (also mentioned in the emails) - but in my opinion it cannot be simplified much. When an allocator is unbounded, if we receive a request that is more than half the size of the allocator block, we cannot guarantee that we can align it correctly in a segment whose size is BLOCK_SIZE. So, I think the limit of MAX_ALLOC_SIZE = BLOCK_SIZE / 2 is correct, in the sense that anything above that limit needs a standalone allocation (or we won't be able to align it in certain edge cases).
>
> Of course, if we didn't care about alignment, the logic could be simplified, but since this is a native allocator, I think respecting alignment of the allocation request is important.
>
> [1] - https://mail.openjdk.java.net/pipermail/panama-dev/2021-May/013796.html
This pull request has now been integrated.
Changeset: 18f0e477
Author: Maurizio Cimadamore <mcimadamore at openjdk.org>
URL: https://git.openjdk.java.net/panama-foreign/commit/18f0e477e335f17bc9d192771adf0d56f31c4d21
Stats: 112 lines in 3 files changed: 61 ins; 37 del; 14 mod
8267240: Bounded arena allocator doesn't work if bounded size > BLOCK_SIZE
Reviewed-by: jvernee
-------------
PR: https://git.openjdk.java.net/panama-foreign/pull/537
More information about the panama-dev
mailing list