[Lldb-commits] [PATCH] D67022: Skip getting declarations for repeated DIEs (WIP)
Guilherme Andrade via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Fri Aug 30 14:53:37 PDT 2019
guiandrade created this revision.
guiandrade added reviewers: clayborg, labath.
guiandrade added a project: LLDB.
Herald added subscribers: lldb-commits, JDevlieghere, aprantl.
guiandrade added a comment.
Hey guys,
This change is more for me to get to know what you guys think. I've noticed that GetDeclForUIDFromDWARF() calls inside SymbolFileDWARF::ParseDeclsForContext (https://github.com/llvm/llvm-project/blob/ef82098a800178a1f973abb8af86eaa690a29734/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp#L1216) often end up having no side effect besides generating a llvm::DenseMap::find invocation (https://github.com/llvm/llvm-project/blob/f07b4aff06d83c6ad25d95f456fbc12b2d2a0a0c/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp#L3322), especially when we evaluate multiple expressions inside the same scope. So I was wondering if there's a way to improve that. Do you guys think we could do something like what this change proposes, or am I missing something important? Thanks!
This change creates a map that keeps track of the number of DIEs for each CompilerDeclContext so we can skip the ones we have already seen
inside SymbolFileDWARF::ParseDeclsForContext.
Repository:
rLLDB LLDB
https://reviews.llvm.org/D67022
Files:
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -489,6 +489,10 @@
llvm::DenseMap<dw_offset_t, lldb_private::FileSpecList>
m_type_unit_support_files;
std::vector<uint32_t> m_lldb_cu_to_dwarf_unit;
+
+ typedef std::pair<void *, lldb_private::TypeSystem *> DeclContextToOffsetKey;
+ typedef std::map<DeclContextToOffsetKey, uint32_t> DeclContextToOffsetMap;
+ DeclContextToOffsetMap m_decl_context_to_offset_map;
};
#endif // SymbolFileDWARF_SymbolFileDWARF_h_
Index: lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
===================================================================
--- lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1209,11 +1209,17 @@
DWARFASTParser *ast_parser = type_system->GetDWARFParser();
std::vector<DWARFDIE> decl_ctx_die_list =
ast_parser->GetDIEForDeclContext(decl_ctx);
+ DeclContextToOffsetKey offset_key =
+ std::make_pair(decl_ctx.GetOpaqueDeclContext(), type_system);
+ uint32_t &offset = m_decl_context_to_offset_map[offset_key];
- for (DWARFDIE decl_ctx_die : decl_ctx_die_list)
- for (DWARFDIE decl = decl_ctx_die.GetFirstChild(); decl;
+ for (auto decl_ctx_die_it = decl_ctx_die_list.begin() + offset;
+ decl_ctx_die_it != decl_ctx_die_list.end(); ++decl_ctx_die_it)
+ for (DWARFDIE decl = decl_ctx_die_it->GetFirstChild(); decl;
decl = decl.GetSibling())
ast_parser->GetDeclForUIDFromDWARF(decl);
+
+ offset = decl_ctx_die_list.size();
}
user_id_t SymbolFileDWARF::GetUID(DIERef ref) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67022.218174.patch
Type: text/x-patch
Size: 1788 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190830/a9f90a92/attachment.bin>
More information about the lldb-commits
mailing list