X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fgc.lisp;h=0e6018461a83552219a80de0dc4bcdf16fdd4ce6;hb=1b650be8b800cf96e2c268ae317fb26d0bf36827;hp=dcff4924165bd5ca103116449f87c212ad35cc5e;hpb=2378b4fe567a8fea78b1e4915b9497d8c18ca92f;p=sbcl.git diff --git a/src/code/gc.lisp b/src/code/gc.lisp index dcff492..0e60184 100644 --- a/src/code/gc.lisp +++ b/src/code/gc.lisp @@ -143,19 +143,14 @@ and submit it as a patch." (defvar *before-gc-hooks* nil ; actually initialized in cold init #!+sb-doc "A list of functions that are called before garbage collection occurs. - The functions should take no arguments.") + The functions are run with interrupts disabled and all other threads + paused. They should take no arguments.") (defvar *after-gc-hooks* nil ; actually initialized in cold init #!+sb-doc "A list of functions that are called after garbage collection occurs. - The functions should take no arguments.") - -(defvar *gc-notify-stream* nil ; (actually initialized in cold init) - #!+sb-doc - "When non-NIL, this must be a STREAM; and the functions bound to - *GC-NOTIFY-BEFORE* and *GC-NOTIFY-AFTER* are called with the - STREAM value before and after a garbage collection occurs - respectively.") + The functions are run with interrupts disabled and all other threads + paused. They should take no arguments.") (defvar *gc-run-time* 0 #!+sb-doc @@ -249,12 +244,14 @@ and submit it as a patch." (let ((*already-in-gc* t)) (without-interrupts (gc-stop-the-world) - ;; XXX run before-gc-hooks + (dolist (h *before-gc-hooks*) + (carefully-funcall h)) (collect-garbage gen) (incf *n-bytes-freed-or-purified* (max 0 (- pre-gc-dynamic-usage (dynamic-usage)))) (setf *need-to-collect-garbage* nil) - ;; XXX run after-gc-hooks + (dolist (h *after-gc-hooks*) + (carefully-funcall h)) (gc-start-the-world))) (scrub-control-stack))) (values))