xo-XXX -> .xo-XXX (prep subrepo)

This commit is contained in:
Roland Conybeare 2026-06-06 22:00:54 -04:00
commit cf0bd4d975
2105 changed files with 0 additions and 0 deletions

View file

@ -1,10 +0,0 @@
/** @file AAllocator.cpp **/
#include "alloc/AAllocator.hpp"
namespace xo {
namespace mm {
}
}
/* end AAlocator.cpp */

View file

@ -1,32 +0,0 @@
# alloc2/CMakeLists.txt
set(SELF_LIB xo_alloc2)
set(SELF_SRCS
init_alloc2.cpp
SetupAlloc2.cpp
CollectorTypeRegistry.cpp
GCObjectConversion.cpp
facet/ICollector_Any.cpp
IGCObject_Any.cpp
facet/IGCObjectVisitor_Any.cpp
AAllocator.cpp
IAllocator_Any.cpp
IAllocator_DArena.cpp
IAllocIterator_Any.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)

View file

@ -1,50 +0,0 @@
/** @file CollectorTypeRegistry.cpp
*
* @author Roland Conybeare, Mar 2026
**/
#include "CollectorTypeRegistry.hpp"
#include <xo/indentlog/scope.hpp>
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<ACollector> 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 */

View file

@ -1,28 +0,0 @@
/** @file GCObjectConversion.cpp
*
* @author Roland Conybeare, May 2026
**/
#include "GCObjectConversion.hpp"
namespace xo {
using xo::reflect::typeseq;
namespace scm {
void
GCObjectConversionUtil::_from_gco_fail_aux(obj<AGCObject> gco,
typeseq tseq,
scope * p_log)
{
p_log->retroactively_enable();
if (p_log) {
(*p_log)(xtag("gco.tseq", gco._typeseq()));
(*p_log)(xtag("DRepr.tseq", tseq));
}
}
} /*namespace scm*/
} /*namespace xo*/
/* end GCObjectConversion.cpp */

View file

@ -1,41 +0,0 @@
/** @file IAllocIterator_Any.cpp
*
* @author Roland Conybeare, Dec 2025
**/
#include "alloc/IAllocIterator_Any.hpp"
#include <iostream>
#include <exception>
namespace xo {
namespace mm {
using xo::facet::DVariantPlaceholder;
using xo::facet::valid_facet_implementation;
using xo::reflect::typeseq;
void
IAllocIterator_Any::_fatal() {
/* control here on uninitialized IAllocator_Any.
* Initialized instance will have specific implementation type
* e.g. IAllocator_Xfer<DArena>
*/
std::cerr << "fatal"
<< ": attempt to call uninitialized"
<< " IAllocIterator_Any method"
<< std::endl;
std::terminate();
}
typeseq
IAllocIterator_Any::s_typeseq = typeseq::id<DVariantPlaceholder>();
bool
IAllocIterator_Any::_valid = valid_facet_implementation<AAllocIterator,
IAllocIterator_Any>();
} /*namespace mm*/
} /*namespace xo*/
/* end IAllocIterator_Any.cpp */

View file

@ -1,52 +0,0 @@
/** @file IAllocIterator_DArenaIterator.cpp
*
* @author Roland Conybeare, Dec 2025
**/
#include "arena/IAllocIterator_DArenaIterator.hpp"
#include "AllocIterator.hpp"
#include <xo/indentlog/scope.hpp>
#include <cassert>
namespace xo {
using std::byte;
namespace mm {
AllocInfo
IAllocIterator_DArenaIterator::deref(const DArenaIterator & ix) noexcept
{
return ix.deref();
}
cmpresult
IAllocIterator_DArenaIterator::compare(const DArenaIterator & ix,
const obj<AAllocIterator> & other_arg) noexcept
{
scope log(XO_DEBUG(false),
xtag("&ix", &ix),
xtag("ix.arena", ix.arena_), xtag("ix.pos", ix.pos_));
/* downcast from variant */
auto other = obj<AAllocIterator, DArenaIterator>::from(other_arg);
if (!other)
return cmpresult::incomparable();
DArenaIterator & other_ix = *other.data();
log && log(xtag("&other_ix", &other_ix),
xtag("other_ix.arena", other_ix.arena_),
xtag("other_ix.pos", other_ix.pos_));
return ix.compare(other_ix);
}
void
IAllocIterator_DArenaIterator::next(DArenaIterator & ix) noexcept
{
ix.next();
}
} /*namespace mm*/
} /*namespace xo*/
/* end IAllocIterator_DArenaIterator.cpp */

View file

@ -1,44 +0,0 @@
/** @file IAllocator_Any.cpp
*
* @author Roland Conybeare, Dec 2025
**/
#include "alloc/IAllocator_Any.hpp"
#include <iostream>
#include <exception>
namespace xo {
using xo::facet::DVariantPlaceholder;
using xo::facet::typeseq;
using xo::facet::valid_facet_implementation;
namespace mm {
// LCOV_EXCL_START
void
IAllocator_Any::_fatal()
{
/* control here on uninitialized IAllocator_Any.
* Initialized instance will have specific implementation type
* e.g. IAllocator_Xfer<DArena>
*/
std::cerr << "fatal"
<< ": attempt to call uninitialized"
<< " IAllocator_Any method"
<< std::endl;
std::terminate();
}
// LCOV_EXCL_STOP
typeseq
IAllocator_Any::s_typeseq = typeseq::id<DVariantPlaceholder>();
bool
IAllocator_Any::_valid = valid_facet_implementation<AAllocator, IAllocator_Any>();
} /*namespace mm*/
} /*namespace xo*/
/* end IAllocator_Any.cpp */

View file

@ -1,186 +0,0 @@
/** @file IAllocator_DArena.cpp
*
* @author Roland Conybeare, Dec 2025
**/
#include "AllocIterator.hpp"
#include "GCObject.hpp"
#include "arena/IAllocator_DArena.hpp"
#include "arena/IAllocIterator_DArenaIterator.hpp" // for alloc_range
#include <xo/arena/DArenaIterator.hpp>
#include <xo/arena/padding.hpp>
#include <xo/facet/obj.hpp>
#include <xo/indentlog/scope.hpp>
#include <cassert>
#include <cstddef>
#include <cstring>
#include <sys/mman.h>
namespace xo {
using xo::facet::with_facet;
using std::size_t;
using std::byte;
namespace mm {
std::string_view
IAllocator_DArena::name(const DArena & s) noexcept {
return s.config_.name_;
}
size_t
IAllocator_DArena::reserved(const DArena & s) noexcept {
return s.reserved();
}
size_t
IAllocator_DArena::size(const DArena & s) noexcept {
return s.limit_ - s.lo_;
}
size_t
IAllocator_DArena::committed(const DArena & s) noexcept {
return s.committed();
}
size_t
IAllocator_DArena::available(const DArena & s) noexcept {
return s.available();
}
size_t
IAllocator_DArena::allocated(const DArena & s) noexcept {
return s.allocated();
}
void
IAllocator_DArena::visit_pools(const DArena & s,
const MemorySizeVisitor & visitor)
{
s.visit_pools(visitor);
}
bool
IAllocator_DArena::contains(const DArena & s,
const void * p) noexcept
{
return (s.lo_ <= p) && (p < s.hi_);
}
AllocError
IAllocator_DArena::last_error(const DArena & s) noexcept {
return s.last_error_;
}
AllocInfo
IAllocator_DArena::alloc_info(const DArena & s, value_type mem) noexcept
{
return s.alloc_info(mem);
}
auto
IAllocator_DArena::alloc_range(const DArena & s,
DArena & ialloc) noexcept -> range_type
{
scope log(XO_DEBUG(false));
DArenaIterator * begin_ix = construct_with<DArenaIterator>(ialloc, &s, s.begin_header());
DArenaIterator * end_ix = construct_with<DArenaIterator>(ialloc, &s, s.end_header());
obj<AAllocIterator,DArenaIterator> begin_obj
= with_facet<AAllocIterator>::mkobj(begin_ix);
obj<AAllocIterator,DArenaIterator> end_obj
= with_facet<AAllocIterator>::mkobj( end_ix);
log && log(xtag("begin_obj.typeseq", begin_obj._typeseq()));
obj<AAllocIterator> begin_vt = begin_obj;
obj<AAllocIterator> end_vt = end_obj;
log && log(xtag("begin_vt.typeseq", begin_vt._typeseq()));
log && log(xtag("begin_ix", begin_ix),
xtag("begin_ix.arena", begin_ix->arena_),
xtag("begin_ix.pos", begin_ix->pos_));
range_type retval = range_type(std::make_pair(begin_vt, end_vt));
log && log(xtag("1.retval.first.typeseq",
retval.begin()._typeseq()));
return retval;
}
bool
IAllocator_DArena::expand(DArena & s, size_t target_z) noexcept
{
return s.expand(target_z, __PRETTY_FUNCTION__);
} /*expand*/
std::byte *
IAllocator_DArena::alloc(DArena & s,
typeseq t,
std::size_t req_z)
{
return s.alloc(t, req_z);
}
std::byte *
IAllocator_DArena::super_alloc(DArena & s,
typeseq t,
std::size_t req_z)
{
return s.super_alloc(t, req_z);
}
std::byte *
IAllocator_DArena::sub_alloc(DArena & s,
std::size_t req_z,
bool complete_flag)
{
return s.sub_alloc(req_z, complete_flag);
}
void
IAllocator_DArena::clear(DArena & s)
{
s.clear();
//s.checkpoint_ = s.lo_;
}
void
IAllocator_DArena::barrier_assign_aux(DArena & s,
void * parent,
AGCObject * lhs_iface, void ** lhs_data,
AGCObject * rhs_iface, void * rhs_data)
{
(void)s;
(void)parent;
// usually would expect this to just forward to DArena.
// That's problematic in this case, because DArena is at lower level
// relative to obj<AAllocator,DArena>;
// recall that DArena is used in the implementation of xo-facet/
//
// In any case, for DArena no write barrier is applied.
// Instead just perform the fop assignment
// replacing vtable pointer here
if (lhs_iface) {
::memcpy((void *)lhs_iface, (void *)rhs_iface, sizeof(AGCObject));
}
*lhs_data = rhs_data;
}
#ifdef OBSOLETE
void
IAllocator_DArena::destruct_data(DArena & s)
{
s.~DArena();
}
#endif
} /*namespace mm*/
} /*namespace xo*/
/* end IAllocator_DArena.cpp */

View file

@ -1,54 +0,0 @@
/** @file IGCObject_Any.cpp
*
**/
#include "gc/IGCObject_Any.hpp"
#include <iostream>
#include <exception>
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<DVariantPlaceholder>();
bool
IGCObject_Any::_valid
= valid_facet_implementation<AGCObject, IGCObject_Any>();
// nonconst methods
auto
IGCObject_Any::gco_shallow_move(Opaque, obj<AGCObjectVisitor>) const noexcept -> Opaque
{
_fatal();
}
auto
IGCObject_Any::visit_gco_children(Opaque, VisitReason, obj<AGCObjectVisitor>) const noexcept -> void
{
_fatal();
}
} /*namespace mm*/
} /*namespace xo*/
/* end IGCObject_Any.cpp */

View file

@ -1,42 +0,0 @@
/** @file IResourceVisitor_Any.cpp
*
**/
#include "visitor/IResourceVisitor_Any.hpp"
#include <iostream>
#include <exception>
namespace xo {
namespace mm {
using xo::facet::DVariantPlaceholder;
using xo::facet::typeseq;
using xo::facet::valid_facet_implementation;
void
IResourceVisitor_Any::_fatal()
{
/* control here on uninitialized IAllocator_Any.
* Initialized instance will have specific implementation type
*/
std::cerr << "fatal"
<< ": attempt to call uninitialized"
<< " IResourceVisitor_Any method"
<< std::endl;
std::terminate();
}
typeseq
IResourceVisitor_Any::s_typeseq = typeseq::id<DVariantPlaceholder>();
bool
IResourceVisitor_Any::_valid
= valid_facet_implementation<AResourceVisitor, IResourceVisitor_Any>();
// nonconst methods
} /*namespace mm*/
} /*namespace xo*/
/* end IResourceVisitor_Any.cpp */

View file

@ -1,39 +0,0 @@
/** @file SetupAlloc2.cpp
*
* @author Roland Conybeare, Feb 2026
**/
#include "SetupAlloc2.hpp"
#include <xo/alloc2/Arena.hpp>
#include <xo/alloc2/ArenaIterator.hpp>
#include <xo/facet/FacetRegistry.hpp>
#include <xo/indentlog/scope.hpp>
namespace xo {
using xo::facet::FacetRegistry;
//using xo::facet::TypeRegistry;
using xo::reflect::typeseq;
namespace mm {
bool
SetupAlloc2::register_facets()
{
scope log(XO_DEBUG(true));
FacetRegistry::register_impl<AAllocator, DArena>();
FacetRegistry::register_impl<AAllocIterator, DArenaIterator>();
log && log(xtag("DArena.tseq", typeseq::id<DArena>()));
log && log(xtag("DArenaIterator.tseq", typeseq::id<DArenaIterator>()));
log && log(xtag("AAllocator.tseq", typeseq::id<AAllocator>()));
log && log(xtag("AAllocIterator.tseq", typeseq::id<AAllocIterator>()));
return true;
}
} /*namespace scm*/
} /*namespace xo*/
/* end SetupAlloc2.cpp */

View file

@ -1,78 +0,0 @@
/** @file ICollector_Any.cpp
*
**/
#include "gc/ICollector_Any.hpp"
#include <iostream>
#include <exception>
namespace xo {
namespace mm {
using xo::facet::DVariantPlaceholder;
using xo::facet::typeseq;
using xo::facet::valid_facet_implementation;
void
ICollector_Any::_fatal()
{
/* control here on uninitialized IAllocator_Any.
* Initialized instance will have specific implementation type
*/
std::cerr << "fatal"
<< ": attempt to call uninitialized"
<< " ICollector_Any method"
<< std::endl;
std::terminate();
}
typeseq
ICollector_Any::s_typeseq = typeseq::id<DVariantPlaceholder>();
bool
ICollector_Any::_valid
= valid_facet_implementation<ACollector, ICollector_Any>();
// nonconst methods
auto
ICollector_Any::install_type(Opaque, const AGCObject &) -> bool
{
_fatal();
}
auto
ICollector_Any::add_gc_root_poly(Opaque, obj<AGCObject> *) -> void
{
_fatal();
}
auto
ICollector_Any::remove_gc_root_poly(Opaque, obj<AGCObject> *) -> void
{
_fatal();
}
auto
ICollector_Any::request_gc(Opaque, Generation) -> void
{
_fatal();
}
auto
ICollector_Any::assign_member(Opaque, void *, obj<AGCObject> *, obj<AGCObject> &) -> void
{
_fatal();
}
auto
ICollector_Any::alloc_copy(Opaque, std::byte *) -> void *
{
_fatal();
}
} /*namespace mm*/
} /*namespace xo*/
/* end ICollector_Any.cpp */

View file

@ -1,54 +0,0 @@
/** @file IGCObjectVisitor_Any.cpp
*
**/
#include "gc/IGCObjectVisitor_Any.hpp"
#include <iostream>
#include <exception>
namespace xo {
namespace mm {
using xo::facet::DVariantPlaceholder;
using xo::facet::typeseq;
using xo::facet::valid_facet_implementation;
void
IGCObjectVisitor_Any::_fatal()
{
/* control here on uninitialized IAllocator_Any.
* Initialized instance will have specific implementation type
*/
std::cerr << "fatal"
<< ": attempt to call uninitialized"
<< " IGCObjectVisitor_Any method"
<< std::endl;
std::terminate();
}
typeseq
IGCObjectVisitor_Any::s_typeseq = typeseq::id<DVariantPlaceholder>();
bool
IGCObjectVisitor_Any::_valid
= valid_facet_implementation<AGCObjectVisitor, IGCObjectVisitor_Any>();
// nonconst methods
auto
IGCObjectVisitor_Any::alloc_copy(Opaque, std::byte *) const -> void *
{
_fatal();
}
auto
IGCObjectVisitor_Any::visit_child(Opaque, VisitReason, AGCObject *, void **) const noexcept -> void
{
_fatal();
}
} /*namespace mm*/
} /*namespace xo*/
/* end IGCObjectVisitor_Any.cpp */

View file

@ -1,36 +0,0 @@
/** @file init_alloc2.cpp
*
* @author Roland Conybeare, Feb 2026
**/
#include "init_alloc2.hpp"
#include "SetupAlloc2.hpp"
namespace xo {
using xo::mm::SetupAlloc2;
// using xo::mm::alloc2_register_types;
// using xo::mm::CollectorTypeRegistry;
void
InitSubsys<S_alloc2_tag>::init()
{
SetupAlloc2::register_facets();
}
InitEvidence
InitSubsys<S_alloc2_tag>::require()
{
InitEvidence retval;
/* direct subsystem deps for xo-alloc2/ (if/when) */
//retval ^= InitSubsys<S_foo_tag>>::require();
/* xo-alloc2/'s own initialization code */
retval ^= Subsystem::provide<S_alloc2_tag>("alloc2", &init);
return retval;
}
} /*namespace xo*/
/* end init_alloc2.cpp */