Greetings! Just a note that my local autorecompiling self-build of gcl compiles maxima now with autorecompiling disabled. There is yet one other portable source issue of particular pathology in the maxima source -- special variables. Variables with names like 'w and 'm are made special in the middle of source files, then made unspecial after several defuns. This foils naive recompilation.
The sketches of a more readable portable source function could go like this: (defun portable-source (form) (if (atom form) form (case (car form) ((let let* lambda) `(,(car form) ,(mapcar (lambda (x) (if (atom x) x `(,(car x) ,(portable-source (cadr x))))) (cadr form)) ,@(let ((r (remove-if-not 'si::specialp (mapcar (lambda (x) (if (atom x) x (car x))) (cadr form))))) (when r `((declare (special ,@r))))) ,@(portable-source (cddr form)))) ((quote declare function) form) (the `(,(car form) ,(cadr form) ,@(portable-source (cddr form)))) ((flet labels macrolet) `(,(car form) ,(mapcar (lambda (x) `(,(car x) ,@(cdr (portable-source `(lambda ,@(cdr x)))))) (cadr form)) ,@(portable-source (cddr form)))) (otherwise (let* ((fd (and (symbolp (car form)) (or (get (car form) 'si::compiler-macro-prop) (macro-function (car form))))) (form (if fd (cmp-expand-macro fd (car form) (cdr form)) form))) (cons (portable-source (car form)) (portable-source (cdr form)))))))) (defun pd (form) (let ((*macroexpand-hook* (lambda (fn form env) (print (list fn form env)) (cond ((some #'(lambda (x) (get (car form) x)) '(c1special co1special)) form) ((let ((ff (get (car form) 'si::compiler-macro-prop))) (when ff (let ((fd ((funcall ff form nil)))) (unless (eq form fd) fd))))) ((some #'(lambda (x) (get (car form) x)) '(co1 c1 c1g c1conditional)) form) ((funcall *macroexpand-hook* fn form nil)))))) (portable-source form))) Here we put in the specials as declarations, but now realize that we must expand all macros (not just eval-when-compile) as one never knows when one might produce a binding form binding an apparent lexical which is actually a temporary maxima special. The downside here is that one must reproduce much of the logic in pass1. Some macros are compiled (hopefully more optimally) by preempting macroexpansion with more customized code (e.g. multiple-value-bind). So this brings up the idea of using the output of pass1 as the portable source. This looks like (LAMBDA #S(INFO TYPE T SP-CHANGE NIL VOLATILE NIL CHANGED-ARRAY #() REFERRED-ARRAY #(#S(VAR NAME QQ KIND SPECIAL REF T REF-CCB NIL LOC 0 DT T TYPE T MT T TAG NIL REGISTER 2 DYNAMIC 0))) ((#S(VAR NAME QQ KIND SPECIAL REF T REF-CCB NIL LOC 0 DT T TYPE T MT T TAG NIL REGISTER 2 DYNAMIC 0)) NIL NIL NIL NIL NIL) NIL (MULTIPLE-VALUE-BIND #S(INFO TYPE T SP-CHANGE NIL VOLATILE NIL CHANGED-ARRAY #() REFERRED-ARRAY #(#S(VAR NAME QQ KIND SPECIAL REF T REF-CCB NIL LOC 0 DT T TYPE T MT T TAG NIL REGISTER 2 DYNAMIC 0))) (#S(VAR NAME WW KIND SPECIAL REF NIL REF-CCB NIL LOC 1 DT T TYPE T MT T TAG NIL REGISTER 0 DYNAMIC 0)) (VAR #S(INFO TYPE T SP-CHANGE NIL VOLATILE NIL CHANGED-ARRAY #() REFERRED-ARRAY #(#S(VAR NAME QQ KIND SPECIAL REF T REF-CCB NIL LOC 0 DT T TYPE T MT T TAG NIL REGISTER 2 DYNAMIC 0))) (#S(VAR NAME QQ KIND SPECIAL REF T REF-CCB NIL LOC 0 DT T TYPE T MT T TAG NIL REGISTER 2 DYNAMIC 0) NIL)) (VAR #S(INFO TYPE T SP-CHANGE NIL VOLATILE NIL CHANGED-ARRAY #() REFERRED-ARRAY #(#S(VAR NAME QQ KIND SPECIAL REF T REF-CCB NIL LOC 0 DT T TYPE T MT T TAG NIL REGISTER 2 DYNAMIC 0))) (#S(VAR NAME QQ KIND SPECIAL REF T REF-CCB NIL LOC 0 DT T TYPE T MT T TAG NIL REGISTER 2 DYNAMIC 0) NIL)))) for (defun foo (qq) (declare (special qq)) (multiple-value-bind (ww) qq (declare (special ww)) qq)) for example. We will have to print with some #= sharing, as the var structures must be eq when approppriate, for example. And we will have to provide some hook into compile-file1 to skip pass1 and go straight to pass2, hopefully automatically. Would also be nice to write this in the fasd-data format which should not be too hard, and store such as strings in the running image as Bob suggested. Although this redesign is more work, it sounds better and worth the trouble, but I thought I'd solicit consultation on this point. Take care, -- Camm Maguire [EMAIL PROTECTED] ========================================================================== "The earth is but one country, and mankind its citizens." -- Baha'u'llah _______________________________________________ Gcl-devel mailing list Gcl-devel@gnu.org http://lists.gnu.org/mailman/listinfo/gcl-devel