diff --git a/Source/Core/Core/HW/WiimoteEmu/EmuSubroutines.cpp b/Source/Core/Core/HW/WiimoteEmu/EmuSubroutines.cpp index 377cda3769..78d68e5f2a 100644 --- a/Source/Core/Core/HW/WiimoteEmu/EmuSubroutines.cpp +++ b/Source/Core/Core/HW/WiimoteEmu/EmuSubroutines.cpp @@ -607,7 +607,11 @@ void Wiimote::DoState(PointerWrap& p) { //clear while (!m_read_requests.empty()) + { + delete[] m_read_requests.front().data; m_read_requests.pop(); + } + p.Do(size); while (size--) diff --git a/Source/Core/Core/PowerPC/Jit64/Jit.cpp b/Source/Core/Core/PowerPC/Jit64/Jit.cpp index a9801ee1fa..1314b8b49b 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit.cpp @@ -210,6 +210,7 @@ void Jit64::Init() // important: do this *after* generating the global asm routines, because we can't use farcode in them. // it'll crash because the farcode functions get cleared on JIT clears. farcode.Init(jo.memcheck ? FARCODE_SIZE_MMU : FARCODE_SIZE); + Clear(); code_block.m_stats = &js.st; code_block.m_gpa = &js.gpa; @@ -223,6 +224,7 @@ void Jit64::ClearCache() trampolines.ClearCodeSpace(); farcode.ClearCodeSpace(); ClearCodeSpace(); + Clear(); UpdateMemoryOptions(); m_clear_cache_asap = false; } diff --git a/Source/Core/Core/PowerPC/Jit64IL/JitIL.cpp b/Source/Core/Core/PowerPC/Jit64IL/JitIL.cpp index 72cb76270e..68fb1aa686 100644 --- a/Source/Core/Core/PowerPC/Jit64IL/JitIL.cpp +++ b/Source/Core/Core/PowerPC/Jit64IL/JitIL.cpp @@ -258,6 +258,7 @@ void JitIL::Init() asm_routines.Init(nullptr); farcode.Init(jo.memcheck ? FARCODE_SIZE_MMU : FARCODE_SIZE); + Clear(); code_block.m_stats = &js.st; code_block.m_gpa = &js.gpa; @@ -273,7 +274,9 @@ void JitIL::ClearCache() { blocks.Clear(); trampolines.ClearCodeSpace(); + farcode.ClearCodeSpace(); ClearCodeSpace(); + Clear(); } void JitIL::Shutdown() @@ -459,7 +462,7 @@ void JitIL::Trace() void JitIL::Jit(u32 em_address) { - if (IsAlmostFull() || farcode.IsAlmostFull() || blocks.IsFull() || + if (IsAlmostFull() || farcode.IsAlmostFull() || trampolines.IsAlmostFull() || blocks.IsFull() || SConfig::GetInstance().bJITNoBlockCache) { ClearCache(); diff --git a/Source/Core/Core/PowerPC/JitCommon/Jit_Util.cpp b/Source/Core/Core/PowerPC/JitCommon/Jit_Util.cpp index 3797fa979d..11a02efb31 100644 --- a/Source/Core/Core/PowerPC/JitCommon/Jit_Util.cpp +++ b/Source/Core/Core/PowerPC/JitCommon/Jit_Util.cpp @@ -1018,3 +1018,11 @@ void EmuCodeBlock::JitClearCA() { MOV(8, PPCSTATE(xer_ca), Imm8(0)); } + +void EmuCodeBlock::Clear() +{ + registersInUseAtLoc.clear(); + pcAtLoc.clear(); + exceptionHandlerAtLoc.clear(); +} + diff --git a/Source/Core/Core/PowerPC/JitCommon/Jit_Util.h b/Source/Core/Core/PowerPC/JitCommon/Jit_Util.h index 4915206786..cc5db24240 100644 --- a/Source/Core/Core/PowerPC/JitCommon/Jit_Util.h +++ b/Source/Core/Core/PowerPC/JitCommon/Jit_Util.h @@ -129,6 +129,7 @@ public: void ConvertSingleToDouble(Gen::X64Reg dst, Gen::X64Reg src, bool src_is_gpr = false); void ConvertDoubleToSingle(Gen::X64Reg dst, Gen::X64Reg src); void SetFPRF(Gen::X64Reg xmm); + void Clear(); protected: std::unordered_map registersInUseAtLoc; std::unordered_map pcAtLoc; diff --git a/Source/Core/Core/PowerPC/JitInterface.cpp b/Source/Core/Core/PowerPC/JitInterface.cpp index 5bc3323a1f..7295ea2a8a 100644 --- a/Source/Core/Core/PowerPC/JitInterface.cpp +++ b/Source/Core/Core/PowerPC/JitInterface.cpp @@ -40,7 +40,7 @@ namespace JitInterface void DoState(PointerWrap &p) { if (jit && p.GetMode() == PointerWrap::MODE_READ) - jit->GetBlockCache()->Clear(); + jit->ClearCache(); } CPUCoreBase *InitJitCore(int core) {