xo-gc: + CollectorTypeRegistry for streamlined init

This commit is contained in:
Roland Conybeare 2026-01-16 16:10:00 -05:00
commit 93429becad
16 changed files with 319 additions and 6 deletions

View file

@ -19,6 +19,7 @@ set(SELF_SRCS
DFloat.cpp
DInteger.cpp
DString.cpp
init_object2.cpp
object2_register_types.cpp
object2_register_facets.cpp
)
@ -27,4 +28,5 @@ xo_add_shared_library4(${SELF_LIB} ${PROJECT_NAME}Targets ${PROJECT_VERSION} 1 $
# note: deps here must also appear in cmake/xo_object2Config.cmake.in
xo_dependency(${SELF_LIB} xo_gc)
xo_dependency(${SELF_LIB} xo_printable2)
xo_dependency(${SELF_LIB} subsys)
xo_dependency(${SELF_LIB} indentlog)

View file

@ -0,0 +1,39 @@
/** @file init_object2.cpp
*
* @author Roland Conybeare, Jan 2026
**/
#include "init_object2.hpp"
#include "object2_register_facets.hpp"
#include "object2_register_types.hpp"
#include <xo/gc/CollectorTypeRegistry.hpp>
namespace xo {
using xo::scm::object2_register_facets;
using xo::scm::object2_register_types;
using xo::mm::CollectorTypeRegistry;
void
InitSubsys<S_object2_tag>::init()
{
object2_register_facets();
CollectorTypeRegistry::instance().register_types(&object2_register_types);
}
InitEvidence
InitSubsys<S_object2_tag>::require()
{
InitEvidence retval;
/* direct subsystem deps for xo-object2/ */
// retval ^= InitSubsys<S_somedep_tag>::require();
/* xo-expression2/'s own initialization code */
retval ^= Subsystem::provide<S_object2_tag>("object2", &init);
return retval;
}
} /*namespace xo*/
/* end init_object2.cpp */