[PDB] Split TypeServerSource and extend type index map lifetime
authorReid Kleckner <rnk@google.com>
Thu, 4 Jun 2020 01:08:55 +0000 (18:08 -0700)
committerReid Kleckner <rnk@google.com>
Thu, 17 Sep 2020 18:53:10 +0000 (11:53 -0700)
commit1e5b7e91aa64c267e495cb4bd8351b1840694437
treed2e33ef91c7c2bfa15f874ec92176fed6e769430
parent7d5b10348371644c69041965b9864886e9961ddd
[PDB] Split TypeServerSource and extend type index map lifetime

Extending the lifetime of these type index mappings does increase memory
usage (+2% in my case), but it decouples type merging from symbol
merging. This is a pre-requisite for two changes that I have in mind:
- parallel type merging: speeds up slow type merging
- defered symbol merging: avoid heap allocating (relocating) all symbols

This eliminates CVIndexMap and moves its data into TpiSource. The maps
are also split into a SmallVector and ArrayRef component, so that the
ipiMap can alias the tpiMap for /Z7 object files, and so that both maps
can simply alias the PDB type server maps for /Zi files.

Splitting TypeServerSource establishes that all input types to be merged
can be identified with two 32-bit indices:
- The index of the TpiSource object
- The type index of the record
This is useful, because this information can be stored in a single
64-bit atomic word to enable concurrent hashtable insertion.

One last change is that now all object files with debugChunks get a
TpiSource, even if they have no type info. This avoids some null checks
and special cases.

Differential Revision: https://reviews.llvm.org/D87736
lld/COFF/DebugTypes.cpp
lld/COFF/DebugTypes.h
lld/COFF/InputFiles.cpp
lld/COFF/PDB.cpp
lld/COFF/TypeMerger.h