JitRegCache: Count locks/unlocks

This commit is contained in:
MerryMage 2018-10-15 21:00:45 +01:00
parent 2dce7e6e21
commit 448fc89e4c
2 changed files with 20 additions and 10 deletions

View File

@ -212,13 +212,13 @@ X64Reg RegCache::RX(preg_t preg) const
void RegCache::UnlockAll()
{
for (auto& reg : m_regs)
reg.Unlock();
reg.UnlockAll();
}
void RegCache::UnlockAllX()
{
for (auto& xreg : m_xregs)
xreg.Unlock();
xreg.UnlockAll();
}
bool RegCache::IsFreeX(size_t xreg) const

View File

@ -75,15 +75,20 @@ public:
location = Gen::Imm32(imm32);
}
bool IsLocked() const { return locked; }
void Lock() { locked = true; }
void Unlock() { locked = false; }
bool IsLocked() const { return locked > 0; }
void Lock() { locked++; }
void Unlock()
{
ASSERT(IsLocked());
locked--;
}
void UnlockAll() { locked = 0; } // TODO: Remove from final version
private:
Gen::OpArg default_location{};
Gen::OpArg location{};
bool away = false; // value not in source register
bool locked = false;
size_t locked = 0;
};
class X64CachedReg
@ -110,15 +115,20 @@ public:
bool IsDirty() const { return dirty; }
void MakeDirty() { dirty = true; }
bool IsLocked() const { return locked; }
void Lock() { locked = true; }
void Unlock() { locked = false; }
bool IsLocked() const { return locked > 0; }
void Lock() { locked++; }
void Unlock()
{
ASSERT(IsLocked());
locked--;
}
void UnlockAll() { locked = 0; } // TODO: Remove from final version
private:
preg_t ppcReg = static_cast<preg_t>(Gen::INVALID_REG);
bool free = true;
bool dirty = false;
bool locked = false;
size_t locked = 0;
};
class RegCache