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

Reviewed-by: mcimadamore
This commit is contained in:
Brian Burkhalter 2021-04-22 19:44:01 +00:00
parent b930bb1a2c
commit ca0de266b4
2 changed files with 7 additions and 6 deletions

View File

@ -481,7 +481,7 @@ class Direct$Type$Buffer$RW$$BO$
try { try {
#if[!byte] #if[!byte]
if (order() != ByteOrder.nativeOrder()) if (order() != ByteOrder.nativeOrder())
SCOPED_MEMORY_ACCESS.copySwapMemory(scope(), null, src, SCOPED_MEMORY_ACCESS.copySwapMemory(null, scope(), src,
srcOffset, srcOffset,
null, null,
ix(pos), ix(pos),
@ -489,7 +489,7 @@ class Direct$Type$Buffer$RW$$BO$
(long)1 << $LG_BYTES_PER_VALUE$); (long)1 << $LG_BYTES_PER_VALUE$);
else else
#end[!byte] #end[!byte]
SCOPED_MEMORY_ACCESS.copyMemory(scope(), null, src, SCOPED_MEMORY_ACCESS.copyMemory(null, scope(), src,
srcOffset, srcOffset,
null, null,
ix(pos), ix(pos),
@ -518,7 +518,7 @@ class Direct$Type$Buffer$RW$$BO$
try { try {
#if[!byte] #if[!byte]
if (order() != ByteOrder.nativeOrder()) if (order() != ByteOrder.nativeOrder())
SCOPED_MEMORY_ACCESS.copySwapMemory(scope(), null, src, SCOPED_MEMORY_ACCESS.copySwapMemory(null, scope(), src,
srcOffset, srcOffset,
null, null,
ix(index), ix(index),
@ -527,7 +527,7 @@ class Direct$Type$Buffer$RW$$BO$
else else
#end[!byte] #end[!byte]
SCOPED_MEMORY_ACCESS.copyMemory( SCOPED_MEMORY_ACCESS.copyMemory(
scope(), null, src, null, scope(), src,
srcOffset, null, ix(index), (long)length << $LG_BYTES_PER_VALUE$); srcOffset, null, ix(index), (long)length << $LG_BYTES_PER_VALUE$);
} finally { } finally {
Reference.reachabilityFence(this); Reference.reachabilityFence(this);
@ -548,6 +548,7 @@ class Direct$Type$Buffer$RW$$BO$
assert (pos <= lim); assert (pos <= lim);
int rem = (pos <= lim ? lim - pos : 0); int rem = (pos <= lim ? lim - pos : 0);
try { try {
// null is passed as destination Scope to avoid checking scope() twice
SCOPED_MEMORY_ACCESS.copyMemory(scope(), null, null, SCOPED_MEMORY_ACCESS.copyMemory(scope(), null, null,
ix(pos), null, ix(0), (long)rem << $LG_BYTES_PER_VALUE$); ix(pos), null, ix(0), (long)rem << $LG_BYTES_PER_VALUE$);
} finally { } finally {

View File

@ -1058,7 +1058,7 @@ public abstract class $Type$Buffer
#end[!byte] #end[!byte]
try { try {
SCOPED_MEMORY_ACCESS.copyMemory( SCOPED_MEMORY_ACCESS.copyMemory(
scope(), src.scope(), srcBase, src.scope(), scope(), srcBase,
srcAddr, base, addr, len); srcAddr, base, addr, len);
} finally { } finally {
Reference.reachabilityFence(src); Reference.reachabilityFence(src);
@ -1068,7 +1068,7 @@ public abstract class $Type$Buffer
} else { } else {
try { try {
SCOPED_MEMORY_ACCESS.copySwapMemory( SCOPED_MEMORY_ACCESS.copySwapMemory(
scope(), src.scope(), srcBase, src.scope(), scope(), srcBase,
srcAddr, base, addr, len, (long)1 << $LG_BYTES_PER_VALUE$); srcAddr, base, addr, len, (long)1 << $LG_BYTES_PER_VALUE$);
} finally { } finally {
Reference.reachabilityFence(src); Reference.reachabilityFence(src);