Skip to content

Commit

Permalink
Merge pull request #20726 from LinHu2016/testupdateforoffheap3
Browse files Browse the repository at this point in the history
Update java9above unsafe test for off-heap case
  • Loading branch information
llxia authored Dec 5, 2024
2 parents 3c8d47b + 66ecf39 commit c714a1e
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,12 @@ private void testCopyLargeArrayIntoRawMemory(Class arrayClass) {
Array.setByte(array, i, (byte) (i % Byte.SIZE));
}

for (long arrayOffset = baseOffset; arrayOffset < (baseOffset + maxNumBytes); arrayOffset = arrayOffset * 11 - 1) {
/*
For off-heap eanbled case initial arrayOffset would be 0 (baseOffset=0),
cause the next arrayOffset in loop become to negative (arrayOffset*11-1),
update logic for the next arrayOffset to avoid negative offset test case.
*/
for (long arrayOffset = baseOffset; arrayOffset < (baseOffset + maxNumBytes); arrayOffset = ((arrayOffset==0) ? 16 : arrayOffset) * 11 - 1 ) {
long maxNumBytesLeft = ((baseOffset + maxNumBytes) - arrayOffset);
for (long numBytesToCopy = 1; numBytesToCopy < maxNumBytesLeft; numBytesToCopy = (numBytesToCopy + 1)
* numBytesToCopy) {
Expand Down

0 comments on commit c714a1e

Please sign in to comment.