On Thu, 18 Jun 2026 12:58:49 GMT, Jorn Vernee <[email protected]> wrote:
>> Chen Liang has updated the pull request with a new target base due to a >> merge or a rebase. The incremental webrev excludes the unrelated changes >> brought in by the merge/rebase. The pull request contains five additional >> commits since the last revision: >> >> - Fix missing trusted final field query >> - Merge branch 'lworld' of https://github.com/openjdk/valhalla into >> fix/lw-strict-static-vh >> - Restrict write access for IMPL_LOOKUP VH on strict final >> - Merge branch 'lworld' of https://github.com/openjdk/valhalla into >> fix/lw-strict-static-vh >> - Missing strict static validation for VarHandle > > src/java.base/share/classes/java/lang/invoke/X-VarHandle.java.template line > 619: > >> 617: @ForceInline >> 618: static boolean compareAndSet(VarHandle ob, $type$ expected, >> $type$ value) { >> 619: FieldStaticReadWrite handle = (FieldStaticReadWrite) >> ob.onStaticFieldAccess(true, true); > > CompareAndSet do both a read and write, so here you pass `true, true`. This > will end up calling `notifyStrictStaticAccess` which then clears the 'unset' > bit of the field for writes. However, a CAS is not guaranteed to do a write. > Isn't that problematic? The VM would consider the field initialized after a > failed CAS. > > Would be nice if you could add a test for that. I can degrade the calls to be reporting only read for cas: after the first write, we don't really care about future writes. ------------- PR Review Comment: https://git.openjdk.org/valhalla/pull/2550#discussion_r3436455815
