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/MappedFileAccessor.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'view/sharedcache/core/MappedFileAccessor.cpp') diff --git a/view/sharedcache/core/MappedFileAccessor.cpp b/view/sharedcache/core/MappedFileAccessor.cpp index 3c9bf1e2..4f9f99a8 100644 --- a/view/sharedcache/core/MappedFileAccessor.cpp +++ b/view/sharedcache/core/MappedFileAccessor.cpp @@ -1,6 +1,5 @@ #include "MappedFileAccessor.h" - std::shared_ptr MappedFileAccessor::Open(const std::string& filePath) { auto file = MappedFile::OpenFile(filePath); @@ -40,48 +39,48 @@ std::string MappedFileAccessor::ReadNullTermString(size_t address, const size_t return str; } -uint8_t MappedFileAccessor::ReadUInt8(size_t address) +uint8_t MappedFileAccessor::ReadUInt8(size_t address) const { return Read(address); } -int8_t MappedFileAccessor::ReadInt8(size_t address) +int8_t MappedFileAccessor::ReadInt8(size_t address) const { return Read(address); } -uint16_t MappedFileAccessor::ReadUInt16(size_t address) +uint16_t MappedFileAccessor::ReadUInt16(size_t address) const { return Read(address); } -int16_t MappedFileAccessor::ReadInt16(size_t address) +int16_t MappedFileAccessor::ReadInt16(size_t address) const { return Read(address); } -uint32_t MappedFileAccessor::ReadUInt32(size_t address) +uint32_t MappedFileAccessor::ReadUInt32(size_t address) const { return Read(address); } -int32_t MappedFileAccessor::ReadInt32(size_t address) +int32_t MappedFileAccessor::ReadInt32(size_t address) const { return Read(address); } -uint64_t MappedFileAccessor::ReadUInt64(size_t address) +uint64_t MappedFileAccessor::ReadUInt64(size_t address) const { return Read(address); } -int64_t MappedFileAccessor::ReadInt64(size_t address) +int64_t MappedFileAccessor::ReadInt64(size_t address) const { return Read(address); } -BinaryNinja::DataBuffer MappedFileAccessor::ReadBuffer(size_t addr, size_t length) +BinaryNinja::DataBuffer MappedFileAccessor::ReadBuffer(size_t addr, size_t length) const { if (addr + length > Length()) throw UnmappedAccessException(addr + length, Length()); @@ -104,7 +103,7 @@ void MappedFileAccessor::Read(void* dest, size_t addr, size_t length) const } template -T MappedFileAccessor::Read(size_t address) +T MappedFileAccessor::Read(size_t address) const { T result; Read(&result, address, sizeof(T)); -- cgit v1.3.1