From: Stefan Kain <smk@us...> - 2002-11-03 04:21:28
Hi Sam (and everybody else),
I have hand-compiled a test example and would like to make it accessible
my first example looks like this:
C_mal(2,args_end_pointer STACKop 2);
Following the instructions in the impnotes yields strange compilation
errors in spvwd.d etc:
- I add square to subr.d, constsym.d init.lisp etc.
square itself compiles without problems.
But I do not get to the point where an image including SQUARE is
But anyway, the described solution in the impnotes would work only
statically. In a running system, I want to create a square.o and link it
to the current program (on a C-runtime level so to speak).
Furthermore I have to introduce it to the LISP runtime system.
There are quite a few problems that I have with compiling real closures.
How to represent the bound variables in the closure?
The struct Cclosure does not help a lot, because it is based on object
pointers. I cannot write an object pointer that is only valid in the
lisp image at runtime to a C-file... So I have to emit code that does
some kind of symbol maintainance ...
My basic strategy for bytecode-compilation seems to work, but there
are a lot of details I am even not yet aware of now! :-(
Lots of the semantics in interpret_bytecode_ has to be tackled
differently in a compiled C-function.
That is why the stuff that I have written so far is currently
- I can excerpt the bytecode implementations from eval.d into
emitter-functions automatically. But using these definitions literally
does not work. I have to rewrite the code snippets for each bytecode
in order to adapt them the "compiled context". Doing this manually is
tedious. So I am currently working on a automated way of turning the
"interpreter spec" (the famous switch-statement in interpret_bytecode)
into something that can be used for compilations. (In theory this
is simple. So I encounter the difference between theory and practice,
My questions so far:
linking an object file is not enough. I have to introduce it to the
LISP-runtime. I have to find out how to create/update the symbol SQUARE,
update its function slot and somehow get a connection to the object code
in square.o (???).
BTW, I am not a systems programmer. Does anybody remember the calls
related to shared objects, that you use to read a library (shared
object) and get a function pointer to the C-symbol that you have
supplied, at runtime. I can't remember...