home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / lisp / 2354 < prev    next >
Encoding:
Text File  |  1992-09-01  |  2.4 KB  |  59 lines

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