From 6188b6398b71c4829d526deac3c85e7c780fa9a9 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Mon, 6 Apr 2026 15:21:48 -0400 Subject: [PATCH] refactor: use GCObjectVisitor api w/ gco_shallow_move --- idl/Procedure.json5 | 2 +- idl/RuntimeContext.json5 | 1 + include/xo/procedure2/DPrimitive.hpp | 6 +++--- include/xo/procedure2/detail/ARuntimeContext.hpp | 1 + include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp | 5 +++-- .../xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp | 5 +++-- .../detail/IGCObject_DPrimitive_gco_2_dict_string.hpp | 5 +++-- .../detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp | 5 +++-- .../detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp | 5 +++-- include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp | 1 + src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp | 4 ++-- src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp | 4 ++-- .../facet/IGCObject_DPrimitive_gco_2_dict_string.cpp | 4 ++-- src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp | 4 ++-- .../facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp | 4 ++-- 15 files changed, 32 insertions(+), 24 deletions(-) diff --git a/idl/Procedure.json5 b/idl/Procedure.json5 index e73c6d8..25e1fed 100644 --- a/idl/Procedure.json5 +++ b/idl/Procedure.json5 @@ -17,7 +17,7 @@ ], namespace1: "xo", namespace2: "scm", - // text after includes, before ASyntaxStateMachine + // text after includes, before AProcedure pretext: [ //"namespace xo { namespace scm { class ARuntimeContext; } }", "namespace xo { namespace scm { class DArray; } }", diff --git a/idl/RuntimeContext.json5 b/idl/RuntimeContext.json5 index 8736f38..fd829e6 100644 --- a/idl/RuntimeContext.json5 +++ b/idl/RuntimeContext.json5 @@ -7,6 +7,7 @@ includes: [ "", "", + "", "" ], // extra includes in RuntimeContext.hpp, if any diff --git a/include/xo/procedure2/DPrimitive.hpp b/include/xo/procedure2/DPrimitive.hpp index f0e1b5e..3779831 100644 --- a/include/xo/procedure2/DPrimitive.hpp +++ b/include/xo/procedure2/DPrimitive.hpp @@ -76,7 +76,7 @@ namespace xo { using FunctionPtrType = Fn; using Traits = detail::PmFnTraits; - using ACollector = xo::mm::ACollector; + //using ACollector = xo::mm::ACollector; using AGCObject = xo::mm::AGCObject; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AAllocator = xo::mm::AAllocator; @@ -135,7 +135,7 @@ namespace xo { ///@} /** @defgroup scm-primitive-gcobject-facet **/ ///@{ - Primitive * shallow_move(obj gc) noexcept; + Primitive * gco_shallow_move(obj gc) noexcept; void visit_gco_children(obj gc) noexcept; ///@} @@ -193,7 +193,7 @@ namespace xo { template Primitive * - Primitive::shallow_move(obj gc) noexcept { + Primitive::gco_shallow_move(obj gc) noexcept { return gc.std_move_for(this); } diff --git a/include/xo/procedure2/detail/ARuntimeContext.hpp b/include/xo/procedure2/detail/ARuntimeContext.hpp index c9da6d6..a6d6d4c 100644 --- a/include/xo/procedure2/detail/ARuntimeContext.hpp +++ b/include/xo/procedure2/detail/ARuntimeContext.hpp @@ -16,6 +16,7 @@ // includes (via {facet_includes}) #include #include +#include #include #include #include diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp index 4fa87f2..beca085 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp @@ -53,8 +53,9 @@ namespace xo { // const methods // non-const methods - /** move instance using collector **/ - static Opaque shallow_move(DPrimitive_gco_0 & self, obj gc) noexcept; + /** move instance using object visitor. +Arguably abusing the word 'visitor' here **/ + static Opaque gco_shallow_move(DPrimitive_gco_0 & self, obj gc) noexcept; /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. Context: provides address of data pointer so it can be updated in place when @p fn invokes garbage collector reentry point **/ diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp index 9b87a83..3092e52 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp @@ -53,8 +53,9 @@ namespace xo { // const methods // non-const methods - /** move instance using collector **/ - static Opaque shallow_move(DPrimitive_gco_1_gco & self, obj gc) noexcept; + /** move instance using object visitor. +Arguably abusing the word 'visitor' here **/ + static Opaque gco_shallow_move(DPrimitive_gco_1_gco & self, obj gc) noexcept; /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. Context: provides address of data pointer so it can be updated in place when @p fn invokes garbage collector reentry point **/ diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp index 85dda05..1fca4b6 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp @@ -53,8 +53,9 @@ namespace xo { // const methods // non-const methods - /** move instance using collector **/ - static Opaque shallow_move(DPrimitive_gco_2_dict_string & self, obj gc) noexcept; + /** move instance using object visitor. +Arguably abusing the word 'visitor' here **/ + static Opaque gco_shallow_move(DPrimitive_gco_2_dict_string & self, obj gc) noexcept; /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. Context: provides address of data pointer so it can be updated in place when @p fn invokes garbage collector reentry point **/ diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp index 4acfd81..14e66c3 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp @@ -53,8 +53,9 @@ namespace xo { // const methods // non-const methods - /** move instance using collector **/ - static Opaque shallow_move(DPrimitive_gco_2_gco_gco & self, obj gc) noexcept; + /** move instance using object visitor. +Arguably abusing the word 'visitor' here **/ + static Opaque gco_shallow_move(DPrimitive_gco_2_gco_gco & self, obj gc) noexcept; /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. Context: provides address of data pointer so it can be updated in place when @p fn invokes garbage collector reentry point **/ diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp index 0a23e79..994682c 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp @@ -53,8 +53,9 @@ namespace xo { // const methods // non-const methods - /** move instance using collector **/ - static Opaque shallow_move(DPrimitive_gco_3_dict_string_gco & self, obj gc) noexcept; + /** move instance using object visitor. +Arguably abusing the word 'visitor' here **/ + static Opaque gco_shallow_move(DPrimitive_gco_3_dict_string_gco & self, obj gc) noexcept; /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. Context: provides address of data pointer so it can be updated in place when @p fn invokes garbage collector reentry point **/ diff --git a/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp b/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp index d1a8e8c..07b3074 100644 --- a/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp +++ b/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp @@ -15,6 +15,7 @@ #include #include +#include #include namespace xo { diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp index 0819f51..150adfd 100644 --- a/src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp @@ -16,9 +16,9 @@ namespace xo { namespace scm { auto - IGCObject_DPrimitive_gco_0::shallow_move(DPrimitive_gco_0 & self, obj gc) noexcept -> Opaque + IGCObject_DPrimitive_gco_0::gco_shallow_move(DPrimitive_gco_0 & self, obj gc) noexcept -> Opaque { - return self.shallow_move(gc); + return self.gco_shallow_move(gc); } auto IGCObject_DPrimitive_gco_0::visit_gco_children(DPrimitive_gco_0 & self, obj fn) noexcept -> void diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp index 7561d16..202389d 100644 --- a/src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp @@ -16,9 +16,9 @@ namespace xo { namespace scm { auto - IGCObject_DPrimitive_gco_1_gco::shallow_move(DPrimitive_gco_1_gco & self, obj gc) noexcept -> Opaque + IGCObject_DPrimitive_gco_1_gco::gco_shallow_move(DPrimitive_gco_1_gco & self, obj gc) noexcept -> Opaque { - return self.shallow_move(gc); + return self.gco_shallow_move(gc); } auto IGCObject_DPrimitive_gco_1_gco::visit_gco_children(DPrimitive_gco_1_gco & self, obj fn) noexcept -> void diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp index 522cba9..c9b4717 100644 --- a/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp @@ -16,9 +16,9 @@ namespace xo { namespace scm { auto - IGCObject_DPrimitive_gco_2_dict_string::shallow_move(DPrimitive_gco_2_dict_string & self, obj gc) noexcept -> Opaque + IGCObject_DPrimitive_gco_2_dict_string::gco_shallow_move(DPrimitive_gco_2_dict_string & self, obj gc) noexcept -> Opaque { - return self.shallow_move(gc); + 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 diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp index 6f7de39..65851b1 100644 --- a/src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp @@ -16,9 +16,9 @@ namespace xo { namespace scm { auto - IGCObject_DPrimitive_gco_2_gco_gco::shallow_move(DPrimitive_gco_2_gco_gco & self, obj gc) noexcept -> Opaque + IGCObject_DPrimitive_gco_2_gco_gco::gco_shallow_move(DPrimitive_gco_2_gco_gco & self, obj gc) noexcept -> Opaque { - return self.shallow_move(gc); + 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 diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp index aa6c85c..89be54a 100644 --- a/src/procedure2/facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp @@ -16,9 +16,9 @@ namespace xo { namespace scm { auto - IGCObject_DPrimitive_gco_3_dict_string_gco::shallow_move(DPrimitive_gco_3_dict_string_gco & self, obj gc) noexcept -> Opaque + IGCObject_DPrimitive_gco_3_dict_string_gco::gco_shallow_move(DPrimitive_gco_3_dict_string_gco & self, obj gc) noexcept -> Opaque { - return self.shallow_move(gc); + 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