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/VirtualMemory.cpp | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'view/sharedcache/core/VirtualMemory.cpp') diff --git a/view/sharedcache/core/VirtualMemory.cpp b/view/sharedcache/core/VirtualMemory.cpp index b55ddefe..60ed1481 100644 --- a/view/sharedcache/core/VirtualMemory.cpp +++ b/view/sharedcache/core/VirtualMemory.cpp @@ -1,9 +1,5 @@ #include "VirtualMemory.h" -// TODO: Add back the ability to do relocations on this stuff. -// TODO: ^ the above is currently handled only by the consumers of the VirtualMemory -// TODO: however we might still want to have this be done here as well for persistence. - void VirtualMemory::MapRegion(WeakFileAccessor fileAccessor, AddressRange mappedRange, uint64_t fileOffset) { // Create a new VirtualMemoryRegion object @@ -56,9 +52,7 @@ void VirtualMemory::WritePointer(size_t address, size_t pointer) auto region = GetRegionAtAddress(address, offset); if (!region.has_value()) throw UnmappedRegionException(address); - // Unique to the `VirtualMemory::WritePointer` we actually have an interface on the WeakFileAccessor to use. - // this is the mechanism for persisting our written pointers. - region->fileAccessor.WritePointer(offset, pointer); + region->fileAccessor.lock()->WritePointer(offset, pointer); } std::string VirtualMemory::ReadCString(uint64_t address) @@ -277,7 +271,7 @@ uint8_t VirtualMemoryReader::ReadUInt8(uint64_t address) int8_t VirtualMemoryReader::ReadInt8() { - return ReadUInt8(m_cursor); + return ReadInt8(m_cursor); } int8_t VirtualMemoryReader::ReadInt8(uint64_t address) -- cgit v1.3.1