RFR(XS): 8230434: [C1, C2] Release barrier for volatile field stores in constructors implemented inconsistently

Andrew Haley aph at redhat.com
Wed Sep 11 09:14:11 UTC 2019


On 9/11/19 9:35 AM, Andrew Haley wrote:

> "Programmers do not expect that even though final fields are
> specifically publication-safe, volatile fields are not always
> so. For various implementation reasons, most JVMs arrange that
> volatile fields are publication safe anyway. We do the same here to
> avoid surprises."

Hmm, and, thinking some more, I wonder if AArch64 needs this too. It
probably does, because even though AArch64 is (sort of) multi-copy
atomic I don't think there's anything to disallow a plain store from
floating above a volatile store. Having said that, we've never
observed any failures, but perhaps that's because implementations of
AArch64 are stronger than the spec requires.

Thank you for raising this issue.  :-)

-- 
Andrew Haley  (he/him)
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
https://keybase.io/andrewhaley
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671


More information about the hotspot-compiler-dev mailing list