diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-05-12 07:30:23 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-05-17 18:49:31 +0200 |
commit | fd31177c45fa47bab867503d8b1b1505ee81654e (patch) | |
tree | 58de6a0406eb6fe97ade3601c646f61c93d681ff /src/corelib/thread | |
parent | 20d8383cb4899fb4c8d13c55ac19a718d1306cae (diff) |
QObject: Turn flaggedSignatures into a thread_local static
... out of QThreadData.
No-one except two functions in qobject.cpp uses the object, and its
creation is constinit, so there's no advantage to expose it to the
world as a QThreadData member.
Remove it from QThreadData, move the class' definition to the unnamed
namespace in qobject.cpp, ensure constinit'ability by letting the
language zero out the members (as opposed to an STL algorithm call),
declare it constinit thread_local static, and adapt the two users
(basically, removing the retrieval of QThreadData::current()).
Almost no effect on Clang, but saves ~400 bytes on optimized GCC 11.2
Linux AMD64 C++20 builds.
Change-Id: I22432d4ec5eb4ab59920656409b21768983fb4db
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/thread')
-rw-r--r-- | src/corelib/thread/qthread_p.h | 21 |
1 files changed, 0 insertions, 21 deletions
diff --git a/src/corelib/thread/qthread_p.h b/src/corelib/thread/qthread_p.h index 134c1577b2..6fdf785633 100644 --- a/src/corelib/thread/qthread_p.h +++ b/src/corelib/thread/qthread_p.h @@ -261,26 +261,6 @@ public: return canWait; } - // This class provides per-thread (by way of being a QThreadData - // member) storage for qFlagLocation() - class FlaggedDebugSignatures - { - static const uint Count = 2; - - uint idx; - const char *locations[Count]; - - public: - FlaggedDebugSignatures() : idx(0) - { std::fill_n(locations, Count, static_cast<char*>(nullptr)); } - - void store(const char* method) - { locations[idx++ % Count] = method; } - - bool contains(const char *method) const - { return std::find(locations, locations + Count, method) != locations + Count; } - }; - private: QAtomicInt _ref; @@ -294,7 +274,6 @@ public: QAtomicPointer<void> threadId; QAtomicPointer<QAbstractEventDispatcher> eventDispatcher; QList<void *> tls; - FlaggedDebugSignatures flaggedSignatures; bool quitNow; bool canWait; |