From 263999efdb632f637fb86bd95d1e328c71e20e17 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Tue, 24 Mar 2026 17:43:45 -0400 Subject: [PATCH] xo-reader2: + SyntaxStateMachine.forward_children method Support gc traversal with goal of making ParserStateMachine a gc root --- xo-reader2/DESIGN.md | 9 +++ xo-reader2/idl/SyntaxStateMachine.json5 | 12 +++- xo-reader2/include/xo/reader2/DDefineSsm.hpp | 8 +++ .../include/xo/reader2/DExpectExprSsm.hpp | 8 +++ .../xo/reader2/DExpectFormalArglistSsm.hpp | 8 +++ .../include/xo/reader2/DExpectQArraySsm.hpp | 8 +++ .../include/xo/reader2/DExpectQListSsm.hpp | 8 +++ .../include/xo/reader2/DExpectQLiteralSsm.hpp | 8 +++ .../include/xo/reader2/DExpectSymbolSsm.hpp | 8 +++ .../include/xo/reader2/DExpectTypeSsm.hpp | 8 +++ .../include/xo/reader2/DProgressSsm.hpp | 8 +++ xo-reader2/include/xo/reader2/DQuoteSsm.hpp | 7 ++ .../include/xo/reader2/DSequenceSsm.hpp | 12 +++- .../include/xo/reader2/DToplevelSeqSsm.hpp | 8 +++ .../include/xo/reader2/ParserResult.hpp | 4 ++ xo-reader2/include/xo/reader2/ParserStack.hpp | 5 ++ .../include/xo/reader2/ParserStateMachine.hpp | 53 ++++++++++++-- .../include/xo/reader2/apply/DApplySsm.hpp | 8 +++ .../apply/ISyntaxStateMachine_DApplySsm.hpp | 3 + .../xo/reader2/deftype/DDeftypeSsm.hpp | 8 +++ .../ISyntaxStateMachine_DDeftypeSsm.hpp | 3 + .../expect_formal_arg/DExpectFormalArgSsm.hpp | 8 +++ ...SyntaxStateMachine_DExpectFormalArgSsm.hpp | 3 + .../expect_listtype/DExpectListTypeSsm.hpp | 8 +++ ...ISyntaxStateMachine_DExpectListTypeSsm.hpp | 3 + .../reader2/expect_qdict/DExpectQDictSsm.hpp | 8 +++ .../ISyntaxStateMachine_DExpectQDictSsm.hpp | 3 + .../include/xo/reader2/ifelse/DIfElseSsm.hpp | 8 +++ .../ifelse/ISyntaxStateMachine_DIfElseSsm.hpp | 3 + .../include/xo/reader2/lambda/DLambdaSsm.hpp | 8 +++ .../lambda/ISyntaxStateMachine_DLambdaSsm.hpp | 3 + .../include/xo/reader2/paren/DParenSsm.hpp | 8 +++ .../paren/ISyntaxStateMachine_DParenSsm.hpp | 3 + .../xo/reader2/parser/DSchematikaParser.hpp | 70 +++++++++++++++---- .../xo/reader2/ssm/ASyntaxStateMachine.hpp | 12 +++- .../reader2/ssm/ISyntaxStateMachine_Any.hpp | 2 + .../ssm/ISyntaxStateMachine_DDefineSsm.hpp | 3 + .../ISyntaxStateMachine_DExpectExprSsm.hpp | 3 + ...axStateMachine_DExpectFormalArglistSsm.hpp | 3 + .../ISyntaxStateMachine_DExpectQArraySsm.hpp | 3 + .../ISyntaxStateMachine_DExpectQListSsm.hpp | 3 + ...ISyntaxStateMachine_DExpectQLiteralSsm.hpp | 3 + .../ISyntaxStateMachine_DExpectSymbolSsm.hpp | 3 + .../ISyntaxStateMachine_DExpectTypeSsm.hpp | 3 + .../ssm/ISyntaxStateMachine_DProgressSsm.hpp | 3 + .../ssm/ISyntaxStateMachine_DQuoteSsm.hpp | 3 + .../ssm/ISyntaxStateMachine_DSequenceSsm.hpp | 3 + .../ISyntaxStateMachine_DToplevelSeqSsm.hpp | 3 + .../reader2/ssm/ISyntaxStateMachine_Xfer.hpp | 5 ++ .../xo/reader2/ssm/RSyntaxStateMachine.hpp | 4 ++ xo-reader2/src/reader2/DApplySsm.cpp | 11 ++- xo-reader2/src/reader2/DDefineSsm.cpp | 10 ++- xo-reader2/src/reader2/DDeftypeSsm.cpp | 6 ++ xo-reader2/src/reader2/DExpectExprSsm.cpp | 6 ++ .../src/reader2/DExpectFormalArgSsm.cpp | 6 ++ .../src/reader2/DExpectFormalArglistSsm.cpp | 22 +++--- xo-reader2/src/reader2/DExpectListTypeSsm.cpp | 7 ++ xo-reader2/src/reader2/DExpectQArraySsm.cpp | 7 ++ xo-reader2/src/reader2/DExpectQDictSsm.cpp | 9 +++ xo-reader2/src/reader2/DExpectQListSsm.cpp | 8 +++ xo-reader2/src/reader2/DExpectQLiteralSsm.cpp | 6 ++ xo-reader2/src/reader2/DExpectSymbolSsm.cpp | 6 ++ xo-reader2/src/reader2/DExpectTypeSsm.cpp | 6 ++ xo-reader2/src/reader2/DIfElseSsm.cpp | 6 ++ xo-reader2/src/reader2/DLambdaSsm.cpp | 9 +++ xo-reader2/src/reader2/DParenSsm.cpp | 6 ++ xo-reader2/src/reader2/DProgressSsm.cpp | 8 +++ xo-reader2/src/reader2/DQuoteSsm.cpp | 6 ++ xo-reader2/src/reader2/DSequenceSsm.cpp | 9 ++- xo-reader2/src/reader2/DToplevelSeqSsm.cpp | 6 ++ .../src/reader2/ISyntaxStateMachine_Any.cpp | 6 ++ .../ISyntaxStateMachine_DDefineSsm.cpp | 5 ++ .../ISyntaxStateMachine_DExpectExprSsm.cpp | 5 ++ ...axStateMachine_DExpectFormalArglistSsm.cpp | 5 ++ .../ISyntaxStateMachine_DExpectQArraySsm.cpp | 5 ++ .../ISyntaxStateMachine_DExpectQListSsm.cpp | 5 ++ ...ISyntaxStateMachine_DExpectQLiteralSsm.cpp | 5 ++ .../ISyntaxStateMachine_DExpectSymbolSsm.cpp | 5 ++ .../ISyntaxStateMachine_DExpectTypeSsm.cpp | 5 ++ .../reader2/ISyntaxStateMachine_DParenSsm.cpp | 5 ++ .../ISyntaxStateMachine_DProgressSsm.cpp | 5 ++ .../reader2/ISyntaxStateMachine_DQuoteSsm.cpp | 5 ++ .../ISyntaxStateMachine_DSequenceSsm.cpp | 5 ++ .../ISyntaxStateMachine_DToplevelSeqSsm.cpp | 5 ++ .../facet/ISyntaxStateMachine_DApplySsm.cpp | 5 ++ .../facet/ISyntaxStateMachine_DDeftypeSsm.cpp | 5 ++ ...SyntaxStateMachine_DExpectFormalArgSsm.cpp | 5 ++ ...ISyntaxStateMachine_DExpectListTypeSsm.cpp | 5 ++ .../ISyntaxStateMachine_DExpectQDictSsm.cpp | 5 ++ .../facet/ISyntaxStateMachine_DIfElseSsm.cpp | 5 ++ .../facet/ISyntaxStateMachine_DLambdaSsm.cpp | 5 ++ xo-type/src/type/DTypeVarRef.cpp | 11 +-- 92 files changed, 633 insertions(+), 43 deletions(-) diff --git a/xo-reader2/DESIGN.md b/xo-reader2/DESIGN.md index 73e863e3..11a8a6ef 100644 --- a/xo-reader2/DESIGN.md +++ b/xo-reader2/DESIGN.md @@ -2,6 +2,15 @@ Uses arena allocators for fast+efficient parsing. Composition of nested state machines. +## SchematikaParser + +Parser to convert schematika text to expressions. + +### Details + +Partial GCObject facet support, so a SchmeatikaParser instance can +be a gc root. + ## SyntaxStateMachine a state machine dedicated to some particular Schematika syntax. diff --git a/xo-reader2/idl/SyntaxStateMachine.json5 b/xo-reader2/idl/SyntaxStateMachine.json5 index 0238749c..8450b02b 100644 --- a/xo-reader2/idl/SyntaxStateMachine.json5 +++ b/xo-reader2/idl/SyntaxStateMachine.json5 @@ -10,13 +10,14 @@ "", "", "", + "" ], // extra includes in SyntaxStateMachine.hpp, if any user_hpp_includes: [], namespace1: "xo", namespace2: "scm", // text after includes, before ASyntaxStateMachine - pretext: ["// {pretex} here"], + pretext: ["// {pretext} here"], facet: "SyntaxStateMachine", detail_subdir: "ssm", brief: "specialized state machine for parsing some particular schematika syntax", @@ -26,6 +27,7 @@ ], types: [ { name: "TypeDescr", doc: [ "reflected c++ type" ], definition: "xo::reflect::TypeDescr" }, + { name: "ACollector", doc: [ "gc interface" ], definition: "xo::mm::ACollector" }, { name: "AGCObject", doc: [ "gc-aware object" ], definition: "xo::mm::AGCObject" }, // { name: string, doc: [ string ], definition: string }, ], @@ -143,6 +145,14 @@ {type: "obj", name: "lit"}, {type: "ParserStateMachine *", name: "p_psm"}, ], + }, + { + name: "forward_children", + doc: ["gc support: move immediate children to to-space and sub forwarding pointer"], + return_type: "void", + args: [ + {type: "obj", name: "gc"}, + ], } ], router_facet_explicit_content: [ ], diff --git a/xo-reader2/include/xo/reader2/DDefineSsm.hpp b/xo-reader2/include/xo/reader2/DDefineSsm.hpp index 6380a233..e372e299 100644 --- a/xo-reader2/include/xo/reader2/DDefineSsm.hpp +++ b/xo-reader2/include/xo/reader2/DDefineSsm.hpp @@ -73,6 +73,7 @@ namespace xo { public: using Super = DSyntaxStateMachine; using TypeDescr = xo::reflect::TypeDescr; + using ACollector = xo::mm::ACollector; using AAllocator = xo::mm::AAllocator; using DArena = xo::mm::DArena; using ppindentinfo = xo::print::ppindentinfo; @@ -195,6 +196,13 @@ namespace xo { bool pretty(const ppindentinfo & ppii) const; ///@} + /** @defgroup scm-define-gc-support **/ + ///@{ + + /** gc support: visit gc-aware child pointers **/ + void forward_children(obj gc); + + ///@} private: /** @defgroup scm-definessm-member-vars **/ diff --git a/xo-reader2/include/xo/reader2/DExpectExprSsm.hpp b/xo-reader2/include/xo/reader2/DExpectExprSsm.hpp index 66189754..a1ba1c69 100644 --- a/xo-reader2/include/xo/reader2/DExpectExprSsm.hpp +++ b/xo-reader2/include/xo/reader2/DExpectExprSsm.hpp @@ -18,6 +18,7 @@ namespace xo { public: using Super = DSyntaxStateMachine; using TypeDescr = xo::reflect::TypeDescr; + using ACollector = xo::mm::ACollector; using DArena = xo::mm::DArena; using ppindentinfo = xo::print::ppindentinfo; @@ -190,6 +191,13 @@ namespace xo { bool pretty(const ppindentinfo & ppii) const; ///@} + /** @defgroup scm-expectexprssm-gc-support gc support methods **/ + ///@{ + + /** gc support: visit gc-aware child pointers **/ + void forward_children(obj gc) noexcept; + + ///@} private: /** if true: allow a define-expression here; otherwise reject **/ diff --git a/xo-reader2/include/xo/reader2/DExpectFormalArglistSsm.hpp b/xo-reader2/include/xo/reader2/DExpectFormalArglistSsm.hpp index 3129f0dc..f28cbac1 100644 --- a/xo-reader2/include/xo/reader2/DExpectFormalArglistSsm.hpp +++ b/xo-reader2/include/xo/reader2/DExpectFormalArglistSsm.hpp @@ -55,6 +55,7 @@ namespace xo { class DExpectFormalArglistSsm : public DSyntaxStateMachine { public: using Super = DSyntaxStateMachine; + using ACollector = xo::mm::ACollector; using AAllocator = xo::mm::AAllocator; using DArena = xo::mm::DArena; using TypeDescr = xo::reflect::TypeDescr; @@ -125,6 +126,13 @@ namespace xo { bool pretty(const ppindentinfo & ppii) const; ///@} + /** @defgroup scm-expectformalarglistssm-gc-support gc support methods **/ + ///@{ + + /** gc support: visit gc-aware child pointers **/ + void forward_children(obj gc) noexcept; + + ///@} private: /** @defgroup scm-expectformalarglistssm-impl-methods **/ diff --git a/xo-reader2/include/xo/reader2/DExpectQArraySsm.hpp b/xo-reader2/include/xo/reader2/DExpectQArraySsm.hpp index 929460dc..068a5b93 100644 --- a/xo-reader2/include/xo/reader2/DExpectQArraySsm.hpp +++ b/xo-reader2/include/xo/reader2/DExpectQArraySsm.hpp @@ -58,6 +58,7 @@ namespace xo { class DExpectQArraySsm : public DSyntaxStateMachine { public: using Super = DSyntaxStateMachine; + using ACollector = xo::mm::ACollector; using AAllocator = xo::mm::AAllocator; using DArena = xo::mm::DArena; using TypeDescr = xo::reflect::TypeDescr; @@ -119,6 +120,13 @@ namespace xo { bool pretty(const ppindentinfo & ppii) const; ///@} + /** @defgroup scm-expectqarrayssm-gc-support gc support methods **/ + ///@{ + + /** gc support: visit gc-aware child pointers **/ + void forward_children(obj gc) noexcept; + + ///@} private: /** @defgroup scm-expectqarrayssm-member-vars **/ diff --git a/xo-reader2/include/xo/reader2/DExpectQListSsm.hpp b/xo-reader2/include/xo/reader2/DExpectQListSsm.hpp index 770821bc..c2119c8b 100644 --- a/xo-reader2/include/xo/reader2/DExpectQListSsm.hpp +++ b/xo-reader2/include/xo/reader2/DExpectQListSsm.hpp @@ -58,6 +58,7 @@ namespace xo { class DExpectQListSsm : public DSyntaxStateMachine { public: using Super = DSyntaxStateMachine; + using ACollector = xo::mm::ACollector; using AAllocator = xo::mm::AAllocator; using DArena = xo::mm::DArena; using TypeDescr = xo::reflect::TypeDescr; @@ -119,6 +120,13 @@ namespace xo { bool pretty(const ppindentinfo & ppii) const; ///@} + /** @defgroup scm-expectqlistssm-gc-support gc support methods **/ + ///@{ + + /** gc support: visit gc-aware child pointers **/ + void forward_children(obj gc) noexcept; + + ///@} private: /** @defgroup scm-expectqlistssm-member-vars **/ diff --git a/xo-reader2/include/xo/reader2/DExpectQLiteralSsm.hpp b/xo-reader2/include/xo/reader2/DExpectQLiteralSsm.hpp index 6beb3430..f037c7d8 100644 --- a/xo-reader2/include/xo/reader2/DExpectQLiteralSsm.hpp +++ b/xo-reader2/include/xo/reader2/DExpectQLiteralSsm.hpp @@ -15,6 +15,7 @@ namespace xo { class DExpectQLiteralSsm : public DSyntaxStateMachine { public: using Super = DSyntaxStateMachine; + using ACollector = xo::mm::ACollector; using AAllocator = xo::mm::AAllocator; using DArena = xo::mm::DArena; using TypeDescr = xo::reflect::TypeDescr; @@ -124,6 +125,13 @@ namespace xo { bool pretty(const ppindentinfo & ppii) const; ///@} + /** @defgroup scm-expectqliteralssm-gc-support gc support methods **/ + ///@{ + + /** gc support: visit gc-aware child pointers **/ + void forward_children(obj gc) noexcept; + + ///@} private: /** @defgroup scm-expectformalarglistssm-impl-methods **/ diff --git a/xo-reader2/include/xo/reader2/DExpectSymbolSsm.hpp b/xo-reader2/include/xo/reader2/DExpectSymbolSsm.hpp index b621985b..9ca3e1a0 100644 --- a/xo-reader2/include/xo/reader2/DExpectSymbolSsm.hpp +++ b/xo-reader2/include/xo/reader2/DExpectSymbolSsm.hpp @@ -21,6 +21,7 @@ namespace xo { class DExpectSymbolSsm : public DSyntaxStateMachine { public: using Super = DSyntaxStateMachine; + using ACollector = xo::mm::ACollector; using DArena = xo::mm::DArena; using TypeDescr = xo::reflect::TypeDescr; using ppindentinfo = xo::print::ppindentinfo; @@ -74,6 +75,13 @@ namespace xo { bool pretty(const ppindentinfo & ppii) const; + ///@} + /** @defgroup scm-expectsymbolssm-gc-support gc support methods **/ + ///@{ + + /** gc support: visit gc-aware child pointers **/ + void forward_children(obj gc) noexcept; + ///@} }; } /*namespace scm*/ diff --git a/xo-reader2/include/xo/reader2/DExpectTypeSsm.hpp b/xo-reader2/include/xo/reader2/DExpectTypeSsm.hpp index 2901c95a..7fae992d 100644 --- a/xo-reader2/include/xo/reader2/DExpectTypeSsm.hpp +++ b/xo-reader2/include/xo/reader2/DExpectTypeSsm.hpp @@ -28,6 +28,7 @@ namespace xo { public: using Super = DSyntaxStateMachine; using TypeDescr = xo::reflect::TypeDescr; + using ACollector = xo::mm::ACollector; using DArena = xo::mm::DArena; using ppindentinfo = xo::print::ppindentinfo; @@ -82,6 +83,13 @@ namespace xo { bool pretty(const ppindentinfo & ppii) const; ///@} + /** @defgroup scm-expecttypessm-gc-support gc support methods **/ + ///@{ + + /** gc support: visit gc-aware child pointers **/ + void forward_children(obj gc) noexcept; + + ///@} private: /** temporary shim. diff --git a/xo-reader2/include/xo/reader2/DProgressSsm.hpp b/xo-reader2/include/xo/reader2/DProgressSsm.hpp index cc0eb0c5..487ba141 100644 --- a/xo-reader2/include/xo/reader2/DProgressSsm.hpp +++ b/xo-reader2/include/xo/reader2/DProgressSsm.hpp @@ -90,6 +90,7 @@ namespace xo { public: using Super = DSyntaxStateMachine; using TypeDescr = xo::reflect::TypeDescr; + using ACollector = xo::mm::ACollector; using DArena = xo::mm::DArena; using ppindentinfo = xo::print::ppindentinfo; @@ -214,6 +215,13 @@ namespace xo { void print(std::ostream & os) const override; #endif + /** @defgroup scm-progressssm-gc-support gc support methods **/ + ///@{ + + void forward_children(obj gc) noexcept; + + ///@} + private: /** populate an expression here, may be followed by an operator **/ obj lhs_; diff --git a/xo-reader2/include/xo/reader2/DQuoteSsm.hpp b/xo-reader2/include/xo/reader2/DQuoteSsm.hpp index 26079e8e..fa598f83 100644 --- a/xo-reader2/include/xo/reader2/DQuoteSsm.hpp +++ b/xo-reader2/include/xo/reader2/DQuoteSsm.hpp @@ -65,6 +65,7 @@ namespace xo { public: using Super = DSyntaxStateMachine; using TypeDescr = xo::reflect::TypeDescr; + using ACollector = xo::mm::ACollector; using AAllocator = xo::mm::AAllocator; using DArena = xo::mm::DArena; using ppindentinfo = xo::print::ppindentinfo; @@ -145,7 +146,13 @@ namespace xo { bool pretty(const ppindentinfo & ppii) const; ///@} + /** @defgroup scm-quotessm-gc-support gc support methods */ + ///@{ + /** gc support: visit gc-aware child pointers **/ + void forward_children(obj gc) noexcept; + + ///@} private: /** @defgroup scm-parenssm-member-vars **/ ///@{ diff --git a/xo-reader2/include/xo/reader2/DSequenceSsm.hpp b/xo-reader2/include/xo/reader2/DSequenceSsm.hpp index 486187fc..e3c699c3 100644 --- a/xo-reader2/include/xo/reader2/DSequenceSsm.hpp +++ b/xo-reader2/include/xo/reader2/DSequenceSsm.hpp @@ -29,8 +29,7 @@ namespace xo { class DSequenceSsm : public DSyntaxStateMachine { public: using Super = DSyntaxStateMachine; - //using Sequence = xo::scm::Sequence; - //using Lambda = xo::scm::Lambda; + using ACollector = xo::mm::ACollector; using AAllocator = xo::mm::AAllocator; using DArena = xo::mm::DArena; using ppindentinfo = xo::print::ppindentinfo; @@ -87,13 +86,20 @@ namespace xo { ParserStateMachine * p_psm); ///@} - /** @defgroup scm-sequencessm-printable-facet printable facet **/ + /** @defgroup scm-sequencessm-printable-facet printable facet methods **/ ///@{ /** pretty printing support **/ bool pretty(const ppindentinfo & ppii) const; ///@} + /** @defgroup scm-sequencessm-gcobject-facet gcobject facet methods **/ + ///@{ + + /** gc support: visit gc-aware child pointers **/ + void forward_children(obj gc) noexcept; + + ///@} private: explicit DSequenceSsm(DSequenceExpr * seq_expr); diff --git a/xo-reader2/include/xo/reader2/DToplevelSeqSsm.hpp b/xo-reader2/include/xo/reader2/DToplevelSeqSsm.hpp index 2466ed1e..b33707e4 100644 --- a/xo-reader2/include/xo/reader2/DToplevelSeqSsm.hpp +++ b/xo-reader2/include/xo/reader2/DToplevelSeqSsm.hpp @@ -40,6 +40,7 @@ namespace xo { public: using Super = DSyntaxStateMachine; using TypeDescr = xo::reflect::TypeDescr; + using ACollector = xo::mm::ACollector; using AAllocator = xo::mm::AAllocator; using DArena = xo::mm::DArena; using ppindentinfo = xo::print::ppindentinfo; @@ -156,6 +157,13 @@ namespace xo { bool pretty(const ppindentinfo & ppii) const; ///@} + /** @defgroup scm-toplevelseqssm-gc-support gc support methods **/ + ///@{ + + /** gc support: visit gc-aware child pointers **/ + void forward_children(obj gc) noexcept; + + ///@} private: /** sequence type. accept rvalue expressions when diff --git a/xo-reader2/include/xo/reader2/ParserResult.hpp b/xo-reader2/include/xo/reader2/ParserResult.hpp index 9cdf1424..73ab38c6 100644 --- a/xo-reader2/include/xo/reader2/ParserResult.hpp +++ b/xo-reader2/include/xo/reader2/ParserResult.hpp @@ -32,6 +32,7 @@ namespace xo { class ParserResult { public: + using ACollector = xo::mm::ACollector; using ppindentinfo = xo::print::ppindentinfo; public: @@ -67,6 +68,9 @@ namespace xo { /** pretty-printing support **/ bool pretty(const ppindentinfo & ppii) const; + /** gc support: forward gc-eligible children **/ + void forward_children(obj gc) noexcept; + public: /** none|expression|error_description * diff --git a/xo-reader2/include/xo/reader2/ParserStack.hpp b/xo-reader2/include/xo/reader2/ParserStack.hpp index ef5705e9..80049a07 100644 --- a/xo-reader2/include/xo/reader2/ParserStack.hpp +++ b/xo-reader2/include/xo/reader2/ParserStack.hpp @@ -21,6 +21,7 @@ namespace xo { **/ class ParserStack { public: + using ACollector = xo::mm::ACollector; using DArena = xo::mm::DArena; using ppindentinfo = xo::print::ppindentinfo; @@ -42,6 +43,8 @@ namespace xo { static ParserStack * pop(ParserStack * stack, DArena & mm); + static constexpr bool is_gc_eligible() { return false; } + DArena::Checkpoint ckp() const noexcept { return ckp_; } obj top() const noexcept { return ssm_; } ParserStack * parent() const noexcept { return parent_; } @@ -51,6 +54,8 @@ namespace xo { /** pretty-printer support **/ bool pretty(const ppindentinfo & ppii) const; + void forward_children(obj gc) noexcept; + private: /** stack pointer: top of stack just before this instance created **/ DArena::Checkpoint ckp_; diff --git a/xo-reader2/include/xo/reader2/ParserStateMachine.hpp b/xo-reader2/include/xo/reader2/ParserStateMachine.hpp index 2ea90466..f5001faa 100644 --- a/xo-reader2/include/xo/reader2/ParserStateMachine.hpp +++ b/xo-reader2/include/xo/reader2/ParserStateMachine.hpp @@ -7,8 +7,8 @@ #include "ParserResult.hpp" #include "GlobalEnv.hpp" -#include -#include +#include +#include #include #include #include @@ -38,6 +38,7 @@ namespace xo { class ParserStateMachine { public: using TypeDescr = xo::reflect::TypeDescr; + using ACollector = xo::mm::ACollector; using AAllocator = xo::mm::AAllocator; using ArenaConfig = xo::mm::ArenaConfig; using AGCObject = xo::mm::AGCObject; @@ -66,6 +67,13 @@ namespace xo { * (e.g. DArenaHashMap for global symtable). * If not using X1Collector, this can be the * same as @p expr_alloc. + * + * NOTE: + * When @p expr_alloc supports the Collector facet: + * ParserStateMachine isn't itself in gc-space + * (i.e. isn't expected to belong to @p expr_alloc). + * To update pointers to gc-owned objects, must have forward_children() + * called as part of @p expr_alloc's gc cycle. **/ ParserStateMachine(const ArenaConfig & config, const ArenaHashMapConfig & symtab_var_config, @@ -81,6 +89,8 @@ namespace xo { /** non-trivial dtor for @ref global_symtab_ **/ ~ParserStateMachine(); + static constexpr bool is_gc_eligible() { return false; } + ///@} /** @defgroup scm-parserstatemachine-accessors accessor methods **/ ///@{ @@ -90,7 +100,7 @@ namespace xo { obj expr_alloc() const noexcept { return expr_alloc_; } StringTable * stringtable() noexcept { return &stringtable_; } DGlobalSymtab * global_symtab() const noexcept { return global_symtab_.data(); } - DLocalSymtab * local_symtab() const noexcept { return local_symtab_; } + DLocalSymtab * local_symtab() const noexcept { return local_symtab_.data(); } DGlobalEnv * global_env() const noexcept { return global_env_.data(); } const ParserResult & result() const noexcept { return result_; } @@ -175,7 +185,6 @@ namespace xo { void clear_error_reset(); ///@} - /** @defgroup scm-parserstatemachine-inputmethods input methods **/ ///@{ @@ -339,8 +348,37 @@ namespace xo { std::string_view sym); ///@} + /** @defgroup scm-parserstatemachine-gcobject-facet gc support **/ + ///@{ + +#ifdef OBSOLETE + std::size_t shallow_size() const noexcept; + /** NOTE: + * ParserStateMachine only eligible to be a GC root. + * It's not eligible to reside in gc-owned space + **/ + ParserStateMachine * shallow_copy(obj mm) const noexcept; + std::size_t forward_children(obj gc) noexcept; +#endif + /** update gc-aware exit pointers from this ParserStateMachine **/ + void forward_children(obj gc) noexcept; + + ///@} private: +#ifdef OBSOLETE + /** @defgroup scm-parserstatemachine-impl-methods implementation methods **/ + ///@{ + + /** record gc-mutable state vars so they're updated when gc runs **/ + void _add_gc_roots(); + + ///@} +#endif + + private: + /** @defgroup scm-parserstatemachine-instance-vars instance variables **/ + ///@{ /** Table containing interned strings + symbols. **/ @@ -348,6 +386,7 @@ namespace xo { /** Arena for internal parsing stack. * Must be owned exclusively because destructively + * modified as parser completes parsing of each sub-expression * * Contents will be a stack of ExprState instances @@ -403,7 +442,7 @@ namespace xo { * if so, along with stringtable_. * maybe new struct ParserState? **/ - dp global_symtab_; + obj global_symtab_; /** symbol table with local bindings. * non-null during parsing of lambda expressions. @@ -411,7 +450,7 @@ namespace xo { * Push local symbol table here to remember local params * during the body of a lambda expression. **/ - DLocalSymtab * local_symtab_ = nullptr; + obj local_symtab_; /** global variable bindings (builtin primitives) **/ obj global_env_; @@ -435,6 +474,8 @@ namespace xo { /** true to enable debug output **/ bool debug_flag_ = false; + + ///@} }; } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/include/xo/reader2/apply/DApplySsm.hpp b/xo-reader2/include/xo/reader2/apply/DApplySsm.hpp index 9357fc39..64513f0c 100644 --- a/xo-reader2/include/xo/reader2/apply/DApplySsm.hpp +++ b/xo-reader2/include/xo/reader2/apply/DApplySsm.hpp @@ -65,6 +65,7 @@ namespace xo { public: using Super = DSyntaxStateMachine; using TypeDescr = xo::reflect::TypeDescr; + using ACollector = xo::mm::ACollector; using AAllocator = xo::mm::AAllocator; using DArena = xo::mm::DArena; using ppindentinfo = xo::print::ppindentinfo; @@ -185,6 +186,13 @@ namespace xo { bool pretty(const ppindentinfo & ppii) const; ///@} + /** @defgroup scm-applyssm-gc-support gc support methods **/ + ///@{ + + /** gc support: visit gc-aware child pointers **/ + void forward_children(obj gc) noexcept; + + ///@} private: /** @defgroup ssm-applyssm-impl-methods **/ diff --git a/xo-reader2/include/xo/reader2/apply/ISyntaxStateMachine_DApplySsm.hpp b/xo-reader2/include/xo/reader2/apply/ISyntaxStateMachine_DApplySsm.hpp index 0b0f6972..04c7bddb 100644 --- a/xo-reader2/include/xo/reader2/apply/ISyntaxStateMachine_DApplySsm.hpp +++ b/xo-reader2/include/xo/reader2/apply/ISyntaxStateMachine_DApplySsm.hpp @@ -42,6 +42,7 @@ namespace xo { /** @defgroup scm-syntaxstatemachine-dapplyssm-type-traits **/ ///@{ using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; + using ACollector = xo::scm::ASyntaxStateMachine::ACollector; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; @@ -75,6 +76,8 @@ namespace xo { static void on_parsed_expression_with_token(DApplySsm & self, obj expr, const Token & tk, ParserStateMachine * p_psm); /** update state machine for nested quoted literal @p lit **/ static void on_quoted_literal(DApplySsm & self, obj lit, ParserStateMachine * p_psm); + /** gc support: move immediate children to to-space and sub forwarding pointer **/ + static void forward_children(DApplySsm & self, obj gc); ///@} }; diff --git a/xo-reader2/include/xo/reader2/deftype/DDeftypeSsm.hpp b/xo-reader2/include/xo/reader2/deftype/DDeftypeSsm.hpp index 29a1d691..a3e4c6cb 100644 --- a/xo-reader2/include/xo/reader2/deftype/DDeftypeSsm.hpp +++ b/xo-reader2/include/xo/reader2/deftype/DDeftypeSsm.hpp @@ -66,6 +66,7 @@ namespace xo { public: using Super = DSyntaxStateMachine; using TypeDescr = xo::reflect::TypeDescr; + using ACollector = xo::mm::ACollector; using AAllocator = xo::mm::AAllocator; using DArena = xo::mm::DArena; using ppindentinfo = xo::print::ppindentinfo; @@ -167,6 +168,13 @@ namespace xo { bool pretty(const ppindentinfo & ppii) const; ///@} + /** @defgroup scm-deftypessm-gc-support gc support methods **/ + ///@{ + + /** gc support: visit gc-aware child pointers **/ + void forward_children(obj gc) noexcept; + + ///@} private: /** @defgroup scm-deftypessm-member-vars **/ diff --git a/xo-reader2/include/xo/reader2/deftype/ISyntaxStateMachine_DDeftypeSsm.hpp b/xo-reader2/include/xo/reader2/deftype/ISyntaxStateMachine_DDeftypeSsm.hpp index 114f2dab..f3776f18 100644 --- a/xo-reader2/include/xo/reader2/deftype/ISyntaxStateMachine_DDeftypeSsm.hpp +++ b/xo-reader2/include/xo/reader2/deftype/ISyntaxStateMachine_DDeftypeSsm.hpp @@ -42,6 +42,7 @@ namespace xo { /** @defgroup scm-syntaxstatemachine-ddeftypessm-type-traits **/ ///@{ using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; + using ACollector = xo::scm::ASyntaxStateMachine::ACollector; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; @@ -75,6 +76,8 @@ namespace xo { static void on_parsed_expression_with_token(DDeftypeSsm & self, obj expr, const Token & tk, ParserStateMachine * p_psm); /** update state machine for nested quoted literal @p lit **/ static void on_quoted_literal(DDeftypeSsm & self, obj lit, ParserStateMachine * p_psm); + /** gc support: move immediate children to to-space and sub forwarding pointer **/ + static void forward_children(DDeftypeSsm & self, obj gc); ///@} }; diff --git a/xo-reader2/include/xo/reader2/expect_formal_arg/DExpectFormalArgSsm.hpp b/xo-reader2/include/xo/reader2/expect_formal_arg/DExpectFormalArgSsm.hpp index f1bd7867..318e340a 100644 --- a/xo-reader2/include/xo/reader2/expect_formal_arg/DExpectFormalArgSsm.hpp +++ b/xo-reader2/include/xo/reader2/expect_formal_arg/DExpectFormalArgSsm.hpp @@ -48,6 +48,7 @@ namespace xo { public: using Super = DSyntaxStateMachine; using TypeDescr = xo::reflect::TypeDescr; + using ACollector = xo::mm::ACollector; using DArena = xo::mm::DArena; using ppindentinfo = xo::print::ppindentinfo; @@ -121,6 +122,13 @@ namespace xo { bool pretty(const ppindentinfo & ppii) const; ///@} + /** @defgroup scm-expectformalargssm-gc-support gc support methods **/ + ///@{ + + /** gc support: visit gc-aware child pointers **/ + void forward_children(obj gc) noexcept; + + ///@} #ifdef PROBABLY_NOT virtual void on_rightparen_token(const token_type & tk, diff --git a/xo-reader2/include/xo/reader2/expect_formal_arg/ISyntaxStateMachine_DExpectFormalArgSsm.hpp b/xo-reader2/include/xo/reader2/expect_formal_arg/ISyntaxStateMachine_DExpectFormalArgSsm.hpp index 2c6da502..7e100e40 100644 --- a/xo-reader2/include/xo/reader2/expect_formal_arg/ISyntaxStateMachine_DExpectFormalArgSsm.hpp +++ b/xo-reader2/include/xo/reader2/expect_formal_arg/ISyntaxStateMachine_DExpectFormalArgSsm.hpp @@ -42,6 +42,7 @@ namespace xo { /** @defgroup scm-syntaxstatemachine-dexpectformalargssm-type-traits **/ ///@{ using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; + using ACollector = xo::scm::ASyntaxStateMachine::ACollector; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; @@ -75,6 +76,8 @@ namespace xo { static void on_parsed_expression_with_token(DExpectFormalArgSsm & self, obj expr, const Token & tk, ParserStateMachine * p_psm); /** update state machine for nested quoted literal @p lit **/ static void on_quoted_literal(DExpectFormalArgSsm & self, obj lit, ParserStateMachine * p_psm); + /** gc support: move immediate children to to-space and sub forwarding pointer **/ + static void forward_children(DExpectFormalArgSsm & self, obj gc); ///@} }; diff --git a/xo-reader2/include/xo/reader2/expect_listtype/DExpectListTypeSsm.hpp b/xo-reader2/include/xo/reader2/expect_listtype/DExpectListTypeSsm.hpp index 38f04ca1..6e7c80b4 100644 --- a/xo-reader2/include/xo/reader2/expect_listtype/DExpectListTypeSsm.hpp +++ b/xo-reader2/include/xo/reader2/expect_listtype/DExpectListTypeSsm.hpp @@ -62,6 +62,7 @@ namespace xo { public: using Super = DSyntaxStateMachine; using TypeDescr = xo::reflect::TypeDescr; + using ACollector = xo::mm::ACollector; using DArena = xo::mm::DArena; using ppindentinfo = xo::print::ppindentinfo; @@ -129,6 +130,13 @@ namespace xo { /** pretty-printing support **/ bool pretty(const ppindentinfo & ppii) const; + ///@} + /** @defgroup scm-expectlisttypessm-gc-support gc support methods **/ + ///@{ + + /** gc support: visit gc-aware child pointers **/ + void forward_children(obj gc) noexcept; + ///@} private: /** @defgroup scm-expectlisttypessm-instance-vars instance variables **/ diff --git a/xo-reader2/include/xo/reader2/expect_listtype/ISyntaxStateMachine_DExpectListTypeSsm.hpp b/xo-reader2/include/xo/reader2/expect_listtype/ISyntaxStateMachine_DExpectListTypeSsm.hpp index 37a653f9..153c47a4 100644 --- a/xo-reader2/include/xo/reader2/expect_listtype/ISyntaxStateMachine_DExpectListTypeSsm.hpp +++ b/xo-reader2/include/xo/reader2/expect_listtype/ISyntaxStateMachine_DExpectListTypeSsm.hpp @@ -42,6 +42,7 @@ namespace xo { /** @defgroup scm-syntaxstatemachine-dexpectlisttypessm-type-traits **/ ///@{ using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; + using ACollector = xo::scm::ASyntaxStateMachine::ACollector; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; @@ -75,6 +76,8 @@ namespace xo { static void on_parsed_expression_with_token(DExpectListTypeSsm & self, obj expr, const Token & tk, ParserStateMachine * p_psm); /** update state machine for nested quoted literal @p lit **/ static void on_quoted_literal(DExpectListTypeSsm & self, obj lit, ParserStateMachine * p_psm); + /** gc support: move immediate children to to-space and sub forwarding pointer **/ + static void forward_children(DExpectListTypeSsm & self, obj gc); ///@} }; diff --git a/xo-reader2/include/xo/reader2/expect_qdict/DExpectQDictSsm.hpp b/xo-reader2/include/xo/reader2/expect_qdict/DExpectQDictSsm.hpp index c03b2414..31aa2be3 100644 --- a/xo-reader2/include/xo/reader2/expect_qdict/DExpectQDictSsm.hpp +++ b/xo-reader2/include/xo/reader2/expect_qdict/DExpectQDictSsm.hpp @@ -63,6 +63,7 @@ namespace xo { class DExpectQDictSsm : public DSyntaxStateMachine { public: using Super = DSyntaxStateMachine; + using ACollector = xo::mm::ACollector; using DArena = xo::mm::DArena; using ppindentinfo = xo::print::ppindentinfo; @@ -154,6 +155,13 @@ namespace xo { bool pretty(const ppindentinfo & ppii) const; ///@} + /** @defgroup scm-expectqdictssm-gc-support gc support methods **/ + ///@{ + + /** gc support: visit gc-aware child pointers **/ + void forward_children(obj gc) noexcept; + + ///@} private: /** @defgroup ssm-expectqdictssm-member-vars **/ diff --git a/xo-reader2/include/xo/reader2/expect_qdict/ISyntaxStateMachine_DExpectQDictSsm.hpp b/xo-reader2/include/xo/reader2/expect_qdict/ISyntaxStateMachine_DExpectQDictSsm.hpp index 5c46cdd9..7014238f 100644 --- a/xo-reader2/include/xo/reader2/expect_qdict/ISyntaxStateMachine_DExpectQDictSsm.hpp +++ b/xo-reader2/include/xo/reader2/expect_qdict/ISyntaxStateMachine_DExpectQDictSsm.hpp @@ -42,6 +42,7 @@ namespace xo { /** @defgroup scm-syntaxstatemachine-dexpectqdictssm-type-traits **/ ///@{ using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; + using ACollector = xo::scm::ASyntaxStateMachine::ACollector; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; @@ -75,6 +76,8 @@ namespace xo { static void on_parsed_expression_with_token(DExpectQDictSsm & self, obj expr, const Token & tk, ParserStateMachine * p_psm); /** update state machine for nested quoted literal @p lit **/ static void on_quoted_literal(DExpectQDictSsm & self, obj lit, ParserStateMachine * p_psm); + /** gc support: move immediate children to to-space and sub forwarding pointer **/ + static void forward_children(DExpectQDictSsm & self, obj gc); ///@} }; diff --git a/xo-reader2/include/xo/reader2/ifelse/DIfElseSsm.hpp b/xo-reader2/include/xo/reader2/ifelse/DIfElseSsm.hpp index cded3e6f..27043bdf 100644 --- a/xo-reader2/include/xo/reader2/ifelse/DIfElseSsm.hpp +++ b/xo-reader2/include/xo/reader2/ifelse/DIfElseSsm.hpp @@ -55,6 +55,7 @@ namespace xo { class DIfElseSsm : public DSyntaxStateMachine { public: using Super = DSyntaxStateMachine; + using ACollector = xo::mm::ACollector; using AAllocator = xo::mm::AAllocator; using DArena = xo::mm::DArena; using TypeDescr = xo::reflect::TypeDescr; @@ -167,6 +168,13 @@ namespace xo { parserstatemachine * p_psm) override; #endif + /** @defgroup scm-ifelsessm-gc-support gc support methods **/ + ///@{ + + void forward_children(obj gc) noexcept; + + ///@} + private: #ifdef NOT_YET static std::unique_ptr make(); diff --git a/xo-reader2/include/xo/reader2/ifelse/ISyntaxStateMachine_DIfElseSsm.hpp b/xo-reader2/include/xo/reader2/ifelse/ISyntaxStateMachine_DIfElseSsm.hpp index 6b9dd33f..8a3991fb 100644 --- a/xo-reader2/include/xo/reader2/ifelse/ISyntaxStateMachine_DIfElseSsm.hpp +++ b/xo-reader2/include/xo/reader2/ifelse/ISyntaxStateMachine_DIfElseSsm.hpp @@ -42,6 +42,7 @@ namespace xo { /** @defgroup scm-syntaxstatemachine-difelsessm-type-traits **/ ///@{ using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; + using ACollector = xo::scm::ASyntaxStateMachine::ACollector; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; @@ -75,6 +76,8 @@ namespace xo { static void on_parsed_expression_with_token(DIfElseSsm & self, obj expr, const Token & tk, ParserStateMachine * p_psm); /** update state machine for nested quoted literal @p lit **/ static void on_quoted_literal(DIfElseSsm & self, obj lit, ParserStateMachine * p_psm); + /** gc support: move immediate children to to-space and sub forwarding pointer **/ + static void forward_children(DIfElseSsm & self, obj gc); ///@} }; diff --git a/xo-reader2/include/xo/reader2/lambda/DLambdaSsm.hpp b/xo-reader2/include/xo/reader2/lambda/DLambdaSsm.hpp index 5ecbecd2..1fa1eac9 100644 --- a/xo-reader2/include/xo/reader2/lambda/DLambdaSsm.hpp +++ b/xo-reader2/include/xo/reader2/lambda/DLambdaSsm.hpp @@ -59,6 +59,7 @@ namespace xo { public: using Super = DSyntaxStateMachine; using DLocalSymtab = xo::scm::DLocalSymtab; + using ACollector = xo::mm::ACollector; using AAllocator = xo::mm::AAllocator; using DArena = xo::mm::DArena; using TypeDescr = xo::reflect::TypeDescr; @@ -184,6 +185,13 @@ namespace xo { bool pretty(const ppindentinfo & ppii) const; ///@} + /** @defgroup scm-lambdassm-gc-support gc support methods **/ + ///@{ + + /** gc support: visit gc-aware child pointers **/ + void forward_children(obj gc) noexcept; + + ///@} private: diff --git a/xo-reader2/include/xo/reader2/lambda/ISyntaxStateMachine_DLambdaSsm.hpp b/xo-reader2/include/xo/reader2/lambda/ISyntaxStateMachine_DLambdaSsm.hpp index 8ba94c58..f10f376e 100644 --- a/xo-reader2/include/xo/reader2/lambda/ISyntaxStateMachine_DLambdaSsm.hpp +++ b/xo-reader2/include/xo/reader2/lambda/ISyntaxStateMachine_DLambdaSsm.hpp @@ -42,6 +42,7 @@ namespace xo { /** @defgroup scm-syntaxstatemachine-dlambdassm-type-traits **/ ///@{ using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; + using ACollector = xo::scm::ASyntaxStateMachine::ACollector; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; @@ -75,6 +76,8 @@ namespace xo { static void on_parsed_expression_with_token(DLambdaSsm & self, obj expr, const Token & tk, ParserStateMachine * p_psm); /** update state machine for nested quoted literal @p lit **/ static void on_quoted_literal(DLambdaSsm & self, obj lit, ParserStateMachine * p_psm); + /** gc support: move immediate children to to-space and sub forwarding pointer **/ + static void forward_children(DLambdaSsm & self, obj gc); ///@} }; diff --git a/xo-reader2/include/xo/reader2/paren/DParenSsm.hpp b/xo-reader2/include/xo/reader2/paren/DParenSsm.hpp index 05c3926b..af9daa91 100644 --- a/xo-reader2/include/xo/reader2/paren/DParenSsm.hpp +++ b/xo-reader2/include/xo/reader2/paren/DParenSsm.hpp @@ -50,6 +50,7 @@ namespace xo { public: using Super = DSyntaxStateMachine; using TypeDescr = xo::reflect::TypeDescr; + using ACollector = xo::mm::ACollector; using AAllocator = xo::mm::AAllocator; using DArena = xo::mm::DArena; using ppindentinfo = xo::print::ppindentinfo; @@ -131,6 +132,13 @@ namespace xo { bool pretty(const ppindentinfo & ppii) const; ///@} + /** @defgroup scm-parenssm-gc-support gc support methods **/ + ///@{ + + /** gc support: visit immediate gc-aware children **/ + void forward_children(obj gc) noexcept; + + ///@} private: /** @defgroup scm-parenssm-member-vars **/ diff --git a/xo-reader2/include/xo/reader2/paren/ISyntaxStateMachine_DParenSsm.hpp b/xo-reader2/include/xo/reader2/paren/ISyntaxStateMachine_DParenSsm.hpp index ef74a525..c2bbcc21 100644 --- a/xo-reader2/include/xo/reader2/paren/ISyntaxStateMachine_DParenSsm.hpp +++ b/xo-reader2/include/xo/reader2/paren/ISyntaxStateMachine_DParenSsm.hpp @@ -42,6 +42,7 @@ namespace xo { /** @defgroup scm-syntaxstatemachine-dparenssm-type-traits **/ ///@{ using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; + using ACollector = xo::scm::ASyntaxStateMachine::ACollector; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; @@ -75,6 +76,8 @@ namespace xo { static void on_parsed_expression_with_token(DParenSsm & self, obj expr, const Token & tk, ParserStateMachine * p_psm); /** update state machine for nested quoted literal @p lit **/ static void on_quoted_literal(DParenSsm & self, obj lit, ParserStateMachine * p_psm); + /** gc support: move immediate children to to-space and sub forwarding pointer **/ + static void forward_children(DParenSsm & self, obj gc); ///@} }; diff --git a/xo-reader2/include/xo/reader2/parser/DSchematikaParser.hpp b/xo-reader2/include/xo/reader2/parser/DSchematikaParser.hpp index ce83dd8a..18e7989c 100644 --- a/xo-reader2/include/xo/reader2/parser/DSchematikaParser.hpp +++ b/xo-reader2/include/xo/reader2/parser/DSchematikaParser.hpp @@ -1,4 +1,4 @@ -/** @file SchematikaParser.hpp +/** @file DSchematikaParser.hpp * * @author Roland Conybeare, Jan 2026 **/ @@ -151,13 +151,21 @@ namespace xo { * | => * | > * + * ---------------------------------------------------------------- + * NOTES: + * - SchematikaParser partially supports the gcobject facet so it can be a collector root node. + * It's not actually moveable (since its ParserStateMachine member isn't moveable), + * Only the forward_children method is load-bearing. + * **/ - class SchematikaParser { + class DSchematikaParser { public: using token_type = Token; using ArenaHashMapConfig = xo::map::ArenaHashMapConfig; using ArenaConfig = xo::mm::ArenaConfig; + using ACollector = xo::mm::ACollector; using AAllocator = xo::mm::AAllocator; + using AGCObject = xo::mm::AGCObject; using MemorySizeVisitor = xo::mm::MemorySizeVisitor; using ppindentinfo = xo::print::ppindentinfo; using size_type = std::size_t; @@ -173,12 +181,36 @@ namespace xo { * with lifetime bounded by this * SchematikeParser itself **/ - SchematikaParser(const ParserConfig & config, - obj expr_alloc, - obj aux_alloc); + DSchematikaParser(const ParserConfig & config, + obj expr_alloc, + obj aux_alloc); /** non-trivial dtor because of @ref psm_ **/ - ~SchematikaParser() = default; + ~DSchematikaParser() = default; + + /** create parser in initial state. + * + * @p mm allocate SchematikaParser instance from here. + * (likely the same as aux_alloc) + * @p config parser configuration + * @p expr_alloc allocator for schematika expressions. + * Probably shared with execution. + * @p aux_alloc aux allocator for non-copyable memory + * with lifetime bounded by this + * SchematikeParser itself + **/ + static DSchematikaParser * _make(obj mm, + const ParserConfig & config, + obj expr_alloc, + obj aux_alloc); + + /** like _make(mm,config,expr_alloc,aux_alloc), + * but as fop + **/ + static obj make(obj mm, + const ParserConfig & config, + obj expr_alloc, + obj aux_alloc); /** scm-schematikaparser-access-methods **/ ///@{ @@ -248,7 +280,7 @@ namespace xo { void reset_to_idle_toplevel(); ///@} - /** scm-schematikaparser-pretty-methods **/ + /** @defgroup scm-schematikaparser-pretty-methods **/ ///@{ /** print human-readable representation on stream @p os **/ @@ -257,18 +289,32 @@ namespace xo { bool pretty(const ppindentinfo & ppii) const; ///@} + /** @defgroup scm-schematikaparser-gcobject-methods **/ + ///@{ + std::size_t shallow_size() const noexcept; + /** not implemented (SchematikaParser not designed to be copyable) **/ + DSchematikaParser * shallow_copy(obj mm) const noexcept; + /** forward gc-aware children **/ + std::size_t forward_children(obj gc) noexcept; + + ///@} private: + /** @defgroup scm-schematikaparser-member-variables member variables **/ + ///@{ + /** state machine **/ ParserStateMachine psm_; /** debug flag (also stored in psm_) **/ bool debug_flag_ = false; - }; /*SchematikaParser*/ + + ///@} + }; /*DSchematikaParser*/ inline std::ostream & operator<< (std::ostream & os, - const SchematikaParser * x) { + const DSchematikaParser * x) { if (x) { x->print(os); } else { @@ -284,8 +330,8 @@ namespace xo { * to handle ParserResult instances **/ template <> - struct ppdetail { - static inline bool print_pretty(const ppindentinfo & ppii, const xo::scm::SchematikaParser* p) { + struct ppdetail { + static inline bool print_pretty(const ppindentinfo & ppii, const xo::scm::DSchematikaParser* p) { if (p) return p->pretty(ppii); else @@ -295,4 +341,4 @@ namespace xo { } } /*namespace xo*/ -/* end SchematikaParser.hpp */ +/* end DSchematikaParser.hpp */ diff --git a/xo-reader2/include/xo/reader2/ssm/ASyntaxStateMachine.hpp b/xo-reader2/include/xo/reader2/ssm/ASyntaxStateMachine.hpp index a010421d..ead25e24 100644 --- a/xo-reader2/include/xo/reader2/ssm/ASyntaxStateMachine.hpp +++ b/xo-reader2/include/xo/reader2/ssm/ASyntaxStateMachine.hpp @@ -19,11 +19,12 @@ #include #include #include +#include #include #include #include -// {pretex} here +// {pretext} here namespace xo { namespace scm { @@ -45,6 +46,8 @@ public: using Opaque = void *; /** reflected c++ type **/ using TypeDescr = xo::reflect::TypeDescr; + /** gc interface **/ + using ACollector = xo::mm::ACollector; /** gc-aware object **/ using AGCObject = xo::mm::AGCObject; ///@} @@ -52,6 +55,11 @@ public: /** @defgroup scm-syntaxstatemachine-methods **/ ///@{ // const methods + /** An uninitialized ASyntaxStateMachine instance will have zero vtable pointer (per {linux,osx} abi). + * Use case for this is narrow. We go to some lengths to avoid null vtable pointers. For example + * obj will have non-null vtable (via IFacet_Any) with all methods terminating. + **/ + bool _has_null_vptr() const noexcept { return *reinterpret_cast(this) == nullptr; } /** RTTI: unique id# for actual runtime data representation **/ virtual typeseq _typeseq() const noexcept = 0; /** destroy instance @p d; calls c++ dtor only for actual runtime type; does not recover memory **/ @@ -82,6 +90,8 @@ public: virtual void on_parsed_expression_with_token(Opaque data, obj expr, const Token & tk, ParserStateMachine * p_psm) = 0; /** update state machine for nested quoted literal @p lit **/ virtual void on_quoted_literal(Opaque data, obj lit, ParserStateMachine * p_psm) = 0; + /** gc support: move immediate children to to-space and sub forwarding pointer **/ + virtual void forward_children(Opaque data, obj gc) = 0; ///@} }; /*ASyntaxStateMachine*/ diff --git a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_Any.hpp b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_Any.hpp index 2f00d0a4..d1077f2a 100644 --- a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_Any.hpp +++ b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_Any.hpp @@ -45,6 +45,7 @@ namespace scm { /** integer identifying a type **/ using typeseq = xo::facet::typeseq; using TypeDescr = ASyntaxStateMachine::TypeDescr; + using ACollector = ASyntaxStateMachine::ACollector; using AGCObject = ASyntaxStateMachine::AGCObject; ///@} @@ -74,6 +75,7 @@ namespace scm { [[noreturn]] void on_parsed_expression(Opaque, obj, ParserStateMachine *) override; [[noreturn]] void on_parsed_expression_with_token(Opaque, obj, const Token &, ParserStateMachine *) override; [[noreturn]] void on_quoted_literal(Opaque, obj, ParserStateMachine *) override; + [[noreturn]] void forward_children(Opaque, obj) override; ///@} diff --git a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DDefineSsm.hpp b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DDefineSsm.hpp index d8b28de8..3487a328 100644 --- a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DDefineSsm.hpp +++ b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DDefineSsm.hpp @@ -42,6 +42,7 @@ namespace xo { /** @defgroup scm-syntaxstatemachine-ddefinessm-type-traits **/ ///@{ using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; + using ACollector = xo::scm::ASyntaxStateMachine::ACollector; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; @@ -75,6 +76,8 @@ namespace xo { static void on_parsed_expression_with_token(DDefineSsm & self, obj expr, const Token & tk, ParserStateMachine * p_psm); /** update state machine for nested quoted literal @p lit **/ static void on_quoted_literal(DDefineSsm & self, obj lit, ParserStateMachine * p_psm); + /** gc support: move immediate children to to-space and sub forwarding pointer **/ + static void forward_children(DDefineSsm & self, obj gc); ///@} }; diff --git a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectExprSsm.hpp b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectExprSsm.hpp index 1cde9c14..79801c00 100644 --- a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectExprSsm.hpp +++ b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectExprSsm.hpp @@ -42,6 +42,7 @@ namespace xo { /** @defgroup scm-syntaxstatemachine-dexpectexprssm-type-traits **/ ///@{ using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; + using ACollector = xo::scm::ASyntaxStateMachine::ACollector; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; @@ -75,6 +76,8 @@ namespace xo { static void on_parsed_expression_with_token(DExpectExprSsm & self, obj expr, const Token & tk, ParserStateMachine * p_psm); /** update state machine for nested quoted literal @p lit **/ static void on_quoted_literal(DExpectExprSsm & self, obj lit, ParserStateMachine * p_psm); + /** gc support: move immediate children to to-space and sub forwarding pointer **/ + static void forward_children(DExpectExprSsm & self, obj gc); ///@} }; diff --git a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectFormalArglistSsm.hpp b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectFormalArglistSsm.hpp index 78e7db56..68151e22 100644 --- a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectFormalArglistSsm.hpp +++ b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectFormalArglistSsm.hpp @@ -42,6 +42,7 @@ namespace xo { /** @defgroup scm-syntaxstatemachine-dexpectformalarglistssm-type-traits **/ ///@{ using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; + using ACollector = xo::scm::ASyntaxStateMachine::ACollector; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; @@ -75,6 +76,8 @@ namespace xo { static void on_parsed_expression_with_token(DExpectFormalArglistSsm & self, obj expr, const Token & tk, ParserStateMachine * p_psm); /** update state machine for nested quoted literal @p lit **/ static void on_quoted_literal(DExpectFormalArglistSsm & self, obj lit, ParserStateMachine * p_psm); + /** gc support: move immediate children to to-space and sub forwarding pointer **/ + static void forward_children(DExpectFormalArglistSsm & self, obj gc); ///@} }; diff --git a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectQArraySsm.hpp b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectQArraySsm.hpp index c77c635d..cf6ae53d 100644 --- a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectQArraySsm.hpp +++ b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectQArraySsm.hpp @@ -42,6 +42,7 @@ namespace xo { /** @defgroup scm-syntaxstatemachine-dexpectqarrayssm-type-traits **/ ///@{ using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; + using ACollector = xo::scm::ASyntaxStateMachine::ACollector; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; @@ -75,6 +76,8 @@ namespace xo { static void on_parsed_expression_with_token(DExpectQArraySsm & self, obj expr, const Token & tk, ParserStateMachine * p_psm); /** update state machine for nested quoted literal @p lit **/ static void on_quoted_literal(DExpectQArraySsm & self, obj lit, ParserStateMachine * p_psm); + /** gc support: move immediate children to to-space and sub forwarding pointer **/ + static void forward_children(DExpectQArraySsm & self, obj gc); ///@} }; diff --git a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectQListSsm.hpp b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectQListSsm.hpp index 14ff3627..38a33d20 100644 --- a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectQListSsm.hpp +++ b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectQListSsm.hpp @@ -42,6 +42,7 @@ namespace xo { /** @defgroup scm-syntaxstatemachine-dexpectqlistssm-type-traits **/ ///@{ using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; + using ACollector = xo::scm::ASyntaxStateMachine::ACollector; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; @@ -75,6 +76,8 @@ namespace xo { static void on_parsed_expression_with_token(DExpectQListSsm & self, obj expr, const Token & tk, ParserStateMachine * p_psm); /** update state machine for nested quoted literal @p lit **/ static void on_quoted_literal(DExpectQListSsm & self, obj lit, ParserStateMachine * p_psm); + /** gc support: move immediate children to to-space and sub forwarding pointer **/ + static void forward_children(DExpectQListSsm & self, obj gc); ///@} }; diff --git a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectQLiteralSsm.hpp b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectQLiteralSsm.hpp index b19181a8..4cd123f7 100644 --- a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectQLiteralSsm.hpp +++ b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectQLiteralSsm.hpp @@ -42,6 +42,7 @@ namespace xo { /** @defgroup scm-syntaxstatemachine-dexpectqliteralssm-type-traits **/ ///@{ using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; + using ACollector = xo::scm::ASyntaxStateMachine::ACollector; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; @@ -75,6 +76,8 @@ namespace xo { static void on_parsed_expression_with_token(DExpectQLiteralSsm & self, obj expr, const Token & tk, ParserStateMachine * p_psm); /** update state machine for nested quoted literal @p lit **/ static void on_quoted_literal(DExpectQLiteralSsm & self, obj lit, ParserStateMachine * p_psm); + /** gc support: move immediate children to to-space and sub forwarding pointer **/ + static void forward_children(DExpectQLiteralSsm & self, obj gc); ///@} }; diff --git a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectSymbolSsm.hpp b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectSymbolSsm.hpp index 431cba69..0ed37f25 100644 --- a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectSymbolSsm.hpp +++ b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectSymbolSsm.hpp @@ -42,6 +42,7 @@ namespace xo { /** @defgroup scm-syntaxstatemachine-dexpectsymbolssm-type-traits **/ ///@{ using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; + using ACollector = xo::scm::ASyntaxStateMachine::ACollector; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; @@ -75,6 +76,8 @@ namespace xo { static void on_parsed_expression_with_token(DExpectSymbolSsm & self, obj expr, const Token & tk, ParserStateMachine * p_psm); /** update state machine for nested quoted literal @p lit **/ static void on_quoted_literal(DExpectSymbolSsm & self, obj lit, ParserStateMachine * p_psm); + /** gc support: move immediate children to to-space and sub forwarding pointer **/ + static void forward_children(DExpectSymbolSsm & self, obj gc); ///@} }; diff --git a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectTypeSsm.hpp b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectTypeSsm.hpp index f43f83c7..ea084f51 100644 --- a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectTypeSsm.hpp +++ b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectTypeSsm.hpp @@ -42,6 +42,7 @@ namespace xo { /** @defgroup scm-syntaxstatemachine-dexpecttypessm-type-traits **/ ///@{ using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; + using ACollector = xo::scm::ASyntaxStateMachine::ACollector; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; @@ -75,6 +76,8 @@ namespace xo { static void on_parsed_expression_with_token(DExpectTypeSsm & self, obj expr, const Token & tk, ParserStateMachine * p_psm); /** update state machine for nested quoted literal @p lit **/ static void on_quoted_literal(DExpectTypeSsm & self, obj lit, ParserStateMachine * p_psm); + /** gc support: move immediate children to to-space and sub forwarding pointer **/ + static void forward_children(DExpectTypeSsm & self, obj gc); ///@} }; diff --git a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DProgressSsm.hpp b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DProgressSsm.hpp index c5e91891..24269888 100644 --- a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DProgressSsm.hpp +++ b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DProgressSsm.hpp @@ -42,6 +42,7 @@ namespace xo { /** @defgroup scm-syntaxstatemachine-dprogressssm-type-traits **/ ///@{ using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; + using ACollector = xo::scm::ASyntaxStateMachine::ACollector; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; @@ -75,6 +76,8 @@ namespace xo { static void on_parsed_expression_with_token(DProgressSsm & self, obj expr, const Token & tk, ParserStateMachine * p_psm); /** update state machine for nested quoted literal @p lit **/ static void on_quoted_literal(DProgressSsm & self, obj lit, ParserStateMachine * p_psm); + /** gc support: move immediate children to to-space and sub forwarding pointer **/ + static void forward_children(DProgressSsm & self, obj gc); ///@} }; diff --git a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DQuoteSsm.hpp b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DQuoteSsm.hpp index 7f776ca0..811119c5 100644 --- a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DQuoteSsm.hpp +++ b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DQuoteSsm.hpp @@ -42,6 +42,7 @@ namespace xo { /** @defgroup scm-syntaxstatemachine-dquotessm-type-traits **/ ///@{ using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; + using ACollector = xo::scm::ASyntaxStateMachine::ACollector; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; @@ -75,6 +76,8 @@ namespace xo { static void on_parsed_expression_with_token(DQuoteSsm & self, obj expr, const Token & tk, ParserStateMachine * p_psm); /** update state machine for nested quoted literal @p lit **/ static void on_quoted_literal(DQuoteSsm & self, obj lit, ParserStateMachine * p_psm); + /** gc support: move immediate children to to-space and sub forwarding pointer **/ + static void forward_children(DQuoteSsm & self, obj gc); ///@} }; diff --git a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DSequenceSsm.hpp b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DSequenceSsm.hpp index 361922ef..f19601b5 100644 --- a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DSequenceSsm.hpp +++ b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DSequenceSsm.hpp @@ -42,6 +42,7 @@ namespace xo { /** @defgroup scm-syntaxstatemachine-dsequencessm-type-traits **/ ///@{ using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; + using ACollector = xo::scm::ASyntaxStateMachine::ACollector; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; @@ -75,6 +76,8 @@ namespace xo { static void on_parsed_expression_with_token(DSequenceSsm & self, obj expr, const Token & tk, ParserStateMachine * p_psm); /** update state machine for nested quoted literal @p lit **/ static void on_quoted_literal(DSequenceSsm & self, obj lit, ParserStateMachine * p_psm); + /** gc support: move immediate children to to-space and sub forwarding pointer **/ + static void forward_children(DSequenceSsm & self, obj gc); ///@} }; diff --git a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DToplevelSeqSsm.hpp b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DToplevelSeqSsm.hpp index fbb45bef..b36cbfc6 100644 --- a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DToplevelSeqSsm.hpp +++ b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DToplevelSeqSsm.hpp @@ -42,6 +42,7 @@ namespace xo { /** @defgroup scm-syntaxstatemachine-dtoplevelseqssm-type-traits **/ ///@{ using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; + using ACollector = xo::scm::ASyntaxStateMachine::ACollector; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; @@ -75,6 +76,8 @@ namespace xo { static void on_parsed_expression_with_token(DToplevelSeqSsm & self, obj expr, const Token & tk, ParserStateMachine * p_psm); /** update state machine for nested quoted literal @p lit **/ static void on_quoted_literal(DToplevelSeqSsm & self, obj lit, ParserStateMachine * p_psm); + /** gc support: move immediate children to to-space and sub forwarding pointer **/ + static void forward_children(DToplevelSeqSsm & self, obj gc); ///@} }; diff --git a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_Xfer.hpp b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_Xfer.hpp index 67b187cf..13b6d1b7 100644 --- a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_Xfer.hpp +++ b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_Xfer.hpp @@ -18,6 +18,7 @@ #include #include #include +#include namespace xo { namespace scm { @@ -33,6 +34,7 @@ namespace scm { /** integer identifying a type **/ using typeseq = ASyntaxStateMachine::typeseq; using TypeDescr = ASyntaxStateMachine::TypeDescr; + using ACollector = ASyntaxStateMachine::ACollector; using AGCObject = ASyntaxStateMachine::AGCObject; ///@} @@ -87,6 +89,9 @@ namespace scm { void on_quoted_literal(Opaque data, obj lit, ParserStateMachine * p_psm) override { return I::on_quoted_literal(_dcast(data), lit, p_psm); } + void forward_children(Opaque data, obj gc) override { + return I::forward_children(_dcast(data), gc); + } ///@} diff --git a/xo-reader2/include/xo/reader2/ssm/RSyntaxStateMachine.hpp b/xo-reader2/include/xo/reader2/ssm/RSyntaxStateMachine.hpp index 4ac4c791..57cc885e 100644 --- a/xo-reader2/include/xo/reader2/ssm/RSyntaxStateMachine.hpp +++ b/xo-reader2/include/xo/reader2/ssm/RSyntaxStateMachine.hpp @@ -32,6 +32,7 @@ public: using DataPtr = Object::DataPtr; using typeseq = xo::reflect::typeseq; using TypeDescr = ASyntaxStateMachine::TypeDescr; + using ACollector = ASyntaxStateMachine::ACollector; using AGCObject = ASyntaxStateMachine::AGCObject; ///@} @@ -92,6 +93,9 @@ public: void on_quoted_literal(obj lit, ParserStateMachine * p_psm) { return O::iface()->on_quoted_literal(O::data(), lit, p_psm); } + void forward_children(obj gc) { + return O::iface()->forward_children(O::data(), gc); + } ///@} /** @defgroup scm-syntaxstatemachine-member-vars **/ diff --git a/xo-reader2/src/reader2/DApplySsm.cpp b/xo-reader2/src/reader2/DApplySsm.cpp index bcbd5c60..c465ce1a 100644 --- a/xo-reader2/src/reader2/DApplySsm.cpp +++ b/xo-reader2/src/reader2/DApplySsm.cpp @@ -5,8 +5,10 @@ #include "ApplySsm.hpp" #include "ExpectExprSsm.hpp" -#include +#include +#include #include +#include #include //#include "parserstatemachine.hpp" @@ -394,6 +396,13 @@ namespace xo { refrtag("fn_expr", fn_expr, fn_expr_present)); } + void + DApplySsm::forward_children(obj gc) noexcept + { + gc.forward_pivot_inplace(&fn_expr_); + gc.forward_inplace(&args_expr_v_); + } + } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/DDefineSsm.cpp b/xo-reader2/src/reader2/DDefineSsm.cpp index 4634e0a2..5e6b57ea 100644 --- a/xo-reader2/src/reader2/DDefineSsm.cpp +++ b/xo-reader2/src/reader2/DDefineSsm.cpp @@ -9,7 +9,7 @@ #include "DExpectExprSsm.hpp" #include "ssm/ISyntaxStateMachine_DDefineSsm.hpp" #include "ssm/IPrintable_DDefineSsm.hpp" -#include +#include #include #include @@ -689,6 +689,14 @@ namespace xo { refrtag("expect", this->get_expect_str()), refrtag("def_expr", expr)); } + + // ----- gc support ----- + + void + DDefineSsm::forward_children(obj gc) + { + gc.forward_inplace(&def_expr_.data_); + } } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/DDeftypeSsm.cpp b/xo-reader2/src/reader2/DDeftypeSsm.cpp index 865ed436..3f377113 100644 --- a/xo-reader2/src/reader2/DDeftypeSsm.cpp +++ b/xo-reader2/src/reader2/DDeftypeSsm.cpp @@ -270,6 +270,12 @@ namespace xo { refrtag("deftypestate", deftype_xst_), refrtag("expect", this->get_expect_str())); } + void + DDeftypeSsm::forward_children(obj /*gc*/) noexcept + { + static_assert(!DUniqueString::is_gc_eligible()); + } + } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/DExpectExprSsm.cpp b/xo-reader2/src/reader2/DExpectExprSsm.cpp index 7dcc1d06..6a9d08e7 100644 --- a/xo-reader2/src/reader2/DExpectExprSsm.cpp +++ b/xo-reader2/src/reader2/DExpectExprSsm.cpp @@ -624,6 +624,12 @@ namespace xo { } #endif + void + DExpectExprSsm::forward_children(obj /*gc*/) noexcept + { + // all members POD, skip + } + } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/DExpectFormalArgSsm.cpp b/xo-reader2/src/reader2/DExpectFormalArgSsm.cpp index eeecdc54..d7e903d8 100644 --- a/xo-reader2/src/reader2/DExpectFormalArgSsm.cpp +++ b/xo-reader2/src/reader2/DExpectFormalArgSsm.cpp @@ -264,6 +264,12 @@ namespace xo { } } + void + DExpectFormalArgSsm::forward_children(obj /*gc*/) noexcept + { + static_assert(!DUniqueString::is_gc_eligible()); + } + } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/DExpectFormalArglistSsm.cpp b/xo-reader2/src/reader2/DExpectFormalArglistSsm.cpp index 0c367547..ab7d19ee 100644 --- a/xo-reader2/src/reader2/DExpectFormalArglistSsm.cpp +++ b/xo-reader2/src/reader2/DExpectFormalArglistSsm.cpp @@ -4,25 +4,15 @@ */ #include "ExpectFormalArglistSsm.hpp" -//#include "ssm/ISyntaxStateMachine_DExpectFormalArglistSsm.hpp" #include "ExpectFormalArgSsm.hpp" -//#include "ssm/ISyntaxStateMachine_DExpectFormalArgSsm.hpp" -#include -#include +#include +#include #include +#include #include #include #include -#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 gc) noexcept + { + gc.forward_inplace(&argl_); + } + } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/DExpectListTypeSsm.cpp b/xo-reader2/src/reader2/DExpectListTypeSsm.cpp index 36723a6a..921c562e 100644 --- a/xo-reader2/src/reader2/DExpectListTypeSsm.cpp +++ b/xo-reader2/src/reader2/DExpectListTypeSsm.cpp @@ -7,6 +7,7 @@ #include "ExpectTypeSsm.hpp" #include "syntaxstatetype.hpp" #include +#include #include namespace xo { @@ -202,6 +203,12 @@ namespace xo { "DExpectListTypeSsm"); } + void + DExpectListTypeSsm::forward_children(obj gc) noexcept + { + gc.forward_pivot_inplace(&elt_type_); + } + } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/DExpectQArraySsm.cpp b/xo-reader2/src/reader2/DExpectQArraySsm.cpp index a86bcdae..3d373783 100644 --- a/xo-reader2/src/reader2/DExpectQArraySsm.cpp +++ b/xo-reader2/src/reader2/DExpectQArraySsm.cpp @@ -6,6 +6,7 @@ #include "ExpectQArraySsm.hpp" #include "ExpectQLiteralSsm.hpp" #include +#include #include #include @@ -218,6 +219,12 @@ namespace xo { refrtag("expect", this->get_expect_str()), refrtag("array", array_pr)); } + void + DExpectQArraySsm::forward_children(obj gc) noexcept + { + gc.forward_inplace(&array_); + } + } } diff --git a/xo-reader2/src/reader2/DExpectQDictSsm.cpp b/xo-reader2/src/reader2/DExpectQDictSsm.cpp index 7566c130..b57887cb 100644 --- a/xo-reader2/src/reader2/DExpectQDictSsm.cpp +++ b/xo-reader2/src/reader2/DExpectQDictSsm.cpp @@ -5,6 +5,8 @@ #include "ExpectQDictSsm.hpp" #include "ExpectQLiteralSsm.hpp" +#include +#include namespace xo { using xo::print::APrintable; @@ -264,6 +266,13 @@ namespace xo { } + void + DExpectQDictSsm::forward_children(obj gc) noexcept + { + gc.forward_inplace(const_cast(&key_)); + gc.forward_inplace(&dict_); + } + } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/DExpectQListSsm.cpp b/xo-reader2/src/reader2/DExpectQListSsm.cpp index b767f939..59df8c2c 100644 --- a/xo-reader2/src/reader2/DExpectQListSsm.cpp +++ b/xo-reader2/src/reader2/DExpectQListSsm.cpp @@ -6,6 +6,7 @@ #include "ExpectQListSsm.hpp" #include "ExpectQLiteralSsm.hpp" #include +#include #include #include @@ -213,6 +214,13 @@ namespace xo { refrtag("expect", this->get_expect_str()), refrtag("list", list_pr)); } + void + DExpectQListSsm::forward_children(obj gc) noexcept + { + gc.forward_inplace(&start_); + gc.forward_inplace(&end_); + } + } } diff --git a/xo-reader2/src/reader2/DExpectQLiteralSsm.cpp b/xo-reader2/src/reader2/DExpectQLiteralSsm.cpp index a1b7b2ce..b87eff24 100644 --- a/xo-reader2/src/reader2/DExpectQLiteralSsm.cpp +++ b/xo-reader2/src/reader2/DExpectQLiteralSsm.cpp @@ -255,6 +255,12 @@ namespace xo { "DExpectQLiteralSsm", refrtag("expect", this->get_expect_str())); } + void + DExpectQLiteralSsm::forward_children(obj /*gc*/) noexcept + { + // cxl_on_rightparen_, cxl_on_rightbracket_: POD, skip + } + } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/DExpectSymbolSsm.cpp b/xo-reader2/src/reader2/DExpectSymbolSsm.cpp index b1754e33..0875a044 100644 --- a/xo-reader2/src/reader2/DExpectSymbolSsm.cpp +++ b/xo-reader2/src/reader2/DExpectSymbolSsm.cpp @@ -145,6 +145,12 @@ namespace xo { //refrtag("member", member_) ); } + void + DExpectSymbolSsm::forward_children(obj /*gc*/) noexcept + { + // no gc-aware members + } + } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/DExpectTypeSsm.cpp b/xo-reader2/src/reader2/DExpectTypeSsm.cpp index 4af50bea..b25c9380 100644 --- a/xo-reader2/src/reader2/DExpectTypeSsm.cpp +++ b/xo-reader2/src/reader2/DExpectTypeSsm.cpp @@ -197,6 +197,12 @@ namespace xo { "DExpectTypeSsm"); } + void + DExpectTypeSsm::forward_children(obj /*gc*/) noexcept + { + // corrected_: POD, skip + } + } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/DIfElseSsm.cpp b/xo-reader2/src/reader2/DIfElseSsm.cpp index e599f6ad..2be7f71c 100644 --- a/xo-reader2/src/reader2/DIfElseSsm.cpp +++ b/xo-reader2/src/reader2/DIfElseSsm.cpp @@ -9,6 +9,7 @@ #include "DExpectExprSsm.hpp" #include #include +#include #include namespace xo { @@ -507,5 +508,10 @@ namespace xo { refrtag("if_expr", expr)); } + void + DIfElseSsm::forward_children(obj gc) noexcept + { + gc.forward_pivot_inplace(&if_expr_); + } } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/DLambdaSsm.cpp b/xo-reader2/src/reader2/DLambdaSsm.cpp index f8d0fa13..8f5a0bc3 100644 --- a/xo-reader2/src/reader2/DLambdaSsm.cpp +++ b/xo-reader2/src/reader2/DLambdaSsm.cpp @@ -16,6 +16,7 @@ //#include //#include #include +#include #include #include @@ -472,6 +473,14 @@ namespace xo { } } + void + DLambdaSsm::forward_children(obj gc) noexcept + { + gc.forward_inplace(&local_symtab_); + gc.forward_pivot_inplace(&body_); + gc.forward_pivot_inplace(&parent_symtab_); + } + } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/DParenSsm.cpp b/xo-reader2/src/reader2/DParenSsm.cpp index 5fc33059..13fb728a 100644 --- a/xo-reader2/src/reader2/DParenSsm.cpp +++ b/xo-reader2/src/reader2/DParenSsm.cpp @@ -6,6 +6,7 @@ #include "ParenSsm.hpp" #include "ExpectExprSsm.hpp" #include "syntaxstatetype.hpp" +#include #include namespace xo { @@ -457,6 +458,11 @@ namespace xo { refrtag("expect", this->get_expect_str())); } + void + DParenSsm::forward_children(obj gc) noexcept + { + gc.forward_pivot_inplace(&expr_); + } } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/DProgressSsm.cpp b/xo-reader2/src/reader2/DProgressSsm.cpp index 90fb5d16..345ba5fd 100644 --- a/xo-reader2/src/reader2/DProgressSsm.cpp +++ b/xo-reader2/src/reader2/DProgressSsm.cpp @@ -22,6 +22,7 @@ #include // for xo::scm::Primitives #include +#include #include #include #include @@ -1242,6 +1243,13 @@ case optype::op_assign: return obj(); } + void + DProgressSsm::forward_children(obj gc) noexcept + { + gc.forward_pivot_inplace(&lhs_); + gc.forward_pivot_inplace(&rhs_); + } + } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/DQuoteSsm.cpp b/xo-reader2/src/reader2/DQuoteSsm.cpp index 6d885e0b..3a665eb5 100644 --- a/xo-reader2/src/reader2/DQuoteSsm.cpp +++ b/xo-reader2/src/reader2/DQuoteSsm.cpp @@ -211,6 +211,12 @@ namespace xo { refrtag("expect", this->get_expect_str())); } + void + DQuoteSsm::forward_children(obj gc) noexcept + { + gc.forward_pivot_inplace(&expr_); + } + } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/DSequenceSsm.cpp b/xo-reader2/src/reader2/DSequenceSsm.cpp index c2a07966..f6caeb06 100644 --- a/xo-reader2/src/reader2/DSequenceSsm.cpp +++ b/xo-reader2/src/reader2/DSequenceSsm.cpp @@ -3,12 +3,13 @@ #include "DSequenceSsm.hpp" #include "ssm/ISyntaxStateMachine_DSequenceSsm.hpp" #include "DExpectExprSsm.hpp" +#include +#include #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 gc) noexcept + { + gc.forward_inplace(&seq_expr_); + } + } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/DToplevelSeqSsm.cpp b/xo-reader2/src/reader2/DToplevelSeqSsm.cpp index 113ec235..9252c700 100644 --- a/xo-reader2/src/reader2/DToplevelSeqSsm.cpp +++ b/xo-reader2/src/reader2/DToplevelSeqSsm.cpp @@ -517,6 +517,12 @@ namespace xo { "DToplevelSeqSsm", refrtag("seqtype", seqtype_)); } + void + DToplevelSeqSsm::forward_children(obj /*gc*/) noexcept + { + // seqtype_: POD, skip + } + } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/ISyntaxStateMachine_Any.cpp b/xo-reader2/src/reader2/ISyntaxStateMachine_Any.cpp index 7d401163..7d174c5b 100644 --- a/xo-reader2/src/reader2/ISyntaxStateMachine_Any.cpp +++ b/xo-reader2/src/reader2/ISyntaxStateMachine_Any.cpp @@ -95,6 +95,12 @@ ISyntaxStateMachine_Any::on_quoted_literal(Opaque, obj, ParserStateMa _fatal(); } +auto +ISyntaxStateMachine_Any::forward_children(Opaque, obj) -> void +{ + _fatal(); +} + } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/ISyntaxStateMachine_DDefineSsm.cpp b/xo-reader2/src/reader2/ISyntaxStateMachine_DDefineSsm.cpp index e038fac3..139a3314 100644 --- a/xo-reader2/src/reader2/ISyntaxStateMachine_DDefineSsm.cpp +++ b/xo-reader2/src/reader2/ISyntaxStateMachine_DDefineSsm.cpp @@ -77,6 +77,11 @@ namespace xo { { self.on_quoted_literal(lit, p_psm); } + auto + ISyntaxStateMachine_DDefineSsm::forward_children(DDefineSsm & self, obj gc) -> void + { + self.forward_children(gc); + } } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectExprSsm.cpp b/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectExprSsm.cpp index 911ec4d5..75464bcc 100644 --- a/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectExprSsm.cpp +++ b/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectExprSsm.cpp @@ -77,6 +77,11 @@ namespace xo { { self.on_quoted_literal(lit, p_psm); } + auto + ISyntaxStateMachine_DExpectExprSsm::forward_children(DExpectExprSsm & self, obj gc) -> void + { + self.forward_children(gc); + } } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectFormalArglistSsm.cpp b/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectFormalArglistSsm.cpp index b92e9655..61b219f0 100644 --- a/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectFormalArglistSsm.cpp +++ b/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectFormalArglistSsm.cpp @@ -77,6 +77,11 @@ namespace xo { { self.on_quoted_literal(lit, p_psm); } + auto + ISyntaxStateMachine_DExpectFormalArglistSsm::forward_children(DExpectFormalArglistSsm & self, obj gc) -> void + { + self.forward_children(gc); + } } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectQArraySsm.cpp b/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectQArraySsm.cpp index e205409f..b938f1e7 100644 --- a/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectQArraySsm.cpp +++ b/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectQArraySsm.cpp @@ -77,6 +77,11 @@ namespace xo { { self.on_quoted_literal(lit, p_psm); } + auto + ISyntaxStateMachine_DExpectQArraySsm::forward_children(DExpectQArraySsm & self, obj gc) -> void + { + self.forward_children(gc); + } } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectQListSsm.cpp b/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectQListSsm.cpp index 0f64936e..19df0dff 100644 --- a/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectQListSsm.cpp +++ b/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectQListSsm.cpp @@ -77,6 +77,11 @@ namespace xo { { self.on_quoted_literal(lit, p_psm); } + auto + ISyntaxStateMachine_DExpectQListSsm::forward_children(DExpectQListSsm & self, obj gc) -> void + { + self.forward_children(gc); + } } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectQLiteralSsm.cpp b/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectQLiteralSsm.cpp index bde94b6b..e6f338fc 100644 --- a/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectQLiteralSsm.cpp +++ b/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectQLiteralSsm.cpp @@ -77,6 +77,11 @@ namespace xo { { self.on_quoted_literal(lit, p_psm); } + auto + ISyntaxStateMachine_DExpectQLiteralSsm::forward_children(DExpectQLiteralSsm & self, obj gc) -> void + { + self.forward_children(gc); + } } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectSymbolSsm.cpp b/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectSymbolSsm.cpp index ebeaafe7..b8e8fed0 100644 --- a/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectSymbolSsm.cpp +++ b/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectSymbolSsm.cpp @@ -77,6 +77,11 @@ namespace xo { { self.on_quoted_literal(lit, p_psm); } + auto + ISyntaxStateMachine_DExpectSymbolSsm::forward_children(DExpectSymbolSsm & self, obj gc) -> void + { + self.forward_children(gc); + } } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectTypeSsm.cpp b/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectTypeSsm.cpp index 267810e2..011edc4f 100644 --- a/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectTypeSsm.cpp +++ b/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectTypeSsm.cpp @@ -77,6 +77,11 @@ namespace xo { { self.on_quoted_literal(lit, p_psm); } + auto + ISyntaxStateMachine_DExpectTypeSsm::forward_children(DExpectTypeSsm & self, obj gc) -> void + { + self.forward_children(gc); + } } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/ISyntaxStateMachine_DParenSsm.cpp b/xo-reader2/src/reader2/ISyntaxStateMachine_DParenSsm.cpp index 555ae683..6ee6902b 100644 --- a/xo-reader2/src/reader2/ISyntaxStateMachine_DParenSsm.cpp +++ b/xo-reader2/src/reader2/ISyntaxStateMachine_DParenSsm.cpp @@ -77,6 +77,11 @@ namespace xo { { self.on_quoted_literal(lit, p_psm); } + auto + ISyntaxStateMachine_DParenSsm::forward_children(DParenSsm & self, obj gc) -> void + { + self.forward_children(gc); + } } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/ISyntaxStateMachine_DProgressSsm.cpp b/xo-reader2/src/reader2/ISyntaxStateMachine_DProgressSsm.cpp index f1c0e2cf..01e1e754 100644 --- a/xo-reader2/src/reader2/ISyntaxStateMachine_DProgressSsm.cpp +++ b/xo-reader2/src/reader2/ISyntaxStateMachine_DProgressSsm.cpp @@ -77,6 +77,11 @@ namespace xo { { self.on_quoted_literal(lit, p_psm); } + auto + ISyntaxStateMachine_DProgressSsm::forward_children(DProgressSsm & self, obj gc) -> void + { + self.forward_children(gc); + } } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/ISyntaxStateMachine_DQuoteSsm.cpp b/xo-reader2/src/reader2/ISyntaxStateMachine_DQuoteSsm.cpp index 233819be..c219db80 100644 --- a/xo-reader2/src/reader2/ISyntaxStateMachine_DQuoteSsm.cpp +++ b/xo-reader2/src/reader2/ISyntaxStateMachine_DQuoteSsm.cpp @@ -77,6 +77,11 @@ namespace xo { { self.on_quoted_literal(lit, p_psm); } + auto + ISyntaxStateMachine_DQuoteSsm::forward_children(DQuoteSsm & self, obj gc) -> void + { + self.forward_children(gc); + } } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/ISyntaxStateMachine_DSequenceSsm.cpp b/xo-reader2/src/reader2/ISyntaxStateMachine_DSequenceSsm.cpp index 714a04f8..30e164d8 100644 --- a/xo-reader2/src/reader2/ISyntaxStateMachine_DSequenceSsm.cpp +++ b/xo-reader2/src/reader2/ISyntaxStateMachine_DSequenceSsm.cpp @@ -77,6 +77,11 @@ namespace xo { { self.on_quoted_literal(lit, p_psm); } + auto + ISyntaxStateMachine_DSequenceSsm::forward_children(DSequenceSsm & self, obj gc) -> void + { + self.forward_children(gc); + } } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/ISyntaxStateMachine_DToplevelSeqSsm.cpp b/xo-reader2/src/reader2/ISyntaxStateMachine_DToplevelSeqSsm.cpp index e78c78c7..73f23da0 100644 --- a/xo-reader2/src/reader2/ISyntaxStateMachine_DToplevelSeqSsm.cpp +++ b/xo-reader2/src/reader2/ISyntaxStateMachine_DToplevelSeqSsm.cpp @@ -77,6 +77,11 @@ namespace xo { { self.on_quoted_literal(lit, p_psm); } + auto + ISyntaxStateMachine_DToplevelSeqSsm::forward_children(DToplevelSeqSsm & self, obj gc) -> void + { + self.forward_children(gc); + } } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DApplySsm.cpp b/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DApplySsm.cpp index abe625c8..daff54de 100644 --- a/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DApplySsm.cpp +++ b/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DApplySsm.cpp @@ -77,6 +77,11 @@ namespace xo { { self.on_quoted_literal(lit, p_psm); } + auto + ISyntaxStateMachine_DApplySsm::forward_children(DApplySsm & self, obj gc) -> void + { + self.forward_children(gc); + } } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DDeftypeSsm.cpp b/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DDeftypeSsm.cpp index 2491eee2..e6e54b1c 100644 --- a/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DDeftypeSsm.cpp +++ b/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DDeftypeSsm.cpp @@ -77,6 +77,11 @@ namespace xo { { self.on_quoted_literal(lit, p_psm); } + auto + ISyntaxStateMachine_DDeftypeSsm::forward_children(DDeftypeSsm & self, obj gc) -> void + { + self.forward_children(gc); + } } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DExpectFormalArgSsm.cpp b/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DExpectFormalArgSsm.cpp index 96a7fb29..059fd4b2 100644 --- a/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DExpectFormalArgSsm.cpp +++ b/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DExpectFormalArgSsm.cpp @@ -77,6 +77,11 @@ namespace xo { { self.on_quoted_literal(lit, p_psm); } + auto + ISyntaxStateMachine_DExpectFormalArgSsm::forward_children(DExpectFormalArgSsm & self, obj gc) -> void + { + self.forward_children(gc); + } } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DExpectListTypeSsm.cpp b/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DExpectListTypeSsm.cpp index bd8ac996..b760ac9a 100644 --- a/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DExpectListTypeSsm.cpp +++ b/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DExpectListTypeSsm.cpp @@ -77,6 +77,11 @@ namespace xo { { self.on_quoted_literal(lit, p_psm); } + auto + ISyntaxStateMachine_DExpectListTypeSsm::forward_children(DExpectListTypeSsm & self, obj gc) -> void + { + self.forward_children(gc); + } } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DExpectQDictSsm.cpp b/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DExpectQDictSsm.cpp index 60ec4af4..7ee82e82 100644 --- a/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DExpectQDictSsm.cpp +++ b/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DExpectQDictSsm.cpp @@ -77,6 +77,11 @@ namespace xo { { self.on_quoted_literal(lit, p_psm); } + auto + ISyntaxStateMachine_DExpectQDictSsm::forward_children(DExpectQDictSsm & self, obj gc) -> void + { + self.forward_children(gc); + } } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DIfElseSsm.cpp b/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DIfElseSsm.cpp index 7ebfbeca..c78464c7 100644 --- a/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DIfElseSsm.cpp +++ b/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DIfElseSsm.cpp @@ -77,6 +77,11 @@ namespace xo { { self.on_quoted_literal(lit, p_psm); } + auto + ISyntaxStateMachine_DIfElseSsm::forward_children(DIfElseSsm & self, obj gc) -> void + { + self.forward_children(gc); + } } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DLambdaSsm.cpp b/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DLambdaSsm.cpp index 098e49c3..b54d54fc 100644 --- a/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DLambdaSsm.cpp +++ b/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DLambdaSsm.cpp @@ -77,6 +77,11 @@ namespace xo { { self.on_quoted_literal(lit, p_psm); } + auto + ISyntaxStateMachine_DLambdaSsm::forward_children(DLambdaSsm & self, obj gc) -> void + { + self.forward_children(gc); + } } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-type/src/type/DTypeVarRef.cpp b/xo-type/src/type/DTypeVarRef.cpp index 88223ee3..8da0ec0a 100644 --- a/xo-type/src/type/DTypeVarRef.cpp +++ b/xo-type/src/type/DTypeVarRef.cpp @@ -6,6 +6,7 @@ #include "Metatype.hpp" #include "TypeVarRef.hpp" #include +#include #include namespace xo { @@ -89,10 +90,12 @@ namespace xo { std::size_t DTypeVarRef::forward_children(obj gc) noexcept { - { - auto e = FacetRegistry::instance().variant(type_); - gc.forward_inplace(e.iface(), (void **)&type_.data_); - } + gc.forward_pivot_inplace(&type_); + + //{ + // auto e = FacetRegistry::instance().variant(type_); + // gc.forward_inplace(e.iface(), (void **)&type_.data_); + //} return this->shallow_size(); }