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

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

[2]  Ralph Johnson,et al.  Type-Checking Smalltalk , 1986, OOPSLA.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[17]  Randall B. Smith,et al.  Self: The power of simplicity , 1987, OOPSLA 1987.