1.0.25.31: axe GC-{ON,OFF}
authorGabor Melis <mega@hotpop.com>
Mon, 16 Feb 2009 21:48:20 +0000 (21:48 +0000)
committerGabor Melis <mega@hotpop.com>
Mon, 16 Feb 2009 21:48:20 +0000 (21:48 +0000)
... because they are broken, nobody uses them (?), and complicated to
fix.

Rationale:

- There is no way to safely allow gc in a WITHOUT-GCING without making
it entirely useless (nothing like the interrupt protocol with
ALLOW-WITH-INTERRUPTS).

- WITHOUT-GCING implies WITHOUT-INTERRUPTS because interrupts running
with gc disabled may lead to deadlocks (see internals manual on lock
ordering and WITHOUT-GCING) or running out of memory. To adhere to
this contract GC-{ON,OFF} would need to enable/disable interrupts by
setting *INTERRUPTS-ENABLED*, comlicated business for little gain.

NEWS
doc/manual/ffi.texinfo
package-data-list.lisp-expr
src/code/cold-init.lisp
src/code/gc.lisp
tests/gc.impure.lisp
version.lisp-expr

diff --git a/NEWS b/NEWS
index 9a946f9..b47062d 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,7 @@
 ;;;; -*- coding: utf-8; fill-column: 78 -*-
 changes in sbcl-1.0.26 relative to 1.0.25:
+  * incompatible change: GC-OFF and GC-ON are removed, they were
+    always unsafe. Use WITHOUT-GCING instead.
   * new feature: runtime option --disable-ldb
   * new feature: runtime option --lose-on-corruption to die at the
     slightest hint of possibly non-recoverable errors: running out of
index 0c97c3c..b65b2bc 100644 (file)
@@ -969,8 +969,7 @@ other ports it is implemented by turning off GC for the duration (so
 could be said to have a whole-world granularity).
 
 @item
-Disable GC, using the @code{without-gcing} macro or @code{gc-off}
-call.
+Disable GC, using the @code{without-gcing} macro.
 @end enumerate
 
 @c <!-- FIXME: This is a "changebar" section from the CMU CL manual.
index 8c53a73..eb52a9e 100644 (file)
@@ -591,7 +591,7 @@ like *STACK-TOP-HINT* and unsupported stuff like *TRACED-FUN-LIST*."
                ;; People have various good reasons to mess with the GC.
                "*AFTER-GC-HOOKS*"
                "BYTES-CONSED-BETWEEN-GCS"
-               "GC" "GC-OFF" "GC-ON" "GET-BYTES-CONSED"
+               "GC" "GET-BYTES-CONSED"
                "*GC-RUN-TIME*"
                "PURIFY"
 
index ab221d1..bcde5e7 100644 (file)
   #!+hpux (sb!sys:%primitive sb!vm::setup-return-from-lisp-stub)
   ;; The system is finally ready for GC.
   (/show0 "enabling GC")
-  (gc-on)
+  (setq *gc-inhibit* nil)
   (/show0 "doing first GC")
   (gc :full t)
   (/show0 "back from first GC")
index 1df184d..e94a392 100644 (file)
 (declaim (type unsigned-byte *n-bytes-freed-or-purified*))
 (defvar *n-bytes-freed-or-purified* 0)
 (defun gc-reinit ()
-  (gc-on)
+  (setq *gc-inhibit* nil)
   (gc)
   (setf *n-bytes-freed-or-purified* 0
         *gc-run-time* 0
@@ -292,18 +292,3 @@ run in any thread.")
              (or #!+sb-thread *stop-for-gc-pending*
                  *gc-pending*))
     (sb!unix::receive-pending-interrupt)))
-
-;;; These work both regardless of whether we're inside WITHOUT-GCING
-;;; or not.
-(defun gc-on ()
-  #!+sb-doc
-  "Enable the garbage collector."
-  (setq *gc-inhibit* nil)
-  (maybe-handle-pending-gc)
-  nil)
-
-(defun gc-off ()
-  #!+sb-doc
-  "Disable the garbage collector."
-  (setq *gc-inhibit* t)
-  nil)
index 07e3d98..c00438b 100644 (file)
 (let ((gc-happend nil))
   (push (lambda () (setq gc-happend t)) sb-ext:*after-gc-hooks*)
 
-  ;; check GC-{ON,OFF} works and gc is deferred
-  (gc-off)
-  (gc)
-  (assert (not gc-happend))
-  (gc-on)
-  (assert gc-happend)
-
   ;; check that WITHOUT-GCING defers explicit gc
-  (setq gc-happend nil)
   (sb-sys:without-gcing
     (gc)
     (assert (not gc-happend)))
       (assert (not gc-happend)))
     ;; give the hook time to run
     (sleep 1)
-    (assert gc-happend))
-
-  ;; check GC-ON works even in a WITHOUT-GCING
-  (setq gc-happend nil)
-  (sb-sys:without-gcing
-    (gc)
-    (assert (not gc-happend))
-    (gc-on)
-    (assert gc-happend)
-    (setq gc-happend nil))
-  (assert (not gc-happend)))
+    (assert gc-happend)))
 
index 48cffab..3395220 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".)
-"1.0.25.30"
+"1.0.25.31"