RFR: 8160821: VarHandle accesses are penalized when argument conversion is required [v3]
Vladimir Ivanov
vlivanov at openjdk.org
Tue Dec 2 02:08:44 UTC 2025
On Tue, 2 Dec 2025 01:52:04 GMT, Chen Liang <liach at openjdk.org> wrote:
>> 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.
Ok, so you eliminated a fast-path check for void-return case and now JIT can't fully optimize it anymore. Do I get it right? Since this particular bytecode shape is exposed through public API, I don't see why user code can't step on it.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28585#discussion_r2579341027
More information about the hotspot-dev
mailing list