PPU LLVM Cache Fixup

This commit is contained in:
Eladash 2023-08-04 20:14:52 +03:00 committed by Elad Ashkenazi
parent e25936c1f1
commit d0b3891002

View File

@ -3199,7 +3199,7 @@ extern fs::file make_file_view(fs::file&& _file, u64 offset)
extern void ppu_finalize(const ppu_module& info)
{
if (info.name.empty())
if (!info.cache.empty())
{
// Don't remove main module from memory
return;
@ -3226,7 +3226,7 @@ extern void ppu_finalize(const ppu_module& info)
fmt::append(cache_path, "ppu-%s-%s/", fmt::base57(info.sha1), info.path.substr(info.path.find_last_of('/') + 1));
#ifdef LLVM_AVAILABLE
g_fxo->get<jit_module_manager>().remove(cache_path + info.name + "_" + std::to_string(info.segs[0].addr));
g_fxo->get<jit_module_manager>().remove(cache_path + info.name + "_" + std::to_string(std::bit_cast<usz>(info.segs[0].ptr)));
#endif
}
@ -3572,6 +3572,11 @@ extern void ppu_precompile(std::vector<std::string>& dir_queue, std::vector<ppu_
break;
}
if (std::memcpy(main_module.sha1, _main.sha1, sizeof(_main.sha1)) == 0)
{
continue;
}
if (!_main.analyse(0, _main.elf_entry, _main.seg0_code_end, _main.applied_pathes, [](){ return Emu.IsStopped(); }))
{
break;
@ -3812,7 +3817,7 @@ bool ppu_initialize(const ppu_module& info, bool check_only)
// Get cache path for this executable
std::string cache_path;
if (info.name.empty())
if (!info.cache.empty())
{
cache_path = info.cache;
}
@ -3862,7 +3867,7 @@ bool ppu_initialize(const ppu_module& info, bool check_only)
};
// Permanently loaded compiled PPU modules (name -> data)
jit_module& jit_mod = g_fxo->get<jit_module_manager>().get(cache_path + info.name + "_" + std::to_string(info.segs[0].addr));
jit_module& jit_mod = g_fxo->get<jit_module_manager>().get(cache_path + info.name + "_" + std::to_string(std::bit_cast<usz>(info.segs[0].ptr)));
// Compiler instance (deferred initialization)
std::shared_ptr<jit_compiler>& jit = jit_mod.pjit;