Minor IR interpreter optimization

This commit is contained in:
Henrik Rydgård committed 2024-05-10 18:27:29 +02:00
1 parent 9bef910953
commit 91d9ef9b81
3 files changed
+9 -6

No files matched your search

+5 -4
View File
@@ -1138,13 +1138,14 @@ u32 IRInterpret(MIPSState *mips, const IRInst *inst, int count) {
// Unimplemented IR op. Bad.
Crash();
}
#ifdef _DEBUG
if (mips->r[0] != 0)
Crash();
#endif
inst++;
}
#ifdef _DEBUG
if (mips->r[0] != 0)
Crash();
#endif
// We hit count. If this is a full block, it was badly constructed.
return 0;
}
+1 -2
View File
@@ -250,8 +250,7 @@ void IRJit::RunLoopUntil(u64 globalticks) {
u32 inst = Memory::ReadUnchecked_U32(mips_->pc);
u32 opcode = inst & 0xFF000000;
if (opcode == MIPS_EMUHACK_OPCODE) {
u32 data = inst & 0xFFFFFF;
IRBlock *block = blocks_.GetBlock(data);
IRBlock *block = blocks_.GetBlockUnchecked(inst & 0xFFFFFF);
u32 startPC = mips_->pc;
mips_->pc = IRInterpret(mips_, block->GetInstructions(), block->GetNumInstructions());
// Note: this will "jump to zero" on a badly constructed block missing exits.
+3
View File
@@ -127,6 +127,9 @@ public:
return nullptr;
}
}
IRBlock *GetBlockUnchecked(int i) {
return &blocks_[i];
}
const IRBlock *GetBlock(int i) const {
if (i >= 0 && i < (int)blocks_.size()) {
return &blocks_[i];