RFR: 8247666: Support Lambda proxy classes in static CDS archive [v4]

Calvin Cheung ccheung at openjdk.java.net
Fri Oct 9 22:49:30 UTC 2020


> Following up on archiving lambda proxy classes in dynamic CDS archive
> ([JDK-8198698](https://bugs.openjdk.java.net/browse/JDK-8198698)), this RFE adds the functionality of archiving of
> lambda proxy classes in static CDS archive.
> When the -XX:DumpLoadedClassList is enabled, the constant pool index related to LambdaMetafactory that are resolved
> during application execution will be included in the classlist. The entry for a lambda proxy class in a class list will
> be of the following format:
> `@lambda-proxy: <classname> <cp index>`
> 
> e.g.
> `@lambda-proxy: test/java/lang/invoke/MethodHandlesGeneralTest 233`
> `@lambda-proxy: test/java/lang/invoke/MethodHandlesGeneralTest 355`
> 
> When dumping a CDS archive using the -Xshare:dump and -XX:ExtraSharedClassListFile options, when the above
> `@lambda-proxy` entry is encountered while parsing the classlist, we will resolve the corresponding constant pool
> indices (233 and 355 in the above example). As a result, lambda proxy classes will be generated for the constant pool
> entries, and will be cached using a similar mechanism to JDK-8198698.  During dumping, there is check on the cp index
> and on the created BootstrapInfo using the cp index. VM will exit with an error message if the check has failed.
> During runtime when looking up a lambda proxy class, the lookup will be perform on the static CDS archive and if not
> found, then lookup from the dynamic archive if one is specified.  (Only name change (IsDynamicDumpingEnabled ->
> IsCDSDumpingEnabled) is involved in the core-libs code.)
> Testing: tiers 1,2,3,4.
> 
> Performance results (javac on HelloWorld on linux-x64):
> Results of " perf stat -r 40 bin/javac -J-Xshare:on -J-XX:SharedArchiveFile=javac2.jsa Bench_HelloWorld.java "
>    1:   2228016795  2067752708 (-160264087)      -----    377.760   349.110 (-28.650)      -----
>    2:   2223051476  2063016483 (-160034993)      -----    374.580   350.620 (-23.960)      ----
>    3:   2225908334  2067673847 (-158234487)      -----    375.220   350.990 (-24.230)      ----
>    4:   2225835999  2064596883 (-161239116)      -----    374.670   349.840 (-24.830)      ----
>    5:   2226005510  2061694332 (-164311178)      -----    373.512   351.120 (-22.392)      ----
>    6:   2225574949  2062657482 (-162917467)      -----    374.710   348.380 (-26.330)      -----
>    7:   2224702424  2064634122 (-160068302)      -----    373.670   349.510 (-24.160)      ----
>    8:   2226662277  2066301134 (-160361143)      -----    375.350   349.790 (-25.560)      ----
>    9:   2226761470  2063162795 (-163598675)      -----    374.260   351.290 (-22.970)      ----
>   10:   2230149089  2066203307 (-163945782)      -----    374.760   350.620 (-24.140)      ----
> ============================================================
>         2226266109  2064768307 (-161497801)      -----    374.848   350.126 (-24.722)      ----
> instr delta =   -161497801    -7.2542%
> time  delta =      -24.722 ms -6.5951%

Calvin Cheung has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev
excludes the unrelated changes brought in by the merge/rebase. The pull request contains seven additional commits since
the last revision:

 - Merge branch 'master' into 8247666
 - 1. Symbolic encoding of lambda proxy resolution. An example of @lambda-proxy in the classlist:
   @lambda-proxy: LambHello run ()Ljava/lang/Runnable; ()V 6 LambHello lambdabash ()V ()V
   2. Removed BadCPIndex.java; added LambdaProxyClassList.java test.
   3. Mandy's comments.
 - Merge branch 'master' into 8247666
 - exclude archived lambda proxy classes in the classlist
 - updated systemDictionaryShared.[c|h]pp based on suggestions from Ioi
 - fix extraneous whitespace
 - 8247666 (initial commit)

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/364/files
  - new: https://git.openjdk.java.net/jdk/pull/364/files/c82b39f1..09cf61c2

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=364&range=03
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=364&range=02-03

  Stats: 24905 lines in 572 files changed: 15353 ins; 6792 del; 2760 mod
  Patch: https://git.openjdk.java.net/jdk/pull/364.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/364/head:pull/364

PR: https://git.openjdk.java.net/jdk/pull/364


More information about the hotspot-runtime-dev mailing list