[all-commits] [llvm/llvm-project] 95a8e8: [dsymutil] Remove recursion from lookForChildDIEsT...

Jonas Devlieghere via All-commits all-commits at lists.llvm.org
Wed Dec 4 10:20:58 PST 2019


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: 95a8e8a2557e487be6133475966255661a9f6567
      https://github.com/llvm/llvm-project/commit/95a8e8a2557e487be6133475966255661a9f6567
  Author: Jonas Devlieghere <jonas at devlieghere.com>
  Date:   2019-12-04 (Wed, 04 Dec 2019)

  Changed paths:
    M llvm/tools/dsymutil/DwarfLinker.cpp
    M llvm/tools/dsymutil/DwarfLinker.h

  Log Message:
  -----------
  [dsymutil] Remove recursion from lookForChildDIEsToKeep (1/2) (NFC)

The functions lookForDIEsToKeep and keepDIEAndDependencies are mutually
recursive and can cause a stackoverflow for large projects. While this
has always been the case, it became a bigger issue when we parallelized
dsymutil, because threads get only a fraction of the stack space.

In an attempt to tackle this issue, we removed part of the recursion in
r338536 by introducing a worklist. Processing of child DIEs was no
longer recursive. However, we still received bug reports where we'd run
out of stack space.

This patch removes another recursive call from lookForDIEsToKeep. The
call was used to look at DIEs that reference the current DIE. To make
this possible, we inlined keepDIEAndDependencies and added this work to
the existing worklist. Because the function is not tail recursive, we
needed to add two more types of worklist entries to perform the
subsequent work.

This was tested by running dsymutil on clang built in debug (both with
and without modules) and comparing the MD5 hash of the generated dSYM
companion file.

Differential revision: https://reviews.llvm.org/D70990


  Commit: 9b15873c92832b06f41be1e1047ea5033411ee0f
      https://github.com/llvm/llvm-project/commit/9b15873c92832b06f41be1e1047ea5033411ee0f
  Author: Jonas Devlieghere <jonas at devlieghere.com>
  Date:   2019-12-04 (Wed, 04 Dec 2019)

  Changed paths:
    M llvm/tools/dsymutil/DwarfLinker.cpp

  Log Message:
  -----------
  [dsymutil] Remove recursion from lookForChildDIEsToKeep (2/2) (NFC)

The functions lookForDIEsToKeep and keepDIEAndDependencies are mutually
recursive and can cause a stackoverflow for large projects. While this
has always been the case, it became a bigger issue when we parallelized
dsymutil, because threads get only a fraction of the stack space.

This patch removes the final recursive call from lookForDIEsToKeep. The
call was used to look at the current DIE's parent chain and mark
everything as kept.

This was tested by running dsymutil on clang built in debug (both with
and without modules) and comparing the MD5 hash of the generated dSYM
companion file.

Differential revision: https://reviews.llvm.org/D70994


Compare: https://github.com/llvm/llvm-project/compare/e18531595bba...9b15873c9283


More information about the All-commits mailing list