On Wed, 24 Jun 2026 13:13:43 GMT, Viktor Klang <[email protected]> wrote:
>> 1. `weakCompareAndSetReferenceXxx` in `Unsafe` were delegating to wrong >> methods >> 2. Replace use of `0` for reference layout with `Unsafe.NON_FLAT_LAYOUT` >> 3. Replace use of `31 - Integer.numberOfLeadingZeros(ascale)` with >> `numberOfTrailingZeros` >> 4. Remove null check for VarHandle getting from NR fields (parity with >> ArrayVarHandle and DirectMethodHandle), add missing null check for flat >> value var handles >> 5. Remove the weird directives and old flags of RecursiveValueClass >> >> Thanks to @JornVernee and @AlanBateman for spotting these issues. >> >> --------- >> - [x] I confirm that I make this contribution in accordance with the >> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai). > > src/java.base/share/classes/jdk/internal/misc/Unsafe.java line 1854: > >> 1852: V x) { >> 1853: if (isValueObject(valueType, expected)) { >> 1854: return compareAndSetReference(o, offset, valueType, >> expected, x); > > My preference would be that all of the accesses that are stronger than > necessary have a small comment stating that they are stronger than necessary > until an appropriately-weaker implementation is added. This is to make it > clear that the code is intentional, and under which circumstances it > could/should change. Sure. I think we did not go for that before because we have things like "storeStoreFence" deferring to stronger "storeFence" or "fullFence" without comments, but more comments would always be good. ------------- PR Review Comment: https://git.openjdk.org/valhalla/pull/2576#discussion_r3467685822
