[foreign-memaccess+abi] RFR: 8315096: Allowed access modes in memory segment should depend on layout alignment

Maurizio Cimadamore mcimadamore at openjdk.org
Mon Aug 28 17:27:33 UTC 2023


On Mon, 28 Aug 2023 17:12:41 GMT, Paul Sandoz <psandoz at openjdk.org> wrote:

> Looks good.
> 
> I notice a subtle difference between this VH behavior and that for arrays and `ByteBuffer`, as specified by the methods on `MethodHandles`, which state:
> 
> ```
>      * <ul>
>      * <li>read write access modes for all {@code T}, with the exception of
>      *     access modes {@code get} and {@code set} for {@code long} and
>      *     {@code double} on 32-bit platforms.
> ```
> 
> I don't exactly recall why we restricted on 32-bit platforms, but it might have been because of some `Unsafe` restriction/complexity in supporting the atomicity that is required for volatile (or more generally non-plain) access (e.g., see https://shipilev.net/blog/2014/all-accesses-are-atomic/#_implementation_specifics). So we probably said well we won't support it at all, but i doubt we assert on that given 32-bit is not a system we generally focus on.

Note: I believe this text is really meant to mean: "these access modes are supported, but access is not atomic" (as in: might tear).

Which is caused by the slightly overloaded use of the letters `atomic` in the var handle javadoc.

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

PR Comment: https://git.openjdk.org/panama-foreign/pull/876#issuecomment-1696065578


More information about the panama-dev mailing list