This is an archive of the discontinued LLVM Phabricator instance.

Consolidate BumpPtrAllocators.
ClosedPublic

Authored by ruiu on Oct 27 2016, 12:20 PM.

Details

Summary

Previously, we have a lot of BumpPtrAllocators, but all these
allocators virtually have the same lifetime because they are
not freed until the linker finishes its job. This patch aggregates
them into a single allocator.

Diff Detail

Repository
rL LLVM

Event Timeline

ruiu updated this revision to Diff 76082.Oct 27 2016, 12:20 PM
ruiu retitled this revision from to Consolidate BumpPtrAllocators..
ruiu updated this object.
ruiu added a reviewer: rafael.
ruiu added a subscriber: llvm-commits.
rafael accepted this revision.Oct 28 2016, 7:24 AM
rafael edited edge metadata.

LGTM with nits. We can also do this as is first and then try to free up some memory earlier.

This has small performance fluctuations, no regression or improvement over 1%.

ELF/Driver.h
65 ↗(On Diff #76082)

This one might make sense to remain. We can free it after option parsing, no?

ELF/DriverUtils.cpp
81 ↗(On Diff #76082)

This too can be freed earlier.

This revision is now accepted and ready to land.Oct 28 2016, 7:24 AM
mehdi_amini added inline comments.Oct 28 2016, 10:40 AM
ELF/Memory.h
31 ↗(On Diff #76082)

Global mutable state never seems like a good idea.

ruiu added inline comments.Oct 28 2016, 10:55 AM
ELF/Memory.h
31 ↗(On Diff #76082)

I disagree. It depends on what you are doing and what your program is.

ruiu added inline comments.Oct 28 2016, 10:57 AM
ELF/Driver.h
65 ↗(On Diff #76082)

No, we can't. Config may have a StringRef referring a command line argument.

ELF/DriverUtils.cpp
81 ↗(On Diff #76082)

Ditto. (And this is not freed until Driver is freed now, too, because Alloc has the same lifetime as Driver and Driver has the same lifetime as the entire linker.)

mehdi_amini added inline comments.Oct 28 2016, 10:58 AM
ELF/Memory.h
31 ↗(On Diff #76082)

I believe that in an ecosystem where we want to be able to evolve and innovate, like the LLVM ecosystem, this prevents code reuse, modularity, and future innovation. This is just unacceptable technical debt.
Again we had this debate about lld, but this is just another opportunity to express another strong disagreement with what's going on in lld.

This revision was automatically updated to reflect the committed changes.