mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
JitCache: Split off JIT call from dispatcher.
This avoid flushing the BLR optimization stack on fast_block_cache misses.
This commit is contained in:
@ -12,7 +12,7 @@
|
||||
|
||||
JitBase* g_jit;
|
||||
|
||||
void Jit(u32 em_address)
|
||||
void JitTrampoline(u32 em_address)
|
||||
{
|
||||
g_jit->Jit(em_address);
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ public:
|
||||
virtual bool HandleStackFault() { return false; }
|
||||
};
|
||||
|
||||
void Jit(u32 em_address);
|
||||
void JitTrampoline(u32 em_address);
|
||||
|
||||
// Merged routines that should be moved somewhere better
|
||||
u32 Helper_Mask(u8 mb, u8 me);
|
||||
|
@ -174,11 +174,11 @@ const u8* JitBaseBlockCache::Dispatch()
|
||||
{
|
||||
JitBlock* block = fast_block_map[FastLookupIndexForAddress(PC)];
|
||||
|
||||
while (!block || block->effectiveAddress != PC || block->msrBits != (MSR & JIT_CACHE_MSR_MASK))
|
||||
{
|
||||
MoveBlockIntoFastCache(PC, MSR & JIT_CACHE_MSR_MASK);
|
||||
block = fast_block_map[FastLookupIndexForAddress(PC)];
|
||||
}
|
||||
if (!block || block->effectiveAddress != PC || block->msrBits != (MSR & JIT_CACHE_MSR_MASK))
|
||||
block = MoveBlockIntoFastCache(PC, MSR & JIT_CACHE_MSR_MASK);
|
||||
|
||||
if (!block)
|
||||
return nullptr;
|
||||
|
||||
return block->normalEntry;
|
||||
}
|
||||
@ -349,25 +349,23 @@ void JitBaseBlockCache::DestroyBlock(JitBlock& block)
|
||||
WriteDestroyBlock(block);
|
||||
}
|
||||
|
||||
void JitBaseBlockCache::MoveBlockIntoFastCache(u32 addr, u32 msr)
|
||||
JitBlock* JitBaseBlockCache::MoveBlockIntoFastCache(u32 addr, u32 msr)
|
||||
{
|
||||
JitBlock* block = GetBlockFromStartAddress(addr, msr);
|
||||
if (!block)
|
||||
{
|
||||
Jit(addr);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Drop old fast block map entry
|
||||
if (fast_block_map[block->fast_block_map_index] == block)
|
||||
fast_block_map[block->fast_block_map_index] = nullptr;
|
||||
|
||||
// And create a new one
|
||||
size_t index = FastLookupIndexForAddress(addr);
|
||||
fast_block_map[index] = block;
|
||||
block->fast_block_map_index = index;
|
||||
LinkBlock(*block);
|
||||
}
|
||||
if (!block)
|
||||
return nullptr;
|
||||
|
||||
// Drop old fast block map entry
|
||||
if (fast_block_map[block->fast_block_map_index] == block)
|
||||
fast_block_map[block->fast_block_map_index] = nullptr;
|
||||
|
||||
// And create a new one
|
||||
size_t index = FastLookupIndexForAddress(addr);
|
||||
fast_block_map[index] = block;
|
||||
block->fast_block_map_index = index;
|
||||
|
||||
return block;
|
||||
}
|
||||
|
||||
size_t JitBaseBlockCache::FastLookupIndexForAddress(u32 address)
|
||||
|
@ -161,7 +161,7 @@ private:
|
||||
void UnlinkBlock(const JitBlock& block);
|
||||
void DestroyBlock(JitBlock& block);
|
||||
|
||||
void MoveBlockIntoFastCache(u32 em_address, u32 msr);
|
||||
JitBlock* MoveBlockIntoFastCache(u32 em_address, u32 msr);
|
||||
|
||||
// Fast but risky block lookup based on fast_block_map.
|
||||
size_t FastLookupIndexForAddress(u32 address);
|
||||
|
Reference in New Issue
Block a user