JDK-8212670 : [Graal] 30% regression to C2 on MethodHandlesGuardWithTest.testInvoke
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: compiler
  • Affected Version: 12
  • Priority: P4
  • Status: Closed
  • Resolution: Cannot Reproduce
  • Submitted: 2018-10-18
  • Updated: 2019-03-04
  • Resolved: 2018-12-14
Related Reports
Relates :  
Description
The open corpus of JMH micros is a maven project here: http://hg.openjdk.java.net/code-tools/jmh-jdk-microbenchmarks

On the MethodHandlesGuardWithTest.testInvoke the performance of Graal is about 30% slower than C2 with default flags, on one test system with 12-b15:

C2:
Benchmark                              Mode  Cnt  Score   Error  Units
MethodHandlesGuardWithTest.testInvoke  avgt   10  9.194 ��� 0.095  ns/op
Graal:
MethodHandlesGuardWithTest.testInvoke  avgt   10  11.711 ��� 0.200  ns/op

Here C2 uses the _profileBoolean intrinsic, but C2 also has slightly better performance than Graal even when it is disabled with "-XX:+UnlockDiagnosticVMOptions -XX:DisableIntrinsic=_profileBoolean":

MethodHandlesGuardWithTest.testInvoke  avgt   15  10.268 ��� 0.035  ns/op

We would like to see if the _profileBoolean intrinsic could be adapted to Graal to improve the performance.
Comments
I will add ongoing MH testing to see if there is a real problem here.
14-12-2018

Eric, there was a fix for this in JDK-8214023. Can you check if there's still a regression?
12-12-2018

Run only this specific benchmark like this: java -jar target/jmh-jdk-microbenchmarks-1.0-SNAPSHOT.jar MethodHandlesGuardWithTest.testInvoke
19-10-2018