diff --git a/FEXCore/Source/Interface/Core/Core.cpp b/FEXCore/Source/Interface/Core/Core.cpp index 6ff1deb9b..282ecabba 100644 --- a/FEXCore/Source/Interface/Core/Core.cpp +++ b/FEXCore/Source/Interface/Core/Core.cpp @@ -886,11 +886,11 @@ uintptr_t ContextImpl::CompileSingleStep(FEXCore::Core::CpuStateFrame* Frame, ui void ContextImpl::InvalidateCodeBuffersCodeRange(uint64_t Start, uint64_t Length) { FEXCORE_PROFILE_SCOPED("InvalidateCodeBuffersCodeRange"); - LogMan::Throw::AFmt(CodeInvalidationMutex.try_lock() == false, "CodeInvalidationMutex needs to be unique_locked here"); + LOGMAN_THROW_A_FMT(CodeInvalidationMutex.try_lock() == false, "CodeInvalidationMutex needs to be unique_locked here"); std::scoped_lock lk {CodeBufferListLock}; auto it = CodeBufferList.begin(); while (it != CodeBufferList.end()) { - if (auto Strong = it->lock(); Strong) { + if (auto Strong = it->lock()) { Strong->LookupCache->InvalidateRange(Start, Length); it++; } else { @@ -900,7 +900,7 @@ void ContextImpl::InvalidateCodeBuffersCodeRange(uint64_t Start, uint64_t Length } void ContextImpl::InvalidateThreadCachedCodeRange(FEXCore::Core::InternalThreadState* Thread, uint64_t Start, uint64_t Length) { - LogMan::Throw::AFmt(CodeInvalidationMutex.try_lock() == false, "CodeInvalidationMutex needs to be unique_locked here"); + LOGMAN_THROW_A_FMT(CodeInvalidationMutex.try_lock() == false, "CodeInvalidationMutex needs to be unique_locked here"); // Ensures now-modified mappings aren't cached as being in their previous non-executable state. // Accessing FrontendDecoder is safe as the thread's code invalidation mutex must be locked here. diff --git a/FEXCore/Source/Interface/Core/LookupCache.h b/FEXCore/Source/Interface/Core/LookupCache.h index 33e7ed657..fab666eb2 100644 --- a/FEXCore/Source/Interface/Core/LookupCache.h +++ b/FEXCore/Source/Interface/Core/LookupCache.h @@ -8,8 +8,8 @@ #include #include #include +#include #include -#include #include #include @@ -437,7 +437,7 @@ private: } // Maps from a page index to all blocks in the page that have at some point been fetched into L1/L2 - fextl::map> CachedCodePages; + fextl::map> CachedCodePages; uintptr_t PagePointer; uintptr_t PageMemory; diff --git a/Source/Tools/CodeSizeValidation/Main.cpp b/Source/Tools/CodeSizeValidation/Main.cpp index 1562c19ed..07380659d 100644 --- a/Source/Tools/CodeSizeValidation/Main.cpp +++ b/Source/Tools/CodeSizeValidation/Main.cpp @@ -52,8 +52,8 @@ public: { auto CodeInvalidationlk = FEXCore::GuardSignalDeferringSection(CTX->GetCodeInvalidationMutex(), Thread); - FEXCore::Context::InvalidatedEntryAccumulator Accumulator; - CTX->InvalidateGuestCodeRange(Thread, Accumulator, reinterpret_cast(CodeStart), MAX_CODE_SIZE); + CTX->InvalidateCodeBuffersCodeRange(reinterpret_cast(CodeStart), MAX_CODE_SIZE); + CTX->InvalidateThreadCachedCodeRange(Thread, reinterpret_cast(CodeStart), MAX_CODE_SIZE); } ClearStats(); diff --git a/Source/Tools/LinuxEmulation/LinuxSyscalls/ThreadManager.h b/Source/Tools/LinuxEmulation/LinuxSyscalls/ThreadManager.h index e19f43224..541a07cc7 100644 --- a/Source/Tools/LinuxEmulation/LinuxSyscalls/ThreadManager.h +++ b/Source/Tools/LinuxEmulation/LinuxSyscalls/ThreadManager.h @@ -208,10 +208,9 @@ public: // Thread object isn't valid very early in frontend's initialization. // To be more optimal the frontend should provide this code with a valid Thread object earlier. auto CodeInvalidationlk = GuardSignalDeferringSectionWithFallback(CTX->GetCodeInvalidationMutex(), CallingThread); - FEXCore::Context::InvalidatedEntryAccumulator Accumulator; - + CTX->InvalidateCodeBuffersCodeRange(Start, Length); for (auto& Thread : Threads) { - CTX->InvalidateGuestCodeRange(Thread->Thread, Accumulator, Start, Length); + CTX->InvalidateThreadCachedCodeRange(Thread->Thread, Start, Length); } } @@ -223,10 +222,9 @@ public: // Thread object isn't valid very early in frontend's initialization. // To be more optimal the frontend should provide this code with a valid Thread object earlier. auto CodeInvalidationlk = GuardSignalDeferringSectionWithFallback(CTX->GetCodeInvalidationMutex(), CallingThread); - FEXCore::Context::InvalidatedEntryAccumulator Accumulator; - + CTX->InvalidateCodeBuffersCodeRange(Start, Length); for (auto& Thread : Threads) { - CTX->InvalidateGuestCodeRange(Thread->Thread, Accumulator, Start, Length); + CTX->InvalidateThreadCachedCodeRange(Thread->Thread, Start, Length); } // Callback while holding the locks.