[PATCH] D81296: [PDB] Defer public serialization until PDB writing

Reid "Away June-Sep" Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 5 12:54:57 PDT 2020


rnk created this revision.
rnk added reviewers: aganea, MaskRay, hans.
Herald added subscribers: mgrang, hiraditya.
Herald added a project: LLVM.

This reduces peak memory on my test case from 1960.14MB to 1700.63MB
(-260MB, -13.2%) with no measurable impact on CPU time. I'm currently
working with a publics stream that is about 277MB. Before this change,
we would allocate 277MB of heap memory, serialize publics into them,
hold onto that heap memory, open the PDB, and commit into it.  After
this change, we defer the serialization until commit time.

In the last change I made to public writing, I re-sorted the list of
publics multiple times in place to avoid allocating new temporary data
structures. Deferring serialization until later requires that we don't
reorder the publics. Instead of sorting the publics, I partially
construct the hash table data structures, store a publics index in them,
and then sort the hash table data structures. Later, I replace the index
with the symbol record offset.

This change also addresses a FIXME and moves the list of global and
public records from GSIHashStreamBuilder to GSIStreamBuilder. Now that
publics aren't being serialized, it makes even less sense to store them
as a list of CVSymbol records. The hash table used to deduplicate
globals is moved as well, since that is specific to globals, and not
publics.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81296

Files:
  lld/COFF/PDB.cpp
  llvm/include/llvm/DebugInfo/PDB/Native/GSIStreamBuilder.h
  llvm/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81296.268912.patch
Type: text/x-patch
Size: 23465 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200605/096dd258/attachment.bin>


More information about the llvm-commits mailing list