diff --git a/FEXCore/Source/Interface/Context/Context.h b/FEXCore/Source/Interface/Context/Context.h index 9592d77a0..8f0ab1cde 100644 --- a/FEXCore/Source/Interface/Context/Context.h +++ b/FEXCore/Source/Interface/Context/Context.h @@ -85,8 +85,6 @@ public: void InitiateCacheGeneration() override { IsGeneratingCache = true; } - - void PostCompileCode(FEXCore::Core::InternalThreadState& Thread, void* CodePtr, uint64_t GuestRIP, Core::DebugData&); }; class ContextImpl final : public FEXCore::Context::Context, public CPU::CodeBufferManager { diff --git a/FEXCore/Source/Interface/Core/CodeCache.cpp b/FEXCore/Source/Interface/Core/CodeCache.cpp index c6d86d5e0..adac418a3 100644 --- a/FEXCore/Source/Interface/Core/CodeCache.cpp +++ b/FEXCore/Source/Interface/Core/CodeCache.cpp @@ -1,11 +1,8 @@ // SPDX-License-Identifier: MIT #include -#include #include -#include - namespace FEXCore { ExecutableFileInfo::~ExecutableFileInfo() = default; @@ -27,19 +24,4 @@ bool CodeCache::SaveData(Core::InternalThreadState& Thread, int fd, const Execut return true; } -void CodeCache::PostCompileCode(FEXCore::Core::InternalThreadState& Thread, void* CodePtr, uint64_t GuestRIP, FEXCore::Core::DebugData& DebugData) { - if (CTX.Config.LibraryJITNaming() || CTX.Config.GDBSymbols()) { - auto MappedSection = CTX.SyscallHandler->LookupExecutableFileSection(Thread, GuestRIP); - if (MappedSection) { - if (CTX.Config.LibraryJITNaming()) { - CTX.Symbols.RegisterNamedRegion(Thread.SymbolBuffer.get(), CodePtr, DebugData.HostCodeSize, MappedSection->FileInfo.Filename); - } - - if (CTX.Config.GDBSymbols()) { - GDBJITRegister(MappedSection->FileInfo, MappedSection->FileStartVA, GuestRIP, (uintptr_t)CodePtr, DebugData); - } - } - } -} - } // namespace FEXCore::Context diff --git a/FEXCore/Source/Interface/Core/Core.cpp b/FEXCore/Source/Interface/Core/Core.cpp index 74357316c..7608fcec4 100644 --- a/FEXCore/Source/Interface/Core/Core.cpp +++ b/FEXCore/Source/Interface/Core/Core.cpp @@ -18,6 +18,7 @@ $end_info$ #include "Interface/Core/JIT/JITClass.h" #include "Interface/Core/Dispatcher/Dispatcher.h" #include "Interface/Core/X86Tables/X86Tables.h" +#include #include "Interface/IR/IR.h" #include "Interface/IR/IREmitter.h" #include "Interface/IR/Passes/RegisterAllocationPass.h" @@ -807,13 +808,24 @@ uintptr_t ContextImpl::CompileBlock(FEXCore::Core::CpuStateFrame* Frame, uint64_ } } + if (Config.LibraryJITNaming() || Config.GDBSymbols()) { + auto MappedSection = SyscallHandler->LookupExecutableFileSection(*Thread, GuestRIP); + if (MappedSection) { + if (Config.LibraryJITNaming()) { + Symbols.RegisterNamedRegion(Thread->SymbolBuffer.get(), CodePtr, DebugData->HostCodeSize, MappedSection->FileInfo.Filename); + } + + if (Config.GDBSymbols()) { + GDBJITRegister(MappedSection->FileInfo, MappedSection->FileStartVA, GuestRIP, (uintptr_t)CodePtr, *DebugData); + } + } + } + // Clear any relocations that might have been generated if (!CodeCache.IsGeneratingCache) { Thread->CPUBackend->ClearRelocations(); } - CodeCache.PostCompileCode(*Thread, CompiledCode.BlockBegin, GuestRIP, *DebugData.get()); - if (NeedsAddGuestCodeRanges) { // Track in the guest to host map all entrypoints for all pages the compiled block touches, if any page didn't previously // contain code, inform the frontend so it can setup SMC detection.