On Mon, 1 Dec 2025 23:41:04 GMT, Chen Liang <[email protected]> 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 2033:
> 2031:
> 2032: @ForceInline
> 2033: MethodHandle adaptedMethodHandle(VarHandle vh) {
Can you elaborate, please, how this method is intended to behave?
test/hotspot/jtreg/compiler/c2/irTests/TestGetAndAdd.java line 78:
> 76: @IR(counts = {IRNode.X86_LOCK_XADDB, "3"}, phase =
> CompilePhase.FINAL_CODE)
> 77: public static void addB() {
> 78: var _ = (byte) B.getAndAdd(b2);
> Since I removed the return type dropping VarHandle bypass, TestGetAndAdd
> became affected because it can no longer access the x86 assembly.
It has performance implications for user code, doesn't it?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/28585#discussion_r2579149358
PR Review Comment: https://git.openjdk.org/jdk/pull/28585#discussion_r2579150006