Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IRJit: If we're in "JIT using IR" mode, don't accidentally optimize for the interpreter. #19268

Merged
merged 1 commit into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading