[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
If DEFINITION is NIL, NAME must be the name of a not-yet-compiled function. In this case, COMPILE compiles the function, installs the compiled function as the global function definition of NAME, and returns NAME. If DEFINITION is non-NIL, it must be a lambda expression and NAME must be a symbol. COMPILE compiles the lambda expression, installs the compiled function as the function definition of NAME, and returns NAME. There is only one exception for this: If NAME is NIL, then the compiled function is not installed but is simply returned as the value of COMPILE. In any case, COMPILE creates temporary files whose filenames are "gazonk***". By default, i.e. if :LEAVE-GAZONK is not supplied or is NIL, these files are automatically deleted after compilation.
On systems where dlopen is used for relocations, one cannot make custom images containing loaded binary object files simply by loading the files and executing save-system. This function is provided for such cases.
After compiling source files into objects, LINK can be called with a list of binary and source FILES which would otherwise normally be loaded in sequence before saving the image to IMAGE. LINK will use the system C linker to link the binary files thus supplied with GCL's objects, using EXTRA-LIBS as well if provided, and producing a raw_IMAGE executable. This executable is then run to initialize first GCL's objects, followed by the supplied files, in order, if RUN-USER-INIT is set. In such a case, source files are loaded at their position in the sequence. Any optional code which should be run after file initialization can be supplied in the POST variable. The image is then saved using save-system to IMAGE.
This method of creating lisp images may also have the advantage that all new object files are kept out of the lisp core and placed instead in the final image's .text section. This should in principle reduce the core size, speed up garbage collection, and forego any performance penalty induced by data cache flushing on some machines.
In both the RAW and SAVED image, any calls to LOAD binary object files which have been specified in this list will bypass the normal load procedure, and simply initialize the already linked in module. One can rely on this feature by disabling RUN-USER-INIT, and instead passing the normal build commands in POST. In the course of executing this code, binary modules previously linked into the .text section of the executable will be initialized at the same point at which they would have normally been loaded into the lisp core, in the executable's .data section. In this way, the user can choose to take advantage of the aforementioned possible benefits of this linking method in a relatively transparent way.
All binary objects specified in FILES must have been compiled with :SYSTEM-P set to T.
Syntax:
(eval-when ({situation}*) {form}*) |
A situation must be either COMPILE, LOAD, or EVAL. The interpreter evaluates only when EVAL is specified. If COMPILE is specified, FORMs are evaluated at compile time. If LOAD is specified, the compiler arranges so that FORMs be evaluated when the compiled code is loaded.
Compiles the file specified by INPUT-PATHNAME and generates a fasl file specified by OUTPUT-FILE. If the filetype is not specified in INPUT-PATHNAME, then ".lsp" is used as the default file type for the source file. :LOAD specifies whether to load the generated fasl file after compilation. :MESSAGE-FILE specifies the log file for the compiler messages. It defaults to the value of the variable COMPILER:*DEFAULT-MESSAGE-FILE*. A non-NIL value of COMPILER::*COMPILE-PRINT* forces the compiler to indicate the form currently being compiled. More keyword parameters are accepted, depending on the version. Most versions of GCL can receive :O-FILE, :C-FILE, :H-FILE, and :DATA-FILE keyword parameters, with which you can control the intermediate files generated by the GCL compiler. Also :C-DEBUG will pass the -g flag to the C compiler.
By top level forms in a file, we mean the value of *top-level-forms* after doing (TF form) for each form read from a file. We define TF as follows:
(defun TF (x) (when (consp x) (setq x (macroexpand x)) (when (consp x) (cond ((member (car x) '(progn eval-when)) (mapcar 'tf (cdr x))) (t (push x *top-level-forms*))))))
Among the common lisp special forms only DEFUN and DEFMACRO will cause actual native machine code to be generated. The rest will be specially treated in an init section of the .data file. This is done so that things like putprop,setq, and many other forms would use up space which could not be usefully freed, if we were to compile to native machine code. If you have other `ordinary' top level forms which you need to have compiled fully to machine code you may either set compiler::*COMPILE-ORDINARIES* to t, or put them inside a
(PROGN 'COMPILE ...forms-which-need-to-be-compiled)
The compiler will take each of them and make a temporary function which will be compiled and invoked once. It is permissible to wrap a (PROGN 'COMPILE ..) around the whole file. Currently this construction binds the compiler::*COMPILE-ORDINARIES* flag to t. Setting this flag globally to a non nil value to cause all top level forms to generate machine code. This might be useful in a system such as PCL, where a number of top level lambda expressions are given. Note that most common lisps will simply ignore the top level atom 'compile, since it has no side effects.
Defentry, clines, and defcfun also result in machine code being generated.
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |