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 4fdaa64085
28 changed files with 58 additions and 61 deletions

View file

@ -38,6 +38,8 @@ namespace xo {
using AGCObject = xo::mm::AGCObject;
/** gc-centric object visitor **/
using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
/** hint for object visitor **/
using VisitReason = xo::mm::VisitReason;
/** pretty-printer state for APrintable **/
using ppindentinfo = xo::print::ppindentinfo;
@ -150,7 +152,7 @@ namespace xo {
/** move to new address, mandated by @p gc **/
DArray * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept;
/** forward elements to @p gc to-space; replace originals with forarding pointers **/
void visit_gco_children(obj<AGCObjectVisitor> gc) noexcept;
void visit_gco_children(VisitReason reason, obj<AGCObjectVisitor> gc) noexcept;
///@}
private:

View file

@ -19,6 +19,7 @@ namespace xo {
//using ACollector = xo::mm::ACollector;
using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using AGCObject = xo::mm::AGCObject;
using VisitReason = xo::mm::VisitReason;
using ppindentinfo = xo::print::ppindentinfo;
using value_type = long;
@ -40,7 +41,7 @@ namespace xo {
// GCObject facet
DBoolean * 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:
/** boxed boolean value **/

View file

@ -40,6 +40,8 @@ namespace xo {
using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
/** gc-aware object facet **/
using AGCObject = xo::mm::AGCObject;
/** color for gco visitor **/
using VisitReason = xo::mm::VisitReason;
/** pretty-printer state for APrintable **/
using ppindentinfo = xo::print::ppindentinfo;
/** canonical type representing a key-value pair **/
@ -206,7 +208,7 @@ namespace xo {
/** return shallow copy of this array, using memory from @p mm **/
DDictionary * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept;
/** forward elements to @p gc to-space; replace originals with forwarding pointers **/
void visit_gco_children(obj<AGCObjectVisitor> gc) noexcept;
void visit_gco_children(VisitReason reason, obj<AGCObjectVisitor> gc) noexcept;
///@}
private:

View file

@ -6,7 +6,6 @@
#pragma once
#include <xo/alloc2/Allocator.hpp>
//#include <xo/alloc2/Collector.hpp>
#include <xo/alloc2/GCObjectVisitor.hpp>
#include <xo/facet/obj.hpp>
#include <xo/indentlog/print/ppindentinfo.hpp>
@ -15,8 +14,8 @@ namespace xo {
namespace scm {
struct DFloat {
using AAllocator = xo::mm::AAllocator;
//using ACollector = xo::mm::ACollector;
using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using VisitReason = xo::mm::VisitReason;
using ppindentinfo = xo::print::ppindentinfo;
using value_type = double;
@ -37,7 +36,7 @@ namespace xo {
// GCObject facet
DFloat * 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

@ -19,6 +19,7 @@ namespace xo {
//using ACollector = xo::mm::ACollector;
using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using AGCObject = xo::mm::AGCObject;
using VisitReason = xo::mm::VisitReason;
using ppindentinfo = xo::print::ppindentinfo;
using value_type = long;
@ -42,7 +43,7 @@ namespace xo {
// GCObject facet
DInteger * 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:
/** boxed integer value **/

View file

@ -22,6 +22,7 @@ namespace xo {
using AAllocator = xo::mm::AAllocator;
using ACollector = xo::mm::ACollector;
using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using VisitReason = xo::mm::VisitReason;
using ppindentinfo = xo::print::ppindentinfo;
public:
@ -75,7 +76,7 @@ namespace xo {
/** @defgroup xo-scm-list-gcobject-facet gcobject facet **/
///@{
DList * 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;
///@}
/** first member of list **/

View file

@ -19,6 +19,7 @@ namespace xo {
using AGCObject = xo::mm::AGCObject;
//using ACollector = xo::mm::ACollector;
using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using VisitReason = xo::mm::VisitReason;
using AAllocator = xo::mm::AAllocator;
using ppindentinfo = xo::print::ppindentinfo;
@ -51,7 +52,7 @@ namespace xo {
///@{
DRuntimeError * 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

@ -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(DArray & self, obj<AGCObjectVisitor> fn) noexcept;
static void visit_gco_children(DArray & 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(DBoolean & self, obj<AGCObjectVisitor> fn) noexcept;
static void visit_gco_children(DBoolean & 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(DDictionary & self, obj<AGCObjectVisitor> fn) noexcept;
static void visit_gco_children(DDictionary & 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(DRuntimeError & self, obj<AGCObjectVisitor> fn) noexcept;
static void visit_gco_children(DRuntimeError & 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(DList & self, obj<AGCObjectVisitor> fn) noexcept;
static void visit_gco_children(DList & self, VisitReason reason, obj<AGCObjectVisitor> fn) noexcept;
///@}
};

View file

@ -44,6 +44,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;
///@}
@ -58,7 +59,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(DFloat & self, obj<AGCObjectVisitor> fn) noexcept;
static void visit_gco_children(DFloat & 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(DInteger & self, obj<AGCObjectVisitor> fn) noexcept;
static void visit_gco_children(DInteger & self, VisitReason reason, obj<AGCObjectVisitor> fn) noexcept;
///@}
};