RFR: 8360025: (se) Convert kqueue Selector Implementation to use FFM APIs [v4]
Darragh Clarke
dclarke at openjdk.org
Wed Sep 3 12:11:51 UTC 2025
On Thu, 28 Aug 2025 08:51:14 GMT, Darragh Clarke <dclarke at openjdk.org> wrote:
>> This PR aims to Panamize the Java Kqueue implementation, This is based on the work that was previously shared in https://github.com/openjdk/jdk/pull/22307 , The main change since then is that this branch takes advantage of the changes made in https://github.com/openjdk/jdk/pull/25043 to allow for better performance during errno handling.
>>
>> These changes feature a lot of Jextract generated files, though alterations have been made in relation to Errno handling and performance improvements.
>>
>> I will update this description soon to include performance metrics on a few microbenchmarks, though currently it's roughly 2% to 3% slower with the changes, which is somewhat expected, though there are still a few ideas of possible performance improvements that could be tried. Any suggestions or comments in that area are more than welcome however.
>
> Darragh Clarke has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains 12 additional commits since the last revision:
>
> - fixed copyright header
> - merged master into branch
> - moved repeating code into own method
> - implementing feedback, adding missing errno checks, cleanup
> - feedback
> - general cleanup
> - small refactoring
> - Performance
> - implementing feedback
> - removed unrelated change
> - ... and 2 more: https://git.openjdk.org/jdk/compare/fbe3c71c...cc5f558a
So I double checked the changes made there and wrote this up, I can make it more precise or change wording if its going to be attached to a file. Package info currently contains the script used to generate the code
**Common changes:**
- utility methods and constant values got moved into FFMUtils, this is to cut down on duplicated code as more FFM code gets added
- kqueue_h and kevent both get updated to reference FFMUtils
**kqueue_h specific changes:**
- Errno handling had to be added, this involved adding the `ADAPTED` method handles as well as editing the `HANDLE` methodhandle to add `Linker.Option.captureCallState(ERRNO_NAME));`
- Removing some unused generated objects such as `static final Arena LIBRARY_ARENA = Arena.ofAuto();`
- added `private static final String ERRNO_NAME = "errno”;`
-------------
PR Comment: https://git.openjdk.org/jdk/pull/25546#issuecomment-3248980788
More information about the nio-dev
mailing list