summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorTilka <tilkax@gmail.com>2020-02-08 13:49:33 +0000
committerGitHub <noreply@github.com>2020-02-08 13:49:33 +0000
commite323f47cebc979c2147f928620b6907362b8a2ba (patch)
tree57221063332ab8b4c3d5366828db9ff955a16a25 /Source
parenta205ecb446e5920d1fb6f6ffde6dc83b956fd877 (diff)
parent3ebcc445de7e2a88a0be0a6ca967f5b0d9b9e01e (diff)
Merge pull request #8472 from degasus/jitsetting
Core/Jits: Adds an option to disable the register cache.
Diffstat (limited to 'Source')
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java5
-rw-r--r--Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/utils/SettingsFile.java1
-rw-r--r--Source/Android/app/src/main/res/values/strings.xml1
-rw-r--r--Source/Core/Core/ConfigManager.cpp3
-rw-r--r--Source/Core/Core/ConfigManager.h1
-rw-r--r--Source/Core/Core/PowerPC/Jit64/Jit.cpp26
-rw-r--r--Source/Core/Core/PowerPC/JitArm64/Jit.cpp7
-rw-r--r--Source/Core/DolphinQt/MenuBar.cpp10
-rw-r--r--Source/Core/DolphinQt/MenuBar.h1
9 files changed, 45 insertions, 10 deletions
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java
index 9bf66e3cbe..1b2b4ddad5 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/ui/SettingsFragmentPresenter.java
@@ -641,6 +641,8 @@ public final class SettingsFragmentPresenter
Setting jitSystemRegistersOff =
debugSection.getSetting(SettingsFile.KEY_DEBUG_JITSYSTEMREGISTEROFF);
Setting jitBranchOff = debugSection.getSetting(SettingsFile.KEY_DEBUG_JITBRANCHOFF);
+ Setting jitRegisterCacheOff =
+ debugSection.getSetting(SettingsFile.KEY_DEBUG_JITREGISTERCACHEOFF);
sl.add(new HeaderSetting(null, null, R.string.debug_warning, 0));
@@ -673,6 +675,9 @@ public final class SettingsFragmentPresenter
sl.add(new CheckBoxSetting(SettingsFile.KEY_DEBUG_JITBRANCHOFF, Settings.SECTION_DEBUG,
R.string.debug_jitbranchoff, 0, false,
jitBranchOff));
+ sl.add(new CheckBoxSetting(SettingsFile.KEY_DEBUG_JITREGISTERCACHEOFF, Settings.SECTION_DEBUG,
+ R.string.debug_jitregistercacheoff, 0, false,
+ jitRegisterCacheOff));
}
private void addStereoSettings(ArrayList<SettingsItem> sl)
diff --git a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/utils/SettingsFile.java b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/utils/SettingsFile.java
index c4e61b8646..2650efa788 100644
--- a/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/utils/SettingsFile.java
+++ b/Source/Android/app/src/main/java/org/dolphinemu/dolphinemu/features/settings/utils/SettingsFile.java
@@ -104,6 +104,7 @@ public final class SettingsFile
public static final String KEY_DEBUG_JITPAIREDOFF = "JitPairedOff";
public static final String KEY_DEBUG_JITSYSTEMREGISTEROFF = "JitSystemRegistersOff";
public static final String KEY_DEBUG_JITBRANCHOFF = "JitBranchOff";
+ public static final String KEY_DEBUG_JITREGISTERCACHEOFF = "JitRegisterCacheOff";
public static final String KEY_GCPAD_TYPE = "SIDevice";
public static final String KEY_GCPAD_G_TYPE = "PadType";
diff --git a/Source/Android/app/src/main/res/values/strings.xml b/Source/Android/app/src/main/res/values/strings.xml
index 8ebd7a8271..46883d4ea7 100644
--- a/Source/Android/app/src/main/res/values/strings.xml
+++ b/Source/Android/app/src/main/res/values/strings.xml
@@ -257,6 +257,7 @@
<string name="debug_jitpairedoff">Jit Paired Disabled</string>
<string name="debug_jitsystemregistersoffr">Jit System Registers Disabled</string>
<string name="debug_jitbranchoff">Jit Branch Disabled</string>
+ <string name="debug_jitregistercacheoff">Jit Register Cache Disabled</string>
<!-- Miscellaneous -->
<string name="yes">Yes</string>
diff --git a/Source/Core/Core/ConfigManager.cpp b/Source/Core/Core/ConfigManager.cpp
index 8a1353822d..1e8272ad5e 100644
--- a/Source/Core/Core/ConfigManager.cpp
+++ b/Source/Core/Core/ConfigManager.cpp
@@ -355,6 +355,7 @@ void SConfig::SaveJitDebugSettings(IniFile& ini)
section->Set("JitPairedOff", bJITPairedOff);
section->Set("JitSystemRegistersOff", bJITSystemRegistersOff);
section->Set("JitBranchOff", bJITBranchOff);
+ section->Set("JitRegisterCacheOff", bJITRegisterCacheOff);
}
void SConfig::LoadSettings()
@@ -647,6 +648,7 @@ void SConfig::LoadJitDebugSettings(IniFile& ini)
section->Get("JitPairedOff", &bJITPairedOff, false);
section->Get("JitSystemRegistersOff", &bJITSystemRegistersOff, false);
section->Get("JitBranchOff", &bJITBranchOff, false);
+ section->Get("JitRegisterCacheOff", &bJITRegisterCacheOff, false);
}
void SConfig::ResetRunningGameMetadata()
@@ -799,6 +801,7 @@ void SConfig::LoadDefaults()
bJITPairedOff = false;
bJITSystemRegistersOff = false;
bJITBranchOff = false;
+ bJITRegisterCacheOff = false;
ResetRunningGameMetadata();
}
diff --git a/Source/Core/Core/ConfigManager.h b/Source/Core/Core/ConfigManager.h
index 6de44b41e1..d752010af5 100644
--- a/Source/Core/Core/ConfigManager.h
+++ b/Source/Core/Core/ConfigManager.h
@@ -105,6 +105,7 @@ struct SConfig
bool bJITPairedOff = false;
bool bJITSystemRegistersOff = false;
bool bJITBranchOff = false;
+ bool bJITRegisterCacheOff = false;
bool bFastmem;
bool bFPRF = false;
diff --git a/Source/Core/Core/PowerPC/Jit64/Jit.cpp b/Source/Core/Core/PowerPC/Jit64/Jit.cpp
index 6a4b2adc3f..d34eb55680 100644
--- a/Source/Core/Core/PowerPC/Jit64/Jit.cpp
+++ b/Source/Core/Core/PowerPC/Jit64/Jit.cpp
@@ -1002,15 +1002,23 @@ u8* Jit64::DoJit(u32 em_address, JitBlock* b, u32 nextPC)
SetJumpTarget(noBreakpoint);
}
- // If we have an input register that is going to be used again, load it pre-emptively,
- // even if the instruction doesn't strictly need it in a register, to avoid redundant
- // loads later. Of course, don't do this if we're already out of registers.
- // As a bit of a heuristic, make sure we have at least one register left over for the
- // output, which needs to be bound in the actual instruction compilation.
- // TODO: make this smarter in the case that we're actually register-starved, i.e.
- // prioritize the more important registers.
- gpr.PreloadRegisters(op.regsIn & op.gprInReg);
- fpr.PreloadRegisters(op.fregsIn & op.fprInXmm);
+ if (SConfig::GetInstance().bJITRegisterCacheOff)
+ {
+ gpr.Flush();
+ fpr.Flush();
+ }
+ else
+ {
+ // If we have an input register that is going to be used again, load it pre-emptively,
+ // even if the instruction doesn't strictly need it in a register, to avoid redundant
+ // loads later. Of course, don't do this if we're already out of registers.
+ // As a bit of a heuristic, make sure we have at least one register left over for the
+ // output, which needs to be bound in the actual instruction compilation.
+ // TODO: make this smarter in the case that we're actually register-starved, i.e.
+ // prioritize the more important registers.
+ gpr.PreloadRegisters(op.regsIn & op.gprInReg);
+ fpr.PreloadRegisters(op.fregsIn & op.fprInXmm);
+ }
CompileInstruction(op);
diff --git a/Source/Core/Core/PowerPC/JitArm64/Jit.cpp b/Source/Core/Core/PowerPC/JitArm64/Jit.cpp
index a0b6fe9aae..3a48ae7df4 100644
--- a/Source/Core/Core/PowerPC/JitArm64/Jit.cpp
+++ b/Source/Core/Core/PowerPC/JitArm64/Jit.cpp
@@ -779,6 +779,13 @@ void JitArm64::DoJit(u32 em_address, JitBlock* b, u32 nextPC)
js.firstFPInstructionFound = true;
}
+ if (SConfig::GetInstance().bJITRegisterCacheOff)
+ {
+ gpr.Flush(FLUSH_ALL);
+ fpr.Flush(FLUSH_ALL);
+ FlushCarry();
+ }
+
CompileInstruction(op);
if (!CanMergeNextInstructions(1) || js.op[1].opinfo->type != ::OpType::Integer)
FlushCarry();
diff --git a/Source/Core/DolphinQt/MenuBar.cpp b/Source/Core/DolphinQt/MenuBar.cpp
index 9d76a7c647..e5303e65ae 100644
--- a/Source/Core/DolphinQt/MenuBar.cpp
+++ b/Source/Core/DolphinQt/MenuBar.cpp
@@ -142,7 +142,7 @@ void MenuBar::OnEmulationStateChanged(Core::State state)
{m_jit_off, m_jit_loadstore_off, m_jit_loadstore_lbzx_off, m_jit_loadstore_lxz_off,
m_jit_loadstore_lwz_off, m_jit_loadstore_floating_off, m_jit_loadstore_paired_off,
m_jit_floatingpoint_off, m_jit_integer_off, m_jit_paired_off, m_jit_systemregisters_off,
- m_jit_branch_off})
+ m_jit_branch_off, m_jit_register_cache_off})
{
action->setEnabled(running && !playing);
}
@@ -896,6 +896,14 @@ void MenuBar::AddJITMenu()
SConfig::GetInstance().bJITBranchOff = enabled;
ClearCache();
});
+
+ m_jit_register_cache_off = m_jit->addAction(tr("JIT Register Cache Off"));
+ m_jit_register_cache_off->setCheckable(true);
+ m_jit_register_cache_off->setChecked(SConfig::GetInstance().bJITRegisterCacheOff);
+ connect(m_jit_register_cache_off, &QAction::toggled, [this](bool enabled) {
+ SConfig::GetInstance().bJITRegisterCacheOff = enabled;
+ ClearCache();
+ });
}
void MenuBar::AddSymbolsMenu()
diff --git a/Source/Core/DolphinQt/MenuBar.h b/Source/Core/DolphinQt/MenuBar.h
index 7118b2ca82..9875888cbc 100644
--- a/Source/Core/DolphinQt/MenuBar.h
+++ b/Source/Core/DolphinQt/MenuBar.h
@@ -261,6 +261,7 @@ private:
QAction* m_jit_paired_off;
QAction* m_jit_systemregisters_off;
QAction* m_jit_branch_off;
+ QAction* m_jit_register_cache_off;
bool m_game_selected = false;
};