xo-interpreter2 stack: + reason arg to visit_gco_children()

Helps streamline DX1Collector in xo-gc/.
Want both forward and verify entry points for the same
representation.
This commit is contained in:
Roland Conybeare 2026-04-10 01:10:03 -04:00
commit 70c0591a9e
20 changed files with 41 additions and 41 deletions

View file

@ -21,6 +21,7 @@ namespace xo {
public:
//using ACollector = xo::mm::ACollector;
using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using VisitReason = xo::mm::VisitReason;
using AAllocator = xo::mm::AAllocator;
using TypeDescr = xo::reflect::TypeDescr;
@ -44,7 +45,7 @@ namespace xo {
/** @defgroup xo-scm-arraytype-gcobject-facet **/
///@{
DArrayType * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept;
void visit_gco_children(obj<AGCObjectVisitor> gc) noexcept;
void visit_gco_children(VisitReason reason, obj<AGCObjectVisitor> gc) noexcept;
///@}
private:

View file

@ -24,6 +24,7 @@ namespace xo {
public:
//using ACollector = xo::mm::ACollector;
using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using VisitReason = xo::mm::VisitReason;
using AAllocator = xo::mm::AAllocator;
using TypeDescr = xo::reflect::TypeDescr;
@ -45,7 +46,7 @@ namespace xo {
/** @defgroup xo-scm-atomictype-gcobject-facet **/
///@{
DAtomicType * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept;
void visit_gco_children(obj<AGCObjectVisitor> gc) noexcept;
void visit_gco_children(VisitReason reason, obj<AGCObjectVisitor> gc) noexcept;
///@}
private:

View file

@ -8,7 +8,6 @@
#include "Type.hpp"
#include "Metatype.hpp"
#include <xo/object2/Array.hpp>
//#include <xo/alloc2/Collector.hpp>
#include <xo/alloc2/GCObjectVisitor.hpp>
#include <xo/alloc2/Allocator.hpp>
@ -20,9 +19,9 @@ namespace xo {
**/
class DFunctionType {
public:
//using ACollector = xo::mm::ACollector;
using AGCObject = xo::mm::AGCObject;
using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using VisitReason = xo::mm::VisitReason;
using AAllocator = xo::mm::AAllocator;
using TypeDescr = xo::reflect::TypeDescr;
@ -66,7 +65,7 @@ namespace xo {
/** @defgroup xo-scm-arraytype-gcobject-facet **/
///@{
DFunctionType * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept;
void visit_gco_children(obj<AGCObjectVisitor> gc) noexcept;
void visit_gco_children(VisitReason reason, obj<AGCObjectVisitor> gc) noexcept;
///@}
private:

View file

@ -26,6 +26,7 @@ namespace xo {
using TypeDescr = xo::reflect::TypeDescr;
//using ACollector = xo::mm::ACollector;
using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using VisitReason = xo::mm::VisitReason;
using AAllocator = xo::mm::AAllocator;
public:
@ -52,7 +53,7 @@ namespace xo {
/** @defgroup xo-scm-listtype-gcobject-facet **/
///@{
DListType * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept;
void visit_gco_children(obj<AGCObjectVisitor> gc) noexcept;
void visit_gco_children(VisitReason reason, obj<AGCObjectVisitor> gc) noexcept;
///@}
private:

View file

@ -43,6 +43,7 @@ namespace xo {
using AAllocator = xo::mm::AGCObject::AAllocator;
using ACollector = xo::mm::AGCObject::ACollector;
using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor;
using VisitReason = xo::mm::AGCObject::VisitReason;
using Copaque = xo::mm::AGCObject::Copaque;
using Opaque = xo::mm::AGCObject::Opaque;
///@}
@ -57,7 +58,7 @@ Arguably abusing the word 'visitor' here **/
/** 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 **/
static void visit_gco_children(DArrayType & self, obj<AGCObjectVisitor> fn) noexcept;
static void visit_gco_children(DArrayType & self, VisitReason reason, obj<AGCObjectVisitor> fn) noexcept;
///@}
};

View file

@ -43,6 +43,7 @@ namespace xo {
using AAllocator = xo::mm::AGCObject::AAllocator;
using ACollector = xo::mm::AGCObject::ACollector;
using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor;
using VisitReason = xo::mm::AGCObject::VisitReason;
using Copaque = xo::mm::AGCObject::Copaque;
using Opaque = xo::mm::AGCObject::Opaque;
///@}
@ -57,7 +58,7 @@ Arguably abusing the word 'visitor' here **/
/** 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 **/
static void visit_gco_children(DAtomicType & self, obj<AGCObjectVisitor> fn) noexcept;
static void visit_gco_children(DAtomicType & self, VisitReason reason, obj<AGCObjectVisitor> fn) noexcept;
///@}
};

View file

@ -43,6 +43,7 @@ namespace xo {
using AAllocator = xo::mm::AGCObject::AAllocator;
using ACollector = xo::mm::AGCObject::ACollector;
using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor;
using VisitReason = xo::mm::AGCObject::VisitReason;
using Copaque = xo::mm::AGCObject::Copaque;
using Opaque = xo::mm::AGCObject::Opaque;
///@}
@ -57,7 +58,7 @@ Arguably abusing the word 'visitor' here **/
/** 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 **/
static void visit_gco_children(DFunctionType & self, obj<AGCObjectVisitor> fn) noexcept;
static void visit_gco_children(DFunctionType & self, VisitReason reason, obj<AGCObjectVisitor> fn) noexcept;
///@}
};

View file

@ -43,6 +43,7 @@ namespace xo {
using AAllocator = xo::mm::AGCObject::AAllocator;
using ACollector = xo::mm::AGCObject::ACollector;
using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor;
using VisitReason = xo::mm::AGCObject::VisitReason;
using Copaque = xo::mm::AGCObject::Copaque;
using Opaque = xo::mm::AGCObject::Opaque;
///@}
@ -57,7 +58,7 @@ Arguably abusing the word 'visitor' here **/
/** 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 **/
static void visit_gco_children(DListType & self, obj<AGCObjectVisitor> fn) noexcept;
static void visit_gco_children(DListType & self, VisitReason reason, obj<AGCObjectVisitor> fn) noexcept;
///@}
};

View file

@ -24,6 +24,7 @@ namespace xo {
public:
//using ACollector = xo::mm::ACollector;
using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using VisitReason = xo::mm::VisitReason;
using AAllocator = xo::mm::AAllocator;
using TypeDescr = xo::reflect::TypeDescr;
@ -55,7 +56,7 @@ namespace xo {
/** @defgroup xo-scm-atomictype-gcobject-facet **/
///@{
DTypeVarRef * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept;
void visit_gco_children(obj<AGCObjectVisitor> gc) noexcept;
void visit_gco_children(VisitReason reason, obj<AGCObjectVisitor> gc) noexcept;
///@}
private:

View file

@ -43,6 +43,7 @@ namespace xo {
using AAllocator = xo::mm::AGCObject::AAllocator;
using ACollector = xo::mm::AGCObject::ACollector;
using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor;
using VisitReason = xo::mm::AGCObject::VisitReason;
using Copaque = xo::mm::AGCObject::Copaque;
using Opaque = xo::mm::AGCObject::Opaque;
///@}
@ -57,7 +58,7 @@ Arguably abusing the word 'visitor' here **/
/** 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 **/
static void visit_gco_children(DTypeVarRef & self, obj<AGCObjectVisitor> fn) noexcept;
static void visit_gco_children(DTypeVarRef & self, VisitReason reason, obj<AGCObjectVisitor> fn) noexcept;
///@}
};

View file

@ -83,13 +83,9 @@ namespace xo {
}
void
DArrayType::visit_gco_children(obj<AGCObjectVisitor> gc) noexcept
DArrayType::visit_gco_children(VisitReason reason, obj<AGCObjectVisitor> gc) noexcept
{
gc.visit_poly_child(&elt_type_);
//{
// auto e = FacetRegistry::instance().variant<AGCObject,AType>(elt_type_);
// gc.forward_inplace(e.iface(), (void **)&(elt_type_.data_));
//}
gc.visit_poly_child(reason, &elt_type_);
}
}
}

View file

@ -61,7 +61,7 @@ namespace xo {
}
void
DAtomicType::visit_gco_children(obj<AGCObjectVisitor>) noexcept
DAtomicType::visit_gco_children(VisitReason, obj<AGCObjectVisitor>) noexcept
{
// no-op. no children
}

View file

@ -94,15 +94,10 @@ namespace xo {
}
void
DFunctionType::visit_gco_children(obj<AGCObjectVisitor> gc) noexcept
DFunctionType::visit_gco_children(VisitReason reason, obj<AGCObjectVisitor> gc) noexcept
{
gc.visit_poly_child(&return_type_);
//{
// auto e = FacetRegistry::instance().variant<AGCObject,AType>(return_type_);
// gc.forward_inplace(e.iface(), (void **)&(return_type_.data_));
//}
gc.visit_child(&arg_types_);
gc.visit_poly_child(reason, &return_type_);
gc.visit_child(reason, &arg_types_);
}
} /*namespace scm*/

View file

@ -88,9 +88,10 @@ namespace xo {
}
void
DListType::visit_gco_children(obj<AGCObjectVisitor> gc) noexcept
DListType::visit_gco_children(VisitReason reason,
obj<AGCObjectVisitor> gc) noexcept
{
gc.visit_poly_child(&elt_type_);
gc.visit_poly_child(reason, &elt_type_);
//{
// auto e = FacetRegistry::instance().variant<AGCObject,AType>(elt_type_);
// gc.forward_inplace(e.iface(), (void **)&(elt_type_.data_));

View file

@ -82,9 +82,9 @@ namespace xo {
}
void
DTypeVarRef::visit_gco_children(obj<AGCObjectVisitor> gc) noexcept
DTypeVarRef::visit_gco_children(VisitReason reason, obj<AGCObjectVisitor> gc) noexcept
{
gc.visit_poly_child(&type_);
gc.visit_poly_child(reason, &type_);
//{
// auto e = FacetRegistry::instance().variant<AGCObject,AType>(type_);

View file

@ -21,9 +21,9 @@ namespace xo {
return self.gco_shallow_move(gc);
}
auto
IGCObject_DArrayType::visit_gco_children(DArrayType & self, obj<AGCObjectVisitor> fn) noexcept -> void
IGCObject_DArrayType::visit_gco_children(DArrayType & self, VisitReason reason, obj<AGCObjectVisitor> fn) noexcept -> void
{
self.visit_gco_children(fn);
self.visit_gco_children(reason, fn);
}
} /*namespace scm*/

View file

@ -21,9 +21,9 @@ namespace xo {
return self.gco_shallow_move(gc);
}
auto
IGCObject_DAtomicType::visit_gco_children(DAtomicType & self, obj<AGCObjectVisitor> fn) noexcept -> void
IGCObject_DAtomicType::visit_gco_children(DAtomicType & self, VisitReason reason, obj<AGCObjectVisitor> fn) noexcept -> void
{
self.visit_gco_children(fn);
self.visit_gco_children(reason, fn);
}
} /*namespace scm*/

View file

@ -21,9 +21,9 @@ namespace xo {
return self.gco_shallow_move(gc);
}
auto
IGCObject_DFunctionType::visit_gco_children(DFunctionType & self, obj<AGCObjectVisitor> fn) noexcept -> void
IGCObject_DFunctionType::visit_gco_children(DFunctionType & self, VisitReason reason, obj<AGCObjectVisitor> fn) noexcept -> void
{
self.visit_gco_children(fn);
self.visit_gco_children(reason, fn);
}
} /*namespace scm*/

View file

@ -21,9 +21,9 @@ namespace xo {
return self.gco_shallow_move(gc);
}
auto
IGCObject_DListType::visit_gco_children(DListType & self, obj<AGCObjectVisitor> fn) noexcept -> void
IGCObject_DListType::visit_gco_children(DListType & self, VisitReason reason, obj<AGCObjectVisitor> fn) noexcept -> void
{
self.visit_gco_children(fn);
self.visit_gco_children(reason, fn);
}
} /*namespace scm*/

View file

@ -21,9 +21,9 @@ namespace xo {
return self.gco_shallow_move(gc);
}
auto
IGCObject_DTypeVarRef::visit_gco_children(DTypeVarRef & self, obj<AGCObjectVisitor> fn) noexcept -> void
IGCObject_DTypeVarRef::visit_gco_children(DTypeVarRef & self, VisitReason reason, obj<AGCObjectVisitor> fn) noexcept -> void
{
self.visit_gco_children(fn);
self.visit_gco_children(reason, fn);
}
} /*namespace scm*/