mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-14 18:58:36 +12:00
SPU LLVM: fix spu_cache dependency
Should fix possible crash on exit.
This commit is contained in:
parent
675fde69aa
commit
1507a59786
3 changed files with 15 additions and 4 deletions
|
@ -74,7 +74,7 @@ spu_function_t spu_recompiler::compile(spu_program&& _func)
|
||||||
return add_loc->compiled;
|
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);
|
cache->add(func);
|
||||||
}
|
}
|
||||||
|
|
|
@ -546,7 +546,10 @@ void spu_cache::initialize()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize global cache instance
|
// 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
|
bool spu_program::operator==(const spu_program& rhs) const noexcept
|
||||||
|
@ -4219,7 +4222,7 @@ public:
|
||||||
|
|
||||||
std::string log;
|
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);
|
cache->add(func);
|
||||||
}
|
}
|
||||||
|
@ -4814,7 +4817,7 @@ public:
|
||||||
fs::file(m_spurt->get_cache_path() + "spu-ir.log", fs::write + fs::append).write(log);
|
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");
|
spu_log.success("New block compiled successfully");
|
||||||
}
|
}
|
||||||
|
@ -8585,6 +8588,12 @@ struct spu_llvm
|
||||||
// Workload
|
// Workload
|
||||||
lf_queue<std::pair<const u64, spu_item*>> registered;
|
lf_queue<std::pair<const u64, spu_item*>> registered;
|
||||||
|
|
||||||
|
spu_llvm()
|
||||||
|
{
|
||||||
|
// Dependency
|
||||||
|
g_fxo->init<spu_cache>();
|
||||||
|
}
|
||||||
|
|
||||||
void operator()()
|
void operator()()
|
||||||
{
|
{
|
||||||
// To compile (hash -> item)
|
// To compile (hash -> item)
|
||||||
|
|
|
@ -16,6 +16,8 @@ class spu_cache
|
||||||
fs::file m_file;
|
fs::file m_file;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
spu_cache() = default;
|
||||||
|
|
||||||
spu_cache(const std::string& loc);
|
spu_cache(const std::string& loc);
|
||||||
|
|
||||||
spu_cache(spu_cache&&) noexcept = default;
|
spu_cache(spu_cache&&) noexcept = default;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue