[all-commits] [llvm/llvm-project] 31a3c5: [clang] use string tables for static diagnostic de...
Nathan Froyd via All-commits
all-commits at lists.llvm.org
Thu Sep 24 07:59:07 PDT 2020
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: 31a3c5fb45b78bdaa78d94ffcc9258e839002016
https://github.com/llvm/llvm-project/commit/31a3c5fb45b78bdaa78d94ffcc9258e839002016
Author: Nathan Froyd <froydnj at gmail.com>
Date: 2020-09-24 (Thu, 24 Sep 2020)
Changed paths:
M clang/lib/Basic/DiagnosticIDs.cpp
Log Message:
-----------
[clang] use string tables for static diagnostic descriptions
Using a pointer for the description string in StaticDiagInfoRec causes
several problems:
1. We don't need to use a whole pointer to represent the string;
2. The use of pointers incurs runtime relocations for those pointers;
the relocations take up space on disk and represent runtime overhead;
3. The need to relocate data implies that, on some platforms, the entire
array containing StaticDiagInfoRecs cannot be shared between processes.
This patch changes the storage scheme for the diagnostic descriptions to
avoid these problems. We instead generate (effectively) one large
string and then StaticDiagInfoRec conceptually holds offsets into the
string. We elected to also move the storage of those offsets into a
separate array to further reduce the space required.
On x86-64 Linux, this change removes about 120KB of relocations and
moves about 60KB from the non-shareable .data.rel.ro section to
shareable .rodata. (The array is about 80KB before this, but we
eliminated 4 bytes/entry by using offsets rather than pointers.) We
actually reap this benefit twice, because these tables show up in both
libclang.so and libclang-cpp.so and we get the reduction in both places.
Differential Revision: https://reviews.llvm.org/D81865
More information about the All-commits
mailing list