[movitz-devel] Self-referential functions

Chris Capel chris at iBankTech.NET
Fri Mar 19 03:55:37 UTC 2004

Ahh!  I saw the definitions of things like cons and cdr and car that
were defined using the assembly macros, and I understood those.  I sort
of understood the defmacro macro.  The piece I was missing was that the
first compiler *directly* translated certain operators, like eq.  But
wait, doesn't it do the same for car?  Why do you need an assembly
definition of car and cdr but not eq?

Ugh.  Let my try to sort this out.  Movitz has facilities for directly
manipulating bits and bytes (binary-types package).  Upon these, it
builds facilities for translating x86 assembly into the binary opcodes
(ia-x86 package).  It defines basic operators in terms of these.  But it
doesn't need to define eq in binary?

Oh, wait it does.  I was just looking in the wrong place.  In
movitz/losp/muerte/basic-macros.lisp, eq is defined as a compiler
macro.  It's just that its defun is in equalp.lisp.  Ha!

So everything is defined, in the first compiler's lisp, down to the bit
and byte level.  In movitz/image.lisp, there resides code to make a
binary bootable image out of all this.  Its job is basically to expand
the lisp code into assembly and then into binary machine language. Once
this expansion is performed, you have defined the second, bootable,

I think I'm getting this, but please someone correct me if I got
something backwards.

Chris Capel

-----Original Message-----
From: Nyef [mailto:nyef at softhome.net]
Sent: Thu 3/18/2004 8:31 PM
To: Chris Capel
Cc: movitz-devel at common-lisp.net
Subject: Re: [movitz-devel] Self-referential functions
The compiler knows how to open-code the function eq, that is,
it will turn a reference to eq into the equivalent machine code
inline. But you still need the function object to exist so that
it can be funcalled, grabbed with symbol-function, function,
etc. So what the definition does is tell the compiler to make a
function object, called eq, that performs the eq operation. RPG
mentions this same thing in Patterns Of Software about the Lisp
implementation that his company wrote.

--Alastair Bridgewater

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/movitz-devel/attachments/20040318/e8e40ddb/attachment.html>

More information about the movitz-devel mailing list