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

Darragh Clarke dclarke at openjdk.org
Wed Sep 3 15:03:45 UTC 2025


On Sat, 30 Aug 2025 15:05:24 GMT, Alan Bateman <alanb at openjdk.org> wrote:

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

So on my local branch I've address all the comments except the two in this thread,

So for using the indices directly what would that look like? would we remove getEvent and instead pass the `MemorySegment` and whatever indices we want to access directly to getDescriptor/getFilter?

As for fd/ident, I think that's interesting, the reason for getDescriptor using long ident is because that's what jextract generated for it (from `uintptr_t` specifically),  I see that in mainline today it's just the simpler call of ` return unsafe.getInt(address + OFFSET_IDENT);` I could try just replicating the existing code instead of using the generated method?

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

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


More information about the core-libs-dev mailing list