From 268e474cfdee19b4de0cf380e88c9e9b6125d1b1 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Mon, 6 Apr 2026 23:33:05 -0400 Subject: [PATCH] xo-gc: cosmetic: rename xo::mm::role -> xo::mm::Role --- include/xo/gc/DX1Collector.hpp | 42 +++++++++---------- include/xo/gc/GCObjectStore.hpp | 20 ++++----- .../xo/gc/detail/ICollector_DX1Collector.hpp | 10 ++--- .../detail/IGCObjectVisitor_DX1Collector.hpp | 2 +- src/gc/DX1Collector.cpp | 42 +++++++++---------- src/gc/DX1CollectorIterator.cpp | 2 +- src/gc/GCObjectStore.cpp | 40 +++++++++--------- src/gc/IAllocator_DX1Collector.cpp | 2 +- src/gc/MutationLogStore.cpp | 30 ++++++------- src/gc/facet/ICollector_DX1Collector.cpp | 8 ++-- .../facet/IGCObjectVisitor_DX1Collector.cpp | 2 +- utest/X1Collector.test.cpp | 32 +++++++------- 12 files changed, 116 insertions(+), 116 deletions(-) diff --git a/include/xo/gc/DX1Collector.hpp b/include/xo/gc/DX1Collector.hpp index 3140e6b..aaa2b08 100644 --- a/include/xo/gc/DX1Collector.hpp +++ b/include/xo/gc/DX1Collector.hpp @@ -118,34 +118,34 @@ namespace xo { GCRunState runstate() const noexcept { return runstate_; } const ObjectTypeTable * get_object_types() const noexcept { return gco_store_.get_object_types(); } const RootSet * get_root_set() const noexcept { return &root_set_; } - const DArena * get_space(role r, Generation g) const noexcept { return gco_store_.get_space(r, g); } - DArena * get_space(role r, Generation g) noexcept { return gco_store_.get_space(r, g); } - DArena * from_space(Generation g) noexcept { return this->get_space(role::from_space(), g); } - DArena * to_space(Generation g) noexcept { return this->get_space(role::to_space(), g); } + const DArena * get_space(Role r, Generation g) const noexcept { return gco_store_.get_space(r, g); } + DArena * get_space(Role r, Generation g) noexcept { return gco_store_.get_space(r, g); } + DArena * from_space(Generation g) noexcept { return this->get_space(Role::from_space(), g); } + DArena * to_space(Generation g) noexcept { return this->get_space(Role::to_space(), g); } DArena * new_space() noexcept { return this->to_space(Generation{0}); } // ----- basic statistics ----- - /** total reserved memory in bytes, across all {role, generation} **/ + /** total reserved memory in bytes, across all {Role, generation} **/ size_type reserved() const noexcept; /** total size in bytes (same as committed_total()) **/ size_type size_total() const noexcept; - /** total committed memory in bytes, across all {role, generation} **/ + /** total committed memory in bytes, across all {Role, generation} **/ size_type committed() const noexcept; - /** total available memory in bytes, across all {role, generation} **/ + /** total available memory in bytes, across all {Role, generation} **/ size_type available() const noexcept; - /** total allocated memory in bytes, across all {role, generation} **/ + /** total allocated memory in bytes, across all {Role, generation} **/ size_type allocated() const noexcept; /** total number of mutation log entries **/ size_type mutation_log_entries() const noexcept; - /** memory allocated for generation @p g in role @p r **/ - size_type allocated(Generation g, role r) const noexcept; - /** memory committed for generation @p g in role @p r **/ - size_type committed(Generation g, role r) const noexcept; - /** memory (virtual addresses) reserved for generation @p g in role @p r **/ - size_type reserved(Generation g, role r) const noexcept; + /** memory allocated for generation @p g in Role @p r **/ + size_type allocated(Generation g, Role r) const noexcept; + /** memory committed for generation @p g in Role @p r **/ + size_type committed(Generation g, Role r) const noexcept; + /** memory (virtual addresses) reserved for generation @p g in Role @p r **/ + size_type reserved(Generation g, Role r) const noexcept; /** very similar to generation_of(), but satisfies ACollector api **/ std::int32_t locate_address(const void * addr) const noexcept; @@ -197,21 +197,21 @@ namespace xo { void visit_pools(const MemorySizeVisitor & visitor) const; /** true iff address @p addr allocated from this collector - * in role @p r (according to current GC state) + * in Role @p r (according to current GC state) **/ - bool contains(role r, const void * addr) const noexcept; + bool contains(Role r, const void * addr) const noexcept; /** true iff address @p addr allocated from this collector and currently live - * in role @p r (according to current GC state) + * in Role @p r (according to current GC state) * * (i.e. in [lo,free) for an arena) **/ - bool contains_allocated(role r, const void * addr) const noexcept; + bool contains_allocated(Role r, const void * addr) const noexcept; - /** generation to which pointer @p addr belongs, given role @p r; + /** generation to which pointer @p addr belongs, given Role @p r; * sentinel if not found in this collector **/ - Generation generation_of(role r, const void * addr) const noexcept; + Generation generation_of(Role r, const void * addr) const noexcept; /** return details from last error (will be in gen0 to-space) **/ AllocError last_error() const noexcept; @@ -352,7 +352,7 @@ namespace xo { /** aux init function: initialize @ref space_storage_[][] arenas **/ void _init_space(const X1CollectorConfig & cfg); - /** swap from- and to- roles for all generations < @p upto **/ + /** swap from- and to- Roles for all generations < @p upto **/ void _swap_roles(Generation upto) noexcept; /** copy roots + everything reachable from them, to to-space **/ void _copy_roots(Generation upto) noexcept; diff --git a/include/xo/gc/GCObjectStore.hpp b/include/xo/gc/GCObjectStore.hpp index a329275..dbb591c 100644 --- a/include/xo/gc/GCObjectStore.hpp +++ b/include/xo/gc/GCObjectStore.hpp @@ -33,10 +33,10 @@ namespace xo { const GCObjectStoreConfig & config() const noexcept { return config_; } const ObjectTypeTable * get_object_types() const noexcept { return &object_types_; } - const DArena * get_space(role r, Generation g) const noexcept { return space_[r][g]; } - DArena * get_space(role r, Generation g) noexcept { return space_[r][g]; } - DArena * from_space(Generation g) noexcept { return get_space(role::from_space(), g); } - DArena * to_space(Generation g) noexcept { return get_space(role::to_space(), g); } + const DArena * get_space(Role r, Generation g) const noexcept { return space_[r][g]; } + DArena * get_space(Role r, Generation g) noexcept { return space_[r][g]; } + DArena * from_space(Generation g) noexcept { return get_space(Role::from_space(), g); } + DArena * to_space(Generation g) noexcept { return get_space(Role::to_space(), g); } DArena * new_space() noexcept { return to_space(Generation{0}); } /** true iff type with id @p tseq has known metadata @@ -50,10 +50,10 @@ namespace xo { **/ AGCObject * lookup_type(typeseq tseq) const noexcept; - /** generation to which pointer @p addr belongs, given role @p r; + /** generation to which pointer @p addr belongs, given Role @p r; * sentinel if not found in this collector **/ - Generation generation_of(role r, const void * addr) const noexcept; + Generation generation_of(Role r, const void * addr) const noexcept; /** get allocation size from header **/ std::size_t header2size(header_type hdr) const noexcept; @@ -72,16 +72,16 @@ namespace xo { void visit_pools(const MemorySizeVisitor & visitor) const; /** true iff address @p addr allocated from this collector - * in role @p r (according to current GC state) + * in Role @p r (according to current GC state) **/ - bool contains(role r, const void * addr) const noexcept; + bool contains(Role r, const void * addr) const noexcept; /** true iff address @p addr allocated from this collector and currently live - * in role @p r (according to current GC state) + * in Role @p r (according to current GC state) * * (i.e. in [lo,free) for an arena) **/ - bool contains_allocated(role r, const void * addr) const noexcept; + bool contains_allocated(Role r, const void * addr) const noexcept; /** Report per-age-bucket information as an array of dictionaries. * Scans to-space to count per-age statistics. diff --git a/include/xo/gc/detail/ICollector_DX1Collector.hpp b/include/xo/gc/detail/ICollector_DX1Collector.hpp index 6f203e7..c81513f 100644 --- a/include/xo/gc/detail/ICollector_DX1Collector.hpp +++ b/include/xo/gc/detail/ICollector_DX1Collector.hpp @@ -48,17 +48,17 @@ namespace xo { ///@{ // const methods /** memory in use for this collector **/ - static size_type allocated(const DX1Collector & self, Generation g, role r) noexcept; + static size_type allocated(const DX1Collector & self, Generation g, Role r) noexcept; /** memory committed for this collector **/ - static size_type committed(const DX1Collector & self, Generation g, role r) noexcept; + static size_type committed(const DX1Collector & self, Generation g, Role r) noexcept; /** address space reserved for this collector **/ - static size_type reserved(const DX1Collector & self, Generation g, role r) noexcept; + static size_type reserved(const DX1Collector & self, Generation g, Role r) noexcept; /** Location of object in collector. -1 if not in collector memory. Other negative values represent collector error states (good luck!). Exact meaning of non-negative values up to collector implementation **/ static std::int32_t locate_address(const DX1Collector & self, const void * addr) noexcept; - /** true if gc responsible for data at @p addr, and data belongs to role @p r **/ - static bool contains(const DX1Collector & self, role r, const void * addr) noexcept; + /** true if gc responsible for data at @p addr, and data belongs to Role @p r **/ + static bool contains(const DX1Collector & self, Role r, const void * addr) noexcept; /** true iff gc-aware object of type @p tseq is installed in this collector **/ static bool is_type_installed(const DX1Collector & self, typeseq tseq) noexcept; /** Report gc statistics, at discretion of collector implementation. diff --git a/include/xo/gc/detail/IGCObjectVisitor_DX1Collector.hpp b/include/xo/gc/detail/IGCObjectVisitor_DX1Collector.hpp index d1c0922..95534db 100644 --- a/include/xo/gc/detail/IGCObjectVisitor_DX1Collector.hpp +++ b/include/xo/gc/detail/IGCObjectVisitor_DX1Collector.hpp @@ -50,7 +50,7 @@ namespace xo { static AllocInfo alloc_info(const DX1Collector & self, void * addr); /** generation to which pointer @p addr belongs, given role @p r; sentinel if @p addr is not owned by collector **/ - static Generation generation_of(const DX1Collector & self, role r, const void * addr) noexcept; + static Generation generation_of(const DX1Collector & self, Role r, const void * addr) noexcept; // non-const methods /** allocate copy of source object at address @p src. diff --git a/src/gc/DX1Collector.cpp b/src/gc/DX1Collector.cpp index 0baddcb..2863636 100644 --- a/src/gc/DX1Collector.cpp +++ b/src/gc/DX1Collector.cpp @@ -110,19 +110,19 @@ namespace xo { } bool - DX1Collector::contains(role r, const void * addr) const noexcept + DX1Collector::contains(Role r, const void * addr) const noexcept { return gco_store_.contains(r, addr); } bool - DX1Collector::contains_allocated(role r, const void * addr) const noexcept + DX1Collector::contains_allocated(Role r, const void * addr) const noexcept { return gco_store_.contains_allocated(r, addr); } Generation - DX1Collector::generation_of(role r, const void * addr) const noexcept + DX1Collector::generation_of(Role r, const void * addr) const noexcept { return gco_store_.generation_of(r, addr); } @@ -134,7 +134,7 @@ namespace xo { // need to adjust here if runtime errors // encountered during gc. - return get_space(role::to_space(), Generation::nursery())->last_error_; + return get_space(Role::to_space(), Generation::nursery())->last_error_; } namespace { @@ -148,7 +148,7 @@ namespace xo { size_t z3 = 0; - for (role ri : role::all()) { + for (Role ri : Role::all()) { for (Generation gj{0}; gj < d.config_.n_generation_; ++gj) { const DArena * arena = d.get_space(ri, gj); @@ -203,7 +203,7 @@ namespace xo { stat_helper(const DX1Collector & d, size_type (DArena::* getter)() const, Generation g, - role r) + Role r) { const DArena * arena = d.get_space(r, g); @@ -215,19 +215,19 @@ namespace xo { } size_type - DX1Collector::allocated(Generation g, role r) const noexcept + DX1Collector::allocated(Generation g, Role r) const noexcept { return stat_helper(*this, &DArena::allocated, g, r); } size_type - DX1Collector::committed(Generation g, role r) const noexcept + DX1Collector::committed(Generation g, Role r) const noexcept { return stat_helper(*this, &DArena::committed, g, r); } size_type - DX1Collector::reserved(Generation g, role r) const noexcept + DX1Collector::reserved(Generation g, Role r) const noexcept { return stat_helper(*this, &DArena::reserved, g, r); } @@ -237,12 +237,12 @@ namespace xo { { Generation g; - g = this->generation_of(role::to_space(), addr); + g = this->generation_of(Role::to_space(), addr); if (!g.is_sentinel()) return g; - g = this->generation_of(role::from_space(), addr); + g = this->generation_of(Role::from_space(), addr); if (!g.is_sentinel()) { // use negative values for @@ -283,7 +283,7 @@ namespace xo { // per-(generation,role) info { for (Generation gi{0}; gi < config_.n_generation_; ++gi) { - for (role rj : role::all()) { + for (Role rj : Role::all()) { const DArena * arena = this->get_space(rj, gi); DDictionary * arena_d = DDictionary::make(mm); @@ -510,8 +510,8 @@ namespace xo { log && log("step 1 : swap from/to roles (now to-space is empty)"); this->_swap_roles(upto); - log && log(xtag("from_0", get_space(role::from_space(), Generation{0})->lo_), - xtag("to_0", get_space(role::to_space(), Generation{0})->lo_)); + log && log(xtag("from_0", get_space(Role::from_space(), Generation{0})->lo_), + xtag("to_0", get_space(Role::to_space(), Generation{0})->lo_)); log && log("step 2a : copy roots"); this->_copy_roots(upto); @@ -632,12 +632,12 @@ namespace xo { (void)iface; (void)data; - Generation g1 = this->generation_of(role::to_space(), data); + Generation g1 = this->generation_of(Role::to_space(), data); if (g1.is_sentinel()) { - assert(this->contains(role::to_space(), data) == false); + assert(this->contains(Role::to_space(), data) == false); - Generation g2 = this->generation_of(role::from_space(), data); + Generation g2 = this->generation_of(Role::from_space(), data); if (!g2.is_sentinel()) { // verify failure - live pointer still refers to from-space @@ -647,7 +647,7 @@ namespace xo { ++(verify_stats_.n_ext_); } } else { - assert(this->contains(role::to_space(), data)); + assert(this->contains(Role::to_space(), data)); ++(verify_stats_.n_to_); } @@ -713,7 +713,7 @@ namespace xo { scope log(XO_DEBUG(false)); const DArena * arena - = get_space(role::to_space(), + = get_space(Role::to_space(), Generation{0}); return DX1CollectorIterator(this, @@ -735,7 +735,7 @@ namespace xo { **/ const DArena * arena - = get_space(role::to_space(), + = get_space(Role::to_space(), Generation(config_.n_generation_ - 1)); DArenaIterator arena_end = arena->end(); @@ -748,7 +748,7 @@ namespace xo { void DX1Collector::clear() noexcept { - for (role ri : role::all()) { + for (Role ri : Role::all()) { for (Generation gj{0}; gj < config_.n_generation_; ++gj) { DArena * arena = this->get_space(ri, gj); diff --git a/src/gc/DX1CollectorIterator.cpp b/src/gc/DX1CollectorIterator.cpp index 9780aca..624a3d1 100644 --- a/src/gc/DX1CollectorIterator.cpp +++ b/src/gc/DX1CollectorIterator.cpp @@ -42,7 +42,7 @@ namespace xo { for (; gen_ix_ < gen_hi_; ++gen_ix_) { const DArena * arena - = gc_->get_space(role::to_space(), gen_ix_); + = gc_->get_space(Role::to_space(), gen_ix_); assert(arena); diff --git a/src/gc/GCObjectStore.cpp b/src/gc/GCObjectStore.cpp index a1cceaa..f7ae549 100644 --- a/src/gc/GCObjectStore.cpp +++ b/src/gc/GCObjectStore.cpp @@ -80,20 +80,20 @@ namespace xo { = DArena::map(config_.arena_config_.with_name(std::string(buf))); } - this->space_[role::to_space()][igen] = &space_storage_[0][igen]; - this->space_[role::from_space()][igen] = &space_storage_[1][igen]; + this->space_[Role::to_space()][igen] = &space_storage_[0][igen]; + this->space_[Role::from_space()][igen] = &space_storage_[1][igen]; } else { assert(false); } } for (uint32_t igen = config_.n_generation_; igen < c_max_generation; ++igen) { - this->space_[role::to_space()][igen] = nullptr; - this->space_[role::from_space()][igen] = nullptr; + this->space_[Role::to_space()][igen] = nullptr; + this->space_[Role::from_space()][igen] = nullptr; } if (config_.n_generation_ == 2) { - assert(this->get_space(role::to_space(), Generation{2}) == nullptr); + assert(this->get_space(Role::to_space(), Generation{2}) == nullptr); } } @@ -149,7 +149,7 @@ namespace xo { } Generation - GCObjectStore::generation_of(role r, const void * addr) const noexcept + GCObjectStore::generation_of(Role r, const void * addr) const noexcept { for (Generation gi{0}; gi < config_.n_generation_; ++gi) { const DArena * arena = this->get_space(r, gi); @@ -196,7 +196,7 @@ namespace xo { AllocInfo GCObjectStore::alloc_info(value_type mem) const noexcept { - for (role ri : role::all()) { + for (Role ri : Role::all()) { for (Generation gj{0}; gj < config_.n_generation_; ++gj) { const DArena * arena = this->get_space(ri, gj); @@ -209,7 +209,7 @@ namespace xo { } // deliberately attempt on nursery to-space, to capture error info + return sentinel - return this->get_space(role::to_space(), Generation{0})->alloc_info(mem); + return this->get_space(Role::to_space(), Generation{0})->alloc_info(mem); } void @@ -225,13 +225,13 @@ namespace xo { } bool - GCObjectStore::contains(role r, const void * addr) const noexcept + GCObjectStore::contains(Role r, const void * addr) const noexcept { return !(this->generation_of(r, addr).is_sentinel()); } bool - GCObjectStore::contains_allocated(role r, const void * addr) const noexcept + GCObjectStore::contains_allocated(Role r, const void * addr) const noexcept { Generation g = this->generation_of(r, addr); @@ -304,7 +304,7 @@ namespace xo { // scan to-space, count objects by type for (Generation g{0}; g < config_.n_generation_; ++g) { - const DArena * arena = this->get_space(role::to_space(), g); + const DArena * arena = this->get_space(Role::to_space(), g); for (AllocInfo info : *arena) { if (info.is_forwarding_tseq()) { @@ -392,7 +392,7 @@ namespace xo { std::int64_t max_age_present = 0; for (Generation g{0}; g < config_.n_generation_; ++g) { - const DArena * arena = this->get_space(role::to_space(), g); + const DArena * arena = this->get_space(Role::to_space(), g); for (AllocInfo info : *arena) { if (info.is_forwarding_tseq()) { @@ -485,7 +485,7 @@ namespace xo { if (!object_data) { /* trivial to forward nullptr */ return; - } else if (!this->contains(role::from_space(), object_data)) { + } else if (!this->contains(Role::from_space(), object_data)) { /* *lhs_data either: * 1. already in to-space * 2. not in GC-allocated space at all @@ -648,7 +648,7 @@ namespace xo { for (Generation g = Generation{0}; g < upto; ++g) { log && log("swap roles", xtag("g", g)); - std::swap(space_[role::to_space()][g], space_[role::from_space()][g]); + std::swap(space_[Role::to_space()][g], space_[Role::from_space()][g]); } } @@ -663,10 +663,10 @@ namespace xo { // for (Generation g = Generation{0}; g < upto; ++g) { if (sanitize_flag) { - space_[role::from_space()][g]->scrub(); + space_[Role::from_space()][g]->scrub(); } - space_[role::from_space()][g]->clear(); + space_[Role::from_space()][g]->clear(); } } @@ -687,7 +687,7 @@ namespace xo { X1VerifyStats * p_verify_stats) noexcept { for (Generation g(0); g < config_.n_generation_; ++g) { - const DArena * space = this->get_space(role::to_space(), g); + const DArena * space = this->get_space(Role::to_space(), g); for (const AllocInfo & info : *space) { @@ -762,7 +762,7 @@ namespace xo { if (!from_src) return nullptr; - bool src_in_from_space = this->contains(role::from_space(), + bool src_in_from_space = this->contains(Role::from_space(), from_src.data()); if (src_in_from_space) { @@ -798,7 +798,7 @@ namespace xo { if (!from_src) return nullptr; - bool src_in_from_space = this->contains(role::from_space(), from_src); + bool src_in_from_space = this->contains(Role::from_space(), from_src); if (!src_in_from_space) return from_src; @@ -817,7 +817,7 @@ namespace xo { AllocHeader hdr = info.header(); typeseq tseq(info.tseq()); - assert(this->contains_allocated(role::from_space(), from_src)); + assert(this->contains_allocated(Role::from_space(), from_src)); if (this->is_forwarding_header(hdr)) { /* already forwarded - pickup destination diff --git a/src/gc/IAllocator_DX1Collector.cpp b/src/gc/IAllocator_DX1Collector.cpp index 37ed497..c0c93d6 100644 --- a/src/gc/IAllocator_DX1Collector.cpp +++ b/src/gc/IAllocator_DX1Collector.cpp @@ -65,7 +65,7 @@ namespace xo { bool IAllocator_DX1Collector::contains(const DX1Collector & d, const void * addr) noexcept { - return d.contains(role::to_space(), addr); + return d.contains(Role::to_space(), addr); } AllocError diff --git a/src/gc/MutationLogStore.cpp b/src/gc/MutationLogStore.cpp index 7724487..4970aa1 100644 --- a/src/gc/MutationLogStore.cpp +++ b/src/gc/MutationLogStore.cpp @@ -73,7 +73,7 @@ namespace xo { size_type z = 0; for (Generation gj{0}; gj + 1 < config_.n_generation_; ++gj) { - z += mlog_[role::to_space()][gj]->size(); + z += mlog_[Role::to_space()][gj]->size(); } return z; @@ -95,15 +95,15 @@ namespace xo { { // 4. scan mutation logs for (Generation g(0); g + 1 < config_.n_generation_; ++g) { - const DArena * space = gco_store->get_space(role::to_space(), g); - const DArena * from = gco_store->get_space(role::from_space(), g); + const DArena * space = gco_store->get_space(Role::to_space(), g); + const DArena * from = gco_store->get_space(Role::from_space(), g); // mutation log for generation g records *incoming* pointers // from more senior generations; includes objects from *this* // generation that are older (track since source promotes before // destination) // - for (const MutationLogEntry & mrecd : *(mlog_[role::to_space()][g])) { + for (const MutationLogEntry & mrecd : *(mlog_[Role::to_space()][g])) { // mutation log entries are only valid until the next assignment // at the source location. Superseded entry may now point // somewhere else. The snapshot member must however point @@ -159,7 +159,7 @@ namespace xo { // 1. generation of lhs // 2. generation of rhs - Generation src_g = gco_store->generation_of(role::to_space(), p_lhs); + Generation src_g = gco_store->generation_of(Role::to_space(), p_lhs); if (src_g.is_sentinel()) { // only need mlog entries for gc-owned pointers. @@ -167,7 +167,7 @@ namespace xo { return; } - Generation dest_g = gco_store->generation_of(role::to_space(), rhs.data()); + Generation dest_g = gco_store->generation_of(Role::to_space(), rhs.data()); if (dest_g.is_sentinel()) { // similarly, don't need mlog entry to non-gc-owned destination @@ -185,7 +185,7 @@ namespace xo { // for pointers within the same generation, need to log // if source is older than destination. - const DArena * arena = gco_store->get_space(role::to_space(), src_g); + const DArena * arena = gco_store->get_space(Role::to_space(), src_g); const DArena::header_type * src_hdr = arena->obj2hdr(parent); const DArena::header_type * dest_hdr = arena->obj2hdr(rhs.data()); @@ -226,7 +226,7 @@ namespace xo { // collection that moves destination generation around needs to also // update pointers such as this one // - MutationLog * mlog = this->mlog_[role::to_space()][dest_g]; + MutationLog * mlog = this->mlog_[Role::to_space()][dest_g]; mlog->push_back(MutationLogEntry(parent, addr, rhs)); } @@ -239,7 +239,7 @@ namespace xo { for (Generation g = Generation{0}; g < upto; ++g) { log && log("swap roles", xtag("g", g)); - std::swap(mlog_[role::to_space()][g], mlog_[role::from_space()][g]); + std::swap(mlog_[Role::to_space()][g], mlog_[Role::from_space()][g]); } } @@ -260,10 +260,10 @@ namespace xo { child_gen + 2 < config_.n_generation_; ++child_gen) { - MutationLog * from_mlog = this->mlog_[role::from_space()][child_gen]; + MutationLog * from_mlog = this->mlog_[Role::from_space()][child_gen]; if (!from_mlog->empty()) { - MutationLog * to_mlog = this->mlog_[role::to_space()][child_gen]; + MutationLog * to_mlog = this->mlog_[Role::to_space()][child_gen]; MutationLog * triage_mlog = this->mlog_[c_n_role][child_gen]; auto stats = this->_forward_mutation_log_phase(gc, @@ -277,7 +277,7 @@ namespace xo { // {from_mlog, triage_mlog} reverse roles - std::swap(this->mlog_[role::from_space()][child_gen], + std::swap(this->mlog_[Role::from_space()][child_gen], this->mlog_[c_n_role][child_gen]); work += stats.n_rescue_; @@ -376,7 +376,7 @@ namespace xo { /* here: mlog current */ - Generation parent_gen_to = gc.generation_of(role::to_space(), + Generation parent_gen_to = gc.generation_of(Role::to_space(), from_entry.parent()); if (parent_gen_to.is_sentinel()) { @@ -393,7 +393,7 @@ namespace xo { // TODO: method on AllocInfo to streamline this void * parent_to = *(void **)parent_fr; - parent_gen_to = gc.generation_of(role::to_space(), + parent_gen_to = gc.generation_of(Role::to_space(), parent_to); parent_info = gc.alloc_info((std::byte *)parent_to); @@ -503,7 +503,7 @@ namespace xo { 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_) diff --git a/src/gc/facet/ICollector_DX1Collector.cpp b/src/gc/facet/ICollector_DX1Collector.cpp index 261deaa..a656ca6 100644 --- a/src/gc/facet/ICollector_DX1Collector.cpp +++ b/src/gc/facet/ICollector_DX1Collector.cpp @@ -16,19 +16,19 @@ namespace xo { namespace mm { auto - ICollector_DX1Collector::allocated(const DX1Collector & self, Generation g, role r) noexcept -> size_type + ICollector_DX1Collector::allocated(const DX1Collector & self, Generation g, Role r) noexcept -> size_type { return self.allocated(g, r); } auto - ICollector_DX1Collector::committed(const DX1Collector & self, Generation g, role r) noexcept -> size_type + ICollector_DX1Collector::committed(const DX1Collector & self, Generation g, Role r) noexcept -> size_type { return self.committed(g, r); } auto - ICollector_DX1Collector::reserved(const DX1Collector & self, Generation g, role r) noexcept -> size_type + ICollector_DX1Collector::reserved(const DX1Collector & self, Generation g, Role r) noexcept -> size_type { return self.reserved(g, r); } @@ -40,7 +40,7 @@ namespace xo { } auto - ICollector_DX1Collector::contains(const DX1Collector & self, role r, const void * addr) noexcept -> bool + ICollector_DX1Collector::contains(const DX1Collector & self, Role r, const void * addr) noexcept -> bool { return self.contains(r, addr); } diff --git a/src/gc/facet/IGCObjectVisitor_DX1Collector.cpp b/src/gc/facet/IGCObjectVisitor_DX1Collector.cpp index 129ba42..7a00a1f 100644 --- a/src/gc/facet/IGCObjectVisitor_DX1Collector.cpp +++ b/src/gc/facet/IGCObjectVisitor_DX1Collector.cpp @@ -22,7 +22,7 @@ namespace xo { } auto - IGCObjectVisitor_DX1Collector::generation_of(const DX1Collector & self, role r, const void * addr) noexcept -> Generation + IGCObjectVisitor_DX1Collector::generation_of(const DX1Collector & self, Role r, const void * addr) noexcept -> Generation { return self.generation_of(r, addr); } diff --git a/utest/X1Collector.test.cpp b/utest/X1Collector.test.cpp index 535b64c..bfea2eb 100644 --- a/utest/X1Collector.test.cpp +++ b/utest/X1Collector.test.cpp @@ -47,7 +47,7 @@ namespace ut { using xo::mm::DArena; using xo::mm::ArenaConfig; using xo::mm::Generation; - using xo::mm::role; + using xo::mm::Role; using xo::mm::padding; using xo::facet::obj; using xo::facet::with_facet; @@ -145,7 +145,7 @@ namespace ut { REQUIRE(roots->store()->reserved() >= cfg.object_roots_z_); REQUIRE(roots->store()->reserved() < cfg.object_roots_z_ + roots->store()->page_z_); - const DArena * from_0 = gc.get_space(role::from_space(), Generation{0}); + const DArena * from_0 = gc.get_space(Role::from_space(), Generation{0}); REQUIRE(from_0 != nullptr); REQUIRE(from_0->reserved() >= tc.tenured_z_); @@ -153,29 +153,29 @@ namespace ut { REQUIRE(from_0->reserved() % from_0->page_z_ == 0); REQUIRE(from_0->allocated() == 0); - const DArena * from_1 = gc.get_space(role::from_space(), Generation{1}); + const DArena * from_1 = gc.get_space(Role::from_space(), Generation{1}); REQUIRE(from_1 != nullptr); REQUIRE(from_1->reserved() == from_0->reserved()); REQUIRE(from_1->allocated() == 0); - to_0 = gc.get_space(role::to_space(), Generation{0}); + to_0 = gc.get_space(Role::to_space(), Generation{0}); REQUIRE(to_0 != nullptr); REQUIRE(to_0->reserved() == from_0->reserved()); REQUIRE(to_0->allocated() == 0); - const DArena * to_1 = gc.get_space(role::to_space(), Generation{1}); + const DArena * to_1 = gc.get_space(Role::to_space(), Generation{1}); REQUIRE(to_1 != nullptr); REQUIRE(to_1->reserved() == to_0->reserved()); REQUIRE(to_1->allocated() == 0); - const DArena * from_2 = gc.get_space(role::from_space(), Generation{2}); + const DArena * from_2 = gc.get_space(Role::from_space(), Generation{2}); REQUIRE(from_2 == nullptr); - const DArena * to_2 = gc.get_space(role::to_space(), Generation{2}); + const DArena * to_2 = gc.get_space(Role::to_space(), Generation{2}); REQUIRE(to_2 == nullptr); @@ -224,7 +224,7 @@ namespace ut { { REQUIRE(x0_o.iface() != nullptr); REQUIRE(x0_o.data() != nullptr); - REQUIRE(gc.contains(role::to_space(), x0_o.data())); + REQUIRE(gc.contains(Role::to_space(), x0_o.data())); /* check alloc info for newly-allocated object */ AllocInfo info = gc.alloc_info((std::byte *)x0_o.data()); @@ -238,7 +238,7 @@ namespace ut { { REQUIRE(n1_o.iface() != nullptr); REQUIRE(n1_o.data() != nullptr); - REQUIRE(gc.contains(role::to_space(), n1_o.data())); + REQUIRE(gc.contains(Role::to_space(), n1_o.data())); /* check alloc info for newly-allocated object */ AllocInfo info = gc.alloc_info((std::byte *)n1_o.data()); @@ -252,7 +252,7 @@ namespace ut { { REQUIRE(l0_o.iface() != nullptr); REQUIRE(l0_o.data() != nullptr); - REQUIRE(gc.contains(role::to_space(), l0_o.data())); + REQUIRE(gc.contains(Role::to_space(), l0_o.data())); /* check alloc info for newly-allocated object */ AllocInfo info = gc.alloc_info((std::byte *)l0_o.data()); @@ -271,16 +271,16 @@ namespace ut { log && log(xtag("l0_o.data()->head_.data()", l0_o.data()->head_.data())); log && log(xtag("x0_o.data()", x0_o.data())); - REQUIRE(!gc.contains(role::from_space(), x0_o.data())); - REQUIRE(gc.contains(role::to_space(), x0_o.data())); + REQUIRE(!gc.contains(Role::from_space(), x0_o.data())); + REQUIRE(gc.contains(Role::to_space(), x0_o.data())); REQUIRE(x0_o.data()->value() == 3.1415927); - REQUIRE(!gc.contains(role::from_space(), n1_o.data())); - REQUIRE(gc.contains(role::to_space(), n1_o.data())); + REQUIRE(!gc.contains(Role::from_space(), n1_o.data())); + REQUIRE(gc.contains(Role::to_space(), n1_o.data())); REQUIRE(n1_o.data()->value() == 42); - REQUIRE(!gc.contains(role::from_space(), l0_o.data())); - REQUIRE(gc.contains(role::to_space(), l0_o.data())); + REQUIRE(!gc.contains(Role::from_space(), l0_o.data())); + REQUIRE(gc.contains(Role::to_space(), l0_o.data())); REQUIRE(l0_o.data()->is_empty() == false); REQUIRE((void*)l0_o.data()->head_.data() == (void*)x0_o.data());