diff --git a/Core/MIPS/x86/Jit.cpp b/Core/MIPS/x86/Jit.cpp index e82dc811c8..1d963cb1a6 100644 --- a/Core/MIPS/x86/Jit.cpp +++ b/Core/MIPS/x86/Jit.cpp @@ -328,6 +328,14 @@ const u8 *Jit::DoJit(u32 em_address, JitBlock *b) js.compilerPC += 4; js.numInstructions++; + + // Safety check, in case we get a bunch of really large jit ops without a lot of branching. + if (GetSpaceLeft() < 0x800) + { + FlushAll(); + WriteExit(js.compilerPC, js.nextExit++); + js.compiling = false; + } } b->codeSize = (u32)(GetCodePtr() - b->normalEntry);