Fix a regression in DWARF access speed caused by svn revision 356190
authorGreg Clayton <clayborg@gmail.com>
Thu, 30 May 2019 15:32:33 +0000 (15:32 +0000)
committerGreg Clayton <clayborg@gmail.com>
Thu, 30 May 2019 15:32:33 +0000 (15:32 +0000)
commite6ddde57e27e03054fd0a7cd627ce7917559a690
tree59501137a3548ca7f8b4fa7171f3f2bafa977a0c
parent913604a637d59a44ce81601a024034b4b0221ec6
Fix a regression in DWARF access speed caused by svn revision 356190

The issue was caused by the error checking code that was added. It was incorrectly adding an extra abbreviation when DWARFEnumState::Complete was received since it would push an extra abbreviation onto the list with the abbreviation code of zero. This cause m_idx_offset in each DWARFAbbreviationDeclarationSet to be set to UINT32_MAX. This valid indicates we must linearly search for attributes, not access them in O(1) time. This caused every DWARFDebugInfoEntry that would try to get its DWARFAbbreviationDeclaration from the CU's DWARFAbbreviationDeclarationSet to always linearly search the abbreviation set for a given abbreviation code. Easy to see why this would cause things to be slow.

This regression was caused by: https://reviews.llvm.org/D59370. I asked to ensure there was no regression is parsing or access speed, but that must not have been done. In my test with 40 DWARF files trying to set a breakpoint by function name and in a header file, I see a 8% speed improvement with this fix.

There was no regression in correctness, just very inefficient access.

Added full unit testing for DWARFAbbreviationDeclarationSet parsing to ensure this doesn't regress.

Differential Revision: https://reviews.llvm.org/D62630

llvm-svn: 362105
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.h
lldb/unittests/SymbolFile/DWARF/SymbolFileDWARFTests.cpp