Core: Clear relocations after the cache service had a chance to copy them

Can't clear the relocations vector until after the code object cache
service has consumed them.
This commit is contained in:
Ryan Houdek committed 2022-05-14 17:49:18 -07:00
1 parent afe10c1666
commit b3cd4edb3b
6 files changed
+12 -2

No files matched your search

+3
View File
@@ -1017,6 +1017,9 @@ namespace FEXCore::Context {
));
}
// Clear any relocations that might have been generated
Thread->CPUBackend->ClearRelocations();
if (IRCaptureCache.PostCompileCode(
Thread,
CodePtr,
@@ -832,7 +832,6 @@ void *Arm64JITCore::CompileCode(uint64_t Entry, [[maybe_unused]] FEXCore::IR::IR
DebugData->HostCodeSize = reinterpret_cast<uintptr_t>(CodeEnd) - reinterpret_cast<uintptr_t>(GuestEntry);
DebugData->Relocations = &Relocations;
}
Relocations.clear();
this->IR = nullptr;
@@ -68,6 +68,8 @@ public:
static void InitializeSignalHandlers(FEXCore::Context::Context *CTX);
void ClearRelocations() override { Relocations.clear(); }
private:
FEX_CONFIG_OPT(ParanoidTSO, PARANOIDTSO);
@@ -804,7 +804,6 @@ void *X86JITCore::CompileCode(uint64_t Entry, [[maybe_unused]] FEXCore::IR::IRLi
DebugData->HostCodeSize = reinterpret_cast<uintptr_t>(GuestExit) - reinterpret_cast<uintptr_t>(GuestEntry);
DebugData->Relocations = &Relocations;
}
Relocations.clear();
return GuestEntry;
}
@@ -84,6 +84,8 @@ public:
static void InitializeSignalHandlers(FEXCore::Context::Context *CTX);
void ClearRelocations() override { Relocations.clear(); }
private:
/**
+5
View File
@@ -112,6 +112,11 @@ class LLVMCore;
*/
virtual bool NeedsRetainedIRCopy() const { return false; }
/**
* @brief Clear any relocations after JIT compiling
*/
virtual void ClearRelocations() {}
using AsmDispatch = FEX_NAKED void(*)(FEXCore::Core::CpuStateFrame *Frame);
using JITCallback = FEX_NAKED void(*)(FEXCore::Core::CpuStateFrame *Frame, uint64_t RIP);