JitCache: Use a pointer in FinalizeBlock.
This commit is contained in:
parent
d3aa8c8080
commit
f14cebf079
|
@ -212,7 +212,7 @@ void CachedInterpreter::Jit(u32 address)
|
||||||
b->codeSize = (u32)(GetCodePtr() - b->checkedEntry);
|
b->codeSize = (u32)(GetCodePtr() - b->checkedEntry);
|
||||||
b->originalSize = code_block.m_num_instructions;
|
b->originalSize = code_block.m_num_instructions;
|
||||||
|
|
||||||
m_block_cache.FinalizeBlock(block_num, jo.enableBlocklink, b->checkedEntry);
|
m_block_cache.FinalizeBlock(*b, jo.enableBlocklink, b->checkedEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CachedInterpreter::ClearCache()
|
void CachedInterpreter::ClearCache()
|
||||||
|
|
|
@ -591,7 +591,7 @@ void Jit64::Jit(u32 em_address)
|
||||||
|
|
||||||
int block_num = blocks.AllocateBlock(em_address);
|
int block_num = blocks.AllocateBlock(em_address);
|
||||||
JitBlock* b = blocks.GetBlock(block_num);
|
JitBlock* b = blocks.GetBlock(block_num);
|
||||||
blocks.FinalizeBlock(block_num, jo.enableBlocklink, DoJit(em_address, &code_buffer, b, nextPC));
|
blocks.FinalizeBlock(*b, jo.enableBlocklink, DoJit(em_address, &code_buffer, b, nextPC));
|
||||||
}
|
}
|
||||||
|
|
||||||
const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer* code_buf, JitBlock* b, u32 nextPC)
|
const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer* code_buf, JitBlock* b, u32 nextPC)
|
||||||
|
|
|
@ -509,7 +509,7 @@ void JitIL::Jit(u32 em_address)
|
||||||
|
|
||||||
int block_num = blocks.AllocateBlock(em_address);
|
int block_num = blocks.AllocateBlock(em_address);
|
||||||
JitBlock* b = blocks.GetBlock(block_num);
|
JitBlock* b = blocks.GetBlock(block_num);
|
||||||
blocks.FinalizeBlock(block_num, jo.enableBlocklink, DoJit(em_address, &code_buffer, b, nextPC));
|
blocks.FinalizeBlock(*b, jo.enableBlocklink, DoJit(em_address, &code_buffer, b, nextPC));
|
||||||
}
|
}
|
||||||
|
|
||||||
const u8* JitIL::DoJit(u32 em_address, PPCAnalyst::CodeBuffer* code_buf, JitBlock* b, u32 nextPC)
|
const u8* JitIL::DoJit(u32 em_address, PPCAnalyst::CodeBuffer* code_buf, JitBlock* b, u32 nextPC)
|
||||||
|
|
|
@ -401,7 +401,7 @@ void JitArm64::Jit(u32)
|
||||||
int block_num = blocks.AllocateBlock(em_address);
|
int block_num = blocks.AllocateBlock(em_address);
|
||||||
JitBlock* b = blocks.GetBlock(block_num);
|
JitBlock* b = blocks.GetBlock(block_num);
|
||||||
const u8* BlockPtr = DoJit(em_address, &code_buffer, b, nextPC);
|
const u8* BlockPtr = DoJit(em_address, &code_buffer, b, nextPC);
|
||||||
blocks.FinalizeBlock(block_num, jo.enableBlocklink, BlockPtr);
|
blocks.FinalizeBlock(*b, jo.enableBlocklink, BlockPtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
const u8* JitArm64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer* code_buf, JitBlock* b, u32 nextPC)
|
const u8* JitArm64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer* code_buf, JitBlock* b, u32 nextPC)
|
||||||
|
|
|
@ -131,9 +131,8 @@ int JitBaseBlockCache::AllocateBlock(u32 em_address)
|
||||||
return num_blocks - 1;
|
return num_blocks - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void JitBaseBlockCache::FinalizeBlock(int block_num, bool block_link, const u8* code_ptr)
|
void JitBaseBlockCache::FinalizeBlock(JitBlock& b, bool block_link, const u8* code_ptr)
|
||||||
{
|
{
|
||||||
JitBlock& b = blocks[block_num];
|
|
||||||
if (start_block_map.count(b.physicalAddress))
|
if (start_block_map.count(b.physicalAddress))
|
||||||
{
|
{
|
||||||
// We already have a block at this address; invalidate the old block.
|
// We already have a block at this address; invalidate the old block.
|
||||||
|
@ -146,6 +145,7 @@ void JitBaseBlockCache::FinalizeBlock(int block_num, bool block_link, const u8*
|
||||||
std::make_pair(old_b.physicalAddress + 4 * old_b.originalSize - 1, old_b.physicalAddress));
|
std::make_pair(old_b.physicalAddress + 4 * old_b.originalSize - 1, old_b.physicalAddress));
|
||||||
DestroyBlock(old_b, true);
|
DestroyBlock(old_b, true);
|
||||||
}
|
}
|
||||||
|
const int block_num = static_cast<int>(&b - &blocks[0]);
|
||||||
start_block_map[b.physicalAddress] = block_num;
|
start_block_map[b.physicalAddress] = block_num;
|
||||||
FastLookupEntryForAddress(b.effectiveAddress) = block_num;
|
FastLookupEntryForAddress(b.effectiveAddress) = block_num;
|
||||||
|
|
||||||
|
|
|
@ -132,7 +132,7 @@ public:
|
||||||
int* GetICache();
|
int* GetICache();
|
||||||
|
|
||||||
int AllocateBlock(u32 em_address);
|
int AllocateBlock(u32 em_address);
|
||||||
void FinalizeBlock(int block_num, bool block_link, const u8* code_ptr);
|
void FinalizeBlock(JitBlock& b, bool block_link, const u8* code_ptr);
|
||||||
|
|
||||||
// Look for the block in the slow but accurate way.
|
// Look for the block in the slow but accurate way.
|
||||||
// This function shall be used if FastLookupEntryForAddress() failed.
|
// This function shall be used if FastLookupEntryForAddress() failed.
|
||||||
|
|
Loading…
Reference in New Issue