Skip to content

Commit c714a1e

Browse files
authored
Merge pull request #20726 from LinHu2016/testupdateforoffheap3
Update java9above unsafe test for off-heap case
2 parents 3c8d47b + 66ecf39 commit c714a1e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

test/functional/UnsafeTest/src_90/org/openj9/test/unsafe/TestUnsafeCopyMemory.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,12 @@ private void testCopyLargeArrayIntoRawMemory(Class arrayClass) {
967967
Array.setByte(array, i, (byte) (i % Byte.SIZE));
968968
}
969969

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

0 commit comments

Comments
 (0)