xo-gc stack: + request-gc-statistics() primitive

1. xo-gc now depends on xo-object2.
2. use genfacet for ICollector_DX1Collector
3. moves xo-gc utest previously in xo-object2 to more natural
   location in xo-gc/
This commit is contained in:
Roland Conybeare 2026-03-29 13:44:19 -04:00
commit 3a263d7f98
6 changed files with 34 additions and 9 deletions

View file

@ -69,6 +69,11 @@ public:
virtual bool contains(Copaque data, role r, const void * addr) const noexcept = 0;
/** true iff gc-aware object of type @p tseq is installed in this collector **/
virtual bool is_type_installed(Copaque data, typeseq tseq) const noexcept = 0;
/** Report gc statistics, at discretion of collector implementation.
Creates dictionary using memory from @p report_mm.
If unable to comply (e.g. oom), return runtime error allocated from @p error_mm.
Avoiding obj<AGCObject> return type to avoid #include cycle **/
virtual bool report_statistics(Copaque data, obj<AAllocator> report_mm, obj<AAllocator> error_mm, obj<AGCObject> * output) const noexcept = 0;
// nonconst methods
/** install interface @p iface for representation with typeseq @p tseq

View file

@ -64,6 +64,7 @@ namespace mm {
[[noreturn]] size_type reserved(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(); }
[[noreturn]] bool report_statistics(Copaque, obj<AAllocator>, obj<AAllocator>, obj<AGCObject> *) const noexcept override { _fatal(); }
// nonconst methods
[[noreturn]] bool install_type(Opaque, const AGCObject &) override;

View file

@ -61,6 +61,9 @@ namespace mm {
bool is_type_installed(Copaque data, typeseq tseq) const noexcept override {
return I::is_type_installed(_dcast(data), tseq);
}
bool report_statistics(Copaque data, obj<AAllocator> report_mm, obj<AAllocator> error_mm, obj<AGCObject> * output) const noexcept override {
return I::report_statistics(_dcast(data), report_mm, error_mm, output);
}
// non-const methods
bool install_type(Opaque data, const AGCObject & iface) override {

View file

@ -94,6 +94,9 @@ public:
bool is_type_installed(typeseq tseq) const noexcept {
return O::iface()->is_type_installed(O::data(), tseq);
}
bool report_statistics(obj<AAllocator> report_mm, obj<AAllocator> error_mm, obj<AGCObject> * output) const noexcept {
return O::iface()->report_statistics(O::data(), report_mm, error_mm, output);
}
// non-const methods (still const in router!)
bool install_type(const AGCObject & iface) {

View file

@ -11,7 +11,7 @@
namespace xo {
namespace mm {
/** hard maximum number of generations **/
static constexpr uint32_t c_max_generation = 2;
static constexpr uint32_t c_max_generation = 3;
/** @class generation
* @brief type-safe generation number