From 2573bcb90ff63df180ad3072651bc65b9eaeff23 Mon Sep 17 00:00:00 2001 From: Tony Wasserka Date: Thu, 18 Dec 2025 16:02:01 +0100 Subject: [PATCH] CodeCache: Turn ExecutableFileSectionInfo::FileInfo into a const reference --- FEXCore/Source/Interface/Core/Frontend.h | 2 +- FEXCore/include/FEXCore/Core/CodeCache.h | 6 ++++-- Source/Tools/FEXServer/ProcessPipe.cpp | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/FEXCore/Source/Interface/Core/Frontend.h b/FEXCore/Source/Interface/Core/Frontend.h index 5e8812853..168eae3ca 100644 --- a/FEXCore/Source/Interface/Core/Frontend.h +++ b/FEXCore/Source/Interface/Core/Frontend.h @@ -145,7 +145,7 @@ private: fextl::set VisitedBlocks; fextl::set* ExternalBranches {nullptr}; - fextl::unordered_map* Relocations {nullptr}; + const fextl::unordered_map* Relocations {nullptr}; // ModRM rm decoding using DecodeModRMPtr = void (FEXCore::Frontend::Decoder::*)(X86Tables::DecodedOperand* Operand, X86Tables::ModRMDecoded ModRM); diff --git a/FEXCore/include/FEXCore/Core/CodeCache.h b/FEXCore/include/FEXCore/Core/CodeCache.h index 68edeaac4..efb1f3d9e 100644 --- a/FEXCore/include/FEXCore/Core/CodeCache.h +++ b/FEXCore/include/FEXCore/Core/CodeCache.h @@ -39,7 +39,9 @@ struct ExecutableFileInfo { ExecutableFileInfo() = default; #endif - fextl::unique_ptr SourcecodeMap; + // This legacy field must be assignable through const-references + mutable fextl::unique_ptr SourcecodeMap; + uint64_t FileId = 0; fextl::string Filename; fextl::unordered_map Relocations; @@ -47,7 +49,7 @@ struct ExecutableFileInfo { // Information associated with a specific section of an executable file struct ExecutableFileSectionInfo { - ExecutableFileInfo& FileInfo; + const ExecutableFileInfo& FileInfo; // Start address that the file is mapped to. // NOTE: Since executable files may be mapped multiple times, this can depend on the queried section. diff --git a/Source/Tools/FEXServer/ProcessPipe.cpp b/Source/Tools/FEXServer/ProcessPipe.cpp index 9400f72e6..a874cd6bf 100644 --- a/Source/Tools/FEXServer/ProcessPipe.cpp +++ b/Source/Tools/FEXServer/ProcessPipe.cpp @@ -385,7 +385,7 @@ static void WriteNewCodeMap(const FEXCore::ExecutableFileInfo& File, const std:: } for (auto& Block : Blocks) { - OutputCodeMap.AppendBlock(FEXCore::ExecutableFileSectionInfo {const_cast(File), 0}, Block); + OutputCodeMap.AppendBlock(FEXCore::ExecutableFileSectionInfo {File, 0}, Block); } }