From 6cc84ffdbb0cf71af6457d9d6eeafd4cc21828f6 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 28 Feb 2015 15:09:41 -0800 Subject: [PATCH] jit: fix invalidation of blocks with only jr. We need to expand the range not to the latest exit, but to the size of the block. --- Core/MIPS/JitCommon/JitBlockCache.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/Core/MIPS/JitCommon/JitBlockCache.cpp b/Core/MIPS/JitCommon/JitBlockCache.cpp index f08cda643..0843209e9 100644 --- a/Core/MIPS/JitCommon/JitBlockCache.cpp +++ b/Core/MIPS/JitCommon/JitBlockCache.cpp @@ -249,12 +249,10 @@ void JitBlockCache::FinalizeBlock(int block_num, bool block_link) { AddBlockMap(block_num); - u32 latestExit = 0; if (block_link) { for (int i = 0; i < MAX_JIT_BLOCK_EXITS; i++) { if (b.exitAddress[i] != INVALID_EXIT) { links_to_.insert(std::make_pair(b.exitAddress[i], block_num)); - latestExit = std::max(latestExit, b.exitAddress[i]); } } @@ -262,15 +260,16 @@ void JitBlockCache::FinalizeBlock(int block_num, bool block_link) { LinkBlockExits(block_num); } + const u32 blockEnd = b.originalAddress + b.originalSize * 4 - 4; if (Memory::IsScratchpadAddress(b.originalAddress)) { - ExpandRange(blockMemRanges_[JITBLOCK_RANGE_SCRATCH], b.originalAddress, latestExit); + ExpandRange(blockMemRanges_[JITBLOCK_RANGE_SCRATCH], b.originalAddress, blockEnd); } const u32 halfUserMemory = (PSP_GetUserMemoryEnd() - PSP_GetUserMemoryBase()) / 2; if (b.originalAddress < PSP_GetUserMemoryBase() + halfUserMemory) { - ExpandRange(blockMemRanges_[JITBLOCK_RANGE_RAMBOTTOM], b.originalAddress, latestExit); + ExpandRange(blockMemRanges_[JITBLOCK_RANGE_RAMBOTTOM], b.originalAddress, blockEnd); } - if (latestExit > PSP_GetUserMemoryBase() + halfUserMemory) { - ExpandRange(blockMemRanges_[JITBLOCK_RANGE_RAMTOP], b.originalAddress, latestExit); + if (blockEnd > PSP_GetUserMemoryBase() + halfUserMemory) { + ExpandRange(blockMemRanges_[JITBLOCK_RANGE_RAMTOP], b.originalAddress, blockEnd); } #if defined USE_OPROFILE && USE_OPROFILE