SPU: fix excessive cache size regression

This commit is contained in:
Nekotekina 2019-05-01 14:56:41 +03:00
parent bc42719c48
commit a4c4ee9cb2
4 changed files with 26 additions and 21 deletions

View file

@ -46,18 +46,23 @@ void spu_recompiler::init()
}
}
bool spu_recompiler::compile(u64 last_reset_count, const std::vector<u32>& func)
spu_function_t spu_recompiler::compile(u64 last_reset_count, const std::vector<u32>& func)
{
const auto fn_location = m_spurt->find(last_reset_count, func);
if (fn_location == spu_runtime::g_dispatcher)
{
return true;
return &dispatch;
}
if (!fn_location)
{
return false;
return nullptr;
}
if (m_cache && g_cfg.core.spu_cache)
{
m_cache->add(func);
}
using namespace asmjit;
@ -836,7 +841,7 @@ bool spu_recompiler::compile(u64 last_reset_count, const std::vector<u32>& func)
{
if (err == asmjit::ErrorCode::kErrorNoVirtualMemory)
{
return false;
return nullptr;
}
LOG_FATAL(SPU, "Failed to build a function");
@ -844,7 +849,7 @@ bool spu_recompiler::compile(u64 last_reset_count, const std::vector<u32>& func)
if (!m_spurt->add(last_reset_count, fn_location, fn))
{
return false;
return nullptr;
}
if (g_cfg.core.spu_debug)
@ -858,7 +863,7 @@ bool spu_recompiler::compile(u64 last_reset_count, const std::vector<u32>& func)
fs::file(m_spurt->get_cache_path() + "spu.log", fs::write + fs::append).write(log);
}
return true;
return fn;
}
spu_recompiler::XmmLink spu_recompiler::XmmAlloc() // get empty xmm register