On Wed, 30 Apr 2025 15:33:52 GMT, Per Minborg <[email protected]> wrote:
>> This PR is based on the work of @mernst-github and aims to implement an
>> _internal_ thread-local 'stack' allocator, which works like a dynamically
>> sized arena, but with reset functionality to reset the allocated size back
>> to a certain level. The underlying memory could stay around between calls,
>> which could improve performance.
>>
>> Re-allocated segments are not zeroed between allocations.
>
> Per Minborg has updated the pull request incrementally with one additional
> commit since the last revision:
>
> Improve on comments
test/micro/org/openjdk/bench/java/lang/foreign/CallOverheadByValue.java line 87:
> 85: public void byValue() throws Throwable {
> 86: // point = unit();
> 87: MemorySegment unused = (MemorySegment)
> MH_UNIT_BY_VALUE.invokeExact(
This benchmark is a bit misleading, because the allocator object will add some
noise in the mix. I suggest to have some allocator object ready in a field, and
just pass that (avoiding the lambda). That would also be more similar to
idiomatic FFM code (which assumes some allocator is already available at the
callsite).
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24829#discussion_r2070131376