RFR: 8360025: (se) Convert kqueue Selector Implementation to use FFM APIs [v4]

Alan Bateman alanb at openjdk.org
Sat Aug 30 15:07:44 UTC 2025


On Fri, 29 Aug 2025 14:50:29 GMT, Per Minborg <pminborg at openjdk.org> wrote:

>> src/java.base/macosx/classes/sun/nio/ch/KQueue.java line 91:
>> 
>>> 89:      */
>>> 90:     static MemorySegment getEvent(MemorySegment memoryHandle, int i) {
>>> 91:         return kevent.asSlice(memoryHandle, i);
>> 
>> Previous work eliminated allocating from the performance critical usages, might have to check the implications of asSlice here.
>
> We could use indices/offsets directly in the methods that receive the slices from this method.

`getDescriptor(MemorySegment keventArray, int index)` and `getFilter(MemorySegment keventArray, int index)` would work for the use-sites.

The other thing here is that a fd is an int rather than a long. The re-implemented KQueue should pick ident or fd (the common usage). Right now register takes an int fd, where the modified getDescriptor is actually returning the 64-bit ident.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25546#discussion_r2311977307


More information about the nio-dev mailing list