JitRegCache: Fix SanityCheck

This commit is contained in:
MerryMage 2018-10-07 09:05:37 +01:00
parent d5999bc0df
commit d448ed3308
3 changed files with 14 additions and 12 deletions

View File

@ -935,10 +935,10 @@ u8* Jit64::DoJit(u32 em_address, JitBlock* b, u32 nextPC)
}
#if defined(_DEBUG) || defined(DEBUGFAST)
if (gpr.SanityCheck() || fpr.SanityCheck())
if (!gpr.SanityCheck() || !fpr.SanityCheck())
{
std::string ppc_inst = Common::GekkoDisassembler::Disassemble(op.inst.hex, em_address);
// NOTICE_LOG(DYNA_REC, "Unflushed register: %s", ppc_inst.c_str());
NOTICE_LOG(DYNA_REC, "Unflushed register: %s", ppc_inst.c_str());
}
#endif
i += js.skipInstructions;

View File

@ -92,7 +92,7 @@ void RegCache::FlushLockX(X64Reg reg1, X64Reg reg2)
LockX(reg2);
}
int RegCache::SanityCheck() const
bool RegCache::SanityCheck() const
{
for (size_t i = 0; i < m_regs.size(); i++)
{
@ -100,21 +100,23 @@ int RegCache::SanityCheck() const
{
case PPCCachedReg::LocationType::Default:
case PPCCachedReg::LocationType::SpeculativeImmediate:
case PPCCachedReg::LocationType::Immediate:
break;
case PPCCachedReg::LocationType::Bound:
{
Gen::X64Reg simple = m_regs[i].Location().GetSimpleReg();
if (m_xregs[simple].IsLocked())
return 1;
if (m_xregs[simple].Contents() != i)
return 2;
if (m_regs[i].IsLocked())
return false;
Gen::X64Reg xr = m_regs[i].Location().GetSimpleReg();
if (m_xregs[xr].IsLocked())
return false;
if (m_xregs[xr].Contents() != i)
return false;
break;
}
case PPCCachedReg::LocationType::Immediate:
return 3;
}
}
return 0;
return true;
}
void RegCache::KillImmediate(preg_t preg, bool doLoad, bool makeDirty)

View File

@ -147,7 +147,7 @@ public:
void FlushLockX(Gen::X64Reg reg);
void FlushLockX(Gen::X64Reg reg1, Gen::X64Reg reg2);
int SanityCheck() const;
bool SanityCheck() const;
void KillImmediate(preg_t preg, bool doLoad, bool makeDirty);
// TODO - instead of doload, use "read", "write"