On Tue, 22 Nov 2022 09:38:35 GMT, Maurizio Cimadamore <mcimadam...@openjdk.org> 
wrote:

>> src/jdk.sctp/unix/classes/sun/nio/ch/sctp/SctpMultiChannelImpl.java line 590:
>> 
>>> 588:                                         int pos)
>>> 589:             throws IOException {
>>> 590:         try (var guard = NIO_ACCESS.acquireScope(bb)) {
>> 
>> Why was the old code not using reachability fences? Bug or feature?
>
> I see that there's a subsequent buffer call if `n > 0`, so that's probably 
> why the fence was skipped? (I also assume that the code calling this method 
> will access the buffer before/after, so reachability is never truly an issue 
> - but for session-backed buffers this needs fixing).
> 
> Also, stepping back, I note how, if `receive0` was a native call using 
> Linker, perhaps we wouldn't need all this manual address computation - we'd 
> just get a memory segment slice from the buffer and pass that to the handle 
> (which will perform the correct liveness check). E.g. maybe a better long 
> term solution would be to panama-ize this code?

Yes, once the memory/linker APIs are permanent then the SCTP implementation 
would be a good candidate to redo.

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

PR: https://git.openjdk.org/jdk/pull/11260

Reply via email to