summaryrefslogtreecommitdiff
path: root/view/sharedcache/core/SharedCache.cpp
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2025-02-11 20:17:29 -0500
committerMason Reed <mason@vector35.com>2025-02-12 18:43:02 -0500
commitcce44e00f23841d3709ac9cd4741ee2482b65595 (patch)
tree71bbe73fff32ecbc3b5a01b55b1a599106108ce3 /view/sharedcache/core/SharedCache.cpp
parent1ffdd4da176f1990cdf0ff4d0079a3ccb4e51206 (diff)
Add Symbol constructor for pre-allocated core namespace
This allows a consumer to bypass the alloc + free of the API NameSpace, removing the need for the consumer to manually construct a symbol for said behavior.
Diffstat (limited to 'view/sharedcache/core/SharedCache.cpp')
-rw-r--r--view/sharedcache/core/SharedCache.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/view/sharedcache/core/SharedCache.cpp b/view/sharedcache/core/SharedCache.cpp
index 224097f5..642e8bcb 100644
--- a/view/sharedcache/core/SharedCache.cpp
+++ b/view/sharedcache/core/SharedCache.cpp
@@ -2722,13 +2722,8 @@ void SharedCache::ReadExportNode(std::vector<Ref<Symbol>>& symbolList, const Sha
#if EXPORT_TRIE_DEBUG
// BNLogInfo("export: %s -> 0x%llx", n.text.c_str(), image.baseAddress + n.offset);
#endif
- // TODO: The usual `Symbol` constructors take a `NameSpace` and do unnecessary memory allocations
- // to pass its fields down to the core API. Here we pass nullptr for the namespace which is treated
- // the same, but avoids the memory allocations. Switch back to directly constructing a `Symbol`
- // once it gains constructors without that overhead.
- auto symbol = new Symbol(BNCreateSymbol(type, currentText.c_str(), currentText.c_str(),
- currentText.c_str(), textBase + imageOffset, NoBinding, nullptr, 0));
- symbolList.push_back(symbol);
+ auto symbol = new Symbol(type, currentText, textBase + imageOffset, nullptr);
+ symbolList.emplace_back(symbol);
}
}
}