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 375f8c1ec4
7 changed files with 64 additions and 135 deletions

View file

@ -104,6 +104,22 @@ namespace xo {
return false;
}
bool
DDictionary::try_upsert_cstr(obj<AAllocator> mm, const char * key_cstr, obj<AGCObject> value)
{
const DString * k1 = DString::from_cstr(mm, key_cstr);
return this->try_upsert(std::make_pair(k1, value));
}
bool
DDictionary::upsert_cstr(obj<AAllocator> mm, const char * key_cstr, obj<AGCObject> value)
{
const DString * k1 = DString::from_cstr(mm, key_cstr);
return this->upsert(mm, std::make_pair(k1, value));
}
bool
DDictionary::try_upsert(const pair_type & kv_pair)
{
@ -190,7 +206,29 @@ namespace xo {
pps->write("}");
return true;
} else {
pps->write("{...}");
pps->write("{");
for (size_type i = 0, n = this->size(); i < n; ++i) {
if (i == 0) {
/* indent, but credit initial {. using same line for first (key,value) */
ppii.pps()->indent(std::max(ppii.pps()->indent_width(), 1u) - 1);
} else {
/* indent after newline */
ppii.pps()->newline_indent(ppii.ci1());
}
obj<APrintable> key
= FacetRegistry::instance().variant<APrintable,AGCObject>((*keys_)[i]);
obj<APrintable> value
= FacetRegistry::instance().variant<APrintable,AGCObject>((*values_)[i]);
pps->pretty(key);
pps->write(": ");
pps->pretty(value);
pps->write(";");
}
pps->write(" }");
return false;
}
}