xo-reader2 stack: expand symbol table to store typedefs

+ typedef utest
+ misc qol policy choices
This commit is contained in:
Roland Conybeare 2026-03-11 07:49:14 -05:00
commit 7cc7a277a3
4 changed files with 8 additions and 7 deletions

View file

@ -47,8 +47,8 @@ namespace xo {
/** @defgroup scm-globalenv-methods methods **/
///@{
/** symbol-table size. Is the number of distinct global symbols **/
size_type size() const noexcept { return symtab_->size(); }
/** symbol-table size. Is the number of distinct global variables **/
size_type n_vars() const noexcept { return symtab_->n_vars(); }
/** lookup current value associated with binding @p ix **/
obj<AGCObject> lookup_value(Binding ix) const noexcept;

View file

@ -41,7 +41,8 @@ namespace xo {
///@{
DLocalEnv * parent() const noexcept { return parent_; }
size_type size() const noexcept { return symtab_->size(); }
size_type n_vars() const noexcept { return symtab_->n_vars(); }
size_type n_types() const noexcept { return symtab_->n_types(); }
/** lookup current value associated with binding @p ix **/
obj<AGCObject> lookup_value(Binding ix) const noexcept;

View file

@ -21,7 +21,7 @@ namespace xo {
DGlobalEnv::_make(obj<AAllocator> mm,
DGlobalSymtab * symtab)
{
DArray * values = DArray::empty(mm, symtab->capacity());
DArray * values = DArray::empty(mm, symtab->var_capacity());
void * mem = mm.alloc_for<DGlobalSymtab>();
@ -136,7 +136,7 @@ namespace xo {
return ppii.pps()->pretty_struct
(ppii,
"DGlobalEnv",
refrtag("size", symtab_->size()));
refrtag("n_vars", symtab_->n_vars()));
}
} /*namespace scm*/

View file

@ -49,7 +49,7 @@ namespace xo {
if (env) {
auto j = ix.j_slot();
if (j < static_cast<decltype(j)>(env->size())) {
if (j < static_cast<decltype(j)>(env->n_vars())) {
return (*(env->args_))[j];
} else {
assert(false);
@ -78,7 +78,7 @@ namespace xo {
if (env) {
auto j = ix.j_slot();
if (j < static_cast<decltype(j)>(env->size())) {
if (j < static_cast<decltype(j)>(env->n_vars())) {
log && log("STUB: need write barrier for GC here");
(*(env->args_))[j] = x;
} else {