diff --git a/include/xo/stringtable2/DString.hpp b/include/xo/stringtable2/DString.hpp index cdb362d..75090f2 100644 --- a/include/xo/stringtable2/DString.hpp +++ b/include/xo/stringtable2/DString.hpp @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -47,6 +48,8 @@ namespace xo { using AAllocator = xo::mm::AAllocator; /** garbage collector **/ using ACollector = xo::mm::ACollector; + /** object visitor (garbage collector proxy) **/ + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; /** ppindentinfo for APrintable **/ using ppindentinfo = xo::print::ppindentinfo; ///@} @@ -247,10 +250,10 @@ namespace xo { /** clone string, using memory from allocator @p mm **/ DString * shallow_move(obj gc) noexcept; - size_type forward_children(obj gc) noexcept; /** fixup child pointers (trivial for DString, no children) * note: cref so we can use forward decl **/ + void visit_gco_children(obj gc) noexcept; ///@} diff --git a/include/xo/stringtable2/DUniqueString.hpp b/include/xo/stringtable2/DUniqueString.hpp index 71427c4..7e3502b 100644 --- a/include/xo/stringtable2/DUniqueString.hpp +++ b/include/xo/stringtable2/DUniqueString.hpp @@ -27,6 +27,7 @@ namespace xo { public: using AAllocator = xo::mm::AAllocator; using ACollector = xo::mm::ACollector; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using size_type = DString::size_type; using ppindentinfo = xo::print::ppindentinfo; @@ -92,7 +93,7 @@ namespace xo { DUniqueString * shallow_move(obj gc) noexcept; /** fixup child pointers (trivial for DUniqueString, no gc-owned children **/ - void forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} diff --git a/include/xo/stringtable2/string/IGCObject_DString.hpp b/include/xo/stringtable2/string/IGCObject_DString.hpp index 4eaa9dc..6fcbd3b 100644 --- a/include/xo/stringtable2/string/IGCObject_DString.hpp +++ b/include/xo/stringtable2/string/IGCObject_DString.hpp @@ -44,6 +44,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -54,8 +55,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DString & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DString & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DString & self, obj fn) noexcept; ///@} }; diff --git a/include/xo/stringtable2/uniquestring/IGCObject_DUniqueString.hpp b/include/xo/stringtable2/uniquestring/IGCObject_DUniqueString.hpp index b6e1d19..a175565 100644 --- a/include/xo/stringtable2/uniquestring/IGCObject_DUniqueString.hpp +++ b/include/xo/stringtable2/uniquestring/IGCObject_DUniqueString.hpp @@ -44,6 +44,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -54,8 +55,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DUniqueString & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DUniqueString & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DUniqueString & self, obj fn) noexcept; ///@} }; diff --git a/src/stringtable2/DString.cpp b/src/stringtable2/DString.cpp index c3340f4..7bd16fb 100644 --- a/src/stringtable2/DString.cpp +++ b/src/stringtable2/DString.cpp @@ -172,10 +172,10 @@ namespace xo { return copy; } - auto - DString::forward_children(obj) noexcept -> size_type + void + DString::visit_gco_children(obj) noexcept { - return shallow_size(); + // no-op. no children! } bool diff --git a/src/stringtable2/DUniqueString.cpp b/src/stringtable2/DUniqueString.cpp index 43e7f1c..2660e5d 100644 --- a/src/stringtable2/DUniqueString.cpp +++ b/src/stringtable2/DUniqueString.cpp @@ -109,9 +109,9 @@ namespace xo { } void - DUniqueString::forward_children(obj) noexcept + DUniqueString::visit_gco_children(obj) noexcept { - // no-op + // no-op -- childless! } } /*namespace scm*/ } /*namespace xo*/ diff --git a/src/stringtable2/IGCObject_DString.cpp b/src/stringtable2/IGCObject_DString.cpp index d838e65..f77077b 100644 --- a/src/stringtable2/IGCObject_DString.cpp +++ b/src/stringtable2/IGCObject_DString.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DString::forward_children(DString & self, obj gc) noexcept -> void + IGCObject_DString::visit_gco_children(DString & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ diff --git a/src/stringtable2/IGCObject_DUniqueString.cpp b/src/stringtable2/IGCObject_DUniqueString.cpp index 60a4d9b..a259148 100644 --- a/src/stringtable2/IGCObject_DUniqueString.cpp +++ b/src/stringtable2/IGCObject_DUniqueString.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DUniqueString::forward_children(DUniqueString & self, obj gc) noexcept -> void + IGCObject_DUniqueString::visit_gco_children(DUniqueString & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/