summaryrefslogtreecommitdiff
path: root/view/sharedcache/core/SharedCache.h
diff options
context:
space:
mode:
authorWeiN76LQh <WeiN76LQh@github.com>2024-11-26 16:15:58 +0000
committerkat <kat@vector35.com>2025-02-10 10:33:20 -0500
commit28aef35c76c4b6c9215aeb82f974032031154bd1 (patch)
tree1c724b45f14428c1e9ea72c70ea93702c14a83e2 /view/sharedcache/core/SharedCache.h
parente90a08f5a6237472a3d0caf77e11dfcc987f1169 (diff)
[SharedCache] Improve the types for `m_exportInfos`
This commit changes 2 things; 1. `m_exportInfos` is now a map where its values are also a map rather than a vector of pairs. The reason for this is that `SharedCache::FindSymbolAtAddrAndApplyToAddr` is a hot path which does by far the most accesses to `m_exportInfos`. In that function it must find the correct symbol for a given address so a map lookup will be much quicker than iterating a vector. The other use cases of `m_exportInfos` would prefer a vector but they are executed very infrequently. 2. The symbols are stored in `m_exportInfos` as references to the `Symbol` type. This makes more sense because otherwise there is a lot of time spent converting to and from a `Symbol` type and a pair of `BNSymbolType` + a `std::string`.
Diffstat (limited to 'view/sharedcache/core/SharedCache.h')
-rw-r--r--view/sharedcache/core/SharedCache.h6
1 files changed, 2 insertions, 4 deletions
diff --git a/view/sharedcache/core/SharedCache.h b/view/sharedcache/core/SharedCache.h
index bb1181b6..fd976ed7 100644
--- a/view/sharedcache/core/SharedCache.h
+++ b/view/sharedcache/core/SharedCache.h
@@ -567,6 +567,7 @@ namespace SharedCacheCore {
struct ViewSpecificState;
+
private:
Ref<Logger> m_logger;
/* VIEW STATE BEGIN -- SERIALIZE ALL OF THIS AND STORE IT IN RAW VIEW */
@@ -641,10 +642,7 @@ private:
const uint8_t *end, const uint8_t* current, uint64_t textBase, const std::string& currentText);
std::vector<Ref<Symbol>> ParseExportTrie(
std::shared_ptr<MMappedFileAccessor> linkeditFile, const SharedCacheMachOHeader& header);
-
- std::vector<std::pair<uint64_t, std::pair<BNSymbolType, std::string>>> GetExportListForHeader(
- SharedCacheMachOHeader header, std::function<std::shared_ptr<MMappedFileAccessor>()> provideLinkeditFile,
- bool* didModifyExportList = nullptr);
+ std::unordered_map<uint64_t, Ref<Symbol>> GetExportListForHeader(SharedCacheMachOHeader header, std::function<std::shared_ptr<MMappedFileAccessor>()> provideLinkeditFile, bool* didModifyExportList = nullptr);
Ref<TypeLibrary> TypeLibraryForImage(const std::string& installName);