/[cmucl]/src/code/gc.lisp
ViewVC logotype

Diff of /src/code/gc.lisp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.21 by dtc, Sat Feb 8 21:08:01 1997 UTC revision 1.21.2.2 by pw, Tue May 23 16:36:31 2000 UTC
# Line 47  Line 47 
47  (c-var-frob current-dynamic-space-start "current_dynamic_space")  (c-var-frob current-dynamic-space-start "current_dynamic_space")
48  (declaim (inline dynamic-usage))  (declaim (inline dynamic-usage))
49    
50  #-cgc  #-(or cgc gencgc)
51  (defun dynamic-usage ()  (defun dynamic-usage ()
52    (the (unsigned-byte 32)    (the (unsigned-byte 32)
53         (- (system:sap-int (c::dynamic-space-free-pointer))         (- (system:sap-int (c::dynamic-space-free-pointer))
54            (current-dynamic-space-start))))            (current-dynamic-space-start))))
55    
56  #+cgc  #+(or cgc gencgc)
57  (c-var-frob dynamic-usage "cgc_bytes_allocated")  (c-var-frob dynamic-usage "bytes_allocated")
58    
59  (defun static-space-usage ()  (defun static-space-usage ()
60    (- (* lisp::*static-space-free-pointer* vm:word-bytes)    (- (* lisp::*static-space-free-pointer* vm:word-bytes)
# Line 301  Line 301 
301    
302  ;;;; Internal GC  ;;;; Internal GC
303    
304  (alien:def-alien-routine collect-garbage c-call:int)  (alien:def-alien-routine collect-garbage c-call:int
305      #+gencgc (last-gen c-call:int))
306    
307  #-ibmrt  #-ibmrt
308  (alien:def-alien-routine set-auto-gc-trigger c-call:void  (alien:def-alien-routine set-auto-gc-trigger c-call:void
# Line 353  Line 354 
354  ;;; called.  The FORCE-P flags controls if a GC should occur even if the  ;;; called.  The FORCE-P flags controls if a GC should occur even if the
355  ;;; dynamic usage is not greater than *GC-TRIGGER*.  ;;; dynamic usage is not greater than *GC-TRIGGER*.
356  ;;;  ;;;
357  (defun sub-gc (&key (verbose-p *gc-verbose*) force-p)  ;;; For GENCGC all generations < GEN will be GC'ed.
358    ;;;
359    (defun sub-gc (&key (verbose-p *gc-verbose*) force-p #+gencgc (gen 0))
360    (unless *already-maybe-gcing*    (unless *already-maybe-gcing*
361      (let* ((*already-maybe-gcing* t)      (let* ((*already-maybe-gcing* t)
362             (start-time (get-internal-run-time))             (start-time (get-internal-run-time))
# Line 383  Line 386 
386                (carefully-funcall hook))                (carefully-funcall hook))
387              (when *gc-trigger*              (when *gc-trigger*
388                (clear-auto-gc-trigger))                (clear-auto-gc-trigger))
389              (funcall *internal-gc*)              #-gencgc (funcall *internal-gc*)
390                #+gencgc (if (eq *internal-gc* #'collect-garbage)
391                             (funcall *internal-gc* gen)
392                             (funcall *internal-gc*))
393              (let* ((post-gc-dyn-usage (dynamic-usage))              (let* ((post-gc-dyn-usage (dynamic-usage))
394                     (bytes-freed (- pre-gc-dyn-usage post-gc-dyn-usage)))                     (bytes-freed (- pre-gc-dyn-usage post-gc-dyn-usage)))
395                (when *last-bytes-in-use*                (when *last-bytes-in-use*
# Line 420  Line 426 
426  ;;;  ;;;
427  ;;; This is the user advertised garbage collection function.  ;;; This is the user advertised garbage collection function.
428  ;;;  ;;;
429    #-gencgc
430  (defun gc (&optional (verbose-p *gc-verbose*))  (defun gc (&optional (verbose-p *gc-verbose*))
431    "Initiates a garbage collection.  The optional argument, VERBOSE-P,    "Initiates a garbage collection.  The optional argument, VERBOSE-P,
432    which defaults to the value of the variable *GC-VERBOSE* controls    which defaults to the value of the variable *GC-VERBOSE* controls
433    whether or not GC statistics are printed."    whether or not GC statistics are printed."
434    (sub-gc :verbose-p verbose-p :force-p t))    (sub-gc :verbose-p verbose-p :force-p t))
435    ;;;
436    #+gencgc
437    (defun gc (&key (verbose *gc-verbose*) (gen 0) (full nil))
438      "Initiates a garbage collection.  The keyword :VERBOSE, which
439       defaults to the value of the variable *GC-VERBOSE* controls whether or
440       not GC statistics are printed. The keyword :GEN defaults to 0, and
441       controls the number of generations to garbage collect."
442      (sub-gc :verbose-p verbose :force-p t :gen (if full 6 gen)))
443    
444    
445  ;;;; Auxiliary Functions.  ;;;; Auxiliary Functions.

Legend:
Removed from v.1.21  
changed lines
  Added in v.1.21.2.2

  ViewVC Help
Powered by ViewVC 1.1.5