Proposed patch to skip the last atomic decrements in _Sp_counted_base::_M_release

Marc Glisse marc.glisse@inria.fr
Tue Dec 8 08:01:23 GMT 2020


On Mon, 7 Dec 2020, Maged Michael via Libstdc++ wrote:

> Any pointers on where to file bug reports about the generated code?

https://gcc.gnu.org/bugzilla/
(creating an account may not be as trivial as it used to be, but it still 
works)

>> ISTR that libstdc++ uses a surprisingly strong memory barrier when
>> incrementing references (acq_rel, where I would expect acquire to suffice,
>> although I haven't thought about weak references that much). Did you also
>> experiment with that?

(I actually meant "relaxed")

> I applied to x86, where acq_rel doesn't add extra memory fence instructions
> for atomic increment/decrement operations.

Indeed, on x86 just making the increment atomically requires lock add or
lock inc, which already includes a strong barrier. It does make a
difference in generated code on aarch64 or powerpc64el though.

-- 
Marc Glisse


More information about the Libstdc++ mailing list