X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fdebug-int.lisp;h=d5dd4c7ede485f2fac6ebb80c51681dae10bad64;hb=6ddc6bb305b4f218780d4b2c9a2ac3584a85f94a;hp=7411bc59a10f25a2997d59c9e1a2bde051de75f5;hpb=cdd026dddac3eaddbaa0221503e49e2673d54545;p=sbcl.git diff --git a/src/code/debug-int.lisp b/src/code/debug-int.lisp index 7411bc5..d5dd4c7 100644 --- a/src/code/debug-int.lisp +++ b/src/code/debug-int.lisp @@ -539,8 +539,7 @@ (sb!alien:define-alien-routine component-ptr-from-pc (system-area-pointer) (pc system-area-pointer)) -#!+gencgc (declaim (inline valid-lisp-pointer-p)) -#!+gencgc +(declaim (inline valid-lisp-pointer-p)) (sb!alien:define-alien-routine valid-lisp-pointer-p sb!alien:int (pointer system-area-pointer)) @@ -1974,6 +1973,18 @@ register." ;;; (Such values can arise in registers on machines with conservative ;;; GC, and might also arise in debug variable locations when ;;; those variables are invalid.) +;;; +;;; NOTE: this function is not GC-safe in the slightest when creating +;;; a pointer to an object in dynamic space. If a GC occurs between +;;; the start of the call to VALID-LISP-POINTER-P and the end of +;;; %MAKE-LISP-OBJ then the object could move before the boxed pointer +;;; is constructed. This can happen on CHENEYGC if an asynchronous +;;; interrupt occurs within the window. This can happen on GENCGC +;;; under the same circumstances, but is more likely due to all GENCGC +;;; platforms supporting threaded operation. This is somewhat +;;; mitigated on x86oids due to the conservative stack and interrupt +;;; context "scavenging" on such platforms, but there still may be a +;;; vulnerable window. (defun make-lisp-obj (val &optional (errorp t)) (if (or ;; fixnum @@ -1987,21 +1998,7 @@ register." ;; unbound marker (= val sb!vm:unbound-marker-widetag) ;; pointer - #!+gencgc - (not (zerop (valid-lisp-pointer-p (int-sap val)))) - ;; FIXME: There is no fundamental reason not to use the above - ;; function on other platforms as well, but I didn't have - ;; others available while doing this. --NS 2007-06-21 - #!-gencgc - (and (logbitp 0 val) - (or (< sb!vm:read-only-space-start val - (ash sb!vm:*read-only-space-free-pointer* - sb!vm:n-fixnum-tag-bits)) - (< sb!vm:static-space-start val - (ash sb!vm:*static-space-free-pointer* - sb!vm:n-fixnum-tag-bits)) - (< (current-dynamic-space-start) val - (sap-int (dynamic-space-free-pointer)))))) + (not (zerop (valid-lisp-pointer-p (int-sap val))))) (values (%make-lisp-obj val) t) (if errorp (error "~S is not a valid argument to ~S"