RFR: 8273122: ZGC: Load forwarding entries without acquire semantics
Aleksey Shipilev
shade at openjdk.java.net
Tue Aug 31 07:53:27 UTC 2021
On Tue, 31 Aug 2021 07:21:02 GMT, Erik Österlund <eosterlund at openjdk.org> wrote:
> We usually do not relax things to rely on data dependency in C++ code, as the C++ standard gives us no guarantees that the data dependency will be retained in the generated machine code. It only gives threats that it might not work. In practice probably not, but still. So I don't know how I feel about this. Have you tried to use load consume instead? If that yields the same improvement, we can incorporate load_consume into HotSpot. I think that is an interesting experiment worth running first.
FWIW, Shenandoah faces a similar thing (see #2496), but in a different direction: it started with "relaxed" for fwdptr accesses. Bumping that up to "acquire" for GC code costs quite a bit. I think I convinced myself (to be fair, with a significant amount of handwaving) that while dangerous, it still works. Yes, "consume" would be nice as the additional safety measure, but I don't think any current C++ compiler properly implements it, and instead it bumps "consume" to "acquire", leaving you at the same performance place. That is to say that "consume" experiments might be futile at this moment.
-------------
PR: https://git.openjdk.java.net/jdk/pull/5298
More information about the hotspot-gc-dev
mailing list