xo-interpreter2 stack: + RuntimeContext.visit_pools() method
This commit is contained in:
parent
5675e12d97
commit
038a931fa5
4 changed files with 19 additions and 2 deletions
|
|
@ -6,11 +6,12 @@
|
|||
#pragma once
|
||||
|
||||
#include <xo/alloc2/Allocator.hpp>
|
||||
#include <xo/arena/MemorySizeInfo.hpp>
|
||||
|
||||
namespace xo {
|
||||
namespace scm {
|
||||
// see xo-interpreter/ VirtualSchematikaMachine.hpp
|
||||
class VirtualSchematikaMachine;
|
||||
class VirtualSchematikaMachine;
|
||||
|
||||
/** @brief Runtime context for schematika interpreter
|
||||
*
|
||||
|
|
@ -19,12 +20,14 @@ namespace xo {
|
|||
class DVsmRcx {
|
||||
public:
|
||||
using AAllocator = xo::mm::AAllocator;
|
||||
using MemorySizeVisitor = xo::mm::MemorySizeVisitor;
|
||||
|
||||
public:
|
||||
DVsmRcx(VirtualSchematikaMachine * vsm);
|
||||
|
||||
obj<AAllocator> allocator() const noexcept;
|
||||
obj<AAllocator> error_allocator() const noexcept;
|
||||
void visit_pools(const MemorySizeVisitor & visitor) const;
|
||||
|
||||
private:
|
||||
/** schematika interpreter **/
|
||||
|
|
@ -34,4 +37,3 @@ namespace xo {
|
|||
} /*namespace xo*/
|
||||
|
||||
/* end DVsmRcx.hpp */
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ namespace xo {
|
|||
/** @defgroup scm-runtimecontext-dvsmrcx-type-traits **/
|
||||
///@{
|
||||
using AAllocator = xo::scm::ARuntimeContext::AAllocator;
|
||||
using MemorySizeVisitor = xo::scm::ARuntimeContext::MemorySizeVisitor;
|
||||
using Copaque = xo::scm::ARuntimeContext::Copaque;
|
||||
using Opaque = xo::scm::ARuntimeContext::Opaque;
|
||||
///@}
|
||||
|
|
@ -48,6 +49,8 @@ namespace xo {
|
|||
// const methods
|
||||
/** default allocator to use for objects **/
|
||||
static obj<AAllocator> allocator(const DVsmRcx & self) noexcept;
|
||||
/** invoke visitor for each distinct memory pool **/
|
||||
static void visit_pools(const DVsmRcx & self, MemorySizeVisitor visitor);
|
||||
|
||||
// non-const methods
|
||||
///@}
|
||||
|
|
|
|||
|
|
@ -25,6 +25,12 @@ namespace xo {
|
|||
return vsm_->error_allocator();
|
||||
}
|
||||
|
||||
void
|
||||
DVsmRcx::visit_pools(const MemorySizeVisitor & visitor) const
|
||||
{
|
||||
vsm_->visit_pools(visitor);
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,12 @@ namespace xo {
|
|||
return self.allocator();
|
||||
}
|
||||
|
||||
auto
|
||||
IRuntimeContext_DVsmRcx::visit_pools(const DVsmRcx & self, MemorySizeVisitor visitor) -> void
|
||||
{
|
||||
self.visit_pools(visitor);
|
||||
}
|
||||
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue