xo-gc: refactor: rename MutationLogState -> MutationLogStore
This commit is contained in:
parent
ebf39b8cc2
commit
1b1be37d62
5 changed files with 30 additions and 47 deletions
|
|
@ -6,12 +6,9 @@
|
|||
#pragma once
|
||||
|
||||
#include "X1CollectorConfig.hpp"
|
||||
//#include "ObjectTypeSlot.hpp"
|
||||
//#include "GCObject.hpp"
|
||||
#include "GCObjectStore.hpp"
|
||||
#include "MutationLogState.hpp"
|
||||
#include "MutationLogStore.hpp"
|
||||
#include "X1VerifyStats.hpp"
|
||||
//#include "generation.hpp"
|
||||
#include "object_age.hpp"
|
||||
#include "role.hpp"
|
||||
#include <xo/alloc2/Allocator.hpp>
|
||||
|
|
@ -354,19 +351,10 @@ namespace xo {
|
|||
|
||||
// ----- book-keeping -----
|
||||
|
||||
#ifdef OBSOLETE // see swap_roles()
|
||||
/** reverse to-space and from-space roles for generation g **/
|
||||
void reverse_roles(Generation g) noexcept;
|
||||
#endif
|
||||
|
||||
/** discard all allocated memory **/
|
||||
void clear() noexcept;
|
||||
|
||||
private:
|
||||
#ifdef OBSOLETE
|
||||
/** aux init function: initialize @ref object_types_ arena **/
|
||||
void _init_object_types(const X1CollectorConfig & cfg, std::size_t page_z);
|
||||
#endif
|
||||
/** aux init function: initialize @ref roots_ arena **/
|
||||
void _init_gc_roots(const X1CollectorConfig & cfg, std::size_t page_z);
|
||||
/** aux init function: initialize @ref mlog_storage_[][] arenas **/
|
||||
|
|
@ -417,11 +405,6 @@ namespace xo {
|
|||
/** current gc state **/
|
||||
GCRunState runstate_;
|
||||
|
||||
#ifdef MARKED
|
||||
/** gc-aware object types **/
|
||||
ObjectTypeTable object_types_;
|
||||
#endif
|
||||
|
||||
/** gc disabled whenever gc_blocked_ > 0 **/
|
||||
uint32_t gc_blocked_ = 0;
|
||||
|
||||
|
|
@ -449,7 +432,7 @@ namespace xo {
|
|||
* {P,C} in same generation, but in fuutre suriving P would
|
||||
* get promoted before C.
|
||||
**/
|
||||
MutationLogState mlog_state_;
|
||||
MutationLogStore mlog_store_;
|
||||
|
||||
/** Collector-managed memory.
|
||||
**/
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/** @file MutationLogState.hpp
|
||||
/** @file MutationLogStore.hpp
|
||||
*
|
||||
* @author Roland Conybeare, Apr 2026
|
||||
**/
|
||||
|
|
@ -20,13 +20,13 @@ namespace xo {
|
|||
|
||||
/** @brief container for X1 collector mutation logs
|
||||
**/
|
||||
class MutationLogState {
|
||||
class MutationLogStore {
|
||||
public:
|
||||
using MutationLog = DArenaVector<MutationLogEntry>;
|
||||
using size_type = DArena::size_type;
|
||||
|
||||
public:
|
||||
explicit MutationLogState(const MutationLogConfig & config);
|
||||
explicit MutationLogStore(const MutationLogConfig & config);
|
||||
|
||||
/** Initialize mlog state
|
||||
* with o/s page size @p page_z
|
||||
|
|
@ -164,4 +164,4 @@ namespace xo {
|
|||
} /*namespace mm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end MutationLogState.hpp */
|
||||
/* end MutationLogStore.hpp */
|
||||
|
|
@ -19,7 +19,7 @@ set(SELF_SRCS
|
|||
GCObjectStore.cpp
|
||||
|
||||
MutationLogConfig.cpp
|
||||
MutationLogState.cpp
|
||||
MutationLogStore.cpp
|
||||
MutationLogEntry.cpp
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ namespace xo {
|
|||
|
||||
DX1Collector::DX1Collector(const X1CollectorConfig & cfg)
|
||||
: config_{cfg},
|
||||
mlog_state_{cfg.mlog_config()},
|
||||
mlog_store_{cfg.mlog_config()},
|
||||
gco_store_{cfg.gco_store_config()}
|
||||
{
|
||||
assert(config_.arena_config_.header_.size_bits_ +
|
||||
|
|
@ -115,7 +115,7 @@ namespace xo {
|
|||
void
|
||||
DX1Collector::_init_mlogs(std::size_t page_z)
|
||||
{
|
||||
this->mlog_state_.init_mlogs(page_z);
|
||||
this->mlog_store_.init_mlogs(page_z);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -125,7 +125,7 @@ namespace xo {
|
|||
root_set_.visit_pools(visitor);
|
||||
|
||||
gco_store_.visit_pools(visitor);
|
||||
mlog_state_.visit_pools(visitor);
|
||||
mlog_store_.visit_pools(visitor);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
@ -214,7 +214,7 @@ namespace xo {
|
|||
size_type
|
||||
DX1Collector::mutation_log_entries() const noexcept
|
||||
{
|
||||
return mlog_state_.mutation_log_entries();
|
||||
return mlog_store_.mutation_log_entries();
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
|
@ -653,7 +653,7 @@ namespace xo {
|
|||
}
|
||||
|
||||
// 4. scan mutation logs
|
||||
mlog_state_.verify_ok(&gco_store_,
|
||||
mlog_store_.verify_ok(&gco_store_,
|
||||
&(this->verify_stats_));
|
||||
}
|
||||
|
||||
|
|
@ -806,13 +806,13 @@ namespace xo {
|
|||
scope log(XO_DEBUG(true), xtag("upto", upto));
|
||||
|
||||
gco_store_.swap_roles(upto);
|
||||
mlog_state_.swap_roles(upto);
|
||||
mlog_store_.swap_roles(upto);
|
||||
}
|
||||
|
||||
void
|
||||
DX1Collector::forward_mutation_log(Generation upto)
|
||||
{
|
||||
mlog_state_.forward_mutation_log(this, upto);
|
||||
mlog_store_.forward_mutation_log(this, upto);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -1480,7 +1480,7 @@ namespace xo {
|
|||
|
||||
void ** lhs_addr = reinterpret_cast<void **>(&(p_lhs->data_));
|
||||
|
||||
mlog_state_.append_mutation(dest_g, parent, lhs_addr, rhs);
|
||||
mlog_store_.append_mutation(dest_g, parent, lhs_addr, rhs);
|
||||
} /*assign_member*/
|
||||
|
||||
DX1CollectorIterator
|
||||
|
|
|
|||
|
|
@ -1,20 +1,20 @@
|
|||
/** @file MutationLogState.cpp
|
||||
/** @file MutationLogStore.cpp
|
||||
*
|
||||
* @author Roland Conybeare, Apr 2026
|
||||
**/
|
||||
|
||||
#include "MutationLogState.hpp"
|
||||
#include "MutationLogStore.hpp"
|
||||
#include "DX1Collector.hpp"
|
||||
|
||||
namespace xo {
|
||||
namespace mm {
|
||||
|
||||
MutationLogState::MutationLogState(const MutationLogConfig & config)
|
||||
MutationLogStore::MutationLogStore(const MutationLogConfig & config)
|
||||
: config_{config}
|
||||
{}
|
||||
|
||||
void
|
||||
MutationLogState::init_mlogs(std::size_t page_z)
|
||||
MutationLogStore::init_mlogs(std::size_t page_z)
|
||||
{
|
||||
assert(c_n_role + 1 == 3);
|
||||
|
||||
|
|
@ -53,7 +53,7 @@ namespace xo {
|
|||
}
|
||||
|
||||
auto
|
||||
MutationLogState::_make_mlog(uint32_t igen, char tag_char,
|
||||
MutationLogStore::_make_mlog(uint32_t igen, char tag_char,
|
||||
size_t mlog_z, size_t page_z) -> MutationLog
|
||||
{
|
||||
char buf[40];
|
||||
|
|
@ -66,7 +66,7 @@ namespace xo {
|
|||
}
|
||||
|
||||
auto
|
||||
MutationLogState::mutation_log_entries() const noexcept -> size_type
|
||||
MutationLogStore::mutation_log_entries() const noexcept -> size_type
|
||||
{
|
||||
size_type z = 0;
|
||||
|
||||
|
|
@ -78,7 +78,7 @@ namespace xo {
|
|||
}
|
||||
|
||||
void
|
||||
MutationLogState::visit_pools(const MemorySizeVisitor & visitor) const
|
||||
MutationLogStore::visit_pools(const MemorySizeVisitor & visitor) const
|
||||
{
|
||||
for (uint32_t j = 0; j + 1 < config_.n_generation_; ++j) {
|
||||
for (uint32_t i = 0; i < c_n_role + 1; ++i) {
|
||||
|
|
@ -88,7 +88,7 @@ namespace xo {
|
|||
}
|
||||
|
||||
void
|
||||
MutationLogState::verify_ok(GCObjectStore * gco_store,
|
||||
MutationLogStore::verify_ok(GCObjectStore * gco_store,
|
||||
VerifyStats * p_verify_stats) noexcept
|
||||
{
|
||||
// 4. scan mutation logs
|
||||
|
|
@ -136,7 +136,7 @@ namespace xo {
|
|||
} /*verify_ok*/
|
||||
|
||||
void
|
||||
MutationLogState::append_mutation(Generation dest_g,
|
||||
MutationLogStore::append_mutation(Generation dest_g,
|
||||
void * parent,
|
||||
void ** addr,
|
||||
obj<AGCObject> rhs)
|
||||
|
|
@ -151,7 +151,7 @@ namespace xo {
|
|||
}
|
||||
|
||||
void
|
||||
MutationLogState::swap_roles(Generation upto) noexcept
|
||||
MutationLogStore::swap_roles(Generation upto) noexcept
|
||||
{
|
||||
scope log(XO_DEBUG(true), xtag("upto", upto));
|
||||
|
||||
|
|
@ -163,7 +163,7 @@ namespace xo {
|
|||
}
|
||||
|
||||
void
|
||||
MutationLogState::forward_mutation_log(DX1Collector * gc,
|
||||
MutationLogStore::forward_mutation_log(DX1Collector * gc,
|
||||
Generation upto)
|
||||
{
|
||||
/** non-zero if at least one object was rescued (from any generation)
|
||||
|
|
@ -213,7 +213,7 @@ namespace xo {
|
|||
}
|
||||
|
||||
MutationLogStatistics
|
||||
MutationLogState::_forward_mutation_log_phase(DX1Collector * gc,
|
||||
MutationLogStore::_forward_mutation_log_phase(DX1Collector * gc,
|
||||
Generation upto,
|
||||
Generation child_gen,
|
||||
MutationLog * from_mlog,
|
||||
|
|
@ -363,7 +363,7 @@ namespace xo {
|
|||
}
|
||||
|
||||
MutationLogStatistics
|
||||
MutationLogState::_preserve_child_of_live_parent(DX1Collector * gc,
|
||||
MutationLogStore::_preserve_child_of_live_parent(DX1Collector * gc,
|
||||
Generation upto,
|
||||
Generation parent_gen,
|
||||
const MutationLogEntry & from_entry,
|
||||
|
|
@ -415,7 +415,7 @@ namespace xo {
|
|||
}
|
||||
|
||||
bool
|
||||
MutationLogState::_check_keep_mutation_aux(const GCObjectStore & gco_store,
|
||||
MutationLogStore::_check_keep_mutation_aux(const GCObjectStore & gco_store,
|
||||
const MutationLogEntry & from_entry,
|
||||
Generation parent_gen_to,
|
||||
void * child_to,
|
||||
|
|
@ -451,4 +451,4 @@ namespace xo {
|
|||
} /*namespace mm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
/* end MutationLogState.cpp */
|
||||
/* end MutationLogStore.cpp */
|
||||
Loading…
Add table
Add a link
Reference in a new issue