Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 598 Scripting Languages Design and Implementation 13. The Deutsch-Schiffman Smalltalk- 80 Implementation.

Similar presentations


Presentation on theme: "CS 598 Scripting Languages Design and Implementation 13. The Deutsch-Schiffman Smalltalk- 80 Implementation."— Presentation transcript:

1 CS 598 Scripting Languages Design and Implementation 13. The Deutsch-Schiffman Smalltalk- 80 Implementation

2 Main references [Kras83] Glenn Krasner (Ed.). Smalltalk-80: Bits of History, Words of Advice. Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA.1983. [DesC84] L. Peter Deutsch and Allan M. Schiffman. 1984. Efficient implementation of the smalltalk-80 system. In Proceedings of the 11th ACM SIGACT-SIGPLAN symposium on Principles of programming languages (POPL '84). ACM, New York, NY, USA, 297-302. Keith Cooper’s slides: – http://www.cs.rice.edu/~keith/512/2 011/Lectures/L28ST80-1up.pdf 2

3 The Smalltalk-80 system Goal: acceptable performance on conventional machines. Earlier implementation on the Xerox Dorado machine: – The Xerox Alto is one of the first personal computers (a term that was already coined at the time), a general purpose computer designed for individual use (although not as a home computer). However it was expensive and, unlike modern personal computers, not based on a microprocessor. – After the Alto, PARC developed more powerful workstations informally termed "the D-machines": Dandelion (least powerful, but the only to be made a product in one form), Dolphin; Dorado (most powerful; an ECL machine); and hybrids like the Dandel-Iris. – The Dorado implementation used the Alto instruction set and extended it with microcode implementation of the Smalltalk virtual machine. “Keep the Alto macroinstruction set; implement the Smalltalk-80virtual machine mostly in microcode, and the remainder in Alto Code”[Kras83] 3

4 4

5 5

6 Code translation The compiler translates Smalltalk code to v- code (virtual machine code that we called bytecode earlier). V-code is good for three reasons: – It is an intermediate representation so that we don’t need a compiler for each target machine. – It is more compact than machine code. – Tools to examine the machine state (which in this approach is the virtual machine) during execution become protable 6

7 Code translation V-code has performance problems – No hardware interpreter (unless implementers write a microprogramming). – Architecture difference from the traget machine (e.g. stack vs. registers). – The virtual machine specification requires expensive operations. The article mentions the need to performan reference counting operations everytime a varaible value is pushed onto the stack. 7

8 Code translation Instead of using threaded code to implement an interpreter, the system dynamically translated the v-code onto n-code (native code). They do more than just macro expanding each v-code instruction. 8

9 Code translation The system always compiles before execution. They credit “B. Ramakrishna Rau. 1978. Levels of representation of programs and the architecture of universal host machines. In Proceedings of the 11th annual workshop on Microprogramming (MICRO 11). IEEE Press, Piscataway, NJ, USA, 67-79” with the idea of dynamic translation. 9

10 10

11 11 “the only code that can directly access the parts of an object requiring mapping is code associated with that object’s class

12 12

13 13 Block contexts are

14 14

15 Hashing formulas for single mehtod cache (from [Kras83]) 15

16 Type prediction For a few special selectors like +, the translator generates in-line code for the common case along with the standard send code. For example. + generates a class check to verity that both argnments are small integers, native code for integer addition, and an overflow check on the result. If any of the checks fail, the send code is executed. This is a space-time tradeoff justified by measurements that indicate that the overwhelming majority ofarithmetic operations involve only small integers, even thoughthey are (in principle) polymorphic like all other operations inthe language. 16

17 17 ([Kras83])

18 18


Download ppt "CS 598 Scripting Languages Design and Implementation 13. The Deutsch-Schiffman Smalltalk- 80 Implementation."

Similar presentations


Ads by Google