[Soot-list] How to optimize final static methods?

Eric Bodden eric.bodden at ec-spride.de
Tue Feb 21 03:53:55 EST 2012


Hi Robert.

The static inlines is a whole-program analysis (and generally needs to
be), so the -w flag needs to be enabled:
http://www.sable.mcgill.ca/soot/tutorial/phase/phase.html#SECTION000102000000000000000

This, in turn, will cause Soot to load and process large parts of the
JDK. Soot has to do this to be sound.

Having said that, you can force Soot to not load the JDK if you know
what you are doing:
http://www.bodden.de/2010/06/04/soot-no-jdk/

Cheers,
Eric

On 20 February 2012 18:49, Robert Baruch <robert.c.baruch at gmail.com> wrote:
> Hi all,
>
> I'm sure this has been asked before, but I can't seem to find anything about
> it. I'm using Soot 2.5.0 and Java 6 on OSX.
>
> I have a simple test program:
>
> public class TestOpt
> {
> private static final long ubtol(byte b) { return ((long)b)&0xFF; }
>
> public static void main(String[] args)
> {
> byte b = Byte.parseByte(args[0]);
> long l = ubtol(b);
> System.out.println("Long is " + Long.toHexString(l));
> }
>
>
> }
>
> I'd like to optimize the ubtol() call by inlining it. My invocation of Soot
> is as follows:
>
> java -jar soot-2.5.0.jar -cp . -pp -O -v TestOp
>
> That certainly doesn't do it, since looking at the decompiled code shows an
> invokestatic to ubtol().
>
> However, invoking using the -W or -app or -w options seems to load lots and
> lots of the Java runtime classes, processing them. This takes a long, long
> time, and after fifteen minutes I just aborted the program.
>
> So is there any way to run Soot to optimize static finals into inline calls
> without having to wait and wait and wait?
>
> Thanks,
>
> --Rob
>
>
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
>



-- 
Eric Bodden, Ph.D., http://bodden.de/
Head of Secure Software Engineering Group at EC SPRIDE
Principal Investigator in Secure Services at CASED
Tel: +49 6151 16-75422    Fax: +49 6151 16-72051
Room 3.2.14, Mornewegstr. 30, 64293 Darmstadt


More information about the Soot-list mailing list