0.8.0.46:
[sbcl.git] / src / pcl / cache.lisp
index d53c674..ed83efd 100644 (file)
 (defun check-wrapper-validity (instance)
   (let* ((owrapper (wrapper-of instance))
         (state (layout-invalid owrapper)))
-    (if (null state)
-       owrapper
-       (ecase (car state)
-         (:flush
-          (flush-cache-trap owrapper (cadr state) instance))
-         (:obsolete
-          (obsolete-instance-trap owrapper (cadr state) instance))))))
+    (aver (not (eq state :uninitialized)))
+    (etypecase state
+      (null owrapper)
+      ;; FIXME: I can't help thinking that, while this does cure the
+      ;; symptoms observed from some class redefinitions, this isn't
+      ;; the place to be doing this flushing.  Nevertheless...  --
+      ;; CSR, 2003-05-31
+      ;;
+      ;; CMUCL comment:
+      ;;    We assume in this case, that the :INVALID is from a
+      ;;    previous call to REGISTER-LAYOUT for a superclass of
+      ;;    INSTANCE's class.  See also the comment above
+      ;;    FORCE-CACHE-FLUSHES.  Paul Dietz has test cases for this.
+      ((member t)
+       (let ((class (class-of instance)))
+        (force-cache-flushes class)
+        (class-wrapper class)))
+      (cons
+       (ecase (car state)
+        (:flush
+         (flush-cache-trap owrapper (cadr state) instance))
+        (:obsolete
+         (obsolete-instance-trap owrapper (cadr state) instance)))))))
 
 (declaim (inline check-obsolete-instance))
 (defun check-obsolete-instance (instance)