RFR: AArch64: incorrect code generation for StoreCM
Andrew Dinn
adinn at redhat.com
Tue Jul 3 08:57:35 UTC 2018
Reviews are welcome for the following AArch64-only patch against
*jdk11*. It fixes an erroneous assumption in the AArch64 back end
generation regarding the planting of StoreStore barriers in CMS without
conditional card mark (thanks are due to Zhongwei Yao for pointing this
out).
JIRA: https://bugs.openjdk.java.net/browse/JDK-8206163
webrev: http://cr.openjdk.java.net/~adinn/8206163/
Is it ok to push this to JDK11 or do I need special permission to do so?
The patch currently also applies cleanly to jdk12.
The Patch:
----------
When using CMS without conditional card mark (-XX:+UseCocMArkSeepGC
-XX:-UseCondCardMark) the AArch64 back end translates a StoreCM to a
StoreStore barrier followed by a strb to order the card mark after the
preceding object field write i.e. it generates:
str ; dmb ishst ; strb
In the case of a volatile object field write it has always assumed the
StoreStore barrier could be omitted if the preceding write was
translated to a releasing store i.e. it has always generated:
stlr ; strb
Similarly, when using barriers for volatiles fields it has always
omitted the StoreStore barrier, generating
dmb ish ; stlr; strb ; dmb ish
This is not correct because it is perfectly legitimate for AArch64
hardware to allow the strb to be visible before the stlr is visible and,
indeed, recent AArch64 hardware now does so. In theory,this means the GC
could read a dirty card, rescan the object it marks and find a stale
value in the object field written by the stlr (although, in practice,
this will be a rare outcome). The correct generated sequences should be
str ; dmb ishst ; strb
and
dmb ish ; stlr; dmb ishst ; strb ; dmb ish
The aarch64.ad rule predicate which controls planting of the dmb ishst
has been modified accordingly. Explanatory comments have also been
corrected.
Testing:
--------
The case handling for the CMS case has been udpated in the relevant
jtreg tests (hotspot/jtreg/compiler/c2/aarch64/*). Those tests were
rerun and passed successfully.
regards,
Andrew Dinn
-----------
Senior Principal Software Engineer
Red Hat UK Ltd
Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham, Michael ("Mike") O'Neill, Eric Shander
More information about the hotspot-compiler-dev
mailing list