Why don't people like lisp?
Brian Downing
see-signature at lavos.net
Wed Oct 22 09:31:25 EDT 2003
In article <zFqlb.746$I04.585 at newsread4.news.pas.earthlink.net>,
Andrew Dalke <adalke at mindspring.com> wrote:
> > And for grins here's the x86 machine code generated for the first
> > function:
>
> I was never any good at Intel assembly, and I thankfully haven't
> touched it in about 15 years. I was trying to figure out if it
> optimized the additions into 15**a, but I could see neither the
> sequence 1, 2, 3, 4, 5 nor the value 15 (octal 17, hex F) anywhere
> in the code. Pointers?
It did indeed optimize the constants. What you're missing is that in
most implementations Lisp fixnums are tagged so that they can fit in a
descriptor slot by themselves and not be boxed in more structure. In
almost all (x86) implementations I've seen a fixnum is 30 high bits of
signed number and 2 low bits of zero.
If a value has a non-zero low tag than it is something else like a
pointer, and not a fixnum.
These fixnums have the property that you can add two of them and get a
third with no shifting at all, and to multiply, you only need to shift
one of them.
So the number you're looking for is 60, which is 15 << 2.
47: 8b 5e 1e movl ebx,[esi+30] ; EXPT
50: 33 c0 xorl eax,eax
52: b0 3c movb al,$60
54: ff 57 27 call *[edi+39] ; SYS::TRAMP-TWO
-bcd
--
*** Brian Downing <bdowning at lavos dot net>
More information about the Python-list
mailing list