Merge pull request #7235 from spycrab/jit_disable_following
Core/PowerPC: Add option to disable branch following
This commit is contained in:
commit
31bc017593
|
@ -1,4 +1,7 @@
|
||||||
# Nxxxxx - All Nintendo 64 Virtual Console games
|
# Nxxxxx - All Nintendo 64 Virtual Console games
|
||||||
|
|
||||||
|
[Core]
|
||||||
|
JITFollowBranch = False
|
||||||
|
|
||||||
[Video_Settings]
|
[Video_Settings]
|
||||||
SuggestedAspectRatio = 2
|
SuggestedAspectRatio = 2
|
||||||
|
|
|
@ -240,6 +240,8 @@ bool BootCore(std::unique_ptr<BootParameters> boot)
|
||||||
IniFile::Section* controls_section = game_ini.GetOrCreateSection("Controls");
|
IniFile::Section* controls_section = game_ini.GetOrCreateSection("Controls");
|
||||||
|
|
||||||
core_section->Get("CPUThread", &StartUp.bCPUThread, StartUp.bCPUThread);
|
core_section->Get("CPUThread", &StartUp.bCPUThread, StartUp.bCPUThread);
|
||||||
|
|
||||||
|
core_section->Get("JITFollowBranch", &StartUp.bJITFollowBranch, StartUp.bJITFollowBranch);
|
||||||
core_section->Get("EnableCheats", &StartUp.bEnableCheats, StartUp.bEnableCheats);
|
core_section->Get("EnableCheats", &StartUp.bEnableCheats, StartUp.bEnableCheats);
|
||||||
core_section->Get("SyncOnSkipIdle", &StartUp.bSyncGPUOnSkipIdleHack,
|
core_section->Get("SyncOnSkipIdle", &StartUp.bSyncGPUOnSkipIdleHack,
|
||||||
StartUp.bSyncGPUOnSkipIdleHack);
|
StartUp.bSyncGPUOnSkipIdleHack);
|
||||||
|
|
|
@ -17,8 +17,8 @@ namespace Config
|
||||||
{
|
{
|
||||||
// Main.Core
|
// Main.Core
|
||||||
|
|
||||||
extern const ConfigInfo<bool> MAIN_SKIP_IPL;
|
|
||||||
extern const ConfigInfo<PowerPC::CPUCore> MAIN_CPU_CORE;
|
extern const ConfigInfo<PowerPC::CPUCore> MAIN_CPU_CORE;
|
||||||
|
extern const ConfigInfo<bool> MAIN_JIT_FOLLOW_BRANCH;
|
||||||
extern const ConfigInfo<bool> MAIN_FASTMEM;
|
extern const ConfigInfo<bool> MAIN_FASTMEM;
|
||||||
// Should really be in the DSP section, but we're kind of stuck with bad decisions made in the past.
|
// Should really be in the DSP section, but we're kind of stuck with bad decisions made in the past.
|
||||||
extern const ConfigInfo<bool> MAIN_DSP_HLE;
|
extern const ConfigInfo<bool> MAIN_DSP_HLE;
|
||||||
|
|
|
@ -219,6 +219,7 @@ void SConfig::SaveCoreSettings(IniFile& ini)
|
||||||
core->Set("SkipIPL", bHLE_BS2);
|
core->Set("SkipIPL", bHLE_BS2);
|
||||||
core->Set("TimingVariance", iTimingVariance);
|
core->Set("TimingVariance", iTimingVariance);
|
||||||
core->Set("CPUCore", cpu_core);
|
core->Set("CPUCore", cpu_core);
|
||||||
|
core->Set("JITFollowBranch", bJITFollowBranch);
|
||||||
core->Set("Fastmem", bFastmem);
|
core->Set("Fastmem", bFastmem);
|
||||||
core->Set("CPUThread", bCPUThread);
|
core->Set("CPUThread", bCPUThread);
|
||||||
core->Set("DSPHLE", bDSPHLE);
|
core->Set("DSPHLE", bDSPHLE);
|
||||||
|
@ -510,6 +511,7 @@ void SConfig::LoadCoreSettings(IniFile& ini)
|
||||||
#else
|
#else
|
||||||
core->Get("CPUCore", &cpu_core, PowerPC::CPUCore::Interpreter);
|
core->Get("CPUCore", &cpu_core, PowerPC::CPUCore::Interpreter);
|
||||||
#endif
|
#endif
|
||||||
|
core->Get("JITFollowBranch", &bJITFollowBranch, true);
|
||||||
core->Get("Fastmem", &bFastmem, true);
|
core->Get("Fastmem", &bFastmem, true);
|
||||||
core->Get("DSPHLE", &bDSPHLE, true);
|
core->Get("DSPHLE", &bDSPHLE, true);
|
||||||
core->Get("TimingVariance", &iTimingVariance, 40);
|
core->Get("TimingVariance", &iTimingVariance, 40);
|
||||||
|
|
|
@ -83,6 +83,7 @@ struct SConfig
|
||||||
|
|
||||||
PowerPC::CPUCore cpu_core;
|
PowerPC::CPUCore cpu_core;
|
||||||
|
|
||||||
|
bool bJITFollowBranch;
|
||||||
bool bJITNoBlockCache = false;
|
bool bJITNoBlockCache = false;
|
||||||
bool bJITNoBlockLinking = false;
|
bool bJITNoBlockLinking = false;
|
||||||
bool bJITOff = false;
|
bool bJITOff = false;
|
||||||
|
|
|
@ -851,6 +851,7 @@ void ReadHeader()
|
||||||
{
|
{
|
||||||
s_bSaveConfig = true;
|
s_bSaveConfig = true;
|
||||||
Config::AddLayer(ConfigLoaders::GenerateMovieConfigLoader(&tmpHeader));
|
Config::AddLayer(ConfigLoaders::GenerateMovieConfigLoader(&tmpHeader));
|
||||||
|
SConfig::GetInstance().bJITFollowBranch = tmpHeader.bFollowBranch;
|
||||||
s_bClearSave = tmpHeader.bClearSave;
|
s_bClearSave = tmpHeader.bClearSave;
|
||||||
s_memcards = tmpHeader.memcards;
|
s_memcards = tmpHeader.memcards;
|
||||||
s_bongos = tmpHeader.bongos;
|
s_bongos = tmpHeader.bongos;
|
||||||
|
@ -1307,6 +1308,7 @@ void SaveRecording(const std::string& filename)
|
||||||
header.filetype[3] = 0x1A;
|
header.filetype[3] = 0x1A;
|
||||||
strncpy(header.gameID.data(), SConfig::GetInstance().GetGameID().c_str(), 6);
|
strncpy(header.gameID.data(), SConfig::GetInstance().GetGameID().c_str(), 6);
|
||||||
header.bWii = SConfig::GetInstance().bWii;
|
header.bWii = SConfig::GetInstance().bWii;
|
||||||
|
header.bFollowBranch = SConfig::GetInstance().bJITFollowBranch;
|
||||||
header.controllers = s_controllers & (SConfig::GetInstance().bWii ? 0xFF : 0x0F);
|
header.controllers = s_controllers & (SConfig::GetInstance().bWii ? 0xFF : 0x0F);
|
||||||
|
|
||||||
header.bFromSaveState = s_bRecordingFromSaveState;
|
header.bFromSaveState = s_bRecordingFromSaveState;
|
||||||
|
|
|
@ -104,7 +104,8 @@ struct DTMHeader
|
||||||
bool bPAL60;
|
bool bPAL60;
|
||||||
u8 language;
|
u8 language;
|
||||||
bool bReducePollingRate;
|
bool bReducePollingRate;
|
||||||
std::array<u8, 10> reserved; // Padding for any new config options
|
bool bFollowBranch;
|
||||||
|
std::array<u8, 9> reserved; // Padding for any new config options
|
||||||
std::array<char, 40> discChange; // Name of iso file to switch to, for two disc games.
|
std::array<char, 40> discChange; // Name of iso file to switch to, for two disc games.
|
||||||
std::array<u8, 20> revision; // Git hash
|
std::array<u8, 20> revision; // Git hash
|
||||||
u32 DSPiromHash;
|
u32 DSPiromHash;
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Common/Logging/Log.h"
|
#include "Common/Logging/Log.h"
|
||||||
#include "Common/StringUtil.h"
|
#include "Common/StringUtil.h"
|
||||||
|
#include "Core/Config/MainSettings.h"
|
||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
#include "Core/PowerPC/JitCommon/JitBase.h"
|
#include "Core/PowerPC/JitCommon/JitBase.h"
|
||||||
#include "Core/PowerPC/MMU.h"
|
#include "Core/PowerPC/MMU.h"
|
||||||
|
@ -671,6 +672,8 @@ u32 PPCAnalyzer::Analyze(u32 address, CodeBlock* block, CodeBuffer* buffer, std:
|
||||||
u32 numFollows = 0;
|
u32 numFollows = 0;
|
||||||
u32 num_inst = 0;
|
u32 num_inst = 0;
|
||||||
|
|
||||||
|
const bool enable_follow = SConfig::GetInstance().bJITFollowBranch;
|
||||||
|
|
||||||
for (std::size_t i = 0; i < block_size; ++i)
|
for (std::size_t i = 0; i < block_size; ++i)
|
||||||
{
|
{
|
||||||
auto result = PowerPC::TryReadInstruction(address);
|
auto result = PowerPC::TryReadInstruction(address);
|
||||||
|
@ -706,7 +709,7 @@ u32 PPCAnalyzer::Analyze(u32 address, CodeBlock* block, CodeBuffer* buffer, std:
|
||||||
// If it is small, the performance will be down.
|
// If it is small, the performance will be down.
|
||||||
// If it is big, the size of generated code will be big and
|
// If it is big, the size of generated code will be big and
|
||||||
// cache clearning will happen many times.
|
// cache clearning will happen many times.
|
||||||
if (HasOption(OPTION_BRANCH_FOLLOW) && numFollows < BRANCH_FOLLOWING_THRESHOLD)
|
if (enable_follow && HasOption(OPTION_BRANCH_FOLLOW) && numFollows < BRANCH_FOLLOWING_THRESHOLD)
|
||||||
{
|
{
|
||||||
if (inst.OPCD == 18 && block_size > 1)
|
if (inst.OPCD == 18 && block_size > 1)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue