diff --git a/FEXCore/Source/Interface/Context/Context.h b/FEXCore/Source/Interface/Context/Context.h index 94660403d..88c1e4089 100644 --- a/FEXCore/Source/Interface/Context/Context.h +++ b/FEXCore/Source/Interface/Context/Context.h @@ -154,8 +154,6 @@ public: return CodeInvalidationMutex; } - void MarkMemoryShared(FEXCore::Core::InternalThreadState* Thread) override; - void ConfigureAOTGen(FEXCore::Core::InternalThreadState* Thread, fextl::set* ExternalBranches, uint64_t SectionMaxAddress) override; bool IsAddressInCodeBuffer(FEXCore::Core::InternalThreadState* Thread, uintptr_t Address) const override; @@ -196,7 +194,6 @@ public: FEX_CONFIG_OPT(GdbServer, GDBSERVER); FEX_CONFIG_OPT(Is64BitMode, IS64BIT_MODE); FEX_CONFIG_OPT(TSOEnabled, TSOENABLED); - FEX_CONFIG_OPT(TSOAutoMigration, TSOAUTOMIGRATION); FEX_CONFIG_OPT(VectorTSOEnabled, VECTORTSOENABLED); FEX_CONFIG_OPT(MemcpySetTSOEnabled, MEMCPYSETTSOENABLED); FEX_CONFIG_OPT(ABILocalFlags, ABILOCALFLAGS); @@ -317,12 +314,9 @@ protected: VectorAtomicTSOEmulationEnabled = true; MemcpyAtomicTSOEmulationEnabled = true; } else { - // Atomic TSO emulation only enabled if the config option is enabled. - AtomicTSOEmulationEnabled = (IsMemoryShared || !Config.TSOAutoMigration) && Config.TSOEnabled; - // Atomic vector TSO emulation only enabled if TSO emulation is enabled and also vector TSO is enabled. - VectorAtomicTSOEmulationEnabled = (IsMemoryShared || !Config.TSOAutoMigration) && Config.TSOEnabled && Config.VectorTSOEnabled; - // Atomic memcpy TSO emulation only enabled if TSO emulation is enabled and also memcpy TSO is enabled. - MemcpyAtomicTSOEmulationEnabled = (IsMemoryShared || !Config.TSOAutoMigration) && Config.TSOEnabled && Config.MemcpySetTSOEnabled; + AtomicTSOEmulationEnabled = Config.TSOEnabled; + VectorAtomicTSOEmulationEnabled = Config.TSOEnabled && Config.VectorTSOEnabled; + MemcpyAtomicTSOEmulationEnabled = Config.TSOEnabled && Config.MemcpySetTSOEnabled; } } @@ -338,7 +332,6 @@ private: IR::AOTIRCaptureCache IRCaptureCache; - bool IsMemoryShared = false; bool SupportsHardwareTSO = false; bool AtomicTSOEmulationEnabled = true; bool VectorAtomicTSOEmulationEnabled = false; @@ -351,8 +344,8 @@ private: std::atomic HasCustomIRHandlers {}; struct CustomIRHandlerEntry final { CustomIREntrypointHandler Handler; - void *Creator; - void *Data; + void* Creator; + void* Data; }; fextl::unordered_map CustomIRHandlers; IntervalList ForceTSOValidRanges; // The ranges for which ForceTSOInstructions has populated data diff --git a/FEXCore/Source/Interface/Core/Core.cpp b/FEXCore/Source/Interface/Core/Core.cpp index 83fbbb905..67cebe5ab 100644 --- a/FEXCore/Source/Interface/Core/Core.cpp +++ b/FEXCore/Source/Interface/Core/Core.cpp @@ -893,23 +893,6 @@ void ContextImpl::InvalidateGuestCodeRange(FEXCore::Core::InternalThreadState* T InvalidateGuestThreadCodeRange(Thread, Accumulator, Start, Length); } -void ContextImpl::MarkMemoryShared(FEXCore::Core::InternalThreadState* Thread) { - if (!Thread) { - return; - } - - if (!IsMemoryShared) { - IsMemoryShared = true; - UpdateAtomicTSOEmulationConfig(); - - if (Config.TSOAutoMigration) { - // Only the lookup cache is cleared here, so that old code can keep running until next compilation. - // This will leak previously compiled blocks until the CodeBuffer is cleared for some other reason. - Thread->LookupCache->ClearCache(); - } - } -} - bool ContextImpl::ThreadRemoveCodeEntry(FEXCore::Core::InternalThreadState* Thread, uint64_t GuestRIP) { LogMan::Throw::AFmt(static_cast(Thread->CTX)->CodeInvalidationMutex.try_lock() == false, "CodeInvalidationMutex needs to " "be unique_locked here"); diff --git a/FEXCore/include/FEXCore/Core/Context.h b/FEXCore/include/FEXCore/Core/Context.h index 201987886..007b14e1b 100644 --- a/FEXCore/include/FEXCore/Core/Context.h +++ b/FEXCore/include/FEXCore/Core/Context.h @@ -158,8 +158,6 @@ public: FEXCore::Core::InternalThreadState* Thread, InvalidatedEntryAccumulator& Accumulator, uint64_t Start, uint64_t Length) = 0; FEX_DEFAULT_VISIBILITY virtual FEXCore::ForkableSharedMutex& GetCodeInvalidationMutex() = 0; - FEX_DEFAULT_VISIBILITY virtual void MarkMemoryShared(FEXCore::Core::InternalThreadState* Thread) = 0; - FEX_DEFAULT_VISIBILITY virtual void ConfigureAOTGen(FEXCore::Core::InternalThreadState* Thread, fextl::set* ExternalBranches, uint64_t SectionMaxAddress) = 0; diff --git a/Source/Tools/LinuxEmulation/LinuxSyscalls/Syscalls.cpp b/Source/Tools/LinuxEmulation/LinuxSyscalls/Syscalls.cpp index 6ffb3ed39..0e45ff7bf 100644 --- a/Source/Tools/LinuxEmulation/LinuxSyscalls/Syscalls.cpp +++ b/Source/Tools/LinuxEmulation/LinuxSyscalls/Syscalls.cpp @@ -620,10 +620,6 @@ uint64_t CloneHandler(FEXCore::Core::CpuStateFrame* Frame, FEX::HLE::clone3_args return false; }; - if (flags & CLONE_VM) { - Frame->Thread->CTX->MarkMemoryShared(Frame->Thread); - } - // If there are flags that can't be handled regularly then we need to hand off to the true clone handler if (HasUnhandledFlags(args)) { if (!AnyFlagsSet(flags, CLONE_THREAD)) { diff --git a/Source/Tools/LinuxEmulation/LinuxSyscalls/SyscallsSMCTracking.cpp b/Source/Tools/LinuxEmulation/LinuxSyscalls/SyscallsSMCTracking.cpp index e7a53b828..a3bec6e71 100644 --- a/Source/Tools/LinuxEmulation/LinuxSyscalls/SyscallsSMCTracking.cpp +++ b/Source/Tools/LinuxEmulation/LinuxSyscalls/SyscallsSMCTracking.cpp @@ -201,10 +201,6 @@ void* SyscallHandler::GuestMmap(bool Is64Bit, FEXCore::Core::InternalThreadState uint64_t Result {}; size_t Size = FEXCore::AlignUp(length, FEXCore::Utils::FEX_PAGE_SIZE); - if (flags & MAP_SHARED) { - CTX->MarkMemoryShared(Thread); - } - { // NOTE: Frontend calls this with a nullptr Thread during initialization, but // providing this code with a valid Thread object earlier would allow @@ -307,10 +303,8 @@ uint64_t SyscallHandler::GuestMprotect(FEXCore::Core::InternalThreadState* Threa } uint64_t SyscallHandler::GuestShmat(bool Is64Bit, FEXCore::Core::InternalThreadState* Thread, int shmid, const void* shmaddr, int shmflg) { - auto CTX = Thread->CTX; uint64_t Result {}; uint64_t Length {}; - CTX->MarkMemoryShared(Thread); { auto lk = FEXCore::GuardSignalDeferringSection(FEX::HLE::_SyscallHandler->VMATracking.Mutex, Thread); diff --git a/Source/Windows/ARM64EC/Module.cpp b/Source/Windows/ARM64EC/Module.cpp index d077e38d0..73930de69 100644 --- a/Source/Windows/ARM64EC/Module.cpp +++ b/Source/Windows/ARM64EC/Module.cpp @@ -641,9 +641,6 @@ NTSTATUS ProcessInit() { FEXCore::Config::Set(FEXCore::Config::CONFIG_IS64BIT_MODE, "1"); - // Not applicable to Windows - FEXCore::Config::Set(FEXCore::Config::ConfigOption::CONFIG_TSOAUTOMIGRATION, "0"); - FEXCore::Profiler::Init("", ""); FEX_CONFIG_OPT(ExtendedVolatileMetadataConfig, EXTENDEDVOLATILEMETADATA); diff --git a/Source/Windows/WOW64/Module.cpp b/Source/Windows/WOW64/Module.cpp index 641ae897a..278330eec 100644 --- a/Source/Windows/WOW64/Module.cpp +++ b/Source/Windows/WOW64/Module.cpp @@ -518,9 +518,6 @@ void BTCpuProcessInit() { FEXCore::Config::Set(FEXCore::Config::CONFIG_INTERPRETER_INSTALLED, "0"); FEXCore::Config::Set(FEXCore::Config::CONFIG_IS64BIT_MODE, "0"); - // Not applicable to Windows - FEXCore::Config::Set(FEXCore::Config::ConfigOption::CONFIG_TSOAUTOMIGRATION, "0"); - FEXCore::Profiler::Init("", ""); FEX_CONFIG_OPT(ExtendedVolatileMetadataConfig, EXTENDEDVOLATILEMETADATA);