refactor: + narrower interface for gc pointer forwarding

add AGCObjectVisitor, instead of requiring ACollector.
This commit is contained in:
Roland Conybeare 2026-04-05 23:53:02 -04:00
commit 72cbffba46
8 changed files with 25 additions and 15 deletions

View file

@ -44,6 +44,7 @@ namespace xo {
using size_type = xo::mm::AGCObject::size_type;
using AAllocator = xo::mm::AGCObject::AAllocator;
using ACollector = xo::mm::AGCObject::ACollector;
using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor;
using Copaque = xo::mm::AGCObject::Copaque;
using Opaque = xo::mm::AGCObject::Opaque;
///@}
@ -54,8 +55,10 @@ namespace xo {
// non-const methods
/** move instance using allocator **/
static Opaque shallow_move(DString & self, obj<ACollector> gc) noexcept;
/** during GC: forward immdiate children **/
static void forward_children(DString & self, obj<ACollector> gc) noexcept;
/** Invoke fn.visit_child(iface,data) for each child GCObject pointer.
Context: provides address of data pointer so it can be updated in place
when @p fn invokes garbage collector reentry point **/
static void visit_gco_children(DString & self, obj<AGCObjectVisitor> fn) noexcept;
///@}
};