8073735: compiler/loopopts/CountedLoopProblem.java got OOME

Ignore OOM in the test

Reviewed-by: kvn
This commit is contained in:
Igor Veresov 2015-02-24 23:31:00 -08:00
parent 24be5c951c
commit 14cf940405

View File

@ -36,18 +36,22 @@ public class CountedLoopProblem {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
Random r = new Random(42); Random r = new Random(42);
int x = 0; int x = 0;
StringBuilder sb = new StringBuilder(); try {
for(int i = 0; i < 1000000; ++i) { StringBuilder sb = new StringBuilder();
int v = Math.abs(r.nextInt()); for(int i = 0; i < 1000000; ++i) {
sb.append('+').append(v).append('\n'); int v = Math.abs(r.nextInt());
x += v; sb.append('+').append(v).append('\n');
// To trigger the problem we must OSR in the following loop x += v;
// To make the problem 100% reproducible run with -XX:-TieredCompilation -XX:OSROnlyBCI=62 // To trigger the problem we must OSR in the following loop
while(x < 0) x += 1000000000; // To make the problem 100% reproducible run with -XX:-TieredCompilation -XX:OSROnlyBCI=62
sb.append('=').append(x).append('\n'); while(x < 0) x += 1000000000;
} sb.append('=').append(x).append('\n');
if (sb.toString().hashCode() != 0xaba94591) { }
throw new Exception("Unexpected result"); if (sb.toString().hashCode() != 0xaba94591) {
throw new Exception("Unexpected result");
}
} catch(OutOfMemoryError e) {
// small heap, ignore
} }
} }
} }