RFR: 8308899: Introduce Classfile.Context and improve Classfile.Option(s) [v16]

Adam Sotona asotona at openjdk.org
Tue Jun 13 12:09:58 UTC 2023


On Tue, 13 Jun 2023 11:32:59 GMT, Adam Sotona <asotona at openjdk.org> wrote:

>> Classfile context object and multi-state options have been discussed at https://mail.openjdk.org/pipermail/classfile-api-dev/2023-May/000321.html
>> This patch implements the proposed changes in Classfile API and fixes all affected code across JDK sources and tests.
>> 
>> Please review.
>> 
>> Thanks,
>> Adam
>
> Adam Sotona has updated the pull request incrementally with one additional commit since the last revision:
> 
>   ClassHierarchyResolver.DEFAULT_RESOLVER gets info from system class loader and does not cache
>   method-level caching is enabled if the provided resolver is not already cached

All the performance regressions have been found and fixed.
Stackmaps generation logic is following:
- `STACK_MAPS_WHEN_REQUIRED` is the default option and performance-critical. It keeps original stack maps if code match and generate them only when required.
- `STACK_MAPS_ALWAYS` always (re)generate stack maps no matter if exist in the original
- `STACK_MAPS_NEVER` stack maps are not generated and dropped if already exist

Naming convention can be still adjusted.

Default `ClassHierarchyResolver` now use reflection from system class loader and it is not globally cached (so no dilemma about CHM vs HM). Any CHR is cached on method level if not already cached.

Benchmarks comparison of this PR vs master now shows even slight improvement:

Benchmark                                  (transform)    master  this PR Units
AdHocAdapt.transform                              LIFT     8.704    9.629 ops/s
AdHocAdapt.transform                             LIFT1     8.622    9.275 ops/s
AdHocAdapt.transform                             LIFT2     9.257    9.378 ops/s
AdaptInjectNoop.transform                   NOP_SHARED     4.709    4.978 ops/s
AdaptNull.transform                           SHARED_1    96.686   98.027 ops/s
AdaptNull.transform                           SHARED_2    48.820   49.257 ops/s
AdaptNull.transform                           SHARED_3     9.611    9.691 ops/s
AdaptNull.transform                  SHARED_3_NO_DEBUG    12.218   12.343 ops/s
AdaptNull.transform                         UNSHARED_3     3.614    3.603 ops/s
ParseOptions.transformNoDebug                      N/A    11.169   11.084 ops/s
ParseOptions.transformNoLineNumbers                N/A    10.590   10.523 ops/s
ParseOptions.transformNoStackmap                   N/A     6.220    9.646 ops/s

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

PR Comment: https://git.openjdk.org/jdk/pull/14180#issuecomment-1589174024


More information about the core-libs-dev mailing list