RFR (XS): 8212753: Improve oopDesc::forward_to_atomic
thomas.schatzl at oracle.com
Mon Oct 22 13:02:13 UTC 2018
can I have reviews for this micro-optimization that de-clutters
oopDesc::forward_to_atomic used in CMS and G1?
Reasons for this change:
- the mark is reloaded in the method although all collectors could pass
in their current copy (the mark is a volatile member, so it can't be
- it checks whether the mark is already set (i.e. already forwarded)
before doing the CAS, and after doing the CAS.
The former is waste of time because forwarding undo-statistics show
that the number of failures (i.e. an object has already been forwarded)
is extremely rate.
- the check after the CAS whether the mark is set is superfluous,
because after the CAS, independent of whether it was successful or not,
we know that the mark must have been forwarded.
There is no particular performance change. Just removes needlessly
(Just before somebody asks: the two asserts in the changed
forward_to_atomic() method are conditionalized on CMS because it will
CAS in a special value into the mark word that do not fit the rest of
the condition to "reserve" it for old gen promotion).
More information about the hotspot-gc-dev