mirror of
https://github.com/jpd002/Play-.git
synced 2025-04-28 21:57:57 +03:00
Handle case where block with fixed end branch is not taken.
This commit is contained in:
parent
6d9a9b469e
commit
25e817802a
1 changed files with 16 additions and 0 deletions
|
@ -181,6 +181,7 @@ void CBasicBlock::Compile()
|
|||
void CBasicBlock::CompileRange(CMipsJitter* jitter)
|
||||
{
|
||||
uint32 fixedEnd = m_end;
|
||||
bool needsPcAdjust = false;
|
||||
|
||||
//Update block end because MipsAnalysis might not include an instruction
|
||||
//in a delay slot when cutting a function into basic blocks
|
||||
|
@ -190,6 +191,7 @@ void CBasicBlock::CompileRange(CMipsJitter* jitter)
|
|||
if(branchType == MIPS_BRANCH_NORMAL)
|
||||
{
|
||||
fixedEnd += 4;
|
||||
needsPcAdjust = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -202,6 +204,20 @@ void CBasicBlock::CompileRange(CMipsJitter* jitter)
|
|||
//Sanity check
|
||||
assert(jitter->IsStackEmpty());
|
||||
}
|
||||
|
||||
//Adjust PC to make sure we don't execute the delay slot at the next block
|
||||
if(needsPcAdjust)
|
||||
{
|
||||
jitter->PushCst(MIPS_INVALID_PC);
|
||||
jitter->PushRel(offsetof(CMIPS, m_State.nDelayedJumpAddr));
|
||||
|
||||
jitter->BeginIf(Jitter::CONDITION_EQ);
|
||||
{
|
||||
jitter->PushCst(fixedEnd + 4);
|
||||
jitter->PullRel(offsetof(CMIPS, m_State.nDelayedJumpAddr));
|
||||
}
|
||||
jitter->EndIf();
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int CBasicBlock::Execute()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue