From b74c500aa9e5e7949ca46f42e0dc62e02136e259 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Mon, 14 Apr 2025 01:53:06 -0400 Subject: [SharedCache] Misc cleanup - Make `SharedCache::m_entries` a simple std::vector we never lookup based off the entry ID - Remove some old comments - Rename some old variables so that they are accurate - Fix compiler warnings - Remove some unneeded copying --- view/sharedcache/core/SharedCache.h | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'view/sharedcache/core/SharedCache.h') diff --git a/view/sharedcache/core/SharedCache.h b/view/sharedcache/core/SharedCache.h index 52e9a984..efef394c 100644 --- a/view/sharedcache/core/SharedCache.h +++ b/view/sharedcache/core/SharedCache.h @@ -106,7 +106,6 @@ enum class CacheEntryType Primary, Secondary, // A special entry that holds symbols for other cache entries. - // TODO: We dont need this i think. Symbols, // If the type is marked as this then all mappings will be marked as such. DyldData, @@ -164,8 +163,6 @@ public: // The ID for a given CacheEntry, use this instead of passing a pointer around to avoid complexity :V typedef uint32_t CacheEntryId; -// TODO: Add a "ViewCache" that keeps track of what has been added to the view. - // The C in DSC. // This represents the entire cache, all regions and images are visible from here. // This is the dump for all the information, and what the workflow activities and the UI want. @@ -175,10 +172,9 @@ class SharedCache { // Calculated within `AddEntry`, this indicates where the shared cache image is based at. uint64_t m_baseAddress = 0; - // TODO: Figure out when to lock the mutex on this shit lmfao // The shared cache can own the virtual memory, this is fine... std::shared_ptr m_vm; - std::unordered_map m_entries {}; + std::vector m_entries {}; // This information is used in tandem with the cache images to load memory regions into the binary view. AddressRangeMap m_regions {}; // Describes the images of the cache. @@ -210,7 +206,7 @@ public: uint64_t GetBaseAddress() const { return m_baseAddress; } std::shared_ptr GetVirtualMemory() const { return m_vm; } - const std::unordered_map& GetEntries() const { return m_entries; } + const std::vector& GetEntries() const { return m_entries; } const AddressRangeMap& GetRegions() const { return m_regions; } const std::unordered_map& GetImages() const { return m_images; } const std::unordered_map& GetSymbols() const { return m_symbols; } @@ -226,7 +222,7 @@ public: // Adds the cache entry and populates the virtual memory using the mapping information. // After being added the entry is read only, there is nothing that can modify it. - CacheEntryId AddEntry(CacheEntry entry); + void AddEntry(CacheEntry entry); void ProcessEntryImages(const CacheEntry& entry); -- cgit v1.3.1