-
Notifications
You must be signed in to change notification settings - Fork 6.1k
8347408: Create an internal method handle adapter for system calls with errno #23517
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
👋 Welcome back pminborg! A progress list of the required criteria for merging this PR into |
|
❗ This change is not yet ready to be integrated. |
Webrevs
|
|
/reviewers 2 reviewer |
|
Unfortunately, this PR would evolve in a direction that is hard to maintain if appropriate changes were made to cover some virtual thread corner cases. So, we need to rethink the overall solution and come back with another PR. Thanks for your feedback so far. |
Going forward, converting older JDK code to use the relatively new FFM API requires system calls that can provide
errnoand the likes to explicitly allocate aMemorySegmentto 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 to add a JDK internal method handle adapter that can be used to handle system calls with
errno,GetLastError, andWSAGetLastError.It relies on an efficient carrier-thread-local cache of memory regions to allide allocations.
Here are some benchmarks that ran on a platform thread and virtual threads respectively:
Adapted system call:
Explicit allocation:
Thread Local allocation:
The adapted system call exhibits a ~6x performance improvement over the existing "explicit allocation" scheme for the happy path on platform threads. Because there needs to be sharing across threads for virtual-tread-capable carrier threads, these are a bit slower ("only" ~2.5x faster).
This PR relates to another PR we had to back out. This PR attempts to ensure, that the problems encountered there do not surface in this PR.
Tested and passed tiers 1-3.
Progress
Issue
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/23517/head:pull/23517$ git checkout pull/23517Update a local copy of the PR:
$ git checkout pull/23517$ git pull https://git.openjdk.org/jdk.git pull/23517/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 23517View PR using the GUI difftool:
$ git pr show -t 23517Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/23517.diff
Using Webrev
Link to Webrev Comment