RFR: 8160821: VarHandle accesses are penalized when argument conversion is required [v3]
Chen Liang
liach at openjdk.org
Tue Dec 2 01:54:46 UTC 2025
On Tue, 2 Dec 2025 01:48:13 GMT, Vladimir Ivanov <vlivanov at openjdk.org> wrote:
>> The performance is measured by the existing `org.openjdk.bench.java.lang.invoke.VarHandleExact` benchmark, which originally expects `generic_genericInvocation` to be much slower. Now it instead has a performance on par with the exact invocations.
>>
>> The constant folding ability is verified with the new `VarHandleMismatchedTypeFold` IR test.
>
> If I understand the IR test logic correctly, C2 was able to compile `(void) B.getAndAdd(b2)` call down to the desired instruction sequence. Is it still the case after the fix? What happens if you keep `TestGetAndAdd.java
> ` intact?
No. The old code worked because it implicitly depended on the backdoor path present in the now removed `GUARD_METHOD_TEMPLATE_V` in `VarHandleGuardMethodGenerator`. If this test is intact, now its IR compiles to doing something in adaptedMethodHandle and calling a MethodHandle. Not sure why it doesn't inline through that MethodHandle.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28585#discussion_r2579310315
More information about the hotspot-compiler-dev
mailing list