qt5base-lts/tests/auto/corelib/thread/qatomicinteger
Thiago Macieira 309dacedac Atomics: remove requirement for alignment equality with plain types
This was originally added so that you could replace a T with
QAtomicInteger<T> in the same class and still keep ABI. However, for
legacy reasons, on 32-bit x86, types larger than 4 bytes keep an old
1990s alignment of only 4 bytes, but modern std::atomic<T> for those 8-
byte types enforces an alignment of 8 bytes. Therefore, the requirement
to keep alignment is not possible to guarantee.

In other words: you may not replace T with QAtomicInteger<T> or
std::atomic<T> and assume no ABI breakages in all platforms.

This is a requirement to implement atomicity. An 8-byte type aligned to
only a 4-byte boundary could cross a 16-byte boundary or, worse, cross a
cacheline boundary. Crossing the 16-byte boundary could be bad on some
processors, but crossing the cacheline boundary (addresses ending in
0x3C, 0x7C, 0xCC and 0xFC, or 4 out of 64 possible addresses or 6.25%)
is always bad: the CPUs cannot guarantee an atomic load or store
operation.

See also <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71660>.

Task-number: QTBUG-67858
Change-Id: If90a92b041d3442fa0a4fffd15283e4615474582
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@qt.io>
2018-04-24 17:36:42 +00:00
..
char Add missing fetchAndXxx methods to atomic classes based on std::atomic 2015-03-05 00:05:00 +00:00
char16_t Add missing fetchAndXxx methods to atomic classes based on std::atomic 2015-03-05 00:05:00 +00:00
char32_t Add missing fetchAndXxx methods to atomic classes based on std::atomic 2015-03-05 00:05:00 +00:00
int Add missing fetchAndXxx methods to atomic classes based on std::atomic 2015-03-05 00:05:00 +00:00
long Add missing fetchAndXxx methods to atomic classes based on std::atomic 2015-03-05 00:05:00 +00:00
qlonglong Add missing fetchAndXxx methods to atomic classes based on std::atomic 2015-03-05 00:05:00 +00:00
qptrdiff Add missing fetchAndXxx methods to atomic classes based on std::atomic 2015-03-05 00:05:00 +00:00
quintptr Add missing fetchAndXxx methods to atomic classes based on std::atomic 2015-03-05 00:05:00 +00:00
qulonglong Add missing fetchAndXxx methods to atomic classes based on std::atomic 2015-03-05 00:05:00 +00:00
schar Add missing fetchAndXxx methods to atomic classes based on std::atomic 2015-03-05 00:05:00 +00:00
short Add missing fetchAndXxx methods to atomic classes based on std::atomic 2015-03-05 00:05:00 +00:00
uchar Add missing fetchAndXxx methods to atomic classes based on std::atomic 2015-03-05 00:05:00 +00:00
uint Add missing fetchAndXxx methods to atomic classes based on std::atomic 2015-03-05 00:05:00 +00:00
ulong Add missing fetchAndXxx methods to atomic classes based on std::atomic 2015-03-05 00:05:00 +00:00
ushort Add missing fetchAndXxx methods to atomic classes based on std::atomic 2015-03-05 00:05:00 +00:00
wchar_t Add missing fetchAndXxx methods to atomic classes based on std::atomic 2015-03-05 00:05:00 +00:00
qatomicinteger.pri Remove all the atomic code besides MSVC and std::atomic 2016-01-19 23:41:52 +00:00
qatomicinteger.pro Remove all the atomic code besides MSVC and std::atomic 2016-01-19 23:41:52 +00:00
tst_qatomicinteger.cpp Atomics: remove requirement for alignment equality with plain types 2018-04-24 17:36:42 +00:00