diff --git a/Source/Core/Core/Src/HW/Memmap.cpp b/Source/Core/Core/Src/HW/Memmap.cpp index 6bfa577b2e..dcbe3ab6d5 100644 --- a/Source/Core/Core/Src/HW/Memmap.cpp +++ b/Source/Core/Core/Src/HW/Memmap.cpp @@ -418,7 +418,7 @@ u32 Read_Instruction(const u32 em_address) u32 Read_Opcode_JIT(const u32 _Address) { -#ifdef JIT_UNLIMITED_ICACHE +#ifdef FAST_ICACHE if ((_Address & ~JIT_ICACHE_MASK) != 0x80000000 && (_Address & ~JIT_ICACHE_MASK) != 0x00000000 && (_Address & ~JIT_ICACHE_MASK) != 0x7e000000 && // TLB area (_Address & ~JIT_ICACHEEX_MASK) != 0x90000000 && (_Address & ~JIT_ICACHEEX_MASK) != 0x10000000) @@ -426,50 +426,23 @@ u32 Read_Opcode_JIT(const u32 _Address) PanicAlert("iCacheJIT: Reading Opcode from %x. Please report.", _Address); return 0; } - u8* iCache; - u32 addr; - if (_Address & JIT_ICACHE_VMEM_BIT) - { - iCache = jit->GetBlockCache()->GetICacheVMEM(); - addr = _Address & JIT_ICACHE_MASK; - } - else if (_Address & JIT_ICACHE_EXRAM_BIT) - { - iCache = jit->GetBlockCache()->GetICacheEx(); - addr = _Address & JIT_ICACHEEX_MASK; - } - else - { - iCache = jit->GetBlockCache()->GetICache(); - addr = _Address & JIT_ICACHE_MASK; - } - u32 inst = *(u32*)(iCache + addr); - if (inst == JIT_ICACHE_INVALID_WORD) - { - u32 cache_block_start = addr & ~0x1f; - u32 mem_block_start = _Address & ~0x1f; - u8 *pMem = Memory::GetPointer(mem_block_start); - memcpy(iCache + cache_block_start, pMem, 32); - inst = *(u32*)(iCache + addr); - } - inst = Common::swap32(inst); + + u32 inst = Read_Opcode(_Address); #else u32 inst = Memory::ReadUnchecked_U32(_Address); #endif - if ((inst & 0xfc000000) == 0) - { - inst = jit->GetBlockCache()->GetOriginalFirstOp(inst); - } - // if a crash occured after that message // that means that we've compiled outdated code from the cache instead of memory // this could happen if a game forgot to icbi the new code +#if defined(_DEBUG) || defined(DEBUGFAST) u32 inst_mem = Memory::ReadUnchecked_U32(_Address); if (inst_mem != inst) ERROR_LOG(POWERPC, "JIT: compiling outdated code. addr=%x, mem=%x, cache=%x", _Address, inst_mem, inst); +#endif return inst; } +// The following function is deprecated in favour of FAST_ICACHE u32 Read_Opcode_JIT_LC(const u32 _Address) { #ifdef JIT_UNLIMITED_ICACHE diff --git a/Source/Core/Core/Src/PowerPC/PPCAnalyst.cpp b/Source/Core/Core/Src/PowerPC/PPCAnalyst.cpp index 0e5238c181..556bd026b6 100644 --- a/Source/Core/Core/Src/PowerPC/PPCAnalyst.cpp +++ b/Source/Core/Core/Src/PowerPC/PPCAnalyst.cpp @@ -288,9 +288,11 @@ bool CanSwapAdjacentOps(const CodeOp &a, const CodeOp &b) u32 Flatten(u32 address, int *realsize, BlockStats *st, BlockRegStats *gpa, BlockRegStats *fpa, CodeBuffer *buffer, int blockSize) { memset(st, 0, sizeof(st)); - UGeckoInstruction previnst = Memory::Read_Opcode_JIT_LC(address - 4); - if (previnst.hex == 0x4e800020) - st->isFirstBlockOfFunction = true; + + // Disabled the following optimization in preference of FAST_ICACHE + //UGeckoInstruction previnst = Memory::Read_Opcode_JIT_LC(address - 4); + //if (previnst.hex == 0x4e800020) + // st->isFirstBlockOfFunction = true; gpa->any = true; fpa->any = false;