QMutex: mark the out-of-line, *Internal() methods Q_NEVER_INLINE

With LTO, I'm seeing GCC conclude that it's best to inline the
lockInternal() and unlockInternal() methods into the public ones and
then emit out-of-line copies for those. That's actually sub-optimal, so
force GCC not to do it.

Pick-to: 6.9 6.8
Change-Id: I88c29098757ea6e70c00fffde56989ec05b136bd
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Thiago Macieira 2024-12-31 17:12:46 -03:00
parent 7ad2083ec3
commit cc4abefb1d

View File

@ -638,6 +638,7 @@ void QRecursiveMutex::unlock() noexcept
/*! /*!
\internal helper for lock() \internal helper for lock()
*/ */
Q_NEVER_INLINE
void QBasicMutex::lockInternal() QT_MUTEX_LOCK_NOEXCEPT void QBasicMutex::lockInternal() QT_MUTEX_LOCK_NOEXCEPT
{ {
if (futexAvailable()) { if (futexAvailable()) {
@ -671,6 +672,7 @@ bool QBasicMutex::lockInternal(int timeout) QT_MUTEX_LOCK_NOEXCEPT
/*! /*!
\internal helper for tryLock(QDeadlineTimer) \internal helper for tryLock(QDeadlineTimer)
*/ */
Q_NEVER_INLINE
bool QBasicMutex::lockInternal(QDeadlineTimer deadlineTimer) QT_MUTEX_LOCK_NOEXCEPT bool QBasicMutex::lockInternal(QDeadlineTimer deadlineTimer) QT_MUTEX_LOCK_NOEXCEPT
{ {
if (deadlineTimer.hasExpired()) if (deadlineTimer.hasExpired())
@ -810,6 +812,7 @@ bool QBasicMutex::lockInternal(QDeadlineTimer deadlineTimer) QT_MUTEX_LOCK_NOEXC
/*! /*!
\internal \internal
*/ */
Q_NEVER_INLINE
void QBasicMutex::unlockInternal() noexcept void QBasicMutex::unlockInternal() noexcept
{ {
QMutexPrivate *copy = d_ptr.loadAcquire(); QMutexPrivate *copy = d_ptr.loadAcquire();