summaryrefslogtreecommitdiff
path: root/view/sharedcache/core/MappedFileAccessor.cpp
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/MappedFileAccessor.cpp
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/MappedFileAccessor.cpp')
-rw-r--r--view/sharedcache/core/MappedFileAccessor.cpp21
1 files changed, 10 insertions, 11 deletions
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> 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<uint8_t>(address);
}
-int8_t MappedFileAccessor::ReadInt8(size_t address)
+int8_t MappedFileAccessor::ReadInt8(size_t address) const
{
return Read<int8_t>(address);
}
-uint16_t MappedFileAccessor::ReadUInt16(size_t address)
+uint16_t MappedFileAccessor::ReadUInt16(size_t address) const
{
return Read<uint16_t>(address);
}
-int16_t MappedFileAccessor::ReadInt16(size_t address)
+int16_t MappedFileAccessor::ReadInt16(size_t address) const
{
return Read<int16_t>(address);
}
-uint32_t MappedFileAccessor::ReadUInt32(size_t address)
+uint32_t MappedFileAccessor::ReadUInt32(size_t address) const
{
return Read<uint32_t>(address);
}
-int32_t MappedFileAccessor::ReadInt32(size_t address)
+int32_t MappedFileAccessor::ReadInt32(size_t address) const
{
return Read<int32_t>(address);
}
-uint64_t MappedFileAccessor::ReadUInt64(size_t address)
+uint64_t MappedFileAccessor::ReadUInt64(size_t address) const
{
return Read<uint64_t>(address);
}
-int64_t MappedFileAccessor::ReadInt64(size_t address)
+int64_t MappedFileAccessor::ReadInt64(size_t address) const
{
return Read<int64_t>(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 <typename T>
-T MappedFileAccessor::Read(size_t address)
+T MappedFileAccessor::Read(size_t address) const
{
T result;
Read(&result, address, sizeof(T));