RFR: 8186838: Generalize Atomic::inc/dec with templates
Andrew Haley
aph at redhat.com
Mon Sep 4 09:24:14 UTC 2017
On 04/09/17 09:14, Erik Österlund wrote:
> On PPC Atomic::inc/dec and Atomic::add have the following differences:
>
> Atomic::inc/dec uses addic between the LL and SC instructions with an
> immediate value for adding, whereas Atomic::add uses the add instruction
> with an extra register.
> Atomic::add has a leading lwsync fence and Atomic::inc/dec has no
> leading fence.
> Atomic::add has a trailing isync fence and Atomic::inc/dec has no
> trailing fence.
One of those must be a bug. Either one of them is unnecessary or
both are necessary.
> So the current implementation of Atomic::add uses heavier fencing than
> Atomic::inc/dec. I can imagine that does matter for performance today.
> However, the documented semantics of Atomic::inc/dec requires a leading
> sync fence - so they are both arguably too weak and should have stronger
> fencing than they do today. And I would argue that if both conformed to
> the fencing required by our public API, then the difference would
> probably be small.
Right.
--
Andrew Haley
Java Platform Lead Engineer
Red Hat UK Ltd. <https://www.redhat.com>
EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671
More information about the hotspot-dev
mailing list