Class PersistentValueStore

Class Documentation

class PersistentValueStore

Values that survive CacheManager::reset() across repeated evaluations, keyed by the value’s canonical hash.

Owned as a plain value member of the cache handle (see CacheManager::persistent_values()) — not chained through parent_, so each handle’s store is local to it, unlike the array-ops and peak-monitor hooks that fall through to the scope-chain parent. It exists so a value whose cell is marked persistent by the table-driven batched executor’s registry (the explicit value cells; see CellReadResolver, cell_registry.hpp) can be written once and read back across repeated evaluations (e.g. successive CC iterations) without being reconstructed from the per-node entry lifetime bookkeeping above, whose persistence flag is scoped to one cache_map_ and drained/rebuilt by reset(). The batched executor’s registry is the sole intended writer; readers are the same registry resolving a persistent cell’s operand read.

What it holds is the frontier of the invariant region, not all of it: the table marks a cell persistent only when some consumer of it is volatile, or it is a forest root (see TableCell::persistent and detail::apply_persistence_frontier), so what accumulates here is the values that feed the next evaluation’s volatile work plus its results — not every invariant intermediate behind them. Nothing here is dropped by reset() by design; its lifetime is bounded by clear_persistent_values() or by the cache handle itself going away.

Public Functions

inline void put(std::size_t hash, ResultPtr v)

Store (or overwrite) the value for hash.

inline ResultPtr get(std::size_t hash) const
Returns:

the value stored for hash, or null if absent.

inline bool holds(std::size_t hash) const
Returns:

whether a value is currently stored for hash.

inline void erase(std::size_t hash)

Drop the value stored for hash, if any.

inline void clear()

Drop every stored value.

inline std::size_t size() const
Returns:

the number of values currently stored.

inline std::size_t bytes() const
Returns:

the sum of Result::size_in_bytes() over every stored value.

template<typename F>
inline void for_each(F &&f) const

Invoke f(hash, ResultPtr const&) for every stored value.