================ @@ -374,25 +377,40 @@ void DebugNamesDWARFIndex::GetFullyQualifiedType( m_fallback.GetFullyQualifiedType(context, callback); } +bool DebugNamesDWARFIndex::SameAsEntryATName( + llvm::StringRef query_name, const DebugNames::Entry &entry) const { + auto maybe_dieoffset = entry.getDIEUnitOffset(); + if (!maybe_dieoffset) + return false; + + // [Optimization] instead of parsing the entry from dwo file, we simply + // check if the query_name can point to an entry of the same DIE offset. + // This greatly reduced number of dwo file parsed and thus improved the + // performance. + for (const DebugNames::Entry &query_entry : + entry.getNameIndex()->equal_range(query_name)) { + auto query_dieoffset = query_entry.getDIEUnitOffset(); + if (!query_dieoffset) + continue; + + if (*query_dieoffset == *maybe_dieoffset) { + return true; + } else if (*query_dieoffset > *maybe_dieoffset) { + // The pool entries of the same name are sequentially cluttered together + // so if the query name from `query_name` is after the target entry, this + // is definitely not the correct one, we can stop searching. ---------------- jeffreytan81 wrote:
@labath, @felipepiovezan, ah, you are right. This check is a bad implementation. The optimization I want to express here is that: the "pool entries" in `.debug_names` are cluttered together (which is stated by spec) while the code incorrectly checks that the "die offsets" in `.debug_info` pointed to by `.debug_names` "pool entries" are sorted (which definitely has no guarantee). >From the existing API it is not that simple to express the intention I want to >express, and the performance testing shows this check does not affect >wall-time (at least in our cases) so I will remove this check in this >iteration but add a TODO to look into in future. For splitting PRs, that makes sense. This PR just shares big picture and gathers feedback so that I can refactor more effectively. https://github.com/llvm/llvm-project/pull/108907 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits