RFR: 8265699: (bf) Scopes passed to ScopedMemoryAccess.copy[Swap]Memory in incorrect order

Brian Burkhalter bpb at openjdk.java.net
Wed Apr 21 20:18:35 UTC 2021


On Wed, 21 Apr 2021 20:10:17 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Please consider this request to correct what appear to be `jdk.internal.misc.ScopedMemoryAccess$Scope`s passed in incorrect order to the `copyMemory()` and `copySwapMemory()` methods of `jdk.internal.misc.ScopedMemoryAccess` in some of the `java.nio.Buffer` bulk transfer methods.
>
> src/java.base/share/classes/java/nio/Direct-X-Buffer.java.template line 551:
> 
>> 549:         int rem = (pos <= lim ? lim - pos : 0);
>> 550:         try {
>> 551:             SCOPED_MEMORY_ACCESS.copyMemory(scope(), scope(), null,
> 
> Is this deliberate? same strange to use same scope for both address and target?

Yes, it is. In this case the buffer is copying to itself, moving the data down to the beginning of the buffer, position zero.

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

PR: https://git.openjdk.java.net/jdk/pull/3607


More information about the nio-dev mailing list