RFR: 8310939: [c1] The visibility of write-volatile requires membar_volatile instead of membar
Andrew Haley
aph at openjdk.org
Mon Jul 24 13:26:51 UTC 2023
On Tue, 27 Jun 2023 12:46:14 GMT, SUN Guoyun <duke at openjdk.org> wrote:
> For c1 now, a volatile write case:
>
> membar_release // LoadStore | StoreStore
> write volatile
> membar
>
> Just like c2, here `membar` should be defined `membar_volatile` clearly, then for risc-v, ppc and loongarch can use StoreLoad for `membar_volatile` for better performance.
>
> Testing:
> GHA testing
> jtreg tier1-3 for loongarch64
For a little more clarity: let's imagine that you wanted to have a sequentially-consistent set of stores and loads, using plain memory accesses and fences.
This would work:
str r1, [x1] ; fullFence; ldr r1, [x1]; fullFence; str r1, [x2]; fullFence; ldr r1, [x2]
but this would not:
str r1, [x1] ; storeLoad; ldr r1, [x1]; storeLoad; str r1, [x2]; storeLoad; ldr r1, [x2]
This is why I wouldn't call storeLoad "membar_volatile".
-------------
PR Comment: https://git.openjdk.org/jdk/pull/14677#issuecomment-1647903628
More information about the hotspot-gc-dev
mailing list