Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Commit 0f9e11c

Browse files
Olga MikhaltsovaYuri Nesterenko
authored andcommitted
8251456: [TESTBUG] compiler/vectorization/TestVectorsNotSavedAtSafepoint.java failed OutOfMemoryError
Removed allocation of large arrays to avoid OOME. Reviewed-by: yan Backport-of: 51b3bd2c2e39fc379918d4fba325f26b2c6cd4ec
1 parent a0b1ba1 commit 0f9e11c

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

test/hotspot/jtreg/compiler/vectorization/TestVectorsNotSavedAtSafepoint.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
* @test
2727
* @bug 8193518 8249608
2828
* @summary C2: Vector registers are sometimes corrupted at safepoint
29-
* @run main/othervm -XX:-BackgroundCompilation -XX:+UseCountedLoopSafepoints -XX:LoopStripMiningIter=1000 TestVectorsNotSavedAtSafepoint test1
29+
* @run main/othervm -XX:-BackgroundCompilation -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCountedLoopSafepoints -XX:LoopStripMiningIter=2 -XX:-TieredCompilation TestVectorsNotSavedAtSafepoint test1
3030
* @run main/othervm -XX:-BackgroundCompilation TestVectorsNotSavedAtSafepoint test2
3131
*/
3232

@@ -58,10 +58,13 @@ public static void test2(int[] iArr, long[] lArr) {
5858
static class GarbageProducerThread extends Thread {
5959
public void run() {
6060
for(;;) {
61+
// Produce some garbage and then let the GC do its work which will
62+
// corrupt vector registers if they are not saved at safepoints.
6163
Object[] arrays = new Object[1024];
6264
for (int i = 0; i < arrays.length; i++) {
6365
arrays[i] = new int[1024];
6466
}
67+
System.gc();
6568
}
6669
}
6770
}
@@ -72,23 +75,20 @@ public static void main(String[] args) {
7275
garbage_producer.start();
7376

7477
if (args[0].equals("test1")) {
75-
byte[] barray = new byte[10];
76-
long[] larray1 = new long[1000];
77-
long[] larray2 = new long[100_000_000];
78-
for (int i = 0; i < 20_000; i++) {
79-
test1(barray, barray, barray, larray1, -1);
80-
}
81-
for (int i = 0; i < 100; i++) {
82-
test1(barray, barray, barray, larray2, -1);
83-
if (larray2[larray2.length-1] != -1) {
84-
System.out.println("Iter " + i + " Failed with " + Long.toHexString(larray2[larray2.length-1]));
85-
throw new RuntimeException("Test1 failed");
78+
byte[] bArr = new byte[10];
79+
long[] lArr = new long[1000];
80+
for (int i = 0; i < 10_000; ++i) {
81+
test1(bArr, bArr, bArr, lArr, -1);
82+
for (int j = 0; j < lArr.length; ++j) {
83+
if (bArr[j % 10] != 0 || lArr[j] != -1) {
84+
throw new RuntimeException("Test1 failed at iteration " + i + ": bArr[" + (j % 10) + "] = " + bArr[j % 10] + ", lArr[" + j + "] = " + lArr[j]);
85+
}
8686
}
8787
}
8888
} else {
8989
int iArr[] = new int[100];
9090
long lArr[] = new long[100];
91-
for (int i = 0; i < 600_000; ++i) {
91+
for (int i = 0; i < 10_000; ++i) {
9292
test2(iArr, lArr);
9393
for (int j = 0; j < lArr.length; ++j) {
9494
if (iArr[j] != 1 || lArr[j] != 1) {

0 commit comments

Comments
 (0)