refactor: use GCObjectVisitor api w/ gco_shallow_move

This commit is contained in:
Roland Conybeare 2026-04-06 15:21:48 -04:00
commit 31df51ac8e
8 changed files with 16 additions and 14 deletions

View file

@ -27,7 +27,7 @@ namespace xo {
class DGlobalEnv { class DGlobalEnv {
public: public:
using TypeDescr = xo::reflect::TypeDescr; using TypeDescr = xo::reflect::TypeDescr;
using ACollector = xo::mm::ACollector; //using ACollector = xo::mm::ACollector;
using AGCObject = xo::mm::AGCObject; using AGCObject = xo::mm::AGCObject;
using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using AAllocator = xo::mm::AAllocator; using AAllocator = xo::mm::AAllocator;
@ -72,7 +72,7 @@ namespace xo {
/** @defgroup scm-globalenv-gcobject-facet **/ /** @defgroup scm-globalenv-gcobject-facet **/
///@{ ///@{
DGlobalEnv * shallow_move(obj<ACollector> gc) noexcept; DGlobalEnv * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept;
void visit_gco_children(obj<AGCObjectVisitor> gc) noexcept; void visit_gco_children(obj<AGCObjectVisitor> gc) noexcept;
///@} ///@}

View file

@ -53,8 +53,9 @@ namespace xo {
// const methods // const methods
// non-const methods // non-const methods
/** move instance using collector **/ /** move instance using object visitor.
static Opaque shallow_move(DGlobalEnv & self, obj<ACollector> gc) noexcept; Arguably abusing the word 'visitor' here **/
static Opaque gco_shallow_move(DGlobalEnv & self, obj<AGCObjectVisitor> gc) noexcept;
/** Invoke fn.visit_child(iface,data) for each child GCObject pointer. /** Invoke fn.visit_child(iface,data) for each child GCObject pointer.
Context: provides address of data pointer so it can be updated in place Context: provides address of data pointer so it can be updated in place
when @p fn invokes garbage collector reentry point **/ when @p fn invokes garbage collector reentry point **/

View file

@ -164,7 +164,7 @@ namespace xo {
using token_type = Token; using token_type = Token;
using ArenaHashMapConfig = xo::map::ArenaHashMapConfig; using ArenaHashMapConfig = xo::map::ArenaHashMapConfig;
using ArenaConfig = xo::mm::ArenaConfig; using ArenaConfig = xo::mm::ArenaConfig;
using ACollector = xo::mm::ACollector; //using ACollector = xo::mm::ACollector;
using AGCObject = xo::mm::AGCObject; using AGCObject = xo::mm::AGCObject;
using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using AAllocator = xo::mm::AAllocator; using AAllocator = xo::mm::AAllocator;
@ -295,7 +295,7 @@ namespace xo {
///@{ ///@{
/** not implemented (SchematikaParser not designed to be copyable) **/ /** not implemented (SchematikaParser not designed to be copyable) **/
DSchematikaParser * shallow_move(obj<ACollector> gc) noexcept; DSchematikaParser * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept;
/** forward gc-aware children **/ /** forward gc-aware children **/
void visit_gco_children(obj<AGCObjectVisitor> gc) noexcept; void visit_gco_children(obj<AGCObjectVisitor> gc) noexcept;

View file

@ -53,8 +53,9 @@ namespace xo {
// const methods // const methods
// non-const methods // non-const methods
/** move instance using collector **/ /** move instance using object visitor.
static Opaque shallow_move(DSchematikaParser & self, obj<ACollector> gc) noexcept; Arguably abusing the word 'visitor' here **/
static Opaque gco_shallow_move(DSchematikaParser & self, obj<AGCObjectVisitor> gc) noexcept;
/** Invoke fn.visit_child(iface,data) for each child GCObject pointer. /** Invoke fn.visit_child(iface,data) for each child GCObject pointer.
Context: provides address of data pointer so it can be updated in place Context: provides address of data pointer so it can be updated in place
when @p fn invokes garbage collector reentry point **/ when @p fn invokes garbage collector reentry point **/

View file

@ -108,7 +108,7 @@ namespace xo {
// ----- AGCObject facet ----- // ----- AGCObject facet -----
DGlobalEnv * DGlobalEnv *
DGlobalEnv::shallow_move(obj<ACollector> gc) noexcept DGlobalEnv::gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept
{ {
return gc.std_move_for<DGlobalEnv>(this); return gc.std_move_for<DGlobalEnv>(this);
} }

View file

@ -185,7 +185,7 @@ namespace xo {
} }
DSchematikaParser * DSchematikaParser *
DSchematikaParser::shallow_move(obj<ACollector> gc) noexcept DSchematikaParser::gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept
{ {
(void)gc; (void)gc;

View file

@ -16,9 +16,9 @@
namespace xo { namespace xo {
namespace scm { namespace scm {
auto auto
IGCObject_DGlobalEnv::shallow_move(DGlobalEnv & self, obj<ACollector> gc) noexcept -> Opaque IGCObject_DGlobalEnv::gco_shallow_move(DGlobalEnv & self, obj<AGCObjectVisitor> gc) noexcept -> Opaque
{ {
return self.shallow_move(gc); return self.gco_shallow_move(gc);
} }
auto auto
IGCObject_DGlobalEnv::visit_gco_children(DGlobalEnv & self, obj<AGCObjectVisitor> fn) noexcept -> void IGCObject_DGlobalEnv::visit_gco_children(DGlobalEnv & self, obj<AGCObjectVisitor> fn) noexcept -> void

View file

@ -16,9 +16,9 @@
namespace xo { namespace xo {
namespace scm { namespace scm {
auto auto
IGCObject_DSchematikaParser::shallow_move(DSchematikaParser & self, obj<ACollector> gc) noexcept -> Opaque IGCObject_DSchematikaParser::gco_shallow_move(DSchematikaParser & self, obj<AGCObjectVisitor> gc) noexcept -> Opaque
{ {
return self.shallow_move(gc); return self.gco_shallow_move(gc);
} }
auto auto
IGCObject_DSchematikaParser::visit_gco_children(DSchematikaParser & self, obj<AGCObjectVisitor> fn) noexcept -> void IGCObject_DSchematikaParser::visit_gco_children(DSchematikaParser & self, obj<AGCObjectVisitor> fn) noexcept -> void