QFutureInterfaceBasePrivate: pack to remove padding

This structure was 216 bytes with 3 padding regions: 3 bytes between
continuationState and refCount, 4 bytes between m_progressValue and
m_progress, and 1 byte at the end after the booleans. The total of 8
bytes can be neatly reduced.

And since it's now a multiple of 16, we should get an effective 16 byte
reduction in malloc()ed size.

Change-Id: I69ecc04064514f939896fffd172e46d1d68cb28b
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
This commit is contained in:
Thiago Macieira 2022-12-06 10:12:58 -08:00
parent e02933a17c
commit 04e668f6ba

View File

@ -143,9 +143,6 @@ public:
std::function<void(const QFutureInterfaceBase &)> continuation;
QFutureInterfaceBasePrivate *continuationData = nullptr;
enum ContinuationState : quint8 { Default, Canceled, Cleaned };
std::atomic<ContinuationState> continuationState { Default };
RefCount refCount = 1;
QAtomicInt state; // reads and writes can happen unprotected, both must be atomic
@ -163,6 +160,9 @@ public:
bool isValid = false;
bool hasException = false;
enum ContinuationState : quint8 { Default, Canceled, Cleaned };
std::atomic<ContinuationState> continuationState { Default };
inline QThreadPool *pool() const
{ return m_pool ? m_pool : QThreadPool::globalInstance(); }