From 04e668f6ba57c83e509ce7cbba929c3e7139671d Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 6 Dec 2022 10:12:58 -0800 Subject: [PATCH] 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 --- src/corelib/thread/qfutureinterface_p.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/corelib/thread/qfutureinterface_p.h b/src/corelib/thread/qfutureinterface_p.h index 6258e61de7..92a1072591 100644 --- a/src/corelib/thread/qfutureinterface_p.h +++ b/src/corelib/thread/qfutureinterface_p.h @@ -143,9 +143,6 @@ public: std::function continuation; QFutureInterfaceBasePrivate *continuationData = nullptr; - enum ContinuationState : quint8 { Default, Canceled, Cleaned }; - std::atomic 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 { Default }; + inline QThreadPool *pool() const { return m_pool ? m_pool : QThreadPool::globalInstance(); }