xo-interpreter2 stack: + stringtable() in RuntimeContext api

This commit is contained in:
Roland Conybeare 2026-03-16 01:27:25 -05:00
commit 383e1983a3
6 changed files with 25 additions and 0 deletions

View file

@ -5,6 +5,7 @@
#pragma once
#include <xo/stringtable2/StringTable.hpp>
#include <xo/alloc2/Allocator.hpp>
#include <xo/arena/MemorySizeInfo.hpp>
@ -19,6 +20,7 @@ namespace xo {
**/
class DVsmRcx {
public:
using StringTable = xo::scm::StringTable;
using AAllocator = xo::mm::AAllocator;
using MemorySizeVisitor = xo::mm::MemorySizeVisitor;
@ -26,6 +28,7 @@ namespace xo {
DVsmRcx(VirtualSchematikaMachine * vsm);
obj<AAllocator> allocator() const noexcept;
StringTable * stringtable() const noexcept;
obj<AAllocator> error_allocator() const noexcept;
void visit_pools(const MemorySizeVisitor & visitor) const;

View file

@ -91,6 +91,8 @@ namespace xo {
obj<AAllocator> allocator() const noexcept;
/** allocator for runtime errors **/
obj<AAllocator> error_allocator() const noexcept;
/** global unique-string table **/
StringTable * stringtable() noexcept;
/** true iff parser is at top-level -> does not contain
* state for a incomplete/partial expression

View file

@ -49,6 +49,8 @@ namespace xo {
// const methods
/** default allocator to use for objects **/
static obj<AAllocator> allocator(const DVsmRcx & self) noexcept;
/** stringtable for unique symbols **/
static StringTable * stringtable(const DVsmRcx & self) noexcept;
/** invoke visitor for each distinct memory pool **/
static void visit_pools(const DVsmRcx & self, MemorySizeVisitor visitor);

View file

@ -25,6 +25,12 @@ namespace xo {
return vsm_->error_allocator();
}
StringTable *
DVsmRcx::stringtable() const noexcept
{
return vsm_->stringtable();
}
void
DVsmRcx::visit_pools(const MemorySizeVisitor & visitor) const
{

View file

@ -21,6 +21,12 @@ namespace xo {
return self.allocator();
}
auto
IRuntimeContext_DVsmRcx::stringtable(const DVsmRcx & self) noexcept -> StringTable *
{
return self.stringtable();
}
auto
IRuntimeContext_DVsmRcx::visit_pools(const DVsmRcx & self, MemorySizeVisitor visitor) -> void
{

View file

@ -100,6 +100,12 @@ namespace xo {
return error_mm_.to_op();
}
StringTable *
VirtualSchematikaMachine::stringtable() noexcept
{
return reader_.stringtable();
}
bool
VirtualSchematikaMachine::is_at_toplevel() const noexcept
{