From e2a7fef742f4f2e7fb52c6c174315a6526ab4e65 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sat, 31 Aug 2024 01:58:35 -0700 Subject: [PATCH] Thunks: Removes global static initializer This variable can't be constexpr initialized since it requires linker fix-ups, which changes it in to a global static initializer instead. While this benign as it doesn't allocate any memory, just move it next to its single use. Removes the static initializer that was there for no reason. --- FEXCore/Source/Interface/HLE/Thunks/Thunks.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/FEXCore/Source/Interface/HLE/Thunks/Thunks.cpp b/FEXCore/Source/Interface/HLE/Thunks/Thunks.cpp index d4a1d8e8e9..fc3860cabd 100644 --- a/FEXCore/Source/Interface/HLE/Thunks/Thunks.cpp +++ b/FEXCore/Source/Interface/HLE/Thunks/Thunks.cpp @@ -97,7 +97,6 @@ struct TrampolineInstanceInfo { // Opaque type pointing to an instance of HostToGuestTrampolineTemplate and its // embedded TrampolineInstanceInfo struct HostToGuestTrampolinePtr; -const auto HostToGuestTrampolineSize = __stop_HostToGuestTrampolineTemplate - __start_HostToGuestTrampolineTemplate; static TrampolineInstanceInfo& GetInstanceInfo(HostToGuestTrampolinePtr* Trampoline) { const auto Length = __stop_HostToGuestTrampolineTemplate - __start_HostToGuestTrampolineTemplate; @@ -438,6 +437,8 @@ MakeHostTrampolineForGuestFunction(void* HostPacker, uintptr_t GuestTarget, uint LogMan::Msg::DFmt("Thunks: Adding host trampoline for guest function {:#x} via unpacker {:#x}", GuestTarget, GuestUnpacker); + const auto HostToGuestTrampolineSize = __stop_HostToGuestTrampolineTemplate - __start_HostToGuestTrampolineTemplate; + if (ThunkHandler->HostTrampolineInstanceDataAvailable < HostToGuestTrampolineSize) { const auto allocation_step = 16 * 1024; ThunkHandler->HostTrampolineInstanceDataAvailable = allocation_step;