xo-gc: MutationLogStore -> GCObjectStore

This commit is contained in:
Roland Conybeare 2026-04-06 19:37:11 -04:00
commit 7154761ba2
4 changed files with 26 additions and 22 deletions

View file

@ -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_;
};

View file

@ -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

View file

@ -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_ +

View file

@ -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<AGCObjectVisitor>(), child_fr, upto);
child_to = gco_store_->deep_move_interior(x1gc->ref<AGCObjectVisitor>(), 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