From 033b83418cbec2162f27f48ab101e9c0c5f98b5f Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Fri, 3 Apr 2026 17:05:33 -0400 Subject: [PATCH] xo-gc: refactor: streamline GCObjectStore .forward_inplace_aux() --- include/xo/gc/DX1Collector.hpp | 7 ------- include/xo/gc/GCObjectStore.hpp | 15 ++++++++------- src/gc/DX1Collector.cpp | 10 +--------- src/gc/GCObjectStore.cpp | 8 ++++---- 4 files changed, 13 insertions(+), 27 deletions(-) diff --git a/include/xo/gc/DX1Collector.hpp b/include/xo/gc/DX1Collector.hpp index 612092e..85b0c18 100644 --- a/include/xo/gc/DX1Collector.hpp +++ b/include/xo/gc/DX1Collector.hpp @@ -279,13 +279,6 @@ namespace xo { **/ void forward_inplace(AGCObject * lhs_iface, void ** lhs_data); -#ifdef OBSOLETE - /** evacuate object with type @p iface at address @p from_src - * to to-space. Return new to-space location. - **/ - void * _shallow_move(const AGCObject * iface, void * from_src); -#endif - /** true iff {alloc_hdr, object_data} should move for * currently-running collection. * diff --git a/include/xo/gc/GCObjectStore.hpp b/include/xo/gc/GCObjectStore.hpp index b5be3dd..d801112 100644 --- a/include/xo/gc/GCObjectStore.hpp +++ b/include/xo/gc/GCObjectStore.hpp @@ -173,6 +173,13 @@ namespace xo { void * gco_data, Generation upto) const noexcept; + public: + /** For each generation g in [0 ,.., upto) + * swap arenas assigned to {to-space, from-space}. + * Invoked once at the beginning of each gc cycle. + **/ + void swap_roles(Generation upto) noexcept; + /** Evacuate object at @p *lhs_data to to-space, during collection phase * acting on generations g in [0 ,.., upto). * Need @p gc to pass to invoke AGCObject methods shallow_copy() and @@ -180,17 +187,11 @@ namespace xo { * * Replace original with forwarding pointer to new location **/ - void _forward_inplace_aux(DX1Collector * gc, + void forward_inplace_aux(DX1Collector * gc, AGCObject * lhs_iface, void ** lhs_data, Generation upto); - /** For each generation g in [0 ,.., upto) - * swap arenas assigned to {to-space, from-space}. - * Invoked once at the beginning of each gc cycle. - **/ - void swap_roles(Generation upto) noexcept; - /** Cleanup at the end of a gc cycle. * Reset from-space * (current from-space is former to-space, diff --git a/src/gc/DX1Collector.cpp b/src/gc/DX1Collector.cpp index b17185e..4dd9a1e 100644 --- a/src/gc/DX1Collector.cpp +++ b/src/gc/DX1Collector.cpp @@ -623,7 +623,7 @@ namespace xo { if (runstate_.is_running()) { // called during collection phase - gco_store_._forward_inplace_aux(this, lhs_iface, lhs_data, upto); + gco_store_.forward_inplace_aux(this, lhs_iface, lhs_data, upto); } else if (runstate_.is_verify()) { // called during verify_ok this->_verify_aux(lhs_iface, *lhs_data); @@ -662,14 +662,6 @@ namespace xo { } } -#ifdef OBSOLETE - void * - DX1Collector::_shallow_move(const AGCObject * iface, void * from_src) - { - return gco_store_._shallow_move(this, iface, from_src); - } -#endif - bool DX1Collector::check_move_policy(header_type alloc_hdr, void * object_data) const noexcept diff --git a/src/gc/GCObjectStore.cpp b/src/gc/GCObjectStore.cpp index 9bbd210..7828cbf 100644 --- a/src/gc/GCObjectStore.cpp +++ b/src/gc/GCObjectStore.cpp @@ -454,10 +454,10 @@ namespace xo { } void - GCObjectStore::_forward_inplace_aux(DX1Collector * gc, - AGCObject * lhs_iface, - void ** lhs_data, - Generation upto) + GCObjectStore::forward_inplace_aux(DX1Collector * gc, + AGCObject * lhs_iface, + void ** lhs_data, + Generation upto) { // upto == runstate_.gc_upto()