refactor: xo-gc: + GCObjectVisitor.generation_of()

Concession to narrow MutationLogStore to only use GCObjectVisitor
instead of assuming X1Collector.
This commit is contained in:
Roland Conybeare 2026-04-06 23:18:45 -04:00
commit b794f225b2
6 changed files with 36 additions and 7 deletions

View file

@ -14,6 +14,8 @@
#pragma once
// includes (via {facet_includes})
#include <xo/alloc2/Generation.hpp>
#include <xo/alloc2/role.hpp>
#include <xo/arena/AllocInfo.hpp>
#include <xo/facet/obj.hpp>
#include <xo/facet/facet_implementation.hpp>
@ -22,6 +24,7 @@
// see GCObject.hpp, also in xo-alloc2/
namespace xo { namespace mm { class AGCObject; }}
namespace xo { namespace mm { class AllocInfo; }}
namespace xo { namespace mm { class Generation; }}
namespace xo {
namespace mm {
@ -58,6 +61,9 @@ public:
/** allocation metadata for gc-aware data at address @p gco.
@p gco must be the result of a call to collector's alloc() function **/
virtual AllocInfo alloc_info(Copaque data, void * addr) const = 0;
/** generation to which pointer @p addr belongs, given role @p r;
sentinel if @p addr is not owned by collector **/
virtual Generation generation_of(Copaque data, role r, const void * addr) const noexcept = 0;
// nonconst methods
/** allocate copy of source object at address @p src.