Skip to content

Commit

Permalink
QMutex: mark the out-of-line, *Internal() methods Q_NEVER_INLINE
Browse files Browse the repository at this point in the history
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.

Change-Id: I88c29098757ea6e70c00fffde56989ec05b136bd
Reviewed-by: Mårten Nordheim <[email protected]>
(cherry picked from commit cc4abef)
Reviewed-by: Qt Cherry-pick Bot <[email protected]>
(cherry picked from commit 7920772)
  • Loading branch information
thiagomacieira authored and Qt Cherry-pick Bot committed Jan 19, 2025
1 parent 4a45159 commit 085780b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/corelib/thread/qmutex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,7 @@ void QRecursiveMutex::unlock() noexcept
/*!
\internal helper for lock()
*/
Q_NEVER_INLINE
void QBasicMutex::lockInternal() QT_MUTEX_LOCK_NOEXCEPT
{
if (futexAvailable()) {
Expand Down Expand Up @@ -670,6 +671,7 @@ bool QBasicMutex::lockInternal(int timeout) QT_MUTEX_LOCK_NOEXCEPT
/*!
\internal helper for tryLock(QDeadlineTimer)
*/
Q_NEVER_INLINE
bool QBasicMutex::lockInternal(QDeadlineTimer deadlineTimer) QT_MUTEX_LOCK_NOEXCEPT
{
if (deadlineTimer.hasExpired())
Expand Down Expand Up @@ -809,6 +811,7 @@ bool QBasicMutex::lockInternal(QDeadlineTimer deadlineTimer) QT_MUTEX_LOCK_NOEXC
/*!
\internal
*/
Q_NEVER_INLINE
void QBasicMutex::unlockInternal() noexcept
{
QMutexPrivate *copy = d_ptr.loadAcquire();
Expand Down

0 comments on commit 085780b

Please sign in to comment.