RFR: 8275874: [JVMCI] use volatile accessors for aligned reads in c2v_readFieldValue [v2]

Aleksey Shipilev shade at openjdk.java.net
Tue Oct 26 14:20:11 UTC 2021


On Tue, 26 Oct 2021 13:55:43 GMT, Doug Simon <dnsimon at openjdk.org> wrote:

>> [JDK-8275645](https://bugs.openjdk.java.net/browse/JDK-8275645) resulted in loosing single-copy atomicity for reads in `c2v_readFieldValue`. This PR fixes that by using `<type>_field_acquire` accessors for all aligned reads and only using `<type>_field` accessors for unaligned reads.
>
> Doug Simon has updated the pull request incrementally with one additional commit since the last revision:
> 
>   restrict c2v_readFieldValue to only perform aligned reads

Thank you, this looks much safer to me. A few minor nits below.

Also, synopsis had once again diverged from the direction this PR is going.

src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.meta/src/jdk/vm/ci/meta/MemoryAccessProvider.java line 40:

> 38:      * @throws IllegalArgumentException if the read is out of bounds of the object or {@code kind}
> 39:      *             is {@link JavaKind#Void} or not {@linkplain JavaKind#isPrimitive() primitive}
> 40:      *             kind or {@code bits} is not 8, 16, 32 or 64 or the read is unaligned

Suggestion:

     *             kind or {@code bits} is not 8, 16, 32 or 64, or the read is unaligned

(not sure about this, but feels better with additional comma)

test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.hotspot.test/src/jdk/vm/ci/hotspot/test/MemoryAccessProviderData.java line 84:

> 82:     }
> 83:     @DataProvider(name = "unalignedPrimitive")
> 84:     public static Object[][] getUnalingedPrimitiveJavaKinds() {

Suggestion:

    public static Object[][] getUnalignedPrimitiveJavaKinds() {

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

Marked as reviewed by shade (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/6109


More information about the hotspot-compiler-dev mailing list