SPU LLVM: Postpone cache writes until compiled

This commit is contained in:
Eladash 2024-03-07 21:09:28 +02:00 committed by Elad.Ash
parent 45863bc7c5
commit ecf7d4e59d

View file

@ -1138,9 +1138,11 @@ public:
std::string log; std::string log;
bool add_to_file = false;
if (auto& cache = g_fxo->get<spu_cache>(); cache && g_cfg.core.spu_cache && !add_loc->cached.exchange(1)) if (auto& cache = g_fxo->get<spu_cache>(); cache && g_cfg.core.spu_cache && !add_loc->cached.exchange(1))
{ {
cache.add(func); add_to_file = true;
} }
{ {
@ -2096,6 +2098,14 @@ public:
// Rebuild trampoline if necessary // Rebuild trampoline if necessary
if (!m_spurt->rebuild_ubertrampoline(func.data[0])) if (!m_spurt->rebuild_ubertrampoline(func.data[0]))
{ {
if (auto& cache = g_fxo->get<spu_cache>())
{
if (add_to_file)
{
cache.add(func);
}
}
return nullptr; return nullptr;
} }
@ -2116,8 +2126,13 @@ public:
asm("DSB ISH"); asm("DSB ISH");
#endif #endif
if (g_fxo->get<spu_cache>().operator bool()) if (auto& cache = g_fxo->get<spu_cache>())
{ {
if (add_to_file)
{
cache.add(func);
}
spu_log.success("New SPU block compiled successfully (size=%u)", func_size); spu_log.success("New SPU block compiled successfully (size=%u)", func_size);
} }