mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-26 04:32:35 +01:00
SPU LLVM: fix spu_cache dependency
Should fix possible crash on exit.
This commit is contained in:
parent
675fde69aa
commit
1507a59786
@ -74,7 +74,7 @@ spu_function_t spu_recompiler::compile(spu_program&& _func)
|
||||
return add_loc->compiled;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -546,7 +546,10 @@ void spu_cache::initialize()
|
||||
}
|
||||
|
||||
// Initialize global cache instance
|
||||
g_fxo->init<spu_cache>(std::move(cache));
|
||||
if (g_cfg.core.spu_cache)
|
||||
{
|
||||
*g_fxo->get<spu_cache>() = std::move(cache);
|
||||
}
|
||||
}
|
||||
|
||||
bool spu_program::operator==(const spu_program& rhs) const noexcept
|
||||
@ -4219,7 +4222,7 @@ public:
|
||||
|
||||
std::string log;
|
||||
|
||||
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);
|
||||
}
|
||||
@ -4814,7 +4817,7 @@ public:
|
||||
fs::file(m_spurt->get_cache_path() + "spu-ir.log", fs::write + fs::append).write(log);
|
||||
}
|
||||
|
||||
if (g_fxo->get<spu_cache>())
|
||||
if (*g_fxo->get<spu_cache>())
|
||||
{
|
||||
spu_log.success("New block compiled successfully");
|
||||
}
|
||||
@ -8585,6 +8588,12 @@ struct spu_llvm
|
||||
// Workload
|
||||
lf_queue<std::pair<const u64, spu_item*>> registered;
|
||||
|
||||
spu_llvm()
|
||||
{
|
||||
// Dependency
|
||||
g_fxo->init<spu_cache>();
|
||||
}
|
||||
|
||||
void operator()()
|
||||
{
|
||||
// To compile (hash -> item)
|
||||
|
@ -16,6 +16,8 @@ class spu_cache
|
||||
fs::file m_file;
|
||||
|
||||
public:
|
||||
spu_cache() = default;
|
||||
|
||||
spu_cache(const std::string& loc);
|
||||
|
||||
spu_cache(spu_cache&&) noexcept = default;
|
||||
|
Loading…
Reference in New Issue
Block a user