diff --git a/include/xo/gc/CollectorTypeRegistry.hpp b/include/xo/gc/CollectorTypeRegistry.hpp deleted file mode 100644 index 4474e20..0000000 --- a/include/xo/gc/CollectorTypeRegistry.hpp +++ /dev/null @@ -1,74 +0,0 @@ -/** @file CollectorTypeRegistry.hpp - * - * @brief Runtime type registration for gc-aware types - * - * @author Roland Conybeare, Jan 2026 - **/ - -#pragma once - -#include "Collector.hpp" -#include - -namespace xo { - namespace mm { - /** @class CollectorTypeRegistry - * - * @brief Runtime registry for gc-aware types - * - * Singleton to remember known gc-aware types; - * use to simplify registering such types - * with a collector instance. - * - * Remark: splitting work here between - * 1. static initializer work: tracking gc-aware types, - * 2. runtime post-configuration work: report - * gc-aware types to GC instances - * - * Use: - * 1. subsystem foo provides function foo_register_types(obj gc) - * Function calls - * gc.install_type(impl_for()) - * for each gc-aware type provided by subsystem foo - * - * Example: in file xo-object2/src/object2/object2_register_types.cpp, see - * object2_register_types() - * - * 2. during subsystem init, call - * CollectorTypeRegistry::instance().register_types(&foo_register_types); - * - * Example: in file xo-object2/src/object2/init_object2.cpp, see - * InitSubsys::init() - * - * 3. during Collector setup, call - * obj gc = ...; - * CollectorTypeRegistry::instance().install_types(gc); - * - * Example: in file xo-object2/utest/X1Collector.test.cpp - * TEST_CASE("x1") - **/ - class CollectorTypeRegistry { - public: - using init_function_type = std::function)>; - - public: - /** singleton instance **/ - static CollectorTypeRegistry & instance(); - - /** remember a gc-aware type-registration function **/ - void register_types(init_function_type init_fn); - - /** register known GC-aware types with @p gc. - * Calls @c gc.isntall_type() for each - * such type. - **/ - bool install_types(obj gc); - - private: - /** initialization steps for a new Collector instance **/ - std::vector init_seq_v_; - }; - } -} - -/* end CollectorTypeRegistry.hpp */ diff --git a/src/gc/CMakeLists.txt b/src/gc/CMakeLists.txt index 985592b..6690932 100644 --- a/src/gc/CMakeLists.txt +++ b/src/gc/CMakeLists.txt @@ -3,11 +3,6 @@ set(SELF_LIB xo_gc) set(SELF_SRCS - CollectorTypeRegistry.cpp - - ICollector_Any.cpp - IGCObject_Any.cpp - IAllocator_DX1Collector.cpp ICollector_DX1Collector.cpp IAllocIterator_DX1CollectorIterator.cpp diff --git a/src/gc/CollectorTypeRegistry.cpp b/src/gc/CollectorTypeRegistry.cpp deleted file mode 100644 index cb039dd..0000000 --- a/src/gc/CollectorTypeRegistry.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/** @file CollectorTypeRegistry.cpp - **/ - -#include "CollectorTypeRegistry.hpp" -#include - -namespace xo { - namespace mm { - CollectorTypeRegistry & - CollectorTypeRegistry::instance() { - static CollectorTypeRegistry s_instance; - - return s_instance; - } - - void - CollectorTypeRegistry::register_types(init_function_type fn) { - scope log(XO_DEBUG(true)); - - init_seq_v_.push_back(fn); - } - - bool - CollectorTypeRegistry::install_types(obj gc) { - scope log(XO_DEBUG(true)); - - bool ok = true; - - size_t i = 0; - size_t n = init_seq_v_.size(); - log && log("run n init steps", xtag("n", n)); - - for (const auto & fn : init_seq_v_) { - log && log("do install fn (", i+1, "/", n, ")"); - - ok = ok & fn(gc); - } - - return ok; - } - - } /*namespace mm*/ -} /*namespace xo*/ - -/* end CollectorTypeRegistry.cpp */ diff --git a/src/gc/ICollector_Any.cpp b/src/gc/ICollector_Any.cpp deleted file mode 100644 index b39aa99..0000000 --- a/src/gc/ICollector_Any.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/** @file ICollector_Any.cpp - * - * @author Roland Conybeare, Dec 2025 - **/ - -#include "gc/ICollector_Any.hpp" -#include -#include - -namespace xo { - using xo::facet::DVariantPlaceholder; - using xo::facet::typeseq; - using xo::facet::valid_facet_implementation; - - namespace mm { - - void - ICollector_Any::_fatal() { - /* control here on uninitialized ICollector_Any. - * Initialized instance will have specific implementation type - * e.g. ICollector_Xfer - */ - - std::cerr << "fatal" - << ": attempt to call uninitialized" - << " ICollector_Any method" - << std::endl; - std::terminate(); - } - - typeseq - ICollector_Any::s_typeseq = typeseq::id(); - - bool - ICollector_Any::_valid = valid_facet_implementation(); - - } /*namespace mm*/ -} /*namespace xo*/ - -/** end ICollector_Any.cpp */ diff --git a/src/gc/IGCObject_Any.cpp b/src/gc/IGCObject_Any.cpp deleted file mode 100644 index 10ff8f6..0000000 --- a/src/gc/IGCObject_Any.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/** @file IGCObject_Any.cpp - * - **/ - -#include "gc/IGCObject_Any.hpp" -#include -#include - -namespace xo { -namespace mm { - -using xo::facet::DVariantPlaceholder; -using xo::facet::typeseq; -using xo::facet::valid_facet_implementation; - -void -IGCObject_Any::_fatal() -{ - /* control here on uninitialized IAllocator_Any. - * Initialized instance will have specific implementation type - */ - std::cerr << "fatal" - << ": attempt to call uninitialized" - << " IGCObject_Any method" - << std::endl; - std::terminate(); -} - -typeseq -IGCObject_Any::s_typeseq = typeseq::id(); - -bool -IGCObject_Any::_valid - = valid_facet_implementation(); - -// nonconst methods - -auto -IGCObject_Any::forward_children(Opaque, obj) const noexcept -> size_type -{ - _fatal(); -} - - -} /*namespace mm*/ -} /*namespace xo*/ - -/* end IGCObject_Any.cpp */