[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cfe-dev
Subject:    Re: [cfe-dev] Proposal: A "Const tool" for clang
From:       Manuel Klimek <klimek () google ! com>
Date:       2013-02-05 9:18:23
Message-ID: CAOsfVvm7YqbGsfFXtKomP+whpXVUV0GPcetEWKzj=EZ9jbww_A () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


On Tue, Feb 5, 2013 at 8:06 AM, Sean Silva <silvas@purdue.edu> wrote:

> > Batch
> > [...]
> > Repeat this process as long as progress ensues.
> 
> Have you done a ballpark estimate of how much resident memory this
> would need for, say LLVM's codebase? Are you planning to do this
> entirely in-core? If not, then how are you planning to make this
> scale?
> 
> > Interactive
> > 
> > Pick as specific function parameter or method and make it const.
> > This would involve checking all of the routines that it calls with that
> parameter, and making changes to fix their interfaces (if necessary).
> 
> This seems pretty ambitious. AFAIK nobody has even written a robust
> and useful tool based on Clang that coherently lets you pick a
> function and see all the call sites in a codebase (otherwise I would
> be using it!). I would recommend starting with just that aspect. My
> 

That is not entirely true. There might not be an open sourced tool, but
there are publicly available ones.
This is an example from Chromium's code search:
https://code.google.com/p/chromium/codesearch#chrome/src/base/memory/ref_counted.h&q=class:scoped_refptr&sq=package:chrome&type=cs&l=254
 You can click for example on the operator T*() const and get a list where
this is called throughout the Chromium codebase.

Generally, we've also internally done transformations that are very similar
in scale and complexity on our internal ~100MLOC codebase. You can make
such things scale by doing MapReduce like algorithms, which first map all
possible function calls / parameters as keys with locations, and then
basically reduce the graph of const-dependencies. Since I've implemented
MapReduce style algorithms with standard unix tools (sort, cat) this also
works for smaller problems if you don't have large infrastructure at hand.

Cheers,
/Manuel

impression is that the new Modules functionality that dgregor is
> working on will go a long way to making this easier, so pragmatically
> your time might be best spent helping to move that feature along.
> 
> -- Sean Silva
> _______________________________________________
> cfe-dev mailing list
> cfe-dev@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
> 


[Attachment #5 (text/html)]

<div dir="ltr">On Tue, Feb 5, 2013 at 8:06 AM, Sean Silva <span dir="ltr">&lt;<a \
href="mailto:silvas@purdue.edu" target="_blank">silvas@purdue.edu</a>&gt;</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">&gt; \
Batch<br> &gt; [...]<br>
&gt; Repeat this process as long as progress ensues.<br>
<br>
Have you done a ballpark estimate of how much resident memory this<br>
would need for, say LLVM&#39;s codebase? Are you planning to do this<br>
entirely in-core? If not, then how are you planning to make this<br>
scale?<br>
<br>
&gt; Interactive<br>
&gt;<br>
&gt; Pick as specific function parameter or method and make it const.<br>
&gt; This would involve checking all of the routines that it calls with that \
parameter, and making changes to fix their interfaces (if necessary).<br> <br>
This seems pretty ambitious. AFAIK nobody has even written a robust<br>
and useful tool based on Clang that coherently lets you pick a<br>
function and see all the call sites in a codebase (otherwise I would<br>
be using it!). I would recommend starting with just that aspect. \
My<br></blockquote><div><br></div><div style>That is not entirely true. There might \
not be an open sourced tool, but there are publicly available ones.</div> <div \
style>This is an example from Chromium&#39;s code search:</div><div style><a \
href="https://code.google.com/p/chromium/codesearch#chrome/src/base/memory/ref_counted \
.h&amp;q=class:scoped_refptr&amp;sq=package:chrome&amp;type=cs&amp;l=254">https://code \
.google.com/p/chromium/codesearch#chrome/src/base/memory/ref_counted.h&amp;q=class:scoped_refptr&amp;sq=package:chrome&amp;type=cs&amp;l=254</a><br>
 </div><div style>You can click for example on the operator T*() const and get a list \
where this is called throughout the Chromium codebase.</div><div style><br></div><div \
style>Generally, we&#39;ve also internally done transformations that are very similar \
in scale and complexity on our internal ~100MLOC codebase. You can make such things \
scale by doing MapReduce like algorithms, which first map all possible function calls \
/ parameters as keys with locations, and then basically reduce the graph of \
const-dependencies. Since I&#39;ve implemented MapReduce style algorithms with \
standard unix tools (sort, cat) this also works for smaller problems if you don&#39;t \
have large infrastructure at hand.</div> <div style><br></div><div \
style>Cheers,</div><div style>/Manuel</div><div style><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">


impression is that the new Modules functionality that dgregor is<br>
working on will go a long way to making this easier, so pragmatically<br>
your time might be best spent helping to move that feature along.<br>
<span class=""><font color="#888888"><br>
-- Sean Silva<br>
</font></span><div class=""><div \
class="h5">_______________________________________________<br> cfe-dev mailing \
list<br> <a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" \
target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br> \
</div></div></blockquote></div><br></div></div>



_______________________________________________
cfe-dev mailing list
cfe-dev@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic