From 670aa64810a3d67510c697410b438b5f9e36d911 Mon Sep 17 00:00:00 2001 From: Nikodemus Siivola Date: Wed, 4 Jun 2008 17:02:17 +0000 Subject: [PATCH] 1.0.17.25: allow dumping of references to arbitrary named constants * 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 | 38 +++++++++++++++++++++----------------- version.lisp-expr | 2 +- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/src/compiler/ir1tran.lisp b/src/compiler/ir1tran.lisp index 16ea19bf3..869d1cd59 100644 --- a/src/compiler/ir1tran.lisp +++ b/src/compiler/ir1tran.lisp @@ -309,24 +309,28 @@ ((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)) diff --git a/version.lisp-expr b/version.lisp-expr index 835b52bbd..f37b0a1ad 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -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" -- 2.11.4.GIT