iR5900: Remove mid block jumping

This commit is contained in:
JordanTheToaster 2024-12-02 17:27:39 +00:00
parent 34c9590cf1
commit 88e322a7a3
2 changed files with 2 additions and 78 deletions

View File

@ -155,7 +155,6 @@ static void iopRecRecompile(u32 startpc);
static const void* iopDispatcherEvent = nullptr;
static const void* iopDispatcherReg = nullptr;
static const void* iopJITCompile = nullptr;
static const void* iopJITCompileInBlock = nullptr;
static const void* iopEnterRecompiledCode = nullptr;
static const void* iopExitRecompiledCode = nullptr;
@ -183,13 +182,6 @@ static const void* _DynGen_JITCompile()
return retval;
}
static const void* _DynGen_JITCompileInBlock()
{
u8* retval = xGetPtr();
xJMP((void*)iopJITCompile);
return retval;
}
// called when jumping to variable pc address
static const void* _DynGen_DispatcherReg()
{
@ -244,7 +236,6 @@ static void _DynGen_Dispatchers()
iopDispatcherReg = _DynGen_DispatcherReg();
iopJITCompile = _DynGen_JITCompile();
iopJITCompileInBlock = _DynGen_JITCompileInBlock();
iopEnterRecompiledCode = _DynGen_EnterRecompiledCode();
recBlocks.SetJITCompile(iopJITCompile);
@ -1606,14 +1597,6 @@ static void iopRecRecompile(const u32 startpc)
while (1)
{
BASEBLOCK* pblock = PSX_GETBLOCK(i);
if (i != startpc && pblock->GetFnptr() != (uptr)iopJITCompile && pblock->GetFnptr() != (uptr)iopJITCompileInBlock)
{
// branch = 3
willbranch3 = 1;
s_nEndBlock = i;
break;
}
psxRegs.code = iopMemRead32(i);
@ -1716,12 +1699,6 @@ StartRecomp:
pxAssert((psxpc - startpc) >> 2 <= 0xffff);
s_pCurBlockEx->size = (psxpc - startpc) >> 2;
for (i = 1; i < (u32)s_pCurBlockEx->size; ++i)
{
if (s_pCurBlock[i].GetFnptr() == (uptr)iopJITCompile)
s_pCurBlock[i].SetFnptr((uptr)iopJITCompileInBlock);
}
if (!(psxpc & 0x10000000))
g_psxMaxRecMem = std::max((psxpc & ~0xa0000000), g_psxMaxRecMem);

View File

@ -350,7 +350,6 @@ static void dyna_page_reset(u32 start, u32 sz);
static const void* DispatcherEvent = nullptr;
static const void* DispatcherReg = nullptr;
static const void* JITCompile = nullptr;
static const void* JITCompileInBlock = nullptr;
static const void* EnterRecompiledCode = nullptr;
static const void* DispatchBlockDiscard = nullptr;
static const void* DispatchPageReset = nullptr;
@ -389,13 +388,6 @@ static const void* _DynGen_JITCompile()
return retval;
}
static const void* _DynGen_JITCompileInBlock()
{
u8* retval = xGetAlignedCallTarget();
xJMP(JITCompile);
return retval;
}
// called when jumping to variable pc address
static const void* _DynGen_DispatcherReg()
{
@ -479,7 +471,6 @@ static void _DynGen_Dispatchers()
DispatcherReg = _DynGen_DispatcherReg();
JITCompile = _DynGen_JITCompile();
JITCompileInBlock = _DynGen_JITCompileInBlock();
EnterRecompiledCode = _DynGen_EnterRecompiledCode();
DispatchBlockDiscard = _DynGen_DispatchBlockDiscard();
DispatchPageReset = _DynGen_DispatchPageReset();
@ -773,9 +764,7 @@ void recClear(u32 addr, u32 size)
lowerextent = std::min(lowerextent, blockstart);
upperextent = std::max(upperextent, blockend);
// This might end up inside a block that doesn't contain the clearing range,
// so set it to recompile now. This will become JITCompile if we clear it.
pblock->SetFnptr((uptr)JITCompileInBlock);
pblock->SetFnptr((uptr)JITCompile);
blockidx--;
}
@ -2305,8 +2294,6 @@ static void recRecompile(const u32 startpc)
while (1)
{
BASEBLOCK* pblock = PC_GETBLOCK(i);
// stop before breakpoints
if (isBreakpointNeeded(i) != 0 || isMemcheckNeeded(i) != 0)
{
@ -2324,13 +2311,6 @@ static void recRecompile(const u32 startpc)
eeRecPerfLog.Write("Pagesplit @ %08X : size=%d insts", startpc, (i - startpc) / 4);
break;
}
if (pblock->GetFnptr() != (uptr)JITCompile && pblock->GetFnptr() != (uptr)JITCompileInBlock)
{
willbranch3 = 1;
s_nEndBlock = i;
break;
}
}
//HUH ? PSM ? whut ? THIS IS VIRTUAL ACCESS GOD DAMMIT
@ -2566,6 +2546,7 @@ StartRecomp:
if (EmuConfig.Speedhacks.vuFlagHack)
COP2FlagHackPass().Run(startpc, s_nEndBlock, s_pInstCache + 1);
}
//WARNING_LOG("Compiling block {:08X} => {:08X}", startpc, s_nEndBlock);
#ifdef DUMP_BLOCKS
ZydisDecoder disas_decoder;
@ -2634,42 +2615,8 @@ StartRecomp:
pxAssert((pc - startpc) >> 2 <= 0xffff);
s_pCurBlockEx->size = (pc - startpc) >> 2;
if (HWADDR(pc) <= Ps2MemSize::ExposedRam)
{
BASEBLOCKEX* oldBlock;
int i;
i = recBlocks.LastIndex(HWADDR(pc) - 4);
while ((oldBlock = recBlocks[i--]))
{
if (oldBlock == s_pCurBlockEx)
continue;
if (oldBlock->startpc >= HWADDR(pc))
continue;
if ((oldBlock->startpc + oldBlock->size * 4) <= HWADDR(startpc))
break;
if (memcmp(&recRAMCopy[oldBlock->startpc / 4], PSM(oldBlock->startpc),
oldBlock->size * 4))
{
recClear(startpc, (pc - startpc) / 4);
s_pCurBlockEx = recBlocks.Get(HWADDR(startpc));
pxAssert(s_pCurBlockEx->startpc == HWADDR(startpc));
break;
}
}
memcpy(&recRAMCopy[HWADDR(startpc) / 4], PSM(startpc), pc - startpc);
}
s_pCurBlock->SetFnptr((uptr)recPtr);
for (i = 1; i < static_cast<u32>(s_pCurBlockEx->size); i++)
{
if ((uptr)JITCompile == s_pCurBlock[i].GetFnptr())
s_pCurBlock[i].SetFnptr((uptr)JITCompileInBlock);
}
if (!(pc & 0x10000000))
maxrecmem = std::max((pc & ~0xa0000000), maxrecmem);