Merge pull request #13147 from mitaclaw/jit-block-table-model-fix
JitBlockTableModel: Catch All Block Invalidating Events (I Hope)
This commit is contained in:
commit
adafe1f347
|
@ -146,7 +146,7 @@ void Host_UpdateDisasmDialog()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void Host_JitCacheCleared()
|
void Host_JitCacheInvalidation()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
#include "Core/Config/MainSettings.h"
|
#include "Core/Config/MainSettings.h"
|
||||||
#include "Core/Core.h"
|
#include "Core/Core.h"
|
||||||
|
#include "Core/Host.h"
|
||||||
#include "Core/PowerPC/MMU.h"
|
#include "Core/PowerPC/MMU.h"
|
||||||
#include "Core/PowerPC/PowerPC.h"
|
#include "Core/PowerPC/PowerPC.h"
|
||||||
#include "Core/System.h"
|
#include "Core/System.h"
|
||||||
|
@ -196,6 +197,7 @@ static Installation InstallCodeHandlerLocked(const Core::CPUThreadGuard& guard)
|
||||||
{
|
{
|
||||||
ppc_state.iCache.Invalidate(memory, jit_interface, INSTALLER_BASE_ADDRESS + j);
|
ppc_state.iCache.Invalidate(memory, jit_interface, INSTALLER_BASE_ADDRESS + j);
|
||||||
}
|
}
|
||||||
|
Host_JitCacheInvalidation();
|
||||||
return Installation::Installed;
|
return Installation::Installed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include "Core/HLE/HLE_Misc.h"
|
#include "Core/HLE/HLE_Misc.h"
|
||||||
#include "Core/HLE/HLE_OS.h"
|
#include "Core/HLE/HLE_OS.h"
|
||||||
#include "Core/HW/Memmap.h"
|
#include "Core/HW/Memmap.h"
|
||||||
|
#include "Core/Host.h"
|
||||||
#include "Core/IOS/ES/ES.h"
|
#include "Core/IOS/ES/ES.h"
|
||||||
#include "Core/PowerPC/PPCSymbolDB.h"
|
#include "Core/PowerPC/PPCSymbolDB.h"
|
||||||
#include "Core/PowerPC/PowerPC.h"
|
#include "Core/PowerPC/PowerPC.h"
|
||||||
|
@ -74,6 +75,7 @@ void Patch(Core::System& system, u32 addr, std::string_view func_name)
|
||||||
{
|
{
|
||||||
s_hooked_addresses[addr] = i;
|
s_hooked_addresses[addr] = i;
|
||||||
ppc_state.iCache.Invalidate(memory, jit_interface, addr);
|
ppc_state.iCache.Invalidate(memory, jit_interface, addr);
|
||||||
|
Host_JitCacheInvalidation();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -144,6 +146,8 @@ void PatchFunctions(Core::System& system)
|
||||||
INFO_LOG_FMT(OSHLE, "Patching {} {:08x}", os_patches[i].name, symbol->address);
|
INFO_LOG_FMT(OSHLE, "Patching {} {:08x}", os_patches[i].name, symbol->address);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Host_JitCacheInvalidation();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Clear()
|
void Clear()
|
||||||
|
@ -264,6 +268,7 @@ u32 UnPatch(Core::System& system, std::string_view patch_name)
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Host_JitCacheInvalidation();
|
||||||
return addr;
|
return addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,6 +281,7 @@ u32 UnPatch(Core::System& system, std::string_view patch_name)
|
||||||
s_hooked_addresses.erase(addr);
|
s_hooked_addresses.erase(addr);
|
||||||
ppc_state.iCache.Invalidate(memory, jit_interface, addr);
|
ppc_state.iCache.Invalidate(memory, jit_interface, addr);
|
||||||
}
|
}
|
||||||
|
Host_JitCacheInvalidation();
|
||||||
return symbol->address;
|
return symbol->address;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,6 +305,7 @@ u32 UnpatchRange(Core::System& system, u32 start_addr, u32 end_addr)
|
||||||
i = s_hooked_addresses.erase(i);
|
i = s_hooked_addresses.erase(i);
|
||||||
count += 1;
|
count += 1;
|
||||||
}
|
}
|
||||||
|
Host_JitCacheInvalidation();
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ void Host_PPCSymbolsChanged();
|
||||||
void Host_RefreshDSPDebuggerWindow();
|
void Host_RefreshDSPDebuggerWindow();
|
||||||
void Host_RequestRenderWindowSize(int width, int height);
|
void Host_RequestRenderWindowSize(int width, int height);
|
||||||
void Host_UpdateDisasmDialog();
|
void Host_UpdateDisasmDialog();
|
||||||
void Host_JitCacheCleared();
|
void Host_JitCacheInvalidation();
|
||||||
void Host_JitProfileDataWiped();
|
void Host_JitProfileDataWiped();
|
||||||
void Host_UpdateMainFrame();
|
void Host_UpdateMainFrame();
|
||||||
void Host_UpdateTitle(const std::string& title);
|
void Host_UpdateTitle(const std::string& title);
|
||||||
|
|
|
@ -442,7 +442,7 @@ void CachedInterpreter::ClearCache()
|
||||||
ClearCodeSpace();
|
ClearCodeSpace();
|
||||||
ResetFreeMemoryRanges();
|
ResetFreeMemoryRanges();
|
||||||
RefreshConfig();
|
RefreshConfig();
|
||||||
Host_JitCacheCleared();
|
Host_JitCacheInvalidation();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CachedInterpreter::LogGeneratedCode() const
|
void CachedInterpreter::LogGeneratedCode() const
|
||||||
|
|
|
@ -313,7 +313,7 @@ void Jit64::ClearCache()
|
||||||
RefreshConfig();
|
RefreshConfig();
|
||||||
asm_routines.Regenerate();
|
asm_routines.Regenerate();
|
||||||
ResetFreeMemoryRanges();
|
ResetFreeMemoryRanges();
|
||||||
Host_JitCacheCleared();
|
Host_JitCacheInvalidation();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Jit64::FreeRanges()
|
void Jit64::FreeRanges()
|
||||||
|
|
|
@ -197,7 +197,7 @@ void JitArm64::GenerateAsmAndResetFreeMemoryRanges()
|
||||||
ResetFreeMemoryRanges(routines_near_end - routines_near_start,
|
ResetFreeMemoryRanges(routines_near_end - routines_near_start,
|
||||||
routines_far_end - routines_far_start);
|
routines_far_end - routines_far_start);
|
||||||
|
|
||||||
Host_JitCacheCleared();
|
Host_JitCacheInvalidation();
|
||||||
}
|
}
|
||||||
|
|
||||||
void JitArm64::FreeRanges()
|
void JitArm64::FreeRanges()
|
||||||
|
|
|
@ -57,6 +57,7 @@ static void InvalidateCacheThreadSafe(Core::System& system, u64 userdata, s64 cy
|
||||||
{
|
{
|
||||||
system.GetPPCState().iCache.Invalidate(system.GetMemory(), system.GetJitInterface(),
|
system.GetPPCState().iCache.Invalidate(system.GetMemory(), system.GetJitInterface(),
|
||||||
static_cast<u32>(userdata));
|
static_cast<u32>(userdata));
|
||||||
|
Host_JitCacheInvalidation();
|
||||||
}
|
}
|
||||||
|
|
||||||
PowerPCManager::PowerPCManager(Core::System& system)
|
PowerPCManager::PowerPCManager(Core::System& system)
|
||||||
|
@ -296,6 +297,7 @@ void PowerPCManager::ScheduleInvalidateCacheThreadSafe(u32 address)
|
||||||
{
|
{
|
||||||
m_ppc_state.iCache.Invalidate(m_system.GetMemory(), m_system.GetJitInterface(),
|
m_ppc_state.iCache.Invalidate(m_system.GetMemory(), m_system.GetJitInterface(),
|
||||||
static_cast<u32>(address));
|
static_cast<u32>(address));
|
||||||
|
Host_JitCacheInvalidation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ void Host_UpdateDisasmDialog()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void Host_JitCacheCleared()
|
void Host_JitCacheInvalidation()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -313,7 +313,7 @@ void JITWidget::SaveQSettings() const
|
||||||
void JITWidget::ConnectSlots()
|
void JITWidget::ConnectSlots()
|
||||||
{
|
{
|
||||||
auto* const host = Host::GetInstance();
|
auto* const host = Host::GetInstance();
|
||||||
connect(host, &Host::JitCacheCleared, this, &JITWidget::OnJitCacheCleared);
|
connect(host, &Host::JitCacheInvalidation, this, &JITWidget::OnJitCacheInvalidation);
|
||||||
connect(host, &Host::UpdateDisasmDialog, this, &JITWidget::OnUpdateDisasmDialog);
|
connect(host, &Host::UpdateDisasmDialog, this, &JITWidget::OnUpdateDisasmDialog);
|
||||||
connect(host, &Host::PPCSymbolsChanged, this, &JITWidget::OnPPCSymbolsUpdated);
|
connect(host, &Host::PPCSymbolsChanged, this, &JITWidget::OnPPCSymbolsUpdated);
|
||||||
connect(host, &Host::PPCBreakpointsChanged, this, &JITWidget::OnPPCBreakpointsChanged);
|
connect(host, &Host::PPCBreakpointsChanged, this, &JITWidget::OnPPCBreakpointsChanged);
|
||||||
|
@ -326,7 +326,7 @@ void JITWidget::ConnectSlots()
|
||||||
void JITWidget::DisconnectSlots()
|
void JITWidget::DisconnectSlots()
|
||||||
{
|
{
|
||||||
auto* const host = Host::GetInstance();
|
auto* const host = Host::GetInstance();
|
||||||
disconnect(host, &Host::JitCacheCleared, this, &JITWidget::OnJitCacheCleared);
|
disconnect(host, &Host::JitCacheInvalidation, this, &JITWidget::OnJitCacheInvalidation);
|
||||||
disconnect(host, &Host::UpdateDisasmDialog, this, &JITWidget::OnUpdateDisasmDialog);
|
disconnect(host, &Host::UpdateDisasmDialog, this, &JITWidget::OnUpdateDisasmDialog);
|
||||||
disconnect(host, &Host::PPCSymbolsChanged, this, &JITWidget::OnPPCSymbolsUpdated);
|
disconnect(host, &Host::PPCSymbolsChanged, this, &JITWidget::OnPPCSymbolsUpdated);
|
||||||
disconnect(host, &Host::PPCBreakpointsChanged, this, &JITWidget::OnPPCBreakpointsChanged);
|
disconnect(host, &Host::PPCBreakpointsChanged, this, &JITWidget::OnPPCBreakpointsChanged);
|
||||||
|
@ -340,7 +340,7 @@ void JITWidget::Show()
|
||||||
{
|
{
|
||||||
ConnectSlots();
|
ConnectSlots();
|
||||||
// Handle every slot that may have missed a signal while this widget was hidden.
|
// Handle every slot that may have missed a signal while this widget was hidden.
|
||||||
// OnJitCacheCleared() can be skipped.
|
// OnJitCacheInvalidation() can be skipped.
|
||||||
// OnUpdateDisasmDialog() can be skipped.
|
// OnUpdateDisasmDialog() can be skipped.
|
||||||
// OnPPCSymbolsUpdated() can be skipped.
|
// OnPPCSymbolsUpdated() can be skipped.
|
||||||
// OnPPCBreakpointsChanged() can be skipped.
|
// OnPPCBreakpointsChanged() can be skipped.
|
||||||
|
@ -446,7 +446,7 @@ void JITWidget::OnStatusBarPressed()
|
||||||
ShowFreeMemoryStatus();
|
ShowFreeMemoryStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void JITWidget::OnJitCacheCleared()
|
void JITWidget::OnJitCacheInvalidation()
|
||||||
{
|
{
|
||||||
if (Core::GetState(m_system) != Core::State::Paused)
|
if (Core::GetState(m_system) != Core::State::Paused)
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -102,7 +102,7 @@ private:
|
||||||
void OnStatusBarPressed();
|
void OnStatusBarPressed();
|
||||||
|
|
||||||
// Conditionally connected slots (external signals)
|
// Conditionally connected slots (external signals)
|
||||||
void OnJitCacheCleared();
|
void OnJitCacheInvalidation();
|
||||||
void OnUpdateDisasmDialog();
|
void OnUpdateDisasmDialog();
|
||||||
void OnPPCSymbolsUpdated();
|
void OnPPCSymbolsUpdated();
|
||||||
void OnPPCBreakpointsChanged();
|
void OnPPCBreakpointsChanged();
|
||||||
|
|
|
@ -112,7 +112,7 @@ void JitBlockTableModel::UpdateSymbols()
|
||||||
void JitBlockTableModel::ConnectSlots()
|
void JitBlockTableModel::ConnectSlots()
|
||||||
{
|
{
|
||||||
auto* const host = Host::GetInstance();
|
auto* const host = Host::GetInstance();
|
||||||
connect(host, &Host::JitCacheCleared, this, &JitBlockTableModel::OnJitCacheCleared);
|
connect(host, &Host::JitCacheInvalidation, this, &JitBlockTableModel::OnJitCacheInvalidation);
|
||||||
connect(host, &Host::JitProfileDataWiped, this, &JitBlockTableModel::OnJitProfileDataWiped);
|
connect(host, &Host::JitProfileDataWiped, this, &JitBlockTableModel::OnJitProfileDataWiped);
|
||||||
connect(host, &Host::UpdateDisasmDialog, this, &JitBlockTableModel::OnUpdateDisasmDialog);
|
connect(host, &Host::UpdateDisasmDialog, this, &JitBlockTableModel::OnUpdateDisasmDialog);
|
||||||
connect(host, &Host::PPCSymbolsChanged, this, &JitBlockTableModel::OnPPCSymbolsUpdated);
|
connect(host, &Host::PPCSymbolsChanged, this, &JitBlockTableModel::OnPPCSymbolsUpdated);
|
||||||
|
@ -125,7 +125,7 @@ void JitBlockTableModel::ConnectSlots()
|
||||||
void JitBlockTableModel::DisconnectSlots()
|
void JitBlockTableModel::DisconnectSlots()
|
||||||
{
|
{
|
||||||
auto* const host = Host::GetInstance();
|
auto* const host = Host::GetInstance();
|
||||||
disconnect(host, &Host::JitCacheCleared, this, &JitBlockTableModel::OnJitCacheCleared);
|
disconnect(host, &Host::JitCacheInvalidation, this, &JitBlockTableModel::OnJitCacheInvalidation);
|
||||||
disconnect(host, &Host::JitProfileDataWiped, this, &JitBlockTableModel::OnJitProfileDataWiped);
|
disconnect(host, &Host::JitProfileDataWiped, this, &JitBlockTableModel::OnJitProfileDataWiped);
|
||||||
disconnect(host, &Host::UpdateDisasmDialog, this, &JitBlockTableModel::OnUpdateDisasmDialog);
|
disconnect(host, &Host::UpdateDisasmDialog, this, &JitBlockTableModel::OnUpdateDisasmDialog);
|
||||||
disconnect(host, &Host::PPCSymbolsChanged, this, &JitBlockTableModel::OnPPCSymbolsUpdated);
|
disconnect(host, &Host::PPCSymbolsChanged, this, &JitBlockTableModel::OnPPCSymbolsUpdated);
|
||||||
|
@ -169,7 +169,7 @@ void JitBlockTableModel::OnFilterSymbolTextChanged(const QString& string)
|
||||||
m_filtering_by_symbols = !string.isEmpty();
|
m_filtering_by_symbols = !string.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void JitBlockTableModel::OnJitCacheCleared()
|
void JitBlockTableModel::OnJitCacheInvalidation()
|
||||||
{
|
{
|
||||||
Update(Core::GetState(m_system));
|
Update(Core::GetState(m_system));
|
||||||
}
|
}
|
||||||
|
@ -187,7 +187,9 @@ void JitBlockTableModel::OnUpdateDisasmDialog()
|
||||||
|
|
||||||
void JitBlockTableModel::OnPPCSymbolsUpdated()
|
void JitBlockTableModel::OnPPCSymbolsUpdated()
|
||||||
{
|
{
|
||||||
UpdateSymbols();
|
// Previously, this was only a call to `UpdateSymbols`, but HLE patch engine code can
|
||||||
|
// invalidate JIT blocks when specific symbols are loaded. What can be done about it?
|
||||||
|
Update(Core::GetState(m_system));
|
||||||
}
|
}
|
||||||
|
|
||||||
void JitBlockTableModel::OnPPCBreakpointsChanged()
|
void JitBlockTableModel::OnPPCBreakpointsChanged()
|
||||||
|
|
|
@ -106,7 +106,7 @@ private:
|
||||||
void Hide();
|
void Hide();
|
||||||
|
|
||||||
// Conditionally connected slots (external signals)
|
// Conditionally connected slots (external signals)
|
||||||
void OnJitCacheCleared();
|
void OnJitCacheInvalidation();
|
||||||
void OnJitProfileDataWiped();
|
void OnJitProfileDataWiped();
|
||||||
void OnUpdateDisasmDialog();
|
void OnUpdateDisasmDialog();
|
||||||
void OnPPCSymbolsUpdated();
|
void OnPPCSymbolsUpdated();
|
||||||
|
|
|
@ -256,9 +256,9 @@ void Host_UpdateDisasmDialog()
|
||||||
QueueOnObject(QApplication::instance(), [] { emit Host::GetInstance()->UpdateDisasmDialog(); });
|
QueueOnObject(QApplication::instance(), [] { emit Host::GetInstance()->UpdateDisasmDialog(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
void Host_JitCacheCleared()
|
void Host_JitCacheInvalidation()
|
||||||
{
|
{
|
||||||
QueueOnObject(QApplication::instance(), [] { emit Host::GetInstance()->JitCacheCleared(); });
|
QueueOnObject(QApplication::instance(), [] { emit Host::GetInstance()->JitCacheInvalidation(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
void Host_JitProfileDataWiped()
|
void Host_JitProfileDataWiped()
|
||||||
|
|
|
@ -40,7 +40,7 @@ signals:
|
||||||
void RequestStop();
|
void RequestStop();
|
||||||
void RequestRenderSize(int w, int h);
|
void RequestRenderSize(int w, int h);
|
||||||
void UpdateDisasmDialog();
|
void UpdateDisasmDialog();
|
||||||
void JitCacheCleared();
|
void JitCacheInvalidation();
|
||||||
void JitProfileDataWiped();
|
void JitProfileDataWiped();
|
||||||
void PPCSymbolsChanged();
|
void PPCSymbolsChanged();
|
||||||
void PPCBreakpointsChanged();
|
void PPCBreakpointsChanged();
|
||||||
|
|
|
@ -61,7 +61,7 @@ void Host_UpdateDisasmDialog()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void Host_JitCacheCleared()
|
void Host_JitCacheInvalidation()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ bool Host_UpdateDiscordPresenceRaw(const std::string& details, const std::string
|
||||||
void Host_UpdateDisasmDialog()
|
void Host_UpdateDisasmDialog()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
void Host_JitCacheCleared()
|
void Host_JitCacheInvalidation()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
void Host_JitProfileDataWiped()
|
void Host_JitProfileDataWiped()
|
||||||
|
|
|
@ -41,7 +41,7 @@ bool Host_UpdateDiscordPresenceRaw(const std::string& details, const std::string
|
||||||
void Host_UpdateDisasmDialog()
|
void Host_UpdateDisasmDialog()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
void Host_JitCacheCleared()
|
void Host_JitCacheInvalidation()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
void Host_JitProfileDataWiped()
|
void Host_JitProfileDataWiped()
|
||||||
|
|
Loading…
Reference in New Issue