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 822af3a246
46 changed files with 124 additions and 142 deletions

View file

@ -21,8 +21,8 @@ namespace xo {
**/ **/
class DApplyExpr { class DApplyExpr {
public: public:
//using ACollector = xo::mm::ACollector;
using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using VisitReason = xo::mm::VisitReason;
using AAllocator = xo::mm::AAllocator; using AAllocator = xo::mm::AAllocator;
using TypeDescr = xo::reflect::TypeDescr; using TypeDescr = xo::reflect::TypeDescr;
using ppindentinfo = xo::print::ppindentinfo; using ppindentinfo = xo::print::ppindentinfo;
@ -85,7 +85,7 @@ namespace xo {
///@{ ///@{
DApplyExpr * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept; DApplyExpr * 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;
///@} ///@}
/** @defgroup scm-applyexpr-printable-facet **/ /** @defgroup scm-applyexpr-printable-facet **/

View file

@ -8,7 +8,6 @@
#include "Expression.hpp" #include "Expression.hpp"
#include "TypeRef.hpp" #include "TypeRef.hpp"
#include "exprtype.hpp" #include "exprtype.hpp"
//#include <xo/alloc2/Collector.hpp>
#include <xo/alloc2/GCObject.hpp> #include <xo/alloc2/GCObject.hpp>
#include <xo/alloc2/GCObjectVisitor.hpp> #include <xo/alloc2/GCObjectVisitor.hpp>
#include <xo/reflect/TaggedPtr.hpp> #include <xo/reflect/TaggedPtr.hpp>
@ -22,8 +21,8 @@ namespace xo {
public: public:
using TaggedPtr = xo::reflect::TaggedPtr; using TaggedPtr = xo::reflect::TaggedPtr;
using TypeDescr = xo::reflect::TypeDescr; using TypeDescr = xo::reflect::TypeDescr;
//using ACollector = xo::mm::ACollector;
using AGCObject = xo::mm::AGCObject; using AGCObject = xo::mm::AGCObject;
using VisitReason = xo::mm::VisitReason;
using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using AAllocator = xo::mm::AAllocator; using AAllocator = xo::mm::AAllocator;
using typeseq = xo::reflect::typeseq; using typeseq = xo::reflect::typeseq;
@ -65,7 +64,7 @@ namespace xo {
///@{ ///@{
DConstant * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept; DConstant * 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;
///@} ///@}
/** @defgroup scm-constant-printable-facet **/ /** @defgroup scm-constant-printable-facet **/

View file

@ -26,6 +26,7 @@ namespace xo {
using ppindentinfo = xo::print::ppindentinfo; using ppindentinfo = xo::print::ppindentinfo;
using ACollector = xo::mm::ACollector; using ACollector = xo::mm::ACollector;
using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using VisitReason = xo::mm::VisitReason;
using AAllocator = xo::mm::AAllocator; using AAllocator = xo::mm::AAllocator;
using TypeDescr = xo::reflect::TypeDescr; using TypeDescr = xo::reflect::TypeDescr;
@ -75,7 +76,7 @@ namespace xo {
///@{ ///@{
DDefineExpr * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept; DDefineExpr * 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;
///@} ///@}
/** @defgroup scm-defineexpr-printable-facet **/ /** @defgroup scm-defineexpr-printable-facet **/

View file

@ -30,9 +30,9 @@ namespace xo {
using value_type = Binding; using value_type = Binding;
using ArenaHashMapConfig = xo::map::ArenaHashMapConfig; using ArenaHashMapConfig = xo::map::ArenaHashMapConfig;
using repr_type = xo::map::DArenaHashMap<key_type, Binding::slot_type>; using repr_type = xo::map::DArenaHashMap<key_type, Binding::slot_type>;
//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 VisitReason = xo::mm::VisitReason;
using AAllocator = xo::mm::AAllocator; using AAllocator = xo::mm::AAllocator;
using MemorySizeVisitor = xo::mm::MemorySizeVisitor; using MemorySizeVisitor = xo::mm::MemorySizeVisitor;
using ppindentinfo = xo::print::ppindentinfo; using ppindentinfo = xo::print::ppindentinfo;
@ -116,7 +116,7 @@ namespace xo {
///@{ ///@{
DGlobalSymtab * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept; DGlobalSymtab * 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;
///@} ///@}
/** @defgroup scm-globalsymtab-printable-facet printable facet **/ /** @defgroup scm-globalsymtab-printable-facet printable facet **/

View file

@ -8,7 +8,6 @@
#include "Expression.hpp" #include "Expression.hpp"
#include "TypeRef.hpp" #include "TypeRef.hpp"
#include "exprtype.hpp" #include "exprtype.hpp"
//#include <xo/alloc2/Collector.hpp>
#include <xo/alloc2/GCObjectVisitor.hpp> #include <xo/alloc2/GCObjectVisitor.hpp>
#include <xo/alloc2/Allocator.hpp> #include <xo/alloc2/Allocator.hpp>
#include <string> #include <string>
@ -21,8 +20,8 @@ namespace xo {
**/ **/
class DIfElseExpr { class DIfElseExpr {
public: public:
//using ACollector = xo::mm::ACollector;
using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using VisitReason = xo::mm::VisitReason;
using AAllocator = xo::mm::AAllocator; using AAllocator = xo::mm::AAllocator;
using TypeDescr = xo::reflect::TypeDescr; using TypeDescr = xo::reflect::TypeDescr;
using ppindentinfo = xo::print::ppindentinfo; using ppindentinfo = xo::print::ppindentinfo;
@ -99,7 +98,7 @@ namespace xo {
///@{ ///@{
DIfElseExpr * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept; DIfElseExpr * 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;
///@} ///@}

View file

@ -21,8 +21,8 @@ namespace xo {
**/ **/
class DLambdaExpr { class DLambdaExpr {
public: public:
//using ACollector = xo::mm::ACollector;
using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using VisitReason = xo::mm::VisitReason;
using AAllocator = xo::mm::AAllocator; using AAllocator = xo::mm::AAllocator;
using TypeDescr = xo::reflect::TypeDescr; using TypeDescr = xo::reflect::TypeDescr;
using ppindentinfo = xo::print::ppindentinfo; using ppindentinfo = xo::print::ppindentinfo;
@ -88,7 +88,7 @@ namespace xo {
std::size_t shallow_size() const noexcept; std::size_t shallow_size() const noexcept;
DLambdaExpr * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept; DLambdaExpr * 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;
///@} ///@}
/** @defgroup scm-lambdaexpr-printable-facet **/ /** @defgroup scm-lambdaexpr-printable-facet **/

View file

@ -20,8 +20,8 @@ namespace xo {
public: public:
using DArray = xo::scm::DArray; using DArray = xo::scm::DArray;
using ppindentinfo = xo::print::ppindentinfo; using ppindentinfo = xo::print::ppindentinfo;
//using ACollector = xo::mm::ACollector;
using AGCObject = xo::mm::AGCObject; using AGCObject = xo::mm::AGCObject;
using VisitReason = xo::mm::VisitReason;
using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using AAllocator = xo::mm::AAllocator; using AAllocator = xo::mm::AAllocator;
/* note: uint16_t would be fine too */ /* note: uint16_t would be fine too */
@ -100,7 +100,7 @@ namespace xo {
///@{ ///@{
DLocalSymtab * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept; DLocalSymtab * 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;
///@} ///@}
/** @defgroup xo-localsymtab-printable-facet printable facet **/ /** @defgroup xo-localsymtab-printable-facet printable facet **/

View file

@ -23,8 +23,8 @@ namespace xo {
**/ **/
class DSequenceExpr { class DSequenceExpr {
public: public:
//using ACollector = xo::mm::ACollector;
using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using VisitReason = xo::mm::VisitReason;
using AAllocator = xo::mm::AAllocator; using AAllocator = xo::mm::AAllocator;
using TypeDescr = xo::reflect::TypeDescr; using TypeDescr = xo::reflect::TypeDescr;
using size_type = DArray::size_type; using size_type = DArray::size_type;
@ -75,7 +75,7 @@ namespace xo {
///@{ ///@{
DSequenceExpr * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept; DSequenceExpr * 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;
///@} ///@}

View file

@ -24,8 +24,8 @@ namespace xo {
class DTypename { class DTypename {
public: public:
using ppindentinfo = xo::print::ppindentinfo; using ppindentinfo = xo::print::ppindentinfo;
//using ACollector = xo::mm::ACollector;
using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using VisitReason = xo::mm::VisitReason;
using AGCObject = xo::mm::AGCObject; using AGCObject = xo::mm::AGCObject;
using AAllocator = xo::mm::AAllocator; using AAllocator = xo::mm::AAllocator;
@ -56,7 +56,7 @@ namespace xo {
///@{ ///@{
DTypename * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept; DTypename * 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;
///@} ///@}
/** @defgroup scm-typename-printable-facet **/ /** @defgroup scm-typename-printable-facet **/

View file

@ -21,8 +21,8 @@ namespace xo {
class DVarRef { class DVarRef {
public: public:
using ppindentinfo = xo::print::ppindentinfo; using ppindentinfo = xo::print::ppindentinfo;
//using ACollector = xo::mm::ACollector;
using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using VisitReason = xo::mm::VisitReason;
using AAllocator = xo::mm::AAllocator; using AAllocator = xo::mm::AAllocator;
using TypeDescr = xo::reflect::TypeDescr; using TypeDescr = xo::reflect::TypeDescr;
@ -57,7 +57,7 @@ namespace xo {
///@{ ///@{
DVarRef * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept; DVarRef * 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;
///@} ///@}
/** @defgroup scm-variable-printable-facet **/ /** @defgroup scm-variable-printable-facet **/

View file

@ -22,8 +22,8 @@ namespace xo {
class DVariable { class DVariable {
public: public:
using ppindentinfo = xo::print::ppindentinfo; using ppindentinfo = xo::print::ppindentinfo;
//using ACollector = xo::mm::ACollector;
using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using VisitReason = xo::mm::VisitReason;
using AAllocator = xo::mm::AAllocator; using AAllocator = xo::mm::AAllocator;
using TypeDescr = xo::reflect::TypeDescr; using TypeDescr = xo::reflect::TypeDescr;
@ -65,7 +65,7 @@ namespace xo {
///@{ ///@{
DVariable * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept; DVariable * 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;
///@} ///@}
/** @defgroup scm-variable-printable-facet **/ /** @defgroup scm-variable-printable-facet **/

View file

@ -26,8 +26,8 @@ namespace xo {
using TypeDescr = xo::reflect::TypeDescr; using TypeDescr = xo::reflect::TypeDescr;
using type_var = flatstring<20>; using type_var = flatstring<20>;
using prefix_type = flatstring<8>; using prefix_type = flatstring<8>;
using ACollector = xo::mm::ACollector;
using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using VisitReason = xo::mm::VisitReason;
using ppindentinfo = xo::print::ppindentinfo; using ppindentinfo = xo::print::ppindentinfo;
public: public:
@ -75,7 +75,7 @@ namespace xo {
bool pretty(const ppindentinfo & ppii) const; bool pretty(const ppindentinfo & ppii) const;
/** gc support **/ /** gc support **/
void visit_gco_children(obj<AGCObjectVisitor> gc) noexcept; void visit_gco_children(VisitReason reason, obj<AGCObjectVisitor> gc) noexcept;
private: private:
TypeRef(const type_var & id, TypeDescr td); TypeRef(const type_var & id, TypeDescr td);

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -43,6 +43,7 @@ namespace xo {
using AAllocator = xo::mm::AGCObject::AAllocator; using AAllocator = xo::mm::AGCObject::AAllocator;
using ACollector = xo::mm::AGCObject::ACollector; using ACollector = xo::mm::AGCObject::ACollector;
using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor;
using VisitReason = xo::mm::AGCObject::VisitReason;
using Copaque = xo::mm::AGCObject::Copaque; using Copaque = xo::mm::AGCObject::Copaque;
using Opaque = xo::mm::AGCObject::Opaque; 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. /** 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 **/
static void visit_gco_children(DTypename & self, obj<AGCObjectVisitor> fn) noexcept; static void visit_gco_children(DTypename & self, VisitReason reason, obj<AGCObjectVisitor> fn) noexcept;
///@} ///@}
}; };

View file

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

View file

@ -125,23 +125,16 @@ namespace xo {
} }
void void
DApplyExpr::visit_gco_children(obj<AGCObjectVisitor> gc) noexcept DApplyExpr::visit_gco_children(VisitReason reason, obj<AGCObjectVisitor> gc) noexcept
{ {
typeref_.visit_gco_children(gc); typeref_.visit_gco_children(reason, gc);
{ gc.visit_poly_child(reason, &fn_);
gc.visit_poly_child(&fn_);
//obj<AGCObject> fn_gco = fn_.to_facet<AGCObject>();
//gc.forward_inplace(fn_gco.iface(), (void **)&fn_.data_);
}
for (size_type i = 0; i < n_args_; ++i) { for (size_type i = 0; i < n_args_; ++i) {
obj<AExpression> & arg = args_[i]; obj<AExpression> & arg = args_[i];
// runtime poly here gc.visit_poly_child(reason, &arg);
gc.visit_poly_child(&arg);
//obj<AGCObject> arg_gco = arg.to_facet<AGCObject>();
//gc.forward_inplace(arg_gco.iface(), (void **)(&arg.data_));
} }
} }

View file

@ -3,8 +3,8 @@
* @author Roland Conybeare, Jan 2026 * @author Roland Conybeare, Jan 2026
**/ **/
#include "DConstant.hpp" #include "Constant.hpp"
#include "detail/IExpression_DConstant.hpp" //#include "detail/IExpression_DConstant.hpp"
#include "TypeDescr.hpp" #include "TypeDescr.hpp"
#include <xo/object2/DFloat.hpp> #include <xo/object2/DFloat.hpp>
#include <xo/object2/DInteger.hpp> #include <xo/object2/DInteger.hpp>
@ -78,11 +78,12 @@ namespace xo {
} }
void void
DConstant::visit_gco_children(obj<AGCObjectVisitor> gc) noexcept DConstant::visit_gco_children(VisitReason reason,
obj<AGCObjectVisitor> gc) noexcept
{ {
typeref_.visit_gco_children(gc); typeref_.visit_gco_children(reason, gc);
gc.visit_child(&value_); gc.visit_child(reason, &value_);
} }
bool bool

View file

@ -85,11 +85,11 @@ namespace xo {
} }
void void
DDefineExpr::visit_gco_children(obj<AGCObjectVisitor> gc) noexcept DDefineExpr::visit_gco_children(VisitReason reason,
obj<AGCObjectVisitor> gc) noexcept
{ {
gc.visit_child(&lhs_var_); gc.visit_child(reason, &lhs_var_);
//gc.forward_inplace(&rhs_); // complicated - need to access via GCObject facet gc.visit_poly_child(reason, &rhs_);
gc.visit_poly_child(&rhs_);
} }
bool bool
@ -104,9 +104,6 @@ namespace xo {
if (lhs_var_) if (lhs_var_)
assert(lhs.data()); assert(lhs.data());
(void)lhs;
(void)rhs;
if (rhs_) if (rhs_)
assert(rhs.data()); assert(rhs.data());

View file

@ -269,15 +269,22 @@ namespace xo {
} }
void void
DGlobalSymtab::visit_gco_children(obj<AGCObjectVisitor> gc) noexcept DGlobalSymtab::visit_gco_children(VisitReason reason,
obj<AGCObjectVisitor> gc) noexcept
{ {
// map_ doesn't contain any gc-owned data, can skip // map_ doesn't contain any gc-owned data, can skip
#ifdef __APPLE__
// clang not recognizing these as comptime eligible
assert(var_map_.is_gc_eligible() == false);
assert(type_map_.is_gc_eligible() == false);
#else
static_assert(var_map_.is_gc_eligible() == false); static_assert(var_map_.is_gc_eligible() == false);
static_assert(type_map_.is_gc_eligible() == false); static_assert(type_map_.is_gc_eligible() == false);
#endif
gc.visit_child(&vars_); gc.visit_child(reason, &vars_);
gc.visit_child(&types_); gc.visit_child(reason, &types_);
} }
// ----- printable facet ----- // ----- printable facet -----

View file

@ -89,26 +89,15 @@ namespace xo {
} }
void void
DIfElseExpr::visit_gco_children(obj<AGCObjectVisitor> gc) noexcept DIfElseExpr::visit_gco_children(VisitReason reason,
obj<AGCObjectVisitor> gc) noexcept
{ {
typeref_.visit_gco_children(gc); typeref_.visit_gco_children(reason, gc);
// GC needs to locate AGCObject iface for each member. // GC needs to locate AGCObject iface for each member.
{ gc.visit_poly_child(reason, &test_);
gc.visit_poly_child(&test_); gc.visit_poly_child(reason, &when_true_);
//auto gco = test_.to_facet<AGCObject>(); gc.visit_poly_child(reason, &when_false_);
//gc.forward_inplace(gco.iface(), (void **)&(test_.data_));
}
{
gc.visit_poly_child(&when_true_);
//auto gco = when_true_.to_facet<AGCObject>();
//gc.forward_inplace(gco.iface(), (void **)&(when_true_.data_));
}
{
gc.visit_poly_child(&when_false_);
//auto gco = when_false_.to_facet<AGCObject>();
//gc.forward_inplace(gco.iface(), (void **)&(when_false_.data_));
}
} }
// ----- printable facet ----- // ----- printable facet -----

View file

@ -146,26 +146,15 @@ namespace xo {
} }
void void
DLambdaExpr::visit_gco_children(obj<AGCObjectVisitor> gc) noexcept { DLambdaExpr::visit_gco_children(VisitReason reason,
typeref_.visit_gco_children(gc); obj<AGCObjectVisitor> gc) noexcept {
typeref_.visit_gco_children(reason, gc);
gc.visit_child(&name_);
//{
// auto iface = xo::facet::impl_for<AGCObject,DUniqueString>();
// gc.forward_inplace(&iface, (void **)(&name_));
//}
gc.visit_child(reason, &name_);
// type_name_str_ // type_name_str_
{ gc.visit_child(reason, &local_symtab_);
gc.visit_child(&local_symtab_); gc.visit_poly_child(reason, &body_expr_);
//gc.forward_inplace(&local_symtab_);
}
{
gc.visit_poly_child(&body_expr_);
//gc.forward_pivot_inplace(&body_expr_);
}
// xxx free_var_set // xxx free_var_set
// xxx captured_var_set // xxx captured_var_set

View file

@ -119,11 +119,12 @@ namespace xo {
} }
void void
DLocalSymtab::visit_gco_children(obj<AGCObjectVisitor> gc) noexcept DLocalSymtab::visit_gco_children(VisitReason reason,
obj<AGCObjectVisitor> gc) noexcept
{ {
gc.visit_child(&parent_); gc.visit_child(reason, &parent_);
gc.visit_child(&vars_); gc.visit_child(reason, &vars_);
gc.visit_child(&types_); gc.visit_child(reason, &types_);
} }
// ----- printable facet ----- // ----- printable facet -----

View file

@ -120,11 +120,11 @@ namespace xo {
} }
void void
DSequenceExpr::visit_gco_children(obj<AGCObjectVisitor> gc) noexcept DSequenceExpr::visit_gco_children(VisitReason reason, obj<AGCObjectVisitor> gc) noexcept
{ {
typeref_.visit_gco_children(gc); typeref_.visit_gco_children(reason, gc);
gc.visit_child(&expr_v_); gc.visit_child(reason, &expr_v_);
} }
} /*namespace scm*/ } /*namespace scm*/

View file

@ -47,15 +47,11 @@ namespace xo {
} }
void void
DTypename::visit_gco_children(obj<AGCObjectVisitor> gc) noexcept DTypename::visit_gco_children(VisitReason reason,
obj<AGCObjectVisitor> gc) noexcept
{ {
gc.visit_child(&name_); gc.visit_child(reason, &name_);
//gc.forward_inplace(const_cast<DUniqueString**>(&name_)); gc.visit_poly_child(reason, &type_);
{
gc.visit_poly_child(&type_);
//auto e = type_.to_facet<AGCObject>();
//gc.forward_inplace(e.iface(), (void **)&(type_.data_));
}
} }
bool bool

View file

@ -65,9 +65,10 @@ namespace xo {
} }
void void
DVarRef::visit_gco_children(obj<AGCObjectVisitor> gc) noexcept DVarRef::visit_gco_children(VisitReason reason,
obj<AGCObjectVisitor> gc) noexcept
{ {
gc.visit_child(&vardef_); gc.visit_child(reason, &vardef_);
//auto iface = xo::facet::impl_for<AGCObject,DVariable>(); //auto iface = xo::facet::impl_for<AGCObject,DVariable>();
//gc.forward_inplace(&iface, (void **)vardef_.data_); //gc.forward_inplace(&iface, (void **)vardef_.data_);

View file

@ -9,7 +9,6 @@
#include <cstddef> #include <cstddef>
namespace xo { namespace xo {
using xo::mm::ACollector;
using xo::facet::typeseq; using xo::facet::typeseq;
namespace scm { namespace scm {
@ -45,9 +44,9 @@ namespace xo {
} }
void void
DVariable::visit_gco_children(obj<AGCObjectVisitor> gc) noexcept DVariable::visit_gco_children(VisitReason reason, obj<AGCObjectVisitor> gc) noexcept
{ {
typeref_.visit_gco_children(gc); typeref_.visit_gco_children(reason, gc);
} }
bool bool

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -102,11 +102,10 @@ namespace xo {
} }
void void
TypeRef::visit_gco_children(obj<AGCObjectVisitor> gc) noexcept TypeRef::visit_gco_children(VisitReason reason,
obj<AGCObjectVisitor> gc) noexcept
{ {
//scope log(XO_DEBUG(true), xtag("type", type_.data()), xtag("type.tseq", type_._typeseq())); gc.visit_poly_child(reason, &type_);
gc.visit_poly_child(&type_);
} }
bool bool

View file

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