+ docs in xo-alloc2/ + misc improvements

This commit is contained in:
Roland Conybeare 2025-12-11 22:18:09 -05:00
commit 5964bcf3d5
22 changed files with 763 additions and 121 deletions

View file

@ -0,0 +1,39 @@
.. _AAllocator-reference:
AAllocator Reference
====================
Abstract interface facet for arena allocator.
Provides simple arena allocation.
Context
-------
.. ditaa::
:--scale: 0.99
+--------------------------------+
| IAllocator_DArena |
+--------------------------------+
| IAllocator_Xfer |
+--------------------------------+
| IAllocator_ImplType |
+--------------+-----------------+
|cBLU | DArena |
| AAllocator +-----------------+
| | ArenaConfig |
+--------------+-----------------+
.. code-block:: cpp
#incldue <xo/alloc2/AAllocator.hpp>
Class
-----
.. doxygenclass:: xo::mm::AAllocator
Methods
-------
.. doxygengroup:: mm-allocator-methods

View file

@ -0,0 +1,35 @@
.. _ArenaConfig-reference:
ArenaConfig Reference
=====================
Configuration for an arena allocator
Context
-------
.. ditaa::
:--scale: 0.99
+--------------------------------+
| IAllocator_DArena |
+--------------------------------+
| IAllocator_Xfer |
+--------------------------------+
| IAllocator_ImplType |
+--------------+-----------------+
| | DArena |
| AAllocator +-----------------+
| | ArenaConfig cBLU|
+--------------+-----------------+
.. code-block:: cpp
#include <xo/alloc2/DArena.hpp>
Class
-----
.. doxygenclass:: xo::mm::ArenaConfig
.. doxygenclass:: mm-arenaconfig-instance-vars

17
docs/CMakeLists.txt Normal file
View file

@ -0,0 +1,17 @@
# xo-alloc2/docs/CMakeLists.txt
xo_doxygen_collect_deps()
xo_docdir_doxygen_config()
xo_docdir_sphinx_config(
index.rst
glossary.rst
implementation.rst
ArenaConfig-reference.rst
DArena-reference.rst
#install.rst
#introduction.rst
#implementation.rst
)
# see xo-reader/doc or xo-unit/doc for working examples
# example.rst install.rst implementation.rst

64
docs/DArena-reference.rst Normal file
View file

@ -0,0 +1,64 @@
.. _DArena-reference:
DArena Reference
================
Native representation for arena allocator
Context
-------
.. ditaa::
:--scale: 0.99
+--------------------------------+
| IAllocator_DArena |
+--------------------------------+
| IAllocator_Xfer |
+--------------------------------+
| IAllocator_ImplType |
+--------------+-----------------+
| | DArena cBLU|
| AAllocator +-----------------+
| | ArenaConfig |
+--------------+-----------------+
.. code-block:: cpp
#include <xo/alloc2/DArena.hpp>
Arena memory layout::
<----------------------------size-------------------------->
<------------committed-----------><-------uncommitted------>
<--allocated-->
XXXXXXXXXXXXXXX___________________..........................
^ ^ ^ ^
lo free limit hi
[X] allocated: in use
[_] committed: physical memory obtained
[.] uncommitted: mapped in virtual memory, not backed by memory
Class
-----
.. doxygenclass:: xo::mm::DArena
Member Variables
----------------
.. doxygengroup:: mm-arena-instance-vars
Type Traits
-----------
.. doxygengroup:: mm-arena-traits
Constructors
------------
.. doxygengroup:: mm-arena-ctors

70
docs/README Normal file
View file

@ -0,0 +1,70 @@
build
+-----------------------------------------------+
| cmake |
| CMakeLists.txt |
| $PREFIX/share/cmake/xo_macros/xo_cxx.cmake |
+-----------------------------------------------+
|
| +----------------------+
+------------------------------------------------->| .build/docs/Doxyfile |
| +----------------------+
| |
| /------------/
| |
| v
| +---------------------------------------+ +-----------------+
+---->| doxygen |--->| .build/docs/dox |
| | $PREFIX/share/xo-macros/Doxyfile.in | | +- html/ |
| +---------------------------------------+ | +- xml/ |
| +-----------------+
| |
| /------------/
| |
| v
| +---------------------------------------+ +--------------------+
\---->| sphinx |--->| .build/docs/sphinx |
| +- conf.py | | +- html/ |
| +- _static/ | +--------------------+
| +- *.rst |
+---------------------------------------+
files
README this file
CMakeLists.txt build entry point
conf.py sphinx config
_static static files for sphinx
map
index.rst
+- install.rst
+- examples.rst
+- unit-quantities.rst
+- classes.rst
+- glossary.rst
...
examples
.. doxygenclass:: ${c++ class name}
:project:
:path:
:members:
:protected-members:
:private-members:
:undoc-members:
:member-groups:
:members-only:
:outline:
:no-link:
:allow-dot-graphs:
.. doxygendefine:: ${c preprocessor define}
.. doxygenconcept:: ${c++ concept definition}
.. doxygenenum:: ${c++ enum definition}
.. doxygenfunction:: ${c++ function name}

1
docs/_static/README vendored Normal file
View file

@ -0,0 +1 @@
add any static {.html, .js, ..} files for sphinx to pickup here

BIN
docs/_static/img/favicon.ico vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 303 KiB

39
docs/conf.py Normal file
View file

@ -0,0 +1,39 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
project = 'xo alloc2 documentation'
copyright = '2025, Roland Conybeare'
author = 'Roland Conybeare'
# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
#extensions = []
extensions = [ "breathe",
"sphinx.ext.mathjax", # inline math
"sphinx.ext.autodoc", # generate info from docstrings
"sphinxcontrib.ditaa", # diagrams-through-ascii-art
"sphinxcontrib.plantuml" # text -> uml diagrams
]
# note: breathe requires doxygen xml output -> must have GENERATE_XML = YES in Doxyfile.in
# match project name in Doxyfile.in
breathe_default_project = "xodoxxml"
templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
pygments_style = 'sphinx'
# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
#html_theme = 'alabaster'
html_theme = 'sphinx_rtd_theme'
html_static_path = ['_static']
html_favicon = '_static/img/favicon.ico'

24
docs/glossary.rst Normal file
View file

@ -0,0 +1,24 @@
.. _glossary:
Glossary
--------
.. glossary::
FOMO
| facet object model
page
| a (4k) page of virtual memory.
| O/S manages virtual memory in chunks of this size.
hugepage
| large (2MB) VM page; use to reduce page fault expense and TLB pressure.
THP
| transparent huge pages
TLB
| translation lookaside buffer
VM
| virtual memory

51
docs/implementation.rst Normal file
View file

@ -0,0 +1,51 @@
.. _implementation:
Components
==========
Library dependency tower for *xo-alloc2*
.. ditaa::
+-----------------+
| xo_alloc2 |
+-----------------+
| xo_facet |
+-----------------+
| xo_cmake |
+-----------------+
Abstraction tower for *xo-alloc2* components
.. ditaa::
:--scale: 0.99
+--------------------------------+
| IAllocator_DArena |
+--------------------------------+
| IAllocator_Xfer |
+--------------------------------+
| IAllocator_ImplType |
+--------------+-----------------+
| | DArena |
| AAllocator +-----------------+
| | ArenaConfig |
+--------------+-----------------+
.. list-table:: Descriptions
:header-rows: 1
:widths: 20 90
* - Component
- Description
* - ``AAllocator``
- allocator facet (abstract interface)
* - ``DArena``
- arena representation
* - ``IAllocator_ImplType<D>``
- lookup implementation for allocator A
with representation D.
* - ``IAllocator_Xfer<D>``
- transfer interface. downcast to native state.
* - ``IAllocator_DArena``
- allocator implementation for ``DArena``

28
docs/index.rst Normal file
View file

@ -0,0 +1,28 @@
# xo-alloc2 documentation master file
xo-alloc2 documentation
=======================
xo-alloc2 is intended to provide fast vm-aware arena allocation.
Next-generation version of xo-alloc.
At present (Dec 2025) xo-alloc is fully functional,
while xo-alloc2 is aspirational.
Features:
* allocates uncommitted virtual memory, and commits on demand.
* ses THP (Transparent Huge Pages) when available.
Implemented using FOMO (faceted rust-like object model) from xo-facet
.. toctree::
:maxdepth: 2
:caption: xo-alloc2 contents
implementation
AAllocator-reference
ArenaConfig-reference
DArena-reference
glossary
genindex
search