refactor: use GCObjectVisitor api w/ gco_shallow_move

This commit is contained in:
Roland Conybeare 2026-04-06 15:21:48 -04:00
commit a312b5f20c
36 changed files with 79 additions and 67 deletions

View file

@ -19,7 +19,7 @@ namespace xo {
class DClosure {
public:
using ARuntimeContext = xo::scm::ARuntimeContext;
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;
@ -58,7 +58,7 @@ namespace xo {
/** @defgroup scm-closure-gcobject-facet **/
///@{
DClosure * shallow_move(obj<ACollector> gc) noexcept;
DClosure * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept;
void visit_gco_children(obj<AGCObjectVisitor> gc) noexcept;
///@}

View file

@ -16,7 +16,7 @@ namespace xo {
class DLocalEnv {
public:
using DArray = xo::scm::DArray;
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;
@ -55,7 +55,7 @@ namespace xo {
/** @defgroup scm-localenv-gcobject-facet **/
///@{
DLocalEnv * shallow_move(obj<ACollector> gc) noexcept;
DLocalEnv * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept;
void visit_gco_children(obj<AGCObjectVisitor> gc) noexcept;
///@}

View file

@ -41,7 +41,7 @@ namespace xo {
/** gcobject facet **/
std::size_t shallow_size() const noexcept;
DVsmApplyClosureFrame * shallow_move(obj<ACollector> gc) noexcept;
DVsmApplyClosureFrame * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept;
void visit_gco_children(obj<AGCObjectVisitor> gc) noexcept;
/** pretty-printing support **/

View file

@ -14,7 +14,7 @@ namespace xo {
class DVsmApplyFrame {
public:
using AProcedure = xo::scm::AProcedure;
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;
@ -38,7 +38,7 @@ namespace xo {
void assign_fn(obj<AGCObject> x) { this->fn_ = x; }
DVsmApplyFrame * shallow_move(obj<ACollector> gc) noexcept;
DVsmApplyFrame * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept;
void visit_gco_children(obj<AGCObjectVisitor> gc) noexcept;
/** pretty-printing support **/

View file

@ -15,7 +15,7 @@ namespace xo {
**/
class DVsmDefContFrame {
public:
using ACollector = xo::mm::ACollector;
//using ACollector = xo::mm::ACollector;
using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using AAllocator = xo::mm::AAllocator;
using AGCObject = xo::mm::AGCObject;
@ -51,7 +51,7 @@ namespace xo {
/** @defgroup scm-vsmdefcontframe-gcobject-facet gcobject facet **/
///@{
DVsmDefContFrame * shallow_move(obj<ACollector> gc) noexcept;
DVsmDefContFrame * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept;
void visit_gco_children(obj<AGCObjectVisitor> gc) noexcept;
///@}

View file

@ -14,7 +14,7 @@ namespace xo {
/** frame for executing an apply expression **/
class DVsmEvalArgsFrame {
public:
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;
@ -43,7 +43,7 @@ namespace xo {
int32_t increment_arg() { return ++i_arg_; }
DVsmEvalArgsFrame * shallow_move(obj<ACollector> gc) noexcept;
DVsmEvalArgsFrame * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept;
void visit_gco_children(obj<AGCObjectVisitor> gc) noexcept;
bool pretty(const ppindentinfo & ppii) const;

View file

@ -15,7 +15,7 @@ namespace xo {
**/
class DVsmIfElseContFrame {
public:
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;
@ -51,7 +51,7 @@ namespace xo {
/** @defgroup scm-vsmevalsequenceframe-gcobject-facet gcobject facet **/
///@{
DVsmIfElseContFrame * shallow_move(obj<ACollector> gc) noexcept;
DVsmIfElseContFrame * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept;
void visit_gco_children(obj<AGCObjectVisitor> gc) noexcept;
///@}

View file

@ -15,7 +15,7 @@ namespace xo {
**/
class DVsmSeqContFrame {
public:
using ACollector = xo::mm::ACollector;
//using ACollector = xo::mm::ACollector;
using AAllocator = xo::mm::AAllocator;
using AGCObject = xo::mm::AGCObject;
using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
@ -32,10 +32,10 @@ namespace xo {
/** create instance using memory from allocator @p mm **/
static DVsmSeqContFrame * make(obj<AAllocator> mm,
obj<AGCObject> parent,
VsmInstr cont,
DSequenceExpr * seq_expr,
uint32_t i_seq);
obj<AGCObject> parent,
VsmInstr cont,
DSequenceExpr * seq_expr,
uint32_t i_seq);
///@}
/** @defgroup scm-vsmevalsequenceframe-access-methods access methods **/
@ -56,7 +56,7 @@ namespace xo {
/** @defgroup scm-vsmevalsequenceframe-gcobject-facet gcobject facet **/
///@{
DVsmSeqContFrame * shallow_move(obj<ACollector> gc) noexcept;
DVsmSeqContFrame * 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(DVsmDefContFrame & self, obj<ACollector> gc) noexcept;
/** move instance using object visitor.
Arguably abusing the word 'visitor' here **/
static Opaque gco_shallow_move(DVsmDefContFrame & 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(DClosure & self, obj<ACollector> gc) noexcept;
/** move instance using object visitor.
Arguably abusing the word 'visitor' here **/
static Opaque gco_shallow_move(DClosure & 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(DVsmApplyClosureFrame & self, obj<ACollector> gc) noexcept;
/** move instance using object visitor.
Arguably abusing the word 'visitor' here **/
static Opaque gco_shallow_move(DVsmApplyClosureFrame & 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(DVsmApplyFrame & self, obj<ACollector> gc) noexcept;
/** move instance using object visitor.
Arguably abusing the word 'visitor' here **/
static Opaque gco_shallow_move(DVsmApplyFrame & 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(DVsmEvalArgsFrame & self, obj<ACollector> gc) noexcept;
/** move instance using object visitor.
Arguably abusing the word 'visitor' here **/
static Opaque gco_shallow_move(DVsmEvalArgsFrame & 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(DLocalEnv & self, obj<ACollector> gc) noexcept;
/** move instance using object visitor.
Arguably abusing the word 'visitor' here **/
static Opaque gco_shallow_move(DLocalEnv & 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(DVsmIfElseContFrame & self, obj<ACollector> gc) noexcept;
/** move instance using object visitor.
Arguably abusing the word 'visitor' here **/
static Opaque gco_shallow_move(DVsmIfElseContFrame & 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(DVsmSeqContFrame & self, obj<ACollector> gc) noexcept;
/** move instance using object visitor.
Arguably abusing the word 'visitor' here **/
static Opaque gco_shallow_move(DVsmSeqContFrame & 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

@ -71,7 +71,7 @@ namespace xo {
public:
// will be DArenaVector<obj<StackFrame>> probably
using Stack = void *;
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;
@ -154,7 +154,7 @@ namespace xo {
/** shallow copy during gc cycle. Not implemented! Only intending to support
* VSM as virtual root
**/
DVirtualSchematikaMachine * shallow_move(obj<ACollector> gc) noexcept;
DVirtualSchematikaMachine * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept;
/** forward gc-aware child pointers
**/

View file

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

@ -65,7 +65,7 @@ namespace xo {
}
DClosure *
DClosure::shallow_move(obj<ACollector> gc) noexcept {
DClosure::gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept {
return gc.std_move_for(this);
}

View file

@ -92,7 +92,7 @@ namespace xo {
}
DLocalEnv *
DLocalEnv::shallow_move(obj<ACollector> gc) noexcept {
DLocalEnv::gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept {
return gc.std_move_for(this);
}

View file

@ -954,8 +954,11 @@ namespace xo {
}
DVirtualSchematikaMachine *
DVirtualSchematikaMachine::shallow_move(obj<ACollector> gc) noexcept
DVirtualSchematikaMachine::gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept
{
// need move-ctor on abox<..>
//return gc.std_move_for(this);
(void)gc;
/** TODO: should be able to use gc.std_move_for(this) now

View file

@ -33,7 +33,7 @@ namespace xo {
}
DVsmApplyClosureFrame *
DVsmApplyClosureFrame::shallow_move(obj<ACollector> gc) noexcept
DVsmApplyClosureFrame::gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept
{
return gc.std_move_for(this);
}

View file

@ -41,7 +41,7 @@ namespace xo {
}
DVsmApplyFrame *
DVsmApplyFrame::shallow_move(obj<ACollector> gc) noexcept
DVsmApplyFrame::gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept
{
return gc.std_move_for(this);
}

View file

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

View file

@ -42,7 +42,7 @@ namespace xo {
}
DVsmEvalArgsFrame *
DVsmEvalArgsFrame::shallow_move(obj<ACollector> gc) noexcept
DVsmEvalArgsFrame::gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept
{
return gc.std_move_for(this);
}

View file

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

View file

@ -33,9 +33,9 @@ namespace xo {
// gcobject facet
DVsmSeqContFrame *
DVsmSeqContFrame::shallow_move(obj<ACollector> gc) noexcept
DVsmSeqContFrame::gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept
{
return gc.std_move_for<DVsmSeqContFrame>(this);
return gc.std_move_for(this);
}
void

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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