RFR: 8160821: VarHandle accesses are penalized when argument conversion is required

Chen Liang liach at openjdk.org
Mon Dec 1 20:27:07 UTC 2025


On Mon, 1 Dec 2025 20:09:38 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`)

java.lang.invoke tests all pass. New benchmark results for `VarHandleExact`:

Benchmark                                 Mode  Cnt  Score   Error  Units
VarHandleExact.exact_exactInvocation      avgt   30  0.380 ± 0.007  ns/op
VarHandleExact.generic_exactInvocation    avgt   30  0.389 ± 0.008  ns/op
VarHandleExact.generic_genericInvocation  avgt   30  0.384 ± 0.008  ns/op

Submitting internal CI runs.

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

PR Comment: https://git.openjdk.org/jdk/pull/28585#issuecomment-3598661038


More information about the hotspot-dev mailing list