diff --git a/include/xo/gc/DX1Collector.hpp b/include/xo/gc/DX1Collector.hpp index 78f1711..1f2ceba 100644 --- a/include/xo/gc/DX1Collector.hpp +++ b/include/xo/gc/DX1Collector.hpp @@ -110,7 +110,9 @@ namespace xo { // ----- access methods ----- const X1CollectorConfig & config() const noexcept { return config_; } + const GCObjectStore & gco_store() const noexcept { return gco_store_; } + GCObjectStore & gco_store() noexcept { return gco_store_; } std::string_view name() const noexcept { return config_.name_; } GCRunState runstate() const noexcept { return runstate_; } @@ -289,11 +291,6 @@ namespace xo { **/ bool check_move_policy(header_type alloc_hdr, void * object_data) const noexcept; - /** move interior subgraph at @p from_src to to-space. - * no-op if not in gc-space. - **/ - void * deep_move_interior(void * from_src, Generation upto); - // ----- allocation ----- /** simple allocation. allocate @p z bytes of memory diff --git a/include/xo/gc/GCObjectStore.hpp b/include/xo/gc/GCObjectStore.hpp index d07be56..67a5506 100644 --- a/include/xo/gc/GCObjectStore.hpp +++ b/include/xo/gc/GCObjectStore.hpp @@ -108,6 +108,13 @@ namespace xo { **/ bool install_type(const AGCObject & meta) noexcept; + /** move interior subgraph at @p from_src to to-space. + * no-op if not in gc-space. + **/ + void * deep_move_interior(DX1Collector * gc, + void * from_src, + Generation upto); + /** Common driver for _deep_move_root(), _deep_move_interior(). * Move object subgraph @p from_src on behalf of @p gc collection cycle, * covering generations in [0 ,.., upto). diff --git a/src/gc/DX1Collector.cpp b/src/gc/DX1Collector.cpp index 1b4fbfc..56f5a74 100644 --- a/src/gc/DX1Collector.cpp +++ b/src/gc/DX1Collector.cpp @@ -845,6 +845,7 @@ namespace xo { } } +#ifdef OBSOLETE void * DX1Collector::deep_move_interior(void * from_src, Generation upto) @@ -861,6 +862,7 @@ namespace xo { return _deep_move_gc_owned(from_src, upto); } +#endif /* * rules: diff --git a/src/gc/GCObjectStore.cpp b/src/gc/GCObjectStore.cpp index 874b518..6b09678 100644 --- a/src/gc/GCObjectStore.cpp +++ b/src/gc/GCObjectStore.cpp @@ -625,6 +625,24 @@ namespace xo { return true; } + void * + GCObjectStore::deep_move_interior(DX1Collector * gc, + void * from_src, + Generation upto) + { + scope log(XO_DEBUG(config_.debug_flag_)); + + if (!from_src) + return nullptr; + + bool src_in_from_space = this->contains(role::from_space(), from_src); + + if (!src_in_from_space) + return from_src; + + return this->_deep_move_gc_owned(gc, from_src, upto); + } + void * GCObjectStore::_deep_move_gc_owned(DX1Collector * gc, void * from_src, diff --git a/src/gc/MutationLogStore.cpp b/src/gc/MutationLogStore.cpp index 563d4bd..0495035 100644 --- a/src/gc/MutationLogStore.cpp +++ b/src/gc/MutationLogStore.cpp @@ -400,7 +400,7 @@ namespace xo { ++counters.n_rescue_; - child_to = gc->deep_move_interior(child_fr, upto); + child_to = gc->gco_store().deep_move_interior(gc, child_fr, upto); // update child pointer in parent object *from_entry.p_data() = child_to;