-
Enhancement
-
Resolution: Fixed
-
P3
-
8, 9, 10, 11, 12, 13
-
b07
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8228920 | 12u-cpu | Vladimir Ivanov | P3 | Resolved | Fixed | master |
JDK-8222646 | 12.0.2 | Vladimir Ivanov | P3 | Resolved | Fixed | b03 |
JDK-8226501 | 11.0.5-oracle | Vladimir Ivanov | P3 | Resolved | Fixed | b02 |
JDK-8222868 | 11.0.4 | Vladimir Ivanov | P3 | Resolved | Fixed | b01 |
FULL PRODUCT VERSION :
java version "9-ea"
Java(TM) SE Runtime Environment (build 9-ea+170)
Java HotSpot(TM) 64-Bit Server VM (build 9-ea+170, mixed mode)
A DESCRIPTION OF THE PROBLEM :
Below is a small test case in which JIT compiler produces a very slow code even in comparison with interpreter.
The first 30-40 iterations of outer cycle runs quite fast, 2-3 ms each. Further it begins to degrade hundreds of times up do 600-1000 ms.
With -Xcomp option it works slowly from the very beginning.
Reproduced always on x64 JVM and with -server option on x86 JVM.
Reproduced on Java 8_05 as well. Didn't tested on Java 7.
The presence of lambda does not affect reproducibility, the code just shorter.
I associate the bug with the C2 compiler.
THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: No
THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Yes
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the attached source sode.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class Test {
static int n;
static {
Runnable r = () -> n = new Integer(0);
for (int i=0; i<1000; ++i) {
long t = System.currentTimeMillis();
for (int j=0; j<100000; ++j) {
r.run();
}
t = System.currentTimeMillis() - t;
System.out.printf("%2d %6d\n", i, t);
}
}
public static void main(String[] args) {
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Do not put the code in a static section.
java version "9-ea"
Java(TM) SE Runtime Environment (build 9-ea+170)
Java HotSpot(TM) 64-Bit Server VM (build 9-ea+170, mixed mode)
A DESCRIPTION OF THE PROBLEM :
Below is a small test case in which JIT compiler produces a very slow code even in comparison with interpreter.
The first 30-40 iterations of outer cycle runs quite fast, 2-3 ms each. Further it begins to degrade hundreds of times up do 600-1000 ms.
With -Xcomp option it works slowly from the very beginning.
Reproduced always on x64 JVM and with -server option on x86 JVM.
Reproduced on Java 8_05 as well. Didn't tested on Java 7.
The presence of lambda does not affect reproducibility, the code just shorter.
I associate the bug with the C2 compiler.
THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: No
THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Yes
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the attached source sode.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class Test {
static int n;
static {
Runnable r = () -> n = new Integer(0);
for (int i=0; i<1000; ++i) {
long t = System.currentTimeMillis();
for (int j=0; j<100000; ++j) {
r.run();
}
t = System.currentTimeMillis() - t;
System.out.printf("%2d %6d\n", i, t);
}
}
public static void main(String[] args) {
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Do not put the code in a static section.
- backported by
-
JDK-8222646 C2: Static field accesses in clinit can trigger deoptimizations
- Resolved
-
JDK-8222868 C2: Static field accesses in clinit can trigger deoptimizations
- Resolved
-
JDK-8226501 C2: Static field accesses in clinit can trigger deoptimizations
- Resolved
-
JDK-8228920 C2: Static field accesses in clinit can trigger deoptimizations
- Resolved
- relates to
-
JDK-8219233 3x performance drop for some Clojure applications
- Resolved
-
JDK-8192070 Deoptimization performance degraded on x86 after AVX-512 support was added
- Open
(1 relates to)