From 70c0591a9e4af2af7ba0810d64923373756ae5b2 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Fri, 10 Apr 2026 01:10:03 -0400 Subject: [PATCH] xo-interpreter2 stack: + reason arg to visit_gco_children() Helps streamline DX1Collector in xo-gc/. Want both forward and verify entry points for the same representation. --- include/xo/type/DArrayType.hpp | 3 ++- include/xo/type/DAtomicType.hpp | 3 ++- include/xo/type/DFunctionType.hpp | 5 ++--- include/xo/type/DListType.hpp | 3 ++- include/xo/type/array/IGCObject_DArrayType.hpp | 3 ++- include/xo/type/atomic/IGCObject_DAtomicType.hpp | 3 ++- include/xo/type/function/IGCObject_DFunctionType.hpp | 3 ++- include/xo/type/list/IGCObject_DListType.hpp | 3 ++- include/xo/type/typevar/DTypeVarRef.hpp | 3 ++- include/xo/type/typevar/IGCObject_DTypeVarRef.hpp | 3 ++- src/type/DArrayType.cpp | 8 ++------ src/type/DAtomicType.cpp | 2 +- src/type/DFunctionType.cpp | 11 +++-------- src/type/DListType.cpp | 5 +++-- src/type/DTypeVarRef.cpp | 4 ++-- src/type/IGCObject_DArrayType.cpp | 4 ++-- src/type/IGCObject_DAtomicType.cpp | 4 ++-- src/type/IGCObject_DFunctionType.cpp | 4 ++-- src/type/IGCObject_DListType.cpp | 4 ++-- src/type/IGCObject_DTypeVarRef.cpp | 4 ++-- 20 files changed, 41 insertions(+), 41 deletions(-) diff --git a/include/xo/type/DArrayType.hpp b/include/xo/type/DArrayType.hpp index 0f12803..e9b93aa 100644 --- a/include/xo/type/DArrayType.hpp +++ b/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/include/xo/type/DAtomicType.hpp b/include/xo/type/DAtomicType.hpp index 1338c1d..df09e4d 100644 --- a/include/xo/type/DAtomicType.hpp +++ b/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/include/xo/type/DFunctionType.hpp b/include/xo/type/DFunctionType.hpp index 19d8bbe..496924b 100644 --- a/include/xo/type/DFunctionType.hpp +++ b/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/include/xo/type/DListType.hpp b/include/xo/type/DListType.hpp index 7ca7517..fcb4735 100644 --- a/include/xo/type/DListType.hpp +++ b/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/include/xo/type/array/IGCObject_DArrayType.hpp b/include/xo/type/array/IGCObject_DArrayType.hpp index f03e6b9..9cbede8 100644 --- a/include/xo/type/array/IGCObject_DArrayType.hpp +++ b/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/include/xo/type/atomic/IGCObject_DAtomicType.hpp b/include/xo/type/atomic/IGCObject_DAtomicType.hpp index dbba8a3..d29bd6a 100644 --- a/include/xo/type/atomic/IGCObject_DAtomicType.hpp +++ b/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/include/xo/type/function/IGCObject_DFunctionType.hpp b/include/xo/type/function/IGCObject_DFunctionType.hpp index 6840ffd..0d54487 100644 --- a/include/xo/type/function/IGCObject_DFunctionType.hpp +++ b/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/include/xo/type/list/IGCObject_DListType.hpp b/include/xo/type/list/IGCObject_DListType.hpp index 752bb76..edb1781 100644 --- a/include/xo/type/list/IGCObject_DListType.hpp +++ b/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/include/xo/type/typevar/DTypeVarRef.hpp b/include/xo/type/typevar/DTypeVarRef.hpp index d1f8258..3c60b05 100644 --- a/include/xo/type/typevar/DTypeVarRef.hpp +++ b/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/include/xo/type/typevar/IGCObject_DTypeVarRef.hpp b/include/xo/type/typevar/IGCObject_DTypeVarRef.hpp index d837afa..1ba0a87 100644 --- a/include/xo/type/typevar/IGCObject_DTypeVarRef.hpp +++ b/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/src/type/DArrayType.cpp b/src/type/DArrayType.cpp index 891a83c..a46752b 100644 --- a/src/type/DArrayType.cpp +++ b/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/src/type/DAtomicType.cpp b/src/type/DAtomicType.cpp index 6c02434..833d19d 100644 --- a/src/type/DAtomicType.cpp +++ b/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/src/type/DFunctionType.cpp b/src/type/DFunctionType.cpp index 934fae1..2b4b8f7 100644 --- a/src/type/DFunctionType.cpp +++ b/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/src/type/DListType.cpp b/src/type/DListType.cpp index 20a6930..0647d8b 100644 --- a/src/type/DListType.cpp +++ b/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/src/type/DTypeVarRef.cpp b/src/type/DTypeVarRef.cpp index d9f3816..8669112 100644 --- a/src/type/DTypeVarRef.cpp +++ b/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/src/type/IGCObject_DArrayType.cpp b/src/type/IGCObject_DArrayType.cpp index d778c3a..76b9c55 100644 --- a/src/type/IGCObject_DArrayType.cpp +++ b/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/src/type/IGCObject_DAtomicType.cpp b/src/type/IGCObject_DAtomicType.cpp index 13b4a83..7c4a27e 100644 --- a/src/type/IGCObject_DAtomicType.cpp +++ b/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/src/type/IGCObject_DFunctionType.cpp b/src/type/IGCObject_DFunctionType.cpp index 65bdd67..25e5e3a 100644 --- a/src/type/IGCObject_DFunctionType.cpp +++ b/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/src/type/IGCObject_DListType.cpp b/src/type/IGCObject_DListType.cpp index 032a3f5..43a0291 100644 --- a/src/type/IGCObject_DListType.cpp +++ b/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/src/type/IGCObject_DTypeVarRef.cpp b/src/type/IGCObject_DTypeVarRef.cpp index 8c5422d..2169b1e 100644 --- a/src/type/IGCObject_DTypeVarRef.cpp +++ b/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*/