mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-21 14:41:39 +00:00
Seems block linking got too slow, speed it up again.
This commit is contained in:
parent
b9f45e4530
commit
338bc0049d
@ -195,19 +195,29 @@ void JitBlockCache::FinalizeBlock(int block_num, bool block_link)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int binary_search(JitBlock blocks[], const u8 *baseoff, int imin, int imax)
|
||||||
|
{
|
||||||
|
while (imin < imax)
|
||||||
|
{
|
||||||
|
int imid = (imin + imax) / 2;
|
||||||
|
if (blocks[imid].normalEntry < baseoff)
|
||||||
|
imin = imid + 1;
|
||||||
|
else
|
||||||
|
imax = imid;
|
||||||
|
}
|
||||||
|
if ((imax == imin) && (blocks[imin].normalEntry == baseoff))
|
||||||
|
return imin;
|
||||||
|
else
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
int JitBlockCache::GetBlockNumberFromEmuHackOp(u32 inst) const {
|
int JitBlockCache::GetBlockNumberFromEmuHackOp(u32 inst) const {
|
||||||
if (!num_blocks || !MIPS_IS_EMUHACK(inst)) // definitely not a JIT block
|
if (!num_blocks || !MIPS_IS_EMUHACK(inst)) // definitely not a JIT block
|
||||||
return -1;
|
return -1;
|
||||||
int off = (inst & MIPS_EMUHACK_VALUE_MASK);
|
int off = (inst & MIPS_EMUHACK_VALUE_MASK);
|
||||||
|
|
||||||
const u8 *baseoff = codeBlock_->GetBasePtr() + off;
|
const u8 *baseoff = codeBlock_->GetBasePtr() + off;
|
||||||
// TODO: Needs smarter search (binary). This code is not really hot though.
|
return binary_search(blocks, baseoff, 0, num_blocks-1);
|
||||||
for (int i = num_blocks - 1; i >= 0; i--) {
|
|
||||||
if (blocks[i].normalEntry == baseoff && !blocks[i].invalid) {
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 JitBlockCache::GetEmuHackOpForBlock(int blockNum) const {
|
u32 JitBlockCache::GetEmuHackOpForBlock(int blockNum) const {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user