[foreign-memaccess+abi] RFR: Improve NIO channel support for buffer views over segments [v3]
Chris Hegarty
chegar at openjdk.java.net
Thu Apr 22 13:23:42 UTC 2021
On Thu, 22 Apr 2021 11:39:55 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> Chris Hegarty has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Resolve outstanding TODO in MemoryScope spec
>
> src/java.base/share/classes/java/nio/Buffer.java line 831:
>
>> 829: return null;
>> 830: }
>> 831: if (async && scope.ownerThread() != null) {
>
> Crazy idea - are we sure we need this check? If user wants to really pass a confined buffer to an async IO, I belive a failure would still occur when the segment is accessed by a different thread - do you see reporting an error eagerly as something important? Will fibers change things so that e.g. we might be able to do more with a _single_ thread?
I think that there is scope for tweaking this in the future. At the moment with the current structure, the Windows async socket channel implementation will access the memory behind the scope's/segment's back ( through the `long` address value that it retrieves ). It stores and reuses the "naked" address value from a thread other than that of the thread which initialed the I/O operation, all without invoking any memory access operations from Java. It's a non-trivial change to alter this, and not even clear if we should.
-------------
PR: https://git.openjdk.java.net/panama-foreign/pull/512
More information about the panama-dev
mailing list