Abstract
We have developed and implemented techniques that double the performance of dynamically-typed object-oriented languages. Our SELF implementation runs twice as fast as the fastest Smalltalk implementation, despite SELF's lack of classes and explicit variables.
To compensate for the absence of classes, our system uses implementation-levelmaps to transparently group objects cloned from the same prototype, providing data type information and eliminating the apparent space overhead for prototype-based systems. To compensate for dynamic typing, user-defined control structures, and the lack of explicit variables, our system dynamically compilesmultiple versions of a source method, eachcustomized according to its receiver's map. Within each version the type of the receiver is fixed, and thus the compiler can statically bind andinline all messages sent toself.Message splitting andtype prediction extract and preserve even more static type information, allowing the compiler to inline many other messages. Inlining dramatically improves performance and eliminates the need to hard-wire low-level methods such as+, ==, andifTrue:.
Despite inlining and other optimizations, our system still supports interactive programming environments. The system traverses internal dependency lists to invalidate all compiled methods affected by a programming change. The debugger reconstructs inlined stack frames from compiler-generated debugging information, making inlining invisible to the SELF programmer.
Similar content being viewed by others
References
Atkinson, R. G. Hurricane: An Optimizing Compiler for Smalltalk. InOOPSLA '86 Conference Proceedings. Published asSIGPLAN Notices, 21, 11 (1986) 151–158.
Ballard, M. B., Maier, D., and Wirfs-Brock, A. QUICKTALK: A Smalltalk-80 Dialect for Defining Primitive Methods. InOOPSLA '86 Conference Proceedings. Published asSIGPLAN Notices, 21, 11 (1986) 140–150.
Bobrow, D. G., DeMichiel, L. G., Gabriel, R. P., Keene, S. E., Kiczales, G., and Moon, D. A. Common Lisp Object System Specification. Published asSIGPLAN Notices, 23, 9 (1988).
Borning, A. H. Classes Versus Prototypes in Object-Oriented Languages. InProceedings of the ACM/IEEE Fall Joint Computer Conference (1986) 36–40.
Borning, A. H., and Ingalls, D. H. H. A type declaration and inference system for Smalltalk. InConference Record of the Ninth Annual Symposium on Foundations of Computer Science (1982) 133–139.
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.
Chambers, C., and Ungar, D. Iterative Type Analysis and Extended Message Splitting: Optimizing Dynamically-Typed Object-Oriented Programs. InProceedings of the ACM SIGPLAN '90 Conference on Programming Language Design and Implementation. Published asSIGPLAN Notices, 25, 6 (1990) 150–162. Also inLisp and Symbolic Computation, 4, 3 (1991) 283–310.
Curtis, P. Type inferencing in Smalltalk. Personal communication (1989).
Deutsch, L. P. The Dorado Smalltalk-80 Implementation: Hardware Architecture's Impact on Software Architecture. In Krasner, G., editor,Smalltalk-80: Bits of History, Words of Advice, Addison-Wesley, Reading, MA (1983) 113–126.
Deutsch, L. P. Richards benchmark. Personal communication (1988).
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.
Goldberg, A., and Robson, D.Smalltalk-80: The Language and Its Implementation. Addison-Wesley, Reading, MA (1983).
Hennessy, J. Stanford integer benchmarks. Personal communication (1988).
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.
LaLonde, W. R., Thomas, D. A., and Pugh, J. R. An Exemplar Based Smalltalk. InOOPSLA '86 Conference Proceedings. Published asSIGPLAN Notices, 21, 11 (1986) 322–330.
Lee, E.Object Storage and Inheritance for SELF, a Prototype-Based Object-Oriented Programming Language. Engineer's thesis, Stanford University (1988).
Lieberman, H. Using Prototypical Objects to Implement Shared Behavior in Object-Oriented Systems. InOOPSLA '86 Conference Proceedings. Published asSIGPLAN Notices, 21, 11 (1986) 214–223.
McCall, K. The Smalltalk-80 Benchmarks. In Krasner, G., editor,Smalltalk-80: Bits of History, Words of Advice, Addison-Wesley, Reading, MA (1983) 153–174.
Meyer, B. Genericity versus Inheritance. InOOPSLA '86 Conference Proceedings. Published asSIGPLAN Notices, 21, 11 (1986) 391–405.
Moon, D. A. Object-Oriented Programming with Flavors. InOOPSLA '86 Conference Proceedings. Published asSIGPLAN Notices, 21, 11 (1986) 1–16.
Namjoo, M., Agrawal, A., Jackson, D. C., and Quach, L. CMOS Gate Array Implementation of the SPARC Architecture. InCOMPCON '88 Conference Proceedings (1988) 10–13.
ParcPlace Systems.ParcPlace Newsletter (Winter 1988), 1, 2 (1988).
Schaffert, C., Cooper, T., Bullis, B., Kilian, M., and Wilpolt, C. An Introduction to Trellis/Owl. InOOPSLA '86 Conference Proceedings. Published asSIGPLAN Notices, 21, 11 (1986) 9–16.
Steele, G. L., Jr. LAMBDA: The Ultimate Declarative. AI Memo 379, MIT Artificial Intelligence Laboratory (1976).
Steele, G. L., Jr., and Sussman, G. J. LAMBDA: The Ultimate Imperative. AI Memo 353, MIT Artificial Intelligence Laboratory (1976).
Stein, L. A. Delegation Is Inheritance. InOOPSLA '87 Conference Proceedings. Published asSIGPLAN Notices, 22, 12 (1987) 138–146.
Stroustrup, B.The C++ Programming Language. Addison-Wesley, Reading, MA (1986).
Suzuki, N. Inferring Types in Smalltalk. In8th Annual ACM Symposium on Principles of Programming Languages (1981) 187–199.
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).
Ungar, D., and Jackson, F. Tenuring Policies for Generation-Based Storage Reclamation. InOOPSLA '88 Conference Proceedings. Published asSIGPLAN Notices, 23, 11 (1988) 1–17.
Ungar, D., and Smith, R. B. SELF: The Power of Simplicity. In Simplicity. InOOPSLA '87 Conference Proceedings. Published asSIGPLAN Notices, 22, 12 (1987) 227–241. Also inLisp and Symbolic Computation, 4, 3 (1991) 187–205.
Wegner, P. Dimensions of Object-Based Language Design. InOOPSLA '87 Conference Proceedings. Published asSIGPLAN Notices, 22, 12 (1987) 168–182.
Author information
Authors and Affiliations
Additional information
This work has been generously supported by National Science Foundation Presidential Young Investigator Grant #CCR-8657631, and by IBM, Texas Instruments, NCR, Tandem Computers, Apple Computer, and Sun Microsystems.
This paper was originally published inOOPSLA '89 Conference Proceedings (SIGPLAN Notices, 25, 10 (1989) 49–70).
Rights and permissions
About this article
Cite this article
Chambers, C., Ungar, D. & Lee, E. An efficient implementation of SELF, a dynamically-typed object-oriented language based on prototypes. Lisp and Symbolic Computation 4, 243–281 (1991). https://doi.org/10.1007/BF01806108
Issue Date:
DOI: https://doi.org/10.1007/BF01806108