X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcode%2Fgc.lisp;h=5ea36699fb622d168f1cebfabe37e5c173069fc2;hb=beddcfe1ea23d2cfdddde2fa7cde6436799715a2;hp=50226abeb707ccdd656733d208d3d98d857d0627;hpb=f71d9c8d57630ca41e149e03305e678cc3e7fc0f;p=sbcl.git diff --git a/src/code/gc.lisp b/src/code/gc.lisp index 50226ab..5ea3669 100644 --- a/src/code/gc.lisp +++ b/src/code/gc.lisp @@ -243,7 +243,7 @@ NIL as the pathname." (let ((*gc-inhibit* t)) (let ((old-usage (dynamic-usage)) (new-usage 0)) - (unsafe-clear-roots) + (unsafe-clear-roots gen) (gc-stop-the-world) (let ((start-time (get-internal-run-time))) (collect-garbage gen) @@ -316,7 +316,8 @@ NIL as the pathname." (define-alien-routine scrub-control-stack sb!alien:void) -(defun unsafe-clear-roots () +(defun unsafe-clear-roots (gen) + #!-gencgc (declare (ignore gen)) ;; KLUDGE: Do things in an attempt to get rid of extra roots. Unsafe ;; as having these cons more then we have space left leads to huge ;; badness. @@ -324,10 +325,15 @@ NIL as the pathname." ;; Power cache of the bignum printer: drops overly large bignums and ;; removes duplicate entries. (scrub-power-cache) - ;; FIXME: CTYPE-OF-CACHE-CLEAR isn't thread-safe. - #!-sb-thread - (ctype-of-cache-clear)) - + ;; Clear caches depending on the generation being collected. + #!+gencgc + (cond ((eql 0 gen)) + ((eql 1 gen) + (ctype-of-cache-clear)) + (t + (drop-all-hash-caches))) + #!-gencgc + (drop-all-hash-caches)) ;;;; auxiliary functions