Permalink
Browse files

JitRegCache: Fix SanityCheck

  • Loading branch information...
MerryMage committed Oct 7, 2018
1 parent d5999bc commit d448ed3308dfa02dda19eea0d8ec2db21a1f50b1
@@ -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;
@@ -92,29 +92,31 @@ 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++)
{
switch (m_regs[i].GetLocationType())
{
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)
@@ -147,7 +147,7 @@ class RegCache
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"

0 comments on commit d448ed3

Please sign in to comment.