[PATCH] D116143: [ELF] Change some global pointers to unique_ptr
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 21 22:57:10 PST 2021
MaskRay created this revision.
MaskRay added reviewers: ikudrin, lichray.
Herald added subscribers: pengfei, arichardson, emaste.
MaskRay requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Currently the singleton `config` is assigned by `config = make<Configuration>()`
and (if `canExitEarly` is false) destroyed by `lld::freeArena`.
`make<Configuration>` allocates a stab with `malloc(4096)`. This both wastes
memory and bloats the executable (every type instantiates `BumpPtrAllocator`
which costs more than 1KiB code on x86-64).
(No need to worry about `clang::no_destroy`. Regular invocations (`canExitEarly`
is true) call `_exit`.)
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D116143
Files:
lld/ELF/Config.h
lld/ELF/Driver.cpp
lld/ELF/Driver.h
lld/ELF/LinkerScript.cpp
lld/ELF/LinkerScript.h
lld/ELF/SymbolTable.cpp
lld/ELF/SymbolTable.h
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116143.395797.patch
Type: text/x-patch
Size: 3445 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211222/71b6326f/attachment.bin>
More information about the llvm-commits
mailing list