OSDN Git Service

[dsymutil] Convert recursion in lookForDIEsToKeep into worklist.
authorJonas Devlieghere <jonas@devlieghere.com>
Wed, 1 Aug 2018 13:24:39 +0000 (13:24 +0000)
committerJonas Devlieghere <jonas@devlieghere.com>
Wed, 1 Aug 2018 13:24:39 +0000 (13:24 +0000)
commit3289ee65825ba5ec6aaf02c75360360ac643182e
treefb990b90dbc86aff43fe9456d06519e5874849d2
parentc690a0177e3aa4bdffb945a18c209c6cf0d4340d
[dsymutil] Convert recursion in lookForDIEsToKeep into worklist.

The functions `lookForDIEsToKeep` and `keepDIEAndDependencies` can have
some very deep recursion. This tackles part of this problem by removing
the recursion from `lookForDIEsToKeep` by turning it into a worklist.

The difficulty in doing so is the computation of incompleteness, which
depends on the incompleteness of its children. To compute this, we
insert "continuation markers" into the worklist. This informs the work
loop to (re)compute the incompleteness property of the DIE associated
with it (i.e. the parent of the previously processed DIE).

This patch should generate byte-identical output. Unfortunately it also
has some impact of performance, regressing by about 4% when processing
clang on my machine.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@338536 91177308-0d34-0410-b5e6-96231b3b80d8
tools/dsymutil/DwarfLinker.cpp
tools/dsymutil/DwarfLinker.h