diff --git a/rpcs3/Emu/Cell/SPUAnalyser.cpp b/rpcs3/Emu/Cell/SPUAnalyser.cpp index 16609af0f0..6df784cfb9 100644 --- a/rpcs3/Emu/Cell/SPUAnalyser.cpp +++ b/rpcs3/Emu/Cell/SPUAnalyser.cpp @@ -328,7 +328,7 @@ std::shared_ptr SPUDatabase::analyse(const be_t* ls, u32 en m_db.emplace(key, func); } - LOG_SUCCESS(SPU, "Function detected [0x%05x-0x%05x] (size=0x%x)", func->addr, func->addr + func->size, func->size); + LOG_NOTICE(SPU, "Function detected [0x%05x-0x%05x] (size=0x%x)", func->addr, func->addr + func->size, func->size); return func; } diff --git a/rpcs3/Emu/Cell/SPURecompiler.cpp b/rpcs3/Emu/Cell/SPURecompiler.cpp index ed52c5c24e..f9102a3b32 100644 --- a/rpcs3/Emu/Cell/SPURecompiler.cpp +++ b/rpcs3/Emu/Cell/SPURecompiler.cpp @@ -5,6 +5,7 @@ #include "SPUThread.h" #include "SPURecompiler.h" #include "SPUASMJITRecompiler.h" +#include extern u64 get_system_time(); @@ -23,20 +24,12 @@ void spu_recompiler_base::enter(SPUThread& spu) const auto _ls = vm::ps3::_ptr(spu.offset); // Search if cached data matches - bool found = false; auto func = spu.compiled_cache[spu.pc / 4]; - if (func) - { - const be_t* base = _ls + spu.pc / 4; - if (std::memcmp(base, func->data.data(), func->size) == 0) - found = true; - } - // Check shared db if we dont have a match - if (!found) + if (!func || !std::equal(func->data.begin(), func->data.end(), _ls + spu.pc / 4, [](const be_t& l, const be_t& r) { return *(u32*)(u8*)&l == *(u32*)(u8*)&r; })) { - func = spu.spu_db->analyse(_ls, spu.pc); + func = spu.spu_db->analyse(_ls, spu.pc).get(); spu.compiled_cache[spu.pc / 4] = func; } diff --git a/rpcs3/Emu/Cell/SPUThread.h b/rpcs3/Emu/Cell/SPUThread.h index 9bd485f14f..b02ae1e7b1 100644 --- a/rpcs3/Emu/Cell/SPUThread.h +++ b/rpcs3/Emu/Cell/SPUThread.h @@ -582,7 +582,7 @@ public: std::exception_ptr pending_exception; - std::array, 65536> compiled_cache; + std::array compiled_cache{}; std::shared_ptr spu_db; std::shared_ptr spu_rec; u32 recursion_level = 0;