xo-gc stack: + contains() method

This commit is contained in:
Roland Conybeare 2026-03-26 14:58:14 -04:00
commit ec1b6173d9
4 changed files with 11 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); }