xo-reader2: + SyntaxStateMachine.forward_children method

Support gc traversal with goal of making ParserStateMachine a gc root
This commit is contained in:
Roland Conybeare 2026-03-24 17:43:45 -04:00
commit 3af72fec64
91 changed files with 626 additions and 39 deletions

View file

@ -5,8 +5,10 @@
#include "ApplySsm.hpp"
#include "ExpectExprSsm.hpp"
#include <xo/facet/FacetRegistry.hpp>
#include <xo/object2/Array.hpp>
#include <xo/alloc2/GCObject.hpp>
#include <xo/alloc2/Arena.hpp>
#include <xo/facet/FacetRegistry.hpp>
#include <xo/reflectutil/typeseq.hpp>
//#include "parserstatemachine.hpp"
@ -394,6 +396,13 @@ namespace xo {
refrtag("fn_expr", fn_expr, fn_expr_present));
}
void
DApplySsm::forward_children(obj<ACollector> gc) noexcept
{
gc.forward_pivot_inplace(&fn_expr_);
gc.forward_inplace(&args_expr_v_);
}
} /*namespace scm*/
} /*namespace xo*/

View file

@ -9,7 +9,7 @@
#include "DExpectExprSsm.hpp"
#include "ssm/ISyntaxStateMachine_DDefineSsm.hpp"
#include "ssm/IPrintable_DDefineSsm.hpp"
#include <xo/expression2/detail/IPrintable_DDefineExpr.hpp>
#include <xo/expression2/DefineExpr.hpp>
#include <xo/printable2/Printable.hpp>
#include <xo/facet/FacetRegistry.hpp>
@ -689,6 +689,14 @@ namespace xo {
refrtag("expect", this->get_expect_str()),
refrtag("def_expr", expr));
}
// ----- gc support -----
void
DDefineSsm::forward_children(obj<ACollector> gc)
{
gc.forward_inplace(&def_expr_.data_);
}
} /*namespace scm*/
} /*namespace xo*/

View file

@ -270,6 +270,12 @@ namespace xo {
refrtag("deftypestate", deftype_xst_),
refrtag("expect", this->get_expect_str()));
}
void
DDeftypeSsm::forward_children(obj<ACollector> /*gc*/) noexcept
{
static_assert(!DUniqueString::is_gc_eligible());
}
} /*namespace scm*/
} /*namespace xo*/

View file

@ -624,6 +624,12 @@ namespace xo {
}
#endif
void
DExpectExprSsm::forward_children(obj<ACollector> /*gc*/) noexcept
{
// all members POD, skip
}
} /*namespace scm*/
} /*namespace xo*/

View file

@ -264,6 +264,12 @@ namespace xo {
}
}
void
DExpectFormalArgSsm::forward_children(obj<ACollector> /*gc*/) noexcept
{
static_assert(!DUniqueString::is_gc_eligible());
}
} /*namespace scm*/
} /*namespace xo*/

View file

@ -4,25 +4,15 @@
*/
#include "ExpectFormalArglistSsm.hpp"
//#include "ssm/ISyntaxStateMachine_DExpectFormalArglistSsm.hpp"
#include "ExpectFormalArgSsm.hpp"
//#include "ssm/ISyntaxStateMachine_DExpectFormalArgSsm.hpp"
#include <xo/expression2/DVariable.hpp>
#include <xo/expression2/detail/IGCObject_DVariable.hpp>
#include <xo/expression2/Variable.hpp>
#include <xo/object2/Array.hpp>
#include <xo/printable2/Printable.hpp>
#include <xo/alloc2/GCObject.hpp>
#include <xo/alloc2/arena/IAllocator_DArena.hpp>
#include <xo/facet/FacetRegistry.hpp>
#include <xo/indentlog/scope.hpp>
#ifdef NOT_YET
#include "parserstatemachine.hpp"
#include "exprstatestack.hpp"
#include "expect_formal_xs.hpp"
#include "expect_symbol_xs.hpp"
#include "xo/expression/Variable.hpp"
#include "xo/indentlog/print/vector.hpp"
#endif
namespace xo {
using xo::print::APrintable;
using xo::print::ppstate;
@ -367,6 +357,12 @@ namespace xo {
}
}
void
DExpectFormalArglistSsm::forward_children(obj<ACollector> gc) noexcept
{
gc.forward_inplace(&argl_);
}
} /*namespace scm*/
} /*namespace xo*/

View file

@ -7,6 +7,7 @@
#include "ExpectTypeSsm.hpp"
#include "syntaxstatetype.hpp"
#include <xo/type/ListType.hpp>
#include <xo/alloc2/GCObject.hpp>
#include <string_view>
namespace xo {
@ -202,6 +203,12 @@ namespace xo {
"DExpectListTypeSsm");
}
void
DExpectListTypeSsm::forward_children(obj<ACollector> gc) noexcept
{
gc.forward_pivot_inplace(&elt_type_);
}
} /*namespace scm*/
} /*namespace xo*/

View file

@ -6,6 +6,7 @@
#include "ExpectQArraySsm.hpp"
#include "ExpectQLiteralSsm.hpp"
#include <xo/object2/Array.hpp>
#include <xo/alloc2/GCObject.hpp>
#include <xo/facet/FacetRegistry.hpp>
#include <xo/indentlog/print/pretty.hpp>
@ -218,6 +219,12 @@ namespace xo {
refrtag("expect", this->get_expect_str()),
refrtag("array", array_pr));
}
void
DExpectQArraySsm::forward_children(obj<ACollector> gc) noexcept
{
gc.forward_inplace(&array_);
}
}
}

View file

@ -5,6 +5,8 @@
#include "ExpectQDictSsm.hpp"
#include "ExpectQLiteralSsm.hpp"
#include <xo/stringtable2/String.hpp>
#include <xo/alloc2/GCObject.hpp>
namespace xo {
using xo::print::APrintable;
@ -264,6 +266,13 @@ namespace xo {
}
void
DExpectQDictSsm::forward_children(obj<ACollector> gc) noexcept
{
gc.forward_inplace(const_cast<DString **>(&key_));
gc.forward_inplace(&dict_);
}
} /*namespace scm*/
} /*namespace xo*/

View file

@ -6,6 +6,7 @@
#include "ExpectQListSsm.hpp"
#include "ExpectQLiteralSsm.hpp"
#include <xo/object2/List.hpp>
#include <xo/alloc2/GCObject.hpp>
#include <xo/facet/FacetRegistry.hpp>
#include <xo/indentlog/print/pretty.hpp>
@ -213,6 +214,13 @@ namespace xo {
refrtag("expect", this->get_expect_str()),
refrtag("list", list_pr));
}
void
DExpectQListSsm::forward_children(obj<ACollector> gc) noexcept
{
gc.forward_inplace(&start_);
gc.forward_inplace(&end_);
}
}
}

View file

@ -255,6 +255,12 @@ namespace xo {
"DExpectQLiteralSsm",
refrtag("expect", this->get_expect_str()));
}
void
DExpectQLiteralSsm::forward_children(obj<ACollector> /*gc*/) noexcept
{
// cxl_on_rightparen_, cxl_on_rightbracket_: POD, skip
}
} /*namespace scm*/
} /*namespace xo*/

View file

@ -145,6 +145,12 @@ namespace xo {
//refrtag("member", member_)
);
}
void
DExpectSymbolSsm::forward_children(obj<ACollector> /*gc*/) noexcept
{
// no gc-aware members
}
} /*namespace scm*/
} /*namespace xo*/

View file

@ -197,6 +197,12 @@ namespace xo {
"DExpectTypeSsm");
}
void
DExpectTypeSsm::forward_children(obj<ACollector> /*gc*/) noexcept
{
// corrected_: POD, skip
}
} /*namespace scm*/
} /*namespace xo*/

View file

@ -9,6 +9,7 @@
#include "DExpectExprSsm.hpp"
#include <xo/expression2/detail/IPrintable_DIfElseExpr.hpp>
#include <xo/printable2/Printable.hpp>
#include <xo/alloc2/GCObject.hpp>
#include <xo/facet/FacetRegistry.hpp>
namespace xo {
@ -507,5 +508,10 @@ namespace xo {
refrtag("if_expr", expr));
}
void
DIfElseSsm::forward_children(obj<ACollector> gc) noexcept
{
gc.forward_pivot_inplace(&if_expr_);
}
} /*namespace scm*/
} /*namespace xo*/

View file

@ -16,6 +16,7 @@
//#include <xo/expression2/detail/IExpression_DVariable.hpp>
//#include <xo/expression2/symtab/ISymbolTable_DLocalSymtab.hpp>
#include <xo/printable2/Printable.hpp>
#include <xo/alloc2/GCObject.hpp>
#include <xo/facet/FacetRegistry.hpp>
#include <xo/arena/DArena.hpp>
@ -472,6 +473,14 @@ namespace xo {
}
}
void
DLambdaSsm::forward_children(obj<ACollector> gc) noexcept
{
gc.forward_inplace(&local_symtab_);
gc.forward_pivot_inplace(&body_);
gc.forward_pivot_inplace(&parent_symtab_);
}
} /*namespace scm*/
} /*namespace xo*/

View file

@ -6,6 +6,7 @@
#include "ParenSsm.hpp"
#include "ExpectExprSsm.hpp"
#include "syntaxstatetype.hpp"
#include <xo/alloc2/GCObject.hpp>
#include <string_view>
namespace xo {
@ -457,6 +458,11 @@ namespace xo {
refrtag("expect", this->get_expect_str()));
}
void
DParenSsm::forward_children(obj<ACollector> gc) noexcept
{
gc.forward_pivot_inplace(&expr_);
}
} /*namespace scm*/
} /*namespace xo*/

View file

@ -22,6 +22,7 @@
#include <xo/procedure2/init_primitives.hpp> // for xo::scm::Primitives
#include <xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp>
#include <xo/alloc2/GCObject.hpp>
#include <xo/printable2/Printable.hpp>
#include <xo/facet/FacetRegistry.hpp>
#include <xo/reflectutil/typeseq.hpp>
@ -1242,6 +1243,13 @@ case optype::op_assign:
return obj<AExpression>();
}
void
DProgressSsm::forward_children(obj<ACollector> gc) noexcept
{
gc.forward_pivot_inplace(&lhs_);
gc.forward_pivot_inplace(&rhs_);
}
} /*namespace scm*/
} /*namespace xo*/

View file

@ -211,6 +211,12 @@ namespace xo {
refrtag("expect", this->get_expect_str()));
}
void
DQuoteSsm::forward_children(obj<ACollector> gc) noexcept
{
gc.forward_pivot_inplace(&expr_);
}
} /*namespace scm*/
} /*namespace xo*/

View file

@ -3,12 +3,13 @@
#include "DSequenceSsm.hpp"
#include "ssm/ISyntaxStateMachine_DSequenceSsm.hpp"
#include "DExpectExprSsm.hpp"
#include <xo/expression2/SequenceExpr.hpp>
#include <xo/alloc2/GCObject.hpp>
#ifdef NOT_YET
#include "expect_expr_xs.hpp"
#include "let1_xs.hpp"
#include "xo/expression/DefineExpr.hpp"
#include "xo/expression/Sequence.hpp"
#include "xo/expression/pretty_expression.hpp"
#endif
@ -256,6 +257,12 @@ namespace xo {
refrtag("expect", this->get_expect_str()));
}
void
DSequenceSsm::forward_children(obj<ACollector> gc) noexcept
{
gc.forward_inplace(&seq_expr_);
}
} /*namespace scm*/
} /*namespace xo*/

View file

@ -517,6 +517,12 @@ namespace xo {
"DToplevelSeqSsm",
refrtag("seqtype", seqtype_));
}
void
DToplevelSeqSsm::forward_children(obj<ACollector> /*gc*/) noexcept
{
// seqtype_: POD, skip
}
} /*namespace scm*/
} /*namespace xo*/

View file

@ -95,6 +95,12 @@ ISyntaxStateMachine_Any::on_quoted_literal(Opaque, obj<AGCObject>, ParserStateMa
_fatal();
}
auto
ISyntaxStateMachine_Any::forward_children(Opaque, obj<ACollector>) -> void
{
_fatal();
}
} /*namespace scm*/
} /*namespace xo*/

View file

@ -77,6 +77,11 @@ namespace xo {
{
self.on_quoted_literal(lit, p_psm);
}
auto
ISyntaxStateMachine_DDefineSsm::forward_children(DDefineSsm & self, obj<ACollector> gc) -> void
{
self.forward_children(gc);
}
} /*namespace scm*/
} /*namespace xo*/

View file

@ -77,6 +77,11 @@ namespace xo {
{
self.on_quoted_literal(lit, p_psm);
}
auto
ISyntaxStateMachine_DExpectExprSsm::forward_children(DExpectExprSsm & self, obj<ACollector> gc) -> void
{
self.forward_children(gc);
}
} /*namespace scm*/
} /*namespace xo*/

View file

@ -77,6 +77,11 @@ namespace xo {
{
self.on_quoted_literal(lit, p_psm);
}
auto
ISyntaxStateMachine_DExpectFormalArglistSsm::forward_children(DExpectFormalArglistSsm & self, obj<ACollector> gc) -> void
{
self.forward_children(gc);
}
} /*namespace scm*/
} /*namespace xo*/

View file

@ -77,6 +77,11 @@ namespace xo {
{
self.on_quoted_literal(lit, p_psm);
}
auto
ISyntaxStateMachine_DExpectQArraySsm::forward_children(DExpectQArraySsm & self, obj<ACollector> gc) -> void
{
self.forward_children(gc);
}
} /*namespace scm*/
} /*namespace xo*/

View file

@ -77,6 +77,11 @@ namespace xo {
{
self.on_quoted_literal(lit, p_psm);
}
auto
ISyntaxStateMachine_DExpectQListSsm::forward_children(DExpectQListSsm & self, obj<ACollector> gc) -> void
{
self.forward_children(gc);
}
} /*namespace scm*/
} /*namespace xo*/

View file

@ -77,6 +77,11 @@ namespace xo {
{
self.on_quoted_literal(lit, p_psm);
}
auto
ISyntaxStateMachine_DExpectQLiteralSsm::forward_children(DExpectQLiteralSsm & self, obj<ACollector> gc) -> void
{
self.forward_children(gc);
}
} /*namespace scm*/
} /*namespace xo*/

View file

@ -77,6 +77,11 @@ namespace xo {
{
self.on_quoted_literal(lit, p_psm);
}
auto
ISyntaxStateMachine_DExpectSymbolSsm::forward_children(DExpectSymbolSsm & self, obj<ACollector> gc) -> void
{
self.forward_children(gc);
}
} /*namespace scm*/
} /*namespace xo*/

View file

@ -77,6 +77,11 @@ namespace xo {
{
self.on_quoted_literal(lit, p_psm);
}
auto
ISyntaxStateMachine_DExpectTypeSsm::forward_children(DExpectTypeSsm & self, obj<ACollector> gc) -> void
{
self.forward_children(gc);
}
} /*namespace scm*/
} /*namespace xo*/

View file

@ -77,6 +77,11 @@ namespace xo {
{
self.on_quoted_literal(lit, p_psm);
}
auto
ISyntaxStateMachine_DParenSsm::forward_children(DParenSsm & self, obj<ACollector> gc) -> void
{
self.forward_children(gc);
}
} /*namespace scm*/
} /*namespace xo*/

View file

@ -77,6 +77,11 @@ namespace xo {
{
self.on_quoted_literal(lit, p_psm);
}
auto
ISyntaxStateMachine_DProgressSsm::forward_children(DProgressSsm & self, obj<ACollector> gc) -> void
{
self.forward_children(gc);
}
} /*namespace scm*/
} /*namespace xo*/

View file

@ -77,6 +77,11 @@ namespace xo {
{
self.on_quoted_literal(lit, p_psm);
}
auto
ISyntaxStateMachine_DQuoteSsm::forward_children(DQuoteSsm & self, obj<ACollector> gc) -> void
{
self.forward_children(gc);
}
} /*namespace scm*/
} /*namespace xo*/

View file

@ -77,6 +77,11 @@ namespace xo {
{
self.on_quoted_literal(lit, p_psm);
}
auto
ISyntaxStateMachine_DSequenceSsm::forward_children(DSequenceSsm & self, obj<ACollector> gc) -> void
{
self.forward_children(gc);
}
} /*namespace scm*/
} /*namespace xo*/

View file

@ -77,6 +77,11 @@ namespace xo {
{
self.on_quoted_literal(lit, p_psm);
}
auto
ISyntaxStateMachine_DToplevelSeqSsm::forward_children(DToplevelSeqSsm & self, obj<ACollector> gc) -> void
{
self.forward_children(gc);
}
} /*namespace scm*/
} /*namespace xo*/

View file

@ -77,6 +77,11 @@ namespace xo {
{
self.on_quoted_literal(lit, p_psm);
}
auto
ISyntaxStateMachine_DApplySsm::forward_children(DApplySsm & self, obj<ACollector> gc) -> void
{
self.forward_children(gc);
}
} /*namespace scm*/
} /*namespace xo*/

View file

@ -77,6 +77,11 @@ namespace xo {
{
self.on_quoted_literal(lit, p_psm);
}
auto
ISyntaxStateMachine_DDeftypeSsm::forward_children(DDeftypeSsm & self, obj<ACollector> gc) -> void
{
self.forward_children(gc);
}
} /*namespace scm*/
} /*namespace xo*/

View file

@ -77,6 +77,11 @@ namespace xo {
{
self.on_quoted_literal(lit, p_psm);
}
auto
ISyntaxStateMachine_DExpectFormalArgSsm::forward_children(DExpectFormalArgSsm & self, obj<ACollector> gc) -> void
{
self.forward_children(gc);
}
} /*namespace scm*/
} /*namespace xo*/

View file

@ -77,6 +77,11 @@ namespace xo {
{
self.on_quoted_literal(lit, p_psm);
}
auto
ISyntaxStateMachine_DExpectListTypeSsm::forward_children(DExpectListTypeSsm & self, obj<ACollector> gc) -> void
{
self.forward_children(gc);
}
} /*namespace scm*/
} /*namespace xo*/

View file

@ -77,6 +77,11 @@ namespace xo {
{
self.on_quoted_literal(lit, p_psm);
}
auto
ISyntaxStateMachine_DExpectQDictSsm::forward_children(DExpectQDictSsm & self, obj<ACollector> gc) -> void
{
self.forward_children(gc);
}
} /*namespace scm*/
} /*namespace xo*/

View file

@ -77,6 +77,11 @@ namespace xo {
{
self.on_quoted_literal(lit, p_psm);
}
auto
ISyntaxStateMachine_DIfElseSsm::forward_children(DIfElseSsm & self, obj<ACollector> gc) -> void
{
self.forward_children(gc);
}
} /*namespace scm*/
} /*namespace xo*/

View file

@ -77,6 +77,11 @@ namespace xo {
{
self.on_quoted_literal(lit, p_psm);
}
auto
ISyntaxStateMachine_DLambdaSsm::forward_children(DLambdaSsm & self, obj<ACollector> gc) -> void
{
self.forward_children(gc);
}
} /*namespace scm*/
} /*namespace xo*/