Use short ptr in LockEventPtr.

This commit is contained in:
Bartosz Taudul 2019-11-02 15:40:06 +01:00
parent 181d16459c
commit c7664b0a98
3 changed files with 10 additions and 10 deletions

View File

@ -208,7 +208,7 @@ struct LockEventShared : public LockEvent
struct LockEventPtr struct LockEventPtr
{ {
LockEvent* ptr; short_ptr<LockEvent> ptr;
uint8_t lockingThread; uint8_t lockingThread;
uint8_t lockCount; uint8_t lockCount;
uint64_t waitList; uint64_t waitList;

View File

@ -3626,7 +3626,7 @@ static Vector<LockEventPtr>::const_iterator GetNextLockEvent( const Vector<LockE
static Vector<LockEventPtr>::const_iterator GetNextLockEventShared( const Vector<LockEventPtr>::const_iterator& it, const Vector<LockEventPtr>::const_iterator& end, LockState& nextState, uint64_t threadBit ) static Vector<LockEventPtr>::const_iterator GetNextLockEventShared( const Vector<LockEventPtr>::const_iterator& it, const Vector<LockEventPtr>::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; auto next = it;
next++; next++;
@ -3635,7 +3635,7 @@ static Vector<LockEventPtr>::const_iterator GetNextLockEventShared( const Vector
case LockState::Nothing: case LockState::Nothing:
while( next < end ) while( next < end )
{ {
const auto ptr = (const LockEventShared*)next->ptr; const auto ptr = (const LockEventShared*)(const LockEvent*)next->ptr;
if( next->lockCount != 0 ) if( next->lockCount != 0 )
{ {
const auto wait = next->waitList | ptr->waitShared; const auto wait = next->waitList | ptr->waitShared;
@ -3666,7 +3666,7 @@ static Vector<LockEventPtr>::const_iterator GetNextLockEventShared( const Vector
case LockState::HasLock: case LockState::HasLock:
while( next < end ) 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 ) ) if( next->lockCount == 0 && !IsThreadWaiting( ptr->sharedList, threadBit ) )
{ {
nextState = LockState::Nothing; nextState = LockState::Nothing;
@ -3695,7 +3695,7 @@ static Vector<LockEventPtr>::const_iterator GetNextLockEventShared( const Vector
case LockState::HasBlockingLock: case LockState::HasBlockingLock:
while( next < end ) 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 ) ) if( next->lockCount == 0 && !IsThreadWaiting( ptr->sharedList, threadBit ) )
{ {
nextState = LockState::Nothing; nextState = LockState::Nothing;
@ -3711,7 +3711,7 @@ static Vector<LockEventPtr>::const_iterator GetNextLockEventShared( const Vector
case LockState::WaitLock: case LockState::WaitLock:
while( next < end ) while( next < end )
{ {
const auto ptr = (const LockEventShared*)next->ptr; const auto ptr = (const LockEventShared*)(const LockEvent*)next->ptr;
if( GetThreadBit( next->lockingThread ) == threadBit ) if( GetThreadBit( next->lockingThread ) == threadBit )
{ {
const auto wait = next->waitList | ptr->waitShared; 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 else
{ {
auto ptr = (const LockEventShared*)vbegin->ptr; auto ptr = (const LockEventShared*)(const LockEvent*)vbegin->ptr;
if( vbegin->lockCount != 0 ) if( vbegin->lockCount != 0 )
{ {
if( vbegin->lockingThread == thread ) if( vbegin->lockingThread == thread )
@ -4177,7 +4177,7 @@ int View::DrawLocks( uint64_t tid, bool hover, double pxns, const ImVec2& wpos,
} }
else else
{ {
const auto ptr = (const LockEventShared*)vbegin->ptr; const auto ptr = (const LockEventShared*)(const LockEvent*)vbegin->ptr;
switch( drawState ) switch( drawState )
{ {
case LockState::HasLock: case LockState::HasLock:

View File

@ -137,7 +137,7 @@ static void UpdateLockCountSharedLockable( LockMap& lockmap, size_t pos )
else else
{ {
const auto& tl = timeline[pos-1]; const auto& tl = timeline[pos-1];
const auto tlp = (LockEventShared*)tl.ptr; const auto tlp = (const LockEventShared*)(const LockEvent*)tl.ptr;
lockingThread = tl.lockingThread; lockingThread = tl.lockingThread;
lockCount = tl.lockCount; lockCount = tl.lockCount;
waitShared = tlp->waitShared; waitShared = tlp->waitShared;
@ -151,7 +151,7 @@ static void UpdateLockCountSharedLockable( LockMap& lockmap, size_t pos )
while( pos != end ) while( pos != end )
{ {
auto& tl = timeline[pos]; 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; const auto tbit = uint64_t( 1 ) << tlp->thread;
switch( (LockEvent::Type)tlp->type ) switch( (LockEvent::Type)tlp->type )
{ {