8219014: (bf) Add absolute bulk put methods which accept a source Buffer

Paul Sandoz paul.sandoz at oracle.com
Tue Feb 11 17:04:53 UTC 2020


Are referring to some property of virtual memory or how buffers are implemented?

Unsafe.copyMemory detect overlaps, given two addresses (double-register base + offset) and length.

Buffers were enhanced to ensure, over all kinds of buffer, consistent access using double-register addressing. We could collapse all bulk copy operations to leverage Unsafe.copyMemory.

Paul.


> On Feb 11, 2020, at 8:03 AM, Florian Weimer <fweimer at redhat.com> wrote:
> 
> * Paul Sandoz:
> 
>> There is some inconsistency with the existing relative bulk
>> specifications and implementations when this and the source buffers
>> overlap. The loopy implementation overwrites but heap buffers defer to
>> System.arraycopy and direct buffers defer to UNSAFE.copyMemory, I
>> believe both make temporary copies on overlapping regions.  I am
>> uncertain about when the loopy version is called.
> 
> But in general, it is impossible to detect overlaps because two buffers
> could refer to the same backing storage mapped at different addresses.
> It's not possible to detect that by comparing the object attachments or
> the addresses: they would all be different.
> 
> Thanks,
> Florian
> 



More information about the nio-dev mailing list