Swapped out UNLIMITED_ICACHE for FAST_ICACHE in both the JIT and JITIL recompilers. The ICACHE is the instruction cache emulation of the CPU. In my testing, FAST_ICACHE was more compatible than UNLIMITED_ICACHE. This also means the icache emulation will be consistent between the PPC recompilers and the interpreter.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5841 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
skidau 2010-07-06 07:21:35 +00:00
parent 3e08208f42
commit 5133793c6c
2 changed files with 11 additions and 36 deletions

View File

@ -418,7 +418,7 @@ u32 Read_Instruction(const u32 em_address)
u32 Read_Opcode_JIT(const u32 _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 && if ((_Address & ~JIT_ICACHE_MASK) != 0x80000000 && (_Address & ~JIT_ICACHE_MASK) != 0x00000000 &&
(_Address & ~JIT_ICACHE_MASK) != 0x7e000000 && // TLB area (_Address & ~JIT_ICACHE_MASK) != 0x7e000000 && // TLB area
(_Address & ~JIT_ICACHEEX_MASK) != 0x90000000 && (_Address & ~JIT_ICACHEEX_MASK) != 0x10000000) (_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); PanicAlert("iCacheJIT: Reading Opcode from %x. Please report.", _Address);
return 0; return 0;
} }
u8* iCache;
u32 addr; u32 inst = Read_Opcode(_Address);
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);
#else #else
u32 inst = Memory::ReadUnchecked_U32(_Address); u32 inst = Memory::ReadUnchecked_U32(_Address);
#endif #endif
if ((inst & 0xfc000000) == 0)
{
inst = jit->GetBlockCache()->GetOriginalFirstOp(inst);
}
// if a crash occured after that message // if a crash occured after that message
// that means that we've compiled outdated code from the cache instead of memory // 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 // this could happen if a game forgot to icbi the new code
#if defined(_DEBUG) || defined(DEBUGFAST)
u32 inst_mem = Memory::ReadUnchecked_U32(_Address); u32 inst_mem = Memory::ReadUnchecked_U32(_Address);
if (inst_mem != inst) if (inst_mem != inst)
ERROR_LOG(POWERPC, "JIT: compiling outdated code. addr=%x, mem=%x, cache=%x", _Address, inst_mem, inst); ERROR_LOG(POWERPC, "JIT: compiling outdated code. addr=%x, mem=%x, cache=%x", _Address, inst_mem, inst);
#endif
return inst; return inst;
} }
// The following function is deprecated in favour of FAST_ICACHE
u32 Read_Opcode_JIT_LC(const u32 _Address) u32 Read_Opcode_JIT_LC(const u32 _Address)
{ {
#ifdef JIT_UNLIMITED_ICACHE #ifdef JIT_UNLIMITED_ICACHE

View File

@ -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) u32 Flatten(u32 address, int *realsize, BlockStats *st, BlockRegStats *gpa, BlockRegStats *fpa, CodeBuffer *buffer, int blockSize)
{ {
memset(st, 0, sizeof(st)); memset(st, 0, sizeof(st));
UGeckoInstruction previnst = Memory::Read_Opcode_JIT_LC(address - 4);
if (previnst.hex == 0x4e800020) // Disabled the following optimization in preference of FAST_ICACHE
st->isFirstBlockOfFunction = true; //UGeckoInstruction previnst = Memory::Read_Opcode_JIT_LC(address - 4);
//if (previnst.hex == 0x4e800020)
// st->isFirstBlockOfFunction = true;
gpa->any = true; gpa->any = true;
fpa->any = false; fpa->any = false;