summaryrefslogtreecommitdiff
path: root/view/sharedcache/core/SharedCache.h
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2025-04-06 20:00:00 -0400
committerMason Reed <mason@vector35.com>2025-04-06 20:00:37 -0400
commitc22d54c5d95f4d23629484579414387b0c7503ee (patch)
tree933a58c8ed3518f507f5bd4d496364411273f5b9 /view/sharedcache/core/SharedCache.h
parent4f22a944d77f784b53ee3a37d9f1966ede1c98a4 (diff)
[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
Diffstat (limited to 'view/sharedcache/core/SharedCache.h')
-rw-r--r--view/sharedcache/core/SharedCache.h7
1 files changed, 3 insertions, 4 deletions
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<dyld_cache_mapping_info> 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<std::string, dyld_cache_image_info> m_images {};
public:
@@ -221,7 +220,7 @@ public:
SharedCache &operator=(SharedCache &&) noexcept = default;
uint64_t GetBaseAddress() const { return m_baseAddress; }
- std::shared_ptr<VirtualMemory> GetVirtualMemory() { return m_vm; }
+ std::shared_ptr<VirtualMemory> GetVirtualMemory() const { return m_vm; }
const std::unordered_map<CacheEntryId, CacheEntry>& GetEntries() const { return m_entries; }
const AddressRangeMap<CacheRegion>& GetRegions() const { return m_regions; }
const std::unordered_map<uint64_t, CacheImage>& 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();