JitCache: Use a pointer in FinalizeBlock.

This commit is contained in:
degasus 2017-01-10 23:24:24 +01:00
parent d3aa8c8080
commit f14cebf079
6 changed files with 7 additions and 7 deletions

View File

@ -212,7 +212,7 @@ void CachedInterpreter::Jit(u32 address)
b->codeSize = (u32)(GetCodePtr() - b->checkedEntry);
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()

View File

@ -591,7 +591,7 @@ void Jit64::Jit(u32 em_address)
int block_num = blocks.AllocateBlock(em_address);
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)

View File

@ -509,7 +509,7 @@ void JitIL::Jit(u32 em_address)
int block_num = blocks.AllocateBlock(em_address);
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)

View File

@ -401,7 +401,7 @@ void JitArm64::Jit(u32)
int block_num = blocks.AllocateBlock(em_address);
JitBlock* b = blocks.GetBlock(block_num);
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)

View File

@ -131,9 +131,8 @@ int JitBaseBlockCache::AllocateBlock(u32 em_address)
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))
{
// 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));
DestroyBlock(old_b, true);
}
const int block_num = static_cast<int>(&b - &blocks[0]);
start_block_map[b.physicalAddress] = block_num;
FastLookupEntryForAddress(b.effectiveAddress) = block_num;

View File

@ -132,7 +132,7 @@ public:
int* GetICache();
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.
// This function shall be used if FastLookupEntryForAddress() failed.