X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fgc.lisp;h=43c2b0726a4b5151ee0b124e07ace7a7077587ca;hb=69d60b456b07a0256f08df0d02484f361ce5737c;hp=dcab2ea63d435ead7bc8acda99c08d8568b24eba;hpb=fd526bc66c53616a2e757323cbda0271c72b3d54;p=sbcl.git diff --git a/src/code/gc.lisp b/src/code/gc.lisp index dcab2ea..43c2b07 100644 --- a/src/code/gc.lisp +++ b/src/code/gc.lisp @@ -17,24 +17,21 @@ sb!vm:*static-space-free-pointer*)) (eval-when (:compile-toplevel :execute) - (sb!xc:defmacro def-c-var-frob (lisp-fun c-var-name) - `(progn - #!-sb-fluid (declaim (inline ,lisp-fun)) - (defun ,lisp-fun () - (sb!alien:extern-alien ,c-var-name (sb!alien:unsigned 32)))))) + (sb!xc:defmacro def-c-var-fun (lisp-fun c-var-name) + `(defun ,lisp-fun () + (sb!alien:extern-alien ,c-var-name (sb!alien:unsigned 32))))) +#!-sb-fluid +(declaim (inline current-dynamic-space-start)) +#!+gencgc +(defun current-dynamic-space-start () sb!vm:dynamic-space-start) #!-gencgc -(progn - ;; This is called once per PROFILEd function call, so it's worth a - ;; little possible space cost to reduce its time cost. - #!-sb-fluid - (declaim (inline current-dynamic-space-start)) - (def-c-var-frob current-dynamic-space-start "current_dynamic_space")) +(def-c-var-fun current-dynamic-space-start "current_dynamic_space") #!-sb-fluid -(declaim (inline dynamic-usage)) ; to reduce PROFILEd call overhead +(declaim (inline dynamic-usage)) #!+gencgc -(def-c-var-frob dynamic-usage "bytes_allocated") +(def-c-var-fun dynamic-usage "bytes_allocated") #!-gencgc (defun dynamic-usage () (the (unsigned-byte 32) @@ -213,6 +210,9 @@ environment these hooks may run in any thread.") (defun sub-gc (&key (gen 0)) (unless (eql (sb!thread:current-thread-id) (sb!thread::mutex-value *already-in-gc*)) + ;; With gencgc, unless *NEED-TO-COLLECT-GARBAGE* every allocation + ;; in this function triggers another gc, potentially exceeding + ;; maximum interrupt nesting. (setf *need-to-collect-garbage* t) (when (zerop *gc-inhibit*) (sb!thread:with-mutex (*already-in-gc*) @@ -236,8 +236,10 @@ environment these hooks may run in any thread.") ;; of things and not a bug. (when (plusp freed) (incf *n-bytes-freed-or-purified* freed))) - (sb!thread::reap-dead-threads))) - ;; Outside the mutex, these may cause another GC. + (sb!thread::reap-dead-threads))) + ;; Outside the mutex, these may cause another GC. FIXME: it can + ;; potentially exceed maximum interrupt nesting by triggering + ;; GCs. (run-pending-finalizers) (dolist (hook *after-gc-hooks*) (handler-case