diff --git a/xo-alloc2/idl/GCObject.json5 b/xo-alloc2/idl/GCObject.json5 index 2b0b6695..234b3d09 100644 --- a/xo-alloc2/idl/GCObject.json5 +++ b/xo-alloc2/idl/GCObject.json5 @@ -6,6 +6,7 @@ includes: [ "", "", + "", "", "", ], @@ -42,6 +43,11 @@ doc: ["fomo collector type"], definition: "xo::mm::ACollector", }, + { + name: "AGCObjectVisitor", + doc: ["fomo collector type"], + definition: "xo::mm::AGCObjectVisitor", + }, ], const_methods: [ // size_type shallow_size() const noexcept @@ -68,13 +74,17 @@ noexcept: true, attributes: [], }, - // size_type forward_children(obj) noexcept + // size_type visit_gco_children(obj) noexcept { - name: "forward_children", - doc: ["during GC: forward immdiate children"], + name: "visit_gco_children", + doc: [ + "Invoke fn.visit_child(iface,data) for each child GCObject pointer.", + "Context: provides address of data pointer so it can be updated in place", + "when @p fn invokes garbage collector reentry point" + ], return_type: "void", args: [ - {type: "obj", name: "gc"}, + {type: "obj", name: "fn"}, ], const: true, noexcept: true, diff --git a/xo-alloc2/idl/GCObjectVisitor.json5 b/xo-alloc2/idl/GCObjectVisitor.json5 index b4658428..2e8344df 100644 --- a/xo-alloc2/idl/GCObjectVisitor.json5 +++ b/xo-alloc2/idl/GCObjectVisitor.json5 @@ -71,5 +71,26 @@ attributes: [], }, ], - router_facet_explicit_content: [] + router_facet_explicit_content: [ + "", + "/** visit forward faceted object child pointer in place.", + " Defined in RGCObject.hpp to avoid #include cycle", + " **/", + "template ", + "void visit_child(xo::facet::obj * p_obj);", + "", + "/** visit typed child data pointer in place.", + " Defined in RGCObject.hpp to avoid #include cycle", + " **/", + "template ", + "void visit_child(DRepr ** pp_data);", + "", + "/** visit faceted object pointer stored using some facet", + " other than AGCObject", + " **/", + "template ", + "requires (!std::is_same_v)", + "void visit_poly_child(obj * p_pivot);", + "", + ] } diff --git a/xo-alloc2/include/xo/alloc2/gc/AGCObject.hpp b/xo-alloc2/include/xo/alloc2/gc/AGCObject.hpp index b5b9fb0b..3c0fed00 100644 --- a/xo-alloc2/include/xo/alloc2/gc/AGCObject.hpp +++ b/xo-alloc2/include/xo/alloc2/gc/AGCObject.hpp @@ -16,6 +16,7 @@ // includes (via {facet_includes}) #include #include +#include #include #include #include @@ -48,6 +49,8 @@ public: using AAllocator = xo::mm::AAllocator; /** fomo collector type **/ using ACollector = xo::mm::ACollector; + /** fomo collector type **/ + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; ///@} /** @defgroup mm-gcobject-methods **/ @@ -66,8 +69,10 @@ public: // nonconst methods /** move instance using allocator **/ virtual Opaque shallow_move(Opaque data, obj gc) const noexcept = 0; - /** during GC: forward immdiate children **/ - virtual void forward_children(Opaque data, obj gc) const noexcept = 0; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + virtual void visit_gco_children(Opaque data, obj fn) const noexcept = 0; ///@} }; /*AGCObject*/ diff --git a/xo-alloc2/include/xo/alloc2/gc/IGCObject_Any.hpp b/xo-alloc2/include/xo/alloc2/gc/IGCObject_Any.hpp index 34f0bca2..7f12f823 100644 --- a/xo-alloc2/include/xo/alloc2/gc/IGCObject_Any.hpp +++ b/xo-alloc2/include/xo/alloc2/gc/IGCObject_Any.hpp @@ -47,6 +47,7 @@ namespace mm { using size_type = AGCObject::size_type; using AAllocator = AGCObject::AAllocator; using ACollector = AGCObject::ACollector; + using AGCObjectVisitor = AGCObject::AGCObjectVisitor; ///@} /** @defgroup mm-gcobject-any-methods **/ @@ -64,7 +65,7 @@ namespace mm { // nonconst methods [[noreturn]] Opaque shallow_move(Opaque, obj) const noexcept override; - [[noreturn]] void forward_children(Opaque, obj) const noexcept override; + [[noreturn]] void visit_gco_children(Opaque, obj) const noexcept override; ///@} diff --git a/xo-alloc2/include/xo/alloc2/gc/IGCObject_Xfer.hpp b/xo-alloc2/include/xo/alloc2/gc/IGCObject_Xfer.hpp index d69184ce..361bc517 100644 --- a/xo-alloc2/include/xo/alloc2/gc/IGCObject_Xfer.hpp +++ b/xo-alloc2/include/xo/alloc2/gc/IGCObject_Xfer.hpp @@ -15,6 +15,7 @@ #include #include +#include #include #include @@ -34,6 +35,7 @@ namespace mm { using size_type = AGCObject::size_type; using AAllocator = AGCObject::AAllocator; using ACollector = AGCObject::ACollector; + using AGCObjectVisitor = AGCObject::AGCObjectVisitor; ///@} /** @defgroup mm-gcobject-xfer-methods **/ @@ -54,8 +56,8 @@ namespace mm { Opaque shallow_move(Opaque data, obj gc) const noexcept override { return I::shallow_move(_dcast(data), gc); } - void forward_children(Opaque data, obj gc) const noexcept override { - return I::forward_children(_dcast(data), gc); + void visit_gco_children(Opaque data, obj fn) const noexcept override { + return I::visit_gco_children(_dcast(data), fn); } ///@} diff --git a/xo-alloc2/include/xo/alloc2/gc/RCollector_aux.hpp b/xo-alloc2/include/xo/alloc2/gc/RCollector_aux.hpp index 529f69db..83bc631e 100644 --- a/xo-alloc2/include/xo/alloc2/gc/RCollector_aux.hpp +++ b/xo-alloc2/include/xo/alloc2/gc/RCollector_aux.hpp @@ -17,6 +17,46 @@ namespace xo { class ACollector; class AGCObject; + /** defined here to avoid #include cycle, since + * template obj awkward to make available + * in RCollector.hpp + **/ + template + template + void + RGCObjectVisitor::visit_child(xo::facet::obj * p_obj) + { + this->visit_child(p_obj->iface(), (void **)&(p_obj->data_)); + } + + template + template + void + RGCObjectVisitor::visit_child(DRepr ** p_repr) + { + // fetch static interface for DRepr (strip const: FacetImplementation specializations use non-const DRepr) + auto iface = xo::facet::impl_for>(); + + this->visit_child(&iface, (void **)p_repr); + } + + template + template + requires (!std::is_same_v) + void + RGCObjectVisitor::visit_poly_child(obj * p_objs) + { + if (*p_objs) { + auto e = xo::facet::FacetRegistry::instance().variant(*p_objs); + + this->visit_child(e.iface(), (void **)&(p_objs->data_)); + } + } + + // ----- DEPRECATED ----- + // + // Moving these methods to RGCObjectVisitor + /** defined here to avoid #include cycle, since * template obj awkward to make available * in RCollector.hpp @@ -52,6 +92,8 @@ namespace xo { } } + // ----- mm_do_assign ----- + /** gc-aware assignment; engage special book-keeping for cross-gen pointers **/ inline void mm_do_assign(obj & gc, void * parent, diff --git a/xo-alloc2/include/xo/alloc2/gc/RGCObject.hpp b/xo-alloc2/include/xo/alloc2/gc/RGCObject.hpp index a0de103c..5ac4c487 100644 --- a/xo-alloc2/include/xo/alloc2/gc/RGCObject.hpp +++ b/xo-alloc2/include/xo/alloc2/gc/RGCObject.hpp @@ -34,6 +34,7 @@ public: using size_type = AGCObject::size_type; using AAllocator = AGCObject::AAllocator; using ACollector = AGCObject::ACollector; + using AGCObjectVisitor = AGCObject::AGCObjectVisitor; ///@} /** @defgroup mm-gcobject-router-ctors **/ @@ -60,8 +61,8 @@ public: Opaque shallow_move(obj gc) noexcept { return O::iface()->shallow_move(O::data(), gc); } - void forward_children(obj gc) noexcept { - return O::iface()->forward_children(O::data(), gc); + void visit_gco_children(obj fn) noexcept { + return O::iface()->visit_gco_children(O::data(), fn); } ///@} diff --git a/xo-alloc2/include/xo/alloc2/gc/RGCObjectVisitor.hpp b/xo-alloc2/include/xo/alloc2/gc/RGCObjectVisitor.hpp index 800d197f..7fbf9076 100644 --- a/xo-alloc2/include/xo/alloc2/gc/RGCObjectVisitor.hpp +++ b/xo-alloc2/include/xo/alloc2/gc/RGCObjectVisitor.hpp @@ -46,6 +46,26 @@ public: ///@{ // explicit injected content + + /** visit forward faceted object child pointer in place. + Defined in RGCObject.hpp to avoid #include cycle + **/ + template + void visit_child(xo::facet::obj * p_obj); + + /** visit typed child data pointer in place. + Defined in RGCObject.hpp to avoid #include cycle + **/ + template + void visit_child(DRepr ** pp_data); + + /** visit faceted object pointer stored using some facet + other than AGCObject + **/ + template + requires (!std::is_same_v) + void visit_poly_child(obj * p_pivot); + // builtin methods typeseq _typeseq() const noexcept { return O::iface()->_typeseq(); } diff --git a/xo-alloc2/src/alloc2/IGCObject_Any.cpp b/xo-alloc2/src/alloc2/IGCObject_Any.cpp index a4415241..7df05480 100644 --- a/xo-alloc2/src/alloc2/IGCObject_Any.cpp +++ b/xo-alloc2/src/alloc2/IGCObject_Any.cpp @@ -42,7 +42,7 @@ IGCObject_Any::shallow_move(Opaque, obj) const noexcept -> Opaque } auto -IGCObject_Any::forward_children(Opaque, obj) const noexcept -> void +IGCObject_Any::visit_gco_children(Opaque, obj) const noexcept -> void { _fatal(); } diff --git a/xo-expression2/include/xo/expression2/DApplyExpr.hpp b/xo-expression2/include/xo/expression2/DApplyExpr.hpp index b4119def..0042d561 100644 --- a/xo-expression2/include/xo/expression2/DApplyExpr.hpp +++ b/xo-expression2/include/xo/expression2/DApplyExpr.hpp @@ -8,6 +8,7 @@ #include "Expression.hpp" #include "TypeRef.hpp" #include "exprtype.hpp" +#include #include #include #include @@ -21,6 +22,7 @@ namespace xo { class DApplyExpr { public: using ACollector = xo::mm::ACollector; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AAllocator = xo::mm::AAllocator; using TypeDescr = xo::reflect::TypeDescr; using ppindentinfo = xo::print::ppindentinfo; @@ -84,7 +86,7 @@ namespace xo { std::size_t shallow_size() const noexcept; DApplyExpr * shallow_move(obj gc) noexcept; - std::size_t forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} /** @defgroup scm-applyexpr-printable-facet **/ diff --git a/xo-expression2/include/xo/expression2/DConstant.hpp b/xo-expression2/include/xo/expression2/DConstant.hpp index e78440ad..2c878ea9 100644 --- a/xo-expression2/include/xo/expression2/DConstant.hpp +++ b/xo-expression2/include/xo/expression2/DConstant.hpp @@ -10,6 +10,7 @@ #include "exprtype.hpp" #include #include +#include #include namespace xo { @@ -22,8 +23,9 @@ namespace xo { using TaggedPtr = xo::reflect::TaggedPtr; using TypeDescr = xo::reflect::TypeDescr; using ACollector = xo::mm::ACollector; - using AAllocator = xo::mm::AAllocator; using AGCObject = xo::mm::AGCObject; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using AAllocator = xo::mm::AAllocator; using typeseq = xo::reflect::typeseq; using ppindentinfo = xo::print::ppindentinfo; @@ -64,7 +66,7 @@ namespace xo { size_t shallow_size() const noexcept; DConstant * shallow_move(obj gc) noexcept; - size_t forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} /** @defgroup scm-constant-printable-facet **/ diff --git a/xo-expression2/include/xo/expression2/DDefineExpr.hpp b/xo-expression2/include/xo/expression2/DDefineExpr.hpp index 1e20c530..f1528531 100644 --- a/xo-expression2/include/xo/expression2/DDefineExpr.hpp +++ b/xo-expression2/include/xo/expression2/DDefineExpr.hpp @@ -8,6 +8,7 @@ #include "Expression.hpp" #include "DVariable.hpp" #include +#include #include namespace xo { @@ -24,6 +25,7 @@ namespace xo { public: using ppindentinfo = xo::print::ppindentinfo; using ACollector = xo::mm::ACollector; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AAllocator = xo::mm::AAllocator; using TypeDescr = xo::reflect::TypeDescr; @@ -74,7 +76,7 @@ namespace xo { std::size_t shallow_size() const noexcept; DDefineExpr * shallow_move(obj gc) noexcept; - std::size_t forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} /** @defgroup scm-defineexpr-printable-facet **/ diff --git a/xo-expression2/include/xo/expression2/DGlobalSymtab.hpp b/xo-expression2/include/xo/expression2/DGlobalSymtab.hpp index 782e48f7..a24c0bdc 100644 --- a/xo-expression2/include/xo/expression2/DGlobalSymtab.hpp +++ b/xo-expression2/include/xo/expression2/DGlobalSymtab.hpp @@ -9,6 +9,7 @@ #include "DVariable.hpp" #include "DTypename.hpp" #include +#include #include #include @@ -30,8 +31,9 @@ namespace xo { using ArenaHashMapConfig = xo::map::ArenaHashMapConfig; using repr_type = xo::map::DArenaHashMap; using ACollector = xo::mm::ACollector; - using AAllocator = xo::mm::AAllocator; using AGCObject = xo::mm::AGCObject; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using AAllocator = xo::mm::AAllocator; using MemorySizeVisitor = xo::mm::MemorySizeVisitor; using ppindentinfo = xo::print::ppindentinfo; using size_type = std::uint32_t; @@ -113,9 +115,8 @@ namespace xo { /** @defgroup scm-globalsymtab-gcobject-facet gcobject facet **/ ///@{ - std::size_t shallow_size() const noexcept; DGlobalSymtab * shallow_move(obj gc) noexcept; - std::size_t forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} /** @defgroup scm-globalsymtab-printable-facet printable facet **/ diff --git a/xo-expression2/include/xo/expression2/DIfElseExpr.hpp b/xo-expression2/include/xo/expression2/DIfElseExpr.hpp index 8ffee429..b27c9ade 100644 --- a/xo-expression2/include/xo/expression2/DIfElseExpr.hpp +++ b/xo-expression2/include/xo/expression2/DIfElseExpr.hpp @@ -9,10 +9,9 @@ #include "TypeRef.hpp" #include "exprtype.hpp" #include +#include #include -//#include #include -//#include namespace xo { namespace scm { @@ -23,6 +22,7 @@ namespace xo { class DIfElseExpr { public: using ACollector = xo::mm::ACollector; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AAllocator = xo::mm::AAllocator; using TypeDescr = xo::reflect::TypeDescr; using ppindentinfo = xo::print::ppindentinfo; @@ -100,7 +100,7 @@ namespace xo { std::size_t shallow_size() const noexcept; DIfElseExpr * shallow_move(obj gc) noexcept; - std::size_t forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} diff --git a/xo-expression2/include/xo/expression2/DLambdaExpr.hpp b/xo-expression2/include/xo/expression2/DLambdaExpr.hpp index 0d8d2391..2a507497 100644 --- a/xo-expression2/include/xo/expression2/DLambdaExpr.hpp +++ b/xo-expression2/include/xo/expression2/DLambdaExpr.hpp @@ -10,6 +10,7 @@ #include "exprtype.hpp" #include "DLocalSymtab.hpp" #include "DString.hpp" +#include #include namespace xo { @@ -21,6 +22,7 @@ namespace xo { class DLambdaExpr { public: using ACollector = xo::mm::ACollector; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AAllocator = xo::mm::AAllocator; using TypeDescr = xo::reflect::TypeDescr; using ppindentinfo = xo::print::ppindentinfo; @@ -86,7 +88,7 @@ namespace xo { std::size_t shallow_size() const noexcept; DLambdaExpr * shallow_move(obj gc) noexcept; - std::size_t forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} /** @defgroup scm-lambdaexpr-printable-facet **/ diff --git a/xo-expression2/include/xo/expression2/DLocalSymtab.hpp b/xo-expression2/include/xo/expression2/DLocalSymtab.hpp index b2843cb9..f389c3ea 100644 --- a/xo-expression2/include/xo/expression2/DLocalSymtab.hpp +++ b/xo-expression2/include/xo/expression2/DLocalSymtab.hpp @@ -9,6 +9,7 @@ #include "DVariable.hpp" #include "DUniqueString.hpp" #include +#include namespace xo { namespace scm { @@ -20,8 +21,9 @@ namespace xo { using DArray = xo::scm::DArray; using ppindentinfo = xo::print::ppindentinfo; using ACollector = xo::mm::ACollector; - using AAllocator = xo::mm::AAllocator; using AGCObject = xo::mm::AGCObject; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using AAllocator = xo::mm::AAllocator; /* note: uint16_t would be fine too */ using size_type = std::uint32_t; @@ -97,9 +99,8 @@ namespace xo { /** @defgroup xo-localsymtab-gcobject-facet gcobject facet **/ ///@{ - std::size_t shallow_size() const noexcept; DLocalSymtab * shallow_move(obj gc) noexcept; - std::size_t forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} /** @defgroup xo-localsymtab-printable-facet printable facet **/ diff --git a/xo-expression2/include/xo/expression2/DSequenceExpr.hpp b/xo-expression2/include/xo/expression2/DSequenceExpr.hpp index f876cfac..76a8bec0 100644 --- a/xo-expression2/include/xo/expression2/DSequenceExpr.hpp +++ b/xo-expression2/include/xo/expression2/DSequenceExpr.hpp @@ -8,6 +8,7 @@ #include "Expression.hpp" #include "TypeRef.hpp" #include +#include namespace xo { namespace scm { @@ -23,6 +24,7 @@ namespace xo { class DSequenceExpr { public: using ACollector = xo::mm::ACollector; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AAllocator = xo::mm::AAllocator; using TypeDescr = xo::reflect::TypeDescr; using size_type = DArray::size_type; @@ -74,7 +76,7 @@ namespace xo { std::size_t shallow_size() const noexcept; DSequenceExpr * shallow_move(obj gc) noexcept; - std::size_t forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} diff --git a/xo-expression2/include/xo/expression2/DTypename.hpp b/xo-expression2/include/xo/expression2/DTypename.hpp index 7bd30931..2e35c9e3 100644 --- a/xo-expression2/include/xo/expression2/DTypename.hpp +++ b/xo-expression2/include/xo/expression2/DTypename.hpp @@ -7,6 +7,7 @@ #include "DUniqueString.hpp" #include +#include #include #include @@ -24,8 +25,9 @@ namespace xo { public: using ppindentinfo = xo::print::ppindentinfo; using ACollector = xo::mm::ACollector; - using AAllocator = xo::mm::AAllocator; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AGCObject = xo::mm::AGCObject; + using AAllocator = xo::mm::AAllocator; public: DTypename(const DUniqueString * name, @@ -55,7 +57,7 @@ namespace xo { size_t shallow_size() const noexcept; DTypename * shallow_move(obj gc) noexcept; - size_t forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} /** @defgroup scm-typename-printable-facet **/ diff --git a/xo-expression2/include/xo/expression2/DVarRef.hpp b/xo-expression2/include/xo/expression2/DVarRef.hpp index 65abddb2..db85d558 100644 --- a/xo-expression2/include/xo/expression2/DVarRef.hpp +++ b/xo-expression2/include/xo/expression2/DVarRef.hpp @@ -6,6 +6,7 @@ #pragma once #include "Variable.hpp" +#include namespace xo { namespace scm { @@ -21,6 +22,7 @@ namespace xo { public: using ppindentinfo = xo::print::ppindentinfo; using ACollector = xo::mm::ACollector; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AAllocator = xo::mm::AAllocator; using TypeDescr = xo::reflect::TypeDescr; @@ -56,7 +58,7 @@ namespace xo { size_t shallow_size() const noexcept; DVarRef * shallow_move(obj gc) noexcept; - size_t forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} /** @defgroup scm-variable-printable-facet **/ diff --git a/xo-expression2/include/xo/expression2/DVariable.hpp b/xo-expression2/include/xo/expression2/DVariable.hpp index 12abae94..2e74fbcc 100644 --- a/xo-expression2/include/xo/expression2/DVariable.hpp +++ b/xo-expression2/include/xo/expression2/DVariable.hpp @@ -9,6 +9,7 @@ #include "Binding.hpp" #include "TypeRef.hpp" #include "exprtype.hpp" +#include #include #include @@ -22,6 +23,7 @@ namespace xo { public: using ppindentinfo = xo::print::ppindentinfo; using ACollector = xo::mm::ACollector; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AAllocator = xo::mm::AAllocator; using TypeDescr = xo::reflect::TypeDescr; @@ -64,7 +66,7 @@ namespace xo { size_t shallow_size() const noexcept; DVariable * shallow_move(obj gc) noexcept; - size_t forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} /** @defgroup scm-variable-printable-facet **/ diff --git a/xo-expression2/include/xo/expression2/TypeRef.hpp b/xo-expression2/include/xo/expression2/TypeRef.hpp index 1342b4df..f56028ba 100644 --- a/xo-expression2/include/xo/expression2/TypeRef.hpp +++ b/xo-expression2/include/xo/expression2/TypeRef.hpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -26,6 +27,7 @@ namespace xo { using type_var = flatstring<20>; using prefix_type = flatstring<8>; using ACollector = xo::mm::ACollector; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using ppindentinfo = xo::print::ppindentinfo; public: @@ -73,7 +75,7 @@ namespace xo { bool pretty(const ppindentinfo & ppii) const; /** gc support **/ - void forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; private: TypeRef(const type_var & id, TypeDescr td); diff --git a/xo-expression2/include/xo/expression2/define/IGCObject_DDefineExpr.hpp b/xo-expression2/include/xo/expression2/define/IGCObject_DDefineExpr.hpp index c0e774c8..adb18480 100644 --- a/xo-expression2/include/xo/expression2/define/IGCObject_DDefineExpr.hpp +++ b/xo-expression2/include/xo/expression2/define/IGCObject_DDefineExpr.hpp @@ -44,6 +44,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -54,8 +55,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DDefineExpr & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DDefineExpr & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DDefineExpr & self, obj fn) noexcept; ///@} }; diff --git a/xo-expression2/include/xo/expression2/detail/IGCObject_DApplyExpr.hpp b/xo-expression2/include/xo/expression2/detail/IGCObject_DApplyExpr.hpp index 477a9b77..86047bd7 100644 --- a/xo-expression2/include/xo/expression2/detail/IGCObject_DApplyExpr.hpp +++ b/xo-expression2/include/xo/expression2/detail/IGCObject_DApplyExpr.hpp @@ -44,6 +44,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -54,8 +55,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DApplyExpr & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DApplyExpr & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DApplyExpr & self, obj fn) noexcept; ///@} }; diff --git a/xo-expression2/include/xo/expression2/detail/IGCObject_DConstant.hpp b/xo-expression2/include/xo/expression2/detail/IGCObject_DConstant.hpp index 6d631c74..823d0de9 100644 --- a/xo-expression2/include/xo/expression2/detail/IGCObject_DConstant.hpp +++ b/xo-expression2/include/xo/expression2/detail/IGCObject_DConstant.hpp @@ -44,6 +44,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -54,8 +55,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DConstant & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DConstant & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DConstant & self, obj fn) noexcept; ///@} }; diff --git a/xo-expression2/include/xo/expression2/detail/IGCObject_DIfElseExpr.hpp b/xo-expression2/include/xo/expression2/detail/IGCObject_DIfElseExpr.hpp index c4917774..13d0e3e4 100644 --- a/xo-expression2/include/xo/expression2/detail/IGCObject_DIfElseExpr.hpp +++ b/xo-expression2/include/xo/expression2/detail/IGCObject_DIfElseExpr.hpp @@ -44,6 +44,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -54,8 +55,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DIfElseExpr & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DIfElseExpr & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DIfElseExpr & self, obj fn) noexcept; ///@} }; diff --git a/xo-expression2/include/xo/expression2/detail/IGCObject_DLambdaExpr.hpp b/xo-expression2/include/xo/expression2/detail/IGCObject_DLambdaExpr.hpp index 6a484b28..077b0e3a 100644 --- a/xo-expression2/include/xo/expression2/detail/IGCObject_DLambdaExpr.hpp +++ b/xo-expression2/include/xo/expression2/detail/IGCObject_DLambdaExpr.hpp @@ -44,6 +44,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -54,8 +55,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DLambdaExpr & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DLambdaExpr & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DLambdaExpr & self, obj fn) noexcept; ///@} }; diff --git a/xo-expression2/include/xo/expression2/detail/IGCObject_DSequenceExpr.hpp b/xo-expression2/include/xo/expression2/detail/IGCObject_DSequenceExpr.hpp index 0bcf1f90..8d86241b 100644 --- a/xo-expression2/include/xo/expression2/detail/IGCObject_DSequenceExpr.hpp +++ b/xo-expression2/include/xo/expression2/detail/IGCObject_DSequenceExpr.hpp @@ -44,6 +44,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -54,8 +55,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DSequenceExpr & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DSequenceExpr & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DSequenceExpr & self, obj fn) noexcept; ///@} }; diff --git a/xo-expression2/include/xo/expression2/detail/IGCObject_DVarRef.hpp b/xo-expression2/include/xo/expression2/detail/IGCObject_DVarRef.hpp index 91c1888c..71489ef4 100644 --- a/xo-expression2/include/xo/expression2/detail/IGCObject_DVarRef.hpp +++ b/xo-expression2/include/xo/expression2/detail/IGCObject_DVarRef.hpp @@ -44,6 +44,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -54,8 +55,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DVarRef & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DVarRef & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DVarRef & self, obj fn) noexcept; ///@} }; diff --git a/xo-expression2/include/xo/expression2/symtab/IGCObject_DGlobalSymtab.hpp b/xo-expression2/include/xo/expression2/symtab/IGCObject_DGlobalSymtab.hpp index 692be2fc..48cf1d7c 100644 --- a/xo-expression2/include/xo/expression2/symtab/IGCObject_DGlobalSymtab.hpp +++ b/xo-expression2/include/xo/expression2/symtab/IGCObject_DGlobalSymtab.hpp @@ -44,6 +44,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -54,8 +55,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DGlobalSymtab & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DGlobalSymtab & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DGlobalSymtab & self, obj fn) noexcept; ///@} }; diff --git a/xo-expression2/include/xo/expression2/symtab/IGCObject_DLocalSymtab.hpp b/xo-expression2/include/xo/expression2/symtab/IGCObject_DLocalSymtab.hpp index 42de5a79..82717f96 100644 --- a/xo-expression2/include/xo/expression2/symtab/IGCObject_DLocalSymtab.hpp +++ b/xo-expression2/include/xo/expression2/symtab/IGCObject_DLocalSymtab.hpp @@ -44,6 +44,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -54,8 +55,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DLocalSymtab & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DLocalSymtab & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DLocalSymtab & self, obj fn) noexcept; ///@} }; diff --git a/xo-expression2/include/xo/expression2/typename/IGCObject_DTypename.hpp b/xo-expression2/include/xo/expression2/typename/IGCObject_DTypename.hpp index 3ed445aa..8c72100b 100644 --- a/xo-expression2/include/xo/expression2/typename/IGCObject_DTypename.hpp +++ b/xo-expression2/include/xo/expression2/typename/IGCObject_DTypename.hpp @@ -42,6 +42,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -52,8 +53,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DTypename & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DTypename & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DTypename & self, obj fn) noexcept; ///@} }; diff --git a/xo-expression2/include/xo/expression2/variable/IGCObject_DVariable.hpp b/xo-expression2/include/xo/expression2/variable/IGCObject_DVariable.hpp index 84c224cd..d04f3588 100644 --- a/xo-expression2/include/xo/expression2/variable/IGCObject_DVariable.hpp +++ b/xo-expression2/include/xo/expression2/variable/IGCObject_DVariable.hpp @@ -44,6 +44,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -54,8 +55,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DVariable & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DVariable & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DVariable & self, obj fn) noexcept; ///@} }; diff --git a/xo-expression2/src/expression2/DApplyExpr.cpp b/xo-expression2/src/expression2/DApplyExpr.cpp index 9683d459..18b9b60a 100644 --- a/xo-expression2/src/expression2/DApplyExpr.cpp +++ b/xo-expression2/src/expression2/DApplyExpr.cpp @@ -129,27 +129,25 @@ namespace xo { return copy; } - std::size_t - DApplyExpr::forward_children(obj gc) noexcept + void + DApplyExpr::visit_gco_children(obj gc) noexcept { - typeref_.forward_children(gc); + typeref_.visit_gco_children(gc); { - obj fn_gco = fn_.to_facet(); - gc.forward_inplace(fn_gco.iface(), (void **)&fn_.data_); + gc.visit_poly_child(&fn_); + //obj fn_gco = fn_.to_facet(); + //gc.forward_inplace(fn_gco.iface(), (void **)&fn_.data_); } for (size_type i = 0; i < n_args_; ++i) { obj & arg = args_[i]; // runtime poly here - obj arg_gco = arg.to_facet(); - - // need the data address within *this - gc.forward_inplace(arg_gco.iface(), (void **)(&arg.data_)); + gc.visit_poly_child(&arg); + //obj arg_gco = arg.to_facet(); + //gc.forward_inplace(arg_gco.iface(), (void **)(&arg.data_)); } - - return shallow_size(); } // ----- printable facet ----- diff --git a/xo-expression2/src/expression2/DConstant.cpp b/xo-expression2/src/expression2/DConstant.cpp index 46d4cbe9..bbf86183 100644 --- a/xo-expression2/src/expression2/DConstant.cpp +++ b/xo-expression2/src/expression2/DConstant.cpp @@ -83,15 +83,12 @@ namespace xo { return gc.std_move_for(this); } - std::size_t - DConstant::forward_children(obj gc) noexcept + void + DConstant::visit_gco_children(obj gc) noexcept { - typeref_.forward_children(gc); + typeref_.visit_gco_children(gc); - gc.forward_inplace(&value_); - //gc.forward_inplace(value_.iface(), (void **)&(value_.data_)); - - return shallow_size(); + gc.visit_child(&value_); } bool diff --git a/xo-expression2/src/expression2/DDefineExpr.cpp b/xo-expression2/src/expression2/DDefineExpr.cpp index b25a655d..69ce84e0 100644 --- a/xo-expression2/src/expression2/DDefineExpr.cpp +++ b/xo-expression2/src/expression2/DDefineExpr.cpp @@ -90,14 +90,12 @@ namespace xo { return gc.std_move_for(this); } - std::size_t - DDefineExpr::forward_children(obj gc) noexcept + void + DDefineExpr::visit_gco_children(obj gc) noexcept { - gc.forward_inplace(&lhs_var_); + gc.visit_child(&lhs_var_); //gc.forward_inplace(&rhs_); // complicated - need to access via GCObject facet - poly_forward_inplace(gc, &rhs_); - - return this->shallow_size(); + gc.visit_poly_child(&rhs_); } bool diff --git a/xo-expression2/src/expression2/DGlobalSymtab.cpp b/xo-expression2/src/expression2/DGlobalSymtab.cpp index c125fb98..10f65ea2 100644 --- a/xo-expression2/src/expression2/DGlobalSymtab.cpp +++ b/xo-expression2/src/expression2/DGlobalSymtab.cpp @@ -262,30 +262,22 @@ namespace xo { // ----- gcobject facet ----- - std::size_t - DGlobalSymtab::shallow_size() const noexcept - { - return sizeof(DGlobalSymtab); - } - DGlobalSymtab * DGlobalSymtab::shallow_move(obj gc) noexcept { return gc.std_move_for(this); } - std::size_t - DGlobalSymtab::forward_children(obj gc) noexcept + void + DGlobalSymtab::visit_gco_children(obj gc) noexcept { // map_ doesn't contain any gc-owned data, can skip static_assert(var_map_.is_gc_eligible() == false); static_assert(type_map_.is_gc_eligible() == false); - gc.forward_inplace(&vars_); - gc.forward_inplace(&types_); - - return this->shallow_size(); + gc.visit_child(&vars_); + gc.visit_child(&types_); } // ----- printable facet ----- diff --git a/xo-expression2/src/expression2/DIfElseExpr.cpp b/xo-expression2/src/expression2/DIfElseExpr.cpp index 81efee1e..c44a7ebd 100644 --- a/xo-expression2/src/expression2/DIfElseExpr.cpp +++ b/xo-expression2/src/expression2/DIfElseExpr.cpp @@ -94,26 +94,27 @@ namespace xo { return gc.std_move_for(this); } - std::size_t - DIfElseExpr::forward_children(obj gc) noexcept + void + DIfElseExpr::visit_gco_children(obj gc) noexcept { - typeref_.forward_children(gc); + typeref_.visit_gco_children(gc); // GC needs to locate AGCObject iface for each member. { - auto gco = test_.to_facet(); - gc.forward_inplace(gco.iface(), (void **)&(test_.data_)); + gc.visit_poly_child(&test_); + //auto gco = test_.to_facet(); + //gc.forward_inplace(gco.iface(), (void **)&(test_.data_)); } { - auto gco = when_true_.to_facet(); - gc.forward_inplace(gco.iface(), (void **)&(when_true_.data_)); + gc.visit_poly_child(&when_true_); + //auto gco = when_true_.to_facet(); + //gc.forward_inplace(gco.iface(), (void **)&(when_true_.data_)); } { - auto gco = when_false_.to_facet(); - gc.forward_inplace(gco.iface(), (void **)&(when_false_.data_)); + gc.visit_poly_child(&when_false_); + //auto gco = when_false_.to_facet(); + //gc.forward_inplace(gco.iface(), (void **)&(when_false_.data_)); } - - return shallow_size(); } // ----- printable facet ----- diff --git a/xo-expression2/src/expression2/DLambdaExpr.cpp b/xo-expression2/src/expression2/DLambdaExpr.cpp index 8069cd3c..349ccd99 100644 --- a/xo-expression2/src/expression2/DLambdaExpr.cpp +++ b/xo-expression2/src/expression2/DLambdaExpr.cpp @@ -13,6 +13,7 @@ namespace xo { using xo::mm::AGCObject; + using xo::mm::AGCObjectVisitor; using xo::print::APrintable; using xo::facet::FacetRegistry; using xo::reflect::TypeDescr; @@ -144,36 +145,32 @@ namespace xo { return gc.std_move_for(this); } - std::size_t - DLambdaExpr::forward_children(obj gc) noexcept { - typeref_.forward_children(gc); + void + DLambdaExpr::visit_gco_children(obj gc) noexcept { + typeref_.visit_gco_children(gc); - { - //gc.forward_inplace(&name_); // doesn't compile for const ptr - auto iface = xo::facet::impl_for(); - gc.forward_inplace(&iface, (void **)(&name_)); - } + gc.visit_child(&name_); + //{ + // auto iface = xo::facet::impl_for(); + // gc.forward_inplace(&iface, (void **)(&name_)); + //} // type_name_str_ { - gc.forward_inplace(&local_symtab_); - //auto iface = xo::facet::impl_for(); - //gc.forward_inplace(&iface, (void **)(&local_symtab_)); + gc.visit_child(&local_symtab_); + //gc.forward_inplace(&local_symtab_); } { - gc.forward_pivot_inplace(&body_expr_); - //auto iface = body_expr_.to_facet().iface(); - //gc.forward_inplace(iface, (void **)&(body_expr_.data_)); + gc.visit_poly_child(&body_expr_); + //gc.forward_pivot_inplace(&body_expr_); } // xxx free_var_set // xxx captured_var_set // xxx layer_var_map // xxx nested_lambda_map - - return shallow_size(); } bool diff --git a/xo-expression2/src/expression2/DLocalSymtab.cpp b/xo-expression2/src/expression2/DLocalSymtab.cpp index 60cdd2e2..017fb1d7 100644 --- a/xo-expression2/src/expression2/DLocalSymtab.cpp +++ b/xo-expression2/src/expression2/DLocalSymtab.cpp @@ -112,26 +112,18 @@ namespace xo { // ----- gcobject facet ----- - std::size_t - DLocalSymtab::shallow_size() const noexcept - { - return sizeof(DLocalSymtab); - } - DLocalSymtab * DLocalSymtab::shallow_move(obj gc) noexcept { return gc.std_move_for(this); } - std::size_t - DLocalSymtab::forward_children(obj gc) noexcept + void + DLocalSymtab::visit_gco_children(obj gc) noexcept { - gc.forward_inplace(&parent_); - gc.forward_inplace(&vars_); - gc.forward_inplace(&types_); - - return shallow_size(); + gc.visit_child(&parent_); + gc.visit_child(&vars_); + gc.visit_child(&types_); } // ----- printable facet ----- diff --git a/xo-expression2/src/expression2/DSequenceExpr.cpp b/xo-expression2/src/expression2/DSequenceExpr.cpp index ed03affc..2dc153f0 100644 --- a/xo-expression2/src/expression2/DSequenceExpr.cpp +++ b/xo-expression2/src/expression2/DSequenceExpr.cpp @@ -125,14 +125,12 @@ namespace xo { return gc.std_move_for(this); } - std::size_t - DSequenceExpr::forward_children(obj gc) noexcept + void + DSequenceExpr::visit_gco_children(obj gc) noexcept { - typeref_.forward_children(gc); + typeref_.visit_gco_children(gc); - gc.forward_inplace(&expr_v_); - - return this->shallow_size(); + gc.visit_child(&expr_v_); } } /*namespace scm*/ diff --git a/xo-expression2/src/expression2/DTypename.cpp b/xo-expression2/src/expression2/DTypename.cpp index c9f56cf1..15e7dbdb 100644 --- a/xo-expression2/src/expression2/DTypename.cpp +++ b/xo-expression2/src/expression2/DTypename.cpp @@ -52,16 +52,16 @@ namespace xo { return gc.std_move_for(this); } - size_t - DTypename::forward_children(obj gc) noexcept + void + DTypename::visit_gco_children(obj gc) noexcept { - gc.forward_inplace(const_cast(&name_)); + gc.visit_child(&name_); + //gc.forward_inplace(const_cast(&name_)); { - auto e = type_.to_facet(); - gc.forward_inplace(e.iface(), (void **)&(type_.data_)); + gc.visit_poly_child(&type_); + //auto e = type_.to_facet(); + //gc.forward_inplace(e.iface(), (void **)&(type_.data_)); } - - return shallow_size(); } bool diff --git a/xo-expression2/src/expression2/DVarRef.cpp b/xo-expression2/src/expression2/DVarRef.cpp index 3b9b2638..6cdea4e5 100644 --- a/xo-expression2/src/expression2/DVarRef.cpp +++ b/xo-expression2/src/expression2/DVarRef.cpp @@ -70,16 +70,14 @@ namespace xo { return gc.std_move_for(this); } - std::size_t - DVarRef::forward_children(obj gc) noexcept + void + DVarRef::visit_gco_children(obj gc) noexcept { - gc.forward_inplace(&vardef_); + gc.visit_child(&vardef_); //auto iface = xo::facet::impl_for(); //gc.forward_inplace(&iface, (void **)vardef_.data_); // TODO: concept to indicate that no gc pointers in Binding - - return shallow_size(); } // printable facet diff --git a/xo-expression2/src/expression2/DVariable.cpp b/xo-expression2/src/expression2/DVariable.cpp index 68a87f67..9ab2f8bd 100644 --- a/xo-expression2/src/expression2/DVariable.cpp +++ b/xo-expression2/src/expression2/DVariable.cpp @@ -50,12 +50,10 @@ namespace xo { return gc.std_move_for(this); } - size_t - DVariable::forward_children(obj gc) noexcept + void + DVariable::visit_gco_children(obj gc) noexcept { - typeref_.forward_children(gc); - - return shallow_size(); + typeref_.visit_gco_children(gc); } bool diff --git a/xo-expression2/src/expression2/IGCObject_DApplyExpr.cpp b/xo-expression2/src/expression2/IGCObject_DApplyExpr.cpp index 56fdda92..9b5fc735 100644 --- a/xo-expression2/src/expression2/IGCObject_DApplyExpr.cpp +++ b/xo-expression2/src/expression2/IGCObject_DApplyExpr.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DApplyExpr::forward_children(DApplyExpr & self, obj gc) noexcept -> void + IGCObject_DApplyExpr::visit_gco_children(DApplyExpr & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ diff --git a/xo-expression2/src/expression2/IGCObject_DConstant.cpp b/xo-expression2/src/expression2/IGCObject_DConstant.cpp index 62bf0fd7..3e350102 100644 --- a/xo-expression2/src/expression2/IGCObject_DConstant.cpp +++ b/xo-expression2/src/expression2/IGCObject_DConstant.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DConstant::forward_children(DConstant & self, obj gc) noexcept -> void + IGCObject_DConstant::visit_gco_children(DConstant & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ diff --git a/xo-expression2/src/expression2/IGCObject_DDefineExpr.cpp b/xo-expression2/src/expression2/IGCObject_DDefineExpr.cpp index 91c83d67..34c59e93 100644 --- a/xo-expression2/src/expression2/IGCObject_DDefineExpr.cpp +++ b/xo-expression2/src/expression2/IGCObject_DDefineExpr.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DDefineExpr::forward_children(DDefineExpr & self, obj gc) noexcept -> void + IGCObject_DDefineExpr::visit_gco_children(DDefineExpr & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ diff --git a/xo-expression2/src/expression2/IGCObject_DGlobalSymtab.cpp b/xo-expression2/src/expression2/IGCObject_DGlobalSymtab.cpp index 9f9549ae..1e78de47 100644 --- a/xo-expression2/src/expression2/IGCObject_DGlobalSymtab.cpp +++ b/xo-expression2/src/expression2/IGCObject_DGlobalSymtab.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DGlobalSymtab::forward_children(DGlobalSymtab & self, obj gc) noexcept -> void + IGCObject_DGlobalSymtab::visit_gco_children(DGlobalSymtab & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ diff --git a/xo-expression2/src/expression2/IGCObject_DIfElseExpr.cpp b/xo-expression2/src/expression2/IGCObject_DIfElseExpr.cpp index 532cad21..0db6f160 100644 --- a/xo-expression2/src/expression2/IGCObject_DIfElseExpr.cpp +++ b/xo-expression2/src/expression2/IGCObject_DIfElseExpr.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DIfElseExpr::forward_children(DIfElseExpr & self, obj gc) noexcept -> void + IGCObject_DIfElseExpr::visit_gco_children(DIfElseExpr & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ diff --git a/xo-expression2/src/expression2/IGCObject_DLambdaExpr.cpp b/xo-expression2/src/expression2/IGCObject_DLambdaExpr.cpp index b6045e90..a9ad37aa 100644 --- a/xo-expression2/src/expression2/IGCObject_DLambdaExpr.cpp +++ b/xo-expression2/src/expression2/IGCObject_DLambdaExpr.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DLambdaExpr::forward_children(DLambdaExpr & self, obj gc) noexcept -> void + IGCObject_DLambdaExpr::visit_gco_children(DLambdaExpr & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ diff --git a/xo-expression2/src/expression2/IGCObject_DLocalSymtab.cpp b/xo-expression2/src/expression2/IGCObject_DLocalSymtab.cpp index df9bc0b7..7384e17a 100644 --- a/xo-expression2/src/expression2/IGCObject_DLocalSymtab.cpp +++ b/xo-expression2/src/expression2/IGCObject_DLocalSymtab.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DLocalSymtab::forward_children(DLocalSymtab & self, obj gc) noexcept -> void + IGCObject_DLocalSymtab::visit_gco_children(DLocalSymtab & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ diff --git a/xo-expression2/src/expression2/IGCObject_DSequenceExpr.cpp b/xo-expression2/src/expression2/IGCObject_DSequenceExpr.cpp index 36efcbfe..8660f506 100644 --- a/xo-expression2/src/expression2/IGCObject_DSequenceExpr.cpp +++ b/xo-expression2/src/expression2/IGCObject_DSequenceExpr.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DSequenceExpr::forward_children(DSequenceExpr & self, obj gc) noexcept -> void + IGCObject_DSequenceExpr::visit_gco_children(DSequenceExpr & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ diff --git a/xo-expression2/src/expression2/IGCObject_DTypename.cpp b/xo-expression2/src/expression2/IGCObject_DTypename.cpp index 246b7bd5..478b2005 100644 --- a/xo-expression2/src/expression2/IGCObject_DTypename.cpp +++ b/xo-expression2/src/expression2/IGCObject_DTypename.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DTypename::forward_children(DTypename & self, obj gc) noexcept -> void + IGCObject_DTypename::visit_gco_children(DTypename & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ diff --git a/xo-expression2/src/expression2/IGCObject_DVarRef.cpp b/xo-expression2/src/expression2/IGCObject_DVarRef.cpp index fc0934fd..7035db1e 100644 --- a/xo-expression2/src/expression2/IGCObject_DVarRef.cpp +++ b/xo-expression2/src/expression2/IGCObject_DVarRef.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DVarRef::forward_children(DVarRef & self, obj gc) noexcept -> void + IGCObject_DVarRef::visit_gco_children(DVarRef & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ diff --git a/xo-expression2/src/expression2/TypeRef.cpp b/xo-expression2/src/expression2/TypeRef.cpp index b5baa88d..961ae148 100644 --- a/xo-expression2/src/expression2/TypeRef.cpp +++ b/xo-expression2/src/expression2/TypeRef.cpp @@ -102,11 +102,11 @@ namespace xo { } void - TypeRef::forward_children(obj gc) noexcept + TypeRef::visit_gco_children(obj gc) noexcept { //scope log(XO_DEBUG(true), xtag("type", type_.data()), xtag("type.tseq", type_._typeseq())); - gc.forward_pivot_inplace(&type_); + gc.visit_poly_child(&type_); } bool diff --git a/xo-expression2/src/expression2/facet/IGCObject_DVariable.cpp b/xo-expression2/src/expression2/facet/IGCObject_DVariable.cpp index 7b2103d6..a6370f56 100644 --- a/xo-expression2/src/expression2/facet/IGCObject_DVariable.cpp +++ b/xo-expression2/src/expression2/facet/IGCObject_DVariable.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DVariable::forward_children(DVariable & self, obj gc) noexcept -> void + IGCObject_DVariable::visit_gco_children(DVariable & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ diff --git a/xo-gc/include/xo/gc/X1Collector.hpp b/xo-gc/include/xo/gc/X1Collector.hpp index 38999844..c35f5251 100644 --- a/xo-gc/include/xo/gc/X1Collector.hpp +++ b/xo-gc/include/xo/gc/X1Collector.hpp @@ -8,5 +8,6 @@ #include "DX1Collector.hpp" #include "detail/ICollector_DX1Collector.hpp" #include "detail/IAllocator_DX1Collector.hpp" +#include "detail/IGCObjectVisitor_DX1Collector.hpp" /* end X1Collector.hpp */ diff --git a/xo-gc/src/gc/DX1Collector.cpp b/xo-gc/src/gc/DX1Collector.cpp index d31c78ca..a74b7f09 100644 --- a/xo-gc/src/gc/DX1Collector.cpp +++ b/xo-gc/src/gc/DX1Collector.cpp @@ -13,6 +13,7 @@ #include #include +#include #include #include #include "object_age.hpp" @@ -382,7 +383,7 @@ namespace xo { // Add run state so DX1Collector can recognize forward_inplace() // calls made for the purpose of checking child pointers. - auto self = this->ref(); + auto self = this->ref(); GCRunState saved_runstate = runstate_; { @@ -403,7 +404,7 @@ namespace xo { // - X1Collector::forward_inplace() -> _verify_aux() // - gco.forward_children(self); + gco.visit_gco_children(self); } diff --git a/xo-gc/src/gc/GCObjectStore.cpp b/xo-gc/src/gc/GCObjectStore.cpp index 4076fd90..ee900b50 100644 --- a/xo-gc/src/gc/GCObjectStore.cpp +++ b/xo-gc/src/gc/GCObjectStore.cpp @@ -498,7 +498,7 @@ namespace xo { log && log("disposition: not in from-space. Don't forward, but check children"); obj gco(lhs_iface, object_data); - gco.forward_children(gc->ref()); + gco.visit_gco_children(gc->ref()); return; } @@ -711,7 +711,7 @@ namespace xo { // Nested control reenters // X1Collector::forward_inplace() -> _verify_aux() // - gco.forward_children(gc->ref()); + gco.visit_gco_children(gc->ref()); } else { ++(p_verify_stats->n_no_iface_); continue; @@ -771,12 +771,12 @@ namespace xo { // we aren't moving from_src, it's not gc-owned. // However weare moving all its gc-owned children - auto gc_obj = gc->ref(); + auto gc_obj = gc->ref(); GCMoveCheckpoint gray_lo_v = this->snap_move_checkpoint(upto); - from_src.forward_children(gc_obj); + from_src.visit_gco_children(gc_obj); // For each generation g: // traverse objects newer than gray_lo_v[g], to make sure children @@ -1005,9 +1005,9 @@ namespace xo { assert(iface->_has_null_vptr() == false); - auto gc_gco = gc->ref(); + auto gc_gco = gc->ref(); - iface->forward_children(src, gc_gco); + iface->visit_gco_children(src, gc_gco); gray_lo_v[g] = ((std::byte *)src) + z; diff --git a/xo-interpreter2/include/xo/interpreter2/DClosure.hpp b/xo-interpreter2/include/xo/interpreter2/DClosure.hpp index e57f6a1a..4d24d72e 100644 --- a/xo-interpreter2/include/xo/interpreter2/DClosure.hpp +++ b/xo-interpreter2/include/xo/interpreter2/DClosure.hpp @@ -20,8 +20,9 @@ namespace xo { public: using ARuntimeContext = xo::scm::ARuntimeContext; using ACollector = xo::mm::ACollector; - using AAllocator = xo::mm::AAllocator; using AGCObject = xo::mm::AGCObject; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using AAllocator = xo::mm::AAllocator; using ppindentinfo = xo::print::ppindentinfo; using size_type = std::int32_t; @@ -57,9 +58,8 @@ namespace xo { /** @defgroup scm-closure-gcobject-facet **/ ///@{ - std::size_t shallow_size() const noexcept; DClosure * shallow_move(obj gc) noexcept; - std::size_t forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} /** @defgroup scm-closure-printable-facet **/ diff --git a/xo-interpreter2/include/xo/interpreter2/DLocalEnv.hpp b/xo-interpreter2/include/xo/interpreter2/DLocalEnv.hpp index 6ecd3eb6..5270dec1 100644 --- a/xo-interpreter2/include/xo/interpreter2/DLocalEnv.hpp +++ b/xo-interpreter2/include/xo/interpreter2/DLocalEnv.hpp @@ -17,8 +17,9 @@ namespace xo { public: using DArray = xo::scm::DArray; using ACollector = xo::mm::ACollector; - using AAllocator = xo::mm::AAllocator; using AGCObject = xo::mm::AGCObject; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using AAllocator = xo::mm::AAllocator; using ppindentinfo = xo::print::ppindentinfo; using size_type = std::uint32_t; @@ -54,9 +55,8 @@ namespace xo { /** @defgroup scm-localenv-gcobject-facet **/ ///@{ - std::size_t shallow_size() const noexcept; DLocalEnv * shallow_move(obj gc) noexcept; - std::size_t forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} /** @defgroup scm-localenv-printable-facet **/ diff --git a/xo-interpreter2/include/xo/interpreter2/DVsmApplyClosureFrame.hpp b/xo-interpreter2/include/xo/interpreter2/DVsmApplyClosureFrame.hpp index ae422cb1..8dd30efb 100644 --- a/xo-interpreter2/include/xo/interpreter2/DVsmApplyClosureFrame.hpp +++ b/xo-interpreter2/include/xo/interpreter2/DVsmApplyClosureFrame.hpp @@ -19,8 +19,9 @@ namespace xo { class DVsmApplyClosureFrame { public: using ACollector = xo::mm::ACollector; - using AAllocator = xo::mm::AAllocator; using AGCObject = xo::mm::AGCObject; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using AAllocator = xo::mm::AAllocator; using ppindentinfo = xo::print::ppindentinfo; public: @@ -41,7 +42,7 @@ namespace xo { /** gcobject facet **/ std::size_t shallow_size() const noexcept; DVsmApplyClosureFrame * shallow_move(obj gc) noexcept; - std::size_t forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; /** pretty-printing support **/ bool pretty(const ppindentinfo & ppii) const; diff --git a/xo-interpreter2/include/xo/interpreter2/DVsmApplyFrame.hpp b/xo-interpreter2/include/xo/interpreter2/DVsmApplyFrame.hpp index 99093f37..d8e9ab79 100644 --- a/xo-interpreter2/include/xo/interpreter2/DVsmApplyFrame.hpp +++ b/xo-interpreter2/include/xo/interpreter2/DVsmApplyFrame.hpp @@ -15,8 +15,9 @@ namespace xo { public: using AProcedure = xo::scm::AProcedure; using ACollector = xo::mm::ACollector; - using AAllocator = xo::mm::AAllocator; using AGCObject = xo::mm::AGCObject; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using AAllocator = xo::mm::AAllocator; using ppindentinfo = xo::print::ppindentinfo; public: @@ -37,9 +38,8 @@ namespace xo { void assign_fn(obj x) { this->fn_ = x; } - std::size_t shallow_size() const noexcept; DVsmApplyFrame * shallow_move(obj gc) noexcept; - std::size_t forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; /** pretty-printing support **/ bool pretty(const ppindentinfo & ppii) const; diff --git a/xo-interpreter2/include/xo/interpreter2/DVsmDefContFrame.hpp b/xo-interpreter2/include/xo/interpreter2/DVsmDefContFrame.hpp index 0ad31cca..acdd8a90 100644 --- a/xo-interpreter2/include/xo/interpreter2/DVsmDefContFrame.hpp +++ b/xo-interpreter2/include/xo/interpreter2/DVsmDefContFrame.hpp @@ -16,6 +16,7 @@ namespace xo { class DVsmDefContFrame { public: using ACollector = xo::mm::ACollector; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AAllocator = xo::mm::AAllocator; using AGCObject = xo::mm::AGCObject; using ppindentinfo = xo::print::ppindentinfo; @@ -50,9 +51,8 @@ namespace xo { /** @defgroup scm-vsmdefcontframe-gcobject-facet gcobject facet **/ ///@{ - std::size_t shallow_size() const noexcept; DVsmDefContFrame * shallow_move(obj gc) noexcept; - std::size_t forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} /** @defgrouop scm-vsmseqcontframe-printable-facet printable facet **/ diff --git a/xo-interpreter2/include/xo/interpreter2/DVsmEvalArgsFrame.hpp b/xo-interpreter2/include/xo/interpreter2/DVsmEvalArgsFrame.hpp index a1903e94..ab7a4607 100644 --- a/xo-interpreter2/include/xo/interpreter2/DVsmEvalArgsFrame.hpp +++ b/xo-interpreter2/include/xo/interpreter2/DVsmEvalArgsFrame.hpp @@ -15,8 +15,9 @@ namespace xo { class DVsmEvalArgsFrame { public: using ACollector = xo::mm::ACollector; - using AAllocator = xo::mm::AAllocator; using AGCObject = xo::mm::AGCObject; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using AAllocator = xo::mm::AAllocator; using ppindentinfo = xo::print::ppindentinfo; public: @@ -42,9 +43,8 @@ namespace xo { int32_t increment_arg() { return ++i_arg_; } - std::size_t shallow_size() const noexcept; DVsmEvalArgsFrame * shallow_move(obj gc) noexcept; - std::size_t forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; bool pretty(const ppindentinfo & ppii) const; diff --git a/xo-interpreter2/include/xo/interpreter2/DVsmIfElseContFrame.hpp b/xo-interpreter2/include/xo/interpreter2/DVsmIfElseContFrame.hpp index 3c438e51..82c5ee31 100644 --- a/xo-interpreter2/include/xo/interpreter2/DVsmIfElseContFrame.hpp +++ b/xo-interpreter2/include/xo/interpreter2/DVsmIfElseContFrame.hpp @@ -16,8 +16,9 @@ namespace xo { class DVsmIfElseContFrame { public: using ACollector = xo::mm::ACollector; - using AAllocator = xo::mm::AAllocator; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AGCObject = xo::mm::AGCObject; + using AAllocator = xo::mm::AAllocator; using ppindentinfo = xo::print::ppindentinfo; public: @@ -50,9 +51,8 @@ namespace xo { /** @defgroup scm-vsmevalsequenceframe-gcobject-facet gcobject facet **/ ///@{ - std::size_t shallow_size() const noexcept; DVsmIfElseContFrame * shallow_move(obj gc) noexcept; - std::size_t forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} /** @defgrouop scm-vsmseqcontframe-printable-facet printable facet **/ diff --git a/xo-interpreter2/include/xo/interpreter2/DVsmSeqContFrame.hpp b/xo-interpreter2/include/xo/interpreter2/DVsmSeqContFrame.hpp index 959edfb0..65532996 100644 --- a/xo-interpreter2/include/xo/interpreter2/DVsmSeqContFrame.hpp +++ b/xo-interpreter2/include/xo/interpreter2/DVsmSeqContFrame.hpp @@ -18,6 +18,7 @@ namespace xo { using ACollector = xo::mm::ACollector; using AAllocator = xo::mm::AAllocator; using AGCObject = xo::mm::AGCObject; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using ppindentinfo = xo::print::ppindentinfo; public: @@ -55,9 +56,8 @@ namespace xo { /** @defgroup scm-vsmevalsequenceframe-gcobject-facet gcobject facet **/ ///@{ - std::size_t shallow_size() const noexcept; DVsmSeqContFrame * shallow_move(obj gc) noexcept; - std::size_t forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} /** @defgrouop scm-vsmseqcontframe-printable-facet printable facet **/ diff --git a/xo-interpreter2/include/xo/interpreter2/define/IGCObject_DVsmDefContFrame.hpp b/xo-interpreter2/include/xo/interpreter2/define/IGCObject_DVsmDefContFrame.hpp index 7d082c38..85949311 100644 --- a/xo-interpreter2/include/xo/interpreter2/define/IGCObject_DVsmDefContFrame.hpp +++ b/xo-interpreter2/include/xo/interpreter2/define/IGCObject_DVsmDefContFrame.hpp @@ -44,6 +44,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -54,8 +55,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DVsmDefContFrame & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DVsmDefContFrame & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DVsmDefContFrame & self, obj fn) noexcept; ///@} }; diff --git a/xo-interpreter2/include/xo/interpreter2/detail/IGCObject_DClosure.hpp b/xo-interpreter2/include/xo/interpreter2/detail/IGCObject_DClosure.hpp index 84502baa..284199eb 100644 --- a/xo-interpreter2/include/xo/interpreter2/detail/IGCObject_DClosure.hpp +++ b/xo-interpreter2/include/xo/interpreter2/detail/IGCObject_DClosure.hpp @@ -44,6 +44,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -54,8 +55,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DClosure & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DClosure & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DClosure & self, obj fn) noexcept; ///@} }; diff --git a/xo-interpreter2/include/xo/interpreter2/detail/IGCObject_DVsmApplyClosureFrame.hpp b/xo-interpreter2/include/xo/interpreter2/detail/IGCObject_DVsmApplyClosureFrame.hpp index 9a2e478d..b6a92890 100644 --- a/xo-interpreter2/include/xo/interpreter2/detail/IGCObject_DVsmApplyClosureFrame.hpp +++ b/xo-interpreter2/include/xo/interpreter2/detail/IGCObject_DVsmApplyClosureFrame.hpp @@ -44,6 +44,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -54,8 +55,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DVsmApplyClosureFrame & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DVsmApplyClosureFrame & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DVsmApplyClosureFrame & self, obj fn) noexcept; ///@} }; diff --git a/xo-interpreter2/include/xo/interpreter2/detail/IGCObject_DVsmApplyFrame.hpp b/xo-interpreter2/include/xo/interpreter2/detail/IGCObject_DVsmApplyFrame.hpp index 9de1e8f3..85b3f614 100644 --- a/xo-interpreter2/include/xo/interpreter2/detail/IGCObject_DVsmApplyFrame.hpp +++ b/xo-interpreter2/include/xo/interpreter2/detail/IGCObject_DVsmApplyFrame.hpp @@ -44,6 +44,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -54,8 +55,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DVsmApplyFrame & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DVsmApplyFrame & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DVsmApplyFrame & self, obj fn) noexcept; ///@} }; diff --git a/xo-interpreter2/include/xo/interpreter2/detail/IGCObject_DVsmEvalArgsFrame.hpp b/xo-interpreter2/include/xo/interpreter2/detail/IGCObject_DVsmEvalArgsFrame.hpp index 9e2841a6..d62489c3 100644 --- a/xo-interpreter2/include/xo/interpreter2/detail/IGCObject_DVsmEvalArgsFrame.hpp +++ b/xo-interpreter2/include/xo/interpreter2/detail/IGCObject_DVsmEvalArgsFrame.hpp @@ -44,6 +44,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -54,8 +55,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DVsmEvalArgsFrame & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DVsmEvalArgsFrame & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DVsmEvalArgsFrame & self, obj fn) noexcept; ///@} }; diff --git a/xo-interpreter2/include/xo/interpreter2/env/IGCObject_DLocalEnv.hpp b/xo-interpreter2/include/xo/interpreter2/env/IGCObject_DLocalEnv.hpp index e4de912e..599829a9 100644 --- a/xo-interpreter2/include/xo/interpreter2/env/IGCObject_DLocalEnv.hpp +++ b/xo-interpreter2/include/xo/interpreter2/env/IGCObject_DLocalEnv.hpp @@ -44,6 +44,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -54,8 +55,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DLocalEnv & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DLocalEnv & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DLocalEnv & self, obj fn) noexcept; ///@} }; diff --git a/xo-interpreter2/include/xo/interpreter2/ifelse/IGCObject_DVsmIfElseContFrame.hpp b/xo-interpreter2/include/xo/interpreter2/ifelse/IGCObject_DVsmIfElseContFrame.hpp index a3cede47..c0c25c65 100644 --- a/xo-interpreter2/include/xo/interpreter2/ifelse/IGCObject_DVsmIfElseContFrame.hpp +++ b/xo-interpreter2/include/xo/interpreter2/ifelse/IGCObject_DVsmIfElseContFrame.hpp @@ -44,6 +44,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -54,8 +55,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DVsmIfElseContFrame & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DVsmIfElseContFrame & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DVsmIfElseContFrame & self, obj fn) noexcept; ///@} }; diff --git a/xo-interpreter2/include/xo/interpreter2/sequence/IGCObject_DVsmSeqContFrame.hpp b/xo-interpreter2/include/xo/interpreter2/sequence/IGCObject_DVsmSeqContFrame.hpp index 14367b50..0c9fe148 100644 --- a/xo-interpreter2/include/xo/interpreter2/sequence/IGCObject_DVsmSeqContFrame.hpp +++ b/xo-interpreter2/include/xo/interpreter2/sequence/IGCObject_DVsmSeqContFrame.hpp @@ -44,6 +44,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -54,8 +55,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DVsmSeqContFrame & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DVsmSeqContFrame & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DVsmSeqContFrame & self, obj fn) noexcept; ///@} }; diff --git a/xo-interpreter2/include/xo/interpreter2/vsm/DVirtualSchematikaMachine.hpp b/xo-interpreter2/include/xo/interpreter2/vsm/DVirtualSchematikaMachine.hpp index fa9a6929..28343528 100644 --- a/xo-interpreter2/include/xo/interpreter2/vsm/DVirtualSchematikaMachine.hpp +++ b/xo-interpreter2/include/xo/interpreter2/vsm/DVirtualSchematikaMachine.hpp @@ -72,8 +72,9 @@ namespace xo { // will be DArenaVector> probably using Stack = void *; using ACollector = xo::mm::ACollector; - using AAllocator = xo::mm::AAllocator; using AGCObject = xo::mm::AGCObject; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using AAllocator = xo::mm::AAllocator; using MemorySizeVisitor = xo::mm::MemorySizeVisitor; using span_type = xo::mm::span; @@ -157,7 +158,7 @@ namespace xo { /** forward gc-aware child pointers **/ - std::size_t forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} diff --git a/xo-interpreter2/include/xo/interpreter2/vsm/IGCObject_DVirtualSchematikaMachine.hpp b/xo-interpreter2/include/xo/interpreter2/vsm/IGCObject_DVirtualSchematikaMachine.hpp index 073e9fac..3d72b7af 100644 --- a/xo-interpreter2/include/xo/interpreter2/vsm/IGCObject_DVirtualSchematikaMachine.hpp +++ b/xo-interpreter2/include/xo/interpreter2/vsm/IGCObject_DVirtualSchematikaMachine.hpp @@ -44,6 +44,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -54,8 +55,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DVirtualSchematikaMachine & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DVirtualSchematikaMachine & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DVirtualSchematikaMachine & self, obj fn) noexcept; ///@} }; diff --git a/xo-interpreter2/src/interpreter2/DClosure.cpp b/xo-interpreter2/src/interpreter2/DClosure.cpp index 6b346463..ea8bcb15 100644 --- a/xo-interpreter2/src/interpreter2/DClosure.cpp +++ b/xo-interpreter2/src/interpreter2/DClosure.cpp @@ -64,32 +64,16 @@ namespace xo { return err; } - size_t - DClosure::shallow_size() const noexcept { - return sizeof(DClosure); - } - DClosure * DClosure::shallow_move(obj gc) noexcept { return gc.std_move_for(this); } - std::size_t - DClosure::forward_children(obj gc) noexcept + void + DClosure::visit_gco_children(obj gc) noexcept { - { - gc.forward_inplace(&lambda_); - //auto iface = xo::facet::impl_for(); - //gc.forward_inplace(&iface, (void **)(&lambda_)); - - } - { - gc.forward_inplace(&env_); - //auto iface = xo::facet::impl_for(); - //gc.forward_inplace(&iface, (void **)(&env_)); - } - - return this->shallow_size(); + gc.visit_child(&lambda_); + gc.visit_child(&env_); } // ----- printable facet ----- diff --git a/xo-interpreter2/src/interpreter2/DLocalEnv.cpp b/xo-interpreter2/src/interpreter2/DLocalEnv.cpp index 4124e280..3da6fd9b 100644 --- a/xo-interpreter2/src/interpreter2/DLocalEnv.cpp +++ b/xo-interpreter2/src/interpreter2/DLocalEnv.cpp @@ -91,33 +91,29 @@ namespace xo { /* something terribly wrong if control here */ } - std::size_t - DLocalEnv::shallow_size() const noexcept { - return sizeof(DLocalEnv); - } - DLocalEnv * DLocalEnv::shallow_move(obj gc) noexcept { return gc.std_move_for(this); } - std::size_t - DLocalEnv::forward_children(obj gc) noexcept + void + DLocalEnv::visit_gco_children(obj gc) noexcept { { - auto iface = xo::facet::impl_for(); - gc.forward_inplace(&iface, (void **)(&parent_)); + gc.visit_child(&parent_); + //auto iface = xo::facet::impl_for(); + //gc.forward_inplace(&iface, (void **)(&parent_)); } { - auto iface = xo::facet::impl_for(); - gc.forward_inplace(&iface, (void **)(&symtab_)); + gc.visit_child(&symtab_); + //auto iface = xo::facet::impl_for(); + //gc.forward_inplace(&iface, (void **)(&symtab_)); } { - auto iface = xo::facet::impl_for(); - gc.forward_inplace(&iface, (void **)(&args_)); + gc.visit_child(&args_); + //auto iface = xo::facet::impl_for(); + //gc.forward_inplace(&iface, (void **)(&args_)); } - - return shallow_size(); } // ----- printable facet ----- diff --git a/xo-interpreter2/src/interpreter2/DVirtualSchematikaMachine.cpp b/xo-interpreter2/src/interpreter2/DVirtualSchematikaMachine.cpp index 06a4c23f..8f9d3967 100644 --- a/xo-interpreter2/src/interpreter2/DVirtualSchematikaMachine.cpp +++ b/xo-interpreter2/src/interpreter2/DVirtualSchematikaMachine.cpp @@ -968,22 +968,20 @@ namespace xo { return nullptr; } - std::size_t - DVirtualSchematikaMachine::forward_children(obj gc) noexcept + void + DVirtualSchematikaMachine::visit_gco_children(obj gc) noexcept { - reader_.forward_children(gc); + reader_.visit_gco_children(gc); - gc.forward_inplace(&stack_); - gc.forward_pivot_inplace(&expr_); - gc.forward_inplace(&global_env_); - gc.forward_inplace(&local_env_); - gc.forward_inplace(&fn_); - gc.forward_inplace(&args_); + gc.visit_child(&stack_); + gc.visit_poly_child(&expr_); + gc.visit_child(&global_env_); + gc.visit_child(&local_env_); + gc.visit_child(&fn_); + gc.visit_child(&args_); if (value_.is_value()) { - gc.forward_inplace(const_cast *>(&value_.value_ref())); + gc.visit_child(const_cast *>(&value_.value_ref())); } - - return this->shallow_size(); } } /*namespace scm*/ diff --git a/xo-interpreter2/src/interpreter2/DVsmApplyClosureFrame.cpp b/xo-interpreter2/src/interpreter2/DVsmApplyClosureFrame.cpp index 129d0d46..c17414b8 100644 --- a/xo-interpreter2/src/interpreter2/DVsmApplyClosureFrame.cpp +++ b/xo-interpreter2/src/interpreter2/DVsmApplyClosureFrame.cpp @@ -32,25 +32,17 @@ namespace xo { return new (mem) DVsmApplyClosureFrame(stack, cont, local_env); } - std::size_t - DVsmApplyClosureFrame::shallow_size() const noexcept - { - return sizeof(DVsmApplyClosureFrame); - } - DVsmApplyClosureFrame * DVsmApplyClosureFrame::shallow_move(obj gc) noexcept { return gc.std_move_for(this); } - std::size_t - DVsmApplyClosureFrame::forward_children(obj gc) noexcept + void + DVsmApplyClosureFrame::visit_gco_children(obj gc) noexcept { - gc.forward_inplace(&stack_); - gc.forward_inplace(&local_env_); - - return this->shallow_size(); + gc.visit_child(&stack_); + gc.visit_child(&local_env_); } bool diff --git a/xo-interpreter2/src/interpreter2/DVsmApplyFrame.cpp b/xo-interpreter2/src/interpreter2/DVsmApplyFrame.cpp index d388f9c4..1a9a946d 100644 --- a/xo-interpreter2/src/interpreter2/DVsmApplyFrame.cpp +++ b/xo-interpreter2/src/interpreter2/DVsmApplyFrame.cpp @@ -40,26 +40,18 @@ namespace xo { return result; } - std::size_t - DVsmApplyFrame::shallow_size() const noexcept - { - return sizeof(DVsmApplyFrame); - } - DVsmApplyFrame * DVsmApplyFrame::shallow_move(obj gc) noexcept { return gc.std_move_for(this); } - std::size_t - DVsmApplyFrame::forward_children(obj gc) noexcept + void + DVsmApplyFrame::visit_gco_children(obj gc) noexcept { - gc.forward_inplace(&parent_); - gc.forward_inplace(&fn_); - gc.forward_inplace(&args_); - - return this->shallow_size(); + gc.visit_child(&parent_); + gc.visit_child(&fn_); + gc.visit_child(&args_); } bool diff --git a/xo-interpreter2/src/interpreter2/DVsmDefContFrame.cpp b/xo-interpreter2/src/interpreter2/DVsmDefContFrame.cpp index 02094534..0014f1a3 100644 --- a/xo-interpreter2/src/interpreter2/DVsmDefContFrame.cpp +++ b/xo-interpreter2/src/interpreter2/DVsmDefContFrame.cpp @@ -31,25 +31,17 @@ namespace xo { // gcobject facet - std::size_t - DVsmDefContFrame::shallow_size() const noexcept - { - return sizeof(*this); - } - DVsmDefContFrame * DVsmDefContFrame::shallow_move(obj gc) noexcept { return gc.std_move_for(this); } - std::size_t - DVsmDefContFrame::forward_children(obj gc) noexcept + void + DVsmDefContFrame::visit_gco_children(obj gc) noexcept { - gc.forward_inplace(&parent_); - gc.forward_inplace(&def_expr_); - - return this->shallow_size(); + gc.visit_child(&parent_); + gc.visit_child(&def_expr_); } // printable facet diff --git a/xo-interpreter2/src/interpreter2/DVsmEvalArgsFrame.cpp b/xo-interpreter2/src/interpreter2/DVsmEvalArgsFrame.cpp index 204bfb44..b796bb78 100644 --- a/xo-interpreter2/src/interpreter2/DVsmEvalArgsFrame.cpp +++ b/xo-interpreter2/src/interpreter2/DVsmEvalArgsFrame.cpp @@ -41,25 +41,17 @@ namespace xo { return result; } - std::size_t - DVsmEvalArgsFrame::shallow_size() const noexcept - { - return sizeof(DVsmEvalArgsFrame); - } - DVsmEvalArgsFrame * DVsmEvalArgsFrame::shallow_move(obj gc) noexcept { return gc.std_move_for(this); } - std::size_t - DVsmEvalArgsFrame::forward_children(obj gc) noexcept + void + DVsmEvalArgsFrame::visit_gco_children(obj gc) noexcept { - gc.forward_inplace(&parent_); - gc.forward_inplace(&apply_expr_); - - return this->shallow_size(); + gc.visit_child(&parent_); + gc.visit_child(&apply_expr_); } bool diff --git a/xo-interpreter2/src/interpreter2/DVsmIfElseContFrame.cpp b/xo-interpreter2/src/interpreter2/DVsmIfElseContFrame.cpp index 511af900..d0edd976 100644 --- a/xo-interpreter2/src/interpreter2/DVsmIfElseContFrame.cpp +++ b/xo-interpreter2/src/interpreter2/DVsmIfElseContFrame.cpp @@ -29,25 +29,17 @@ namespace xo { // gcobject facet - std::size_t - DVsmIfElseContFrame::shallow_size() const noexcept - { - return sizeof(*this); - } - DVsmIfElseContFrame * DVsmIfElseContFrame::shallow_move(obj gc) noexcept { return gc.std_move_for(this); } - std::size_t - DVsmIfElseContFrame::forward_children(obj gc) noexcept + void + DVsmIfElseContFrame::visit_gco_children(obj gc) noexcept { - gc.forward_inplace(&parent_); - gc.forward_inplace(&ifelse_expr_); - - return this->shallow_size(); + gc.visit_child(&parent_); + gc.visit_child(&ifelse_expr_); } // printable facet diff --git a/xo-interpreter2/src/interpreter2/DVsmSeqContFrame.cpp b/xo-interpreter2/src/interpreter2/DVsmSeqContFrame.cpp index ad006def..f9ef2f0b 100644 --- a/xo-interpreter2/src/interpreter2/DVsmSeqContFrame.cpp +++ b/xo-interpreter2/src/interpreter2/DVsmSeqContFrame.cpp @@ -32,25 +32,17 @@ namespace xo { // gcobject facet - std::size_t - DVsmSeqContFrame::shallow_size() const noexcept - { - return sizeof(*this); - } - DVsmSeqContFrame * DVsmSeqContFrame::shallow_move(obj gc) noexcept { return gc.std_move_for(this); } - std::size_t - DVsmSeqContFrame::forward_children(obj gc) noexcept + void + DVsmSeqContFrame::visit_gco_children(obj gc) noexcept { - gc.forward_inplace(&parent_); - gc.forward_inplace(&seq_expr_); - - return this->shallow_size(); + gc.visit_child(&parent_); + gc.visit_child(&seq_expr_); } // printable facet diff --git a/xo-interpreter2/src/interpreter2/IGCObject_DClosure.cpp b/xo-interpreter2/src/interpreter2/IGCObject_DClosure.cpp index 3f6af457..889567bc 100644 --- a/xo-interpreter2/src/interpreter2/IGCObject_DClosure.cpp +++ b/xo-interpreter2/src/interpreter2/IGCObject_DClosure.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DClosure::forward_children(DClosure & self, obj gc) noexcept -> void + IGCObject_DClosure::visit_gco_children(DClosure & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ diff --git a/xo-interpreter2/src/interpreter2/IGCObject_DVsmApplyClosureFrame.cpp b/xo-interpreter2/src/interpreter2/IGCObject_DVsmApplyClosureFrame.cpp index cd0bed84..be67179b 100644 --- a/xo-interpreter2/src/interpreter2/IGCObject_DVsmApplyClosureFrame.cpp +++ b/xo-interpreter2/src/interpreter2/IGCObject_DVsmApplyClosureFrame.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DVsmApplyClosureFrame::forward_children(DVsmApplyClosureFrame & self, obj gc) noexcept -> void + IGCObject_DVsmApplyClosureFrame::visit_gco_children(DVsmApplyClosureFrame & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ diff --git a/xo-interpreter2/src/interpreter2/IGCObject_DVsmApplyFrame.cpp b/xo-interpreter2/src/interpreter2/IGCObject_DVsmApplyFrame.cpp index 0024df69..d3078821 100644 --- a/xo-interpreter2/src/interpreter2/IGCObject_DVsmApplyFrame.cpp +++ b/xo-interpreter2/src/interpreter2/IGCObject_DVsmApplyFrame.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DVsmApplyFrame::forward_children(DVsmApplyFrame & self, obj gc) noexcept -> void + IGCObject_DVsmApplyFrame::visit_gco_children(DVsmApplyFrame & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ diff --git a/xo-interpreter2/src/interpreter2/IGCObject_DVsmDefContFrame.cpp b/xo-interpreter2/src/interpreter2/IGCObject_DVsmDefContFrame.cpp index e0cc2158..b3de6d94 100644 --- a/xo-interpreter2/src/interpreter2/IGCObject_DVsmDefContFrame.cpp +++ b/xo-interpreter2/src/interpreter2/IGCObject_DVsmDefContFrame.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DVsmDefContFrame::forward_children(DVsmDefContFrame & self, obj gc) noexcept -> void + IGCObject_DVsmDefContFrame::visit_gco_children(DVsmDefContFrame & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ diff --git a/xo-interpreter2/src/interpreter2/IGCObject_DVsmEvalArgsFrame.cpp b/xo-interpreter2/src/interpreter2/IGCObject_DVsmEvalArgsFrame.cpp index 8107e7d9..edf1768b 100644 --- a/xo-interpreter2/src/interpreter2/IGCObject_DVsmEvalArgsFrame.cpp +++ b/xo-interpreter2/src/interpreter2/IGCObject_DVsmEvalArgsFrame.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DVsmEvalArgsFrame::forward_children(DVsmEvalArgsFrame & self, obj gc) noexcept -> void + IGCObject_DVsmEvalArgsFrame::visit_gco_children(DVsmEvalArgsFrame & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ diff --git a/xo-interpreter2/src/interpreter2/IGCObject_DVsmIfElseContFrame.cpp b/xo-interpreter2/src/interpreter2/IGCObject_DVsmIfElseContFrame.cpp index 7b95a521..6f73f5a8 100644 --- a/xo-interpreter2/src/interpreter2/IGCObject_DVsmIfElseContFrame.cpp +++ b/xo-interpreter2/src/interpreter2/IGCObject_DVsmIfElseContFrame.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DVsmIfElseContFrame::forward_children(DVsmIfElseContFrame & self, obj gc) noexcept -> void + IGCObject_DVsmIfElseContFrame::visit_gco_children(DVsmIfElseContFrame & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ diff --git a/xo-interpreter2/src/interpreter2/IGCObject_DVsmSeqContFrame.cpp b/xo-interpreter2/src/interpreter2/IGCObject_DVsmSeqContFrame.cpp index c9651507..437ac776 100644 --- a/xo-interpreter2/src/interpreter2/IGCObject_DVsmSeqContFrame.cpp +++ b/xo-interpreter2/src/interpreter2/IGCObject_DVsmSeqContFrame.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DVsmSeqContFrame::forward_children(DVsmSeqContFrame & self, obj gc) noexcept -> void + IGCObject_DVsmSeqContFrame::visit_gco_children(DVsmSeqContFrame & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ diff --git a/xo-interpreter2/src/interpreter2/facet/IGCObject_DLocalEnv.cpp b/xo-interpreter2/src/interpreter2/facet/IGCObject_DLocalEnv.cpp index 25b84b4e..2b8e4e93 100644 --- a/xo-interpreter2/src/interpreter2/facet/IGCObject_DLocalEnv.cpp +++ b/xo-interpreter2/src/interpreter2/facet/IGCObject_DLocalEnv.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DLocalEnv::forward_children(DLocalEnv & self, obj gc) noexcept -> void + IGCObject_DLocalEnv::visit_gco_children(DLocalEnv & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ diff --git a/xo-interpreter2/src/interpreter2/facet/IGCObject_DVirtualSchematikaMachine.cpp b/xo-interpreter2/src/interpreter2/facet/IGCObject_DVirtualSchematikaMachine.cpp index 8f071003..7fa74f97 100644 --- a/xo-interpreter2/src/interpreter2/facet/IGCObject_DVirtualSchematikaMachine.cpp +++ b/xo-interpreter2/src/interpreter2/facet/IGCObject_DVirtualSchematikaMachine.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DVirtualSchematikaMachine::forward_children(DVirtualSchematikaMachine & self, obj gc) noexcept -> void + IGCObject_DVirtualSchematikaMachine::visit_gco_children(DVirtualSchematikaMachine & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ diff --git a/xo-object2/include/xo/object2/DArray.hpp b/xo-object2/include/xo/object2/DArray.hpp index ac44c328..71c7f444 100644 --- a/xo-object2/include/xo/object2/DArray.hpp +++ b/xo-object2/include/xo/object2/DArray.hpp @@ -36,6 +36,8 @@ namespace xo { using ACollector = xo::mm::ACollector; /** gc-aware object facet **/ using AGCObject = xo::mm::AGCObject; + /** gc-centric object visitor **/ + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; /** pretty-printer state for APrintable **/ using ppindentinfo = xo::print::ppindentinfo; @@ -148,7 +150,7 @@ namespace xo { /** move to new address, mandated by @p gc **/ DArray * shallow_move(obj gc) noexcept; /** forward elements to @p gc to-space; replace originals with forarding pointers **/ - void forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} private: diff --git a/xo-object2/include/xo/object2/DBoolean.hpp b/xo-object2/include/xo/object2/DBoolean.hpp index f6374e3e..1637bc74 100644 --- a/xo-object2/include/xo/object2/DBoolean.hpp +++ b/xo-object2/include/xo/object2/DBoolean.hpp @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -16,6 +17,7 @@ namespace xo { struct DBoolean { using AAllocator = xo::mm::AAllocator; using ACollector = xo::mm::ACollector; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AGCObject = xo::mm::AGCObject; using ppindentinfo = xo::print::ppindentinfo; using value_type = long; @@ -38,7 +40,7 @@ namespace xo { // GCObject facet DBoolean * shallow_move(obj gc) noexcept; - void forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; private: /** boxed boolean value **/ diff --git a/xo-object2/include/xo/object2/DDictionary.hpp b/xo-object2/include/xo/object2/DDictionary.hpp index 8183a671..9ab75be0 100644 --- a/xo-object2/include/xo/object2/DDictionary.hpp +++ b/xo-object2/include/xo/object2/DDictionary.hpp @@ -8,6 +8,7 @@ #include "DArray.hpp" #include "DString.hpp" #include +#include #include #include #include @@ -35,6 +36,8 @@ namespace xo { using AAllocator = xo::mm::AAllocator; /** garbage collector facet **/ using ACollector = xo::mm::ACollector; + /** gc-centric object visitor **/ + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; /** gc-aware object facet **/ using AGCObject = xo::mm::AGCObject; /** pretty-printer state for APrintable **/ @@ -203,7 +206,7 @@ namespace xo { /** return shallow copy of this array, using memory from @p mm **/ DDictionary * shallow_move(obj gc) noexcept; /** forward elements to @p gc to-space; replace originals with forwarding pointers **/ - void forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} private: diff --git a/xo-object2/include/xo/object2/DFloat.hpp b/xo-object2/include/xo/object2/DFloat.hpp index 50b0828c..95322042 100644 --- a/xo-object2/include/xo/object2/DFloat.hpp +++ b/xo-object2/include/xo/object2/DFloat.hpp @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -15,6 +16,7 @@ namespace xo { struct DFloat { using AAllocator = xo::mm::AAllocator; using ACollector = xo::mm::ACollector; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using ppindentinfo = xo::print::ppindentinfo; using value_type = double; @@ -35,7 +37,7 @@ namespace xo { // GCObject facet DFloat * shallow_move(obj gc) noexcept; - void forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; private: diff --git a/xo-object2/include/xo/object2/DInteger.hpp b/xo-object2/include/xo/object2/DInteger.hpp index 4105d92d..4b0552ba 100644 --- a/xo-object2/include/xo/object2/DInteger.hpp +++ b/xo-object2/include/xo/object2/DInteger.hpp @@ -6,6 +6,7 @@ #pragma once #include +#include #include #include #include @@ -16,6 +17,7 @@ namespace xo { struct DInteger { using AAllocator = xo::mm::AAllocator; using ACollector = xo::mm::ACollector; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AGCObject = xo::mm::AGCObject; using ppindentinfo = xo::print::ppindentinfo; using value_type = long; @@ -40,7 +42,7 @@ namespace xo { // GCObject facet DInteger * shallow_move(obj gc) noexcept; - void forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; private: /** boxed integer value **/ diff --git a/xo-object2/include/xo/object2/DList.hpp b/xo-object2/include/xo/object2/DList.hpp index 4c37045b..e694acb9 100644 --- a/xo-object2/include/xo/object2/DList.hpp +++ b/xo-object2/include/xo/object2/DList.hpp @@ -20,6 +20,7 @@ namespace xo { using AGCObject = xo::mm::AGCObject; using AAllocator = xo::mm::AAllocator; using ACollector = xo::mm::ACollector; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using ppindentinfo = xo::print::ppindentinfo; public: @@ -70,7 +71,7 @@ namespace xo { /** @defgroup xo-scm-list-gcobject-facet gcobject facet **/ ///@{ DList * shallow_move(obj gc) noexcept; - void forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} /** first member of list **/ diff --git a/xo-object2/include/xo/object2/DRuntimeError.hpp b/xo-object2/include/xo/object2/DRuntimeError.hpp index 2ee93061..782185b3 100644 --- a/xo-object2/include/xo/object2/DRuntimeError.hpp +++ b/xo-object2/include/xo/object2/DRuntimeError.hpp @@ -18,6 +18,7 @@ namespace xo { public: using AGCObject = xo::mm::AGCObject; using ACollector = xo::mm::ACollector; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AAllocator = xo::mm::AAllocator; using ppindentinfo = xo::print::ppindentinfo; @@ -49,9 +50,8 @@ namespace xo { /** @defgroup scm-runtimeerror-gcobject-facet gcobject facet **/ ///@{ - std::size_t shallow_size() const noexcept; DRuntimeError * shallow_move(obj gc) noexcept; - std::size_t forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} diff --git a/xo-object2/include/xo/object2/array/IGCObject_DArray.hpp b/xo-object2/include/xo/object2/array/IGCObject_DArray.hpp index 04669db9..5b3db885 100644 --- a/xo-object2/include/xo/object2/array/IGCObject_DArray.hpp +++ b/xo-object2/include/xo/object2/array/IGCObject_DArray.hpp @@ -42,6 +42,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -52,8 +53,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DArray & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DArray & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DArray & self, obj fn) noexcept; ///@} }; diff --git a/xo-object2/include/xo/object2/boolean/IGCObject_DBoolean.hpp b/xo-object2/include/xo/object2/boolean/IGCObject_DBoolean.hpp index 15ba4f75..e13bb51a 100644 --- a/xo-object2/include/xo/object2/boolean/IGCObject_DBoolean.hpp +++ b/xo-object2/include/xo/object2/boolean/IGCObject_DBoolean.hpp @@ -42,6 +42,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -52,8 +53,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DBoolean & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DBoolean & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DBoolean & self, obj fn) noexcept; ///@} }; diff --git a/xo-object2/include/xo/object2/dictionary/IGCObject_DDictionary.hpp b/xo-object2/include/xo/object2/dictionary/IGCObject_DDictionary.hpp index 173f7a44..79197a8f 100644 --- a/xo-object2/include/xo/object2/dictionary/IGCObject_DDictionary.hpp +++ b/xo-object2/include/xo/object2/dictionary/IGCObject_DDictionary.hpp @@ -42,6 +42,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -52,8 +53,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DDictionary & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DDictionary & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DDictionary & self, obj fn) noexcept; ///@} }; diff --git a/xo-object2/include/xo/object2/error/IGCObject_DRuntimeError.hpp b/xo-object2/include/xo/object2/error/IGCObject_DRuntimeError.hpp index 25e6e241..fe447123 100644 --- a/xo-object2/include/xo/object2/error/IGCObject_DRuntimeError.hpp +++ b/xo-object2/include/xo/object2/error/IGCObject_DRuntimeError.hpp @@ -42,6 +42,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -52,8 +53,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DRuntimeError & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DRuntimeError & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DRuntimeError & self, obj fn) noexcept; ///@} }; diff --git a/xo-object2/include/xo/object2/list/IGCObject_DList.hpp b/xo-object2/include/xo/object2/list/IGCObject_DList.hpp index 6132041f..8ef9e1ca 100644 --- a/xo-object2/include/xo/object2/list/IGCObject_DList.hpp +++ b/xo-object2/include/xo/object2/list/IGCObject_DList.hpp @@ -42,6 +42,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -52,8 +53,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DList & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DList & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DList & self, obj fn) noexcept; ///@} }; diff --git a/xo-object2/include/xo/object2/number/IGCObject_DFloat.hpp b/xo-object2/include/xo/object2/number/IGCObject_DFloat.hpp index accf1ea7..384a8de3 100644 --- a/xo-object2/include/xo/object2/number/IGCObject_DFloat.hpp +++ b/xo-object2/include/xo/object2/number/IGCObject_DFloat.hpp @@ -43,6 +43,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -53,8 +54,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DFloat & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DFloat & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DFloat & self, obj fn) noexcept; ///@} }; diff --git a/xo-object2/include/xo/object2/number/IGCObject_DInteger.hpp b/xo-object2/include/xo/object2/number/IGCObject_DInteger.hpp index 8b418e12..92ddf1ec 100644 --- a/xo-object2/include/xo/object2/number/IGCObject_DInteger.hpp +++ b/xo-object2/include/xo/object2/number/IGCObject_DInteger.hpp @@ -42,6 +42,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -52,8 +53,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DInteger & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DInteger & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DInteger & self, obj fn) noexcept; ///@} }; diff --git a/xo-object2/src/object2/DArray.cpp b/xo-object2/src/object2/DArray.cpp index 4be2ff64..a3658101 100644 --- a/xo-object2/src/object2/DArray.cpp +++ b/xo-object2/src/object2/DArray.cpp @@ -198,16 +198,16 @@ namespace xo { } void - DArray::forward_children(obj gc) noexcept + DArray::visit_gco_children(obj gc) noexcept { scope log(XO_DEBUG(false)); for (size_type i = 0; i < size_; ++i) { - log && log("DArray::forward_children (loop)", xtag("i", i), xtag("z", size_)); + log && log("DArray::visit_gco_children (loop)", xtag("i", i), xtag("z", size_)); obj & elt = elts_[i]; - gc.forward_inplace(&elt); + gc.visit_child(&elt); } } diff --git a/xo-object2/src/object2/DBoolean.cpp b/xo-object2/src/object2/DBoolean.cpp index 2a196d55..d2c2b7c8 100644 --- a/xo-object2/src/object2/DBoolean.cpp +++ b/xo-object2/src/object2/DBoolean.cpp @@ -36,9 +36,9 @@ namespace xo { } void - DBoolean::forward_children(obj) noexcept + DBoolean::visit_gco_children(obj) noexcept { - // no-op + // no-op. childless } diff --git a/xo-object2/src/object2/DDictionary.cpp b/xo-object2/src/object2/DDictionary.cpp index bd9ad11f..63e0e9e8 100644 --- a/xo-object2/src/object2/DDictionary.cpp +++ b/xo-object2/src/object2/DDictionary.cpp @@ -274,11 +274,10 @@ namespace xo { } void - DDictionary::forward_children(obj gc) noexcept + DDictionary::visit_gco_children(obj gc) noexcept { - - gc.forward_inplace(&keys_); - gc.forward_inplace(&values_); + gc.visit_child(&keys_); + gc.visit_child(&values_); } } /*namespace scm*/ diff --git a/xo-object2/src/object2/DFloat.cpp b/xo-object2/src/object2/DFloat.cpp index 32f3438b..3515dcfa 100644 --- a/xo-object2/src/object2/DFloat.cpp +++ b/xo-object2/src/object2/DFloat.cpp @@ -34,9 +34,9 @@ namespace xo { } void - DFloat::forward_children(obj) noexcept + DFloat::visit_gco_children(obj) noexcept { - // noop + // noop -- childless! } } /*namespace scm*/ diff --git a/xo-object2/src/object2/DInteger.cpp b/xo-object2/src/object2/DInteger.cpp index 2b0a4c0c..b73391cc 100644 --- a/xo-object2/src/object2/DInteger.cpp +++ b/xo-object2/src/object2/DInteger.cpp @@ -34,9 +34,9 @@ namespace xo { } void - DInteger::forward_children(obj) noexcept + DInteger::visit_gco_children(obj) noexcept { - // no-op + // no-op. childless } } /*namespace scm*/ diff --git a/xo-object2/src/object2/DList.cpp b/xo-object2/src/object2/DList.cpp index fbba2e3c..56701180 100644 --- a/xo-object2/src/object2/DList.cpp +++ b/xo-object2/src/object2/DList.cpp @@ -185,12 +185,12 @@ namespace xo { } void - DList::forward_children(obj gc) noexcept + DList::visit_gco_children(obj gc) noexcept { //scope log(XO_DEBUG(true)); - gc.forward_inplace(&head_); - gc.forward_inplace(&rest_); + gc.visit_child(&head_); + gc.visit_child(&rest_); } } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-object2/src/object2/DRuntimeError.cpp b/xo-object2/src/object2/DRuntimeError.cpp index 469479c1..d46dcb20 100644 --- a/xo-object2/src/object2/DRuntimeError.cpp +++ b/xo-object2/src/object2/DRuntimeError.cpp @@ -52,32 +52,28 @@ namespace xo { // ----- GCObject facet ----- - std::size_t - DRuntimeError::shallow_size() const noexcept - { - return sizeof(DRuntimeError); - } - DRuntimeError * DRuntimeError::shallow_move(obj gc) noexcept { return gc.std_move_for(this); } - std::size_t - DRuntimeError::forward_children(obj gc) noexcept + void + DRuntimeError::visit_gco_children(obj gc) noexcept { { - auto iface = xo::facet::impl_for(); - gc.forward_inplace(&iface, (void **)(&src_function_)); + gc.visit_child(&src_function_); + + //auto iface = xo::facet::impl_for(); + //gc.forward_inplace(&iface, (void **)(&src_function_)); } { - auto iface = xo::facet::impl_for(); - gc.forward_inplace(&iface, (void **)(&error_descr_)); - } + gc.visit_child(&error_descr_); - return this->shallow_size(); + //auto iface = xo::facet::impl_for(); + //gc.forward_inplace(&iface, (void **)(&error_descr_)); + } } // ----- Printable facet ----- diff --git a/xo-object2/src/object2/IGCObject_DArray.cpp b/xo-object2/src/object2/IGCObject_DArray.cpp index 84c4768a..38a31972 100644 --- a/xo-object2/src/object2/IGCObject_DArray.cpp +++ b/xo-object2/src/object2/IGCObject_DArray.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DArray::forward_children(DArray & self, obj gc) noexcept -> void + IGCObject_DArray::visit_gco_children(DArray & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ diff --git a/xo-object2/src/object2/IGCObject_DBoolean.cpp b/xo-object2/src/object2/IGCObject_DBoolean.cpp index 0c1f3a8c..d76460df 100644 --- a/xo-object2/src/object2/IGCObject_DBoolean.cpp +++ b/xo-object2/src/object2/IGCObject_DBoolean.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DBoolean::forward_children(DBoolean & self, obj gc) noexcept -> void + IGCObject_DBoolean::visit_gco_children(DBoolean & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ diff --git a/xo-object2/src/object2/IGCObject_DDictionary.cpp b/xo-object2/src/object2/IGCObject_DDictionary.cpp index e8c890a1..cd011b19 100644 --- a/xo-object2/src/object2/IGCObject_DDictionary.cpp +++ b/xo-object2/src/object2/IGCObject_DDictionary.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DDictionary::forward_children(DDictionary & self, obj gc) noexcept -> void + IGCObject_DDictionary::visit_gco_children(DDictionary & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ diff --git a/xo-object2/src/object2/IGCObject_DFloat.cpp b/xo-object2/src/object2/IGCObject_DFloat.cpp index 4908db82..ab58f840 100644 --- a/xo-object2/src/object2/IGCObject_DFloat.cpp +++ b/xo-object2/src/object2/IGCObject_DFloat.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DFloat::forward_children(DFloat & self, obj gc) noexcept -> void + IGCObject_DFloat::visit_gco_children(DFloat & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ diff --git a/xo-object2/src/object2/IGCObject_DInteger.cpp b/xo-object2/src/object2/IGCObject_DInteger.cpp index 99944479..13ea8379 100644 --- a/xo-object2/src/object2/IGCObject_DInteger.cpp +++ b/xo-object2/src/object2/IGCObject_DInteger.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DInteger::forward_children(DInteger & self, obj gc) noexcept -> void + IGCObject_DInteger::visit_gco_children(DInteger & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ diff --git a/xo-object2/src/object2/IGCObject_DList.cpp b/xo-object2/src/object2/IGCObject_DList.cpp index 138f707f..680d1aa7 100644 --- a/xo-object2/src/object2/IGCObject_DList.cpp +++ b/xo-object2/src/object2/IGCObject_DList.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DList::forward_children(DList & self, obj gc) noexcept -> void + IGCObject_DList::visit_gco_children(DList & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ diff --git a/xo-object2/src/object2/IGCObject_DRuntimeError.cpp b/xo-object2/src/object2/IGCObject_DRuntimeError.cpp index fad46841..7cce9717 100644 --- a/xo-object2/src/object2/IGCObject_DRuntimeError.cpp +++ b/xo-object2/src/object2/IGCObject_DRuntimeError.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DRuntimeError::forward_children(DRuntimeError & self, obj gc) noexcept -> void + IGCObject_DRuntimeError::visit_gco_children(DRuntimeError & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ diff --git a/xo-procedure2/include/xo/procedure2/DPrimitive.hpp b/xo-procedure2/include/xo/procedure2/DPrimitive.hpp index 6463ccd8..f0e1b5e8 100644 --- a/xo-procedure2/include/xo/procedure2/DPrimitive.hpp +++ b/xo-procedure2/include/xo/procedure2/DPrimitive.hpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -76,8 +77,9 @@ namespace xo { using Traits = detail::PmFnTraits; using ACollector = xo::mm::ACollector; - using AAllocator = xo::mm::AAllocator; using AGCObject = xo::mm::AGCObject; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using AAllocator = xo::mm::AAllocator; using DArray = xo::scm::DArray; using Reflect = xo::reflect::Reflect; using TypeDescr = xo::reflect::TypeDescr; @@ -134,7 +136,7 @@ namespace xo { /** @defgroup scm-primitive-gcobject-facet **/ ///@{ Primitive * shallow_move(obj gc) noexcept; - void forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} private: @@ -197,11 +199,12 @@ namespace xo { template void - Primitive::forward_children(obj gc) noexcept { - { - auto e = type_.to_facet(); // FacetRegistry dep - gc.forward_inplace(e.iface(), (void **)&(type_.data_)); - } + Primitive::visit_gco_children(obj gc) noexcept { + gc.visit_poly_child(&type_); + //{ + // auto e = type_.to_facet(); // FacetRegistry dep + // gc.forward_inplace(e.iface(), (void **)&(type_.data_)); + //} } } /*namespace scm*/ diff --git a/xo-procedure2/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp b/xo-procedure2/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp index a8b25c9b..9d4d338c 100644 --- a/xo-procedure2/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp +++ b/xo-procedure2/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp @@ -44,6 +44,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -54,8 +55,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DPrimitive_gco_0 & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DPrimitive_gco_0 & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DPrimitive_gco_0 & self, obj fn) noexcept; ///@} }; diff --git a/xo-procedure2/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp b/xo-procedure2/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp index 89c13e30..6b3e9992 100644 --- a/xo-procedure2/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp +++ b/xo-procedure2/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp @@ -44,6 +44,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -54,8 +55,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DPrimitive_gco_1_gco & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DPrimitive_gco_1_gco & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DPrimitive_gco_1_gco & self, obj fn) noexcept; ///@} }; diff --git a/xo-procedure2/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp b/xo-procedure2/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp index 24dc8775..d54fc0b7 100644 --- a/xo-procedure2/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp +++ b/xo-procedure2/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp @@ -44,6 +44,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -54,8 +55,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DPrimitive_gco_2_dict_string & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DPrimitive_gco_2_dict_string & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DPrimitive_gco_2_dict_string & self, obj fn) noexcept; ///@} }; diff --git a/xo-procedure2/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp b/xo-procedure2/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp index 51db4ff8..eba31977 100644 --- a/xo-procedure2/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp +++ b/xo-procedure2/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp @@ -44,6 +44,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -54,8 +55,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DPrimitive_gco_2_gco_gco & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DPrimitive_gco_2_gco_gco & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DPrimitive_gco_2_gco_gco & self, obj fn) noexcept; ///@} }; diff --git a/xo-procedure2/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp b/xo-procedure2/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp index 81e0b418..09f9c35c 100644 --- a/xo-procedure2/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp +++ b/xo-procedure2/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp @@ -44,6 +44,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -54,8 +55,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DPrimitive_gco_3_dict_string_gco & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DPrimitive_gco_3_dict_string_gco & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DPrimitive_gco_3_dict_string_gco & self, obj fn) noexcept; ///@} }; diff --git a/xo-procedure2/src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp b/xo-procedure2/src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp index 24a68f64..0819f51e 100644 --- a/xo-procedure2/src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp +++ b/xo-procedure2/src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DPrimitive_gco_0::forward_children(DPrimitive_gco_0 & self, obj gc) noexcept -> void + IGCObject_DPrimitive_gco_0::visit_gco_children(DPrimitive_gco_0 & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ diff --git a/xo-procedure2/src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp b/xo-procedure2/src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp index 9d411bf9..7561d167 100644 --- a/xo-procedure2/src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp +++ b/xo-procedure2/src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DPrimitive_gco_1_gco::forward_children(DPrimitive_gco_1_gco & self, obj gc) noexcept -> void + IGCObject_DPrimitive_gco_1_gco::visit_gco_children(DPrimitive_gco_1_gco & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ diff --git a/xo-procedure2/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp b/xo-procedure2/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp index 32c43775..522cba9b 100644 --- a/xo-procedure2/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp +++ b/xo-procedure2/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DPrimitive_gco_2_dict_string::forward_children(DPrimitive_gco_2_dict_string & self, obj gc) noexcept -> void + IGCObject_DPrimitive_gco_2_dict_string::visit_gco_children(DPrimitive_gco_2_dict_string & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ diff --git a/xo-procedure2/src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp b/xo-procedure2/src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp index 281c426e..6f7de390 100644 --- a/xo-procedure2/src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp +++ b/xo-procedure2/src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DPrimitive_gco_2_gco_gco::forward_children(DPrimitive_gco_2_gco_gco & self, obj gc) noexcept -> void + IGCObject_DPrimitive_gco_2_gco_gco::visit_gco_children(DPrimitive_gco_2_gco_gco & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ diff --git a/xo-procedure2/src/procedure2/facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp b/xo-procedure2/src/procedure2/facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp index b15cc565..aa6c85c0 100644 --- a/xo-procedure2/src/procedure2/facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp +++ b/xo-procedure2/src/procedure2/facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DPrimitive_gco_3_dict_string_gco::forward_children(DPrimitive_gco_3_dict_string_gco & self, obj gc) noexcept -> void + IGCObject_DPrimitive_gco_3_dict_string_gco::visit_gco_children(DPrimitive_gco_3_dict_string_gco & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ diff --git a/xo-reader2/idl/SyntaxStateMachine.json5 b/xo-reader2/idl/SyntaxStateMachine.json5 index 8450b02b..d47656b7 100644 --- a/xo-reader2/idl/SyntaxStateMachine.json5 +++ b/xo-reader2/idl/SyntaxStateMachine.json5 @@ -10,7 +10,7 @@ "", "", "", - "" + "" ], // extra includes in SyntaxStateMachine.hpp, if any user_hpp_includes: [], @@ -27,7 +27,7 @@ ], types: [ { name: "TypeDescr", doc: [ "reflected c++ type" ], definition: "xo::reflect::TypeDescr" }, - { name: "ACollector", doc: [ "gc interface" ], definition: "xo::mm::ACollector" }, + { name: "AGCObjectVisitor", doc: [ "gc visitor interface" ], definition: "xo::mm::AGCObjectVisitor" }, { name: "AGCObject", doc: [ "gc-aware object" ], definition: "xo::mm::AGCObject" }, // { name: string, doc: [ string ], definition: string }, ], @@ -147,11 +147,11 @@ ], }, { - name: "forward_children", - doc: ["gc support: move immediate children to to-space and sub forwarding pointer"], + name: "visit_gco_children", + doc: ["gc support: visit immediate gc-aware child pointers with @p gc. Call gc.visit_child() for each"], return_type: "void", args: [ - {type: "obj", name: "gc"}, + {type: "obj", name: "gc"}, ], } ], diff --git a/xo-reader2/include/xo/reader2/DDefineSsm.hpp b/xo-reader2/include/xo/reader2/DDefineSsm.hpp index e372e299..e31c3b2a 100644 --- a/xo-reader2/include/xo/reader2/DDefineSsm.hpp +++ b/xo-reader2/include/xo/reader2/DDefineSsm.hpp @@ -73,7 +73,7 @@ namespace xo { public: using Super = DSyntaxStateMachine; using TypeDescr = xo::reflect::TypeDescr; - using ACollector = xo::mm::ACollector; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AAllocator = xo::mm::AAllocator; using DArena = xo::mm::DArena; using ppindentinfo = xo::print::ppindentinfo; @@ -200,7 +200,7 @@ namespace xo { ///@{ /** gc support: visit gc-aware child pointers **/ - void forward_children(obj gc); + void visit_gco_children(obj gc) noexcept; ///@} diff --git a/xo-reader2/include/xo/reader2/DExpectExprSsm.hpp b/xo-reader2/include/xo/reader2/DExpectExprSsm.hpp index a1ba1c69..e73e1f16 100644 --- a/xo-reader2/include/xo/reader2/DExpectExprSsm.hpp +++ b/xo-reader2/include/xo/reader2/DExpectExprSsm.hpp @@ -6,7 +6,6 @@ #pragma once #include "DSyntaxStateMachine.hpp" -//#include "ParserStateMachine.hpp" #include "syntaxstatetype.hpp" #include #include @@ -18,7 +17,7 @@ namespace xo { public: using Super = DSyntaxStateMachine; using TypeDescr = xo::reflect::TypeDescr; - using ACollector = xo::mm::ACollector; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using DArena = xo::mm::DArena; using ppindentinfo = xo::print::ppindentinfo; @@ -195,7 +194,7 @@ namespace xo { ///@{ /** gc support: visit gc-aware child pointers **/ - void forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} diff --git a/xo-reader2/include/xo/reader2/DExpectFormalArglistSsm.hpp b/xo-reader2/include/xo/reader2/DExpectFormalArglistSsm.hpp index f28cbac1..954cdc72 100644 --- a/xo-reader2/include/xo/reader2/DExpectFormalArglistSsm.hpp +++ b/xo-reader2/include/xo/reader2/DExpectFormalArglistSsm.hpp @@ -55,7 +55,7 @@ namespace xo { class DExpectFormalArglistSsm : public DSyntaxStateMachine { public: using Super = DSyntaxStateMachine; - using ACollector = xo::mm::ACollector; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AAllocator = xo::mm::AAllocator; using DArena = xo::mm::DArena; using TypeDescr = xo::reflect::TypeDescr; @@ -130,7 +130,7 @@ namespace xo { ///@{ /** gc support: visit gc-aware child pointers **/ - void forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} diff --git a/xo-reader2/include/xo/reader2/DExpectQArraySsm.hpp b/xo-reader2/include/xo/reader2/DExpectQArraySsm.hpp index 068a5b93..2ec32eb4 100644 --- a/xo-reader2/include/xo/reader2/DExpectQArraySsm.hpp +++ b/xo-reader2/include/xo/reader2/DExpectQArraySsm.hpp @@ -7,7 +7,6 @@ #include "DSyntaxStateMachine.hpp" #include -//#include #include namespace xo { @@ -58,7 +57,7 @@ namespace xo { class DExpectQArraySsm : public DSyntaxStateMachine { public: using Super = DSyntaxStateMachine; - using ACollector = xo::mm::ACollector; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AAllocator = xo::mm::AAllocator; using DArena = xo::mm::DArena; using TypeDescr = xo::reflect::TypeDescr; @@ -124,7 +123,7 @@ namespace xo { ///@{ /** gc support: visit gc-aware child pointers **/ - void forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} diff --git a/xo-reader2/include/xo/reader2/DExpectQListSsm.hpp b/xo-reader2/include/xo/reader2/DExpectQListSsm.hpp index c2119c8b..3b9ab53d 100644 --- a/xo-reader2/include/xo/reader2/DExpectQListSsm.hpp +++ b/xo-reader2/include/xo/reader2/DExpectQListSsm.hpp @@ -58,7 +58,7 @@ namespace xo { class DExpectQListSsm : public DSyntaxStateMachine { public: using Super = DSyntaxStateMachine; - using ACollector = xo::mm::ACollector; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AAllocator = xo::mm::AAllocator; using DArena = xo::mm::DArena; using TypeDescr = xo::reflect::TypeDescr; @@ -124,7 +124,7 @@ namespace xo { ///@{ /** gc support: visit gc-aware child pointers **/ - void forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} diff --git a/xo-reader2/include/xo/reader2/DExpectQLiteralSsm.hpp b/xo-reader2/include/xo/reader2/DExpectQLiteralSsm.hpp index f037c7d8..2538fb6f 100644 --- a/xo-reader2/include/xo/reader2/DExpectQLiteralSsm.hpp +++ b/xo-reader2/include/xo/reader2/DExpectQLiteralSsm.hpp @@ -15,7 +15,7 @@ namespace xo { class DExpectQLiteralSsm : public DSyntaxStateMachine { public: using Super = DSyntaxStateMachine; - using ACollector = xo::mm::ACollector; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AAllocator = xo::mm::AAllocator; using DArena = xo::mm::DArena; using TypeDescr = xo::reflect::TypeDescr; @@ -129,7 +129,7 @@ namespace xo { ///@{ /** gc support: visit gc-aware child pointers **/ - void forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} diff --git a/xo-reader2/include/xo/reader2/DExpectSymbolSsm.hpp b/xo-reader2/include/xo/reader2/DExpectSymbolSsm.hpp index 9ca3e1a0..f4c3c156 100644 --- a/xo-reader2/include/xo/reader2/DExpectSymbolSsm.hpp +++ b/xo-reader2/include/xo/reader2/DExpectSymbolSsm.hpp @@ -21,7 +21,7 @@ namespace xo { class DExpectSymbolSsm : public DSyntaxStateMachine { public: using Super = DSyntaxStateMachine; - using ACollector = xo::mm::ACollector; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using DArena = xo::mm::DArena; using TypeDescr = xo::reflect::TypeDescr; using ppindentinfo = xo::print::ppindentinfo; @@ -80,7 +80,7 @@ namespace xo { ///@{ /** gc support: visit gc-aware child pointers **/ - void forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} }; diff --git a/xo-reader2/include/xo/reader2/DExpectTypeSsm.hpp b/xo-reader2/include/xo/reader2/DExpectTypeSsm.hpp index 7fae992d..d405e916 100644 --- a/xo-reader2/include/xo/reader2/DExpectTypeSsm.hpp +++ b/xo-reader2/include/xo/reader2/DExpectTypeSsm.hpp @@ -28,7 +28,7 @@ namespace xo { public: using Super = DSyntaxStateMachine; using TypeDescr = xo::reflect::TypeDescr; - using ACollector = xo::mm::ACollector; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using DArena = xo::mm::DArena; using ppindentinfo = xo::print::ppindentinfo; @@ -87,7 +87,7 @@ namespace xo { ///@{ /** gc support: visit gc-aware child pointers **/ - void forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} diff --git a/xo-reader2/include/xo/reader2/DGlobalEnv.hpp b/xo-reader2/include/xo/reader2/DGlobalEnv.hpp index 96cd5771..04605c4c 100644 --- a/xo-reader2/include/xo/reader2/DGlobalEnv.hpp +++ b/xo-reader2/include/xo/reader2/DGlobalEnv.hpp @@ -7,6 +7,7 @@ #include #include +#include namespace xo { namespace scm { @@ -27,8 +28,9 @@ namespace xo { public: using TypeDescr = xo::reflect::TypeDescr; using ACollector = xo::mm::ACollector; - using AAllocator = xo::mm::AAllocator; using AGCObject = xo::mm::AGCObject; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using AAllocator = xo::mm::AAllocator; using MemorySizeVisitor = xo::mm::MemorySizeVisitor; using ppindentinfo = xo::print::ppindentinfo; using size_type = std::uint32_t; @@ -70,9 +72,8 @@ namespace xo { /** @defgroup scm-globalenv-gcobject-facet **/ ///@{ - std::size_t shallow_size() const noexcept; DGlobalEnv * shallow_move(obj gc) noexcept; - std::size_t forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} /** @defgroup scm-globalenv-printable-facet **/ diff --git a/xo-reader2/include/xo/reader2/DProgressSsm.hpp b/xo-reader2/include/xo/reader2/DProgressSsm.hpp index 487ba141..372b3af6 100644 --- a/xo-reader2/include/xo/reader2/DProgressSsm.hpp +++ b/xo-reader2/include/xo/reader2/DProgressSsm.hpp @@ -7,7 +7,6 @@ #include "DSyntaxStateMachine.hpp" #include "syntaxstatetype.hpp" -//#include #include #ifdef NOT_YET @@ -90,7 +89,7 @@ namespace xo { public: using Super = DSyntaxStateMachine; using TypeDescr = xo::reflect::TypeDescr; - using ACollector = xo::mm::ACollector; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using DArena = xo::mm::DArena; using ppindentinfo = xo::print::ppindentinfo; @@ -218,7 +217,7 @@ namespace xo { /** @defgroup scm-progressssm-gc-support gc support methods **/ ///@{ - void forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} diff --git a/xo-reader2/include/xo/reader2/DQuoteSsm.hpp b/xo-reader2/include/xo/reader2/DQuoteSsm.hpp index fa598f83..542342ef 100644 --- a/xo-reader2/include/xo/reader2/DQuoteSsm.hpp +++ b/xo-reader2/include/xo/reader2/DQuoteSsm.hpp @@ -65,7 +65,7 @@ namespace xo { public: using Super = DSyntaxStateMachine; using TypeDescr = xo::reflect::TypeDescr; - using ACollector = xo::mm::ACollector; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AAllocator = xo::mm::AAllocator; using DArena = xo::mm::DArena; using ppindentinfo = xo::print::ppindentinfo; @@ -150,7 +150,7 @@ namespace xo { ///@{ /** gc support: visit gc-aware child pointers **/ - void forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} private: diff --git a/xo-reader2/include/xo/reader2/DSequenceSsm.hpp b/xo-reader2/include/xo/reader2/DSequenceSsm.hpp index e3c699c3..a7819048 100644 --- a/xo-reader2/include/xo/reader2/DSequenceSsm.hpp +++ b/xo-reader2/include/xo/reader2/DSequenceSsm.hpp @@ -29,7 +29,7 @@ namespace xo { class DSequenceSsm : public DSyntaxStateMachine { public: using Super = DSyntaxStateMachine; - using ACollector = xo::mm::ACollector; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AAllocator = xo::mm::AAllocator; using DArena = xo::mm::DArena; using ppindentinfo = xo::print::ppindentinfo; @@ -97,7 +97,7 @@ namespace xo { ///@{ /** gc support: visit gc-aware child pointers **/ - void forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} diff --git a/xo-reader2/include/xo/reader2/DToplevelSeqSsm.hpp b/xo-reader2/include/xo/reader2/DToplevelSeqSsm.hpp index b33707e4..4103f45a 100644 --- a/xo-reader2/include/xo/reader2/DToplevelSeqSsm.hpp +++ b/xo-reader2/include/xo/reader2/DToplevelSeqSsm.hpp @@ -40,7 +40,7 @@ namespace xo { public: using Super = DSyntaxStateMachine; using TypeDescr = xo::reflect::TypeDescr; - using ACollector = xo::mm::ACollector; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AAllocator = xo::mm::AAllocator; using DArena = xo::mm::DArena; using ppindentinfo = xo::print::ppindentinfo; @@ -161,7 +161,7 @@ namespace xo { ///@{ /** gc support: visit gc-aware child pointers **/ - void forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} diff --git a/xo-reader2/include/xo/reader2/ParserResult.hpp b/xo-reader2/include/xo/reader2/ParserResult.hpp index 73ab38c6..823372da 100644 --- a/xo-reader2/include/xo/reader2/ParserResult.hpp +++ b/xo-reader2/include/xo/reader2/ParserResult.hpp @@ -32,7 +32,7 @@ namespace xo { class ParserResult { public: - using ACollector = xo::mm::ACollector; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using ppindentinfo = xo::print::ppindentinfo; public: @@ -69,7 +69,7 @@ namespace xo { bool pretty(const ppindentinfo & ppii) const; /** gc support: forward gc-eligible children **/ - void forward_children(obj gc) noexcept; + void visit_gco_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 80049a07..e4b414b4 100644 --- a/xo-reader2/include/xo/reader2/ParserStack.hpp +++ b/xo-reader2/include/xo/reader2/ParserStack.hpp @@ -6,6 +6,7 @@ #pragma once #include "SyntaxStateMachine.hpp" +#include #include #include #include @@ -21,7 +22,8 @@ namespace xo { **/ class ParserStack { public: - using ACollector = xo::mm::ACollector; + //using ACollector = xo::mm::ACollector; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using DArena = xo::mm::DArena; using ppindentinfo = xo::print::ppindentinfo; @@ -54,7 +56,7 @@ namespace xo { /** pretty-printer support **/ bool pretty(const ppindentinfo & ppii) const; - void forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; private: /** stack pointer: top of stack just before this instance created **/ diff --git a/xo-reader2/include/xo/reader2/ParserStateMachine.hpp b/xo-reader2/include/xo/reader2/ParserStateMachine.hpp index cc313660..fedd574d 100644 --- a/xo-reader2/include/xo/reader2/ParserStateMachine.hpp +++ b/xo-reader2/include/xo/reader2/ParserStateMachine.hpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -39,6 +40,7 @@ namespace xo { public: using TypeDescr = xo::reflect::TypeDescr; using ACollector = xo::mm::ACollector; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AAllocator = xo::mm::AAllocator; using ArenaConfig = xo::mm::ArenaConfig; using AGCObject = xo::mm::AGCObject; @@ -352,7 +354,7 @@ namespace xo { ///@{ /** update gc-aware exit pointers from this ParserStateMachine **/ - void forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} diff --git a/xo-reader2/include/xo/reader2/QuoteSsm.hpp b/xo-reader2/include/xo/reader2/QuoteSsm.hpp index c0fb5429..801179e9 100644 --- a/xo-reader2/include/xo/reader2/QuoteSsm.hpp +++ b/xo-reader2/include/xo/reader2/QuoteSsm.hpp @@ -6,7 +6,7 @@ #pragma once #include "DQuoteSsm.hpp" -#include "ssm/ISyntaxStateMachine_DQuoteSsm.hpp" -#include "ssm/IPrintable_DQuoteSsm.hpp" +#include "quote/ISyntaxStateMachine_DQuoteSsm.hpp" +#include "quote/IPrintable_DQuoteSsm.hpp" /* end QuoteSsm.hpp */ diff --git a/xo-reader2/include/xo/reader2/SchematikaReader.hpp b/xo-reader2/include/xo/reader2/SchematikaReader.hpp index de3da42f..d70c2c04 100644 --- a/xo-reader2/include/xo/reader2/SchematikaReader.hpp +++ b/xo-reader2/include/xo/reader2/SchematikaReader.hpp @@ -8,17 +8,19 @@ #include "ReaderConfig.hpp" #include "SchematikaParser.hpp" #include +#include namespace xo { namespace scm { struct ReaderResult { using ACollector = xo::mm::ACollector; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using span_type = xo::mm::span; bool is_tk_error() const { return tk_error_.is_error(); } /** forward gc-aware pointers (called during gc cycle) **/ - void forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; /** schematika expression parsed from input **/ obj expr_; @@ -40,6 +42,7 @@ namespace xo { class SchematikaReader { public: using ACollector = xo::mm::ACollector; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AAllocator = xo::mm::AAllocator; using MemorySizeVisitor = xo::mm::MemorySizeVisitor; using span_type = xo::mm::span; @@ -107,7 +110,7 @@ namespace xo { void reset_to_idle_toplevel(); /** update gc-aware child pointers **/ - void forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; private: /** tokenizer converts a stream of chars diff --git a/xo-reader2/include/xo/reader2/apply/DApplySsm.hpp b/xo-reader2/include/xo/reader2/apply/DApplySsm.hpp index 64513f0c..f7ee1cce 100644 --- a/xo-reader2/include/xo/reader2/apply/DApplySsm.hpp +++ b/xo-reader2/include/xo/reader2/apply/DApplySsm.hpp @@ -65,7 +65,7 @@ namespace xo { public: using Super = DSyntaxStateMachine; using TypeDescr = xo::reflect::TypeDescr; - using ACollector = xo::mm::ACollector; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AAllocator = xo::mm::AAllocator; using DArena = xo::mm::DArena; using ppindentinfo = xo::print::ppindentinfo; @@ -190,7 +190,7 @@ namespace xo { ///@{ /** gc support: visit gc-aware child pointers **/ - void forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} diff --git a/xo-reader2/include/xo/reader2/apply/ISyntaxStateMachine_DApplySsm.hpp b/xo-reader2/include/xo/reader2/apply/ISyntaxStateMachine_DApplySsm.hpp index 04c7bddb..db3a147d 100644 --- a/xo-reader2/include/xo/reader2/apply/ISyntaxStateMachine_DApplySsm.hpp +++ b/xo-reader2/include/xo/reader2/apply/ISyntaxStateMachine_DApplySsm.hpp @@ -42,7 +42,7 @@ namespace xo { /** @defgroup scm-syntaxstatemachine-dapplyssm-type-traits **/ ///@{ using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; - using ACollector = xo::scm::ASyntaxStateMachine::ACollector; + using AGCObjectVisitor = xo::scm::ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; @@ -76,8 +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); + /** gc support: visit immediate gc-aware child pointers with @p gc. Call gc.visit_child() for each **/ + static void visit_gco_children(DApplySsm & self, obj gc); ///@} }; diff --git a/xo-reader2/include/xo/reader2/define/ISyntaxStateMachine_DDefineSsm.hpp b/xo-reader2/include/xo/reader2/define/ISyntaxStateMachine_DDefineSsm.hpp index 3487a328..d5338cd5 100644 --- a/xo-reader2/include/xo/reader2/define/ISyntaxStateMachine_DDefineSsm.hpp +++ b/xo-reader2/include/xo/reader2/define/ISyntaxStateMachine_DDefineSsm.hpp @@ -42,7 +42,7 @@ namespace xo { /** @defgroup scm-syntaxstatemachine-ddefinessm-type-traits **/ ///@{ using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; - using ACollector = xo::scm::ASyntaxStateMachine::ACollector; + using AGCObjectVisitor = xo::scm::ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; @@ -76,8 +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); + /** gc support: visit immediate gc-aware child pointers with @p gc. Call gc.visit_child() for each **/ + static void visit_gco_children(DDefineSsm & self, obj gc); ///@} }; diff --git a/xo-reader2/include/xo/reader2/deftype/DDeftypeSsm.hpp b/xo-reader2/include/xo/reader2/deftype/DDeftypeSsm.hpp index a3e4c6cb..b1a6d910 100644 --- a/xo-reader2/include/xo/reader2/deftype/DDeftypeSsm.hpp +++ b/xo-reader2/include/xo/reader2/deftype/DDeftypeSsm.hpp @@ -66,7 +66,7 @@ namespace xo { public: using Super = DSyntaxStateMachine; using TypeDescr = xo::reflect::TypeDescr; - using ACollector = xo::mm::ACollector; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AAllocator = xo::mm::AAllocator; using DArena = xo::mm::DArena; using ppindentinfo = xo::print::ppindentinfo; @@ -172,7 +172,7 @@ namespace xo { ///@{ /** gc support: visit gc-aware child pointers **/ - void forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} diff --git a/xo-reader2/include/xo/reader2/deftype/ISyntaxStateMachine_DDeftypeSsm.hpp b/xo-reader2/include/xo/reader2/deftype/ISyntaxStateMachine_DDeftypeSsm.hpp index f3776f18..9bfdfba5 100644 --- a/xo-reader2/include/xo/reader2/deftype/ISyntaxStateMachine_DDeftypeSsm.hpp +++ b/xo-reader2/include/xo/reader2/deftype/ISyntaxStateMachine_DDeftypeSsm.hpp @@ -42,7 +42,7 @@ namespace xo { /** @defgroup scm-syntaxstatemachine-ddeftypessm-type-traits **/ ///@{ using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; - using ACollector = xo::scm::ASyntaxStateMachine::ACollector; + using AGCObjectVisitor = xo::scm::ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; @@ -76,8 +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); + /** gc support: visit immediate gc-aware child pointers with @p gc. Call gc.visit_child() for each **/ + static void visit_gco_children(DDeftypeSsm & self, obj gc); ///@} }; diff --git a/xo-reader2/include/xo/reader2/env/IGCObject_DGlobalEnv.hpp b/xo-reader2/include/xo/reader2/env/IGCObject_DGlobalEnv.hpp index 88bc11b1..8e97a792 100644 --- a/xo-reader2/include/xo/reader2/env/IGCObject_DGlobalEnv.hpp +++ b/xo-reader2/include/xo/reader2/env/IGCObject_DGlobalEnv.hpp @@ -44,6 +44,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -54,8 +55,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DGlobalEnv & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DGlobalEnv & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DGlobalEnv & self, obj fn) noexcept; ///@} }; 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 318e340a..5c7e6dec 100644 --- a/xo-reader2/include/xo/reader2/expect_formal_arg/DExpectFormalArgSsm.hpp +++ b/xo-reader2/include/xo/reader2/expect_formal_arg/DExpectFormalArgSsm.hpp @@ -48,7 +48,7 @@ namespace xo { public: using Super = DSyntaxStateMachine; using TypeDescr = xo::reflect::TypeDescr; - using ACollector = xo::mm::ACollector; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using DArena = xo::mm::DArena; using ppindentinfo = xo::print::ppindentinfo; @@ -126,7 +126,7 @@ namespace xo { ///@{ /** gc support: visit gc-aware child pointers **/ - void forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} 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 7e100e40..a880fad3 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,7 +42,7 @@ namespace xo { /** @defgroup scm-syntaxstatemachine-dexpectformalargssm-type-traits **/ ///@{ using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; - using ACollector = xo::scm::ASyntaxStateMachine::ACollector; + using AGCObjectVisitor = xo::scm::ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; @@ -76,8 +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); + /** gc support: visit immediate gc-aware child pointers with @p gc. Call gc.visit_child() for each **/ + static void visit_gco_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 6e7c80b4..eeadd15c 100644 --- a/xo-reader2/include/xo/reader2/expect_listtype/DExpectListTypeSsm.hpp +++ b/xo-reader2/include/xo/reader2/expect_listtype/DExpectListTypeSsm.hpp @@ -62,7 +62,7 @@ namespace xo { public: using Super = DSyntaxStateMachine; using TypeDescr = xo::reflect::TypeDescr; - using ACollector = xo::mm::ACollector; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using DArena = xo::mm::DArena; using ppindentinfo = xo::print::ppindentinfo; @@ -135,7 +135,7 @@ namespace xo { ///@{ /** gc support: visit gc-aware child pointers **/ - void forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} private: 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 153c47a4..9ed4214c 100644 --- a/xo-reader2/include/xo/reader2/expect_listtype/ISyntaxStateMachine_DExpectListTypeSsm.hpp +++ b/xo-reader2/include/xo/reader2/expect_listtype/ISyntaxStateMachine_DExpectListTypeSsm.hpp @@ -42,7 +42,7 @@ namespace xo { /** @defgroup scm-syntaxstatemachine-dexpectlisttypessm-type-traits **/ ///@{ using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; - using ACollector = xo::scm::ASyntaxStateMachine::ACollector; + using AGCObjectVisitor = xo::scm::ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; @@ -76,8 +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); + /** gc support: visit immediate gc-aware child pointers with @p gc. Call gc.visit_child() for each **/ + static void visit_gco_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 31aa2be3..5ed40fab 100644 --- a/xo-reader2/include/xo/reader2/expect_qdict/DExpectQDictSsm.hpp +++ b/xo-reader2/include/xo/reader2/expect_qdict/DExpectQDictSsm.hpp @@ -63,7 +63,7 @@ namespace xo { class DExpectQDictSsm : public DSyntaxStateMachine { public: using Super = DSyntaxStateMachine; - using ACollector = xo::mm::ACollector; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using DArena = xo::mm::DArena; using ppindentinfo = xo::print::ppindentinfo; @@ -159,7 +159,7 @@ namespace xo { ///@{ /** gc support: visit gc-aware child pointers **/ - void forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} 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 7014238f..c629e07b 100644 --- a/xo-reader2/include/xo/reader2/expect_qdict/ISyntaxStateMachine_DExpectQDictSsm.hpp +++ b/xo-reader2/include/xo/reader2/expect_qdict/ISyntaxStateMachine_DExpectQDictSsm.hpp @@ -42,7 +42,7 @@ namespace xo { /** @defgroup scm-syntaxstatemachine-dexpectqdictssm-type-traits **/ ///@{ using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; - using ACollector = xo::scm::ASyntaxStateMachine::ACollector; + using AGCObjectVisitor = xo::scm::ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; @@ -76,8 +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); + /** gc support: visit immediate gc-aware child pointers with @p gc. Call gc.visit_child() for each **/ + static void visit_gco_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 27043bdf..fd7b8168 100644 --- a/xo-reader2/include/xo/reader2/ifelse/DIfElseSsm.hpp +++ b/xo-reader2/include/xo/reader2/ifelse/DIfElseSsm.hpp @@ -55,7 +55,7 @@ namespace xo { class DIfElseSsm : public DSyntaxStateMachine { public: using Super = DSyntaxStateMachine; - using ACollector = xo::mm::ACollector; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AAllocator = xo::mm::AAllocator; using DArena = xo::mm::DArena; using TypeDescr = xo::reflect::TypeDescr; @@ -171,7 +171,7 @@ namespace xo { /** @defgroup scm-ifelsessm-gc-support gc support methods **/ ///@{ - void forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} diff --git a/xo-reader2/include/xo/reader2/ifelse/ISyntaxStateMachine_DIfElseSsm.hpp b/xo-reader2/include/xo/reader2/ifelse/ISyntaxStateMachine_DIfElseSsm.hpp index 8a3991fb..17f6b4cd 100644 --- a/xo-reader2/include/xo/reader2/ifelse/ISyntaxStateMachine_DIfElseSsm.hpp +++ b/xo-reader2/include/xo/reader2/ifelse/ISyntaxStateMachine_DIfElseSsm.hpp @@ -42,7 +42,7 @@ namespace xo { /** @defgroup scm-syntaxstatemachine-difelsessm-type-traits **/ ///@{ using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; - using ACollector = xo::scm::ASyntaxStateMachine::ACollector; + using AGCObjectVisitor = xo::scm::ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; @@ -76,8 +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); + /** gc support: visit immediate gc-aware child pointers with @p gc. Call gc.visit_child() for each **/ + static void visit_gco_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 1fa1eac9..7b16503b 100644 --- a/xo-reader2/include/xo/reader2/lambda/DLambdaSsm.hpp +++ b/xo-reader2/include/xo/reader2/lambda/DLambdaSsm.hpp @@ -59,7 +59,7 @@ namespace xo { public: using Super = DSyntaxStateMachine; using DLocalSymtab = xo::scm::DLocalSymtab; - using ACollector = xo::mm::ACollector; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AAllocator = xo::mm::AAllocator; using DArena = xo::mm::DArena; using TypeDescr = xo::reflect::TypeDescr; @@ -189,7 +189,7 @@ namespace xo { ///@{ /** gc support: visit gc-aware child pointers **/ - void forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} diff --git a/xo-reader2/include/xo/reader2/lambda/ISyntaxStateMachine_DLambdaSsm.hpp b/xo-reader2/include/xo/reader2/lambda/ISyntaxStateMachine_DLambdaSsm.hpp index f10f376e..db67ee9a 100644 --- a/xo-reader2/include/xo/reader2/lambda/ISyntaxStateMachine_DLambdaSsm.hpp +++ b/xo-reader2/include/xo/reader2/lambda/ISyntaxStateMachine_DLambdaSsm.hpp @@ -42,7 +42,7 @@ namespace xo { /** @defgroup scm-syntaxstatemachine-dlambdassm-type-traits **/ ///@{ using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; - using ACollector = xo::scm::ASyntaxStateMachine::ACollector; + using AGCObjectVisitor = xo::scm::ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; @@ -76,8 +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); + /** gc support: visit immediate gc-aware child pointers with @p gc. Call gc.visit_child() for each **/ + static void visit_gco_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 af9daa91..e70ba255 100644 --- a/xo-reader2/include/xo/reader2/paren/DParenSsm.hpp +++ b/xo-reader2/include/xo/reader2/paren/DParenSsm.hpp @@ -50,7 +50,7 @@ namespace xo { public: using Super = DSyntaxStateMachine; using TypeDescr = xo::reflect::TypeDescr; - using ACollector = xo::mm::ACollector; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AAllocator = xo::mm::AAllocator; using DArena = xo::mm::DArena; using ppindentinfo = xo::print::ppindentinfo; @@ -136,7 +136,7 @@ namespace xo { ///@{ /** gc support: visit immediate gc-aware children **/ - void forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} diff --git a/xo-reader2/include/xo/reader2/paren/ISyntaxStateMachine_DParenSsm.hpp b/xo-reader2/include/xo/reader2/paren/ISyntaxStateMachine_DParenSsm.hpp index c2bbcc21..4dd7ef74 100644 --- a/xo-reader2/include/xo/reader2/paren/ISyntaxStateMachine_DParenSsm.hpp +++ b/xo-reader2/include/xo/reader2/paren/ISyntaxStateMachine_DParenSsm.hpp @@ -42,7 +42,7 @@ namespace xo { /** @defgroup scm-syntaxstatemachine-dparenssm-type-traits **/ ///@{ using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; - using ACollector = xo::scm::ASyntaxStateMachine::ACollector; + using AGCObjectVisitor = xo::scm::ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; @@ -76,8 +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); + /** gc support: visit immediate gc-aware child pointers with @p gc. Call gc.visit_child() for each **/ + static void visit_gco_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 07c85e4f..c3de4930 100644 --- a/xo-reader2/include/xo/reader2/parser/DSchematikaParser.hpp +++ b/xo-reader2/include/xo/reader2/parser/DSchematikaParser.hpp @@ -10,6 +10,7 @@ #include "ParserResult.hpp" #include #include +#include namespace xo { namespace scm { @@ -164,8 +165,9 @@ namespace xo { 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 AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using AAllocator = xo::mm::AAllocator; using MemorySizeVisitor = xo::mm::MemorySizeVisitor; using ppindentinfo = xo::print::ppindentinfo; using size_type = std::size_t; @@ -292,11 +294,10 @@ namespace xo { /** @defgroup scm-schematikaparser-gcobject-methods **/ ///@{ - std::size_t shallow_size() const noexcept; /** not implemented (SchematikaParser not designed to be copyable) **/ DSchematikaParser * shallow_move(obj gc) noexcept; /** forward gc-aware children **/ - std::size_t forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} private: diff --git a/xo-reader2/include/xo/reader2/parser/IGCObject_DSchematikaParser.hpp b/xo-reader2/include/xo/reader2/parser/IGCObject_DSchematikaParser.hpp index 39f61b9b..f2ca67de 100644 --- a/xo-reader2/include/xo/reader2/parser/IGCObject_DSchematikaParser.hpp +++ b/xo-reader2/include/xo/reader2/parser/IGCObject_DSchematikaParser.hpp @@ -44,6 +44,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -54,8 +55,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DSchematikaParser & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DSchematikaParser & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DSchematikaParser & self, obj fn) noexcept; ///@} }; diff --git a/xo-reader2/include/xo/reader2/quote/ISyntaxStateMachine_DQuoteSsm.hpp b/xo-reader2/include/xo/reader2/quote/ISyntaxStateMachine_DQuoteSsm.hpp index 811119c5..35dc5da1 100644 --- a/xo-reader2/include/xo/reader2/quote/ISyntaxStateMachine_DQuoteSsm.hpp +++ b/xo-reader2/include/xo/reader2/quote/ISyntaxStateMachine_DQuoteSsm.hpp @@ -42,7 +42,7 @@ namespace xo { /** @defgroup scm-syntaxstatemachine-dquotessm-type-traits **/ ///@{ using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; - using ACollector = xo::scm::ASyntaxStateMachine::ACollector; + using AGCObjectVisitor = xo::scm::ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; @@ -76,8 +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); + /** gc support: visit immediate gc-aware child pointers with @p gc. Call gc.visit_child() for each **/ + static void visit_gco_children(DQuoteSsm & self, obj gc); ///@} }; diff --git a/xo-reader2/include/xo/reader2/ssm/ASyntaxStateMachine.hpp b/xo-reader2/include/xo/reader2/ssm/ASyntaxStateMachine.hpp index ead25e24..07d992c1 100644 --- a/xo-reader2/include/xo/reader2/ssm/ASyntaxStateMachine.hpp +++ b/xo-reader2/include/xo/reader2/ssm/ASyntaxStateMachine.hpp @@ -19,7 +19,7 @@ #include #include #include -#include +#include #include #include #include @@ -46,8 +46,8 @@ public: using Opaque = void *; /** reflected c++ type **/ using TypeDescr = xo::reflect::TypeDescr; - /** gc interface **/ - using ACollector = xo::mm::ACollector; + /** gc visitor interface **/ + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; /** gc-aware object **/ using AGCObject = xo::mm::AGCObject; ///@} @@ -90,8 +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; + /** gc support: visit immediate gc-aware child pointers with @p gc. Call gc.visit_child() for each **/ + virtual void visit_gco_children(Opaque data, obj gc) = 0; ///@} }; /*ASyntaxStateMachine*/ diff --git a/xo-reader2/include/xo/reader2/ssm/IPrintable_DQuoteSsm.hpp b/xo-reader2/include/xo/reader2/ssm/IPrintable_DQuoteSsm.hpp deleted file mode 100644 index 2b969c50..00000000 --- a/xo-reader2/include/xo/reader2/ssm/IPrintable_DQuoteSsm.hpp +++ /dev/null @@ -1,62 +0,0 @@ -/** @file IPrintable_DQuoteSsm.hpp - * - * Generated automagically from ingredients: - * 1. code generator: - * [xo-facet/codegen/genfacet] - * arguments: - * --input [idl/IPrintable_DQuoteSsm.json5] - * 2. jinja2 template for abstract facet .hpp file: - * [iface_facet_repr.hpp.j2] - * 3. idl for facet methods - * [idl/IPrintable_DQuoteSsm.json5] - **/ - -#pragma once - -#include "Printable.hpp" -#include -#include -#include "DQuoteSsm.hpp" - -namespace xo { namespace scm { class IPrintable_DQuoteSsm; } } - -namespace xo { - namespace facet { - template <> - struct FacetImplementation - { - using ImplType = xo::print::IPrintable_Xfer - ; - }; - } -} - -namespace xo { - namespace scm { - /** @class IPrintable_DQuoteSsm - **/ - class IPrintable_DQuoteSsm { - public: - /** @defgroup scm-printable-dquotessm-type-traits **/ - ///@{ - using ppindentinfo = xo::print::APrintable::ppindentinfo; - using Copaque = xo::print::APrintable::Copaque; - using Opaque = xo::print::APrintable::Opaque; - ///@} - /** @defgroup scm-printable-dquotessm-methods **/ - ///@{ - // const methods - /** Pretty-printing support for this object. -See [xo-indentlog/xo/indentlog/pretty.hpp] **/ - static bool pretty(const DQuoteSsm & self, const ppindentinfo & ppii); - - // non-const methods - ///@} - }; - - } /*namespace scm*/ -} /*namespace xo*/ - -/* end */ \ No newline at end of file diff --git a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_Any.hpp b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_Any.hpp index d1077f2a..34e7ec84 100644 --- a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_Any.hpp +++ b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_Any.hpp @@ -45,7 +45,7 @@ namespace scm { /** integer identifying a type **/ using typeseq = xo::facet::typeseq; using TypeDescr = ASyntaxStateMachine::TypeDescr; - using ACollector = ASyntaxStateMachine::ACollector; + using AGCObjectVisitor = ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = ASyntaxStateMachine::AGCObject; ///@} @@ -75,7 +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; + [[noreturn]] void visit_gco_children(Opaque, obj) override; ///@} diff --git a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectExprSsm.hpp b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectExprSsm.hpp index 79801c00..5ca9f1c0 100644 --- a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectExprSsm.hpp +++ b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectExprSsm.hpp @@ -42,7 +42,7 @@ namespace xo { /** @defgroup scm-syntaxstatemachine-dexpectexprssm-type-traits **/ ///@{ using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; - using ACollector = xo::scm::ASyntaxStateMachine::ACollector; + using AGCObjectVisitor = xo::scm::ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; @@ -76,8 +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); + /** gc support: visit immediate gc-aware child pointers with @p gc. Call gc.visit_child() for each **/ + static void visit_gco_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 68151e22..04da69bd 100644 --- a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectFormalArglistSsm.hpp +++ b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectFormalArglistSsm.hpp @@ -42,7 +42,7 @@ namespace xo { /** @defgroup scm-syntaxstatemachine-dexpectformalarglistssm-type-traits **/ ///@{ using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; - using ACollector = xo::scm::ASyntaxStateMachine::ACollector; + using AGCObjectVisitor = xo::scm::ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; @@ -76,8 +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); + /** gc support: visit immediate gc-aware child pointers with @p gc. Call gc.visit_child() for each **/ + static void visit_gco_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 cf6ae53d..7b345008 100644 --- a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectQArraySsm.hpp +++ b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectQArraySsm.hpp @@ -42,7 +42,7 @@ namespace xo { /** @defgroup scm-syntaxstatemachine-dexpectqarrayssm-type-traits **/ ///@{ using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; - using ACollector = xo::scm::ASyntaxStateMachine::ACollector; + using AGCObjectVisitor = xo::scm::ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; @@ -76,8 +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); + /** gc support: visit immediate gc-aware child pointers with @p gc. Call gc.visit_child() for each **/ + static void visit_gco_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 38a33d20..ea0cb3c2 100644 --- a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectQListSsm.hpp +++ b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectQListSsm.hpp @@ -42,7 +42,7 @@ namespace xo { /** @defgroup scm-syntaxstatemachine-dexpectqlistssm-type-traits **/ ///@{ using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; - using ACollector = xo::scm::ASyntaxStateMachine::ACollector; + using AGCObjectVisitor = xo::scm::ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; @@ -76,8 +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); + /** gc support: visit immediate gc-aware child pointers with @p gc. Call gc.visit_child() for each **/ + static void visit_gco_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 4cd123f7..4a4bdbfb 100644 --- a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectQLiteralSsm.hpp +++ b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectQLiteralSsm.hpp @@ -42,7 +42,7 @@ namespace xo { /** @defgroup scm-syntaxstatemachine-dexpectqliteralssm-type-traits **/ ///@{ using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; - using ACollector = xo::scm::ASyntaxStateMachine::ACollector; + using AGCObjectVisitor = xo::scm::ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; @@ -76,8 +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); + /** gc support: visit immediate gc-aware child pointers with @p gc. Call gc.visit_child() for each **/ + static void visit_gco_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 0ed37f25..e3cf7146 100644 --- a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectSymbolSsm.hpp +++ b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectSymbolSsm.hpp @@ -42,7 +42,7 @@ namespace xo { /** @defgroup scm-syntaxstatemachine-dexpectsymbolssm-type-traits **/ ///@{ using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; - using ACollector = xo::scm::ASyntaxStateMachine::ACollector; + using AGCObjectVisitor = xo::scm::ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; @@ -76,8 +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); + /** gc support: visit immediate gc-aware child pointers with @p gc. Call gc.visit_child() for each **/ + static void visit_gco_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 ea084f51..965212d1 100644 --- a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectTypeSsm.hpp +++ b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectTypeSsm.hpp @@ -42,7 +42,7 @@ namespace xo { /** @defgroup scm-syntaxstatemachine-dexpecttypessm-type-traits **/ ///@{ using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; - using ACollector = xo::scm::ASyntaxStateMachine::ACollector; + using AGCObjectVisitor = xo::scm::ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; @@ -76,8 +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); + /** gc support: visit immediate gc-aware child pointers with @p gc. Call gc.visit_child() for each **/ + static void visit_gco_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 24269888..7c12ee39 100644 --- a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DProgressSsm.hpp +++ b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DProgressSsm.hpp @@ -42,7 +42,7 @@ namespace xo { /** @defgroup scm-syntaxstatemachine-dprogressssm-type-traits **/ ///@{ using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; - using ACollector = xo::scm::ASyntaxStateMachine::ACollector; + using AGCObjectVisitor = xo::scm::ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; @@ -76,8 +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); + /** gc support: visit immediate gc-aware child pointers with @p gc. Call gc.visit_child() for each **/ + static void visit_gco_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 deleted file mode 100644 index 811119c5..00000000 --- a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DQuoteSsm.hpp +++ /dev/null @@ -1,87 +0,0 @@ -/** @file ISyntaxStateMachine_DQuoteSsm.hpp - * - * Generated automagically from ingredients: - * 1. code generator: - * [xo-facet/codegen/genfacet] - * arguments: - * --input [idl/ISyntaxStateMachine_DQuoteSsm.json5] - * 2. jinja2 template for abstract facet .hpp file: - * [iface_facet_repr.hpp.j2] - * 3. idl for facet methods - * [idl/ISyntaxStateMachine_DQuoteSsm.json5] - **/ - -#pragma once - -#include "SyntaxStateMachine.hpp" -#include "SyntaxStateMachine.hpp" -#include "ssm/ISyntaxStateMachine_Xfer.hpp" -#include "DQuoteSsm.hpp" - -namespace xo { namespace scm { class ISyntaxStateMachine_DQuoteSsm; } } - -namespace xo { - namespace facet { - template <> - struct FacetImplementation - { - using ImplType = xo::scm::ISyntaxStateMachine_Xfer - ; - }; - } -} - -namespace xo { - namespace scm { - /** @class ISyntaxStateMachine_DQuoteSsm - **/ - class ISyntaxStateMachine_DQuoteSsm { - public: - /** @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; - ///@} - /** @defgroup scm-syntaxstatemachine-dquotessm-methods **/ - ///@{ - // const methods - /** identify a type of syntax state machine **/ - static syntaxstatetype ssm_type(const DQuoteSsm & self) noexcept; - /** text describing expected/allowed input to this ssm in current state **/ - static std::string_view get_expect_str(const DQuoteSsm & self) noexcept; - - // non-const methods - /** operate state machine for incoming token @p tk **/ - static void on_token(DQuoteSsm & self, const Token & tk, ParserStateMachine * p_psm); - /** update stat machine for incoming parsed symbol @p sym **/ - static void on_parsed_symbol(DQuoteSsm & self, std::string_view sym, ParserStateMachine * p_psm); - /** operate state machine for incoming type description @p td **/ - static void on_parsed_typedescr(DQuoteSsm & self, TypeDescr td, ParserStateMachine * p_psm); - /** update state machine for type emitted by nested ssm **/ - static void on_parsed_type(DQuoteSsm & self, obj type, ParserStateMachine * p_psm); - /** operate state machine for formal emitted by nested ssm **/ - static void on_parsed_formal(DQuoteSsm & self, const DUniqueString * param_name, TypeDescr param_type, ParserStateMachine * p_psm); - /** operate state machine for formal emitted by nested ssm **/ - static void on_parsed_formal_with_token(DQuoteSsm & self, const DUniqueString * param_name, TypeDescr param_type, const Token & tk, ParserStateMachine * p_psm); - /** consume formal arglist emitted by nested ssm **/ - static void on_parsed_formal_arglist(DQuoteSsm & self, DArray * arglist, ParserStateMachine * p_psm); - /** update state machine for nested parsed expression @p expr **/ - static void on_parsed_expression(DQuoteSsm & self, obj expr, ParserStateMachine * p_psm); - /** update state machine @p p_psm for incoming parsed expression @p expr followed by token @p tk **/ - 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); - ///@} - }; - - } /*namespace scm*/ -} /*namespace xo*/ - -/* end */ \ No newline at end of file diff --git a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DSequenceSsm.hpp b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DSequenceSsm.hpp index f19601b5..b35d45a1 100644 --- a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DSequenceSsm.hpp +++ b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DSequenceSsm.hpp @@ -42,7 +42,7 @@ namespace xo { /** @defgroup scm-syntaxstatemachine-dsequencessm-type-traits **/ ///@{ using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; - using ACollector = xo::scm::ASyntaxStateMachine::ACollector; + using AGCObjectVisitor = xo::scm::ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; @@ -76,8 +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); + /** gc support: visit immediate gc-aware child pointers with @p gc. Call gc.visit_child() for each **/ + static void visit_gco_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 b36cbfc6..695da17c 100644 --- a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DToplevelSeqSsm.hpp +++ b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DToplevelSeqSsm.hpp @@ -42,7 +42,7 @@ namespace xo { /** @defgroup scm-syntaxstatemachine-dtoplevelseqssm-type-traits **/ ///@{ using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; - using ACollector = xo::scm::ASyntaxStateMachine::ACollector; + using AGCObjectVisitor = xo::scm::ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; @@ -76,8 +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); + /** gc support: visit immediate gc-aware child pointers with @p gc. Call gc.visit_child() for each **/ + static void visit_gco_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 13b6d1b7..df1a87f4 100644 --- a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_Xfer.hpp +++ b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_Xfer.hpp @@ -18,7 +18,7 @@ #include #include #include -#include +#include namespace xo { namespace scm { @@ -34,7 +34,7 @@ namespace scm { /** integer identifying a type **/ using typeseq = ASyntaxStateMachine::typeseq; using TypeDescr = ASyntaxStateMachine::TypeDescr; - using ACollector = ASyntaxStateMachine::ACollector; + using AGCObjectVisitor = ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = ASyntaxStateMachine::AGCObject; ///@} @@ -89,8 +89,8 @@ 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); + void visit_gco_children(Opaque data, obj gc) override { + return I::visit_gco_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 57cc885e..9c8a8274 100644 --- a/xo-reader2/include/xo/reader2/ssm/RSyntaxStateMachine.hpp +++ b/xo-reader2/include/xo/reader2/ssm/RSyntaxStateMachine.hpp @@ -32,7 +32,7 @@ public: using DataPtr = Object::DataPtr; using typeseq = xo::reflect::typeseq; using TypeDescr = ASyntaxStateMachine::TypeDescr; - using ACollector = ASyntaxStateMachine::ACollector; + using AGCObjectVisitor = ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = ASyntaxStateMachine::AGCObject; ///@} @@ -93,8 +93,8 @@ 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); + void visit_gco_children(obj gc) { + return O::iface()->visit_gco_children(O::data(), gc); } ///@} diff --git a/xo-reader2/src/reader2/DApplySsm.cpp b/xo-reader2/src/reader2/DApplySsm.cpp index c465ce1a..1787d560 100644 --- a/xo-reader2/src/reader2/DApplySsm.cpp +++ b/xo-reader2/src/reader2/DApplySsm.cpp @@ -397,10 +397,10 @@ namespace xo { } void - DApplySsm::forward_children(obj gc) noexcept + DApplySsm::visit_gco_children(obj gc) noexcept { - gc.forward_pivot_inplace(&fn_expr_); - gc.forward_inplace(&args_expr_v_); + gc.visit_poly_child(&fn_expr_); + gc.visit_child(&args_expr_v_); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/DDefineSsm.cpp b/xo-reader2/src/reader2/DDefineSsm.cpp index f9be0335..1ee8e3aa 100644 --- a/xo-reader2/src/reader2/DDefineSsm.cpp +++ b/xo-reader2/src/reader2/DDefineSsm.cpp @@ -692,9 +692,9 @@ namespace xo { // ----- gc support ----- void - DDefineSsm::forward_children(obj gc) + DDefineSsm::visit_gco_children(obj gc) noexcept { - gc.forward_inplace(&def_expr_.data_); + gc.visit_child(&def_expr_.data_); } } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/DDeftypeSsm.cpp b/xo-reader2/src/reader2/DDeftypeSsm.cpp index 3f377113..0007d940 100644 --- a/xo-reader2/src/reader2/DDeftypeSsm.cpp +++ b/xo-reader2/src/reader2/DDeftypeSsm.cpp @@ -271,7 +271,7 @@ namespace xo { refrtag("expect", this->get_expect_str())); } void - DDeftypeSsm::forward_children(obj /*gc*/) noexcept + DDeftypeSsm::visit_gco_children(obj) noexcept { static_assert(!DUniqueString::is_gc_eligible()); } diff --git a/xo-reader2/src/reader2/DExpectExprSsm.cpp b/xo-reader2/src/reader2/DExpectExprSsm.cpp index 6a9d08e7..bce870f6 100644 --- a/xo-reader2/src/reader2/DExpectExprSsm.cpp +++ b/xo-reader2/src/reader2/DExpectExprSsm.cpp @@ -625,7 +625,7 @@ namespace xo { #endif void - DExpectExprSsm::forward_children(obj /*gc*/) noexcept + DExpectExprSsm::visit_gco_children(obj) noexcept { // all members POD, skip } diff --git a/xo-reader2/src/reader2/DExpectFormalArgSsm.cpp b/xo-reader2/src/reader2/DExpectFormalArgSsm.cpp index d7e903d8..7a529983 100644 --- a/xo-reader2/src/reader2/DExpectFormalArgSsm.cpp +++ b/xo-reader2/src/reader2/DExpectFormalArgSsm.cpp @@ -265,7 +265,7 @@ namespace xo { } void - DExpectFormalArgSsm::forward_children(obj /*gc*/) noexcept + DExpectFormalArgSsm::visit_gco_children(obj) noexcept { static_assert(!DUniqueString::is_gc_eligible()); } diff --git a/xo-reader2/src/reader2/DExpectFormalArglistSsm.cpp b/xo-reader2/src/reader2/DExpectFormalArglistSsm.cpp index ab7d19ee..6cbf199a 100644 --- a/xo-reader2/src/reader2/DExpectFormalArglistSsm.cpp +++ b/xo-reader2/src/reader2/DExpectFormalArglistSsm.cpp @@ -358,9 +358,9 @@ namespace xo { } void - DExpectFormalArglistSsm::forward_children(obj gc) noexcept + DExpectFormalArglistSsm::visit_gco_children(obj gc) noexcept { - gc.forward_inplace(&argl_); + gc.visit_child(&argl_); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/DExpectListTypeSsm.cpp b/xo-reader2/src/reader2/DExpectListTypeSsm.cpp index 921c562e..001ff254 100644 --- a/xo-reader2/src/reader2/DExpectListTypeSsm.cpp +++ b/xo-reader2/src/reader2/DExpectListTypeSsm.cpp @@ -204,9 +204,9 @@ namespace xo { } void - DExpectListTypeSsm::forward_children(obj gc) noexcept + DExpectListTypeSsm::visit_gco_children(obj gc) noexcept { - gc.forward_pivot_inplace(&elt_type_); + gc.visit_poly_child(&elt_type_); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/DExpectQArraySsm.cpp b/xo-reader2/src/reader2/DExpectQArraySsm.cpp index 3d373783..9e281f8c 100644 --- a/xo-reader2/src/reader2/DExpectQArraySsm.cpp +++ b/xo-reader2/src/reader2/DExpectQArraySsm.cpp @@ -220,9 +220,9 @@ namespace xo { refrtag("array", array_pr)); } void - DExpectQArraySsm::forward_children(obj gc) noexcept + DExpectQArraySsm::visit_gco_children(obj gc) noexcept { - gc.forward_inplace(&array_); + gc.visit_child(&array_); } } diff --git a/xo-reader2/src/reader2/DExpectQDictSsm.cpp b/xo-reader2/src/reader2/DExpectQDictSsm.cpp index b57887cb..9839ffd2 100644 --- a/xo-reader2/src/reader2/DExpectQDictSsm.cpp +++ b/xo-reader2/src/reader2/DExpectQDictSsm.cpp @@ -267,10 +267,10 @@ namespace xo { void - DExpectQDictSsm::forward_children(obj gc) noexcept + DExpectQDictSsm::visit_gco_children(obj gc) noexcept { - gc.forward_inplace(const_cast(&key_)); - gc.forward_inplace(&dict_); + gc.visit_child(&key_); + gc.visit_child(&dict_); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/DExpectQListSsm.cpp b/xo-reader2/src/reader2/DExpectQListSsm.cpp index 59df8c2c..965351c3 100644 --- a/xo-reader2/src/reader2/DExpectQListSsm.cpp +++ b/xo-reader2/src/reader2/DExpectQListSsm.cpp @@ -215,10 +215,10 @@ namespace xo { refrtag("list", list_pr)); } void - DExpectQListSsm::forward_children(obj gc) noexcept + DExpectQListSsm::visit_gco_children(obj gc) noexcept { - gc.forward_inplace(&start_); - gc.forward_inplace(&end_); + gc.visit_child(&start_); + gc.visit_child(&end_); } } diff --git a/xo-reader2/src/reader2/DExpectQLiteralSsm.cpp b/xo-reader2/src/reader2/DExpectQLiteralSsm.cpp index b87eff24..c49cf565 100644 --- a/xo-reader2/src/reader2/DExpectQLiteralSsm.cpp +++ b/xo-reader2/src/reader2/DExpectQLiteralSsm.cpp @@ -256,7 +256,7 @@ namespace xo { refrtag("expect", this->get_expect_str())); } void - DExpectQLiteralSsm::forward_children(obj /*gc*/) noexcept + DExpectQLiteralSsm::visit_gco_children(obj) noexcept { // cxl_on_rightparen_, cxl_on_rightbracket_: POD, skip } diff --git a/xo-reader2/src/reader2/DExpectSymbolSsm.cpp b/xo-reader2/src/reader2/DExpectSymbolSsm.cpp index 0875a044..fa1372b1 100644 --- a/xo-reader2/src/reader2/DExpectSymbolSsm.cpp +++ b/xo-reader2/src/reader2/DExpectSymbolSsm.cpp @@ -146,7 +146,7 @@ namespace xo { ); } void - DExpectSymbolSsm::forward_children(obj /*gc*/) noexcept + DExpectSymbolSsm::visit_gco_children(obj) noexcept { // no gc-aware members } diff --git a/xo-reader2/src/reader2/DExpectTypeSsm.cpp b/xo-reader2/src/reader2/DExpectTypeSsm.cpp index b25c9380..47cc5a6c 100644 --- a/xo-reader2/src/reader2/DExpectTypeSsm.cpp +++ b/xo-reader2/src/reader2/DExpectTypeSsm.cpp @@ -198,7 +198,7 @@ namespace xo { } void - DExpectTypeSsm::forward_children(obj /*gc*/) noexcept + DExpectTypeSsm::visit_gco_children(obj) noexcept { // corrected_: POD, skip } diff --git a/xo-reader2/src/reader2/DGlobalEnv.cpp b/xo-reader2/src/reader2/DGlobalEnv.cpp index 2893beda..64eabd4f 100644 --- a/xo-reader2/src/reader2/DGlobalEnv.cpp +++ b/xo-reader2/src/reader2/DGlobalEnv.cpp @@ -107,25 +107,17 @@ namespace xo { // ----- AGCObject facet ----- - std::size_t - DGlobalEnv::shallow_size() const noexcept - { - return sizeof(*this); - } - DGlobalEnv * DGlobalEnv::shallow_move(obj gc) noexcept { return gc.std_move_for(this); } - std::size_t - DGlobalEnv::forward_children(obj gc) noexcept + void + DGlobalEnv::visit_gco_children(obj gc) noexcept { - gc.forward_inplace(&symtab_); - gc.forward_inplace(&values_); - - return this->shallow_size(); + gc.visit_child(&symtab_); + gc.visit_child(&values_); } // ----- APrintable facet ----- diff --git a/xo-reader2/src/reader2/DIfElseSsm.cpp b/xo-reader2/src/reader2/DIfElseSsm.cpp index 03bd1589..f4fd4f88 100644 --- a/xo-reader2/src/reader2/DIfElseSsm.cpp +++ b/xo-reader2/src/reader2/DIfElseSsm.cpp @@ -510,9 +510,9 @@ namespace xo { } void - DIfElseSsm::forward_children(obj gc) noexcept + DIfElseSsm::visit_gco_children(obj gc) noexcept { - gc.forward_pivot_inplace(&if_expr_); + gc.visit_poly_child(&if_expr_); } } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/DLambdaSsm.cpp b/xo-reader2/src/reader2/DLambdaSsm.cpp index d23f04e6..f0fed420 100644 --- a/xo-reader2/src/reader2/DLambdaSsm.cpp +++ b/xo-reader2/src/reader2/DLambdaSsm.cpp @@ -4,16 +4,13 @@ **/ #include "LambdaSsm.hpp" -//#include "ssm/ISyntaxStateMachine_DLambdaSsm.hpp" #include "ExpectFormalArglistSsm.hpp" -//#include "ssm/ISyntaxStateMachine_DExpectFormalArglistSsm.hpp" #include "DExpectTypeSsm.hpp" #include "DExpectExprSsm.hpp" #include "ParserStateMachine.hpp" #include "syntaxstatetype.hpp" #include #include -//#include //#include #include #include @@ -474,15 +471,15 @@ namespace xo { } void - DLambdaSsm::forward_children(obj gc) noexcept + DLambdaSsm::visit_gco_children(obj gc) noexcept { - gc.forward_inplace(&local_symtab_); + gc.visit_child(&local_symtab_); // explicit_return_td not gcobject // lambda_td not gcobject - gc.forward_pivot_inplace(&body_); - gc.forward_pivot_inplace(&parent_symtab_); + gc.visit_poly_child(&body_); + gc.visit_poly_child(&parent_symtab_); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/DParenSsm.cpp b/xo-reader2/src/reader2/DParenSsm.cpp index 13fb728a..82320cb6 100644 --- a/xo-reader2/src/reader2/DParenSsm.cpp +++ b/xo-reader2/src/reader2/DParenSsm.cpp @@ -459,9 +459,9 @@ namespace xo { } void - DParenSsm::forward_children(obj gc) noexcept + DParenSsm::visit_gco_children(obj gc) noexcept { - gc.forward_pivot_inplace(&expr_); + gc.visit_poly_child(&expr_); } } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/DProgressSsm.cpp b/xo-reader2/src/reader2/DProgressSsm.cpp index 345ba5fd..04c87fac 100644 --- a/xo-reader2/src/reader2/DProgressSsm.cpp +++ b/xo-reader2/src/reader2/DProgressSsm.cpp @@ -1244,10 +1244,10 @@ case optype::op_assign: } void - DProgressSsm::forward_children(obj gc) noexcept + DProgressSsm::visit_gco_children(obj gc) noexcept { - gc.forward_pivot_inplace(&lhs_); - gc.forward_pivot_inplace(&rhs_); + gc.visit_poly_child(&lhs_); + gc.visit_poly_child(&rhs_); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/DQuoteSsm.cpp b/xo-reader2/src/reader2/DQuoteSsm.cpp index 3a665eb5..cbbedc73 100644 --- a/xo-reader2/src/reader2/DQuoteSsm.cpp +++ b/xo-reader2/src/reader2/DQuoteSsm.cpp @@ -212,9 +212,9 @@ namespace xo { } void - DQuoteSsm::forward_children(obj gc) noexcept + DQuoteSsm::visit_gco_children(obj gc) noexcept { - gc.forward_pivot_inplace(&expr_); + gc.visit_poly_child(&expr_); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/DSchematikaParser.cpp b/xo-reader2/src/reader2/DSchematikaParser.cpp index e25e76aa..1d5ecea7 100644 --- a/xo-reader2/src/reader2/DSchematikaParser.cpp +++ b/xo-reader2/src/reader2/DSchematikaParser.cpp @@ -184,12 +184,6 @@ namespace xo { ); } - std::size_t - DSchematikaParser::shallow_size() const noexcept - { - return sizeof(DSchematikaParser); - } - DSchematikaParser * DSchematikaParser::shallow_move(obj gc) noexcept { @@ -202,12 +196,10 @@ namespace xo { return nullptr; } - std::size_t - DSchematikaParser::forward_children(obj gc) noexcept + void + DSchematikaParser::visit_gco_children(obj gc) noexcept { - psm_.forward_children(gc); - - return this->shallow_size(); + psm_.visit_gco_children(gc); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/DSequenceSsm.cpp b/xo-reader2/src/reader2/DSequenceSsm.cpp index f6caeb06..a6d4013b 100644 --- a/xo-reader2/src/reader2/DSequenceSsm.cpp +++ b/xo-reader2/src/reader2/DSequenceSsm.cpp @@ -258,9 +258,9 @@ namespace xo { } void - DSequenceSsm::forward_children(obj gc) noexcept + DSequenceSsm::visit_gco_children(obj gc) noexcept { - gc.forward_inplace(&seq_expr_); + gc.visit_child(&seq_expr_); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/DToplevelSeqSsm.cpp b/xo-reader2/src/reader2/DToplevelSeqSsm.cpp index 9252c700..e660f780 100644 --- a/xo-reader2/src/reader2/DToplevelSeqSsm.cpp +++ b/xo-reader2/src/reader2/DToplevelSeqSsm.cpp @@ -518,7 +518,7 @@ namespace xo { refrtag("seqtype", seqtype_)); } void - DToplevelSeqSsm::forward_children(obj /*gc*/) noexcept + DToplevelSeqSsm::visit_gco_children(obj) noexcept { // seqtype_: POD, skip } diff --git a/xo-reader2/src/reader2/ISyntaxStateMachine_Any.cpp b/xo-reader2/src/reader2/ISyntaxStateMachine_Any.cpp index 7d174c5b..a260bdc9 100644 --- a/xo-reader2/src/reader2/ISyntaxStateMachine_Any.cpp +++ b/xo-reader2/src/reader2/ISyntaxStateMachine_Any.cpp @@ -96,7 +96,7 @@ ISyntaxStateMachine_Any::on_quoted_literal(Opaque, obj, ParserStateMa } auto -ISyntaxStateMachine_Any::forward_children(Opaque, obj) -> void +ISyntaxStateMachine_Any::visit_gco_children(Opaque, obj) -> void { _fatal(); } diff --git a/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectExprSsm.cpp b/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectExprSsm.cpp index 75464bcc..0ecc4e24 100644 --- a/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectExprSsm.cpp +++ b/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectExprSsm.cpp @@ -78,9 +78,9 @@ namespace xo { self.on_quoted_literal(lit, p_psm); } auto - ISyntaxStateMachine_DExpectExprSsm::forward_children(DExpectExprSsm & self, obj gc) -> void + ISyntaxStateMachine_DExpectExprSsm::visit_gco_children(DExpectExprSsm & self, obj gc) -> void { - self.forward_children(gc); + self.visit_gco_children(gc); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectFormalArglistSsm.cpp b/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectFormalArglistSsm.cpp index 61b219f0..4db6a480 100644 --- a/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectFormalArglistSsm.cpp +++ b/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectFormalArglistSsm.cpp @@ -78,9 +78,9 @@ namespace xo { self.on_quoted_literal(lit, p_psm); } auto - ISyntaxStateMachine_DExpectFormalArglistSsm::forward_children(DExpectFormalArglistSsm & self, obj gc) -> void + ISyntaxStateMachine_DExpectFormalArglistSsm::visit_gco_children(DExpectFormalArglistSsm & self, obj gc) -> void { - self.forward_children(gc); + self.visit_gco_children(gc); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectQArraySsm.cpp b/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectQArraySsm.cpp index b938f1e7..ea8b14cc 100644 --- a/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectQArraySsm.cpp +++ b/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectQArraySsm.cpp @@ -78,9 +78,9 @@ namespace xo { self.on_quoted_literal(lit, p_psm); } auto - ISyntaxStateMachine_DExpectQArraySsm::forward_children(DExpectQArraySsm & self, obj gc) -> void + ISyntaxStateMachine_DExpectQArraySsm::visit_gco_children(DExpectQArraySsm & self, obj gc) -> void { - self.forward_children(gc); + self.visit_gco_children(gc); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectQListSsm.cpp b/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectQListSsm.cpp index 19df0dff..363f9646 100644 --- a/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectQListSsm.cpp +++ b/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectQListSsm.cpp @@ -78,9 +78,9 @@ namespace xo { self.on_quoted_literal(lit, p_psm); } auto - ISyntaxStateMachine_DExpectQListSsm::forward_children(DExpectQListSsm & self, obj gc) -> void + ISyntaxStateMachine_DExpectQListSsm::visit_gco_children(DExpectQListSsm & self, obj gc) -> void { - self.forward_children(gc); + self.visit_gco_children(gc); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectQLiteralSsm.cpp b/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectQLiteralSsm.cpp index e6f338fc..61e15926 100644 --- a/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectQLiteralSsm.cpp +++ b/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectQLiteralSsm.cpp @@ -78,9 +78,9 @@ namespace xo { self.on_quoted_literal(lit, p_psm); } auto - ISyntaxStateMachine_DExpectQLiteralSsm::forward_children(DExpectQLiteralSsm & self, obj gc) -> void + ISyntaxStateMachine_DExpectQLiteralSsm::visit_gco_children(DExpectQLiteralSsm & self, obj gc) -> void { - self.forward_children(gc); + self.visit_gco_children(gc); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectSymbolSsm.cpp b/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectSymbolSsm.cpp index b8e8fed0..c1331ceb 100644 --- a/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectSymbolSsm.cpp +++ b/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectSymbolSsm.cpp @@ -78,9 +78,9 @@ namespace xo { self.on_quoted_literal(lit, p_psm); } auto - ISyntaxStateMachine_DExpectSymbolSsm::forward_children(DExpectSymbolSsm & self, obj gc) -> void + ISyntaxStateMachine_DExpectSymbolSsm::visit_gco_children(DExpectSymbolSsm & self, obj gc) -> void { - self.forward_children(gc); + self.visit_gco_children(gc); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectTypeSsm.cpp b/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectTypeSsm.cpp index 011edc4f..8daed04c 100644 --- a/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectTypeSsm.cpp +++ b/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectTypeSsm.cpp @@ -78,9 +78,9 @@ namespace xo { self.on_quoted_literal(lit, p_psm); } auto - ISyntaxStateMachine_DExpectTypeSsm::forward_children(DExpectTypeSsm & self, obj gc) -> void + ISyntaxStateMachine_DExpectTypeSsm::visit_gco_children(DExpectTypeSsm & self, obj gc) -> void { - self.forward_children(gc); + self.visit_gco_children(gc); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/ISyntaxStateMachine_DParenSsm.cpp b/xo-reader2/src/reader2/ISyntaxStateMachine_DParenSsm.cpp index 6ee6902b..42a199cb 100644 --- a/xo-reader2/src/reader2/ISyntaxStateMachine_DParenSsm.cpp +++ b/xo-reader2/src/reader2/ISyntaxStateMachine_DParenSsm.cpp @@ -78,9 +78,9 @@ namespace xo { self.on_quoted_literal(lit, p_psm); } auto - ISyntaxStateMachine_DParenSsm::forward_children(DParenSsm & self, obj gc) -> void + ISyntaxStateMachine_DParenSsm::visit_gco_children(DParenSsm & self, obj gc) -> void { - self.forward_children(gc); + self.visit_gco_children(gc); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/ISyntaxStateMachine_DProgressSsm.cpp b/xo-reader2/src/reader2/ISyntaxStateMachine_DProgressSsm.cpp index 01e1e754..9c5ad07d 100644 --- a/xo-reader2/src/reader2/ISyntaxStateMachine_DProgressSsm.cpp +++ b/xo-reader2/src/reader2/ISyntaxStateMachine_DProgressSsm.cpp @@ -78,9 +78,9 @@ namespace xo { self.on_quoted_literal(lit, p_psm); } auto - ISyntaxStateMachine_DProgressSsm::forward_children(DProgressSsm & self, obj gc) -> void + ISyntaxStateMachine_DProgressSsm::visit_gco_children(DProgressSsm & self, obj gc) -> void { - self.forward_children(gc); + self.visit_gco_children(gc); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/ISyntaxStateMachine_DSequenceSsm.cpp b/xo-reader2/src/reader2/ISyntaxStateMachine_DSequenceSsm.cpp index 30e164d8..a6375288 100644 --- a/xo-reader2/src/reader2/ISyntaxStateMachine_DSequenceSsm.cpp +++ b/xo-reader2/src/reader2/ISyntaxStateMachine_DSequenceSsm.cpp @@ -78,9 +78,9 @@ namespace xo { self.on_quoted_literal(lit, p_psm); } auto - ISyntaxStateMachine_DSequenceSsm::forward_children(DSequenceSsm & self, obj gc) -> void + ISyntaxStateMachine_DSequenceSsm::visit_gco_children(DSequenceSsm & self, obj gc) -> void { - self.forward_children(gc); + self.visit_gco_children(gc); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/ISyntaxStateMachine_DToplevelSeqSsm.cpp b/xo-reader2/src/reader2/ISyntaxStateMachine_DToplevelSeqSsm.cpp index 73f23da0..47788590 100644 --- a/xo-reader2/src/reader2/ISyntaxStateMachine_DToplevelSeqSsm.cpp +++ b/xo-reader2/src/reader2/ISyntaxStateMachine_DToplevelSeqSsm.cpp @@ -78,9 +78,9 @@ namespace xo { self.on_quoted_literal(lit, p_psm); } auto - ISyntaxStateMachine_DToplevelSeqSsm::forward_children(DToplevelSeqSsm & self, obj gc) -> void + ISyntaxStateMachine_DToplevelSeqSsm::visit_gco_children(DToplevelSeqSsm & self, obj gc) -> void { - self.forward_children(gc); + self.visit_gco_children(gc); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/ParserResult.cpp b/xo-reader2/src/reader2/ParserResult.cpp index fa9c9591..609f204f 100644 --- a/xo-reader2/src/reader2/ParserResult.cpp +++ b/xo-reader2/src/reader2/ParserResult.cpp @@ -106,12 +106,12 @@ namespace xo { } void - ParserResult::forward_children(obj gc) noexcept + ParserResult::visit_gco_children(obj gc) noexcept { // {result_type_, error_src_fn_}: pod, ignore - gc.forward_pivot_inplace(&result_expr_); - gc.forward_inplace(const_cast(&error_description_)); + gc.visit_poly_child(&result_expr_); + gc.visit_child(&error_description_); } } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/ParserStack.cpp b/xo-reader2/src/reader2/ParserStack.cpp index f40696b2..721b19b4 100644 --- a/xo-reader2/src/reader2/ParserStack.cpp +++ b/xo-reader2/src/reader2/ParserStack.cpp @@ -90,14 +90,14 @@ namespace xo { } void - ParserStack::forward_children(obj gc) noexcept + ParserStack::visit_gco_children(obj gc) noexcept { for (ParserStack * target = this; target; target = target->parent_) { // ParserStack::ckp: skip, POD if (target->ssm_) - target->ssm_.forward_children(gc); + target->ssm_.visit_gco_children(gc); } } diff --git a/xo-reader2/src/reader2/ParserStateMachine.cpp b/xo-reader2/src/reader2/ParserStateMachine.cpp index c3d92a0c..6bec1833 100644 --- a/xo-reader2/src/reader2/ParserStateMachine.cpp +++ b/xo-reader2/src/reader2/ParserStateMachine.cpp @@ -907,7 +907,7 @@ namespace xo { #endif void - ParserStateMachine::forward_children(obj gc) noexcept + ParserStateMachine::visit_gco_children(obj gc) noexcept { //scope log(XO_DEBUG(true)); @@ -916,23 +916,23 @@ namespace xo { //log && log("forward stack_", xtag("addr", stack_)); if (stack_) { - stack_->forward_children(gc); + stack_->visit_gco_children(gc); } // static_assert(!expr_alloc_.is_gc_eligible()); // static_assert(!aux_alloc_.is_gc_eligible()); //log && log("global_symtab_", xtag("addr", global_symtab_.data())); - gc.forward_inplace(&global_symtab_); + gc.visit_child(&global_symtab_); //log && log("local_symtab_", xtag("addr", local_symtab_.data())); - gc.forward_inplace(&local_symtab_); + gc.visit_child(&local_symtab_); //log && log("global_env_", xtag("addr", global_env_.data())); - gc.forward_inplace(&global_env_); + gc.visit_child(&global_env_); //log && log("result_"); - result_.forward_children(gc); + result_.visit_gco_children(gc); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/SchematikaReader.cpp b/xo-reader2/src/reader2/SchematikaReader.cpp index ba681bab..c9405916 100644 --- a/xo-reader2/src/reader2/SchematikaReader.cpp +++ b/xo-reader2/src/reader2/SchematikaReader.cpp @@ -10,9 +10,9 @@ namespace xo { namespace scm { void - ReaderResult::forward_children(obj gc) noexcept + ReaderResult::visit_gco_children(obj gc) noexcept { - gc.forward_pivot_inplace(&expr_); + gc.visit_poly_child(&expr_); } // ----- SchematikaReader ----- @@ -208,12 +208,12 @@ namespace xo { } void - SchematikaReader::forward_children(obj gc) noexcept + SchematikaReader::visit_gco_children(obj gc) noexcept { // tokenizer doesn't contain any gc-aware pointers. - parser_.forward_children(gc); - result_.forward_children(gc); + parser_.visit_gco_children(gc); + result_.visit_gco_children(gc); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/facet/IGCObject_DGlobalEnv.cpp b/xo-reader2/src/reader2/facet/IGCObject_DGlobalEnv.cpp index 5c61e9ea..e826c422 100644 --- a/xo-reader2/src/reader2/facet/IGCObject_DGlobalEnv.cpp +++ b/xo-reader2/src/reader2/facet/IGCObject_DGlobalEnv.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DGlobalEnv::forward_children(DGlobalEnv & self, obj gc) noexcept -> void + IGCObject_DGlobalEnv::visit_gco_children(DGlobalEnv & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/facet/IGCObject_DSchematikaParser.cpp b/xo-reader2/src/reader2/facet/IGCObject_DSchematikaParser.cpp index 133b3f9c..cd9ec847 100644 --- a/xo-reader2/src/reader2/facet/IGCObject_DSchematikaParser.cpp +++ b/xo-reader2/src/reader2/facet/IGCObject_DSchematikaParser.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DSchematikaParser::forward_children(DSchematikaParser & self, obj gc) noexcept -> void + IGCObject_DSchematikaParser::visit_gco_children(DSchematikaParser & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DApplySsm.cpp b/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DApplySsm.cpp index daff54de..01f685fe 100644 --- a/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DApplySsm.cpp +++ b/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DApplySsm.cpp @@ -78,9 +78,9 @@ namespace xo { self.on_quoted_literal(lit, p_psm); } auto - ISyntaxStateMachine_DApplySsm::forward_children(DApplySsm & self, obj gc) -> void + ISyntaxStateMachine_DApplySsm::visit_gco_children(DApplySsm & self, obj gc) -> void { - self.forward_children(gc); + self.visit_gco_children(gc); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DDefineSsm.cpp b/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DDefineSsm.cpp index 9867898f..886155c0 100644 --- a/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DDefineSsm.cpp +++ b/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DDefineSsm.cpp @@ -78,9 +78,9 @@ namespace xo { self.on_quoted_literal(lit, p_psm); } auto - ISyntaxStateMachine_DDefineSsm::forward_children(DDefineSsm & self, obj gc) -> void + ISyntaxStateMachine_DDefineSsm::visit_gco_children(DDefineSsm & self, obj gc) -> void { - self.forward_children(gc); + self.visit_gco_children(gc); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DDeftypeSsm.cpp b/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DDeftypeSsm.cpp index e6e54b1c..874849ff 100644 --- a/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DDeftypeSsm.cpp +++ b/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DDeftypeSsm.cpp @@ -78,9 +78,9 @@ namespace xo { self.on_quoted_literal(lit, p_psm); } auto - ISyntaxStateMachine_DDeftypeSsm::forward_children(DDeftypeSsm & self, obj gc) -> void + ISyntaxStateMachine_DDeftypeSsm::visit_gco_children(DDeftypeSsm & self, obj gc) -> void { - self.forward_children(gc); + self.visit_gco_children(gc); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DExpectFormalArgSsm.cpp b/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DExpectFormalArgSsm.cpp index 059fd4b2..85f8dd7a 100644 --- a/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DExpectFormalArgSsm.cpp +++ b/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DExpectFormalArgSsm.cpp @@ -78,9 +78,9 @@ namespace xo { self.on_quoted_literal(lit, p_psm); } auto - ISyntaxStateMachine_DExpectFormalArgSsm::forward_children(DExpectFormalArgSsm & self, obj gc) -> void + ISyntaxStateMachine_DExpectFormalArgSsm::visit_gco_children(DExpectFormalArgSsm & self, obj gc) -> void { - self.forward_children(gc); + self.visit_gco_children(gc); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DExpectListTypeSsm.cpp b/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DExpectListTypeSsm.cpp index b760ac9a..d3b292ad 100644 --- a/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DExpectListTypeSsm.cpp +++ b/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DExpectListTypeSsm.cpp @@ -78,9 +78,9 @@ namespace xo { self.on_quoted_literal(lit, p_psm); } auto - ISyntaxStateMachine_DExpectListTypeSsm::forward_children(DExpectListTypeSsm & self, obj gc) -> void + ISyntaxStateMachine_DExpectListTypeSsm::visit_gco_children(DExpectListTypeSsm & self, obj gc) -> void { - self.forward_children(gc); + self.visit_gco_children(gc); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DExpectQDictSsm.cpp b/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DExpectQDictSsm.cpp index 7ee82e82..9f4d74cc 100644 --- a/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DExpectQDictSsm.cpp +++ b/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DExpectQDictSsm.cpp @@ -78,9 +78,9 @@ namespace xo { self.on_quoted_literal(lit, p_psm); } auto - ISyntaxStateMachine_DExpectQDictSsm::forward_children(DExpectQDictSsm & self, obj gc) -> void + ISyntaxStateMachine_DExpectQDictSsm::visit_gco_children(DExpectQDictSsm & self, obj gc) -> void { - self.forward_children(gc); + self.visit_gco_children(gc); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DIfElseSsm.cpp b/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DIfElseSsm.cpp index c78464c7..68034ba4 100644 --- a/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DIfElseSsm.cpp +++ b/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DIfElseSsm.cpp @@ -78,9 +78,9 @@ namespace xo { self.on_quoted_literal(lit, p_psm); } auto - ISyntaxStateMachine_DIfElseSsm::forward_children(DIfElseSsm & self, obj gc) -> void + ISyntaxStateMachine_DIfElseSsm::visit_gco_children(DIfElseSsm & self, obj gc) -> void { - self.forward_children(gc); + self.visit_gco_children(gc); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DLambdaSsm.cpp b/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DLambdaSsm.cpp index b54d54fc..88e52100 100644 --- a/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DLambdaSsm.cpp +++ b/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DLambdaSsm.cpp @@ -78,9 +78,9 @@ namespace xo { self.on_quoted_literal(lit, p_psm); } auto - ISyntaxStateMachine_DLambdaSsm::forward_children(DLambdaSsm & self, obj gc) -> void + ISyntaxStateMachine_DLambdaSsm::visit_gco_children(DLambdaSsm & self, obj gc) -> void { - self.forward_children(gc); + self.visit_gco_children(gc); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DQuoteSsm.cpp b/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DQuoteSsm.cpp index 9624c899..39d26414 100644 --- a/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DQuoteSsm.cpp +++ b/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DQuoteSsm.cpp @@ -78,9 +78,9 @@ namespace xo { self.on_quoted_literal(lit, p_psm); } auto - ISyntaxStateMachine_DQuoteSsm::forward_children(DQuoteSsm & self, obj gc) -> void + ISyntaxStateMachine_DQuoteSsm::visit_gco_children(DQuoteSsm & self, obj gc) -> void { - self.forward_children(gc); + self.visit_gco_children(gc); } } /*namespace scm*/ diff --git a/xo-stringtable2/include/xo/stringtable2/DString.hpp b/xo-stringtable2/include/xo/stringtable2/DString.hpp index cdb362d2..75090f24 100644 --- a/xo-stringtable2/include/xo/stringtable2/DString.hpp +++ b/xo-stringtable2/include/xo/stringtable2/DString.hpp @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -47,6 +48,8 @@ namespace xo { using AAllocator = xo::mm::AAllocator; /** garbage collector **/ using ACollector = xo::mm::ACollector; + /** object visitor (garbage collector proxy) **/ + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; /** ppindentinfo for APrintable **/ using ppindentinfo = xo::print::ppindentinfo; ///@} @@ -247,10 +250,10 @@ namespace xo { /** clone string, using memory from allocator @p mm **/ DString * shallow_move(obj gc) noexcept; - size_type forward_children(obj gc) noexcept; /** fixup child pointers (trivial for DString, no children) * note: cref so we can use forward decl **/ + void visit_gco_children(obj gc) noexcept; ///@} diff --git a/xo-stringtable2/include/xo/stringtable2/DUniqueString.hpp b/xo-stringtable2/include/xo/stringtable2/DUniqueString.hpp index 71427c48..7e3502b2 100644 --- a/xo-stringtable2/include/xo/stringtable2/DUniqueString.hpp +++ b/xo-stringtable2/include/xo/stringtable2/DUniqueString.hpp @@ -27,6 +27,7 @@ namespace xo { public: using AAllocator = xo::mm::AAllocator; using ACollector = xo::mm::ACollector; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using size_type = DString::size_type; using ppindentinfo = xo::print::ppindentinfo; @@ -92,7 +93,7 @@ namespace xo { DUniqueString * shallow_move(obj gc) noexcept; /** fixup child pointers (trivial for DUniqueString, no gc-owned children **/ - void forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} diff --git a/xo-stringtable2/include/xo/stringtable2/string/IGCObject_DString.hpp b/xo-stringtable2/include/xo/stringtable2/string/IGCObject_DString.hpp index 4eaa9dc1..6fcbd3bd 100644 --- a/xo-stringtable2/include/xo/stringtable2/string/IGCObject_DString.hpp +++ b/xo-stringtable2/include/xo/stringtable2/string/IGCObject_DString.hpp @@ -44,6 +44,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -54,8 +55,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DString & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DString & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DString & self, obj fn) noexcept; ///@} }; diff --git a/xo-stringtable2/include/xo/stringtable2/uniquestring/IGCObject_DUniqueString.hpp b/xo-stringtable2/include/xo/stringtable2/uniquestring/IGCObject_DUniqueString.hpp index b6e1d19d..a175565e 100644 --- a/xo-stringtable2/include/xo/stringtable2/uniquestring/IGCObject_DUniqueString.hpp +++ b/xo-stringtable2/include/xo/stringtable2/uniquestring/IGCObject_DUniqueString.hpp @@ -44,6 +44,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -54,8 +55,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DUniqueString & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DUniqueString & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DUniqueString & self, obj fn) noexcept; ///@} }; diff --git a/xo-stringtable2/src/stringtable2/DString.cpp b/xo-stringtable2/src/stringtable2/DString.cpp index c3340f46..7bd16fba 100644 --- a/xo-stringtable2/src/stringtable2/DString.cpp +++ b/xo-stringtable2/src/stringtable2/DString.cpp @@ -172,10 +172,10 @@ namespace xo { return copy; } - auto - DString::forward_children(obj) noexcept -> size_type + void + DString::visit_gco_children(obj) noexcept { - return shallow_size(); + // no-op. no children! } bool diff --git a/xo-stringtable2/src/stringtable2/DUniqueString.cpp b/xo-stringtable2/src/stringtable2/DUniqueString.cpp index 43e7f1c3..2660e5d6 100644 --- a/xo-stringtable2/src/stringtable2/DUniqueString.cpp +++ b/xo-stringtable2/src/stringtable2/DUniqueString.cpp @@ -109,9 +109,9 @@ namespace xo { } void - DUniqueString::forward_children(obj) noexcept + DUniqueString::visit_gco_children(obj) noexcept { - // no-op + // no-op -- childless! } } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-stringtable2/src/stringtable2/IGCObject_DString.cpp b/xo-stringtable2/src/stringtable2/IGCObject_DString.cpp index d838e655..f77077b3 100644 --- a/xo-stringtable2/src/stringtable2/IGCObject_DString.cpp +++ b/xo-stringtable2/src/stringtable2/IGCObject_DString.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DString::forward_children(DString & self, obj gc) noexcept -> void + IGCObject_DString::visit_gco_children(DString & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ diff --git a/xo-stringtable2/src/stringtable2/IGCObject_DUniqueString.cpp b/xo-stringtable2/src/stringtable2/IGCObject_DUniqueString.cpp index 60a4d9b9..a2591484 100644 --- a/xo-stringtable2/src/stringtable2/IGCObject_DUniqueString.cpp +++ b/xo-stringtable2/src/stringtable2/IGCObject_DUniqueString.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DUniqueString::forward_children(DUniqueString & self, obj gc) noexcept -> void + IGCObject_DUniqueString::visit_gco_children(DUniqueString & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ diff --git a/xo-type/include/xo/type/DArrayType.hpp b/xo-type/include/xo/type/DArrayType.hpp index db827e80..92a9ecac 100644 --- a/xo-type/include/xo/type/DArrayType.hpp +++ b/xo-type/include/xo/type/DArrayType.hpp @@ -9,6 +9,7 @@ #include "Metatype.hpp" #include #include +#include namespace xo { namespace scm { @@ -19,6 +20,7 @@ namespace xo { class DArrayType { public: using ACollector = xo::mm::ACollector; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AAllocator = xo::mm::AAllocator; using TypeDescr = xo::reflect::TypeDescr; @@ -43,7 +45,7 @@ namespace xo { ///@{ std::size_t shallow_size() const noexcept; DArrayType * shallow_move(obj gc) noexcept; - std::size_t forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} private: diff --git a/xo-type/include/xo/type/DAtomicType.hpp b/xo-type/include/xo/type/DAtomicType.hpp index b9daf767..3274b882 100644 --- a/xo-type/include/xo/type/DAtomicType.hpp +++ b/xo-type/include/xo/type/DAtomicType.hpp @@ -8,6 +8,7 @@ #include "Type.hpp" #include "Metatype.hpp" #include +#include #include namespace xo { @@ -22,6 +23,7 @@ namespace xo { class DAtomicType { public: using ACollector = xo::mm::ACollector; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AAllocator = xo::mm::AAllocator; using TypeDescr = xo::reflect::TypeDescr; @@ -44,7 +46,7 @@ namespace xo { ///@{ std::size_t shallow_size() const noexcept; DAtomicType * shallow_move(obj gc) noexcept; - std::size_t forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} private: diff --git a/xo-type/include/xo/type/DFunctionType.hpp b/xo-type/include/xo/type/DFunctionType.hpp index 5fbb93a7..66b92c1e 100644 --- a/xo-type/include/xo/type/DFunctionType.hpp +++ b/xo-type/include/xo/type/DFunctionType.hpp @@ -9,6 +9,7 @@ #include "Metatype.hpp" #include #include +#include #include namespace xo { @@ -20,8 +21,9 @@ namespace xo { class DFunctionType { public: using ACollector = xo::mm::ACollector; - using AAllocator = xo::mm::AAllocator; using AGCObject = xo::mm::AGCObject; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using AAllocator = xo::mm::AAllocator; using TypeDescr = xo::reflect::TypeDescr; public: @@ -65,7 +67,7 @@ namespace xo { ///@{ std::size_t shallow_size() const noexcept; DFunctionType * shallow_move(obj gc) noexcept; - std::size_t forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} private: diff --git a/xo-type/include/xo/type/DListType.hpp b/xo-type/include/xo/type/DListType.hpp index b2fd196b..c6fa0309 100644 --- a/xo-type/include/xo/type/DListType.hpp +++ b/xo-type/include/xo/type/DListType.hpp @@ -9,6 +9,7 @@ #include "Metatype.hpp" #include #include +#include #include namespace xo { @@ -24,6 +25,7 @@ namespace xo { public: using TypeDescr = xo::reflect::TypeDescr; using ACollector = xo::mm::ACollector; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AAllocator = xo::mm::AAllocator; public: @@ -51,7 +53,7 @@ namespace xo { ///@{ std::size_t shallow_size() const noexcept; DListType * shallow_move(obj gc) noexcept; - std::size_t forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} private: diff --git a/xo-type/include/xo/type/array/IGCObject_DArrayType.hpp b/xo-type/include/xo/type/array/IGCObject_DArrayType.hpp index fe1e8b13..8e6b92d2 100644 --- a/xo-type/include/xo/type/array/IGCObject_DArrayType.hpp +++ b/xo-type/include/xo/type/array/IGCObject_DArrayType.hpp @@ -42,6 +42,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -52,8 +53,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DArrayType & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DArrayType & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DArrayType & self, obj fn) noexcept; ///@} }; diff --git a/xo-type/include/xo/type/atomic/IGCObject_DAtomicType.hpp b/xo-type/include/xo/type/atomic/IGCObject_DAtomicType.hpp index 844c21cc..88f607da 100644 --- a/xo-type/include/xo/type/atomic/IGCObject_DAtomicType.hpp +++ b/xo-type/include/xo/type/atomic/IGCObject_DAtomicType.hpp @@ -42,6 +42,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -52,8 +53,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DAtomicType & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DAtomicType & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DAtomicType & self, obj fn) noexcept; ///@} }; diff --git a/xo-type/include/xo/type/function/IGCObject_DFunctionType.hpp b/xo-type/include/xo/type/function/IGCObject_DFunctionType.hpp index 19c9b7da..2e027c35 100644 --- a/xo-type/include/xo/type/function/IGCObject_DFunctionType.hpp +++ b/xo-type/include/xo/type/function/IGCObject_DFunctionType.hpp @@ -42,6 +42,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -52,8 +53,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DFunctionType & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DFunctionType & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DFunctionType & self, obj fn) noexcept; ///@} }; diff --git a/xo-type/include/xo/type/list/IGCObject_DListType.hpp b/xo-type/include/xo/type/list/IGCObject_DListType.hpp index 19450270..bda54e7d 100644 --- a/xo-type/include/xo/type/list/IGCObject_DListType.hpp +++ b/xo-type/include/xo/type/list/IGCObject_DListType.hpp @@ -42,6 +42,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -52,8 +53,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DListType & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DListType & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DListType & self, obj fn) noexcept; ///@} }; diff --git a/xo-type/include/xo/type/typevar/DTypeVarRef.hpp b/xo-type/include/xo/type/typevar/DTypeVarRef.hpp index f59f3f72..9e1d6b98 100644 --- a/xo-type/include/xo/type/typevar/DTypeVarRef.hpp +++ b/xo-type/include/xo/type/typevar/DTypeVarRef.hpp @@ -23,6 +23,7 @@ namespace xo { class DTypeVarRef { public: using ACollector = xo::mm::ACollector; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AAllocator = xo::mm::AAllocator; using TypeDescr = xo::reflect::TypeDescr; @@ -55,7 +56,7 @@ namespace xo { ///@{ std::size_t shallow_size() const noexcept; DTypeVarRef * shallow_move(obj gc) noexcept; - std::size_t forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} private: diff --git a/xo-type/include/xo/type/typevar/IGCObject_DTypeVarRef.hpp b/xo-type/include/xo/type/typevar/IGCObject_DTypeVarRef.hpp index caf35660..72261cb0 100644 --- a/xo-type/include/xo/type/typevar/IGCObject_DTypeVarRef.hpp +++ b/xo-type/include/xo/type/typevar/IGCObject_DTypeVarRef.hpp @@ -42,6 +42,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -52,8 +53,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DTypeVarRef & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DTypeVarRef & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DTypeVarRef & self, obj fn) noexcept; ///@} }; diff --git a/xo-type/src/type/DArrayType.cpp b/xo-type/src/type/DArrayType.cpp index 46bad06c..4a172f92 100644 --- a/xo-type/src/type/DArrayType.cpp +++ b/xo-type/src/type/DArrayType.cpp @@ -88,15 +88,14 @@ namespace xo { return gc.std_move_for(this); } - std::size_t - DArrayType::forward_children(obj gc) noexcept + void + DArrayType::visit_gco_children(obj gc) noexcept { - { - auto e = FacetRegistry::instance().variant(elt_type_); - gc.forward_inplace(e.iface(), (void **)&(elt_type_.data_)); - } - - return this->shallow_size(); + gc.visit_poly_child(&elt_type_); + //{ + // auto e = FacetRegistry::instance().variant(elt_type_); + // gc.forward_inplace(e.iface(), (void **)&(elt_type_.data_)); + //} } } } diff --git a/xo-type/src/type/DAtomicType.cpp b/xo-type/src/type/DAtomicType.cpp index c5d30330..070683b0 100644 --- a/xo-type/src/type/DAtomicType.cpp +++ b/xo-type/src/type/DAtomicType.cpp @@ -66,10 +66,10 @@ namespace xo { return gc.std_move_for(this); } - std::size_t - DAtomicType::forward_children(obj) noexcept + void + DAtomicType::visit_gco_children(obj) noexcept { - return this->shallow_size(); + // no-op. no children } } /*namespace scm*/ diff --git a/xo-type/src/type/DFunctionType.cpp b/xo-type/src/type/DFunctionType.cpp index 83462b8d..b27e9ac1 100644 --- a/xo-type/src/type/DFunctionType.cpp +++ b/xo-type/src/type/DFunctionType.cpp @@ -99,17 +99,16 @@ namespace xo { return gc.std_move_for(this); } - std::size_t - DFunctionType::forward_children(obj gc) noexcept + void + DFunctionType::visit_gco_children(obj gc) noexcept { - { - auto e = FacetRegistry::instance().variant(return_type_); - gc.forward_inplace(e.iface(), (void **)&(return_type_.data_)); - } + gc.visit_poly_child(&return_type_); + //{ + // auto e = FacetRegistry::instance().variant(return_type_); + // gc.forward_inplace(e.iface(), (void **)&(return_type_.data_)); + //} - gc.forward_inplace(&arg_types_); - - return this->shallow_size(); + gc.visit_child(&arg_types_); } } /*namespace scm*/ diff --git a/xo-type/src/type/DListType.cpp b/xo-type/src/type/DListType.cpp index 49557777..0ffdf8de 100644 --- a/xo-type/src/type/DListType.cpp +++ b/xo-type/src/type/DListType.cpp @@ -93,15 +93,14 @@ namespace xo { return gc.std_move_for(this); } - std::size_t - DListType::forward_children(obj gc) noexcept + void + DListType::visit_gco_children(obj gc) noexcept { - { - auto e = FacetRegistry::instance().variant(elt_type_); - gc.forward_inplace(e.iface(), (void **)&(elt_type_.data_)); - } - - return this->shallow_size(); + gc.visit_poly_child(&elt_type_); + //{ + // auto e = FacetRegistry::instance().variant(elt_type_); + // gc.forward_inplace(e.iface(), (void **)&(elt_type_.data_)); + //} } } } diff --git a/xo-type/src/type/DTypeVarRef.cpp b/xo-type/src/type/DTypeVarRef.cpp index e9119d17..a540c623 100644 --- a/xo-type/src/type/DTypeVarRef.cpp +++ b/xo-type/src/type/DTypeVarRef.cpp @@ -87,17 +87,16 @@ namespace xo { return gc.std_move_for(this); } - std::size_t - DTypeVarRef::forward_children(obj gc) noexcept + void + DTypeVarRef::visit_gco_children(obj gc) noexcept { - gc.forward_pivot_inplace(&type_); + gc.visit_poly_child(&type_); //{ // auto e = FacetRegistry::instance().variant(type_); // gc.forward_inplace(e.iface(), (void **)&type_.data_); //} - return this->shallow_size(); } } /*namespace scm*/ diff --git a/xo-type/src/type/IGCObject_DArrayType.cpp b/xo-type/src/type/IGCObject_DArrayType.cpp index 5f9e6c23..3483c40e 100644 --- a/xo-type/src/type/IGCObject_DArrayType.cpp +++ b/xo-type/src/type/IGCObject_DArrayType.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DArrayType::forward_children(DArrayType & self, obj gc) noexcept -> void + IGCObject_DArrayType::visit_gco_children(DArrayType & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ diff --git a/xo-type/src/type/IGCObject_DAtomicType.cpp b/xo-type/src/type/IGCObject_DAtomicType.cpp index 287db903..2d891efb 100644 --- a/xo-type/src/type/IGCObject_DAtomicType.cpp +++ b/xo-type/src/type/IGCObject_DAtomicType.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DAtomicType::forward_children(DAtomicType & self, obj gc) noexcept -> void + IGCObject_DAtomicType::visit_gco_children(DAtomicType & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ diff --git a/xo-type/src/type/IGCObject_DFunctionType.cpp b/xo-type/src/type/IGCObject_DFunctionType.cpp index 3114a00d..36d76b43 100644 --- a/xo-type/src/type/IGCObject_DFunctionType.cpp +++ b/xo-type/src/type/IGCObject_DFunctionType.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DFunctionType::forward_children(DFunctionType & self, obj gc) noexcept -> void + IGCObject_DFunctionType::visit_gco_children(DFunctionType & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ diff --git a/xo-type/src/type/IGCObject_DListType.cpp b/xo-type/src/type/IGCObject_DListType.cpp index bf5860f1..68130a80 100644 --- a/xo-type/src/type/IGCObject_DListType.cpp +++ b/xo-type/src/type/IGCObject_DListType.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DListType::forward_children(DListType & self, obj gc) noexcept -> void + IGCObject_DListType::visit_gco_children(DListType & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ diff --git a/xo-type/src/type/IGCObject_DTypeVarRef.cpp b/xo-type/src/type/IGCObject_DTypeVarRef.cpp index 910b7a9d..3ff82f33 100644 --- a/xo-type/src/type/IGCObject_DTypeVarRef.cpp +++ b/xo-type/src/type/IGCObject_DTypeVarRef.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DTypeVarRef::forward_children(DTypeVarRef & self, obj gc) noexcept -> void + IGCObject_DTypeVarRef::visit_gco_children(DTypeVarRef & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/