<div dir="ltr">On Thu, Aug 29, 2013 at 3:49 PM, Kristof Beyls <span dir="ltr"><<a href="mailto:kristof.beyls@arm.com" target="_blank" class="cremed">kristof.beyls@arm.com</a>></span> wrote:<br><div class="gmail_extra">
<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi Samuel,<br>
<br>
We've observed that in the past few days, debug-builds with Visual Studio<br>
have started failing again because too many sections are generated for<br>
ASTMatchers/Dynamic/Registry.cpp.<br>
<br>
This has been observed and discussed before in this email thread:<br>
<a href="http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-June/030102.html" target="_blank" class="cremed">http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-June/030102.html</a>.<br>
<br>
It seems that since then, bit by bit, the number of sections for<br>
Registry.cpp<br>
has been creeping up. I've done a quick experiment on linux to measure how<br>
the size and the number of sections in Registry.cpp.o has been increasing<br>
over<br>
time. The table does show that your fix in r183768 did reduce the number of<br>
sections a lot; but since then, the number of sections has been increasing<br>
steadily and quite rapidly.<br>
<br>
Size of Register.cpp.o<br>
svn id bytes sections<br>
189448 27122264 28108<br>
189353 27204656 28259<br>
189031 26473624 27284<br>
187500 26451288 26952<br>
186000 21940824 23119<br>
183769 19289872 20544<br>
183768 33647984 35738<br>
<br>
You did say on the previous email thread that you had a few more ideas on<br>
how<br>
to reduce the number of sections in Register.cpp.o. I'm wondering if you<br>
would<br>
be able to share the ideas you've got?<br></blockquote><div><br></div><div>The problem is that there are a lot of AST nodes, and each node is getting a whole bunch of classes instantiated, many of them with virtual methods.</div>
<div>For example, there are around 200 symbols related to clang::WhileStmt. It instantiates TrueMatcher<clang::WhileStmt>, DynCastMatcher<clang::Stmt, , lang::WhileStmt>, BindableMatcher<clang::WhileStmt>, MatcherInterface<clang::WhileStmt>, SingleNodeMatcherInterface<clang::WhileStmt>, VariadicOperatorMatcherInterface<clang::WhileStmt>, Matcher<clang::WhileStmt>::WrappedMatcher, Matcher<clang::WhileStmt>, IdMatcher<clang::WhileStmt>.</div>
<div>All of these have virtual methods, which means that there are 2 symbols per constructor, 3 for the destructor and 1 for the vtable. This is without counting the actual methods in the class.</div><div>We then do more method/class instantiations for the dynamic binding.</div>
<div><br></div><div>The main fix I wanted to try is to reduce the number of classes that get instantiated. On the previous fix I removed vector<T> and list<T> for each AST node. I just replaced those uses with plain arrays.</div>
<div>I will do another round of fixes. Do you have a target size/sections ?</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
At the moment, it seems clang cannot be build with visual studio in debug<br>
mode; and the large file size of Register.cpp.o and the large number of<br>
sections seems to be slowing down the compile process on other platforms<br>
too.<br></blockquote><div><br></div><div>In the worst case we could use plan A, which was splitting Register.cpp into many smaller files. We don't need to have all this code in the same compilation unit. I wanted to avoid doing this because it doesn't help to the total size of the objects and makes the code more complex.</div>
<div><br></div><div>_Sam</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
Thanks,<br>
<br>
Kristof<br>
<br>
<br>
</blockquote></div><br></div></div>