xo-gc: utest: mutation log tests

This commit is contained in:
Roland Conybeare 2026-04-19 15:13:13 -04:00
commit 39b1ad1b21
21 changed files with 1155 additions and 136 deletions

View file

@ -26,7 +26,7 @@ namespace xo {
class DGCObjectStoreVisitor {
public:
DGCObjectStoreVisitor(GCObjectStore * gcos, Generation upto);
template <typename AFacet = AGCObjectVisitor>
obj<AFacet,DGCObjectStoreVisitor> ref() { return obj<AFacet,DGCObjectStoreVisitor>(this); }
@ -46,4 +46,4 @@ namespace xo {
} /*namespace mm*/
} /*namespace xo*/
/* end DGCObjectVisitor.hpp */
/* end DGCObjectStoreVisitor.hpp */

View file

@ -60,6 +60,18 @@ namespace xo {
**/
AGCObject * lookup_type(typeseq tseq) const noexcept;
/** report allocated memory for role r, generation g
**/
size_type allocated(Generation g, Role r) const noexcept;
/** report committed memory for role r, generation g
**/
size_type committed(Generation g, Role r) const noexcept;
/** report reserved memory for role r, generation g
**/
size_type reserved(Generation g, Role r) const noexcept;
/** generation to which pointer @p addr belongs, given Role @p r;
* sentinel if not found in this collector
**/

View file

@ -35,7 +35,9 @@ namespace xo {
void ** p_data() const { return p_data_; }
obj<AGCObject> snap() const { return snap_; }
/** true if child pointer has been altered since this mlog entry created **/
/** true iff child pointer matches value when this mlog entry created **/
bool is_active() const noexcept { return *p_data_ == snap_.data(); }
/** true iff child pointer has been altered since this mlog entry created **/
bool is_superseded() const noexcept { return *p_data_ != snap_.data(); }
private:

View file

@ -18,11 +18,12 @@ namespace xo {
class DX1Collector;
class X1VerifyStats;
using MutationLog = DArenaVector<MutationLogEntry>;
/** @brief container for X1 collector mutation logs
**/
class MutationLogStore {
public:
using MutationLog = DArenaVector<MutationLogEntry>;
using size_type = DArena::size_type;
public:
@ -34,6 +35,12 @@ namespace xo {
**/
void init_mlogs(std::size_t page_z);
MutationLog * get_mlog(Role r, Generation g) noexcept { return mlog_[r][g]; }
const MutationLog * get_mlog(Role r, Generation g) const noexcept { return mlog_[r][g]; }
/** reminder: abusing Role because we need one additional mlog **/
MutationLog * triage_mlog(Generation g) noexcept { return mlog_[Role{c_n_role}][g]; }
const MutationLog * triage_mlog(Generation g) const noexcept { return mlog_[Role{c_n_role}][g]; }
/** total number of active mlog entries (across all generations)
**/
size_type mutation_log_entries() const noexcept;
@ -41,12 +48,10 @@ namespace xo {
void visit_pools(const MemorySizeVisitor & visitor) const;
/** verify consistent mlog state,
* on behalf of gc-aware object store @p gc.
* (using gc to identify location of objects).
* Update counters in @p *p_verify_stats.
* Update counters associated with gco_store_
**/
void verify_ok(GCObjectStore * gc,
X1VerifyStats * p_verify_stats) noexcept;
void verify_ok() noexcept;
/** on behalf of gc-aware object store @p gc,
* change the value of a child pointer at @p p_lhs