Path: utzoo!mnetor!uunet!husc6!think!barmar From: barmar@think.COM (Barry Margolin) Newsgroups: comp.lang.lisp Subject: Re: GC and time critical code? (use of numbers) Message-ID: <20045@think.UUCP> Date: 20 Apr 88 03:03:37 GMT References: <452@cvaxa.sussex.ac.uk> <5243@sdcrdcf.UUCP> Sender: usenet@think.UUCP Reply-To: barmar@fafnir.think.com.UUCP (Barry Margolin) Organization: Thinking Machines Corporation, Cambridge, MA Lines: 44 Keywords: GC, time-critical, number representation, Poplog In article <5243@sdcrdcf.UUCP> darrelj@sdcrdcf.UUCP (Darrel VanBuer) writes: >Implementation SMALLP FIXP BIGNUM >============== ====== ==== ====== Symbolics 3600 32 bits no yes >I have also seen a few implementations with NO smallp. It probably simplifies the implementation if you don't have to decide at runtime whether to dereference a pointer or not. >Commonlisp only talks of FIXNUM and BIGNUM, but discourages knowing the >dividing line since it is unportable (though it suggests that fixnums should >provide at least 16 bits), and is even vague about how much of an efficiency >difference there is (or how you would split up the three catagories into the >two Commonlisp sets). Common Lisp seems to consider that the important difference between FIXNUM and BIGNUM is the speed of the arithmetic. In this case, the difference between SMALLP and FIXP is not great, because both can generally use hardware arithmetic instructions; FIXP just requires an extra indirection first. BIGNUM arithmetic is generally implemented using subroutines (or, in the case of some Lisp Machines, microcode). If speed is what you care about, FIXNUM = SMALLP U FIXP. The other distinction, storage efficiency, can also be important; that's what this whole discussion started with. Unfortunately, the Lisp implementations that most CL designers came from didn't have FIXPs, so they didn't include this distinction in the language. They were used to implementations of SMALLP that were close enough to the word size that it didn't pay to have another one-word integer type. A common way of implementing SMALLP in a typed-pointer Lisp is to include some of the bits that would ordinarily be type bits in the integer, by specifying that if the first N bits (where N is often 2) of the type code are all 0 or all 1 the object is a SMALLP and the rest of the bits of the type code are actually the high-order bits of the number. This allows SMALLP's to get very large without forcing type codes to be too small. Barry Margolin Thinking Machines Corp. barmar@think.com uunet!think!barmar