JDK-8058319 : No value profile for receivers: constructor MethodHandle invocation is very slow
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.lang.invoke
  • Affected Version: 8u40,9
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2014-09-12
  • Updated: 2014-09-12
  • Resolved: 2014-09-12
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9Resolved
Related Reports
Duplicate :  
Description
Originally reported here:
 https://twitter.com/junkdogAP/status/510414300587261952

Remeasuring with:
 http://cr.openjdk.java.net/~shade/8058319/ConstructorBenchmark.java
 http://cr.openjdk.java.net/~shade/8058319/benchmarks.jar

...and current jdk9-dev (with LF caching already here) yields:

 - create_handle               25.301 +- 3.162  ops/us
 - create_handle_unreflect       25.424 +- 0.967  ops/us
 - create_plain                 203.557 +-  33.607  ops/us
 - create_reflect              80.443 +- 6.504  ops/us

Perfasm profiles for plain/reflect cases are relatively clean:
 http://cr.openjdk.java.net/~shade/8058319/create_plain.perfasm
 http://cr.openjdk.java.net/~shade/8058319/create_reflect.perfasm

We seem to blow inlining in MH cases:
 http://cr.openjdk.java.net/~shade/8058319/create_handle.perfasm
 http://cr.openjdk.java.net/~shade/8058319/create_handle_unreflect.perfasm
Comments
Indeed, "static final"-s inline perfectly. Please link this to value profiling RFE, if any?
12-09-2014

Yes, as Paul said. We need value profiling for receivers to make inlining works.
12-09-2014

Try making those MHs static final: instance fields Benchmark Mode Samples Score Score error Units v.ConstructorBenchmark.create_handle thrpt 20 35.562 0.281 ops/us v.ConstructorBenchmark.create_handle_unreflect thrpt 20 35.483 0.508 ops/us v.ConstructorBenchmark.create_plain thrpt 20 372.399 3.847 ops/us v.ConstructorBenchmark.create_reflect thrpt 20 144.358 2.030 ops/us static final fields Benchmark Mode Samples Score Score error Units v.ConstructorBenchmark.create_handle thrpt 20 368.700 3.656 ops/us v.ConstructorBenchmark.create_handle_unreflect thrpt 20 369.923 4.277 ops/us v.ConstructorBenchmark.create_plain thrpt 20 368.828 5.597 ops/us v.ConstructorBenchmark.create_reflect thrpt 20 147.457 2.065 ops/us Then things will inline.
12-09-2014