Update of /cvsroot/sbcl/sbcl/src/pcl
In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv11748/src/pcl
184.108.40.206: AVER that the GF lock is held during SET-DFUN
...and adjust commentary in UPDATE-DFUN.
RCS file: /cvsroot/sbcl/sbcl/src/pcl/boot.lisp,v
retrieving revision 1.135
retrieving revision 1.136
diff -u -d -r1.135 -r1.136
--- boot.lisp 2 Jun 2007 09:04:15 -0000 1.135
+++ boot.lisp 8 Jun 2007 11:40:43 -0000 1.136
@@ -2090,10 +2090,15 @@
(let ((new-state (if (and dfun (or cache info))
(list* dfun cache info)
- (if (eq *boot-state* 'complete)
- (setf (safe-gf-dfun-state gf) new-state)
- (setf (clos-slots-ref (get-slots gf) *sgf-dfun-state-index*)
+ ((eq *boot-state* 'complete)
+ ;; Check that we are under the lock.
+ (aver (eq sb-thread:*current-thread* (sb-thread::spinlock-value (gf-lock gf))))
+ (setf (safe-gf-dfun-state gf) new-state))
+ (setf (clos-slots-ref (get-slots gf) *sgf-dfun-state-index*)
(defun gf-dfun-cache (gf)
RCS file: /cvsroot/sbcl/sbcl/src/pcl/dfun.lisp,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- dfun.lisp 3 Jun 2007 18:20:09 -0000 1.60
+++ dfun.lisp 8 Jun 2007 11:40:43 -0000 1.61
@@ -1752,13 +1752,13 @@
;; a generic can cause the dispatch function to be updated we
;; need a lock here.
- ;; We need to accept recursion, because PCL is nasty and twisty.
+ ;; We need to accept recursion, because PCL is nasty and twisty,
+ ;; and we need to disable interrupts because it would be bad if
+ ;; we updated the DFUN-STATE but not the dispatch function.
- ;; KLUDGE: We need to disable interrupts as long as
- ;; WITH-FOO-LOCK is interrupt unsafe. Once they are interrupt
- ;; safe we can allow interrupts here. (But if someone some day
- ;; manages to get rid of the need for a recursive lock here we
- ;; _will_ need without-interrupts once again.)
+ ;; This is sufficient, because all the other calls to SET-DFUN
+ ;; are part of this same code path (done while the lock is held),
+ ;; which we AVER.
;; FIXME: When our mutexes are smart about the need to wake up
;; sleepers we can put a mutex here instead -- but in the meantime
@@ -1767,9 +1767,14 @@
;; KLUDGE: No need to lock during bootstrap.
- (sb-thread::with-recursive-spinlock ((gf-lock generic-function))
+ (let ((lock (gf-lock generic-function)))
+ ;; FIXME: GF-LOCK is a generic function... Are there cases
+ ;; where we can end up in a metacircular loop here? In
+ ;; case there are, better fetch it while interrupts are
+ ;; still enabled...
+ (sb-thread::with-recursive-spinlock (lock)
(defvar *dfun-count* nil)
(defvar *dfun-list* nil)