RFR: 8357847: (ch) WindowsAsynchronousFileChannelImpl should support FFM Buffers

Brian Burkhalter bpb at openjdk.org
Fri May 30 21:31:57 UTC 2025


On Fri, 30 May 2025 15:50:37 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> src/java.base/windows/classes/sun/nio/ch/WindowsAsynchronousFileChannelImpl.java line 452:
>> 
>>> 450:                 buf = dst;
>>> 451:                 address = ((DirectBuffer)dst).address() + pos;
>>> 452:                 IOUtil.acquireScope(dst, true);
>> 
>> I assume we'll have to change this to use IOUtil.bufferAddress(dst), and after the acquire.
>
> Noted.

I don't think that using `IOUtil.bufferAddress()` would be correct here. The reason is that it calls `JavaNioAccess.getBufferAddress()` which returns the value of `address` hoisted into `Buffer` thereby circumventing the check for closable shared sessions mentioned [below](https://github.com/openjdk/jdk/pull/25531#issuecomment-2922822498).

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25531#discussion_r2116688743


More information about the nio-dev mailing list