xo-gc xo-object2 xo-alloc2: templates for FOMO [WIP]

This commit is contained in:
Roland Conybeare 2025-12-24 19:39:11 -05:00
commit a8ff0ffec3
10 changed files with 12 additions and 60 deletions

View file

@ -217,6 +217,8 @@ let
# note: pybind11 won't build on roly-chicago-24a in nix sandbox, runs out of pty devices
#
pkgs.python3Packages.pybind11
pkgs.python3Packages.json5
pkgs.python3Packages.jinja2
pkgs.llvmPackages_18.llvm.dev
pkgs.replxx
pkgs.libwebsockets

View file

@ -3,7 +3,7 @@
DArenaIterator
==============
Iterator for allocs obtained from a :cpp:class:`DArena`.
Iterator for allocs obtained from a :cpp:class:`xo::mm::DArena`.
Context
-------

View file

@ -6,6 +6,9 @@ IAllocator_Xfer
IAllocator_Xfer provides a type-erased interface to a specific native allocator
implementation.
It supports runtime polymorphism for the cpp:class:`xo::mm::AAllocator` facet.
Application code iis unlikely to directly interact with this class
Context
-------

View file

@ -9,7 +9,7 @@ namespace xo {
ArenaConfig
ArenaConfig::simple(std::size_t z)
{
return ArenaConfig { .size_ = z };
return ArenaConfig { .name_ = "anonymous", .size_ = z };
}
}
}

View file

@ -1,53 +0,0 @@
/** @file AGCObject.hpp
*
* @author Roland Conybeare, Dec 2025
**/
#pragma once
#include "Allocator.hpp"
#include "xo/facet/facet_implementation.hpp"
#include "xo/facet/typeseq.hpp"
#include "xo/facet/obj.hpp" // for obj<AAllocator> in shallow_copy
#include <cstdint>
#include <cstddef>
namespace xo {
namespace mm {
using Copaque = const void *;
using Opaque = void *;
/** @class AObject
* @brief Abstract facet for collector-eligible data
*
* Data that supports AGCObject can have memory managed
* by ACollector
**/
struct AGCObject {
using size_type = std::size_t;
/** RTTI: unique id# for actual runtime data representation **/
virtual int32_t _typeseq() const noexcept = 0;
virtual size_type shallow_size(Copaque d) const noexcept = 0;
virtual Opaque * shallow_copy(Copaque d,
obj<AAllocator> mm) const noexcept = 0;
virtual size_type forward_children(Opaque d) const noexcept = 0;
};
// implementation IGCObject_DRepr of AGCObject for state DRepr
// should provide a specialization:
//
// template <>
// struct xo::facet::FacetImplementation<AGCObjectx, DRepr> {
// using ImplType = IGCObject_DRepr;
// };
//
// then IGCObject_ImplType<DRepr> --> IGCObject_DRepr
//
template <typename DRepr>
using IGCObject_ImplType = xo::facet::FacetImplType<AGCObject, DRepr>;
} /*namespace mm*/
} /*namespace xo*/
/* end AGCObject.hpp */

View file

@ -5,7 +5,7 @@
#pragma once
#include "AGCObject.hpp"
#include "detail/AGCObject.hpp"
#include "detail/IGCObject_Any.hpp"
#include "detail/IGCObject_Xfer.hpp"
#include "detail/RGCObject.hpp"

View file

@ -27,7 +27,7 @@ namespace xo {
/** @class ACollector
* @brief Abstract facet for the XO garbage collector
*
* Collector also supports the @ref AAllocator facet, see also
* A collector implementation will also support the @ref AAllocator facet, see also
**/
struct ACollector {
using size_type = std::size_t;

View file

@ -6,7 +6,7 @@
#pragma once
#include <xo/alloc2/alloc/AAllocator.hpp>
#include <xo/gc/AGCObject.hpp>
#include <xo/gc/detail/AGCObject.hpp>
#include <xo/gc/detail/IGCObject_Xfer.hpp>
#include "DFloat.hpp"

View file

@ -6,7 +6,7 @@
#pragma once
#include "xo/alloc2/alloc/AAllocator.hpp"
#include <xo/gc/AGCObject.hpp>
#include <xo/gc/detail/AGCObject.hpp>
#include <xo/gc/detail/IGCObject_Xfer.hpp>
#include "DInteger.hpp"

View file

@ -8,7 +8,7 @@
#include <xo/alloc2/alloc/AAllocator.hpp>
#include <xo/alloc2/alloc/RAllocator.hpp>
#include <xo/gc/Collector.hpp>
#include <xo/gc/AGCObject.hpp>
#include <xo/gc/detail/AGCObject.hpp>
#include <xo/gc/detail/IGCObject_Xfer.hpp>
#include "DList.hpp"