Skip to content

Commit 6b2fe5a

Browse files
committed
section about missing CHA causing slowdown
1 parent 4318d83 commit 6b2fe5a

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

blog/_posts/2016-07-08-trait-method-performance.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,18 @@ Again, the problem seems to be that the JIT compiler does not know that two regi
456456
same memory address for object `c`. The unfolded loop also uses a lot of registers, it even seems to
457457
make use of SSE registers (`%xmm1`, ...) as 32 bit registers.
458458

459+
#### And CHA, again
460+
461+
[Aleksey Shipilёv](https://twitter.com/shipilev) kindly took a look at the example and managed to
462+
narrow it down further. Using the JVM option `-XX:-UseCHA`, he observed that the C2 compiler
463+
generates the slower bytecode (with two memory accesses per iteration) also for virtual methods when
464+
CHA is disabled. This was reported in a [new ticket](https://bugs.openjdk.java.net/browse/JDK-8161334).
465+
466+
This limitation may be accidential, i.e., the loop optimizer should probably perform the same no
467+
matter if inlining was CHA- or profile-based. But the example shows that for now, the lack of CHA
468+
for default methods causes optimizations (other than inlining) to fail, which may result in
469+
significant slowdowns.
470+
459471
## Summary
460472

461473
We found a few interesting behaviors of the JVM optimizer.

0 commit comments

Comments
 (0)