(declaim (inline wrapper-class*))
(defun wrapper-class* (wrapper)
(or (wrapper-class wrapper)
- (ensure-non-standard-class
- (classoid-name (layout-classoid wrapper)))))
+ (let ((classoid (layout-classoid wrapper)))
+ (ensure-non-standard-class
+ (classoid-name classoid)
+ classoid))))
;;; The wrapper cache machinery provides general mechanism for
;;; trapping on the next access to any instance of a given class. This
(remhash owrapper *previous-nwrappers*)
(setf (gethash nwrapper *previous-nwrappers*) new-previous)))
+;;; FIXME: This is not a good name: part of the constract here is that
+;;; we return the valid wrapper, which is not obvious from the name
+;;; (or the names of our callees.)
(defun check-wrapper-validity (instance)
(let* ((owrapper (wrapper-of instance))
(state (layout-invalid owrapper)))
;; INSTANCE's class. See also the comment above
;; FORCE-CACHE-FLUSHES. Paul Dietz has test cases for this.
(force-cache-flushes (class-of instance))
+ ;; KLUDGE avoid an infinite recursion, it's still better to
+ ;; bail out with an AVER for server softwares. see FIXME above.
+ ;; details: http://thread.gmane.org/gmane.lisp.steel-bank.devel/10175
+ (aver (not (eq (layout-invalid (wrapper-of instance)) t)))
(check-wrapper-validity instance))
((consp state)
(ecase (car state)
(defun check-obsolete-instance (instance)
(when (invalid-wrapper-p (layout-of instance))
(check-wrapper-validity instance)))
+
+(defun valid-wrapper-of (instance)
+ (let ((wrapper (wrapper-of instance)))
+ (if (invalid-wrapper-p wrapper)
+ (check-wrapper-validity instance)
+ wrapper)))
\f
;;; NIL: means nothing so far, no actual arg info has NILs in the
;;; metatype.