Iterative type analysis and extended message splitting; optimizing dynamically-typed object-oriented programs

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 and extended 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.

[1]  Mitchell Wand,et al.  Type inference for record concatenation and multiple inheritance , 1989, [1989] Proceedings. Fourth Annual Symposium on Logic in Computer Science.

[2]  Ralph E. Johnson,et al.  A type system for Smalltalk , 1989, POPL '90.

[3]  William D. Clinger,et al.  Revised3 report on the algorithmic language scheme , 1986, SIGP.

[4]  Justin O. Graver,et al.  TS: an optimizing compiler for smalltalk , 1988, OOPSLA 1988.

[5]  V. Rich Personal communication , 1989, Nature.

[6]  D. H. Bartley,et al.  Revised4 report on the algorithmic language scheme , 1991, LIPO.

[7]  Alfred V. Aho,et al.  Compilers: Principles, Techniques, and Tools , 1986, Addison-Wesley series in computer science / World student series edition.

[8]  Peter Buneman,et al.  OOPSLA '89 Conference proceedings on Object-oriented programming systems, languages and applications , 1989 .

[9]  Craig Chambers,et al.  An efficient implementation of SELF, a dynamically-typed object-oriented language based on prototypes , 1989, OOPSLA '89.

[10]  David A. Padua,et al.  Advanced compiler optimizations for supercomputers , 1986, CACM.

[11]  L. Peter Deutsch,et al.  Efficient implementation of the smalltalk-80 system , 1984, POPL.

[12]  Ralph E. Johnson,et al.  Type-checking Smalltalk , 1986, OOPLSA '86.

[13]  David Robson,et al.  Smalltalk-80: The Language and Its Implementation , 1983 .

[14]  Mitchell Wand,et al.  Complete Type Inference for Simple Objects , 1987, LICS.

[15]  Robin Milner,et al.  Definition of standard ML , 1990 .

[16]  Peter Buneman,et al.  Static type inference for parametric classes , 1989, OOPSLA '89.

[17]  Justin O. Graver,et al.  Type checking and type inference for object-oriented programming languages , 1989 .

[18]  Peter Sestoft,et al.  A bibliography on partial evaluation , 1988, SIGP.

[19]  Randall B. Smith,et al.  SELF: The power of simplicity , 1987, OOPSLA '87.

[20]  David Ungar,et al.  The design and evaluation of a high performance Smalltalk system , 1987 .

[21]  Ifor Williams,et al.  The design and evaluation of a high-performance smalltalk system , 1988 .