From 5f9a81e6685a445249d36192b7a73db3dbc6b8d8 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Mon, 6 Apr 2026 19:37:11 -0400 Subject: [PATCH] xo-gc: MutationLogStore -> GCObjectStore --- include/xo/gc/DX1Collector.hpp | 8 ++++---- include/xo/gc/MutationLogStore.hpp | 11 ++++++++--- src/gc/DX1Collector.cpp | 4 ++-- src/gc/MutationLogStore.cpp | 25 ++++++++++++------------- 4 files changed, 26 insertions(+), 22 deletions(-) diff --git a/include/xo/gc/DX1Collector.hpp b/include/xo/gc/DX1Collector.hpp index 9ffe5fe..3140e6b 100644 --- a/include/xo/gc/DX1Collector.hpp +++ b/include/xo/gc/DX1Collector.hpp @@ -389,6 +389,10 @@ namespace xo { **/ RootSet root_set_; + /** Collector-managed memory. + **/ + GCObjectStore gco_store_; + /** "remembered sets": track pointers P->C that require special handling * during a gc cycle where either: * 1. xgen pointers g(P) > g(C): @@ -399,10 +403,6 @@ namespace xo { **/ MutationLogStore mlog_store_; - /** Collector-managed memory. - **/ - GCObjectStore gco_store_; - /** counters collected during @ref verify_ok call **/ X1VerifyStats verify_stats_; }; diff --git a/include/xo/gc/MutationLogStore.hpp b/include/xo/gc/MutationLogStore.hpp index 6d2604b..4ef37e3 100644 --- a/include/xo/gc/MutationLogStore.hpp +++ b/include/xo/gc/MutationLogStore.hpp @@ -26,7 +26,8 @@ namespace xo { using size_type = DArena::size_type; public: - explicit MutationLogStore(const MutationLogConfig & config); + explicit MutationLogStore(const MutationLogConfig & config, + GCObjectStore * gco_store); /** Initialize mlog state * with o/s page size @p page_z @@ -140,8 +141,7 @@ namespace xo { * helper function to decide whether to keep a mutation log entry * @return true iff mlog entry appended to @p keep_mlog **/ - bool _check_keep_mutation_aux(const GCObjectStore & gco_store, - const MutationLogEntry & from_entry, + bool _check_keep_mutation_aux(const MutationLogEntry & from_entry, Generation parent_gen_to, void * child_to, MutationLog * keep_mlog); @@ -151,6 +151,11 @@ namespace xo { /** configuration for mlog store **/ MutationLogConfig config_; + /** stores GCOs (gc-aware objects) owned by the incremental collector + * with this mutaiton-log store + **/ + GCObjectStore * gco_store_ = nullptr; + /** Cross-generational mutations tracked in MutationLogs. * We need three logs per generation: * A. one to observe and remember mutations in to-space diff --git a/src/gc/DX1Collector.cpp b/src/gc/DX1Collector.cpp index 9075f44..78a298a 100644 --- a/src/gc/DX1Collector.cpp +++ b/src/gc/DX1Collector.cpp @@ -69,8 +69,8 @@ namespace xo { DX1Collector::DX1Collector(const X1CollectorConfig & cfg) : config_{cfg}, - mlog_store_{cfg.mlog_config()}, - gco_store_{cfg.gco_store_config()} + gco_store_{cfg.gco_store_config()}, + mlog_store_{cfg.mlog_config(), &gco_store_} { assert(config_.arena_config_.header_.size_bits_ + config_.arena_config_.header_.age_bits_ + diff --git a/src/gc/MutationLogStore.cpp b/src/gc/MutationLogStore.cpp index 9cf7e9b..46e5c3e 100644 --- a/src/gc/MutationLogStore.cpp +++ b/src/gc/MutationLogStore.cpp @@ -9,8 +9,10 @@ namespace xo { namespace mm { - MutationLogStore::MutationLogStore(const MutationLogConfig & config) - : config_{config} + MutationLogStore::MutationLogStore(const MutationLogConfig & config, + GCObjectStore * gco_store) + : config_{config}, + gco_store_{gco_store} {} void @@ -411,8 +413,7 @@ namespace xo { MutationLogEntry to_entry(parent_to, p_data_to, from_entry.snap()); - this->_check_keep_mutation_aux(gc->gco_store(), - to_entry, + this->_check_keep_mutation_aux(to_entry, parent_gen_to, child_to, keep_mlog); @@ -464,7 +465,7 @@ namespace xo { // or already evacuated. // (+ remember this need not be 1st pass over mlog entries) - GCObjectStore & gco_store = x1gc->gco_store(); + //GCObjectStore & gco_store = x1gc->gco_store(); if (child_info.is_forwarding_tseq()) { // [MLOG1] @@ -481,7 +482,7 @@ namespace xo { ++counters.n_rescue_; - child_to = gco_store.deep_move_interior(x1gc->ref(), child_fr, upto); + child_to = gco_store_->deep_move_interior(x1gc->ref(), child_fr, upto); // update child pointer in parent object *from_entry.p_data() = child_to; @@ -489,26 +490,24 @@ namespace xo { // child_to generation in {gen, gen+1} - this->_check_keep_mutation_aux(gco_store, - from_entry, parent_gen, child_to, keep_mlog); + this->_check_keep_mutation_aux(from_entry, parent_gen, child_to, keep_mlog); return counters; } bool - MutationLogStore::_check_keep_mutation_aux(const GCObjectStore & gco_store, - const MutationLogEntry & from_entry, + MutationLogStore::_check_keep_mutation_aux(const MutationLogEntry & from_entry, Generation parent_gen_to, void * child_to, MutationLog * keep_mlog) { Generation child_gen_to - = gco_store.generation_of(role::to_space(), child_to); + = gco_store_->generation_of(role::to_space(), child_to); bool need_mlog_entry = ((child_gen_to + 1 < config_.n_generation_) - && (gco_store.config().promotion_threshold(parent_gen_to) - > gco_store.config().promotion_threshold(child_gen_to))); + && (gco_store_->config().promotion_threshold(parent_gen_to) + > gco_store_->config().promotion_threshold(child_gen_to))); if (need_mlog_entry) { // 1. P->C pointer is still cross-age (xage), and