Source
(defmethod mark-some-objects-in-table ((heap mark-and-sweep-heap) amount)
;; Mark all 'live' objects in the object table as dead (temporarily).
;; Returns the amount of work done.
(let* ((object-table (object-table heap))
(object-block-size (min-block-size object-table))
(first-object-id (floor (nr-object-bytes-marked heap)
object-block-size))
(work-done 0))
(loop for object-id from first-object-id
while (and (< object-id (object-table-size object-table))
(< work-done amount))
do (progn
(when (eql (object-info object-table object-id) :live-object)
;; Don't touch free or reserved blocks.
(setf (object-info object-table object-id) :dead-object))
(incf (nr-object-bytes-marked heap) object-block-size)
(incf work-done object-block-size)))
(when (>= (nr-object-bytes-marked heap) (nr-object-bytes heap))
;; We've finished this stage. Move to the next step.
(setf (state heap) :scanning))
;; Return the amount of work done.
work-done))
Source Context