@@ -228,39 +228,34 @@ void MIPSState::UpdateCore(CPUCore desired) {
228
228
return ;
229
229
}
230
230
231
+ if (MIPSComp::jit) {
232
+ std::lock_guard<std::recursive_mutex> guard (MIPSComp::jitLock);
233
+ delete MIPSComp::jit;
234
+ MIPSComp::jit = nullptr ;
235
+ }
236
+
231
237
PSP_CoreParameter ().cpuCore = desired;
232
- MIPSComp::JitInterface *oldjit = MIPSComp::jit;
233
238
MIPSComp::JitInterface *newjit = nullptr ;
234
239
235
240
switch (PSP_CoreParameter ().cpuCore ) {
236
241
case CPUCore::JIT:
237
242
case CPUCore::JIT_IR:
238
243
INFO_LOG (Log::CPU, " Switching to JIT%s" , PSP_CoreParameter ().cpuCore == CPUCore::JIT_IR ? " IR" : " " );
239
- if (oldjit) {
240
- std::lock_guard<std::recursive_mutex> guard (MIPSComp::jitLock);
241
- MIPSComp::jit = nullptr ;
242
- delete oldjit;
243
- }
244
244
newjit = MIPSComp::CreateNativeJit (this , PSP_CoreParameter ().cpuCore == CPUCore::JIT_IR);
245
245
break ;
246
246
247
247
case CPUCore::IR_INTERPRETER:
248
248
INFO_LOG (Log::CPU, " Switching to IR interpreter" );
249
- if (oldjit) {
250
- std::lock_guard<std::recursive_mutex> guard (MIPSComp::jitLock);
251
- MIPSComp::jit = nullptr ;
252
- delete oldjit;
253
- }
254
249
newjit = new MIPSComp::IRJit (this , false );
255
250
break ;
256
251
257
252
case CPUCore::INTERPRETER:
258
253
INFO_LOG (Log::CPU, " Switching to interpreter" );
259
- if (oldjit) {
260
- std::lock_guard<std::recursive_mutex> guard (MIPSComp::jitLock);
261
- MIPSComp::jit = nullptr ;
262
- delete oldjit ;
263
- }
254
+ break ;
255
+
256
+ default :
257
+ WARN_LOG (Log::CPU, " Invalid value for cpuCore, falling back to interpreter " ) ;
258
+ // Leave as nullptr.
264
259
break ;
265
260
}
266
261
0 commit comments