-
Bug
-
Resolution: Fixed
-
P3
-
11, 15
-
b26
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8247553 | 11.0.9-oracle | Roland Westrelin | P3 | Resolved | Fixed | b01 |
JDK-8246748 | 11.0.9 | Roland Westrelin | P3 | Resolved | Fixed | b01 |
public class TestBadControlLoopLimitCheck {
public static void main(String[] args) {
int[] array = {0, 0};
for (int i = 0; i < 20_000; i++) {
test(array, 0, 10, false);
test_helper(42);
}
}
private static int test(int[] a, int start, int stop, boolean flag) {
int[] b = new int[2]; // non escaping allocation
System.arraycopy(a, 0, b, 0, 2); // optimized out
int v = 1;
int j = 0;
for (; j < 10; j++);
int inc = test_helper(j); // delay transformation to counted loop
// loop limit check here has loads pinned on unc branch
for (int i = start; i < stop; i += inc) {
v *= 2;
}
if (flag) {
v += b[0] + b[1];
}
return v;
}
static int test_helper(int j) {
return j == 10 ? 10 : 1;
}
}
fails with:
java -XX:-BackgroundCompilation -XX:ArrayCopyLoadStoreMaxElem=0 TestBadControlLoopLimitCheck
public static void main(String[] args) {
int[] array = {0, 0};
for (int i = 0; i < 20_000; i++) {
test(array, 0, 10, false);
test_helper(42);
}
}
private static int test(int[] a, int start, int stop, boolean flag) {
int[] b = new int[2]; // non escaping allocation
System.arraycopy(a, 0, b, 0, 2); // optimized out
int v = 1;
int j = 0;
for (; j < 10; j++);
int inc = test_helper(j); // delay transformation to counted loop
// loop limit check here has loads pinned on unc branch
for (int i = start; i < stop; i += inc) {
v *= 2;
}
if (flag) {
v += b[0] + b[1];
}
return v;
}
static int test_helper(int j) {
return j == 10 ? 10 : 1;
}
}
fails with:
java -XX:-BackgroundCompilation -XX:ArrayCopyLoadStoreMaxElem=0 TestBadControlLoopLimitCheck
- backported by
-
JDK-8246748 "Bad graph detected in build_loop_late" when loads are pinned on loop limit check uncommon branch
-
- Resolved
-
-
JDK-8247553 "Bad graph detected in build_loop_late" when loads are pinned on loop limit check uncommon branch
-
- Resolved
-