SPU LLVM: Postpone runtime worker threads init

They may not be active at all unless a ps3 application is booted.
This commit is contained in:
Eladash 2024-03-30 20:08:45 +03:00 committed by Elad Ashkenazi
parent e38b005a8b
commit 7c8be662c6
1 changed files with 22 additions and 3 deletions

View File

@ -4495,11 +4495,10 @@ struct spu_llvm_worker
void operator()()
{
// SPU LLVM Recompiler instance
const auto compiler = spu_recompiler_base::make_llvm_recompiler();
compiler->init();
std::unique_ptr<spu_recompiler_base> compiler;
// Fake LS
std::vector<be_t<u32>> ls(0x10000);
std::vector<be_t<u32>> ls;
bool set_relax_flag = false;
@ -4542,6 +4541,15 @@ struct spu_llvm_worker
break;
}
if (!compiler)
{
// Postponed initialization
compiler = spu_recompiler_base::make_llvm_recompiler();
compiler->init();
ls.resize(SPU_LS_SIZE / sizeof(be_t<u32>));
}
if (!set_relax_flag)
{
spu_thread::g_spu_work_count++;
@ -4624,6 +4632,17 @@ struct spu_llvm
return;
}
while (!registered && thread_ctrl::state() != thread_state::aborting)
{
// Wait for the first SPU block before launching any thread
thread_ctrl::wait_on(utils::bless<atomic_t<u32>>(&registered)[1], 0);
}
if (thread_ctrl::state() == thread_state::aborting)
{
return;
}
// To compile (hash -> item)
std::unordered_multimap<u64, spu_item*, value_hash<u64>> enqueued;