Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[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
- Loading branch information
Showing
1 changed file
with
92 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters