From c22d54c5d95f4d23629484579414387b0c7503ee Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Sun, 6 Apr 2025 20:00:00 -0400 Subject: [SharedCache] Replace write log with callback registration for reapplying slide info This improves performance by ~10x with the only real issue being a copy of the cache entry existing for each weak ref. Also fixes - Some old TODO's that are no longer relevant - Some function signatures not being const - FileAccessorCache not evicting enough accessors to fit under an adjusted cache size - Added a warning if we are over the global cache size in view initialization - Logger name not having a `.` in `SlideInfoProcessor::SlideInfoProcessor` - Re-added the accessor dirty check before applying slide info to fix https://github.com/Vector35/binaryninja-api/issues/6570 --- view/sharedcache/core/SharedCache.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'view/sharedcache/core/SharedCache.h') diff --git a/view/sharedcache/core/SharedCache.h b/view/sharedcache/core/SharedCache.h index 3b9e9fe1..3f2caed5 100644 --- a/view/sharedcache/core/SharedCache.h +++ b/view/sharedcache/core/SharedCache.h @@ -134,9 +134,8 @@ class CacheEntry // Mappings tell us _where_ to map the regions within the flat address space. // Without this we wouldn't know where the entry is supposed to exist in the address space. std::vector m_mappings {}; - // TODO: We really should remove this methinks. - // TODO: Storing this here is basically useless? IDK // Mapping of image path to image info, used within ProcessImagesAndRegions to add them to the cache. + // Also used to retrieve the image dependencies. std::unordered_map m_images {}; public: @@ -221,7 +220,7 @@ public: SharedCache &operator=(SharedCache &&) noexcept = default; uint64_t GetBaseAddress() const { return m_baseAddress; } - std::shared_ptr GetVirtualMemory() { return m_vm; } + std::shared_ptr GetVirtualMemory() const { return m_vm; } const std::unordered_map& GetEntries() const { return m_entries; } const AddressRangeMap& GetRegions() const { return m_regions; } const std::unordered_map& GetImages() const { return m_images; } @@ -245,7 +244,7 @@ public: void ProcessEntryRegions(const CacheEntry& entry); - void ProcessEntrySlideInfo(const CacheEntry& entry); + void ProcessEntrySlideInfo(const CacheEntry& entry) const; // Construct the named symbols lookup map for use with `GetSymbolWithName`. void ProcessSymbols(); -- cgit v1.3.1