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

Chen Liang liach at openjdk.org
Fri Mar 21 19:24:33 UTC 2025


On Fri, 21 Mar 2025 19:02:30 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 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 16 additional commits since the last revision:
> 
>  - Address review commments
>  - Simplify Unsafe::compareAndSetFlatValueAsBytes to use new unsafe flat array creation primitive
>  - Merge branch 'lworld' into varhandle_flat
>  - Add missing `@ForceInline`
>  - Update src/java.base/share/classes/jdk/internal/misc/Unsafe.java
>    
>    Co-authored-by: Chen Liang <liach at openjdk.org>
>  - Update src/java.base/share/classes/jdk/internal/misc/Unsafe.java
>    
>    Co-authored-by: Chen Liang <liach at openjdk.org>
>  - Tighten the signature of VarHandles::checkAtomicFlatArray
>  - Avoid dynamic var handle creation in the middle of array element access
>  - Fix test header
>  - Enhance compareAndSetFlatValueAsBytes to work on different kinds of flat arrays
>    Cache result of oop-free analysis
>    Beef up tests to check different combinations of VM flags
>  - ... and 6 more: https://git.openjdk.org/valhalla/compare/1c6416bf...000917a3

src/java.base/share/classes/jdk/internal/misc/Unsafe.java line 3288:

> 3286: 
> 3287:     public Object getAndSetFlatValue(Object o, long offset, int layoutKind, Class<?> valueType, Object newValue) {
> 3288:         Object v;

Suggestion:


    @ForceInline
    public Object getAndSetFlatValue(Object o, long offset, int layoutKind, Class<?> valueType, Object newValue) {
        Object v;

Just because how stupid github comment thread is :(

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

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


More information about the valhalla-dev mailing list