[foreign-memaccess+abi] RFR: 8267240: Bounded arena allocator doesn't work if bounded size > BLOCK_SIZE [v2]
Maurizio Cimadamore
mcimadamore at openjdk.java.net
Mon May 17 15:08:24 UTC 2021
> 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
Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision:
Address review comment
-------------
Changes:
- all: https://git.openjdk.java.net/panama-foreign/pull/537/files
- new: https://git.openjdk.java.net/panama-foreign/pull/537/files/ecdb982d..b20aae53
Webrevs:
- full: https://webrevs.openjdk.java.net/?repo=panama-foreign&pr=537&range=01
- incr: https://webrevs.openjdk.java.net/?repo=panama-foreign&pr=537&range=00-01
Stats: 3 lines in 1 file changed: 1 ins; 1 del; 1 mod
Patch: https://git.openjdk.java.net/panama-foreign/pull/537.diff
Fetch: git fetch https://git.openjdk.java.net/panama-foreign pull/537/head:pull/537
PR: https://git.openjdk.java.net/panama-foreign/pull/537
More information about the panama-dev
mailing list