diff --git a/include/xo/gc/SetupGc.hpp b/include/xo/gc/SetupGc.hpp new file mode 100644 index 0000000..bf5c5c6 --- /dev/null +++ b/include/xo/gc/SetupGc.hpp @@ -0,0 +1,20 @@ +/** @file SetupGc.hpp + * + * @author Roland Conybeare, Mar 2026 + **/ + +#pragma once + +namespace xo { + namespace mm { + + class SetupGc { + public: + /** Register gc (facet,impl) combinations with FacetRegistry **/ + static bool register_facets(); + }; + + } /*namespace mm*/ +} /*namespace xo*/ + +/* end SetupGc.hpp */ diff --git a/include/xo/gc/init_gc.hpp b/include/xo/gc/init_gc.hpp new file mode 100644 index 0000000..7270eea --- /dev/null +++ b/include/xo/gc/init_gc.hpp @@ -0,0 +1,21 @@ +/** @file init_gc.hpp + * + * @author Roland Conybeare, Mar 2026 + **/ + +#pragma once + +#include + +namespace xo { + /* tag to represent the xo-gc/ subsystem within ordered initialization */ + enum S_gc_tag {}; + + template <> + struct InitSubsys { + static void init(); + static InitEvidence require(); + }; +} /*namespace xo*/ + +/* end init_gc.hpp */ diff --git a/src/gc/MutationLogEntry.cpp b/src/gc/MutationLogEntry.cpp new file mode 100644 index 0000000..6e3a0ed --- /dev/null +++ b/src/gc/MutationLogEntry.cpp @@ -0,0 +1,22 @@ +/** @file MutationLogEntry.cpp + * + * @author Roland Conybeare, Mar 2026 + **/ + +#include "MutationLogEntry.hpp" + +namespace xo { + namespace mm { + + MutationLogEntry::MutationLogEntry(void * parent, + void ** p_data, + obj snap) + : parent_{parent}, + p_data_{p_data}, + snap_{snap} + {} + + } /*namespace mm*/ +} /*namespace xo*/ + +/* end MutationLogEntry.cpp */ diff --git a/src/gc/SetupGc.cpp b/src/gc/SetupGc.cpp new file mode 100644 index 0000000..f99ea4e --- /dev/null +++ b/src/gc/SetupGc.cpp @@ -0,0 +1,36 @@ +/** @file SetupGc.cpp + * + * @author Roland Conybeare, Mar 2026 + **/ + +#include "SetupGc.hpp" +#include "X1Collector.hpp" +#include +#include + +namespace xo { + using xo::mm::AAllocator; + using xo::mm::ACollector; + using xo::mm::DX1Collector; + using xo::facet::FacetRegistry; + using xo::reflect::typeseq; + + namespace mm { + + bool + SetupGc::register_facets() + { + scope log(XO_DEBUG(true)); + + FacetRegistry::register_impl(); + FacetRegistry::register_impl(); + + log && log(xtag("DX1Collector.tseq", typeseq::id())); + log && log(xtag("ACollector.tseq", typeseq::id())); + + return true; + } + } +} /*namespace xo*/ + +/* end SetupGc.cpp */ diff --git a/src/gc/X1CollectorConfig.cpp b/src/gc/X1CollectorConfig.cpp new file mode 100644 index 0000000..812e276 --- /dev/null +++ b/src/gc/X1CollectorConfig.cpp @@ -0,0 +1,46 @@ +/** @file X1CollectorConfig.cpp + * + * @author Roland Conybeare, Mar 2026 + **/ + +#include "X1CollectorConfig.hpp" + +namespace xo { + namespace mm { + + X1CollectorConfig + X1CollectorConfig::with_name(std::string name) + { + X1CollectorConfig copy = *this; + copy.name_ = std::move(name); + return copy; + } + + X1CollectorConfig + X1CollectorConfig::with_size(std::size_t gen_z) + { + X1CollectorConfig copy = *this; + copy.arena_config_ = arena_config_.with_size(gen_z); + return copy; + } + + X1CollectorConfig + X1CollectorConfig::with_debug_flag(bool x) + { + X1CollectorConfig copy = *this; + copy.debug_flag_ = x; + return copy; + } + + X1CollectorConfig + X1CollectorConfig::with_sanitize_flag(bool x) + { + X1CollectorConfig copy = *this; + copy.sanitize_flag_ = x; + return copy; + } + + } /*namespace mm*/ +} /*namespace xo*/ + +/* end X1CollectorConfig.cpp */ diff --git a/src/gc/init_gc.cpp b/src/gc/init_gc.cpp new file mode 100644 index 0000000..8747229 --- /dev/null +++ b/src/gc/init_gc.cpp @@ -0,0 +1,34 @@ +/** @file init_gc.cpp + * + * @author Roland Conybeare, Mar 2026 + **/ + +#include "init_gc.hpp" +#include "SetupGc.hpp" +#include + +namespace xo { + using xo::mm::SetupGc; + + void + InitSubsys::init() + { + SetupGc::register_facets(); + } + + InitEvidence + InitSubsys::require() { + InitEvidence retval; + + /* recursive subsystem deps for xo-gc/ */ + retval ^= InitSubsys::require(); + + /* xo-gc/'s own initialization code */ + retval ^= Subsystem::provide("gc", &init); + + return retval; + } + +} /*namespace xo*/ + +/* end init_gc.cpp */