mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-04 05:51:27 +12:00
PPU: use shared jit_compiler instance
(Linux) Fix deregisterEHFrames error message
This commit is contained in:
parent
6baba2875d
commit
d40aaf0391
2 changed files with 10 additions and 7 deletions
|
@ -268,8 +268,6 @@ struct MemoryManager : llvm::RTDyldMemoryManager
|
||||||
|
|
||||||
void deregisterEHFrames(u8* addr, u64 load_addr, std::size_t size) override
|
void deregisterEHFrames(u8* addr, u64 load_addr, std::size_t size) override
|
||||||
{
|
{
|
||||||
LOG_ERROR(GENERAL, "deregisterEHFrames() called"); // Not expected
|
|
||||||
|
|
||||||
return RTDyldMemoryManager::deregisterEHFrames(addr, load_addr, size);
|
return RTDyldMemoryManager::deregisterEHFrames(addr, load_addr, size);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1146,10 +1146,10 @@ extern void ppu_initialize(const ppu_module& info)
|
||||||
jit_module& jit_mod = fxm::get_always<std::unordered_map<std::string, jit_module>>()->emplace(cache_path + info.name, jit_module{}).first->second;
|
jit_module& jit_mod = fxm::get_always<std::unordered_map<std::string, jit_module>>()->emplace(cache_path + info.name, jit_module{}).first->second;
|
||||||
|
|
||||||
// Compiler instance (deferred initialization)
|
// Compiler instance (deferred initialization)
|
||||||
std::unique_ptr<jit_compiler> jit;
|
std::shared_ptr<jit_compiler> jit;
|
||||||
|
|
||||||
// Compiler mutex
|
// Compiler mutex (global)
|
||||||
semaphore<> jmutex;
|
static semaphore<> jmutex;
|
||||||
|
|
||||||
// Initialize semaphore with the max number of threads
|
// Initialize semaphore with the max number of threads
|
||||||
semaphore<INT32_MAX> jcores(std::thread::hardware_concurrency());
|
semaphore<INT32_MAX> jcores(std::thread::hardware_concurrency());
|
||||||
|
@ -1175,7 +1175,10 @@ extern void ppu_initialize(const ppu_module& info)
|
||||||
while (jit_mod.vars.empty() && fpos < info.funcs.size())
|
while (jit_mod.vars.empty() && fpos < info.funcs.size())
|
||||||
{
|
{
|
||||||
// Initialize compiler instance
|
// Initialize compiler instance
|
||||||
if (!jit) jit = std::make_unique<jit_compiler>(s_link_table, g_cfg.core.llvm_cpu);
|
if (!jit)
|
||||||
|
{
|
||||||
|
jit = fxm::get_always<jit_compiler>(s_link_table, g_cfg.core.llvm_cpu);
|
||||||
|
}
|
||||||
|
|
||||||
// First function in current module part
|
// First function in current module part
|
||||||
const auto fstart = fpos;
|
const auto fstart = fpos;
|
||||||
|
@ -1301,7 +1304,7 @@ extern void ppu_initialize(const ppu_module& info)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create worker thread for compilation
|
// Create worker thread for compilation
|
||||||
jthreads.emplace_back([&jit, &jmutex, &jcores, obj_name = obj_name, part = std::move(part), &cache_path]()
|
jthreads.emplace_back([&jit, &jcores, obj_name = obj_name, part = std::move(part), &cache_path]()
|
||||||
{
|
{
|
||||||
// Set low priority
|
// Set low priority
|
||||||
thread_ctrl::set_native_priority(-1);
|
thread_ctrl::set_native_priority(-1);
|
||||||
|
@ -1345,7 +1348,9 @@ extern void ppu_initialize(const ppu_module& info)
|
||||||
// Jit can be null if the loop doesn't ever enter.
|
// Jit can be null if the loop doesn't ever enter.
|
||||||
if (jit && jit_mod.vars.empty())
|
if (jit && jit_mod.vars.empty())
|
||||||
{
|
{
|
||||||
|
semaphore_lock lock(jmutex);
|
||||||
jit->fin();
|
jit->fin();
|
||||||
|
|
||||||
// Get and install function addresses
|
// Get and install function addresses
|
||||||
for (const auto& func : info.funcs)
|
for (const auto& func : info.funcs)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue