gcl-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gcl-devel] autoproclamation


From: Camm Maguire
Subject: [Gcl-devel] autoproclamation
Date: 02 Jun 2006 14:30:25 -0400
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

Greetings!  Got it!  (eureka?)  maxima now passes all tests
auto-recompiling at each file load any functions which call others
that have changed signature.  The portable-source idea I wrote about
earlier (using pass1 output) didn't work for several reasons (the
typing is already done, including any branch elimination warranted
thereby, etc. .i.e. there is no simple way to adjust the compiler
output for new function typeing information alone.)

Here is my 'portable-source' function now -- we capture

        a) compile-time macros
        b) special variable bindings
        c) compile-time safety proclamations

These to my understanding are the only compile-time environment
variables which affect the compiler output (Anyone know of others?):

(defun portable-source (form &optional cdr)
  (cond ((atom form) form)
        (cdr (cons (portable-source (car form)) (portable-source (cdr form) t)))
        ((case (car form)
               ((let let* lambda) 
                `(,(car form) 
                  ,(mapcar (lambda (x) (if (atom x) x `(,(car x) 
,@(portable-source (cdr x) t)))) (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)))))
                  ,@(ndbctxt (portable-source (cddr form) t))))
               ((quote function) form)
               (declare 
                (let ((opts (mapcan 'cdr 
                                    (remove-if-not
                                     (lambda (x) (and (consp x) (eq (car x) 
'optimize)))
                                     (cdr form)))))
                  (when opts (local-compile-decls opts)))
                form)
               (the `(,(car form) ,(cadr form) ,@(portable-source (cddr form) 
t)))
               ((flet labels macrolet) 
                `(,(car form)
                  ,(mapcar (lambda (x) `(,(car x) ,@(cdr (portable-source 
`(lambda ,@(cdr x)))))) (cadr form))
                  ,@(let ((*mlts* *mlts*))
                      (when (eq (car form) 'macrolet)
                        (dolist (l (cadr form)) (push (car l) *mlts*)))
                      (ndbctxt (portable-source (cddr form) t)))))
               (multiple-value-bind `(,(car form) ,(cadr form) 
,(portable-source (caddr form))
                                      ,@(let ((r (remove-if-not 'si::specialp 
(cadr form))))
                                          (when r `((declare (special ,@r)))))
                                      ,@(ndbctxt (portable-source (cdddr form) 
t))))))
        ((let* ((fd (and (symbolp (car form)) (not (member (car form) *mlts*))
                         (or (get (car form) 'si::compiler-macro-prop) 
(macro-function (car form)))))
                (nf (if fd (cmp-expand-macro fd (car form) (cdr form)) form)))
           (portable-source nf (equal form nf))))))


This said, the saved portable code is equivalent but not identical to
that processed by the compiler at present.  This should be addressable.

Bob, I wanted to test nqthm before committing.  Are there any mods
needed when using the ansi build?

Take care,
-- 
Camm Maguire                                            address@hidden
==========================================================================
"The earth is but one country, and mankind its citizens."  --  Baha'u'llah




reply via email to

[Prev in Thread] Current Thread [Next in Thread]