<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""></div><div class=""><div><blockquote type="cite" class=""><div class="">On Jun 8, 2015, at 2:02 PM, Duncan P. N. Exon Smith <<a href="mailto:dexonsmith@apple.com" class="">dexonsmith@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class="Apple-interchange-newline">On 2015 Jun 8, at 13:50, David Blaikie <<a href="mailto:dblaikie@gmail.com" class="">dblaikie@gmail.com</a>> wrote:<br class=""><br class=""><br class=""><br class="">On Mon, Jun 8, 2015 at 1:45 PM, Duncan P. N. Exon Smith <<a href="mailto:dexonsmith@apple.com" class="">dexonsmith@apple.com</a>> wrote:<br class=""><br class=""><blockquote type="cite" class="">On 2015 Jun 8, at 13:16, Pete Cooper <<a href="mailto:peter_cooper@apple.com" class="">peter_cooper@apple.com</a>> wrote:<br class=""><br class=""><br class=""><blockquote type="cite" class="">On Jun 8, 2015, at 1:11 PM, David Blaikie <<a href="mailto:dblaikie@gmail.com" class="">dblaikie@gmail.com</a>> wrote:<br class=""><br class=""><br class=""><br class="">On Mon, Jun 8, 2015 at 12:19 PM, Pete Cooper <<a href="mailto:peter_cooper@apple.com" class="">peter_cooper@apple.com</a>> wrote:<br class="">Hi all<br class=""><br class="">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.<br class=""><br class="">This patch moves the storage for the Name* itself to be allocated prior to the MCSymbol.<br class=""><br class="">Any particular reason it goes before rather than after? (I know some of our data structures put things after)<br class=""></blockquote>There’s a couple of subclasses of MCSymbol - MCSymbolCOFF and MCSymbolELF - so i thought it would be tricker to put it after those.<br class=""><blockquote type="cite" class=""><br class="">There's no need to reinterpret_cast to MCSymbol when you just want a void* in operator new.<br class=""></blockquote>Good catch.  Thanks.  I’ll fix that.<br class=""></blockquote><br class="">FWIW, I've found the opposite in a few places in our code base.<br class="">Sometimes you need to cast to `void *` to disambiguate from other<br class="">versions of `operator new()`.<br class=""><br class="">Not quite sure I follow - In other contexts it may be relevant, but in that particular context (casting T* to U* just to return the U* as void* anyway) it doesn't seem to add anything.<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">Sure, I didn't actually look at the code :).</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""><br class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><br class="">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)<br class=""></blockquote>Thats true.  There are currently pointers in there, but good to be explicit about it.  I’ll fix that too.<br class=""><blockquote type="cite" class=""><br class="">The extra indirection hidden behind NameTy is a bit confusing (especially since you have pointers to it - so it's pointers on pointers).<br class=""></blockquote>Yeah, I see what you mean.  I’ll move the * out of NameTy.<br class=""><br class="">Thanks for the comments.  I’ll send out an updated patch shortly.<br class=""><br class="">Cheers,<br class="">Pete<br class=""><blockquote type="cite" class=""><br class="">This is similar to how User allocates Use’s in a custom new/delete.<br class=""><br class="">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.<br class=""><br class="">Cheers,<br class="">Pete<br class=""><br class=""><br class="">_______________________________________________<br class="">llvm-commits mailing list<br class=""><a href="mailto:llvm-commits@cs.uiuc.edu" class="">llvm-commits@cs.uiuc.edu</a><br class="">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</blockquote></blockquote></blockquote></div></blockquote></div><br class=""></div></body></html>