xo-gc: streamlining/simplifying

This commit is contained in:
Roland Conybeare 2026-04-03 17:29:18 -04:00
commit eba7219593
7 changed files with 30 additions and 44 deletions

View file

@ -382,9 +382,7 @@ namespace xo {
/** if > 0: need gc for all generations < gc_pending_upto_ **/
Generation gc_pending_upto_;
/** using arena to get extensible list of root objects.
* For each root store one address (type obj<AGCObject>*)
*
/**
* An Object x that supports AGCObject, but doesn't live in gc-space,
* will get special treatment if it appears in root_set_:
* collector will traverse x to forward pointers to gc-owned
@ -410,7 +408,7 @@ namespace xo {
GCObjectStore gco_store_;
/** counters collected during @ref verify_ok call **/
VerifyStats verify_stats_;
X1VerifyStats verify_stats_;
};
} /*namespace mm*/
} /*namespace xo*/

View file

@ -131,22 +131,6 @@ namespace xo {
obj<AGCObject> from_src,
Generation upto);
/** move interior subgraph at @p from_src to to-space.
* no-op if not in gc-space.
**/
void * _deep_move_interior(DX1Collector * gc,
void * from_src,
Generation upto);
/** Common driver for _deep_move_root(), _deep_move_interior().
* Move object subgraph @p from_src on behalf of @p gc collection cycle,
* covering generations in [0 ,.., upto).
**/
void * _deep_move_gc_owned(DX1Collector * gc,
void * from_src,
Generation upto);
private:
public:
/** For each generation g in [0 ,.., upto)
* swap arenas assigned to {to-space, from-space}.
@ -154,6 +138,15 @@ namespace xo {
**/
void swap_roles(Generation upto) noexcept;
/** move interior subgraph at @p from_src to to-space.
* no-op if not in gc-space.
*
* NOTE: load-bearing for MutationLogStore
**/
void * deep_move_interior(DX1Collector * gc,
void * from_src,
Generation upto);
/** Evacuate object at @p *lhs_data to to-space, during collection phase
* acting on generations g in [0 ,.., upto).
* Need @p gc to pass to invoke AGCObject methods shallow_copy() and
@ -192,6 +185,14 @@ namespace xo {
void * gco_data,
Generation upto) const noexcept;
/** Common driver for _deep_move_root(), _deep_move_interior().
* Move object subgraph @p from_src on behalf of @p gc collection cycle,
* covering generations in [0 ,.., upto).
**/
void * _deep_move_gc_owned(DX1Collector * gc,
void * from_src,
Generation upto);
/** traverse objects allocated after @p ckp, to make sure their children
* are forwarded. Repeat until traverse doesn't find any unforwarded children.
*

View file

@ -16,7 +16,7 @@
namespace xo {
namespace mm {
class DX1Collector;
class VerifyStats;
class X1VerifyStats;
/** @brief container for X1 collector mutation logs
**/
@ -45,7 +45,7 @@ namespace xo {
* Update counters in @p *p_verify_stats.
**/
void verify_ok(GCObjectStore * gc,
VerifyStats * p_verify_stats) noexcept;
X1VerifyStats * p_verify_stats) noexcept;
/** Append a single mutation to log for generation @p dest_g
* Mutation modifies @p parent at address @p addr,

View file

@ -13,13 +13,13 @@ namespace xo {
/** @brief info collected during a @ref DX1Collector::verify_ok call
* (or @ref MutationLogState::verify_ok call)
**/
class VerifyStats {
class X1VerifyStats {
public:
bool is_ok() const noexcept {
return (n_from_ == 0) && (n_fwd_ == 0) && (n_no_iface_ == 0);
}
void clear() { *this = VerifyStats(); }
void clear() { *this = X1VerifyStats(); }
/** number of gc roots examined **/
std::uint32_t n_gc_root_ = 0;

View file

@ -391,7 +391,7 @@ namespace xo {
// 2. visit roots
for (GCRoot & root_slot : root_set_) {
VerifyStats pre = verify_stats_;
X1VerifyStats pre = verify_stats_;
auto gco = *root_slot.root();
@ -407,7 +407,7 @@ namespace xo {
}
VerifyStats post = verify_stats_;
X1VerifyStats post = verify_stats_;
// assert fail -> root contains ptr to from-space
assert(pre.n_from_ == post.n_from_);
@ -662,19 +662,6 @@ namespace xo {
}
}
#ifdef OBSOLETE
bool
DX1Collector::check_move_policy(header_type alloc_hdr,
void * object_data) const noexcept
{
assert(runstate_.is_running());
return gco_store_._check_move_policy(alloc_hdr,
object_data,
runstate_.gc_upto());
}
#endif
auto
DX1Collector::alloc(typeseq t, size_type z) noexcept -> value_type
{

View file

@ -752,9 +752,9 @@ namespace xo {
}
void *
GCObjectStore::_deep_move_interior(DX1Collector * gc,
void * from_src,
Generation upto)
GCObjectStore::deep_move_interior(DX1Collector * gc,
void * from_src,
Generation upto)
{
scope log(XO_DEBUG(config_.debug_flag_));

View file

@ -89,7 +89,7 @@ namespace xo {
void
MutationLogStore::verify_ok(GCObjectStore * gco_store,
VerifyStats * p_verify_stats) noexcept
X1VerifyStats * p_verify_stats) noexcept
{
// 4. scan mutation logs
for (Generation g(0); g + 1 < config_.n_generation_; ++g) {
@ -402,7 +402,7 @@ namespace xo {
GCObjectStore & gco_store = gc->gco_store();
child_to = gco_store._deep_move_interior(gc, child_fr, upto);
child_to = gco_store.deep_move_interior(gc, child_fr, upto);
// update child pointer in parent object
*from_entry.p_data() = child_to;