Function: READ-BLOCK-START

Source

(defun read-block-start (heap position)
  ;; All blocks start the same way: 8 bytes for the block header
  ;; (containing the size or a pointer to the next free block),
  ;; followed by the previous version pointer (a serialized positive
  ;; integer or nil) or the block size (a serialized negative integer; for
  ;; free blocks).
  (let ((stream (heap-stream heap)))
    (file-position stream position)
    (let ((block-header (read-unsigned-bytes (cell-buffer heap) stream)))
      (file-position stream (+ 8 position))
      (let ((block-start (deserialize stream)))
        (values block-header block-start)))))
Source Context