From c7664b0a988e155ddaeb641d17a01c1bf9dfa4cf Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sat, 2 Nov 2019 15:40:06 +0100 Subject: [PATCH] Use short ptr in LockEventPtr. --- server/TracyEvent.hpp | 2 +- server/TracyView.cpp | 14 +++++++------- server/TracyWorker.cpp | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/server/TracyEvent.hpp b/server/TracyEvent.hpp index e4dc9fa6..365a1f43 100644 --- a/server/TracyEvent.hpp +++ b/server/TracyEvent.hpp @@ -208,7 +208,7 @@ struct LockEventShared : public LockEvent struct LockEventPtr { - LockEvent* ptr; + short_ptr ptr; uint8_t lockingThread; uint8_t lockCount; uint64_t waitList; diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 96b11b73..a03caa58 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -3626,7 +3626,7 @@ static Vector::const_iterator GetNextLockEvent( const Vector::const_iterator GetNextLockEventShared( const Vector::const_iterator& it, const Vector::const_iterator& end, LockState& nextState, uint64_t threadBit ) { - const auto itptr = (const LockEventShared*)it->ptr; + const auto itptr = (const LockEventShared*)(const LockEvent*)it->ptr; auto next = it; next++; @@ -3635,7 +3635,7 @@ static Vector::const_iterator GetNextLockEventShared( const Vector case LockState::Nothing: while( next < end ) { - const auto ptr = (const LockEventShared*)next->ptr; + const auto ptr = (const LockEventShared*)(const LockEvent*)next->ptr; if( next->lockCount != 0 ) { const auto wait = next->waitList | ptr->waitShared; @@ -3666,7 +3666,7 @@ static Vector::const_iterator GetNextLockEventShared( const Vector case LockState::HasLock: while( next < end ) { - const auto ptr = (const LockEventShared*)next->ptr; + const auto ptr = (const LockEventShared*)(const LockEvent*)next->ptr; if( next->lockCount == 0 && !IsThreadWaiting( ptr->sharedList, threadBit ) ) { nextState = LockState::Nothing; @@ -3695,7 +3695,7 @@ static Vector::const_iterator GetNextLockEventShared( const Vector case LockState::HasBlockingLock: while( next < end ) { - const auto ptr = (const LockEventShared*)next->ptr; + const auto ptr = (const LockEventShared*)(const LockEvent*)next->ptr; if( next->lockCount == 0 && !IsThreadWaiting( ptr->sharedList, threadBit ) ) { nextState = LockState::Nothing; @@ -3711,7 +3711,7 @@ static Vector::const_iterator GetNextLockEventShared( const Vector case LockState::WaitLock: while( next < end ) { - const auto ptr = (const LockEventShared*)next->ptr; + const auto ptr = (const LockEventShared*)(const LockEvent*)next->ptr; if( GetThreadBit( next->lockingThread ) == threadBit ) { const auto wait = next->waitList | ptr->waitShared; @@ -3902,7 +3902,7 @@ int View::DrawLocks( uint64_t tid, bool hover, double pxns, const ImVec2& wpos, } else { - auto ptr = (const LockEventShared*)vbegin->ptr; + auto ptr = (const LockEventShared*)(const LockEvent*)vbegin->ptr; if( vbegin->lockCount != 0 ) { if( vbegin->lockingThread == thread ) @@ -4177,7 +4177,7 @@ int View::DrawLocks( uint64_t tid, bool hover, double pxns, const ImVec2& wpos, } else { - const auto ptr = (const LockEventShared*)vbegin->ptr; + const auto ptr = (const LockEventShared*)(const LockEvent*)vbegin->ptr; switch( drawState ) { case LockState::HasLock: diff --git a/server/TracyWorker.cpp b/server/TracyWorker.cpp index 46891547..5d5e45d4 100644 --- a/server/TracyWorker.cpp +++ b/server/TracyWorker.cpp @@ -137,7 +137,7 @@ static void UpdateLockCountSharedLockable( LockMap& lockmap, size_t pos ) else { const auto& tl = timeline[pos-1]; - const auto tlp = (LockEventShared*)tl.ptr; + const auto tlp = (const LockEventShared*)(const LockEvent*)tl.ptr; lockingThread = tl.lockingThread; lockCount = tl.lockCount; waitShared = tlp->waitShared; @@ -151,7 +151,7 @@ static void UpdateLockCountSharedLockable( LockMap& lockmap, size_t pos ) while( pos != end ) { auto& tl = timeline[pos]; - const auto tlp = (LockEventShared*)tl.ptr; + const auto tlp = (LockEventShared*)(LockEvent*)tl.ptr; const auto tbit = uint64_t( 1 ) << tlp->thread; switch( (LockEvent::Type)tlp->type ) {