From 8c0bf6a3112834274de827759a27ea69e1ff362e Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Fri, 13 Feb 2026 20:46:53 -0500 Subject: [PATCH] xo-interpreter2: work on global symtab [WIP] --- include/xo/expression2/DGlobalSymtab.hpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/include/xo/expression2/DGlobalSymtab.hpp b/include/xo/expression2/DGlobalSymtab.hpp index bb668ff3..91117888 100644 --- a/include/xo/expression2/DGlobalSymtab.hpp +++ b/include/xo/expression2/DGlobalSymtab.hpp @@ -6,6 +6,7 @@ #pragma once #include "Binding.hpp" +#include namespace xo { namespace scm { @@ -13,10 +14,21 @@ namespace xo { /** @class DGlobalSymtab * @brief symbol table for toplevel environment + * + * We're using DArenaHashMap to store pairs. + * Both of these are outside GC-space, so we don't need collector + * to traverse these. **/ - struct DGlobalSymtab { + class DGlobalSymtab { public: + using key_type = const DUniqueString *; + using value_type = Binding; + using repr_type = xo::map::DArenaHashMap; + using MemorySizeVisitor = xo::mm::MemorySizeVisitor; + public: + /** visit symtab-owned memory pools; call visitor(info) for each **/ + void visit_pools(const MemorySizeVisitor & visitor) const; public: /** @defgroup xo-expression2-symboltable-facet symboltable facet**/ @@ -31,6 +43,12 @@ namespace xo { ///@} private: + /** next binding will use this global index. See DGlobalEnv **/ + uint32_t next_binding_ix_ = 0; + + /** map symbols -> bindings **/ + repr_type map_; + }; } /*namespace scm*/