1.0.17.25: allow dumping of references to arbitrary named constants
authorNikodemus Siivola <nikodemus@random-state.net>
Wed, 4 Jun 2008 17:02:17 +0000 (17:02 +0000)
committerNikodemus Siivola <nikodemus@random-state.net>
Wed, 4 Jun 2008 17:02:17 +0000 (17:02 +0000)
 * While ANSI does not require us to do this, supporting this allows
   users to write code like:

     (unless (boundp 'f) (defconstant f (lambda () 'foo!)))
     (defun foo () f)

   ...which pre 1.0.17.3 SBCL also allowed.

src/compiler/ir1tran.lisp
version.lisp-expr

index 16ea19b..869d1cd 100644 (file)
                    ((array t)
                     (dotimes (i (array-total-size value))
                       (grovel (row-major-aref value i))))
-                   (;; In the target SBCL, we can dump any instance,
-                    ;; but in the cross-compilation host,
-                    ;; %INSTANCE-FOO functions don't work on general
-                    ;; instances, only on STRUCTURE!OBJECTs.
-                    #+sb-xc-host structure!object
-                    #-sb-xc-host instance
-                    (when (if namep
-                              (emit-make-load-form value name)
-                              (emit-make-load-form value))
-                      (dotimes (i (- (%instance-length value)
-                                     #+sb-xc-host 0
-                                     #-sb-xc-host (layout-n-untagged-slots
-                                                   (%instance-ref value 0))))
-                        (grovel (%instance-ref value i)))))
                    (t
-                    (compiler-error
-                     "Objects of type ~S can't be dumped into fasl files."
-                     (type-of value)))))))
+                    (if namep
+                        ;; We can dump arbitrary named constant references by
+                        ;; using the name.
+                        (emit-make-load-form value name)
+                        ;; In the target SBCL, we can dump any instance, but
+                        ;; in the cross-compilation host, %INSTANCE-FOO
+                        ;; functions don't work on general instances, only on
+                        ;; STRUCTURE!OBJECTs.
+                        ;;
+                        ;; FIXME: What about funcallable instances with user-defined
+                        ;; MAKE-LOAD-FORM methods?
+                        (if (typep value #+sb-xc-host 'structure!object #-sb-xc-host 'instance)
+                            (when (emit-make-load-form value)
+                              (dotimes (i (- (%instance-length value)
+                                             #+sb-xc-host 0
+                                             #-sb-xc-host (layout-n-untagged-slots
+                                                           (%instance-ref value 0))))
+                                (grovel (%instance-ref value i))))
+                            (compiler-error
+                             "Objects of type ~S can't be dumped into fasl files."
+                             (type-of value)))))))))
       (grovel constant)))
   (values))
 \f
index 835b52b..f37b0a1 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"1.0.17.24"
+"1.0.17.25"