<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jan 27, 2015 at 2:08 PM, Frederic Riss <span dir="ltr"><<a href="mailto:friss@apple.com" target="_blank">friss@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This update removes the limitation to a fixed maximum number of<br>
attributes per DIE. The patch is very similar to the first one that<br>
I sent for discussion. It only adds a pointer to a vector of DIEs<br>
as arguement to DIE::addValue(). If a DIE overflows its inline storage<br>
for attributes, it is added to the vector. The vector is then iterated<br>
just before the BumpPtrAllocator is destroyed to call the destructors<br>
of all these DIEs.<br>
<br>
This approach gives the most flexibilty as it doesn't impose the<br>
memory management upon the user (for example DIEHashTest.cpp continues<br>
to use stack allocated DIEs and it works fine).<br>
<br>
I've been playing with this for the last few days, and I have quite<br>
a few different implementations lying around (for example using<br>
std::vectors with a custom stateful allocator). They are all more<br>
complicated and don't perform as well as this patch.<br>
<br>
There's one point that I'd like to mention: the patch unifies the<br>
existing bookkeeping of the DIEBlock and DIELoc objects and treats<br>
them the same as standard DIEs. This means that we will call ~DIE<br>
on DIEBlock and DIELoc objects which will result in a 'partial'<br>
destruction (DIEBlock inherits both from DIEValue and from DIE).<br>
I think this is fine. It should do exactly what we want and just<br>
call the destructors of the SmallVectors in the DIE part of the<br>
object, but I wanted to mention it in case someone thinks its not<br>
legal to do that.<br></blockquote><div><br>Pretty sure that's not valid C++ (not sure quite which cracks the bump allocator objects fall in general in terms of not running dtors, reusing memory, etc - and whether this would be worse than that or not, though).<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5"><br>
<br>
<a href="http://reviews.llvm.org/D7072" target="_blank">http://reviews.llvm.org/D7072</a><br>
<br>
Files:<br>
  include/llvm/CodeGen/DIE.h<br>
  lib/CodeGen/AsmPrinter/DIE.cpp<br>
  lib/CodeGen/AsmPrinter/DIEHash.cpp<br>
  lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp<br>
  lib/CodeGen/AsmPrinter/DwarfCompileUnit.h<br>
  lib/CodeGen/AsmPrinter/DwarfDebug.cpp<br>
  lib/CodeGen/AsmPrinter/DwarfFile.cpp<br>
  lib/CodeGen/AsmPrinter/DwarfUnit.cpp<br>
  lib/CodeGen/AsmPrinter/DwarfUnit.h<br>
  unittests/CodeGen/DIEHashTest.cpp<br>
<br>
EMAIL PREFERENCES<br>
  <a href="http://reviews.llvm.org/settings/panel/emailpreferences/" target="_blank">http://reviews.llvm.org/settings/panel/emailpreferences/</a><br>
</div></div></blockquote></div><br></div></div>