summaryrefslogtreecommitdiffstats
path: root/lld/ELF/InputFiles.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2016-10-27 13:32:32 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2016-10-27 13:32:32 +0000
commita8631e3887698583e5bd0f118921571dd92757b1 (patch)
treef9de4b6b03193622ce9ed2da43e5d11aeb3fe242 /lld/ELF/InputFiles.cpp
parentba5032c9cf876e08eb5d6eac37c34f93ba16e1b3 (diff)
downloadbcm5719-llvm-a8631e3887698583e5bd0f118921571dd92757b1.tar.gz
bcm5719-llvm-a8631e3887698583e5bd0f118921571dd92757b1.zip
Use fewer allocators.
Instead of having 3 section allocators per file, have 3 for all files. This is a substantial performance improvement for some cases. Linking chromium without gc speeds up by 1.065x. This requires using _exit in fatal since we have to avoid destructing an InputSection if fatal is called from the constructor. Thanks to Rui for the suggestion. llvm-svn: 285290
Diffstat (limited to 'lld/ELF/InputFiles.cpp')
-rw-r--r--lld/ELF/InputFiles.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp
index 507090d563d..b0c177fc48c 100644
--- a/lld/ELF/InputFiles.cpp
+++ b/lld/ELF/InputFiles.cpp
@@ -386,7 +386,8 @@ elf::ObjectFile<ELFT>::createInputSection(const Elf_Shdr &Sec) {
// If -r is given, we do not interpret or apply relocation
// but just copy relocation sections to output.
if (Config->Relocatable)
- return new (IAlloc.Allocate()) InputSection<ELFT>(this, &Sec, Name);
+ return new (GAlloc<ELFT>::IAlloc.Allocate())
+ InputSection<ELFT>(this, &Sec, Name);
// Find the relocation target section and associate this
// section with it.
@@ -428,11 +429,14 @@ elf::ObjectFile<ELFT>::createInputSection(const Elf_Shdr &Sec) {
// .eh_frame_hdr section for runtime. So we handle them with a special
// class. For relocatable outputs, they are just passed through.
if (Name == ".eh_frame" && !Config->Relocatable)
- return new (EHAlloc.Allocate()) EhInputSection<ELFT>(this, &Sec, Name);
+ return new (GAlloc<ELFT>::EHAlloc.Allocate())
+ EhInputSection<ELFT>(this, &Sec, Name);
if (shouldMerge(Sec))
- return new (MAlloc.Allocate()) MergeInputSection<ELFT>(this, &Sec, Name);
- return new (IAlloc.Allocate()) InputSection<ELFT>(this, &Sec, Name);
+ return new (GAlloc<ELFT>::MAlloc.Allocate())
+ MergeInputSection<ELFT>(this, &Sec, Name);
+ return new (GAlloc<ELFT>::IAlloc.Allocate())
+ InputSection<ELFT>(this, &Sec, Name);
}
template <class ELFT> void elf::ObjectFile<ELFT>::initializeSymbols() {
OpenPOWER on IntegriCloud