refactor: use GCObjectVisitor api w/ gco_shallow_move

This commit is contained in:
Roland Conybeare 2026-04-06 15:21:48 -04:00
commit e95353f1c8
169 changed files with 391 additions and 402 deletions

View file

@ -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; } }",

View file

@ -7,6 +7,7 @@
includes: [
"<xo/stringtable2/StringTable.hpp>",
"<xo/alloc2/Allocator.hpp>",
"<xo/alloc2/Collector.hpp>",
"<xo/arena/MemorySizeInfo.hpp>"
],
// extra includes in RuntimeContext.hpp, if any

View file

@ -76,7 +76,7 @@ namespace xo {
using FunctionPtrType = Fn;
using Traits = detail::PmFnTraits<Fn>;
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<ACollector> gc) noexcept;
Primitive * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept;
void visit_gco_children(obj<AGCObjectVisitor> gc) noexcept;
///@}
@ -193,7 +193,7 @@ namespace xo {
template <typename Fn>
Primitive<Fn> *
Primitive<Fn>::shallow_move(obj<ACollector> gc) noexcept {
Primitive<Fn>::gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept {
return gc.std_move_for(this);
}

View file

@ -16,6 +16,7 @@
// includes (via {facet_includes})
#include <xo/stringtable2/StringTable.hpp>
#include <xo/alloc2/Allocator.hpp>
#include <xo/alloc2/Collector.hpp>
#include <xo/arena/MemorySizeInfo.hpp>
#include <xo/facet/obj.hpp>
#include <xo/facet/facet_implementation.hpp>

View file

@ -53,8 +53,9 @@ namespace xo {
// const methods
// non-const methods
/** move instance using collector **/
static Opaque shallow_move(DPrimitive_gco_0 & self, obj<ACollector> gc) noexcept;
/** move instance using object visitor.
Arguably abusing the word 'visitor' here **/
static Opaque gco_shallow_move(DPrimitive_gco_0 & self, obj<AGCObjectVisitor> 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 **/

View file

@ -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<ACollector> gc) noexcept;
/** move instance using object visitor.
Arguably abusing the word 'visitor' here **/
static Opaque gco_shallow_move(DPrimitive_gco_1_gco & self, obj<AGCObjectVisitor> 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 **/

View file

@ -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<ACollector> 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<AGCObjectVisitor> 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 **/

View file

@ -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<ACollector> 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<AGCObjectVisitor> 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 **/

View file

@ -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<ACollector> 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<AGCObjectVisitor> 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 **/

View file

@ -15,6 +15,7 @@
#include <xo/stringtable2/StringTable.hpp>
#include <xo/alloc2/Allocator.hpp>
#include <xo/alloc2/Collector.hpp>
#include <xo/arena/MemorySizeInfo.hpp>
namespace xo {

View file

@ -16,9 +16,9 @@
namespace xo {
namespace scm {
auto
IGCObject_DPrimitive_gco_0::shallow_move(DPrimitive_gco_0 & self, obj<ACollector> gc) noexcept -> Opaque
IGCObject_DPrimitive_gco_0::gco_shallow_move(DPrimitive_gco_0 & self, obj<AGCObjectVisitor> 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<AGCObjectVisitor> fn) noexcept -> void

View file

@ -16,9 +16,9 @@
namespace xo {
namespace scm {
auto
IGCObject_DPrimitive_gco_1_gco::shallow_move(DPrimitive_gco_1_gco & self, obj<ACollector> gc) noexcept -> Opaque
IGCObject_DPrimitive_gco_1_gco::gco_shallow_move(DPrimitive_gco_1_gco & self, obj<AGCObjectVisitor> 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<AGCObjectVisitor> fn) noexcept -> void

View file

@ -16,9 +16,9 @@
namespace xo {
namespace scm {
auto
IGCObject_DPrimitive_gco_2_dict_string::shallow_move(DPrimitive_gco_2_dict_string & self, obj<ACollector> gc) noexcept -> Opaque
IGCObject_DPrimitive_gco_2_dict_string::gco_shallow_move(DPrimitive_gco_2_dict_string & self, obj<AGCObjectVisitor> 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<AGCObjectVisitor> fn) noexcept -> void

View file

@ -16,9 +16,9 @@
namespace xo {
namespace scm {
auto
IGCObject_DPrimitive_gco_2_gco_gco::shallow_move(DPrimitive_gco_2_gco_gco & self, obj<ACollector> gc) noexcept -> Opaque
IGCObject_DPrimitive_gco_2_gco_gco::gco_shallow_move(DPrimitive_gco_2_gco_gco & self, obj<AGCObjectVisitor> 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<AGCObjectVisitor> fn) noexcept -> void

View file

@ -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<ACollector> gc) noexcept -> Opaque
IGCObject_DPrimitive_gco_3_dict_string_gco::gco_shallow_move(DPrimitive_gco_3_dict_string_gco & self, obj<AGCObjectVisitor> 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<AGCObjectVisitor> fn) noexcept -> void