RFR: 8160821: VarHandle accesses are penalized when argument conversion is required [v9]
Christian Hagedorn
chagedorn at openjdk.org
Wed Dec 10 08:09:27 UTC 2025
On Mon, 8 Dec 2025 19:10:48 GMT, Chen Liang <liach at openjdk.org> wrote:
>> Since access descriptor is created for each VH operation site, we can optimistically cache the adapted method handle in a site if the site operates on a constant VH. Used a C2 IR test to verify such a setup through an inexact VarHandle invocation can be constant folded through (previously, it was blocked by `asType`)
>
> Chen Liang 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 17 additional commits since the last revision:
>
> - Review
> - Merge branch 'master' of https://github.com/openjdk/jdk into fix/vh-adapt-cache
> - Bugs and verify loader leak
> - Try to avoid loader leak
> - Merge branch 'master' of https://github.com/openjdk/jdk into fix/vh-adapt-cache
> - Revert void special case removal due to C2 shortage causing TestZGCBarrierElision::testAtomicThenAtomicAnotherField failure
> - Test from Jorn
> - Copyright years
> - Fix problem identified by Jorn
> - Rollback getAndAdd for now
> - ... and 7 more: https://git.openjdk.org/jdk/compare/45fb0e07...d734e8a6
test/hotspot/jtreg/compiler/c2/irTests/constantFold/VarHandleMismatchedTypeFold.java line 70:
> 68:
> 69: @Check(test = "testSum")
> 70: public void runTestSum() {
Drive-by comment: From the method name, it seems that you want to have a runner method. For that, you need to switch to `@Run`. But you can also do result verification with `@Check`. In the latter case, you do not need to call `testSum()` again but you can just add a `long result` as parameter. The IR framework will then call this `@Check` method with the result of `testSum()`.
Example:
https://github.com/openjdk/jdk/blob/1bbbce75c5e68429c2a32519eb3c36d964dcdf57/test/hotspot/jtreg/testlibrary_tests/ir_framework/examples/CheckedTestExample.java#L94-L102
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28585#discussion_r2605606400
More information about the core-libs-dev
mailing list