Disable block linking while debugger stepping or if there are breakpoints

This commit is contained in:
skidau 2014-10-24 12:57:17 +11:00
parent d0a3bb7650
commit 290e1bed37
6 changed files with 144 additions and 105 deletions

View File

@ -174,13 +174,8 @@ bool Jit64::HandleFault(uintptr_t access_address, SContext* ctx)
void Jit64::Init()
{
jo.optimizeStack = true;
jo.enableBlocklink = true;
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bJITNoBlockLinking ||
SConfig::GetInstance().m_LocalCoreStartupParameter.bMMU)
{
// TODO: support block linking with MMU
jo.enableBlocklink = false;
}
EnableBlockLink();
jo.fpAccurateFcmp = SConfig::GetInstance().m_LocalCoreStartupParameter.bFPRF;
jo.optimizeGatherPipe = true;
jo.fastInterrupts = false;
@ -521,11 +516,19 @@ const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableDebugging)
{
// We can link blocks as long as we are not single stepping and there are no breakpoints here
EnableBlockLink();
// Comment out the following to disable breakpoints (speed-up)
if (!Profiler::g_ProfileBlocks)
{
if (GetState() == CPU_STEPPING)
{
blockSize = 1;
// Do not link this block to other blocks While single stepping
jo.enableBlocklink = false;
}
Trace();
}
}
@ -715,6 +718,9 @@ const u8* Jit64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableDebugging && breakpoints.IsAddressBreakPoint(ops[i].address) && GetState() != CPU_STEPPING)
{
// Turn off block linking if there are breakpoints so that the Step Over command does not link this block.
jo.enableBlocklink = false;
gpr.Flush();
fpr.Flush();
@ -856,3 +862,14 @@ u32 Jit64::CallerSavedRegistersInUse()
}
return result & ABI_ALL_CALLER_SAVED;
}
void Jit64::EnableBlockLink()
{
jo.enableBlocklink = true;
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bJITNoBlockLinking ||
SConfig::GetInstance().m_LocalCoreStartupParameter.bMMU)
{
// TODO: support block linking with MMU
jo.enableBlocklink = false;
}
}

View File

@ -64,6 +64,9 @@ public:
~Jit64() {}
void Init() override;
void EnableBlockLink();
void Shutdown() override;
bool HandleFault(uintptr_t access_address, SContext* ctx) override;

View File

@ -244,13 +244,7 @@ namespace JitILProfiler
void JitIL::Init()
{
jo.optimizeStack = true;
jo.enableBlocklink = true;
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bJITNoBlockLinking ||
SConfig::GetInstance().m_LocalCoreStartupParameter.bMMU)
{
// TODO: support block linking with MMU
jo.enableBlocklink = false;
}
EnableBlockLink();
jo.fpAccurateFcmp = false;
jo.optimizeGatherPipe = true;
@ -509,11 +503,19 @@ const u8* JitIL::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableDebugging)
{
// We can link blocks as long as we are not single stepping and there are no breakpoints here
EnableBlockLink();
// Comment out the following to disable breakpoints (speed-up)
if (!Profiler::g_ProfileBlocks)
{
if (GetState() == CPU_STEPPING)
{
blockSize = 1;
// Do not link this block to other blocks While single stepping
jo.enableBlocklink = false;
}
Trace();
}
}
@ -648,6 +650,9 @@ const u8* JitIL::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bEnableDebugging && breakpoints.IsAddressBreakPoint(ops[i].address) && GetState() != CPU_STEPPING)
{
// Turn off block linking if there are breakpoints so that the Step Over command does not link this block.
jo.enableBlocklink = false;
ibuild.EmitBreakPointCheck(ibuild.EmitIntConst(ops[i].address));
}
@ -702,3 +707,14 @@ const u8* JitIL::DoJit(u32 em_address, PPCAnalyst::CodeBuffer *code_buf, JitBloc
return normalEntry;
}
void JitIL::EnableBlockLink()
{
jo.enableBlocklink = true;
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bJITNoBlockLinking ||
SConfig::GetInstance().m_LocalCoreStartupParameter.bMMU)
{
// TODO: support block linking with MMU
jo.enableBlocklink = false;
}
}

View File

@ -47,6 +47,9 @@ public:
// Initialization, etc
void Init() override;
void EnableBlockLink();
void Shutdown() override;
// Jit!

View File

@ -310,10 +310,10 @@ void CCodeWindow::StepOver()
{
if (CCPU::IsStepping())
{
PowerPC::breakpoints.ClearAllTemporary();
UGeckoInstruction inst = Memory::Read_Instruction(PC);
if (inst.LK)
{
PowerPC::breakpoints.ClearAllTemporary();
PowerPC::breakpoints.Add(PC + 4, true);
CCPU::EnableStepping(false);
JumpToAddress(PC);