JitCache: Return a pointer in AllocateBlock.

This commit is contained in:
degasus 2017-01-10 23:28:44 +01:00
parent f14cebf079
commit 2d5288dc10
6 changed files with 7 additions and 11 deletions

View File

@ -140,8 +140,7 @@ void CachedInterpreter::Jit(u32 address)
return; return;
} }
int block_num = m_block_cache.AllocateBlock(PC); JitBlock* b = m_block_cache.AllocateBlock(PC);
JitBlock* b = m_block_cache.GetBlock(block_num);
js.blockStart = PC; js.blockStart = PC;
js.firstFPInstructionFound = false; js.firstFPInstructionFound = false;

View File

@ -589,8 +589,7 @@ void Jit64::Jit(u32 em_address)
return; return;
} }
int block_num = blocks.AllocateBlock(em_address); JitBlock* b = blocks.AllocateBlock(em_address);
JitBlock* b = blocks.GetBlock(block_num);
blocks.FinalizeBlock(*b, jo.enableBlocklink, DoJit(em_address, &code_buffer, b, nextPC)); blocks.FinalizeBlock(*b, jo.enableBlocklink, DoJit(em_address, &code_buffer, b, nextPC));
} }

View File

@ -507,8 +507,7 @@ void JitIL::Jit(u32 em_address)
return; return;
} }
int block_num = blocks.AllocateBlock(em_address); JitBlock* b = blocks.AllocateBlock(em_address);
JitBlock* b = blocks.GetBlock(block_num);
blocks.FinalizeBlock(*b, jo.enableBlocklink, DoJit(em_address, &code_buffer, b, nextPC)); blocks.FinalizeBlock(*b, jo.enableBlocklink, DoJit(em_address, &code_buffer, b, nextPC));
} }

View File

@ -398,8 +398,7 @@ void JitArm64::Jit(u32)
return; return;
} }
int block_num = blocks.AllocateBlock(em_address); JitBlock* b = blocks.AllocateBlock(em_address);
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(*b, jo.enableBlocklink, BlockPtr); blocks.FinalizeBlock(*b, jo.enableBlocklink, BlockPtr);
} }

View File

@ -119,7 +119,7 @@ int* JitBaseBlockCache::GetICache()
return iCache.data(); return iCache.data();
} }
int JitBaseBlockCache::AllocateBlock(u32 em_address) JitBlock* JitBaseBlockCache::AllocateBlock(u32 em_address)
{ {
JitBlock& b = blocks[num_blocks]; JitBlock& b = blocks[num_blocks];
b.invalid = false; b.invalid = false;
@ -128,7 +128,7 @@ int JitBaseBlockCache::AllocateBlock(u32 em_address)
b.msrBits = MSR & JitBlock::JIT_CACHE_MSR_MASK; b.msrBits = MSR & JitBlock::JIT_CACHE_MSR_MASK;
b.linkData.clear(); b.linkData.clear();
num_blocks++; // commit the current block num_blocks++; // commit the current block
return num_blocks - 1; return &b;
} }
void JitBaseBlockCache::FinalizeBlock(JitBlock& b, bool block_link, const u8* code_ptr) void JitBaseBlockCache::FinalizeBlock(JitBlock& b, bool block_link, const u8* code_ptr)

View File

@ -131,7 +131,7 @@ public:
int GetNumBlocks() const; int GetNumBlocks() const;
int* GetICache(); int* GetICache();
int AllocateBlock(u32 em_address); JitBlock* AllocateBlock(u32 em_address);
void FinalizeBlock(JitBlock& b, 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.