skip to main content
article
Free Access

EDO: Exception-directed optimization in java

Published:01 January 2006Publication History
Skip Abstract Section

Abstract

Optimizing exception handling is critical for programs that frequently throw exceptions. We observed that there are many such exception-intensive programs written in Java. There are two commonly used exception handling techniques, stack unwinding and stack cutting. Stack unwinding optimizes the normal path by leaving the exception handling path unoptimized, while stack cutting optimizes the exception handling path by adding extra work to the normal path. However, there has been no single exception handling technique to optimize the exception handling path without incurring any overhead to the normal path.We propose a new technique called Exception-Directed Optimization (EDO) that optimizes exception-intensive programs without slowing down exception-minimal programs. It is a feedback-directed dynamic optimization consisting of three steps: exception path profiling, exception path inlining, and throw elimination. Exception path profiling attempts to detect hot exception paths. Exception path inlining embeds every hot exception path into the corresponding catching method. Throw elimination replaces a throw with a branch to the corresponding handler. We implemented EDO in IBM's production Just-in-Time compiler and made several experiments. In summary, it improved the performance of exception-intensive programs by up to 18.3% without decreasing the performance of exception-minimal programs for SPECjvm98. We also found an opportunity for performance improvement using EDO in the startup of a Java application server.

References

  1. ACM 1995. In Proceedings of the 10th Annual Conference on Object-Oriented Programming Systems, Languages and Applications. ACM Press, New York, NY.]]Google ScholarGoogle Scholar
  2. ACM 2000a. In Proceedings of the 15th ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages and Applications. ACM Press, New York, NY.]]Google ScholarGoogle Scholar
  3. ACM 2000b. In Proceedings of the ACM 2000 Conference on Java Grande. ACM Press, New York, NY.]]Google ScholarGoogle Scholar
  4. ACM 2000c. In Proceedings of the ACM SIGPLAN 2000 Conference on Programming Language Design and Implementation. ACM Press, New York, NY.]]Google ScholarGoogle Scholar
  5. Agesen, O. and Hölzle, U. 1995. Type feedback vs. concrete type inference: A comparison of optimization techniques for object-oriented languages. See ACM {1995}, 91--107.]] Google ScholarGoogle Scholar
  6. Aigner, G. and Hölzle, U. 1996. Eliminating virtual function calls in C++ programs. In Proceedings of the 10th European Conference on Object-Oriented Programming---ECOOP '96. Lecture Notes in Computer Science, vol. 1098. Springer-Verlag, Berlin, Germany, 142--166.]] Google ScholarGoogle Scholar
  7. Aiken, A., Williams, J. H., and Wimmers, E. L. 1994. The FL project: The design of a functional language. Go online to http://www.cs.berkeley.edu/aiken/ftp/FL.ps.]]Google ScholarGoogle Scholar
  8. Allen, R. and Johnson, S. 1988. Compiling C for vectorization, parallelization, and inline expansion. In Proceedings of the ACM SIGPLAN 1988 Conference on Programming Language Design and Implementation. ACM Press, New York, NY, 241--249.]] Google ScholarGoogle Scholar
  9. Arnold, M., Fink, S., Grove, D., Hind, M., and Sweeney, P. F. 2000a. Adaptive optimization in the Jalapeño JVM. See ACM {2000a}, 47--65.]] Google ScholarGoogle Scholar
  10. Arnold, M., Fink, S., Sarkar, V., and Sweeney, P. F. 2000b. A comparative study of static and profile-based heuristics for inlining. In Proceedings of ACM SIGPLAN Workshop on Dynamic and Adaptive Compilation and Optimization. ACM Press, New York, NY, 52--64.]] Google ScholarGoogle Scholar
  11. Ayers, A., Gottlieb, R., and Schooler, R. 1997. Aggressive inlining. In Proceedings of the ACM SIGPLAN 1997 Conference on Programming Language Design and Implementation. ACM Press, New York, NY, 134--145.]] Google ScholarGoogle Scholar
  12. Baker, T. P. and Riccardi, G. A. 1986. Implementing Ada exceptions. IEEE Softw. 3, 5 (Sept.), 42--51.]]Google ScholarGoogle Scholar
  13. Ball, J. E. 1979. Predicting the effects of optimization on a procedure body. In Proceedings of the 1979 SIGPLAN Symposium on Compiler Construction. ACM Press, New York, NY, 214-- 220.]] Google ScholarGoogle Scholar
  14. Calder, B. and Grunwald, D. 1994. Reducing indirect function call overhead in C++. In Proceedings of the 21st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. ACM Press, New York, NY, 397--408.]] Google ScholarGoogle Scholar
  15. Cameron, D., Faust, P., Lenkov, D., and Mehta, M. 1992. A portable implementation of C++ exception handling. In Proceedings of the C++ Conference. USENIX Association, Berkeley, CA, 225--243.]]Google ScholarGoogle Scholar
  16. Cardelli, L., Donahue, J., Glassman, L., Jordan, M., Kalsow, B., and Nelson, G. 1989. Modula-3 report (revised). Tech. rep. SRC research rep. 52, Digital Equipment Corporation, Systems Research Center (DEC is now part of Hewlett Peckard, Palo Alto, CA.)]]Google ScholarGoogle Scholar
  17. Carini, P. R., Srinivasan, H., and Hind, M. 1995. Flow-sensitive type analysis for C++. Tech. rep. research rep. RC20267, IBM, Yorktown Heights, NY.]]Google ScholarGoogle Scholar
  18. Chang, P. P., Mahlke, S. A., Chen, W. Y., and Hwu, W. W. 1992. Profile-guided automatic inline expansion for C programs. Softw.: Pract. Not. 22, 5 (May), 349--369.]] Google ScholarGoogle Scholar
  19. Chatterjee, R., Ryder, B. G., and Landi, W. 1998. Complexity of concrete type-inference in the presence of exceptions. In ESOP'98, 7th European Symposium on Programming, Proceedings. Lecture Notes in Computer Science, vol. 1381. Springer-Verlag, Berlin, Germany, 57--74.]] Google ScholarGoogle Scholar
  20. Chen, W. Y., Chung, P. P., Conte, T. M., and Hwu, W. W. 1993. The effect of code expanding optimizations on instruction cache design. IEEE Trans. Comput. 42, 9 (Sept.), 1045--1057.]] Google ScholarGoogle Scholar
  21. Choi, J., Grove, D., Hind, M., and Sarkar, V. 1999. Efficient and precise modeling of exceptions for the analysis of Java programs. In Proceedings of the ACM SIGPLAN-SIGSOFT Workshop on Programming Analysis for Software Tools and Engineering. ACM Press, New York, NY, 21-- 31.]] Google ScholarGoogle Scholar
  22. Cierniak, M., Lueh, G., and Stichnoth, J. M. 2000. Practicing JUDO: Java under dynamic optimizations. See ACM {2000c}, 18--21.]] Google ScholarGoogle Scholar
  23. de Dinechin, C. 2000. C++ exception handling. IEEE Concurr. 8, 4, 72--79.]] Google ScholarGoogle Scholar
  24. Dean, J. and Chambers, C. 1994. Towards better inlining decisions using inlining trials. In Proceedings of the 1994 ACM Conference on LISP and Functional Programming. ACM Press, New York, NY, 273--282.]] Google ScholarGoogle Scholar
  25. Dean, J., DeFouw, G., Grove, D., Litvinov, V., and Chambers, C. 1996. Vortex: An optimizing compiler for object-oriented languages. In Proceedings of the 7th Annual Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA'96). ACM Press, New York, NY, 83--100.]] Google ScholarGoogle Scholar
  26. Dean, J., Grove, D., and Chambers, C. 1995. Optimization of object-oriented programs using static class hierarchy. In Proceedings of the 9th European Conference on Object-Oriented Programming---ECOOP '95. Lecture Notes in Computer Science, vol. 952. Springer-Verlag, Berlin, Germany, 77--101.]] Google ScholarGoogle Scholar
  27. Detlefs, D. and Agesen, O. 1999. Inlining of virtual methods. In Proceedings of the 13th European Conference on Object-Oriented Programming---ECOOP'99. Lecture Notes in Computer Science, vol. 1628. Springer-Verlag, Berlin, Germany, 258--278.]] Google ScholarGoogle Scholar
  28. Drew, S., Gouph, K. J., and Ledermann, J. 1995. Implementing zero overhead exception handling. Tech. rep. 95-12. Faculty of Information Technology, Queensland University of Technology, Brisbane, Australia.]]Google ScholarGoogle Scholar
  29. Fitzgerald, R., Knoblock, T. B., Ruf, E., Steensgaard, B., and Tarditi, D. 2000. Marmot: An optimizing compiler for Java. Softw.: Pract. Exper. 30, 3 (Mar.), 199--232.]] Google ScholarGoogle Scholar
  30. Frisch, A., Botlan, D. L., and Schmitt, A. 2001. The Objective Caml system---implementation. Go online to http://pauillac.inria.fr/~lebotlan/docaml_html/english/.]]Google ScholarGoogle Scholar
  31. Gagnon, E. M., Hendren, L. J., and Marceau, G. 2000. Efficient inference of static types for Java bytecode. In Static Analysis. 7th International Symposium, SAS 2000, Proceedings. Lecture Notes in Computer Science, vol. 1824. Springer-Verlag, Berlin, Germany, 199--219.]] Google ScholarGoogle Scholar
  32. Gehani, N. H. 1992. Exceptional C or C with exceptions. Softw.: Pract. Not. 22, 10 (Oct.), 827-- 848.]] Google ScholarGoogle Scholar
  33. Gosling, J., Joy, B., and Steele, G. 1996a. The Java Language Specification. The Java Series. Addison-Wesley, Reading, MA.]] Google ScholarGoogle Scholar
  34. Gosling, J., Joy, B., and Steele, G. 1996b. The Java Language Specification, Chapt. 11, 201--213. In Gosling et al. {1996a}.]]Google ScholarGoogle Scholar
  35. Govindarajan, R. 1993. Exception handlers in functional programming languages. IEEE Trans. Softw. Eng. 19, 8, 826--834.]] Google ScholarGoogle Scholar
  36. Grove, D. and Dean, J. 1995. Profile-guided receiver class prediction. See ACM {1995}, 108--123.]] Google ScholarGoogle Scholar
  37. Gunter, C. A., Remy, D., and Riecke, J. G. 1995. A generalization of exceptions and control in ML-like languages. In Proceedings of the Seventh International Conference on Functional Programming Languages and Computer Architecture. ACM Press, New York, NY, 12--23.]] Google ScholarGoogle Scholar
  38. Gupta, M., Choi, J., and Hind, M. 2000. Optimizing Java programs in the presence of exceptions. In Proceedings of the 14th European Conference on Object-Oriented Programming---ECOOP'00. Lecture Notes in Computer Science, vol. 1850. Springer-Verlag, Berlin, Germany, 422--446.]] Google ScholarGoogle Scholar
  39. Hank, R. E., Hwu, W. W., and Rau, B. R. 1995. Region-based compilation: An introduction and motivation. In Proceedings of the 28th Annual International Symposium on Microarchitecture. ACM Press, New York, NY, 158--168.]] Google ScholarGoogle Scholar
  40. Harper, R. W., Milner, A. R. J. G., and Tofte, M. 1986. Introduction to Standard ML. Tech. rep. ECS-LFCS-86-14. Dept. of Computer Science, Edinburgh University, Edinburgh, Scotland.]]Google ScholarGoogle Scholar
  41. Harrison, W. 1977. A new strategy for code generation: The general purpose optimizing compiler. In Proceedings of the 4th ACM SIGACT-SIGPLAN Symposium on Principles of Programming Languages. ACM Press, New York, NY, 29--37.]] Google ScholarGoogle Scholar
  42. Hennessy, J. 1981. Program optimization and exception handling. In Conference Record of the 8th Annual ACM Symposium on Principles of Programming Languages. ACM Press, New York, NY, 200--206.]] Google ScholarGoogle Scholar
  43. Hölzle, U., Chambers, C., and Ungar, D. 1991. Optimizing dynamically-typed object-oriented languages with polymorphic inline caches. In Proceedings of the 5th European Conference on Object-Oriented Programming---ECOOP '91 Lecture Notes in Computer Science, vol. 512. Springer-Verlag, Berlin, Germany, 21--38.]] Google ScholarGoogle Scholar
  44. Hölzle, U., Chambers, C., and Ungar, D. 1992. Debugging optimized code with dynamic deoptimization. In Proceedings of the ACM SIGPLAN 1992 Conference on Programming Language Design and Implementation. ACM Press, New York, NY, 32--43.]] Google ScholarGoogle Scholar
  45. Hwu, W. W. and Chang, P. P. 1989. Inline function expansion for compiling C programs. In Proceedings of the ACM SIGPLAN 1989 Conference on Programming Language Design and Implementation. ACM Press, New York, NY, 246--257.]] Google ScholarGoogle Scholar
  46. IBM 1995. IBM VisualAge C++ for OS/2 Programming Guide, 3rd ed. IBM, Yorktown Heights, NY.]]Google ScholarGoogle Scholar
  47. IBM 2001. The IBM Developer Kit, Java 2 Technology Edition. Go online to http://www.ibm.com/developerworks/java/jdk/.]]Google ScholarGoogle Scholar
  48. IBM 2004. IBM WebSphere Application Server. Go online to http://www-306.ibm.com/software/webservers/appserv/was/.]]Google ScholarGoogle Scholar
  49. Intel Corporation. 2001. IA-32 Intel Architecture Software Developer's Manual, Volume 1: Basic Architecture. Intel Corporation, Mt. Prospect, IL.]]Google ScholarGoogle Scholar
  50. Ishizaki, K., Kawahito, M., Yasue, T., Komatsu, H., and Nakatani, T. 2000a. A study of devirtualization techniques for a Java just-in-time compiler. See ACM {2000a}, 294--310.]] Google ScholarGoogle Scholar
  51. Ishizaki, K., Kawahito, M., Yasue, T., Takeuchi, M., Ogasawara, T., Suganuma, T., Onodera, T., Komatsu, H., and Nakatani, T. 2000b. Design, implementation, and evaluation of optimizations in a Java Just-In-Time compiler. Concurr.: Pract. Exper. 12, 6, 457--475.]] Google ScholarGoogle Scholar
  52. Kawahito, M., Komatsu, H., and Nakatani, T. 2000. Effective null pointer check elimination utilizing hardware trap. In Proceedings of the 9th International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS IX). ACM Press, New York, NY, 118--127.]] Google ScholarGoogle Scholar
  53. Koenig, A. and Stroustrup, B. 1990. Exception handling for C++ (revised). In Proceedings of the C++ Conference. USENIX Association, Berkeley, CA, 149--176.]]Google ScholarGoogle Scholar
  54. Krall, A. and Probst, M. 1998. Monitors and exceptions: How to implement Java efficiently. In Proceedings of the ACM 1998 Workshop on Java for High-Performance Network Computing. ACM Press, New York, NY, 15--24. Also published under the same title in the September 1998 issue of Concurr.: Pract. Exp. 10, 11--13, 837--850.]]Google ScholarGoogle Scholar
  55. Lang, J. and Stewart, D. B. 1998. A study of the applicability of existing exception-handling techniques to component-based real-time software technology. ACM Trans. Program. Lang. Syst. 20, 2 (Mar.), 274--301.]] Google ScholarGoogle Scholar
  56. Lee, S., Yang, B.-S., Kim, S., Park, S., Moon, S.-M., and Ebcioğlu, K. 2000. Efficient Java exception handling in just-in-time compilation. See ACM {2000b}, 1--8.]] Google ScholarGoogle Scholar
  57. Lee, S., Yang, B.-S., Kim, S., Park, S., Moon, S.-M., Ebcioğlu, K., and Altman, E. 1999. On-demand translation of Java exception handlers in the LaTTe JVM just-in-time compiler. In Proceedings of the 1999 Workshop on Binary Translation. IEEE Computer Society Press, Los Alamitos, CA.]]Google ScholarGoogle Scholar
  58. Lindholm, T. and Yellin, F. 1996. The Java Virtual Machine Specification. The Java Series. Addison-Wesley, Reading, MA, Chapter 4.7.4, 110--113.]] Google ScholarGoogle Scholar
  59. Liskov, B. and Snyder, A. 1979. Exception handling in CLU. IEEE Trans. Softw. Eng. 5, 6, 546--558.]]Google ScholarGoogle Scholar
  60. Maassen, J., van Nieuwpoort, R., Veldema, R., Bal, H. E., and Plaat, A. 1999. An efficient implementation of Java's remote method invocation. In Proceedings of the 7th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming. ACM Press, New York, NY, 173--182.]] Google ScholarGoogle Scholar
  61. MacLaren, M. D. 1984. Inline routines in VAXELN pascal. In Proceedings of the 1984 SIGPLAN Symposium on Compiler Construction. ACM Press, New York, NY, 266--275.]] Google ScholarGoogle Scholar
  62. Microsoft. 2001. MSDN Online. Go online to http://msdn.microsoft.com/.]]Google ScholarGoogle Scholar
  63. Microsoft 2004a. Programming with the .NET framework. Go online to http://msdn.microsoft.com/library/en-us/cpguide/html/cpconprogrammingwithnetframework.asp.]]Google ScholarGoogle Scholar
  64. Microsoft 2004b. Visual C and C++. Go online to http://msdn.microsoft.com/library/en-us/dnanchor/html/vc6anchor.asp.]]Google ScholarGoogle Scholar
  65. Paleczny, M., Vick, C., and Click, C. 2001. The Java HotSpot server compiler. In Proceedings of the Java Virtual Machine Research and Technology Symposium. USENIX Association, Berkeley, CA, 1--12.]] Google ScholarGoogle Scholar
  66. Palsberg, J. and Schwartzbach, M. I. 1991. Object-oriented type inference. In Proceedings of the Conference on Object-Oriented Programming Systems, Languages and Applications. ACM Press, New York, NY, 146--161.]] Google ScholarGoogle Scholar
  67. Peyton Jones, S. 2003. Haskell 98 language and libraries: The revised report. J. Func. Prog. 13, 1, 1--146.]] Google ScholarGoogle Scholar
  68. Peyton Jones, S., Reid, A., Hoare, T., and Marlow, S. 1999. A semantics for imprecise exceptions. In Proceedings of the ACM SIGPLAN 1999 Conference on Programming Language Design and Implementation. ACM Press, New York, NY, 25--36.]] Google ScholarGoogle Scholar
  69. Ramsey, N. and Peyton Jones, S. 2000. A single intermediate language that supports multiple implementations of exceptions. See ACM {2000c}, 285--298.]] Google ScholarGoogle Scholar
  70. Ryder, B. G., Smith, D., Kremer, U., Gordon, M., and Shah, N. 1999. A static study of Java exceptions using JESP. Tech. rep. dcs-tr-406. Department of Computer Science, Rutgers University, New Brunewick, NJ.]]Google ScholarGoogle Scholar
  71. Scheifler, R. W. 1977. An analysis of inline substitution for a structured programming language. Commun. ACM 20, 9 (Sept.), 647--654.]] Google ScholarGoogle Scholar
  72. Schilling, J. L. 1998. Optimizing away C++ exception handling. ACM SIGPLAN Not. 33, 8 (Aug.), 40--47.]] Google ScholarGoogle Scholar
  73. Sinha, S. and Harrold, M. J. 2000. Analysis and testing of programs with exception handling constructs. IEEE Trans. Softw. Eng. 42, 9, 849--871.]] Google ScholarGoogle Scholar
  74. Stallman, R. M. 2004. Using the GNU Compiler Collection. Go online to http://gcc.gnu.org/onlinedocs/.]]Google ScholarGoogle Scholar
  75. Suganuma, T., Ogasawara, T., Takeuchi, M., Yasue, T., Kawahito, M., Ishizaki, K., Komatsu, H., and Nakatani, T. 2000. Overview of the IBM Java just-in-time compiler. IBM Syst. J. 39, 1, 175--193.]] Google ScholarGoogle Scholar
  76. Suganuma, T., Yasue, T., Kawahito, M., Komatsu, H., and Nakatani, T. 2001. A dynamic optimization framework for a Java just-in-time compiler. In Proceedings of the 16th ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages and Applications. ACM Press, New York, NY, 180--194.]] Google ScholarGoogle Scholar
  77. Suganuma, T., Yasue, T., and Nakatani, T. 2003. A region-based compilation technique for a Java just-in-time compiler. In Proceedings of the ACM SIGPLAN 2003 Conference on Programming Language Design and Implementation. ACM Press, New York, NY, 312--323.]] Google ScholarGoogle Scholar
  78. Sun. 2000. Java HotSpot technology. Go online to http://java.sun.com/products/hotspot/.]]Google ScholarGoogle Scholar
  79. The Standard Performance Evaluation Corporation (SPEC). 1998. JVM Client98 (SPECjvm98). Go online to http://www.spec.org/osg/jvm98/.]]Google ScholarGoogle Scholar
  80. Tromey, T. 2002. GNU gcj. Go online to http://gcc.gnu.org/onlinedocs/.]]Google ScholarGoogle Scholar
  81. Veldema, R. 1998. Jcc, a native Java compiler. M.S. thesis, Vrije Universiteit Amsterdam, The Netherlands.]]Google ScholarGoogle Scholar
  82. Whaley, J. 2000. A portable sampling-based profiler for Java virtual machines. See ACM {2000b}, 78--87.]] Google ScholarGoogle Scholar

Index Terms

  1. EDO: Exception-directed optimization in java

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in

        Full Access

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader
        About Cookies On This Site

        We use cookies to ensure that we give you the best experience on our website.

        Learn more

        Got it!