refactor: use GCObjectVisitor api w/ gco_shallow_move

This commit is contained in:
Roland Conybeare 2026-04-06 15:21:48 -04:00
commit 997d3d8264
44 changed files with 89 additions and 133 deletions

View file

@ -21,7 +21,7 @@ namespace xo {
**/
class DApplyExpr {
public:
using ACollector = xo::mm::ACollector;
//using ACollector = xo::mm::ACollector;
using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using AAllocator = xo::mm::AAllocator;
using TypeDescr = xo::reflect::TypeDescr;
@ -84,8 +84,7 @@ namespace xo {
/** @defgroup scm-applyexpr-gcobject-facet **/
///@{
std::size_t shallow_size() const noexcept;
DApplyExpr * shallow_move(obj<ACollector> gc) noexcept;
DApplyExpr * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept;
void visit_gco_children(obj<AGCObjectVisitor> gc) noexcept;
///@}

View file

@ -8,7 +8,7 @@
#include "Expression.hpp"
#include "TypeRef.hpp"
#include "exprtype.hpp"
#include <xo/alloc2/Collector.hpp>
//#include <xo/alloc2/Collector.hpp>
#include <xo/alloc2/GCObject.hpp>
#include <xo/alloc2/GCObjectVisitor.hpp>
#include <xo/reflect/TaggedPtr.hpp>
@ -22,7 +22,7 @@ namespace xo {
public:
using TaggedPtr = xo::reflect::TaggedPtr;
using TypeDescr = xo::reflect::TypeDescr;
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;
@ -64,8 +64,7 @@ namespace xo {
/** @defgroup scm-constant-gcobject-facet **/
///@{
size_t shallow_size() const noexcept;
DConstant * shallow_move(obj<ACollector> gc) noexcept;
DConstant * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept;
void visit_gco_children(obj<AGCObjectVisitor> gc) noexcept;
///@}

View file

@ -74,8 +74,7 @@ namespace xo {
/** @defgroup scm-defineexpr-gcobject-facet **/
///@{
std::size_t shallow_size() const noexcept;
DDefineExpr * shallow_move(obj<ACollector> gc) noexcept;
DDefineExpr * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept;
void visit_gco_children(obj<AGCObjectVisitor> gc) noexcept;
///@}

View file

@ -30,7 +30,7 @@ namespace xo {
using value_type = Binding;
using ArenaHashMapConfig = xo::map::ArenaHashMapConfig;
using repr_type = xo::map::DArenaHashMap<key_type, Binding::slot_type>;
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;
@ -115,7 +115,7 @@ namespace xo {
/** @defgroup scm-globalsymtab-gcobject-facet gcobject facet **/
///@{
DGlobalSymtab * shallow_move(obj<ACollector> gc) noexcept;
DGlobalSymtab * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept;
void visit_gco_children(obj<AGCObjectVisitor> gc) noexcept;
///@}

View file

@ -8,7 +8,7 @@
#include "Expression.hpp"
#include "TypeRef.hpp"
#include "exprtype.hpp"
#include <xo/alloc2/Collector.hpp>
//#include <xo/alloc2/Collector.hpp>
#include <xo/alloc2/GCObjectVisitor.hpp>
#include <xo/alloc2/Allocator.hpp>
#include <string>
@ -21,7 +21,7 @@ namespace xo {
**/
class DIfElseExpr {
public:
using ACollector = xo::mm::ACollector;
//using ACollector = xo::mm::ACollector;
using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using AAllocator = xo::mm::AAllocator;
using TypeDescr = xo::reflect::TypeDescr;
@ -98,8 +98,7 @@ namespace xo {
/** @defgroup scm-ifelseexpr-gcobject-facet **/
///@{
std::size_t shallow_size() const noexcept;
DIfElseExpr * shallow_move(obj<ACollector> gc) noexcept;
DIfElseExpr * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept;
void visit_gco_children(obj<AGCObjectVisitor> gc) noexcept;
///@}

View file

@ -21,7 +21,7 @@ namespace xo {
**/
class DLambdaExpr {
public:
using ACollector = xo::mm::ACollector;
//using ACollector = xo::mm::ACollector;
using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using AAllocator = xo::mm::AAllocator;
using TypeDescr = xo::reflect::TypeDescr;
@ -87,7 +87,7 @@ namespace xo {
///@{
std::size_t shallow_size() const noexcept;
DLambdaExpr * shallow_move(obj<ACollector> gc) noexcept;
DLambdaExpr * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept;
void visit_gco_children(obj<AGCObjectVisitor> gc) noexcept;
///@}

View file

@ -20,7 +20,7 @@ namespace xo {
public:
using DArray = xo::scm::DArray;
using ppindentinfo = xo::print::ppindentinfo;
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;
@ -99,7 +99,7 @@ namespace xo {
/** @defgroup xo-localsymtab-gcobject-facet gcobject facet **/
///@{
DLocalSymtab * shallow_move(obj<ACollector> gc) noexcept;
DLocalSymtab * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept;
void visit_gco_children(obj<AGCObjectVisitor> gc) noexcept;
///@}

View file

@ -23,7 +23,7 @@ namespace xo {
**/
class DSequenceExpr {
public:
using ACollector = xo::mm::ACollector;
//using ACollector = xo::mm::ACollector;
using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using AAllocator = xo::mm::AAllocator;
using TypeDescr = xo::reflect::TypeDescr;
@ -74,8 +74,7 @@ namespace xo {
/** @defgroup scm-sequenceexpr-gcobject-facet gcobject facet methods **/
///@{
std::size_t shallow_size() const noexcept;
DSequenceExpr * shallow_move(obj<ACollector> gc) noexcept;
DSequenceExpr * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept;
void visit_gco_children(obj<AGCObjectVisitor> gc) noexcept;
///@}

View file

@ -24,7 +24,7 @@ namespace xo {
class DTypename {
public:
using ppindentinfo = xo::print::ppindentinfo;
using ACollector = xo::mm::ACollector;
//using ACollector = xo::mm::ACollector;
using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using AGCObject = xo::mm::AGCObject;
using AAllocator = xo::mm::AAllocator;
@ -55,8 +55,7 @@ namespace xo {
/** @defgroup scm-typename-gcobject-facet **/
///@{
size_t shallow_size() const noexcept;
DTypename * shallow_move(obj<ACollector> gc) noexcept;
DTypename * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept;
void visit_gco_children(obj<AGCObjectVisitor> gc) noexcept;
///@}

View file

@ -21,7 +21,7 @@ namespace xo {
class DVarRef {
public:
using ppindentinfo = xo::print::ppindentinfo;
using ACollector = xo::mm::ACollector;
//using ACollector = xo::mm::ACollector;
using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using AAllocator = xo::mm::AAllocator;
using TypeDescr = xo::reflect::TypeDescr;
@ -56,8 +56,7 @@ namespace xo {
/** @defgroup scm-variable-gcobject-facet **/
///@{
size_t shallow_size() const noexcept;
DVarRef * shallow_move(obj<ACollector> gc) noexcept;
DVarRef * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept;
void visit_gco_children(obj<AGCObjectVisitor> gc) noexcept;
///@}

View file

@ -22,7 +22,7 @@ namespace xo {
class DVariable {
public:
using ppindentinfo = xo::print::ppindentinfo;
using ACollector = xo::mm::ACollector;
//using ACollector = xo::mm::ACollector;
using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using AAllocator = xo::mm::AAllocator;
using TypeDescr = xo::reflect::TypeDescr;
@ -64,8 +64,7 @@ namespace xo {
/** @defgroup scm-variable-gcobject-facet **/
///@{
size_t shallow_size() const noexcept;
DVariable * shallow_move(obj<ACollector> gc) noexcept;
DVariable * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept;
void visit_gco_children(obj<AGCObjectVisitor> gc) noexcept;
///@}

View file

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

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