Method: (HANDLE-WRITTEN-OBJECT T T MARK-AND-SWEEP-HEAP)

Source

(defmethod handle-written-object (object-id block (heap mark-and-sweep-heap))
  ;; (This is called just after a (version of an) object has been
  ;; written to the heap.) Mark the object entry dead if the collector
  ;; is in the marking-object-table or scanning phase, and live otherwise.
  (setf (object-info (object-table heap) object-id)
        (case (state heap)
          ((:starting :marking-object-table :scanning)
           :dead-object)
          (otherwise
           :live-object)))
  ;; In the scanning phase, the object id must be added to the root set to
  ;; guarantee that it will be marked and scanned.
  (when (eql (state heap) :scanning)
    (push object-id (roots heap))))
Source Context