8219014: (bf) Add absolute bulk put methods which accept a source Buffer
Brian Burkhalter
brian.burkhalter at oracle.com
Wed Apr 1 15:57:24 UTC 2020
Hi Florian,
> On Apr 1, 2020, at 7:26 AM, Florian Weimer <fweimer at redhat.com> wrote:
>
>> Resuscitating the thread [1] concerning [2]. An updated version of the
>> proposed patch is [3]. This differs from the previous version in that
>> it permits the source and destination buffers to share the same
>> backing storage. Hopefully I have implemented this correctly (it is
>> assumed that System.arraycopy() [4] and Unsafe copying handle
>> overlapping copies as documented for the new methods $Type$Buffer
>> put(int, $Type$Buffer, int, int) {}).
>
>> [3] http://cr.openjdk.java.net/~bpb/8219014/webrev.01/ <http://cr.openjdk.java.net/~bpb/8219014/webrev.01/>
>
> Hmm. This part
>
> + * of both buffers are unchanged. If the source buffer and this buffer share
> + * the same backing storage and the source and destination ranges overlap,
> + * then the transfer is performed as if the elements at positions
>
> still references “backing storage”? Should it say “backing array”
> instead?
>
> I don't think you can make such a promise for direct buffers.
I think the fallback code that does put(j, get(i)) instead of using arraycopy() or Unsafe needs to be checked for this, but the latter two approaches insofar as we know will handle overlaps.
Thanks,
Brian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/nio-dev/attachments/20200401/bcd041ec/attachment.htm>
More information about the nio-dev
mailing list