[COFF] Reduce the size of Chunk and SectionChunk, NFC
authorReid Kleckner <rnk@google.com>
Tue, 2 Apr 2019 22:11:58 +0000 (22:11 +0000)
committerReid Kleckner <rnk@google.com>
Tue, 2 Apr 2019 22:11:58 +0000 (22:11 +0000)
commitcc525c97b7df198095124ee1fb68219e5a9189a5
tree0f3d1162b6f3a17b815b859447cd078bfa5d8f94
parent1b5310c2df3f39ca96dc3f1d9239d151a7204cd0
[COFF] Reduce the size of Chunk and SectionChunk, NFC

Summary:
Reorder the fields in both to use padding more efficiently, and add more
comments on the purpose of the fields.

Replace `std::vector<SectionChunk*> AssociativeChildren` with a
singly-linked list. This avoids the separate vector allocation to list
associative children, and shrinks the 3 pointers used for the typically
empty vector down to 1.

In the end, this reduces the sum of heap allocations used to link
browser_tests.exe with NO PDB by 13.10%, going from 2,248,728 KB to
1,954,071 KB of heap. These numbers exclude memory mapped files, which
are of course a significant factor in LLD's memory usage.

Reviewers: ruiu, mstorsjo, aganea

Subscribers: jdoerfert, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D59797

llvm-svn: 357535
lld/COFF/Chunks.cpp
lld/COFF/Chunks.h
lld/COFF/ICF.cpp
lld/COFF/MarkLive.cpp
llvm/include/llvm/BinaryFormat/COFF.h