From 3d11412f3458048039cd8fece1db2aa6511118dc Mon Sep 17 00:00:00 2001 From: Christophe Rhodes Date: Fri, 17 Feb 2006 17:49:36 +0000 Subject: [PATCH] 0.9.9.34: 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 | 3 +++ src/code/gc.lisp | 6 +++--- src/code/toplevel.lisp | 4 ++-- version.lisp-expr | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index 0e50cc0..fa06808 100644 --- 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 diff --git a/src/code/gc.lisp b/src/code/gc.lisp index 9bc64ee..95ff75c 100644 --- a/src/code/gc.lisp +++ b/src/code/gc.lisp @@ -49,14 +49,14 @@ (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*)))) ;;;; ROOM diff --git a/src/code/toplevel.lisp b/src/code/toplevel.lisp index 9e492a2..274b03d 100644 --- a/src/code/toplevel.lisp +++ b/src/code/toplevel.lisp @@ -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 diff --git a/version.lisp-expr b/version.lisp-expr index df55c64..e5e553a 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -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" -- 1.7.10.4