xo-interpreter2 .. xo-arena. memory pool introspection

This commit is contained in:
Roland Conybeare 2026-02-03 01:05:36 -05:00
commit d243124ea8
6 changed files with 23 additions and 59 deletions

View file

@ -36,7 +36,7 @@ namespace xo {
using AAllocator = xo::mm::AAllocator;
using ArenaConfig = xo::mm::ArenaConfig;
using DArena = xo::mm::DArena;
using MemorySizeInfo = xo::mm::MemorySizeInfo;
using MemorySizeVisitor = xo::mm::MemorySizeVisitor;
using size_type = std::size_t;
public:
@ -62,10 +62,8 @@ namespace xo {
/** top of parser stack **/
obj<ASyntaxStateMachine> top_ssm() const;
/** number of distinct memory pools owned by PS **/
std::size_t _n_store() const noexcept;
/** memory consumption for i'th memory pool **/
MemorySizeInfo _store_info(std::size_t i) const noexcept;
/** visit psm-owned memory pools; call visitor(info) for each **/
void visit_pools(const MemorySizeVisitor & visitor) const;
///@}

View file

@ -156,7 +156,7 @@ namespace xo {
using token_type = Token;
using ArenaConfig = xo::mm::ArenaConfig;
using AAllocator = xo::mm::AAllocator;
using MemorySizeInfo = xo::mm::MemorySizeInfo;
using MemorySizeVisitor = xo::mm::MemorySizeVisitor;
using ppindentinfo = xo::print::ppindentinfo;
using size_type = std::size_t;
@ -193,10 +193,8 @@ namespace xo {
/** top of parser stack **/
obj<ASyntaxStateMachine> top_ssm() const;
/** number of distinct memory pools owned by PS **/
std::size_t _n_store() const noexcept;
/** memory consumption for i'th memory pool **/
MemorySizeInfo _store_info(std::size_t i) const noexcept;
/** visit parser-owned memory pools; invoke visitor(info) for each **/
void visit_pools(const MemorySizeVisitor & visitor) const;
///@}
/** scm-schematikaparser-general-methods **/

View file

@ -36,7 +36,7 @@ namespace xo {
class SchematikaReader {
public:
using AAllocator = xo::mm::AAllocator;
using MemorySizeInfo = xo::mm::MemorySizeInfo;
using MemorySizeVisitor = xo::mm::MemorySizeVisitor;
using span_type = xo::mm::span<const char>;
using size_type = std::size_t;
@ -44,8 +44,11 @@ namespace xo {
SchematikaReader(const ReaderConfig & config,
obj<AAllocator> expr_alloc);
std::size_t _n_store() const noexcept;
MemorySizeInfo _store_info(std::size_t i) const noexcept;
/** visit reader-owned memory pools; call visitor(info) for each.
* Specifically exclude expr_alloc, since we don't consider
* that reader-owned
**/
void visit_pools(const MemorySizeVisitor & visitor) const;
/** true iff parser is at top-level.
* false iff parser is working on incomplete expression