Source
(defmethod mark-root ((heap mark-and-sweep-heap) (object-id integer))
;; Returns the number of octets scanned.
(let ((object-table (object-table heap)))
(if (member (object-info object-table object-id) '(:reserved :live-object))
;; Reserved objects aren't written to the heap yet (they just
;; have an object table entry), so we don't need to scan them
;; for child objects. And live objects were already marked earlier,
;; so don't need to be scanned again now.
0
(let* ((block (object-heap-position object-table object-id))
(buffer (load-block heap block :skip-header t)))
(setf (object-info object-table object-id) :live-object)
(scan-object object-id buffer heap)
;; Keep track of statistics.
(let ((block-size (block-size block heap)))
(incf (nr-heap-bytes-scanned heap) block-size)
;; Return the amount of work done.
block-size)))))
Source Context