0.9.9.34:
authorChristophe Rhodes <csr21@cam.ac.uk>
Fri, 17 Feb 2006 17:49:36 +0000 (17:49 +0000)
committerChristophe Rhodes <csr21@cam.ac.uk>
Fri, 17 Feb 2006 17:49:36 +0000 (17:49 +0000)
Merge fix from Peter Van Eynde (sbcl-devel 2006-02-11 "cosmetic
room bug") for a cosmetic room bug.
... also fix a distinctly non-cosmetic scrub-control-stack bug
resulting from the same issue.  This scrubbing failure
appeared to cause heap corruption in powerpc/gencgc
test builds; I think I understand why.

The Cheney GC zeros the unused parts of the lisp control stack
after it has completed the garbage collection.  This ensures
that, if the active stack had no garbage pointers at the start
of the collection, there is no region in the entire control
stack (used or unused) which contains a garbage pointer, since
every entry has either been scavenged or zeroed.  But since by
assumption we start off with no garbage pointers, by
mathematical induction we never scavenge one, so everything is
safe.

GENCGC doesn't perform this zeroing.  (Why?)  However,
SCRUB-CONTROL-STACK does, before a GC.  This is slightly more
dangerous, because we could in fact have incomplete stack frames
        lying below the stack pointer with an entry from a previous
        iteration of the heap, but I think it's OK by the same
        reasoning as before.  Failure to zero the stack, however, does
        leave the possibility of bogus pointers open when stack frames
        are extended but not every stack slot has yet been written to.
        This wasn't so much of an issue when the stack is
        scanned conservatively and ambiguous roots caused pinning, but
        under a precise stack scanning regime disaster ensues.

NEWS
src/code/gc.lisp
src/code/toplevel.lisp
version.lisp-expr

diff --git a/NEWS b/NEWS
index 0e50cc0..fa06808 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -30,6 +30,9 @@ changes in sbcl-0.9.10 relative to sbcl-0.9.9:
     manifest itself in a segmentation violation while building PCL.
     (reported by Kevin Rosenberg, Eric Marsden, Lars Brinkhoff and
     many others over the years)
+  * fixed bug: ROOM no longer reports silly numbers for stack usage if
+    the stack pointer (treated as a signed integer) is negative.
+    (thanks to Peter van Eynde)
 
 changes in sbcl-0.9.9 relative to sbcl-0.9.8:
   * new platform: experimental support for the Windows operating
index 9bc64ee..95ff75c 100644 (file)
 (defun control-stack-usage ()
   #!-stack-grows-downward-not-upward
   (- (sb!sys:sap-int (sb!c::control-stack-pointer-sap))
-     (sb!vm:fixnumize sb!vm:*control-stack-start*))
+     (sb!sys:sap-int (sb!di::descriptor-sap sb!vm:*control-stack-start*)))
   #!+stack-grows-downward-not-upward
-  (- (sb!vm:fixnumize sb!vm:*control-stack-end*)
+  (- (sb!sys:sap-int (sb!di::descriptor-sap sb!vm:*control-stack-end*))
      (sb!sys:sap-int (sb!c::control-stack-pointer-sap))))
 
 (defun binding-stack-usage ()
   (- (sb!sys:sap-int (sb!c::binding-stack-pointer-sap))
-     (sb!vm:fixnumize sb!vm:*binding-stack-start*)))
+     (sb!sys:sap-int (sb!di::descriptor-sap sb!vm:*binding-stack-start*))))
 \f
 ;;;; ROOM
 
index 9e492a2..274b03d 100644 (file)
@@ -185,7 +185,7 @@ steppers to maintain contextual information.")
   (let* ((csp (sap-int (sb!c::control-stack-pointer-sap)))
          (initial-offset (logand csp (1- bytes-per-scrub-unit)))
          (end-of-stack
-          (- (sb!vm:fixnumize sb!vm:*control-stack-end*)
+          (- (sap-int (sb!di::descriptor-sap sb!vm:*control-stack-end*))
              sb!c:*backend-page-size*)))
     (labels
         ((scrub (ptr offset count)
@@ -218,7 +218,7 @@ steppers to maintain contextual information.")
 
   #!+stack-grows-downward-not-upward
   (let* ((csp (sap-int (sb!c::control-stack-pointer-sap)))
-         (end-of-stack (+ (sb!vm:fixnumize sb!vm:*control-stack-start*)
+         (end-of-stack (+ (sap-int (sb!di::descriptor-sap sb!vm:*control-stack-start*))
                           sb!c:*backend-page-size*))
          (initial-offset (logand csp (1- bytes-per-scrub-unit))))
     (labels
index df55c64..e5e553a 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"0.9.9.33"
+"0.9.9.34"