Skip to main content
Log in

Iterative type analysis and extended message splitting: Optimizing dynamically-typed object-oriented programs

  • Published:
LISP and Symbolic Computation

Abstract

Object-oriented languages have suffered from poor performance caused by frequent and slow dynamically-bound procedure calls. The best way to speed up a procedure call is to compile it out, but dynamic binding of object-oriented procedure calls without static receiver type information precludes inlining.Iterative type analysis andextended message splitting are new compilation techniques that extract much of the necessary type information and make it possible to hoist run-time type tests out of loops.

Our system compiles code on-the-fly that is customized to the actual data types used by a running program. The compiler constructs a control flow graph annotated with type information by simultaneously performing type analysis and inlining. Extended message splitting preserves type information that would otherwise be lost by a control-flow merge by duplicating all the code between the merge and the place that uses the information. Iterative type analysis computes the types of variables used in a loop by repeatedly recompiling the loop until the computed types reach a fix-point. Together these two techniques enable our SELF compiler to split off a copy of an entire loop, optimized for the common-case types.

By the time our SELF compiler generates code for the graph, it has eliminated many dynamically-dispatched procedure calls and type tests. The resulting machine code is twice as fast as that generated by the previous SELF compiler, four times faster than ParcPlace Systems Smalltalk-80, the fastest commercially available dynamically-typed object-oriented language implementation, and nearly half the speed of optimized C. Iterative type analysis and extended message splitting have cut the performance penalty for dynamically-typed object-oriented languages in half.

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

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Similar content being viewed by others

References

  1. Aho, A. V., Sethi, R., and Ullman, J. D.Compilers: Principles, Techniques, and Tools. Addison-Wesley, Reading, MA (1986).

    Google Scholar 

  2. Chambers, C., and Ungar, D. Customization: Optimizing Compiler Technology for SELF, a Dynamically-Typed Object-Oriented Programming Language. InProceedings of the SIGPLAN '89 Conference on Programming Language Design and Implementation. Published asSIGPLAN Notices, 24, 7 (1989) 146–160.

    Google Scholar 

  3. Chambers, C., Ungar, D., and Lee, E. An Efficient Implementation of SELF, a Dynamically-Typed Object-Oriented Language Based on Prototypes. InOOPSLA '89 Conference Proceedings. Published asSIGPLAN Notices, 24, 10 (1989) 49–70. Also inLisp and Symbolic Computation, 4, 3 (1991) 243–281.

    Google Scholar 

  4. Deutsch, L. P., and Schiffman, A. M. Efficient Implementation of the Smalltalk-80 System. InProceedings of the 11th Annual ACM Symposium on the Principles of Programming Languages (1984) 297–302.

  5. Goldberg, A., and Robson, D.Smalltalk-80: The Language and Its Implementation. Addison-Wesley, Reading, MA (1983).

    Google Scholar 

  6. Graver, J. O.Type-Checking and Type-Inference for Object-Oriented Programming Languages. Ph.D. thesis, University of Illinois at Urbana-Champaign (1989).

  7. Graver, J. O., and Johnson, R. E. A Type System for Smalltalk. InConference Record of the 17th Annual ACM Symposium on Principles of Programming Languages (1990) 136–150.

  8. Heintz, R. L., Jr.Low Level Optimizations for an Object-Oriented Programming Language. Master's thesis, University of Illinois at Urbana-Champaign (1990).

  9. Hennessy, J. Stanford integer benchmarks. Personal communication (1988).

  10. Johnson, R. E. Type-Checking Smalltalk. InOOPSLA '86 Conference Proceedings. Published asSIGPLAN Notices, 21, 11 (1986) 315–321.

    Google Scholar 

  11. Johnson, R. E., Graver, J. O., and Zurawski, L. W. TS: An Optimizing Compiler for Smalltalk. InOOPSLA '88 Conference Proceedings. Published asSIGPLAN Notices, 23, 11 (1988) 18–26.

    Google Scholar 

  12. Lee, E.Object Storage and Inheritance for SELF, a Prototype-Based Object-Oriented Programming Language. Engineer's thesis, Stanford University (1988).

  13. McConnell, C. D.The Design of the RTL System. Master's thesis, University of Illinois at Urbana-Champaign (1989).

  14. Milner, R., Tofte, M., and Harper, R.The Definition of Standard ML. MIT Press, Cambridge, MA (1990).

    Google Scholar 

  15. Mitchell, J. Personal communication (1989).

  16. Ohori, A., and Buneman, P. Static Type Inference for Parametric Classes. InOOPSLA '89 Conference Proceedings. Published asSIGPLAN Notices, 24, 10 (1989) 445–456.

    Google Scholar 

  17. Padua, D. A., and Wolfe, M. J. Advanced Compiler Optimizations for Supercomputers. InCommunications of the ACM, 29, 12 (1986) 1184–1201.

    Google Scholar 

  18. Rees, J., and Clinger, W., editors.Revised 3 Report on the Algorithmic Language Scheme (1986).

  19. Sestoft, P., and Søndergaard, H. A Bibliography on Partial Evaluation. InSIGPLAN Notices, 23, 2 (1988) 19–27.

    Google Scholar 

  20. Ungar, D. M.The Design and Evaluation of a High-Performance Smalltalk System. Ph.D. thesis, the University of California at Berkeley (1986). Published by the MIT Press, Cambridge, MA (1987).

    Google Scholar 

  21. Ungar, D. A Performance Comparison of C, SELF, and Smalltalk Implementations. Unpublished manuscript (1989).

  22. Ungar, D., and Smith, R. B. SELF: The Power of Simplicity. InOOPSLA '87 Conference Proceedings. Published asSIGPLAN Notices, 22, 12 (1987) 227–241. Also inLisp and Symbolic Computation, 4, 3 (1991) 187–205.

    Google Scholar 

  23. Wand, M. Complete Type Inference for Simple Objects. InProceedings of the 2nd IEEE Symposium on Logic in Computer Science (1987) 37–44.

  24. Wand, M. Type Inference for Record Concatenation and Multiple Inheritance. InProceedings of the 4th IEEE Symposium on Logic in Computer Science (1989) 92–97.

Download references

Author information

Authors and Affiliations

Authors

Additional information

This work has been generously supported by National Science Foundation Presidential Young Investigator Grant #CCR-8657631, and by Sun Microsystems, IBM, Apple Computer, Tandem Computers, NCR, Texas Instruments, the Powell Foundation, and DEC.

This paper was originally published in theProceedings of the ACM SIGPLAN '90 Conference on Programming Language Design and Implementation (SIGPLAN Notices, 25, 6 (1990) 150–160).

Rights and permissions

Reprints and permissions

About this article

Cite this article

Chambers, C., Ungar, D. Iterative type analysis and extended message splitting: Optimizing dynamically-typed object-oriented programs. Lisp and Symbolic Computation 4, 283–310 (1991). https://doi.org/10.1007/BF01806109

Download citation

  • Issue Date:

  • DOI: https://doi.org/10.1007/BF01806109

Keywords

Navigation