On Tue, 16 Jun 2026 22:39:57 GMT, Chen Liang <[email protected]> wrote:
>> src/java.base/share/classes/java/lang/invoke/LazyInitializingVarHandle.java
>> line 72:
>>
>>> 70: VarHandle target() {
>>> 71: ensureInitialized();
>>> 72: return target;
>>
>> What about static method access? `onStaticFieldAccess` seems to be only used
>> for field access, and the regular access to the target seems to skip the
>> `ensureInitialized` check now.
>
> `target` is completely eliminated now. `IndirectVarHandle` uses `asDirect`
> before passing a VH to the implementation MH; `LazyInitializingVarHandle`
> uses `onStaticFieldAccess` or old `target` once you are within the
> implementation MH/MemberName, so the two mechanisms were quite different and
> better separated. All other VHs don't need this class initialization barrier.
Ah you're right. I'm not reading the changes correctly. (that's what I get for
trying to review this on very little sleep :/)
-------------
PR Review Comment:
https://git.openjdk.org/valhalla/pull/2550#discussion_r3428074322