RFR: 8349146: [REDO] Implement a better allocator for downcalls [v6]
Shaojin Wen
swen at openjdk.org
Fri May 2 08:14:50 UTC 2025
On Wed, 30 Apr 2025 15:33:52 GMT, Per Minborg <pminborg at openjdk.org> 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
src/java.base/share/classes/jdk/internal/foreign/BufferStack.java line 108:
> 106: final Arena arena = Arena.ofAuto();
> 107: final SlicingAllocator stack = new SlicingAllocator(arena.allocate(size));
> 108: return new PerThread(new ReentrantLock(), stack, arena);
Suggestion:
final Arena arena = Arena.ofAuto();
return new PerThread(new ReentrantLock(),
new SlicingAllocator(arena.allocate(size)), arena);
}
The local variable stack is only used once, is it okay not to use it?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/24829#discussion_r2071260412
More information about the core-libs-dev
mailing list