diff --git a/xo-alloc2/idl/GCObject.json5 b/xo-alloc2/idl/GCObject.json5 index f86e6ca9..cd320d06 100644 --- a/xo-alloc2/idl/GCObject.json5 +++ b/xo-alloc2/idl/GCObject.json5 @@ -48,6 +48,11 @@ doc: ["fomo collector type"], definition: "xo::mm::AGCObjectVisitor", }, + { + name: "VisitReason", + doc: ["hint arg when navigating object graph"], + definition: "xo::mm::VisitReason", + }, ], const_methods: [ // size_type shallow_size() const noexcept @@ -77,7 +82,7 @@ noexcept: true, attributes: [], }, - // size_type visit_gco_children(obj) noexcept + // size_type visit_gco_children(VisitReason reason, obj) noexcept { name: "visit_gco_children", doc: [ @@ -87,6 +92,7 @@ ], return_type: "void", args: [ + {type: "VisitReason", name: "reason"}, {type: "obj", name: "fn"}, ], const: true, diff --git a/xo-alloc2/idl/GCObjectVisitor.json5 b/xo-alloc2/idl/GCObjectVisitor.json5 index 854287e2..fe6fbb1c 100644 --- a/xo-alloc2/idl/GCObjectVisitor.json5 +++ b/xo-alloc2/idl/GCObjectVisitor.json5 @@ -6,6 +6,7 @@ includes: [ "", "", + "", "", ], // extra includes in GCObject.hpp, if any @@ -85,12 +86,13 @@ noexcept: false, attributes: [], }, - // void visit_child(AGCObject * iface, void ** pp_data) noexcept; + // void visit_child(VisitReason reason, AGCObject * iface, void ** pp_data) noexcept; { name: "visit_child", doc: ["visit child of a gc-aware object. May update child in-place!"], return_type: "void", args:[ + {type: "VisitReason", name: "reason"}, {type: "AGCObject *", name: "iface"}, {type: "void **", name: "pp_data"}, ], @@ -121,20 +123,20 @@ " (for historical reasons - coul d be in RGCObject_aux.hpp?)", " **/", "template ", - "void visit_child(xo::facet::obj * p_obj);", + "void visit_child(VisitReason reason, 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);", + "void visit_child(VisitReason reason, 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);", + "void visit_poly_child(VisitReason reason, obj * p_pivot);", "", ] } diff --git a/xo-alloc2/include/xo/alloc2/VisitReason.hpp b/xo-alloc2/include/xo/alloc2/VisitReason.hpp new file mode 100644 index 00000000..569b02d3 --- /dev/null +++ b/xo-alloc2/include/xo/alloc2/VisitReason.hpp @@ -0,0 +1,51 @@ +/** @file VisitReason.hpp + * + * @author Roland Conybeare, Apr 2026 + **/ + +#pragma once + +namespace xo { + namespace mm { + + /** @brief tag when navigating object graph + * + * Used with + * @ref DX1Collector::visit_child + * @ref GCObject::visit_gco_children + **/ + class VisitReason { + public: + enum class code { + invalid = -1, + + /** color not needed **/ + unspecified, + + /** Forward child pointers inplace for GC. + * See @ref GCObjectStore::forward_inplace_aux + **/ + forward, + /** verify GC store consistency + * See @ref DX1Collector::_verify_aux + **/ + verify, + + N, + }; + + explicit VisitReason(code x) : code_{x} {} + + static VisitReason unspecified() { return VisitReason(code::unspecified); } + static VisitReason forward() { return VisitReason(code::forward); } + static VisitReason verify() { return VisitReason(code::verify); } + + code code() const noexcept { return code_; } + + enum code code_; + }; + + } /*namespace mm*/ +} /*namespace xo*/ + +/* end VisitReason.hpp */ diff --git a/xo-alloc2/include/xo/alloc2/gc/AGCObject.hpp b/xo-alloc2/include/xo/alloc2/gc/AGCObject.hpp index 6ed3ee77..fbb5f613 100644 --- a/xo-alloc2/include/xo/alloc2/gc/AGCObject.hpp +++ b/xo-alloc2/include/xo/alloc2/gc/AGCObject.hpp @@ -51,6 +51,8 @@ public: using ACollector = xo::mm::ACollector; /** fomo collector type **/ using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + /** hint arg when navigating object graph **/ + using VisitReason = xo::mm::VisitReason; ///@} /** @defgroup mm-gcobject-methods **/ @@ -73,7 +75,7 @@ Arguably abusing the word 'visitor' here **/ /** 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; + virtual void visit_gco_children(Opaque data, VisitReason reason, obj fn) const noexcept = 0; ///@} }; /*AGCObject*/ diff --git a/xo-alloc2/include/xo/alloc2/gc/AGCObjectVisitor.hpp b/xo-alloc2/include/xo/alloc2/gc/AGCObjectVisitor.hpp index a9d00931..86cd9b9a 100644 --- a/xo-alloc2/include/xo/alloc2/gc/AGCObjectVisitor.hpp +++ b/xo-alloc2/include/xo/alloc2/gc/AGCObjectVisitor.hpp @@ -16,6 +16,7 @@ // includes (via {facet_includes}) #include #include +#include #include #include #include @@ -71,7 +72,7 @@ Source must be owned by this collector. Increments object age **/ virtual void * alloc_copy(Opaque data, std::byte * src) const = 0; /** visit child of a gc-aware object. May update child in-place! **/ - virtual void visit_child(Opaque data, AGCObject * iface, void ** pp_data) const noexcept = 0; + virtual void visit_child(Opaque data, VisitReason reason, AGCObject * iface, void ** pp_data) const noexcept = 0; ///@} }; /*AGCObjectVisitor*/ diff --git a/xo-alloc2/include/xo/alloc2/gc/IGCObjectVisitor_Any.hpp b/xo-alloc2/include/xo/alloc2/gc/IGCObjectVisitor_Any.hpp index 53515e25..8dbece07 100644 --- a/xo-alloc2/include/xo/alloc2/gc/IGCObjectVisitor_Any.hpp +++ b/xo-alloc2/include/xo/alloc2/gc/IGCObjectVisitor_Any.hpp @@ -63,7 +63,7 @@ namespace mm { // nonconst methods [[noreturn]] void * alloc_copy(Opaque, std::byte *) const override; - [[noreturn]] void visit_child(Opaque, AGCObject *, void **) const noexcept override; + [[noreturn]] void visit_child(Opaque, VisitReason, AGCObject *, void **) const noexcept override; ///@} diff --git a/xo-alloc2/include/xo/alloc2/gc/IGCObjectVisitor_Xfer.hpp b/xo-alloc2/include/xo/alloc2/gc/IGCObjectVisitor_Xfer.hpp index 00ad3596..0cc60872 100644 --- a/xo-alloc2/include/xo/alloc2/gc/IGCObjectVisitor_Xfer.hpp +++ b/xo-alloc2/include/xo/alloc2/gc/IGCObjectVisitor_Xfer.hpp @@ -15,6 +15,7 @@ #include #include +#include #include namespace xo { @@ -56,8 +57,8 @@ namespace mm { void * alloc_copy(Opaque data, std::byte * src) const override { return I::alloc_copy(_dcast(data), src); } - void visit_child(Opaque data, AGCObject * iface, void ** pp_data) const noexcept override { - return I::visit_child(_dcast(data), iface, pp_data); + void visit_child(Opaque data, VisitReason reason, AGCObject * iface, void ** pp_data) const noexcept override { + return I::visit_child(_dcast(data), reason, iface, pp_data); } ///@} diff --git a/xo-alloc2/include/xo/alloc2/gc/IGCObject_Any.hpp b/xo-alloc2/include/xo/alloc2/gc/IGCObject_Any.hpp index 62974779..f9ff5f87 100644 --- a/xo-alloc2/include/xo/alloc2/gc/IGCObject_Any.hpp +++ b/xo-alloc2/include/xo/alloc2/gc/IGCObject_Any.hpp @@ -48,6 +48,7 @@ namespace mm { using AAllocator = AGCObject::AAllocator; using ACollector = AGCObject::ACollector; using AGCObjectVisitor = AGCObject::AGCObjectVisitor; + using VisitReason = AGCObject::VisitReason; ///@} /** @defgroup mm-gcobject-any-methods **/ @@ -65,7 +66,7 @@ namespace mm { // nonconst methods [[noreturn]] Opaque gco_shallow_move(Opaque, obj) const noexcept override; - [[noreturn]] void visit_gco_children(Opaque, obj) const noexcept override; + [[noreturn]] void visit_gco_children(Opaque, VisitReason, 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 633c1030..c5a0a6b8 100644 --- a/xo-alloc2/include/xo/alloc2/gc/IGCObject_Xfer.hpp +++ b/xo-alloc2/include/xo/alloc2/gc/IGCObject_Xfer.hpp @@ -36,6 +36,7 @@ namespace mm { using AAllocator = AGCObject::AAllocator; using ACollector = AGCObject::ACollector; using AGCObjectVisitor = AGCObject::AGCObjectVisitor; + using VisitReason = AGCObject::VisitReason; ///@} /** @defgroup mm-gcobject-xfer-methods **/ @@ -56,8 +57,8 @@ namespace mm { Opaque gco_shallow_move(Opaque data, obj gc) const noexcept override { return I::gco_shallow_move(_dcast(data), gc); } - void visit_gco_children(Opaque data, obj fn) const noexcept override { - return I::visit_gco_children(_dcast(data), fn); + void visit_gco_children(Opaque data, VisitReason reason, obj fn) const noexcept override { + return I::visit_gco_children(_dcast(data), reason, fn); } ///@} diff --git a/xo-alloc2/include/xo/alloc2/gc/RCollector_aux.hpp b/xo-alloc2/include/xo/alloc2/gc/RCollector_aux.hpp index 83bc631e..e964a931 100644 --- a/xo-alloc2/include/xo/alloc2/gc/RCollector_aux.hpp +++ b/xo-alloc2/include/xo/alloc2/gc/RCollector_aux.hpp @@ -24,32 +24,33 @@ namespace xo { template template void - RGCObjectVisitor::visit_child(xo::facet::obj * p_obj) + RGCObjectVisitor::visit_child(VisitReason reason, + xo::facet::obj * p_obj) { - this->visit_child(p_obj->iface(), (void **)&(p_obj->data_)); + this->visit_child(reason, p_obj->iface(), (void **)&(p_obj->data_)); } template template void - RGCObjectVisitor::visit_child(DRepr ** p_repr) + RGCObjectVisitor::visit_child(VisitReason reason, 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); + this->visit_child(reason, &iface, (void **)p_repr); } template template requires (!std::is_same_v) void - RGCObjectVisitor::visit_poly_child(obj * p_objs) + RGCObjectVisitor::visit_poly_child(VisitReason reason, obj * p_objs) { if (*p_objs) { auto e = xo::facet::FacetRegistry::instance().variant(*p_objs); - this->visit_child(e.iface(), (void **)&(p_objs->data_)); + this->visit_child(reason, e.iface(), (void **)&(p_objs->data_)); } } diff --git a/xo-alloc2/include/xo/alloc2/gc/RGCObject.hpp b/xo-alloc2/include/xo/alloc2/gc/RGCObject.hpp index 1d625590..5b401554 100644 --- a/xo-alloc2/include/xo/alloc2/gc/RGCObject.hpp +++ b/xo-alloc2/include/xo/alloc2/gc/RGCObject.hpp @@ -35,6 +35,7 @@ public: using AAllocator = AGCObject::AAllocator; using ACollector = AGCObject::ACollector; using AGCObjectVisitor = AGCObject::AGCObjectVisitor; + using VisitReason = AGCObject::VisitReason; ///@} /** @defgroup mm-gcobject-router-ctors **/ @@ -61,8 +62,8 @@ public: Opaque gco_shallow_move(obj gc) noexcept { return O::iface()->gco_shallow_move(O::data(), gc); } - void visit_gco_children(obj fn) noexcept { - return O::iface()->visit_gco_children(O::data(), fn); + void visit_gco_children(VisitReason reason, obj fn) noexcept { + return O::iface()->visit_gco_children(O::data(), reason, fn); } ///@} diff --git a/xo-alloc2/include/xo/alloc2/gc/RGCObjectVisitor.hpp b/xo-alloc2/include/xo/alloc2/gc/RGCObjectVisitor.hpp index 8b7ab260..4972593b 100644 --- a/xo-alloc2/include/xo/alloc2/gc/RGCObjectVisitor.hpp +++ b/xo-alloc2/include/xo/alloc2/gc/RGCObjectVisitor.hpp @@ -67,20 +67,20 @@ public: (for historical reasons - coul d be in RGCObject_aux.hpp?) **/ template - void visit_child(xo::facet::obj * p_obj); + void visit_child(VisitReason reason, 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); + void visit_child(VisitReason reason, 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); + void visit_poly_child(VisitReason reason, obj * p_pivot); // builtin methods @@ -99,8 +99,8 @@ public: void * alloc_copy(std::byte * src) { return O::iface()->alloc_copy(O::data(), src); } - void visit_child(AGCObject * iface, void ** pp_data) noexcept { - return O::iface()->visit_child(O::data(), iface, pp_data); + void visit_child(VisitReason reason, AGCObject * iface, void ** pp_data) noexcept { + return O::iface()->visit_child(O::data(), reason, iface, pp_data); } ///@} diff --git a/xo-alloc2/include/xo/alloc2/role.hpp b/xo-alloc2/include/xo/alloc2/role.hpp index d2b7c2fb..9b068a1d 100644 --- a/xo-alloc2/include/xo/alloc2/role.hpp +++ b/xo-alloc2/include/xo/alloc2/role.hpp @@ -12,6 +12,8 @@ namespace xo { namespace mm { static constexpr uint32_t c_n_role = 2; + /** @brief identify GC half-spaces + **/ class Role { public: using value_type = std::uint32_t; diff --git a/xo-alloc2/src/alloc2/IGCObject_Any.cpp b/xo-alloc2/src/alloc2/IGCObject_Any.cpp index 914123de..4e729e08 100644 --- a/xo-alloc2/src/alloc2/IGCObject_Any.cpp +++ b/xo-alloc2/src/alloc2/IGCObject_Any.cpp @@ -42,7 +42,7 @@ IGCObject_Any::gco_shallow_move(Opaque, obj) const noexcept } auto -IGCObject_Any::visit_gco_children(Opaque, obj) const noexcept -> void +IGCObject_Any::visit_gco_children(Opaque, VisitReason, obj) const noexcept -> void { _fatal(); } diff --git a/xo-alloc2/src/alloc2/facet/IGCObjectVisitor_Any.cpp b/xo-alloc2/src/alloc2/facet/IGCObjectVisitor_Any.cpp index 0946acde..934aa946 100644 --- a/xo-alloc2/src/alloc2/facet/IGCObjectVisitor_Any.cpp +++ b/xo-alloc2/src/alloc2/facet/IGCObjectVisitor_Any.cpp @@ -42,7 +42,7 @@ IGCObjectVisitor_Any::alloc_copy(Opaque, std::byte *) const -> void * } auto -IGCObjectVisitor_Any::visit_child(Opaque, AGCObject *, void **) const noexcept -> void +IGCObjectVisitor_Any::visit_child(Opaque, VisitReason, AGCObject *, void **) const noexcept -> void { _fatal(); } diff --git a/xo-expression2/include/xo/expression2/DApplyExpr.hpp b/xo-expression2/include/xo/expression2/DApplyExpr.hpp index bc5cdc47..cb0be70f 100644 --- a/xo-expression2/include/xo/expression2/DApplyExpr.hpp +++ b/xo-expression2/include/xo/expression2/DApplyExpr.hpp @@ -21,8 +21,8 @@ namespace xo { **/ class DApplyExpr { public: - //using ACollector = xo::mm::ACollector; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using AAllocator = xo::mm::AAllocator; using TypeDescr = xo::reflect::TypeDescr; using ppindentinfo = xo::print::ppindentinfo; @@ -85,7 +85,7 @@ namespace xo { ///@{ DApplyExpr * gco_shallow_move(obj gc) noexcept; - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, 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 e81a7b2d..bf901537 100644 --- a/xo-expression2/include/xo/expression2/DConstant.hpp +++ b/xo-expression2/include/xo/expression2/DConstant.hpp @@ -8,7 +8,6 @@ #include "Expression.hpp" #include "TypeRef.hpp" #include "exprtype.hpp" -//#include #include #include #include @@ -22,8 +21,8 @@ namespace xo { public: using TaggedPtr = xo::reflect::TaggedPtr; using TypeDescr = xo::reflect::TypeDescr; - //using ACollector = xo::mm::ACollector; using AGCObject = xo::mm::AGCObject; + using VisitReason = xo::mm::VisitReason; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AAllocator = xo::mm::AAllocator; using typeseq = xo::reflect::typeseq; @@ -65,7 +64,7 @@ namespace xo { ///@{ DConstant * gco_shallow_move(obj gc) noexcept; - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, 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 474a4122..3f0071fd 100644 --- a/xo-expression2/include/xo/expression2/DDefineExpr.hpp +++ b/xo-expression2/include/xo/expression2/DDefineExpr.hpp @@ -26,6 +26,7 @@ namespace xo { using ppindentinfo = xo::print::ppindentinfo; using ACollector = xo::mm::ACollector; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using AAllocator = xo::mm::AAllocator; using TypeDescr = xo::reflect::TypeDescr; @@ -75,7 +76,7 @@ namespace xo { ///@{ DDefineExpr * gco_shallow_move(obj gc) noexcept; - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, 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 b3840a69..4a7fdf93 100644 --- a/xo-expression2/include/xo/expression2/DGlobalSymtab.hpp +++ b/xo-expression2/include/xo/expression2/DGlobalSymtab.hpp @@ -30,9 +30,9 @@ namespace xo { using value_type = Binding; using ArenaHashMapConfig = xo::map::ArenaHashMapConfig; using repr_type = xo::map::DArenaHashMap; - //using ACollector = xo::mm::ACollector; using AGCObject = xo::mm::AGCObject; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using AAllocator = xo::mm::AAllocator; using MemorySizeVisitor = xo::mm::MemorySizeVisitor; using ppindentinfo = xo::print::ppindentinfo; @@ -116,7 +116,7 @@ namespace xo { ///@{ DGlobalSymtab * gco_shallow_move(obj gc) noexcept; - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, 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 04a354dd..bc83ccd4 100644 --- a/xo-expression2/include/xo/expression2/DIfElseExpr.hpp +++ b/xo-expression2/include/xo/expression2/DIfElseExpr.hpp @@ -8,7 +8,6 @@ #include "Expression.hpp" #include "TypeRef.hpp" #include "exprtype.hpp" -//#include #include #include #include @@ -21,8 +20,8 @@ namespace xo { **/ class DIfElseExpr { public: - //using ACollector = xo::mm::ACollector; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using AAllocator = xo::mm::AAllocator; using TypeDescr = xo::reflect::TypeDescr; using ppindentinfo = xo::print::ppindentinfo; @@ -99,7 +98,7 @@ namespace xo { ///@{ DIfElseExpr * gco_shallow_move(obj gc) noexcept; - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, obj gc) noexcept; ///@} diff --git a/xo-expression2/include/xo/expression2/DLambdaExpr.hpp b/xo-expression2/include/xo/expression2/DLambdaExpr.hpp index e4b0296d..b7fc76a8 100644 --- a/xo-expression2/include/xo/expression2/DLambdaExpr.hpp +++ b/xo-expression2/include/xo/expression2/DLambdaExpr.hpp @@ -21,8 +21,8 @@ namespace xo { **/ class DLambdaExpr { public: - //using ACollector = xo::mm::ACollector; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using AAllocator = xo::mm::AAllocator; using TypeDescr = xo::reflect::TypeDescr; using ppindentinfo = xo::print::ppindentinfo; @@ -88,7 +88,7 @@ namespace xo { std::size_t shallow_size() const noexcept; DLambdaExpr * gco_shallow_move(obj gc) noexcept; - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, 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 081742b0..b658bbd5 100644 --- a/xo-expression2/include/xo/expression2/DLocalSymtab.hpp +++ b/xo-expression2/include/xo/expression2/DLocalSymtab.hpp @@ -20,8 +20,8 @@ namespace xo { public: using DArray = xo::scm::DArray; using ppindentinfo = xo::print::ppindentinfo; - //using ACollector = xo::mm::ACollector; using AGCObject = xo::mm::AGCObject; + using VisitReason = xo::mm::VisitReason; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AAllocator = xo::mm::AAllocator; /* note: uint16_t would be fine too */ @@ -100,7 +100,7 @@ namespace xo { ///@{ DLocalSymtab * gco_shallow_move(obj gc) noexcept; - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, 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 4a103e0e..e919ae13 100644 --- a/xo-expression2/include/xo/expression2/DSequenceExpr.hpp +++ b/xo-expression2/include/xo/expression2/DSequenceExpr.hpp @@ -23,8 +23,8 @@ namespace xo { **/ class DSequenceExpr { public: - //using ACollector = xo::mm::ACollector; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using AAllocator = xo::mm::AAllocator; using TypeDescr = xo::reflect::TypeDescr; using size_type = DArray::size_type; @@ -75,7 +75,7 @@ namespace xo { ///@{ DSequenceExpr * gco_shallow_move(obj gc) noexcept; - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, obj gc) noexcept; ///@} diff --git a/xo-expression2/include/xo/expression2/DTypename.hpp b/xo-expression2/include/xo/expression2/DTypename.hpp index 7ddacd21..64ec86bc 100644 --- a/xo-expression2/include/xo/expression2/DTypename.hpp +++ b/xo-expression2/include/xo/expression2/DTypename.hpp @@ -24,8 +24,8 @@ namespace xo { class DTypename { public: using ppindentinfo = xo::print::ppindentinfo; - //using ACollector = xo::mm::ACollector; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using AGCObject = xo::mm::AGCObject; using AAllocator = xo::mm::AAllocator; @@ -56,7 +56,7 @@ namespace xo { ///@{ DTypename * gco_shallow_move(obj gc) noexcept; - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, 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 002e511a..93224199 100644 --- a/xo-expression2/include/xo/expression2/DVarRef.hpp +++ b/xo-expression2/include/xo/expression2/DVarRef.hpp @@ -21,8 +21,8 @@ namespace xo { class DVarRef { public: using ppindentinfo = xo::print::ppindentinfo; - //using ACollector = xo::mm::ACollector; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using AAllocator = xo::mm::AAllocator; using TypeDescr = xo::reflect::TypeDescr; @@ -57,7 +57,7 @@ namespace xo { ///@{ DVarRef * gco_shallow_move(obj gc) noexcept; - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, 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 5813ae1b..158ef842 100644 --- a/xo-expression2/include/xo/expression2/DVariable.hpp +++ b/xo-expression2/include/xo/expression2/DVariable.hpp @@ -22,8 +22,8 @@ namespace xo { class DVariable { public: using ppindentinfo = xo::print::ppindentinfo; - //using ACollector = xo::mm::ACollector; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using AAllocator = xo::mm::AAllocator; using TypeDescr = xo::reflect::TypeDescr; @@ -65,7 +65,7 @@ namespace xo { ///@{ DVariable * gco_shallow_move(obj gc) noexcept; - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, 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 f56028ba..c93158fb 100644 --- a/xo-expression2/include/xo/expression2/TypeRef.hpp +++ b/xo-expression2/include/xo/expression2/TypeRef.hpp @@ -26,8 +26,8 @@ namespace xo { using TypeDescr = xo::reflect::TypeDescr; using type_var = flatstring<20>; using prefix_type = flatstring<8>; - using ACollector = xo::mm::ACollector; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using ppindentinfo = xo::print::ppindentinfo; public: @@ -75,7 +75,7 @@ namespace xo { bool pretty(const ppindentinfo & ppii) const; /** gc support **/ - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, 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 6a233f92..c07c8e4e 100644 --- a/xo-expression2/include/xo/expression2/define/IGCObject_DDefineExpr.hpp +++ b/xo-expression2/include/xo/expression2/define/IGCObject_DDefineExpr.hpp @@ -45,6 +45,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -59,7 +60,7 @@ Arguably abusing the word 'visitor' here **/ /** 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; + static void visit_gco_children(DDefineExpr & self, VisitReason reason, 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 399d9398..a1a2fac4 100644 --- a/xo-expression2/include/xo/expression2/detail/IGCObject_DApplyExpr.hpp +++ b/xo-expression2/include/xo/expression2/detail/IGCObject_DApplyExpr.hpp @@ -45,6 +45,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -59,7 +60,7 @@ Arguably abusing the word 'visitor' here **/ /** 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; + static void visit_gco_children(DApplyExpr & self, VisitReason reason, 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 b2e624be..82783948 100644 --- a/xo-expression2/include/xo/expression2/detail/IGCObject_DConstant.hpp +++ b/xo-expression2/include/xo/expression2/detail/IGCObject_DConstant.hpp @@ -45,6 +45,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -59,7 +60,7 @@ Arguably abusing the word 'visitor' here **/ /** 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; + static void visit_gco_children(DConstant & self, VisitReason reason, 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 80a49f22..3156fe58 100644 --- a/xo-expression2/include/xo/expression2/detail/IGCObject_DIfElseExpr.hpp +++ b/xo-expression2/include/xo/expression2/detail/IGCObject_DIfElseExpr.hpp @@ -45,6 +45,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -59,7 +60,7 @@ Arguably abusing the word 'visitor' here **/ /** 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; + static void visit_gco_children(DIfElseExpr & self, VisitReason reason, 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 5decc2a0..ec4faded 100644 --- a/xo-expression2/include/xo/expression2/detail/IGCObject_DLambdaExpr.hpp +++ b/xo-expression2/include/xo/expression2/detail/IGCObject_DLambdaExpr.hpp @@ -45,6 +45,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -59,7 +60,7 @@ Arguably abusing the word 'visitor' here **/ /** 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; + static void visit_gco_children(DLambdaExpr & self, VisitReason reason, 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 54bab050..1b927e01 100644 --- a/xo-expression2/include/xo/expression2/detail/IGCObject_DSequenceExpr.hpp +++ b/xo-expression2/include/xo/expression2/detail/IGCObject_DSequenceExpr.hpp @@ -45,6 +45,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -59,7 +60,7 @@ Arguably abusing the word 'visitor' here **/ /** 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; + static void visit_gco_children(DSequenceExpr & self, VisitReason reason, 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 98c65aab..085999f9 100644 --- a/xo-expression2/include/xo/expression2/detail/IGCObject_DVarRef.hpp +++ b/xo-expression2/include/xo/expression2/detail/IGCObject_DVarRef.hpp @@ -45,6 +45,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -59,7 +60,7 @@ Arguably abusing the word 'visitor' here **/ /** 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; + static void visit_gco_children(DVarRef & self, VisitReason reason, 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 334c0ea9..ee24adfb 100644 --- a/xo-expression2/include/xo/expression2/symtab/IGCObject_DGlobalSymtab.hpp +++ b/xo-expression2/include/xo/expression2/symtab/IGCObject_DGlobalSymtab.hpp @@ -45,6 +45,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -59,7 +60,7 @@ Arguably abusing the word 'visitor' here **/ /** 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; + static void visit_gco_children(DGlobalSymtab & self, VisitReason reason, 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 c7890a79..cbd98904 100644 --- a/xo-expression2/include/xo/expression2/symtab/IGCObject_DLocalSymtab.hpp +++ b/xo-expression2/include/xo/expression2/symtab/IGCObject_DLocalSymtab.hpp @@ -45,6 +45,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -59,7 +60,7 @@ Arguably abusing the word 'visitor' here **/ /** 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; + static void visit_gco_children(DLocalSymtab & self, VisitReason reason, 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 e8946864..cdd91734 100644 --- a/xo-expression2/include/xo/expression2/typename/IGCObject_DTypename.hpp +++ b/xo-expression2/include/xo/expression2/typename/IGCObject_DTypename.hpp @@ -43,6 +43,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -57,7 +58,7 @@ Arguably abusing the word 'visitor' here **/ /** 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; + static void visit_gco_children(DTypename & self, VisitReason reason, 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 3a31f155..9e173090 100644 --- a/xo-expression2/include/xo/expression2/variable/IGCObject_DVariable.hpp +++ b/xo-expression2/include/xo/expression2/variable/IGCObject_DVariable.hpp @@ -45,6 +45,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -59,7 +60,7 @@ Arguably abusing the word 'visitor' here **/ /** 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; + static void visit_gco_children(DVariable & self, VisitReason reason, obj fn) noexcept; ///@} }; diff --git a/xo-expression2/src/expression2/DApplyExpr.cpp b/xo-expression2/src/expression2/DApplyExpr.cpp index 2776b438..0f9a5c5c 100644 --- a/xo-expression2/src/expression2/DApplyExpr.cpp +++ b/xo-expression2/src/expression2/DApplyExpr.cpp @@ -125,23 +125,16 @@ namespace xo { } void - DApplyExpr::visit_gco_children(obj gc) noexcept + DApplyExpr::visit_gco_children(VisitReason reason, obj gc) noexcept { - typeref_.visit_gco_children(gc); + typeref_.visit_gco_children(reason, gc); - { - gc.visit_poly_child(&fn_); - //obj fn_gco = fn_.to_facet(); - //gc.forward_inplace(fn_gco.iface(), (void **)&fn_.data_); - } + gc.visit_poly_child(reason, &fn_); for (size_type i = 0; i < n_args_; ++i) { obj & arg = args_[i]; - // runtime poly here - gc.visit_poly_child(&arg); - //obj arg_gco = arg.to_facet(); - //gc.forward_inplace(arg_gco.iface(), (void **)(&arg.data_)); + gc.visit_poly_child(reason, &arg); } } diff --git a/xo-expression2/src/expression2/DConstant.cpp b/xo-expression2/src/expression2/DConstant.cpp index 19805cb5..441d24a0 100644 --- a/xo-expression2/src/expression2/DConstant.cpp +++ b/xo-expression2/src/expression2/DConstant.cpp @@ -3,8 +3,8 @@ * @author Roland Conybeare, Jan 2026 **/ -#include "DConstant.hpp" -#include "detail/IExpression_DConstant.hpp" +#include "Constant.hpp" +//#include "detail/IExpression_DConstant.hpp" #include "TypeDescr.hpp" #include #include @@ -78,11 +78,12 @@ namespace xo { } void - DConstant::visit_gco_children(obj gc) noexcept + DConstant::visit_gco_children(VisitReason reason, + obj gc) noexcept { - typeref_.visit_gco_children(gc); + typeref_.visit_gco_children(reason, gc); - gc.visit_child(&value_); + gc.visit_child(reason, &value_); } bool diff --git a/xo-expression2/src/expression2/DDefineExpr.cpp b/xo-expression2/src/expression2/DDefineExpr.cpp index ba481805..7bcf817b 100644 --- a/xo-expression2/src/expression2/DDefineExpr.cpp +++ b/xo-expression2/src/expression2/DDefineExpr.cpp @@ -85,11 +85,11 @@ namespace xo { } void - DDefineExpr::visit_gco_children(obj gc) noexcept + DDefineExpr::visit_gco_children(VisitReason reason, + obj gc) noexcept { - gc.visit_child(&lhs_var_); - //gc.forward_inplace(&rhs_); // complicated - need to access via GCObject facet - gc.visit_poly_child(&rhs_); + gc.visit_child(reason, &lhs_var_); + gc.visit_poly_child(reason, &rhs_); } bool @@ -104,9 +104,6 @@ namespace xo { if (lhs_var_) assert(lhs.data()); - (void)lhs; - (void)rhs; - if (rhs_) assert(rhs.data()); diff --git a/xo-expression2/src/expression2/DGlobalSymtab.cpp b/xo-expression2/src/expression2/DGlobalSymtab.cpp index f5df4a4c..7b6bd760 100644 --- a/xo-expression2/src/expression2/DGlobalSymtab.cpp +++ b/xo-expression2/src/expression2/DGlobalSymtab.cpp @@ -269,15 +269,22 @@ namespace xo { } void - DGlobalSymtab::visit_gco_children(obj gc) noexcept + DGlobalSymtab::visit_gco_children(VisitReason reason, + obj gc) noexcept { // map_ doesn't contain any gc-owned data, can skip +#ifdef __APPLE__ + // clang not recognizing these as comptime eligible + assert(var_map_.is_gc_eligible() == false); + assert(type_map_.is_gc_eligible() == false); +#else static_assert(var_map_.is_gc_eligible() == false); static_assert(type_map_.is_gc_eligible() == false); +#endif - gc.visit_child(&vars_); - gc.visit_child(&types_); + gc.visit_child(reason, &vars_); + gc.visit_child(reason, &types_); } // ----- printable facet ----- diff --git a/xo-expression2/src/expression2/DIfElseExpr.cpp b/xo-expression2/src/expression2/DIfElseExpr.cpp index b8758387..6042104b 100644 --- a/xo-expression2/src/expression2/DIfElseExpr.cpp +++ b/xo-expression2/src/expression2/DIfElseExpr.cpp @@ -89,26 +89,15 @@ namespace xo { } void - DIfElseExpr::visit_gco_children(obj gc) noexcept + DIfElseExpr::visit_gco_children(VisitReason reason, + obj gc) noexcept { - typeref_.visit_gco_children(gc); + typeref_.visit_gco_children(reason, gc); // GC needs to locate AGCObject iface for each member. - { - gc.visit_poly_child(&test_); - //auto gco = test_.to_facet(); - //gc.forward_inplace(gco.iface(), (void **)&(test_.data_)); - } - { - gc.visit_poly_child(&when_true_); - //auto gco = when_true_.to_facet(); - //gc.forward_inplace(gco.iface(), (void **)&(when_true_.data_)); - } - { - gc.visit_poly_child(&when_false_); - //auto gco = when_false_.to_facet(); - //gc.forward_inplace(gco.iface(), (void **)&(when_false_.data_)); - } + gc.visit_poly_child(reason, &test_); + gc.visit_poly_child(reason, &when_true_); + gc.visit_poly_child(reason, &when_false_); } // ----- printable facet ----- diff --git a/xo-expression2/src/expression2/DLambdaExpr.cpp b/xo-expression2/src/expression2/DLambdaExpr.cpp index c73ccc8a..1b512b0c 100644 --- a/xo-expression2/src/expression2/DLambdaExpr.cpp +++ b/xo-expression2/src/expression2/DLambdaExpr.cpp @@ -146,26 +146,15 @@ namespace xo { } void - DLambdaExpr::visit_gco_children(obj gc) noexcept { - typeref_.visit_gco_children(gc); - - gc.visit_child(&name_); - //{ - // auto iface = xo::facet::impl_for(); - // gc.forward_inplace(&iface, (void **)(&name_)); - //} + DLambdaExpr::visit_gco_children(VisitReason reason, + obj gc) noexcept { + typeref_.visit_gco_children(reason, gc); + gc.visit_child(reason, &name_); // type_name_str_ - { - gc.visit_child(&local_symtab_); - //gc.forward_inplace(&local_symtab_); - } - - { - gc.visit_poly_child(&body_expr_); - //gc.forward_pivot_inplace(&body_expr_); - } + gc.visit_child(reason, &local_symtab_); + gc.visit_poly_child(reason, &body_expr_); // xxx free_var_set // xxx captured_var_set diff --git a/xo-expression2/src/expression2/DLocalSymtab.cpp b/xo-expression2/src/expression2/DLocalSymtab.cpp index 1fa1afd8..9d85a97c 100644 --- a/xo-expression2/src/expression2/DLocalSymtab.cpp +++ b/xo-expression2/src/expression2/DLocalSymtab.cpp @@ -119,11 +119,12 @@ namespace xo { } void - DLocalSymtab::visit_gco_children(obj gc) noexcept + DLocalSymtab::visit_gco_children(VisitReason reason, + obj gc) noexcept { - gc.visit_child(&parent_); - gc.visit_child(&vars_); - gc.visit_child(&types_); + gc.visit_child(reason, &parent_); + gc.visit_child(reason, &vars_); + gc.visit_child(reason, &types_); } // ----- printable facet ----- diff --git a/xo-expression2/src/expression2/DSequenceExpr.cpp b/xo-expression2/src/expression2/DSequenceExpr.cpp index a180a5fb..8fdfcf9b 100644 --- a/xo-expression2/src/expression2/DSequenceExpr.cpp +++ b/xo-expression2/src/expression2/DSequenceExpr.cpp @@ -120,11 +120,11 @@ namespace xo { } void - DSequenceExpr::visit_gco_children(obj gc) noexcept + DSequenceExpr::visit_gco_children(VisitReason reason, obj gc) noexcept { - typeref_.visit_gco_children(gc); + typeref_.visit_gco_children(reason, gc); - gc.visit_child(&expr_v_); + gc.visit_child(reason, &expr_v_); } } /*namespace scm*/ diff --git a/xo-expression2/src/expression2/DTypename.cpp b/xo-expression2/src/expression2/DTypename.cpp index da73f28f..c8debab9 100644 --- a/xo-expression2/src/expression2/DTypename.cpp +++ b/xo-expression2/src/expression2/DTypename.cpp @@ -47,15 +47,11 @@ namespace xo { } void - DTypename::visit_gco_children(obj gc) noexcept + DTypename::visit_gco_children(VisitReason reason, + obj gc) noexcept { - gc.visit_child(&name_); - //gc.forward_inplace(const_cast(&name_)); - { - gc.visit_poly_child(&type_); - //auto e = type_.to_facet(); - //gc.forward_inplace(e.iface(), (void **)&(type_.data_)); - } + gc.visit_child(reason, &name_); + gc.visit_poly_child(reason, &type_); } bool diff --git a/xo-expression2/src/expression2/DVarRef.cpp b/xo-expression2/src/expression2/DVarRef.cpp index 57a39153..b73efe10 100644 --- a/xo-expression2/src/expression2/DVarRef.cpp +++ b/xo-expression2/src/expression2/DVarRef.cpp @@ -65,9 +65,10 @@ namespace xo { } void - DVarRef::visit_gco_children(obj gc) noexcept + DVarRef::visit_gco_children(VisitReason reason, + obj gc) noexcept { - gc.visit_child(&vardef_); + gc.visit_child(reason, &vardef_); //auto iface = xo::facet::impl_for(); //gc.forward_inplace(&iface, (void **)vardef_.data_); diff --git a/xo-expression2/src/expression2/DVariable.cpp b/xo-expression2/src/expression2/DVariable.cpp index 209764cd..066aeb50 100644 --- a/xo-expression2/src/expression2/DVariable.cpp +++ b/xo-expression2/src/expression2/DVariable.cpp @@ -9,7 +9,6 @@ #include namespace xo { - using xo::mm::ACollector; using xo::facet::typeseq; namespace scm { @@ -45,9 +44,9 @@ namespace xo { } void - DVariable::visit_gco_children(obj gc) noexcept + DVariable::visit_gco_children(VisitReason reason, obj gc) noexcept { - typeref_.visit_gco_children(gc); + typeref_.visit_gco_children(reason, gc); } bool diff --git a/xo-expression2/src/expression2/IGCObject_DApplyExpr.cpp b/xo-expression2/src/expression2/IGCObject_DApplyExpr.cpp index d2574d64..610b675b 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.gco_shallow_move(gc); } auto - IGCObject_DApplyExpr::visit_gco_children(DApplyExpr & self, obj fn) noexcept -> void + IGCObject_DApplyExpr::visit_gco_children(DApplyExpr & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, fn); } } /*namespace scm*/ diff --git a/xo-expression2/src/expression2/IGCObject_DConstant.cpp b/xo-expression2/src/expression2/IGCObject_DConstant.cpp index be6f583d..20c71341 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.gco_shallow_move(gc); } auto - IGCObject_DConstant::visit_gco_children(DConstant & self, obj fn) noexcept -> void + IGCObject_DConstant::visit_gco_children(DConstant & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, fn); } } /*namespace scm*/ diff --git a/xo-expression2/src/expression2/IGCObject_DDefineExpr.cpp b/xo-expression2/src/expression2/IGCObject_DDefineExpr.cpp index f2ea0747..8540ab25 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.gco_shallow_move(gc); } auto - IGCObject_DDefineExpr::visit_gco_children(DDefineExpr & self, obj fn) noexcept -> void + IGCObject_DDefineExpr::visit_gco_children(DDefineExpr & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, fn); } } /*namespace scm*/ diff --git a/xo-expression2/src/expression2/IGCObject_DGlobalSymtab.cpp b/xo-expression2/src/expression2/IGCObject_DGlobalSymtab.cpp index 3070a26c..01153218 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.gco_shallow_move(gc); } auto - IGCObject_DGlobalSymtab::visit_gco_children(DGlobalSymtab & self, obj fn) noexcept -> void + IGCObject_DGlobalSymtab::visit_gco_children(DGlobalSymtab & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, fn); } } /*namespace scm*/ diff --git a/xo-expression2/src/expression2/IGCObject_DIfElseExpr.cpp b/xo-expression2/src/expression2/IGCObject_DIfElseExpr.cpp index 6f788e03..22878fea 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.gco_shallow_move(gc); } auto - IGCObject_DIfElseExpr::visit_gco_children(DIfElseExpr & self, obj fn) noexcept -> void + IGCObject_DIfElseExpr::visit_gco_children(DIfElseExpr & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, fn); } } /*namespace scm*/ diff --git a/xo-expression2/src/expression2/IGCObject_DLambdaExpr.cpp b/xo-expression2/src/expression2/IGCObject_DLambdaExpr.cpp index b4706c56..05bd85a0 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.gco_shallow_move(gc); } auto - IGCObject_DLambdaExpr::visit_gco_children(DLambdaExpr & self, obj fn) noexcept -> void + IGCObject_DLambdaExpr::visit_gco_children(DLambdaExpr & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, fn); } } /*namespace scm*/ diff --git a/xo-expression2/src/expression2/IGCObject_DLocalSymtab.cpp b/xo-expression2/src/expression2/IGCObject_DLocalSymtab.cpp index 5e37d826..7ccadca0 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.gco_shallow_move(gc); } auto - IGCObject_DLocalSymtab::visit_gco_children(DLocalSymtab & self, obj fn) noexcept -> void + IGCObject_DLocalSymtab::visit_gco_children(DLocalSymtab & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, fn); } } /*namespace scm*/ diff --git a/xo-expression2/src/expression2/IGCObject_DSequenceExpr.cpp b/xo-expression2/src/expression2/IGCObject_DSequenceExpr.cpp index 1f92c2e2..0cc84faa 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.gco_shallow_move(gc); } auto - IGCObject_DSequenceExpr::visit_gco_children(DSequenceExpr & self, obj fn) noexcept -> void + IGCObject_DSequenceExpr::visit_gco_children(DSequenceExpr & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, fn); } } /*namespace scm*/ diff --git a/xo-expression2/src/expression2/IGCObject_DTypename.cpp b/xo-expression2/src/expression2/IGCObject_DTypename.cpp index ca21870a..accbfc6e 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.gco_shallow_move(gc); } auto - IGCObject_DTypename::visit_gco_children(DTypename & self, obj fn) noexcept -> void + IGCObject_DTypename::visit_gco_children(DTypename & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, fn); } } /*namespace scm*/ diff --git a/xo-expression2/src/expression2/IGCObject_DVarRef.cpp b/xo-expression2/src/expression2/IGCObject_DVarRef.cpp index 68d6e1d2..e169c37f 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.gco_shallow_move(gc); } auto - IGCObject_DVarRef::visit_gco_children(DVarRef & self, obj fn) noexcept -> void + IGCObject_DVarRef::visit_gco_children(DVarRef & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, fn); } } /*namespace scm*/ diff --git a/xo-expression2/src/expression2/TypeRef.cpp b/xo-expression2/src/expression2/TypeRef.cpp index 961ae148..e3178b7f 100644 --- a/xo-expression2/src/expression2/TypeRef.cpp +++ b/xo-expression2/src/expression2/TypeRef.cpp @@ -102,11 +102,10 @@ namespace xo { } void - TypeRef::visit_gco_children(obj gc) noexcept + TypeRef::visit_gco_children(VisitReason reason, + obj gc) noexcept { - //scope log(XO_DEBUG(true), xtag("type", type_.data()), xtag("type.tseq", type_._typeseq())); - - gc.visit_poly_child(&type_); + gc.visit_poly_child(reason, &type_); } bool diff --git a/xo-expression2/src/expression2/facet/IGCObject_DVariable.cpp b/xo-expression2/src/expression2/facet/IGCObject_DVariable.cpp index 0a91bfb2..8734ca7a 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.gco_shallow_move(gc); } auto - IGCObject_DVariable::visit_gco_children(DVariable & self, obj fn) noexcept -> void + IGCObject_DVariable::visit_gco_children(DVariable & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, fn); } } /*namespace scm*/ diff --git a/xo-gc/include/xo/gc/DX1Collector.hpp b/xo-gc/include/xo/gc/DX1Collector.hpp index 5eafa802..98fc254b 100644 --- a/xo-gc/include/xo/gc/DX1Collector.hpp +++ b/xo-gc/include/xo/gc/DX1Collector.hpp @@ -274,20 +274,13 @@ namespace xo { /** Execute gc immediately, for all generations < @p upto **/ void execute_gc(Generation upto) noexcept; -#ifdef OBSOLETE // replaced by visit_child() - /** Evacuate object at @p *lhs_data to to-space. - * Replace original with forwarding pointer to new location - **/ - void forward_inplace(AGCObject * lhs_iface, void ** lhs_data); -#endif - /** Supports GCObjectVisitor facet. - * During gc phase: + * During gc phase (@p reason is 'forward') * 1. evacuate object at @p *lhs_data to to-space. * 2. replace @p *lhs_data with forwarding pointer * to new location. **/ - void visit_child(AGCObject * lhs_iface, void ** lhs_data); + void visit_child(VisitReason reason, AGCObject * lhs_iface, void ** lhs_data); // ----- allocation ----- diff --git a/xo-gc/include/xo/gc/detail/IGCObjectVisitor_DX1Collector.hpp b/xo-gc/include/xo/gc/detail/IGCObjectVisitor_DX1Collector.hpp index 95534db6..5c18c8eb 100644 --- a/xo-gc/include/xo/gc/detail/IGCObjectVisitor_DX1Collector.hpp +++ b/xo-gc/include/xo/gc/detail/IGCObjectVisitor_DX1Collector.hpp @@ -58,7 +58,7 @@ Source must be owned by this collector. Increments object age **/ static void * alloc_copy(DX1Collector & self, std::byte * src); /** visit child of a gc-aware object. May update child in-place! **/ - static void visit_child(DX1Collector & self, AGCObject * iface, void ** pp_data) noexcept; + static void visit_child(DX1Collector & self, VisitReason reason, AGCObject * iface, void ** pp_data) noexcept; ///@} }; diff --git a/xo-gc/src/gc/DX1Collector.cpp b/xo-gc/src/gc/DX1Collector.cpp index 1faebdc1..63b6ef57 100644 --- a/xo-gc/src/gc/DX1Collector.cpp +++ b/xo-gc/src/gc/DX1Collector.cpp @@ -404,7 +404,7 @@ namespace xo { // - X1Collector::forward_inplace() -> _verify_aux() // - gco.visit_gco_children(self); + gco.visit_gco_children(VisitReason::verify(), self); } @@ -585,21 +585,28 @@ namespace xo { } void - DX1Collector::visit_child(AGCObject * lhs_iface, + DX1Collector::visit_child(VisitReason reason, + AGCObject * lhs_iface, void ** lhs_data) { // MAYBE: adapter distinct from DX1Collector that supports GCObjectVisitor facet, // calls DX1Collector::_verify_aux() - if (runstate_.is_running()) { + switch (reason.code()) { + case VisitReason::code::forward: + { Generation upto = runstate_.gc_upto(); // called during collection phase - gco_store_.forward_inplace_aux(this->ref(), lhs_iface, lhs_data, upto); - } else if (runstate_.is_verify()) { + gco_store_.forward_inplace_aux + (this->ref(), lhs_iface, lhs_data, upto); + break; + } + case VisitReason::code::verify: // called during verify_ok this->_verify_aux(lhs_iface, *lhs_data); - } else { + break; + default: // should be unreachable assert(false); } diff --git a/xo-gc/src/gc/GCObjectStore.cpp b/xo-gc/src/gc/GCObjectStore.cpp index 9ff067da..1f54a4c9 100644 --- a/xo-gc/src/gc/GCObjectStore.cpp +++ b/xo-gc/src/gc/GCObjectStore.cpp @@ -501,7 +501,7 @@ namespace xo { log && log("disposition: not in from-space. Don't forward, but check children"); obj gco(lhs_iface, object_data); - gco.visit_gco_children(gc); + gco.visit_gco_children(VisitReason::forward(), gc); return; } @@ -714,7 +714,7 @@ namespace xo { // Nested control reenters // X1Collector::forward_inplace() -> _verify_aux() // - gco.visit_gco_children(gc); + gco.visit_gco_children(VisitReason::forward(), gc); } else { ++(p_verify_stats->n_no_iface_); continue; @@ -783,7 +783,7 @@ namespace xo { GCMoveCheckpoint gray_lo_v = this->snap_move_checkpoint(upto); - from_src.visit_gco_children(gc); + from_src.visit_gco_children(VisitReason::forward(), gc); // For each generation g: // traverse objects newer than gray_lo_v[g], to make sure children @@ -1013,7 +1013,7 @@ namespace xo { assert(iface->_has_null_vptr() == false); - iface->visit_gco_children(src, gc); + iface->visit_gco_children(src, VisitReason::forward(), gc); gray_lo_v[g] = ((std::byte *)src) + z; diff --git a/xo-gc/src/gc/facet/IGCObjectVisitor_DX1Collector.cpp b/xo-gc/src/gc/facet/IGCObjectVisitor_DX1Collector.cpp index 7a00a1f7..17f364ed 100644 --- a/xo-gc/src/gc/facet/IGCObjectVisitor_DX1Collector.cpp +++ b/xo-gc/src/gc/facet/IGCObjectVisitor_DX1Collector.cpp @@ -33,9 +33,9 @@ namespace xo { return self.alloc_copy(src); } auto - IGCObjectVisitor_DX1Collector::visit_child(DX1Collector & self, AGCObject * iface, void ** pp_data) noexcept -> void + IGCObjectVisitor_DX1Collector::visit_child(DX1Collector & self, VisitReason reason, AGCObject * iface, void ** pp_data) noexcept -> void { - self.visit_child(iface, pp_data); + self.visit_child(reason, iface, pp_data); } } /*namespace mm*/ diff --git a/xo-gc/utest/DMockCollector.cpp b/xo-gc/utest/DMockCollector.cpp index 69f90508..6b6e9204 100644 --- a/xo-gc/utest/DMockCollector.cpp +++ b/xo-gc/utest/DMockCollector.cpp @@ -21,9 +21,12 @@ namespace xo { } void - DMockCollector::visit_child(AGCObject * lhs_iface, void ** lhs_data) + DMockCollector::visit_child(VisitReason reason, AGCObject * lhs_iface, void ** lhs_data) { - p_gco_store_->forward_inplace_aux(this->ref(), lhs_iface, lhs_data, upto_); + (void)reason; + + p_gco_store_->forward_inplace_aux + (this->ref(), lhs_iface, lhs_data, upto_); } std::byte * diff --git a/xo-gc/utest/DMockCollector.hpp b/xo-gc/utest/DMockCollector.hpp index ca1c0dfb..3297f8fa 100644 --- a/xo-gc/utest/DMockCollector.hpp +++ b/xo-gc/utest/DMockCollector.hpp @@ -26,7 +26,7 @@ namespace xo { Generation generation_of(Role r, const void * addr) const noexcept; AllocInfo alloc_info(void * mem) const noexcept; - void visit_child(AGCObject * lhs_iface, void ** lhs_data); + void visit_child(VisitReason reason, AGCObject * lhs_iface, void ** lhs_data); std::byte * alloc_copy(void * src) noexcept; private: diff --git a/xo-gc/utest/GCObjectStore.test.cpp b/xo-gc/utest/GCObjectStore.test.cpp index 552ad28f..75766563 100644 --- a/xo-gc/utest/GCObjectStore.test.cpp +++ b/xo-gc/utest/GCObjectStore.test.cpp @@ -295,9 +295,10 @@ namespace ut { * 2. arena2 doesn't have concept of installed types. * It doesn't have or require any builtin ability to traverse an object model **/ - DArena arena2 = DArena::map(ArenaConfig().with_name("arena2-reference") - .with_size(tc.gc_size_ * tc.n_gen_) - .with_store_header_flag(true)); + DArena arena2 + = DArena::map(ArenaConfig().with_name("arena2-reference") + .with_size(tc.gc_size_ * tc.n_gen_) + .with_store_header_flag(true)); // object type storage will be empty unless we install a type. GCObjectStore gcos(gcos_config); @@ -325,7 +326,7 @@ namespace ut { } } - // verify basic arena partitioning + // verify basic arena partitioning + sizing { REQUIRE(g0 != g1); REQUIRE(gcos.new_space()); @@ -371,7 +372,7 @@ namespace ut { } } - // allocator + // allocator api auto alloc = obj(gcos.new_space()); // create object(s). @@ -420,6 +421,7 @@ namespace ut { REQUIRE(gcos.header2size(obj_info.header()) == obj_info.size()); REQUIRE(gcos.header2age(obj_info.header()) == object_age{0}); REQUIRE(gcos.header2tseq(obj_info.header()) == obj_info.tseq()); + REQUIRE(gcos.is_forwarding_header(obj_info.header()) == false); } // new objects appear in to-space for generation 0 @@ -441,6 +443,7 @@ namespace ut { for (size_t i = 0, n = x1_v.size(); i < n; ++i) { const auto & x1 = x1_v.at(i); + REQUIRE(gcos.contains(Role::from_space(), x1.gco_.data())); REQUIRE(gcos.contains_allocated(Role::from_space(), x1.gco_.data())); AllocInfo obj_info = gcos.alloc_info((std::byte *)x1.gco_.data()); REQUIRE(obj_info.size() >= x1.alloc_z_); @@ -578,7 +581,8 @@ namespace ut { // can still try to move something. // but will fail since type isn't registered - auto x1p_data = gcos.deep_move_root(mock_gc_visitor, x1.gco_, g1); + auto x1p_data + = gcos.deep_move_root(mock_gc_visitor, x1.gco_, g1); // control here under normal GC use // would represent a configuration fail @@ -590,10 +594,23 @@ namespace ut { // Things to test: // - deep_move_interior() // used from MutationLogStore // - forward_inplace_aux() // used from DX1Collector.visit_child - // - cleanup_phase() // used from DX1Collector._cleanup_phase // - report_object_types + // - report_object_ages() + bool sanitize_flag = true; + + // swaps to- and from- spaces again + // Now from-space will be empty, all live objects in to-space + + gcos.cleanup_phase(g1, sanitize_flag); + +#ifdef NOT_YET + gcos.verify_ok(xxx objectvisitor, + xxx &verify_stats); +#endif + + // - verify_ok } } diff --git a/xo-gc/utest/IGCObjectVisitor_DMockCollector.cpp b/xo-gc/utest/IGCObjectVisitor_DMockCollector.cpp index f4472874..34a0c155 100644 --- a/xo-gc/utest/IGCObjectVisitor_DMockCollector.cpp +++ b/xo-gc/utest/IGCObjectVisitor_DMockCollector.cpp @@ -33,9 +33,9 @@ namespace xo { return self.alloc_copy(src); } auto - IGCObjectVisitor_DMockCollector::visit_child(DMockCollector & self, AGCObject * iface, void ** pp_data) noexcept -> void + IGCObjectVisitor_DMockCollector::visit_child(DMockCollector & self, VisitReason reason, AGCObject * iface, void ** pp_data) noexcept -> void { - self.visit_child(iface, pp_data); + self.visit_child(reason, iface, pp_data); } } /*namespace mm*/ diff --git a/xo-gc/utest/IGCObjectVisitor_DMockCollector.hpp b/xo-gc/utest/IGCObjectVisitor_DMockCollector.hpp index ac9db2bb..359972ba 100644 --- a/xo-gc/utest/IGCObjectVisitor_DMockCollector.hpp +++ b/xo-gc/utest/IGCObjectVisitor_DMockCollector.hpp @@ -58,7 +58,7 @@ Source must be owned by this collector. Increments object age **/ static void * alloc_copy(DMockCollector & self, std::byte * src); /** visit child of a gc-aware object. May update child in-place! **/ - static void visit_child(DMockCollector & self, AGCObject * iface, void ** pp_data) noexcept; + static void visit_child(DMockCollector & self, VisitReason reason, AGCObject * iface, void ** pp_data) noexcept; ///@} }; diff --git a/xo-interpreter2/include/xo/interpreter2/DClosure.hpp b/xo-interpreter2/include/xo/interpreter2/DClosure.hpp index 8472cfc5..8462d412 100644 --- a/xo-interpreter2/include/xo/interpreter2/DClosure.hpp +++ b/xo-interpreter2/include/xo/interpreter2/DClosure.hpp @@ -19,9 +19,9 @@ namespace xo { class DClosure { public: using ARuntimeContext = xo::scm::ARuntimeContext; - //using ACollector = xo::mm::ACollector; using AGCObject = xo::mm::AGCObject; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using AAllocator = xo::mm::AAllocator; using ppindentinfo = xo::print::ppindentinfo; using size_type = std::int32_t; @@ -59,7 +59,7 @@ namespace xo { ///@{ DClosure * gco_shallow_move(obj gc) noexcept; - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, 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 e60727b0..4cbe3f7d 100644 --- a/xo-interpreter2/include/xo/interpreter2/DLocalEnv.hpp +++ b/xo-interpreter2/include/xo/interpreter2/DLocalEnv.hpp @@ -16,9 +16,9 @@ namespace xo { class DLocalEnv { public: using DArray = xo::scm::DArray; - //using ACollector = xo::mm::ACollector; using AGCObject = xo::mm::AGCObject; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using AAllocator = xo::mm::AAllocator; using ppindentinfo = xo::print::ppindentinfo; using size_type = std::uint32_t; @@ -56,7 +56,7 @@ namespace xo { ///@{ DLocalEnv * gco_shallow_move(obj gc) noexcept; - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, 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 66cbf81a..b13ed03a 100644 --- a/xo-interpreter2/include/xo/interpreter2/DVsmApplyClosureFrame.hpp +++ b/xo-interpreter2/include/xo/interpreter2/DVsmApplyClosureFrame.hpp @@ -21,6 +21,7 @@ namespace xo { using ACollector = xo::mm::ACollector; using AGCObject = xo::mm::AGCObject; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using AAllocator = xo::mm::AAllocator; using ppindentinfo = xo::print::ppindentinfo; @@ -42,7 +43,7 @@ namespace xo { /** gcobject facet **/ std::size_t shallow_size() const noexcept; DVsmApplyClosureFrame * gco_shallow_move(obj gc) noexcept; - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, 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 60a572aa..147b4857 100644 --- a/xo-interpreter2/include/xo/interpreter2/DVsmApplyFrame.hpp +++ b/xo-interpreter2/include/xo/interpreter2/DVsmApplyFrame.hpp @@ -14,9 +14,9 @@ namespace xo { class DVsmApplyFrame { public: using AProcedure = xo::scm::AProcedure; - //using ACollector = xo::mm::ACollector; using AGCObject = xo::mm::AGCObject; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using AAllocator = xo::mm::AAllocator; using ppindentinfo = xo::print::ppindentinfo; @@ -39,7 +39,7 @@ namespace xo { void assign_fn(obj x) { this->fn_ = x; } DVsmApplyFrame * gco_shallow_move(obj gc) noexcept; - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, 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 79a9227c..3174a59f 100644 --- a/xo-interpreter2/include/xo/interpreter2/DVsmDefContFrame.hpp +++ b/xo-interpreter2/include/xo/interpreter2/DVsmDefContFrame.hpp @@ -15,8 +15,8 @@ namespace xo { **/ class DVsmDefContFrame { public: - //using ACollector = xo::mm::ACollector; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using AAllocator = xo::mm::AAllocator; using AGCObject = xo::mm::AGCObject; using ppindentinfo = xo::print::ppindentinfo; @@ -52,7 +52,7 @@ namespace xo { ///@{ DVsmDefContFrame * gco_shallow_move(obj gc) noexcept; - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, 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 34d74b9a..bc556a9e 100644 --- a/xo-interpreter2/include/xo/interpreter2/DVsmEvalArgsFrame.hpp +++ b/xo-interpreter2/include/xo/interpreter2/DVsmEvalArgsFrame.hpp @@ -14,9 +14,9 @@ namespace xo { /** frame for executing an apply expression **/ class DVsmEvalArgsFrame { public: - //using ACollector = xo::mm::ACollector; using AGCObject = xo::mm::AGCObject; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using AAllocator = xo::mm::AAllocator; using ppindentinfo = xo::print::ppindentinfo; @@ -44,7 +44,7 @@ namespace xo { int32_t increment_arg() { return ++i_arg_; } DVsmEvalArgsFrame * gco_shallow_move(obj gc) noexcept; - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, 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 4d3176dc..355e4214 100644 --- a/xo-interpreter2/include/xo/interpreter2/DVsmIfElseContFrame.hpp +++ b/xo-interpreter2/include/xo/interpreter2/DVsmIfElseContFrame.hpp @@ -15,9 +15,9 @@ namespace xo { **/ class DVsmIfElseContFrame { public: - //using ACollector = xo::mm::ACollector; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AGCObject = xo::mm::AGCObject; + using VisitReason = xo::mm::VisitReason; using AAllocator = xo::mm::AAllocator; using ppindentinfo = xo::print::ppindentinfo; @@ -52,7 +52,7 @@ namespace xo { ///@{ DVsmIfElseContFrame * gco_shallow_move(obj gc) noexcept; - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, 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 6b141cc6..f4412843 100644 --- a/xo-interpreter2/include/xo/interpreter2/DVsmSeqContFrame.hpp +++ b/xo-interpreter2/include/xo/interpreter2/DVsmSeqContFrame.hpp @@ -15,10 +15,10 @@ namespace xo { **/ class DVsmSeqContFrame { public: - //using ACollector = xo::mm::ACollector; - using AAllocator = xo::mm::AAllocator; using AGCObject = xo::mm::AGCObject; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; + using AAllocator = xo::mm::AAllocator; using ppindentinfo = xo::print::ppindentinfo; public: @@ -57,7 +57,7 @@ namespace xo { ///@{ DVsmSeqContFrame * gco_shallow_move(obj gc) noexcept; - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, 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 215515ac..972cbbbd 100644 --- a/xo-interpreter2/include/xo/interpreter2/define/IGCObject_DVsmDefContFrame.hpp +++ b/xo-interpreter2/include/xo/interpreter2/define/IGCObject_DVsmDefContFrame.hpp @@ -45,6 +45,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -59,7 +60,7 @@ Arguably abusing the word 'visitor' here **/ /** 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; + static void visit_gco_children(DVsmDefContFrame & self, VisitReason reason, 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 6e6058dd..e7326396 100644 --- a/xo-interpreter2/include/xo/interpreter2/detail/IGCObject_DClosure.hpp +++ b/xo-interpreter2/include/xo/interpreter2/detail/IGCObject_DClosure.hpp @@ -45,6 +45,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -59,7 +60,7 @@ Arguably abusing the word 'visitor' here **/ /** 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; + static void visit_gco_children(DClosure & self, VisitReason reason, 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 9a021127..1113a679 100644 --- a/xo-interpreter2/include/xo/interpreter2/detail/IGCObject_DVsmApplyClosureFrame.hpp +++ b/xo-interpreter2/include/xo/interpreter2/detail/IGCObject_DVsmApplyClosureFrame.hpp @@ -45,6 +45,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -59,7 +60,7 @@ Arguably abusing the word 'visitor' here **/ /** 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; + static void visit_gco_children(DVsmApplyClosureFrame & self, VisitReason reason, 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 2936f81e..469d3a0c 100644 --- a/xo-interpreter2/include/xo/interpreter2/detail/IGCObject_DVsmApplyFrame.hpp +++ b/xo-interpreter2/include/xo/interpreter2/detail/IGCObject_DVsmApplyFrame.hpp @@ -45,6 +45,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -59,7 +60,7 @@ Arguably abusing the word 'visitor' here **/ /** 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; + static void visit_gco_children(DVsmApplyFrame & self, VisitReason reason, 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 15a09267..0a3ce07f 100644 --- a/xo-interpreter2/include/xo/interpreter2/detail/IGCObject_DVsmEvalArgsFrame.hpp +++ b/xo-interpreter2/include/xo/interpreter2/detail/IGCObject_DVsmEvalArgsFrame.hpp @@ -45,6 +45,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -59,7 +60,7 @@ Arguably abusing the word 'visitor' here **/ /** 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; + static void visit_gco_children(DVsmEvalArgsFrame & self, VisitReason reason, 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 29484934..84207c36 100644 --- a/xo-interpreter2/include/xo/interpreter2/env/IGCObject_DLocalEnv.hpp +++ b/xo-interpreter2/include/xo/interpreter2/env/IGCObject_DLocalEnv.hpp @@ -45,6 +45,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -59,7 +60,7 @@ Arguably abusing the word 'visitor' here **/ /** 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; + static void visit_gco_children(DLocalEnv & self, VisitReason reason, 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 6812b6a0..ff3545a1 100644 --- a/xo-interpreter2/include/xo/interpreter2/ifelse/IGCObject_DVsmIfElseContFrame.hpp +++ b/xo-interpreter2/include/xo/interpreter2/ifelse/IGCObject_DVsmIfElseContFrame.hpp @@ -45,6 +45,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -59,7 +60,7 @@ Arguably abusing the word 'visitor' here **/ /** 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; + static void visit_gco_children(DVsmIfElseContFrame & self, VisitReason reason, 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 9b299d82..907e3fb2 100644 --- a/xo-interpreter2/include/xo/interpreter2/sequence/IGCObject_DVsmSeqContFrame.hpp +++ b/xo-interpreter2/include/xo/interpreter2/sequence/IGCObject_DVsmSeqContFrame.hpp @@ -45,6 +45,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -59,7 +60,7 @@ Arguably abusing the word 'visitor' here **/ /** 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; + static void visit_gco_children(DVsmSeqContFrame & self, VisitReason reason, obj fn) noexcept; ///@} }; diff --git a/xo-interpreter2/include/xo/interpreter2/vsm/DVirtualSchematikaMachine.hpp b/xo-interpreter2/include/xo/interpreter2/vsm/DVirtualSchematikaMachine.hpp index 1b386aaa..2902840c 100644 --- a/xo-interpreter2/include/xo/interpreter2/vsm/DVirtualSchematikaMachine.hpp +++ b/xo-interpreter2/include/xo/interpreter2/vsm/DVirtualSchematikaMachine.hpp @@ -71,9 +71,9 @@ namespace xo { public: // will be DArenaVector> probably using Stack = void *; - //using ACollector = xo::mm::ACollector; using AGCObject = xo::mm::AGCObject; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using AAllocator = xo::mm::AAllocator; using MemorySizeVisitor = xo::mm::MemorySizeVisitor; using span_type = xo::mm::span; @@ -158,7 +158,7 @@ namespace xo { /** forward gc-aware child pointers **/ - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, 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 c7d1d1f7..85faa8ee 100644 --- a/xo-interpreter2/include/xo/interpreter2/vsm/IGCObject_DVirtualSchematikaMachine.hpp +++ b/xo-interpreter2/include/xo/interpreter2/vsm/IGCObject_DVirtualSchematikaMachine.hpp @@ -45,6 +45,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -59,7 +60,7 @@ Arguably abusing the word 'visitor' here **/ /** 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; + static void visit_gco_children(DVirtualSchematikaMachine & self, VisitReason reason, obj fn) noexcept; ///@} }; diff --git a/xo-interpreter2/src/interpreter2/DClosure.cpp b/xo-interpreter2/src/interpreter2/DClosure.cpp index 684eb5d0..c7bb3140 100644 --- a/xo-interpreter2/src/interpreter2/DClosure.cpp +++ b/xo-interpreter2/src/interpreter2/DClosure.cpp @@ -70,10 +70,11 @@ namespace xo { } void - DClosure::visit_gco_children(obj gc) noexcept + DClosure::visit_gco_children(VisitReason reason, + obj gc) noexcept { - gc.visit_child(&lambda_); - gc.visit_child(&env_); + gc.visit_child(reason, &lambda_); + gc.visit_child(reason, &env_); } // ----- printable facet ----- diff --git a/xo-interpreter2/src/interpreter2/DLocalEnv.cpp b/xo-interpreter2/src/interpreter2/DLocalEnv.cpp index e0fe0e79..0e805d1b 100644 --- a/xo-interpreter2/src/interpreter2/DLocalEnv.cpp +++ b/xo-interpreter2/src/interpreter2/DLocalEnv.cpp @@ -97,23 +97,12 @@ namespace xo { } void - DLocalEnv::visit_gco_children(obj gc) noexcept + DLocalEnv::visit_gco_children(VisitReason reason, + obj gc) noexcept { - { - gc.visit_child(&parent_); - //auto iface = xo::facet::impl_for(); - //gc.forward_inplace(&iface, (void **)(&parent_)); - } - { - gc.visit_child(&symtab_); - //auto iface = xo::facet::impl_for(); - //gc.forward_inplace(&iface, (void **)(&symtab_)); - } - { - gc.visit_child(&args_); - //auto iface = xo::facet::impl_for(); - //gc.forward_inplace(&iface, (void **)(&args_)); - } + gc.visit_child(reason, &parent_); + gc.visit_child(reason, &symtab_); + gc.visit_child(reason, &args_); } // ----- printable facet ----- diff --git a/xo-interpreter2/src/interpreter2/DVirtualSchematikaMachine.cpp b/xo-interpreter2/src/interpreter2/DVirtualSchematikaMachine.cpp index 01c56698..c7e864c6 100644 --- a/xo-interpreter2/src/interpreter2/DVirtualSchematikaMachine.cpp +++ b/xo-interpreter2/src/interpreter2/DVirtualSchematikaMachine.cpp @@ -972,18 +972,19 @@ namespace xo { } void - DVirtualSchematikaMachine::visit_gco_children(obj gc) noexcept + DVirtualSchematikaMachine::visit_gco_children(VisitReason reason, + obj gc) noexcept { - reader_.visit_gco_children(gc); + reader_.visit_gco_children(reason, gc); - 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_); + gc.visit_child(reason, &stack_); + gc.visit_poly_child(reason, &expr_); + gc.visit_child(reason, &global_env_); + gc.visit_child(reason, &local_env_); + gc.visit_child(reason, &fn_); + gc.visit_child(reason, &args_); if (value_.is_value()) { - gc.visit_child(const_cast *>(&value_.value_ref())); + gc.visit_child(reason, const_cast *>(&value_.value_ref())); } } diff --git a/xo-interpreter2/src/interpreter2/DVsmApplyClosureFrame.cpp b/xo-interpreter2/src/interpreter2/DVsmApplyClosureFrame.cpp index dbb1601c..55199464 100644 --- a/xo-interpreter2/src/interpreter2/DVsmApplyClosureFrame.cpp +++ b/xo-interpreter2/src/interpreter2/DVsmApplyClosureFrame.cpp @@ -39,10 +39,11 @@ namespace xo { } void - DVsmApplyClosureFrame::visit_gco_children(obj gc) noexcept + DVsmApplyClosureFrame::visit_gco_children(VisitReason reason, + obj gc) noexcept { - gc.visit_child(&stack_); - gc.visit_child(&local_env_); + gc.visit_child(reason, &stack_); + gc.visit_child(reason, &local_env_); } bool diff --git a/xo-interpreter2/src/interpreter2/DVsmApplyFrame.cpp b/xo-interpreter2/src/interpreter2/DVsmApplyFrame.cpp index 19db4bdf..591d8aef 100644 --- a/xo-interpreter2/src/interpreter2/DVsmApplyFrame.cpp +++ b/xo-interpreter2/src/interpreter2/DVsmApplyFrame.cpp @@ -47,11 +47,12 @@ namespace xo { } void - DVsmApplyFrame::visit_gco_children(obj gc) noexcept + DVsmApplyFrame::visit_gco_children(VisitReason reason, + obj gc) noexcept { - gc.visit_child(&parent_); - gc.visit_child(&fn_); - gc.visit_child(&args_); + gc.visit_child(reason, &parent_); + gc.visit_child(reason, &fn_); + gc.visit_child(reason, &args_); } bool diff --git a/xo-interpreter2/src/interpreter2/DVsmDefContFrame.cpp b/xo-interpreter2/src/interpreter2/DVsmDefContFrame.cpp index 97b12ab0..d8c52d10 100644 --- a/xo-interpreter2/src/interpreter2/DVsmDefContFrame.cpp +++ b/xo-interpreter2/src/interpreter2/DVsmDefContFrame.cpp @@ -38,10 +38,11 @@ namespace xo { } void - DVsmDefContFrame::visit_gco_children(obj gc) noexcept + DVsmDefContFrame::visit_gco_children(VisitReason reason, + obj gc) noexcept { - gc.visit_child(&parent_); - gc.visit_child(&def_expr_); + gc.visit_child(reason, &parent_); + gc.visit_child(reason, &def_expr_); } // printable facet diff --git a/xo-interpreter2/src/interpreter2/DVsmEvalArgsFrame.cpp b/xo-interpreter2/src/interpreter2/DVsmEvalArgsFrame.cpp index 42d44de5..b4e3f448 100644 --- a/xo-interpreter2/src/interpreter2/DVsmEvalArgsFrame.cpp +++ b/xo-interpreter2/src/interpreter2/DVsmEvalArgsFrame.cpp @@ -48,10 +48,11 @@ namespace xo { } void - DVsmEvalArgsFrame::visit_gco_children(obj gc) noexcept + DVsmEvalArgsFrame::visit_gco_children(VisitReason reason, + obj gc) noexcept { - gc.visit_child(&parent_); - gc.visit_child(&apply_expr_); + gc.visit_child(reason, &parent_); + gc.visit_child(reason, &apply_expr_); } bool diff --git a/xo-interpreter2/src/interpreter2/DVsmIfElseContFrame.cpp b/xo-interpreter2/src/interpreter2/DVsmIfElseContFrame.cpp index a82206bc..f1f88952 100644 --- a/xo-interpreter2/src/interpreter2/DVsmIfElseContFrame.cpp +++ b/xo-interpreter2/src/interpreter2/DVsmIfElseContFrame.cpp @@ -36,10 +36,11 @@ namespace xo { } void - DVsmIfElseContFrame::visit_gco_children(obj gc) noexcept + DVsmIfElseContFrame::visit_gco_children(VisitReason reason, + obj gc) noexcept { - gc.visit_child(&parent_); - gc.visit_child(&ifelse_expr_); + gc.visit_child(reason, &parent_); + gc.visit_child(reason, &ifelse_expr_); } // printable facet diff --git a/xo-interpreter2/src/interpreter2/DVsmSeqContFrame.cpp b/xo-interpreter2/src/interpreter2/DVsmSeqContFrame.cpp index cb031b18..219342b5 100644 --- a/xo-interpreter2/src/interpreter2/DVsmSeqContFrame.cpp +++ b/xo-interpreter2/src/interpreter2/DVsmSeqContFrame.cpp @@ -39,10 +39,11 @@ namespace xo { } void - DVsmSeqContFrame::visit_gco_children(obj gc) noexcept + DVsmSeqContFrame::visit_gco_children(VisitReason reason, + obj gc) noexcept { - gc.visit_child(&parent_); - gc.visit_child(&seq_expr_); + gc.visit_child(reason, &parent_); + gc.visit_child(reason, &seq_expr_); } // printable facet diff --git a/xo-interpreter2/src/interpreter2/IGCObject_DClosure.cpp b/xo-interpreter2/src/interpreter2/IGCObject_DClosure.cpp index be0c9903..dc281fd4 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.gco_shallow_move(gc); } auto - IGCObject_DClosure::visit_gco_children(DClosure & self, obj fn) noexcept -> void + IGCObject_DClosure::visit_gco_children(DClosure & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, fn); } } /*namespace scm*/ diff --git a/xo-interpreter2/src/interpreter2/IGCObject_DVsmApplyClosureFrame.cpp b/xo-interpreter2/src/interpreter2/IGCObject_DVsmApplyClosureFrame.cpp index 5fcb724a..e080c301 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.gco_shallow_move(gc); } auto - IGCObject_DVsmApplyClosureFrame::visit_gco_children(DVsmApplyClosureFrame & self, obj fn) noexcept -> void + IGCObject_DVsmApplyClosureFrame::visit_gco_children(DVsmApplyClosureFrame & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, fn); } } /*namespace scm*/ diff --git a/xo-interpreter2/src/interpreter2/IGCObject_DVsmApplyFrame.cpp b/xo-interpreter2/src/interpreter2/IGCObject_DVsmApplyFrame.cpp index 4e8adef7..b0ce1838 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.gco_shallow_move(gc); } auto - IGCObject_DVsmApplyFrame::visit_gco_children(DVsmApplyFrame & self, obj fn) noexcept -> void + IGCObject_DVsmApplyFrame::visit_gco_children(DVsmApplyFrame & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, fn); } } /*namespace scm*/ diff --git a/xo-interpreter2/src/interpreter2/IGCObject_DVsmDefContFrame.cpp b/xo-interpreter2/src/interpreter2/IGCObject_DVsmDefContFrame.cpp index 60cb90d0..c0ed5412 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.gco_shallow_move(gc); } auto - IGCObject_DVsmDefContFrame::visit_gco_children(DVsmDefContFrame & self, obj fn) noexcept -> void + IGCObject_DVsmDefContFrame::visit_gco_children(DVsmDefContFrame & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, fn); } } /*namespace scm*/ diff --git a/xo-interpreter2/src/interpreter2/IGCObject_DVsmEvalArgsFrame.cpp b/xo-interpreter2/src/interpreter2/IGCObject_DVsmEvalArgsFrame.cpp index c9697c90..0db77058 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.gco_shallow_move(gc); } auto - IGCObject_DVsmEvalArgsFrame::visit_gco_children(DVsmEvalArgsFrame & self, obj fn) noexcept -> void + IGCObject_DVsmEvalArgsFrame::visit_gco_children(DVsmEvalArgsFrame & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, fn); } } /*namespace scm*/ diff --git a/xo-interpreter2/src/interpreter2/IGCObject_DVsmIfElseContFrame.cpp b/xo-interpreter2/src/interpreter2/IGCObject_DVsmIfElseContFrame.cpp index d8fa856d..3488e8c3 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.gco_shallow_move(gc); } auto - IGCObject_DVsmIfElseContFrame::visit_gco_children(DVsmIfElseContFrame & self, obj fn) noexcept -> void + IGCObject_DVsmIfElseContFrame::visit_gco_children(DVsmIfElseContFrame & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, fn); } } /*namespace scm*/ diff --git a/xo-interpreter2/src/interpreter2/IGCObject_DVsmSeqContFrame.cpp b/xo-interpreter2/src/interpreter2/IGCObject_DVsmSeqContFrame.cpp index aa004bce..5293306f 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.gco_shallow_move(gc); } auto - IGCObject_DVsmSeqContFrame::visit_gco_children(DVsmSeqContFrame & self, obj fn) noexcept -> void + IGCObject_DVsmSeqContFrame::visit_gco_children(DVsmSeqContFrame & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, fn); } } /*namespace scm*/ diff --git a/xo-interpreter2/src/interpreter2/facet/IGCObject_DLocalEnv.cpp b/xo-interpreter2/src/interpreter2/facet/IGCObject_DLocalEnv.cpp index eb107a81..f086b07a 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.gco_shallow_move(gc); } auto - IGCObject_DLocalEnv::visit_gco_children(DLocalEnv & self, obj fn) noexcept -> void + IGCObject_DLocalEnv::visit_gco_children(DLocalEnv & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, fn); } } /*namespace scm*/ diff --git a/xo-interpreter2/src/interpreter2/facet/IGCObject_DVirtualSchematikaMachine.cpp b/xo-interpreter2/src/interpreter2/facet/IGCObject_DVirtualSchematikaMachine.cpp index c894ec35..4b9d83bb 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.gco_shallow_move(gc); } auto - IGCObject_DVirtualSchematikaMachine::visit_gco_children(DVirtualSchematikaMachine & self, obj fn) noexcept -> void + IGCObject_DVirtualSchematikaMachine::visit_gco_children(DVirtualSchematikaMachine & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, fn); } } /*namespace scm*/ diff --git a/xo-object2/include/xo/object2/DArray.hpp b/xo-object2/include/xo/object2/DArray.hpp index cd2bab29..27b0961d 100644 --- a/xo-object2/include/xo/object2/DArray.hpp +++ b/xo-object2/include/xo/object2/DArray.hpp @@ -38,6 +38,8 @@ namespace xo { using AGCObject = xo::mm::AGCObject; /** gc-centric object visitor **/ using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + /** hint for object visitor **/ + using VisitReason = xo::mm::VisitReason; /** pretty-printer state for APrintable **/ using ppindentinfo = xo::print::ppindentinfo; @@ -150,7 +152,7 @@ namespace xo { /** move to new address, mandated by @p gc **/ DArray * gco_shallow_move(obj gc) noexcept; /** forward elements to @p gc to-space; replace originals with forarding pointers **/ - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, obj gc) noexcept; ///@} private: diff --git a/xo-object2/include/xo/object2/DBoolean.hpp b/xo-object2/include/xo/object2/DBoolean.hpp index 53ee4b88..904503c3 100644 --- a/xo-object2/include/xo/object2/DBoolean.hpp +++ b/xo-object2/include/xo/object2/DBoolean.hpp @@ -19,6 +19,7 @@ namespace xo { //using ACollector = xo::mm::ACollector; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AGCObject = xo::mm::AGCObject; + using VisitReason = xo::mm::VisitReason; using ppindentinfo = xo::print::ppindentinfo; using value_type = long; @@ -40,7 +41,7 @@ namespace xo { // GCObject facet DBoolean * gco_shallow_move(obj gc) noexcept; - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, 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 cda1d6f7..beda6600 100644 --- a/xo-object2/include/xo/object2/DDictionary.hpp +++ b/xo-object2/include/xo/object2/DDictionary.hpp @@ -40,6 +40,8 @@ namespace xo { using AGCObjectVisitor = xo::mm::AGCObjectVisitor; /** gc-aware object facet **/ using AGCObject = xo::mm::AGCObject; + /** color for gco visitor **/ + using VisitReason = xo::mm::VisitReason; /** pretty-printer state for APrintable **/ using ppindentinfo = xo::print::ppindentinfo; /** canonical type representing a key-value pair **/ @@ -206,7 +208,7 @@ namespace xo { /** return shallow copy of this array, using memory from @p mm **/ DDictionary * gco_shallow_move(obj gc) noexcept; /** forward elements to @p gc to-space; replace originals with forwarding pointers **/ - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, obj gc) noexcept; ///@} private: diff --git a/xo-object2/include/xo/object2/DFloat.hpp b/xo-object2/include/xo/object2/DFloat.hpp index edd4f1ec..54ffe41f 100644 --- a/xo-object2/include/xo/object2/DFloat.hpp +++ b/xo-object2/include/xo/object2/DFloat.hpp @@ -6,7 +6,6 @@ #pragma once #include -//#include #include #include #include @@ -15,8 +14,8 @@ namespace xo { namespace scm { struct DFloat { using AAllocator = xo::mm::AAllocator; - //using ACollector = xo::mm::ACollector; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using ppindentinfo = xo::print::ppindentinfo; using value_type = double; @@ -37,7 +36,7 @@ namespace xo { // GCObject facet DFloat * gco_shallow_move(obj gc) noexcept; - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, obj gc) noexcept; private: diff --git a/xo-object2/include/xo/object2/DInteger.hpp b/xo-object2/include/xo/object2/DInteger.hpp index d82d9890..ddcd9ba1 100644 --- a/xo-object2/include/xo/object2/DInteger.hpp +++ b/xo-object2/include/xo/object2/DInteger.hpp @@ -19,6 +19,7 @@ namespace xo { //using ACollector = xo::mm::ACollector; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AGCObject = xo::mm::AGCObject; + using VisitReason = xo::mm::VisitReason; using ppindentinfo = xo::print::ppindentinfo; using value_type = long; @@ -42,7 +43,7 @@ namespace xo { // GCObject facet DInteger * gco_shallow_move(obj gc) noexcept; - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, 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 c61b2978..608f82b4 100644 --- a/xo-object2/include/xo/object2/DList.hpp +++ b/xo-object2/include/xo/object2/DList.hpp @@ -22,6 +22,7 @@ namespace xo { using AAllocator = xo::mm::AAllocator; using ACollector = xo::mm::ACollector; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using ppindentinfo = xo::print::ppindentinfo; public: @@ -75,7 +76,7 @@ namespace xo { /** @defgroup xo-scm-list-gcobject-facet gcobject facet **/ ///@{ DList * gco_shallow_move(obj gc) noexcept; - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, 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 43fe4a03..e65b2883 100644 --- a/xo-object2/include/xo/object2/DRuntimeError.hpp +++ b/xo-object2/include/xo/object2/DRuntimeError.hpp @@ -19,6 +19,7 @@ namespace xo { using AGCObject = xo::mm::AGCObject; //using ACollector = xo::mm::ACollector; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using AAllocator = xo::mm::AAllocator; using ppindentinfo = xo::print::ppindentinfo; @@ -51,7 +52,7 @@ namespace xo { ///@{ DRuntimeError * gco_shallow_move(obj gc) noexcept; - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, 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 75399cf3..4cd5f026 100644 --- a/xo-object2/include/xo/object2/array/IGCObject_DArray.hpp +++ b/xo-object2/include/xo/object2/array/IGCObject_DArray.hpp @@ -43,6 +43,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -57,7 +58,7 @@ Arguably abusing the word 'visitor' here **/ /** 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; + static void visit_gco_children(DArray & self, VisitReason reason, 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 30fc70fe..8ab00b09 100644 --- a/xo-object2/include/xo/object2/boolean/IGCObject_DBoolean.hpp +++ b/xo-object2/include/xo/object2/boolean/IGCObject_DBoolean.hpp @@ -43,6 +43,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -57,7 +58,7 @@ Arguably abusing the word 'visitor' here **/ /** 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; + static void visit_gco_children(DBoolean & self, VisitReason reason, 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 5d45179b..52d093bb 100644 --- a/xo-object2/include/xo/object2/dictionary/IGCObject_DDictionary.hpp +++ b/xo-object2/include/xo/object2/dictionary/IGCObject_DDictionary.hpp @@ -43,6 +43,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -57,7 +58,7 @@ Arguably abusing the word 'visitor' here **/ /** 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; + static void visit_gco_children(DDictionary & self, VisitReason reason, 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 a0039ad9..19e378b4 100644 --- a/xo-object2/include/xo/object2/error/IGCObject_DRuntimeError.hpp +++ b/xo-object2/include/xo/object2/error/IGCObject_DRuntimeError.hpp @@ -43,6 +43,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -57,7 +58,7 @@ Arguably abusing the word 'visitor' here **/ /** 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; + static void visit_gco_children(DRuntimeError & self, VisitReason reason, 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 4002106e..10463fef 100644 --- a/xo-object2/include/xo/object2/list/IGCObject_DList.hpp +++ b/xo-object2/include/xo/object2/list/IGCObject_DList.hpp @@ -43,6 +43,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -57,7 +58,7 @@ Arguably abusing the word 'visitor' here **/ /** 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; + static void visit_gco_children(DList & self, VisitReason reason, 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 eb50bb37..0d9042f6 100644 --- a/xo-object2/include/xo/object2/number/IGCObject_DFloat.hpp +++ b/xo-object2/include/xo/object2/number/IGCObject_DFloat.hpp @@ -44,6 +44,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -58,7 +59,7 @@ Arguably abusing the word 'visitor' here **/ /** 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; + static void visit_gco_children(DFloat & self, VisitReason reason, 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 fece77f5..5d6d944f 100644 --- a/xo-object2/include/xo/object2/number/IGCObject_DInteger.hpp +++ b/xo-object2/include/xo/object2/number/IGCObject_DInteger.hpp @@ -43,6 +43,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -57,7 +58,7 @@ Arguably abusing the word 'visitor' here **/ /** 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; + static void visit_gco_children(DInteger & self, VisitReason reason, obj fn) noexcept; ///@} }; diff --git a/xo-object2/src/object2/DArray.cpp b/xo-object2/src/object2/DArray.cpp index f6c16b79..c6e83ee6 100644 --- a/xo-object2/src/object2/DArray.cpp +++ b/xo-object2/src/object2/DArray.cpp @@ -198,16 +198,12 @@ namespace xo { } void - DArray::visit_gco_children(obj gc) noexcept + DArray::visit_gco_children(VisitReason reason, obj gc) noexcept { - scope log(XO_DEBUG(false)); - for (size_type i = 0; i < size_; ++i) { - log && log("DArray::visit_gco_children (loop)", xtag("i", i), xtag("z", size_)); - obj & elt = elts_[i]; - gc.visit_child(&elt); + gc.visit_child(reason, &elt); } } diff --git a/xo-object2/src/object2/DBoolean.cpp b/xo-object2/src/object2/DBoolean.cpp index 5d2de407..2e0bafa8 100644 --- a/xo-object2/src/object2/DBoolean.cpp +++ b/xo-object2/src/object2/DBoolean.cpp @@ -36,7 +36,7 @@ namespace xo { } void - DBoolean::visit_gco_children(obj) noexcept + DBoolean::visit_gco_children(VisitReason, obj) noexcept { // no-op. childless } diff --git a/xo-object2/src/object2/DDictionary.cpp b/xo-object2/src/object2/DDictionary.cpp index f7806b6a..7d838dd8 100644 --- a/xo-object2/src/object2/DDictionary.cpp +++ b/xo-object2/src/object2/DDictionary.cpp @@ -274,10 +274,10 @@ namespace xo { } void - DDictionary::visit_gco_children(obj gc) noexcept + DDictionary::visit_gco_children(VisitReason reason, obj gc) noexcept { - gc.visit_child(&keys_); - gc.visit_child(&values_); + gc.visit_child(reason, &keys_); + gc.visit_child(reason, &values_); } } /*namespace scm*/ diff --git a/xo-object2/src/object2/DFloat.cpp b/xo-object2/src/object2/DFloat.cpp index 99d8b23a..6141b283 100644 --- a/xo-object2/src/object2/DFloat.cpp +++ b/xo-object2/src/object2/DFloat.cpp @@ -34,7 +34,7 @@ namespace xo { } void - DFloat::visit_gco_children(obj) noexcept + DFloat::visit_gco_children(VisitReason, obj) noexcept { // noop -- childless! } diff --git a/xo-object2/src/object2/DInteger.cpp b/xo-object2/src/object2/DInteger.cpp index 1c17d9cf..03e6a5d0 100644 --- a/xo-object2/src/object2/DInteger.cpp +++ b/xo-object2/src/object2/DInteger.cpp @@ -34,7 +34,7 @@ namespace xo { } void - DInteger::visit_gco_children(obj) noexcept + DInteger::visit_gco_children(VisitReason, obj) noexcept { // no-op. childless } diff --git a/xo-object2/src/object2/DList.cpp b/xo-object2/src/object2/DList.cpp index fc2070ff..612ed98b 100644 --- a/xo-object2/src/object2/DList.cpp +++ b/xo-object2/src/object2/DList.cpp @@ -185,12 +185,10 @@ namespace xo { } void - DList::visit_gco_children(obj gc) noexcept + DList::visit_gco_children(VisitReason reason, obj gc) noexcept { - //scope log(XO_DEBUG(true)); - - gc.visit_child(&head_); - gc.visit_child(&rest_); + gc.visit_child(reason, &head_); + gc.visit_child(reason, &rest_); } } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-object2/src/object2/DRuntimeError.cpp b/xo-object2/src/object2/DRuntimeError.cpp index 7edb6227..2d9518e6 100644 --- a/xo-object2/src/object2/DRuntimeError.cpp +++ b/xo-object2/src/object2/DRuntimeError.cpp @@ -59,21 +59,10 @@ namespace xo { } void - DRuntimeError::visit_gco_children(obj gc) noexcept + DRuntimeError::visit_gco_children(VisitReason reason, obj gc) noexcept { - { - gc.visit_child(&src_function_); - - //auto iface = xo::facet::impl_for(); - //gc.forward_inplace(&iface, (void **)(&src_function_)); - } - - { - gc.visit_child(&error_descr_); - - //auto iface = xo::facet::impl_for(); - //gc.forward_inplace(&iface, (void **)(&error_descr_)); - } + gc.visit_child(reason, &src_function_); + gc.visit_child(reason, &error_descr_); } // ----- Printable facet ----- diff --git a/xo-object2/src/object2/IGCObject_DArray.cpp b/xo-object2/src/object2/IGCObject_DArray.cpp index 6de8b94d..e771e335 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.gco_shallow_move(gc); } auto - IGCObject_DArray::visit_gco_children(DArray & self, obj fn) noexcept -> void + IGCObject_DArray::visit_gco_children(DArray & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, fn); } } /*namespace scm*/ diff --git a/xo-object2/src/object2/IGCObject_DBoolean.cpp b/xo-object2/src/object2/IGCObject_DBoolean.cpp index d791116d..62b82ca7 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.gco_shallow_move(gc); } auto - IGCObject_DBoolean::visit_gco_children(DBoolean & self, obj fn) noexcept -> void + IGCObject_DBoolean::visit_gco_children(DBoolean & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, fn); } } /*namespace scm*/ diff --git a/xo-object2/src/object2/IGCObject_DDictionary.cpp b/xo-object2/src/object2/IGCObject_DDictionary.cpp index 41d462c9..ae6da864 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.gco_shallow_move(gc); } auto - IGCObject_DDictionary::visit_gco_children(DDictionary & self, obj fn) noexcept -> void + IGCObject_DDictionary::visit_gco_children(DDictionary & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, fn); } } /*namespace scm*/ diff --git a/xo-object2/src/object2/IGCObject_DFloat.cpp b/xo-object2/src/object2/IGCObject_DFloat.cpp index adcb9948..d6399b0b 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.gco_shallow_move(gc); } auto - IGCObject_DFloat::visit_gco_children(DFloat & self, obj fn) noexcept -> void + IGCObject_DFloat::visit_gco_children(DFloat & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, fn); } } /*namespace scm*/ diff --git a/xo-object2/src/object2/IGCObject_DInteger.cpp b/xo-object2/src/object2/IGCObject_DInteger.cpp index b4b57fc6..1acd0455 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.gco_shallow_move(gc); } auto - IGCObject_DInteger::visit_gco_children(DInteger & self, obj fn) noexcept -> void + IGCObject_DInteger::visit_gco_children(DInteger & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, fn); } } /*namespace scm*/ diff --git a/xo-object2/src/object2/IGCObject_DList.cpp b/xo-object2/src/object2/IGCObject_DList.cpp index 79ad3750..205c3e58 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.gco_shallow_move(gc); } auto - IGCObject_DList::visit_gco_children(DList & self, obj fn) noexcept -> void + IGCObject_DList::visit_gco_children(DList & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, fn); } } /*namespace scm*/ diff --git a/xo-object2/src/object2/IGCObject_DRuntimeError.cpp b/xo-object2/src/object2/IGCObject_DRuntimeError.cpp index 800d72ba..3efa863d 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.gco_shallow_move(gc); } auto - IGCObject_DRuntimeError::visit_gco_children(DRuntimeError & self, obj fn) noexcept -> void + IGCObject_DRuntimeError::visit_gco_children(DRuntimeError & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, fn); } } /*namespace scm*/ diff --git a/xo-procedure2/include/xo/procedure2/DPrimitive.hpp b/xo-procedure2/include/xo/procedure2/DPrimitive.hpp index 37798319..a5b01251 100644 --- a/xo-procedure2/include/xo/procedure2/DPrimitive.hpp +++ b/xo-procedure2/include/xo/procedure2/DPrimitive.hpp @@ -75,10 +75,9 @@ namespace xo { public: using FunctionPtrType = Fn; using Traits = detail::PmFnTraits; - - //using ACollector = xo::mm::ACollector; using AGCObject = xo::mm::AGCObject; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using AAllocator = xo::mm::AAllocator; using DArray = xo::scm::DArray; using Reflect = xo::reflect::Reflect; @@ -136,7 +135,7 @@ namespace xo { /** @defgroup scm-primitive-gcobject-facet **/ ///@{ Primitive * gco_shallow_move(obj gc) noexcept; - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, obj gc) noexcept; ///@} private: @@ -199,8 +198,9 @@ namespace xo { template void - Primitive::visit_gco_children(obj gc) noexcept { - gc.visit_poly_child(&type_); + Primitive::visit_gco_children(xo::mm::VisitReason reason, + obj gc) noexcept { + gc.visit_poly_child(reason, &type_); //{ // auto e = type_.to_facet(); // FacetRegistry dep // gc.forward_inplace(e.iface(), (void **)&(type_.data_)); 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 beca0850..63986f85 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 @@ -45,6 +45,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -59,7 +60,7 @@ Arguably abusing the word 'visitor' here **/ /** 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; + static void visit_gco_children(DPrimitive_gco_0 & self, VisitReason reason, 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 3092e52f..c15dedb4 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 @@ -45,6 +45,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -59,7 +60,7 @@ Arguably abusing the word 'visitor' here **/ /** 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; + static void visit_gco_children(DPrimitive_gco_1_gco & self, VisitReason reason, 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 1fca4b6c..6cc1754d 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 @@ -45,6 +45,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -59,7 +60,7 @@ Arguably abusing the word 'visitor' here **/ /** 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; + static void visit_gco_children(DPrimitive_gco_2_dict_string & self, VisitReason reason, 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 14e66c34..52c46f49 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 @@ -45,6 +45,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -59,7 +60,7 @@ Arguably abusing the word 'visitor' here **/ /** 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; + static void visit_gco_children(DPrimitive_gco_2_gco_gco & self, VisitReason reason, 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 994682cd..cc8294e2 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 @@ -45,6 +45,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -59,7 +60,7 @@ Arguably abusing the word 'visitor' here **/ /** 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; + static void visit_gco_children(DPrimitive_gco_3_dict_string_gco & self, VisitReason reason, 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 150adfd8..80b04c15 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.gco_shallow_move(gc); } auto - IGCObject_DPrimitive_gco_0::visit_gco_children(DPrimitive_gco_0 & self, obj fn) noexcept -> void + IGCObject_DPrimitive_gco_0::visit_gco_children(DPrimitive_gco_0 & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, 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 202389d0..865cd641 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.gco_shallow_move(gc); } auto - IGCObject_DPrimitive_gco_1_gco::visit_gco_children(DPrimitive_gco_1_gco & self, obj fn) noexcept -> void + IGCObject_DPrimitive_gco_1_gco::visit_gco_children(DPrimitive_gco_1_gco & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, 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 c9b4717b..5e9bbcb3 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.gco_shallow_move(gc); } auto - IGCObject_DPrimitive_gco_2_dict_string::visit_gco_children(DPrimitive_gco_2_dict_string & self, obj fn) noexcept -> void + IGCObject_DPrimitive_gco_2_dict_string::visit_gco_children(DPrimitive_gco_2_dict_string & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, 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 65851b1f..ef410d88 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.gco_shallow_move(gc); } auto - IGCObject_DPrimitive_gco_2_gco_gco::visit_gco_children(DPrimitive_gco_2_gco_gco & self, obj fn) noexcept -> void + IGCObject_DPrimitive_gco_2_gco_gco::visit_gco_children(DPrimitive_gco_2_gco_gco & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, 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 89be54af..58e26deb 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.gco_shallow_move(gc); } auto - IGCObject_DPrimitive_gco_3_dict_string_gco::visit_gco_children(DPrimitive_gco_3_dict_string_gco & self, obj fn) noexcept -> void + IGCObject_DPrimitive_gco_3_dict_string_gco::visit_gco_children(DPrimitive_gco_3_dict_string_gco & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, fn); } } /*namespace scm*/ diff --git a/xo-reader2/idl/SyntaxStateMachine.json5 b/xo-reader2/idl/SyntaxStateMachine.json5 index d47656b7..c2d8aff1 100644 --- a/xo-reader2/idl/SyntaxStateMachine.json5 +++ b/xo-reader2/idl/SyntaxStateMachine.json5 @@ -29,7 +29,7 @@ { name: "TypeDescr", doc: [ "reflected c++ type" ], definition: "xo::reflect::TypeDescr" }, { 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 }, + { name: "VisitReason", doc: [ "hint when traversing gco graph" ], definition: "xo::mm::VisitReason" }, ], const_methods: [ { @@ -151,6 +151,7 @@ doc: ["gc support: visit immediate gc-aware child pointers with @p gc. Call gc.visit_child() for each"], return_type: "void", args: [ + {type: "VisitReason", name: "reason"}, {type: "obj", name: "gc"}, ], } diff --git a/xo-reader2/include/xo/reader2/DDefineSsm.hpp b/xo-reader2/include/xo/reader2/DDefineSsm.hpp index e31c3b2a..36afb4b4 100644 --- a/xo-reader2/include/xo/reader2/DDefineSsm.hpp +++ b/xo-reader2/include/xo/reader2/DDefineSsm.hpp @@ -74,6 +74,7 @@ namespace xo { using Super = DSyntaxStateMachine; using TypeDescr = xo::reflect::TypeDescr; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using AAllocator = xo::mm::AAllocator; using DArena = xo::mm::DArena; using ppindentinfo = xo::print::ppindentinfo; @@ -200,7 +201,8 @@ namespace xo { ///@{ /** gc support: visit gc-aware child pointers **/ - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, + obj gc) noexcept; ///@} diff --git a/xo-reader2/include/xo/reader2/DExpectExprSsm.hpp b/xo-reader2/include/xo/reader2/DExpectExprSsm.hpp index e73e1f16..b0d4b5f3 100644 --- a/xo-reader2/include/xo/reader2/DExpectExprSsm.hpp +++ b/xo-reader2/include/xo/reader2/DExpectExprSsm.hpp @@ -18,6 +18,7 @@ namespace xo { using Super = DSyntaxStateMachine; using TypeDescr = xo::reflect::TypeDescr; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using DArena = xo::mm::DArena; using ppindentinfo = xo::print::ppindentinfo; @@ -194,7 +195,7 @@ namespace xo { ///@{ /** gc support: visit gc-aware child pointers **/ - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, obj gc) noexcept; ///@} diff --git a/xo-reader2/include/xo/reader2/DExpectFormalArglistSsm.hpp b/xo-reader2/include/xo/reader2/DExpectFormalArglistSsm.hpp index 954cdc72..c321b135 100644 --- a/xo-reader2/include/xo/reader2/DExpectFormalArglistSsm.hpp +++ b/xo-reader2/include/xo/reader2/DExpectFormalArglistSsm.hpp @@ -56,6 +56,7 @@ namespace xo { public: using Super = DSyntaxStateMachine; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using AAllocator = xo::mm::AAllocator; using DArena = xo::mm::DArena; using TypeDescr = xo::reflect::TypeDescr; @@ -130,7 +131,8 @@ namespace xo { ///@{ /** gc support: visit gc-aware child pointers **/ - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, + obj gc) noexcept; ///@} diff --git a/xo-reader2/include/xo/reader2/DExpectQArraySsm.hpp b/xo-reader2/include/xo/reader2/DExpectQArraySsm.hpp index 2ec32eb4..fcd1a14e 100644 --- a/xo-reader2/include/xo/reader2/DExpectQArraySsm.hpp +++ b/xo-reader2/include/xo/reader2/DExpectQArraySsm.hpp @@ -58,6 +58,7 @@ namespace xo { public: using Super = DSyntaxStateMachine; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using AAllocator = xo::mm::AAllocator; using DArena = xo::mm::DArena; using TypeDescr = xo::reflect::TypeDescr; @@ -123,7 +124,8 @@ namespace xo { ///@{ /** gc support: visit gc-aware child pointers **/ - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, + obj gc) noexcept; ///@} diff --git a/xo-reader2/include/xo/reader2/DExpectQListSsm.hpp b/xo-reader2/include/xo/reader2/DExpectQListSsm.hpp index 3b9ab53d..8c9185ca 100644 --- a/xo-reader2/include/xo/reader2/DExpectQListSsm.hpp +++ b/xo-reader2/include/xo/reader2/DExpectQListSsm.hpp @@ -59,6 +59,7 @@ namespace xo { public: using Super = DSyntaxStateMachine; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using AAllocator = xo::mm::AAllocator; using DArena = xo::mm::DArena; using TypeDescr = xo::reflect::TypeDescr; @@ -124,7 +125,7 @@ namespace xo { ///@{ /** gc support: visit gc-aware child pointers **/ - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, obj gc) noexcept; ///@} diff --git a/xo-reader2/include/xo/reader2/DExpectQLiteralSsm.hpp b/xo-reader2/include/xo/reader2/DExpectQLiteralSsm.hpp index 2538fb6f..58d7a0b4 100644 --- a/xo-reader2/include/xo/reader2/DExpectQLiteralSsm.hpp +++ b/xo-reader2/include/xo/reader2/DExpectQLiteralSsm.hpp @@ -16,6 +16,7 @@ namespace xo { public: using Super = DSyntaxStateMachine; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using AAllocator = xo::mm::AAllocator; using DArena = xo::mm::DArena; using TypeDescr = xo::reflect::TypeDescr; @@ -129,7 +130,7 @@ namespace xo { ///@{ /** gc support: visit gc-aware child pointers **/ - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, obj gc) noexcept; ///@} diff --git a/xo-reader2/include/xo/reader2/DExpectSymbolSsm.hpp b/xo-reader2/include/xo/reader2/DExpectSymbolSsm.hpp index f4c3c156..0acd75c3 100644 --- a/xo-reader2/include/xo/reader2/DExpectSymbolSsm.hpp +++ b/xo-reader2/include/xo/reader2/DExpectSymbolSsm.hpp @@ -22,6 +22,7 @@ namespace xo { public: using Super = DSyntaxStateMachine; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using DArena = xo::mm::DArena; using TypeDescr = xo::reflect::TypeDescr; using ppindentinfo = xo::print::ppindentinfo; @@ -80,7 +81,7 @@ namespace xo { ///@{ /** gc support: visit gc-aware child pointers **/ - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, obj gc) noexcept; ///@} }; diff --git a/xo-reader2/include/xo/reader2/DExpectTypeSsm.hpp b/xo-reader2/include/xo/reader2/DExpectTypeSsm.hpp index d405e916..fd65a3ec 100644 --- a/xo-reader2/include/xo/reader2/DExpectTypeSsm.hpp +++ b/xo-reader2/include/xo/reader2/DExpectTypeSsm.hpp @@ -29,6 +29,7 @@ namespace xo { using Super = DSyntaxStateMachine; using TypeDescr = xo::reflect::TypeDescr; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using DArena = xo::mm::DArena; using ppindentinfo = xo::print::ppindentinfo; @@ -87,7 +88,8 @@ namespace xo { ///@{ /** gc support: visit gc-aware child pointers **/ - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, + obj gc) noexcept; ///@} diff --git a/xo-reader2/include/xo/reader2/DGlobalEnv.hpp b/xo-reader2/include/xo/reader2/DGlobalEnv.hpp index 6bb88f49..02a4679a 100644 --- a/xo-reader2/include/xo/reader2/DGlobalEnv.hpp +++ b/xo-reader2/include/xo/reader2/DGlobalEnv.hpp @@ -27,9 +27,9 @@ namespace xo { class DGlobalEnv { public: using TypeDescr = xo::reflect::TypeDescr; - //using ACollector = xo::mm::ACollector; using AGCObject = xo::mm::AGCObject; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using AAllocator = xo::mm::AAllocator; using MemorySizeVisitor = xo::mm::MemorySizeVisitor; using ppindentinfo = xo::print::ppindentinfo; @@ -73,7 +73,7 @@ namespace xo { ///@{ DGlobalEnv * gco_shallow_move(obj gc) noexcept; - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, 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 372b3af6..3abc38ea 100644 --- a/xo-reader2/include/xo/reader2/DProgressSsm.hpp +++ b/xo-reader2/include/xo/reader2/DProgressSsm.hpp @@ -90,6 +90,7 @@ namespace xo { using Super = DSyntaxStateMachine; using TypeDescr = xo::reflect::TypeDescr; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using DArena = xo::mm::DArena; using ppindentinfo = xo::print::ppindentinfo; @@ -217,7 +218,8 @@ namespace xo { /** @defgroup scm-progressssm-gc-support gc support methods **/ ///@{ - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, + obj gc) noexcept; ///@} diff --git a/xo-reader2/include/xo/reader2/DQuoteSsm.hpp b/xo-reader2/include/xo/reader2/DQuoteSsm.hpp index 542342ef..0874b549 100644 --- a/xo-reader2/include/xo/reader2/DQuoteSsm.hpp +++ b/xo-reader2/include/xo/reader2/DQuoteSsm.hpp @@ -66,6 +66,7 @@ namespace xo { using Super = DSyntaxStateMachine; using TypeDescr = xo::reflect::TypeDescr; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using AAllocator = xo::mm::AAllocator; using DArena = xo::mm::DArena; using ppindentinfo = xo::print::ppindentinfo; @@ -150,7 +151,7 @@ namespace xo { ///@{ /** gc support: visit gc-aware child pointers **/ - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, obj gc) noexcept; ///@} private: diff --git a/xo-reader2/include/xo/reader2/DSequenceSsm.hpp b/xo-reader2/include/xo/reader2/DSequenceSsm.hpp index a7819048..c153d76e 100644 --- a/xo-reader2/include/xo/reader2/DSequenceSsm.hpp +++ b/xo-reader2/include/xo/reader2/DSequenceSsm.hpp @@ -30,6 +30,7 @@ namespace xo { public: using Super = DSyntaxStateMachine; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using AAllocator = xo::mm::AAllocator; using DArena = xo::mm::DArena; using ppindentinfo = xo::print::ppindentinfo; @@ -97,7 +98,8 @@ namespace xo { ///@{ /** gc support: visit gc-aware child pointers **/ - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, + obj gc) noexcept; ///@} diff --git a/xo-reader2/include/xo/reader2/DToplevelSeqSsm.hpp b/xo-reader2/include/xo/reader2/DToplevelSeqSsm.hpp index 4103f45a..5df90f4d 100644 --- a/xo-reader2/include/xo/reader2/DToplevelSeqSsm.hpp +++ b/xo-reader2/include/xo/reader2/DToplevelSeqSsm.hpp @@ -41,6 +41,7 @@ namespace xo { using Super = DSyntaxStateMachine; using TypeDescr = xo::reflect::TypeDescr; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using AAllocator = xo::mm::AAllocator; using DArena = xo::mm::DArena; using ppindentinfo = xo::print::ppindentinfo; @@ -161,7 +162,7 @@ namespace xo { ///@{ /** gc support: visit gc-aware child pointers **/ - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, obj gc) noexcept; ///@} diff --git a/xo-reader2/include/xo/reader2/ParserResult.hpp b/xo-reader2/include/xo/reader2/ParserResult.hpp index 823372da..c8976da4 100644 --- a/xo-reader2/include/xo/reader2/ParserResult.hpp +++ b/xo-reader2/include/xo/reader2/ParserResult.hpp @@ -33,6 +33,7 @@ namespace xo { class ParserResult { public: using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using ppindentinfo = xo::print::ppindentinfo; public: @@ -69,7 +70,7 @@ namespace xo { bool pretty(const ppindentinfo & ppii) const; /** gc support: forward gc-eligible children **/ - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, 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 e4b414b4..fade2079 100644 --- a/xo-reader2/include/xo/reader2/ParserStack.hpp +++ b/xo-reader2/include/xo/reader2/ParserStack.hpp @@ -24,6 +24,7 @@ namespace xo { public: //using ACollector = xo::mm::ACollector; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using DArena = xo::mm::DArena; using ppindentinfo = xo::print::ppindentinfo; @@ -56,7 +57,8 @@ namespace xo { /** pretty-printer support **/ bool pretty(const ppindentinfo & ppii) const; - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, + 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 fedd574d..b73eac0b 100644 --- a/xo-reader2/include/xo/reader2/ParserStateMachine.hpp +++ b/xo-reader2/include/xo/reader2/ParserStateMachine.hpp @@ -40,10 +40,11 @@ namespace xo { public: using TypeDescr = xo::reflect::TypeDescr; using ACollector = xo::mm::ACollector; + using AGCObject = xo::mm::AGCObject; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using AAllocator = xo::mm::AAllocator; using ArenaConfig = xo::mm::ArenaConfig; - using AGCObject = xo::mm::AGCObject; using DArena = xo::mm::DArena; using MemorySizeVisitor = xo::mm::MemorySizeVisitor; using ArenaHashMapConfig = xo::map::ArenaHashMapConfig; @@ -354,7 +355,8 @@ namespace xo { ///@{ /** update gc-aware exit pointers from this ParserStateMachine **/ - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, + obj gc) noexcept; ///@} diff --git a/xo-reader2/include/xo/reader2/SchematikaReader.hpp b/xo-reader2/include/xo/reader2/SchematikaReader.hpp index d70c2c04..fd2f5cc9 100644 --- a/xo-reader2/include/xo/reader2/SchematikaReader.hpp +++ b/xo-reader2/include/xo/reader2/SchematikaReader.hpp @@ -15,12 +15,14 @@ namespace xo { struct ReaderResult { using ACollector = xo::mm::ACollector; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; 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 visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, + obj gc) noexcept; /** schematika expression parsed from input **/ obj expr_; @@ -43,6 +45,7 @@ namespace xo { public: using ACollector = xo::mm::ACollector; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using AAllocator = xo::mm::AAllocator; using MemorySizeVisitor = xo::mm::MemorySizeVisitor; using span_type = xo::mm::span; @@ -110,7 +113,8 @@ namespace xo { void reset_to_idle_toplevel(); /** update gc-aware child pointers **/ - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, + 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 f7ee1cce..dd724066 100644 --- a/xo-reader2/include/xo/reader2/apply/DApplySsm.hpp +++ b/xo-reader2/include/xo/reader2/apply/DApplySsm.hpp @@ -8,7 +8,6 @@ #include "DSyntaxStateMachine.hpp" #include "syntaxstatetype.hpp" #include -//#include #include @@ -66,12 +65,11 @@ namespace xo { using Super = DSyntaxStateMachine; using TypeDescr = xo::reflect::TypeDescr; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using AAllocator = xo::mm::AAllocator; using DArena = xo::mm::DArena; using ppindentinfo = xo::print::ppindentinfo; - //using Apply = xo::scm::Apply; - public: /** @defgroup scm-applyssm-ctors constructors **/ ///@{ @@ -190,7 +188,8 @@ namespace xo { ///@{ /** gc support: visit gc-aware child pointers **/ - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, + 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 db3a147d..a50740f5 100644 --- a/xo-reader2/include/xo/reader2/apply/ISyntaxStateMachine_DApplySsm.hpp +++ b/xo-reader2/include/xo/reader2/apply/ISyntaxStateMachine_DApplySsm.hpp @@ -44,6 +44,7 @@ namespace xo { using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; using AGCObjectVisitor = xo::scm::ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; + using VisitReason = xo::scm::ASyntaxStateMachine::VisitReason; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; ///@} @@ -77,7 +78,7 @@ namespace xo { /** update state machine for nested quoted literal @p lit **/ static void on_quoted_literal(DApplySsm & self, obj lit, ParserStateMachine * p_psm); /** 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); + static void visit_gco_children(DApplySsm & self, VisitReason reason, 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 d5338cd5..35df5ded 100644 --- a/xo-reader2/include/xo/reader2/define/ISyntaxStateMachine_DDefineSsm.hpp +++ b/xo-reader2/include/xo/reader2/define/ISyntaxStateMachine_DDefineSsm.hpp @@ -44,6 +44,7 @@ namespace xo { using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; using AGCObjectVisitor = xo::scm::ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; + using VisitReason = xo::scm::ASyntaxStateMachine::VisitReason; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; ///@} @@ -77,7 +78,7 @@ namespace xo { /** update state machine for nested quoted literal @p lit **/ static void on_quoted_literal(DDefineSsm & self, obj lit, ParserStateMachine * p_psm); /** 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); + static void visit_gco_children(DDefineSsm & self, VisitReason reason, obj gc); ///@} }; diff --git a/xo-reader2/include/xo/reader2/deftype/DDeftypeSsm.hpp b/xo-reader2/include/xo/reader2/deftype/DDeftypeSsm.hpp index b1a6d910..8bbe3ea1 100644 --- a/xo-reader2/include/xo/reader2/deftype/DDeftypeSsm.hpp +++ b/xo-reader2/include/xo/reader2/deftype/DDeftypeSsm.hpp @@ -67,6 +67,7 @@ namespace xo { using Super = DSyntaxStateMachine; using TypeDescr = xo::reflect::TypeDescr; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using AAllocator = xo::mm::AAllocator; using DArena = xo::mm::DArena; using ppindentinfo = xo::print::ppindentinfo; @@ -172,7 +173,7 @@ namespace xo { ///@{ /** gc support: visit gc-aware child pointers **/ - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, 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 9bfdfba5..b984bc7d 100644 --- a/xo-reader2/include/xo/reader2/deftype/ISyntaxStateMachine_DDeftypeSsm.hpp +++ b/xo-reader2/include/xo/reader2/deftype/ISyntaxStateMachine_DDeftypeSsm.hpp @@ -44,6 +44,7 @@ namespace xo { using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; using AGCObjectVisitor = xo::scm::ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; + using VisitReason = xo::scm::ASyntaxStateMachine::VisitReason; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; ///@} @@ -77,7 +78,7 @@ namespace xo { /** update state machine for nested quoted literal @p lit **/ static void on_quoted_literal(DDeftypeSsm & self, obj lit, ParserStateMachine * p_psm); /** 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); + static void visit_gco_children(DDeftypeSsm & self, VisitReason reason, 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 f96deebc..8efa3c27 100644 --- a/xo-reader2/include/xo/reader2/env/IGCObject_DGlobalEnv.hpp +++ b/xo-reader2/include/xo/reader2/env/IGCObject_DGlobalEnv.hpp @@ -45,6 +45,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -59,7 +60,7 @@ Arguably abusing the word 'visitor' here **/ /** 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; + static void visit_gco_children(DGlobalEnv & self, VisitReason reason, 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 5c7e6dec..38a4bb3e 100644 --- a/xo-reader2/include/xo/reader2/expect_formal_arg/DExpectFormalArgSsm.hpp +++ b/xo-reader2/include/xo/reader2/expect_formal_arg/DExpectFormalArgSsm.hpp @@ -49,6 +49,7 @@ namespace xo { using Super = DSyntaxStateMachine; using TypeDescr = xo::reflect::TypeDescr; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using DArena = xo::mm::DArena; using ppindentinfo = xo::print::ppindentinfo; @@ -126,7 +127,8 @@ namespace xo { ///@{ /** gc support: visit gc-aware child pointers **/ - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, + 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 a880fad3..ccdfc0bd 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 @@ -44,6 +44,7 @@ namespace xo { using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; using AGCObjectVisitor = xo::scm::ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; + using VisitReason = xo::scm::ASyntaxStateMachine::VisitReason; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; ///@} @@ -77,7 +78,7 @@ namespace xo { /** update state machine for nested quoted literal @p lit **/ static void on_quoted_literal(DExpectFormalArgSsm & self, obj lit, ParserStateMachine * p_psm); /** 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); + static void visit_gco_children(DExpectFormalArgSsm & self, VisitReason reason, 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 eeadd15c..ce69f929 100644 --- a/xo-reader2/include/xo/reader2/expect_listtype/DExpectListTypeSsm.hpp +++ b/xo-reader2/include/xo/reader2/expect_listtype/DExpectListTypeSsm.hpp @@ -63,6 +63,7 @@ namespace xo { using Super = DSyntaxStateMachine; using TypeDescr = xo::reflect::TypeDescr; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using DArena = xo::mm::DArena; using ppindentinfo = xo::print::ppindentinfo; @@ -135,7 +136,8 @@ namespace xo { ///@{ /** gc support: visit gc-aware child pointers **/ - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, + 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 9ed4214c..b320b9c9 100644 --- a/xo-reader2/include/xo/reader2/expect_listtype/ISyntaxStateMachine_DExpectListTypeSsm.hpp +++ b/xo-reader2/include/xo/reader2/expect_listtype/ISyntaxStateMachine_DExpectListTypeSsm.hpp @@ -44,6 +44,7 @@ namespace xo { using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; using AGCObjectVisitor = xo::scm::ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; + using VisitReason = xo::scm::ASyntaxStateMachine::VisitReason; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; ///@} @@ -77,7 +78,7 @@ namespace xo { /** update state machine for nested quoted literal @p lit **/ static void on_quoted_literal(DExpectListTypeSsm & self, obj lit, ParserStateMachine * p_psm); /** 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); + static void visit_gco_children(DExpectListTypeSsm & self, VisitReason reason, 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 5ed40fab..18c52bac 100644 --- a/xo-reader2/include/xo/reader2/expect_qdict/DExpectQDictSsm.hpp +++ b/xo-reader2/include/xo/reader2/expect_qdict/DExpectQDictSsm.hpp @@ -64,6 +64,7 @@ namespace xo { public: using Super = DSyntaxStateMachine; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using DArena = xo::mm::DArena; using ppindentinfo = xo::print::ppindentinfo; @@ -159,7 +160,8 @@ namespace xo { ///@{ /** gc support: visit gc-aware child pointers **/ - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, + 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 c629e07b..006e43b1 100644 --- a/xo-reader2/include/xo/reader2/expect_qdict/ISyntaxStateMachine_DExpectQDictSsm.hpp +++ b/xo-reader2/include/xo/reader2/expect_qdict/ISyntaxStateMachine_DExpectQDictSsm.hpp @@ -44,6 +44,7 @@ namespace xo { using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; using AGCObjectVisitor = xo::scm::ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; + using VisitReason = xo::scm::ASyntaxStateMachine::VisitReason; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; ///@} @@ -77,7 +78,7 @@ namespace xo { /** update state machine for nested quoted literal @p lit **/ static void on_quoted_literal(DExpectQDictSsm & self, obj lit, ParserStateMachine * p_psm); /** 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); + static void visit_gco_children(DExpectQDictSsm & self, VisitReason reason, obj gc); ///@} }; diff --git a/xo-reader2/include/xo/reader2/ifelse/DIfElseSsm.hpp b/xo-reader2/include/xo/reader2/ifelse/DIfElseSsm.hpp index fd7b8168..3b63cdb7 100644 --- a/xo-reader2/include/xo/reader2/ifelse/DIfElseSsm.hpp +++ b/xo-reader2/include/xo/reader2/ifelse/DIfElseSsm.hpp @@ -56,6 +56,7 @@ namespace xo { public: using Super = DSyntaxStateMachine; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using AAllocator = xo::mm::AAllocator; using DArena = xo::mm::DArena; using TypeDescr = xo::reflect::TypeDescr; @@ -171,7 +172,8 @@ namespace xo { /** @defgroup scm-ifelsessm-gc-support gc support methods **/ ///@{ - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, + 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 17f6b4cd..a88e9af1 100644 --- a/xo-reader2/include/xo/reader2/ifelse/ISyntaxStateMachine_DIfElseSsm.hpp +++ b/xo-reader2/include/xo/reader2/ifelse/ISyntaxStateMachine_DIfElseSsm.hpp @@ -44,6 +44,7 @@ namespace xo { using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; using AGCObjectVisitor = xo::scm::ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; + using VisitReason = xo::scm::ASyntaxStateMachine::VisitReason; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; ///@} @@ -77,7 +78,7 @@ namespace xo { /** update state machine for nested quoted literal @p lit **/ static void on_quoted_literal(DIfElseSsm & self, obj lit, ParserStateMachine * p_psm); /** 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); + static void visit_gco_children(DIfElseSsm & self, VisitReason reason, obj gc); ///@} }; diff --git a/xo-reader2/include/xo/reader2/lambda/DLambdaSsm.hpp b/xo-reader2/include/xo/reader2/lambda/DLambdaSsm.hpp index 7b16503b..93642f5f 100644 --- a/xo-reader2/include/xo/reader2/lambda/DLambdaSsm.hpp +++ b/xo-reader2/include/xo/reader2/lambda/DLambdaSsm.hpp @@ -60,6 +60,7 @@ namespace xo { using Super = DSyntaxStateMachine; using DLocalSymtab = xo::scm::DLocalSymtab; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using AAllocator = xo::mm::AAllocator; using DArena = xo::mm::DArena; using TypeDescr = xo::reflect::TypeDescr; @@ -189,7 +190,8 @@ namespace xo { ///@{ /** gc support: visit gc-aware child pointers **/ - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, + 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 db67ee9a..baeb5af4 100644 --- a/xo-reader2/include/xo/reader2/lambda/ISyntaxStateMachine_DLambdaSsm.hpp +++ b/xo-reader2/include/xo/reader2/lambda/ISyntaxStateMachine_DLambdaSsm.hpp @@ -44,6 +44,7 @@ namespace xo { using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; using AGCObjectVisitor = xo::scm::ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; + using VisitReason = xo::scm::ASyntaxStateMachine::VisitReason; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; ///@} @@ -77,7 +78,7 @@ namespace xo { /** update state machine for nested quoted literal @p lit **/ static void on_quoted_literal(DLambdaSsm & self, obj lit, ParserStateMachine * p_psm); /** 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); + static void visit_gco_children(DLambdaSsm & self, VisitReason reason, obj gc); ///@} }; diff --git a/xo-reader2/include/xo/reader2/paren/DParenSsm.hpp b/xo-reader2/include/xo/reader2/paren/DParenSsm.hpp index e70ba255..9da3ba42 100644 --- a/xo-reader2/include/xo/reader2/paren/DParenSsm.hpp +++ b/xo-reader2/include/xo/reader2/paren/DParenSsm.hpp @@ -51,6 +51,7 @@ namespace xo { using Super = DSyntaxStateMachine; using TypeDescr = xo::reflect::TypeDescr; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using AAllocator = xo::mm::AAllocator; using DArena = xo::mm::DArena; using ppindentinfo = xo::print::ppindentinfo; @@ -136,7 +137,8 @@ namespace xo { ///@{ /** gc support: visit immediate gc-aware children **/ - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, + 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 4dd7ef74..dc1a826d 100644 --- a/xo-reader2/include/xo/reader2/paren/ISyntaxStateMachine_DParenSsm.hpp +++ b/xo-reader2/include/xo/reader2/paren/ISyntaxStateMachine_DParenSsm.hpp @@ -44,6 +44,7 @@ namespace xo { using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; using AGCObjectVisitor = xo::scm::ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; + using VisitReason = xo::scm::ASyntaxStateMachine::VisitReason; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; ///@} @@ -77,7 +78,7 @@ namespace xo { /** update state machine for nested quoted literal @p lit **/ static void on_quoted_literal(DParenSsm & self, obj lit, ParserStateMachine * p_psm); /** 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); + static void visit_gco_children(DParenSsm & self, VisitReason reason, obj gc); ///@} }; diff --git a/xo-reader2/include/xo/reader2/parser/DSchematikaParser.hpp b/xo-reader2/include/xo/reader2/parser/DSchematikaParser.hpp index 24e4b46a..f699c30b 100644 --- a/xo-reader2/include/xo/reader2/parser/DSchematikaParser.hpp +++ b/xo-reader2/include/xo/reader2/parser/DSchematikaParser.hpp @@ -164,9 +164,9 @@ namespace xo { using token_type = Token; using ArenaHashMapConfig = xo::map::ArenaHashMapConfig; using ArenaConfig = xo::mm::ArenaConfig; - //using ACollector = xo::mm::ACollector; using AGCObject = xo::mm::AGCObject; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using AAllocator = xo::mm::AAllocator; using MemorySizeVisitor = xo::mm::MemorySizeVisitor; using ppindentinfo = xo::print::ppindentinfo; @@ -297,7 +297,7 @@ namespace xo { /** not implemented (SchematikaParser not designed to be copyable) **/ DSchematikaParser * gco_shallow_move(obj gc) noexcept; /** forward gc-aware children **/ - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, 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 64394e65..586678cd 100644 --- a/xo-reader2/include/xo/reader2/parser/IGCObject_DSchematikaParser.hpp +++ b/xo-reader2/include/xo/reader2/parser/IGCObject_DSchematikaParser.hpp @@ -45,6 +45,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -59,7 +60,7 @@ Arguably abusing the word 'visitor' here **/ /** 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; + static void visit_gco_children(DSchematikaParser & self, VisitReason reason, 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 35dc5da1..0f01d967 100644 --- a/xo-reader2/include/xo/reader2/quote/ISyntaxStateMachine_DQuoteSsm.hpp +++ b/xo-reader2/include/xo/reader2/quote/ISyntaxStateMachine_DQuoteSsm.hpp @@ -44,6 +44,7 @@ namespace xo { using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; using AGCObjectVisitor = xo::scm::ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; + using VisitReason = xo::scm::ASyntaxStateMachine::VisitReason; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; ///@} @@ -77,7 +78,7 @@ namespace xo { /** update state machine for nested quoted literal @p lit **/ static void on_quoted_literal(DQuoteSsm & self, obj lit, ParserStateMachine * p_psm); /** 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); + static void visit_gco_children(DQuoteSsm & self, VisitReason reason, obj gc); ///@} }; diff --git a/xo-reader2/include/xo/reader2/ssm/ASyntaxStateMachine.hpp b/xo-reader2/include/xo/reader2/ssm/ASyntaxStateMachine.hpp index 07d992c1..fc71175b 100644 --- a/xo-reader2/include/xo/reader2/ssm/ASyntaxStateMachine.hpp +++ b/xo-reader2/include/xo/reader2/ssm/ASyntaxStateMachine.hpp @@ -50,6 +50,8 @@ public: using AGCObjectVisitor = xo::mm::AGCObjectVisitor; /** gc-aware object **/ using AGCObject = xo::mm::AGCObject; + /** hint when traversing gco graph **/ + using VisitReason = xo::mm::VisitReason; ///@} /** @defgroup scm-syntaxstatemachine-methods **/ @@ -91,7 +93,7 @@ public: /** update state machine for nested quoted literal @p lit **/ virtual void on_quoted_literal(Opaque data, obj lit, ParserStateMachine * p_psm) = 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; + virtual void visit_gco_children(Opaque data, VisitReason reason, obj gc) = 0; ///@} }; /*ASyntaxStateMachine*/ diff --git a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_Any.hpp b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_Any.hpp index 34e7ec84..88b0cde2 100644 --- a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_Any.hpp +++ b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_Any.hpp @@ -47,6 +47,7 @@ namespace scm { using TypeDescr = ASyntaxStateMachine::TypeDescr; using AGCObjectVisitor = ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = ASyntaxStateMachine::AGCObject; + using VisitReason = ASyntaxStateMachine::VisitReason; ///@} /** @defgroup scm-syntaxstatemachine-any-methods **/ @@ -75,7 +76,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 visit_gco_children(Opaque, obj) override; + [[noreturn]] void visit_gco_children(Opaque, VisitReason, 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 5ca9f1c0..63210b94 100644 --- a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectExprSsm.hpp +++ b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectExprSsm.hpp @@ -44,6 +44,7 @@ namespace xo { using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; using AGCObjectVisitor = xo::scm::ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; + using VisitReason = xo::scm::ASyntaxStateMachine::VisitReason; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; ///@} @@ -77,7 +78,7 @@ namespace xo { /** update state machine for nested quoted literal @p lit **/ static void on_quoted_literal(DExpectExprSsm & self, obj lit, ParserStateMachine * p_psm); /** 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); + static void visit_gco_children(DExpectExprSsm & self, VisitReason reason, 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 04da69bd..8b9d4083 100644 --- a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectFormalArglistSsm.hpp +++ b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectFormalArglistSsm.hpp @@ -44,6 +44,7 @@ namespace xo { using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; using AGCObjectVisitor = xo::scm::ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; + using VisitReason = xo::scm::ASyntaxStateMachine::VisitReason; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; ///@} @@ -77,7 +78,7 @@ namespace xo { /** update state machine for nested quoted literal @p lit **/ static void on_quoted_literal(DExpectFormalArglistSsm & self, obj lit, ParserStateMachine * p_psm); /** 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); + static void visit_gco_children(DExpectFormalArglistSsm & self, VisitReason reason, 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 7b345008..e4b15c21 100644 --- a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectQArraySsm.hpp +++ b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectQArraySsm.hpp @@ -44,6 +44,7 @@ namespace xo { using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; using AGCObjectVisitor = xo::scm::ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; + using VisitReason = xo::scm::ASyntaxStateMachine::VisitReason; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; ///@} @@ -77,7 +78,7 @@ namespace xo { /** update state machine for nested quoted literal @p lit **/ static void on_quoted_literal(DExpectQArraySsm & self, obj lit, ParserStateMachine * p_psm); /** 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); + static void visit_gco_children(DExpectQArraySsm & self, VisitReason reason, 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 ea0cb3c2..42fdc804 100644 --- a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectQListSsm.hpp +++ b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectQListSsm.hpp @@ -44,6 +44,7 @@ namespace xo { using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; using AGCObjectVisitor = xo::scm::ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; + using VisitReason = xo::scm::ASyntaxStateMachine::VisitReason; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; ///@} @@ -77,7 +78,7 @@ namespace xo { /** update state machine for nested quoted literal @p lit **/ static void on_quoted_literal(DExpectQListSsm & self, obj lit, ParserStateMachine * p_psm); /** 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); + static void visit_gco_children(DExpectQListSsm & self, VisitReason reason, 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 4a4bdbfb..5dc2130b 100644 --- a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectQLiteralSsm.hpp +++ b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectQLiteralSsm.hpp @@ -44,6 +44,7 @@ namespace xo { using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; using AGCObjectVisitor = xo::scm::ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; + using VisitReason = xo::scm::ASyntaxStateMachine::VisitReason; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; ///@} @@ -77,7 +78,7 @@ namespace xo { /** update state machine for nested quoted literal @p lit **/ static void on_quoted_literal(DExpectQLiteralSsm & self, obj lit, ParserStateMachine * p_psm); /** 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); + static void visit_gco_children(DExpectQLiteralSsm & self, VisitReason reason, 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 e3cf7146..dfc0d6bb 100644 --- a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectSymbolSsm.hpp +++ b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectSymbolSsm.hpp @@ -44,6 +44,7 @@ namespace xo { using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; using AGCObjectVisitor = xo::scm::ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; + using VisitReason = xo::scm::ASyntaxStateMachine::VisitReason; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; ///@} @@ -77,7 +78,7 @@ namespace xo { /** update state machine for nested quoted literal @p lit **/ static void on_quoted_literal(DExpectSymbolSsm & self, obj lit, ParserStateMachine * p_psm); /** 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); + static void visit_gco_children(DExpectSymbolSsm & self, VisitReason reason, 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 965212d1..b8607deb 100644 --- a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectTypeSsm.hpp +++ b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DExpectTypeSsm.hpp @@ -44,6 +44,7 @@ namespace xo { using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; using AGCObjectVisitor = xo::scm::ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; + using VisitReason = xo::scm::ASyntaxStateMachine::VisitReason; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; ///@} @@ -77,7 +78,7 @@ namespace xo { /** update state machine for nested quoted literal @p lit **/ static void on_quoted_literal(DExpectTypeSsm & self, obj lit, ParserStateMachine * p_psm); /** 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); + static void visit_gco_children(DExpectTypeSsm & self, VisitReason reason, 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 7c12ee39..3a2b3aaf 100644 --- a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DProgressSsm.hpp +++ b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DProgressSsm.hpp @@ -44,6 +44,7 @@ namespace xo { using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; using AGCObjectVisitor = xo::scm::ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; + using VisitReason = xo::scm::ASyntaxStateMachine::VisitReason; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; ///@} @@ -77,7 +78,7 @@ namespace xo { /** update state machine for nested quoted literal @p lit **/ static void on_quoted_literal(DProgressSsm & self, obj lit, ParserStateMachine * p_psm); /** 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); + static void visit_gco_children(DProgressSsm & self, VisitReason reason, obj gc); ///@} }; diff --git a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DSequenceSsm.hpp b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DSequenceSsm.hpp index b35d45a1..74183d99 100644 --- a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DSequenceSsm.hpp +++ b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DSequenceSsm.hpp @@ -44,6 +44,7 @@ namespace xo { using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; using AGCObjectVisitor = xo::scm::ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; + using VisitReason = xo::scm::ASyntaxStateMachine::VisitReason; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; ///@} @@ -77,7 +78,7 @@ namespace xo { /** update state machine for nested quoted literal @p lit **/ static void on_quoted_literal(DSequenceSsm & self, obj lit, ParserStateMachine * p_psm); /** 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); + static void visit_gco_children(DSequenceSsm & self, VisitReason reason, 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 695da17c..55da530d 100644 --- a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DToplevelSeqSsm.hpp +++ b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_DToplevelSeqSsm.hpp @@ -44,6 +44,7 @@ namespace xo { using TypeDescr = xo::scm::ASyntaxStateMachine::TypeDescr; using AGCObjectVisitor = xo::scm::ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = xo::scm::ASyntaxStateMachine::AGCObject; + using VisitReason = xo::scm::ASyntaxStateMachine::VisitReason; using Copaque = xo::scm::ASyntaxStateMachine::Copaque; using Opaque = xo::scm::ASyntaxStateMachine::Opaque; ///@} @@ -77,7 +78,7 @@ namespace xo { /** update state machine for nested quoted literal @p lit **/ static void on_quoted_literal(DToplevelSeqSsm & self, obj lit, ParserStateMachine * p_psm); /** 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); + static void visit_gco_children(DToplevelSeqSsm & self, VisitReason reason, 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 df1a87f4..1d971d3b 100644 --- a/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_Xfer.hpp +++ b/xo-reader2/include/xo/reader2/ssm/ISyntaxStateMachine_Xfer.hpp @@ -36,6 +36,7 @@ namespace scm { using TypeDescr = ASyntaxStateMachine::TypeDescr; using AGCObjectVisitor = ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = ASyntaxStateMachine::AGCObject; + using VisitReason = ASyntaxStateMachine::VisitReason; ///@} /** @defgroup scm-syntaxstatemachine-xfer-methods **/ @@ -89,8 +90,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 visit_gco_children(Opaque data, obj gc) override { - return I::visit_gco_children(_dcast(data), gc); + void visit_gco_children(Opaque data, VisitReason reason, obj gc) override { + return I::visit_gco_children(_dcast(data), reason, gc); } ///@} diff --git a/xo-reader2/include/xo/reader2/ssm/RSyntaxStateMachine.hpp b/xo-reader2/include/xo/reader2/ssm/RSyntaxStateMachine.hpp index 9c8a8274..2f5b9fb0 100644 --- a/xo-reader2/include/xo/reader2/ssm/RSyntaxStateMachine.hpp +++ b/xo-reader2/include/xo/reader2/ssm/RSyntaxStateMachine.hpp @@ -34,6 +34,7 @@ public: using TypeDescr = ASyntaxStateMachine::TypeDescr; using AGCObjectVisitor = ASyntaxStateMachine::AGCObjectVisitor; using AGCObject = ASyntaxStateMachine::AGCObject; + using VisitReason = ASyntaxStateMachine::VisitReason; ///@} /** @defgroup scm-syntaxstatemachine-router-ctors **/ @@ -93,8 +94,8 @@ public: void on_quoted_literal(obj lit, ParserStateMachine * p_psm) { return O::iface()->on_quoted_literal(O::data(), lit, p_psm); } - void visit_gco_children(obj gc) { - return O::iface()->visit_gco_children(O::data(), gc); + void visit_gco_children(VisitReason reason, obj gc) { + return O::iface()->visit_gco_children(O::data(), reason, gc); } ///@} diff --git a/xo-reader2/src/reader2/DApplySsm.cpp b/xo-reader2/src/reader2/DApplySsm.cpp index 1787d560..ef84187b 100644 --- a/xo-reader2/src/reader2/DApplySsm.cpp +++ b/xo-reader2/src/reader2/DApplySsm.cpp @@ -397,10 +397,11 @@ namespace xo { } void - DApplySsm::visit_gco_children(obj gc) noexcept + DApplySsm::visit_gco_children(VisitReason reason, + obj gc) noexcept { - gc.visit_poly_child(&fn_expr_); - gc.visit_child(&args_expr_v_); + gc.visit_poly_child(reason, &fn_expr_); + gc.visit_child(reason, &args_expr_v_); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/DDefineSsm.cpp b/xo-reader2/src/reader2/DDefineSsm.cpp index 1ee8e3aa..0e38f93d 100644 --- a/xo-reader2/src/reader2/DDefineSsm.cpp +++ b/xo-reader2/src/reader2/DDefineSsm.cpp @@ -692,9 +692,10 @@ namespace xo { // ----- gc support ----- void - DDefineSsm::visit_gco_children(obj gc) noexcept + DDefineSsm::visit_gco_children(VisitReason reason, + obj gc) noexcept { - gc.visit_child(&def_expr_.data_); + gc.visit_child(reason, &def_expr_.data_); } } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/DDeftypeSsm.cpp b/xo-reader2/src/reader2/DDeftypeSsm.cpp index 0007d940..108f6be7 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::visit_gco_children(obj) noexcept + DDeftypeSsm::visit_gco_children(VisitReason, 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 bce870f6..9526aaea 100644 --- a/xo-reader2/src/reader2/DExpectExprSsm.cpp +++ b/xo-reader2/src/reader2/DExpectExprSsm.cpp @@ -625,7 +625,8 @@ namespace xo { #endif void - DExpectExprSsm::visit_gco_children(obj) noexcept + DExpectExprSsm::visit_gco_children(VisitReason, + obj) noexcept { // all members POD, skip } diff --git a/xo-reader2/src/reader2/DExpectFormalArgSsm.cpp b/xo-reader2/src/reader2/DExpectFormalArgSsm.cpp index 7a529983..f1bdd81d 100644 --- a/xo-reader2/src/reader2/DExpectFormalArgSsm.cpp +++ b/xo-reader2/src/reader2/DExpectFormalArgSsm.cpp @@ -265,7 +265,8 @@ namespace xo { } void - DExpectFormalArgSsm::visit_gco_children(obj) noexcept + DExpectFormalArgSsm::visit_gco_children(VisitReason, + 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 6cbf199a..6d68a610 100644 --- a/xo-reader2/src/reader2/DExpectFormalArglistSsm.cpp +++ b/xo-reader2/src/reader2/DExpectFormalArglistSsm.cpp @@ -358,9 +358,10 @@ namespace xo { } void - DExpectFormalArglistSsm::visit_gco_children(obj gc) noexcept + DExpectFormalArglistSsm::visit_gco_children(VisitReason reason, + obj gc) noexcept { - gc.visit_child(&argl_); + gc.visit_child(reason, &argl_); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/DExpectListTypeSsm.cpp b/xo-reader2/src/reader2/DExpectListTypeSsm.cpp index 001ff254..e94e299b 100644 --- a/xo-reader2/src/reader2/DExpectListTypeSsm.cpp +++ b/xo-reader2/src/reader2/DExpectListTypeSsm.cpp @@ -204,9 +204,10 @@ namespace xo { } void - DExpectListTypeSsm::visit_gco_children(obj gc) noexcept + DExpectListTypeSsm::visit_gco_children(VisitReason reason, + obj gc) noexcept { - gc.visit_poly_child(&elt_type_); + gc.visit_poly_child(reason, &elt_type_); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/DExpectQArraySsm.cpp b/xo-reader2/src/reader2/DExpectQArraySsm.cpp index 9e281f8c..97e68228 100644 --- a/xo-reader2/src/reader2/DExpectQArraySsm.cpp +++ b/xo-reader2/src/reader2/DExpectQArraySsm.cpp @@ -220,9 +220,10 @@ namespace xo { refrtag("array", array_pr)); } void - DExpectQArraySsm::visit_gco_children(obj gc) noexcept + DExpectQArraySsm::visit_gco_children(VisitReason reason, + obj gc) noexcept { - gc.visit_child(&array_); + gc.visit_child(reason, &array_); } } diff --git a/xo-reader2/src/reader2/DExpectQDictSsm.cpp b/xo-reader2/src/reader2/DExpectQDictSsm.cpp index 9839ffd2..4a34d19a 100644 --- a/xo-reader2/src/reader2/DExpectQDictSsm.cpp +++ b/xo-reader2/src/reader2/DExpectQDictSsm.cpp @@ -267,10 +267,11 @@ namespace xo { void - DExpectQDictSsm::visit_gco_children(obj gc) noexcept + DExpectQDictSsm::visit_gco_children(VisitReason reason, + obj gc) noexcept { - gc.visit_child(&key_); - gc.visit_child(&dict_); + gc.visit_child(reason, &key_); + gc.visit_child(reason, &dict_); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/DExpectQListSsm.cpp b/xo-reader2/src/reader2/DExpectQListSsm.cpp index 965351c3..5a570caa 100644 --- a/xo-reader2/src/reader2/DExpectQListSsm.cpp +++ b/xo-reader2/src/reader2/DExpectQListSsm.cpp @@ -215,10 +215,11 @@ namespace xo { refrtag("list", list_pr)); } void - DExpectQListSsm::visit_gco_children(obj gc) noexcept + DExpectQListSsm::visit_gco_children(VisitReason reason, + obj gc) noexcept { - gc.visit_child(&start_); - gc.visit_child(&end_); + gc.visit_child(reason, &start_); + gc.visit_child(reason, &end_); } } diff --git a/xo-reader2/src/reader2/DExpectQLiteralSsm.cpp b/xo-reader2/src/reader2/DExpectQLiteralSsm.cpp index c49cf565..5265aeb7 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::visit_gco_children(obj) noexcept + DExpectQLiteralSsm::visit_gco_children(VisitReason, 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 fa1372b1..6847a776 100644 --- a/xo-reader2/src/reader2/DExpectSymbolSsm.cpp +++ b/xo-reader2/src/reader2/DExpectSymbolSsm.cpp @@ -146,7 +146,8 @@ namespace xo { ); } void - DExpectSymbolSsm::visit_gco_children(obj) noexcept + DExpectSymbolSsm::visit_gco_children(VisitReason, + obj) noexcept { // no gc-aware members } diff --git a/xo-reader2/src/reader2/DExpectTypeSsm.cpp b/xo-reader2/src/reader2/DExpectTypeSsm.cpp index 47cc5a6c..7a5d55a3 100644 --- a/xo-reader2/src/reader2/DExpectTypeSsm.cpp +++ b/xo-reader2/src/reader2/DExpectTypeSsm.cpp @@ -198,7 +198,8 @@ namespace xo { } void - DExpectTypeSsm::visit_gco_children(obj) noexcept + DExpectTypeSsm::visit_gco_children(VisitReason, + obj) noexcept { // corrected_: POD, skip } diff --git a/xo-reader2/src/reader2/DGlobalEnv.cpp b/xo-reader2/src/reader2/DGlobalEnv.cpp index 8491c60b..b1eecf37 100644 --- a/xo-reader2/src/reader2/DGlobalEnv.cpp +++ b/xo-reader2/src/reader2/DGlobalEnv.cpp @@ -114,10 +114,11 @@ namespace xo { } void - DGlobalEnv::visit_gco_children(obj gc) noexcept + DGlobalEnv::visit_gco_children(VisitReason reason, + obj gc) noexcept { - gc.visit_child(&symtab_); - gc.visit_child(&values_); + gc.visit_child(reason, &symtab_); + gc.visit_child(reason, &values_); } // ----- APrintable facet ----- diff --git a/xo-reader2/src/reader2/DIfElseSsm.cpp b/xo-reader2/src/reader2/DIfElseSsm.cpp index f4fd4f88..5efd9289 100644 --- a/xo-reader2/src/reader2/DIfElseSsm.cpp +++ b/xo-reader2/src/reader2/DIfElseSsm.cpp @@ -510,9 +510,10 @@ namespace xo { } void - DIfElseSsm::visit_gco_children(obj gc) noexcept + DIfElseSsm::visit_gco_children(VisitReason reason, + obj gc) noexcept { - gc.visit_poly_child(&if_expr_); + gc.visit_poly_child(reason, &if_expr_); } } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/DLambdaSsm.cpp b/xo-reader2/src/reader2/DLambdaSsm.cpp index f0fed420..e39e530b 100644 --- a/xo-reader2/src/reader2/DLambdaSsm.cpp +++ b/xo-reader2/src/reader2/DLambdaSsm.cpp @@ -471,15 +471,16 @@ namespace xo { } void - DLambdaSsm::visit_gco_children(obj gc) noexcept + DLambdaSsm::visit_gco_children(VisitReason reason, + obj gc) noexcept { - gc.visit_child(&local_symtab_); + gc.visit_child(reason, &local_symtab_); // explicit_return_td not gcobject // lambda_td not gcobject - gc.visit_poly_child(&body_); - gc.visit_poly_child(&parent_symtab_); + gc.visit_poly_child(reason, &body_); + gc.visit_poly_child(reason, &parent_symtab_); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/DParenSsm.cpp b/xo-reader2/src/reader2/DParenSsm.cpp index 82320cb6..a832bd15 100644 --- a/xo-reader2/src/reader2/DParenSsm.cpp +++ b/xo-reader2/src/reader2/DParenSsm.cpp @@ -459,9 +459,10 @@ namespace xo { } void - DParenSsm::visit_gco_children(obj gc) noexcept + DParenSsm::visit_gco_children(VisitReason reason, + obj gc) noexcept { - gc.visit_poly_child(&expr_); + gc.visit_poly_child(reason, &expr_); } } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/DProgressSsm.cpp b/xo-reader2/src/reader2/DProgressSsm.cpp index 04c87fac..00ce5f61 100644 --- a/xo-reader2/src/reader2/DProgressSsm.cpp +++ b/xo-reader2/src/reader2/DProgressSsm.cpp @@ -1244,10 +1244,11 @@ case optype::op_assign: } void - DProgressSsm::visit_gco_children(obj gc) noexcept + DProgressSsm::visit_gco_children(VisitReason reason, + obj gc) noexcept { - gc.visit_poly_child(&lhs_); - gc.visit_poly_child(&rhs_); + gc.visit_poly_child(reason, &lhs_); + gc.visit_poly_child(reason, &rhs_); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/DQuoteSsm.cpp b/xo-reader2/src/reader2/DQuoteSsm.cpp index cbbedc73..af5d08e3 100644 --- a/xo-reader2/src/reader2/DQuoteSsm.cpp +++ b/xo-reader2/src/reader2/DQuoteSsm.cpp @@ -212,9 +212,10 @@ namespace xo { } void - DQuoteSsm::visit_gco_children(obj gc) noexcept + DQuoteSsm::visit_gco_children(VisitReason reason, + obj gc) noexcept { - gc.visit_poly_child(&expr_); + gc.visit_poly_child(reason, &expr_); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/DSchematikaParser.cpp b/xo-reader2/src/reader2/DSchematikaParser.cpp index fc71d12f..c1a92c5b 100644 --- a/xo-reader2/src/reader2/DSchematikaParser.cpp +++ b/xo-reader2/src/reader2/DSchematikaParser.cpp @@ -197,9 +197,10 @@ namespace xo { } void - DSchematikaParser::visit_gco_children(obj gc) noexcept + DSchematikaParser::visit_gco_children(VisitReason reason, + obj gc) noexcept { - psm_.visit_gco_children(gc); + psm_.visit_gco_children(reason, gc); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/DSequenceSsm.cpp b/xo-reader2/src/reader2/DSequenceSsm.cpp index a6d4013b..c3517065 100644 --- a/xo-reader2/src/reader2/DSequenceSsm.cpp +++ b/xo-reader2/src/reader2/DSequenceSsm.cpp @@ -258,9 +258,10 @@ namespace xo { } void - DSequenceSsm::visit_gco_children(obj gc) noexcept + DSequenceSsm::visit_gco_children(VisitReason reason, + obj gc) noexcept { - gc.visit_child(&seq_expr_); + gc.visit_child(reason, &seq_expr_); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/DToplevelSeqSsm.cpp b/xo-reader2/src/reader2/DToplevelSeqSsm.cpp index e660f780..cab947b1 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::visit_gco_children(obj) noexcept + DToplevelSeqSsm::visit_gco_children(VisitReason, obj) noexcept { // seqtype_: POD, skip } diff --git a/xo-reader2/src/reader2/ISyntaxStateMachine_Any.cpp b/xo-reader2/src/reader2/ISyntaxStateMachine_Any.cpp index a260bdc9..e20b42f6 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::visit_gco_children(Opaque, obj) -> void +ISyntaxStateMachine_Any::visit_gco_children(Opaque, VisitReason, obj) -> void { _fatal(); } diff --git a/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectExprSsm.cpp b/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectExprSsm.cpp index 0ecc4e24..0d6146e4 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::visit_gco_children(DExpectExprSsm & self, obj gc) -> void + ISyntaxStateMachine_DExpectExprSsm::visit_gco_children(DExpectExprSsm & self, VisitReason reason, obj gc) -> void { - self.visit_gco_children(gc); + self.visit_gco_children(reason, gc); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectFormalArglistSsm.cpp b/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectFormalArglistSsm.cpp index 4db6a480..77bf5f55 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::visit_gco_children(DExpectFormalArglistSsm & self, obj gc) -> void + ISyntaxStateMachine_DExpectFormalArglistSsm::visit_gco_children(DExpectFormalArglistSsm & self, VisitReason reason, obj gc) -> void { - self.visit_gco_children(gc); + self.visit_gco_children(reason, gc); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectQArraySsm.cpp b/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectQArraySsm.cpp index ea8b14cc..2eb6f6b5 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::visit_gco_children(DExpectQArraySsm & self, obj gc) -> void + ISyntaxStateMachine_DExpectQArraySsm::visit_gco_children(DExpectQArraySsm & self, VisitReason reason, obj gc) -> void { - self.visit_gco_children(gc); + self.visit_gco_children(reason, gc); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectQListSsm.cpp b/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectQListSsm.cpp index 363f9646..b0f89a2d 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::visit_gco_children(DExpectQListSsm & self, obj gc) -> void + ISyntaxStateMachine_DExpectQListSsm::visit_gco_children(DExpectQListSsm & self, VisitReason reason, obj gc) -> void { - self.visit_gco_children(gc); + self.visit_gco_children(reason, gc); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectQLiteralSsm.cpp b/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectQLiteralSsm.cpp index 61e15926..69f17c50 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::visit_gco_children(DExpectQLiteralSsm & self, obj gc) -> void + ISyntaxStateMachine_DExpectQLiteralSsm::visit_gco_children(DExpectQLiteralSsm & self, VisitReason reason, obj gc) -> void { - self.visit_gco_children(gc); + self.visit_gco_children(reason, gc); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectSymbolSsm.cpp b/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectSymbolSsm.cpp index c1331ceb..ea2b7a0d 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::visit_gco_children(DExpectSymbolSsm & self, obj gc) -> void + ISyntaxStateMachine_DExpectSymbolSsm::visit_gco_children(DExpectSymbolSsm & self, VisitReason reason, obj gc) -> void { - self.visit_gco_children(gc); + self.visit_gco_children(reason, gc); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectTypeSsm.cpp b/xo-reader2/src/reader2/ISyntaxStateMachine_DExpectTypeSsm.cpp index 8daed04c..e107f011 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::visit_gco_children(DExpectTypeSsm & self, obj gc) -> void + ISyntaxStateMachine_DExpectTypeSsm::visit_gco_children(DExpectTypeSsm & self, VisitReason reason, obj gc) -> void { - self.visit_gco_children(gc); + self.visit_gco_children(reason, gc); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/ISyntaxStateMachine_DParenSsm.cpp b/xo-reader2/src/reader2/ISyntaxStateMachine_DParenSsm.cpp index 42a199cb..f67e77c8 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::visit_gco_children(DParenSsm & self, obj gc) -> void + ISyntaxStateMachine_DParenSsm::visit_gco_children(DParenSsm & self, VisitReason reason, obj gc) -> void { - self.visit_gco_children(gc); + self.visit_gco_children(reason, gc); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/ISyntaxStateMachine_DProgressSsm.cpp b/xo-reader2/src/reader2/ISyntaxStateMachine_DProgressSsm.cpp index 9c5ad07d..5ad51fe2 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::visit_gco_children(DProgressSsm & self, obj gc) -> void + ISyntaxStateMachine_DProgressSsm::visit_gco_children(DProgressSsm & self, VisitReason reason, obj gc) -> void { - self.visit_gco_children(gc); + self.visit_gco_children(reason, gc); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/ISyntaxStateMachine_DSequenceSsm.cpp b/xo-reader2/src/reader2/ISyntaxStateMachine_DSequenceSsm.cpp index a6375288..8dff7fa0 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::visit_gco_children(DSequenceSsm & self, obj gc) -> void + ISyntaxStateMachine_DSequenceSsm::visit_gco_children(DSequenceSsm & self, VisitReason reason, obj gc) -> void { - self.visit_gco_children(gc); + self.visit_gco_children(reason, gc); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/ISyntaxStateMachine_DToplevelSeqSsm.cpp b/xo-reader2/src/reader2/ISyntaxStateMachine_DToplevelSeqSsm.cpp index 47788590..ba17482f 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::visit_gco_children(DToplevelSeqSsm & self, obj gc) -> void + ISyntaxStateMachine_DToplevelSeqSsm::visit_gco_children(DToplevelSeqSsm & self, VisitReason reason, obj gc) -> void { - self.visit_gco_children(gc); + self.visit_gco_children(reason, gc); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/ParserResult.cpp b/xo-reader2/src/reader2/ParserResult.cpp index 609f204f..bb3d4034 100644 --- a/xo-reader2/src/reader2/ParserResult.cpp +++ b/xo-reader2/src/reader2/ParserResult.cpp @@ -106,12 +106,13 @@ namespace xo { } void - ParserResult::visit_gco_children(obj gc) noexcept + ParserResult::visit_gco_children(VisitReason reason, + obj gc) noexcept { // {result_type_, error_src_fn_}: pod, ignore - gc.visit_poly_child(&result_expr_); - gc.visit_child(&error_description_); + gc.visit_poly_child(reason, &result_expr_); + gc.visit_child(reason, &error_description_); } } /*namespace scm*/ } /*namespace xo*/ diff --git a/xo-reader2/src/reader2/ParserStack.cpp b/xo-reader2/src/reader2/ParserStack.cpp index 721b19b4..83d21df1 100644 --- a/xo-reader2/src/reader2/ParserStack.cpp +++ b/xo-reader2/src/reader2/ParserStack.cpp @@ -90,14 +90,15 @@ namespace xo { } void - ParserStack::visit_gco_children(obj gc) noexcept + ParserStack::visit_gco_children(VisitReason reason, + obj gc) noexcept { for (ParserStack * target = this; target; target = target->parent_) { // ParserStack::ckp: skip, POD if (target->ssm_) - target->ssm_.visit_gco_children(gc); + target->ssm_.visit_gco_children(reason, gc); } } diff --git a/xo-reader2/src/reader2/ParserStateMachine.cpp b/xo-reader2/src/reader2/ParserStateMachine.cpp index 6bec1833..71028ebe 100644 --- a/xo-reader2/src/reader2/ParserStateMachine.cpp +++ b/xo-reader2/src/reader2/ParserStateMachine.cpp @@ -907,7 +907,8 @@ namespace xo { #endif void - ParserStateMachine::visit_gco_children(obj gc) noexcept + ParserStateMachine::visit_gco_children(VisitReason reason, + obj gc) noexcept { //scope log(XO_DEBUG(true)); @@ -916,23 +917,23 @@ namespace xo { //log && log("forward stack_", xtag("addr", stack_)); if (stack_) { - stack_->visit_gco_children(gc); + stack_->visit_gco_children(reason, 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.visit_child(&global_symtab_); + gc.visit_child(reason, &global_symtab_); //log && log("local_symtab_", xtag("addr", local_symtab_.data())); - gc.visit_child(&local_symtab_); + gc.visit_child(reason, &local_symtab_); //log && log("global_env_", xtag("addr", global_env_.data())); - gc.visit_child(&global_env_); + gc.visit_child(reason, &global_env_); //log && log("result_"); - result_.visit_gco_children(gc); + result_.visit_gco_children(reason, gc); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/SchematikaReader.cpp b/xo-reader2/src/reader2/SchematikaReader.cpp index c9405916..168f562a 100644 --- a/xo-reader2/src/reader2/SchematikaReader.cpp +++ b/xo-reader2/src/reader2/SchematikaReader.cpp @@ -10,9 +10,10 @@ namespace xo { namespace scm { void - ReaderResult::visit_gco_children(obj gc) noexcept + ReaderResult::visit_gco_children(VisitReason reason, + obj gc) noexcept { - gc.visit_poly_child(&expr_); + gc.visit_poly_child(reason, &expr_); } // ----- SchematikaReader ----- @@ -208,12 +209,13 @@ namespace xo { } void - SchematikaReader::visit_gco_children(obj gc) noexcept + SchematikaReader::visit_gco_children(VisitReason reason, + obj gc) noexcept { // tokenizer doesn't contain any gc-aware pointers. - parser_.visit_gco_children(gc); - result_.visit_gco_children(gc); + parser_.visit_gco_children(reason, gc); + result_.visit_gco_children(reason, gc); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/facet/IGCObject_DGlobalEnv.cpp b/xo-reader2/src/reader2/facet/IGCObject_DGlobalEnv.cpp index 9a2802ae..72c9b065 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.gco_shallow_move(gc); } auto - IGCObject_DGlobalEnv::visit_gco_children(DGlobalEnv & self, obj fn) noexcept -> void + IGCObject_DGlobalEnv::visit_gco_children(DGlobalEnv & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, fn); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/facet/IGCObject_DSchematikaParser.cpp b/xo-reader2/src/reader2/facet/IGCObject_DSchematikaParser.cpp index f1778d5a..7586fc25 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.gco_shallow_move(gc); } auto - IGCObject_DSchematikaParser::visit_gco_children(DSchematikaParser & self, obj fn) noexcept -> void + IGCObject_DSchematikaParser::visit_gco_children(DSchematikaParser & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, fn); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DApplySsm.cpp b/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DApplySsm.cpp index 01f685fe..baba1c7f 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::visit_gco_children(DApplySsm & self, obj gc) -> void + ISyntaxStateMachine_DApplySsm::visit_gco_children(DApplySsm & self, VisitReason reason, obj gc) -> void { - self.visit_gco_children(gc); + self.visit_gco_children(reason, gc); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DDefineSsm.cpp b/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DDefineSsm.cpp index 886155c0..5fe37536 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::visit_gco_children(DDefineSsm & self, obj gc) -> void + ISyntaxStateMachine_DDefineSsm::visit_gco_children(DDefineSsm & self, VisitReason reason, obj gc) -> void { - self.visit_gco_children(gc); + self.visit_gco_children(reason, gc); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DDeftypeSsm.cpp b/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DDeftypeSsm.cpp index 874849ff..a88b1005 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::visit_gco_children(DDeftypeSsm & self, obj gc) -> void + ISyntaxStateMachine_DDeftypeSsm::visit_gco_children(DDeftypeSsm & self, VisitReason reason, obj gc) -> void { - self.visit_gco_children(gc); + self.visit_gco_children(reason, gc); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DExpectFormalArgSsm.cpp b/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DExpectFormalArgSsm.cpp index 85f8dd7a..c0adc804 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::visit_gco_children(DExpectFormalArgSsm & self, obj gc) -> void + ISyntaxStateMachine_DExpectFormalArgSsm::visit_gco_children(DExpectFormalArgSsm & self, VisitReason reason, obj gc) -> void { - self.visit_gco_children(gc); + self.visit_gco_children(reason, gc); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DExpectListTypeSsm.cpp b/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DExpectListTypeSsm.cpp index d3b292ad..1306e061 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::visit_gco_children(DExpectListTypeSsm & self, obj gc) -> void + ISyntaxStateMachine_DExpectListTypeSsm::visit_gco_children(DExpectListTypeSsm & self, VisitReason reason, obj gc) -> void { - self.visit_gco_children(gc); + self.visit_gco_children(reason, gc); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DExpectQDictSsm.cpp b/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DExpectQDictSsm.cpp index 9f4d74cc..5cc75b00 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::visit_gco_children(DExpectQDictSsm & self, obj gc) -> void + ISyntaxStateMachine_DExpectQDictSsm::visit_gco_children(DExpectQDictSsm & self, VisitReason reason, obj gc) -> void { - self.visit_gco_children(gc); + self.visit_gco_children(reason, gc); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DIfElseSsm.cpp b/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DIfElseSsm.cpp index 68034ba4..37a20363 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::visit_gco_children(DIfElseSsm & self, obj gc) -> void + ISyntaxStateMachine_DIfElseSsm::visit_gco_children(DIfElseSsm & self, VisitReason reason, obj gc) -> void { - self.visit_gco_children(gc); + self.visit_gco_children(reason, gc); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DLambdaSsm.cpp b/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DLambdaSsm.cpp index 88e52100..08754857 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::visit_gco_children(DLambdaSsm & self, obj gc) -> void + ISyntaxStateMachine_DLambdaSsm::visit_gco_children(DLambdaSsm & self, VisitReason reason, obj gc) -> void { - self.visit_gco_children(gc); + self.visit_gco_children(reason, gc); } } /*namespace scm*/ diff --git a/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DQuoteSsm.cpp b/xo-reader2/src/reader2/facet/ISyntaxStateMachine_DQuoteSsm.cpp index 39d26414..b4ee1261 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::visit_gco_children(DQuoteSsm & self, obj gc) -> void + ISyntaxStateMachine_DQuoteSsm::visit_gco_children(DQuoteSsm & self, VisitReason reason, obj gc) -> void { - self.visit_gco_children(gc); + self.visit_gco_children(reason, gc); } } /*namespace scm*/ diff --git a/xo-stringtable2/include/xo/stringtable2/DString.hpp b/xo-stringtable2/include/xo/stringtable2/DString.hpp index 7d736a37..73e165de 100644 --- a/xo-stringtable2/include/xo/stringtable2/DString.hpp +++ b/xo-stringtable2/include/xo/stringtable2/DString.hpp @@ -50,6 +50,8 @@ namespace xo { //using ACollector = xo::mm::ACollector; /** object visitor (garbage collector proxy) **/ using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + /** visitor hint **/ + using VisitReason = xo::mm::VisitReason; /** ppindentinfo for APrintable **/ using ppindentinfo = xo::print::ppindentinfo; ///@} @@ -251,7 +253,7 @@ namespace xo { /** fixup child pointers (trivial for DString, no children) * note: cref so we can use forward decl **/ - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, obj gc) noexcept; ///@} diff --git a/xo-stringtable2/include/xo/stringtable2/DUniqueString.hpp b/xo-stringtable2/include/xo/stringtable2/DUniqueString.hpp index 27a364ed..fedf6691 100644 --- a/xo-stringtable2/include/xo/stringtable2/DUniqueString.hpp +++ b/xo-stringtable2/include/xo/stringtable2/DUniqueString.hpp @@ -28,6 +28,7 @@ namespace xo { using AAllocator = xo::mm::AAllocator; using ACollector = xo::mm::ACollector; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using size_type = DString::size_type; using ppindentinfo = xo::print::ppindentinfo; @@ -93,7 +94,7 @@ namespace xo { DUniqueString * gco_shallow_move(obj gc) noexcept; /** fixup child pointers (trivial for DUniqueString, no gc-owned children **/ - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, 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 f35b0a54..e9c15f43 100644 --- a/xo-stringtable2/include/xo/stringtable2/string/IGCObject_DString.hpp +++ b/xo-stringtable2/include/xo/stringtable2/string/IGCObject_DString.hpp @@ -45,6 +45,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -59,7 +60,7 @@ Arguably abusing the word 'visitor' here **/ /** 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; + static void visit_gco_children(DString & self, VisitReason reason, 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 5771e05e..77c0ea6d 100644 --- a/xo-stringtable2/include/xo/stringtable2/uniquestring/IGCObject_DUniqueString.hpp +++ b/xo-stringtable2/include/xo/stringtable2/uniquestring/IGCObject_DUniqueString.hpp @@ -45,6 +45,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -59,7 +60,7 @@ Arguably abusing the word 'visitor' here **/ /** 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; + static void visit_gco_children(DUniqueString & self, VisitReason reason, obj fn) noexcept; ///@} }; diff --git a/xo-stringtable2/src/stringtable2/DString.cpp b/xo-stringtable2/src/stringtable2/DString.cpp index 1b9ce48f..30bfb396 100644 --- a/xo-stringtable2/src/stringtable2/DString.cpp +++ b/xo-stringtable2/src/stringtable2/DString.cpp @@ -167,7 +167,7 @@ namespace xo { } void - DString::visit_gco_children(obj) noexcept + DString::visit_gco_children(VisitReason, obj) noexcept { // no-op. no children! } diff --git a/xo-stringtable2/src/stringtable2/DUniqueString.cpp b/xo-stringtable2/src/stringtable2/DUniqueString.cpp index 98371add..bc63cf0d 100644 --- a/xo-stringtable2/src/stringtable2/DUniqueString.cpp +++ b/xo-stringtable2/src/stringtable2/DUniqueString.cpp @@ -109,7 +109,7 @@ namespace xo { } void - DUniqueString::visit_gco_children(obj) noexcept + DUniqueString::visit_gco_children(VisitReason, obj) noexcept { // no-op -- childless! } diff --git a/xo-stringtable2/src/stringtable2/IGCObject_DString.cpp b/xo-stringtable2/src/stringtable2/IGCObject_DString.cpp index 716c043a..a3a384bb 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.gco_shallow_move(gc); } auto - IGCObject_DString::visit_gco_children(DString & self, obj fn) noexcept -> void + IGCObject_DString::visit_gco_children(DString & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, fn); } } /*namespace scm*/ diff --git a/xo-stringtable2/src/stringtable2/IGCObject_DUniqueString.cpp b/xo-stringtable2/src/stringtable2/IGCObject_DUniqueString.cpp index e43fc8b6..88fbaaa4 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.gco_shallow_move(gc); } auto - IGCObject_DUniqueString::visit_gco_children(DUniqueString & self, obj fn) noexcept -> void + IGCObject_DUniqueString::visit_gco_children(DUniqueString & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, fn); } } /*namespace scm*/ diff --git a/xo-type/include/xo/type/DArrayType.hpp b/xo-type/include/xo/type/DArrayType.hpp index 0f128037..e9b93aa3 100644 --- a/xo-type/include/xo/type/DArrayType.hpp +++ b/xo-type/include/xo/type/DArrayType.hpp @@ -21,6 +21,7 @@ namespace xo { public: //using ACollector = xo::mm::ACollector; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using AAllocator = xo::mm::AAllocator; using TypeDescr = xo::reflect::TypeDescr; @@ -44,7 +45,7 @@ namespace xo { /** @defgroup xo-scm-arraytype-gcobject-facet **/ ///@{ DArrayType * gco_shallow_move(obj gc) noexcept; - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, obj gc) noexcept; ///@} private: diff --git a/xo-type/include/xo/type/DAtomicType.hpp b/xo-type/include/xo/type/DAtomicType.hpp index 1338c1d6..df09e4dc 100644 --- a/xo-type/include/xo/type/DAtomicType.hpp +++ b/xo-type/include/xo/type/DAtomicType.hpp @@ -24,6 +24,7 @@ namespace xo { public: //using ACollector = xo::mm::ACollector; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using AAllocator = xo::mm::AAllocator; using TypeDescr = xo::reflect::TypeDescr; @@ -45,7 +46,7 @@ namespace xo { /** @defgroup xo-scm-atomictype-gcobject-facet **/ ///@{ DAtomicType * gco_shallow_move(obj gc) noexcept; - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, obj gc) noexcept; ///@} private: diff --git a/xo-type/include/xo/type/DFunctionType.hpp b/xo-type/include/xo/type/DFunctionType.hpp index 19d8bbee..496924b5 100644 --- a/xo-type/include/xo/type/DFunctionType.hpp +++ b/xo-type/include/xo/type/DFunctionType.hpp @@ -8,7 +8,6 @@ #include "Type.hpp" #include "Metatype.hpp" #include -//#include #include #include @@ -20,9 +19,9 @@ namespace xo { **/ class DFunctionType { public: - //using ACollector = xo::mm::ACollector; using AGCObject = xo::mm::AGCObject; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using AAllocator = xo::mm::AAllocator; using TypeDescr = xo::reflect::TypeDescr; @@ -66,7 +65,7 @@ namespace xo { /** @defgroup xo-scm-arraytype-gcobject-facet **/ ///@{ DFunctionType * gco_shallow_move(obj gc) noexcept; - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, obj gc) noexcept; ///@} private: diff --git a/xo-type/include/xo/type/DListType.hpp b/xo-type/include/xo/type/DListType.hpp index 7ca75176..fcb4735a 100644 --- a/xo-type/include/xo/type/DListType.hpp +++ b/xo-type/include/xo/type/DListType.hpp @@ -26,6 +26,7 @@ namespace xo { using TypeDescr = xo::reflect::TypeDescr; //using ACollector = xo::mm::ACollector; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using AAllocator = xo::mm::AAllocator; public: @@ -52,7 +53,7 @@ namespace xo { /** @defgroup xo-scm-listtype-gcobject-facet **/ ///@{ DListType * gco_shallow_move(obj gc) noexcept; - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, 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 f03e6b9a..9cbede83 100644 --- a/xo-type/include/xo/type/array/IGCObject_DArrayType.hpp +++ b/xo-type/include/xo/type/array/IGCObject_DArrayType.hpp @@ -43,6 +43,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -57,7 +58,7 @@ Arguably abusing the word 'visitor' here **/ /** 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; + static void visit_gco_children(DArrayType & self, VisitReason reason, 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 dbba8a3a..d29bd6a7 100644 --- a/xo-type/include/xo/type/atomic/IGCObject_DAtomicType.hpp +++ b/xo-type/include/xo/type/atomic/IGCObject_DAtomicType.hpp @@ -43,6 +43,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -57,7 +58,7 @@ Arguably abusing the word 'visitor' here **/ /** 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; + static void visit_gco_children(DAtomicType & self, VisitReason reason, 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 6840ffd6..0d544878 100644 --- a/xo-type/include/xo/type/function/IGCObject_DFunctionType.hpp +++ b/xo-type/include/xo/type/function/IGCObject_DFunctionType.hpp @@ -43,6 +43,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -57,7 +58,7 @@ Arguably abusing the word 'visitor' here **/ /** 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; + static void visit_gco_children(DFunctionType & self, VisitReason reason, 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 752bb76e..edb17816 100644 --- a/xo-type/include/xo/type/list/IGCObject_DListType.hpp +++ b/xo-type/include/xo/type/list/IGCObject_DListType.hpp @@ -43,6 +43,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -57,7 +58,7 @@ Arguably abusing the word 'visitor' here **/ /** 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; + static void visit_gco_children(DListType & self, VisitReason reason, obj fn) noexcept; ///@} }; diff --git a/xo-type/include/xo/type/typevar/DTypeVarRef.hpp b/xo-type/include/xo/type/typevar/DTypeVarRef.hpp index d1f8258e..3c60b05a 100644 --- a/xo-type/include/xo/type/typevar/DTypeVarRef.hpp +++ b/xo-type/include/xo/type/typevar/DTypeVarRef.hpp @@ -24,6 +24,7 @@ namespace xo { public: //using ACollector = xo::mm::ACollector; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using AAllocator = xo::mm::AAllocator; using TypeDescr = xo::reflect::TypeDescr; @@ -55,7 +56,7 @@ namespace xo { /** @defgroup xo-scm-atomictype-gcobject-facet **/ ///@{ DTypeVarRef * gco_shallow_move(obj gc) noexcept; - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, 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 d837afa2..1ba0a87c 100644 --- a/xo-type/include/xo/type/typevar/IGCObject_DTypeVarRef.hpp +++ b/xo-type/include/xo/type/typevar/IGCObject_DTypeVarRef.hpp @@ -43,6 +43,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -57,7 +58,7 @@ Arguably abusing the word 'visitor' here **/ /** 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; + static void visit_gco_children(DTypeVarRef & self, VisitReason reason, obj fn) noexcept; ///@} }; diff --git a/xo-type/src/type/DArrayType.cpp b/xo-type/src/type/DArrayType.cpp index 891a83c8..a46752bc 100644 --- a/xo-type/src/type/DArrayType.cpp +++ b/xo-type/src/type/DArrayType.cpp @@ -83,13 +83,9 @@ namespace xo { } void - DArrayType::visit_gco_children(obj gc) noexcept + DArrayType::visit_gco_children(VisitReason reason, obj gc) noexcept { - gc.visit_poly_child(&elt_type_); - //{ - // auto e = FacetRegistry::instance().variant(elt_type_); - // gc.forward_inplace(e.iface(), (void **)&(elt_type_.data_)); - //} + gc.visit_poly_child(reason, &elt_type_); } } } diff --git a/xo-type/src/type/DAtomicType.cpp b/xo-type/src/type/DAtomicType.cpp index 6c024344..833d19d1 100644 --- a/xo-type/src/type/DAtomicType.cpp +++ b/xo-type/src/type/DAtomicType.cpp @@ -61,7 +61,7 @@ namespace xo { } void - DAtomicType::visit_gco_children(obj) noexcept + DAtomicType::visit_gco_children(VisitReason, obj) noexcept { // no-op. no children } diff --git a/xo-type/src/type/DFunctionType.cpp b/xo-type/src/type/DFunctionType.cpp index 934fae15..2b4b8f7c 100644 --- a/xo-type/src/type/DFunctionType.cpp +++ b/xo-type/src/type/DFunctionType.cpp @@ -94,15 +94,10 @@ namespace xo { } void - DFunctionType::visit_gco_children(obj gc) noexcept + DFunctionType::visit_gco_children(VisitReason reason, obj gc) noexcept { - gc.visit_poly_child(&return_type_); - //{ - // auto e = FacetRegistry::instance().variant(return_type_); - // gc.forward_inplace(e.iface(), (void **)&(return_type_.data_)); - //} - - gc.visit_child(&arg_types_); + gc.visit_poly_child(reason, &return_type_); + gc.visit_child(reason, &arg_types_); } } /*namespace scm*/ diff --git a/xo-type/src/type/DListType.cpp b/xo-type/src/type/DListType.cpp index 20a69302..0647d8b2 100644 --- a/xo-type/src/type/DListType.cpp +++ b/xo-type/src/type/DListType.cpp @@ -88,9 +88,10 @@ namespace xo { } void - DListType::visit_gco_children(obj gc) noexcept + DListType::visit_gco_children(VisitReason reason, + obj gc) noexcept { - gc.visit_poly_child(&elt_type_); + gc.visit_poly_child(reason, &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 d9f38160..86691122 100644 --- a/xo-type/src/type/DTypeVarRef.cpp +++ b/xo-type/src/type/DTypeVarRef.cpp @@ -82,9 +82,9 @@ namespace xo { } void - DTypeVarRef::visit_gco_children(obj gc) noexcept + DTypeVarRef::visit_gco_children(VisitReason reason, obj gc) noexcept { - gc.visit_poly_child(&type_); + gc.visit_poly_child(reason, &type_); //{ // auto e = FacetRegistry::instance().variant(type_); diff --git a/xo-type/src/type/IGCObject_DArrayType.cpp b/xo-type/src/type/IGCObject_DArrayType.cpp index d778c3aa..76b9c550 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.gco_shallow_move(gc); } auto - IGCObject_DArrayType::visit_gco_children(DArrayType & self, obj fn) noexcept -> void + IGCObject_DArrayType::visit_gco_children(DArrayType & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, fn); } } /*namespace scm*/ diff --git a/xo-type/src/type/IGCObject_DAtomicType.cpp b/xo-type/src/type/IGCObject_DAtomicType.cpp index 13b4a83f..7c4a27e0 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.gco_shallow_move(gc); } auto - IGCObject_DAtomicType::visit_gco_children(DAtomicType & self, obj fn) noexcept -> void + IGCObject_DAtomicType::visit_gco_children(DAtomicType & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, fn); } } /*namespace scm*/ diff --git a/xo-type/src/type/IGCObject_DFunctionType.cpp b/xo-type/src/type/IGCObject_DFunctionType.cpp index 65bdd67b..25e5e3a7 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.gco_shallow_move(gc); } auto - IGCObject_DFunctionType::visit_gco_children(DFunctionType & self, obj fn) noexcept -> void + IGCObject_DFunctionType::visit_gco_children(DFunctionType & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, fn); } } /*namespace scm*/ diff --git a/xo-type/src/type/IGCObject_DListType.cpp b/xo-type/src/type/IGCObject_DListType.cpp index 032a3f5d..43a02911 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.gco_shallow_move(gc); } auto - IGCObject_DListType::visit_gco_children(DListType & self, obj fn) noexcept -> void + IGCObject_DListType::visit_gco_children(DListType & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, fn); } } /*namespace scm*/ diff --git a/xo-type/src/type/IGCObject_DTypeVarRef.cpp b/xo-type/src/type/IGCObject_DTypeVarRef.cpp index 8c5422db..2169b1e3 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.gco_shallow_move(gc); } auto - IGCObject_DTypeVarRef::visit_gco_children(DTypeVarRef & self, obj fn) noexcept -> void + IGCObject_DTypeVarRef::visit_gco_children(DTypeVarRef & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, fn); } } /*namespace scm*/