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

John R Rose jrose at openjdk.org
Sat Jan 24 01:21:04 UTC 2026


On Fri, 23 Jan 2026 20:08:58 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 incrementally with one additional commit since the last revision:
> 
>   Wording update, thanks Jorn

Good work.  I’m assuming you will address my previous comments.

src/java.base/share/classes/java/lang/invoke/SegmentVarHandle.java line 69:

> 67:     @Override
> 68:     boolean isReachableFrom(ClassLoader cl) {
> 69:         return true;

Give a comment explaining why this is correct.  Something like:  The segment is neither an instance nor an array, so it is effectively common to all class loaders.  Compare this to a class on the boot class loader, which also uses only types that are common reachable from all other class loaders.  (Or something like that.)

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

Marked as reviewed by jrose (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/28585#pullrequestreview-3700343726
PR Review Comment: https://git.openjdk.org/jdk/pull/28585#discussion_r2723372435


More information about the hotspot-compiler-dev mailing list