[PATCH] Allocate MCSymbol Name intrusively only when required

David Blaikie dblaikie at gmail.com
Mon Jun 8 13:11:27 PDT 2015


On Mon, Jun 8, 2015 at 12:19 PM, Pete Cooper <peter_cooper at apple.com> wrote:

> Hi all
>
> Recent work by Rafael and Duncan has greatly reduced the number of
> MCSymbol’s which are actually named.  In particular, temporary symbols
> typically don’t need names.  On the verify_uselist_order test case for
> example, only around 50,000 symbols have names out of 700,000 total symbols.
>
> This patch moves the storage for the Name* itself to be allocated prior to
> the MCSymbol.


Any particular reason it goes before rather than after? (I know some of our
data structures put things after)

There's no need to reinterpret_cast to MCSymbol when you just want a void*
in operator new.

The alignment of the allocation might be interesting - given that it needs
to be aligned as much as a pointer, not just MCSymbol (I assume MCSymbol is
at least as aligned as a pointer right now, so you probably get this for
free/correct without explicitly accounting for it)

The extra indirection hidden behind NameTy is a bit confusing (especially
since you have pointers to it - so it's pointers on pointers).


> This is similar to how User allocates Use’s in a custom new/delete.
>
> Given that a symbol is currently 48 bytes on MachO, this reduces it by 16%
> on the typical case.  I have other patches coming which will get us to
> 24-bytes which is on average half the current amount.
>
> Cheers,
> Pete
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150608/319bdeac/attachment.html>


More information about the llvm-commits mailing list