On Thu, 23 Jan 2025 12:37:16 GMT, Maurizio Cimadamore <mcimadam...@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