Permalink
Browse files

irjit: Add a safety check for block num overflow.

In case a game is very frequently modifying some block.
  • Loading branch information...
unknownbrackets committed Jan 5, 2018
1 parent 5b9b6da commit ccd562d934073c0a7086887ea7f14046258ed1e6
Showing with 6 additions and 0 deletions.
  1. +6 −0 Core/MIPS/IR/IRJit.cpp
View
@@ -67,6 +67,12 @@ void IRJit::Compile(u32 em_address) {
PROFILE_THIS_SCOPE("jitc");
int block_num = blocks_.AllocateBlock(em_address);
if ((block_num & ~MIPS_EMUHACK_VALUE_MASK) != 0) {
// Ran out of block numbers - need to reset.
ERROR_LOG(JIT, "Ran out of block numbers, clearing cache");
ClearCache();
block_num = blocks_.AllocateBlock(em_address);
}
IRBlock *b = blocks_.GetBlock(block_num);
std::vector<IRInst> instructions;

0 comments on commit ccd562d

Please sign in to comment.