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() void Jit64::Init()
{ {
jo.optimizeStack = true; jo.optimizeStack = true;
jo.enableBlocklink = true; EnableBlockLink();
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bJITNoBlockLinking ||
SConfig::GetInstance().m_LocalCoreStartupParameter.bMMU)
{
// TODO: support block linking with MMU
jo.enableBlocklink = false;
}
jo.fpAccurateFcmp = SConfig::GetInstance().m_LocalCoreStartupParameter.bFPRF; jo.fpAccurateFcmp = SConfig::GetInstance().m_LocalCoreStartupParameter.bFPRF;
jo.optimizeGatherPipe = true; jo.optimizeGatherPipe = true;
jo.fastInterrupts = false; 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) 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) // Comment out the following to disable breakpoints (speed-up)
if (!Profiler::g_ProfileBlocks) if (!Profiler::g_ProfileBlocks)
{ {
if (GetState() == CPU_STEPPING) if (GetState() == CPU_STEPPING)
{
blockSize = 1; blockSize = 1;
// Do not link this block to other blocks While single stepping
jo.enableBlocklink = false;
}
Trace(); 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) 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(); gpr.Flush();
fpr.Flush(); fpr.Flush();
@ -856,3 +862,14 @@ u32 Jit64::CallerSavedRegistersInUse()
} }
return result & ABI_ALL_CALLER_SAVED; 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() {} ~Jit64() {}
void Init() override; void Init() override;
void EnableBlockLink();
void Shutdown() override; void Shutdown() override;
bool HandleFault(uintptr_t access_address, SContext* ctx) override; bool HandleFault(uintptr_t access_address, SContext* ctx) override;

View File

@ -244,13 +244,7 @@ namespace JitILProfiler
void JitIL::Init() void JitIL::Init()
{ {
jo.optimizeStack = true; jo.optimizeStack = true;
jo.enableBlocklink = true; EnableBlockLink();
if (SConfig::GetInstance().m_LocalCoreStartupParameter.bJITNoBlockLinking ||
SConfig::GetInstance().m_LocalCoreStartupParameter.bMMU)
{
// TODO: support block linking with MMU
jo.enableBlocklink = false;
}
jo.fpAccurateFcmp = false; jo.fpAccurateFcmp = false;
jo.optimizeGatherPipe = true; 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) 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) // Comment out the following to disable breakpoints (speed-up)
if (!Profiler::g_ProfileBlocks) if (!Profiler::g_ProfileBlocks)
{ {
if (GetState() == CPU_STEPPING) if (GetState() == CPU_STEPPING)
{
blockSize = 1; blockSize = 1;
// Do not link this block to other blocks While single stepping
jo.enableBlocklink = false;
}
Trace(); 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) 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)); 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; 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 // Initialization, etc
void Init() override; void Init() override;
void EnableBlockLink();
void Shutdown() override; void Shutdown() override;
// Jit! // Jit!

View File

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

View File

@ -36,113 +36,113 @@ class wxMenuBar;
class CCodeWindow : public wxPanel class CCodeWindow : public wxPanel
{ {
public: public:
CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter, CCodeWindow(const SCoreStartupParameter& _LocalCoreStartupParameter,
CFrame * parent, CFrame * parent,
wxWindowID id = wxID_ANY, wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
long style = wxTAB_TRAVERSAL | wxBORDER_NONE, long style = wxTAB_TRAVERSAL | wxBORDER_NONE,
const wxString& name = _("Code")); const wxString& name = _("Code"));
void Load(); void Load();
void Save(); void Save();
// Parent interaction // Parent interaction
CFrame *Parent; CFrame *Parent;
wxMenuBar * GetMenuBar(); wxMenuBar * GetMenuBar();
wxToolBar * GetToolBar(); wxToolBar * GetToolBar();
wxBitmap m_Bitmaps[ToolbarDebugBitmapMax]; wxBitmap m_Bitmaps[ToolbarDebugBitmapMax];
bool UseInterpreter(); bool UseInterpreter();
bool BootToPause(); bool BootToPause();
bool AutomaticStart(); bool AutomaticStart();
bool JITNoBlockCache(); bool JITNoBlockCache();
bool JITNoBlockLinking(); bool JITNoBlockLinking();
bool JumpToAddress(u32 address); bool JumpToAddress(u32 address);
void Update() override; void Update() override;
void NotifyMapLoaded(); void NotifyMapLoaded();
void CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParameter, wxMenuBar *pMenuBar); void CreateMenu(const SCoreStartupParameter& _LocalCoreStartupParameter, wxMenuBar *pMenuBar);
void CreateMenuOptions(wxMenu *pMenu); void CreateMenuOptions(wxMenu *pMenu);
void CreateMenuSymbols(wxMenuBar *pMenuBar); void CreateMenuSymbols(wxMenuBar *pMenuBar);
void RecreateToolbar(wxToolBar*); void RecreateToolbar(wxToolBar*);
void PopulateToolbar(wxToolBar* toolBar); void PopulateToolbar(wxToolBar* toolBar);
void UpdateButtonStates(); void UpdateButtonStates();
void OpenPages(); void OpenPages();
void UpdateManager(); void UpdateManager();
// Menu bar // Menu bar
// ------------------- // -------------------
void OnCPUMode(wxCommandEvent& event); // CPU Mode menu void OnCPUMode(wxCommandEvent& event); // CPU Mode menu
void OnJITOff(wxCommandEvent& event); void OnJITOff(wxCommandEvent& event);
void ToggleCodeWindow(bool bShow); void ToggleCodeWindow(bool bShow);
void ToggleRegisterWindow(bool bShow); void ToggleRegisterWindow(bool bShow);
void ToggleWatchWindow(bool bShow); void ToggleWatchWindow(bool bShow);
void ToggleBreakPointWindow(bool bShow); void ToggleBreakPointWindow(bool bShow);
void ToggleMemoryWindow(bool bShow); void ToggleMemoryWindow(bool bShow);
void ToggleJitWindow(bool bShow); void ToggleJitWindow(bool bShow);
void ToggleSoundWindow(bool bShow); void ToggleSoundWindow(bool bShow);
void ToggleVideoWindow(bool bShow); void ToggleVideoWindow(bool bShow);
void OnChangeFont(wxCommandEvent& event); void OnChangeFont(wxCommandEvent& event);
void OnCodeStep(wxCommandEvent& event); void OnCodeStep(wxCommandEvent& event);
void OnAddrBoxChange(wxCommandEvent& event); void OnAddrBoxChange(wxCommandEvent& event);
void OnSymbolsMenu(wxCommandEvent& event); void OnSymbolsMenu(wxCommandEvent& event);
void OnJitMenu(wxCommandEvent& event); void OnJitMenu(wxCommandEvent& event);
void OnProfilerMenu(wxCommandEvent& event); void OnProfilerMenu(wxCommandEvent& event);
// Sub dialogs // Sub dialogs
CRegisterWindow* m_RegisterWindow; CRegisterWindow* m_RegisterWindow;
CWatchWindow* m_WatchWindow; CWatchWindow* m_WatchWindow;
CBreakPointWindow* m_BreakpointWindow; CBreakPointWindow* m_BreakpointWindow;
CMemoryWindow* m_MemoryWindow; CMemoryWindow* m_MemoryWindow;
CJitWindow* m_JitWindow; CJitWindow* m_JitWindow;
DSPDebuggerLLE* m_SoundWindow; DSPDebuggerLLE* m_SoundWindow;
GFXDebuggerPanel* m_VideoWindow; GFXDebuggerPanel* m_VideoWindow;
// Settings // Settings
bool bAutomaticStart; bool bBootToPause; bool bAutomaticStart; bool bBootToPause;
bool bShowOnStart[IDM_VIDEOWINDOW - IDM_LOGWINDOW + 1]; bool bShowOnStart[IDM_VIDEOWINDOW - IDM_LOGWINDOW + 1];
int iNbAffiliation[IDM_CODEWINDOW - IDM_LOGWINDOW + 1]; int iNbAffiliation[IDM_CODEWINDOW - IDM_LOGWINDOW + 1];
private: private:
enum enum
{ {
// Debugger GUI Objects // Debugger GUI Objects
ID_CODEVIEW, ID_CODEVIEW,
ID_CALLSTACKLIST, ID_CALLSTACKLIST,
ID_CALLERSLIST, ID_CALLERSLIST,
ID_CALLSLIST, ID_CALLSLIST,
ID_SYMBOLLIST ID_SYMBOLLIST
}; };
void OnSymbolListChange(wxCommandEvent& event); void OnSymbolListChange(wxCommandEvent& event);
void OnSymbolListContextMenu(wxContextMenuEvent& event); void OnSymbolListContextMenu(wxContextMenuEvent& event);
void OnCallstackListChange(wxCommandEvent& event); void OnCallstackListChange(wxCommandEvent& event);
void OnCallersListChange(wxCommandEvent& event); void OnCallersListChange(wxCommandEvent& event);
void OnCallsListChange(wxCommandEvent& event); void OnCallsListChange(wxCommandEvent& event);
void OnCodeViewChange(wxCommandEvent &event); void OnCodeViewChange(wxCommandEvent &event);
void OnHostMessage(wxCommandEvent& event); void OnHostMessage(wxCommandEvent& event);
// Debugger functions // Debugger functions
void SingleStep(); void SingleStep();
void StepOver(); void StepOver();
void StepOut(); void StepOut();
void ToggleBreakpoint(); void ToggleBreakpoint();
void UpdateLists(); void UpdateLists();
void UpdateCallstack(); void UpdateCallstack();
void InitBitmaps(); void InitBitmaps();
CCodeView* codeview; CCodeView* codeview;
wxListBox* callstack; wxListBox* callstack;
wxListBox* symbols; wxListBox* symbols;
wxListBox* callers; wxListBox* callers;
wxListBox* calls; wxListBox* calls;
Common::Event sync_event; Common::Event sync_event;
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };