-
Bug
-
Resolution: Unresolved
-
P4
-
11, 17, 21, 25
The code
```java
public class C {
final static int N = 3_000_000;
public static void test(int i) {
try {
new StringBuilder((int)(-i));
} catch (Throwable e) {
}
}
public static void loop() {
for (int i = 0; i < N; i++) {
test(i);
}
}
public static void main(String[] args) {
loop();
}
}
```
performs much worse with C2 (about 17s) that C1 or Interpreter (about 4s).
Probably a cycle of deopt and re-execution because of repeated exception throwing.
Originally reported in a comment ofJDK-8346989.
```java
public class C {
final static int N = 3_000_000;
public static void test(int i) {
try {
new StringBuilder((int)(-i));
} catch (Throwable e) {
}
}
public static void loop() {
for (int i = 0; i < N; i++) {
test(i);
}
}
public static void main(String[] args) {
loop();
}
}
```
performs much worse with C2 (about 17s) that C1 or Interpreter (about 4s).
Probably a cycle of deopt and re-execution because of repeated exception throwing.
Originally reported in a comment of
- relates to
-
JDK-8346989 C2: deoptimization and re-execution cycle with Math.*Exact in case of frequent overflow
-
- Resolved
-