X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fweak.lisp;h=37b83a1d0d6812ff2ff7f70c177729cf8ddfd84d;hb=5d0643d3b70aade43037e8b7cdf39b7e12f5d3fd;hp=78bd2180cf65904fa829ce6d77534ae28ee782c8;hpb=a530bbe337109d898d5b4a001fc8f1afa3b5dc39;p=sbcl.git diff --git a/src/code/weak.lisp b/src/code/weak.lisp index 78bd218..37b83a1 100644 --- a/src/code/weak.lisp +++ b/src/code/weak.lisp @@ -9,29 +9,31 @@ ;;;; provided with absolutely no warranty. See the COPYING and CREDITS ;;;; files for more information. -(in-package "SB!EXT") - -(file-comment - "$Header$") +(in-package "SB!IMPL") (defun make-weak-pointer (object) #!+sb-doc - "Allocates and returns a weak pointer which points to OBJECT." + "Allocate and return a weak pointer which points to OBJECT." (declare (values weak-pointer)) (make-weak-pointer object)) #!-sb-fluid (declaim (inline weak-pointer-value)) (defun weak-pointer-value (weak-pointer) #!+sb-doc - "If WEAK-POINTER is valid, returns the value of WEAK-POINTER and T. + "If WEAK-POINTER is valid, return the value of WEAK-POINTER and T. If the referent of WEAK-POINTER has been garbage collected, returns the values NIL and NIL." (declare (type weak-pointer weak-pointer) (values t (member t nil))) - ;; We don't need to wrap this with a without-gcing, because once we have - ;; extracted the value, our reference to it will keep the weak pointer - ;; from becoming broken. We just have to make sure the compiler won't - ;; reorder these primitives. + ;; We don't need to wrap this with a WITHOUT-GCING, because once we + ;; have extracted the value, our reference to it will keep the weak + ;; pointer from becoming broken. We just have to make sure the + ;; compiler won't reorder these primitives. + ;; + ;; FIXME: Might it be a good idea to tweak the DEFKNOWNs for + ;; %WEAK-POINTER-VALUE and %WEAK-POINTER-BROKEN, so that the + ;; compiler will never try to reorder them even in code where we + ;; neglect to frame them in a LET? (let ((value (sb!c::%weak-pointer-value weak-pointer)) (broken (sb!c::%weak-pointer-broken weak-pointer))) (values value (not broken))))