From b29121c71a76b95cbca16d26e49882b5980bdfdf Mon Sep 17 00:00:00 2001 From: Stefanos Kornilios Mitsis Poiitidis Date: Wed, 17 Feb 2021 14:20:14 +0200 Subject: [PATCH] AOTIR: Rename AOTCache to AOTIRCache --- .../Source/Interface/Context/Context.h | 4 +-- .../FEXCore/Source/Interface/Core/Core.cpp | 28 +++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/External/FEXCore/Source/Interface/Context/Context.h b/External/FEXCore/Source/Interface/Context/Context.h index eaceb7341..27529f531 100644 --- a/External/FEXCore/Source/Interface/Context/Context.h +++ b/External/FEXCore/Source/Interface/Context/Context.h @@ -107,7 +107,7 @@ namespace FEXCore::Context { CustomCPUFactoryType FallbackCPUFactory; std::function CustomExitHandler; - struct AOTCacheEntry { + struct AOTIRCacheEntry { uint64_t start; uint64_t len; uint64_t crc; @@ -116,7 +116,7 @@ namespace FEXCore::Context { }; std::function(const std::string&)> AOTIRLoader; - std::unordered_map> AOTCache; + std::unordered_map> AOTIRCache; struct AddrToFileEntry { uint64_t Start; diff --git a/External/FEXCore/Source/Interface/Core/Core.cpp b/External/FEXCore/Source/Interface/Core/Core.cpp index 9ad3363e4..e7230d117 100644 --- a/External/FEXCore/Source/Interface/Core/Core.cpp +++ b/External/FEXCore/Source/Interface/Core/Core.cpp @@ -78,7 +78,7 @@ namespace FEXCore::CPU { } } -static std::mutex AOTCacheLock; +static std::mutex AOTIRCacheLock; namespace FEXCore::Core { struct ThreadLocalData { @@ -274,8 +274,8 @@ namespace FEXCore::Context { SaveEntryList(); - // AOTCache needs manual clear - for (auto &Mod: AOTCache) { + // AOTIRCache needs manual clear + for (auto &Mod: AOTIRCache) { for (auto &Entry: Mod.second) { delete Entry.second.IR; free(Entry.second.RAData); @@ -839,14 +839,14 @@ namespace FEXCore::Context { } if (IRList == nullptr && Config.AOTIRLoad) { - std::lock_guard lk(AOTCacheLock); + std::lock_guard lk(AOTIRCacheLock); auto file = AddrToFile.lower_bound(GuestRIP); if (file != AddrToFile.begin()) { --file; - auto Mod = (decltype(AOTCache)::value_type::second_type*) file->second.CachedFileEntry; + auto Mod = (decltype(AOTIRCache)::value_type::second_type*) file->second.CachedFileEntry; if (Mod == nullptr) { - file->second.CachedFileEntry = Mod = &AOTCache[file->second.fileid]; + file->second.CachedFileEntry = Mod = &AOTIRCache[file->second.fileid]; } auto AOTEntry = Mod->find(GuestRIP - file->second.Start + file->second.Offset); @@ -896,7 +896,7 @@ namespace FEXCore::Context { } bool Context::LoadAOTIRCache(std::istream &stream) { - std::lock_guard lk(AOTCacheLock); + std::lock_guard lk(AOTIRCacheLock); uint64_t tag; stream.read((char*)&tag, sizeof(tag)); if (!stream || tag != 0xDEADBEEFC0D30002) @@ -919,7 +919,7 @@ namespace FEXCore::Context { if (!stream) return false; - auto &Mod = AOTCache[Module]; + auto &Mod = AOTIRCache[Module]; uint64_t FnCount; stream.read((char*)&FnCount, sizeof(FnCount)); @@ -979,11 +979,11 @@ namespace FEXCore::Context { } bool Context::WriteAOTIRCache(std::function(const std::string&)> CacheWriter) { - std::lock_guard lk(AOTCacheLock); + std::lock_guard lk(AOTIRCacheLock); bool rv = true; - for (auto AOTModule: AOTCache) { + for (auto AOTModule: AOTIRCache) { if (AOTModule.second.size() == 0) { continue; } @@ -1093,11 +1093,11 @@ namespace FEXCore::Context { // Add to AOT cache if aot generation is enabled if (Config.AOTIRCapture && RAData && MinAddress) { - std::lock_guard lk(AOTCacheLock); + std::lock_guard lk(AOTIRCacheLock); RAData->IsShared = true; IRList->IsShared = true; - + auto len = MaxAddress - MinAddress; auto hash = fasthash64((void*)MinAddress, len, 0); @@ -1105,7 +1105,7 @@ namespace FEXCore::Context { if (file != AddrToFile.begin()) { --file; if (file->second.Start <= MinAddress && (file->second.Start + file->second.Len) > MaxAddress) { - AOTCache[file->second.fileid].insert({GuestRIP - file->second.Start + file->second.Offset, {MinAddress - file->second.Start + file->second.Offset, len, hash, IRList, RAData}}); + AOTIRCache[file->second.fileid].insert({GuestRIP - file->second.Start + file->second.Offset, {MinAddress - file->second.Start + file->second.Offset, len, hash, IRList, RAData}}); } } } @@ -1271,7 +1271,7 @@ namespace FEXCore::Context { AddrToFile.insert({ Base, { Base, Size, Offset, fileid, nullptr } }); - if (Config.AOTIRLoad && !AOTCache.contains(fileid) && AOTIRLoader) { + if (Config.AOTIRLoad && !AOTIRCache.contains(fileid) && AOTIRLoader) { auto stream = AOTIRLoader(fileid); if (*stream) { LoadAOTIRCache(*stream);