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
{
LockEvent* ptr;
short_ptr<LockEvent> ptr;
uint8_t lockingThread;
uint8_t lockCount;
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 )
{
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<LockEventPtr>::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<LockEventPtr>::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<LockEventPtr>::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<LockEventPtr>::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:

View File

@ -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 )
{