[PATCH] D102674: Avoid calculating the string hash twice in GsymCreator::insertString.

Simon Giesecke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 18 02:00:09 PDT 2021


simon.giesecke created this revision.
Herald added a subscriber: hiraditya.
simon.giesecke requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Do the single hash calculation before acquiring the lock, to reduce
lock contention. If Copy is true, and the string was not yet contained
in the StringStorage, use the new address from StringStorage, but
reuse the hash we already calculated.

Move FunctionInfo in addFunctionInfo rather than copying.

Use a non-recursive mutex in GsymCreator.

There doesn't seem to be a need to support recursive locking,
and a recursive mutex is unnecessarily inefficient.

Avoid underestimating the number of DIEs for a given debug info size.

Calculate indexes of last child of each DWARF entry once during tryExtractDIEsIfNeeded.

This ensures that the last child indexes are calculated in linear time and
can later be queried in constant time by getLastChild.

The baseline situation was that individual calls to getLastChild were linear in the
size of DieArray. Calling getLastChild once for every DWARFDebugInfoEntry was
amortized quadratic in the size of DieArray.

Reformat DWARFUnit.cpp


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D102674

Files:
  llvm/include/llvm/DebugInfo/DWARF/DWARFUnit.h
  llvm/include/llvm/DebugInfo/GSYM/GsymCreator.h
  llvm/lib/DebugInfo/DWARF/DWARFUnit.cpp
  llvm/lib/DebugInfo/GSYM/GsymCreator.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102674.346076.patch
Type: text/x-patch
Size: 17134 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210518/c208bf5f/attachment.bin>


More information about the llvm-commits mailing list