Towards a Universal Implementation Substrate for Object-Oriented Languages

Self is a minimalist object-oriented language with a sophisticated implementation that utilizes adaptive optimization. We have built implementations of Smalltalk and Java by translation to Self. These implementations were much easier to construct in Self than by conventional means, and perform surprisingly well (competitively with conventional, commercial implementations). This leads us to believe that a Self-like system may form the basis of a universal substrate for implementation of object-oriented languages. This paper was presented at the OOPSLA 99 workshop on Simplicity, Performance and Portability in Virtual Machine Design, Denver, CO, Nov 2, 1999. 1 Building virtual machines is hard Building a high-performance virtual machine (VM) for an object-oriented language such as Smalltalk or JavaTM 2 is a major undertaking. The conventional approach has been to hand-craft the entire VM in a systems language such as C or C++. The low-level access afforded by such a language, compared to using a higher level language, enables an efficient implementation of necessary components, such as a garbage collector, bytecode interpreter, dynamic compiler, and object storage system. Access to the hardware is important because many central data structures and algorithms must be tightly coded if the resulting VM is to perform well and use memory efficiently. Details such as object layout, inner loops of the garbage collector, and code sequences emitted by a dynamic compiler, must all be well tuned for maximum performance. C and C++ serve the role of “structured assembly language” in these cases, because the code emitted by optimizing C and C++ compilers is predictable and efficient. Performance of certain sections of code, such as the message dispatch sequence, is so critical that in some circumstances even these languages are not suitable, and hand-crafted machine code sequences are used to squeeze the last drop of efficiency from the machine. Hand-crafting a VM in this way is very laborious. The efficiency gained by using C or C++ is at the cost of security; array accesses are not checked to see whether they are within bounds, errors in memory management can lead to memory leaks or dangling pointers, and unchecked type coercions can result in erroneous accesses. A high-performance VM will contain many tens of thousands of lines of source code (e.g., the Self VM 1. Correspondence may be addressed to the first author at: MS UMTV29-117, 2550 Garcia Ave., Mountain View, CA 94043, U.S.A. 2. Sun, Sun Microsystems, Java, JavaSoft and JDK are trademarks or registered trademarks of Sun Microsystems Inc. in the US and other countries. SPARC, UltraSPARC and SPARCstation are trademarks or registered trademarks of SPARC International, Inc. in the US and other countries Sun Labs document #96-0506

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

[2]  David M. Ungar,et al.  Generation Scavenging: A non-disruptive high performance storage reclamation algorithm , 1984, SDE 1.

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

[4]  Adele Goldberg,et al.  SmallTalk 80: The Language , 1989 .

[5]  簡聰富,et al.  物件導向軟體之架構(Object-Oriented Software Construction)探討 , 1989 .

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

[7]  Craig Chambers,et al.  Debugging optimized code with dynamic deoptimization , 1992, PLDI '92.

[8]  Ole Lehrmann Madsen,et al.  Object-oriented programming in the BETA programming language , 1993 .

[9]  Bjørn N. Freeman-Benson,et al.  Multi‐way versus one‐way constraints in user interfaces: Experience with the deltablue algorithm , 1993, Softw. Pract. Exp..

[10]  Ivan Moore,et al.  Babel - A Translator from Smalltalk into CLOS , 1994 .

[11]  Urs Hölzle,et al.  Adaptive optimization for self: reconciling high performance with exploratory programming , 1994 .

[12]  John Maloney,et al.  The Self-4.0 user interface: manifesting a system-wide vision of concreteness, uniformity, and flexibility , 1995, OOPSLA 1995.

[13]  Ole Agesen Design and Implementation of Pep, A Java Just-in-Time Translator , 1997, Theory Pract. Object Syst..