Skip to content

Commit

Permalink
JitRegCache: Count locks/unlocks
Browse files Browse the repository at this point in the history
  • Loading branch information
MerryMage committed Oct 28, 2018
1 parent 2dce7e6 commit 448fc89
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Source/Core/Core/PowerPC/Jit64/JitRegCache.cpp
Expand Up @@ -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
Expand Down
26 changes: 18 additions & 8 deletions Source/Core/Core/PowerPC/Jit64/JitRegCache.h
Expand Up @@ -75,15 +75,20 @@ class PPCCachedReg
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
Expand All @@ -110,15 +115,20 @@ class X64CachedReg
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
Expand Down

0 comments on commit 448fc89

Please sign in to comment.