RFR: 8273122: ZGC: Load forwarding entries without acquire semantics
Erik Österlund
eosterlund at openjdk.java.net
Tue Aug 31 11:28:30 UTC 2021
On Tue, 31 Aug 2021 09:02:32 GMT, Florian Weimer <fweimer at openjdk.org> wrote:
> As far as I know, Hotspot does not consistently use C++ atomics, so whether the compiler implements consume-as-acquire or any other aspect of the C++ memory model not does not really matter. Consequently, the code is full of undefined data races as far as the compiler is concerned. Compiler writers are aware of that and generally avoid optimizations that would break this memory-model-in-a-library approach (although there is of course no language specification that actually guarantees this).
>
> I think that historically, the approach has been that when compiler optimizations make things go wrong, some sort of compiler barrier is added to the code. I assume the same thing could be done to implement an approximation to consume semantics.
We have not had access to C++ atomics for a long time. It's only rather recently that we upgraded past C++11. So I don't think the question of consume or acquire is irrelevant. If consume was to magically do what we want, in a way that is more standards compliant, then it would be a compelling reason to start upgrading our atomics. Given of course, that consume actually does do something other than to just bind to acquire.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5298
More information about the hotspot-gc-dev
mailing list