RFR: 8160821: VarHandle accesses are penalized when argument conversion is required [v9]
Emanuel Peter
epeter at openjdk.org
Wed Dec 10 07:38:33 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/edba0887...d734e8a6
Was asked on slack to review IR tests, so that's all I'm doing here - won't review the whole patch ;)
test/hotspot/jtreg/compiler/c2/irTests/constantFold/VarHandleMismatchedTypeFold.java line 2:
> 1: /*
> 2: * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
We want to eventually migrate all tests from `c2/irTests` to more "topic based" directories, so it would be great if you already migrated them now, since you probably would know a better name/place now already ;)
test/hotspot/jtreg/compiler/c2/irTests/constantFold/VarHandleMismatchedTypeFold.java line 41:
> 39: * @summary Verify constant folding is possible for mismatched VarHandle access
> 40: * @library /test/lib /
> 41: * @requires vm.compiler2.enabled
What would happen if you removed this? Is the test expected to fail anywhere? IR rules are executed only if C2 is available anyway, so probably you don't need this restriction.
-------------
Changes requested by epeter (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/28585#pullrequestreview-3561137086
PR Review Comment: https://git.openjdk.org/jdk/pull/28585#discussion_r2605521507
PR Review Comment: https://git.openjdk.org/jdk/pull/28585#discussion_r2605526968
More information about the core-libs-dev
mailing list