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.
- ACM 1995. In Proceedings of the 10th Annual Conference on Object-Oriented Programming Systems, Languages and Applications. ACM Press, New York, NY.]]Google Scholar
- ACM 2000a. In Proceedings of the 15th ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages and Applications. ACM Press, New York, NY.]]Google Scholar
- ACM 2000b. In Proceedings of the ACM 2000 Conference on Java Grande. ACM Press, New York, NY.]]Google Scholar
- ACM 2000c. In Proceedings of the ACM SIGPLAN 2000 Conference on Programming Language Design and Implementation. ACM Press, New York, NY.]]Google Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- Baker, T. P. and Riccardi, G. A. 1986. Implementing Ada exceptions. IEEE Softw. 3, 5 (Sept.), 42--51.]]Google Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- Cierniak, M., Lueh, G., and Stichnoth, J. M. 2000. Practicing JUDO: Java under dynamic optimizations. See ACM {2000c}, 18--21.]] Google Scholar
- de Dinechin, C. 2000. C++ exception handling. IEEE Concurr. 8, 4, 72--79.]] Google Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- Gehani, N. H. 1992. Exceptional C or C with exceptions. Softw.: Pract. Not. 22, 10 (Oct.), 827-- 848.]] Google Scholar
- Gosling, J., Joy, B., and Steele, G. 1996a. The Java Language Specification. The Java Series. Addison-Wesley, Reading, MA.]] Google Scholar
- Gosling, J., Joy, B., and Steele, G. 1996b. The Java Language Specification, Chapt. 11, 201--213. In Gosling et al. {1996a}.]]Google Scholar
- Govindarajan, R. 1993. Exception handlers in functional programming languages. IEEE Trans. Softw. Eng. 19, 8, 826--834.]] Google Scholar
- Grove, D. and Dean, J. 1995. Profile-guided receiver class prediction. See ACM {1995}, 108--123.]] Google Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- IBM 1995. IBM VisualAge C++ for OS/2 Programming Guide, 3rd ed. IBM, Yorktown Heights, NY.]]Google Scholar
- IBM 2001. The IBM Developer Kit, Java 2 Technology Edition. Go online to http://www.ibm.com/developerworks/java/jdk/.]]Google Scholar
- IBM 2004. IBM WebSphere Application Server. Go online to http://www-306.ibm.com/software/webservers/appserv/was/.]]Google Scholar
- Intel Corporation. 2001. IA-32 Intel Architecture Software Developer's Manual, Volume 1: Basic Architecture. Intel Corporation, Mt. Prospect, IL.]]Google Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- Koenig, A. and Stroustrup, B. 1990. Exception handling for C++ (revised). In Proceedings of the C++ Conference. USENIX Association, Berkeley, CA, 149--176.]]Google Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- Liskov, B. and Snyder, A. 1979. Exception handling in CLU. IEEE Trans. Softw. Eng. 5, 6, 546--558.]]Google Scholar
- 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 Scholar
- 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 Scholar
- Microsoft. 2001. MSDN Online. Go online to http://msdn.microsoft.com/.]]Google Scholar
- Microsoft 2004a. Programming with the .NET framework. Go online to http://msdn.microsoft.com/library/en-us/cpguide/html/cpconprogrammingwithnetframework.asp.]]Google Scholar
- Microsoft 2004b. Visual C and C++. Go online to http://msdn.microsoft.com/library/en-us/dnanchor/html/vc6anchor.asp.]]Google Scholar
- 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 Scholar
- 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 Scholar
- Peyton Jones, S. 2003. Haskell 98 language and libraries: The revised report. J. Func. Prog. 13, 1, 1--146.]] Google Scholar
- 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 Scholar
- Ramsey, N. and Peyton Jones, S. 2000. A single intermediate language that supports multiple implementations of exceptions. See ACM {2000c}, 285--298.]] Google Scholar
- 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 Scholar
- Scheifler, R. W. 1977. An analysis of inline substitution for a structured programming language. Commun. ACM 20, 9 (Sept.), 647--654.]] Google Scholar
- Schilling, J. L. 1998. Optimizing away C++ exception handling. ACM SIGPLAN Not. 33, 8 (Aug.), 40--47.]] Google Scholar
- 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 Scholar
- Stallman, R. M. 2004. Using the GNU Compiler Collection. Go online to http://gcc.gnu.org/onlinedocs/.]]Google Scholar
- 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 Scholar
- 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 Scholar
- 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 Scholar
- Sun. 2000. Java HotSpot technology. Go online to http://java.sun.com/products/hotspot/.]]Google Scholar
- The Standard Performance Evaluation Corporation (SPEC). 1998. JVM Client98 (SPECjvm98). Go online to http://www.spec.org/osg/jvm98/.]]Google Scholar
- Tromey, T. 2002. GNU gcj. Go online to http://gcc.gnu.org/onlinedocs/.]]Google Scholar
- Veldema, R. 1998. Jcc, a native Java compiler. M.S. thesis, Vrije Universiteit Amsterdam, The Netherlands.]]Google Scholar
- Whaley, J. 2000. A portable sampling-based profiler for Java virtual machines. See ACM {2000b}, 78--87.]] Google Scholar
Index Terms
EDO: Exception-directed optimization in java
Recommendations
Efficient Java exception handling in just-in-time compilation
Research ArticlesJava uses exceptions to provide elegant error handling capabilities during program execution. However, the presence of exception handlers complicates the job of the just-in-time (JIT) compiler, while exceptions are rarely used in most programs. This ...
Towards architecture-level middleware-enabled exception handling of component-based systems
CBSE '11: Proceedings of the 14th international ACM Sigsoft symposium on Component based software engineeringException handling is a practical and important way to improve the availability and reliability of a component-based system. The classical code-level exception handling approach is usually applied to the inside of a component, while some exceptions can ...
A semantics for execution levels with exceptions
FOAL '11: Proceedings of the 10th international workshop on Foundations of aspect-oriented languagesAspect-oriented languages are usually formulated as an extension to existing languages, without paying any special attention to the underlying exception handling mechanisms. Consequently, aspect exceptions and handlers are no different than base ...






Comments