Skip to main content

Optimizing Java Programs in the Presence of Exceptions

  • Conference paper
  • First Online:
ECOOP 2000 — Object-Oriented Programming (ECOOP 2000)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 1850))

Included in the following conference series:

Abstract

The support for precise exceptions in Java, combined with frequent checks for runtime exceptions, leads to severe limitations on the compiler’s ability to perform program optimizations that involve reordering of instructions. This paper presents a novel framework that allows a compiler to relax these constraints. We first present an algorithm using dynamic analysis, and a variant using static analysis, to identify the subset of program state that need not be preserved if an exception is thrown. This allows many spurious dependence constraints between potentially excepting instructions (PEIs) and writes into variables to be eliminated. Our dynamic algorithm is particularly suitable for dynamically dispatched methods in object-oriented languages, where static analysis may be quite conservative. We then present the first software-only solution that allows dependence constraints among PEIs to be completely ignored while applying program optimizations, with no need to execute any additional instructions if an exception is not thrown. With a preliminary implementation, we show that for many benchmark programs, a large percentage of methods can be optimized (while honoring the precise exception requirement) without any constraints imposed by frequent runtime exceptions. Finally, we show that relaxing these reordering constraints can lead to substantial improvements (up to a factor of 7 on small codes) in the performance of programs.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. A.-R. A.-Tabatabai and T. Gross. Source-level debugging of scalar optimized code. In SIGPLAN’ 96 Conference on Programming Language Design and Implementation, Philadelphia, PA, May 1996.

    Google Scholar 

  2. B. Alpern, C. R. Attanasio, J. J. Barton, M. G. Burke, P. Cheng, J.-D. Choi, A. Cocchi, S. J. Fink, D. Grove, M. Hind, S. F. Hummel, D. Lieber, V. Litvinov, M. F. Mergen, T. Ngo, J. R. Russell, V. Sarkar, M. J. Serrano, J. C. Shepherd, S. E. Smith, V. C. Sreedhar, H. Srinivasan, and J. Whaley. The Jalapeño virtual machine. IBM Systems Journal, 39(1), 2000.

    Google Scholar 

  3. M. Arnold, M. Hsiao, U. Kremer, and B. Ryder. Instruction scheduling in the presence of Java’s runtime exceptions. In 12th International Workshop on Languages and Compilers for Parallel Computing, August 1999.

    Google Scholar 

  4. B. Blanchet. Escape analysis for object oriented languages: Application to Java. In Proceedings of ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages, and Applications, Denver, Colorado, November 1999.

    Google Scholar 

  5. J. Bodga and U. Hölzle. Removing unnecessay synchronization in Java. In Proceedings of ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages, and Applications, Denver, Colorado, November 1999.

    Google Scholar 

  6. M. G. Burke, J.-D. Choi, S. Fink, D. Grove, M. Hind, V. Sarkar, M. J. Serrano, V. C. Sreedhar, H. Srinivasan, and J. Whaley. The Jalapeño dynamic optimizing compiler for Java. In ACM 1999 Java Grande Conference, pages 129–141, June 1999.

    Google Scholar 

  7. C. Chambers, I. Pechtchanski, V. Sarkar, M. J. Serrano, and H. Srinivasan. Dependence analysis for Java. In 12th International Workshop on Languages and Compilers for Parallel Computing, August 1999.

    Google Scholar 

  8. P. Chang, S. Mahlke, W. Chen, N. Warter, and W.-M. Hwu. IMPACT: An architectural framework for multiple-instruction-issue processors. In Proc. 18th International Symposium on Computer Architecture, pages 266–275, 1991.

    Google Scholar 

  9. J.-D. Choi, D. Grove, M. Hind, and V. Sarkar. Efficient and precise modeling of exceptions for the analysis of Java programs. In ACM SIGPLAN-SIGSOFT Workshop on Program Analysis for Software Tools and Engineering, September 1999.

    Google Scholar 

  10. J.-D. Choi, M. Gupta, M. Serrano, V. C. Sreedhar, and S. Midkiff. Escape analysis for Java. In ACM Conference on Object-Oriented Programming Systems, Languages, and Applications, 1999.

    Google Scholar 

  11. M. Cooperman. Debugging optimized code without being misled. ACM Transactions on Programming Languages and Systems, 16(3):387–427, 1994.

    Article  Google Scholar 

  12. D. Dhamdhere and K. Sankaranarayanan. Dynamic currency determination in optimized programs. ACM Transactions on Programming Languages and Systems, 20(6), November 1998.

    Google Scholar 

  13. K. Ebcioglu and E. Altman. DAISY: Dynamic compilation for 100% architectural compatibility. In Proc. 24th International Symposium on Computer Architecture, pages 26–37, June 1997.

    Google Scholar 

  14. J. Gosling, B. Joy, and G. Steele. The Java Language Specification. Addison Wesley, 1996.

    Google Scholar 

  15. J. Hennessy. Program optimization and exception handling. In 8th Annual ACM Symposium on the Principles of Programming Languages, pages 200–206, 1981.

    Google Scholar 

  16. U. Holzle, C. Chambers, and D. Ungar. Debugging optimized code with dynamic deoptimization. In SIGPLAN’ 92 Conference on Programming Language Design and Implementation, San Francisco, CA, June 1992.

    Google Scholar 

  17. Java memory model mailing list. Archive at http://www.cs.umd.edu/~pugh/java/memoryModel/archive/.

  18. B. C. Le. An out-of-order execution technique for runtime binary translators. In Proc. 8th International Conference on Architectural Support for Programming Languages and Operating Systems, pages 151–158, October 1998.

    Google Scholar 

  19. S. Mahlke, W. Chen, R. Bringmann, R. Hank, W.-M. Hwu, B. Rau, and M. Schlansker. Sentinel scheduling: A model for compiler-controlled speculative execution. ACM Transactions on Computer Systems, 11(4):376–408, November 1993.

    Google Scholar 

  20. J. E. Moreira, S. P. Midkiff, and M. Gupta. From flop to megaflops: Java for technical computing. ACM Transactions on Programming Languages and Systems, 1999. (to appear); Also available as IBM Research Report RC 21166.

    Google Scholar 

  21. S. S. Muchnick. Advanced Compiler Design and Implementation. Morgan Kaufmann, 1997.

    Google Scholar 

  22. W. Pugh. Fixing the Java memory model. In ACM 1999 Java Grande Conference, pages 89–98, June 1999.

    Google Scholar 

  23. V. Sarkar. Automatic selection of high-order transformations in the IBM XL Fortran compilers. IBM Journal of Research and Development, 41(3), May 1997.

    Google Scholar 

  24. M.D. Smith, M.S. Lam, and M.A. Horowitz. Boosting beyond static scheduling in a superscalar processor. In Proc. 17th International Symposium on Computer Architecture, pages 344–354, May 1990.

    Google Scholar 

  25. F. Tip, C. Laffra, P. F. Sweeney, and D. Streeter. Practical experience with an application extractor for Java. In ACM Conference on Object-Oriented Programming Systems, Languages, and Applications, November 1999.

    Google Scholar 

  26. M. E. Wolf and M. S. Lam. A loop transformation theory and an algorithm to maximize parallelism. IEEE Transactions on Parallel and Distributed Systems, 2(4):452–471, October 1991.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2000 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Gupta, M., Choi, JD., Hind, M. (2000). Optimizing Java Programs in the Presence of Exceptions. In: Bertino, E. (eds) ECOOP 2000 — Object-Oriented Programming. ECOOP 2000. Lecture Notes in Computer Science, vol 1850. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-45102-1_21

Download citation

  • DOI: https://doi.org/10.1007/3-540-45102-1_21

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-67660-7

  • Online ISBN: 978-3-540-45102-0

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics