xo-gc stack: + contains() method

This commit is contained in:
Roland Conybeare 2026-03-26 14:58:14 -04:00
commit 7845dac09a
6 changed files with 18 additions and 0 deletions

View file

@ -43,6 +43,12 @@ namespace xo {
Generation g, role r) const noexcept = 0;
virtual size_type committed(Copaque d,
Generation g, role r) const noexcept = 0;
/** true if gc responsible for address @p addr with role @p r
**/
virtual bool contains(Copaque d,
role r, const void * addr) const noexcept = 0;
virtual bool is_type_installed(Copaque d,
typeseq tseq) const noexcept = 0;

View file

@ -34,6 +34,7 @@ namespace xo {
[[noreturn]] size_type allocated(Copaque, Generation, role) const noexcept override { _fatal(); }
[[noreturn]] size_type reserved(Copaque, Generation, role) const noexcept override { _fatal(); }
[[noreturn]] size_type committed(Copaque, Generation, role) const noexcept override { _fatal(); }
[[noreturn]] bool contains(Copaque, role, const void *) const noexcept override { _fatal(); }
[[noreturn]] bool is_type_installed(Copaque, typeseq) const noexcept override { _fatal(); }
// non-const methods

View file

@ -44,6 +44,9 @@ namespace xo {
bool is_type_installed(Copaque d, typeseq tseq) const noexcept override {
return I::is_type_installed(_dcast(d), tseq);
}
bool contains(Copaque d, role r, const void * addr) const noexcept override {
return I::contains(_dcast(d), r, addr);
}
// non-const methods

View file

@ -45,6 +45,7 @@ namespace xo {
size_type allocated(Generation g, role r) const noexcept { return O::iface()->allocated(O::data(), g, r); }
size_type reserved(Generation g, role r) const noexcept { return O::iface()->reserved(O::data(), g, r); }
size_type committed(Generation g, role r) const noexcept { return O::iface()->committed(O::data(), g, r); }
bool contains(role r, const void * addr) const noexcept { return O::iface()->contains(O::data(), r, addr); }
bool is_type_installed(typeseq tseq) const noexcept { return O::iface()->is_type_installed(O::data(), tseq); }
bool install_type(const AGCObject & iface) { return O::iface()->install_type(O::data(), iface); }

View file

@ -44,6 +44,7 @@ namespace xo {
static size_type reserved(const DX1Collector & d, Generation g, role r);
static size_type committed(const DX1Collector & d, Generation g, role r);
static bool is_type_installed(const DX1Collector & d, typeseq tseq);
static bool contains(const DX1Collector & d, role r, const void * addr);
static bool install_type(DX1Collector & d, const AGCObject & iface);
static void add_gc_root_poly(DX1Collector & d, obj<AGCObject> * p_root);

View file

@ -47,6 +47,12 @@ namespace xo {
return stat_helper(d, &DArena::committed, g, r);
}
bool
ICollector_DX1Collector::contains(const DX1Collector & d, role r, const void * addr)
{
return d.contains(r, addr);
}
bool
ICollector_DX1Collector::is_type_installed(const DX1Collector & d, typeseq tseq)
{