Add "SPU Verification" option

Should be always enabled
This commit is contained in:
Nekotekina 2018-06-04 02:13:53 +03:00
parent 12eee6a19e
commit 5d4c5ecc1c
3 changed files with 25 additions and 12 deletions

View File

@ -206,9 +206,9 @@ spu_function_t spu_recompiler::compile(std::vector<u32>&& func_rv)
}; };
// Check code // Check code
if (false) if (!g_cfg.core.spu_verification)
{ {
// Disable check (not available) // Disable check (unsafe)
} }
else if (func.size() - 1 == 1) else if (func.size() - 1 == 1)
{ {
@ -764,11 +764,14 @@ spu_function_t spu_recompiler::compile(std::vector<u32>&& func_rv)
c->bind(label_stop); c->bind(label_stop);
c->ret(); c->ret();
// Dispatch if (g_cfg.core.spu_verification)
c->align(kAlignCode, 16); {
c->bind(label_diff); // Dispatch
c->inc(SPU_OFF_64(block_failure)); c->align(kAlignCode, 16);
c->jmp(imm_ptr(&spu_recompiler_base::dispatch)); c->bind(label_diff);
c->inc(SPU_OFF_64(block_failure));
c->jmp(imm_ptr(&spu_recompiler_base::dispatch));
}
for (auto&& work : decltype(after)(std::move(after))) for (auto&& work : decltype(after)(std::move(after)))
{ {

View File

@ -1320,9 +1320,10 @@ public:
// Emit code check // Emit code check
m_ir->SetInsertPoint(label_test); m_ir->SetInsertPoint(label_test);
if (false) if (!g_cfg.core.spu_verification)
{ {
// Disable check (not available) // Disable check (unsafe)
m_ir->CreateBr(label_body);
} }
else if (func.size() - 1 == 1) else if (func.size() - 1 == 1)
{ {
@ -1506,9 +1507,17 @@ public:
m_ir->CreateRetVoid(); m_ir->CreateRetVoid();
m_ir->SetInsertPoint(label_diff); m_ir->SetInsertPoint(label_diff);
const auto pbfail = spu_ptr<u64>(&SPUThread::block_failure);
m_ir->CreateStore(m_ir->CreateAdd(m_ir->CreateLoad(pbfail), m_ir->getInt64(1)), pbfail); if (g_cfg.core.spu_verification)
tail(&spu_recompiler_base::dispatch, m_thread, m_ir->getInt32(0), m_ir->getInt32(0)); {
const auto pbfail = spu_ptr<u64>(&SPUThread::block_failure);
m_ir->CreateStore(m_ir->CreateAdd(m_ir->CreateLoad(pbfail), m_ir->getInt64(1)), pbfail);
tail(&spu_recompiler_base::dispatch, m_thread, m_ir->getInt32(0), m_ir->getInt32(0));
}
else
{
m_ir->CreateUnreachable();
}
// Clear context // Clear context
m_gpr.fill({}); m_gpr.fill({});

View File

@ -322,6 +322,7 @@ struct cfg_root : cfg::node
cfg::_bool spu_shared_runtime{this, "SPU Shared Runtime", true}; // Share compiled SPU functions between all threads cfg::_bool spu_shared_runtime{this, "SPU Shared Runtime", true}; // Share compiled SPU functions between all threads
cfg::_enum<spu_block_size_type> spu_block_size{this, "SPU Block Size"}; cfg::_enum<spu_block_size_type> spu_block_size{this, "SPU Block Size"};
cfg::_bool spu_accurate_getllar{this, "Accurate GETLLAR", false}; cfg::_bool spu_accurate_getllar{this, "Accurate GETLLAR", false};
cfg::_bool spu_verification{this, "SPU Verification", true}; // Should be enabled
cfg::_enum<lib_loading_type> lib_loading{this, "Lib Loader", lib_loading_type::liblv2only}; cfg::_enum<lib_loading_type> lib_loading{this, "Lib Loader", lib_loading_type::liblv2only};
cfg::_bool hook_functions{this, "Hook static functions"}; cfg::_bool hook_functions{this, "Hook static functions"};