JitArm64: Make FlushRegisters unlock condition more robust

To find out whether a host register needs to be unlocked, FlushRegisters
checks if the guest register is known to be a zero immediate. This works
right now, but it will stop working correctly once we gain the ability
to have a guest register be a known immediate and be in a host register
at the same time, because a register that's known to be a zero immediate
may have had a host register allocated prior to the call to
FlushRegisters. Instead, we should check whether the register is
RegType::Register after we're done calling BindForRead.
This commit is contained in:
JosJuice 2024-11-02 15:46:40 +01:00
parent 47894560af
commit 236bd035eb

View File

@ -269,10 +269,10 @@ void Arm64GPRCache::FlushRegisters(BitSet32 regs, FlushMode mode, ARM64Reg tmp_r
m_emit->STP(IndexType::Signed, RX1, RX2, PPC_REG, u32(ppc_offset));
if (flush_all)
{
if (!reg1_zero)
UnlockRegister(EncodeRegTo32(RX1));
if (!reg2_zero)
UnlockRegister(EncodeRegTo32(RX2));
if (reg1.GetType() == RegType::Register)
UnlockRegister(reg1.GetReg());
if (reg2.GetType() == RegType::Register)
UnlockRegister(reg2.GetReg());
reg1.Flush();
reg2.Flush();
}