RFR: 8160821: VarHandle accesses are penalized when argument conversion is required [v3]
Per Minborg
pminborg at openjdk.org
Tue Dec 2 09:31:03 UTC 2025
On Mon, 1 Dec 2025 23:41:04 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:
>
> Tweak VH usage in some classes
src/java.base/share/classes/java/lang/invoke/VarHandle.java line 2036:
> 2034: var constant = MethodHandleImpl.isCompileConstant(vh);
> 2035: var cache = adaptedMh;
> 2036: if (constant == MethodHandleImpl.CONSTANT_YES && cache != null) {
Rookie question: Is there multi-thread considerations here? How about visibility across threads?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28585#discussion_r2580353068
More information about the hotspot-compiler-dev
mailing list