Function sequant::eval::detail::residency_scope

Function Documentation

inline CellScope sequant::eval::detail::residency_scope(TableCell const &s)

The scope over which a produced cell s remains resident, once produced — decided by s.production.kind, exactly three cases: (1) Assemble: the prefix of s.scope.path ending at the deepest instance in bound_instances(s) (it dies when that loop’s batch ends); the root scope (empty path) when s is bound to none of its enclosing loops — the runtime’s close-store walk homes a whole block output that far out, all the way to the chain root; (2) Build (plain and implicit per-batch alike): always s.scope itself, bound or whole — a step’s value is stored in its own block’s cache and dies with that block, so even a whole Build cell spans only that block’s batches, never further out; (3) Leaf: the root scope. persistent and produce_if_absent are separate properties (survival across evaluations / first-visit production, not where within one evaluation a cell lives) and are not consulted here.

Note

This is the residency ceiling, deliberately: it is where a table-driven executor may home the cell, since such an executor homes an Assemble at that scope and slices every read of it explicitly. The forest runtime’s close-store walk stops earlier in two cases — at a loop that some consumer reads the value inside, and at the end of the cache chain — so a value that runtime holds deeper than this says is not a table defect; the reverse (the runtime holding it shallower than the table claims) would be.