|
Bertini 2 d882924 (2026-10-06 19:56 UTC)
Numerical algebraic geometry library (C++ core)
|
Re-intern deserialized node DAGs into the live hash-consing tables (ADR-0042). More...
Go to the source code of this file.
Namespaces | |
| namespace | bertini |
| namespace | bertini::node |
Typedefs | |
| using | bertini::node::ReinternMemo = std::map<Node const*, std::shared_ptr<Node>> |
| Memo for one re-interning pass: loaded node -> its interned replacement. | |
Functions | |
| std::shared_ptr< Node > | bertini::node::Reintern (std::shared_ptr< Node > const &root, ReinternMemo &memo) |
| Rebuild the DAG rooted at root through the interning factories (memoized, post-order), returning the canonical interned equivalent. | |
| std::shared_ptr< Node > | bertini::node::Reintern (std::shared_ptr< Node > const &root) |
| Convenience overload with a private memo (single-root use). | |
Re-intern deserialized node DAGs into the live hash-consing tables (ADR-0042).
Deserialization deliberately constructs nodes WITHOUT going through Make/Intern (node.hpp), so a freshly loaded tree does not share with structurally equal live nodes – and on a System-intern miss the loaded nodes would fork the intern universe: nothing built afterward, and nothing loaded from a second archive, would unify with them. Reintern() repairs that: a memoized post-order rebuild of the loaded DAG through the ordinary interning factories, so every subtree collapses onto its live canonical representative (or becomes it).
Runs ONLY at deserialization time. The pointer-keyed memo preserves the archive's internal sharing (each loaded object rebuilt once; the pass is linear). Rebuilding re-runs construction-time canonicalization, so it assumes the session canonicalization settings match those the tree was authored under – which the System digest header records (ADR-0042). Rebuilt nodes acquire fresh memoized state (structural hash, compiled-evaluator cache). Content is never changed: reinterning a tree leaves its canonical encoding, and hence any digest over it, bit-identical.