RFR: 8347408: Create an internal method handle adapter for system calls with errno [v7]

Per Minborg pminborg at openjdk.org
Thu May 8 07:40:44 UTC 2025


> 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:

  Clean up and remove unrelated changed

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/25043/files
  - new: https://git.openjdk.org/jdk/pull/25043/files/e435762b..3a4cf9dc

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=25043&range=06
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=25043&range=05-06

  Stats: 115 lines in 5 files changed: 0 ins; 100 del; 15 mod
  Patch: https://git.openjdk.org/jdk/pull/25043.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/25043/head:pull/25043

PR: https://git.openjdk.org/jdk/pull/25043


More information about the core-libs-dev mailing list