Skip to content

Commit

Permalink
iR3000A/iR5900: Partial revert of 8c98f5d ("Remove mid block jumping")
Browse files Browse the repository at this point in the history
  • Loading branch information
Ziemas authored and F0bes committed Jan 17, 2025
1 parent ef7169d commit 2e35013
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pcsx2/x86/iR3000A.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1595,6 +1595,14 @@ static void iopRecRecompile(const u32 startpc)

while (1)
{
BASEBLOCK* pblock = PSX_GETBLOCK(i);
if (i != startpc && pblock->GetFnptr() != (uptr)iopJITCompile)
{
// branch = 3
willbranch3 = 1;
s_nEndBlock = i;
break;
}

psxRegs.code = iopMemRead32(i);

Expand Down
37 changes: 37 additions & 0 deletions pcsx2/x86/ix86-32/iR5900.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2294,6 +2294,8 @@ static void recRecompile(const u32 startpc)

while (1)
{
BASEBLOCK* pblock = PC_GETBLOCK(i);

// stop before breakpoints
if (isBreakpointNeeded(i) != 0 || isMemcheckNeeded(i) != 0)
{
Expand All @@ -2311,6 +2313,13 @@ static void recRecompile(const u32 startpc)
eeRecPerfLog.Write("Pagesplit @ %08X : size=%d insts", startpc, (i - startpc) / 4);
break;
}

if (pblock->GetFnptr() != (uptr)JITCompile)
{
willbranch3 = 1;
s_nEndBlock = i;
break;
}
}

//HUH ? PSM ? whut ? THIS IS VIRTUAL ACCESS GOD DAMMIT
Expand Down Expand Up @@ -2614,6 +2623,34 @@ static void recRecompile(const u32 startpc)
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);

if (!(pc & 0x10000000))
Expand Down

0 comments on commit 2e35013

Please sign in to comment.