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

Per Minborg pminborg at openjdk.org
Wed May 7 08:48:53 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 with a new target base due to a merge or a rebase. The pull request now contains 48 commits:

 - Simplify equals method
 - Use modern switch
 - Merge branch 'master' into errno-util3b
 - Address comments
 - Fix empty line at the end of a third file
 - Fix empty line at the end of another file
 - Fix empty line at the end of a file
 - Reformat more
 - Reformat
 - Use stable values
 - ... and 38 more: https://git.openjdk.org/jdk/compare/21f01e0c...f9511b88

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

Changes: https://git.openjdk.org/jdk/pull/25043/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=25043&range=04
  Stats: 818 lines in 9 files changed: 804 ins; 0 del; 14 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