Skip to content

Commit

Permalink
Merge pull request #19268 from hrydgard/fix-ir-jits
Browse files Browse the repository at this point in the history
IRJit: If we're in "JIT using IR" mode, don't accidentally optimize for the interpreter.
  • Loading branch information
hrydgard authored Jun 11, 2024
2 parents 5dec3ca + 9ef5250 commit c739599
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions Core/MIPS/IR/IRJit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,12 @@

namespace MIPSComp {

IRJit::IRJit(MIPSState *mipsState) : frontend_(mipsState->HasDefaultPrefix()), mips_(mipsState) {
IRJit::IRJit(MIPSState *mipsState, bool actualJit) : frontend_(mipsState->HasDefaultPrefix()), mips_(mipsState) {
// u32 size = 128 * 1024;
InitIR();

jo.optimizeForInterpreter = true;
// If this IRJit instance will be used to drive a "JIT using IR", don't optimize for interpretation.
jo.optimizeForInterpreter = !actualJit;

IROptions opts{};
opts.disableFlags = g_Config.uJitDisableFlags;
Expand Down
2 changes: 1 addition & 1 deletion Core/MIPS/IR/IRJit.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ class IRBlockCache : public JitBlockCacheDebugInterface {

class IRJit : public JitInterface {
public:
IRJit(MIPSState *mipsState);
IRJit(MIPSState *mipsState, bool actualJit);
~IRJit();

void DoState(PointerWrap &p) override;
Expand Down
2 changes: 1 addition & 1 deletion Core/MIPS/IR/IRNativeCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ void IRNativeBackend::CompileIRInst(IRInst inst) {
}

IRNativeJit::IRNativeJit(MIPSState *mipsState)
: IRJit(mipsState), debugInterface_(blocks_) {}
: IRJit(mipsState, true), debugInterface_(blocks_) {}

void IRNativeJit::Init(IRNativeBackend &backend) {
backend_ = &backend;
Expand Down
4 changes: 2 additions & 2 deletions Core/MIPS/MIPS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ void MIPSState::Init() {
if (PSP_CoreParameter().cpuCore == CPUCore::JIT || PSP_CoreParameter().cpuCore == CPUCore::JIT_IR) {
MIPSComp::jit = MIPSComp::CreateNativeJit(this, PSP_CoreParameter().cpuCore == CPUCore::JIT_IR);
} else if (PSP_CoreParameter().cpuCore == CPUCore::IR_INTERPRETER) {
MIPSComp::jit = new MIPSComp::IRJit(this);
MIPSComp::jit = new MIPSComp::IRJit(this, false);
} else {
MIPSComp::jit = nullptr;
}
Expand Down Expand Up @@ -252,7 +252,7 @@ void MIPSState::UpdateCore(CPUCore desired) {
MIPSComp::jit = nullptr;
delete oldjit;
}
newjit = new MIPSComp::IRJit(this);
newjit = new MIPSComp::IRJit(this, false);
break;

case CPUCore::INTERPRETER:
Expand Down

0 comments on commit c739599

Please sign in to comment.