[Soot-list] How to use soot as an effective command line bytecode optimizer

Chris Pickett chris.pickett at mail.mcgill.ca
Thu May 24 17:40:35 EDT 2007


If you are running the output program on a JVM with a JIT compiler, 
especially one of the commercial ones, then I think you are *probably* 
wasting your time trying to optimize for speed with Soot by modifying 
the bytecode instruction stream.  Optimizing for space may work better.

This might not always be the case, particularly if you perform an 
optimization that is orthogonal to what the JIT does.

More importantly, if you have access to the source of a JIT compiler, 
you can probably do some heavy points-to and side-effect analysis with 
Soot and exploit that information at runtime quite profitably.

Chris

Mark Friedman wrote:
> Thanks for all this.  Perhaps I can get guidance from some folks who 
> have used soot as an optimizer for real applications or benchmarks.  
> Basically, it would be nice, as a first cut, to have sets of generally 
> known to be useful optimizations.  This would be somewhat akin to gcc's 
> optimization flags.  They have flags to control individual optimizations 
> as well as the more general -0, -02 and -03 flags which turn on batches 
> of them.
> 
> -Mark
> 
> On 5/24/07, *mbatch at cs.mcgill.ca <mailto:mbatch at cs.mcgill.ca>* 
> <mbatch at cs.mcgill.ca <mailto:mbatch at cs.mcgill.ca> > wrote:
> 
>      > The first is whether whole-program mode and whole-program
>      > optimization is 'safe', i.e. will whole-program optimizations produce
>      > incorrect code if it turns out that the program loads unknown files
>      > through reflection or other means.
> 
>     As far as I know there should be no issues with reflection when
>     using the
>     optimizations. Obfuscation is another beast altogether, though.
> 
>      > The second issue is some guidance on
>      > which analysis and optimization phases should be used for the most
>      > effective performance optimizations?
> 
>     While some optimizations are generally good, it is hard to clearly state
>     which ones are "worth it" to you and which ones aren't. There are more
>     trade-offs than just space-time.. an optimization may, for example,
>     make
>     80% of your code run 2% faster but the other 20% of the code run 1%
>     slower...
> 
>     This is something you just have to investigate yourself if you're that
>     worried about it.
> 
>      > Finally, it's not clear to me which, if any,
>      > phases are executed by default and which ones must be turned on
>      > explicitly.
> 
>     Turn on verbose output and, bingo: It'll tell you what phases it is
>     running.
> 
>     Cheers,
> 
>     Michael Batchelder
> 
>     _______________________________________________
>     Soot-list mailing list
>     Soot-list at sable.mcgill.ca <mailto:Soot-list at sable.mcgill.ca>
>     http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Soot-list mailing list
> Soot-list at sable.mcgill.ca
> http://mailman.cs.mcgill.ca/mailman/listinfo/soot-list


More information about the Soot-list mailing list