Skip to content

Commit

Permalink
Merge pull request #20339 from LinHu2016/testupdate4offheap
Browse files Browse the repository at this point in the history
Update j9vmtest for off-heap feature
  • Loading branch information
tajila authored Oct 30, 2024
2 parents c0eabdd + c4c62eb commit dba0347
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,12 @@ public 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) {
long memoryPointer = myUnsafe.allocateMemory(maxNumBytes);
Expand Down

0 comments on commit dba0347

Please sign in to comment.