[lworld] RFR: 8351569: [lworld] Revisit atomic access modes in flat var handles [v5]

Maurizio Cimadamore mcimadamore at openjdk.org
Thu Mar 20 18:26:20 UTC 2025


On Thu, 20 Mar 2025 18:21:59 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> This PR is an attempt to put var handle support for flat values on a more solid footing. Some more notes in a comment below.
>
> Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Tighten the signature of VarHandles::checkAtomicFlatArray

make/modules/java.base/gensrc/GensrcVarHandles.gmk line 42:

> 40: define GenerateVarHandle
> 41: 
> 42:   $1_InputType := $2

We need to do a bit of trickery here. Basically we have two pair of input values, which should use the _same_ unsafe access primitives:
* Reference, NonAtomicReference -> get/putReference
* FlatValue, NonAtomicFlatValue -> get/putFlatValue

So, we now use `InputType` to model the input type to the template, and from there we derive `Type` (which is really the Unsafe access type).

There's also some other changes:
* Not all generated classes need non-plain operations (e.g. NonAtomicReference, NonAtomicFlatValue do not)
* Not all generated classes need to handle static fields (e.g. FlatValues and NonAtomicFlatValues do not, as static fields are never flattened)
* Not all generated classes need to deal with arrays (e.g. FlatValues and NonAtomicFlatValues do not -- access to value arrays is always handled in the Reference impl class)

-------------

PR Review Comment: https://git.openjdk.org/valhalla/pull/1402#discussion_r2006216567


More information about the valhalla-dev mailing list