RFR(S): 8087341: C2 doesn't optimize redundant memory operations with G1

Andrew Dinn adinn at redhat.com
Fri Feb 12 11:25:44 UTC 2016

On 12/02/16 10:49, Andrew Haley wrote:
> On 12/02/16 10:42, Andrew Dinn wrote:
>> A review from an AArch64 reviewer would be welcome.
> Crikey.  Well, it looks okay, but wow... :-)

well, yes . . . wow! But then again, this is what we had to expect when
we decided to rely on matching subgraph shapes in the back end -- a
change to the details of how stores are generated in generic code will
have implications for the back end.

The flip side of this is twofold. Firstly, changes of this sort will
always be few and far between. Secondly, Roland's change has simplified
something that was over-complex in the first place; this has not only
unlatched some generic optimizations that should have just worked but
also, by the same token, reduced the complexity of the AArch64 back end

> One question: if those code fails because of a different shape of
> ideal graph than it expects, all that happens is slightly suboptimal
> code, right?

Not quite. Roland's change without the AArch64 patch triggered an assert
during CAS generation when the expected subgraph was not found.

Also, the current code is not built to expect whatever barrier
Shenandoah might insert. It ought to fall into much the same case as G1
and CMS + CondCardMark (depending upon how the GC barriers are
generated). However, a check which folds Shenandoah into the same bucket
as those two still needs explicitly wiring in.

This patch is probably a better place to start from than the previous
version in order to add that case handling. Roland's fix decouples the
effects of the GC barrier from the ones associated with oop updates.
That means that following this patch any changes in the way the GC
barriers are generated are less likely to impact the Aarch64 back end
code that is interested in memory barriers associated with oop updates.


Andrew Dinn
Senior Principal Software Engineer
Red Hat UK Ltd
Registered in UK and Wales under Company Registration No. 3798903
Directors: Michael Cunningham (US), Michael O'Neill (Ireland), Paul
Argiry (US)

More information about the hotspot-compiler-dev mailing list