xo-interpreter2 stack: scaffold for virtual root VSM [WIP]

This commit is contained in:
Roland Conybeare 2026-03-25 18:00:36 -04:00
commit f8839278c3
2 changed files with 26 additions and 0 deletions

View file

@ -12,10 +12,14 @@
namespace xo {
namespace scm {
struct ReaderResult {
using ACollector = xo::mm::ACollector;
using span_type = xo::mm::span<const char>;
bool is_tk_error() const { return tk_error_.is_error(); }
/** forward gc-aware pointers (called during gc cycle) **/
void forward_children(obj<ACollector> gc) noexcept;
/** schematika expression parsed from input **/
obj<AExpression> expr_;
/** unconsumed portion of input span
@ -35,6 +39,7 @@ namespace xo {
**/
class SchematikaReader {
public:
using ACollector = xo::mm::ACollector;
using AAllocator = xo::mm::AAllocator;
using MemorySizeVisitor = xo::mm::MemorySizeVisitor;
using span_type = xo::mm::span<const char>;
@ -101,6 +106,9 @@ namespace xo {
**/
void reset_to_idle_toplevel();
/** update gc-aware child pointers **/
void forward_children(obj<ACollector> gc) noexcept;
private:
/** tokenizer converts a stream of chars
* to a stream of lexical tokens

View file

@ -9,6 +9,14 @@ namespace xo {
using xo::mm::MemorySizeInfo;
namespace scm {
void
ReaderResult::forward_children(obj<ACollector> gc) noexcept
{
gc.forward_pivot_inplace(&expr_);
}
// ----- SchematikaReader -----
SchematikaReader::SchematikaReader(const ReaderConfig & config,
obj<AAllocator> expr_alloc,
obj<AAllocator> aux_alloc)
@ -198,6 +206,16 @@ namespace xo {
this->tokenizer_.discard_current_line();
this->parser_.reset_to_idle_toplevel();
}
void
SchematikaReader::forward_children(obj<ACollector> gc) noexcept
{
// tokenizer doesn't contain any gc-aware pointers.
parser_.forward_children(gc);
result_.forward_children(gc);
}
} /*namespace scm*/
} /*namespace xo*/