home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.lisp
- Path: sparky!uunet!cis.ohio-state.edu!news.sei.cmu.edu!fs7.ece.cmu.edu!crabapple.srv.cs.cmu.edu!ram
- From: ram+@cs.cmu.edu (Rob MacLachlan)
- Subject: Re: What do compilers optimize?
- Message-ID: <Btwr6D.3E0.1@cs.cmu.edu>
- Sender: news@cs.cmu.edu (Usenet News System)
- Nntp-Posting-Host: lisp-pmax1.slisp.cs.cmu.edu
- Organization: School of Computer Science, Carnegie Mellon
- References: <7398@skye.ed.ac.uk> <17tvm1INNqdc@early-bird.think.com>
- Date: Tue, 1 Sep 1992 16:30:08 GMT
- Lines: 46
-
- >>Are there any implementations that do any of the following (or
- >>something similar):
- >>
- >> * Turn a CASE in which the alternatives are integers into
- >> an indirect transfer?
- >
- >Surprisingly, CMUCL doesn't do this optimization at all.
-
- Yeah, it's on our list. The utility of this optimization is reduced
- somewhat in Lisp due to the tendency to represent "enumerations" as
- symbols, but if the programmer goes to the trouble of using integers
- (as in the byte-interpreter example), then we really ought to generate
- a jump-table.
-
- >
- >> * Use hashing for a CASE with many alternatives?
- >
- >Neither Symbolics, Lucid, nor CMUCL appear to do this.
-
- It's a possibility I never thought of, which could be used to handle
- CASE'ing off of symbols. One approach would be to figure out a
- perfect hashing function at compile time (based on the symbol's equal
- hash, stored in the symbol). This hash could be used as an index into
- a jump table, and each table entry would only need to do an EQ test to
- verify that the symbol is correct, branching off to the OTHERWISE case
- if there is a mismatch.
-
- >
- >> * Allow fixnums (or floats) to be passed between procedures without
- >> any heap allocations (maybe just for local procedures in the same
- >> top-level form)?
-
- As Barmar says, in all the modern implementations I know of, fixnums
- are "immediate", and don't need to be heap-allocated. [This
- terminology is confusing, since it is unrelated to the concept of an
- immediate operand to an instruction.]
-
- Within a block compilation unit, CMU CL supports non-consing register
- passing of ([un]signed-byte 32), single-float and double-float values
- as function arguments and return values. CMU has START-BLOCK and
- END-BLOCK proclamations which can delimit a compilation block smaller
- than a file; entire files or multiple files can also be block
- compiled. The size of a block compilation is limited only by the
- amount of memory needed for compilation.
-
- Robert A. MacLachlan (ram@cs.cmu.edu)
-