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

Florian Weimer fweimer at redhat.com
Tue Feb 11 16:03:23 UTC 2020


* 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