article

Automatic program specialization for Java

Abstract

The object-oriented style of programming facilitates program adaptation and enhances program genericness, but at the expense of efficiency. We demonstrate experimentally that state-of-the-art Java compilers fail to compensate for the use of object-oriented abstractions in the implementation of generic programs, and that program specialization can eliminate a significant portion of these overheads. We present an automatic program specializer for Java, illustrate its use through detailed case studies, and demonstrate experimentally that it can significantly reduce program execution time. Although automatic program specialization could be seen as being subsumed by existing optimizing compiler technology, we show that specialization and compiler optimization are in fact complementary.

References

  1. Affeldt, R., Masuhara, H., Sumii, E., and Yonezawa, A. 2002. Supporting objects in run-time bytecode specialization. ACM Press, Aizu, Japan. In the Proceedings of Asia-PEPM 2002.]] Google ScholarGoogle Scholar
  2. Agesen, O., Palsberg, J., and Schwartzbach, M. 1993. Type inference of SELF. In Proceedings of the European Conference on Object-oriented Programming (ECOOP'93). Lecture Notes in Computer Science, vol. 707. Springer-Verlag, Kaiserslautern, Germany, 247--267.]] Google ScholarGoogle Scholar
  3. Aigner, G. and Holzle, U. 1996. Eliminating virtual calls in C++ programs. In Proceedings of ECOOP '96. Springer-Verlag, Linz, Austria.]] Google ScholarGoogle Scholar
  4. Alpern, B., Attanasio, C., Cocchi, A., Lieber, D., Smith, S., Ngo, T., Barton, J., Hummel, S., Sheperd, J., and Mergen, M. 1999. Implementing Jalapeño in Java. In Proceedings of the 1999 ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA'99). ACM SIGPLAN Notices, vol. 34(10), L. Meissner, Ed. ACM Press, Denver, CO, 314--324.]] Google ScholarGoogle Scholar
  5. Andersen, L. 1994. Program analysis and specialization for the C programming language. Ph.D. thesis, Computer Science Department, University of Copenhagen. DIKU Technical Report 94/19.]]Google ScholarGoogle Scholar
  6. Baier, R., Glück, R., and Zöchling, R. 1994. Partial evaluation of numerical programs in Fortran. In ACM SIGPLAN Workshop on Partial Evaluation and Semantics-Based Program Manipulation (PEPM'94). Technical Report 94/9, University of Melbourne, Australia, Orlando, FL, USA, 119--132.]]Google ScholarGoogle Scholar
  7. Blount, B. and Chatterjee, S. 1999. An evaluation of Java for numerical computing. Scientific Programming 7(2), 97--110. Special Issue: High Performance Java Compilation and Runtime Issues.]] Google ScholarGoogle Scholar
  8. Bondorf, A. 1990. Self-applicable partial evaluation. Ph.D. thesis, DIKU, University of Copenhagen, Denmark. Revised version: DIKU Report 90/17.]]Google ScholarGoogle Scholar
  9. Braux, M. and Noyé, J. 2000. Towards partially evaluating reflection in Java. In ACM SIGPLAN Workshop on Partial Evaluation and Semantics-Based Program Manipulation (PEPM'00). ACM Press, Boston, MA, USA.]] Google ScholarGoogle Scholar
  10. Budimlić, Z. and Kennedy, K. 1999. Prospects for scientific computing in polymorphic, object-oriented style. In Proceedings of the Ninth SIAM Conference of Parallel Processing in Scientific Computing. SIAM, San Antonio.]]Google ScholarGoogle Scholar
  11. Budimlić, Z. and Kennedy, K. 2001. JaMake: a Java compiler environment. In Third International Conference on Large Scale Scientific Computing. Number 2179 in Lecture Notes in Computer Science. Springer-Verlag, Sozopol, Bulgaria, 201--209.]] Google ScholarGoogle Scholar
  12. Budimlić, Z., Kennedy, K., and Piper, J. 1999. The cost of being object-oriented: A preliminary study. Scientific Computing 7, 2, 87--95.]] Google ScholarGoogle Scholar
  13. Chambers, C. and Ungar, D. 1989. Customization: Optimizing compiler technology for SELF, A dynamically-typed object-oriented programming language. In Proceedings of the SIGPLAN '89 Conference on Programming Language Design and Implementation (PLDI '89), B. Knobe, Ed. ACM Press, Portland, OR, USA, 146--160.]] Google ScholarGoogle Scholar
  14. Consel, C. 1993. A tour of Schism: a partial evaluation system for higher-order applicative languages. In Partial Evaluation and Semantics-Based Program Manipulation (PEPM'93). ACM Press, Copenhagen, Denmark, 66--77.]] Google ScholarGoogle Scholar
  15. Consel, C., Hornof, L., Noël, F., Noyé, J., and Volanschi, E. 1996. A uniform approach for compile-time and run-time specialization. In Partial Evaluation, International Seminar, Dagstuhl Castle, O. Danvy, R. Glück, and P. Thiemann, Eds. Number 1110 in Lecture Notes in Computer Science. Springer-Verlag, Dagstuhl Castle, Germany, 54--72.]] Google ScholarGoogle Scholar
  16. Cooper, K., Hall, M., and Kennedy, K. 1992. Procedure cloning. In Proceedings of the 1992 International Conference on Computer Languages. IEEE Computer Society Press, Oakland, CA, USA, 96--105.]]Google ScholarGoogle Scholar
  17. Dean, J., Chambers, C., and Grove, D. 1995. Selective specialization for object-oriented languages. In Proceedings of the ACM SIGPLAN '95 Conference on Programming Language Design and Implementation (PLDI'95). ACM SIGPLAN Notices, 30(6), La Jolla, CA USA, 93--102.]] Google ScholarGoogle Scholar
  18. Dean, J., Grove, D., and Chambers, C. 1995a. Optimization of object-oriented programs using static class hierarchy analysis. In Proceedings of the European Conference on Object-Oriented Programming (ECOOP'95), W. G. Olthoff, Ed. Lecture Notes in Computer Science, vol. 952. Springer-Verlag, Aarhus, Denmark, 77--101.]] Google ScholarGoogle Scholar
  19. Detlefs, D. and Agesen, O. 1999. Inlining of virtual methods. In Proceedings of the European Conference on Object-Oriented Programming (ECOOP'99). Lecture Notes in Computer Science, vol. 1628, R. Guerraoui, Ed. Springer-Verlag, Lisbon, Portugal, 258--278.]] Google ScholarGoogle Scholar
  20. Dolby, J. and Chien, A. 1998. An evaluation of automatic object inline allocation techniques. In OOPSLA'97 Conference Proceedings. ACM SIGPLAN Notices. ACM Press, ACM Press, Vancouver, Canada, 1--20.]] Google ScholarGoogle Scholar
  21. Dolby, J. and Chien, A. 2000. An automatic object inlining optimizations and its evaluation. In Proceedings of the 1999 ACM SIGPLAN'00 Conference on Programming Language Design and Implementation (PLDI'00), M. Lam, Ed. Vancouver, British Columbia, Canada, 345--357.]] Google ScholarGoogle Scholar
  22. Fujinami, N. 1998. Determination of dynamic method dispatches using run-time code generation. In Proceedings of the Second International Workshop on Types in Compilation (TIC'98), X. Leroy and A. Ohori, Eds. Lecture Notes in Computer Science, vol. 1473. Springer-Verlag, Kyoto, Japan, 253--271.]] Google ScholarGoogle Scholar
  23. Gamma, E., Helm, R., Johnson, R., and Vlissides, J. 1994. Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley.]] Google ScholarGoogle Scholar
  24. Grove, D., Dean, J., Garrett, C., and Chambers, C. 1995. Profile-guided receiver class prediction. In OOPSLA'95 Conference Proceedings. ACM Press, Austin, TX, USA, 108--123.]] Google ScholarGoogle Scholar
  25. Hölzle, U. and Ungar, D. 1994. Optimizing dynamically-dispatched calls with run-time type feedback. In Proceedings of the ACM SIGPLAN '94 Conference on Programming Language Design and Implementation (PLDI'94). ACM SIGPLAN Notices, 29(6), New York, NY, USA, 326--336.]] Google ScholarGoogle Scholar
  26. Hornof, L. and Noyé, J. 2000. Accurate binding-time analysis for imperative languages: Flow, context, and return sensitivity. Theoretical Computer Science (TCS) 248, 1--2, 3--27.]] Google ScholarGoogle Scholar
  27. Hornof, L., Noyé, J., and Consel, C. 1997. Effective specialization of realistic programs via use sensitivity. In Proceedings of the Fourth International Symposium on Static Analysis (SAS'97), P. Van Hentenryck, Ed. Lecture Notes in Computer Science, vol. 1302. Springer-Verlag, Paris, France, 293--314.]] Google ScholarGoogle Scholar
  28. IBM. 2001. IBM JDK 1.3.1. http://www.ibm.com/java/jdk.]]Google ScholarGoogle Scholar
  29. IBM. 2002. Jikes RVM 2.1.0. http://www.ibm.com/developerworks/oss/jikesrvm/.]]Google ScholarGoogle Scholar
  30. Irwin, J., Loingtier, J., Gilbert, J., Kiczales, G., Lamping, J., Mendhekar, A., and Shpeisman, T. 1997. Aspect-oriented programming of sparse matrix code. In Proceedings of the First International Conference on Scientific Computing in Object-Oriented Parallel Environments (ISCOPE'97), Y. Ishikawa, R. Oldehoeft, J. Reynders, and M. Tholsburn, Eds. Lecture Notes in Computer Science, vol. 1343. Springer-Verlag, Marina del Rey, CA, USA, 249--256.]] Google ScholarGoogle Scholar
  31. Ishizaki, K., Kawahito, M., Yasue, T., Komatsu, H., and Nokatani, T. 2000. A study of devirtualization techniques for a Java Just-In-Time compiler. In OOPSLA'00 Conference Proceedings. ACM SIGPLAN Notices, M. Rosson and D. Lea, Eds. ACM Press, Minneapolis, MN, 294--310.]] Google ScholarGoogle Scholar
  32. Java Grande Forum. 1999. The Java Grande Forum benchmark suite. http://www. javagrande.org.]]Google ScholarGoogle Scholar
  33. Jones, N., Gomard, C., and Sestoft, P. 1993. Partial Evaluation and Automatic Program Generation. International Series in Computer Science. Prentice-Hall.]] Google ScholarGoogle Scholar
  34. Kiczales, G., Hilsdale, E., Hugunin, J., Kersten, M., Palm, J., and Griswold, W. 2001. An overview of AspectJ. In Proceedings of the European Conference on Object-Oriented Programming (ECOOP '01). Lecture Notes in Computer Science, vol. 2072, J. Knudsen, Ed. Budapest, Hungary, 327--353.]] Google ScholarGoogle Scholar
  35. Kiczales, G., Lamping, J., Mendhekar, A., Maeda, C., Lopes, C., Loingtier, J., and Irwin, J. 1997. Aspect-oriented programming. In Proceedings of the European Conference on Object-oriented Programming (ECOOP'97), M. Aksit and S. Matsuoka, Eds. Lecture Notes in Computer Science, vol. 1241. Springer, Jyväskylä, Finland, 220--242.]]Google ScholarGoogle Scholar
  36. Lawall, J. and Muller, G. 2000. Efficient incremental checkpointing of Java programs. In Proceedings of the International Conference on Dependable Systems and Networks. IEEE, New York, NY, USA, 61--70.]] Google ScholarGoogle Scholar
  37. Lloyd, J. and Shepherdson, J. 1991. Partial evaluation in logic programming. J. Logic Prog. 11, 217--242.]] Google ScholarGoogle Scholar
  38. Luján, M. 1999. Object oriented linear algebra. M.S. thesis, University of Manchester.]]Google ScholarGoogle Scholar
  39. Luján, M., Freeman, T., and Gurd, J. 2000. OoLaLa: an object oriented analysis and design of numerical linear algebra. In OOPSLA'00 Conference Proceedings. ACM SIGPLAN Notices, M. Rosson and D. Lea, Eds. ACM Press, Minneapolis, MN, 229--252.]] Google ScholarGoogle Scholar
  40. Luján, M., Gurd, J., and Freeman, T. 2001. OoLaLa: Transformations for implementations of matrix operations at high abstraction levels. In Proceedings 4th Workshop on Parallel Object-Oriented Scientific Computing---POOSC'01. ACM Press, Tampa Bay, Florida, USA.]]Google ScholarGoogle Scholar
  41. Marquard, M. and Steensgaard, B. 1992. Partial evaluation of an object-oriented imperative language. M.S. thesis, University of Copenhagen.]]Google ScholarGoogle Scholar
  42. Masuhara, H. and Yonezawa, A. 2002. A portable approach to dynamic optimization in run-time specialization. New Generation Computing 20, 1, 101--124.]] Google ScholarGoogle Scholar
  43. Muller, G. and Schultz, U. 1999. Harissa: A hybrid approach to Java execution. IEEE Soft. 16, 2 (Mar.), 44--51.]] Google ScholarGoogle Scholar
  44. Ogawa, H., Shimura, K., Matsuoka, S., Maruyama, F., Sohda, Y., and Kimura, Y. 2000. OpenJIT: an open-ended, reflective JIT compiler framework for Java. In Proceedings of the European Conference on Object-Oriented Programming (ECOOP'00). Lecture Notes in Computer Science, vol. 1850. Springer-Verlag, Cannes, France, 362--387.]] Google ScholarGoogle Scholar
  45. Plevyak, J. and Chien, A. 1994. Precise concrete type inference for object-oriented languages. In OOPSLA'94 Conference Proceedings. SIGPLAN Notices, vol. 29:10. ACM Press, ACM Press, Portland, OR, USA, 324--324.]] Google ScholarGoogle Scholar
  46. Raj, R., Tempero, E., Levy, H., Black, A., Hutchinson, N., and Jul, E. 1991. Emerald: A general-purpose programming language. Software---Practice and Experience 21, 1 (Jan.), 91--118.]] Google ScholarGoogle Scholar
  47. Schultz, U. 2000. Object-oriented software engineering using partial evaluation. Ph.D. thesis, University of Rennes I, Rennes, France.]]Google ScholarGoogle Scholar
  48. Schultz, U. 2001. Partial evaluation for class-based object-oriented languages. In Symposium on Programs as Data Objects II. Lecture Notes in Computer Science, vol. 2053, O. Danvy and A. Filinski, Eds. Aarhus, Denmark, 173--197.]] Google ScholarGoogle Scholar
  49. Schultz, U., Lawall, J., Consel, C., and Muller, G. 1999. Towards automatic specialization of Java programs. In Proceedings of the European Conference on Object-Oriented Programming (ECOOP'99). Lecture Notes in Computer Science, vol. 1628, R. Guerraoui, Ed. Springer-Verlag, Lisbon, Portugal, 367--390.]] Google ScholarGoogle Scholar
  50. Schultz, U., Lawall, J., Consel, C., and Muller, G. 2000. Specialization patterns. In Proceedings of the 15th IEEE International Conference on Automated Software Engineering (ASE 2000). IEEE Computer Society Press, Grenoble, France, 197--206.]] Google ScholarGoogle Scholar
  51. SPEC. 1998. SPEC JVM 98 benchmarks. Standard Performance Evaluation Corporation. http://www.specbench.org/osg/jvm98/.]]Google ScholarGoogle Scholar
  52. Sreedhar, V., Burke, M., and Choi, J. 2000. A framework for interprocedural optimization in the presence of dynamic class loading. In Proceedings of the 1999 ACM SIGPLAN'00 Conference on Programming Language Design and Implementation (PLDI'00), M. Lam, Ed. Vancouver, British Columbia, Canada, 196--207.]] Google ScholarGoogle Scholar
  53. Sullivan, G. 2001. Dynamic partial evaluation. In Symposium on Programs as Data Objects II. Lecture Notes in Computer Science, vol. 2053, O. Danvy and A. Filinski, Eds. Aarhus, Denmark, 238--256.]] Google ScholarGoogle Scholar
  54. Sun Microsystems, Inc. 1999. Sun JDK 1.2.2. http://java.sun.com/products/j2se.]]Google ScholarGoogle Scholar
  55. Sun Microsystems, Inc. 2002. Sun JDK 1.4.0. http://java.sun.com/products/j2se.]]Google ScholarGoogle Scholar
  56. Sundaresan, V., Hendren, L., and Razafimahefa, C. 2000. Practical virtual method call resolution for Java. In OOPSLA'00 Conference Proceedings. ACM SIGPLAN Notices, M. Rosson and D. Lea, Eds. ACM Press, Minneapolis, MN, 264--280.]] Google ScholarGoogle Scholar
  57. Tip, F., Laffra, C., and Sweeney, P. 1999. Practical experience with an application extractor for Java. In Proceedings of the 1999 ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA'99). ACM SIGPLAN Notices, vol. 34(10), L. Meissner, Ed. ACM Press, Denver, CO, 292--305.]] Google ScholarGoogle Scholar
  58. Veldhuizen, T. 1999. C++ templates as partial evaluation. In ACM SIGPLAN Workshop on Partial Evaluation and Semantics-Based Program Manipulation (PEPM'98). ACM Press, San Antonio, TX, USA, 13--18.]]Google ScholarGoogle Scholar
  59. Veldhuizen, T. 2000. Expression templates in Java. In Generative and Component-Based Software Engineering, Second International Symposium, GCSE'00, G. Butler and S. Jarzabek, Eds. Lecture Notes in Computer Science, vol. 2177. Springer, Erfurt, Germany, 188--202. Revised Papers.]] Google ScholarGoogle Scholar
  60. Volanschi, E., Consel, C., Muller, G., and Cowan, C. 1997. Declarative specialization of object-oriented programs. In OOPSLA'97 Conference Proceedings. ACM Press, Atlanta, GA, USA, 286--300.]] Google ScholarGoogle Scholar
  61. Wang, T. and Smith, S. 2001. Precise constraint-based type inference for Java. In Proceedings of the European Conference on Object-Oriented Programming (ECOOP'01). Lecture Notes in Computer Science, vol. 2072, J. Knudsen, Ed. Budapest, Hungary, 99--117.]] Google ScholarGoogle Scholar
  62. XEROX 2000. AspectJ home page. http://aspectj.org. Xerox Corp.]]Google ScholarGoogle Scholar
  63. Zaks, A., Feldman, V., and Aizikowitz, N. 2000. Sealed calls in Java packages. In OOPSLA'00 Conference Proceedings. ACM SIGPIAN Notices, M. Rosson and D. Lea, Eds. ACM Press, Minneapolis, MN, 83--92.]] Google ScholarGoogle Scholar

Index Terms

  1. Automatic program specialization for Java

    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!