X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fpcl%2Fstd-class.lisp;h=c1e6af30745220bff339d65a7573575ee1646e72;hb=bcd323c39d6f5f80020ba4a5d9eb8d348c6cc499;hp=101a635e78a3e9352e4cdb8fab625f58814262a0;hpb=96aa790ea1d70810e862665c3c8be4ce405a964c;p=sbcl.git diff --git a/src/pcl/std-class.lisp b/src/pcl/std-class.lisp index 101a635..c1e6af3 100644 --- a/src/pcl/std-class.lisp +++ b/src/pcl/std-class.lisp @@ -202,18 +202,18 @@ ;;; This needs to be used recursively, in case a non-trivial user ;;; defined ADD/REMOVE-DIRECT-METHOD method ends up calling another ;;; function using the same lock. -(defvar *specializer-lock* (sb-thread::make-spinlock :name "Specializer lock")) +(defvar *specializer-lock* (sb-thread:make-mutex :name "Specializer lock")) (defmethod add-direct-method :around ((specializer specializer) method) ;; All the actions done under this lock are done in an order ;; that is safe to unwind at any point. - (sb-thread::with-recursive-system-spinlock (*specializer-lock*) + (sb-thread::with-recursive-system-lock (*specializer-lock*) (call-next-method))) (defmethod remove-direct-method :around ((specializer specializer) method) ;; All the actions done under this lock are done in an order ;; that is safe to unwind at any point. - (sb-thread::with-recursive-system-spinlock (*specializer-lock*) + (sb-thread::with-recursive-system-lock (*specializer-lock*) (call-next-method))) (defmethod add-direct-method ((specializer class) (method method)) @@ -244,7 +244,7 @@ ;; we behave as if we got just first or just after -- it's just ;; for update that we need to lock. (or (cdr cell) - (sb-thread::with-spinlock (*specializer-lock*) + (sb-thread:with-mutex (*specializer-lock*) (setf (cdr cell) (let (collect) (dolist (m (car cell)) @@ -303,7 +303,7 @@ (entry (gethash object (specializer-method-table specializer)))) (when entry (or (cdr entry) - (sb-thread::with-spinlock (*specializer-lock*) + (sb-thread:with-mutex (*specializer-lock*) (setf (cdr entry) (let (collect) (dolist (m (car entry)) @@ -845,7 +845,8 @@ (defun class-has-a-forward-referenced-superclass-p (class) - (or (forward-referenced-class-p class) + (or (when (forward-referenced-class-p class) + class) (some #'class-has-a-forward-referenced-superclass-p (class-direct-superclasses class)))) @@ -956,6 +957,32 @@ (eq (class-of o) (class-of n))) (return nil))))))) +(defun style-warn-about-duplicate-slots (class) + (do* ((slots (slot-value class 'slots) (cdr slots)) + (dupes nil)) + ((null slots) + (when dupes + (style-warn + "~@~@:>" + class dupes))) + (let* ((slot-name (slot-definition-name (car slots))) + (oslots (and (not (eq (symbol-package slot-name) + *pcl-package*)) + (remove-if + (lambda (slot-name-2) + (or (eq (symbol-package slot-name-2) + *pcl-package*) + (string/= slot-name slot-name-2))) + (cdr slots) + :key #'slot-definition-name)))) + (when oslots + (pushnew (cons slot-name + (mapcar #'slot-definition-name oslots)) + dupes + :test #'string= :key #'car))))) + (defun %update-slots (class eslotds) (multiple-value-bind (instance-slots class-slots custom-slots) (classify-slotds eslotds) @@ -981,24 +1008,7 @@ (wrapper-slot-table nwrapper) (make-slot-table class eslotds) (wrapper-length nwrapper) nslots (slot-value class 'wrapper) nwrapper) - (do* ((slots (slot-value class 'slots) (cdr slots)) - (dupes nil)) - ((null slots) - (when dupes - (style-warn - "~@~@:>" - class dupes))) - (let* ((slot (car slots)) - (oslots (remove (slot-definition-name slot) (cdr slots) - :test #'string/= - :key #'slot-definition-name))) - (when oslots - (pushnew (cons (slot-definition-name slot) - (mapcar #'slot-definition-name oslots)) - dupes - :test #'string= :key #'car)))) + (style-warn-about-duplicate-slots class) (setf (slot-value class 'finalized-p) t) (unless (eq owrapper nwrapper) (maybe-update-standard-slot-locations class)))))