anchor.diff:  ;;;
   ;;; The goal is to translate a data flow graph into a graph of executable
   ;;; parts, called kernels. The data flow nodes form a DAG (directed acyclic
  -;;; graph). The data flow graph is fully determined by a set of graph roots
  -;;; --- typically the nodes passed to SCHEDULE.
  +;;; graph). The data flow graph is fully determined by a set of graph
  +;;; roots, typically the nodes passed to SCHEDULE.
   ;;;
   ;;; The resulting graph consists only of immediate values. Each immediate
  -;;; comes with a set of kernels. Each kernel describes how the values of a
  -;;; subspace of the index space of its target immediate can be
  +;;; hash a possibly empty set of kernels. Each kernel describes how values
  +;;; of a subspace of the index space of its target immediate can be
   ;;; computed. Furthermore each kernel tracks the set of its sources,
  -;;; i.e. other immediates that are referenced during their
  +;;; i.e. those immediates that are referenced during their
   ;;; evaluation. Since the resulting immediate graph is used to decide a
   ;;; scheduling and allocation strategy, it is important that its kernels
   ;;; are easy to analyze, yet expressive enough to denote fast programs.
  
positive.code:    3. A function, mapping each tree leaf to its corresponding immediate
  
     Return the sequence of immediates corresponding to the GRAPH-ROOTS."
    )
  
  (defun kernelize-graph (graph-roots)
    "Convert the data flow graph defined by GRAPH-ROOTS to an executable
     specification. Return a sequence of immediate values, each with a
     (possibly empty) set of kernels and dependencies."
    (let ((table (make-hash-table :test #'eq))
          (graph-roots (ensure-sequence graph-roots)))
      ;; step 1 - define a mapping from nodes to immediate values
      (labels ((register (node)
                 (setf (gethash node table)
                       (corresponding-immediate node))
                 (values))
               (register-root (node)
                 (unless (immediate? node)
                   (register node)))
               (traverse (node)
                 (if (or (< (refcount node) 2)
                         (immediate? node))
                     (traverse-inputs node)
                     (multiple-value-bind (value recurring)
                         (gethash node table)
                       (cond ((not recurring)
                              (setf (gethash node table) nil)
                              (traverse-inputs node))
                             ((and recurring (not value))
                              (register node))))))
               (traverse-inputs (node)
                 (dolist (input (inputs node))
                   (traverse input))))
        ;; explicitly register all non-immediate graph roots, because they
        ;; are tree roots regardless of their type or refcount
        (map nil #'register-root graph-roots)
        ;; now process the entire graph recursively
        (map nil #'traverse graph-roots))
      ;; step 2 - derive the kernels of each immediate
      (labels
          ((kernelize-hash-table-entry (tree-root target)
             ;; TABLE has an entry for all nodes that are potential kernel
             ;; targets (i.e. their refcount is bigger than 1). But only
             ;; those nodes with a non-NIL target actually need to be
             ;; kernelized, the rest is skipped
             (when target
               (flet ((leaf-function (node)
                        (cond
                          ;; the root is never a leaf
                          ((eq node tree-root) nil)
                          ;; all immediates are leaves
                          ((immediate? node) node)
                          ;; skip the table lookup when the refcount is small
                          ((< (refcount node) 2) nil)
                          ;; otherwise check the table
                          (t (values (gethash node table))))))
                 (declare (dynamic-extent #'leaf-function))
                 (let ((kernels (subgraph-kernels target tree-root #'leaf-function)))
                   (setf (kernels target) kernels))))))
        (maphash #'kernelize-hash-table-entry table))
      (map 'vector
           (lambda (node)
             (if (immediate? node)
                 node
                 (gethash node table)))
           graph-roots)))
  
  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  ;;;
  
negative.code: ;;;   data flow graph are critical nodes. However such a critical node is
  ;;;   cheap, because it has already been allocated.
  ;;;
  ;;; - Each graph root is a critical node -- the whole purpose of Petalisp
  ;;;   is to compute the values of these graph roots.
  ;;;
  ;;; - A node that appears as an input of multiple other nodes of the same
  ;;;   graph, is a critical node. As a result, all non-critical nodes have
  