[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Simple inlining question
On Mon, Jul 05, 2004 at 05:12:52PM -0500, Archie Cobbs wrote:
> Hello,
>
> I have a (hopefully) simple question about inlining. I use Soot
> from within an application (not from the command line), and invoke
> the optimzations via this method:
>
> public class MyClass() {
> public static void optimize(JimpleBody body) {
> PackManager.v().getPack("jtp").apply(body);
> PackManager.v().getPack("jop").apply(body);
> }
> }
>
> What I would like to do is add "simple" inlining to the above
> optimizations. That is, I'd like to have Soot look at all call
> sites and inline those whose target is either a static, private,
> or final method (i.e., known target) and is suitable for inlining
> (e.g., fairly short, not INVOKESPECIAL, etc).
>
> It looks like the soot.jimple.toolkits.invoke has all the logic
> for this. I just need to know how to turn it on in the above method.
> Any easy answers appreciated :-)
Soot's inliner is in the phase wjop.si, and its code is in the
StaticInliner class. The code there uses the call graph and various
heuristics to decide what to inline, then uses SiteInliner to actually
do the inlining. Assuming you don't have a call graph, you can either
make up a call graph that will get the StaticInliner to inline the sites
you want, or just use the StaticInliner code as a starting point for
writing your own class to decide what to inline or not. You definitely
shouldn't need to do the inlining itself yourself; that's done in
SiteInliner.
Ondrej
>
> Thanks,
> -Archie
>
> __________________________________________________________________________
> Archie Cobbs * CTO, Awarix * http://www.awarix.com
>