Try to intrinsify MethodHandles.arrayConstructor for java.lang, 
java.lang.invoke, and java.util types, which InvokerBytecodeGenerator can refer 
to directly in a class constant.

In fact, the performance difference of Array.newInstance and anewarray is quite 
negligible per benchmark:

Benchmark                                                            Mode  Cnt  
   Score     Error  Units
MethodHandlesArrayConstructorCall.baselineConstruct                  avgt    5  
   3.467 ±   0.163  ns/op
MethodHandlesArrayConstructorCall.constantFoldConstruct              avgt    5  
   3.403 ±   0.070  ns/op
MethodHandlesArrayConstructorCall.constantFoldNonInvocableConstruct  avgt    5  
   3.445 ±   0.231  ns/op
MethodHandlesArrayConstructorCall.instanceConstruct                  avgt    5  
   4.034 ±   0.168  ns/op
MethodHandlesArrayConstructorCall.instanceNonInvocableConstruct      avgt    5  
   4.038 ±   0.104  ns/op
MethodHandlesArrayConstructorColdStart.testCreateInvocable             ss   10  
1425.991 ± 308.216  us/op
MethodHandlesArrayConstructorColdStart.testCreateNonInvocable          ss   10  
1401.480 ± 258.402  us/op
MethodHandlesArrayConstructorColdStart.testCreateObject                ss   10  
1213.018 ± 166.522  us/op
MethodHandlesArrayConstructorColdStart.testCreatePrimitive             ss   10  
1163.461 ± 178.549  us/op

-------------

Commit messages:
 - message
 - fix wrong types
 - micro problems
 - Add partial intrinsic for array constructors

Changes: https://git.openjdk.org/jdk/pull/13735/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=13735&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8156916
  Stats: 241 lines in 6 files changed: 221 ins; 5 del; 15 mod
  Patch: https://git.openjdk.org/jdk/pull/13735.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/13735/head:pull/13735

PR: https://git.openjdk.org/jdk/pull/13735

Reply via email to