Xref: utzoo comp.lang.scheme:2123 comp.lang.lisp:4593 comp.lang.smalltalk:2732 Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!samsung!crackers!m2c!umvlsi!dime!dime.cs.umass.edu!moss From: moss@cs.umass.edu (Eliot Moss) Newsgroups: comp.lang.scheme,comp.lang.lisp,comp.lang.smalltalk Subject: Re: implementing an interpreter Message-ID: Date: 13 Mar 91 13:52:37 GMT References: <1991Mar8.153120.19836@tripos.com> Sender: news@dime.cs.umass.edu Reply-To: moss@cs.umass.edu Followup-To: comp.lang.scheme Distribution: comp Organization: Dept of Comp and Info Sci, Univ of Mass (Amherst) Lines: 38 In-reply-to: rick@tripos.com's message of 8 Mar 91 15:31:20 GMT In article <1991Mar8.153120.19836@tripos.com> rick@tripos.com (Rick Moll) writes: I have been thinking a lot about data-structures for implementing a Scheme interpreter, and have the following question: There appears to be two fundamentally different approaches to the design of language interpreters. 1) Make all pointers to objects have a type tag. This is typical in lisp and scheme. 2) Make all pointers to objects be in index into an object table that contains the type information. The object's data may be in the object table for small objects, or point to a data-structure elsewhere for large object types. This is typical in SmallTalk. How about what most modern Smalltalk systems do: 3) Make all pointers to object point to the objects, which have a header that includes the type. Given Ungar's generation scavenging, etc., there has been a move away from object tables towards direct pointers to objects in the heap. You still need pointer/non-pointer tags on the quantities that can be stored in slots (instance variables, etc.), to distinguish small integers (e.g.) from pointers, but in our Smalltalk implementation, all pointers objects have an 8 byte header consisting of the class and some packed information about the format and size of the object. If the object has indexable fields, then there are two more words: a pointer to those fields (which need not be continuous), and the number of indexables (i.e., the size; prepended to the indexables). -- J. Eliot B. Moss, Assistant Professor Department of Computer and Information Science Lederle Graduate Research Center University of Massachusetts Amherst, MA 01003 (413) 545-4206, 545-1249 (fax); Moss@cs.umass.edu