Loop Transformations in the Ahead-of-Time Optimization of Java Bytecode

  • Simon Hammond
  • David Lacey
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3923)


Loop optimizations such as loop unrolling, unfolding and invariant code motion have long been used in a wide variety of compilers to improve the running time of applications. In this paper we present a series of experimental results detailing the effect these techniques have on the running time of Java applications following ahead of time optimization.

We also detail the optimization tools and transformations developed for this paper which extend the SOOT framework discussed in a number of previous papers on the subject.

Our experimentation, conducted on the SciMark 2.0 benchmarking suite, demonstrates that when optimized using the techniques mentioned, Java applications can benefit from performance improvements of up to 20%.

We finish with a discussion of the results obtained, including results on how the optimizations affect JIT compilation and class size and proceed to argue that ahead-of-time loop unrolling and unfolding optimization may have a role to play in improving the performance of Java applications, particularly in scientific applications.


Virtual Machine Cache Line Code Size Java Virtual Machine Java Application 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


  1. 1.
    Appel, A.W.: Modern Compiler Implementation in Java. Cambridge Press, New York (2002)Google Scholar
  2. 2.
    Bacon, D.F., Graham Susan, L., Sharp, O.J.: Compiler Transformations for High-Performance Computing. ACM Computing Surveys 26(4), 345–420 (1994)CrossRefGoogle Scholar
  3. 3.
    SPEC JVM 1998 Client Benchmarks. World Wide Web, http://www.spec.org/osg/jvm98/
  4. 4.
    Bull, J.M., Smith, L.A., Pottage, L., Freeman, R.: Benchmarking java against c and fortran for scientific applications. In: Proceedings of the 2001 joint ACM-ISCOPE conference on Java Grande, pp. 97–105. ACM Press, New York (2001)CrossRefGoogle Scholar
  5. 5.
    Cierniak, M., Li, W.: Just in time optimizations for high performance java programs. Concurrency: Practice and Experience (1997)Google Scholar
  6. 6.
    Clausen, L.R.: A java bytecode optimizer using side effect analysis. Concurrency: Practice and Experience (1997)Google Scholar
  7. 7.
    Cohen, G.A., Chase, J.S., Kaminsky, D.L.: Automatic program transformation with joie. In: Proceedings of the USENIX 1998 Annual Technical Conference, pp. 167–178. USENIX Association (1998)Google Scholar
  8. 8.
    Davidson, J.W., Jinturkar, S.: An agressive approach to loop unrolling. Technical report, University of Virginia (2001)Google Scholar
  9. 9.
    Dean, J., De Fouw, G., Grove, D., Litvino, V., Chambers, C.: Vortex: An optimizing compiler for object-oriented languages. In: Proceedings OOPSLA 1996 Conference on Object-Oriented Programming Systems, Languages and Applications, vol. 31, pp. 83–100. ACM Sigplan (1996)Google Scholar
  10. 10.
    Dongarra, J.J., Hinds, A.R.: Unrolling loops in fortran. Software Practice and Experience 9(3), 219–226 (1979)CrossRefMATHGoogle Scholar
  11. 11.
    Ellis, J.R.: Bulldog: A Compiler for VLIW Architectures. MIT Press, Cambridge (1987)Google Scholar
  12. 12.
    Fitzgerald, R., Knoblock, T.B., Ruf, E., Steensgaard, B., Tarditi, D.: Marmot: an optimizing compiler for java. Technical report, Microsoft Research (1998)Google Scholar
  13. 13.
    Grune, D., Bal, H., Jacobs, C., Langendoen, K.: Modern Compiler Design. John Wiley and Sons, Chichester (2000)Google Scholar
  14. 14.
    Le, A., Lhoták, O., Hendren, L.: Using inter-procedural side-effect information in JIT optimizations. In: Bodik, R. (ed.) CC 2005. LNCS, vol. 3443, pp. 287–304. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  15. 15.
    Lee, H.B., Zorn, B.G.: A tool for instrumenting java bytecodes. In: The USENIX Symposium on Internet Technologies and Systems, pp. 73–82 (1997)Google Scholar
  16. 16.
    Muchnick, S.S.: Advanced Compiler Design and Implementation, pp. 559–563. Morgan Kaufmann, San Francisco (1997)Google Scholar
  17. 17.
    Mohan Krishna Reddy, B.V.: A work bench for loop transformation. Master’s thesis, Indian Institute of Technology, Kanpur (May 2001)Google Scholar
  18. 18.
    Song, L., Kavi, K.: What can we gain by Unfolding Loops? SIGPLAN Not. 39(2), 26–33 (2004)CrossRefGoogle Scholar
  19. 19.
    SciMark 2.0 Benchmarking Suite. World Wide Web, http://math.nist.gov/scimark2/
  20. 20.
    Tip, F., Laffra, C., Sweeney, P.F., Streeter, D.: Practical experience with an application extractor for java. Technical Report RC 21451, IBM Research (1999)Google Scholar
  21. 21.
    Vallee-Rai, R., Phong, C., Etienne, G., Laurie, H., Patrick, L., Vijay, S.: Soot - a Java bytecode optimization framework (1999)Google Scholar
  22. 22.
    Vallee-Rai, R., Gagnon, E., Hendren, L.J., Lam, P., Pominville, P., Sundaresan, V.: Optimizing Java Bytecode Using the Soot Framework: Is It Feasible? In: Computational Complexity, pp. 18–34 (2000)Google Scholar
  23. 23.
    Vallee-Rai, R., Hendren, L.J.: Jimple: Simplifying Java Bytecode for Analyses and TransformationsGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  • Simon Hammond
    • 1
  • David Lacey
    • 1
  1. 1.University of WarwickUK

Personalised recommendations