[armedbear-cvs] r12768 - trunk/abcl/src/org/armedbear/lisp

Erik Huelsmann ehuelsmann at common-lisp.net
Sun Jun 27 10:10:40 UTC 2010


Author: ehuelsmann
Date: Sun Jun 27 06:10:38 2010
New Revision: 12768

Log:
Fix elimination of unused local functions:
macroexpand before scanning the body.

Found by: William Wadsworth (will wadsworth 10 at gmail com)

Modified:
   trunk/abcl/src/org/armedbear/lisp/precompiler.lisp

Modified: trunk/abcl/src/org/armedbear/lisp/precompiler.lisp
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/precompiler.lisp	(original)
+++ trunk/abcl/src/org/armedbear/lisp/precompiler.lisp	Sun Jun 27 06:10:38 2010
@@ -788,7 +788,9 @@
   (let ((*precompile-env* (make-environment *precompile-env*))
         (operator (car form))
         (locals (cadr form))
-        (body (cddr form)))
+        ;; precompile (thus macro-expand) the body before inspecting it
+        ;; for the use of our locals and optimizing them away
+        (body (mapcar #'precompile1 (cddr form))))
     (dolist (local locals)
       (let* ((name (car local))
              (used-p (find-use name body)))
@@ -820,7 +822,7 @@
             (return-from precompile-flet/labels (precompile1 new-form))))))
     (list* (car form)
            (precompile-local-functions locals)
-           (mapcar #'precompile1 body))))
+           body)))
 
 (defun precompile-function (form)
   (if (and (consp (cadr form)) (eq (caadr form) 'LAMBDA))




More information about the armedbear-cvs mailing list