JitCache: Do not use block 0.

This ID is reserved for invalid blocks. So this block can't be invalidated.
This commit is contained in:
degasus 2016-08-06 14:15:11 +02:00
parent 814f29b25b
commit 85affe995e
2 changed files with 5 additions and 4 deletions

View File

@ -42,7 +42,7 @@ void JitBaseBlockCache::Init()
void JitBaseBlockCache::Shutdown()
{
num_blocks = 0;
num_blocks = 1;
JitRegister::Shutdown();
}
@ -59,7 +59,7 @@ void JitBaseBlockCache::Clear()
#endif
jit->js.fifoWriteAddresses.clear();
jit->js.pairedQuantizeAddresses.clear();
for (int i = 0; i < num_blocks; i++)
for (int i = 1; i < num_blocks; i++)
{
DestroyBlock(i, false);
}
@ -68,7 +68,7 @@ void JitBaseBlockCache::Clear()
valid_block.ClearAll();
num_blocks = 0;
num_blocks = 1;
blocks[0].msrBits = 0xFFFFFFFF;
blocks[0].invalid = true;
}

View File

@ -114,6 +114,7 @@ public:
private:
// We store the metadata of all blocks in a linear way within this array.
// Note: blocks[0] must not be used as it is referenced as invalid block in iCache.
std::array<JitBlock, MAX_NUM_BLOCKS> blocks; // number -> JitBlock
int num_blocks;
@ -152,7 +153,7 @@ private:
virtual void WriteLinkBlock(const JitBlock::LinkData& source, const JitBlock* dest) = 0;
virtual void WriteDestroyBlock(const JitBlock& block) {}
public:
JitBaseBlockCache() : num_blocks(0) {}
JitBaseBlockCache() : num_blocks(1) {}
virtual ~JitBaseBlockCache() {}
int AllocateBlock(u32 em_address);
void FinalizeBlock(int block_num, bool block_link, const u8* code_ptr);