mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-07-11 01:25:07 +02:00
Correct the clearing/destruction order when switching JITs.
Fixes #20502
This commit is contained in:
+3
-2
@@ -140,8 +140,9 @@ __attribute__((format(printf, 5, 6)))
|
||||
// They can have a value between 0 and 15.
|
||||
enum class DebugCounter {
|
||||
APP_BOOT = 0,
|
||||
GAME_BOOT = 0,
|
||||
GAME_SHUTDOWN = 0,
|
||||
GAME_BOOT = 1,
|
||||
GAME_SHUTDOWN = 2,
|
||||
CPUCORE_SWITCHES = 3,
|
||||
};
|
||||
|
||||
bool HitAnyAsserts();
|
||||
|
||||
@@ -119,6 +119,9 @@ private:
|
||||
class IRBlockCache : public JitBlockCacheDebugInterface {
|
||||
public:
|
||||
IRBlockCache(bool compileToNative);
|
||||
~IRBlockCache() {
|
||||
Clear();
|
||||
}
|
||||
|
||||
void Clear();
|
||||
std::vector<int> FindInvalidatedBlockNumbers(u32 address, u32 length);
|
||||
|
||||
+18
-18
@@ -228,39 +228,39 @@ void MIPSState::UpdateCore(CPUCore desired) {
|
||||
return;
|
||||
}
|
||||
|
||||
PSP_CoreParameter().cpuCore = desired;
|
||||
MIPSComp::JitInterface *oldjit = MIPSComp::jit;
|
||||
MIPSComp::JitInterface *newjit = nullptr;
|
||||
IncrementDebugCounter(DebugCounter::CPUCORE_SWITCHES);
|
||||
|
||||
// Get rid of the old JIT first, before switching.
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> guard(MIPSComp::jitLock);
|
||||
if (MIPSComp::jit) {
|
||||
delete MIPSComp::jit;
|
||||
MIPSComp::jit = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
PSP_CoreParameter().cpuCore = desired;
|
||||
|
||||
MIPSComp::JitInterface *newjit = nullptr;
|
||||
switch (PSP_CoreParameter().cpuCore) {
|
||||
case CPUCore::JIT:
|
||||
case CPUCore::JIT_IR:
|
||||
INFO_LOG(Log::CPU, "Switching to JIT%s", PSP_CoreParameter().cpuCore == CPUCore::JIT_IR ? " IR" : "");
|
||||
if (oldjit) {
|
||||
std::lock_guard<std::recursive_mutex> guard(MIPSComp::jitLock);
|
||||
MIPSComp::jit = nullptr;
|
||||
delete oldjit;
|
||||
}
|
||||
newjit = MIPSComp::CreateNativeJit(this, PSP_CoreParameter().cpuCore == CPUCore::JIT_IR);
|
||||
break;
|
||||
|
||||
case CPUCore::IR_INTERPRETER:
|
||||
INFO_LOG(Log::CPU, "Switching to IR interpreter");
|
||||
if (oldjit) {
|
||||
std::lock_guard<std::recursive_mutex> guard(MIPSComp::jitLock);
|
||||
MIPSComp::jit = nullptr;
|
||||
delete oldjit;
|
||||
}
|
||||
newjit = new MIPSComp::IRJit(this, false);
|
||||
break;
|
||||
|
||||
case CPUCore::INTERPRETER:
|
||||
INFO_LOG(Log::CPU, "Switching to interpreter");
|
||||
if (oldjit) {
|
||||
std::lock_guard<std::recursive_mutex> guard(MIPSComp::jitLock);
|
||||
MIPSComp::jit = nullptr;
|
||||
delete oldjit;
|
||||
}
|
||||
// Leaving newjit as null.
|
||||
break;
|
||||
|
||||
default:
|
||||
WARN_LOG(Log::CPU, "Invalid value for cpuCore, falling back to interpreter");
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user