From cce44e00f23841d3709ac9cd4741ee2482b65595 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Tue, 11 Feb 2025 20:17:29 -0500 Subject: 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. --- view/sharedcache/core/SharedCache.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'view/sharedcache/core/SharedCache.cpp') 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>& 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); } } } -- cgit v1.3.1