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 ec639ebb4b
276 changed files with 772 additions and 596 deletions

View file

@ -48,6 +48,11 @@
doc: ["fomo collector type"],
definition: "xo::mm::AGCObjectVisitor",
},
{
name: "VisitReason",
doc: ["hint arg when navigating object graph"],
definition: "xo::mm::VisitReason",
},
],
const_methods: [
// size_type shallow_size() const noexcept
@ -77,7 +82,7 @@
noexcept: true,
attributes: [],
},
// size_type visit_gco_children(obj<AGCObjectVisitor>) noexcept
// size_type visit_gco_children(VisitReason reason, obj<AGCObjectVisitor>) noexcept
{
name: "visit_gco_children",
doc: [
@ -87,6 +92,7 @@
],
return_type: "void",
args: [
{type: "VisitReason", name: "reason"},
{type: "obj<AGCObjectVisitor>", name: "fn"},
],
const: true,

View file

@ -6,6 +6,7 @@
includes: [
"<xo/alloc2/Generation.hpp>",
"<xo/alloc2/role.hpp>",
"<xo/alloc2/VisitReason.hpp>",
"<xo/arena/AllocInfo.hpp>",
],
// extra includes in GCObject.hpp, if any
@ -85,12 +86,13 @@
noexcept: false,
attributes: [],
},
// void visit_child(AGCObject * iface, void ** pp_data) noexcept;
// void visit_child(VisitReason reason, AGCObject * iface, void ** pp_data) noexcept;
{
name: "visit_child",
doc: ["visit child of a gc-aware object. May update child in-place!"],
return_type: "void",
args:[
{type: "VisitReason", name: "reason"},
{type: "AGCObject *", name: "iface"},
{type: "void **", name: "pp_data"},
],
@ -121,20 +123,20 @@
" (for historical reasons - coul d be in RGCObject_aux.hpp?)",
" **/",
"template <typename DRepr>",
"void visit_child(xo::facet::obj<AGCObject,DRepr> * p_obj);",
"void visit_child(VisitReason reason, xo::facet::obj<AGCObject,DRepr> * p_obj);",
"",
"/** visit typed child data pointer in place.",
" Defined in RGCObject.hpp to avoid #include cycle",
" **/",
"template <typename DRepr>",
"void visit_child(DRepr ** pp_data);",
"void visit_child(VisitReason reason, DRepr ** pp_data);",
"",
"/** visit faceted object pointer stored using some facet",
" other than AGCObject",
" **/",
"template <typename AFacet, typename DRepr>",
"requires (!std::is_same_v<AFacet, AGCObject>)",
"void visit_poly_child(obj<AFacet,DRepr> * p_pivot);",
"void visit_poly_child(VisitReason reason, obj<AFacet,DRepr> * p_pivot);",
"",
]
}

View file

@ -0,0 +1,51 @@
/** @file VisitReason.hpp
*
* @author Roland Conybeare, Apr 2026
**/
#pragma once
namespace xo {
namespace mm {
/** @brief tag when navigating object graph
*
* Used with
* @ref DX1Collector::visit_child
* @ref GCObject::visit_gco_children
**/
class VisitReason {
public:
enum class code {
invalid = -1,
/** color not needed **/
unspecified,
/** Forward child pointers inplace for GC.
* See @ref GCObjectStore::forward_inplace_aux
**/
forward,
/** verify GC store consistency
* See @ref DX1Collector::_verify_aux
**/
verify,
N,
};
explicit VisitReason(code x) : code_{x} {}
static VisitReason unspecified() { return VisitReason(code::unspecified); }
static VisitReason forward() { return VisitReason(code::forward); }
static VisitReason verify() { return VisitReason(code::verify); }
code code() const noexcept { return code_; }
enum code code_;
};
} /*namespace mm*/
} /*namespace xo*/
/* end VisitReason.hpp */

View file

@ -51,6 +51,8 @@ public:
using ACollector = xo::mm::ACollector;
/** fomo collector type **/
using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
/** hint arg when navigating object graph **/
using VisitReason = xo::mm::VisitReason;
///@}
/** @defgroup mm-gcobject-methods **/
@ -73,7 +75,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 **/
virtual void visit_gco_children(Opaque data, obj<AGCObjectVisitor> fn) const noexcept = 0;
virtual void visit_gco_children(Opaque data, VisitReason reason, obj<AGCObjectVisitor> fn) const noexcept = 0;
///@}
}; /*AGCObject*/

View file

@ -16,6 +16,7 @@
// includes (via {facet_includes})
#include <xo/alloc2/Generation.hpp>
#include <xo/alloc2/role.hpp>
#include <xo/alloc2/VisitReason.hpp>
#include <xo/arena/AllocInfo.hpp>
#include <xo/facet/obj.hpp>
#include <xo/facet/facet_implementation.hpp>
@ -71,7 +72,7 @@ Source must be owned by this collector.
Increments object age **/
virtual void * alloc_copy(Opaque data, std::byte * src) const = 0;
/** visit child of a gc-aware object. May update child in-place! **/
virtual void visit_child(Opaque data, AGCObject * iface, void ** pp_data) const noexcept = 0;
virtual void visit_child(Opaque data, VisitReason reason, AGCObject * iface, void ** pp_data) const noexcept = 0;
///@}
}; /*AGCObjectVisitor*/

View file

@ -63,7 +63,7 @@ namespace mm {
// nonconst methods
[[noreturn]] void * alloc_copy(Opaque, std::byte *) const override;
[[noreturn]] void visit_child(Opaque, AGCObject *, void **) const noexcept override;
[[noreturn]] void visit_child(Opaque, VisitReason, AGCObject *, void **) const noexcept override;
///@}

View file

@ -15,6 +15,7 @@
#include <xo/alloc2/Generation.hpp>
#include <xo/alloc2/role.hpp>
#include <xo/alloc2/VisitReason.hpp>
#include <xo/arena/AllocInfo.hpp>
namespace xo {
@ -56,8 +57,8 @@ namespace mm {
void * alloc_copy(Opaque data, std::byte * src) const override {
return I::alloc_copy(_dcast(data), src);
}
void visit_child(Opaque data, AGCObject * iface, void ** pp_data) const noexcept override {
return I::visit_child(_dcast(data), iface, pp_data);
void visit_child(Opaque data, VisitReason reason, AGCObject * iface, void ** pp_data) const noexcept override {
return I::visit_child(_dcast(data), reason, iface, pp_data);
}
///@}

View file

@ -48,6 +48,7 @@ namespace mm {
using AAllocator = AGCObject::AAllocator;
using ACollector = AGCObject::ACollector;
using AGCObjectVisitor = AGCObject::AGCObjectVisitor;
using VisitReason = AGCObject::VisitReason;
///@}
/** @defgroup mm-gcobject-any-methods **/
@ -65,7 +66,7 @@ namespace mm {
// nonconst methods
[[noreturn]] Opaque gco_shallow_move(Opaque, obj<AGCObjectVisitor>) const noexcept override;
[[noreturn]] void visit_gco_children(Opaque, obj<AGCObjectVisitor>) const noexcept override;
[[noreturn]] void visit_gco_children(Opaque, VisitReason, obj<AGCObjectVisitor>) const noexcept override;
///@}

View file

@ -36,6 +36,7 @@ namespace mm {
using AAllocator = AGCObject::AAllocator;
using ACollector = AGCObject::ACollector;
using AGCObjectVisitor = AGCObject::AGCObjectVisitor;
using VisitReason = AGCObject::VisitReason;
///@}
/** @defgroup mm-gcobject-xfer-methods **/
@ -56,8 +57,8 @@ namespace mm {
Opaque gco_shallow_move(Opaque data, obj<AGCObjectVisitor> gc) const noexcept override {
return I::gco_shallow_move(_dcast(data), gc);
}
void visit_gco_children(Opaque data, obj<AGCObjectVisitor> fn) const noexcept override {
return I::visit_gco_children(_dcast(data), fn);
void visit_gco_children(Opaque data, VisitReason reason, obj<AGCObjectVisitor> fn) const noexcept override {
return I::visit_gco_children(_dcast(data), reason, fn);
}
///@}

View file

@ -24,32 +24,33 @@ namespace xo {
template <typename Object>
template <typename DRepr>
void
RGCObjectVisitor<Object>::visit_child(xo::facet::obj<AGCObject,DRepr> * p_obj)
RGCObjectVisitor<Object>::visit_child(VisitReason reason,
xo::facet::obj<AGCObject,DRepr> * p_obj)
{
this->visit_child(p_obj->iface(), (void **)&(p_obj->data_));
this->visit_child(reason, p_obj->iface(), (void **)&(p_obj->data_));
}
template <typename Object>
template <typename DRepr>
void
RGCObjectVisitor<Object>::visit_child(DRepr ** p_repr)
RGCObjectVisitor<Object>::visit_child(VisitReason reason, DRepr ** p_repr)
{
// fetch static interface for DRepr (strip const: FacetImplementation specializations use non-const DRepr)
auto iface = xo::facet::impl_for<AGCObject, std::remove_const_t<DRepr>>();
this->visit_child(&iface, (void **)p_repr);
this->visit_child(reason, &iface, (void **)p_repr);
}
template <typename Object>
template <typename AFacet, typename DRepr>
requires (!std::is_same_v<AFacet, AGCObject>)
void
RGCObjectVisitor<Object>::visit_poly_child(obj<AFacet, DRepr> * p_objs)
RGCObjectVisitor<Object>::visit_poly_child(VisitReason reason, obj<AFacet, DRepr> * p_objs)
{
if (*p_objs) {
auto e = xo::facet::FacetRegistry::instance().variant<AGCObject,AFacet>(*p_objs);
this->visit_child(e.iface(), (void **)&(p_objs->data_));
this->visit_child(reason, e.iface(), (void **)&(p_objs->data_));
}
}

View file

@ -35,6 +35,7 @@ public:
using AAllocator = AGCObject::AAllocator;
using ACollector = AGCObject::ACollector;
using AGCObjectVisitor = AGCObject::AGCObjectVisitor;
using VisitReason = AGCObject::VisitReason;
///@}
/** @defgroup mm-gcobject-router-ctors **/
@ -61,8 +62,8 @@ public:
Opaque gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept {
return O::iface()->gco_shallow_move(O::data(), gc);
}
void visit_gco_children(obj<AGCObjectVisitor> fn) noexcept {
return O::iface()->visit_gco_children(O::data(), fn);
void visit_gco_children(VisitReason reason, obj<AGCObjectVisitor> fn) noexcept {
return O::iface()->visit_gco_children(O::data(), reason, fn);
}
///@}

View file

@ -67,20 +67,20 @@ public:
(for historical reasons - coul d be in RGCObject_aux.hpp?)
**/
template <typename DRepr>
void visit_child(xo::facet::obj<AGCObject,DRepr> * p_obj);
void visit_child(VisitReason reason, xo::facet::obj<AGCObject,DRepr> * p_obj);
/** visit typed child data pointer in place.
Defined in RGCObject.hpp to avoid #include cycle
**/
template <typename DRepr>
void visit_child(DRepr ** pp_data);
void visit_child(VisitReason reason, DRepr ** pp_data);
/** visit faceted object pointer stored using some facet
other than AGCObject
**/
template <typename AFacet, typename DRepr>
requires (!std::is_same_v<AFacet, AGCObject>)
void visit_poly_child(obj<AFacet,DRepr> * p_pivot);
void visit_poly_child(VisitReason reason, obj<AFacet,DRepr> * p_pivot);
// builtin methods
@ -99,8 +99,8 @@ public:
void * alloc_copy(std::byte * src) {
return O::iface()->alloc_copy(O::data(), src);
}
void visit_child(AGCObject * iface, void ** pp_data) noexcept {
return O::iface()->visit_child(O::data(), iface, pp_data);
void visit_child(VisitReason reason, AGCObject * iface, void ** pp_data) noexcept {
return O::iface()->visit_child(O::data(), reason, iface, pp_data);
}
///@}

View file

@ -12,6 +12,8 @@ namespace xo {
namespace mm {
static constexpr uint32_t c_n_role = 2;
/** @brief identify GC half-spaces
**/
class Role {
public:
using value_type = std::uint32_t;

View file

@ -42,7 +42,7 @@ IGCObject_Any::gco_shallow_move(Opaque, obj<AGCObjectVisitor>) const noexcept
}
auto
IGCObject_Any::visit_gco_children(Opaque, obj<AGCObjectVisitor>) const noexcept -> void
IGCObject_Any::visit_gco_children(Opaque, VisitReason, obj<AGCObjectVisitor>) const noexcept -> void
{
_fatal();
}

View file

@ -42,7 +42,7 @@ IGCObjectVisitor_Any::alloc_copy(Opaque, std::byte *) const -> void *
}
auto
IGCObjectVisitor_Any::visit_child(Opaque, AGCObject *, void **) const noexcept -> void
IGCObjectVisitor_Any::visit_child(Opaque, VisitReason, AGCObject *, void **) const noexcept -> void
{
_fatal();
}

View file

@ -21,8 +21,8 @@ namespace xo {
**/
class DApplyExpr {
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;
using ppindentinfo = xo::print::ppindentinfo;
@ -85,7 +85,7 @@ namespace xo {
///@{
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 **/

View file

@ -8,7 +8,6 @@
#include "Expression.hpp"
#include "TypeRef.hpp"
#include "exprtype.hpp"
//#include <xo/alloc2/Collector.hpp>
#include <xo/alloc2/GCObject.hpp>
#include <xo/alloc2/GCObjectVisitor.hpp>
#include <xo/reflect/TaggedPtr.hpp>
@ -22,8 +21,8 @@ namespace xo {
public:
using TaggedPtr = xo::reflect::TaggedPtr;
using TypeDescr = xo::reflect::TypeDescr;
//using ACollector = xo::mm::ACollector;
using AGCObject = xo::mm::AGCObject;
using VisitReason = xo::mm::VisitReason;
using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using AAllocator = xo::mm::AAllocator;
using typeseq = xo::reflect::typeseq;
@ -65,7 +64,7 @@ namespace xo {
///@{
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 **/

View file

@ -26,6 +26,7 @@ namespace xo {
using ppindentinfo = xo::print::ppindentinfo;
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;
@ -75,7 +76,7 @@ namespace xo {
///@{
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 **/

View file

@ -30,9 +30,9 @@ 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 AGCObject = xo::mm::AGCObject;
using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using VisitReason = xo::mm::VisitReason;
using AAllocator = xo::mm::AAllocator;
using MemorySizeVisitor = xo::mm::MemorySizeVisitor;
using ppindentinfo = xo::print::ppindentinfo;
@ -116,7 +116,7 @@ namespace xo {
///@{
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 **/

View file

@ -8,7 +8,6 @@
#include "Expression.hpp"
#include "TypeRef.hpp"
#include "exprtype.hpp"
//#include <xo/alloc2/Collector.hpp>
#include <xo/alloc2/GCObjectVisitor.hpp>
#include <xo/alloc2/Allocator.hpp>
#include <string>
@ -21,8 +20,8 @@ namespace xo {
**/
class DIfElseExpr {
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;
using ppindentinfo = xo::print::ppindentinfo;
@ -99,7 +98,7 @@ namespace xo {
///@{
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 {
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;
using ppindentinfo = xo::print::ppindentinfo;
@ -88,7 +88,7 @@ namespace xo {
std::size_t shallow_size() const 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 **/

View file

@ -20,8 +20,8 @@ namespace xo {
public:
using DArray = xo::scm::DArray;
using ppindentinfo = xo::print::ppindentinfo;
//using ACollector = xo::mm::ACollector;
using AGCObject = xo::mm::AGCObject;
using VisitReason = xo::mm::VisitReason;
using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using AAllocator = xo::mm::AAllocator;
/* note: uint16_t would be fine too */
@ -100,7 +100,7 @@ namespace xo {
///@{
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 **/

View file

@ -23,8 +23,8 @@ namespace xo {
**/
class DSequenceExpr {
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;
using size_type = DArray::size_type;
@ -75,7 +75,7 @@ namespace xo {
///@{
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 {
public:
using ppindentinfo = xo::print::ppindentinfo;
//using ACollector = xo::mm::ACollector;
using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using VisitReason = xo::mm::VisitReason;
using AGCObject = xo::mm::AGCObject;
using AAllocator = xo::mm::AAllocator;
@ -56,7 +56,7 @@ namespace xo {
///@{
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 **/

View file

@ -21,8 +21,8 @@ namespace xo {
class DVarRef {
public:
using ppindentinfo = xo::print::ppindentinfo;
//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;
@ -57,7 +57,7 @@ namespace xo {
///@{
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 **/

View file

@ -22,8 +22,8 @@ namespace xo {
class DVariable {
public:
using ppindentinfo = xo::print::ppindentinfo;
//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;
@ -65,7 +65,7 @@ namespace xo {
///@{
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 **/

View file

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

View file

@ -45,6 +45,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;
///@}
@ -59,7 +60,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(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 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;
///@}
@ -59,7 +60,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(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 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;
///@}
@ -59,7 +60,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(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 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;
///@}
@ -59,7 +60,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(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 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;
///@}
@ -59,7 +60,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(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 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;
///@}
@ -59,7 +60,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(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 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;
///@}
@ -59,7 +60,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(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 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;
///@}
@ -59,7 +60,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(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 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;
///@}
@ -59,7 +60,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(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 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(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 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;
///@}
@ -59,7 +60,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(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
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(&fn_);
//obj<AGCObject> fn_gco = fn_.to_facet<AGCObject>();
//gc.forward_inplace(fn_gco.iface(), (void **)&fn_.data_);
}
gc.visit_poly_child(reason, &fn_);
for (size_type i = 0; i < n_args_; ++i) {
obj<AExpression> & arg = args_[i];
// runtime poly here
gc.visit_poly_child(&arg);
//obj<AGCObject> arg_gco = arg.to_facet<AGCObject>();
//gc.forward_inplace(arg_gco.iface(), (void **)(&arg.data_));
gc.visit_poly_child(reason, &arg);
}
}

View file

@ -3,8 +3,8 @@
* @author Roland Conybeare, Jan 2026
**/
#include "DConstant.hpp"
#include "detail/IExpression_DConstant.hpp"
#include "Constant.hpp"
//#include "detail/IExpression_DConstant.hpp"
#include "TypeDescr.hpp"
#include <xo/object2/DFloat.hpp>
#include <xo/object2/DInteger.hpp>
@ -78,11 +78,12 @@ namespace xo {
}
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

View file

@ -85,11 +85,11 @@ namespace xo {
}
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.forward_inplace(&rhs_); // complicated - need to access via GCObject facet
gc.visit_poly_child(&rhs_);
gc.visit_child(reason, &lhs_var_);
gc.visit_poly_child(reason, &rhs_);
}
bool
@ -104,9 +104,6 @@ namespace xo {
if (lhs_var_)
assert(lhs.data());
(void)lhs;
(void)rhs;
if (rhs_)
assert(rhs.data());

View file

@ -269,15 +269,22 @@ namespace xo {
}
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
#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(type_map_.is_gc_eligible() == false);
#endif
gc.visit_child(&vars_);
gc.visit_child(&types_);
gc.visit_child(reason, &vars_);
gc.visit_child(reason, &types_);
}
// ----- printable facet -----

View file

@ -89,26 +89,15 @@ namespace xo {
}
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.visit_poly_child(&test_);
//auto gco = test_.to_facet<AGCObject>();
//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_));
}
gc.visit_poly_child(reason, &test_);
gc.visit_poly_child(reason, &when_true_);
gc.visit_poly_child(reason, &when_false_);
}
// ----- printable facet -----

View file

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

View file

@ -119,11 +119,12 @@ namespace xo {
}
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(&vars_);
gc.visit_child(&types_);
gc.visit_child(reason, &parent_);
gc.visit_child(reason, &vars_);
gc.visit_child(reason, &types_);
}
// ----- printable facet -----

View file

@ -120,11 +120,11 @@ namespace xo {
}
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*/

View file

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

View file

@ -65,9 +65,10 @@ namespace xo {
}
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>();
//gc.forward_inplace(&iface, (void **)vardef_.data_);

View file

@ -9,7 +9,6 @@
#include <cstddef>
namespace xo {
using xo::mm::ACollector;
using xo::facet::typeseq;
namespace scm {
@ -45,9 +44,9 @@ namespace xo {
}
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

View file

@ -21,9 +21,9 @@ namespace xo {
return self.gco_shallow_move(gc);
}
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*/

View file

@ -21,9 +21,9 @@ namespace xo {
return self.gco_shallow_move(gc);
}
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*/

View file

@ -21,9 +21,9 @@ namespace xo {
return self.gco_shallow_move(gc);
}
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*/

View file

@ -21,9 +21,9 @@ namespace xo {
return self.gco_shallow_move(gc);
}
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*/

View file

@ -21,9 +21,9 @@ namespace xo {
return self.gco_shallow_move(gc);
}
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*/

View file

@ -21,9 +21,9 @@ namespace xo {
return self.gco_shallow_move(gc);
}
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*/

View file

@ -21,9 +21,9 @@ namespace xo {
return self.gco_shallow_move(gc);
}
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*/

View file

@ -21,9 +21,9 @@ namespace xo {
return self.gco_shallow_move(gc);
}
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*/

View file

@ -21,9 +21,9 @@ namespace xo {
return self.gco_shallow_move(gc);
}
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*/

View file

@ -21,9 +21,9 @@ namespace xo {
return self.gco_shallow_move(gc);
}
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*/

View file

@ -102,11 +102,10 @@ namespace xo {
}
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(&type_);
gc.visit_poly_child(reason, &type_);
}
bool

View file

@ -21,9 +21,9 @@ namespace xo {
return self.gco_shallow_move(gc);
}
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*/

View file

@ -274,20 +274,13 @@ namespace xo {
/** Execute gc immediately, for all generations < @p upto **/
void execute_gc(Generation upto) noexcept;
#ifdef OBSOLETE // replaced by visit_child()
/** Evacuate object at @p *lhs_data to to-space.
* Replace original with forwarding pointer to new location
**/
void forward_inplace(AGCObject * lhs_iface, void ** lhs_data);
#endif
/** Supports GCObjectVisitor facet.
* During gc phase:
* During gc phase (@p reason is 'forward')
* 1. evacuate object at @p *lhs_data to to-space.
* 2. replace @p *lhs_data with forwarding pointer
* to new location.
**/
void visit_child(AGCObject * lhs_iface, void ** lhs_data);
void visit_child(VisitReason reason, AGCObject * lhs_iface, void ** lhs_data);
// ----- allocation -----

View file

@ -58,7 +58,7 @@ Source must be owned by this collector.
Increments object age **/
static void * alloc_copy(DX1Collector & self, std::byte * src);
/** visit child of a gc-aware object. May update child in-place! **/
static void visit_child(DX1Collector & self, AGCObject * iface, void ** pp_data) noexcept;
static void visit_child(DX1Collector & self, VisitReason reason, AGCObject * iface, void ** pp_data) noexcept;
///@}
};

View file

@ -404,7 +404,7 @@ namespace xo {
// - X1Collector::forward_inplace() -> _verify_aux()
//
gco.visit_gco_children(self);
gco.visit_gco_children(VisitReason::verify(), self);
}
@ -585,21 +585,28 @@ namespace xo {
}
void
DX1Collector::visit_child(AGCObject * lhs_iface,
DX1Collector::visit_child(VisitReason reason,
AGCObject * lhs_iface,
void ** lhs_data)
{
// MAYBE: adapter distinct from DX1Collector that supports GCObjectVisitor facet,
// calls DX1Collector::_verify_aux()
if (runstate_.is_running()) {
switch (reason.code()) {
case VisitReason::code::forward:
{
Generation upto = runstate_.gc_upto();
// called during collection phase
gco_store_.forward_inplace_aux(this->ref<AGCObjectVisitor>(), lhs_iface, lhs_data, upto);
} else if (runstate_.is_verify()) {
gco_store_.forward_inplace_aux
(this->ref<AGCObjectVisitor>(), lhs_iface, lhs_data, upto);
break;
}
case VisitReason::code::verify:
// called during verify_ok
this->_verify_aux(lhs_iface, *lhs_data);
} else {
break;
default:
// should be unreachable
assert(false);
}

View file

@ -501,7 +501,7 @@ namespace xo {
log && log("disposition: not in from-space. Don't forward, but check children");
obj<AGCObject> gco(lhs_iface, object_data);
gco.visit_gco_children(gc);
gco.visit_gco_children(VisitReason::forward(), gc);
return;
}
@ -714,7 +714,7 @@ namespace xo {
// Nested control reenters
// X1Collector::forward_inplace() -> _verify_aux()
//
gco.visit_gco_children(gc);
gco.visit_gco_children(VisitReason::forward(), gc);
} else {
++(p_verify_stats->n_no_iface_);
continue;
@ -783,7 +783,7 @@ namespace xo {
GCMoveCheckpoint gray_lo_v
= this->snap_move_checkpoint(upto);
from_src.visit_gco_children(gc);
from_src.visit_gco_children(VisitReason::forward(), gc);
// For each generation g:
// traverse objects newer than gray_lo_v[g], to make sure children
@ -1013,7 +1013,7 @@ namespace xo {
assert(iface->_has_null_vptr() == false);
iface->visit_gco_children(src, gc);
iface->visit_gco_children(src, VisitReason::forward(), gc);
gray_lo_v[g] = ((std::byte *)src) + z;

View file

@ -33,9 +33,9 @@ namespace xo {
return self.alloc_copy(src);
}
auto
IGCObjectVisitor_DX1Collector::visit_child(DX1Collector & self, AGCObject * iface, void ** pp_data) noexcept -> void
IGCObjectVisitor_DX1Collector::visit_child(DX1Collector & self, VisitReason reason, AGCObject * iface, void ** pp_data) noexcept -> void
{
self.visit_child(iface, pp_data);
self.visit_child(reason, iface, pp_data);
}
} /*namespace mm*/

View file

@ -21,9 +21,12 @@ namespace xo {
}
void
DMockCollector::visit_child(AGCObject * lhs_iface, void ** lhs_data)
DMockCollector::visit_child(VisitReason reason, AGCObject * lhs_iface, void ** lhs_data)
{
p_gco_store_->forward_inplace_aux(this->ref<AGCObjectVisitor>(), lhs_iface, lhs_data, upto_);
(void)reason;
p_gco_store_->forward_inplace_aux
(this->ref<AGCObjectVisitor>(), lhs_iface, lhs_data, upto_);
}
std::byte *

View file

@ -26,7 +26,7 @@ namespace xo {
Generation generation_of(Role r, const void * addr) const noexcept;
AllocInfo alloc_info(void * mem) const noexcept;
void visit_child(AGCObject * lhs_iface, void ** lhs_data);
void visit_child(VisitReason reason, AGCObject * lhs_iface, void ** lhs_data);
std::byte * alloc_copy(void * src) noexcept;
private:

View file

@ -295,9 +295,10 @@ namespace ut {
* 2. arena2 doesn't have concept of installed types.
* It doesn't have or require any builtin ability to traverse an object model
**/
DArena arena2 = DArena::map(ArenaConfig().with_name("arena2-reference")
.with_size(tc.gc_size_ * tc.n_gen_)
.with_store_header_flag(true));
DArena arena2
= DArena::map(ArenaConfig().with_name("arena2-reference")
.with_size(tc.gc_size_ * tc.n_gen_)
.with_store_header_flag(true));
// object type storage will be empty unless we install a type.
GCObjectStore gcos(gcos_config);
@ -325,7 +326,7 @@ namespace ut {
}
}
// verify basic arena partitioning
// verify basic arena partitioning + sizing
{
REQUIRE(g0 != g1);
REQUIRE(gcos.new_space());
@ -371,7 +372,7 @@ namespace ut {
}
}
// allocator
// allocator api
auto alloc = obj<AAllocator,DArena>(gcos.new_space());
// create object(s).
@ -420,6 +421,7 @@ namespace ut {
REQUIRE(gcos.header2size(obj_info.header()) == obj_info.size());
REQUIRE(gcos.header2age(obj_info.header()) == object_age{0});
REQUIRE(gcos.header2tseq(obj_info.header()) == obj_info.tseq());
REQUIRE(gcos.is_forwarding_header(obj_info.header()) == false);
}
// new objects appear in to-space for generation 0
@ -441,6 +443,7 @@ namespace ut {
for (size_t i = 0, n = x1_v.size(); i < n; ++i) {
const auto & x1 = x1_v.at(i);
REQUIRE(gcos.contains(Role::from_space(), x1.gco_.data()));
REQUIRE(gcos.contains_allocated(Role::from_space(), x1.gco_.data()));
AllocInfo obj_info = gcos.alloc_info((std::byte *)x1.gco_.data());
REQUIRE(obj_info.size() >= x1.alloc_z_);
@ -578,7 +581,8 @@ namespace ut {
// can still try to move something.
// but will fail since type isn't registered
auto x1p_data = gcos.deep_move_root(mock_gc_visitor, x1.gco_, g1);
auto x1p_data
= gcos.deep_move_root(mock_gc_visitor, x1.gco_, g1);
// control here under normal GC use
// would represent a configuration fail
@ -590,10 +594,23 @@ namespace ut {
// Things to test:
// - deep_move_interior() // used from MutationLogStore
// - forward_inplace_aux() // used from DX1Collector.visit_child
// - cleanup_phase() // used from DX1Collector._cleanup_phase
// - report_object_types
// - report_object_ages()
bool sanitize_flag = true;
// swaps to- and from- spaces again
// Now from-space will be empty, all live objects in to-space
gcos.cleanup_phase(g1, sanitize_flag);
#ifdef NOT_YET
gcos.verify_ok(xxx objectvisitor,
xxx &verify_stats);
#endif
// - verify_ok
}
}

View file

@ -33,9 +33,9 @@ namespace xo {
return self.alloc_copy(src);
}
auto
IGCObjectVisitor_DMockCollector::visit_child(DMockCollector & self, AGCObject * iface, void ** pp_data) noexcept -> void
IGCObjectVisitor_DMockCollector::visit_child(DMockCollector & self, VisitReason reason, AGCObject * iface, void ** pp_data) noexcept -> void
{
self.visit_child(iface, pp_data);
self.visit_child(reason, iface, pp_data);
}
} /*namespace mm*/

View file

@ -58,7 +58,7 @@ Source must be owned by this collector.
Increments object age **/
static void * alloc_copy(DMockCollector & self, std::byte * src);
/** visit child of a gc-aware object. May update child in-place! **/
static void visit_child(DMockCollector & self, AGCObject * iface, void ** pp_data) noexcept;
static void visit_child(DMockCollector & self, VisitReason reason, AGCObject * iface, void ** pp_data) noexcept;
///@}
};

View file

@ -19,9 +19,9 @@ namespace xo {
class DClosure {
public:
using ARuntimeContext = xo::scm::ARuntimeContext;
//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 ppindentinfo = xo::print::ppindentinfo;
using size_type = std::int32_t;
@ -59,7 +59,7 @@ namespace xo {
///@{
DClosure * 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-closure-printable-facet **/

View file

@ -16,9 +16,9 @@ namespace xo {
class DLocalEnv {
public:
using DArray = xo::scm::DArray;
//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 ppindentinfo = xo::print::ppindentinfo;
using size_type = std::uint32_t;
@ -56,7 +56,7 @@ namespace xo {
///@{
DLocalEnv * 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-localenv-printable-facet **/

View file

@ -21,6 +21,7 @@ namespace xo {
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 ppindentinfo = xo::print::ppindentinfo;
@ -42,7 +43,7 @@ namespace xo {
/** gcobject facet **/
std::size_t shallow_size() const noexcept;
DVsmApplyClosureFrame * 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;
/** pretty-printing support **/
bool pretty(const ppindentinfo & ppii) const;

View file

@ -14,9 +14,9 @@ namespace xo {
class DVsmApplyFrame {
public:
using AProcedure = xo::scm::AProcedure;
//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 ppindentinfo = xo::print::ppindentinfo;
@ -39,7 +39,7 @@ namespace xo {
void assign_fn(obj<AGCObject> x) { this->fn_ = x; }
DVsmApplyFrame * 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;
/** pretty-printing support **/
bool pretty(const ppindentinfo & ppii) const;

View file

@ -15,8 +15,8 @@ namespace xo {
**/
class DVsmDefContFrame {
public:
//using ACollector = xo::mm::ACollector;
using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using VisitReason = xo::mm::VisitReason;
using AAllocator = xo::mm::AAllocator;
using AGCObject = xo::mm::AGCObject;
using ppindentinfo = xo::print::ppindentinfo;
@ -52,7 +52,7 @@ namespace xo {
///@{
DVsmDefContFrame * 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;
///@}
/** @defgrouop scm-vsmseqcontframe-printable-facet printable facet **/

View file

@ -14,9 +14,9 @@ namespace xo {
/** frame for executing an apply expression **/
class DVsmEvalArgsFrame {
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 ppindentinfo = xo::print::ppindentinfo;
@ -44,7 +44,7 @@ namespace xo {
int32_t increment_arg() { return ++i_arg_; }
DVsmEvalArgsFrame * 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;
bool pretty(const ppindentinfo & ppii) const;

View file

@ -15,9 +15,9 @@ namespace xo {
**/
class DVsmIfElseContFrame {
public:
//using ACollector = xo::mm::ACollector;
using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using AGCObject = xo::mm::AGCObject;
using VisitReason = xo::mm::VisitReason;
using AAllocator = xo::mm::AAllocator;
using ppindentinfo = xo::print::ppindentinfo;
@ -52,7 +52,7 @@ namespace xo {
///@{
DVsmIfElseContFrame * 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;
///@}
/** @defgrouop scm-vsmseqcontframe-printable-facet printable facet **/

View file

@ -15,10 +15,10 @@ namespace xo {
**/
class DVsmSeqContFrame {
public:
//using ACollector = xo::mm::ACollector;
using AAllocator = xo::mm::AAllocator;
using AGCObject = xo::mm::AGCObject;
using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using VisitReason = xo::mm::VisitReason;
using AAllocator = xo::mm::AAllocator;
using ppindentinfo = xo::print::ppindentinfo;
public:
@ -57,7 +57,7 @@ namespace xo {
///@{
DVsmSeqContFrame * 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;
///@}
/** @defgrouop scm-vsmseqcontframe-printable-facet printable facet **/

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -71,9 +71,9 @@ namespace xo {
public:
// will be DArenaVector<obj<StackFrame>> probably
using Stack = void *;
//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 MemorySizeVisitor = xo::mm::MemorySizeVisitor;
using span_type = xo::mm::span<const char>;
@ -158,7 +158,7 @@ namespace xo {
/** forward gc-aware child pointers
**/
void visit_gco_children(obj<AGCObjectVisitor> gc) noexcept;
void visit_gco_children(VisitReason reason, obj<AGCObjectVisitor> gc) noexcept;
///@}

View file

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

View file

@ -70,10 +70,11 @@ namespace xo {
}
void
DClosure::visit_gco_children(obj<AGCObjectVisitor> gc) noexcept
DClosure::visit_gco_children(VisitReason reason,
obj<AGCObjectVisitor> gc) noexcept
{
gc.visit_child(&lambda_);
gc.visit_child(&env_);
gc.visit_child(reason, &lambda_);
gc.visit_child(reason, &env_);
}
// ----- printable facet -----

View file

@ -97,23 +97,12 @@ namespace xo {
}
void
DLocalEnv::visit_gco_children(obj<AGCObjectVisitor> gc) noexcept
DLocalEnv::visit_gco_children(VisitReason reason,
obj<AGCObjectVisitor> gc) noexcept
{
{
gc.visit_child(&parent_);
//auto iface = xo::facet::impl_for<AGCObject,DLocalEnv>();
//gc.forward_inplace(&iface, (void **)(&parent_));
}
{
gc.visit_child(&symtab_);
//auto iface = xo::facet::impl_for<AGCObject,DLocalSymtab>();
//gc.forward_inplace(&iface, (void **)(&symtab_));
}
{
gc.visit_child(&args_);
//auto iface = xo::facet::impl_for<AGCObject,DArray>();
//gc.forward_inplace(&iface, (void **)(&args_));
}
gc.visit_child(reason, &parent_);
gc.visit_child(reason, &symtab_);
gc.visit_child(reason, &args_);
}
// ----- printable facet -----

View file

@ -972,18 +972,19 @@ namespace xo {
}
void
DVirtualSchematikaMachine::visit_gco_children(obj<AGCObjectVisitor> gc) noexcept
DVirtualSchematikaMachine::visit_gco_children(VisitReason reason,
obj<AGCObjectVisitor> gc) noexcept
{
reader_.visit_gco_children(gc);
reader_.visit_gco_children(reason, gc);
gc.visit_child(&stack_);
gc.visit_poly_child(&expr_);
gc.visit_child(&global_env_);
gc.visit_child(&local_env_);
gc.visit_child(&fn_);
gc.visit_child(&args_);
gc.visit_child(reason, &stack_);
gc.visit_poly_child(reason, &expr_);
gc.visit_child(reason, &global_env_);
gc.visit_child(reason, &local_env_);
gc.visit_child(reason, &fn_);
gc.visit_child(reason, &args_);
if (value_.is_value()) {
gc.visit_child(const_cast<obj<AGCObject> *>(&value_.value_ref()));
gc.visit_child(reason, const_cast<obj<AGCObject> *>(&value_.value_ref()));
}
}

View file

@ -39,10 +39,11 @@ namespace xo {
}
void
DVsmApplyClosureFrame::visit_gco_children(obj<AGCObjectVisitor> gc) noexcept
DVsmApplyClosureFrame::visit_gco_children(VisitReason reason,
obj<AGCObjectVisitor> gc) noexcept
{
gc.visit_child(&stack_);
gc.visit_child(&local_env_);
gc.visit_child(reason, &stack_);
gc.visit_child(reason, &local_env_);
}
bool

View file

@ -47,11 +47,12 @@ namespace xo {
}
void
DVsmApplyFrame::visit_gco_children(obj<AGCObjectVisitor> gc) noexcept
DVsmApplyFrame::visit_gco_children(VisitReason reason,
obj<AGCObjectVisitor> gc) noexcept
{
gc.visit_child(&parent_);
gc.visit_child(&fn_);
gc.visit_child(&args_);
gc.visit_child(reason, &parent_);
gc.visit_child(reason, &fn_);
gc.visit_child(reason, &args_);
}
bool

View file

@ -38,10 +38,11 @@ namespace xo {
}
void
DVsmDefContFrame::visit_gco_children(obj<AGCObjectVisitor> gc) noexcept
DVsmDefContFrame::visit_gco_children(VisitReason reason,
obj<AGCObjectVisitor> gc) noexcept
{
gc.visit_child(&parent_);
gc.visit_child(&def_expr_);
gc.visit_child(reason, &parent_);
gc.visit_child(reason, &def_expr_);
}
// printable facet

View file

@ -48,10 +48,11 @@ namespace xo {
}
void
DVsmEvalArgsFrame::visit_gco_children(obj<AGCObjectVisitor> gc) noexcept
DVsmEvalArgsFrame::visit_gco_children(VisitReason reason,
obj<AGCObjectVisitor> gc) noexcept
{
gc.visit_child(&parent_);
gc.visit_child(&apply_expr_);
gc.visit_child(reason, &parent_);
gc.visit_child(reason, &apply_expr_);
}
bool

View file

@ -36,10 +36,11 @@ namespace xo {
}
void
DVsmIfElseContFrame::visit_gco_children(obj<AGCObjectVisitor> gc) noexcept
DVsmIfElseContFrame::visit_gco_children(VisitReason reason,
obj<AGCObjectVisitor> gc) noexcept
{
gc.visit_child(&parent_);
gc.visit_child(&ifelse_expr_);
gc.visit_child(reason, &parent_);
gc.visit_child(reason, &ifelse_expr_);
}
// printable facet

View file

@ -39,10 +39,11 @@ namespace xo {
}
void
DVsmSeqContFrame::visit_gco_children(obj<AGCObjectVisitor> gc) noexcept
DVsmSeqContFrame::visit_gco_children(VisitReason reason,
obj<AGCObjectVisitor> gc) noexcept
{
gc.visit_child(&parent_);
gc.visit_child(&seq_expr_);
gc.visit_child(reason, &parent_);
gc.visit_child(reason, &seq_expr_);
}
// printable facet

View file

@ -21,9 +21,9 @@ namespace xo {
return self.gco_shallow_move(gc);
}
auto
IGCObject_DClosure::visit_gco_children(DClosure & self, obj<AGCObjectVisitor> fn) noexcept -> void
IGCObject_DClosure::visit_gco_children(DClosure & 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_DVsmApplyClosureFrame::visit_gco_children(DVsmApplyClosureFrame & self, obj<AGCObjectVisitor> fn) noexcept -> void
IGCObject_DVsmApplyClosureFrame::visit_gco_children(DVsmApplyClosureFrame & self, VisitReason reason, obj<AGCObjectVisitor> fn) noexcept -> void
{
self.visit_gco_children(fn);
self.visit_gco_children(reason, fn);
}
} /*namespace scm*/

Some files were not shown because too many files have changed in this diff Show more