summaryrefslogtreecommitdiff
path: root/Source/Core/DSPCore/Src/DSPEmitter.cpp
diff options
context:
space:
mode:
authorj4ck.fr0st <j4ck.fr0st@gmail.com>2010-06-30 16:17:20 +0000
committerj4ck.fr0st <j4ck.fr0st@gmail.com>2010-06-30 16:17:20 +0000
commit89c4068663ca961cd9cec40c94eac4bf0f2d6583 (patch)
tree8d90ce8b6ca6afe0548012389bcffc8963c46240 /Source/Core/DSPCore/Src/DSPEmitter.cpp
parent599a4c974d949ef5fc587f3084f5c88ac23539e5 (diff)
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
Diffstat (limited to 'Source/Core/DSPCore/Src/DSPEmitter.cpp')
-rw-r--r--Source/Core/DSPCore/Src/DSPEmitter.cpp11
1 files changed, 9 insertions, 2 deletions
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;
}