Optimization of Object-Oriented Programs Using Static Class Hierarchy Analysis

  • Jeffrey Dean
  • David Grove
  • Craig Chambers
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 952)

Abstract

Optimizing compilers for object-oriented languages apply static class analysis and other techniques to try to deduce precise information about the possible classes of the receivers of messages; if successful, dynamically-dispatched messages can be replaced with direct procedure calls and potentially further optimized through inline-expansion. By examining the complete inheritance graph of a program, which we call class hierarchy analysis, the compiler can improve the quality of static class information and thereby improve run-time performance. In this paper we present class hierarchy analysis and describe techniques for implementing this analysis effectively in both statically- and dynamically-typed languages and also in the presence of multi-methods. We also discuss how class hierarchy analysis can be supported in an interactive programming environment and, to some extent, in the presence of separate compilation. Finally, we assess the bottom-line performance improvement due to class hierarchy analysis alone and in combination with two other “competing” optimizations, profile-guided receiver class prediction and method specialization.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. [Agesen & Hölzle 95]
    Ole Agesen and Urs Hölzle. Type Feedback vs. Concrete Type Analysis: A Comparison of Optimization Techniques for Object-Oriented Languages. Technical Report TRCS 95-04, Department of Computer Science, University of California, Santa Barbara, March 1995.Google Scholar
  2. [Agesen et al. 93]_Ole Agesen, Jens Palsberg, and Michael I. Schwartzback. Type Inference of SELF: Analysis of Objects with Dynamic and Multiple Inheritance. In Proceedings ECOOP’ 93, July 1993.Google Scholar
  3. [Agrawal et al. 91]_Rakesh Agrawal, Linda G. DeMichiel, and Bruce G. Lindsay. Static Type Checking of Multi-Methods. In Proceedings OOPSLA’ 91, pages 113–128, November 1991. Published as ACM SIGPLAN Notices, volume 26, number 11.Google Scholar
  4. [AK et al. 89]_Hassan Aït-Kaci, Robert Boyer, Patrick Lincoln, and Roger Nasr. Efficient Implementation of Lattice Operations. ACM Transactions on Programming Languages and Systems, 11(1): 115–146, January 1989.CrossRefGoogle Scholar
  5. [Bobrow et al. 88]_D. G. Bobrow, L. G. DeMichiel, R. P. Gabriel, S. E. Keene, G. Kiczales, and D. A. Moon. Common Lisp Object System Specification X3J13. SIGPLAN Notices, 28(Special Issue), September 1988.Google Scholar
  6. [Calder & Grunwald 94]
    Brad Calder and Dirk Grunwald. Reducing Indirect Function Call Overhead in C++ Programs. In Conference Record of POPL’ 94: 21st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 397–408, Portland, Oregon, January 1994.Google Scholar
  7. [Caseau 93]
    Yves Caseau. Efficient Handling of Multiple Inheritance Hierarchies. In Proceedings OOPSLA’93, pages 271–287, October 1993. Published as ACM SIGPLAN Notices, volume 28, number 10.Google Scholar
  8. [Chambers & Ungar 89]
    Craig Chambers and David Ungar. Customization: Optimizing Compiler Technology for Self, A Dynamically-Typed Object-Oriented Programming Language. SIGPLAN Notices, 24(7): 146–160, July 1989. In Proceedings of the ACM SIGPLAN’ 89 Conference on Programming Language Design and Implementation.CrossRefGoogle Scholar
  9. [Chambers & Ungar 90]
    Craig Chambers and David Ungar. Iterative Type Analysis and Extended Message Splitting: Optimizing Dynamically-Typed Object-Oriented Programs. SIGPLAN Notices, 25(6):150–164, June 1990. In Proceedings of the ACM SIGPLAN’ 90 Conference on Programming Language Design and Implementation.CrossRefGoogle Scholar
  10. [Chambers & Ungar 91]
    Craig Chambers and David Ungar. Making Pure Object-Oriented Languages Practical. In Proceedings OOPSLA’ 91, pages 1–15, November 1991. Published as ACM SIGPLAN Notices, volume 26, number 11.Google Scholar
  11. [Chambers 92]
    Craig Chambers. Object-Oriented Multi-Methods in Cecil. In O. Lehrmann Madsen, editor, Proceedings ECOOP’ 92, LNCS 615, pages 33–56, Utrecht, The Netherlands, July 1992. Springer-Verlag.Google Scholar
  12. [Chambers 93]
    Craig Chambers. The Cecil Language: Specification and Rationale. Technical Report TR-93-03-05, Department of Computer Science and Engineering. University of Washington, March 1993.Google Scholar
  13. [Chambers et al. 89]_Craig Chambers, David Ungar, and Elgin Lee. An Efficient Implementation of SELF-a Dynamically-Typed Object-Oriented Language Based on Prototypes. In Proceedings OOPSLA’ 89, pages 49–70, October 1989. Published as ACM SIGPLAN Notices, volume 24, number 10.Google Scholar
  14. [Chambers et al. 95]_Craig Chambers, Jeffrey Dean, and David Grove. A Framework for Selective Recompilation in the Presence of Complex Intermodule Dependencies. In 17th International Conference on Software Engineering, Seattle, WA, April 1995.Google Scholar
  15. [Dean et al. 95]_Jeffrey Dean, Craig Chambers, and David Grove. Selective Specialization for Object-Oriented Languages. SIGPLAN Notices, June 1995. In Proceedings of the ACM SIGPLAN’ 95 Conference on Programming Language Design and Implementation.Google Scholar
  16. [Deutsch & Schiffman 84]
    L. Peter Deutsch and Allan M. Schiffman. Efficient Implementation of the Smalltalk-80 System. In Conference Record of the Eleventh Annual ACM Symposium on Principles of Programming Languages, pages 297–302, Salt Lake City, Utah, January 1984.Google Scholar
  17. [Dyl92]
    Dylan, an Object-Oriented Dynamic Language, April 1992. Apple Computer.Google Scholar
  18. [Fernandez 95]
    Mary Fernandez. Simple and Effective Link-time Optimization of Modula-3 Programs. SIGPLAN Notices, June 1995. In Proceedings of the ACM SIGPLAN’ 95 Conference on Programming Language Design and Implementation.Google Scholar
  19. [Gabriel et al. 91]_Richard P. Gabriel, Jon L. White, and Daniel G. Bobrow. CLOS: Integrating Object-Oriented and Functional Programming. Communications of the ACM, 34(9):28–38, September 1991.CrossRefGoogle Scholar
  20. [Garrett et al. 94]_Charlie Garrett, Jeffrey Dean, David Grove, and Craig Chambers. Measurement and Application of Dynamic Receiver Class Distributions. Technical Report UW-CS 94-03-05, University of Washington, March 1994.Google Scholar
  21. [Harbison 92]
    Samuel P. Harbison. Modula-3. Prentice Hall, Englewood Cliffs, NJ, 1992.MATHGoogle Scholar
  22. [Hölzle & Ungar 94]
    Urs Hölzle and David Ungar. Optimizing Dynamically-Dispatched Calls with Run-Time Type Feedback. SIGPLAN Notices, 29(6): 326–336, June 1994. In Proceedings of the ACM SIGPLAN’ 94 Conference on Programming Language Design and Implementation.CrossRefGoogle Scholar
  23. [Holzle 94]
    Urs Hölzle. Adaptive Optimization for Self: Reconciling High Performance with Exploratory Programming. PhD thesis, Stanford University, August 1994.Google Scholar
  24. [Johnson 92]
    Ralph Johnson. Documenting Frameworks Using Patterns. In Proceedings OOPSLA’ 92, pages 63–76, October 1992. Published as ACM SIGPLAN Notices, volume 27, number 10.Google Scholar
  25. [Kilian 88]
    Michael F. Kilian. Why Trellis/Owl Runs Fast. Unpublished manuscript, March 1988.Google Scholar
  26. [Lea 90]
    Doug Lea. Customization in C++. In Proceedings of the 1990 Usenix C+ + Conference, San Francisco, CA, April 1990.Google Scholar
  27. [Lim & Stolcke 91]
    Chu-Cheow Lim and Andreas Stolcke. Sather Language Design and Performance Evaluation. Technical Report TR 91-034, International Computer Science Institute, May 1991.Google Scholar
  28. [Linton et al. 89]_M. A. Linton, J. M. Vlissides, and P. R. Calder. Composing User Interfaces with Interviews. IEEE Computer, 2(2):8–22, February 1989.Google Scholar
  29. [Nelson 91]
    Greg Nelson. Systems Programming with Modula-3. Prentice Hall, Englewood Cliffs, NJ, 1991.Google Scholar
  30. [Omohundro 94]
    Stephen Omohundro. The Sather 1.0 Specification. Unpublished manuscript from International Computer Science Institute, Berkeley, CA, 1994.Google Scholar
  31. [Oxhøj et al. 92]_Nicholas Oxhøj, Jens Palsberg, and Michael I. Schwartzbach. Making Type Inference Practical. In O. Lehrmann Madsen, editor, Proceedings ECOOP’ 92, LNCS 615, pages 329–349, Utrecht, The Netherlands, July 1992. Springer-Verlag.Google Scholar
  32. [Palsberg & Schwartzbach 91]
    Jens Palsberg and Michael I. Schwartzbach. Object-Oriented Type Inference. In Proceedings OOPSLA’ 91, pages 146–161, November 1991. Published as ACM SIGPLAN Notices, volume 26, number 11.Google Scholar
  33. [Palsberg & Schwartzbach 94]
    Jens Palsberg and Michael I. Schwartzbach. Object-Oriented Type Systems. John Wiley & Sons, 1994.Google Scholar
  34. [Plevyak & Chien 94]
    John Plevyak and Andrew A. Chien. Precise Concrete Type Inference for Object-Oriented Languages. In Proceedings OOPSLA’ 94, pages 324–340, Portland, Oregon, October 1994.Google Scholar
  35. [Schaffert et al. 85]_Craig Schaffert, Topher Cooper, and Carrie Wilpolt. Trellis Object-Based Environment, Language Reference Manual. Technical Report DEC-TR-372, Digital Equipment Corporation, November 1985.Google Scholar
  36. [Schaffert et al. 86]_Craig Schaffert, Topher Cooper, Bruce Bullis, Mike Killian, and Carrie Wilpolt. An Introduction to Trellis/Owl. In Proceedings OOPSLA’ 86, pages 9–16, November 1986. Published as ACM SIGPLAN Notices, volume 21, number 11.Google Scholar
  37. [Srivastava 92]
    Amitabh Srivastava. Unreachable Procedures in Object-Oriented Programming. ACM Letters on Programming Languages and Systems, 1(4):355–364, December 1992.CrossRefGoogle Scholar
  38. [Stroustrup 91]
    Bjarne Stroustrup. The C+ + Programming Language (second edition). Addision-Wesley, Reading, MA, 1991.Google Scholar
  39. [Szypersky et al. 93]_Clemens Szypersky, Stephen Omohundro, and Stephan Murerzw. Engineering a Programming Language: The Type and Class System of Sather. Technical Report 93-064, International Computer Science Institute, Berkeley, CA, 1993.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1995

Authors and Affiliations

  • Jeffrey Dean
    • 1
  • David Grove
    • 1
  • Craig Chambers
    • 1
  1. 1.Department of Computer Science and EngineeringUniversity of WashingtonSeattleUSA

Personalised recommendations