On Thu, 8 May 2025 07:54:17 GMT, Per Minborg <pminb...@openjdk.org> wrote:
>> As we advance, converting older JDK code to use the relatively new FFM API >> requires system calls that can provide `errno` and the likes to explicitly >> allocate a MemorySegment to capture potential error states. This can lead to >> negative performance implications if not designed carefully and also >> introduces unnecessary code complexity. >> >> Hence, this PR proposes adding a JDK internal method handle adapter that can >> be used to handle system calls with `errno`, `GetLastError`, and >> `WSAGetLastError`. >> >> It relies on an efficient carrier-thread-local cache of memory regions to >> allide allocations. > > Per Minborg has updated the pull request incrementally with one additional > commit since the last revision: > > Remove class src/java.base/share/classes/jdk/internal/foreign/CaptureStateUtil.java line 53: > 51: private static final BufferStack POOL = > BufferStack.of(CAPTURE_LAYOUT); > 52: > 53: // Do not use a lambda in order to allow early use in the init > sequence This can be a local variable in the static initializer, right -- e.g. no need to expose it at class-level? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/25043#discussion_r2079201294