[libcxx-commits] [libcxx] [libc++] Fix bug in atomic_ref's calculation of lock_free-ness (PR #99570)

Damien L-G via libcxx-commits libcxx-commits at lists.llvm.org
Fri Jul 19 05:08:49 PDT 2024


dalg24 wrote:

> @dalg24 We should also consider changing the required alignment of `atomic_ref` so as to make it lockfree more often, as mentioned by @EricWF 's (C) point above. The ideal time to make that change would be before we ship `atomic_ref` for the first time.
> 
> Note: I said _consider_, not _actually change_. IDK if that's actually a good idea / better QOI, but we should think about it and consider the tradeoffs, which I haven't done so far.

I had not put much thought into it when I implemented it.
It looks like libstdc++ and ms stl both elected to require types of size 1, 2, 4, 8, and 16 bytes in length to be aligned on their size value.

https://github.com/gcc-mirror/gcc/blob/cea6473e48b4cfbf16f7b4a804f1562f8da8f25b/libstdc%2B%2B-v3/include/bits/atomic_base.h#L1491-L1503

https://github.com/microsoft/STL/blob/ecbc1efa09936f4ef5af529e770a95a29a4290d3/stl/inc/atomic#L2318-L2321

https://github.com/llvm/llvm-project/pull/99570


More information about the libcxx-commits mailing list