diff --git a/include/xo/expression2/DApplyExpr.hpp b/include/xo/expression2/DApplyExpr.hpp index bc5cdc47..cb0be70f 100644 --- a/include/xo/expression2/DApplyExpr.hpp +++ b/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/include/xo/expression2/DConstant.hpp b/include/xo/expression2/DConstant.hpp index e81a7b2d..bf901537 100644 --- a/include/xo/expression2/DConstant.hpp +++ b/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/include/xo/expression2/DDefineExpr.hpp b/include/xo/expression2/DDefineExpr.hpp index 474a4122..3f0071fd 100644 --- a/include/xo/expression2/DDefineExpr.hpp +++ b/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/include/xo/expression2/DGlobalSymtab.hpp b/include/xo/expression2/DGlobalSymtab.hpp index b3840a69..4a7fdf93 100644 --- a/include/xo/expression2/DGlobalSymtab.hpp +++ b/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/include/xo/expression2/DIfElseExpr.hpp b/include/xo/expression2/DIfElseExpr.hpp index 04a354dd..bc83ccd4 100644 --- a/include/xo/expression2/DIfElseExpr.hpp +++ b/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/include/xo/expression2/DLambdaExpr.hpp b/include/xo/expression2/DLambdaExpr.hpp index e4b0296d..b7fc76a8 100644 --- a/include/xo/expression2/DLambdaExpr.hpp +++ b/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/include/xo/expression2/DLocalSymtab.hpp b/include/xo/expression2/DLocalSymtab.hpp index 081742b0..b658bbd5 100644 --- a/include/xo/expression2/DLocalSymtab.hpp +++ b/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/include/xo/expression2/DSequenceExpr.hpp b/include/xo/expression2/DSequenceExpr.hpp index 4a103e0e..e919ae13 100644 --- a/include/xo/expression2/DSequenceExpr.hpp +++ b/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/include/xo/expression2/DTypename.hpp b/include/xo/expression2/DTypename.hpp index 7ddacd21..64ec86bc 100644 --- a/include/xo/expression2/DTypename.hpp +++ b/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/include/xo/expression2/DVarRef.hpp b/include/xo/expression2/DVarRef.hpp index 002e511a..93224199 100644 --- a/include/xo/expression2/DVarRef.hpp +++ b/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/include/xo/expression2/DVariable.hpp b/include/xo/expression2/DVariable.hpp index 5813ae1b..158ef842 100644 --- a/include/xo/expression2/DVariable.hpp +++ b/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/include/xo/expression2/TypeRef.hpp b/include/xo/expression2/TypeRef.hpp index f56028ba..c93158fb 100644 --- a/include/xo/expression2/TypeRef.hpp +++ b/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/include/xo/expression2/define/IGCObject_DDefineExpr.hpp b/include/xo/expression2/define/IGCObject_DDefineExpr.hpp index 6a233f92..c07c8e4e 100644 --- a/include/xo/expression2/define/IGCObject_DDefineExpr.hpp +++ b/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/include/xo/expression2/detail/IGCObject_DApplyExpr.hpp b/include/xo/expression2/detail/IGCObject_DApplyExpr.hpp index 399d9398..a1a2fac4 100644 --- a/include/xo/expression2/detail/IGCObject_DApplyExpr.hpp +++ b/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/include/xo/expression2/detail/IGCObject_DConstant.hpp b/include/xo/expression2/detail/IGCObject_DConstant.hpp index b2e624be..82783948 100644 --- a/include/xo/expression2/detail/IGCObject_DConstant.hpp +++ b/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/include/xo/expression2/detail/IGCObject_DIfElseExpr.hpp b/include/xo/expression2/detail/IGCObject_DIfElseExpr.hpp index 80a49f22..3156fe58 100644 --- a/include/xo/expression2/detail/IGCObject_DIfElseExpr.hpp +++ b/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/include/xo/expression2/detail/IGCObject_DLambdaExpr.hpp b/include/xo/expression2/detail/IGCObject_DLambdaExpr.hpp index 5decc2a0..ec4faded 100644 --- a/include/xo/expression2/detail/IGCObject_DLambdaExpr.hpp +++ b/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/include/xo/expression2/detail/IGCObject_DSequenceExpr.hpp b/include/xo/expression2/detail/IGCObject_DSequenceExpr.hpp index 54bab050..1b927e01 100644 --- a/include/xo/expression2/detail/IGCObject_DSequenceExpr.hpp +++ b/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/include/xo/expression2/detail/IGCObject_DVarRef.hpp b/include/xo/expression2/detail/IGCObject_DVarRef.hpp index 98c65aab..085999f9 100644 --- a/include/xo/expression2/detail/IGCObject_DVarRef.hpp +++ b/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/include/xo/expression2/symtab/IGCObject_DGlobalSymtab.hpp b/include/xo/expression2/symtab/IGCObject_DGlobalSymtab.hpp index 334c0ea9..ee24adfb 100644 --- a/include/xo/expression2/symtab/IGCObject_DGlobalSymtab.hpp +++ b/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/include/xo/expression2/symtab/IGCObject_DLocalSymtab.hpp b/include/xo/expression2/symtab/IGCObject_DLocalSymtab.hpp index c7890a79..cbd98904 100644 --- a/include/xo/expression2/symtab/IGCObject_DLocalSymtab.hpp +++ b/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/include/xo/expression2/typename/IGCObject_DTypename.hpp b/include/xo/expression2/typename/IGCObject_DTypename.hpp index e8946864..cdd91734 100644 --- a/include/xo/expression2/typename/IGCObject_DTypename.hpp +++ b/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/include/xo/expression2/variable/IGCObject_DVariable.hpp b/include/xo/expression2/variable/IGCObject_DVariable.hpp index 3a31f155..9e173090 100644 --- a/include/xo/expression2/variable/IGCObject_DVariable.hpp +++ b/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/src/expression2/DApplyExpr.cpp b/src/expression2/DApplyExpr.cpp index 2776b438..0f9a5c5c 100644 --- a/src/expression2/DApplyExpr.cpp +++ b/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/src/expression2/DConstant.cpp b/src/expression2/DConstant.cpp index 19805cb5..441d24a0 100644 --- a/src/expression2/DConstant.cpp +++ b/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/src/expression2/DDefineExpr.cpp b/src/expression2/DDefineExpr.cpp index ba481805..7bcf817b 100644 --- a/src/expression2/DDefineExpr.cpp +++ b/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/src/expression2/DGlobalSymtab.cpp b/src/expression2/DGlobalSymtab.cpp index f5df4a4c..7b6bd760 100644 --- a/src/expression2/DGlobalSymtab.cpp +++ b/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/src/expression2/DIfElseExpr.cpp b/src/expression2/DIfElseExpr.cpp index b8758387..6042104b 100644 --- a/src/expression2/DIfElseExpr.cpp +++ b/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/src/expression2/DLambdaExpr.cpp b/src/expression2/DLambdaExpr.cpp index c73ccc8a..1b512b0c 100644 --- a/src/expression2/DLambdaExpr.cpp +++ b/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/src/expression2/DLocalSymtab.cpp b/src/expression2/DLocalSymtab.cpp index 1fa1afd8..9d85a97c 100644 --- a/src/expression2/DLocalSymtab.cpp +++ b/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/src/expression2/DSequenceExpr.cpp b/src/expression2/DSequenceExpr.cpp index a180a5fb..8fdfcf9b 100644 --- a/src/expression2/DSequenceExpr.cpp +++ b/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/src/expression2/DTypename.cpp b/src/expression2/DTypename.cpp index da73f28f..c8debab9 100644 --- a/src/expression2/DTypename.cpp +++ b/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/src/expression2/DVarRef.cpp b/src/expression2/DVarRef.cpp index 57a39153..b73efe10 100644 --- a/src/expression2/DVarRef.cpp +++ b/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/src/expression2/DVariable.cpp b/src/expression2/DVariable.cpp index 209764cd..066aeb50 100644 --- a/src/expression2/DVariable.cpp +++ b/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/src/expression2/IGCObject_DApplyExpr.cpp b/src/expression2/IGCObject_DApplyExpr.cpp index d2574d64..610b675b 100644 --- a/src/expression2/IGCObject_DApplyExpr.cpp +++ b/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/src/expression2/IGCObject_DConstant.cpp b/src/expression2/IGCObject_DConstant.cpp index be6f583d..20c71341 100644 --- a/src/expression2/IGCObject_DConstant.cpp +++ b/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/src/expression2/IGCObject_DDefineExpr.cpp b/src/expression2/IGCObject_DDefineExpr.cpp index f2ea0747..8540ab25 100644 --- a/src/expression2/IGCObject_DDefineExpr.cpp +++ b/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/src/expression2/IGCObject_DGlobalSymtab.cpp b/src/expression2/IGCObject_DGlobalSymtab.cpp index 3070a26c..01153218 100644 --- a/src/expression2/IGCObject_DGlobalSymtab.cpp +++ b/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/src/expression2/IGCObject_DIfElseExpr.cpp b/src/expression2/IGCObject_DIfElseExpr.cpp index 6f788e03..22878fea 100644 --- a/src/expression2/IGCObject_DIfElseExpr.cpp +++ b/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/src/expression2/IGCObject_DLambdaExpr.cpp b/src/expression2/IGCObject_DLambdaExpr.cpp index b4706c56..05bd85a0 100644 --- a/src/expression2/IGCObject_DLambdaExpr.cpp +++ b/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/src/expression2/IGCObject_DLocalSymtab.cpp b/src/expression2/IGCObject_DLocalSymtab.cpp index 5e37d826..7ccadca0 100644 --- a/src/expression2/IGCObject_DLocalSymtab.cpp +++ b/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/src/expression2/IGCObject_DSequenceExpr.cpp b/src/expression2/IGCObject_DSequenceExpr.cpp index 1f92c2e2..0cc84faa 100644 --- a/src/expression2/IGCObject_DSequenceExpr.cpp +++ b/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/src/expression2/IGCObject_DTypename.cpp b/src/expression2/IGCObject_DTypename.cpp index ca21870a..accbfc6e 100644 --- a/src/expression2/IGCObject_DTypename.cpp +++ b/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/src/expression2/IGCObject_DVarRef.cpp b/src/expression2/IGCObject_DVarRef.cpp index 68d6e1d2..e169c37f 100644 --- a/src/expression2/IGCObject_DVarRef.cpp +++ b/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/src/expression2/TypeRef.cpp b/src/expression2/TypeRef.cpp index 961ae148..e3178b7f 100644 --- a/src/expression2/TypeRef.cpp +++ b/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/src/expression2/facet/IGCObject_DVariable.cpp b/src/expression2/facet/IGCObject_DVariable.cpp index 0a91bfb2..8734ca7a 100644 --- a/src/expression2/facet/IGCObject_DVariable.cpp +++ b/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*/