RFR: 8287788: Implement a better allocator for downcalls [v16]
Matthias Ernst
duke at openjdk.org
Thu Jan 23 12:55:50 UTC 2025
On Thu, 23 Jan 2025 12:37:16 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> Matthias Ernst has updated the pull request incrementally with four additional commits since the last revision:
>>
>> - test deep linker stack
>> - Merge remote-tracking branch 'origin/mernst/cache-segments' into mernst/cache-segments
>> - topOfStack
>> - (c)
>
> src/java.base/share/classes/jdk/internal/foreign/abi/BufferStack.java line 103:
>
>> 101: @SuppressWarnings("restricted")
>> 102: public MemorySegment allocate(long byteSize, long byteAlignment) {
>> 103: return frame.allocate(byteSize, byteAlignment);
>
> Should this also check order?
We could, in the sense that an allocation in a lower stack frame seems suspicious, but technically it is completely legal. The frame has been allocated and is sliced to the requested size, and is guaranteed as long as the Frame's arena hasn't been closed, no matter whether other frames are on top:
frame1 = pushFrame(256);
frame2 = pushFrame(256);
<<frame1 can safely allocate up to 256>>
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/23142#discussion_r1926931511
More information about the core-libs-dev
mailing list