Go to file
Chandler Carruth 64c17c7d67 [opt] Devirtualize the SymbolBody type hierarchy and start compacting
its members into the base class.

First, to help motivate this kind of change, understand that in
a self-link, LLD creates 5.5 million defined regular symbol bodies (and
6 million symbol bodies total). A significant portion of its time is
spent allocating the memory for these symbols, and befor ethis patch
the defined regular symbol body objects alone consumed some 420mb of
memory during the self link.

As a consequence, I think it is worth expending considerable effort to
make these objects as memory efficient as possible. This is the first of
several components of that. This change starts with the goal of removing
the virtual functins from SymbolBody so that it can avoid having a vptr
embedded in it when it already contains a "kind" member, and that member
can be much more compact than a vptr.

The primary way of doing this is to sink as much of the logic that we
would have to dispatch for into data in the base class. As part of this,
I made the various flags bits that will pack into a bitfield with the
kind tag. I also sank the Name down to eliminate the dispatch for that,
and used LLVM's RTTI-style dispatch for everything else (most of which
is cold and so doesn't matter terribly if we get minutely worse lowering
than a vtable dispatch).

As I was doing this, I wanted to make the RTTI-dispatch (which would
become much hotter than before) as efficient as possible, so I've
re-organized the tags somewhat. Notably, the common case (regular
defined symbols) is now zero which we can test for faster.

I also needed to rewrite the comparison routine used during resolving
symbols. This proved to be quite complex as the semantics of the
existing one were very subtle due to the back-and-forth virtual dispatch
caused by re-dispatching with reversed operands. I've consolidated it to
a single function and tried to comment it quite a bit more to help
explain what is going on. However, this may need more comments or other
explanations. It at least passes all the regression tests. I'm not
working on Windows, so I can't fully test it.

With all of these changes, the size of a DefinedRegular symbol on
a 64-bit build goes from 80 bytes to 64 bytes, and we save approximately
84mb or 20% of the memory consumed by these symbol bodies during the
link.

The link time appears marginally faster as well, and the profile hotness
of the memory allocation subsystem got a bit better, but there is still
a lot of allocation traffic.

Differential Revision: http://reviews.llvm.org/D10792

llvm-svn: 241001
2015-06-29 21:35:48 +00:00
clang Add support for the x86 builtin __builtin_cpu_supports. 2015-06-29 21:00:05 +00:00
clang-tools-extra [clang-tidy] Fix false positives in the macro parentheses checker 2015-06-29 12:18:11 +00:00
compiler-rt [asan] Fix SanitizerCommon.PthreadDestructorIterations test on Android L. 2015-06-29 20:28:55 +00:00
debuginfo-tests
libclc Properly initialize Module pointer 2015-06-27 12:35:54 +00:00
libcxx Make support for thread-unsafe C functions optional. 2015-06-24 08:44:38 +00:00
libcxxabi fallback_malloc: silence conversion warning (NFC) 2015-06-03 17:25:35 +00:00
libunwind Fix unw_getcontext() return value on AArch64. 2015-06-25 15:12:46 +00:00
lld [opt] Devirtualize the SymbolBody type hierarchy and start compacting 2015-06-29 21:35:48 +00:00
lldb Make sure that SharingPtr.h appears in the LLDB.framework by making it a public header in the LLDB framework target. 2015-06-29 20:42:28 +00:00
llgo [llgo] cmd/llgoi: use line editor 2015-05-23 15:16:09 +00:00
llvm [LoopSimplify] Set proper debug location in loop backedge blocks. 2015-06-29 21:30:14 +00:00
openmp Remove _KMP_BUILD_TIME macro from kmp_version.c 2015-06-29 19:22:12 +00:00
polly [Polly] Add -std=c99 flag only to C source files 2015-06-29 19:57:59 +00:00