Reflection/built-in assemblers
Henry G. Baker
hbaker@netcom.com
Sun, 11 May 1997 21:54:44 -0700 (PDT)
I've been following the 'reflection' thread with some interest,
because I agree with the goals of this approach. That's pretty much
what the Lisp Machines did--they were programmed in Lisp, but
introspected all the way down to the hardware. For example, many of
the 'hard cases' of the machine instructions trapped so that they
could be handled _in Lisp_!
I would suggest that the way to get bootstrapped is to first write an
excellent native Lisp cross-compiler which handles 'basic' Lisp --
that part of Lisp that is necessary to write the compiler itself and
most of the OS -- but is considerably smaller than Common Lisp. By
having access to the compiler and having complete control over the
code generated, you are in a position to make sure that _important
optimizations get done in the right place -- in the compiler --
instead of having to constantly fight the compiler and be forced to
program in machine language or use 'sub-primitives'.
This isn't as big of a job as you might think, since basic Lisp is
really a pretty small language. I woul recommend reading the papers
about the Lucid Lisp compiler, which had some very interesting ideas
about how to organize the compilation. In particular, they kept
things into Lisp form until just before code generation, and went so
far as to put functions into a form like:
(lambda (r1 r2 r3) ...)
where r1, r2, r3, were the actual registers to be used in the compiled
code.
--
Henry Baker
www/ftp directory URL:
ftp://ftp.netcom.com/pub/hb/hbaker/home.html