Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
offamitkumar committed Oct 28, 2024
1 parent 237221d commit b21b72e
Showing 1 changed file with 148 additions and 116 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -492,120 +492,152 @@ public static void testByteLong5_runner() {
// ///runAndVerify2(() -> testByteByte5b(byteArray, byteArray, 0, size-1), 8);
// }
//
// @Test
// @IR(counts = { IRNode.LOAD_VECTOR_L, "=0", IRNode.STORE_VECTOR, "=0" }) // temporary
// // @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" })
// // FAILS: adr is CastX2P(dest + 8 * (i + int_con))
// // See: JDK-8331576
// public static void testOffHeapLong1a(long dest, long[] src) {
// for (int i = 0; i < src.length; i++) {
// UNSAFE.putLongUnaligned(null, dest + 8 * i, src[i]);
// }
// }
//
// @Test
// @IR(counts = { IRNode.LOAD_VECTOR_L, "=0", IRNode.STORE_VECTOR, "=0" }) // temporary
// // @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" })
// // FAILS: adr is CastX2P(dest + 8L * (i + int_con))
// // See: JDK-8331576
// public static void testOffHeapLong1b(long dest, long[] src) {
// for (int i = 0; i < src.length; i++) {
// UNSAFE.putLongUnaligned(null, dest + 8L * i, src[i]);
// }
// }
//
// @Run(test = {"testOffHeapLong1a", "testOffHeapLong1b"})
// public static void testOffHeapLong1_runner() {
// ///runAndVerify3(() -> testOffHeapLong1a(baseOffHeap, longArray), 0);
// ///runAndVerify3(() -> testOffHeapLong1b(baseOffHeap, longArray), 0);
// }
//
// @Test
// @IR(counts = { IRNode.LOAD_VECTOR_L, "=0", IRNode.STORE_VECTOR, "=0" }) // temporary
// // @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" })
// // FAILS: adr is CastX2P
// // See: JDK-8331576
// public static void testOffHeapLong2a(long dest, long[] src) {
// for (int i = 1; i < src.length; i++) {
// UNSAFE.putLongUnaligned(null, dest + 8 * (i - 1), src[i]);
// }
// }
//
// @Test
// @IR(counts = { IRNode.LOAD_VECTOR_L, "=0", IRNode.STORE_VECTOR, "=0" }) // temporary
// // @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" })
// // FAILS: adr is CastX2P
// // See: JDK-8331576
// public static void testOffHeapLong2b(long dest, long[] src) {
// for (int i = 1; i < src.length; i++) {
// UNSAFE.putLongUnaligned(null, dest + 8L * (i - 1), src[i]);
// }
// }
//
// @Run(test = {"testOffHeapLong2a", "testOffHeapLong2b"})
// public static void testOffHeapLong2_runner() {
// ///runAndVerify3(() -> testOffHeapLong2a(baseOffHeap, longArray), -8);
// ///runAndVerify3(() -> testOffHeapLong2b(baseOffHeap, longArray), -8);
// }
//
// @Test
// @IR(counts = { IRNode.LOAD_VECTOR_L, "=0", IRNode.STORE_VECTOR, "=0" }) // temporary
// // @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" })
// // FAILS: adr is CastX2P
// // See: JDK-8331576
// public static void testOffHeapLong3a(long dest, long[] src) {
// for (int i = 0; i < src.length - 1; i++) {
// UNSAFE.putLongUnaligned(null, dest + 8 * (i + 1), src[i]);
// }
// }
//
// @Test
// @IR(counts = { IRNode.LOAD_VECTOR_L, "=0", IRNode.STORE_VECTOR, "=0" }) // temporary
// // @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" })
// // FAILS: adr is CastX2P
// // See: JDK-8331576
// public static void testOffHeapLong3b(long dest, long[] src) {
// for (int i = 0; i < src.length - 1; i++) {
// UNSAFE.putLongUnaligned(null, dest + 8L * (i + 1), src[i]);
// }
// }
//
// @Run(test = {"testOffHeapLong3a", "testOffHeapLong3b"})
// public static void testOffHeapLong3_runner() {
// ///runAndVerify3(() -> testOffHeapLong3a(baseOffHeap, longArray), 8);
// ///runAndVerify3(() -> testOffHeapLong3b(baseOffHeap, longArray), 8);
// }
//
// @Test
// @IR(counts = { IRNode.LOAD_VECTOR_L, "=0", IRNode.STORE_VECTOR, "=0" }) // temporary
// // @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
// // applyIf = {"AlignVector", "false"})
// // FAILS: adr is CastX2P
// // See: JDK-8331576
// // AlignVector cannot guarantee that invar is aligned.
// public static void testOffHeapLong4a(long dest, long[] src, int start, int stop) {
// for (int i = start; i < stop; i++) {
// UNSAFE.putLongUnaligned(null, dest + 8 * i + baseOffset, src[i]);
// }
// }
//
// @Test
// @IR(counts = { IRNode.LOAD_VECTOR_L, "=0", IRNode.STORE_VECTOR, "=0" }) // temporary
// // @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
// // applyIf = {"AlignVector", "false"})
// // FAILS: adr is CastX2P
// // See: JDK-8331576
// // AlignVector cannot guarantee that invar is aligned.
// public static void testOffHeapLong4b(long dest, long[] src, int start, int stop) {
// for (int i = start; i < stop; i++) {
// UNSAFE.putLongUnaligned(null, dest + 8L * i + baseOffset, src[i]);
// }
// }
//
// @Run(test = {"testOffHeapLong4a", "testOffHeapLong4b"})
// public static void testOffHeapLong4_runner() {
// baseOffset = 8;
// ///runAndVerify3(() -> testOffHeapLong4a(baseOffHeap, longArray, 0, size-1), 8);
// ///runAndVerify3(() -> testOffHeapLong4b(baseOffHeap, longArray, 0, size-1), 8);
// }
@Test
@IR(counts = { IRNode.LOAD_VECTOR_L, "=0", IRNode.STORE_VECTOR, "=0" }) // temporary
// @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" })
// FAILS: adr is CastX2P(dest + 8 * (i + int_con))
// See: JDK-8331576
public static void testOffHeapLong1a(long dest, long[] src) {
for (int i = 0; i < src.length; i++) {
long value = src[i];
if (ByteOrder.nativeOrder() != ByteOrder.LITTLE_ENDIAN) {
value = Long.reverseBytes(value);
}
UNSAFE.putLongUnaligned(null, dest + 8 * i, value);
}
}

@Test
@IR(counts = { IRNode.LOAD_VECTOR_L, "=0", IRNode.STORE_VECTOR, "=0" }) // temporary
// @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" })
// FAILS: adr is CastX2P(dest + 8L * (i + int_con))
// See: JDK-8331576
public static void testOffHeapLong1b(long dest, long[] src) {
for (int i = 0; i < src.length; i++) {
long value = src[i];
if (ByteOrder.nativeOrder() != ByteOrder.LITTLE_ENDIAN) {
value = Long.reverseBytes(value);
}
UNSAFE.putLongUnaligned(null, dest + 8L * i, value);
}
}

@Run(test = {"testOffHeapLong1a", "testOffHeapLong1b"})
public static void testOffHeapLong1_runner() {
runAndVerify3(() -> testOffHeapLong1a(baseOffHeap, longArray), 0);
runAndVerify3(() -> testOffHeapLong1b(baseOffHeap, longArray), 0);
}

@Test
@IR(counts = { IRNode.LOAD_VECTOR_L, "=0", IRNode.STORE_VECTOR, "=0" }) // temporary
// @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" })
// FAILS: adr is CastX2P
// See: JDK-8331576
public static void testOffHeapLong2a(long dest, long[] src) {
for (int i = 1; i < src.length; i++) {
long value = src[i];
if (ByteOrder.nativeOrder() != ByteOrder.LITTLE_ENDIAN) {
value = Long.reverseBytes(value);
}
UNSAFE.putLongUnaligned(null, dest + 8 * (i - 1), value);
}
}

@Test
@IR(counts = { IRNode.LOAD_VECTOR_L, "=0", IRNode.STORE_VECTOR, "=0" }) // temporary
// @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" })
// FAILS: adr is CastX2P
// See: JDK-8331576
public static void testOffHeapLong2b(long dest, long[] src) {
for (int i = 1; i < src.length; i++) {
long value = src[i];
if (ByteOrder.nativeOrder() != ByteOrder.LITTLE_ENDIAN) {
value = Long.reverseBytes(value);
}
UNSAFE.putLongUnaligned(null, dest + 8L * (i - 1), value);
}
}

@Run(test = {"testOffHeapLong2a", "testOffHeapLong2b"})
public static void testOffHeapLong2_runner() {
runAndVerify3(() -> testOffHeapLong2a(baseOffHeap, longArray), -8);
runAndVerify3(() -> testOffHeapLong2b(baseOffHeap, longArray), -8);
}

@Test
@IR(counts = { IRNode.LOAD_VECTOR_L, "=0", IRNode.STORE_VECTOR, "=0" }) // temporary
// @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" })
// FAILS: adr is CastX2P
// See: JDK-8331576
public static void testOffHeapLong3a(long dest, long[] src) {
for (int i = 0; i < src.length - 1; i++) {
long value = src[i];
if (ByteOrder.nativeOrder() != ByteOrder.LITTLE_ENDIAN) {
value = Long.reverseBytes(value);
}
UNSAFE.putLongUnaligned(null, dest + 8 * (i + 1), value);
}
}

@Test
@IR(counts = { IRNode.LOAD_VECTOR_L, "=0", IRNode.STORE_VECTOR, "=0" }) // temporary
// @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" })
// FAILS: adr is CastX2P
// See: JDK-8331576
public static void testOffHeapLong3b(long dest, long[] src) {
for (int i = 0; i < src.length - 1; i++) {
long value = src[i];
if (ByteOrder.nativeOrder() != ByteOrder.LITTLE_ENDIAN) {
value = Long.reverseBytes(value);
}
UNSAFE.putLongUnaligned(null, dest + 8L * (i + 1), value);
}
}

@Run(test = {"testOffHeapLong3a", "testOffHeapLong3b"})
public static void testOffHeapLong3_runner() {
runAndVerify3(() -> testOffHeapLong3a(baseOffHeap, longArray), 8);
runAndVerify3(() -> testOffHeapLong3b(baseOffHeap, longArray), 8);
}

@Test
@IR(counts = { IRNode.LOAD_VECTOR_L, "=0", IRNode.STORE_VECTOR, "=0" }) // temporary
// @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
// applyIf = {"AlignVector", "false"})
// FAILS: adr is CastX2P
// See: JDK-8331576
// AlignVector cannot guarantee that invar is aligned.
public static void testOffHeapLong4a(long dest, long[] src, int start, int stop) {
for (int i = start; i < stop; i++) {
long value = src[i];
if (ByteOrder.nativeOrder() != ByteOrder.LITTLE_ENDIAN) {
value = Long.reverseBytes(value);
}
UNSAFE.putLongUnaligned(null, dest + 8 * i + baseOffset, value);
}
}

@Test
@IR(counts = { IRNode.LOAD_VECTOR_L, "=0", IRNode.STORE_VECTOR, "=0" }) // temporary
// @IR(counts = { IRNode.LOAD_VECTOR_L, ">=1", IRNode.STORE_VECTOR, ">=1" },
// applyIf = {"AlignVector", "false"})
// FAILS: adr is CastX2P
// See: JDK-8331576
// AlignVector cannot guarantee that invar is aligned.
public static void testOffHeapLong4b(long dest, long[] src, int start, int stop) {
for (int i = start; i < stop; i++) {
long value = src[i];
if (ByteOrder.nativeOrder() != ByteOrder.LITTLE_ENDIAN) {
value = Long.reverseBytes(value);
}
UNSAFE.putLongUnaligned(null, dest + 8L * i + baseOffset, value);
}
}

@Run(test = {"testOffHeapLong4a", "testOffHeapLong4b"})
public static void testOffHeapLong4_runner() {
baseOffset = 8;
runAndVerify3(() -> testOffHeapLong4a(baseOffHeap, longArray, 0, size-1), 8);
runAndVerify3(() -> testOffHeapLong4b(baseOffHeap, longArray, 0, size-1), 8);
}
}

0 comments on commit b21b72e

Please sign in to comment.