1.0.28.65: fix compiling with *PROFILE-HASH-CACHE* set to T
[sbcl.git] / src / pcl / init.lisp
index 912c197..6696bba 100644 (file)
            ;; that slot won't be initialized from its :INITFORM, if any.
            (let ((initfun (slot-definition-initfunction slotd)))
              (if (typep instance 'structure-object)
-                 (when (eq (funcall
-                            ;; not SLOT-VALUE-USING-CLASS, as that
-                            ;; throws an error if the value is the
-                            ;; unbound marker.
-                            (slot-definition-internal-reader-function slotd)
-                            instance)
-                           +slot-unbound+)
+                 ;; We don't have a consistent unbound marker for structure
+                 ;; object slots, and structure object redefinition is not
+                 ;; really supported anyways -- so unconditionally
+                 ;; initializing the slot should be fine.
+                 (when initfun
                    (setf (slot-value-using-class class instance slotd)
-                         (when initfun
-                           (funcall initfun))))
+                         (funcall initfun)))
                  (unless (or (not initfun)
                              (slot-boundp-using-class class instance slotd))
-                  (setf (slot-value-using-class class instance slotd)
-                        (funcall initfun)))))))
+                   (setf (slot-value-using-class class instance slotd)
+                         (funcall initfun)))))))
     (let* ((class (class-of instance))
            (initfn-slotds
             (loop for slotd in (class-slots class)
                   unless (initialize-slot-from-initarg class instance slotd)
                   collect slotd)))
       (dolist (slotd initfn-slotds)
-        (if (eq (slot-definition-allocation slotd) :class)
-            (when (or (eq t slot-names)
-                      (memq (slot-definition-name slotd) slot-names))
-              (unless (slot-boundp-using-class class instance slotd)
-                (initialize-slot-from-initfunction class instance slotd)))
-            (when (or (eq t slot-names)
-                      (memq (slot-definition-name slotd) slot-names))
-              (initialize-slot-from-initfunction class instance slotd)))))
+        (unless (eq (slot-definition-allocation slotd) :class)
+          ;; :ALLOCATION :CLASS slots use the :INITFORM when class is defined
+          ;; or redefined, not when instances are allocated.
+          (when (or (eq t slot-names)
+                    (memq (slot-definition-name slotd) slot-names))
+            (initialize-slot-from-initfunction class instance slotd)))))
     instance))
 \f
 ;;; If initargs are valid return nil, otherwise signal an error.