From e87073f9141a7e6471286327ef2e448a9a1a8b08 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Mon, 16 Feb 2026 09:31:49 -0500 Subject: [PATCH] xo-alloc2: register DArena facet + subsystem init --- .../xo/alloc2/alloc2_register_facets.hpp | 15 ++++++++ xo-alloc2/include/xo/alloc2/init_alloc2.hpp | 23 ++++++++++++ xo-alloc2/src/alloc2/CMakeLists.txt | 10 ++---- .../src/alloc2/alloc2_register_facets.cpp | 33 +++++++++++++++++ xo-alloc2/src/alloc2/init_alloc2.cpp | 36 +++++++++++++++++++ xo-object2/src/object2/init_object2.cpp | 3 +- .../src/object2/object2_register_facets.cpp | 31 +++++++++------- 7 files changed, 131 insertions(+), 20 deletions(-) create mode 100644 xo-alloc2/include/xo/alloc2/alloc2_register_facets.hpp create mode 100644 xo-alloc2/include/xo/alloc2/init_alloc2.hpp create mode 100644 xo-alloc2/src/alloc2/alloc2_register_facets.cpp create mode 100644 xo-alloc2/src/alloc2/init_alloc2.cpp diff --git a/xo-alloc2/include/xo/alloc2/alloc2_register_facets.hpp b/xo-alloc2/include/xo/alloc2/alloc2_register_facets.hpp new file mode 100644 index 00000000..a53248a2 --- /dev/null +++ b/xo-alloc2/include/xo/alloc2/alloc2_register_facets.hpp @@ -0,0 +1,15 @@ +/** @file alloc2_register_facets.hpp + * + * @author Roland Conybeare, Feb 2026 + **/ + +#pragma once + +namespace xo { + namespace mm { + /** Register alloc2 (facet,impl) combinations with Facet Registry **/ + bool alloc2_register_facets(); + } +} + +/* end alloc2_register_facets.hpp */ diff --git a/xo-alloc2/include/xo/alloc2/init_alloc2.hpp b/xo-alloc2/include/xo/alloc2/init_alloc2.hpp new file mode 100644 index 00000000..c13160b8 --- /dev/null +++ b/xo-alloc2/include/xo/alloc2/init_alloc2.hpp @@ -0,0 +1,23 @@ +/** @file init_alloc2.hpp + * + * @author Roland Conybeare, Feb 2026 + **/ + +#pragma once + +#include + +namespace xo { + /* tag to represent the xo-alloc2/ subsystem within ordered initialization */ + enum S_alloc2_tag {}; + + template <> + struct InitSubsys { + static void init(); + static InitEvidence require(); + }; + + +} /*namespace xo*/ + +/* end init_alloc2.hpp */ diff --git a/xo-alloc2/src/alloc2/CMakeLists.txt b/xo-alloc2/src/alloc2/CMakeLists.txt index 7cebc7ae..29890c5f 100644 --- a/xo-alloc2/src/alloc2/CMakeLists.txt +++ b/xo-alloc2/src/alloc2/CMakeLists.txt @@ -3,26 +3,22 @@ set(SELF_LIB xo_alloc2) set(SELF_SRCS -# AllocError.cpp -# AllocInfo.cpp -# cmpresult.cpp + init_alloc2.cpp + alloc2_register_facets.cpp AAllocator.cpp -# ArenaConfig.cpp -# DArena.cpp IAllocator_Any.cpp IAllocator_DArena.cpp IAllocIterator_Any.cpp -# DArenaIterator.cpp IAllocIterator_DArenaIterator.cpp IResourceVisitor_Any.cpp - ) xo_add_shared_library4(${SELF_LIB} ${PROJECT_NAME}Targets ${PROJECT_VERSION} 1 ${SELF_SRCS}) # note: deps here must also appear in cmake/xo_alloc2Config.cmake.in xo_dependency(${SELF_LIB} xo_arena) xo_dependency(${SELF_LIB} xo_facet) +xo_dependency(${SELF_LIB} subsys) xo_dependency(${SELF_LIB} indentlog) diff --git a/xo-alloc2/src/alloc2/alloc2_register_facets.cpp b/xo-alloc2/src/alloc2/alloc2_register_facets.cpp new file mode 100644 index 00000000..e03afde0 --- /dev/null +++ b/xo-alloc2/src/alloc2/alloc2_register_facets.cpp @@ -0,0 +1,33 @@ +/** @file alloc2_register_facets.cpp + * + * @author Roland Conybeare, Feb 2026 + **/ + +#include "alloc2_register_facets.hpp" +#include +#include +#include + +namespace xo { + using xo::facet::FacetRegistry; + //using xo::facet::TypeRegistry; + using xo::reflect::typeseq; + + namespace mm { + + bool + alloc2_register_facets() + { + scope log(XO_DEBUG(true)); + + FacetRegistry::register_impl(); + + log && log(xtag("DArena.tseq", typeseq::id())); + + return true; + } + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end alloc2_register_facets.cpp */ diff --git a/xo-alloc2/src/alloc2/init_alloc2.cpp b/xo-alloc2/src/alloc2/init_alloc2.cpp new file mode 100644 index 00000000..d3fb73fa --- /dev/null +++ b/xo-alloc2/src/alloc2/init_alloc2.cpp @@ -0,0 +1,36 @@ +/** @file init_alloc2.cpp + * + * @author Roland Conybeare, Feb 2026 + **/ + +#include "init_alloc2.hpp" +#include "alloc2_register_facets.hpp" + +namespace xo { + using xo::mm::alloc2_register_facets; + // using xo::mm::alloc2_register_types; + // using xo::mm::CollectorTypeRegistry; + + void + InitSubsys::init() + { + alloc2_register_facets(); + } + + InitEvidence + InitSubsys::require() + { + InitEvidence retval; + + /* direct subsystem deps for xo-alloc2/ (if/when) */ + //retval ^= InitSubsys>::require(); + + /* xo-alloc2/'s own initialization code */ + retval ^= Subsystem::provide("alloc2", &init); + + return retval; + } + +} /*namespace xo*/ + +/* end init_alloc2.cpp */ diff --git a/xo-object2/src/object2/init_object2.cpp b/xo-object2/src/object2/init_object2.cpp index 0f804fe0..bcf7608c 100644 --- a/xo-object2/src/object2/init_object2.cpp +++ b/xo-object2/src/object2/init_object2.cpp @@ -7,6 +7,7 @@ #include "object2_register_facets.hpp" #include "object2_register_types.hpp" #include +#include namespace xo { using xo::scm::object2_register_facets; @@ -27,7 +28,7 @@ namespace xo { InitEvidence retval; /* direct subsystem deps for xo-object2/ */ - // retval ^= InitSubsys::require(); + retval ^= InitSubsys::require(); /* xo-expression2/'s own initialization code */ retval ^= Subsystem::provide("object2", &init); diff --git a/xo-object2/src/object2/object2_register_facets.cpp b/xo-object2/src/object2/object2_register_facets.cpp index c6358474..01d6ef04 100644 --- a/xo-object2/src/object2/object2_register_facets.cpp +++ b/xo-object2/src/object2/object2_register_facets.cpp @@ -6,22 +6,29 @@ #include "object2_register_facets.hpp" #include "RuntimeError.hpp" -#include -#include -#include -#include -#include -#include +#include +//#include +#include +#include +#include +#include -#include +//#include +#include +//#include +//#include +//#include +//#include + +//#include #include -#include -#include -#include -#include +//#include +//#include +//#include +//#include #include -#include +//#include #include #include