From 89c4068663ca961cd9cec40c94eac4bf0f2d6583 Mon Sep 17 00:00:00 2001 From: "j4ck.fr0st" Date: Wed, 30 Jun 2010 16:17:20 +0000 Subject: Fix a bug in DSP Jit where branches had a blockSize of zero. Add some useful checking to J_CC/SetJumpTarget. Refactor increment/decrement and reuse code with increase/decrease. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5816 8ced0084-cf51-0410-be5f-012b33b47a6e --- Source/Core/DSPCore/Src/DSPEmitter.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'Source/Core/DSPCore/Src/DSPEmitter.cpp') diff --git a/Source/Core/DSPCore/Src/DSPEmitter.cpp b/Source/Core/DSPCore/Src/DSPEmitter.cpp index 3184e340d8..4b908847fe 100644 --- a/Source/Core/DSPCore/Src/DSPEmitter.cpp +++ b/Source/Core/DSPCore/Src/DSPEmitter.cpp @@ -194,6 +194,8 @@ const u8 *DSPEmitter::Compile(int start_addr) { SetJumpTarget(rLoopCounterExit); } + blockSize[start_addr]++; + // End the block if we're at a loop end. if (opcode->branch || (DSPAnalyzer::code_flags[addr] & DSPAnalyzer::CODE_LOOP_END) || @@ -201,8 +203,6 @@ const u8 *DSPEmitter::Compile(int start_addr) { break; } addr += opcode->size; - - blockSize[start_addr]++; } // ABI_RestoreStack(0); @@ -210,6 +210,13 @@ const u8 *DSPEmitter::Compile(int start_addr) { RET(); blocks[start_addr] = (CompiledCode)entryPoint; + if (blockSize[start_addr] == 0) + { + // just a safeguard, should never happen anymore. + // if it does we might get stuck over in RunForCycles. + ERROR_LOG(DSPLLE, "Block at 0x%04x has zero size", start_addr); + blockSize[start_addr] = 1; + } return entryPoint; } -- cgit v1.2.3