From 83156ef2d03456ecbf70166424492bd45c4e63aa Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Thu, 12 Feb 2026 16:16:49 -0500 Subject: [PATCH] xo-interpreter2: vsm uses VsmRcx for runtime context --- xo-interpreter2/CMakeLists.txt | 13 ++++ .../idl/IRuntimeContext_DVsmRcx.json5 | 15 +++++ .../include/xo/interpreter2/VsmRcx.hpp | 11 ++++ .../detail/IRuntimeContext_DVsmRcx.hpp | 59 +++++++++++++++++++ .../src/interpreter2/CMakeLists.txt | 1 + .../interpreter2/IRuntimeContext_DVsmRcx.cpp | 28 +++++++++ .../interpreter2/VirtualSchematikaMachine.cpp | 9 +-- .../interpreter2_register_facets.cpp | 7 +++ xo-procedure2/idl/RuntimeContext.json5 | 1 + 9 files changed, 140 insertions(+), 4 deletions(-) create mode 100644 xo-interpreter2/idl/IRuntimeContext_DVsmRcx.json5 create mode 100644 xo-interpreter2/include/xo/interpreter2/VsmRcx.hpp create mode 100644 xo-interpreter2/include/xo/interpreter2/detail/IRuntimeContext_DVsmRcx.hpp create mode 100644 xo-interpreter2/src/interpreter2/IRuntimeContext_DVsmRcx.cpp diff --git a/xo-interpreter2/CMakeLists.txt b/xo-interpreter2/CMakeLists.txt index 7bda6388..6f3b14bc 100644 --- a/xo-interpreter2/CMakeLists.txt +++ b/xo-interpreter2/CMakeLists.txt @@ -141,6 +141,19 @@ xo_add_genfacetimpl( # ---------------------------------------------------------------- +xo_add_genfacetimpl( + TARGET xo-interpreter2-facetimpl-runtimecontext-vsmrcx + FACET_PKG xo_procedure2 + FACET RuntimeContext + REPR DVsmRcx + INPUT idl/IRuntimeContext_DVsmRcx.json5 + OUTPUT_HPP_DIR include/xo/interpreter2 + OUTPUT_IMPL_SUBDIR detail + OUTPUT_CPP_DIR src/interpreter2 + ) + +# ---------------------------------------------------------------- + xo_add_genfacet_all(xo-interpreter2-genfacet-all) # ---------------------------------------------------------------- diff --git a/xo-interpreter2/idl/IRuntimeContext_DVsmRcx.json5 b/xo-interpreter2/idl/IRuntimeContext_DVsmRcx.json5 new file mode 100644 index 00000000..8659eb66 --- /dev/null +++ b/xo-interpreter2/idl/IRuntimeContext_DVsmRcx.json5 @@ -0,0 +1,15 @@ +{ + mode: "implementation", + includes: [ + //"", + //"", + ], + local_types: [ ], + namespace1: "xo", + namespace2: "scm", + facet_idl: "idl/RuntimeContext.json5", + brief: "provide ARuntimeContext interface for DVsmRcx", + using_doxygen: true, + repr: "DVsmRcx", + doc: [ "implement ARuntimeContext for DVsmRcx" ], +} diff --git a/xo-interpreter2/include/xo/interpreter2/VsmRcx.hpp b/xo-interpreter2/include/xo/interpreter2/VsmRcx.hpp new file mode 100644 index 00000000..c0f015eb --- /dev/null +++ b/xo-interpreter2/include/xo/interpreter2/VsmRcx.hpp @@ -0,0 +1,11 @@ +/** @file VsmRcx.hpp + * + * @author Roland Conybeare, Feb 2026 + **/ + +#pragma once + +#include "DVsmRcx.hpp" +#include "detail/IRuntimeContext_DVsmRcx.hpp" + +/* end VsmRcx.hpp */ diff --git a/xo-interpreter2/include/xo/interpreter2/detail/IRuntimeContext_DVsmRcx.hpp b/xo-interpreter2/include/xo/interpreter2/detail/IRuntimeContext_DVsmRcx.hpp new file mode 100644 index 00000000..ecb81f1f --- /dev/null +++ b/xo-interpreter2/include/xo/interpreter2/detail/IRuntimeContext_DVsmRcx.hpp @@ -0,0 +1,59 @@ +/** @file IRuntimeContext_DVsmRcx.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IRuntimeContext_DVsmRcx.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_repr.hpp.j2] + * 3. idl for facet methods + * [idl/IRuntimeContext_DVsmRcx.json5] + **/ + +#pragma once + +#include "RuntimeContext.hpp" +#include "DVsmRcx.hpp" + +namespace xo { namespace scm { class IRuntimeContext_DVsmRcx; } } + +namespace xo { + namespace facet { + template <> + struct FacetImplementation + { + using ImplType = xo::scm::IRuntimeContext_Xfer + ; + }; + } +} + +namespace xo { + namespace scm { + /** @class IRuntimeContext_DVsmRcx + **/ + class IRuntimeContext_DVsmRcx { + public: + /** @defgroup scm-runtimecontext-dvsmrcx-type-traits **/ + ///@{ + using AAllocator = xo::scm::ARuntimeContext::AAllocator; + using Copaque = xo::scm::ARuntimeContext::Copaque; + using Opaque = xo::scm::ARuntimeContext::Opaque; + ///@} + /** @defgroup scm-runtimecontext-dvsmrcx-methods **/ + ///@{ + // const methods + /** default allocator to use for objects **/ + static obj allocator(const DVsmRcx & self) noexcept; + + // non-const methods + ///@} + }; + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end */ \ No newline at end of file diff --git a/xo-interpreter2/src/interpreter2/CMakeLists.txt b/xo-interpreter2/src/interpreter2/CMakeLists.txt index b02a4a7a..f6fbd10b 100644 --- a/xo-interpreter2/src/interpreter2/CMakeLists.txt +++ b/xo-interpreter2/src/interpreter2/CMakeLists.txt @@ -26,6 +26,7 @@ set(SELF_SRCS DLocalEnv.cpp DVsmRcx.cpp + IRuntimeContext_DVsmRcx.cpp VsmInstr.cpp ) diff --git a/xo-interpreter2/src/interpreter2/IRuntimeContext_DVsmRcx.cpp b/xo-interpreter2/src/interpreter2/IRuntimeContext_DVsmRcx.cpp new file mode 100644 index 00000000..3fd3730d --- /dev/null +++ b/xo-interpreter2/src/interpreter2/IRuntimeContext_DVsmRcx.cpp @@ -0,0 +1,28 @@ +/** @file IRuntimeContext_DVsmRcx.cpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IRuntimeContext_DVsmRcx.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/IRuntimeContext_DVsmRcx.json5] +**/ + +#include "detail/IRuntimeContext_DVsmRcx.hpp" + +namespace xo { + namespace scm { + auto + IRuntimeContext_DVsmRcx::allocator(const DVsmRcx & self) noexcept -> obj + { + return self.allocator(); + } + + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end IRuntimeContext_DVsmRcx.cpp */ diff --git a/xo-interpreter2/src/interpreter2/VirtualSchematikaMachine.cpp b/xo-interpreter2/src/interpreter2/VirtualSchematikaMachine.cpp index 2b07791f..1569ccc0 100644 --- a/xo-interpreter2/src/interpreter2/VirtualSchematikaMachine.cpp +++ b/xo-interpreter2/src/interpreter2/VirtualSchematikaMachine.cpp @@ -6,12 +6,13 @@ #include "VirtualSchematikaMachine.hpp" #include "VsmApplyFrame.hpp" #include "VsmEvalArgsFrame.hpp" +#include "VsmRcx.hpp" #include "Closure.hpp" #include #include #include #include -#include +//#include #include #include #include @@ -31,13 +32,13 @@ namespace xo { namespace scm { - // NOTE: using heap for {DX1Collector, DSimpleRcx} instances - // (though allocation from explictly mmap'd memory) + // NOTE: using heap here for {DX1Collector, DVsmRcx} instances + // (though DX1Collector allocations will be from explictly mmap'd memory) // VirtualSchematikaMachine::VirtualSchematikaMachine(const VsmConfig & config) : config_{config}, mm_(box(new DX1Collector(config.x1_config_))), - rcx_(box(new DSimpleRcx(mm_.to_op()))), + rcx_(box(new DVsmRcx(this))), reader_{config.rdr_config_, mm_.to_op()} { // TODO: allocate global_env diff --git a/xo-interpreter2/src/interpreter2/interpreter2_register_facets.cpp b/xo-interpreter2/src/interpreter2/interpreter2_register_facets.cpp index 22757a48..5d1467e5 100644 --- a/xo-interpreter2/src/interpreter2/interpreter2_register_facets.cpp +++ b/xo-interpreter2/src/interpreter2/interpreter2_register_facets.cpp @@ -9,6 +9,7 @@ #include "VsmEvalArgsFrame.hpp" #include "Closure.hpp" #include "LocalEnv.hpp" +#include "VsmRcx.hpp" #include #include @@ -51,10 +52,16 @@ namespace xo { FacetRegistry::register_impl(); + // RuntimeContext + // \- VsmRcx + + FacetRegistry::register_impl(); + log && log(xtag("DVsmApplyFrame.tseq", typeseq::id())); log && log(xtag("DVsmEvalArgsFrame.tseq", typeseq::id())); log && log(xtag("DClosure.tseq", typeseq::id())); log && log(xtag("DLocalEnv.tseq", typeseq::id())); + log && log(xtag("DVsmRcx.tseq", typeseq::id())); return true; } diff --git a/xo-procedure2/idl/RuntimeContext.json5 b/xo-procedure2/idl/RuntimeContext.json5 index 8a1e125f..e80c0bc5 100644 --- a/xo-procedure2/idl/RuntimeContext.json5 +++ b/xo-procedure2/idl/RuntimeContext.json5 @@ -40,4 +40,5 @@ ], nonconst_methods: [ ], + router_facet_explicit_content: [ ], }