From a4dd872a15f93acc5f3aed3cda9e4d6720533899 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Sun, 25 Jan 2026 10:31:06 -0500 Subject: [PATCH 01/90] xo-procedure2: procedure abstraction for Schematika --- CMakeLists.txt | 41 ++++++++ cmake/xo-bootstrap-macros.cmake | 41 ++++++++ cmake/xo_procedure2Config.cmake.in | 13 +++ idl/Procedure.json5 | 58 +++++++++++ include/xo/procedure2/.gitkeep | 0 include/xo/procedure2/DPrimitive.hpp | 94 ++++++++++++++++++ include/xo/procedure2/Procedure.hpp | 22 +++++ include/xo/procedure2/detail/AProcedure.hpp | 77 +++++++++++++++ .../xo/procedure2/detail/IProcedure_Any.hpp | 88 +++++++++++++++++ .../xo/procedure2/detail/IProcedure_Xfer.hpp | 86 +++++++++++++++++ include/xo/procedure2/detail/RProcedure.hpp | 86 +++++++++++++++++ include/xo/procedure2/init_primitives.hpp | 29 ++++++ include/xo/procedure2/init_procedure2.hpp | 21 ++++ include/xo/procedure2/primitives.hpp | 13 +++ src/procedure2/CMakeLists.txt | 26 +++++ src/procedure2/DPrimitive.cpp | 16 ++++ src/procedure2/IProcedure_Any.cpp | 47 +++++++++ src/procedure2/init_primitives.cpp | 95 +++++++++++++++++++ src/procedure2/init_procedure2.cpp | 32 +++++++ 19 files changed, 885 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 cmake/xo-bootstrap-macros.cmake create mode 100644 cmake/xo_procedure2Config.cmake.in create mode 100644 idl/Procedure.json5 create mode 100644 include/xo/procedure2/.gitkeep create mode 100644 include/xo/procedure2/DPrimitive.hpp create mode 100644 include/xo/procedure2/Procedure.hpp create mode 100644 include/xo/procedure2/detail/AProcedure.hpp create mode 100644 include/xo/procedure2/detail/IProcedure_Any.hpp create mode 100644 include/xo/procedure2/detail/IProcedure_Xfer.hpp create mode 100644 include/xo/procedure2/detail/RProcedure.hpp create mode 100644 include/xo/procedure2/init_primitives.hpp create mode 100644 include/xo/procedure2/init_procedure2.hpp create mode 100644 include/xo/procedure2/primitives.hpp create mode 100644 src/procedure2/CMakeLists.txt create mode 100644 src/procedure2/DPrimitive.cpp create mode 100644 src/procedure2/IProcedure_Any.cpp create mode 100644 src/procedure2/init_primitives.cpp create mode 100644 src/procedure2/init_procedure2.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..8d00f310 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,41 @@ +# xo-procedure2/CMakeLists.txt + +cmake_minimum_required(VERSION 3.10) + +project(xo_procedure2 VERSION 1.0) +enable_language(CXX) + +include(GNUInstallDirs) +include(cmake/xo-bootstrap-macros.cmake) + +xo_cxx_toplevel_options3() + +# ---------------------------------------------------------------- +# c++ settings + +# one-time project-specific c++ flags. usually empty +set(PROJECT_CXX_FLAGS "") +add_definitions(${PROJECT_CXX_FLAGS}) + +# ---------------------------------------------------------------- +# output targets + +# note: manual target; generated code committed to git +xo_add_genfacet( + TARGET xo-procedure2-facet-procedure + FACET Procedure + INPUT idl/Procedure.json5 + OUTPUT_HPP_DIR include/xo/procedure2 + OUTPUT_IMPL_SUBDIR detail + OUTPUT_CPP_DIR src/procedure2 + ) + +add_subdirectory(src/procedure2) +#add_subdirectory(utest) + +# ---------------------------------------------------------------- +# cmake export + +#xo_export_cmake_config(${PROJECT_NAME} ${PROJECT_VERSION} ${PROJECT_NAME}Targets) + +# end CMakeLists.txt diff --git a/cmake/xo-bootstrap-macros.cmake b/cmake/xo-bootstrap-macros.cmake new file mode 100644 index 00000000..592272c0 --- /dev/null +++ b/cmake/xo-bootstrap-macros.cmake @@ -0,0 +1,41 @@ +# ---------------------------------------------------------------- +# for example: +# $ PREFIX=/usr/local # for example +# $ cmake -DCMAKE_MODULE_PATH=prefix -DCMAKE_INSTALL_PREFIX=$PREFIX -B .build +# +# will get +# CMAKE_MODULE_PATH +# from xo-cmake-config --cmake-module-path +# +# and expect .cmake macros in +# CMAKE_MODULE_PATH/xo_macros/xo_cxx.cmake +# ---------------------------------------------------------------- + +find_program(XO_CMAKE_CONFIG_EXECUTABLE NAMES xo-cmake-config REQUIRED) + +if ("${XO_CMAKE_CONFIG_EXECUTABLE}" STREQUAL "XO_CMAKE_CONFIG_EXECUTABLE-NOT_FOUND") + message(FATAL "could not find xo-cmake-config executable") +endif() + +message(STATUS "XO_CMAKE_CONFIG_EXECUTABLE=${XO_CMAKE_CONFIG_EXECUTABLE}") + +if (XO_SUBMODULE_BUILD) + if (("${CMAKE_MODULE_PATH}" STREQUAL "") OR ("${CMAKE_MODULE_PATH}" STREQUAL prefix)) + # local version of xo-cmake macros + set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/xo-cmake/cmake") + message(STATUS "CMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}") + endif() +else() + if (("${CMAKE_MODULE_PATH}" STREQUAL "") OR ("${CMAKE_MODULE_PATH}" STREQUAL prefix)) + # default to typical install location for xo-project-macros + execute_process(COMMAND ${XO_CMAKE_CONFIG_EXECUTABLE} --cmake-module-path OUTPUT_VARIABLE CMAKE_MODULE_PATH) + message(STATUS "CMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}") + endif() +endif() + +# needs to have been installed somewhere on CMAKE_MODULE_PATH, +# (e.g. from xo-cmake with the same value for CMAKE_INSTALL_PREFIX) +# +include(xo_macros/xo_cxx) + +xo_cxx_bootstrap_message() diff --git a/cmake/xo_procedure2Config.cmake.in b/cmake/xo_procedure2Config.cmake.in new file mode 100644 index 00000000..0229c033 --- /dev/null +++ b/cmake/xo_procedure2Config.cmake.in @@ -0,0 +1,13 @@ +@PACKAGE_INIT@ + +include(CMakeFindDependencyMacro) + +# note: changes to find_dependency() calls here +# must coordinate with xo_dependency() calls +# in CMakeLists.txt +# +find_dependency(xo_gc) +find_dependency(subsys) + +include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") +check_required_components("@PROJECT_NAME@") diff --git a/idl/Procedure.json5 b/idl/Procedure.json5 new file mode 100644 index 00000000..fb43f310 --- /dev/null +++ b/idl/Procedure.json5 @@ -0,0 +1,58 @@ +{ + mode: "facet", + // includes in ASyntaxStateMachine.hpp + includes: [ + ], + // extra includes in SyntaxStateMachine.hpp, if any + user_hpp_includes: [ + ], + namespace1: "xo", + namespace2: "scm", + // text after includes, before ASyntaxStateMachine + pretext: [ "// {pretex} here" ], + facet: "Procedure", + detail_subdir: "detail", + brief: "abstraction for a schematika procedure i.e. something callable", + using_doxygen: true, + doc: [ + "Abstraction for a schematika procedure" + ], + types: [ + { name: "AGCObject", + definition: "xo::mm::AGCObject", + doc: [ "a gc-aware object" ], + }, + // { name: string, doc: [ string ], definition: string }, + ], + const_methods: [ + { + name: "is_nary", + doc: [ "true iff procedure takes n arguments" ], + return_type: "bool", + args: [], + const: true, + noexcept: true, + attributes: [] + }, + { + name: "n_args", + doc: ["number of arguments. -1 for n-ary" ], + return_type: "std::int32_t", + args: [], + const: true, + noexcept: true, + attributes: [] + } + ], + nonconst_methods: [ + { + name: "apply_nocheck", + doc: ["invoke procedure; assume arguments satisfy type system" ], + return_type: "obj", + args: [ + {type: "obj", name: "mm"}, + {type: "const DArray *", name: "args"}, + ] + } + ], +} diff --git a/include/xo/procedure2/.gitkeep b/include/xo/procedure2/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/include/xo/procedure2/DPrimitive.hpp b/include/xo/procedure2/DPrimitive.hpp new file mode 100644 index 00000000..5e5f996c --- /dev/null +++ b/include/xo/procedure2/DPrimitive.hpp @@ -0,0 +1,94 @@ +/** @file DPrimitive.hpp + * + * @author Roland Conybeare, Jan 2025 + **/ + +#pragma once + +#include +#include +#include +#include + +#include +#include +#include +#include + +namespace xo { + namespace scm { + /** @brief Extract return type and argument types from a function type. + * + * Primary template (undefined) - specializations handle specific cases + **/ + template + struct FnTraits; + + /** specialization for function pointers **/ + template + struct FnTraits { + /** function return type **/ + using return_type = R; + /** tuple type for function arguments **/ + using args_tuple = std::tuple; + /** number of arguments **/ + static constexpr std::size_t n_args = sizeof...(Args); + + /** arg_type is the type of the i'th argument to Fn **/ + template + using arg_type = std::tuple_element_t; + }; + + /** specialization for function references **/ + template + struct FnTraits : FnTraits {}; + + /** specialization for plain function types **/ + template + struct FnTraits : FnTraits {}; + + template + class Primitive { + public: + using AAllocator = xo::mm::AAllocator; + using AGCObject = xo::mm::AGCObject; + using DArray = xo::scm::DArray; + using Traits = FnTraits; + + public: + Primitive(std::string_view name, Fn fn) : name_{name}, fn_{fn} {} + + bool is_nary() const noexcept { return false; } + static constexpr std::int32_t n_args() noexcept { return Traits::n_args; } + + obj apply_nocheck(obj mm, const DArray * args) { + return _apply_nocheck(mm, args, + std::make_index_sequence{}); + } + + private: + template + obj _apply_nocheck(obj mm, + const DArray * args, + std::index_sequence) + { + using R = typename Traits::return_type; + + R result + = fn_(GCObjectConversion>::from_gco(mm, args->at(Is))... + ); + + return GCObjectConversion::to_gco(mm, result); + } + + private: + /** name of this primitive **/ + std::string_view name_; + /** function implementation **/ + Fn fn_; + }; /*Primitive*/ + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end DPrimitive.hpp */ diff --git a/include/xo/procedure2/Procedure.hpp b/include/xo/procedure2/Procedure.hpp new file mode 100644 index 00000000..8b2cd91a --- /dev/null +++ b/include/xo/procedure2/Procedure.hpp @@ -0,0 +1,22 @@ +/** @file Procedure.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet] + * arguments: + * --input [idl/Procedure.json5] + * 2. jinja2 template for facet .hpp file: + * [facet.hpp.j2] + * 3. idl for facet methods + * [idl/Procedure.json5] + **/ + +#pragma once + +#include "detail/AProcedure.hpp" +#include "detail/IProcedure_Any.hpp" +#include "detail/IProcedure_Xfer.hpp" +#include "detail/RProcedure.hpp" + + +/* end Procedure.hpp */ \ No newline at end of file diff --git a/include/xo/procedure2/detail/AProcedure.hpp b/include/xo/procedure2/detail/AProcedure.hpp new file mode 100644 index 00000000..c0b22f49 --- /dev/null +++ b/include/xo/procedure2/detail/AProcedure.hpp @@ -0,0 +1,77 @@ +/** @file AProcedure.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet] + * arguments: + * --input [idl/Procedure.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [abstract_facet.hpp.j2] + * 3. idl for facet methods + * [idl/Procedure.json5] + **/ + +#pragma once + +// includes (via {facet_includes}) +#include +#include +#include + +// {pretex} here + +namespace xo { +namespace scm { + +using Copaque = const void *; +using Opaque = void *; + +/** +Abstraction for a schematika procedure +**/ +class AProcedure { +public: + /** @defgroup scm-procedure-type-traits **/ + ///@{ + // types + /** integer identifying a type **/ + using typeseq = xo::facet::typeseq; + using Copaque = const void *; + using Opaque = void *; + /** a gc-aware object **/ + using AGCObject = xo::mm::AGCObject; + ///@} + + /** @defgroup scm-procedure-methods **/ + ///@{ + // const methods + /** RTTI: unique id# for actual runtime data representation **/ + virtual typeseq _typeseq() const noexcept = 0; + /** true iff procedure takes n arguments **/ + virtual bool is_nary(Copaque data) const noexcept = 0; + /** number of arguments. -1 for n-ary **/ + virtual std::int32_t n_args(Copaque data) const noexcept = 0; + + // nonconst methods + /** invoke procedure; assume arguments satisfy type system **/ + virtual obj apply_nocheck(Opaque data, obj mm, const DArray * args) = 0; + ///@} +}; /*AProcedure*/ + +/** Implementation IProcedure_DRepr of AProcedure for state DRepr + * should provide a specialization: + * + * template <> + * struct xo::facet::FacetImplementation { + * using Impltype = IProcedure_DRepr; + * }; + * + * then IProcedure_ImplType --> IProcedure_DRepr + **/ +template +using IProcedure_ImplType = xo::facet::FacetImplType; + +} /*namespace scm*/ +} /*namespace xo*/ + +/* AProcedure.hpp */ \ No newline at end of file diff --git a/include/xo/procedure2/detail/IProcedure_Any.hpp b/include/xo/procedure2/detail/IProcedure_Any.hpp new file mode 100644 index 00000000..c1b8c9d6 --- /dev/null +++ b/include/xo/procedure2/detail/IProcedure_Any.hpp @@ -0,0 +1,88 @@ +/** @file IProcedure_Any.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet] + * arguments: + * --input [idl/Procedure.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/Procedure.json5] + **/ + +#pragma once + +#include "AProcedure.hpp" +#include + +namespace xo { namespace scm { class IProcedure_Any; } } + +namespace xo { +namespace facet { + +template <> +struct FacetImplementation +{ + using ImplType = xo::scm::IProcedure_Any; +}; + +} +} + +namespace xo { +namespace scm { + + /** @class IProcedure_Any + * @brief AProcedure implementation for empty variant instance + **/ + class IProcedure_Any : public AProcedure { + public: + /** @defgroup scm-procedure-any-type-traits **/ + ///@{ + + /** integer identifying a type **/ + using typeseq = xo::facet::typeseq; + using AGCObject = AProcedure::AGCObject; + + ///@} + /** @defgroup scm-procedure-any-methods **/ + ///@{ + + const AProcedure * iface() const { return std::launder(this); } + + // from AProcedure + + // const methods + typeseq _typeseq() const noexcept override { return s_typeseq; } + [[noreturn]] bool is_nary(Copaque) const noexcept override { _fatal(); } + [[noreturn]] std::int32_t n_args(Copaque) const noexcept override { _fatal(); } + + // nonconst methods + [[noreturn]] obj apply_nocheck(Opaque, obj, const DArray *) override; + + ///@} + + private: + /** @defgraoup scm-procedure-any-private-methods **/ + ///@{ + + [[noreturn]] static void _fatal(); + + ///@} + + public: + /** @defgroup scm-procedure-any-member-vars **/ + ///@{ + + static typeseq s_typeseq; + static bool _valid; + + ///@} + }; + +} /*namespace scm */ +} /*namespace xo */ + +/* IProcedure_Any.hpp */ \ No newline at end of file diff --git a/include/xo/procedure2/detail/IProcedure_Xfer.hpp b/include/xo/procedure2/detail/IProcedure_Xfer.hpp new file mode 100644 index 00000000..dfe8a558 --- /dev/null +++ b/include/xo/procedure2/detail/IProcedure_Xfer.hpp @@ -0,0 +1,86 @@ +/** @file IProcedure_Xfer.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet] + * arguments: + * --input [idl/Procedure.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/Procedure.json5] + **/ + +#pragma once + + +namespace xo { +namespace scm { + /** @class IProcedure_Xfer + **/ + template + class IProcedure_Xfer : public AProcedure { + public: + /** @defgroup scm-procedure-xfer-type-traits **/ + ///@{ + /** actual implementation (not generated; often delegates to DRepr) **/ + using Impl = IProcedure_DRepr; + /** integer identifying a type **/ + using typeseq = AProcedure::typeseq; + using AGCObject = AProcedure::AGCObject; + ///@} + + /** @defgroup scm-procedure-xfer-methods **/ + ///@{ + + static const DRepr & _dcast(Copaque d) { return *(const DRepr *)d; } + static DRepr & _dcast(Opaque d) { return *(DRepr *)d; } + + // from AProcedure + + // const methods + typeseq _typeseq() const noexcept override { return s_typeseq; } + bool is_nary(Copaque data) const noexcept override { + return I::is_nary(_dcast(data)); + } + std::int32_t n_args(Copaque data) const noexcept override { + return I::n_args(_dcast(data)); + } + + // non-const methods + obj apply_nocheck(Opaque data, obj mm, const DArray * args) override { + return I::apply_nocheck(_dcast(data), mm, args); + } + + ///@} + + private: + using I = Impl; + + public: + /** @defgroup scm-procedure-xfer-member-vars **/ + ///@{ + + /** typeseq for template parameter DRepr **/ + static typeseq s_typeseq; + /** true iff satisfies facet implementation **/ + static bool _valid; + + ///@} + }; + + template + xo::facet::typeseq + IProcedure_Xfer::s_typeseq + = xo::facet::typeseq::id(); + + template + bool + IProcedure_Xfer::_valid + = xo::facet::valid_facet_implementation(); + +} /*namespace scm */ +} /*namespace xo*/ + +/* end IProcedure_Xfer.hpp */ \ No newline at end of file diff --git a/include/xo/procedure2/detail/RProcedure.hpp b/include/xo/procedure2/detail/RProcedure.hpp new file mode 100644 index 00000000..dc0f30d8 --- /dev/null +++ b/include/xo/procedure2/detail/RProcedure.hpp @@ -0,0 +1,86 @@ +/** @file RProcedure.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet] + * arguments: + * --input [idl/Procedure.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/Procedure.json5] + **/ + +#pragma once + +#include "AProcedure.hpp" + +namespace xo { +namespace scm { + +/** @class RProcedure + **/ +template +class RProcedure : public Object { +private: + using O = Object; + +public: + /** @defgroup scm-procedure-router-type-traits **/ + ///@{ + using ObjectType = Object; + using DataPtr = Object::DataPtr; + using typeseq = xo::reflect::typeseq; + using AGCObject = AProcedure::AGCObject; + ///@} + + /** @defgroup scm-procedure-router-ctors **/ + ///@{ + RProcedure() {} + RProcedure(Object::DataPtr data) : Object{std::move(data)} {} + RProcedure(const AProcedure * iface, void * data) + requires std::is_same_v + : Object(iface, data) {} + + ///@} + /** @defgroup scm-procedure-router-methods **/ + ///@{ + + // const methods + typeseq _typeseq() const noexcept { return O::iface()->_typeseq(); } + bool is_nary() const noexcept { + return O::iface()->is_nary(O::data()); + } + std::int32_t n_args() const noexcept { + return O::iface()->n_args(O::data()); + } + + // non-const methods (still const in router!) + obj apply_nocheck(obj mm, const DArray * args) { + return O::iface()->apply_nocheck(O::data(), mm, args); + } + + ///@} + /** @defgroup scm-procedure-member-vars **/ + ///@{ + + static bool _valid; + + ///@} +}; + +template +bool +RProcedure::_valid = xo::facet::valid_object_router(); + +} /*namespace scm*/ +} /*namespace xo*/ + +namespace xo { namespace facet { + template + struct RoutingFor { + using RoutingType = xo::scm::RProcedure; + }; +} } + +/* end RProcedure.hpp */ \ No newline at end of file diff --git a/include/xo/procedure2/init_primitives.hpp b/include/xo/procedure2/init_primitives.hpp new file mode 100644 index 00000000..d4150d2d --- /dev/null +++ b/include/xo/procedure2/init_primitives.hpp @@ -0,0 +1,29 @@ +/** @file init_primitives.hpp **/ + +#pragma once + +#include "DPrimitive.hpp" + +namespace xo { + namespace scm { + using Primitive_f64_1_f64 = Primitive; + using Primitive_f64_2_f64_f64 = Primitive; + + struct Primitives { + static Primitive_f64_1_f64 s_neg_f64_pm; + + static Primitive_f64_2_f64_f64 s_add_f64_f64_pm; + static Primitive_f64_2_f64_f64 s_sub_f64_f64_pm; + static Primitive_f64_2_f64_f64 s_mul_f64_f64_pm; + static Primitive_f64_2_f64_f64 s_div_f64_f64_pm; + static Primitive_f64_2_f64_f64 s_pow_f64_f64_pm; + + static Primitive_f64_1_f64 s_log_f64_pm; + static Primitive_f64_1_f64 s_sin_f64_pm; + static Primitive_f64_1_f64 s_cos_f64_pm; + static Primitive_f64_1_f64 s_tan_f64_pm; + }; + } +} + +/* end init_primitives.hpp */ diff --git a/include/xo/procedure2/init_procedure2.hpp b/include/xo/procedure2/init_procedure2.hpp new file mode 100644 index 00000000..793cc061 --- /dev/null +++ b/include/xo/procedure2/init_procedure2.hpp @@ -0,0 +1,21 @@ +/** @file init_procedure2.hpp + * + * @author Roland Conybeare, Jan 2026 + **/ + +#pragma once + +#include + +namespace xo { + /* tag to represent the xo-procedure2/ subsystem within ordered iniitalization */ + enum S_procedure2_tag {}; + + template <> + struct InitSubsys { + static void init(); + static InitEvidence require(); + }; +} /*namespace xo*/ + +/* end init_procedure2.hpp */ diff --git a/include/xo/procedure2/primitives.hpp b/include/xo/procedure2/primitives.hpp new file mode 100644 index 00000000..e2e0d88a --- /dev/null +++ b/include/xo/procedure2/primitives.hpp @@ -0,0 +1,13 @@ +/** @file primitives.hpp **/ + +#pragma once + +namespace xo { + namespace scm { + struct Primitives { + static void init_primitives(); + }; + } +} + +/* end primitives.hpp */ diff --git a/src/procedure2/CMakeLists.txt b/src/procedure2/CMakeLists.txt new file mode 100644 index 00000000..edc5d3ce --- /dev/null +++ b/src/procedure2/CMakeLists.txt @@ -0,0 +1,26 @@ +# xo-procedure2/src/CMakeLists.txt + +set(SELF_LIB xo_procedure2) +set(SELF_SRCS + init_procedure2.cpp + init_primitives.cpp + DPrimitive.cpp + # Add source files here, e.g.: + # procedure2.cpp +) + +xo_add_shared_library4(${SELF_LIB} ${PROJECT_NAME}Targets ${PROJECT_VERSION} 1 ${SELF_SRCS}) +xo_install_include_tree3(include/xo/procedure2) + +# ---------------------------------------------------------------- +# input dependencies +# +# NOTE: dependency set here must be kept consistent with +# xo-procedure2/cmake/xo_procedure2Config.cmake.in + +xo_dependency(${SELF_LIB} xo_object2) +xo_dependency(${SELF_LIB} xo_gc) +xo_dependency(${SELF_LIB} subsys) +#xo_dependency(${SELF_LIB} xo_indentlog) + +# end src/CMakeLists.txt diff --git a/src/procedure2/DPrimitive.cpp b/src/procedure2/DPrimitive.cpp new file mode 100644 index 00000000..ab335d8d --- /dev/null +++ b/src/procedure2/DPrimitive.cpp @@ -0,0 +1,16 @@ +/** @file DPrimitive.cpp + * + * @author Roland Conybeare, Jan 2026 + **/ + +#include "DPrimitive.hpp" +#include + +namespace xo { + namespace scm { + + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end DPrimitive.cpp */ diff --git a/src/procedure2/IProcedure_Any.cpp b/src/procedure2/IProcedure_Any.cpp new file mode 100644 index 00000000..3044c104 --- /dev/null +++ b/src/procedure2/IProcedure_Any.cpp @@ -0,0 +1,47 @@ +/** @file IProcedure_Any.cpp + * + **/ + +#include "detail/IProcedure_Any.hpp" +#include + +namespace xo { +namespace scm { + +using xo::facet::DVariantPlaceholder; +using xo::facet::typeseq; +using xo::facet::valid_facet_implementation; + +void +IProcedure_Any::_fatal() +{ + /* control here on uninitialized IAllocator_Any. + * Initialized instance will have specific implementation type + */ + std::cerr << "fatal" + << ": attempt to call uninitialized" + << " IProcedure_Any method" + << std::endl; + std::terminate(); +} + +typeseq +IProcedure_Any::s_typeseq = typeseq::id(); + +bool +IProcedure_Any::_valid + = valid_facet_implementation(); + +// nonconst methods + +auto +IProcedure_Any::apply_nocheck(Opaque, obj, const DArray *) -> obj +{ + _fatal(); +} + + +} /*namespace scm*/ +} /*namespace xo*/ + +/* end IProcedure_Any.cpp */ \ No newline at end of file diff --git a/src/procedure2/init_primitives.cpp b/src/procedure2/init_primitives.cpp new file mode 100644 index 00000000..169b660e --- /dev/null +++ b/src/procedure2/init_primitives.cpp @@ -0,0 +1,95 @@ +/** @file init_primitives.cpp + * + * @author Roland Conybeare, Jan 2026 + **/ + +#include "init_primitives.hpp" +#include "DPrimitive.hpp" + +namespace xo { + namespace scm { + double + neg_f64(double x) { + return -x; + } + + double + add_f64_f64(double x, double y) { + return x + y; + } + + double + sub_f64_f64(double x, double y) { + return x - y; + } + + double + mul_f64_f64(double x, double y) { + return x * y; + } + + double + div_f64_f64(double x, double y) { + return x / y; + } + + double + pow_f64_f64(double x, double y) { + return ::pow(x, y); + } + + double + log_f64(double x) { + return ::log(x); + } + + double + sin_f64(double x) { + return ::sin(x); + } + + double + cos_f64(double x) { + return ::cos(x); + } + + double + tan_f64(double x) { + return ::tan(x); + } + + Primitive_f64_1_f64 + Primitives::s_neg_f64_pm("_neg_d", + &neg_f64); + + Primitive_f64_2_f64_f64 + Primitives::s_add_f64_f64_pm("_add_d_d", &add_f64_f64); + + Primitive_f64_2_f64_f64 + Primitives::s_sub_f64_f64_pm("_sub_d_d", &sub_f64_f64); + + Primitive_f64_2_f64_f64 + Primitives::s_mul_f64_f64_pm("_mul_d_d", &mul_f64_f64); + + Primitive_f64_2_f64_f64 + Primitives::s_div_f64_f64_pm("_div_d_d", &div_f64_f64); + + Primitive_f64_2_f64_f64 + Primitives::s_pow_f64_f64_pm("_pow_d_d", &pow_f64_f64); + + Primitive_f64_1_f64 + Primitives::s_log_f64_pm("_log_d", &log_f64); + + Primitive_f64_1_f64 + Primitives::s_sin_f64_pm("_sin_d", &sin_f64); + + Primitive_f64_1_f64 + Primitives::s_cos_f64_pm("_cos_d", &cos_f64); + + Primitive_f64_1_f64 + Primitives::s_tan_f64_pm("_tan_d", &tan_f64); + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end init_primitives.cpp */ diff --git a/src/procedure2/init_procedure2.cpp b/src/procedure2/init_procedure2.cpp new file mode 100644 index 00000000..fc316653 --- /dev/null +++ b/src/procedure2/init_procedure2.cpp @@ -0,0 +1,32 @@ +/** @file init_procedure2.cpp + * + * @author Roland Conybeare, Jan 2026 +**/ + +#include "init_procedure2.hpp" +#include "init_primitives.hpp" +//#include "procedure2_register_facets.hpp" +//#include "procedure2_register_types.hpp" +#include + +namespace xo { + using xo::scm::Primitives; + + void + InitSubsys::init() + { + } + + InitEvidence + InitSubsys::require() + { + InitEvidence retval; + + /* xo-procedure2/'s own initialization code */ + retval ^= Subsystem::provide("procedure2", &init); + + return retval; + } +} /*namespace xo*/ + +/* end init_procedure2.cpp */ From f2139feafb15199c9159da04c697e8ee2c1b5a09 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Sun, 25 Jan 2026 19:07:23 -0500 Subject: [PATCH 02/90] xo-procedure2: work on Primitive.apply_nocheck() + ARuntimeContext [WIP] --- CMakeLists.txt | 27 ++++++ idl/IProcedure_DPrimitive_gco_2_gco_gco.json5 | 17 ++++ idl/Procedure.json5 | 18 ++-- idl/RuntimeContext.json5 | 43 ++++++++++ include/xo/procedure2/DPrimitive.hpp | 15 ++-- .../procedure2/DPrimitive_gco_2_gco_gco.hpp | 15 ++++ include/xo/procedure2/Procedure.hpp | 2 +- include/xo/procedure2/RuntimeContext.hpp | 22 +++++ include/xo/procedure2/detail/AProcedure.hpp | 8 +- .../xo/procedure2/detail/ARuntimeContext.hpp | 73 ++++++++++++++++ .../xo/procedure2/detail/IProcedure_Any.hpp | 4 +- .../IProcedure_DPrimitive_gco_2_gco_gco.hpp | 67 +++++++++++++++ .../xo/procedure2/detail/IProcedure_Xfer.hpp | 8 +- .../procedure2/detail/IRuntimeContext_Any.hpp | 86 +++++++++++++++++++ .../detail/IRuntimeContext_Xfer.hpp | 81 +++++++++++++++++ include/xo/procedure2/detail/RProcedure.hpp | 6 +- .../xo/procedure2/detail/RRuntimeContext.hpp | 80 +++++++++++++++++ src/procedure2/CMakeLists.txt | 3 + src/procedure2/IProcedure_Any.cpp | 2 +- .../IProcedure_DPrimitive_gco_2_gco_gco.cpp | 39 +++++++++ src/procedure2/IRuntimeContext_Any.cpp | 41 +++++++++ src/procedure2/init_primitives.cpp | 35 ++++++++ 22 files changed, 667 insertions(+), 25 deletions(-) create mode 100644 idl/IProcedure_DPrimitive_gco_2_gco_gco.json5 create mode 100644 idl/RuntimeContext.json5 create mode 100644 include/xo/procedure2/DPrimitive_gco_2_gco_gco.hpp create mode 100644 include/xo/procedure2/RuntimeContext.hpp create mode 100644 include/xo/procedure2/detail/ARuntimeContext.hpp create mode 100644 include/xo/procedure2/detail/IProcedure_DPrimitive_gco_2_gco_gco.hpp create mode 100644 include/xo/procedure2/detail/IRuntimeContext_Any.hpp create mode 100644 include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp create mode 100644 include/xo/procedure2/detail/RRuntimeContext.hpp create mode 100644 src/procedure2/IProcedure_DPrimitive_gco_2_gco_gco.cpp create mode 100644 src/procedure2/IRuntimeContext_Any.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 8d00f310..acb0bad9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,9 +30,36 @@ xo_add_genfacet( OUTPUT_CPP_DIR src/procedure2 ) +# note: manual target; generated code committed to git +xo_add_genfacet( + TARGET xo-procedure2-facet-runtimecontext + FACET RuntimeContext + INPUT idl/RuntimeContext.json5 + OUTPUT_HPP_DIR include/xo/procedure2 + OUTPUT_IMPL_SUBDIR detail + OUTPUT_CPP_DIR src/procedure2 + ) + +# ---------------------------------------------------------------- + +xo_add_genfacetimpl( + TARGET xo-procedure2-facetimpl-procedure2-primitive_gco_2_gco_gco + FACET_PKG xo_procedure2 + FACET Procedure + REPR DPrimitive_gco_2_gco_gco + INPUT idl/IProcedure_DPrimitive_gco_2_gco_gco.json5 + OUTPUT_HPP_DIR include/xo/procedure2 + OUTPUT_IMPL_SUBDIR detail + OUTPUT_CPP_DIR src/procedure2 +) + add_subdirectory(src/procedure2) #add_subdirectory(utest) +# ---------------------------------------------------------------- + +xo_add_genfacet_all(xo-procedure2-genfacet-all) + # ---------------------------------------------------------------- # cmake export diff --git a/idl/IProcedure_DPrimitive_gco_2_gco_gco.json5 b/idl/IProcedure_DPrimitive_gco_2_gco_gco.json5 new file mode 100644 index 00000000..fb22bad5 --- /dev/null +++ b/idl/IProcedure_DPrimitive_gco_2_gco_gco.json5 @@ -0,0 +1,17 @@ +{ + mode: "implementation", + includes: [ + "", + "", + "", + "", + ], + local_types: [ ], + namespace1: "xo", + namespace2: "scm", + facet_idl: "idl/Procedure.json5", + brief: "provide AProcedure interface for Primitive (gco x gco) -> gco", + using_doxygen: true, + repr: "DPrimitive_gco_2_gco_gco", + doc: [ "implement AProcedure for DPrimitive (gco x gco) -> gco" ], +} diff --git a/idl/Procedure.json5 b/idl/Procedure.json5 index fb43f310..f0eac6b5 100644 --- a/idl/Procedure.json5 +++ b/idl/Procedure.json5 @@ -2,14 +2,19 @@ mode: "facet", // includes in ASyntaxStateMachine.hpp includes: [ + "\"RuntimeContext.hpp\"", + "", ], - // extra includes in SyntaxStateMachine.hpp, if any + // extra includes in Procedure.hpp, if any user_hpp_includes: [ ], namespace1: "xo", namespace2: "scm", // text after includes, before ASyntaxStateMachine - pretext: [ "// {pretex} here" ], + pretext: [ + //"namespace xo { namespace scm { class ARuntimeContext; } }", + "namespace xo { namespace scm { class DArray; } }", + ], facet: "Procedure", detail_subdir: "detail", brief: "abstraction for a schematika procedure i.e. something callable", @@ -18,9 +23,10 @@ "Abstraction for a schematika procedure" ], types: [ - { name: "AGCObject", - definition: "xo::mm::AGCObject", - doc: [ "a gc-aware object" ], + { + name: "AGCObject", + definition: "xo::mm::AGCObject", + doc: [ "a gc-aware object" ], }, // { name: string, doc: [ string ], definition: string }, ], @@ -50,7 +56,7 @@ doc: ["invoke procedure; assume arguments satisfy type system" ], return_type: "obj", args: [ - {type: "obj", name: "mm"}, + {type: "obj", name: "rcx"}, {type: "const DArray *", name: "args"}, ] } diff --git a/idl/RuntimeContext.json5 b/idl/RuntimeContext.json5 new file mode 100644 index 00000000..8a1e125f --- /dev/null +++ b/idl/RuntimeContext.json5 @@ -0,0 +1,43 @@ +{ + mode: "facet", + // includes in ARuntimeContext.hpp + includes: [ + "" + ], + // extra includes in RuntimeContext.hpp, if any + user_hpp_includes: [ + ], + namespace1: "xo", + namespace2: "scm", + // text after includes, before ARuntimeContext + pretext: [ + //"namespace xo { namespace mm { class AAllocator; } }", + ], + facet: "RuntimeContext", + detail_subdir: "detail", + brief: "runtime context for application code. At minimum provides allocator", + using_doxygen: true, + doc: [ + "Runtime application context" + ], + types: [ + { + name: "AAllocator", + definition: "xo::mm::AAllocator", + doc: [ "xo memory allocator" ], + }, + ], + const_methods: [ + { + name: "allocator", + doc: [ "default allocator to use for objects" ], + return_type: "obj", + args: [], + const: true, + noexcept: true, + attributes: [], + }, + ], + nonconst_methods: [ + ], +} diff --git a/include/xo/procedure2/DPrimitive.hpp b/include/xo/procedure2/DPrimitive.hpp index 5e5f996c..106cbed1 100644 --- a/include/xo/procedure2/DPrimitive.hpp +++ b/include/xo/procedure2/DPrimitive.hpp @@ -5,6 +5,7 @@ #pragma once +#include "RuntimeContext.hpp" #include #include #include @@ -61,22 +62,24 @@ namespace xo { bool is_nary() const noexcept { return false; } static constexpr std::int32_t n_args() noexcept { return Traits::n_args; } - obj apply_nocheck(obj mm, const DArray * args) { - return _apply_nocheck(mm, args, - std::make_index_sequence{}); + obj apply_nocheck(obj rcx, const DArray * args) { + return _apply_nocheck(rcx, args, + std::make_index_sequence{}); } private: template - obj _apply_nocheck(obj mm, + obj _apply_nocheck(obj rcx, const DArray * args, std::index_sequence) { using R = typename Traits::return_type; + obj mm = rcx.allocator(); + R result - = fn_(GCObjectConversion>::from_gco(mm, args->at(Is))... - ); + = fn_(rcx, + GCObjectConversion>::from_gco(mm, args->at(Is))... ); return GCObjectConversion::to_gco(mm, result); } diff --git a/include/xo/procedure2/DPrimitive_gco_2_gco_gco.hpp b/include/xo/procedure2/DPrimitive_gco_2_gco_gco.hpp new file mode 100644 index 00000000..24ad3b41 --- /dev/null +++ b/include/xo/procedure2/DPrimitive_gco_2_gco_gco.hpp @@ -0,0 +1,15 @@ +#pragma once + +#include +#include "DPrimitive.hpp" + +namespace xo { + namespace scm { + using xo::mm::AGCObject; + using xo::facet::obj; + + using DPrimitive_gco_2_gco_gco = Primitive (*)(obj, + obj, + obj)>; + } +} diff --git a/include/xo/procedure2/Procedure.hpp b/include/xo/procedure2/Procedure.hpp index 8b2cd91a..784608ed 100644 --- a/include/xo/procedure2/Procedure.hpp +++ b/include/xo/procedure2/Procedure.hpp @@ -2,7 +2,7 @@ * * Generated automagically from ingredients: * 1. code generator: - * [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet] + * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] * arguments: * --input [idl/Procedure.json5] * 2. jinja2 template for facet .hpp file: diff --git a/include/xo/procedure2/RuntimeContext.hpp b/include/xo/procedure2/RuntimeContext.hpp new file mode 100644 index 00000000..3241451b --- /dev/null +++ b/include/xo/procedure2/RuntimeContext.hpp @@ -0,0 +1,22 @@ +/** @file RuntimeContext.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] + * arguments: + * --input [idl/RuntimeContext.json5] + * 2. jinja2 template for facet .hpp file: + * [facet.hpp.j2] + * 3. idl for facet methods + * [idl/RuntimeContext.json5] + **/ + +#pragma once + +#include "detail/ARuntimeContext.hpp" +#include "detail/IRuntimeContext_Any.hpp" +#include "detail/IRuntimeContext_Xfer.hpp" +#include "detail/RRuntimeContext.hpp" + + +/* end RuntimeContext.hpp */ \ No newline at end of file diff --git a/include/xo/procedure2/detail/AProcedure.hpp b/include/xo/procedure2/detail/AProcedure.hpp index c0b22f49..63a4da9b 100644 --- a/include/xo/procedure2/detail/AProcedure.hpp +++ b/include/xo/procedure2/detail/AProcedure.hpp @@ -2,7 +2,7 @@ * * Generated automagically from ingredients: * 1. code generator: - * [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet] + * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] * arguments: * --input [idl/Procedure.json5] * 2. jinja2 template for abstract facet .hpp file: @@ -14,11 +14,13 @@ #pragma once // includes (via {facet_includes}) +#include "RuntimeContext.hpp" +#include #include #include #include -// {pretex} here +namespace xo { namespace scm { class DArray; } } namespace xo { namespace scm { @@ -54,7 +56,7 @@ public: // nonconst methods /** invoke procedure; assume arguments satisfy type system **/ - virtual obj apply_nocheck(Opaque data, obj mm, const DArray * args) = 0; + virtual obj apply_nocheck(Opaque data, obj rcx, const DArray * args) = 0; ///@} }; /*AProcedure*/ diff --git a/include/xo/procedure2/detail/ARuntimeContext.hpp b/include/xo/procedure2/detail/ARuntimeContext.hpp new file mode 100644 index 00000000..4e96bc8f --- /dev/null +++ b/include/xo/procedure2/detail/ARuntimeContext.hpp @@ -0,0 +1,73 @@ +/** @file ARuntimeContext.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] + * arguments: + * --input [idl/RuntimeContext.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [abstract_facet.hpp.j2] + * 3. idl for facet methods + * [idl/RuntimeContext.json5] + **/ + +#pragma once + +// includes (via {facet_includes}) +#include +#include +#include +#include + + +namespace xo { +namespace scm { + +using Copaque = const void *; +using Opaque = void *; + +/** +Runtime application context +**/ +class ARuntimeContext { +public: + /** @defgroup scm-runtimecontext-type-traits **/ + ///@{ + // types + /** integer identifying a type **/ + using typeseq = xo::facet::typeseq; + using Copaque = const void *; + using Opaque = void *; + /** xo memory allocator **/ + using AAllocator = xo::mm::AAllocator; + ///@} + + /** @defgroup scm-runtimecontext-methods **/ + ///@{ + // const methods + /** RTTI: unique id# for actual runtime data representation **/ + virtual typeseq _typeseq() const noexcept = 0; + /** default allocator to use for objects **/ + virtual obj allocator(Copaque data) const noexcept = 0; + + // nonconst methods + ///@} +}; /*ARuntimeContext*/ + +/** Implementation IRuntimeContext_DRepr of ARuntimeContext for state DRepr + * should provide a specialization: + * + * template <> + * struct xo::facet::FacetImplementation { + * using Impltype = IRuntimeContext_DRepr; + * }; + * + * then IRuntimeContext_ImplType --> IRuntimeContext_DRepr + **/ +template +using IRuntimeContext_ImplType = xo::facet::FacetImplType; + +} /*namespace scm*/ +} /*namespace xo*/ + +/* ARuntimeContext.hpp */ \ No newline at end of file diff --git a/include/xo/procedure2/detail/IProcedure_Any.hpp b/include/xo/procedure2/detail/IProcedure_Any.hpp index c1b8c9d6..5d711d4c 100644 --- a/include/xo/procedure2/detail/IProcedure_Any.hpp +++ b/include/xo/procedure2/detail/IProcedure_Any.hpp @@ -2,7 +2,7 @@ * * Generated automagically from ingredients: * 1. code generator: - * [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet] + * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] * arguments: * --input [idl/Procedure.json5] * 2. jinja2 template for abstract facet .hpp file: @@ -60,7 +60,7 @@ namespace scm { [[noreturn]] std::int32_t n_args(Copaque) const noexcept override { _fatal(); } // nonconst methods - [[noreturn]] obj apply_nocheck(Opaque, obj, const DArray *) override; + [[noreturn]] obj apply_nocheck(Opaque, obj, const DArray *) override; ///@} diff --git a/include/xo/procedure2/detail/IProcedure_DPrimitive_gco_2_gco_gco.hpp b/include/xo/procedure2/detail/IProcedure_DPrimitive_gco_2_gco_gco.hpp new file mode 100644 index 00000000..11f2cd60 --- /dev/null +++ b/include/xo/procedure2/detail/IProcedure_DPrimitive_gco_2_gco_gco.hpp @@ -0,0 +1,67 @@ +/** @file IProcedure_DPrimitive_gco_2_gco_gco.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IProcedure_DPrimitive_gco_2_gco_gco.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_repr.hpp.j2] + * 3. idl for facet methods + * [idl/IProcedure_DPrimitive_gco_2_gco_gco.json5] + **/ + +#pragma once + +#include "Procedure.hpp" +#include +#include +#include +#include +#include "DPrimitive_gco_2_gco_gco.hpp" + +namespace xo { namespace scm { class IProcedure_DPrimitive_gco_2_gco_gco; } } + +namespace xo { + namespace facet { + template <> + struct FacetImplementation + { + using ImplType = xo::scm::IProcedure_Xfer + ; + }; + } +} + +namespace xo { + namespace scm { + /** @class IProcedure_DPrimitive_gco_2_gco_gco + **/ + class IProcedure_DPrimitive_gco_2_gco_gco { + public: + /** @defgroup scm-procedure-dprimitive_gco_2_gco_gco-type-traits **/ + ///@{ + using AGCObject = xo::scm::AProcedure::AGCObject; + using Copaque = xo::scm::AProcedure::Copaque; + using Opaque = xo::scm::AProcedure::Opaque; + ///@} + /** @defgroup scm-procedure-dprimitive_gco_2_gco_gco-methods **/ + ///@{ + // const methods + /** true iff procedure takes n arguments **/ + static bool is_nary(const DPrimitive_gco_2_gco_gco & self) noexcept; + /** number of arguments. -1 for n-ary **/ + static std::int32_t n_args(const DPrimitive_gco_2_gco_gco & self) noexcept; + + // non-const methods + /** invoke procedure; assume arguments satisfy type system **/ + static obj apply_nocheck(DPrimitive_gco_2_gco_gco & self, obj rcx, const DArray * args); + ///@} + }; + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end */ \ No newline at end of file diff --git a/include/xo/procedure2/detail/IProcedure_Xfer.hpp b/include/xo/procedure2/detail/IProcedure_Xfer.hpp index dfe8a558..4f84652e 100644 --- a/include/xo/procedure2/detail/IProcedure_Xfer.hpp +++ b/include/xo/procedure2/detail/IProcedure_Xfer.hpp @@ -2,7 +2,7 @@ * * Generated automagically from ingredients: * 1. code generator: - * [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet] + * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] * arguments: * --input [idl/Procedure.json5] * 2. jinja2 template for abstract facet .hpp file: @@ -13,6 +13,8 @@ #pragma once +#include "RuntimeContext.hpp" +#include namespace xo { namespace scm { @@ -48,8 +50,8 @@ namespace scm { } // non-const methods - obj apply_nocheck(Opaque data, obj mm, const DArray * args) override { - return I::apply_nocheck(_dcast(data), mm, args); + obj apply_nocheck(Opaque data, obj rcx, const DArray * args) override { + return I::apply_nocheck(_dcast(data), rcx, args); } ///@} diff --git a/include/xo/procedure2/detail/IRuntimeContext_Any.hpp b/include/xo/procedure2/detail/IRuntimeContext_Any.hpp new file mode 100644 index 00000000..1e5f97c0 --- /dev/null +++ b/include/xo/procedure2/detail/IRuntimeContext_Any.hpp @@ -0,0 +1,86 @@ +/** @file IRuntimeContext_Any.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] + * arguments: + * --input [idl/RuntimeContext.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/RuntimeContext.json5] + **/ + +#pragma once + +#include "ARuntimeContext.hpp" +#include + +namespace xo { namespace scm { class IRuntimeContext_Any; } } + +namespace xo { +namespace facet { + +template <> +struct FacetImplementation +{ + using ImplType = xo::scm::IRuntimeContext_Any; +}; + +} +} + +namespace xo { +namespace scm { + + /** @class IRuntimeContext_Any + * @brief ARuntimeContext implementation for empty variant instance + **/ + class IRuntimeContext_Any : public ARuntimeContext { + public: + /** @defgroup scm-runtimecontext-any-type-traits **/ + ///@{ + + /** integer identifying a type **/ + using typeseq = xo::facet::typeseq; + using AAllocator = ARuntimeContext::AAllocator; + + ///@} + /** @defgroup scm-runtimecontext-any-methods **/ + ///@{ + + const ARuntimeContext * iface() const { return std::launder(this); } + + // from ARuntimeContext + + // const methods + typeseq _typeseq() const noexcept override { return s_typeseq; } + [[noreturn]] obj allocator(Copaque) const noexcept override { _fatal(); } + + // nonconst methods + + ///@} + + private: + /** @defgraoup scm-runtimecontext-any-private-methods **/ + ///@{ + + [[noreturn]] static void _fatal(); + + ///@} + + public: + /** @defgroup scm-runtimecontext-any-member-vars **/ + ///@{ + + static typeseq s_typeseq; + static bool _valid; + + ///@} + }; + +} /*namespace scm */ +} /*namespace xo */ + +/* IRuntimeContext_Any.hpp */ \ No newline at end of file diff --git a/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp b/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp new file mode 100644 index 00000000..cd71b73e --- /dev/null +++ b/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp @@ -0,0 +1,81 @@ +/** @file IRuntimeContext_Xfer.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] + * arguments: + * --input [idl/RuntimeContext.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/RuntimeContext.json5] + **/ + +#pragma once + +#include + +namespace xo { +namespace scm { + /** @class IRuntimeContext_Xfer + **/ + template + class IRuntimeContext_Xfer : public ARuntimeContext { + public: + /** @defgroup scm-runtimecontext-xfer-type-traits **/ + ///@{ + /** actual implementation (not generated; often delegates to DRepr) **/ + using Impl = IRuntimeContext_DRepr; + /** integer identifying a type **/ + using typeseq = ARuntimeContext::typeseq; + using AAllocator = ARuntimeContext::AAllocator; + ///@} + + /** @defgroup scm-runtimecontext-xfer-methods **/ + ///@{ + + static const DRepr & _dcast(Copaque d) { return *(const DRepr *)d; } + static DRepr & _dcast(Opaque d) { return *(DRepr *)d; } + + // from ARuntimeContext + + // const methods + typeseq _typeseq() const noexcept override { return s_typeseq; } + obj allocator(Copaque data) const noexcept override { + return I::allocator(_dcast(data)); + } + + // non-const methods + + ///@} + + private: + using I = Impl; + + public: + /** @defgroup scm-runtimecontext-xfer-member-vars **/ + ///@{ + + /** typeseq for template parameter DRepr **/ + static typeseq s_typeseq; + /** true iff satisfies facet implementation **/ + static bool _valid; + + ///@} + }; + + template + xo::facet::typeseq + IRuntimeContext_Xfer::s_typeseq + = xo::facet::typeseq::id(); + + template + bool + IRuntimeContext_Xfer::_valid + = xo::facet::valid_facet_implementation(); + +} /*namespace scm */ +} /*namespace xo*/ + +/* end IRuntimeContext_Xfer.hpp */ \ No newline at end of file diff --git a/include/xo/procedure2/detail/RProcedure.hpp b/include/xo/procedure2/detail/RProcedure.hpp index dc0f30d8..93599ae3 100644 --- a/include/xo/procedure2/detail/RProcedure.hpp +++ b/include/xo/procedure2/detail/RProcedure.hpp @@ -2,7 +2,7 @@ * * Generated automagically from ingredients: * 1. code generator: - * [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet] + * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] * arguments: * --input [idl/Procedure.json5] * 2. jinja2 template for abstract facet .hpp file: @@ -56,8 +56,8 @@ public: } // non-const methods (still const in router!) - obj apply_nocheck(obj mm, const DArray * args) { - return O::iface()->apply_nocheck(O::data(), mm, args); + obj apply_nocheck(obj rcx, const DArray * args) { + return O::iface()->apply_nocheck(O::data(), rcx, args); } ///@} diff --git a/include/xo/procedure2/detail/RRuntimeContext.hpp b/include/xo/procedure2/detail/RRuntimeContext.hpp new file mode 100644 index 00000000..b06227c8 --- /dev/null +++ b/include/xo/procedure2/detail/RRuntimeContext.hpp @@ -0,0 +1,80 @@ +/** @file RRuntimeContext.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] + * arguments: + * --input [idl/RuntimeContext.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/RuntimeContext.json5] + **/ + +#pragma once + +#include "ARuntimeContext.hpp" + +namespace xo { +namespace scm { + +/** @class RRuntimeContext + **/ +template +class RRuntimeContext : public Object { +private: + using O = Object; + +public: + /** @defgroup scm-runtimecontext-router-type-traits **/ + ///@{ + using ObjectType = Object; + using DataPtr = Object::DataPtr; + using typeseq = xo::reflect::typeseq; + using AAllocator = ARuntimeContext::AAllocator; + ///@} + + /** @defgroup scm-runtimecontext-router-ctors **/ + ///@{ + RRuntimeContext() {} + RRuntimeContext(Object::DataPtr data) : Object{std::move(data)} {} + RRuntimeContext(const ARuntimeContext * iface, void * data) + requires std::is_same_v + : Object(iface, data) {} + + ///@} + /** @defgroup scm-runtimecontext-router-methods **/ + ///@{ + + // const methods + typeseq _typeseq() const noexcept { return O::iface()->_typeseq(); } + obj allocator() const noexcept { + return O::iface()->allocator(O::data()); + } + + // non-const methods (still const in router!) + + ///@} + /** @defgroup scm-runtimecontext-member-vars **/ + ///@{ + + static bool _valid; + + ///@} +}; + +template +bool +RRuntimeContext::_valid = xo::facet::valid_object_router(); + +} /*namespace scm*/ +} /*namespace xo*/ + +namespace xo { namespace facet { + template + struct RoutingFor { + using RoutingType = xo::scm::RRuntimeContext; + }; +} } + +/* end RRuntimeContext.hpp */ \ No newline at end of file diff --git a/src/procedure2/CMakeLists.txt b/src/procedure2/CMakeLists.txt index edc5d3ce..11a9c305 100644 --- a/src/procedure2/CMakeLists.txt +++ b/src/procedure2/CMakeLists.txt @@ -5,6 +5,9 @@ set(SELF_SRCS init_procedure2.cpp init_primitives.cpp DPrimitive.cpp + IRuntimeContext_Any.cpp + IProcedure_Any.cpp + IProcedure_DPrimitive_gco_2_gco_gco.cpp # Add source files here, e.g.: # procedure2.cpp ) diff --git a/src/procedure2/IProcedure_Any.cpp b/src/procedure2/IProcedure_Any.cpp index 3044c104..d28d98ee 100644 --- a/src/procedure2/IProcedure_Any.cpp +++ b/src/procedure2/IProcedure_Any.cpp @@ -35,7 +35,7 @@ IProcedure_Any::_valid // nonconst methods auto -IProcedure_Any::apply_nocheck(Opaque, obj, const DArray *) -> obj +IProcedure_Any::apply_nocheck(Opaque, obj, const DArray *) -> obj { _fatal(); } diff --git a/src/procedure2/IProcedure_DPrimitive_gco_2_gco_gco.cpp b/src/procedure2/IProcedure_DPrimitive_gco_2_gco_gco.cpp new file mode 100644 index 00000000..67e73c97 --- /dev/null +++ b/src/procedure2/IProcedure_DPrimitive_gco_2_gco_gco.cpp @@ -0,0 +1,39 @@ +/** @file IProcedure_DPrimitive_gco_2_gco_gco.cpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IProcedure_DPrimitive_gco_2_gco_gco.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/IProcedure_DPrimitive_gco_2_gco_gco.json5] +**/ + +#include "detail/IProcedure_DPrimitive_gco_2_gco_gco.hpp" + +namespace xo { + namespace scm { + auto + IProcedure_DPrimitive_gco_2_gco_gco::is_nary(const DPrimitive_gco_2_gco_gco & self) noexcept -> bool + { + return self.is_nary(); + } + + auto + IProcedure_DPrimitive_gco_2_gco_gco::n_args(const DPrimitive_gco_2_gco_gco & self) noexcept -> std::int32_t + { + return self.n_args(); + } + + auto + IProcedure_DPrimitive_gco_2_gco_gco::apply_nocheck(DPrimitive_gco_2_gco_gco & self, obj rcx, const DArray * args) -> obj + { + return self.apply_nocheck(rcx, args); + } + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end IProcedure_DPrimitive_gco_2_gco_gco.cpp */ \ No newline at end of file diff --git a/src/procedure2/IRuntimeContext_Any.cpp b/src/procedure2/IRuntimeContext_Any.cpp new file mode 100644 index 00000000..a9c5b55a --- /dev/null +++ b/src/procedure2/IRuntimeContext_Any.cpp @@ -0,0 +1,41 @@ +/** @file IRuntimeContext_Any.cpp + * + **/ + +#include "detail/IRuntimeContext_Any.hpp" +#include + +namespace xo { +namespace scm { + +using xo::facet::DVariantPlaceholder; +using xo::facet::typeseq; +using xo::facet::valid_facet_implementation; + +void +IRuntimeContext_Any::_fatal() +{ + /* control here on uninitialized IAllocator_Any. + * Initialized instance will have specific implementation type + */ + std::cerr << "fatal" + << ": attempt to call uninitialized" + << " IRuntimeContext_Any method" + << std::endl; + std::terminate(); +} + +typeseq +IRuntimeContext_Any::s_typeseq = typeseq::id(); + +bool +IRuntimeContext_Any::_valid + = valid_facet_implementation(); + +// nonconst methods + + +} /*namespace scm*/ +} /*namespace xo*/ + +/* end IRuntimeContext_Any.cpp */ \ No newline at end of file diff --git a/src/procedure2/init_primitives.cpp b/src/procedure2/init_primitives.cpp index 169b660e..35709e0f 100644 --- a/src/procedure2/init_primitives.cpp +++ b/src/procedure2/init_primitives.cpp @@ -5,6 +5,7 @@ #include "init_primitives.hpp" #include "DPrimitive.hpp" +#include namespace xo { namespace scm { @@ -23,6 +24,40 @@ namespace xo { return x - y; } +#ifdef NOT_YET + obj + mul_any_any(obj x_gco, obj y_gco) + { + // PLACEHOLDER + + // TODO: + // 1. move this to xo-numeric2/ when available + // 2. at that point will require polymorphic dispatch + // on argument representations, analogous to dispatch + // in FacetRegistry + // 3. Need concept of a 'runtime context'. + // This will need to be part of the AProcedure api + // e.g. passed to apply_nocheck + + typeseq x_tseq = x_gco._typeseq(); + typeseq y_tseq = y_gco._typeseq(); + + // FOR NOW: just test runtime values + // + if (x_tseq == typeseq::id()) { + if (y_tseq == typeseq::id()) { + // unusable placeholder allocator; + obj placeholder_mm; + + // f64 * f64. + double x = GCObjectConversion::from_gco(placeholder_mm, x_gco); + double y = GCObjectConversion::from_gco(placeholder_mm, y_gco); + + + + } +#endif + double mul_f64_f64(double x, double y) { return x * y; From d39e13593c724f91cd92119c17195eddd64faee2 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Mon, 26 Jan 2026 12:38:17 -0500 Subject: [PATCH 03/90] xo-procedure2 xo-object2: + polymorphic primitive support --- doc/implementation.rst | 25 +++++++ idl/Procedure.json5 | 1 - include/xo/procedure2/DPrimitive.hpp | 18 +++-- include/xo/procedure2/Procedure.hpp | 2 +- include/xo/procedure2/RuntimeContext.hpp | 2 +- include/xo/procedure2/detail/AProcedure.hpp | 4 +- .../xo/procedure2/detail/ARuntimeContext.hpp | 2 +- .../xo/procedure2/detail/IProcedure_Any.hpp | 4 +- .../IProcedure_DPrimitive_gco_2_gco_gco.hpp | 4 +- .../xo/procedure2/detail/IProcedure_Xfer.hpp | 6 +- .../procedure2/detail/IRuntimeContext_Any.hpp | 2 +- .../detail/IRuntimeContext_Xfer.hpp | 2 +- include/xo/procedure2/detail/RProcedure.hpp | 6 +- .../xo/procedure2/detail/RRuntimeContext.hpp | 2 +- include/xo/procedure2/init_primitives.hpp | 7 ++ src/procedure2/IProcedure_Any.cpp | 2 +- .../IProcedure_DPrimitive_gco_2_gco_gco.cpp | 6 +- src/procedure2/init_primitives.cpp | 70 ++++++++++++++++--- 18 files changed, 126 insertions(+), 39 deletions(-) create mode 100644 doc/implementation.rst diff --git a/doc/implementation.rst b/doc/implementation.rst new file mode 100644 index 00000000..418dc759 --- /dev/null +++ b/doc/implementation.rst @@ -0,0 +1,25 @@ +.. _implementation: + +.. toctree:: + :maxdepth: 2 + +Components +========== + +Library dependency tower for *xo-procedure2* + +.. ditaa:: + + +--------------------------------+ + | xo_gc | + +--------------------------------+ + | xo_alloc2 | + +--------------------------------+ + | xo_facet | + +----------------+---------------+ + | xo_reflectutil | xo_indentlog | + +----------------+---------------+ + | xo_cmake | + +--------------------------------+ + +Expect to have xo_facet depending on xo_arena instead of using std::unordered_map diff --git a/idl/Procedure.json5 b/idl/Procedure.json5 index f0eac6b5..f26a4e56 100644 --- a/idl/Procedure.json5 +++ b/idl/Procedure.json5 @@ -56,7 +56,6 @@ doc: ["invoke procedure; assume arguments satisfy type system" ], return_type: "obj", args: [ - {type: "obj", name: "rcx"}, {type: "const DArray *", name: "args"}, ] } diff --git a/include/xo/procedure2/DPrimitive.hpp b/include/xo/procedure2/DPrimitive.hpp index 106cbed1..cf913a15 100644 --- a/include/xo/procedure2/DPrimitive.hpp +++ b/include/xo/procedure2/DPrimitive.hpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -62,24 +63,29 @@ namespace xo { bool is_nary() const noexcept { return false; } static constexpr std::int32_t n_args() noexcept { return Traits::n_args; } - obj apply_nocheck(obj rcx, const DArray * args) { - return _apply_nocheck(rcx, args, + obj apply_nocheck(const DArray * args) { + return _apply_nocheck(args, std::make_index_sequence{}); } private: template - obj _apply_nocheck(obj rcx, - const DArray * args, + obj _apply_nocheck(const DArray * args, std::index_sequence) { + using xo::facet::FacetRegistry; + using R = typename Traits::return_type; + assert(args); + assert(args->size() > 0); + + obj rcx + = FacetRegistry::instance().variant(args->at(0)); obj mm = rcx.allocator(); R result - = fn_(rcx, - GCObjectConversion>::from_gco(mm, args->at(Is))... ); + = fn_(GCObjectConversion>::from_gco(mm, args->at(Is))... ); return GCObjectConversion::to_gco(mm, result); } diff --git a/include/xo/procedure2/Procedure.hpp b/include/xo/procedure2/Procedure.hpp index 784608ed..8b2cd91a 100644 --- a/include/xo/procedure2/Procedure.hpp +++ b/include/xo/procedure2/Procedure.hpp @@ -2,7 +2,7 @@ * * Generated automagically from ingredients: * 1. code generator: - * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] + * [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet] * arguments: * --input [idl/Procedure.json5] * 2. jinja2 template for facet .hpp file: diff --git a/include/xo/procedure2/RuntimeContext.hpp b/include/xo/procedure2/RuntimeContext.hpp index 3241451b..2e8300ed 100644 --- a/include/xo/procedure2/RuntimeContext.hpp +++ b/include/xo/procedure2/RuntimeContext.hpp @@ -2,7 +2,7 @@ * * Generated automagically from ingredients: * 1. code generator: - * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] + * [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet] * arguments: * --input [idl/RuntimeContext.json5] * 2. jinja2 template for facet .hpp file: diff --git a/include/xo/procedure2/detail/AProcedure.hpp b/include/xo/procedure2/detail/AProcedure.hpp index 63a4da9b..1be5e0d1 100644 --- a/include/xo/procedure2/detail/AProcedure.hpp +++ b/include/xo/procedure2/detail/AProcedure.hpp @@ -2,7 +2,7 @@ * * Generated automagically from ingredients: * 1. code generator: - * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] + * [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet] * arguments: * --input [idl/Procedure.json5] * 2. jinja2 template for abstract facet .hpp file: @@ -56,7 +56,7 @@ public: // nonconst methods /** invoke procedure; assume arguments satisfy type system **/ - virtual obj apply_nocheck(Opaque data, obj rcx, const DArray * args) = 0; + virtual obj apply_nocheck(Opaque data, const DArray * args) = 0; ///@} }; /*AProcedure*/ diff --git a/include/xo/procedure2/detail/ARuntimeContext.hpp b/include/xo/procedure2/detail/ARuntimeContext.hpp index 4e96bc8f..42030d9d 100644 --- a/include/xo/procedure2/detail/ARuntimeContext.hpp +++ b/include/xo/procedure2/detail/ARuntimeContext.hpp @@ -2,7 +2,7 @@ * * Generated automagically from ingredients: * 1. code generator: - * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] + * [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet] * arguments: * --input [idl/RuntimeContext.json5] * 2. jinja2 template for abstract facet .hpp file: diff --git a/include/xo/procedure2/detail/IProcedure_Any.hpp b/include/xo/procedure2/detail/IProcedure_Any.hpp index 5d711d4c..3f66fcd5 100644 --- a/include/xo/procedure2/detail/IProcedure_Any.hpp +++ b/include/xo/procedure2/detail/IProcedure_Any.hpp @@ -2,7 +2,7 @@ * * Generated automagically from ingredients: * 1. code generator: - * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] + * [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet] * arguments: * --input [idl/Procedure.json5] * 2. jinja2 template for abstract facet .hpp file: @@ -60,7 +60,7 @@ namespace scm { [[noreturn]] std::int32_t n_args(Copaque) const noexcept override { _fatal(); } // nonconst methods - [[noreturn]] obj apply_nocheck(Opaque, obj, const DArray *) override; + [[noreturn]] obj apply_nocheck(Opaque, const DArray *) override; ///@} diff --git a/include/xo/procedure2/detail/IProcedure_DPrimitive_gco_2_gco_gco.hpp b/include/xo/procedure2/detail/IProcedure_DPrimitive_gco_2_gco_gco.hpp index 11f2cd60..4b4351dd 100644 --- a/include/xo/procedure2/detail/IProcedure_DPrimitive_gco_2_gco_gco.hpp +++ b/include/xo/procedure2/detail/IProcedure_DPrimitive_gco_2_gco_gco.hpp @@ -2,7 +2,7 @@ * * Generated automagically from ingredients: * 1. code generator: - * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] + * [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet] * arguments: * --input [idl/IProcedure_DPrimitive_gco_2_gco_gco.json5] * 2. jinja2 template for abstract facet .hpp file: @@ -57,7 +57,7 @@ namespace xo { // non-const methods /** invoke procedure; assume arguments satisfy type system **/ - static obj apply_nocheck(DPrimitive_gco_2_gco_gco & self, obj rcx, const DArray * args); + static obj apply_nocheck(DPrimitive_gco_2_gco_gco & self, const DArray * args); ///@} }; diff --git a/include/xo/procedure2/detail/IProcedure_Xfer.hpp b/include/xo/procedure2/detail/IProcedure_Xfer.hpp index 4f84652e..adf4995d 100644 --- a/include/xo/procedure2/detail/IProcedure_Xfer.hpp +++ b/include/xo/procedure2/detail/IProcedure_Xfer.hpp @@ -2,7 +2,7 @@ * * Generated automagically from ingredients: * 1. code generator: - * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] + * [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet] * arguments: * --input [idl/Procedure.json5] * 2. jinja2 template for abstract facet .hpp file: @@ -50,8 +50,8 @@ namespace scm { } // non-const methods - obj apply_nocheck(Opaque data, obj rcx, const DArray * args) override { - return I::apply_nocheck(_dcast(data), rcx, args); + obj apply_nocheck(Opaque data, const DArray * args) override { + return I::apply_nocheck(_dcast(data), args); } ///@} diff --git a/include/xo/procedure2/detail/IRuntimeContext_Any.hpp b/include/xo/procedure2/detail/IRuntimeContext_Any.hpp index 1e5f97c0..419d45cc 100644 --- a/include/xo/procedure2/detail/IRuntimeContext_Any.hpp +++ b/include/xo/procedure2/detail/IRuntimeContext_Any.hpp @@ -2,7 +2,7 @@ * * Generated automagically from ingredients: * 1. code generator: - * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] + * [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet] * arguments: * --input [idl/RuntimeContext.json5] * 2. jinja2 template for abstract facet .hpp file: diff --git a/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp b/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp index cd71b73e..e9f5512e 100644 --- a/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp +++ b/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp @@ -2,7 +2,7 @@ * * Generated automagically from ingredients: * 1. code generator: - * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] + * [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet] * arguments: * --input [idl/RuntimeContext.json5] * 2. jinja2 template for abstract facet .hpp file: diff --git a/include/xo/procedure2/detail/RProcedure.hpp b/include/xo/procedure2/detail/RProcedure.hpp index 93599ae3..9fff0c6c 100644 --- a/include/xo/procedure2/detail/RProcedure.hpp +++ b/include/xo/procedure2/detail/RProcedure.hpp @@ -2,7 +2,7 @@ * * Generated automagically from ingredients: * 1. code generator: - * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] + * [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet] * arguments: * --input [idl/Procedure.json5] * 2. jinja2 template for abstract facet .hpp file: @@ -56,8 +56,8 @@ public: } // non-const methods (still const in router!) - obj apply_nocheck(obj rcx, const DArray * args) { - return O::iface()->apply_nocheck(O::data(), rcx, args); + obj apply_nocheck(const DArray * args) { + return O::iface()->apply_nocheck(O::data(), args); } ///@} diff --git a/include/xo/procedure2/detail/RRuntimeContext.hpp b/include/xo/procedure2/detail/RRuntimeContext.hpp index b06227c8..06b093de 100644 --- a/include/xo/procedure2/detail/RRuntimeContext.hpp +++ b/include/xo/procedure2/detail/RRuntimeContext.hpp @@ -2,7 +2,7 @@ * * Generated automagically from ingredients: * 1. code generator: - * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] + * [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet] * arguments: * --input [idl/RuntimeContext.json5] * 2. jinja2 template for abstract facet .hpp file: diff --git a/include/xo/procedure2/init_primitives.hpp b/include/xo/procedure2/init_primitives.hpp index d4150d2d..5e2d08e8 100644 --- a/include/xo/procedure2/init_primitives.hpp +++ b/include/xo/procedure2/init_primitives.hpp @@ -3,13 +3,19 @@ #pragma once #include "DPrimitive.hpp" +#include "DPrimitive_gco_2_gco_gco.hpp" namespace xo { namespace scm { +#ifdef NOT_YET using Primitive_f64_1_f64 = Primitive; using Primitive_f64_2_f64_f64 = Primitive; +#endif struct Primitives { + static DPrimitive_gco_2_gco_gco s_mul_gco_gco_pm; + +#ifdef NOT_YET static Primitive_f64_1_f64 s_neg_f64_pm; static Primitive_f64_2_f64_f64 s_add_f64_f64_pm; @@ -22,6 +28,7 @@ namespace xo { static Primitive_f64_1_f64 s_sin_f64_pm; static Primitive_f64_1_f64 s_cos_f64_pm; static Primitive_f64_1_f64 s_tan_f64_pm; +#endif }; } } diff --git a/src/procedure2/IProcedure_Any.cpp b/src/procedure2/IProcedure_Any.cpp index d28d98ee..79b3b778 100644 --- a/src/procedure2/IProcedure_Any.cpp +++ b/src/procedure2/IProcedure_Any.cpp @@ -35,7 +35,7 @@ IProcedure_Any::_valid // nonconst methods auto -IProcedure_Any::apply_nocheck(Opaque, obj, const DArray *) -> obj +IProcedure_Any::apply_nocheck(Opaque, const DArray *) -> obj { _fatal(); } diff --git a/src/procedure2/IProcedure_DPrimitive_gco_2_gco_gco.cpp b/src/procedure2/IProcedure_DPrimitive_gco_2_gco_gco.cpp index 67e73c97..5266477c 100644 --- a/src/procedure2/IProcedure_DPrimitive_gco_2_gco_gco.cpp +++ b/src/procedure2/IProcedure_DPrimitive_gco_2_gco_gco.cpp @@ -2,7 +2,7 @@ * * Generated automagically from ingredients: * 1. code generator: - * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] + * [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet] * arguments: * --input [idl/IProcedure_DPrimitive_gco_2_gco_gco.json5] * 2. jinja2 template for abstract facet .hpp file: @@ -28,9 +28,9 @@ namespace xo { } auto - IProcedure_DPrimitive_gco_2_gco_gco::apply_nocheck(DPrimitive_gco_2_gco_gco & self, obj rcx, const DArray * args) -> obj + IProcedure_DPrimitive_gco_2_gco_gco::apply_nocheck(DPrimitive_gco_2_gco_gco & self, const DArray * args) -> obj { - return self.apply_nocheck(rcx, args); + return self.apply_nocheck(args); } } /*namespace scm*/ diff --git a/src/procedure2/init_primitives.cpp b/src/procedure2/init_primitives.cpp index 35709e0f..dbcb3b35 100644 --- a/src/procedure2/init_primitives.cpp +++ b/src/procedure2/init_primitives.cpp @@ -5,10 +5,23 @@ #include "init_primitives.hpp" #include "DPrimitive.hpp" +#include +#include +#include +#include +#include +#include +#include +#include #include namespace xo { + using xo::mm::AAllocator; + using xo::scm::DFloat; + using xo::facet::with_facet; + namespace scm { +#ifdef NOT_YET double neg_f64(double x) { return -x; @@ -23,11 +36,17 @@ namespace xo { sub_f64_f64(double x, double y) { return x - y; } +#endif -#ifdef NOT_YET obj - mul_any_any(obj x_gco, obj y_gco) + mul_gco_gco(obj rcx, + obj x_gco, + obj y_gco) { + using xo::reflect::typeseq; + + obj mm = rcx.allocator(); + // PLACEHOLDER // TODO: @@ -44,20 +63,45 @@ namespace xo { // FOR NOW: just test runtime values // - if (x_tseq == typeseq::id()) { - if (y_tseq == typeseq::id()) { - // unusable placeholder allocator; - obj placeholder_mm; + if (x_tseq == typeseq::id()) { + // i64 * .. + long x = GCObjectConversion::from_gco(mm, x_gco); + if (y_tseq == typeseq::id()) { + // i64 * i64 + long y = GCObjectConversion::from_gco(mm, y_gco); + + return DInteger::box(mm, x * y); + } else if (y_tseq == typeseq::id()) { + // i64 * f64 + double y = GCObjectConversion::from_gco(mm, y_gco); + + return DFloat::box(mm, x * y); + } + } else if (x_tseq == typeseq::id()) { + if (y_tseq == typeseq::id()) { + // f64 * i64. + double x = GCObjectConversion::from_gco(mm, x_gco); + long y = GCObjectConversion::from_gco(mm, y_gco); + + return DFloat::box(mm, x * y); + } else if (y_tseq == typeseq::id()) { // f64 * f64. - double x = GCObjectConversion::from_gco(placeholder_mm, x_gco); - double y = GCObjectConversion::from_gco(placeholder_mm, y_gco); - + double x = GCObjectConversion::from_gco(mm, x_gco); + double y = GCObjectConversion::from_gco(mm, y_gco); + return DFloat::box(mm, x * y); + } + } + // here: error + throw std::runtime_error(tostr("mul_gco_gco: unexpected argument types xt,yt", + xtag("x.tseq", x_tseq), + xtag("y.tseq", y_tseq))); + return obj(); } -#endif +#ifdef NOT_YET double mul_f64_f64(double x, double y) { return x * y; @@ -92,7 +136,12 @@ namespace xo { tan_f64(double x) { return ::tan(x); } +#endif + DPrimitive_gco_2_gco_gco + Primitives::s_mul_gco_gco_pm("_mul", &mul_gco_gco); + +#ifdef NOT_YET Primitive_f64_1_f64 Primitives::s_neg_f64_pm("_neg_d", &neg_f64); @@ -123,6 +172,7 @@ namespace xo { Primitive_f64_1_f64 Primitives::s_tan_f64_pm("_tan_d", &tan_f64); +#endif } /*namespace scm*/ } /*namespace xo*/ From 6acc676d430ba0b394189aeaeaea18423b2d39bf Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Mon, 26 Jan 2026 13:42:42 -0500 Subject: [PATCH 04/90] xo-expression2 xo-procedure2: work on calling primitive for x*y --- idl/Procedure.json5 | 5 ++ include/xo/procedure2/DPrimitive.hpp | 78 ++++++++++--------- .../procedure2/DPrimitive_gco_2_gco_gco.hpp | 7 ++ include/xo/procedure2/Procedure.hpp | 2 +- include/xo/procedure2/RuntimeContext.hpp | 2 +- include/xo/procedure2/detail/AProcedure.hpp | 4 +- .../xo/procedure2/detail/ARuntimeContext.hpp | 2 +- .../xo/procedure2/detail/IProcedure_Any.hpp | 4 +- .../IProcedure_DPrimitive_gco_2_gco_gco.hpp | 4 +- .../xo/procedure2/detail/IProcedure_Xfer.hpp | 6 +- .../procedure2/detail/IRuntimeContext_Any.hpp | 2 +- .../detail/IRuntimeContext_Xfer.hpp | 2 +- include/xo/procedure2/detail/RProcedure.hpp | 6 +- .../xo/procedure2/detail/RRuntimeContext.hpp | 2 +- src/procedure2/IProcedure_Any.cpp | 2 +- .../IProcedure_DPrimitive_gco_2_gco_gco.cpp | 6 +- 16 files changed, 76 insertions(+), 58 deletions(-) diff --git a/idl/Procedure.json5 b/idl/Procedure.json5 index f26a4e56..91c8bdf3 100644 --- a/idl/Procedure.json5 +++ b/idl/Procedure.json5 @@ -1,3 +1,7 @@ +// can regenerate downstream .*pp files with either: +// cmake --build -- xo-procedure2-facet-procedure +// cmake --build -- xo-procedure2-genfacet-all + { mode: "facet", // includes in ASyntaxStateMachine.hpp @@ -56,6 +60,7 @@ doc: ["invoke procedure; assume arguments satisfy type system" ], return_type: "obj", args: [ + {type: "obj", name: "rcx"}, {type: "const DArray *", name: "args"}, ] } diff --git a/include/xo/procedure2/DPrimitive.hpp b/include/xo/procedure2/DPrimitive.hpp index cf913a15..afd2ada2 100644 --- a/include/xo/procedure2/DPrimitive.hpp +++ b/include/xo/procedure2/DPrimitive.hpp @@ -19,43 +19,49 @@ namespace xo { namespace scm { - /** @brief Extract return type and argument types from a function type. - * - * Primary template (undefined) - specializations handle specific cases + namespace detail { + /** @brief Extract return type and argument types from a function type. + * + * Primary template (undefined) - specializations handle specific cases + **/ + template + struct PmFnTraits; + + /** specialization for function pointers **/ + template + struct PmFnTraits rcx, Args...)> { + /** function return type **/ + using return_type = R; + /** tuple type for function arguments (except for runtime context) **/ + using args_tuple = std::tuple; + /** number of arguments (except for runtime context) **/ + static constexpr std::size_t n_args = sizeof...(Args); + + /** arg_type is the type of the i'th argument to Fn. + * (starting from argument after runtime context) + **/ + template + using arg_type = std::tuple_element_t; + }; + + /** specialization for function references **/ + template + struct PmFnTraits, Args...)> : PmFnTraits, Args...)> {}; + + /** specialization for plain function types **/ + template + struct PmFnTraits, Args...)> : PmFnTraits, Args...)> {}; + } + + /** @brief Schematika primitive with fixed number of arguments **/ - template - struct FnTraits; - - /** specialization for function pointers **/ - template - struct FnTraits { - /** function return type **/ - using return_type = R; - /** tuple type for function arguments **/ - using args_tuple = std::tuple; - /** number of arguments **/ - static constexpr std::size_t n_args = sizeof...(Args); - - /** arg_type is the type of the i'th argument to Fn **/ - template - using arg_type = std::tuple_element_t; - }; - - /** specialization for function references **/ - template - struct FnTraits : FnTraits {}; - - /** specialization for plain function types **/ - template - struct FnTraits : FnTraits {}; - template class Primitive { public: using AAllocator = xo::mm::AAllocator; using AGCObject = xo::mm::AGCObject; using DArray = xo::scm::DArray; - using Traits = FnTraits; + using Traits = detail::PmFnTraits; public: Primitive(std::string_view name, Fn fn) : name_{name}, fn_{fn} {} @@ -63,14 +69,15 @@ namespace xo { bool is_nary() const noexcept { return false; } static constexpr std::int32_t n_args() noexcept { return Traits::n_args; } - obj apply_nocheck(const DArray * args) { - return _apply_nocheck(args, + obj apply_nocheck(obj rcx, const DArray * args) { + return _apply_nocheck(rcx, args, std::make_index_sequence{}); } private: template - obj _apply_nocheck(const DArray * args, + obj _apply_nocheck(obj rcx, + const DArray * args, std::index_sequence) { using xo::facet::FacetRegistry; @@ -80,12 +87,11 @@ namespace xo { assert(args); assert(args->size() > 0); - obj rcx - = FacetRegistry::instance().variant(args->at(0)); obj mm = rcx.allocator(); R result - = fn_(GCObjectConversion>::from_gco(mm, args->at(Is))... ); + = fn_(rcx, + GCObjectConversion>::from_gco(mm, args->at(Is))... ); return GCObjectConversion::to_gco(mm, result); } diff --git a/include/xo/procedure2/DPrimitive_gco_2_gco_gco.hpp b/include/xo/procedure2/DPrimitive_gco_2_gco_gco.hpp index 24ad3b41..78dd26b9 100644 --- a/include/xo/procedure2/DPrimitive_gco_2_gco_gco.hpp +++ b/include/xo/procedure2/DPrimitive_gco_2_gco_gco.hpp @@ -1,3 +1,8 @@ +/** @file DPrimitive_gco_2_gco_gco.hpp + * + * @author Roland Conybeare, Jan 2026 + **/ + #pragma once #include @@ -13,3 +18,5 @@ namespace xo { obj)>; } } + +/* end DPrimitive_gco_2_gco_gco.hpp */ diff --git a/include/xo/procedure2/Procedure.hpp b/include/xo/procedure2/Procedure.hpp index 8b2cd91a..784608ed 100644 --- a/include/xo/procedure2/Procedure.hpp +++ b/include/xo/procedure2/Procedure.hpp @@ -2,7 +2,7 @@ * * Generated automagically from ingredients: * 1. code generator: - * [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet] + * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] * arguments: * --input [idl/Procedure.json5] * 2. jinja2 template for facet .hpp file: diff --git a/include/xo/procedure2/RuntimeContext.hpp b/include/xo/procedure2/RuntimeContext.hpp index 2e8300ed..3241451b 100644 --- a/include/xo/procedure2/RuntimeContext.hpp +++ b/include/xo/procedure2/RuntimeContext.hpp @@ -2,7 +2,7 @@ * * Generated automagically from ingredients: * 1. code generator: - * [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet] + * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] * arguments: * --input [idl/RuntimeContext.json5] * 2. jinja2 template for facet .hpp file: diff --git a/include/xo/procedure2/detail/AProcedure.hpp b/include/xo/procedure2/detail/AProcedure.hpp index 1be5e0d1..63a4da9b 100644 --- a/include/xo/procedure2/detail/AProcedure.hpp +++ b/include/xo/procedure2/detail/AProcedure.hpp @@ -2,7 +2,7 @@ * * Generated automagically from ingredients: * 1. code generator: - * [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet] + * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] * arguments: * --input [idl/Procedure.json5] * 2. jinja2 template for abstract facet .hpp file: @@ -56,7 +56,7 @@ public: // nonconst methods /** invoke procedure; assume arguments satisfy type system **/ - virtual obj apply_nocheck(Opaque data, const DArray * args) = 0; + virtual obj apply_nocheck(Opaque data, obj rcx, const DArray * args) = 0; ///@} }; /*AProcedure*/ diff --git a/include/xo/procedure2/detail/ARuntimeContext.hpp b/include/xo/procedure2/detail/ARuntimeContext.hpp index 42030d9d..4e96bc8f 100644 --- a/include/xo/procedure2/detail/ARuntimeContext.hpp +++ b/include/xo/procedure2/detail/ARuntimeContext.hpp @@ -2,7 +2,7 @@ * * Generated automagically from ingredients: * 1. code generator: - * [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet] + * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] * arguments: * --input [idl/RuntimeContext.json5] * 2. jinja2 template for abstract facet .hpp file: diff --git a/include/xo/procedure2/detail/IProcedure_Any.hpp b/include/xo/procedure2/detail/IProcedure_Any.hpp index 3f66fcd5..5d711d4c 100644 --- a/include/xo/procedure2/detail/IProcedure_Any.hpp +++ b/include/xo/procedure2/detail/IProcedure_Any.hpp @@ -2,7 +2,7 @@ * * Generated automagically from ingredients: * 1. code generator: - * [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet] + * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] * arguments: * --input [idl/Procedure.json5] * 2. jinja2 template for abstract facet .hpp file: @@ -60,7 +60,7 @@ namespace scm { [[noreturn]] std::int32_t n_args(Copaque) const noexcept override { _fatal(); } // nonconst methods - [[noreturn]] obj apply_nocheck(Opaque, const DArray *) override; + [[noreturn]] obj apply_nocheck(Opaque, obj, const DArray *) override; ///@} diff --git a/include/xo/procedure2/detail/IProcedure_DPrimitive_gco_2_gco_gco.hpp b/include/xo/procedure2/detail/IProcedure_DPrimitive_gco_2_gco_gco.hpp index 4b4351dd..11f2cd60 100644 --- a/include/xo/procedure2/detail/IProcedure_DPrimitive_gco_2_gco_gco.hpp +++ b/include/xo/procedure2/detail/IProcedure_DPrimitive_gco_2_gco_gco.hpp @@ -2,7 +2,7 @@ * * Generated automagically from ingredients: * 1. code generator: - * [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet] + * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] * arguments: * --input [idl/IProcedure_DPrimitive_gco_2_gco_gco.json5] * 2. jinja2 template for abstract facet .hpp file: @@ -57,7 +57,7 @@ namespace xo { // non-const methods /** invoke procedure; assume arguments satisfy type system **/ - static obj apply_nocheck(DPrimitive_gco_2_gco_gco & self, const DArray * args); + static obj apply_nocheck(DPrimitive_gco_2_gco_gco & self, obj rcx, const DArray * args); ///@} }; diff --git a/include/xo/procedure2/detail/IProcedure_Xfer.hpp b/include/xo/procedure2/detail/IProcedure_Xfer.hpp index adf4995d..4f84652e 100644 --- a/include/xo/procedure2/detail/IProcedure_Xfer.hpp +++ b/include/xo/procedure2/detail/IProcedure_Xfer.hpp @@ -2,7 +2,7 @@ * * Generated automagically from ingredients: * 1. code generator: - * [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet] + * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] * arguments: * --input [idl/Procedure.json5] * 2. jinja2 template for abstract facet .hpp file: @@ -50,8 +50,8 @@ namespace scm { } // non-const methods - obj apply_nocheck(Opaque data, const DArray * args) override { - return I::apply_nocheck(_dcast(data), args); + obj apply_nocheck(Opaque data, obj rcx, const DArray * args) override { + return I::apply_nocheck(_dcast(data), rcx, args); } ///@} diff --git a/include/xo/procedure2/detail/IRuntimeContext_Any.hpp b/include/xo/procedure2/detail/IRuntimeContext_Any.hpp index 419d45cc..1e5f97c0 100644 --- a/include/xo/procedure2/detail/IRuntimeContext_Any.hpp +++ b/include/xo/procedure2/detail/IRuntimeContext_Any.hpp @@ -2,7 +2,7 @@ * * Generated automagically from ingredients: * 1. code generator: - * [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet] + * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] * arguments: * --input [idl/RuntimeContext.json5] * 2. jinja2 template for abstract facet .hpp file: diff --git a/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp b/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp index e9f5512e..cd71b73e 100644 --- a/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp +++ b/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp @@ -2,7 +2,7 @@ * * Generated automagically from ingredients: * 1. code generator: - * [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet] + * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] * arguments: * --input [idl/RuntimeContext.json5] * 2. jinja2 template for abstract facet .hpp file: diff --git a/include/xo/procedure2/detail/RProcedure.hpp b/include/xo/procedure2/detail/RProcedure.hpp index 9fff0c6c..93599ae3 100644 --- a/include/xo/procedure2/detail/RProcedure.hpp +++ b/include/xo/procedure2/detail/RProcedure.hpp @@ -2,7 +2,7 @@ * * Generated automagically from ingredients: * 1. code generator: - * [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet] + * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] * arguments: * --input [idl/Procedure.json5] * 2. jinja2 template for abstract facet .hpp file: @@ -56,8 +56,8 @@ public: } // non-const methods (still const in router!) - obj apply_nocheck(const DArray * args) { - return O::iface()->apply_nocheck(O::data(), args); + obj apply_nocheck(obj rcx, const DArray * args) { + return O::iface()->apply_nocheck(O::data(), rcx, args); } ///@} diff --git a/include/xo/procedure2/detail/RRuntimeContext.hpp b/include/xo/procedure2/detail/RRuntimeContext.hpp index 06b093de..b06227c8 100644 --- a/include/xo/procedure2/detail/RRuntimeContext.hpp +++ b/include/xo/procedure2/detail/RRuntimeContext.hpp @@ -2,7 +2,7 @@ * * Generated automagically from ingredients: * 1. code generator: - * [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet] + * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] * arguments: * --input [idl/RuntimeContext.json5] * 2. jinja2 template for abstract facet .hpp file: diff --git a/src/procedure2/IProcedure_Any.cpp b/src/procedure2/IProcedure_Any.cpp index 79b3b778..d28d98ee 100644 --- a/src/procedure2/IProcedure_Any.cpp +++ b/src/procedure2/IProcedure_Any.cpp @@ -35,7 +35,7 @@ IProcedure_Any::_valid // nonconst methods auto -IProcedure_Any::apply_nocheck(Opaque, const DArray *) -> obj +IProcedure_Any::apply_nocheck(Opaque, obj, const DArray *) -> obj { _fatal(); } diff --git a/src/procedure2/IProcedure_DPrimitive_gco_2_gco_gco.cpp b/src/procedure2/IProcedure_DPrimitive_gco_2_gco_gco.cpp index 5266477c..67e73c97 100644 --- a/src/procedure2/IProcedure_DPrimitive_gco_2_gco_gco.cpp +++ b/src/procedure2/IProcedure_DPrimitive_gco_2_gco_gco.cpp @@ -2,7 +2,7 @@ * * Generated automagically from ingredients: * 1. code generator: - * [/Users/roland/proj/xo-umbrella2/xo-facet/codegen/genfacet] + * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] * arguments: * --input [idl/IProcedure_DPrimitive_gco_2_gco_gco.json5] * 2. jinja2 template for abstract facet .hpp file: @@ -28,9 +28,9 @@ namespace xo { } auto - IProcedure_DPrimitive_gco_2_gco_gco::apply_nocheck(DPrimitive_gco_2_gco_gco & self, const DArray * args) -> obj + IProcedure_DPrimitive_gco_2_gco_gco::apply_nocheck(DPrimitive_gco_2_gco_gco & self, obj rcx, const DArray * args) -> obj { - return self.apply_nocheck(args); + return self.apply_nocheck(rcx, args); } } /*namespace scm*/ From 12882e3a99720fdc05b0a2a8ae569767834778a0 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Mon, 26 Jan 2026 15:34:53 -0500 Subject: [PATCH 05/90] xo-procedure2: + GCObject support for Primitive + misc --- CMakeLists.txt | 12 ++++ cmake/xo_procedure2Config.cmake.in | 1 + idl/IGCObject_DPrimitive_gco_2_gco_gco.json5 | 16 +++++ include/xo/procedure2/DPrimitive.hpp | 33 +++++++++ .../IGCObject_DPrimitive_gco_2_gco_gco.hpp | 67 +++++++++++++++++++ include/xo/procedure2/init_primitives.hpp | 7 ++ src/procedure2/CMakeLists.txt | 1 + .../IGCObject_DPrimitive_gco_2_gco_gco.cpp | 39 +++++++++++ 8 files changed, 176 insertions(+) create mode 100644 idl/IGCObject_DPrimitive_gco_2_gco_gco.json5 create mode 100644 include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp create mode 100644 src/procedure2/IGCObject_DPrimitive_gco_2_gco_gco.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index acb0bad9..be7909a5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,6 +53,18 @@ xo_add_genfacetimpl( OUTPUT_CPP_DIR src/procedure2 ) +# note: manual target; generated code committed to git +xo_add_genfacetimpl( + TARGET xo-procedure2-facetimpl-gcobject-primitive_gco_2_gco_gco + FACET_PKG xo_gc + FACET GCObject + REPR Primitive_gco_2_gco_gco + INPUT idl/IGCObject_DPrimitive_gco_2_gco_gco.json5 + OUTPUT_HPP_DIR include/xo/procedure2 + OUTPUT_IMPL_SUBDIR detail + OUTPUT_CPP_DIR src/procedure2 +) + add_subdirectory(src/procedure2) #add_subdirectory(utest) diff --git a/cmake/xo_procedure2Config.cmake.in b/cmake/xo_procedure2Config.cmake.in index 0229c033..867a3535 100644 --- a/cmake/xo_procedure2Config.cmake.in +++ b/cmake/xo_procedure2Config.cmake.in @@ -6,6 +6,7 @@ include(CMakeFindDependencyMacro) # must coordinate with xo_dependency() calls # in CMakeLists.txt # +find_dependency(xo_object2) find_dependency(xo_gc) find_dependency(subsys) diff --git a/idl/IGCObject_DPrimitive_gco_2_gco_gco.json5 b/idl/IGCObject_DPrimitive_gco_2_gco_gco.json5 new file mode 100644 index 00000000..b2fb4014 --- /dev/null +++ b/idl/IGCObject_DPrimitive_gco_2_gco_gco.json5 @@ -0,0 +1,16 @@ +{ + mode: "implementation", + includes: [ + // + "", + "", + ], + local_types: [ ], + namespace1: "xo", + namespace2: "scm", + facet_idl: "idl/GCObject.json5", + brief: "provide AGCobject interface for Primitive (gco x gco) -> gco", + using_doxygen: true, + repr: "DPrimitive_gco_2_gco_gco", + doc: [ "implement AGCObject for DPrimitive (gco x gco) -> gco" ], +} diff --git a/include/xo/procedure2/DPrimitive.hpp b/include/xo/procedure2/DPrimitive.hpp index afd2ada2..c225246d 100644 --- a/include/xo/procedure2/DPrimitive.hpp +++ b/include/xo/procedure2/DPrimitive.hpp @@ -58,6 +58,7 @@ namespace xo { template class Primitive { public: + using ACollector = xo::mm::ACollector; using AAllocator = xo::mm::AAllocator; using AGCObject = xo::mm::AGCObject; using DArray = xo::scm::DArray; @@ -74,6 +75,13 @@ namespace xo { std::make_index_sequence{}); } + /** @defgroup scm-primitive-gcobject-facet **/ + ///@{ + std::size_t shallow_size() const noexcept; + Primitive * shallow_copy(obj mm) const noexcept; + std::size_t forward_children(obj gc) noexcept; + ///@} + private: template obj _apply_nocheck(obj rcx, @@ -103,6 +111,31 @@ namespace xo { Fn fn_; }; /*Primitive*/ + template + std::size_t + Primitive::shallow_size() const noexcept { + return sizeof(*this); + } + + template + Primitive * + Primitive::shallow_copy(obj mm) const noexcept { + void * mem = mm.alloc_copy((std::byte *)this); + + if (mem) { + return new (mem) Primitive(*this); + } + + return nullptr; + } + + template + std::size_t + Primitive::forward_children(obj) noexcept { + // Primitive holds no GC refs (just string_view + function pointer) + return this->shallow_size(); + } + } /*namespace scm*/ } /*namespace xo*/ diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp new file mode 100644 index 00000000..344aa6c1 --- /dev/null +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp @@ -0,0 +1,67 @@ +/** @file IGCObject_DPrimitive_gco_2_gco_gco.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IGCObject_DPrimitive_gco_2_gco_gco.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_repr.hpp.j2] + * 3. idl for facet methods + * [idl/IGCObject_DPrimitive_gco_2_gco_gco.json5] + **/ + +#pragma once + +#include "GCObject.hpp" +#include +#include +#include "DPrimitive_gco_2_gco_gco.hpp" + +namespace xo { namespace scm { class IGCObject_DPrimitive_gco_2_gco_gco; } } + +namespace xo { + namespace facet { + template <> + struct FacetImplementation + { + using ImplType = xo::mm::IGCObject_Xfer + ; + }; + } +} + +namespace xo { + namespace scm { + /** @class IGCObject_DPrimitive_gco_2_gco_gco + **/ + class IGCObject_DPrimitive_gco_2_gco_gco { + public: + /** @defgroup scm-gcobject-dprimitive_gco_2_gco_gco-type-traits **/ + ///@{ + using size_type = xo::mm::AGCObject::size_type; + using AAllocator = xo::mm::AGCObject::AAllocator; + using ACollector = xo::mm::AGCObject::ACollector; + using Copaque = xo::mm::AGCObject::Copaque; + using Opaque = xo::mm::AGCObject::Opaque; + ///@} + /** @defgroup scm-gcobject-dprimitive_gco_2_gco_gco-methods **/ + ///@{ + // const methods + /** memory consumption for this instance **/ + static size_type shallow_size(const DPrimitive_gco_2_gco_gco & self) noexcept; + /** copy instance using allocator **/ + static Opaque shallow_copy(const DPrimitive_gco_2_gco_gco & self, obj mm) noexcept; + + // non-const methods + /** during GC: forward immdiate children **/ + static size_type forward_children(DPrimitive_gco_2_gco_gco & self, obj gc) noexcept; + ///@} + }; + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end */ \ No newline at end of file diff --git a/include/xo/procedure2/init_primitives.hpp b/include/xo/procedure2/init_primitives.hpp index 5e2d08e8..48b733df 100644 --- a/include/xo/procedure2/init_primitives.hpp +++ b/include/xo/procedure2/init_primitives.hpp @@ -7,12 +7,19 @@ namespace xo { namespace scm { +/** TODO: move this into xo-reader2 ? **/ + #ifdef NOT_YET using Primitive_f64_1_f64 = Primitive; using Primitive_f64_2_f64_f64 = Primitive; #endif struct Primitives { + /** polymorphich multiply + * + * TODO: this will want to move to xo-numeric/ + * so we can dispatch on vector, matrix, function types + **/ static DPrimitive_gco_2_gco_gco s_mul_gco_gco_pm; #ifdef NOT_YET diff --git a/src/procedure2/CMakeLists.txt b/src/procedure2/CMakeLists.txt index 11a9c305..c127b760 100644 --- a/src/procedure2/CMakeLists.txt +++ b/src/procedure2/CMakeLists.txt @@ -7,6 +7,7 @@ set(SELF_SRCS DPrimitive.cpp IRuntimeContext_Any.cpp IProcedure_Any.cpp + IGCObject_DPrimitive_gco_2_gco_gco.cpp IProcedure_DPrimitive_gco_2_gco_gco.cpp # Add source files here, e.g.: # procedure2.cpp diff --git a/src/procedure2/IGCObject_DPrimitive_gco_2_gco_gco.cpp b/src/procedure2/IGCObject_DPrimitive_gco_2_gco_gco.cpp new file mode 100644 index 00000000..bd88e9ff --- /dev/null +++ b/src/procedure2/IGCObject_DPrimitive_gco_2_gco_gco.cpp @@ -0,0 +1,39 @@ +/** @file IGCObject_DPrimitive_gco_2_gco_gco.cpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IGCObject_DPrimitive_gco_2_gco_gco.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/IGCObject_DPrimitive_gco_2_gco_gco.json5] +**/ + +#include "detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp" + +namespace xo { + namespace scm { + auto + IGCObject_DPrimitive_gco_2_gco_gco::shallow_size(const DPrimitive_gco_2_gco_gco & self) noexcept -> size_type + { + return self.shallow_size(); + } + + auto + IGCObject_DPrimitive_gco_2_gco_gco::shallow_copy(const DPrimitive_gco_2_gco_gco & self, obj mm) noexcept -> Opaque + { + return self.shallow_copy(mm); + } + + auto + IGCObject_DPrimitive_gco_2_gco_gco::forward_children(DPrimitive_gco_2_gco_gco & self, obj gc) noexcept -> size_type + { + return self.forward_children(gc); + } + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end IGCObject_DPrimitive_gco_2_gco_gco.cpp */ \ No newline at end of file From 87b89db2f320be326434e29709faf8ba92d64320 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Mon, 26 Jan 2026 15:35:21 -0500 Subject: [PATCH 06/90] xo-procedure2: export cmake config --- src/procedure2/CMakeLists.txt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/procedure2/CMakeLists.txt b/src/procedure2/CMakeLists.txt index c127b760..d460e2db 100644 --- a/src/procedure2/CMakeLists.txt +++ b/src/procedure2/CMakeLists.txt @@ -27,4 +27,12 @@ xo_dependency(${SELF_LIB} xo_gc) xo_dependency(${SELF_LIB} subsys) #xo_dependency(${SELF_LIB} xo_indentlog) +xo_export_cmake_config(${PROJECT_NAME} ${PROJECT_VERSION} ${PROJECT_NAME}Targets) + +# ---------------------------------------------------------------- +# docs targets depend on other library/utest/exec targets above, +# --> must come after them. +# +#add_subdirectory(docs) + # end src/CMakeLists.txt From 9a52d270bd9a8b76dff39369fae9fd640c3d6bf1 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Mon, 26 Jan 2026 16:05:37 -0500 Subject: [PATCH 07/90] init dep handling for xo-expression2 -> xo-procedure2 --- .../procedure2/procedure2_register_facets.hpp | 17 ++++++++++ .../procedure2/procedure2_register_types.hpp | 17 ++++++++++ src/procedure2/CMakeLists.txt | 2 ++ src/procedure2/init_procedure2.cpp | 16 +++++++-- src/procedure2/procedure2_register_facets.cpp | 33 +++++++++++++++++++ src/procedure2/procedure2_register_types.cpp | 33 +++++++++++++++++++ 6 files changed, 115 insertions(+), 3 deletions(-) create mode 100644 include/xo/procedure2/procedure2_register_facets.hpp create mode 100644 include/xo/procedure2/procedure2_register_types.hpp create mode 100644 src/procedure2/procedure2_register_facets.cpp create mode 100644 src/procedure2/procedure2_register_types.cpp diff --git a/include/xo/procedure2/procedure2_register_facets.hpp b/include/xo/procedure2/procedure2_register_facets.hpp new file mode 100644 index 00000000..219da3d4 --- /dev/null +++ b/include/xo/procedure2/procedure2_register_facets.hpp @@ -0,0 +1,17 @@ +/** @file procedure2_register_facets.hpp + * + * @author Roland Conybeare, Jan 2026 + **/ + +#pragma once + +#include + +namespace xo { + namespace scm { + /** Register procedure2 (facet,impl) combinations with FacetRegistry **/ + bool procedure2_register_facets(); + } +} + +/* end procedure2_register_facets.hpp */ diff --git a/include/xo/procedure2/procedure2_register_types.hpp b/include/xo/procedure2/procedure2_register_types.hpp new file mode 100644 index 00000000..be0170aa --- /dev/null +++ b/include/xo/procedure2/procedure2_register_types.hpp @@ -0,0 +1,17 @@ +/** @file procedure2_register_types.hpp + * + * @author Roland Conybeare, Dec 2025 + **/ + +#pragma once + +#include + +namespace xo { + namespace scm { + /** Register gc-aware (AGCObject,DRepr) combinations with garbage collector @p gc **/ + bool procedure2_register_types(obj gc); + } +} + +/* end procedure2_register_types.hpp */ diff --git a/src/procedure2/CMakeLists.txt b/src/procedure2/CMakeLists.txt index d460e2db..d1699eb0 100644 --- a/src/procedure2/CMakeLists.txt +++ b/src/procedure2/CMakeLists.txt @@ -4,6 +4,8 @@ set(SELF_LIB xo_procedure2) set(SELF_SRCS init_procedure2.cpp init_primitives.cpp + procedure2_register_types.cpp + procedure2_register_facets.cpp DPrimitive.cpp IRuntimeContext_Any.cpp IProcedure_Any.cpp diff --git a/src/procedure2/init_procedure2.cpp b/src/procedure2/init_procedure2.cpp index fc316653..aaa6a021 100644 --- a/src/procedure2/init_procedure2.cpp +++ b/src/procedure2/init_procedure2.cpp @@ -5,16 +5,23 @@ #include "init_procedure2.hpp" #include "init_primitives.hpp" -//#include "procedure2_register_facets.hpp" -//#include "procedure2_register_types.hpp" +#include "procedure2_register_facets.hpp" +#include "procedure2_register_types.hpp" + +#include #include namespace xo { - using xo::scm::Primitives; + using xo::scm::procedure2_register_facets; + using xo::scm::procedure2_register_types; + using xo::mm::CollectorTypeRegistry; void InitSubsys::init() { + procedure2_register_facets(); + + CollectorTypeRegistry::instance().register_types(&procedure2_register_types); } InitEvidence @@ -22,6 +29,9 @@ namespace xo { { InitEvidence retval; + /* recursive subsystem deps for xo-object2/ */ + retval ^= InitSubsys::require(); + /* xo-procedure2/'s own initialization code */ retval ^= Subsystem::provide("procedure2", &init); diff --git a/src/procedure2/procedure2_register_facets.cpp b/src/procedure2/procedure2_register_facets.cpp new file mode 100644 index 00000000..5e7a8755 --- /dev/null +++ b/src/procedure2/procedure2_register_facets.cpp @@ -0,0 +1,33 @@ +/** @file procedure2_register_facets.cpp + * + * @author Roland Conybeare, Jan 2026 + **/ + +#include "DPrimitive_gco_2_gco_gco.hpp" +#include "detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp" + +#include +#include +#include + +namespace xo { + using xo::facet::FacetRegistry; + using xo::facet::typeseq; + + namespace scm { + bool + procedure2_register_facets() + { + scope log(XO_DEBUG(true)); + + FacetRegistry::register_impl(); + + log && log(xtag("DPrimitive_gco_2_gco_gco.tseq", typeseq::id())); + + return true; + } + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end procedure2_register_facets.cpp */ diff --git a/src/procedure2/procedure2_register_types.cpp b/src/procedure2/procedure2_register_types.cpp new file mode 100644 index 00000000..dedceb69 --- /dev/null +++ b/src/procedure2/procedure2_register_types.cpp @@ -0,0 +1,33 @@ +/** @file procedure2_register_types.cpp + * + * @author Roland Conybeare, Jan 2026 + **/ + +#include "procedure2_register_types.hpp" + +#include "detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp" +#include + +namespace xo { + using xo::mm::ACollector; + using xo::mm::AGCObject; + using xo::facet::impl_for; + using xo::facet::typeseq; + using xo::scope; + + namespace scm { + bool + procedure2_register_types(obj gc) + { + scope log(XO_DEBUG(true)); + + bool ok = true; + + ok &= gc.install_type(impl_for()); + + return ok; + } + } +} /*namespace xo*/ + +/* end procedure2_register_types.cpp */ From 673895902aade010aa2d30d7ed4a27c3783c5830 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Mon, 26 Jan 2026 16:51:23 -0500 Subject: [PATCH 08/90] xo-procedure2: add DSimpleRcx w/ IRuntimeContext facet --- CMakeLists.txt | 15 ++++- idl/IRuntimeContext_DSimpleRcx.json5 | 15 +++++ include/xo/procedure2/DSimpleRcx.hpp | 32 ++++++++++ .../detail/IRuntimeContext_DSimpleRcx.hpp | 59 +++++++++++++++++++ src/procedure2/CMakeLists.txt | 3 +- src/procedure2/IRuntimeContext_DSimpleRcx.cpp | 28 +++++++++ 6 files changed, 150 insertions(+), 2 deletions(-) create mode 100644 idl/IRuntimeContext_DSimpleRcx.json5 create mode 100644 include/xo/procedure2/DSimpleRcx.hpp create mode 100644 include/xo/procedure2/detail/IRuntimeContext_DSimpleRcx.hpp create mode 100644 src/procedure2/IRuntimeContext_DSimpleRcx.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index be7909a5..929c48bc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,7 +43,20 @@ xo_add_genfacet( # ---------------------------------------------------------------- xo_add_genfacetimpl( - TARGET xo-procedure2-facetimpl-procedure2-primitive_gco_2_gco_gco + TARGET xo-procedure2-facetimpl-runtimecontext-simplercx + FACET_PKG xo_procedure2 + FACET RuntimeContext + REPR DSimpleRcx + INPUT idl/IRuntimeContext_DSimpleRcx.json5 + OUTPUT_HPP_DIR include/xo/procedure2 + OUTPUT_IMPL_SUBDIR detail + OUTPUT_CPP_DIR src/procedure2 + ) + +# ---------------------------------------------------------------- + +xo_add_genfacetimpl( + TARGET xo-procedure2-facetimpl-procedure-primitive_gco_2_gco_gco FACET_PKG xo_procedure2 FACET Procedure REPR DPrimitive_gco_2_gco_gco diff --git a/idl/IRuntimeContext_DSimpleRcx.json5 b/idl/IRuntimeContext_DSimpleRcx.json5 new file mode 100644 index 00000000..ed838629 --- /dev/null +++ b/idl/IRuntimeContext_DSimpleRcx.json5 @@ -0,0 +1,15 @@ +{ + mode: "implementation", + includes: [ + //"", + //"", + ], + local_types: [ ], + namespace1: "xo", + namespace2: "scm", + facet_idl: "idl/RuntimeContext.json5", + brief: "provide ARuntimeContext interface for DSimpleRcx", + using_doxygen: true, + repr: "DSimpleRcx", + doc: [ "implement ARuntimeContext for DSimpleRcx" ], +} diff --git a/include/xo/procedure2/DSimpleRcx.hpp b/include/xo/procedure2/DSimpleRcx.hpp new file mode 100644 index 00000000..d5060bb9 --- /dev/null +++ b/include/xo/procedure2/DSimpleRcx.hpp @@ -0,0 +1,32 @@ +/** @file DSimpleRcx.hpp + * + * @author Roland Conybeare, Jan 2026 + **/ + +#include + +namespace xo { + namespace scm { + + /** @brief Minimal runtime context. + * + * Minimal runtime context provides an allocator, + * and nothing more. + **/ + class DSimpleRcx { + public: + using AAllocator = xo::mm::AAllocator; + + public: + DSimpleRcx(obj mm) : allocator_{mm} {} + + obj allocator() const noexcept { return allocator_; } + + private: + obj allocator_; + }; + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end DSimpleRcx.hpp */ diff --git a/include/xo/procedure2/detail/IRuntimeContext_DSimpleRcx.hpp b/include/xo/procedure2/detail/IRuntimeContext_DSimpleRcx.hpp new file mode 100644 index 00000000..06f14bc5 --- /dev/null +++ b/include/xo/procedure2/detail/IRuntimeContext_DSimpleRcx.hpp @@ -0,0 +1,59 @@ +/** @file IRuntimeContext_DSimpleRcx.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IRuntimeContext_DSimpleRcx.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_repr.hpp.j2] + * 3. idl for facet methods + * [idl/IRuntimeContext_DSimpleRcx.json5] + **/ + +#pragma once + +#include "RuntimeContext.hpp" +#include "DSimpleRcx.hpp" + +namespace xo { namespace scm { class IRuntimeContext_DSimpleRcx; } } + +namespace xo { + namespace facet { + template <> + struct FacetImplementation + { + using ImplType = xo::scm::IRuntimeContext_Xfer + ; + }; + } +} + +namespace xo { + namespace scm { + /** @class IRuntimeContext_DSimpleRcx + **/ + class IRuntimeContext_DSimpleRcx { + public: + /** @defgroup scm-runtimecontext-dsimplercx-type-traits **/ + ///@{ + using AAllocator = xo::scm::ARuntimeContext::AAllocator; + using Copaque = xo::scm::ARuntimeContext::Copaque; + using Opaque = xo::scm::ARuntimeContext::Opaque; + ///@} + /** @defgroup scm-runtimecontext-dsimplercx-methods **/ + ///@{ + // const methods + /** default allocator to use for objects **/ + static obj allocator(const DSimpleRcx & self) noexcept; + + // non-const methods + ///@} + }; + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end */ \ No newline at end of file diff --git a/src/procedure2/CMakeLists.txt b/src/procedure2/CMakeLists.txt index d1699eb0..8ecbc329 100644 --- a/src/procedure2/CMakeLists.txt +++ b/src/procedure2/CMakeLists.txt @@ -6,9 +6,10 @@ set(SELF_SRCS init_primitives.cpp procedure2_register_types.cpp procedure2_register_facets.cpp - DPrimitive.cpp IRuntimeContext_Any.cpp + IRuntimeContext_DSimpleRcx.cpp IProcedure_Any.cpp + DPrimitive.cpp IGCObject_DPrimitive_gco_2_gco_gco.cpp IProcedure_DPrimitive_gco_2_gco_gco.cpp # Add source files here, e.g.: diff --git a/src/procedure2/IRuntimeContext_DSimpleRcx.cpp b/src/procedure2/IRuntimeContext_DSimpleRcx.cpp new file mode 100644 index 00000000..4ec8378b --- /dev/null +++ b/src/procedure2/IRuntimeContext_DSimpleRcx.cpp @@ -0,0 +1,28 @@ +/** @file IRuntimeContext_DSimpleRcx.cpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IRuntimeContext_DSimpleRcx.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/IRuntimeContext_DSimpleRcx.json5] +**/ + +#include "detail/IRuntimeContext_DSimpleRcx.hpp" + +namespace xo { + namespace scm { + auto + IRuntimeContext_DSimpleRcx::allocator(const DSimpleRcx & self) noexcept -> obj + { + return self.allocator(); + } + + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end IRuntimeContext_DSimpleRcx.cpp */ \ No newline at end of file From 5df004fb1257ac911389ab0b4ea82aa6f7687671 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Mon, 26 Jan 2026 16:51:58 -0500 Subject: [PATCH 09/90] xo-procedure2: + simple unit test --- CMakeLists.txt | 2 +- utest/CMakeLists.txt | 11 +++++++++++ utest/DPrimitive.test.cpp | 35 +++++++++++++++++++++++++++++++++ utest/procedure2_utest_main.cpp | 20 +++++++++++++++++++ 4 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 utest/CMakeLists.txt create mode 100644 utest/DPrimitive.test.cpp create mode 100644 utest/procedure2_utest_main.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 929c48bc..04751f1d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -79,7 +79,7 @@ xo_add_genfacetimpl( ) add_subdirectory(src/procedure2) -#add_subdirectory(utest) +add_subdirectory(utest) # ---------------------------------------------------------------- diff --git a/utest/CMakeLists.txt b/utest/CMakeLists.txt new file mode 100644 index 00000000..2e5f1471 --- /dev/null +++ b/utest/CMakeLists.txt @@ -0,0 +1,11 @@ +# built unittest xo-procedure2/utest + +set(UTEST_EXE utest.procedure2) +set(UTEST_SRCS + procedure2_utest_main.cpp + DPrimitive.test.cpp +) + +xo_add_utest_executable(${UTEST_EXE} ${UTEST_SRCS}) +xo_self_dependency(${UTEST_EXE} xo_procedure2) +xo_external_target_dependency(${UTEST_EXE} Catch2 Catch2::Catch2) diff --git a/utest/DPrimitive.test.cpp b/utest/DPrimitive.test.cpp new file mode 100644 index 00000000..db501dae --- /dev/null +++ b/utest/DPrimitive.test.cpp @@ -0,0 +1,35 @@ +/** @file DPrimitive.test.cpp + * + * @author Roland Conybeare, Jan 2026 + **/ + +#include +#include +#include + +namespace xo { + using xo::scm::Primitives; + + namespace ut { + static InitEvidence s_init = InitSubsys::require(); + + TEST_CASE("DPrimitive-init", "[procedure2][DPrimitive]") + { + REQUIRE(s_init.evidence()); + } + + TEST_CASE("DPrimitive-n_args", "[procedure2][DPrimitive]") + { + // s_mul_gco_gco_pm takes 2 AGCObject args + REQUIRE(Primitives::s_mul_gco_gco_pm.n_args() == 2); + } + + TEST_CASE("DPrimitive-is_nary", "[procedure2][DPrimitive]") + { + REQUIRE(Primitives::s_mul_gco_gco_pm.is_nary() == false); + } + + } /*namespace ut*/ +} /*namespace xo*/ + +/* end DPrimitive.test.cpp */ diff --git a/utest/procedure2_utest_main.cpp b/utest/procedure2_utest_main.cpp new file mode 100644 index 00000000..477099bc --- /dev/null +++ b/utest/procedure2_utest_main.cpp @@ -0,0 +1,20 @@ +/* file procedure2_utest_main.cpp */ + +#include + +#define CATCH_CONFIG_RUNNER +#include "catch2/catch.hpp" + +int +main(int argc, char* argv[]) +{ + using xo::Subsystem; + + Subsystem::initialize_all(); + + int result = Catch::Session().run(argc, argv); + + return result; +} + +/* end procedure2_utest_main.cpp */ From df86cef2b1f9dac5119f39884e97d6f5f83e8633 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Mon, 26 Jan 2026 16:56:35 -0500 Subject: [PATCH 10/90] xo-procedure2: + DSimpleRcx utest --- include/xo/procedure2/DSimpleRcx.hpp | 2 + utest/CMakeLists.txt | 1 + utest/DSimpleRcx.test.cpp | 60 ++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 utest/DSimpleRcx.test.cpp diff --git a/include/xo/procedure2/DSimpleRcx.hpp b/include/xo/procedure2/DSimpleRcx.hpp index d5060bb9..bd52dcc5 100644 --- a/include/xo/procedure2/DSimpleRcx.hpp +++ b/include/xo/procedure2/DSimpleRcx.hpp @@ -3,6 +3,8 @@ * @author Roland Conybeare, Jan 2026 **/ +#pragma once + #include namespace xo { diff --git a/utest/CMakeLists.txt b/utest/CMakeLists.txt index 2e5f1471..e758d282 100644 --- a/utest/CMakeLists.txt +++ b/utest/CMakeLists.txt @@ -4,6 +4,7 @@ set(UTEST_EXE utest.procedure2) set(UTEST_SRCS procedure2_utest_main.cpp DPrimitive.test.cpp + DSimpleRcx.test.cpp ) xo_add_utest_executable(${UTEST_EXE} ${UTEST_SRCS}) diff --git a/utest/DSimpleRcx.test.cpp b/utest/DSimpleRcx.test.cpp new file mode 100644 index 00000000..cab1362d --- /dev/null +++ b/utest/DSimpleRcx.test.cpp @@ -0,0 +1,60 @@ +/** @file DSimpleRcx.test.cpp + * + * @author Roland Conybeare, Jan 2026 + **/ + +#include +#include +#include +#include +#include + +namespace xo { + using xo::scm::DSimpleRcx; + using xo::scm::ARuntimeContext; + using xo::mm::AAllocator; + using xo::mm::DArena; + using xo::mm::ArenaConfig; + using xo::facet::with_facet; + using xo::facet::obj; + + namespace ut { + static InitEvidence s_init = InitSubsys::require(); + + TEST_CASE("DSimpleRcx-init", "[procedure2][DSimpleRcx]") + { + REQUIRE(s_init.evidence()); + } + + TEST_CASE("DSimpleRcx-construct", "[procedure2][DSimpleRcx]") + { + ArenaConfig cfg { .name_ = "testarena", + .size_ = 4*1024 }; + DArena arena = DArena::map(cfg); + auto alloc = with_facet::mkobj(&arena); + + DSimpleRcx rcx(alloc); + + REQUIRE((void*)rcx.allocator().data() == (void*)alloc.data()); + } + + TEST_CASE("DSimpleRcx-as-ARuntimeContext", "[procedure2][DSimpleRcx]") + { + ArenaConfig cfg { .name_ = "testarena", + .size_ = 4*1024 }; + DArena arena = DArena::map(cfg); + auto alloc = with_facet::mkobj(&arena); + + DSimpleRcx rcx(alloc); + obj rcx_obj = with_facet::mkobj(&rcx); + + // verify we can recover allocator from obj + obj recovered_alloc = rcx_obj.allocator(); + + REQUIRE((void*)recovered_alloc.data() == (void*)alloc.data()); + } + + } /*namespace ut*/ +} /*namespace xo*/ + +/* end DSimpleRcx.test.cpp */ From 37bdf634a9de9574f2a7b77f41d41c22927f61cf Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Mon, 26 Jan 2026 16:59:07 -0500 Subject: [PATCH 11/90] xo-procedure2: register DSimpleRcx --- src/procedure2/procedure2_register_facets.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/procedure2/procedure2_register_facets.cpp b/src/procedure2/procedure2_register_facets.cpp index 5e7a8755..c22b8049 100644 --- a/src/procedure2/procedure2_register_facets.cpp +++ b/src/procedure2/procedure2_register_facets.cpp @@ -3,6 +3,9 @@ * @author Roland Conybeare, Jan 2026 **/ +#include "DSimpleRcx.hpp" +#include "detail/IRuntimeContext_DSimpleRcx.hpp" + #include "DPrimitive_gco_2_gco_gco.hpp" #include "detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp" @@ -20,8 +23,11 @@ namespace xo { { scope log(XO_DEBUG(true)); + FacetRegistry::register_impl(); + FacetRegistry::register_impl(); + log && log(xtag("DSimpleRcx.tseq", typeseq::id())); log && log(xtag("DPrimitive_gco_2_gco_gco.tseq", typeseq::id())); return true; From c5a782d01ccd3b9a9fd9a56618a310d4a5324a3c Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Mon, 26 Jan 2026 17:08:25 -0500 Subject: [PATCH 12/90] xo-procedure2: add apply_nocheck() utest on gco multiply --- src/procedure2/procedure2_register_types.cpp | 2 + utest/DPrimitive.test.cpp | 82 ++++++++++++++++++++ 2 files changed, 84 insertions(+) diff --git a/src/procedure2/procedure2_register_types.cpp b/src/procedure2/procedure2_register_types.cpp index dedceb69..497773d2 100644 --- a/src/procedure2/procedure2_register_types.cpp +++ b/src/procedure2/procedure2_register_types.cpp @@ -23,6 +23,8 @@ namespace xo { bool ok = true; + // (note: don't currently intend to support AGCObject for DSimpleRcx) + ok &= gc.install_type(impl_for()); return ok; diff --git a/utest/DPrimitive.test.cpp b/utest/DPrimitive.test.cpp index db501dae..b3775e62 100644 --- a/utest/DPrimitive.test.cpp +++ b/utest/DPrimitive.test.cpp @@ -5,10 +5,29 @@ #include #include +#include +#include +#include +#include +#include +#include +#include +#include #include namespace xo { using xo::scm::Primitives; + using xo::scm::DSimpleRcx; + using xo::scm::ARuntimeContext; + using xo::scm::DFloat; + using xo::scm::DInteger; + using xo::scm::DArray; + using xo::mm::AAllocator; + using xo::mm::AGCObject; + using xo::mm::DArena; + using xo::mm::ArenaConfig; + using xo::facet::with_facet; + using xo::facet::obj; namespace ut { static InitEvidence s_init = InitSubsys::require(); @@ -29,6 +48,69 @@ namespace xo { REQUIRE(Primitives::s_mul_gco_gco_pm.is_nary() == false); } + TEST_CASE("DPrimitive-apply_nocheck-float-float", "[procedure2][DPrimitive]") + { + ArenaConfig cfg { .name_ = "testarena", .size_ = 4*1024 }; + DArena arena = DArena::map(cfg); + auto alloc = with_facet::mkobj(&arena); + + DSimpleRcx rcx_data(alloc); + obj rcx = with_facet::mkobj(&rcx_data); + + // 3.0 * 7.0 = 21.0 + obj x = DFloat::box(alloc, 3.0); + obj y = DFloat::box(alloc, 7.0); + DArray * args = DArray::array(alloc, x, y); + + obj result = Primitives::s_mul_gco_gco_pm.apply_nocheck(rcx, args); + + auto result_float = obj::from(result); + REQUIRE(result_float); + REQUIRE(result_float.data()->value() == 21.0); + } + + TEST_CASE("DPrimitive-apply_nocheck-int-int", "[procedure2][DPrimitive]") + { + ArenaConfig cfg { .name_ = "testarena", .size_ = 4*1024 }; + DArena arena = DArena::map(cfg); + auto alloc = with_facet::mkobj(&arena); + + DSimpleRcx rcx_data(alloc); + obj rcx = with_facet::mkobj(&rcx_data); + + // 3 * 7 = 21 + obj x = DInteger::box(alloc, 3L); + obj y = DInteger::box(alloc, 7L); + DArray * args = DArray::array(alloc, x, y); + + obj result = Primitives::s_mul_gco_gco_pm.apply_nocheck(rcx, args); + + auto result_int = obj::from(result); + REQUIRE(result_int); + REQUIRE(result_int.data()->value() == 21L); + } + + TEST_CASE("DPrimitive-apply_nocheck-int-float", "[procedure2][DPrimitive]") + { + ArenaConfig cfg { .name_ = "testarena", .size_ = 4*1024 }; + DArena arena = DArena::map(cfg); + auto alloc = with_facet::mkobj(&arena); + + DSimpleRcx rcx_data(alloc); + obj rcx = with_facet::mkobj(&rcx_data); + + // 3 * 7.0 = 21.0 (mixed: result is float) + obj x = DInteger::box(alloc, 3L); + obj y = DFloat::box(alloc, 7.0); + DArray * args = DArray::array(alloc, x, y); + + obj result = Primitives::s_mul_gco_gco_pm.apply_nocheck(rcx, args); + + auto result_float = obj::from(result); + REQUIRE(result_float); + REQUIRE(result_float.data()->value() == 21.0); + } + } /*namespace ut*/ } /*namespace xo*/ From 01af6146ab7b4f65640df70d82d738a54d92e6fc Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Mon, 26 Jan 2026 18:15:17 -0500 Subject: [PATCH 13/90] xo-procedure2: + printable support for Primitive --- CMakeLists.txt | 13 ++++ idl/IPrintable_DPrimitive_gco_2_gco_gco.json5 | 19 ++++++ include/xo/procedure2/DPrimitive.hpp | 38 +++++++++++- .../IPrintable_DPrimitive_gco_2_gco_gco.hpp | 62 +++++++++++++++++++ src/procedure2/CMakeLists.txt | 1 + .../IPrintable_DPrimitive_gco_2_gco_gco.cpp | 28 +++++++++ src/procedure2/procedure2_register_facets.cpp | 4 ++ utest/DPrimitive.test.cpp | 27 ++++++++ 8 files changed, 190 insertions(+), 2 deletions(-) create mode 100644 idl/IPrintable_DPrimitive_gco_2_gco_gco.json5 create mode 100644 include/xo/procedure2/detail/IPrintable_DPrimitive_gco_2_gco_gco.hpp create mode 100644 src/procedure2/IPrintable_DPrimitive_gco_2_gco_gco.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 04751f1d..ad8673d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,6 +55,7 @@ xo_add_genfacetimpl( # ---------------------------------------------------------------- +# note: manual target; generated code committed to git xo_add_genfacetimpl( TARGET xo-procedure2-facetimpl-procedure-primitive_gco_2_gco_gco FACET_PKG xo_procedure2 @@ -78,6 +79,18 @@ xo_add_genfacetimpl( OUTPUT_CPP_DIR src/procedure2 ) +# note: manual target; generated code committed to git +xo_add_genfacetimpl( + TARGET xo-procedure2-facetimpl-printable-primitive_gco_2_gco_gco + FACET_PKG xo_printable2 + FACET Printable + REPR Primitive_gco_2_gco_gco + INPUT idl/IPrintable_DPrimitive_gco_2_gco_gco.json5 + OUTPUT_HPP_DIR include/xo/procedure2 + OUTPUT_IMPL_SUBDIR detail + OUTPUT_CPP_DIR src/procedure2 +) + add_subdirectory(src/procedure2) add_subdirectory(utest) diff --git a/idl/IPrintable_DPrimitive_gco_2_gco_gco.json5 b/idl/IPrintable_DPrimitive_gco_2_gco_gco.json5 new file mode 100644 index 00000000..15cff1b4 --- /dev/null +++ b/idl/IPrintable_DPrimitive_gco_2_gco_gco.json5 @@ -0,0 +1,19 @@ +{ + mode: "implementation", + includes: [ + "", + "", +// "", +// "", +// "", +// "", + ], + local_types: [ ], + namespace1: "xo", + namespace2: "scm", + facet_idl: "idl/Printable.json5", + brief: "provide APrintable interface for DPrimitive (gco x gco) -> gco", + using_doxygen: true, + repr: "DPrimitive_gco_2_gco_gco", + doc: [ "implement APrintable for DPrimitive (gco x gco) -> gco" ], +} diff --git a/include/xo/procedure2/DPrimitive.hpp b/include/xo/procedure2/DPrimitive.hpp index c225246d..90fdba50 100644 --- a/include/xo/procedure2/DPrimitive.hpp +++ b/include/xo/procedure2/DPrimitive.hpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -58,14 +59,22 @@ namespace xo { template class Primitive { public: + using Traits = detail::PmFnTraits; + using ACollector = xo::mm::ACollector; using AAllocator = xo::mm::AAllocator; using AGCObject = xo::mm::AGCObject; using DArray = xo::scm::DArray; - using Traits = detail::PmFnTraits; + using Reflect = xo::reflect::Reflect; + using TypeDescr = xo::reflect::TypeDescr; + using ppindentinfo = xo::print::ppindentinfo; public: - Primitive(std::string_view name, Fn fn) : name_{name}, fn_{fn} {} + Primitive(std::string_view name, Fn fn) : name_{name}, + fn_td_{Reflect::require()}, + fn_{fn} {} + + TypeDescr fn_td() const noexcept { return fn_td_; } bool is_nary() const noexcept { return false; } static constexpr std::int32_t n_args() noexcept { return Traits::n_args; } @@ -75,6 +84,12 @@ namespace xo { std::make_index_sequence{}); } + /** @defgroup scm-primitive-printable-facet **/ + ///@{ + + bool pretty(const ppindentinfo & ppii) const; + + ///@} /** @defgroup scm-primitive-gcobject-facet **/ ///@{ std::size_t shallow_size() const noexcept; @@ -107,10 +122,29 @@ namespace xo { private: /** name of this primitive **/ std::string_view name_; + + /** type description for function + * Note that this type description will have additional first argument + * for obj + **/ + TypeDescr fn_td_; + /** function implementation **/ Fn fn_; }; /*Primitive*/ + template + bool + Primitive::pretty(const ppindentinfo & ppii) const + { + return ppii.pps()->pretty_struct + (ppii, + "Primitive", + refrtag("name", name_), + refrtag("td", fn_td_), + refrtag("fn", fn_)); + } + template std::size_t Primitive::shallow_size() const noexcept { diff --git a/include/xo/procedure2/detail/IPrintable_DPrimitive_gco_2_gco_gco.hpp b/include/xo/procedure2/detail/IPrintable_DPrimitive_gco_2_gco_gco.hpp new file mode 100644 index 00000000..b6b0a9c5 --- /dev/null +++ b/include/xo/procedure2/detail/IPrintable_DPrimitive_gco_2_gco_gco.hpp @@ -0,0 +1,62 @@ +/** @file IPrintable_DPrimitive_gco_2_gco_gco.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IPrintable_DPrimitive_gco_2_gco_gco.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_repr.hpp.j2] + * 3. idl for facet methods + * [idl/IPrintable_DPrimitive_gco_2_gco_gco.json5] + **/ + +#pragma once + +#include "Printable.hpp" +#include +#include +#include "DPrimitive_gco_2_gco_gco.hpp" + +namespace xo { namespace scm { class IPrintable_DPrimitive_gco_2_gco_gco; } } + +namespace xo { + namespace facet { + template <> + struct FacetImplementation + { + using ImplType = xo::print::IPrintable_Xfer + ; + }; + } +} + +namespace xo { + namespace scm { + /** @class IPrintable_DPrimitive_gco_2_gco_gco + **/ + class IPrintable_DPrimitive_gco_2_gco_gco { + public: + /** @defgroup scm-printable-dprimitive_gco_2_gco_gco-type-traits **/ + ///@{ + using ppindentinfo = xo::print::APrintable::ppindentinfo; + using Copaque = xo::print::APrintable::Copaque; + using Opaque = xo::print::APrintable::Opaque; + ///@} + /** @defgroup scm-printable-dprimitive_gco_2_gco_gco-methods **/ + ///@{ + // const methods + /** Pretty-printing support for this object. +See [xo-indentlog/xo/indentlog/pretty.hpp] **/ + static bool pretty(const DPrimitive_gco_2_gco_gco & self, const ppindentinfo & ppii); + + // non-const methods + ///@} + }; + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end */ \ No newline at end of file diff --git a/src/procedure2/CMakeLists.txt b/src/procedure2/CMakeLists.txt index 8ecbc329..92685afb 100644 --- a/src/procedure2/CMakeLists.txt +++ b/src/procedure2/CMakeLists.txt @@ -12,6 +12,7 @@ set(SELF_SRCS DPrimitive.cpp IGCObject_DPrimitive_gco_2_gco_gco.cpp IProcedure_DPrimitive_gco_2_gco_gco.cpp + IPrintable_DPrimitive_gco_2_gco_gco.cpp # Add source files here, e.g.: # procedure2.cpp ) diff --git a/src/procedure2/IPrintable_DPrimitive_gco_2_gco_gco.cpp b/src/procedure2/IPrintable_DPrimitive_gco_2_gco_gco.cpp new file mode 100644 index 00000000..2c791324 --- /dev/null +++ b/src/procedure2/IPrintable_DPrimitive_gco_2_gco_gco.cpp @@ -0,0 +1,28 @@ +/** @file IPrintable_DPrimitive_gco_2_gco_gco.cpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IPrintable_DPrimitive_gco_2_gco_gco.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/IPrintable_DPrimitive_gco_2_gco_gco.json5] +**/ + +#include "detail/IPrintable_DPrimitive_gco_2_gco_gco.hpp" + +namespace xo { + namespace scm { + auto + IPrintable_DPrimitive_gco_2_gco_gco::pretty(const DPrimitive_gco_2_gco_gco & self, const ppindentinfo & ppii) -> bool + { + return self.pretty(ppii); + } + + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end IPrintable_DPrimitive_gco_2_gco_gco.cpp */ \ No newline at end of file diff --git a/src/procedure2/procedure2_register_facets.cpp b/src/procedure2/procedure2_register_facets.cpp index c22b8049..5b84b4dd 100644 --- a/src/procedure2/procedure2_register_facets.cpp +++ b/src/procedure2/procedure2_register_facets.cpp @@ -8,14 +8,17 @@ #include "DPrimitive_gco_2_gco_gco.hpp" #include "detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp" +#include "detail/IPrintable_DPrimitive_gco_2_gco_gco.hpp" #include +#include #include #include namespace xo { using xo::facet::FacetRegistry; using xo::facet::typeseq; + using xo::print::APrintable; namespace scm { bool @@ -26,6 +29,7 @@ namespace xo { FacetRegistry::register_impl(); FacetRegistry::register_impl(); + FacetRegistry::register_impl(); log && log(xtag("DSimpleRcx.tseq", typeseq::id())); log && log(xtag("DPrimitive_gco_2_gco_gco.tseq", typeseq::id())); diff --git a/utest/DPrimitive.test.cpp b/utest/DPrimitive.test.cpp index b3775e62..73e807fd 100644 --- a/utest/DPrimitive.test.cpp +++ b/utest/DPrimitive.test.cpp @@ -7,13 +7,17 @@ #include #include #include +#include #include #include #include #include #include #include +#include +#include #include +#include namespace xo { using xo::scm::Primitives; @@ -22,12 +26,17 @@ namespace xo { using xo::scm::DFloat; using xo::scm::DInteger; using xo::scm::DArray; + using xo::scm::DPrimitive_gco_2_gco_gco; using xo::mm::AAllocator; using xo::mm::AGCObject; using xo::mm::DArena; using xo::mm::ArenaConfig; + using xo::print::APrintable; + using xo::print::ppstate_standalone; + using xo::print::ppconfig; using xo::facet::with_facet; using xo::facet::obj; + using xo::scope; namespace ut { static InitEvidence s_init = InitSubsys::require(); @@ -111,6 +120,24 @@ namespace xo { REQUIRE(result_float.data()->value() == 21.0); } + TEST_CASE("DPrimitive-pretty", "[procedure2][DPrimitive][pp]") + { + scope log(XO_DEBUG(false)); + + std::stringstream ss; + ppconfig ppc; + ppstate_standalone pps(&ss, 0, &ppc); + + obj prim_pr(&Primitives::s_mul_gco_gco_pm); + pps.pretty(prim_pr); + + std::string output = ss.str(); + + log && log(output); + + CHECK(output.find("_mul") != std::string::npos); + } + } /*namespace ut*/ } /*namespace xo*/ From 4d6404776e11b74cb1e8a12bb57ea7c75c0c07be Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Tue, 3 Feb 2026 14:27:42 -0500 Subject: [PATCH 14/90] xo-reader2 stack: streamlining + arith parser test --- include/xo/procedure2/DPrimitive.hpp | 4 +++- include/xo/procedure2/Primitive_gco_2_gco_gco.hpp | 11 +++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 include/xo/procedure2/Primitive_gco_2_gco_gco.hpp diff --git a/include/xo/procedure2/DPrimitive.hpp b/include/xo/procedure2/DPrimitive.hpp index 90fdba50..abec46cc 100644 --- a/include/xo/procedure2/DPrimitive.hpp +++ b/include/xo/procedure2/DPrimitive.hpp @@ -76,9 +76,11 @@ namespace xo { TypeDescr fn_td() const noexcept { return fn_td_; } - bool is_nary() const noexcept { return false; } + std::string_view name() const noexcept { return name_; } static constexpr std::int32_t n_args() noexcept { return Traits::n_args; } + bool is_nary() const noexcept { return false; } + obj apply_nocheck(obj rcx, const DArray * args) { return _apply_nocheck(rcx, args, std::make_index_sequence{}); diff --git a/include/xo/procedure2/Primitive_gco_2_gco_gco.hpp b/include/xo/procedure2/Primitive_gco_2_gco_gco.hpp new file mode 100644 index 00000000..9e6814f4 --- /dev/null +++ b/include/xo/procedure2/Primitive_gco_2_gco_gco.hpp @@ -0,0 +1,11 @@ +/** @file Primitive_gco_2_gco_gco.hpp + * + * @author Roland Conybeare, Feb 2026 + **/ + +#include "DPrimitive_gco_2_gco_gco.hpp" +#include "detail/IProcedure_DPrimitive_gco_2_gco_gco.hpp" +#include "detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp" +#include "detail/IPrintable_DPrimitive_gco_2_gco_gco.hpp" + +/* end Primitive_gco_2_gco_gco.hpp */ From cf5029274fef56f736cb623d4789ba3920451cb4 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Wed, 4 Feb 2026 16:25:37 -0500 Subject: [PATCH 15/90] xo-procedure2: streamline DSimpleRcx + regen facet *.pp --- CMakeLists.txt | 6 +++--- include/xo/procedure2/Procedure.hpp | 4 ++-- include/xo/procedure2/RuntimeContext.hpp | 4 ++-- include/xo/procedure2/SimpleRcx.hpp | 11 +++++++++++ include/xo/procedure2/detail/AProcedure.hpp | 6 ++++-- include/xo/procedure2/detail/ARuntimeContext.hpp | 6 ++++-- .../detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp | 2 +- .../detail/IPrintable_DPrimitive_gco_2_gco_gco.hpp | 2 +- include/xo/procedure2/detail/IProcedure_Any.hpp | 9 ++++++--- .../detail/IProcedure_DPrimitive_gco_2_gco_gco.hpp | 2 +- include/xo/procedure2/detail/IProcedure_Xfer.hpp | 9 ++++++--- .../xo/procedure2/detail/IRuntimeContext_Any.hpp | 9 ++++++--- .../detail/IRuntimeContext_DSimpleRcx.hpp | 2 +- .../xo/procedure2/detail/IRuntimeContext_Xfer.hpp | 9 ++++++--- include/xo/procedure2/detail/RProcedure.hpp | 9 ++++++--- include/xo/procedure2/detail/RRuntimeContext.hpp | 9 ++++++--- .../IGCObject_DPrimitive_gco_2_gco_gco.cpp | 4 ++-- .../IPrintable_DPrimitive_gco_2_gco_gco.cpp | 4 ++-- src/procedure2/IProcedure_Any.cpp | 2 +- .../IProcedure_DPrimitive_gco_2_gco_gco.cpp | 4 ++-- src/procedure2/IRuntimeContext_Any.cpp | 2 +- src/procedure2/IRuntimeContext_DSimpleRcx.cpp | 4 ++-- src/procedure2/procedure2_register_facets.cpp | 13 +++++++------ 23 files changed, 83 insertions(+), 49 deletions(-) create mode 100644 include/xo/procedure2/SimpleRcx.hpp diff --git a/CMakeLists.txt b/CMakeLists.txt index ad8673d1..a6fd4d21 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -91,12 +91,12 @@ xo_add_genfacetimpl( OUTPUT_CPP_DIR src/procedure2 ) -add_subdirectory(src/procedure2) -add_subdirectory(utest) +xo_add_genfacet_all(xo-procedure2-genfacet-all) # ---------------------------------------------------------------- -xo_add_genfacet_all(xo-procedure2-genfacet-all) +add_subdirectory(src/procedure2) +add_subdirectory(utest) # ---------------------------------------------------------------- # cmake export diff --git a/include/xo/procedure2/Procedure.hpp b/include/xo/procedure2/Procedure.hpp index 784608ed..05d1b661 100644 --- a/include/xo/procedure2/Procedure.hpp +++ b/include/xo/procedure2/Procedure.hpp @@ -2,7 +2,7 @@ * * Generated automagically from ingredients: * 1. code generator: - * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] + * [xo-facet/codegen/genfacet] * arguments: * --input [idl/Procedure.json5] * 2. jinja2 template for facet .hpp file: @@ -19,4 +19,4 @@ #include "detail/RProcedure.hpp" -/* end Procedure.hpp */ \ No newline at end of file +/* end Procedure.hpp */ diff --git a/include/xo/procedure2/RuntimeContext.hpp b/include/xo/procedure2/RuntimeContext.hpp index 3241451b..48891944 100644 --- a/include/xo/procedure2/RuntimeContext.hpp +++ b/include/xo/procedure2/RuntimeContext.hpp @@ -2,7 +2,7 @@ * * Generated automagically from ingredients: * 1. code generator: - * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] + * [xo-facet/codegen/genfacet] * arguments: * --input [idl/RuntimeContext.json5] * 2. jinja2 template for facet .hpp file: @@ -19,4 +19,4 @@ #include "detail/RRuntimeContext.hpp" -/* end RuntimeContext.hpp */ \ No newline at end of file +/* end RuntimeContext.hpp */ diff --git a/include/xo/procedure2/SimpleRcx.hpp b/include/xo/procedure2/SimpleRcx.hpp new file mode 100644 index 00000000..2fdc4929 --- /dev/null +++ b/include/xo/procedure2/SimpleRcx.hpp @@ -0,0 +1,11 @@ +/** @file SimpleRcx.hpp + * + * @author Roland Conybeare, Feb 2026 + **/ + +#pragma once + +#include "DSimpleRcx.hpp" +#include "detail/IRuntimeContext_DSimpleRcx.hpp" + +/* end SimpleRcx.hpp */ diff --git a/include/xo/procedure2/detail/AProcedure.hpp b/include/xo/procedure2/detail/AProcedure.hpp index 63a4da9b..eb119fbd 100644 --- a/include/xo/procedure2/detail/AProcedure.hpp +++ b/include/xo/procedure2/detail/AProcedure.hpp @@ -2,7 +2,7 @@ * * Generated automagically from ingredients: * 1. code generator: - * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] + * [xo-facet/codegen/genfacet] * arguments: * --input [idl/Procedure.json5] * 2. jinja2 template for abstract facet .hpp file: @@ -49,6 +49,8 @@ public: // const methods /** RTTI: unique id# for actual runtime data representation **/ virtual typeseq _typeseq() const noexcept = 0; + /** destroy instance @p d; calls c++ dtor only for actual runtime type; does not recover memory **/ + virtual void _drop(Opaque d) const noexcept = 0; /** true iff procedure takes n arguments **/ virtual bool is_nary(Copaque data) const noexcept = 0; /** number of arguments. -1 for n-ary **/ @@ -76,4 +78,4 @@ using IProcedure_ImplType = xo::facet::FacetImplType; } /*namespace scm*/ } /*namespace xo*/ -/* AProcedure.hpp */ \ No newline at end of file +/* AProcedure.hpp */ diff --git a/include/xo/procedure2/detail/ARuntimeContext.hpp b/include/xo/procedure2/detail/ARuntimeContext.hpp index 4e96bc8f..09831870 100644 --- a/include/xo/procedure2/detail/ARuntimeContext.hpp +++ b/include/xo/procedure2/detail/ARuntimeContext.hpp @@ -2,7 +2,7 @@ * * Generated automagically from ingredients: * 1. code generator: - * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] + * [xo-facet/codegen/genfacet] * arguments: * --input [idl/RuntimeContext.json5] * 2. jinja2 template for abstract facet .hpp file: @@ -47,6 +47,8 @@ public: // const methods /** RTTI: unique id# for actual runtime data representation **/ virtual typeseq _typeseq() const noexcept = 0; + /** destroy instance @p d; calls c++ dtor only for actual runtime type; does not recover memory **/ + virtual void _drop(Opaque d) const noexcept = 0; /** default allocator to use for objects **/ virtual obj allocator(Copaque data) const noexcept = 0; @@ -70,4 +72,4 @@ using IRuntimeContext_ImplType = xo::facet::FacetImplType allocator(Copaque) const noexcept override { _fatal(); } // nonconst methods @@ -83,4 +86,4 @@ namespace scm { } /*namespace scm */ } /*namespace xo */ -/* IRuntimeContext_Any.hpp */ \ No newline at end of file +/* IRuntimeContext_Any.hpp */ diff --git a/include/xo/procedure2/detail/IRuntimeContext_DSimpleRcx.hpp b/include/xo/procedure2/detail/IRuntimeContext_DSimpleRcx.hpp index 06f14bc5..247b6762 100644 --- a/include/xo/procedure2/detail/IRuntimeContext_DSimpleRcx.hpp +++ b/include/xo/procedure2/detail/IRuntimeContext_DSimpleRcx.hpp @@ -2,7 +2,7 @@ * * Generated automagically from ingredients: * 1. code generator: - * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] + * [xo-facet/codegen/genfacet] * arguments: * --input [idl/IRuntimeContext_DSimpleRcx.json5] * 2. jinja2 template for abstract facet .hpp file: diff --git a/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp b/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp index cd71b73e..a4545b8f 100644 --- a/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp +++ b/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp @@ -2,7 +2,7 @@ * * Generated automagically from ingredients: * 1. code generator: - * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] + * [xo-facet/codegen/genfacet] * arguments: * --input [idl/RuntimeContext.json5] * 2. jinja2 template for abstract facet .hpp file: @@ -39,8 +39,11 @@ namespace scm { // from ARuntimeContext - // const methods + // builtin methods typeseq _typeseq() const noexcept override { return s_typeseq; } + void _drop(Opaque d) const noexcept override { _dcast(d).~DRepr(); } + + // const methods obj allocator(Copaque data) const noexcept override { return I::allocator(_dcast(data)); } @@ -78,4 +81,4 @@ namespace scm { } /*namespace scm */ } /*namespace xo*/ -/* end IRuntimeContext_Xfer.hpp */ \ No newline at end of file +/* end IRuntimeContext_Xfer.hpp */ diff --git a/include/xo/procedure2/detail/RProcedure.hpp b/include/xo/procedure2/detail/RProcedure.hpp index 93599ae3..61bcb7f7 100644 --- a/include/xo/procedure2/detail/RProcedure.hpp +++ b/include/xo/procedure2/detail/RProcedure.hpp @@ -2,7 +2,7 @@ * * Generated automagically from ingredients: * 1. code generator: - * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] + * [xo-facet/codegen/genfacet] * arguments: * --input [idl/Procedure.json5] * 2. jinja2 template for abstract facet .hpp file: @@ -46,8 +46,11 @@ public: /** @defgroup scm-procedure-router-methods **/ ///@{ - // const methods + // builtin methods typeseq _typeseq() const noexcept { return O::iface()->_typeseq(); } + void _drop() const noexcept { O::iface()->_drop(O::data()); } + + // const methods bool is_nary() const noexcept { return O::iface()->is_nary(O::data()); } @@ -83,4 +86,4 @@ namespace xo { namespace facet { }; } } -/* end RProcedure.hpp */ \ No newline at end of file +/* end RProcedure.hpp */ diff --git a/include/xo/procedure2/detail/RRuntimeContext.hpp b/include/xo/procedure2/detail/RRuntimeContext.hpp index b06227c8..a6df812e 100644 --- a/include/xo/procedure2/detail/RRuntimeContext.hpp +++ b/include/xo/procedure2/detail/RRuntimeContext.hpp @@ -2,7 +2,7 @@ * * Generated automagically from ingredients: * 1. code generator: - * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] + * [xo-facet/codegen/genfacet] * arguments: * --input [idl/RuntimeContext.json5] * 2. jinja2 template for abstract facet .hpp file: @@ -46,8 +46,11 @@ public: /** @defgroup scm-runtimecontext-router-methods **/ ///@{ - // const methods + // builtin methods typeseq _typeseq() const noexcept { return O::iface()->_typeseq(); } + void _drop() const noexcept { O::iface()->_drop(O::data()); } + + // const methods obj allocator() const noexcept { return O::iface()->allocator(O::data()); } @@ -77,4 +80,4 @@ namespace xo { namespace facet { }; } } -/* end RRuntimeContext.hpp */ \ No newline at end of file +/* end RRuntimeContext.hpp */ diff --git a/src/procedure2/IGCObject_DPrimitive_gco_2_gco_gco.cpp b/src/procedure2/IGCObject_DPrimitive_gco_2_gco_gco.cpp index bd88e9ff..b889d0d0 100644 --- a/src/procedure2/IGCObject_DPrimitive_gco_2_gco_gco.cpp +++ b/src/procedure2/IGCObject_DPrimitive_gco_2_gco_gco.cpp @@ -2,7 +2,7 @@ * * Generated automagically from ingredients: * 1. code generator: - * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] + * [xo-facet/codegen/genfacet] * arguments: * --input [idl/IGCObject_DPrimitive_gco_2_gco_gco.json5] * 2. jinja2 template for abstract facet .hpp file: @@ -36,4 +36,4 @@ namespace xo { } /*namespace scm*/ } /*namespace xo*/ -/* end IGCObject_DPrimitive_gco_2_gco_gco.cpp */ \ No newline at end of file +/* end IGCObject_DPrimitive_gco_2_gco_gco.cpp */ diff --git a/src/procedure2/IPrintable_DPrimitive_gco_2_gco_gco.cpp b/src/procedure2/IPrintable_DPrimitive_gco_2_gco_gco.cpp index 2c791324..c8b7c2d8 100644 --- a/src/procedure2/IPrintable_DPrimitive_gco_2_gco_gco.cpp +++ b/src/procedure2/IPrintable_DPrimitive_gco_2_gco_gco.cpp @@ -2,7 +2,7 @@ * * Generated automagically from ingredients: * 1. code generator: - * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] + * [xo-facet/codegen/genfacet] * arguments: * --input [idl/IPrintable_DPrimitive_gco_2_gco_gco.json5] * 2. jinja2 template for abstract facet .hpp file: @@ -25,4 +25,4 @@ namespace xo { } /*namespace scm*/ } /*namespace xo*/ -/* end IPrintable_DPrimitive_gco_2_gco_gco.cpp */ \ No newline at end of file +/* end IPrintable_DPrimitive_gco_2_gco_gco.cpp */ diff --git a/src/procedure2/IProcedure_Any.cpp b/src/procedure2/IProcedure_Any.cpp index d28d98ee..dcdf9eeb 100644 --- a/src/procedure2/IProcedure_Any.cpp +++ b/src/procedure2/IProcedure_Any.cpp @@ -44,4 +44,4 @@ IProcedure_Any::apply_nocheck(Opaque, obj, const DArray *) -> } /*namespace scm*/ } /*namespace xo*/ -/* end IProcedure_Any.cpp */ \ No newline at end of file +/* end IProcedure_Any.cpp */ diff --git a/src/procedure2/IProcedure_DPrimitive_gco_2_gco_gco.cpp b/src/procedure2/IProcedure_DPrimitive_gco_2_gco_gco.cpp index 67e73c97..1207429f 100644 --- a/src/procedure2/IProcedure_DPrimitive_gco_2_gco_gco.cpp +++ b/src/procedure2/IProcedure_DPrimitive_gco_2_gco_gco.cpp @@ -2,7 +2,7 @@ * * Generated automagically from ingredients: * 1. code generator: - * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] + * [xo-facet/codegen/genfacet] * arguments: * --input [idl/IProcedure_DPrimitive_gco_2_gco_gco.json5] * 2. jinja2 template for abstract facet .hpp file: @@ -36,4 +36,4 @@ namespace xo { } /*namespace scm*/ } /*namespace xo*/ -/* end IProcedure_DPrimitive_gco_2_gco_gco.cpp */ \ No newline at end of file +/* end IProcedure_DPrimitive_gco_2_gco_gco.cpp */ diff --git a/src/procedure2/IRuntimeContext_Any.cpp b/src/procedure2/IRuntimeContext_Any.cpp index a9c5b55a..1ea5859a 100644 --- a/src/procedure2/IRuntimeContext_Any.cpp +++ b/src/procedure2/IRuntimeContext_Any.cpp @@ -38,4 +38,4 @@ IRuntimeContext_Any::_valid } /*namespace scm*/ } /*namespace xo*/ -/* end IRuntimeContext_Any.cpp */ \ No newline at end of file +/* end IRuntimeContext_Any.cpp */ diff --git a/src/procedure2/IRuntimeContext_DSimpleRcx.cpp b/src/procedure2/IRuntimeContext_DSimpleRcx.cpp index 4ec8378b..f057220d 100644 --- a/src/procedure2/IRuntimeContext_DSimpleRcx.cpp +++ b/src/procedure2/IRuntimeContext_DSimpleRcx.cpp @@ -2,7 +2,7 @@ * * Generated automagically from ingredients: * 1. code generator: - * [/home/roland/proj/xo-umbrella2-claude1/xo-facet/codegen/genfacet] + * [xo-facet/codegen/genfacet] * arguments: * --input [idl/IRuntimeContext_DSimpleRcx.json5] * 2. jinja2 template for abstract facet .hpp file: @@ -25,4 +25,4 @@ namespace xo { } /*namespace scm*/ } /*namespace xo*/ -/* end IRuntimeContext_DSimpleRcx.cpp */ \ No newline at end of file +/* end IRuntimeContext_DSimpleRcx.cpp */ diff --git a/src/procedure2/procedure2_register_facets.cpp b/src/procedure2/procedure2_register_facets.cpp index 5b84b4dd..6905e0ba 100644 --- a/src/procedure2/procedure2_register_facets.cpp +++ b/src/procedure2/procedure2_register_facets.cpp @@ -3,12 +3,9 @@ * @author Roland Conybeare, Jan 2026 **/ -#include "DSimpleRcx.hpp" -#include "detail/IRuntimeContext_DSimpleRcx.hpp" - -#include "DPrimitive_gco_2_gco_gco.hpp" -#include "detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp" -#include "detail/IPrintable_DPrimitive_gco_2_gco_gco.hpp" +#include "Procedure.hpp" +#include "SimpleRcx.hpp" +#include "Primitive_gco_2_gco_gco.hpp" #include #include @@ -28,12 +25,16 @@ namespace xo { FacetRegistry::register_impl(); + FacetRegistry::register_impl(); FacetRegistry::register_impl(); FacetRegistry::register_impl(); log && log(xtag("DSimpleRcx.tseq", typeseq::id())); log && log(xtag("DPrimitive_gco_2_gco_gco.tseq", typeseq::id())); + log && log(xtag("ARuntimeContext.tseq", typeseq::id())); + log && log(xtag("AProcedure.tseq", typeseq::id())); + return true; } From afd33eb8708172e00b7cf493e07a64fda00f272d Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Thu, 5 Feb 2026 10:44:11 -0500 Subject: [PATCH 16/90] xo-interpreter2 stack: work on variable references [WIP] --- idl/Procedure.json5 | 1 + 1 file changed, 1 insertion(+) diff --git a/idl/Procedure.json5 b/idl/Procedure.json5 index 91c8bdf3..449414f0 100644 --- a/idl/Procedure.json5 +++ b/idl/Procedure.json5 @@ -65,4 +65,5 @@ ] } ], + router_facet_explicit_content: [ ], } From 1fdc7c4f722e8f40d680ab79cd7cf558561e7724 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Thu, 12 Feb 2026 16:16:49 -0500 Subject: [PATCH 17/90] xo-interpreter2: vsm uses VsmRcx for runtime context --- idl/RuntimeContext.json5 | 1 + 1 file changed, 1 insertion(+) diff --git a/idl/RuntimeContext.json5 b/idl/RuntimeContext.json5 index 8a1e125f..e80c0bc5 100644 --- a/idl/RuntimeContext.json5 +++ b/idl/RuntimeContext.json5 @@ -40,4 +40,5 @@ ], nonconst_methods: [ ], + router_facet_explicit_content: [ ], } From cd38931c9d0dbbfde8bbf35280a623ba21eda6c6 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Fri, 13 Feb 2026 17:24:23 -0500 Subject: [PATCH 18/90] xo-reader2 stack: handle comparison expression (x == y) --- include/xo/procedure2/init_primitives.hpp | 6 ++ src/procedure2/init_primitives.cpp | 74 ++++++++++++++++++++--- 2 files changed, 73 insertions(+), 7 deletions(-) diff --git a/include/xo/procedure2/init_primitives.hpp b/include/xo/procedure2/init_primitives.hpp index 48b733df..d2d51a59 100644 --- a/include/xo/procedure2/init_primitives.hpp +++ b/include/xo/procedure2/init_primitives.hpp @@ -22,6 +22,12 @@ namespace xo { **/ static DPrimitive_gco_2_gco_gco s_mul_gco_gco_pm; + /** polymorphic equality comparison + * + * TODO: this will want to move to x-numeric/ + **/ + static DPrimitive_gco_2_gco_gco s_equal_gco_gco_pm; + #ifdef NOT_YET static Primitive_f64_1_f64 s_neg_f64_pm; diff --git a/src/procedure2/init_primitives.cpp b/src/procedure2/init_primitives.cpp index dbcb3b35..c1eceada 100644 --- a/src/procedure2/init_primitives.cpp +++ b/src/procedure2/init_primitives.cpp @@ -5,10 +5,11 @@ #include "init_primitives.hpp" #include "DPrimitive.hpp" -#include -#include -#include -#include +#include +//#include +#include +//#include +#include #include #include #include @@ -54,9 +55,6 @@ namespace xo { // 2. at that point will require polymorphic dispatch // on argument representations, analogous to dispatch // in FacetRegistry - // 3. Need concept of a 'runtime context'. - // This will need to be part of the AProcedure api - // e.g. passed to apply_nocheck typeseq x_tseq = x_gco._typeseq(); typeseq y_tseq = y_gco._typeseq(); @@ -101,6 +99,65 @@ namespace xo { return obj(); } + obj + equal_gco_gco(obj rcx, + obj x_gco, + obj y_gco) + { + using xo::reflect::typeseq; + + obj mm = rcx.allocator(); + + // PLACEHOLDER + + // TODO + // 1. move this to xo-numeric2/ when available + // 2. at that point will require polymorphic dispatch on argument representations. + // + + typeseq x_tseq = x_gco._typeseq(); + typeseq y_tseq = y_gco._typeseq(); + + // FOR NOW: just test runtime values + // + if (x_tseq == typeseq::id()) { + // i64 * .. + long x = GCObjectConversion::from_gco(mm, x_gco); + + if (y_tseq == typeseq::id()) { + // i64 == i64 + long y = GCObjectConversion::from_gco(mm, y_gco); + + return DBoolean::box(mm, x == y); + } else if (y_tseq == typeseq::id()) { + // i64 == f64 + double y = GCObjectConversion::from_gco(mm, y_gco); + + return DFloat::box(mm, static_cast(x) == y); + } + } else if (x_tseq == typeseq::id()) { + if (y_tseq == typeseq::id()) { + // f64 == i64. + double x = GCObjectConversion::from_gco(mm, x_gco); + long y = GCObjectConversion::from_gco(mm, y_gco); + + return DFloat::box(mm, x == static_cast(y)); + } else if (y_tseq == typeseq::id()) { + // f64 * f64. + double x = GCObjectConversion::from_gco(mm, x_gco); + double y = GCObjectConversion::from_gco(mm, y_gco); + + return DFloat::box(mm, x == y); + } + } + + // here: error + throw std::runtime_error(tostr("mul_gco_gco: unexpected argument types xt,yt", + xtag("x.tseq", x_tseq), + xtag("y.tseq", y_tseq))); + return obj(); + } + #ifdef NOT_YET double mul_f64_f64(double x, double y) { @@ -141,6 +198,9 @@ namespace xo { DPrimitive_gco_2_gco_gco Primitives::s_mul_gco_gco_pm("_mul", &mul_gco_gco); + DPrimitive_gco_2_gco_gco + Primitives::s_equal_gco_gco_pm("_equal", &equal_gco_gco); + #ifdef NOT_YET Primitive_f64_1_f64 Primitives::s_neg_f64_pm("_neg_d", From 4d98cb8ccf2f8e9eea422ff0bf9f104c05cfc378 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Mon, 16 Feb 2026 17:15:02 -0500 Subject: [PATCH 19/90] xo-procedure2 xo-cmake: move OUTPUT_CPP_DIR to idl/*.json5 --- idl/IGCObject_DPrimitive_gco_2_gco_gco.json5 | 1 + idl/IPrintable_DPrimitive_gco_2_gco_gco.json5 | 1 + idl/IProcedure_DPrimitive_gco_2_gco_gco.json5 | 1 + idl/IRuntimeContext_DSimpleRcx.json5 | 1 + idl/Procedure.json5 | 1 + idl/RuntimeContext.json5 | 1 + include/xo/procedure2/detail/RProcedure.hpp | 2 ++ include/xo/procedure2/detail/RRuntimeContext.hpp | 2 ++ 8 files changed, 10 insertions(+) diff --git a/idl/IGCObject_DPrimitive_gco_2_gco_gco.json5 b/idl/IGCObject_DPrimitive_gco_2_gco_gco.json5 index b2fb4014..79ee61d4 100644 --- a/idl/IGCObject_DPrimitive_gco_2_gco_gco.json5 +++ b/idl/IGCObject_DPrimitive_gco_2_gco_gco.json5 @@ -1,5 +1,6 @@ { mode: "implementation", + output_cpp_dir: "src/procedure2", includes: [ // "", diff --git a/idl/IPrintable_DPrimitive_gco_2_gco_gco.json5 b/idl/IPrintable_DPrimitive_gco_2_gco_gco.json5 index 15cff1b4..5eb7bf34 100644 --- a/idl/IPrintable_DPrimitive_gco_2_gco_gco.json5 +++ b/idl/IPrintable_DPrimitive_gco_2_gco_gco.json5 @@ -1,5 +1,6 @@ { mode: "implementation", + output_cpp_dir: "src/procedure2", includes: [ "", "", diff --git a/idl/IProcedure_DPrimitive_gco_2_gco_gco.json5 b/idl/IProcedure_DPrimitive_gco_2_gco_gco.json5 index fb22bad5..b0a770fd 100644 --- a/idl/IProcedure_DPrimitive_gco_2_gco_gco.json5 +++ b/idl/IProcedure_DPrimitive_gco_2_gco_gco.json5 @@ -1,5 +1,6 @@ { mode: "implementation", + output_cpp_dir: "src/procedure2", includes: [ "", "", diff --git a/idl/IRuntimeContext_DSimpleRcx.json5 b/idl/IRuntimeContext_DSimpleRcx.json5 index ed838629..4765285d 100644 --- a/idl/IRuntimeContext_DSimpleRcx.json5 +++ b/idl/IRuntimeContext_DSimpleRcx.json5 @@ -1,5 +1,6 @@ { mode: "implementation", + output_cpp_dir: "src/procedure2", includes: [ //"", //"", diff --git a/idl/Procedure.json5 b/idl/Procedure.json5 index 449414f0..7933c3a2 100644 --- a/idl/Procedure.json5 +++ b/idl/Procedure.json5 @@ -4,6 +4,7 @@ { mode: "facet", + output_cpp_dir: "src/procedure2", // includes in ASyntaxStateMachine.hpp includes: [ "\"RuntimeContext.hpp\"", diff --git a/idl/RuntimeContext.json5 b/idl/RuntimeContext.json5 index e80c0bc5..c896cc64 100644 --- a/idl/RuntimeContext.json5 +++ b/idl/RuntimeContext.json5 @@ -1,5 +1,6 @@ { mode: "facet", + output_cpp_dir: "src/procedure2", // includes in ARuntimeContext.hpp includes: [ "" diff --git a/include/xo/procedure2/detail/RProcedure.hpp b/include/xo/procedure2/detail/RProcedure.hpp index 61bcb7f7..191bd37e 100644 --- a/include/xo/procedure2/detail/RProcedure.hpp +++ b/include/xo/procedure2/detail/RProcedure.hpp @@ -46,6 +46,8 @@ public: /** @defgroup scm-procedure-router-methods **/ ///@{ + // explicit injected content + // builtin methods typeseq _typeseq() const noexcept { return O::iface()->_typeseq(); } void _drop() const noexcept { O::iface()->_drop(O::data()); } diff --git a/include/xo/procedure2/detail/RRuntimeContext.hpp b/include/xo/procedure2/detail/RRuntimeContext.hpp index a6df812e..a9e161ed 100644 --- a/include/xo/procedure2/detail/RRuntimeContext.hpp +++ b/include/xo/procedure2/detail/RRuntimeContext.hpp @@ -46,6 +46,8 @@ public: /** @defgroup scm-runtimecontext-router-methods **/ ///@{ + // explicit injected content + // builtin methods typeseq _typeseq() const noexcept { return O::iface()->_typeseq(); } void _drop() const noexcept { O::iface()->_drop(O::data()); } From 9f9569379528ff4e47820e2494f27a9820e029f3 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Mon, 16 Feb 2026 17:23:12 -0500 Subject: [PATCH 20/90] xo-procedure2 xo-cmake: drop unnecessary output-cpp-dir cmdline arg --- CMakeLists.txt | 6 ------ 1 file changed, 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a6fd4d21..1eced319 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,7 +27,6 @@ xo_add_genfacet( INPUT idl/Procedure.json5 OUTPUT_HPP_DIR include/xo/procedure2 OUTPUT_IMPL_SUBDIR detail - OUTPUT_CPP_DIR src/procedure2 ) # note: manual target; generated code committed to git @@ -37,7 +36,6 @@ xo_add_genfacet( INPUT idl/RuntimeContext.json5 OUTPUT_HPP_DIR include/xo/procedure2 OUTPUT_IMPL_SUBDIR detail - OUTPUT_CPP_DIR src/procedure2 ) # ---------------------------------------------------------------- @@ -50,7 +48,6 @@ xo_add_genfacetimpl( INPUT idl/IRuntimeContext_DSimpleRcx.json5 OUTPUT_HPP_DIR include/xo/procedure2 OUTPUT_IMPL_SUBDIR detail - OUTPUT_CPP_DIR src/procedure2 ) # ---------------------------------------------------------------- @@ -64,7 +61,6 @@ xo_add_genfacetimpl( INPUT idl/IProcedure_DPrimitive_gco_2_gco_gco.json5 OUTPUT_HPP_DIR include/xo/procedure2 OUTPUT_IMPL_SUBDIR detail - OUTPUT_CPP_DIR src/procedure2 ) # note: manual target; generated code committed to git @@ -76,7 +72,6 @@ xo_add_genfacetimpl( INPUT idl/IGCObject_DPrimitive_gco_2_gco_gco.json5 OUTPUT_HPP_DIR include/xo/procedure2 OUTPUT_IMPL_SUBDIR detail - OUTPUT_CPP_DIR src/procedure2 ) # note: manual target; generated code committed to git @@ -88,7 +83,6 @@ xo_add_genfacetimpl( INPUT idl/IPrintable_DPrimitive_gco_2_gco_gco.json5 OUTPUT_HPP_DIR include/xo/procedure2 OUTPUT_IMPL_SUBDIR detail - OUTPUT_CPP_DIR src/procedure2 ) xo_add_genfacet_all(xo-procedure2-genfacet-all) From b4f871fc2797b09d30dda631cd846e2b7a358b1f Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Mon, 16 Feb 2026 22:33:32 -0500 Subject: [PATCH 21/90] xo-facet: move output-hpp-dir + subdir to idl/*.json5 --- idl/IGCObject_DPrimitive_gco_2_gco_gco.json5 | 2 ++ idl/IPrintable_DPrimitive_gco_2_gco_gco.json5 | 2 ++ idl/IProcedure_DPrimitive_gco_2_gco_gco.json5 | 2 ++ idl/IRuntimeContext_DSimpleRcx.json5 | 2 ++ idl/Procedure.json5 | 2 ++ idl/RuntimeContext.json5 | 2 ++ 6 files changed, 12 insertions(+) diff --git a/idl/IGCObject_DPrimitive_gco_2_gco_gco.json5 b/idl/IGCObject_DPrimitive_gco_2_gco_gco.json5 index 79ee61d4..cd17ae4f 100644 --- a/idl/IGCObject_DPrimitive_gco_2_gco_gco.json5 +++ b/idl/IGCObject_DPrimitive_gco_2_gco_gco.json5 @@ -1,6 +1,8 @@ { mode: "implementation", output_cpp_dir: "src/procedure2", + output_hpp_dir: "include/xo/procedure2", + output_impl_subdir: "detail", includes: [ // "", diff --git a/idl/IPrintable_DPrimitive_gco_2_gco_gco.json5 b/idl/IPrintable_DPrimitive_gco_2_gco_gco.json5 index 5eb7bf34..ee3a1951 100644 --- a/idl/IPrintable_DPrimitive_gco_2_gco_gco.json5 +++ b/idl/IPrintable_DPrimitive_gco_2_gco_gco.json5 @@ -1,6 +1,8 @@ { mode: "implementation", output_cpp_dir: "src/procedure2", + output_hpp_dir: "include/xo/procedure2", + output_impl_subdir: "detail", includes: [ "", "", diff --git a/idl/IProcedure_DPrimitive_gco_2_gco_gco.json5 b/idl/IProcedure_DPrimitive_gco_2_gco_gco.json5 index b0a770fd..b50a8634 100644 --- a/idl/IProcedure_DPrimitive_gco_2_gco_gco.json5 +++ b/idl/IProcedure_DPrimitive_gco_2_gco_gco.json5 @@ -1,6 +1,8 @@ { mode: "implementation", output_cpp_dir: "src/procedure2", + output_hpp_dir: "include/xo/procedure2", + output_impl_subdir: "detail", includes: [ "", "", diff --git a/idl/IRuntimeContext_DSimpleRcx.json5 b/idl/IRuntimeContext_DSimpleRcx.json5 index 4765285d..324526f7 100644 --- a/idl/IRuntimeContext_DSimpleRcx.json5 +++ b/idl/IRuntimeContext_DSimpleRcx.json5 @@ -1,6 +1,8 @@ { mode: "implementation", output_cpp_dir: "src/procedure2", + output_hpp_dir: "include/xo/procedure2", + output_impl_subdir: "detail", includes: [ //"", //"", diff --git a/idl/Procedure.json5 b/idl/Procedure.json5 index 7933c3a2..b45227d0 100644 --- a/idl/Procedure.json5 +++ b/idl/Procedure.json5 @@ -5,6 +5,8 @@ { mode: "facet", output_cpp_dir: "src/procedure2", + output_hpp_dir: "include/xo/procedure2", + output_impl_subdir: "detail", // includes in ASyntaxStateMachine.hpp includes: [ "\"RuntimeContext.hpp\"", diff --git a/idl/RuntimeContext.json5 b/idl/RuntimeContext.json5 index c896cc64..07ed5b00 100644 --- a/idl/RuntimeContext.json5 +++ b/idl/RuntimeContext.json5 @@ -1,6 +1,8 @@ { mode: "facet", output_cpp_dir: "src/procedure2", + output_hpp_dir: "include/xo/procedure2", + output_impl_subdir: "detail", // includes in ARuntimeContext.hpp includes: [ "" From 3857f33b14f2278aaae67271f86474fe36146e92 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Mon, 16 Feb 2026 22:45:05 -0500 Subject: [PATCH 22/90] xo-procedure2: simplify facet codegen --- CMakeLists.txt | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1eced319..a8b29a22 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,8 +25,6 @@ xo_add_genfacet( TARGET xo-procedure2-facet-procedure FACET Procedure INPUT idl/Procedure.json5 - OUTPUT_HPP_DIR include/xo/procedure2 - OUTPUT_IMPL_SUBDIR detail ) # note: manual target; generated code committed to git @@ -34,8 +32,6 @@ xo_add_genfacet( TARGET xo-procedure2-facet-runtimecontext FACET RuntimeContext INPUT idl/RuntimeContext.json5 - OUTPUT_HPP_DIR include/xo/procedure2 - OUTPUT_IMPL_SUBDIR detail ) # ---------------------------------------------------------------- @@ -46,8 +42,6 @@ xo_add_genfacetimpl( FACET RuntimeContext REPR DSimpleRcx INPUT idl/IRuntimeContext_DSimpleRcx.json5 - OUTPUT_HPP_DIR include/xo/procedure2 - OUTPUT_IMPL_SUBDIR detail ) # ---------------------------------------------------------------- @@ -59,8 +53,6 @@ xo_add_genfacetimpl( FACET Procedure REPR DPrimitive_gco_2_gco_gco INPUT idl/IProcedure_DPrimitive_gco_2_gco_gco.json5 - OUTPUT_HPP_DIR include/xo/procedure2 - OUTPUT_IMPL_SUBDIR detail ) # note: manual target; generated code committed to git @@ -70,8 +62,6 @@ xo_add_genfacetimpl( FACET GCObject REPR Primitive_gco_2_gco_gco INPUT idl/IGCObject_DPrimitive_gco_2_gco_gco.json5 - OUTPUT_HPP_DIR include/xo/procedure2 - OUTPUT_IMPL_SUBDIR detail ) # note: manual target; generated code committed to git @@ -81,8 +71,6 @@ xo_add_genfacetimpl( FACET Printable REPR Primitive_gco_2_gco_gco INPUT idl/IPrintable_DPrimitive_gco_2_gco_gco.json5 - OUTPUT_HPP_DIR include/xo/procedure2 - OUTPUT_IMPL_SUBDIR detail ) xo_add_genfacet_all(xo-procedure2-genfacet-all) From 8ba87153ba583075a941906012086098e4086b90 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Tue, 17 Feb 2026 18:32:14 -0500 Subject: [PATCH 23/90] xo-procedure2: + generic subtract primitive --- include/xo/procedure2/init_primitives.hpp | 9 ++- src/procedure2/init_primitives.cpp | 67 ++++++++++++++++++++++- 2 files changed, 73 insertions(+), 3 deletions(-) diff --git a/include/xo/procedure2/init_primitives.hpp b/include/xo/procedure2/init_primitives.hpp index d2d51a59..6747fa6b 100644 --- a/include/xo/procedure2/init_primitives.hpp +++ b/include/xo/procedure2/init_primitives.hpp @@ -15,13 +15,20 @@ namespace xo { #endif struct Primitives { - /** polymorphich multiply + /** polymorphic multiply * * TODO: this will want to move to xo-numeric/ * so we can dispatch on vector, matrix, function types **/ static DPrimitive_gco_2_gco_gco s_mul_gco_gco_pm; + /** polymorphic subtract + * + * TODO: this will want to move to xo-numeric/ + * so we can dispatch on vector, matrix, function types + **/ + static DPrimitive_gco_2_gco_gco s_sub_gco_gco_pm; + /** polymorphic equality comparison * * TODO: this will want to move to x-numeric/ diff --git a/src/procedure2/init_primitives.cpp b/src/procedure2/init_primitives.cpp index c1eceada..f3759f4b 100644 --- a/src/procedure2/init_primitives.cpp +++ b/src/procedure2/init_primitives.cpp @@ -99,6 +99,66 @@ namespace xo { return obj(); } + obj + sub_gco_gco(obj rcx, + obj x_gco, + obj y_gco) + { + using xo::reflect::typeseq; + + obj mm = rcx.allocator(); + + // PLACEHOLDER + + // TODO: + // 1. move this to xo-numeric2/ when available + // 2. at that point will require polymorphic dispatch + // on argument representations, analogous to dispatch + // in FacetRegistry + + typeseq x_tseq = x_gco._typeseq(); + typeseq y_tseq = y_gco._typeseq(); + + // FOR NOW: just test runtime values + // + if (x_tseq == typeseq::id()) { + // i64 * .. + long x = GCObjectConversion::from_gco(mm, x_gco); + + if (y_tseq == typeseq::id()) { + // i64 * i64 + long y = GCObjectConversion::from_gco(mm, y_gco); + + return DInteger::box(mm, x - y); + } else if (y_tseq == typeseq::id()) { + // i64 * f64 + double y = GCObjectConversion::from_gco(mm, y_gco); + + return DFloat::box(mm, x - y); + } + } else if (x_tseq == typeseq::id()) { + if (y_tseq == typeseq::id()) { + // f64 * i64. + double x = GCObjectConversion::from_gco(mm, x_gco); + long y = GCObjectConversion::from_gco(mm, y_gco); + + return DFloat::box(mm, x - y); + } else if (y_tseq == typeseq::id()) { + // f64 * f64. + double x = GCObjectConversion::from_gco(mm, x_gco); + double y = GCObjectConversion::from_gco(mm, y_gco); + + return DFloat::box(mm, x - y); + } + } + + // here: error + throw std::runtime_error(tostr("sub_gco_gco: unexpected argument types xt,yt", + xtag("x.tseq", x_tseq), + xtag("y.tseq", y_tseq))); + return obj(); + } + obj equal_gco_gco(obj rcx, obj x_gco, @@ -113,7 +173,7 @@ namespace xo { // TODO // 1. move this to xo-numeric2/ when available // 2. at that point will require polymorphic dispatch on argument representations. - // + // typeseq x_tseq = x_gco._typeseq(); typeseq y_tseq = y_gco._typeseq(); @@ -150,7 +210,7 @@ namespace xo { return DFloat::box(mm, x == y); } } - + // here: error throw std::runtime_error(tostr("mul_gco_gco: unexpected argument types xt,yt", xtag("x.tseq", x_tseq), @@ -198,6 +258,9 @@ namespace xo { DPrimitive_gco_2_gco_gco Primitives::s_mul_gco_gco_pm("_mul", &mul_gco_gco); + DPrimitive_gco_2_gco_gco + Primitives::s_sub_gco_gco_pm("_sub", &sub_gco_gco); + DPrimitive_gco_2_gco_gco Primitives::s_equal_gco_gco_pm("_equal", &equal_gco_gco); From e75af5bb4fba2addbe951ebafc5656a81b59eaae Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Wed, 18 Feb 2026 13:44:57 -0500 Subject: [PATCH 24/90] + xo-numeric/ [WIP] --- CMakeLists.txt | 5 ----- 1 file changed, 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a8b29a22..ac63701b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -80,9 +80,4 @@ xo_add_genfacet_all(xo-procedure2-genfacet-all) add_subdirectory(src/procedure2) add_subdirectory(utest) -# ---------------------------------------------------------------- -# cmake export - -#xo_export_cmake_config(${PROJECT_NAME} ${PROJECT_VERSION} ${PROJECT_NAME}Targets) - # end CMakeLists.txt From 02f96d2e955381dbb55c8404351164e40e19dfdd Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Wed, 18 Feb 2026 22:00:30 -0800 Subject: [PATCH 25/90] xo-interpreter2 stack: use xo-numeric/ to support op* --- include/xo/procedure2/init_primitives.hpp | 2 ++ src/procedure2/init_primitives.cpp | 4 ++++ utest/DPrimitive.test.cpp | 5 +++++ 3 files changed, 11 insertions(+) diff --git a/include/xo/procedure2/init_primitives.hpp b/include/xo/procedure2/init_primitives.hpp index 6747fa6b..562a984c 100644 --- a/include/xo/procedure2/init_primitives.hpp +++ b/include/xo/procedure2/init_primitives.hpp @@ -15,12 +15,14 @@ namespace xo { #endif struct Primitives { +#ifdef OBSOLETE // see xo-numeric/src/numeric/NumericPrimitives.cpp /** polymorphic multiply * * TODO: this will want to move to xo-numeric/ * so we can dispatch on vector, matrix, function types **/ static DPrimitive_gco_2_gco_gco s_mul_gco_gco_pm; +#endif /** polymorphic subtract * diff --git a/src/procedure2/init_primitives.cpp b/src/procedure2/init_primitives.cpp index f3759f4b..1d1d50fc 100644 --- a/src/procedure2/init_primitives.cpp +++ b/src/procedure2/init_primitives.cpp @@ -39,6 +39,7 @@ namespace xo { } #endif +#ifdef OBSOLETE // see xo-numeric/xo/numeric/NumericPrimitives.cpp obj mul_gco_gco(obj rcx, obj x_gco, @@ -98,6 +99,7 @@ namespace xo { xtag("y.tseq", y_tseq))); return obj(); } +#endif obj sub_gco_gco(obj rcx, @@ -255,8 +257,10 @@ namespace xo { } #endif +#ifdef OSOLETE DPrimitive_gco_2_gco_gco Primitives::s_mul_gco_gco_pm("_mul", &mul_gco_gco); +#endif DPrimitive_gco_2_gco_gco Primitives::s_sub_gco_gco_pm("_sub", &sub_gco_gco); diff --git a/utest/DPrimitive.test.cpp b/utest/DPrimitive.test.cpp index 73e807fd..5d0fc318 100644 --- a/utest/DPrimitive.test.cpp +++ b/utest/DPrimitive.test.cpp @@ -46,6 +46,10 @@ namespace xo { REQUIRE(s_init.evidence()); } + // MOVE THESE TO xo-numeric/ + // Should work using NumericPrimitives::s_mul_gco_gco + +#ifdef OBSOLETE TEST_CASE("DPrimitive-n_args", "[procedure2][DPrimitive]") { // s_mul_gco_gco_pm takes 2 AGCObject args @@ -137,6 +141,7 @@ namespace xo { CHECK(output.find("_mul") != std::string::npos); } +#endif } /*namespace ut*/ } /*namespace xo*/ From 7a364d252ad409de3c008585a1856a10cb300e0f Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Wed, 18 Feb 2026 22:40:37 -0800 Subject: [PATCH 26/90] xo-reader2 stack: use NumericDispatch for *,/,+,- ops --- include/xo/procedure2/init_primitives.hpp | 2 +- src/procedure2/init_primitives.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/xo/procedure2/init_primitives.hpp b/include/xo/procedure2/init_primitives.hpp index 562a984c..411b3d3e 100644 --- a/include/xo/procedure2/init_primitives.hpp +++ b/include/xo/procedure2/init_primitives.hpp @@ -22,7 +22,6 @@ namespace xo { * so we can dispatch on vector, matrix, function types **/ static DPrimitive_gco_2_gco_gco s_mul_gco_gco_pm; -#endif /** polymorphic subtract * @@ -30,6 +29,7 @@ namespace xo { * so we can dispatch on vector, matrix, function types **/ static DPrimitive_gco_2_gco_gco s_sub_gco_gco_pm; +#endif /** polymorphic equality comparison * diff --git a/src/procedure2/init_primitives.cpp b/src/procedure2/init_primitives.cpp index 1d1d50fc..c3cc5176 100644 --- a/src/procedure2/init_primitives.cpp +++ b/src/procedure2/init_primitives.cpp @@ -99,7 +99,6 @@ namespace xo { xtag("y.tseq", y_tseq))); return obj(); } -#endif obj sub_gco_gco(obj rcx, @@ -160,6 +159,7 @@ namespace xo { xtag("y.tseq", y_tseq))); return obj(); } +#endif obj equal_gco_gco(obj rcx, @@ -260,10 +260,10 @@ namespace xo { #ifdef OSOLETE DPrimitive_gco_2_gco_gco Primitives::s_mul_gco_gco_pm("_mul", &mul_gco_gco); -#endif DPrimitive_gco_2_gco_gco Primitives::s_sub_gco_gco_pm("_sub", &sub_gco_gco); +#endif DPrimitive_gco_2_gco_gco Primitives::s_equal_gco_gco_pm("_equal", &equal_gco_gco); From 1595302e131b43e248388c6378d77d0cedcaf59e Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Thu, 19 Feb 2026 09:03:02 -0800 Subject: [PATCH 27/90] xo-interpreter2 stack: streamline op== impl + utests --- include/xo/procedure2/init_primitives.hpp | 2 +- src/procedure2/init_primitives.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/xo/procedure2/init_primitives.hpp b/include/xo/procedure2/init_primitives.hpp index 411b3d3e..14f5fdc8 100644 --- a/include/xo/procedure2/init_primitives.hpp +++ b/include/xo/procedure2/init_primitives.hpp @@ -29,13 +29,13 @@ namespace xo { * so we can dispatch on vector, matrix, function types **/ static DPrimitive_gco_2_gco_gco s_sub_gco_gco_pm; -#endif /** polymorphic equality comparison * * TODO: this will want to move to x-numeric/ **/ static DPrimitive_gco_2_gco_gco s_equal_gco_gco_pm; +#endif #ifdef NOT_YET static Primitive_f64_1_f64 s_neg_f64_pm; diff --git a/src/procedure2/init_primitives.cpp b/src/procedure2/init_primitives.cpp index c3cc5176..1fd3950c 100644 --- a/src/procedure2/init_primitives.cpp +++ b/src/procedure2/init_primitives.cpp @@ -159,7 +159,6 @@ namespace xo { xtag("y.tseq", y_tseq))); return obj(); } -#endif obj equal_gco_gco(obj rcx, @@ -219,6 +218,7 @@ namespace xo { xtag("y.tseq", y_tseq))); return obj(); } +#endif #ifdef NOT_YET double @@ -263,10 +263,10 @@ namespace xo { DPrimitive_gco_2_gco_gco Primitives::s_sub_gco_gco_pm("_sub", &sub_gco_gco); -#endif DPrimitive_gco_2_gco_gco Primitives::s_equal_gco_gco_pm("_equal", &equal_gco_gco); +#endif #ifdef NOT_YET Primitive_f64_1_f64 From 009aeddd91fdbf501d0f866d1494a25f688a1fa6 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Fri, 27 Feb 2026 19:38:53 +1100 Subject: [PATCH 28/90] xo-cmake: setup to make share target available via cmake install --- cmake/xo_procedure2Config.cmake.in | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/xo_procedure2Config.cmake.in b/cmake/xo_procedure2Config.cmake.in index 867a3535..fa6ee3cd 100644 --- a/cmake/xo_procedure2Config.cmake.in +++ b/cmake/xo_procedure2Config.cmake.in @@ -11,4 +11,5 @@ find_dependency(xo_gc) find_dependency(subsys) include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") +include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Share.cmake") check_required_components("@PROJECT_NAME@") From 210145cd14efb59b1b4b84f5640b180d9c62c221 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Fri, 27 Feb 2026 19:41:03 +1100 Subject: [PATCH 29/90] osx build: #include in _Any.cpp --- src/procedure2/IProcedure_Any.cpp | 1 + src/procedure2/IRuntimeContext_Any.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/src/procedure2/IProcedure_Any.cpp b/src/procedure2/IProcedure_Any.cpp index dcdf9eeb..8ff611c7 100644 --- a/src/procedure2/IProcedure_Any.cpp +++ b/src/procedure2/IProcedure_Any.cpp @@ -4,6 +4,7 @@ #include "detail/IProcedure_Any.hpp" #include +#include namespace xo { namespace scm { diff --git a/src/procedure2/IRuntimeContext_Any.cpp b/src/procedure2/IRuntimeContext_Any.cpp index 1ea5859a..195bd135 100644 --- a/src/procedure2/IRuntimeContext_Any.cpp +++ b/src/procedure2/IRuntimeContext_Any.cpp @@ -4,6 +4,7 @@ #include "detail/IRuntimeContext_Any.hpp" #include +#include namespace xo { namespace scm { From 19906d582ef251b8d5e0d3c559cb241b3d9772ea Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Sat, 28 Feb 2026 13:20:11 +1100 Subject: [PATCH 30/90] xo-interpreter2 stack: support 0-argument function calls --- include/xo/procedure2/DPrimitive.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/include/xo/procedure2/DPrimitive.hpp b/include/xo/procedure2/DPrimitive.hpp index abec46cc..e458ce3a 100644 --- a/include/xo/procedure2/DPrimitive.hpp +++ b/include/xo/procedure2/DPrimitive.hpp @@ -110,7 +110,6 @@ namespace xo { using R = typename Traits::return_type; assert(args); - assert(args->size() > 0); obj mm = rcx.allocator(); From c99ac53c728fac8ff7fcf15ce5c045a82ce18ccc Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Sat, 28 Feb 2026 13:26:10 +1100 Subject: [PATCH 31/90] xo-interpreter2 stack: + RuntimeContext.visit_pools() method --- idl/RuntimeContext.json5 | 19 ++++++++++++++++++- include/xo/procedure2/DSimpleRcx.hpp | 2 ++ .../xo/procedure2/detail/ARuntimeContext.hpp | 5 +++++ .../procedure2/detail/IRuntimeContext_Any.hpp | 2 ++ .../detail/IRuntimeContext_DSimpleRcx.hpp | 3 +++ .../detail/IRuntimeContext_Xfer.hpp | 5 +++++ .../xo/procedure2/detail/RRuntimeContext.hpp | 4 ++++ src/procedure2/CMakeLists.txt | 3 +-- src/procedure2/DSimpleRcx.cpp | 19 +++++++++++++++++++ src/procedure2/IRuntimeContext_DSimpleRcx.cpp | 6 ++++++ 10 files changed, 65 insertions(+), 3 deletions(-) create mode 100644 src/procedure2/DSimpleRcx.cpp diff --git a/idl/RuntimeContext.json5 b/idl/RuntimeContext.json5 index 07ed5b00..40120771 100644 --- a/idl/RuntimeContext.json5 +++ b/idl/RuntimeContext.json5 @@ -5,7 +5,8 @@ output_impl_subdir: "detail", // includes in ARuntimeContext.hpp includes: [ - "" + "", + "" ], // extra includes in RuntimeContext.hpp, if any user_hpp_includes: [ @@ -29,6 +30,11 @@ definition: "xo::mm::AAllocator", doc: [ "xo memory allocator" ], }, + { + name: "MemorySizeVisitor", + definition: "xo::mm::MemorySizeVisitor", + doc: [ "function to visit memory pools" ], + }, ], const_methods: [ { @@ -40,6 +46,17 @@ noexcept: true, attributes: [], }, + { + name: "visit_pools", + doc: [ "invoke visitor for each distinct memory pool" ], + return_type: "void", + args: [ + {type: "MemorySizeVisitor", name: "visitor"} + ], + const: true, + noexcept: false, + attributes: [], + }, ], nonconst_methods: [ ], diff --git a/include/xo/procedure2/DSimpleRcx.hpp b/include/xo/procedure2/DSimpleRcx.hpp index bd52dcc5..1efb802e 100644 --- a/include/xo/procedure2/DSimpleRcx.hpp +++ b/include/xo/procedure2/DSimpleRcx.hpp @@ -18,11 +18,13 @@ namespace xo { class DSimpleRcx { public: using AAllocator = xo::mm::AAllocator; + using MemorySizeVisitor = xo::mm::MemorySizeVisitor; public: DSimpleRcx(obj mm) : allocator_{mm} {} obj allocator() const noexcept { return allocator_; } + void visit_pools(const MemorySizeVisitor & visitor) const; private: obj allocator_; diff --git a/include/xo/procedure2/detail/ARuntimeContext.hpp b/include/xo/procedure2/detail/ARuntimeContext.hpp index 09831870..820dd8dd 100644 --- a/include/xo/procedure2/detail/ARuntimeContext.hpp +++ b/include/xo/procedure2/detail/ARuntimeContext.hpp @@ -15,6 +15,7 @@ // includes (via {facet_includes}) #include +#include #include #include #include @@ -40,6 +41,8 @@ public: using Opaque = void *; /** xo memory allocator **/ using AAllocator = xo::mm::AAllocator; + /** function to visit memory pools **/ + using MemorySizeVisitor = xo::mm::MemorySizeVisitor; ///@} /** @defgroup scm-runtimecontext-methods **/ @@ -51,6 +54,8 @@ public: virtual void _drop(Opaque d) const noexcept = 0; /** default allocator to use for objects **/ virtual obj allocator(Copaque data) const noexcept = 0; + /** invoke visitor for each distinct memory pool **/ + virtual void visit_pools(Copaque data, MemorySizeVisitor visitor) const = 0; // nonconst methods ///@} diff --git a/include/xo/procedure2/detail/IRuntimeContext_Any.hpp b/include/xo/procedure2/detail/IRuntimeContext_Any.hpp index cb6dfa45..2caa9d34 100644 --- a/include/xo/procedure2/detail/IRuntimeContext_Any.hpp +++ b/include/xo/procedure2/detail/IRuntimeContext_Any.hpp @@ -45,6 +45,7 @@ namespace scm { /** integer identifying a type **/ using typeseq = xo::facet::typeseq; using AAllocator = ARuntimeContext::AAllocator; + using MemorySizeVisitor = ARuntimeContext::MemorySizeVisitor; ///@} /** @defgroup scm-runtimecontext-any-methods **/ @@ -60,6 +61,7 @@ namespace scm { // const methods [[noreturn]] obj allocator(Copaque) const noexcept override { _fatal(); } + [[noreturn]] void visit_pools(Copaque, MemorySizeVisitor) const override { _fatal(); } // nonconst methods diff --git a/include/xo/procedure2/detail/IRuntimeContext_DSimpleRcx.hpp b/include/xo/procedure2/detail/IRuntimeContext_DSimpleRcx.hpp index 247b6762..62d3e12d 100644 --- a/include/xo/procedure2/detail/IRuntimeContext_DSimpleRcx.hpp +++ b/include/xo/procedure2/detail/IRuntimeContext_DSimpleRcx.hpp @@ -40,6 +40,7 @@ namespace xo { /** @defgroup scm-runtimecontext-dsimplercx-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 allocator(const DSimpleRcx & self) noexcept; + /** invoke visitor for each distinct memory pool **/ + static void visit_pools(const DSimpleRcx & self, MemorySizeVisitor visitor); // non-const methods ///@} diff --git a/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp b/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp index a4545b8f..6257abb4 100644 --- a/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp +++ b/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp @@ -14,6 +14,7 @@ #pragma once #include +#include namespace xo { namespace scm { @@ -29,6 +30,7 @@ namespace scm { /** integer identifying a type **/ using typeseq = ARuntimeContext::typeseq; using AAllocator = ARuntimeContext::AAllocator; + using MemorySizeVisitor = ARuntimeContext::MemorySizeVisitor; ///@} /** @defgroup scm-runtimecontext-xfer-methods **/ @@ -47,6 +49,9 @@ namespace scm { obj allocator(Copaque data) const noexcept override { return I::allocator(_dcast(data)); } + void visit_pools(Copaque data, MemorySizeVisitor visitor) const override { + return I::visit_pools(_dcast(data), visitor); + } // non-const methods diff --git a/include/xo/procedure2/detail/RRuntimeContext.hpp b/include/xo/procedure2/detail/RRuntimeContext.hpp index a9e161ed..5840743e 100644 --- a/include/xo/procedure2/detail/RRuntimeContext.hpp +++ b/include/xo/procedure2/detail/RRuntimeContext.hpp @@ -32,6 +32,7 @@ public: using DataPtr = Object::DataPtr; using typeseq = xo::reflect::typeseq; using AAllocator = ARuntimeContext::AAllocator; + using MemorySizeVisitor = ARuntimeContext::MemorySizeVisitor; ///@} /** @defgroup scm-runtimecontext-router-ctors **/ @@ -56,6 +57,9 @@ public: obj allocator() const noexcept { return O::iface()->allocator(O::data()); } + void visit_pools(MemorySizeVisitor visitor) const { + return O::iface()->visit_pools(O::data(), visitor); + } // non-const methods (still const in router!) diff --git a/src/procedure2/CMakeLists.txt b/src/procedure2/CMakeLists.txt index 92685afb..45f41bd8 100644 --- a/src/procedure2/CMakeLists.txt +++ b/src/procedure2/CMakeLists.txt @@ -6,6 +6,7 @@ set(SELF_SRCS init_primitives.cpp procedure2_register_types.cpp procedure2_register_facets.cpp + DSimpleRcx.cpp IRuntimeContext_Any.cpp IRuntimeContext_DSimpleRcx.cpp IProcedure_Any.cpp @@ -13,8 +14,6 @@ set(SELF_SRCS IGCObject_DPrimitive_gco_2_gco_gco.cpp IProcedure_DPrimitive_gco_2_gco_gco.cpp IPrintable_DPrimitive_gco_2_gco_gco.cpp - # Add source files here, e.g.: - # procedure2.cpp ) xo_add_shared_library4(${SELF_LIB} ${PROJECT_NAME}Targets ${PROJECT_VERSION} 1 ${SELF_SRCS}) diff --git a/src/procedure2/DSimpleRcx.cpp b/src/procedure2/DSimpleRcx.cpp new file mode 100644 index 00000000..30ec9c95 --- /dev/null +++ b/src/procedure2/DSimpleRcx.cpp @@ -0,0 +1,19 @@ +/** @file DSimpleRcx.cpp + * + * @author Roland Conybeare, Feb 2026 + **/ + +#include "DSimpleRcx.hpp" + +namespace xo { + namespace scm { + + void + DSimpleRcx::visit_pools(const MemorySizeVisitor & visitor) const + { + allocator_.visit_pools(visitor); + } + } +} + +/* end DSimpleRcx.cpp */ diff --git a/src/procedure2/IRuntimeContext_DSimpleRcx.cpp b/src/procedure2/IRuntimeContext_DSimpleRcx.cpp index f057220d..2331b7c1 100644 --- a/src/procedure2/IRuntimeContext_DSimpleRcx.cpp +++ b/src/procedure2/IRuntimeContext_DSimpleRcx.cpp @@ -21,6 +21,12 @@ namespace xo { return self.allocator(); } + auto + IRuntimeContext_DSimpleRcx::visit_pools(const DSimpleRcx & self, MemorySizeVisitor visitor) -> void + { + self.visit_pools(visitor); + } + } /*namespace scm*/ } /*namespace xo*/ From bb2072594026bc3f5e6a56c492eadc8aff32e9b5 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Sat, 28 Feb 2026 13:27:34 +1100 Subject: [PATCH 32/90] xo-procedure2: + DPrimitive_gco_0 (primitive with 0 arguments) --- CMakeLists.txt | 29 ++++++++ idl/IGCObject_DPrimitive_gco_0.json5 | 19 ++++++ idl/IPrintable_DPrimitive_gco_0.json5 | 18 +++++ idl/IProcedure_DPrimitive_gco_0.json5 | 20 ++++++ include/xo/procedure2/DPrimitive_gco_0.hpp | 20 ++++++ include/xo/procedure2/Primitive_gco_0.hpp | 11 +++ .../detail/IGCObject_DPrimitive_gco_0.hpp | 67 +++++++++++++++++++ .../detail/IPrintable_DPrimitive_gco_0.hpp | 62 +++++++++++++++++ .../detail/IProcedure_DPrimitive_gco_0.hpp | 67 +++++++++++++++++++ src/procedure2/CMakeLists.txt | 3 + src/procedure2/IGCObject_DPrimitive_gco_0.cpp | 39 +++++++++++ .../IPrintable_DPrimitive_gco_0.cpp | 28 ++++++++ .../IProcedure_DPrimitive_gco_0.cpp | 39 +++++++++++ src/procedure2/procedure2_register_facets.cpp | 5 ++ src/procedure2/procedure2_register_types.cpp | 2 + 15 files changed, 429 insertions(+) create mode 100644 idl/IGCObject_DPrimitive_gco_0.json5 create mode 100644 idl/IPrintable_DPrimitive_gco_0.json5 create mode 100644 idl/IProcedure_DPrimitive_gco_0.json5 create mode 100644 include/xo/procedure2/DPrimitive_gco_0.hpp create mode 100644 include/xo/procedure2/Primitive_gco_0.hpp create mode 100644 include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp create mode 100644 include/xo/procedure2/detail/IPrintable_DPrimitive_gco_0.hpp create mode 100644 include/xo/procedure2/detail/IProcedure_DPrimitive_gco_0.hpp create mode 100644 src/procedure2/IGCObject_DPrimitive_gco_0.cpp create mode 100644 src/procedure2/IPrintable_DPrimitive_gco_0.cpp create mode 100644 src/procedure2/IProcedure_DPrimitive_gco_0.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index ac63701b..b4cc8fbb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -46,6 +46,35 @@ xo_add_genfacetimpl( # ---------------------------------------------------------------- +# note: manual target; generated code committed to git +xo_add_genfacetimpl( + TARGET xo-procedure2-facetimpl-procedure-primitive_gco_0 + FACET_PKG xo_procedure2 + FACET Procedure + REPR DPrimitive_gco_0 + INPUT idl/IProcedure_DPrimitive_gco_0.json5 +) + +# note: manual target; generated code committed to git +xo_add_genfacetimpl( + TARGET xo-procedure2-facetimpl-gcobject-primitive_gco_0 + FACET_PKG xo_gc + FACET GCObject + REPR Primitive_gco_0 + INPUT idl/IGCObject_DPrimitive_gco_0.json5 +) + +# note: manual target; generated code committed to git +xo_add_genfacetimpl( + TARGET xo-procedure2-facetimpl-printable-primitive_gco_0 + FACET_PKG xo_printable2 + FACET Printable + REPR Primitive_gco_0 + INPUT idl/IPrintable_DPrimitive_gco_0.json5 +) + +# ---------------------------------------------------------------- + # note: manual target; generated code committed to git xo_add_genfacetimpl( TARGET xo-procedure2-facetimpl-procedure-primitive_gco_2_gco_gco diff --git a/idl/IGCObject_DPrimitive_gco_0.json5 b/idl/IGCObject_DPrimitive_gco_0.json5 new file mode 100644 index 00000000..27557c24 --- /dev/null +++ b/idl/IGCObject_DPrimitive_gco_0.json5 @@ -0,0 +1,19 @@ +{ + mode: "implementation", + output_cpp_dir: "src/procedure2", + output_hpp_dir: "include/xo/procedure2", + output_impl_subdir: "detail", + includes: [ + // + "", + "", + ], + local_types: [ ], + namespace1: "xo", + namespace2: "scm", + facet_idl: "idl/GCObject.json5", + brief: "provide AGCobject interface for Primitive _ -> gco", + using_doxygen: true, + repr: "DPrimitive_gco_0", + doc: [ "implement AGCObject for DPrimitive _ -> gco" ], +} diff --git a/idl/IPrintable_DPrimitive_gco_0.json5 b/idl/IPrintable_DPrimitive_gco_0.json5 new file mode 100644 index 00000000..830078c9 --- /dev/null +++ b/idl/IPrintable_DPrimitive_gco_0.json5 @@ -0,0 +1,18 @@ +{ + mode: "implementation", + output_cpp_dir: "src/procedure2", + output_hpp_dir: "include/xo/procedure2", + output_impl_subdir: "detail", + includes: [ + "", + "", + ], + local_types: [ ], + namespace1: "xo", + namespace2: "scm", + facet_idl: "idl/Printable.json5", + brief: "provide APrintable interface for DPrimitive _ -> gco", + using_doxygen: true, + repr: "DPrimitive_gco_0", + doc: [ "implement APrintable for DPrimitive _ -> gco" ], +} diff --git a/idl/IProcedure_DPrimitive_gco_0.json5 b/idl/IProcedure_DPrimitive_gco_0.json5 new file mode 100644 index 00000000..757e5f5f --- /dev/null +++ b/idl/IProcedure_DPrimitive_gco_0.json5 @@ -0,0 +1,20 @@ +{ + mode: "implementation", + output_cpp_dir: "src/procedure2", + output_hpp_dir: "include/xo/procedure2", + output_impl_subdir: "detail", + includes: [ + "", + "", + "", + "", + ], + local_types: [ ], + namespace1: "xo", + namespace2: "scm", + facet_idl: "idl/Procedure.json5", + brief: "provide AProcedure interface for Primitive _ -> gco", + using_doxygen: true, + repr: "DPrimitive_gco_0", + doc: [ "implement AProcedure for DPrimitive _ -> gco" ], +} diff --git a/include/xo/procedure2/DPrimitive_gco_0.hpp b/include/xo/procedure2/DPrimitive_gco_0.hpp new file mode 100644 index 00000000..7e5633cf --- /dev/null +++ b/include/xo/procedure2/DPrimitive_gco_0.hpp @@ -0,0 +1,20 @@ +/** @file DPrimitive_gco_0.hpp + * + * @author Roland Conybeare, Jan 2026 + **/ + +#pragma once + +#include +#include "DPrimitive.hpp" + +namespace xo { + namespace scm { + using xo::mm::AGCObject; + using xo::facet::obj; + + using DPrimitive_gco_0 = Primitive (*)(obj)>; + } +} + +/* end DPrimitive_gco_0.hpp */ diff --git a/include/xo/procedure2/Primitive_gco_0.hpp b/include/xo/procedure2/Primitive_gco_0.hpp new file mode 100644 index 00000000..00b2d866 --- /dev/null +++ b/include/xo/procedure2/Primitive_gco_0.hpp @@ -0,0 +1,11 @@ +/** @file Primitive_gco_0_gco_gco.hpp + * + * @author Roland Conybeare, Feb 2026 + **/ + +#include "DPrimitive_gco_0.hpp" +#include "detail/IProcedure_DPrimitive_gco_0.hpp" +#include "detail/IGCObject_DPrimitive_gco_0.hpp" +#include "detail/IPrintable_DPrimitive_gco_0.hpp" + +/* end Primitive_gco_2_gco_gco.hpp */ diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp new file mode 100644 index 00000000..91ff1833 --- /dev/null +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp @@ -0,0 +1,67 @@ +/** @file IGCObject_DPrimitive_gco_0.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IGCObject_DPrimitive_gco_0.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_repr.hpp.j2] + * 3. idl for facet methods + * [idl/IGCObject_DPrimitive_gco_0.json5] + **/ + +#pragma once + +#include "GCObject.hpp" +#include +#include +#include "DPrimitive_gco_0.hpp" + +namespace xo { namespace scm { class IGCObject_DPrimitive_gco_0; } } + +namespace xo { + namespace facet { + template <> + struct FacetImplementation + { + using ImplType = xo::mm::IGCObject_Xfer + ; + }; + } +} + +namespace xo { + namespace scm { + /** @class IGCObject_DPrimitive_gco_0 + **/ + class IGCObject_DPrimitive_gco_0 { + public: + /** @defgroup scm-gcobject-dprimitive_gco_0-type-traits **/ + ///@{ + using size_type = xo::mm::AGCObject::size_type; + using AAllocator = xo::mm::AGCObject::AAllocator; + using ACollector = xo::mm::AGCObject::ACollector; + using Copaque = xo::mm::AGCObject::Copaque; + using Opaque = xo::mm::AGCObject::Opaque; + ///@} + /** @defgroup scm-gcobject-dprimitive_gco_0-methods **/ + ///@{ + // const methods + /** memory consumption for this instance **/ + static size_type shallow_size(const DPrimitive_gco_0 & self) noexcept; + /** copy instance using allocator **/ + static Opaque shallow_copy(const DPrimitive_gco_0 & self, obj mm) noexcept; + + // non-const methods + /** during GC: forward immdiate children **/ + static size_type forward_children(DPrimitive_gco_0 & self, obj gc) noexcept; + ///@} + }; + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end */ \ No newline at end of file diff --git a/include/xo/procedure2/detail/IPrintable_DPrimitive_gco_0.hpp b/include/xo/procedure2/detail/IPrintable_DPrimitive_gco_0.hpp new file mode 100644 index 00000000..d8b30128 --- /dev/null +++ b/include/xo/procedure2/detail/IPrintable_DPrimitive_gco_0.hpp @@ -0,0 +1,62 @@ +/** @file IPrintable_DPrimitive_gco_0.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IPrintable_DPrimitive_gco_0.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_repr.hpp.j2] + * 3. idl for facet methods + * [idl/IPrintable_DPrimitive_gco_0.json5] + **/ + +#pragma once + +#include "Printable.hpp" +#include +#include +#include "DPrimitive_gco_0.hpp" + +namespace xo { namespace scm { class IPrintable_DPrimitive_gco_0; } } + +namespace xo { + namespace facet { + template <> + struct FacetImplementation + { + using ImplType = xo::print::IPrintable_Xfer + ; + }; + } +} + +namespace xo { + namespace scm { + /** @class IPrintable_DPrimitive_gco_0 + **/ + class IPrintable_DPrimitive_gco_0 { + public: + /** @defgroup scm-printable-dprimitive_gco_0-type-traits **/ + ///@{ + using ppindentinfo = xo::print::APrintable::ppindentinfo; + using Copaque = xo::print::APrintable::Copaque; + using Opaque = xo::print::APrintable::Opaque; + ///@} + /** @defgroup scm-printable-dprimitive_gco_0-methods **/ + ///@{ + // const methods + /** Pretty-printing support for this object. +See [xo-indentlog/xo/indentlog/pretty.hpp] **/ + static bool pretty(const DPrimitive_gco_0 & self, const ppindentinfo & ppii); + + // non-const methods + ///@} + }; + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end */ \ No newline at end of file diff --git a/include/xo/procedure2/detail/IProcedure_DPrimitive_gco_0.hpp b/include/xo/procedure2/detail/IProcedure_DPrimitive_gco_0.hpp new file mode 100644 index 00000000..cd1a9b3a --- /dev/null +++ b/include/xo/procedure2/detail/IProcedure_DPrimitive_gco_0.hpp @@ -0,0 +1,67 @@ +/** @file IProcedure_DPrimitive_gco_0.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IProcedure_DPrimitive_gco_0.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_repr.hpp.j2] + * 3. idl for facet methods + * [idl/IProcedure_DPrimitive_gco_0.json5] + **/ + +#pragma once + +#include "Procedure.hpp" +#include +#include +#include +#include +#include "DPrimitive_gco_0.hpp" + +namespace xo { namespace scm { class IProcedure_DPrimitive_gco_0; } } + +namespace xo { + namespace facet { + template <> + struct FacetImplementation + { + using ImplType = xo::scm::IProcedure_Xfer + ; + }; + } +} + +namespace xo { + namespace scm { + /** @class IProcedure_DPrimitive_gco_0 + **/ + class IProcedure_DPrimitive_gco_0 { + public: + /** @defgroup scm-procedure-dprimitive_gco_0-type-traits **/ + ///@{ + using AGCObject = xo::scm::AProcedure::AGCObject; + using Copaque = xo::scm::AProcedure::Copaque; + using Opaque = xo::scm::AProcedure::Opaque; + ///@} + /** @defgroup scm-procedure-dprimitive_gco_0-methods **/ + ///@{ + // const methods + /** true iff procedure takes n arguments **/ + static bool is_nary(const DPrimitive_gco_0 & self) noexcept; + /** number of arguments. -1 for n-ary **/ + static std::int32_t n_args(const DPrimitive_gco_0 & self) noexcept; + + // non-const methods + /** invoke procedure; assume arguments satisfy type system **/ + static obj apply_nocheck(DPrimitive_gco_0 & self, obj rcx, const DArray * args); + ///@} + }; + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end */ \ No newline at end of file diff --git a/src/procedure2/CMakeLists.txt b/src/procedure2/CMakeLists.txt index 45f41bd8..44a4fad6 100644 --- a/src/procedure2/CMakeLists.txt +++ b/src/procedure2/CMakeLists.txt @@ -11,6 +11,9 @@ set(SELF_SRCS IRuntimeContext_DSimpleRcx.cpp IProcedure_Any.cpp DPrimitive.cpp + IGCObject_DPrimitive_gco_0.cpp + IProcedure_DPrimitive_gco_0.cpp + IPrintable_DPrimitive_gco_0.cpp IGCObject_DPrimitive_gco_2_gco_gco.cpp IProcedure_DPrimitive_gco_2_gco_gco.cpp IPrintable_DPrimitive_gco_2_gco_gco.cpp diff --git a/src/procedure2/IGCObject_DPrimitive_gco_0.cpp b/src/procedure2/IGCObject_DPrimitive_gco_0.cpp new file mode 100644 index 00000000..1864246d --- /dev/null +++ b/src/procedure2/IGCObject_DPrimitive_gco_0.cpp @@ -0,0 +1,39 @@ +/** @file IGCObject_DPrimitive_gco_0.cpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IGCObject_DPrimitive_gco_0.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/IGCObject_DPrimitive_gco_0.json5] +**/ + +#include "detail/IGCObject_DPrimitive_gco_0.hpp" + +namespace xo { + namespace scm { + auto + IGCObject_DPrimitive_gco_0::shallow_size(const DPrimitive_gco_0 & self) noexcept -> size_type + { + return self.shallow_size(); + } + + auto + IGCObject_DPrimitive_gco_0::shallow_copy(const DPrimitive_gco_0 & self, obj mm) noexcept -> Opaque + { + return self.shallow_copy(mm); + } + + auto + IGCObject_DPrimitive_gco_0::forward_children(DPrimitive_gco_0 & self, obj gc) noexcept -> size_type + { + return self.forward_children(gc); + } + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end IGCObject_DPrimitive_gco_0.cpp */ diff --git a/src/procedure2/IPrintable_DPrimitive_gco_0.cpp b/src/procedure2/IPrintable_DPrimitive_gco_0.cpp new file mode 100644 index 00000000..af23021e --- /dev/null +++ b/src/procedure2/IPrintable_DPrimitive_gco_0.cpp @@ -0,0 +1,28 @@ +/** @file IPrintable_DPrimitive_gco_0.cpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IPrintable_DPrimitive_gco_0.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/IPrintable_DPrimitive_gco_0.json5] +**/ + +#include "detail/IPrintable_DPrimitive_gco_0.hpp" + +namespace xo { + namespace scm { + auto + IPrintable_DPrimitive_gco_0::pretty(const DPrimitive_gco_0 & self, const ppindentinfo & ppii) -> bool + { + return self.pretty(ppii); + } + + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end IPrintable_DPrimitive_gco_0.cpp */ diff --git a/src/procedure2/IProcedure_DPrimitive_gco_0.cpp b/src/procedure2/IProcedure_DPrimitive_gco_0.cpp new file mode 100644 index 00000000..220f566e --- /dev/null +++ b/src/procedure2/IProcedure_DPrimitive_gco_0.cpp @@ -0,0 +1,39 @@ +/** @file IProcedure_DPrimitive_gco_0.cpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IProcedure_DPrimitive_gco_0.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/IProcedure_DPrimitive_gco_0.json5] +**/ + +#include "detail/IProcedure_DPrimitive_gco_0.hpp" + +namespace xo { + namespace scm { + auto + IProcedure_DPrimitive_gco_0::is_nary(const DPrimitive_gco_0 & self) noexcept -> bool + { + return self.is_nary(); + } + + auto + IProcedure_DPrimitive_gco_0::n_args(const DPrimitive_gco_0 & self) noexcept -> std::int32_t + { + return self.n_args(); + } + + auto + IProcedure_DPrimitive_gco_0::apply_nocheck(DPrimitive_gco_0 & self, obj rcx, const DArray * args) -> obj + { + return self.apply_nocheck(rcx, args); + } + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end IProcedure_DPrimitive_gco_0.cpp */ diff --git a/src/procedure2/procedure2_register_facets.cpp b/src/procedure2/procedure2_register_facets.cpp index 6905e0ba..111a3070 100644 --- a/src/procedure2/procedure2_register_facets.cpp +++ b/src/procedure2/procedure2_register_facets.cpp @@ -5,6 +5,7 @@ #include "Procedure.hpp" #include "SimpleRcx.hpp" +#include "Primitive_gco_0.hpp" #include "Primitive_gco_2_gco_gco.hpp" #include @@ -25,6 +26,10 @@ namespace xo { FacetRegistry::register_impl(); + FacetRegistry::register_impl(); + FacetRegistry::register_impl(); + FacetRegistry::register_impl(); + FacetRegistry::register_impl(); FacetRegistry::register_impl(); FacetRegistry::register_impl(); diff --git a/src/procedure2/procedure2_register_types.cpp b/src/procedure2/procedure2_register_types.cpp index 497773d2..a6467be3 100644 --- a/src/procedure2/procedure2_register_types.cpp +++ b/src/procedure2/procedure2_register_types.cpp @@ -5,6 +5,7 @@ #include "procedure2_register_types.hpp" +#include "detail/IGCObject_DPrimitive_gco_0.hpp" #include "detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp" #include @@ -25,6 +26,7 @@ namespace xo { // (note: don't currently intend to support AGCObject for DSimpleRcx) + ok &= gc.install_type(impl_for()); ok &= gc.install_type(impl_for()); return ok; From dbf43f009b57fb141b216d2f9022f9670574e721 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Wed, 4 Mar 2026 14:18:50 +1100 Subject: [PATCH 33/90] xo-interpreter2 stack: + DPrimitive_gco_1_gco [foundation] --- CMakeLists.txt | 29 ++++++++ idl/IGCObject_DPrimitive_gco_1_gco.json5 | 19 ++++++ idl/IPrintable_DPrimitive_gco_1_gco.json5 | 22 ++++++ idl/IProcedure_DPrimitive_gco_1_gco.json5 | 20 ++++++ .../xo/procedure2/DPrimitive_gco_1_gco.hpp | 21 ++++++ include/xo/procedure2/Primitive_gco_1_gco.hpp | 11 +++ .../detail/IGCObject_DPrimitive_gco_1_gco.hpp | 67 +++++++++++++++++++ .../IPrintable_DPrimitive_gco_1_gco.hpp | 62 +++++++++++++++++ .../IProcedure_DPrimitive_gco_1_gco.hpp | 67 +++++++++++++++++++ src/procedure2/CMakeLists.txt | 3 + .../IGCObject_DPrimitive_gco_1_gco.cpp | 39 +++++++++++ .../IPrintable_DPrimitive_gco_1_gco.cpp | 28 ++++++++ .../IProcedure_DPrimitive_gco_1_gco.cpp | 39 +++++++++++ src/procedure2/procedure2_register_facets.cpp | 6 ++ src/procedure2/procedure2_register_types.cpp | 2 + 15 files changed, 435 insertions(+) create mode 100644 idl/IGCObject_DPrimitive_gco_1_gco.json5 create mode 100644 idl/IPrintable_DPrimitive_gco_1_gco.json5 create mode 100644 idl/IProcedure_DPrimitive_gco_1_gco.json5 create mode 100644 include/xo/procedure2/DPrimitive_gco_1_gco.hpp create mode 100644 include/xo/procedure2/Primitive_gco_1_gco.hpp create mode 100644 include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp create mode 100644 include/xo/procedure2/detail/IPrintable_DPrimitive_gco_1_gco.hpp create mode 100644 include/xo/procedure2/detail/IProcedure_DPrimitive_gco_1_gco.hpp create mode 100644 src/procedure2/IGCObject_DPrimitive_gco_1_gco.cpp create mode 100644 src/procedure2/IPrintable_DPrimitive_gco_1_gco.cpp create mode 100644 src/procedure2/IProcedure_DPrimitive_gco_1_gco.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index b4cc8fbb..adc54114 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -75,6 +75,35 @@ xo_add_genfacetimpl( # ---------------------------------------------------------------- +# note: manual target; generated code committed to git +xo_add_genfacetimpl( + TARGET xo-procedure2-facetimpl-procedure-primitive_gco_1_gco + FACET_PKG xo_procedure2 + FACET Procedure + REPR DPrimitive_gco_1_gco + INPUT idl/IProcedure_DPrimitive_gco_1_gco.json5 +) + +# note: manual target; generated code committed to git +xo_add_genfacetimpl( + TARGET xo-procedure2-facetimpl-gcobject-primitive_gco_1_gco + FACET_PKG xo_gc + FACET GCObject + REPR Primitive_gco_1_gco + INPUT idl/IGCObject_DPrimitive_gco_1_gco.json5 +) + +# note: manual target; generated code committed to git +xo_add_genfacetimpl( + TARGET xo-procedure2-facetimpl-printable-primitive_gco_1_gco + FACET_PKG xo_printable2 + FACET Printable + REPR Primitive_gco_1_gco + INPUT idl/IPrintable_DPrimitive_gco_1_gco.json5 +) + +# ---------------------------------------------------------------- + # note: manual target; generated code committed to git xo_add_genfacetimpl( TARGET xo-procedure2-facetimpl-procedure-primitive_gco_2_gco_gco diff --git a/idl/IGCObject_DPrimitive_gco_1_gco.json5 b/idl/IGCObject_DPrimitive_gco_1_gco.json5 new file mode 100644 index 00000000..3b85d4a0 --- /dev/null +++ b/idl/IGCObject_DPrimitive_gco_1_gco.json5 @@ -0,0 +1,19 @@ +{ + mode: "implementation", + output_cpp_dir: "src/procedure2", + output_hpp_dir: "include/xo/procedure2", + output_impl_subdir: "detail", + includes: [ + // + "", + "", + ], + local_types: [ ], + namespace1: "xo", + namespace2: "scm", + facet_idl: "idl/GCObject.json5", + brief: "provide AGCobject interface for Primitive (gco) -> gco", + using_doxygen: true, + repr: "DPrimitive_gco_1_gco", + doc: [ "implement AGCObject for DPrimitive (gco) -> gco" ], +} diff --git a/idl/IPrintable_DPrimitive_gco_1_gco.json5 b/idl/IPrintable_DPrimitive_gco_1_gco.json5 new file mode 100644 index 00000000..96782439 --- /dev/null +++ b/idl/IPrintable_DPrimitive_gco_1_gco.json5 @@ -0,0 +1,22 @@ +{ + mode: "implementation", + output_cpp_dir: "src/procedure2", + output_hpp_dir: "include/xo/procedure2", + output_impl_subdir: "detail", + includes: [ + "", + "", +// "", +// "", +// "", +// "", + ], + local_types: [ ], + namespace1: "xo", + namespace2: "scm", + facet_idl: "idl/Printable.json5", + brief: "provide APrintable interface for DPrimitive (gco) -> gco", + using_doxygen: true, + repr: "DPrimitive_gco_1_gco", + doc: [ "implement APrintable for DPrimitive (gco) -> gco" ], +} diff --git a/idl/IProcedure_DPrimitive_gco_1_gco.json5 b/idl/IProcedure_DPrimitive_gco_1_gco.json5 new file mode 100644 index 00000000..63af21b5 --- /dev/null +++ b/idl/IProcedure_DPrimitive_gco_1_gco.json5 @@ -0,0 +1,20 @@ +{ + mode: "implementation", + output_cpp_dir: "src/procedure2", + output_hpp_dir: "include/xo/procedure2", + output_impl_subdir: "detail", + includes: [ + "", + "", + "", + "", + ], + local_types: [ ], + namespace1: "xo", + namespace2: "scm", + facet_idl: "idl/Procedure.json5", + brief: "provide AProcedure interface for Primitive (gco) -> gco", + using_doxygen: true, + repr: "DPrimitive_gco_1_gco", + doc: [ "implement AProcedure for DPrimitive (gco) -> gco" ], +} diff --git a/include/xo/procedure2/DPrimitive_gco_1_gco.hpp b/include/xo/procedure2/DPrimitive_gco_1_gco.hpp new file mode 100644 index 00000000..56e540d6 --- /dev/null +++ b/include/xo/procedure2/DPrimitive_gco_1_gco.hpp @@ -0,0 +1,21 @@ +/** @file DPrimitive_gco_1_gco.hpp + * + * @author Roland Conybeare, Mar 2026 + **/ + +#pragma once + +#include +#include "DPrimitive.hpp" + +namespace xo { + namespace scm { + using xo::mm::AGCObject; + using xo::facet::obj; + + using DPrimitive_gco_1_gco = Primitive (*)(obj, + obj)>; + } +} + +/* end DPrimitive_gco_1_gco.hpp */ diff --git a/include/xo/procedure2/Primitive_gco_1_gco.hpp b/include/xo/procedure2/Primitive_gco_1_gco.hpp new file mode 100644 index 00000000..a30f8d4f --- /dev/null +++ b/include/xo/procedure2/Primitive_gco_1_gco.hpp @@ -0,0 +1,11 @@ +/** @file Primitive_gco_1_gco.hpp + * + * @author Roland Conybeare, Feb 2026 + **/ + +#include "DPrimitive_gco_1_gco.hpp" +#include "detail/IProcedure_DPrimitive_gco_1_gco.hpp" +#include "detail/IGCObject_DPrimitive_gco_1_gco.hpp" +#include "detail/IPrintable_DPrimitive_gco_1_gco.hpp" + +/* end Primitive_gco_1_gco.hpp */ diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp new file mode 100644 index 00000000..190a92c7 --- /dev/null +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp @@ -0,0 +1,67 @@ +/** @file IGCObject_DPrimitive_gco_1_gco.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IGCObject_DPrimitive_gco_1_gco.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_repr.hpp.j2] + * 3. idl for facet methods + * [idl/IGCObject_DPrimitive_gco_1_gco.json5] + **/ + +#pragma once + +#include "GCObject.hpp" +#include +#include +#include "DPrimitive_gco_1_gco.hpp" + +namespace xo { namespace scm { class IGCObject_DPrimitive_gco_1_gco; } } + +namespace xo { + namespace facet { + template <> + struct FacetImplementation + { + using ImplType = xo::mm::IGCObject_Xfer + ; + }; + } +} + +namespace xo { + namespace scm { + /** @class IGCObject_DPrimitive_gco_1_gco + **/ + class IGCObject_DPrimitive_gco_1_gco { + public: + /** @defgroup scm-gcobject-dprimitive_gco_1_gco-type-traits **/ + ///@{ + using size_type = xo::mm::AGCObject::size_type; + using AAllocator = xo::mm::AGCObject::AAllocator; + using ACollector = xo::mm::AGCObject::ACollector; + using Copaque = xo::mm::AGCObject::Copaque; + using Opaque = xo::mm::AGCObject::Opaque; + ///@} + /** @defgroup scm-gcobject-dprimitive_gco_1_gco-methods **/ + ///@{ + // const methods + /** memory consumption for this instance **/ + static size_type shallow_size(const DPrimitive_gco_1_gco & self) noexcept; + /** copy instance using allocator **/ + static Opaque shallow_copy(const DPrimitive_gco_1_gco & self, obj mm) noexcept; + + // non-const methods + /** during GC: forward immdiate children **/ + static size_type forward_children(DPrimitive_gco_1_gco & self, obj gc) noexcept; + ///@} + }; + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end */ \ No newline at end of file diff --git a/include/xo/procedure2/detail/IPrintable_DPrimitive_gco_1_gco.hpp b/include/xo/procedure2/detail/IPrintable_DPrimitive_gco_1_gco.hpp new file mode 100644 index 00000000..f3743cc4 --- /dev/null +++ b/include/xo/procedure2/detail/IPrintable_DPrimitive_gco_1_gco.hpp @@ -0,0 +1,62 @@ +/** @file IPrintable_DPrimitive_gco_1_gco.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IPrintable_DPrimitive_gco_1_gco.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_repr.hpp.j2] + * 3. idl for facet methods + * [idl/IPrintable_DPrimitive_gco_1_gco.json5] + **/ + +#pragma once + +#include "Printable.hpp" +#include +#include +#include "DPrimitive_gco_1_gco.hpp" + +namespace xo { namespace scm { class IPrintable_DPrimitive_gco_1_gco; } } + +namespace xo { + namespace facet { + template <> + struct FacetImplementation + { + using ImplType = xo::print::IPrintable_Xfer + ; + }; + } +} + +namespace xo { + namespace scm { + /** @class IPrintable_DPrimitive_gco_1_gco + **/ + class IPrintable_DPrimitive_gco_1_gco { + public: + /** @defgroup scm-printable-dprimitive_gco_1_gco-type-traits **/ + ///@{ + using ppindentinfo = xo::print::APrintable::ppindentinfo; + using Copaque = xo::print::APrintable::Copaque; + using Opaque = xo::print::APrintable::Opaque; + ///@} + /** @defgroup scm-printable-dprimitive_gco_1_gco-methods **/ + ///@{ + // const methods + /** Pretty-printing support for this object. +See [xo-indentlog/xo/indentlog/pretty.hpp] **/ + static bool pretty(const DPrimitive_gco_1_gco & self, const ppindentinfo & ppii); + + // non-const methods + ///@} + }; + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end */ \ No newline at end of file diff --git a/include/xo/procedure2/detail/IProcedure_DPrimitive_gco_1_gco.hpp b/include/xo/procedure2/detail/IProcedure_DPrimitive_gco_1_gco.hpp new file mode 100644 index 00000000..415874f8 --- /dev/null +++ b/include/xo/procedure2/detail/IProcedure_DPrimitive_gco_1_gco.hpp @@ -0,0 +1,67 @@ +/** @file IProcedure_DPrimitive_gco_1_gco.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IProcedure_DPrimitive_gco_1_gco.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_repr.hpp.j2] + * 3. idl for facet methods + * [idl/IProcedure_DPrimitive_gco_1_gco.json5] + **/ + +#pragma once + +#include "Procedure.hpp" +#include +#include +#include +#include +#include "DPrimitive_gco_1_gco.hpp" + +namespace xo { namespace scm { class IProcedure_DPrimitive_gco_1_gco; } } + +namespace xo { + namespace facet { + template <> + struct FacetImplementation + { + using ImplType = xo::scm::IProcedure_Xfer + ; + }; + } +} + +namespace xo { + namespace scm { + /** @class IProcedure_DPrimitive_gco_1_gco + **/ + class IProcedure_DPrimitive_gco_1_gco { + public: + /** @defgroup scm-procedure-dprimitive_gco_1_gco-type-traits **/ + ///@{ + using AGCObject = xo::scm::AProcedure::AGCObject; + using Copaque = xo::scm::AProcedure::Copaque; + using Opaque = xo::scm::AProcedure::Opaque; + ///@} + /** @defgroup scm-procedure-dprimitive_gco_1_gco-methods **/ + ///@{ + // const methods + /** true iff procedure takes n arguments **/ + static bool is_nary(const DPrimitive_gco_1_gco & self) noexcept; + /** number of arguments. -1 for n-ary **/ + static std::int32_t n_args(const DPrimitive_gco_1_gco & self) noexcept; + + // non-const methods + /** invoke procedure; assume arguments satisfy type system **/ + static obj apply_nocheck(DPrimitive_gco_1_gco & self, obj rcx, const DArray * args); + ///@} + }; + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end */ \ No newline at end of file diff --git a/src/procedure2/CMakeLists.txt b/src/procedure2/CMakeLists.txt index 44a4fad6..b86faa45 100644 --- a/src/procedure2/CMakeLists.txt +++ b/src/procedure2/CMakeLists.txt @@ -14,6 +14,9 @@ set(SELF_SRCS IGCObject_DPrimitive_gco_0.cpp IProcedure_DPrimitive_gco_0.cpp IPrintable_DPrimitive_gco_0.cpp + IGCObject_DPrimitive_gco_1_gco.cpp + IProcedure_DPrimitive_gco_1_gco.cpp + IPrintable_DPrimitive_gco_1_gco.cpp IGCObject_DPrimitive_gco_2_gco_gco.cpp IProcedure_DPrimitive_gco_2_gco_gco.cpp IPrintable_DPrimitive_gco_2_gco_gco.cpp diff --git a/src/procedure2/IGCObject_DPrimitive_gco_1_gco.cpp b/src/procedure2/IGCObject_DPrimitive_gco_1_gco.cpp new file mode 100644 index 00000000..6d7205d5 --- /dev/null +++ b/src/procedure2/IGCObject_DPrimitive_gco_1_gco.cpp @@ -0,0 +1,39 @@ +/** @file IGCObject_DPrimitive_gco_1_gco.cpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IGCObject_DPrimitive_gco_1_gco.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/IGCObject_DPrimitive_gco_1_gco.json5] +**/ + +#include "detail/IGCObject_DPrimitive_gco_1_gco.hpp" + +namespace xo { + namespace scm { + auto + IGCObject_DPrimitive_gco_1_gco::shallow_size(const DPrimitive_gco_1_gco & self) noexcept -> size_type + { + return self.shallow_size(); + } + + auto + IGCObject_DPrimitive_gco_1_gco::shallow_copy(const DPrimitive_gco_1_gco & self, obj mm) noexcept -> Opaque + { + return self.shallow_copy(mm); + } + + auto + IGCObject_DPrimitive_gco_1_gco::forward_children(DPrimitive_gco_1_gco & self, obj gc) noexcept -> size_type + { + return self.forward_children(gc); + } + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end IGCObject_DPrimitive_gco_1_gco.cpp */ diff --git a/src/procedure2/IPrintable_DPrimitive_gco_1_gco.cpp b/src/procedure2/IPrintable_DPrimitive_gco_1_gco.cpp new file mode 100644 index 00000000..9769c1b4 --- /dev/null +++ b/src/procedure2/IPrintable_DPrimitive_gco_1_gco.cpp @@ -0,0 +1,28 @@ +/** @file IPrintable_DPrimitive_gco_1_gco.cpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IPrintable_DPrimitive_gco_1_gco.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/IPrintable_DPrimitive_gco_1_gco.json5] +**/ + +#include "detail/IPrintable_DPrimitive_gco_1_gco.hpp" + +namespace xo { + namespace scm { + auto + IPrintable_DPrimitive_gco_1_gco::pretty(const DPrimitive_gco_1_gco & self, const ppindentinfo & ppii) -> bool + { + return self.pretty(ppii); + } + + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end IPrintable_DPrimitive_gco_1_gco.cpp */ diff --git a/src/procedure2/IProcedure_DPrimitive_gco_1_gco.cpp b/src/procedure2/IProcedure_DPrimitive_gco_1_gco.cpp new file mode 100644 index 00000000..e491e806 --- /dev/null +++ b/src/procedure2/IProcedure_DPrimitive_gco_1_gco.cpp @@ -0,0 +1,39 @@ +/** @file IProcedure_DPrimitive_gco_1_gco.cpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IProcedure_DPrimitive_gco_1_gco.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/IProcedure_DPrimitive_gco_1_gco.json5] +**/ + +#include "detail/IProcedure_DPrimitive_gco_1_gco.hpp" + +namespace xo { + namespace scm { + auto + IProcedure_DPrimitive_gco_1_gco::is_nary(const DPrimitive_gco_1_gco & self) noexcept -> bool + { + return self.is_nary(); + } + + auto + IProcedure_DPrimitive_gco_1_gco::n_args(const DPrimitive_gco_1_gco & self) noexcept -> std::int32_t + { + return self.n_args(); + } + + auto + IProcedure_DPrimitive_gco_1_gco::apply_nocheck(DPrimitive_gco_1_gco & self, obj rcx, const DArray * args) -> obj + { + return self.apply_nocheck(rcx, args); + } + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end IProcedure_DPrimitive_gco_1_gco.cpp */ diff --git a/src/procedure2/procedure2_register_facets.cpp b/src/procedure2/procedure2_register_facets.cpp index 111a3070..6d522a30 100644 --- a/src/procedure2/procedure2_register_facets.cpp +++ b/src/procedure2/procedure2_register_facets.cpp @@ -6,6 +6,7 @@ #include "Procedure.hpp" #include "SimpleRcx.hpp" #include "Primitive_gco_0.hpp" +#include "Primitive_gco_1_gco.hpp" #include "Primitive_gco_2_gco_gco.hpp" #include @@ -30,11 +31,16 @@ namespace xo { FacetRegistry::register_impl(); FacetRegistry::register_impl(); + FacetRegistry::register_impl(); + FacetRegistry::register_impl(); + FacetRegistry::register_impl(); + FacetRegistry::register_impl(); FacetRegistry::register_impl(); FacetRegistry::register_impl(); log && log(xtag("DSimpleRcx.tseq", typeseq::id())); + log && log(xtag("DPrimitive_gco_1_gco.tseq", typeseq::id())); log && log(xtag("DPrimitive_gco_2_gco_gco.tseq", typeseq::id())); log && log(xtag("ARuntimeContext.tseq", typeseq::id())); diff --git a/src/procedure2/procedure2_register_types.cpp b/src/procedure2/procedure2_register_types.cpp index a6467be3..efbf4cd4 100644 --- a/src/procedure2/procedure2_register_types.cpp +++ b/src/procedure2/procedure2_register_types.cpp @@ -6,6 +6,7 @@ #include "procedure2_register_types.hpp" #include "detail/IGCObject_DPrimitive_gco_0.hpp" +#include "detail/IGCObject_DPrimitive_gco_1_gco.hpp" #include "detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp" #include @@ -27,6 +28,7 @@ namespace xo { // (note: don't currently intend to support AGCObject for DSimpleRcx) ok &= gc.install_type(impl_for()); + ok &= gc.install_type(impl_for()); ok &= gc.install_type(impl_for()); return ok; From b39f1bb0852fa5e4dea32cd4a8308b75da4ead7d Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Wed, 4 Mar 2026 14:34:57 +1100 Subject: [PATCH 34/90] xo-interpreter2 stack: + DPrimitive_gco_3_dict_string_gco + dict_upsert --- CMakeLists.txt | 31 +++++++++ ...ect_DPrimitive_gco_3_dict_string_gco.json5 | 19 ++++++ ...ble_DPrimitive_gco_3_dict_string_gco.json5 | 18 +++++ ...ure_DPrimitive_gco_3_dict_string_gco.json5 | 20 ++++++ .../DPrimitive_gco_3_dict_string_gco.hpp | 26 +++++++ .../Primitive_gco_3_dict_string_gco.hpp | 11 +++ ...bject_DPrimitive_gco_3_dict_string_gco.hpp | 67 +++++++++++++++++++ ...table_DPrimitive_gco_3_dict_string_gco.hpp | 62 +++++++++++++++++ ...edure_DPrimitive_gco_3_dict_string_gco.hpp | 67 +++++++++++++++++++ src/procedure2/CMakeLists.txt | 3 + ...bject_DPrimitive_gco_3_dict_string_gco.cpp | 39 +++++++++++ ...table_DPrimitive_gco_3_dict_string_gco.cpp | 28 ++++++++ ...edure_DPrimitive_gco_3_dict_string_gco.cpp | 39 +++++++++++ src/procedure2/procedure2_register_facets.cpp | 6 ++ src/procedure2/procedure2_register_types.cpp | 2 + 15 files changed, 438 insertions(+) create mode 100644 idl/IGCObject_DPrimitive_gco_3_dict_string_gco.json5 create mode 100644 idl/IPrintable_DPrimitive_gco_3_dict_string_gco.json5 create mode 100644 idl/IProcedure_DPrimitive_gco_3_dict_string_gco.json5 create mode 100644 include/xo/procedure2/DPrimitive_gco_3_dict_string_gco.hpp create mode 100644 include/xo/procedure2/Primitive_gco_3_dict_string_gco.hpp create mode 100644 include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp create mode 100644 include/xo/procedure2/detail/IPrintable_DPrimitive_gco_3_dict_string_gco.hpp create mode 100644 include/xo/procedure2/detail/IProcedure_DPrimitive_gco_3_dict_string_gco.hpp create mode 100644 src/procedure2/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp create mode 100644 src/procedure2/IPrintable_DPrimitive_gco_3_dict_string_gco.cpp create mode 100644 src/procedure2/IProcedure_DPrimitive_gco_3_dict_string_gco.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index adc54114..e902e864 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -131,6 +131,37 @@ xo_add_genfacetimpl( INPUT idl/IPrintable_DPrimitive_gco_2_gco_gco.json5 ) +# ---------------------------------------------------------------- + +# note: manual target; generated code committed to git +xo_add_genfacetimpl( + TARGET xo-procedure2-facetimpl-procedure-primitive_gco_3_dict_string_gco + FACET_PKG xo_procedure2 + FACET Procedure + REPR Dprimitive_gco_3_dict_string_gco + INPUT idl/IProcedure_DPrimitive_gco_3_dict_string_gco.json5 +) + +# note: manual target; generated code committed to git +xo_add_genfacetimpl( + TARGET xo-procedure2-facetimpl-gcobject-primitive_gco_3_dict_string_gco + FACET_PKG xo_gc + FACET GCObject + REPR primitive_gco_3_dict_string_gco + INPUT idl/IGCObject_DPrimitive_gco_3_dict_string_gco.json5 +) + +# note: manual target; generated code committed to git +xo_add_genfacetimpl( + TARGET xo-procedure2-facetimpl-printable-primitive_gco_3_dict_string_gco + FACET_PKG xo_printable2 + FACET Printable + REPR primitive_gco_3_dict_string_gco + INPUT idl/IPrintable_DPrimitive_gco_3_dict_string_gco.json5 +) + +# ---------------------------------------------------------------- + xo_add_genfacet_all(xo-procedure2-genfacet-all) # ---------------------------------------------------------------- diff --git a/idl/IGCObject_DPrimitive_gco_3_dict_string_gco.json5 b/idl/IGCObject_DPrimitive_gco_3_dict_string_gco.json5 new file mode 100644 index 00000000..342b9bfd --- /dev/null +++ b/idl/IGCObject_DPrimitive_gco_3_dict_string_gco.json5 @@ -0,0 +1,19 @@ +{ + mode: "implementation", + output_cpp_dir: "src/procedure2", + output_hpp_dir: "include/xo/procedure2", + output_impl_subdir: "detail", + includes: [ + // + "", + "", + ], + local_types: [ ], + namespace1: "xo", + namespace2: "scm", + facet_idl: "idl/GCObject.json5", + brief: "provide AGCobject interface for Primitive (dict x string x gco) -> gco", + using_doxygen: true, + repr: "DPrimitive_gco_3_dict_string_gco", + doc: [ "implement AGCObject for DPrimitive (dict x string x gco) -> gco" ], +} diff --git a/idl/IPrintable_DPrimitive_gco_3_dict_string_gco.json5 b/idl/IPrintable_DPrimitive_gco_3_dict_string_gco.json5 new file mode 100644 index 00000000..c3129451 --- /dev/null +++ b/idl/IPrintable_DPrimitive_gco_3_dict_string_gco.json5 @@ -0,0 +1,18 @@ +{ + mode: "implementation", + output_cpp_dir: "src/procedure2", + output_hpp_dir: "include/xo/procedure2", + output_impl_subdir: "detail", + includes: [ + "", + "", + ], + local_types: [ ], + namespace1: "xo", + namespace2: "scm", + facet_idl: "idl/Printable.json5", + brief: "provide APrintable interface for DPrimitive (dict x string x gco) -> gco", + using_doxygen: true, + repr: "DPrimitive_gco_3_dict_string_gco", + doc: [ "implement APrintable for DPrimitive (dict x string x gco) -> gco" ], +} diff --git a/idl/IProcedure_DPrimitive_gco_3_dict_string_gco.json5 b/idl/IProcedure_DPrimitive_gco_3_dict_string_gco.json5 new file mode 100644 index 00000000..8099d9f3 --- /dev/null +++ b/idl/IProcedure_DPrimitive_gco_3_dict_string_gco.json5 @@ -0,0 +1,20 @@ +{ + mode: "implementation", + output_cpp_dir: "src/procedure2", + output_hpp_dir: "include/xo/procedure2", + output_impl_subdir: "detail", + includes: [ + "", + "", + "", + "", + ], + local_types: [ ], + namespace1: "xo", + namespace2: "scm", + facet_idl: "idl/Procedure.json5", + brief: "provide AProcedure interface for Primitive (dict x string x gco) -> gco", + using_doxygen: true, + repr: "DPrimitive_gco_3_dict_string_gco", + doc: [ "implement AProcedure for DPrimitive (dict x string x gco) -> gco" ], +} diff --git a/include/xo/procedure2/DPrimitive_gco_3_dict_string_gco.hpp b/include/xo/procedure2/DPrimitive_gco_3_dict_string_gco.hpp new file mode 100644 index 00000000..c0dce657 --- /dev/null +++ b/include/xo/procedure2/DPrimitive_gco_3_dict_string_gco.hpp @@ -0,0 +1,26 @@ +/** @file DPrimitive_gco_3_dict_string_gco.hpp + * + * @author Roland Conybeare, Mar 2026 + **/ + +#pragma once + +#include +#include +#include +#include "DPrimitive.hpp" + +namespace xo { + namespace scm { + using xo::mm::AGCObject; + using xo::facet::obj; + + using DPrimitive_gco_3_dict_string_gco + = Primitive (*)(obj, + obj, + obj, + obj)>; + } +} + +/* end DPrimitive_gco_3_dict_string_gco.hpp */ diff --git a/include/xo/procedure2/Primitive_gco_3_dict_string_gco.hpp b/include/xo/procedure2/Primitive_gco_3_dict_string_gco.hpp new file mode 100644 index 00000000..40a49864 --- /dev/null +++ b/include/xo/procedure2/Primitive_gco_3_dict_string_gco.hpp @@ -0,0 +1,11 @@ +/** @file Primitive_gco_3_dict_string_gco.hpp + * + * @author Roland Conybeare, Feb 2026 + **/ + +#include "DPrimitive_gco_3_dict_string_gco.hpp" +#include "detail/IProcedure_DPrimitive_gco_3_dict_string_gco.hpp" +#include "detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp" +#include "detail/IPrintable_DPrimitive_gco_3_dict_string_gco.hpp" + +/* end Primitive_gco_3_dict_string_gco.hpp */ diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp new file mode 100644 index 00000000..abb30bca --- /dev/null +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp @@ -0,0 +1,67 @@ +/** @file IGCObject_DPrimitive_gco_3_dict_string_gco.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IGCObject_DPrimitive_gco_3_dict_string_gco.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_repr.hpp.j2] + * 3. idl for facet methods + * [idl/IGCObject_DPrimitive_gco_3_dict_string_gco.json5] + **/ + +#pragma once + +#include "GCObject.hpp" +#include +#include +#include "DPrimitive_gco_3_dict_string_gco.hpp" + +namespace xo { namespace scm { class IGCObject_DPrimitive_gco_3_dict_string_gco; } } + +namespace xo { + namespace facet { + template <> + struct FacetImplementation + { + using ImplType = xo::mm::IGCObject_Xfer + ; + }; + } +} + +namespace xo { + namespace scm { + /** @class IGCObject_DPrimitive_gco_3_dict_string_gco + **/ + class IGCObject_DPrimitive_gco_3_dict_string_gco { + public: + /** @defgroup scm-gcobject-dprimitive_gco_3_dict_string_gco-type-traits **/ + ///@{ + using size_type = xo::mm::AGCObject::size_type; + using AAllocator = xo::mm::AGCObject::AAllocator; + using ACollector = xo::mm::AGCObject::ACollector; + using Copaque = xo::mm::AGCObject::Copaque; + using Opaque = xo::mm::AGCObject::Opaque; + ///@} + /** @defgroup scm-gcobject-dprimitive_gco_3_dict_string_gco-methods **/ + ///@{ + // const methods + /** memory consumption for this instance **/ + static size_type shallow_size(const DPrimitive_gco_3_dict_string_gco & self) noexcept; + /** copy instance using allocator **/ + static Opaque shallow_copy(const DPrimitive_gco_3_dict_string_gco & self, obj mm) noexcept; + + // non-const methods + /** during GC: forward immdiate children **/ + static size_type forward_children(DPrimitive_gco_3_dict_string_gco & self, obj gc) noexcept; + ///@} + }; + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end */ \ No newline at end of file diff --git a/include/xo/procedure2/detail/IPrintable_DPrimitive_gco_3_dict_string_gco.hpp b/include/xo/procedure2/detail/IPrintable_DPrimitive_gco_3_dict_string_gco.hpp new file mode 100644 index 00000000..4ef7ada3 --- /dev/null +++ b/include/xo/procedure2/detail/IPrintable_DPrimitive_gco_3_dict_string_gco.hpp @@ -0,0 +1,62 @@ +/** @file IPrintable_DPrimitive_gco_3_dict_string_gco.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IPrintable_DPrimitive_gco_3_dict_string_gco.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_repr.hpp.j2] + * 3. idl for facet methods + * [idl/IPrintable_DPrimitive_gco_3_dict_string_gco.json5] + **/ + +#pragma once + +#include "Printable.hpp" +#include +#include +#include "DPrimitive_gco_3_dict_string_gco.hpp" + +namespace xo { namespace scm { class IPrintable_DPrimitive_gco_3_dict_string_gco; } } + +namespace xo { + namespace facet { + template <> + struct FacetImplementation + { + using ImplType = xo::print::IPrintable_Xfer + ; + }; + } +} + +namespace xo { + namespace scm { + /** @class IPrintable_DPrimitive_gco_3_dict_string_gco + **/ + class IPrintable_DPrimitive_gco_3_dict_string_gco { + public: + /** @defgroup scm-printable-dprimitive_gco_3_dict_string_gco-type-traits **/ + ///@{ + using ppindentinfo = xo::print::APrintable::ppindentinfo; + using Copaque = xo::print::APrintable::Copaque; + using Opaque = xo::print::APrintable::Opaque; + ///@} + /** @defgroup scm-printable-dprimitive_gco_3_dict_string_gco-methods **/ + ///@{ + // const methods + /** Pretty-printing support for this object. +See [xo-indentlog/xo/indentlog/pretty.hpp] **/ + static bool pretty(const DPrimitive_gco_3_dict_string_gco & self, const ppindentinfo & ppii); + + // non-const methods + ///@} + }; + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end */ \ No newline at end of file diff --git a/include/xo/procedure2/detail/IProcedure_DPrimitive_gco_3_dict_string_gco.hpp b/include/xo/procedure2/detail/IProcedure_DPrimitive_gco_3_dict_string_gco.hpp new file mode 100644 index 00000000..6001397c --- /dev/null +++ b/include/xo/procedure2/detail/IProcedure_DPrimitive_gco_3_dict_string_gco.hpp @@ -0,0 +1,67 @@ +/** @file IProcedure_DPrimitive_gco_3_dict_string_gco.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IProcedure_DPrimitive_gco_3_dict_string_gco.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_repr.hpp.j2] + * 3. idl for facet methods + * [idl/IProcedure_DPrimitive_gco_3_dict_string_gco.json5] + **/ + +#pragma once + +#include "Procedure.hpp" +#include +#include +#include +#include +#include "DPrimitive_gco_3_dict_string_gco.hpp" + +namespace xo { namespace scm { class IProcedure_DPrimitive_gco_3_dict_string_gco; } } + +namespace xo { + namespace facet { + template <> + struct FacetImplementation + { + using ImplType = xo::scm::IProcedure_Xfer + ; + }; + } +} + +namespace xo { + namespace scm { + /** @class IProcedure_DPrimitive_gco_3_dict_string_gco + **/ + class IProcedure_DPrimitive_gco_3_dict_string_gco { + public: + /** @defgroup scm-procedure-dprimitive_gco_3_dict_string_gco-type-traits **/ + ///@{ + using AGCObject = xo::scm::AProcedure::AGCObject; + using Copaque = xo::scm::AProcedure::Copaque; + using Opaque = xo::scm::AProcedure::Opaque; + ///@} + /** @defgroup scm-procedure-dprimitive_gco_3_dict_string_gco-methods **/ + ///@{ + // const methods + /** true iff procedure takes n arguments **/ + static bool is_nary(const DPrimitive_gco_3_dict_string_gco & self) noexcept; + /** number of arguments. -1 for n-ary **/ + static std::int32_t n_args(const DPrimitive_gco_3_dict_string_gco & self) noexcept; + + // non-const methods + /** invoke procedure; assume arguments satisfy type system **/ + static obj apply_nocheck(DPrimitive_gco_3_dict_string_gco & self, obj rcx, const DArray * args); + ///@} + }; + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end */ \ No newline at end of file diff --git a/src/procedure2/CMakeLists.txt b/src/procedure2/CMakeLists.txt index b86faa45..28c168e9 100644 --- a/src/procedure2/CMakeLists.txt +++ b/src/procedure2/CMakeLists.txt @@ -20,6 +20,9 @@ set(SELF_SRCS IGCObject_DPrimitive_gco_2_gco_gco.cpp IProcedure_DPrimitive_gco_2_gco_gco.cpp IPrintable_DPrimitive_gco_2_gco_gco.cpp + IGCObject_DPrimitive_gco_3_dict_string_gco.cpp + IProcedure_DPrimitive_gco_3_dict_string_gco.cpp + IPrintable_DPrimitive_gco_3_dict_string_gco.cpp ) xo_add_shared_library4(${SELF_LIB} ${PROJECT_NAME}Targets ${PROJECT_VERSION} 1 ${SELF_SRCS}) diff --git a/src/procedure2/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp b/src/procedure2/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp new file mode 100644 index 00000000..7b199bd6 --- /dev/null +++ b/src/procedure2/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp @@ -0,0 +1,39 @@ +/** @file IGCObject_DPrimitive_gco_3_dict_string_gco.cpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IGCObject_DPrimitive_gco_3_dict_string_gco.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/IGCObject_DPrimitive_gco_3_dict_string_gco.json5] +**/ + +#include "detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp" + +namespace xo { + namespace scm { + auto + IGCObject_DPrimitive_gco_3_dict_string_gco::shallow_size(const DPrimitive_gco_3_dict_string_gco & self) noexcept -> size_type + { + return self.shallow_size(); + } + + auto + IGCObject_DPrimitive_gco_3_dict_string_gco::shallow_copy(const DPrimitive_gco_3_dict_string_gco & self, obj mm) noexcept -> Opaque + { + return self.shallow_copy(mm); + } + + auto + IGCObject_DPrimitive_gco_3_dict_string_gco::forward_children(DPrimitive_gco_3_dict_string_gco & self, obj gc) noexcept -> size_type + { + return self.forward_children(gc); + } + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end IGCObject_DPrimitive_gco_3_dict_string_gco.cpp */ diff --git a/src/procedure2/IPrintable_DPrimitive_gco_3_dict_string_gco.cpp b/src/procedure2/IPrintable_DPrimitive_gco_3_dict_string_gco.cpp new file mode 100644 index 00000000..68312304 --- /dev/null +++ b/src/procedure2/IPrintable_DPrimitive_gco_3_dict_string_gco.cpp @@ -0,0 +1,28 @@ +/** @file IPrintable_DPrimitive_gco_3_dict_string_gco.cpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IPrintable_DPrimitive_gco_3_dict_string_gco.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/IPrintable_DPrimitive_gco_3_dict_string_gco.json5] +**/ + +#include "detail/IPrintable_DPrimitive_gco_3_dict_string_gco.hpp" + +namespace xo { + namespace scm { + auto + IPrintable_DPrimitive_gco_3_dict_string_gco::pretty(const DPrimitive_gco_3_dict_string_gco & self, const ppindentinfo & ppii) -> bool + { + return self.pretty(ppii); + } + + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end IPrintable_DPrimitive_gco_3_dict_string_gco.cpp */ diff --git a/src/procedure2/IProcedure_DPrimitive_gco_3_dict_string_gco.cpp b/src/procedure2/IProcedure_DPrimitive_gco_3_dict_string_gco.cpp new file mode 100644 index 00000000..334267aa --- /dev/null +++ b/src/procedure2/IProcedure_DPrimitive_gco_3_dict_string_gco.cpp @@ -0,0 +1,39 @@ +/** @file IProcedure_DPrimitive_gco_3_dict_string_gco.cpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IProcedure_DPrimitive_gco_3_dict_string_gco.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/IProcedure_DPrimitive_gco_3_dict_string_gco.json5] +**/ + +#include "detail/IProcedure_DPrimitive_gco_3_dict_string_gco.hpp" + +namespace xo { + namespace scm { + auto + IProcedure_DPrimitive_gco_3_dict_string_gco::is_nary(const DPrimitive_gco_3_dict_string_gco & self) noexcept -> bool + { + return self.is_nary(); + } + + auto + IProcedure_DPrimitive_gco_3_dict_string_gco::n_args(const DPrimitive_gco_3_dict_string_gco & self) noexcept -> std::int32_t + { + return self.n_args(); + } + + auto + IProcedure_DPrimitive_gco_3_dict_string_gco::apply_nocheck(DPrimitive_gco_3_dict_string_gco & self, obj rcx, const DArray * args) -> obj + { + return self.apply_nocheck(rcx, args); + } + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end IProcedure_DPrimitive_gco_3_dict_string_gco.cpp */ diff --git a/src/procedure2/procedure2_register_facets.cpp b/src/procedure2/procedure2_register_facets.cpp index 6d522a30..d785cf0e 100644 --- a/src/procedure2/procedure2_register_facets.cpp +++ b/src/procedure2/procedure2_register_facets.cpp @@ -8,6 +8,7 @@ #include "Primitive_gco_0.hpp" #include "Primitive_gco_1_gco.hpp" #include "Primitive_gco_2_gco_gco.hpp" +#include "Primitive_gco_3_dict_string_gco.hpp" #include #include @@ -39,9 +40,14 @@ namespace xo { FacetRegistry::register_impl(); FacetRegistry::register_impl(); + FacetRegistry::register_impl(); + FacetRegistry::register_impl(); + FacetRegistry::register_impl(); + log && log(xtag("DSimpleRcx.tseq", typeseq::id())); log && log(xtag("DPrimitive_gco_1_gco.tseq", typeseq::id())); log && log(xtag("DPrimitive_gco_2_gco_gco.tseq", typeseq::id())); + log && log(xtag("DPrimitive_gco_3_dict_string_gco.tseq", typeseq::id())); log && log(xtag("ARuntimeContext.tseq", typeseq::id())); log && log(xtag("AProcedure.tseq", typeseq::id())); diff --git a/src/procedure2/procedure2_register_types.cpp b/src/procedure2/procedure2_register_types.cpp index efbf4cd4..09723228 100644 --- a/src/procedure2/procedure2_register_types.cpp +++ b/src/procedure2/procedure2_register_types.cpp @@ -8,6 +8,7 @@ #include "detail/IGCObject_DPrimitive_gco_0.hpp" #include "detail/IGCObject_DPrimitive_gco_1_gco.hpp" #include "detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp" +#include "detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp" #include namespace xo { @@ -30,6 +31,7 @@ namespace xo { ok &= gc.install_type(impl_for()); ok &= gc.install_type(impl_for()); ok &= gc.install_type(impl_for()); + ok &= gc.install_type(impl_for()); return ok; } From 84b69409396e09b07c8d8b1d9969f92b99287b14 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Wed, 4 Mar 2026 14:35:43 +1100 Subject: [PATCH 35/90] xo-procedure2: include nit --- src/procedure2/procedure2_register_types.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/procedure2/procedure2_register_types.cpp b/src/procedure2/procedure2_register_types.cpp index 09723228..2484be68 100644 --- a/src/procedure2/procedure2_register_types.cpp +++ b/src/procedure2/procedure2_register_types.cpp @@ -5,7 +5,8 @@ #include "procedure2_register_types.hpp" -#include "detail/IGCObject_DPrimitive_gco_0.hpp" +#include "Primitive_gco_0.hpp" +//#include "detail/IGCObject_DPrimitive_gco_0.hpp" #include "detail/IGCObject_DPrimitive_gco_1_gco.hpp" #include "detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp" #include "detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp" From 67b79034d09104b3ce3f1895b03d76dbafb68e40 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Wed, 4 Mar 2026 14:40:31 +1100 Subject: [PATCH 36/90] xo-procedure2: fix logging nit --- src/procedure2/procedure2_register_facets.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/procedure2/procedure2_register_facets.cpp b/src/procedure2/procedure2_register_facets.cpp index d785cf0e..b7b595e5 100644 --- a/src/procedure2/procedure2_register_facets.cpp +++ b/src/procedure2/procedure2_register_facets.cpp @@ -45,6 +45,7 @@ namespace xo { FacetRegistry::register_impl(); log && log(xtag("DSimpleRcx.tseq", typeseq::id())); + log && log(xtag("DPrimitive_gco_0.tseq", typeseq::id())); log && log(xtag("DPrimitive_gco_1_gco.tseq", typeseq::id())); log && log(xtag("DPrimitive_gco_2_gco_gco.tseq", typeseq::id())); log && log(xtag("DPrimitive_gco_3_dict_string_gco.tseq", typeseq::id())); From e3aef4935e0c5137b5c3089881fec96fe4b5ebe7 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Wed, 4 Mar 2026 22:26:31 +1100 Subject: [PATCH 37/90] xo-gc xo-alloc2: move Collector faceet gc/ -> alloc2/ for levelling --- include/xo/procedure2/DPrimitive.hpp | 2 +- include/xo/procedure2/DPrimitive_gco_0.hpp | 2 +- include/xo/procedure2/DPrimitive_gco_1_gco.hpp | 2 +- include/xo/procedure2/DPrimitive_gco_2_gco_gco.hpp | 2 +- include/xo/procedure2/DPrimitive_gco_3_dict_string_gco.hpp | 2 +- include/xo/procedure2/detail/AProcedure.hpp | 2 +- include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp | 4 ++-- .../xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp | 4 ++-- .../procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp | 4 ++-- .../detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp | 4 ++-- include/xo/procedure2/detail/IProcedure_Xfer.hpp | 2 +- include/xo/procedure2/procedure2_register_facets.hpp | 2 +- include/xo/procedure2/procedure2_register_types.hpp | 2 +- src/procedure2/DPrimitive.cpp | 2 +- src/procedure2/procedure2_register_facets.cpp | 2 +- 15 files changed, 19 insertions(+), 19 deletions(-) diff --git a/include/xo/procedure2/DPrimitive.hpp b/include/xo/procedure2/DPrimitive.hpp index e458ce3a..5003ba02 100644 --- a/include/xo/procedure2/DPrimitive.hpp +++ b/include/xo/procedure2/DPrimitive.hpp @@ -8,7 +8,7 @@ #include "RuntimeContext.hpp" #include #include -#include +#include #include #include #include diff --git a/include/xo/procedure2/DPrimitive_gco_0.hpp b/include/xo/procedure2/DPrimitive_gco_0.hpp index 7e5633cf..b6b02a94 100644 --- a/include/xo/procedure2/DPrimitive_gco_0.hpp +++ b/include/xo/procedure2/DPrimitive_gco_0.hpp @@ -5,7 +5,7 @@ #pragma once -#include +#include #include "DPrimitive.hpp" namespace xo { diff --git a/include/xo/procedure2/DPrimitive_gco_1_gco.hpp b/include/xo/procedure2/DPrimitive_gco_1_gco.hpp index 56e540d6..8e939677 100644 --- a/include/xo/procedure2/DPrimitive_gco_1_gco.hpp +++ b/include/xo/procedure2/DPrimitive_gco_1_gco.hpp @@ -5,7 +5,7 @@ #pragma once -#include +#include #include "DPrimitive.hpp" namespace xo { diff --git a/include/xo/procedure2/DPrimitive_gco_2_gco_gco.hpp b/include/xo/procedure2/DPrimitive_gco_2_gco_gco.hpp index 78dd26b9..a5895af3 100644 --- a/include/xo/procedure2/DPrimitive_gco_2_gco_gco.hpp +++ b/include/xo/procedure2/DPrimitive_gco_2_gco_gco.hpp @@ -5,7 +5,7 @@ #pragma once -#include +#include #include "DPrimitive.hpp" namespace xo { diff --git a/include/xo/procedure2/DPrimitive_gco_3_dict_string_gco.hpp b/include/xo/procedure2/DPrimitive_gco_3_dict_string_gco.hpp index c0dce657..29f18b23 100644 --- a/include/xo/procedure2/DPrimitive_gco_3_dict_string_gco.hpp +++ b/include/xo/procedure2/DPrimitive_gco_3_dict_string_gco.hpp @@ -7,7 +7,7 @@ #include #include -#include +#include #include "DPrimitive.hpp" namespace xo { diff --git a/include/xo/procedure2/detail/AProcedure.hpp b/include/xo/procedure2/detail/AProcedure.hpp index eb119fbd..a5c41b41 100644 --- a/include/xo/procedure2/detail/AProcedure.hpp +++ b/include/xo/procedure2/detail/AProcedure.hpp @@ -15,7 +15,7 @@ // includes (via {facet_includes}) #include "RuntimeContext.hpp" -#include +#include #include #include #include diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp index 91ff1833..cfc5d192 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp @@ -14,7 +14,7 @@ #pragma once #include "GCObject.hpp" -#include +#include #include #include "DPrimitive_gco_0.hpp" @@ -64,4 +64,4 @@ namespace xo { } /*namespace scm*/ } /*namespace xo*/ -/* end */ \ No newline at end of file +/* end */ diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp index 190a92c7..d2dd1d3e 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp @@ -14,7 +14,7 @@ #pragma once #include "GCObject.hpp" -#include +#include #include #include "DPrimitive_gco_1_gco.hpp" @@ -64,4 +64,4 @@ namespace xo { } /*namespace scm*/ } /*namespace xo*/ -/* end */ \ No newline at end of file +/* end */ diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp index f6bfe6ed..68fa0e53 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp @@ -14,7 +14,7 @@ #pragma once #include "GCObject.hpp" -#include +#include #include #include "DPrimitive_gco_2_gco_gco.hpp" @@ -64,4 +64,4 @@ namespace xo { } /*namespace scm*/ } /*namespace xo*/ -/* end */ \ No newline at end of file +/* end */ diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp index abb30bca..4f851cfa 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp @@ -14,7 +14,7 @@ #pragma once #include "GCObject.hpp" -#include +#include #include #include "DPrimitive_gco_3_dict_string_gco.hpp" @@ -64,4 +64,4 @@ namespace xo { } /*namespace scm*/ } /*namespace xo*/ -/* end */ \ No newline at end of file +/* end */ diff --git a/include/xo/procedure2/detail/IProcedure_Xfer.hpp b/include/xo/procedure2/detail/IProcedure_Xfer.hpp index 0be093fb..59742f32 100644 --- a/include/xo/procedure2/detail/IProcedure_Xfer.hpp +++ b/include/xo/procedure2/detail/IProcedure_Xfer.hpp @@ -14,7 +14,7 @@ #pragma once #include "RuntimeContext.hpp" -#include +#include namespace xo { namespace scm { diff --git a/include/xo/procedure2/procedure2_register_facets.hpp b/include/xo/procedure2/procedure2_register_facets.hpp index 219da3d4..2a7128cc 100644 --- a/include/xo/procedure2/procedure2_register_facets.hpp +++ b/include/xo/procedure2/procedure2_register_facets.hpp @@ -5,7 +5,7 @@ #pragma once -#include +#include namespace xo { namespace scm { diff --git a/include/xo/procedure2/procedure2_register_types.hpp b/include/xo/procedure2/procedure2_register_types.hpp index be0170aa..98b0c5f7 100644 --- a/include/xo/procedure2/procedure2_register_types.hpp +++ b/include/xo/procedure2/procedure2_register_types.hpp @@ -5,7 +5,7 @@ #pragma once -#include +#include namespace xo { namespace scm { diff --git a/src/procedure2/DPrimitive.cpp b/src/procedure2/DPrimitive.cpp index ab335d8d..44903cc2 100644 --- a/src/procedure2/DPrimitive.cpp +++ b/src/procedure2/DPrimitive.cpp @@ -4,7 +4,7 @@ **/ #include "DPrimitive.hpp" -#include +#include namespace xo { namespace scm { diff --git a/src/procedure2/procedure2_register_facets.cpp b/src/procedure2/procedure2_register_facets.cpp index b7b595e5..0fb14fe7 100644 --- a/src/procedure2/procedure2_register_facets.cpp +++ b/src/procedure2/procedure2_register_facets.cpp @@ -10,7 +10,7 @@ #include "Primitive_gco_2_gco_gco.hpp" #include "Primitive_gco_3_dict_string_gco.hpp" -#include +#include #include #include #include From f43420c760b4d928123334380610ad24300f8551 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Thu, 5 Mar 2026 00:50:58 +1100 Subject: [PATCH 38/90] refactor: + xo-stringtable2 w/ DString impl --- include/xo/procedure2/DPrimitive_gco_3_dict_string_gco.hpp | 2 +- src/procedure2/init_procedure2.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/xo/procedure2/DPrimitive_gco_3_dict_string_gco.hpp b/include/xo/procedure2/DPrimitive_gco_3_dict_string_gco.hpp index 29f18b23..f566fee2 100644 --- a/include/xo/procedure2/DPrimitive_gco_3_dict_string_gco.hpp +++ b/include/xo/procedure2/DPrimitive_gco_3_dict_string_gco.hpp @@ -6,7 +6,7 @@ #pragma once #include -#include +#include #include #include "DPrimitive.hpp" diff --git a/src/procedure2/init_procedure2.cpp b/src/procedure2/init_procedure2.cpp index aaa6a021..bc7e53ab 100644 --- a/src/procedure2/init_procedure2.cpp +++ b/src/procedure2/init_procedure2.cpp @@ -9,7 +9,7 @@ #include "procedure2_register_types.hpp" #include -#include +#include namespace xo { using xo::scm::procedure2_register_facets; From f4248204cea7aa6316e9b8a96a8985a33050de96 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Thu, 5 Mar 2026 20:11:05 +1100 Subject: [PATCH 39/90] xo-object2 stack: refactor/tidy after GCObject -> alloc2 --- include/xo/procedure2/DPrimitive.hpp | 2 +- src/procedure2/init_primitives.cpp | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/include/xo/procedure2/DPrimitive.hpp b/include/xo/procedure2/DPrimitive.hpp index 5003ba02..17c19435 100644 --- a/include/xo/procedure2/DPrimitive.hpp +++ b/include/xo/procedure2/DPrimitive.hpp @@ -7,7 +7,7 @@ #include "RuntimeContext.hpp" #include -#include +#include #include #include #include diff --git a/src/procedure2/init_primitives.cpp b/src/procedure2/init_primitives.cpp index 1fd3950c..142ad868 100644 --- a/src/procedure2/init_primitives.cpp +++ b/src/procedure2/init_primitives.cpp @@ -6,13 +6,11 @@ #include "init_primitives.hpp" #include "DPrimitive.hpp" #include -//#include #include -//#include #include -#include #include #include +#include #include #include From 39b95ae6cbc2d97b44b913d7c89876beac1d636b Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Thu, 5 Mar 2026 20:25:32 +1100 Subject: [PATCH 40/90] nix-build: + xo.procedure2 --- cmake/xo_procedure2Config.cmake.in | 2 +- src/procedure2/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/xo_procedure2Config.cmake.in b/cmake/xo_procedure2Config.cmake.in index fa6ee3cd..96f11c99 100644 --- a/cmake/xo_procedure2Config.cmake.in +++ b/cmake/xo_procedure2Config.cmake.in @@ -7,7 +7,7 @@ include(CMakeFindDependencyMacro) # in CMakeLists.txt # find_dependency(xo_object2) -find_dependency(xo_gc) +#find_dependency(xo_gc) find_dependency(subsys) include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") diff --git a/src/procedure2/CMakeLists.txt b/src/procedure2/CMakeLists.txt index 28c168e9..b74b3e62 100644 --- a/src/procedure2/CMakeLists.txt +++ b/src/procedure2/CMakeLists.txt @@ -35,7 +35,7 @@ xo_install_include_tree3(include/xo/procedure2) # xo-procedure2/cmake/xo_procedure2Config.cmake.in xo_dependency(${SELF_LIB} xo_object2) -xo_dependency(${SELF_LIB} xo_gc) +#xo_dependency(${SELF_LIB} xo_gc) xo_dependency(${SELF_LIB} subsys) #xo_dependency(${SELF_LIB} xo_indentlog) From 551f6f72666d5a9e1793f045e8a1d39e41af2fe3 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Wed, 11 Mar 2026 08:41:57 -0500 Subject: [PATCH 41/90] build: retiring REPR argument to xo_add_genfacetimpl() --- CMakeLists.txt | 34 +++++++++---------- include/xo/procedure2/detail/AProcedure.hpp | 2 +- .../detail/IGCObject_DPrimitive_gco_0.hpp | 4 +-- .../detail/IGCObject_DPrimitive_gco_1_gco.hpp | 4 +-- .../IGCObject_DPrimitive_gco_2_gco_gco.hpp | 4 +-- ...bject_DPrimitive_gco_3_dict_string_gco.hpp | 4 +-- .../xo/procedure2/detail/IProcedure_Xfer.hpp | 2 +- 7 files changed, 27 insertions(+), 27 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e902e864..eb4a0fb4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,7 +40,7 @@ xo_add_genfacetimpl( TARGET xo-procedure2-facetimpl-runtimecontext-simplercx FACET_PKG xo_procedure2 FACET RuntimeContext - REPR DSimpleRcx +# REPR DSimpleRcx INPUT idl/IRuntimeContext_DSimpleRcx.json5 ) @@ -51,16 +51,16 @@ xo_add_genfacetimpl( TARGET xo-procedure2-facetimpl-procedure-primitive_gco_0 FACET_PKG xo_procedure2 FACET Procedure - REPR DPrimitive_gco_0 +# REPR DPrimitive_gco_0 INPUT idl/IProcedure_DPrimitive_gco_0.json5 ) # note: manual target; generated code committed to git xo_add_genfacetimpl( TARGET xo-procedure2-facetimpl-gcobject-primitive_gco_0 - FACET_PKG xo_gc + FACET_PKG xo_alloc2 FACET GCObject - REPR Primitive_gco_0 +# REPR Primitive_gco_0 INPUT idl/IGCObject_DPrimitive_gco_0.json5 ) @@ -69,7 +69,7 @@ xo_add_genfacetimpl( TARGET xo-procedure2-facetimpl-printable-primitive_gco_0 FACET_PKG xo_printable2 FACET Printable - REPR Primitive_gco_0 +# REPR Primitive_gco_0 INPUT idl/IPrintable_DPrimitive_gco_0.json5 ) @@ -80,16 +80,16 @@ xo_add_genfacetimpl( TARGET xo-procedure2-facetimpl-procedure-primitive_gco_1_gco FACET_PKG xo_procedure2 FACET Procedure - REPR DPrimitive_gco_1_gco +# REPR DPrimitive_gco_1_gco INPUT idl/IProcedure_DPrimitive_gco_1_gco.json5 ) # note: manual target; generated code committed to git xo_add_genfacetimpl( TARGET xo-procedure2-facetimpl-gcobject-primitive_gco_1_gco - FACET_PKG xo_gc + FACET_PKG xo_alloc2 FACET GCObject - REPR Primitive_gco_1_gco +# REPR Primitive_gco_1_gco INPUT idl/IGCObject_DPrimitive_gco_1_gco.json5 ) @@ -98,7 +98,7 @@ xo_add_genfacetimpl( TARGET xo-procedure2-facetimpl-printable-primitive_gco_1_gco FACET_PKG xo_printable2 FACET Printable - REPR Primitive_gco_1_gco +# REPR Primitive_gco_1_gco INPUT idl/IPrintable_DPrimitive_gco_1_gco.json5 ) @@ -109,16 +109,16 @@ xo_add_genfacetimpl( TARGET xo-procedure2-facetimpl-procedure-primitive_gco_2_gco_gco FACET_PKG xo_procedure2 FACET Procedure - REPR DPrimitive_gco_2_gco_gco +# REPR DPrimitive_gco_2_gco_gco INPUT idl/IProcedure_DPrimitive_gco_2_gco_gco.json5 ) # note: manual target; generated code committed to git xo_add_genfacetimpl( TARGET xo-procedure2-facetimpl-gcobject-primitive_gco_2_gco_gco - FACET_PKG xo_gc + FACET_PKG xo_alloc2 FACET GCObject - REPR Primitive_gco_2_gco_gco +# REPR Primitive_gco_2_gco_gco INPUT idl/IGCObject_DPrimitive_gco_2_gco_gco.json5 ) @@ -127,7 +127,7 @@ xo_add_genfacetimpl( TARGET xo-procedure2-facetimpl-printable-primitive_gco_2_gco_gco FACET_PKG xo_printable2 FACET Printable - REPR Primitive_gco_2_gco_gco +# REPR Primitive_gco_2_gco_gco INPUT idl/IPrintable_DPrimitive_gco_2_gco_gco.json5 ) @@ -138,16 +138,16 @@ xo_add_genfacetimpl( TARGET xo-procedure2-facetimpl-procedure-primitive_gco_3_dict_string_gco FACET_PKG xo_procedure2 FACET Procedure - REPR Dprimitive_gco_3_dict_string_gco +# REPR Dprimitive_gco_3_dict_string_gco INPUT idl/IProcedure_DPrimitive_gco_3_dict_string_gco.json5 ) # note: manual target; generated code committed to git xo_add_genfacetimpl( TARGET xo-procedure2-facetimpl-gcobject-primitive_gco_3_dict_string_gco - FACET_PKG xo_gc + FACET_PKG xo_alloc2 FACET GCObject - REPR primitive_gco_3_dict_string_gco +# REPR primitive_gco_3_dict_string_gco INPUT idl/IGCObject_DPrimitive_gco_3_dict_string_gco.json5 ) @@ -156,7 +156,7 @@ xo_add_genfacetimpl( TARGET xo-procedure2-facetimpl-printable-primitive_gco_3_dict_string_gco FACET_PKG xo_printable2 FACET Printable - REPR primitive_gco_3_dict_string_gco +# REPR primitive_gco_3_dict_string_gco INPUT idl/IPrintable_DPrimitive_gco_3_dict_string_gco.json5 ) diff --git a/include/xo/procedure2/detail/AProcedure.hpp b/include/xo/procedure2/detail/AProcedure.hpp index a5c41b41..eb119fbd 100644 --- a/include/xo/procedure2/detail/AProcedure.hpp +++ b/include/xo/procedure2/detail/AProcedure.hpp @@ -15,7 +15,7 @@ // includes (via {facet_includes}) #include "RuntimeContext.hpp" -#include +#include #include #include #include diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp index cfc5d192..91ff1833 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp @@ -14,7 +14,7 @@ #pragma once #include "GCObject.hpp" -#include +#include #include #include "DPrimitive_gco_0.hpp" @@ -64,4 +64,4 @@ namespace xo { } /*namespace scm*/ } /*namespace xo*/ -/* end */ +/* end */ \ No newline at end of file diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp index d2dd1d3e..190a92c7 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp @@ -14,7 +14,7 @@ #pragma once #include "GCObject.hpp" -#include +#include #include #include "DPrimitive_gco_1_gco.hpp" @@ -64,4 +64,4 @@ namespace xo { } /*namespace scm*/ } /*namespace xo*/ -/* end */ +/* end */ \ No newline at end of file diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp index 68fa0e53..f6bfe6ed 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp @@ -14,7 +14,7 @@ #pragma once #include "GCObject.hpp" -#include +#include #include #include "DPrimitive_gco_2_gco_gco.hpp" @@ -64,4 +64,4 @@ namespace xo { } /*namespace scm*/ } /*namespace xo*/ -/* end */ +/* end */ \ No newline at end of file diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp index 4f851cfa..abb30bca 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp @@ -14,7 +14,7 @@ #pragma once #include "GCObject.hpp" -#include +#include #include #include "DPrimitive_gco_3_dict_string_gco.hpp" @@ -64,4 +64,4 @@ namespace xo { } /*namespace scm*/ } /*namespace xo*/ -/* end */ +/* end */ \ No newline at end of file diff --git a/include/xo/procedure2/detail/IProcedure_Xfer.hpp b/include/xo/procedure2/detail/IProcedure_Xfer.hpp index 59742f32..0be093fb 100644 --- a/include/xo/procedure2/detail/IProcedure_Xfer.hpp +++ b/include/xo/procedure2/detail/IProcedure_Xfer.hpp @@ -14,7 +14,7 @@ #pragma once #include "RuntimeContext.hpp" -#include +#include namespace xo { namespace scm { From 71b1c31aebd66bed3adace1eb9f1fa09bdfff0ed Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Wed, 11 Mar 2026 08:49:03 -0500 Subject: [PATCH 42/90] xo-interpreter2 stack: bugfix after GCObject facet location change --- idl/IGCObject_DPrimitive_gco_0.json5 | 2 +- idl/IGCObject_DPrimitive_gco_1_gco.json5 | 2 +- idl/IGCObject_DPrimitive_gco_2_gco_gco.json5 | 2 +- idl/IGCObject_DPrimitive_gco_3_dict_string_gco.json5 | 2 +- idl/Procedure.json5 | 2 +- include/xo/procedure2/detail/AProcedure.hpp | 2 +- include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp | 2 +- include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp | 2 +- .../xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp | 2 +- .../detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp | 2 +- include/xo/procedure2/detail/IProcedure_Xfer.hpp | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/idl/IGCObject_DPrimitive_gco_0.json5 b/idl/IGCObject_DPrimitive_gco_0.json5 index 27557c24..89c7de3a 100644 --- a/idl/IGCObject_DPrimitive_gco_0.json5 +++ b/idl/IGCObject_DPrimitive_gco_0.json5 @@ -5,7 +5,7 @@ output_impl_subdir: "detail", includes: [ // - "", + "", "", ], local_types: [ ], diff --git a/idl/IGCObject_DPrimitive_gco_1_gco.json5 b/idl/IGCObject_DPrimitive_gco_1_gco.json5 index 3b85d4a0..60785f65 100644 --- a/idl/IGCObject_DPrimitive_gco_1_gco.json5 +++ b/idl/IGCObject_DPrimitive_gco_1_gco.json5 @@ -5,7 +5,7 @@ output_impl_subdir: "detail", includes: [ // - "", + "", "", ], local_types: [ ], diff --git a/idl/IGCObject_DPrimitive_gco_2_gco_gco.json5 b/idl/IGCObject_DPrimitive_gco_2_gco_gco.json5 index cd17ae4f..e0ffb9fe 100644 --- a/idl/IGCObject_DPrimitive_gco_2_gco_gco.json5 +++ b/idl/IGCObject_DPrimitive_gco_2_gco_gco.json5 @@ -5,7 +5,7 @@ output_impl_subdir: "detail", includes: [ // - "", + "", "", ], local_types: [ ], diff --git a/idl/IGCObject_DPrimitive_gco_3_dict_string_gco.json5 b/idl/IGCObject_DPrimitive_gco_3_dict_string_gco.json5 index 342b9bfd..ad44b582 100644 --- a/idl/IGCObject_DPrimitive_gco_3_dict_string_gco.json5 +++ b/idl/IGCObject_DPrimitive_gco_3_dict_string_gco.json5 @@ -5,7 +5,7 @@ output_impl_subdir: "detail", includes: [ // - "", + "", "", ], local_types: [ ], diff --git a/idl/Procedure.json5 b/idl/Procedure.json5 index b45227d0..a4597ddd 100644 --- a/idl/Procedure.json5 +++ b/idl/Procedure.json5 @@ -10,7 +10,7 @@ // includes in ASyntaxStateMachine.hpp includes: [ "\"RuntimeContext.hpp\"", - "", + "", ], // extra includes in Procedure.hpp, if any user_hpp_includes: [ diff --git a/include/xo/procedure2/detail/AProcedure.hpp b/include/xo/procedure2/detail/AProcedure.hpp index eb119fbd..a5c41b41 100644 --- a/include/xo/procedure2/detail/AProcedure.hpp +++ b/include/xo/procedure2/detail/AProcedure.hpp @@ -15,7 +15,7 @@ // includes (via {facet_includes}) #include "RuntimeContext.hpp" -#include +#include #include #include #include diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp index 91ff1833..c8865270 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp @@ -14,7 +14,7 @@ #pragma once #include "GCObject.hpp" -#include +#include #include #include "DPrimitive_gco_0.hpp" diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp index 190a92c7..ac5a4439 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp @@ -14,7 +14,7 @@ #pragma once #include "GCObject.hpp" -#include +#include #include #include "DPrimitive_gco_1_gco.hpp" diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp index f6bfe6ed..fee6d62b 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp @@ -14,7 +14,7 @@ #pragma once #include "GCObject.hpp" -#include +#include #include #include "DPrimitive_gco_2_gco_gco.hpp" diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp index abb30bca..951bda1c 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp @@ -14,7 +14,7 @@ #pragma once #include "GCObject.hpp" -#include +#include #include #include "DPrimitive_gco_3_dict_string_gco.hpp" diff --git a/include/xo/procedure2/detail/IProcedure_Xfer.hpp b/include/xo/procedure2/detail/IProcedure_Xfer.hpp index 0be093fb..59742f32 100644 --- a/include/xo/procedure2/detail/IProcedure_Xfer.hpp +++ b/include/xo/procedure2/detail/IProcedure_Xfer.hpp @@ -14,7 +14,7 @@ #pragma once #include "RuntimeContext.hpp" -#include +#include namespace xo { namespace scm { From c8bc13cb2e07543bc3378eec90742f4c0314c06f Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Wed, 11 Mar 2026 10:03:46 -0500 Subject: [PATCH 43/90] build: retire FACET argument to genfacetimpl --- CMakeLists.txt | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index eb4a0fb4..15a6d329 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,7 +39,6 @@ xo_add_genfacet( xo_add_genfacetimpl( TARGET xo-procedure2-facetimpl-runtimecontext-simplercx FACET_PKG xo_procedure2 - FACET RuntimeContext # REPR DSimpleRcx INPUT idl/IRuntimeContext_DSimpleRcx.json5 ) @@ -50,7 +49,6 @@ xo_add_genfacetimpl( xo_add_genfacetimpl( TARGET xo-procedure2-facetimpl-procedure-primitive_gco_0 FACET_PKG xo_procedure2 - FACET Procedure # REPR DPrimitive_gco_0 INPUT idl/IProcedure_DPrimitive_gco_0.json5 ) @@ -59,7 +57,6 @@ xo_add_genfacetimpl( xo_add_genfacetimpl( TARGET xo-procedure2-facetimpl-gcobject-primitive_gco_0 FACET_PKG xo_alloc2 - FACET GCObject # REPR Primitive_gco_0 INPUT idl/IGCObject_DPrimitive_gco_0.json5 ) @@ -68,7 +65,6 @@ xo_add_genfacetimpl( xo_add_genfacetimpl( TARGET xo-procedure2-facetimpl-printable-primitive_gco_0 FACET_PKG xo_printable2 - FACET Printable # REPR Primitive_gco_0 INPUT idl/IPrintable_DPrimitive_gco_0.json5 ) @@ -79,7 +75,6 @@ xo_add_genfacetimpl( xo_add_genfacetimpl( TARGET xo-procedure2-facetimpl-procedure-primitive_gco_1_gco FACET_PKG xo_procedure2 - FACET Procedure # REPR DPrimitive_gco_1_gco INPUT idl/IProcedure_DPrimitive_gco_1_gco.json5 ) @@ -88,7 +83,6 @@ xo_add_genfacetimpl( xo_add_genfacetimpl( TARGET xo-procedure2-facetimpl-gcobject-primitive_gco_1_gco FACET_PKG xo_alloc2 - FACET GCObject # REPR Primitive_gco_1_gco INPUT idl/IGCObject_DPrimitive_gco_1_gco.json5 ) @@ -97,7 +91,6 @@ xo_add_genfacetimpl( xo_add_genfacetimpl( TARGET xo-procedure2-facetimpl-printable-primitive_gco_1_gco FACET_PKG xo_printable2 - FACET Printable # REPR Primitive_gco_1_gco INPUT idl/IPrintable_DPrimitive_gco_1_gco.json5 ) @@ -108,7 +101,6 @@ xo_add_genfacetimpl( xo_add_genfacetimpl( TARGET xo-procedure2-facetimpl-procedure-primitive_gco_2_gco_gco FACET_PKG xo_procedure2 - FACET Procedure # REPR DPrimitive_gco_2_gco_gco INPUT idl/IProcedure_DPrimitive_gco_2_gco_gco.json5 ) @@ -117,7 +109,6 @@ xo_add_genfacetimpl( xo_add_genfacetimpl( TARGET xo-procedure2-facetimpl-gcobject-primitive_gco_2_gco_gco FACET_PKG xo_alloc2 - FACET GCObject # REPR Primitive_gco_2_gco_gco INPUT idl/IGCObject_DPrimitive_gco_2_gco_gco.json5 ) @@ -126,7 +117,6 @@ xo_add_genfacetimpl( xo_add_genfacetimpl( TARGET xo-procedure2-facetimpl-printable-primitive_gco_2_gco_gco FACET_PKG xo_printable2 - FACET Printable # REPR Primitive_gco_2_gco_gco INPUT idl/IPrintable_DPrimitive_gco_2_gco_gco.json5 ) @@ -137,7 +127,6 @@ xo_add_genfacetimpl( xo_add_genfacetimpl( TARGET xo-procedure2-facetimpl-procedure-primitive_gco_3_dict_string_gco FACET_PKG xo_procedure2 - FACET Procedure # REPR Dprimitive_gco_3_dict_string_gco INPUT idl/IProcedure_DPrimitive_gco_3_dict_string_gco.json5 ) @@ -146,7 +135,6 @@ xo_add_genfacetimpl( xo_add_genfacetimpl( TARGET xo-procedure2-facetimpl-gcobject-primitive_gco_3_dict_string_gco FACET_PKG xo_alloc2 - FACET GCObject # REPR primitive_gco_3_dict_string_gco INPUT idl/IGCObject_DPrimitive_gco_3_dict_string_gco.json5 ) @@ -155,7 +143,6 @@ xo_add_genfacetimpl( xo_add_genfacetimpl( TARGET xo-procedure2-facetimpl-printable-primitive_gco_3_dict_string_gco FACET_PKG xo_printable2 - FACET Printable # REPR primitive_gco_3_dict_string_gco INPUT idl/IPrintable_DPrimitive_gco_3_dict_string_gco.json5 ) From 6c7216ed7d592bbbd17ef0ed06fc7fe7e6572ae3 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Thu, 12 Mar 2026 20:26:08 -0500 Subject: [PATCH 44/90] xo-interpreter2 stack: refactor + bugfix operator expr --- cmake/xo_procedure2Config.cmake.in | 2 +- include/xo/procedure2/DPrimitive.hpp | 42 +++- include/xo/procedure2/PrimitiveRegistry.hpp | 89 ++++++++ .../procedure2_register_primitives.hpp | 18 ++ src/procedure2/CMakeLists.txt | 3 +- src/procedure2/PrimitiveRegistry.cpp | 49 +++++ src/procedure2/init_primitives.cpp | 192 ------------------ 7 files changed, 195 insertions(+), 200 deletions(-) create mode 100644 include/xo/procedure2/PrimitiveRegistry.hpp create mode 100644 include/xo/procedure2/procedure2_register_primitives.hpp create mode 100644 src/procedure2/PrimitiveRegistry.cpp diff --git a/cmake/xo_procedure2Config.cmake.in b/cmake/xo_procedure2Config.cmake.in index 96f11c99..250797df 100644 --- a/cmake/xo_procedure2Config.cmake.in +++ b/cmake/xo_procedure2Config.cmake.in @@ -6,8 +6,8 @@ include(CMakeFindDependencyMacro) # must coordinate with xo_dependency() calls # in CMakeLists.txt # +find_dependency(xo_type) find_dependency(xo_object2) -#find_dependency(xo_gc) find_dependency(subsys) include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") diff --git a/include/xo/procedure2/DPrimitive.hpp b/include/xo/procedure2/DPrimitive.hpp index 17c19435..7735bf0b 100644 --- a/include/xo/procedure2/DPrimitive.hpp +++ b/include/xo/procedure2/DPrimitive.hpp @@ -55,6 +55,18 @@ namespace xo { } /** @brief Schematika primitive with fixed number of arguments + * + * Distinction between type-constructor (@ref type_) and + * type-description (@ref fn_td_): type-constructor is narrower; + * it may lift into schematika type system some information about function + * behavior. For example + * @pre + * cons :: (T x list) -> list + * @endpre + * but implementation has signature: + * @pre + * (obj x obj) -> obj + * @endpre **/ template class Primitive { @@ -70,13 +82,28 @@ namespace xo { using ppindentinfo = xo::print::ppindentinfo; public: - Primitive(std::string_view name, Fn fn) : name_{name}, - fn_td_{Reflect::require()}, - fn_{fn} {} + /** @defgroup scm-primitive-ctors constructors **/ + ///@{ + + Primitive(std::string_view name, Fn fn) + : name_{name}, + fn_td_{Reflect::require()}, + fn_{fn} {} + + static Primitive * _make(obj mm, std::string_view name, Fn fn) { + void * mem = mm.alloc_for(); + + return new (mem) Primitive(name, fn); + } + + ///@} + /** @defgroup scm-primitive-methods general methods **/ + ///@{ TypeDescr fn_td() const noexcept { return fn_td_; } std::string_view name() const noexcept { return name_; } + static constexpr std::int32_t n_args() noexcept { return Traits::n_args; } bool is_nary() const noexcept { return false; } @@ -86,6 +113,7 @@ namespace xo { std::make_index_sequence{}); } + ///@} /** @defgroup scm-primitive-printable-facet **/ ///@{ @@ -166,8 +194,12 @@ namespace xo { template std::size_t - Primitive::forward_children(obj) noexcept { - // Primitive holds no GC refs (just string_view + function pointer) + Primitive::forward_children(obj gc) noexcept { + { + auto e = type_.to_facet(); // FacetRegistry dep + gc.forward_inplace(e.iface(), (void **)&(type_.data_)); + } + return this->shallow_size(); } diff --git a/include/xo/procedure2/PrimitiveRegistry.hpp b/include/xo/procedure2/PrimitiveRegistry.hpp new file mode 100644 index 00000000..6f1f67ea --- /dev/null +++ b/include/xo/procedure2/PrimitiveRegistry.hpp @@ -0,0 +1,89 @@ +/** @file PrimitiveRegistry.hpp + * + * @author Roland Conybeare, Mar 2026 + **/ + +#pragma once + +#include "Procedure.hpp" +#include +#include +#include + +namespace xo { + namespace scm { + /** partition primitives based on scope. + * Each primitive associates with exactly one flag value. + * Flags also operate as bitmasks when calling + * @ref PrimitiveRegistry::install_primitives() + **/ + enum class InstallFlags { + f_none = 0x0, + + /** mandatory primitives, necessary for operator support, + * e.g. _add needed to implement infix + + **/ + f_essential = 0x1, + f_generalpurpose = 0x2, + + /** all primitives **/ + f_all = f_essential | f_generalpurpose, + }; + + inline InstallFlags operator&(InstallFlags x, InstallFlags y) { + return InstallFlags(static_cast(x) & static_cast(y)); + } + + + + /** provided by VSM to receive created primitives. + * InstallSink(pm) adopts a primitive + **/ + using InstallSink = std::function pm, + InstallFlags flags)>; + + /** @class PrimitiveRegistry + * + * @brief Runtime registry for primitives + * + * Singleton to remember setup code for known primitives. + * Use to gather primitives for installation in global + * environment for a virtual schematika machine (VSM) + **/ + class PrimitiveRegistry { + public: + using AAllocator = xo::mm::AAllocator; + + /** provided by a subsystem that provides primitives. + * Allocates primitives using memory from mm, delivering them + * to InstallSink sink. + **/ + using InstallSource = std::function mm, + InstallSink sink, + InstallFlags flags)>; + + public: + /** singleton instance **/ + static PrimitiveRegistry & instance(); + + /** remember primitive-factory @p source_fn **/ + void register_primitives(InstallSource source_fn); + + /** create primitives using memory from @p mm, + * delivering each primitive to @p sink. + **/ + bool install_primitives(obj mm, + InstallSink sink, + InstallFlags flags); + + private: + /** a set of factories that create primitives **/ + std::vector init_seq_v_; + }; + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end PrimitiveRegistry.hpp */ diff --git a/include/xo/procedure2/procedure2_register_primitives.hpp b/include/xo/procedure2/procedure2_register_primitives.hpp new file mode 100644 index 00000000..12e1db94 --- /dev/null +++ b/include/xo/procedure2/procedure2_register_primitives.hpp @@ -0,0 +1,18 @@ +/** @file procedure2_register_primitives.hpp + * + * @author Roland Conybeare, Mar 2026 + **/ + +#pragma once + +#include "PrimitiveRegistry.hpp" +#include + +namespace xo { + namespace scm { + /** Register gc-aware (AGCObject,DRepr) combinations with garbage collector @p gc **/ + bool procedure2_register_primitives(obj gc, InstallSink sink); + } +} + +/* end procedure2_register_primitives.hpp */ diff --git a/src/procedure2/CMakeLists.txt b/src/procedure2/CMakeLists.txt index b74b3e62..1a65a629 100644 --- a/src/procedure2/CMakeLists.txt +++ b/src/procedure2/CMakeLists.txt @@ -34,10 +34,9 @@ xo_install_include_tree3(include/xo/procedure2) # NOTE: dependency set here must be kept consistent with # xo-procedure2/cmake/xo_procedure2Config.cmake.in +xo_dependency(${SELF_LIB} xo_type) xo_dependency(${SELF_LIB} xo_object2) -#xo_dependency(${SELF_LIB} xo_gc) xo_dependency(${SELF_LIB} subsys) -#xo_dependency(${SELF_LIB} xo_indentlog) xo_export_cmake_config(${PROJECT_NAME} ${PROJECT_VERSION} ${PROJECT_NAME}Targets) diff --git a/src/procedure2/PrimitiveRegistry.cpp b/src/procedure2/PrimitiveRegistry.cpp new file mode 100644 index 00000000..0ce7aa68 --- /dev/null +++ b/src/procedure2/PrimitiveRegistry.cpp @@ -0,0 +1,49 @@ +/** @file PrimitiveRegistry.cpp + * + * @author Roland Conybeare, Mar 2026 + **/ + +#include "PrimitiveRegistry.hpp" +#include + +namespace xo { + namespace scm { + PrimitiveRegistry & + PrimitiveRegistry::instance() + { + static PrimitiveRegistry s_instance; + + return s_instance; + } + + void + PrimitiveRegistry::register_primitives(InstallSource factory) + { + scope log(XO_DEBUG(true)); + + init_seq_v_.push_back(factory); + } + + bool + PrimitiveRegistry::install_primitives(obj mm, + InstallSink sink, + InstallFlags flags) + { + scope log(XO_DEBUG(true)); + + bool ok = true; + + size_t i = 0; + size_t n = init_seq_v_.size(); + log && log("run n init steps", xtag("n", n)); + + for (const auto & fn : init_seq_v_) { + log && log("do install fn (", i+1, "/", n, ")"); + + ok = ok & fn(mm, sink, flags); + } + + return ok; + } + } +} /*namespace xo*/ diff --git a/src/procedure2/init_primitives.cpp b/src/procedure2/init_primitives.cpp index 142ad868..58b9d7aa 100644 --- a/src/procedure2/init_primitives.cpp +++ b/src/procedure2/init_primitives.cpp @@ -37,187 +37,6 @@ namespace xo { } #endif -#ifdef OBSOLETE // see xo-numeric/xo/numeric/NumericPrimitives.cpp - obj - mul_gco_gco(obj rcx, - obj x_gco, - obj y_gco) - { - using xo::reflect::typeseq; - - obj mm = rcx.allocator(); - - // PLACEHOLDER - - // TODO: - // 1. move this to xo-numeric2/ when available - // 2. at that point will require polymorphic dispatch - // on argument representations, analogous to dispatch - // in FacetRegistry - - typeseq x_tseq = x_gco._typeseq(); - typeseq y_tseq = y_gco._typeseq(); - - // FOR NOW: just test runtime values - // - if (x_tseq == typeseq::id()) { - // i64 * .. - long x = GCObjectConversion::from_gco(mm, x_gco); - - if (y_tseq == typeseq::id()) { - // i64 * i64 - long y = GCObjectConversion::from_gco(mm, y_gco); - - return DInteger::box(mm, x * y); - } else if (y_tseq == typeseq::id()) { - // i64 * f64 - double y = GCObjectConversion::from_gco(mm, y_gco); - - return DFloat::box(mm, x * y); - } - } else if (x_tseq == typeseq::id()) { - if (y_tseq == typeseq::id()) { - // f64 * i64. - double x = GCObjectConversion::from_gco(mm, x_gco); - long y = GCObjectConversion::from_gco(mm, y_gco); - - return DFloat::box(mm, x * y); - } else if (y_tseq == typeseq::id()) { - // f64 * f64. - double x = GCObjectConversion::from_gco(mm, x_gco); - double y = GCObjectConversion::from_gco(mm, y_gco); - - return DFloat::box(mm, x * y); - } - } - - // here: error - throw std::runtime_error(tostr("mul_gco_gco: unexpected argument types xt,yt", - xtag("x.tseq", x_tseq), - xtag("y.tseq", y_tseq))); - return obj(); - } - - obj - sub_gco_gco(obj rcx, - obj x_gco, - obj y_gco) - { - using xo::reflect::typeseq; - - obj mm = rcx.allocator(); - - // PLACEHOLDER - - // TODO: - // 1. move this to xo-numeric2/ when available - // 2. at that point will require polymorphic dispatch - // on argument representations, analogous to dispatch - // in FacetRegistry - - typeseq x_tseq = x_gco._typeseq(); - typeseq y_tseq = y_gco._typeseq(); - - // FOR NOW: just test runtime values - // - if (x_tseq == typeseq::id()) { - // i64 * .. - long x = GCObjectConversion::from_gco(mm, x_gco); - - if (y_tseq == typeseq::id()) { - // i64 * i64 - long y = GCObjectConversion::from_gco(mm, y_gco); - - return DInteger::box(mm, x - y); - } else if (y_tseq == typeseq::id()) { - // i64 * f64 - double y = GCObjectConversion::from_gco(mm, y_gco); - - return DFloat::box(mm, x - y); - } - } else if (x_tseq == typeseq::id()) { - if (y_tseq == typeseq::id()) { - // f64 * i64. - double x = GCObjectConversion::from_gco(mm, x_gco); - long y = GCObjectConversion::from_gco(mm, y_gco); - - return DFloat::box(mm, x - y); - } else if (y_tseq == typeseq::id()) { - // f64 * f64. - double x = GCObjectConversion::from_gco(mm, x_gco); - double y = GCObjectConversion::from_gco(mm, y_gco); - - return DFloat::box(mm, x - y); - } - } - - // here: error - throw std::runtime_error(tostr("sub_gco_gco: unexpected argument types xt,yt", - xtag("x.tseq", x_tseq), - xtag("y.tseq", y_tseq))); - return obj(); - } - - obj - equal_gco_gco(obj rcx, - obj x_gco, - obj y_gco) - { - using xo::reflect::typeseq; - - obj mm = rcx.allocator(); - - // PLACEHOLDER - - // TODO - // 1. move this to xo-numeric2/ when available - // 2. at that point will require polymorphic dispatch on argument representations. - // - - typeseq x_tseq = x_gco._typeseq(); - typeseq y_tseq = y_gco._typeseq(); - - // FOR NOW: just test runtime values - // - if (x_tseq == typeseq::id()) { - // i64 * .. - long x = GCObjectConversion::from_gco(mm, x_gco); - - if (y_tseq == typeseq::id()) { - // i64 == i64 - long y = GCObjectConversion::from_gco(mm, y_gco); - - return DBoolean::box(mm, x == y); - } else if (y_tseq == typeseq::id()) { - // i64 == f64 - double y = GCObjectConversion::from_gco(mm, y_gco); - - return DFloat::box(mm, static_cast(x) == y); - } - } else if (x_tseq == typeseq::id()) { - if (y_tseq == typeseq::id()) { - // f64 == i64. - double x = GCObjectConversion::from_gco(mm, x_gco); - long y = GCObjectConversion::from_gco(mm, y_gco); - - return DFloat::box(mm, x == static_cast(y)); - } else if (y_tseq == typeseq::id()) { - // f64 * f64. - double x = GCObjectConversion::from_gco(mm, x_gco); - double y = GCObjectConversion::from_gco(mm, y_gco); - - return DFloat::box(mm, x == y); - } - } - - // here: error - throw std::runtime_error(tostr("mul_gco_gco: unexpected argument types xt,yt", - xtag("x.tseq", x_tseq), - xtag("y.tseq", y_tseq))); - return obj(); - } -#endif - #ifdef NOT_YET double mul_f64_f64(double x, double y) { @@ -255,17 +74,6 @@ namespace xo { } #endif -#ifdef OSOLETE - DPrimitive_gco_2_gco_gco - Primitives::s_mul_gco_gco_pm("_mul", &mul_gco_gco); - - DPrimitive_gco_2_gco_gco - Primitives::s_sub_gco_gco_pm("_sub", &sub_gco_gco); - - DPrimitive_gco_2_gco_gco - Primitives::s_equal_gco_gco_pm("_equal", &equal_gco_gco); -#endif - #ifdef NOT_YET Primitive_f64_1_f64 Primitives::s_neg_f64_pm("_neg_d", From 14248ea68f97db87140896fbeb5b40ab490b83ee Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Thu, 12 Mar 2026 20:30:45 -0500 Subject: [PATCH 45/90] xo-gc: + remove_gc_root_poly() --- src/procedure2/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/procedure2/CMakeLists.txt b/src/procedure2/CMakeLists.txt index 1a65a629..c10c878d 100644 --- a/src/procedure2/CMakeLists.txt +++ b/src/procedure2/CMakeLists.txt @@ -6,6 +6,7 @@ set(SELF_SRCS init_primitives.cpp procedure2_register_types.cpp procedure2_register_facets.cpp + PrimitiveRegistry.cpp DSimpleRcx.cpp IRuntimeContext_Any.cpp IRuntimeContext_DSimpleRcx.cpp From 9b8de11c31bf2e0dbc95912e71d733d455fd275e Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Thu, 12 Mar 2026 20:43:14 -0500 Subject: [PATCH 46/90] xo-procedure2: + type_ member [WIP] --- include/xo/procedure2/DPrimitive.hpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/include/xo/procedure2/DPrimitive.hpp b/include/xo/procedure2/DPrimitive.hpp index 7735bf0b..4cc45f83 100644 --- a/include/xo/procedure2/DPrimitive.hpp +++ b/include/xo/procedure2/DPrimitive.hpp @@ -6,6 +6,7 @@ #pragma once #include "RuntimeContext.hpp" +#include #include #include #include @@ -152,7 +153,12 @@ namespace xo { /** name of this primitive **/ std::string_view name_; - /** type description for function + /** primitive type-constructor. These are non-trivial to establish; + * not convenient to establish in ctor + **/ + obj type_; + + /** type description for implementation function * Note that this type description will have additional first argument * for obj **/ From f6ecc56a1c6537d74e032243d5b775e7147c7013 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Fri, 13 Mar 2026 16:15:31 -0500 Subject: [PATCH 47/90] xo-procedure: refactor generated file locations --- CMakeLists.txt | 13 -------- idl/IGCObject_DPrimitive_gco_0.json5 | 2 +- idl/IGCObject_DPrimitive_gco_1_gco.json5 | 2 +- idl/IGCObject_DPrimitive_gco_2_gco_gco.json5 | 2 +- ...ect_DPrimitive_gco_3_dict_string_gco.json5 | 2 +- idl/IPrintable_DPrimitive_gco_0.json5 | 2 +- idl/IPrintable_DPrimitive_gco_1_gco.json5 | 2 +- idl/IPrintable_DPrimitive_gco_2_gco_gco.json5 | 6 +--- ...ble_DPrimitive_gco_3_dict_string_gco.json5 | 2 +- idl/IProcedure_DPrimitive_gco_0.json5 | 2 +- idl/IProcedure_DPrimitive_gco_1_gco.json5 | 2 +- idl/IProcedure_DPrimitive_gco_2_gco_gco.json5 | 2 +- ...ure_DPrimitive_gco_3_dict_string_gco.json5 | 2 +- idl/IRuntimeContext_DSimpleRcx.json5 | 2 +- idl/Procedure.json5 | 2 +- idl/RuntimeContext.json5 | 2 +- src/procedure2/CMakeLists.txt | 32 +++++++++---------- .../IGCObject_DPrimitive_gco_0.cpp | 0 .../IGCObject_DPrimitive_gco_1_gco.cpp | 0 .../IGCObject_DPrimitive_gco_2_gco_gco.cpp | 0 ...bject_DPrimitive_gco_3_dict_string_gco.cpp | 0 .../IPrintable_DPrimitive_gco_0.cpp | 0 .../IPrintable_DPrimitive_gco_1_gco.cpp | 0 .../IPrintable_DPrimitive_gco_2_gco_gco.cpp | 0 ...table_DPrimitive_gco_3_dict_string_gco.cpp | 0 src/procedure2/{ => facet}/IProcedure_Any.cpp | 0 .../IProcedure_DPrimitive_gco_0.cpp | 0 .../IProcedure_DPrimitive_gco_1_gco.cpp | 0 .../IProcedure_DPrimitive_gco_2_gco_gco.cpp | 0 ...edure_DPrimitive_gco_3_dict_string_gco.cpp | 0 .../{ => facet}/IRuntimeContext_Any.cpp | 0 .../IRuntimeContext_DSimpleRcx.cpp | 0 32 files changed, 31 insertions(+), 48 deletions(-) rename src/procedure2/{ => facet}/IGCObject_DPrimitive_gco_0.cpp (100%) rename src/procedure2/{ => facet}/IGCObject_DPrimitive_gco_1_gco.cpp (100%) rename src/procedure2/{ => facet}/IGCObject_DPrimitive_gco_2_gco_gco.cpp (100%) rename src/procedure2/{ => facet}/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp (100%) rename src/procedure2/{ => facet}/IPrintable_DPrimitive_gco_0.cpp (100%) rename src/procedure2/{ => facet}/IPrintable_DPrimitive_gco_1_gco.cpp (100%) rename src/procedure2/{ => facet}/IPrintable_DPrimitive_gco_2_gco_gco.cpp (100%) rename src/procedure2/{ => facet}/IPrintable_DPrimitive_gco_3_dict_string_gco.cpp (100%) rename src/procedure2/{ => facet}/IProcedure_Any.cpp (100%) rename src/procedure2/{ => facet}/IProcedure_DPrimitive_gco_0.cpp (100%) rename src/procedure2/{ => facet}/IProcedure_DPrimitive_gco_1_gco.cpp (100%) rename src/procedure2/{ => facet}/IProcedure_DPrimitive_gco_2_gco_gco.cpp (100%) rename src/procedure2/{ => facet}/IProcedure_DPrimitive_gco_3_dict_string_gco.cpp (100%) rename src/procedure2/{ => facet}/IRuntimeContext_Any.cpp (100%) rename src/procedure2/{ => facet}/IRuntimeContext_DSimpleRcx.cpp (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 15a6d329..de78c4f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,7 +39,6 @@ xo_add_genfacet( xo_add_genfacetimpl( TARGET xo-procedure2-facetimpl-runtimecontext-simplercx FACET_PKG xo_procedure2 -# REPR DSimpleRcx INPUT idl/IRuntimeContext_DSimpleRcx.json5 ) @@ -49,7 +48,6 @@ xo_add_genfacetimpl( xo_add_genfacetimpl( TARGET xo-procedure2-facetimpl-procedure-primitive_gco_0 FACET_PKG xo_procedure2 -# REPR DPrimitive_gco_0 INPUT idl/IProcedure_DPrimitive_gco_0.json5 ) @@ -57,7 +55,6 @@ xo_add_genfacetimpl( xo_add_genfacetimpl( TARGET xo-procedure2-facetimpl-gcobject-primitive_gco_0 FACET_PKG xo_alloc2 -# REPR Primitive_gco_0 INPUT idl/IGCObject_DPrimitive_gco_0.json5 ) @@ -65,7 +62,6 @@ xo_add_genfacetimpl( xo_add_genfacetimpl( TARGET xo-procedure2-facetimpl-printable-primitive_gco_0 FACET_PKG xo_printable2 -# REPR Primitive_gco_0 INPUT idl/IPrintable_DPrimitive_gco_0.json5 ) @@ -75,7 +71,6 @@ xo_add_genfacetimpl( xo_add_genfacetimpl( TARGET xo-procedure2-facetimpl-procedure-primitive_gco_1_gco FACET_PKG xo_procedure2 -# REPR DPrimitive_gco_1_gco INPUT idl/IProcedure_DPrimitive_gco_1_gco.json5 ) @@ -83,7 +78,6 @@ xo_add_genfacetimpl( xo_add_genfacetimpl( TARGET xo-procedure2-facetimpl-gcobject-primitive_gco_1_gco FACET_PKG xo_alloc2 -# REPR Primitive_gco_1_gco INPUT idl/IGCObject_DPrimitive_gco_1_gco.json5 ) @@ -91,7 +85,6 @@ xo_add_genfacetimpl( xo_add_genfacetimpl( TARGET xo-procedure2-facetimpl-printable-primitive_gco_1_gco FACET_PKG xo_printable2 -# REPR Primitive_gco_1_gco INPUT idl/IPrintable_DPrimitive_gco_1_gco.json5 ) @@ -101,7 +94,6 @@ xo_add_genfacetimpl( xo_add_genfacetimpl( TARGET xo-procedure2-facetimpl-procedure-primitive_gco_2_gco_gco FACET_PKG xo_procedure2 -# REPR DPrimitive_gco_2_gco_gco INPUT idl/IProcedure_DPrimitive_gco_2_gco_gco.json5 ) @@ -109,7 +101,6 @@ xo_add_genfacetimpl( xo_add_genfacetimpl( TARGET xo-procedure2-facetimpl-gcobject-primitive_gco_2_gco_gco FACET_PKG xo_alloc2 -# REPR Primitive_gco_2_gco_gco INPUT idl/IGCObject_DPrimitive_gco_2_gco_gco.json5 ) @@ -117,7 +108,6 @@ xo_add_genfacetimpl( xo_add_genfacetimpl( TARGET xo-procedure2-facetimpl-printable-primitive_gco_2_gco_gco FACET_PKG xo_printable2 -# REPR Primitive_gco_2_gco_gco INPUT idl/IPrintable_DPrimitive_gco_2_gco_gco.json5 ) @@ -127,7 +117,6 @@ xo_add_genfacetimpl( xo_add_genfacetimpl( TARGET xo-procedure2-facetimpl-procedure-primitive_gco_3_dict_string_gco FACET_PKG xo_procedure2 -# REPR Dprimitive_gco_3_dict_string_gco INPUT idl/IProcedure_DPrimitive_gco_3_dict_string_gco.json5 ) @@ -135,7 +124,6 @@ xo_add_genfacetimpl( xo_add_genfacetimpl( TARGET xo-procedure2-facetimpl-gcobject-primitive_gco_3_dict_string_gco FACET_PKG xo_alloc2 -# REPR primitive_gco_3_dict_string_gco INPUT idl/IGCObject_DPrimitive_gco_3_dict_string_gco.json5 ) @@ -143,7 +131,6 @@ xo_add_genfacetimpl( xo_add_genfacetimpl( TARGET xo-procedure2-facetimpl-printable-primitive_gco_3_dict_string_gco FACET_PKG xo_printable2 -# REPR primitive_gco_3_dict_string_gco INPUT idl/IPrintable_DPrimitive_gco_3_dict_string_gco.json5 ) diff --git a/idl/IGCObject_DPrimitive_gco_0.json5 b/idl/IGCObject_DPrimitive_gco_0.json5 index 89c7de3a..e101b65c 100644 --- a/idl/IGCObject_DPrimitive_gco_0.json5 +++ b/idl/IGCObject_DPrimitive_gco_0.json5 @@ -1,6 +1,6 @@ { mode: "implementation", - output_cpp_dir: "src/procedure2", + output_cpp_dir: "src/procedure2/facet", output_hpp_dir: "include/xo/procedure2", output_impl_subdir: "detail", includes: [ diff --git a/idl/IGCObject_DPrimitive_gco_1_gco.json5 b/idl/IGCObject_DPrimitive_gco_1_gco.json5 index 60785f65..68a74f68 100644 --- a/idl/IGCObject_DPrimitive_gco_1_gco.json5 +++ b/idl/IGCObject_DPrimitive_gco_1_gco.json5 @@ -1,6 +1,6 @@ { mode: "implementation", - output_cpp_dir: "src/procedure2", + output_cpp_dir: "src/procedure2/facet", output_hpp_dir: "include/xo/procedure2", output_impl_subdir: "detail", includes: [ diff --git a/idl/IGCObject_DPrimitive_gco_2_gco_gco.json5 b/idl/IGCObject_DPrimitive_gco_2_gco_gco.json5 index e0ffb9fe..e012bd84 100644 --- a/idl/IGCObject_DPrimitive_gco_2_gco_gco.json5 +++ b/idl/IGCObject_DPrimitive_gco_2_gco_gco.json5 @@ -1,6 +1,6 @@ { mode: "implementation", - output_cpp_dir: "src/procedure2", + output_cpp_dir: "src/procedure2/facet", output_hpp_dir: "include/xo/procedure2", output_impl_subdir: "detail", includes: [ diff --git a/idl/IGCObject_DPrimitive_gco_3_dict_string_gco.json5 b/idl/IGCObject_DPrimitive_gco_3_dict_string_gco.json5 index ad44b582..7c61aea6 100644 --- a/idl/IGCObject_DPrimitive_gco_3_dict_string_gco.json5 +++ b/idl/IGCObject_DPrimitive_gco_3_dict_string_gco.json5 @@ -1,6 +1,6 @@ { mode: "implementation", - output_cpp_dir: "src/procedure2", + output_cpp_dir: "src/procedure2/facet", output_hpp_dir: "include/xo/procedure2", output_impl_subdir: "detail", includes: [ diff --git a/idl/IPrintable_DPrimitive_gco_0.json5 b/idl/IPrintable_DPrimitive_gco_0.json5 index 830078c9..7b88b4e7 100644 --- a/idl/IPrintable_DPrimitive_gco_0.json5 +++ b/idl/IPrintable_DPrimitive_gco_0.json5 @@ -1,6 +1,6 @@ { mode: "implementation", - output_cpp_dir: "src/procedure2", + output_cpp_dir: "src/procedure2/facet", output_hpp_dir: "include/xo/procedure2", output_impl_subdir: "detail", includes: [ diff --git a/idl/IPrintable_DPrimitive_gco_1_gco.json5 b/idl/IPrintable_DPrimitive_gco_1_gco.json5 index 96782439..44493560 100644 --- a/idl/IPrintable_DPrimitive_gco_1_gco.json5 +++ b/idl/IPrintable_DPrimitive_gco_1_gco.json5 @@ -1,6 +1,6 @@ { mode: "implementation", - output_cpp_dir: "src/procedure2", + output_cpp_dir: "src/procedure2/facet", output_hpp_dir: "include/xo/procedure2", output_impl_subdir: "detail", includes: [ diff --git a/idl/IPrintable_DPrimitive_gco_2_gco_gco.json5 b/idl/IPrintable_DPrimitive_gco_2_gco_gco.json5 index ee3a1951..7b75e0b5 100644 --- a/idl/IPrintable_DPrimitive_gco_2_gco_gco.json5 +++ b/idl/IPrintable_DPrimitive_gco_2_gco_gco.json5 @@ -1,15 +1,11 @@ { mode: "implementation", - output_cpp_dir: "src/procedure2", + output_cpp_dir: "src/procedure2/facet", output_hpp_dir: "include/xo/procedure2", output_impl_subdir: "detail", includes: [ "", "", -// "", -// "", -// "", -// "", ], local_types: [ ], namespace1: "xo", diff --git a/idl/IPrintable_DPrimitive_gco_3_dict_string_gco.json5 b/idl/IPrintable_DPrimitive_gco_3_dict_string_gco.json5 index c3129451..639402c7 100644 --- a/idl/IPrintable_DPrimitive_gco_3_dict_string_gco.json5 +++ b/idl/IPrintable_DPrimitive_gco_3_dict_string_gco.json5 @@ -1,6 +1,6 @@ { mode: "implementation", - output_cpp_dir: "src/procedure2", + output_cpp_dir: "src/procedure2/facet", output_hpp_dir: "include/xo/procedure2", output_impl_subdir: "detail", includes: [ diff --git a/idl/IProcedure_DPrimitive_gco_0.json5 b/idl/IProcedure_DPrimitive_gco_0.json5 index 757e5f5f..4b0600f5 100644 --- a/idl/IProcedure_DPrimitive_gco_0.json5 +++ b/idl/IProcedure_DPrimitive_gco_0.json5 @@ -1,6 +1,6 @@ { mode: "implementation", - output_cpp_dir: "src/procedure2", + output_cpp_dir: "src/procedure2/facet", output_hpp_dir: "include/xo/procedure2", output_impl_subdir: "detail", includes: [ diff --git a/idl/IProcedure_DPrimitive_gco_1_gco.json5 b/idl/IProcedure_DPrimitive_gco_1_gco.json5 index 63af21b5..55007323 100644 --- a/idl/IProcedure_DPrimitive_gco_1_gco.json5 +++ b/idl/IProcedure_DPrimitive_gco_1_gco.json5 @@ -1,6 +1,6 @@ { mode: "implementation", - output_cpp_dir: "src/procedure2", + output_cpp_dir: "src/procedure2/facet", output_hpp_dir: "include/xo/procedure2", output_impl_subdir: "detail", includes: [ diff --git a/idl/IProcedure_DPrimitive_gco_2_gco_gco.json5 b/idl/IProcedure_DPrimitive_gco_2_gco_gco.json5 index b50a8634..e74b53c4 100644 --- a/idl/IProcedure_DPrimitive_gco_2_gco_gco.json5 +++ b/idl/IProcedure_DPrimitive_gco_2_gco_gco.json5 @@ -1,6 +1,6 @@ { mode: "implementation", - output_cpp_dir: "src/procedure2", + output_cpp_dir: "src/procedure2/facet", output_hpp_dir: "include/xo/procedure2", output_impl_subdir: "detail", includes: [ diff --git a/idl/IProcedure_DPrimitive_gco_3_dict_string_gco.json5 b/idl/IProcedure_DPrimitive_gco_3_dict_string_gco.json5 index 8099d9f3..ffb820dc 100644 --- a/idl/IProcedure_DPrimitive_gco_3_dict_string_gco.json5 +++ b/idl/IProcedure_DPrimitive_gco_3_dict_string_gco.json5 @@ -1,6 +1,6 @@ { mode: "implementation", - output_cpp_dir: "src/procedure2", + output_cpp_dir: "src/procedure2/facet", output_hpp_dir: "include/xo/procedure2", output_impl_subdir: "detail", includes: [ diff --git a/idl/IRuntimeContext_DSimpleRcx.json5 b/idl/IRuntimeContext_DSimpleRcx.json5 index 324526f7..ea42239b 100644 --- a/idl/IRuntimeContext_DSimpleRcx.json5 +++ b/idl/IRuntimeContext_DSimpleRcx.json5 @@ -1,6 +1,6 @@ { mode: "implementation", - output_cpp_dir: "src/procedure2", + output_cpp_dir: "src/procedure2/facet", output_hpp_dir: "include/xo/procedure2", output_impl_subdir: "detail", includes: [ diff --git a/idl/Procedure.json5 b/idl/Procedure.json5 index a4597ddd..e73c6d87 100644 --- a/idl/Procedure.json5 +++ b/idl/Procedure.json5 @@ -4,7 +4,7 @@ { mode: "facet", - output_cpp_dir: "src/procedure2", + output_cpp_dir: "src/procedure2/facet", output_hpp_dir: "include/xo/procedure2", output_impl_subdir: "detail", // includes in ASyntaxStateMachine.hpp diff --git a/idl/RuntimeContext.json5 b/idl/RuntimeContext.json5 index 40120771..46623b45 100644 --- a/idl/RuntimeContext.json5 +++ b/idl/RuntimeContext.json5 @@ -1,6 +1,6 @@ { mode: "facet", - output_cpp_dir: "src/procedure2", + output_cpp_dir: "src/procedure2/facet", output_hpp_dir: "include/xo/procedure2", output_impl_subdir: "detail", // includes in ARuntimeContext.hpp diff --git a/src/procedure2/CMakeLists.txt b/src/procedure2/CMakeLists.txt index c10c878d..9e1af2c7 100644 --- a/src/procedure2/CMakeLists.txt +++ b/src/procedure2/CMakeLists.txt @@ -7,23 +7,23 @@ set(SELF_SRCS procedure2_register_types.cpp procedure2_register_facets.cpp PrimitiveRegistry.cpp - DSimpleRcx.cpp - IRuntimeContext_Any.cpp - IRuntimeContext_DSimpleRcx.cpp - IProcedure_Any.cpp DPrimitive.cpp - IGCObject_DPrimitive_gco_0.cpp - IProcedure_DPrimitive_gco_0.cpp - IPrintable_DPrimitive_gco_0.cpp - IGCObject_DPrimitive_gco_1_gco.cpp - IProcedure_DPrimitive_gco_1_gco.cpp - IPrintable_DPrimitive_gco_1_gco.cpp - IGCObject_DPrimitive_gco_2_gco_gco.cpp - IProcedure_DPrimitive_gco_2_gco_gco.cpp - IPrintable_DPrimitive_gco_2_gco_gco.cpp - IGCObject_DPrimitive_gco_3_dict_string_gco.cpp - IProcedure_DPrimitive_gco_3_dict_string_gco.cpp - IPrintable_DPrimitive_gco_3_dict_string_gco.cpp + DSimpleRcx.cpp + facet/IRuntimeContext_Any.cpp + facet/IRuntimeContext_DSimpleRcx.cpp + facet/IProcedure_Any.cpp + facet/IGCObject_DPrimitive_gco_0.cpp + facet/IProcedure_DPrimitive_gco_0.cpp + facet/IPrintable_DPrimitive_gco_0.cpp + facet/IGCObject_DPrimitive_gco_1_gco.cpp + facet/IProcedure_DPrimitive_gco_1_gco.cpp + facet/IPrintable_DPrimitive_gco_1_gco.cpp + facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp + facet/IProcedure_DPrimitive_gco_2_gco_gco.cpp + facet/IPrintable_DPrimitive_gco_2_gco_gco.cpp + facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp + facet/IProcedure_DPrimitive_gco_3_dict_string_gco.cpp + facet/IPrintable_DPrimitive_gco_3_dict_string_gco.cpp ) xo_add_shared_library4(${SELF_LIB} ${PROJECT_NAME}Targets ${PROJECT_VERSION} 1 ${SELF_SRCS}) diff --git a/src/procedure2/IGCObject_DPrimitive_gco_0.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp similarity index 100% rename from src/procedure2/IGCObject_DPrimitive_gco_0.cpp rename to src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp diff --git a/src/procedure2/IGCObject_DPrimitive_gco_1_gco.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp similarity index 100% rename from src/procedure2/IGCObject_DPrimitive_gco_1_gco.cpp rename to src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp diff --git a/src/procedure2/IGCObject_DPrimitive_gco_2_gco_gco.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp similarity index 100% rename from src/procedure2/IGCObject_DPrimitive_gco_2_gco_gco.cpp rename to src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp diff --git a/src/procedure2/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp similarity index 100% rename from src/procedure2/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp rename to src/procedure2/facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp diff --git a/src/procedure2/IPrintable_DPrimitive_gco_0.cpp b/src/procedure2/facet/IPrintable_DPrimitive_gco_0.cpp similarity index 100% rename from src/procedure2/IPrintable_DPrimitive_gco_0.cpp rename to src/procedure2/facet/IPrintable_DPrimitive_gco_0.cpp diff --git a/src/procedure2/IPrintable_DPrimitive_gco_1_gco.cpp b/src/procedure2/facet/IPrintable_DPrimitive_gco_1_gco.cpp similarity index 100% rename from src/procedure2/IPrintable_DPrimitive_gco_1_gco.cpp rename to src/procedure2/facet/IPrintable_DPrimitive_gco_1_gco.cpp diff --git a/src/procedure2/IPrintable_DPrimitive_gco_2_gco_gco.cpp b/src/procedure2/facet/IPrintable_DPrimitive_gco_2_gco_gco.cpp similarity index 100% rename from src/procedure2/IPrintable_DPrimitive_gco_2_gco_gco.cpp rename to src/procedure2/facet/IPrintable_DPrimitive_gco_2_gco_gco.cpp diff --git a/src/procedure2/IPrintable_DPrimitive_gco_3_dict_string_gco.cpp b/src/procedure2/facet/IPrintable_DPrimitive_gco_3_dict_string_gco.cpp similarity index 100% rename from src/procedure2/IPrintable_DPrimitive_gco_3_dict_string_gco.cpp rename to src/procedure2/facet/IPrintable_DPrimitive_gco_3_dict_string_gco.cpp diff --git a/src/procedure2/IProcedure_Any.cpp b/src/procedure2/facet/IProcedure_Any.cpp similarity index 100% rename from src/procedure2/IProcedure_Any.cpp rename to src/procedure2/facet/IProcedure_Any.cpp diff --git a/src/procedure2/IProcedure_DPrimitive_gco_0.cpp b/src/procedure2/facet/IProcedure_DPrimitive_gco_0.cpp similarity index 100% rename from src/procedure2/IProcedure_DPrimitive_gco_0.cpp rename to src/procedure2/facet/IProcedure_DPrimitive_gco_0.cpp diff --git a/src/procedure2/IProcedure_DPrimitive_gco_1_gco.cpp b/src/procedure2/facet/IProcedure_DPrimitive_gco_1_gco.cpp similarity index 100% rename from src/procedure2/IProcedure_DPrimitive_gco_1_gco.cpp rename to src/procedure2/facet/IProcedure_DPrimitive_gco_1_gco.cpp diff --git a/src/procedure2/IProcedure_DPrimitive_gco_2_gco_gco.cpp b/src/procedure2/facet/IProcedure_DPrimitive_gco_2_gco_gco.cpp similarity index 100% rename from src/procedure2/IProcedure_DPrimitive_gco_2_gco_gco.cpp rename to src/procedure2/facet/IProcedure_DPrimitive_gco_2_gco_gco.cpp diff --git a/src/procedure2/IProcedure_DPrimitive_gco_3_dict_string_gco.cpp b/src/procedure2/facet/IProcedure_DPrimitive_gco_3_dict_string_gco.cpp similarity index 100% rename from src/procedure2/IProcedure_DPrimitive_gco_3_dict_string_gco.cpp rename to src/procedure2/facet/IProcedure_DPrimitive_gco_3_dict_string_gco.cpp diff --git a/src/procedure2/IRuntimeContext_Any.cpp b/src/procedure2/facet/IRuntimeContext_Any.cpp similarity index 100% rename from src/procedure2/IRuntimeContext_Any.cpp rename to src/procedure2/facet/IRuntimeContext_Any.cpp diff --git a/src/procedure2/IRuntimeContext_DSimpleRcx.cpp b/src/procedure2/facet/IRuntimeContext_DSimpleRcx.cpp similarity index 100% rename from src/procedure2/IRuntimeContext_DSimpleRcx.cpp rename to src/procedure2/facet/IRuntimeContext_DSimpleRcx.cpp From 6d6066995a900405464824141d8a39aaa82f1d08 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Sun, 15 Mar 2026 09:47:14 -0500 Subject: [PATCH 48/90] xo-interpreter2 stack: modularize nth() primitive setup/install --- include/xo/procedure2/DPrimitive.hpp | 1 + include/xo/procedure2/ObjectPrimitives.hpp | 29 ++++++++ .../procedure2_register_primitives.hpp | 6 +- src/procedure2/CMakeLists.txt | 2 + src/procedure2/ObjectPrimitives.cpp | 45 ++++++++++++ src/procedure2/init_procedure2.cpp | 4 + .../procedure2_register_primitives.cpp | 73 +++++++++++++++++++ 7 files changed, 158 insertions(+), 2 deletions(-) create mode 100644 include/xo/procedure2/ObjectPrimitives.hpp create mode 100644 src/procedure2/ObjectPrimitives.cpp create mode 100644 src/procedure2/procedure2_register_primitives.cpp diff --git a/include/xo/procedure2/DPrimitive.hpp b/include/xo/procedure2/DPrimitive.hpp index 4cc45f83..07c19c4f 100644 --- a/include/xo/procedure2/DPrimitive.hpp +++ b/include/xo/procedure2/DPrimitive.hpp @@ -72,6 +72,7 @@ namespace xo { template class Primitive { public: + using FunctionPtrType = Fn; using Traits = detail::PmFnTraits; using ACollector = xo::mm::ACollector; diff --git a/include/xo/procedure2/ObjectPrimitives.hpp b/include/xo/procedure2/ObjectPrimitives.hpp new file mode 100644 index 00000000..392cf939 --- /dev/null +++ b/include/xo/procedure2/ObjectPrimitives.hpp @@ -0,0 +1,29 @@ +/** @file ObjectPrimitives.hpp + * + * @author Roland Conybeare, Mar 2026 + **/ + +#pragma once + +#include + +namespace xo { + namespace scm { + /** @brief primitives centered on object2/ data structures. + * + * Note: they don't reside in object2/ because DPrimitive + * not available yet at that level + **/ + class ObjectPrimitives { + public: + using AAllocator = xo::mm::AAllocator; + + public: + /** create primitive for fetching nth element of a sequence **/ + static DPrimitive_gco_2_gco_gco * make_nth_pm(obj mm); + }; + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end ObjectPrimitives.hpp */ diff --git a/include/xo/procedure2/procedure2_register_primitives.hpp b/include/xo/procedure2/procedure2_register_primitives.hpp index 12e1db94..69237697 100644 --- a/include/xo/procedure2/procedure2_register_primitives.hpp +++ b/include/xo/procedure2/procedure2_register_primitives.hpp @@ -10,8 +10,10 @@ namespace xo { namespace scm { - /** Register gc-aware (AGCObject,DRepr) combinations with garbage collector @p gc **/ - bool procedure2_register_primitives(obj gc, InstallSink sink); + /** Register primitive-factories **/ + bool procedure2_register_primitives(obj gc, + InstallSink sink, + InstallFlags flags); } } diff --git a/src/procedure2/CMakeLists.txt b/src/procedure2/CMakeLists.txt index 9e1af2c7..f38ea2f1 100644 --- a/src/procedure2/CMakeLists.txt +++ b/src/procedure2/CMakeLists.txt @@ -4,8 +4,10 @@ set(SELF_LIB xo_procedure2) set(SELF_SRCS init_procedure2.cpp init_primitives.cpp + procedure2_register_primitives.cpp procedure2_register_types.cpp procedure2_register_facets.cpp + ObjectPrimitives.cpp PrimitiveRegistry.cpp DPrimitive.cpp DSimpleRcx.cpp diff --git a/src/procedure2/ObjectPrimitives.cpp b/src/procedure2/ObjectPrimitives.cpp new file mode 100644 index 00000000..5164efc6 --- /dev/null +++ b/src/procedure2/ObjectPrimitives.cpp @@ -0,0 +1,45 @@ +/** @file ObjectPrimitives.cpp + * + * @author Roland Conybeare, Mar 2026 + **/ + +#include "ObjectPrimitives.hpp" +#include "Primitive_gco_2_gco_gco.hpp" +#include +#include + +namespace xo { + using xo::scm::ASequence; + using xo::mm::AAllocator; + using xo::mm::AGCObject; + + namespace scm { + + // TODO: seq_gc -> obj + // n_gco -> obj + // + obj + xfer_nth(obj rcx, + obj seq_gco, + obj n_gco) + { + scope log(XO_DEBUG(true)); + + (void)rcx; + + obj seq = seq_gco.to_facet(); + auto n = obj::from(n_gco); + + return seq.at(n->value()); + } + + DPrimitive_gco_2_gco_gco * + ObjectPrimitives::make_nth_pm(obj mm) + { + return DPrimitive_gco_2_gco_gco::_make(mm, "nth", &xfer_nth); + } + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end ObjectPrimitives.cpp */ diff --git a/src/procedure2/init_procedure2.cpp b/src/procedure2/init_procedure2.cpp index bc7e53ab..d202931e 100644 --- a/src/procedure2/init_procedure2.cpp +++ b/src/procedure2/init_procedure2.cpp @@ -7,6 +7,7 @@ #include "init_primitives.hpp" #include "procedure2_register_facets.hpp" #include "procedure2_register_types.hpp" +#include "procedure2_register_primitives.hpp" #include #include @@ -14,6 +15,8 @@ namespace xo { using xo::scm::procedure2_register_facets; using xo::scm::procedure2_register_types; + using xo::scm::procedure2_register_primitives; + using xo::scm::PrimitiveRegistry; using xo::mm::CollectorTypeRegistry; void @@ -22,6 +25,7 @@ namespace xo { procedure2_register_facets(); CollectorTypeRegistry::instance().register_types(&procedure2_register_types); + PrimitiveRegistry::instance().register_primitives(&procedure2_register_primitives); } InitEvidence diff --git a/src/procedure2/procedure2_register_primitives.cpp b/src/procedure2/procedure2_register_primitives.cpp new file mode 100644 index 00000000..e17cda4e --- /dev/null +++ b/src/procedure2/procedure2_register_primitives.cpp @@ -0,0 +1,73 @@ +/** @file procedure2_register_primitives.cpp + * + * @author Roland Conybeare, Mar 2026 + **/ + +#include "procedure2_register_primitives.hpp" +#include "ObjectPrimitives.hpp" +#include "Primitive_gco_2_gco_gco.hpp" +#include +#include + +namespace xo { + using xo::scm::ASequence; + using xo::mm::AAllocator; + using xo::mm::AGCObject; + + namespace scm { + template + bool install_aux(InstallSink sink, + PrimitiveRepr * pm, + InstallFlags flags) + { + scope log(XO_DEBUG(true)); + + if ((flags & InstallFlags::f_generalpurpose) == InstallFlags::f_generalpurpose) { + log && log("create primitive", xtag("name", pm->name())); + + return sink(pm->name(), + pm->fn_td(), + obj(pm), + flags); + } else { + log && log("skip primitive", xtag("name", pm->name())); + + return true; + } + } + + template + bool install_aux(InstallSink sink, + obj mm, + std::string_view name, + typename Primitive::FunctionPtrType impl, + InstallFlags flags) + { + if (flags != InstallFlags::f_none) { + auto pm + = Primitive::_make(mm, name, impl); + + return install_aux(sink, pm, flags); + } else { + return true; + } + } + + bool + procedure2_register_primitives(obj mm, + InstallSink sink, + InstallFlags flags) + { + scope log(XO_DEBUG(true)); + + bool ok = true; + + ok = ok & install_aux(sink, ObjectPrimitives::make_nth_pm(mm), flags); + + return ok; + } + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end procedure2_register_primitives.cpp */ From 384fe25bcb14a67c1172f13d6c340e6c96cafec6 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Sun, 15 Mar 2026 11:40:24 -0500 Subject: [PATCH 49/90] xo-interpreter2 stack: refactor: move dict pms to object2/ --- include/xo/procedure2/ObjectPrimitives.hpp | 10 +++- src/procedure2/ObjectPrimitives.cpp | 59 ++++++++++++++++++- .../procedure2_register_primitives.cpp | 3 +- 3 files changed, 67 insertions(+), 5 deletions(-) diff --git a/include/xo/procedure2/ObjectPrimitives.hpp b/include/xo/procedure2/ObjectPrimitives.hpp index 392cf939..46cdf801 100644 --- a/include/xo/procedure2/ObjectPrimitives.hpp +++ b/include/xo/procedure2/ObjectPrimitives.hpp @@ -5,7 +5,9 @@ #pragma once -#include +#include "Primitive_gco_0.hpp" +#include "Primitive_gco_2_gco_gco.hpp" +#include "Primitive_gco_3_dict_string_gco.hpp" namespace xo { namespace scm { @@ -21,6 +23,12 @@ namespace xo { public: /** create primitive for fetching nth element of a sequence **/ static DPrimitive_gco_2_gco_gco * make_nth_pm(obj mm); + + /** create pirmitive for creating a dictionary instance **/ + static DPrimitive_gco_0 * make_dict_make_pm(obj mm); + + /** create primitive that upserts a key,value pair into a dictionary **/ + static DPrimitive_gco_3_dict_string_gco * make_dict_upsert_pm(obj mm); }; } /*namespace scm*/ diff --git a/src/procedure2/ObjectPrimitives.cpp b/src/procedure2/ObjectPrimitives.cpp index 5164efc6..98206d26 100644 --- a/src/procedure2/ObjectPrimitives.cpp +++ b/src/procedure2/ObjectPrimitives.cpp @@ -4,17 +4,24 @@ **/ #include "ObjectPrimitives.hpp" -#include "Primitive_gco_2_gco_gco.hpp" +#include #include #include +#include +#include namespace xo { using xo::scm::ASequence; + using xo::print::APrintable; using xo::mm::AAllocator; using xo::mm::AGCObject; + using xo::facet::FacetRegistry; + using xo::facet::TypeRegistry; namespace scm { + // ----- nth ----- + // TODO: seq_gc -> obj // n_gco -> obj // @@ -23,8 +30,6 @@ namespace xo { obj seq_gco, obj n_gco) { - scope log(XO_DEBUG(true)); - (void)rcx; obj seq = seq_gco.to_facet(); @@ -39,6 +44,54 @@ namespace xo { return DPrimitive_gco_2_gco_gco::_make(mm, "nth", &xfer_nth); } + // ----- dict_make ----- + + obj + xfer_dict_make(obj rcx) + { + return obj(DDictionary::empty(rcx.allocator(), + 8 /*cap*/)); + } + + DPrimitive_gco_0 * + ObjectPrimitives::make_dict_make_pm(obj mm) + { + return DPrimitive_gco_0::_make(mm, "dict_make", &xfer_dict_make); + } + + // ----- dict_upsert ----- + + obj + xfer_dict_upsert(obj rcx, + obj dict, + obj key, + obj value) + { + scope log(XO_DEBUG(true)); + + log && log(xtag("dict.tseq", dict._typeseq()), + xtag("dict.tname", TypeRegistry::id2name(dict._typeseq()))); + log && log(xtag("key.tseq", key._typeseq()), + xtag("key.tname", TypeRegistry::id2name(key._typeseq()))); + log && log(xtag("value.tseq", value._typeseq()), + xtag("value.tname", TypeRegistry::id2name(value._typeseq()))); + + auto value_pr = FacetRegistry::instance().variant(value); + + log && log(xtag("value", value_pr)); + + dict->upsert(rcx.allocator(), + DDictionary::pair_type(key.data(), value)); + + return dict; + } + + DPrimitive_gco_3_dict_string_gco * + ObjectPrimitives::make_dict_upsert_pm(obj mm) + { + return DPrimitive_gco_3_dict_string_gco::_make(mm, "dict_upsert", &xfer_dict_upsert); + } + } /*namespace scm*/ } /*namespace xo*/ diff --git a/src/procedure2/procedure2_register_primitives.cpp b/src/procedure2/procedure2_register_primitives.cpp index e17cda4e..f0aa6f1b 100644 --- a/src/procedure2/procedure2_register_primitives.cpp +++ b/src/procedure2/procedure2_register_primitives.cpp @@ -5,7 +5,6 @@ #include "procedure2_register_primitives.hpp" #include "ObjectPrimitives.hpp" -#include "Primitive_gco_2_gco_gco.hpp" #include #include @@ -63,6 +62,8 @@ namespace xo { bool ok = true; ok = ok & install_aux(sink, ObjectPrimitives::make_nth_pm(mm), flags); + ok = ok & install_aux(sink, ObjectPrimitives::make_dict_make_pm(mm), flags); + ok = ok & install_aux(sink, ObjectPrimitives::make_dict_upsert_pm(mm), flags); return ok; } From 7be6463835d43a60bd5febeff2f68bf0cfb31b4d Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Sun, 15 Mar 2026 11:51:37 -0500 Subject: [PATCH 50/90] xo-interpreter2 stack: refactor: move cons() pm to object2/ --- include/xo/procedure2/ObjectPrimitives.hpp | 5 +++- src/procedure2/ObjectPrimitives.cpp | 23 +++++++++++++++++++ .../procedure2_register_primitives.cpp | 1 + 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/include/xo/procedure2/ObjectPrimitives.hpp b/include/xo/procedure2/ObjectPrimitives.hpp index 46cdf801..d02ad4aa 100644 --- a/include/xo/procedure2/ObjectPrimitives.hpp +++ b/include/xo/procedure2/ObjectPrimitives.hpp @@ -21,9 +21,12 @@ namespace xo { using AAllocator = xo::mm::AAllocator; public: - /** create primitive for fetching nth element of a sequence **/ + /** create primitive: fetch nth element of a sequence **/ static DPrimitive_gco_2_gco_gco * make_nth_pm(obj mm); + /** create primitive: create cons cell **/ + static DPrimitive_gco_2_gco_gco * make_cons_pm(obj mm); + /** create pirmitive for creating a dictionary instance **/ static DPrimitive_gco_0 * make_dict_make_pm(obj mm); diff --git a/src/procedure2/ObjectPrimitives.cpp b/src/procedure2/ObjectPrimitives.cpp index 98206d26..1cd00863 100644 --- a/src/procedure2/ObjectPrimitives.cpp +++ b/src/procedure2/ObjectPrimitives.cpp @@ -6,6 +6,7 @@ #include "ObjectPrimitives.hpp" #include #include +#include #include #include #include @@ -44,6 +45,28 @@ namespace xo { return DPrimitive_gco_2_gco_gco::_make(mm, "nth", &xfer_nth); } + // ----- cons ----- + + obj + xfer_cons(obj rcx, + obj car, + obj cdr) + { + (void)rcx; + + auto cdr_list = obj::from(cdr); + + return DList::cons(rcx.allocator(), + car, + cdr_list.data()); + } + + DPrimitive_gco_2_gco_gco * + ObjectPrimitives::make_cons_pm(obj mm) + { + return DPrimitive_gco_2_gco_gco::_make(mm, "cons", &xfer_cons); + } + // ----- dict_make ----- obj diff --git a/src/procedure2/procedure2_register_primitives.cpp b/src/procedure2/procedure2_register_primitives.cpp index f0aa6f1b..c13dd4d3 100644 --- a/src/procedure2/procedure2_register_primitives.cpp +++ b/src/procedure2/procedure2_register_primitives.cpp @@ -62,6 +62,7 @@ namespace xo { bool ok = true; ok = ok & install_aux(sink, ObjectPrimitives::make_nth_pm(mm), flags); + ok = ok & install_aux(sink, ObjectPrimitives::make_cons_pm(mm), flags); ok = ok & install_aux(sink, ObjectPrimitives::make_dict_make_pm(mm), flags); ok = ok & install_aux(sink, ObjectPrimitives::make_dict_upsert_pm(mm), flags); From f72d7aac252ecf7fd682bc7758e0407c9221eef7 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Sun, 15 Mar 2026 12:10:21 -0500 Subject: [PATCH 51/90] xo-interpreter2 stack: refactor: do report_memory_use() modular --- include/xo/procedure2/ObjectPrimitives.hpp | 2 +- src/procedure2/init_procedure2.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/xo/procedure2/ObjectPrimitives.hpp b/include/xo/procedure2/ObjectPrimitives.hpp index d02ad4aa..e7dc3127 100644 --- a/include/xo/procedure2/ObjectPrimitives.hpp +++ b/include/xo/procedure2/ObjectPrimitives.hpp @@ -27,7 +27,7 @@ namespace xo { /** create primitive: create cons cell **/ static DPrimitive_gco_2_gco_gco * make_cons_pm(obj mm); - /** create pirmitive for creating a dictionary instance **/ + /** create primitive for creating a dictionary instance **/ static DPrimitive_gco_0 * make_dict_make_pm(obj mm); /** create primitive that upserts a key,value pair into a dictionary **/ diff --git a/src/procedure2/init_procedure2.cpp b/src/procedure2/init_procedure2.cpp index d202931e..7c07f378 100644 --- a/src/procedure2/init_procedure2.cpp +++ b/src/procedure2/init_procedure2.cpp @@ -13,9 +13,9 @@ #include namespace xo { + using xo::scm::procedure2_register_primitives; using xo::scm::procedure2_register_facets; using xo::scm::procedure2_register_types; - using xo::scm::procedure2_register_primitives; using xo::scm::PrimitiveRegistry; using xo::mm::CollectorTypeRegistry; From 32b26d11633ff2e410df946949d0f20e38444d7a Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Sun, 15 Mar 2026 14:25:35 -0500 Subject: [PATCH 52/90] xo-interpreter2 stack: refactor: move cwd() -> ObjectPrimitives --- include/xo/procedure2/ObjectPrimitives.hpp | 3 +++ src/procedure2/ObjectPrimitives.cpp | 18 ++++++++++++++++++ .../procedure2_register_primitives.cpp | 1 + 3 files changed, 22 insertions(+) diff --git a/include/xo/procedure2/ObjectPrimitives.hpp b/include/xo/procedure2/ObjectPrimitives.hpp index e7dc3127..ee2dfae0 100644 --- a/include/xo/procedure2/ObjectPrimitives.hpp +++ b/include/xo/procedure2/ObjectPrimitives.hpp @@ -21,6 +21,9 @@ namespace xo { using AAllocator = xo::mm::AAllocator; public: + /** create primitive: report current working directory **/ + static DPrimitive_gco_0 * make_cwd_pm(obj mm); + /** create primitive: fetch nth element of a sequence **/ static DPrimitive_gco_2_gco_gco * make_nth_pm(obj mm); diff --git a/src/procedure2/ObjectPrimitives.cpp b/src/procedure2/ObjectPrimitives.cpp index 1cd00863..f5d7ab15 100644 --- a/src/procedure2/ObjectPrimitives.cpp +++ b/src/procedure2/ObjectPrimitives.cpp @@ -10,6 +10,7 @@ #include #include #include +#include // for getcwd() namespace xo { using xo::scm::ASequence; @@ -21,6 +22,23 @@ namespace xo { namespace scm { + // ----- cwd ----- + + obj + xfer_cwd(obj rcx) + { + char buf[PATH_MAX]; + ::getcwd(buf, sizeof(buf)); + + return obj(DString::from_cstr(rcx.allocator(), buf)); + } + + DPrimitive_gco_0 * + ObjectPrimitives::make_cwd_pm(obj mm) + { + return DPrimitive_gco_0::_make(mm, "cwd", &xfer_cwd); + } + // ----- nth ----- // TODO: seq_gc -> obj diff --git a/src/procedure2/procedure2_register_primitives.cpp b/src/procedure2/procedure2_register_primitives.cpp index c13dd4d3..a5502d68 100644 --- a/src/procedure2/procedure2_register_primitives.cpp +++ b/src/procedure2/procedure2_register_primitives.cpp @@ -61,6 +61,7 @@ namespace xo { bool ok = true; + ok = ok & install_aux(sink, ObjectPrimitives::make_cwd_pm(mm), flags); ok = ok & install_aux(sink, ObjectPrimitives::make_nth_pm(mm), flags); ok = ok & install_aux(sink, ObjectPrimitives::make_cons_pm(mm), flags); ok = ok & install_aux(sink, ObjectPrimitives::make_dict_make_pm(mm), flags); From 42b5cc7aea2af85e7c7fc54d0def4f68bfa96b0a Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Sun, 15 Mar 2026 14:35:44 -0500 Subject: [PATCH 53/90] xo-interpreter2 stack: move fn_n_args() to ObjectPrimitives --- include/xo/procedure2/ObjectPrimitives.hpp | 4 ++++ src/procedure2/ObjectPrimitives.cpp | 24 +++++++++++++++++++ .../procedure2_register_primitives.cpp | 1 + 3 files changed, 29 insertions(+) diff --git a/include/xo/procedure2/ObjectPrimitives.hpp b/include/xo/procedure2/ObjectPrimitives.hpp index ee2dfae0..1de2fd2d 100644 --- a/include/xo/procedure2/ObjectPrimitives.hpp +++ b/include/xo/procedure2/ObjectPrimitives.hpp @@ -6,6 +6,7 @@ #pragma once #include "Primitive_gco_0.hpp" +#include "Primitive_gco_1_gco.hpp" #include "Primitive_gco_2_gco_gco.hpp" #include "Primitive_gco_3_dict_string_gco.hpp" @@ -35,6 +36,9 @@ namespace xo { /** create primitive that upserts a key,value pair into a dictionary **/ static DPrimitive_gco_3_dict_string_gco * make_dict_upsert_pm(obj mm); + + /** create primitive: get fixed number of args for function **/ + static DPrimitive_gco_1_gco * make_fn_n_args_pm(obj mm); }; } /*namespace scm*/ diff --git a/src/procedure2/ObjectPrimitives.cpp b/src/procedure2/ObjectPrimitives.cpp index f5d7ab15..29e9e9bb 100644 --- a/src/procedure2/ObjectPrimitives.cpp +++ b/src/procedure2/ObjectPrimitives.cpp @@ -133,6 +133,30 @@ namespace xo { return DPrimitive_gco_3_dict_string_gco::_make(mm, "dict_upsert", &xfer_dict_upsert); } + // ----- fn_n_args ----- + + obj + xfer_fn_n_args(obj rcx, + obj fn_gco) + { + scope log(XO_DEBUG(true)); + + log && log(xtag("fn_gco.tseq", fn_gco._typeseq())); + log && log(xtag("fn_gco.tname", TypeRegistry::id2name(fn_gco._typeseq()))); + + auto fn_proc = FacetRegistry::instance().try_variant(fn_gco); + + assert(fn_proc); + + return DInteger::box(rcx.allocator(), fn_proc.n_args()); + } + + DPrimitive_gco_1_gco * + ObjectPrimitives::make_fn_n_args_pm(obj mm) + { + return DPrimitive_gco_1_gco::_make(mm, "fn_n_args", &xfer_fn_n_args); + } + } /*namespace scm*/ } /*namespace xo*/ diff --git a/src/procedure2/procedure2_register_primitives.cpp b/src/procedure2/procedure2_register_primitives.cpp index a5502d68..2585457b 100644 --- a/src/procedure2/procedure2_register_primitives.cpp +++ b/src/procedure2/procedure2_register_primitives.cpp @@ -66,6 +66,7 @@ namespace xo { ok = ok & install_aux(sink, ObjectPrimitives::make_cons_pm(mm), flags); ok = ok & install_aux(sink, ObjectPrimitives::make_dict_make_pm(mm), flags); ok = ok & install_aux(sink, ObjectPrimitives::make_dict_upsert_pm(mm), flags); + ok = ok & install_aux(sink, ObjectPrimitives::make_fn_n_args_pm(mm), flags); return ok; } From 7a8dc0c4ca7390378b100d06700efd74ed35e368 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Sun, 15 Mar 2026 14:36:47 -0500 Subject: [PATCH 54/90] xo-procedure2: bugfix: cosmetic index variable --- src/procedure2/PrimitiveRegistry.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/procedure2/PrimitiveRegistry.cpp b/src/procedure2/PrimitiveRegistry.cpp index 0ce7aa68..e62b6794 100644 --- a/src/procedure2/PrimitiveRegistry.cpp +++ b/src/procedure2/PrimitiveRegistry.cpp @@ -41,6 +41,7 @@ namespace xo { log && log("do install fn (", i+1, "/", n, ")"); ok = ok & fn(mm, sink, flags); + ++i; } return ok; From f1594aab1366b52c63d8d763cb6bef252cab36b5 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Mon, 16 Mar 2026 00:57:17 -0500 Subject: [PATCH 55/90] x-procedure2: + dict_lookup() primitive --- CMakeLists.txt | 23 +++++++ ...CObject_DPrimitive_gco_2_dict_string.json5 | 19 ++++++ ...intable_DPrimitive_gco_2_dict_string.json5 | 18 +++++ ...ocedure_DPrimitive_gco_2_dict_string.json5 | 20 ++++++ .../DPrimitive_gco_2_dict_string.hpp | 25 +++++++ include/xo/procedure2/ObjectPrimitives.hpp | 4 ++ .../Primitive_gco_2_dict_string.hpp | 11 +++ ...IGCObject_DPrimitive_gco_2_dict_string.hpp | 67 +++++++++++++++++++ ...Printable_DPrimitive_gco_2_dict_string.hpp | 62 +++++++++++++++++ ...Procedure_DPrimitive_gco_2_dict_string.hpp | 67 +++++++++++++++++++ src/procedure2/CMakeLists.txt | 3 + src/procedure2/ObjectPrimitives.cpp | 30 +++++++++ ...IGCObject_DPrimitive_gco_2_dict_string.cpp | 39 +++++++++++ ...Printable_DPrimitive_gco_2_dict_string.cpp | 28 ++++++++ ...Procedure_DPrimitive_gco_2_dict_string.cpp | 39 +++++++++++ src/procedure2/procedure2_register_facets.cpp | 6 ++ .../procedure2_register_primitives.cpp | 1 + src/procedure2/procedure2_register_types.cpp | 4 +- 18 files changed, 464 insertions(+), 2 deletions(-) create mode 100644 idl/IGCObject_DPrimitive_gco_2_dict_string.json5 create mode 100644 idl/IPrintable_DPrimitive_gco_2_dict_string.json5 create mode 100644 idl/IProcedure_DPrimitive_gco_2_dict_string.json5 create mode 100644 include/xo/procedure2/DPrimitive_gco_2_dict_string.hpp create mode 100644 include/xo/procedure2/Primitive_gco_2_dict_string.hpp create mode 100644 include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp create mode 100644 include/xo/procedure2/detail/IPrintable_DPrimitive_gco_2_dict_string.hpp create mode 100644 include/xo/procedure2/detail/IProcedure_DPrimitive_gco_2_dict_string.hpp create mode 100644 src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp create mode 100644 src/procedure2/facet/IPrintable_DPrimitive_gco_2_dict_string.cpp create mode 100644 src/procedure2/facet/IProcedure_DPrimitive_gco_2_dict_string.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index de78c4f4..c567a383 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -113,6 +113,29 @@ xo_add_genfacetimpl( # ---------------------------------------------------------------- +# note: manual target; generated code committed to git +xo_add_genfacetimpl( + TARGET xo-procedure2-facetimpl-procedure-primitive_gco_2_dict_string + FACET_PKG xo_procedure2 + INPUT idl/IProcedure_DPrimitive_gco_2_dict_string.json5 +) + +# note: manual target; generated code committed to git +xo_add_genfacetimpl( + TARGET xo-procedure2-facetimpl-gcobject-primitive_gco_2_dict_string + FACET_PKG xo_alloc2 + INPUT idl/IGCObject_DPrimitive_gco_2_dict_string.json5 +) + +# note: manual target; generated code committed to git +xo_add_genfacetimpl( + TARGET xo-procedure2-facetimpl-printable-primitive_gco_2_dict_string + FACET_PKG xo_printable2 + INPUT idl/IPrintable_DPrimitive_gco_2_dict_string.json5 +) + +# ---------------------------------------------------------------- + # note: manual target; generated code committed to git xo_add_genfacetimpl( TARGET xo-procedure2-facetimpl-procedure-primitive_gco_3_dict_string_gco diff --git a/idl/IGCObject_DPrimitive_gco_2_dict_string.json5 b/idl/IGCObject_DPrimitive_gco_2_dict_string.json5 new file mode 100644 index 00000000..af5861aa --- /dev/null +++ b/idl/IGCObject_DPrimitive_gco_2_dict_string.json5 @@ -0,0 +1,19 @@ +{ + mode: "implementation", + output_cpp_dir: "src/procedure2/facet", + output_hpp_dir: "include/xo/procedure2", + output_impl_subdir: "detail", + includes: [ + // + "", + "", + ], + local_types: [ ], + namespace1: "xo", + namespace2: "scm", + facet_idl: "idl/GCObject.json5", + brief: "provide AGCobject interface for Primitive (dict x string) -> gco", + using_doxygen: true, + repr: "DPrimitive_gco_2_dict_string", + doc: [ "implement AGCObject for DPrimitive (dict x string) -> gco" ], +} diff --git a/idl/IPrintable_DPrimitive_gco_2_dict_string.json5 b/idl/IPrintable_DPrimitive_gco_2_dict_string.json5 new file mode 100644 index 00000000..b37a21ac --- /dev/null +++ b/idl/IPrintable_DPrimitive_gco_2_dict_string.json5 @@ -0,0 +1,18 @@ +{ + mode: "implementation", + output_cpp_dir: "src/procedure2/facet", + output_hpp_dir: "include/xo/procedure2", + output_impl_subdir: "detail", + includes: [ + "", + "", + ], + local_types: [ ], + namespace1: "xo", + namespace2: "scm", + facet_idl: "idl/Printable.json5", + brief: "provide APrintable interface for DPrimitive (dict x string) -> gco", + using_doxygen: true, + repr: "DPrimitive_gco_2_dict_string", + doc: [ "implement APrintable for DPrimitive (dict x string) -> gco" ], +} diff --git a/idl/IProcedure_DPrimitive_gco_2_dict_string.json5 b/idl/IProcedure_DPrimitive_gco_2_dict_string.json5 new file mode 100644 index 00000000..1d47b474 --- /dev/null +++ b/idl/IProcedure_DPrimitive_gco_2_dict_string.json5 @@ -0,0 +1,20 @@ +{ + mode: "implementation", + output_cpp_dir: "src/procedure2/facet", + output_hpp_dir: "include/xo/procedure2", + output_impl_subdir: "detail", + includes: [ + "", + "", + "", + "", + ], + local_types: [ ], + namespace1: "xo", + namespace2: "scm", + facet_idl: "idl/Procedure.json5", + brief: "provide AProcedure interface for Primitive (dict x string) -> gco", + using_doxygen: true, + repr: "DPrimitive_gco_2_dict_string", + doc: [ "implement AProcedure for DPrimitive (dict x string) -> gco" ], +} diff --git a/include/xo/procedure2/DPrimitive_gco_2_dict_string.hpp b/include/xo/procedure2/DPrimitive_gco_2_dict_string.hpp new file mode 100644 index 00000000..521dc2e1 --- /dev/null +++ b/include/xo/procedure2/DPrimitive_gco_2_dict_string.hpp @@ -0,0 +1,25 @@ +/** @file DPrimitive_gco_2_dict_string.hpp + * + * @author Roland Conybeare, Jan 2026 + **/ + +#pragma once + +#include +#include +#include +#include "DPrimitive.hpp" + +namespace xo { + namespace scm { + using xo::mm::AGCObject; + using xo::facet::obj; + + using DPrimitive_gco_2_dict_string + = Primitive (*)(obj, + obj, + obj)>; + } +} + +/* end DPrimitive_gco_2_dict_string.hpp */ diff --git a/include/xo/procedure2/ObjectPrimitives.hpp b/include/xo/procedure2/ObjectPrimitives.hpp index 1de2fd2d..2fc31766 100644 --- a/include/xo/procedure2/ObjectPrimitives.hpp +++ b/include/xo/procedure2/ObjectPrimitives.hpp @@ -8,6 +8,7 @@ #include "Primitive_gco_0.hpp" #include "Primitive_gco_1_gco.hpp" #include "Primitive_gco_2_gco_gco.hpp" +#include "Primitive_gco_2_dict_string.hpp" #include "Primitive_gco_3_dict_string_gco.hpp" namespace xo { @@ -34,6 +35,9 @@ namespace xo { /** create primitive for creating a dictionary instance **/ static DPrimitive_gco_0 * make_dict_make_pm(obj mm); + /** create primitive for creating a dictionary instance **/ + static DPrimitive_gco_2_dict_string * make_dict_lookup_pm(obj mm); + /** create primitive that upserts a key,value pair into a dictionary **/ static DPrimitive_gco_3_dict_string_gco * make_dict_upsert_pm(obj mm); diff --git a/include/xo/procedure2/Primitive_gco_2_dict_string.hpp b/include/xo/procedure2/Primitive_gco_2_dict_string.hpp new file mode 100644 index 00000000..69f116a8 --- /dev/null +++ b/include/xo/procedure2/Primitive_gco_2_dict_string.hpp @@ -0,0 +1,11 @@ +/** @file Primitive_gco_2_dict_string.hpp + * + * @author Roland Conybeare, Feb 2026 + **/ + +#include "DPrimitive_gco_2_dict_string.hpp" +#include "detail/IProcedure_DPrimitive_gco_2_dict_string.hpp" +#include "detail/IGCObject_DPrimitive_gco_2_dict_string.hpp" +#include "detail/IPrintable_DPrimitive_gco_2_dict_string.hpp" + +/* end Primitive_gco_2_dict_string.hpp */ diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp new file mode 100644 index 00000000..256ad716 --- /dev/null +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp @@ -0,0 +1,67 @@ +/** @file IGCObject_DPrimitive_gco_2_dict_string.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IGCObject_DPrimitive_gco_2_dict_string.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_repr.hpp.j2] + * 3. idl for facet methods + * [idl/IGCObject_DPrimitive_gco_2_dict_string.json5] + **/ + +#pragma once + +#include "GCObject.hpp" +#include +#include +#include "DPrimitive_gco_2_dict_string.hpp" + +namespace xo { namespace scm { class IGCObject_DPrimitive_gco_2_dict_string; } } + +namespace xo { + namespace facet { + template <> + struct FacetImplementation + { + using ImplType = xo::mm::IGCObject_Xfer + ; + }; + } +} + +namespace xo { + namespace scm { + /** @class IGCObject_DPrimitive_gco_2_dict_string + **/ + class IGCObject_DPrimitive_gco_2_dict_string { + public: + /** @defgroup scm-gcobject-dprimitive_gco_2_dict_string-type-traits **/ + ///@{ + using size_type = xo::mm::AGCObject::size_type; + using AAllocator = xo::mm::AGCObject::AAllocator; + using ACollector = xo::mm::AGCObject::ACollector; + using Copaque = xo::mm::AGCObject::Copaque; + using Opaque = xo::mm::AGCObject::Opaque; + ///@} + /** @defgroup scm-gcobject-dprimitive_gco_2_dict_string-methods **/ + ///@{ + // const methods + /** memory consumption for this instance **/ + static size_type shallow_size(const DPrimitive_gco_2_dict_string & self) noexcept; + /** copy instance using allocator **/ + static Opaque shallow_copy(const DPrimitive_gco_2_dict_string & self, obj mm) noexcept; + + // non-const methods + /** during GC: forward immdiate children **/ + static size_type forward_children(DPrimitive_gco_2_dict_string & self, obj gc) noexcept; + ///@} + }; + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end */ \ No newline at end of file diff --git a/include/xo/procedure2/detail/IPrintable_DPrimitive_gco_2_dict_string.hpp b/include/xo/procedure2/detail/IPrintable_DPrimitive_gco_2_dict_string.hpp new file mode 100644 index 00000000..fac4a58b --- /dev/null +++ b/include/xo/procedure2/detail/IPrintable_DPrimitive_gco_2_dict_string.hpp @@ -0,0 +1,62 @@ +/** @file IPrintable_DPrimitive_gco_2_dict_string.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IPrintable_DPrimitive_gco_2_dict_string.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_repr.hpp.j2] + * 3. idl for facet methods + * [idl/IPrintable_DPrimitive_gco_2_dict_string.json5] + **/ + +#pragma once + +#include "Printable.hpp" +#include +#include +#include "DPrimitive_gco_2_dict_string.hpp" + +namespace xo { namespace scm { class IPrintable_DPrimitive_gco_2_dict_string; } } + +namespace xo { + namespace facet { + template <> + struct FacetImplementation + { + using ImplType = xo::print::IPrintable_Xfer + ; + }; + } +} + +namespace xo { + namespace scm { + /** @class IPrintable_DPrimitive_gco_2_dict_string + **/ + class IPrintable_DPrimitive_gco_2_dict_string { + public: + /** @defgroup scm-printable-dprimitive_gco_2_dict_string-type-traits **/ + ///@{ + using ppindentinfo = xo::print::APrintable::ppindentinfo; + using Copaque = xo::print::APrintable::Copaque; + using Opaque = xo::print::APrintable::Opaque; + ///@} + /** @defgroup scm-printable-dprimitive_gco_2_dict_string-methods **/ + ///@{ + // const methods + /** Pretty-printing support for this object. +See [xo-indentlog/xo/indentlog/pretty.hpp] **/ + static bool pretty(const DPrimitive_gco_2_dict_string & self, const ppindentinfo & ppii); + + // non-const methods + ///@} + }; + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end */ \ No newline at end of file diff --git a/include/xo/procedure2/detail/IProcedure_DPrimitive_gco_2_dict_string.hpp b/include/xo/procedure2/detail/IProcedure_DPrimitive_gco_2_dict_string.hpp new file mode 100644 index 00000000..bdb5bc81 --- /dev/null +++ b/include/xo/procedure2/detail/IProcedure_DPrimitive_gco_2_dict_string.hpp @@ -0,0 +1,67 @@ +/** @file IProcedure_DPrimitive_gco_2_dict_string.hpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IProcedure_DPrimitive_gco_2_dict_string.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_repr.hpp.j2] + * 3. idl for facet methods + * [idl/IProcedure_DPrimitive_gco_2_dict_string.json5] + **/ + +#pragma once + +#include "Procedure.hpp" +#include +#include +#include +#include +#include "DPrimitive_gco_2_dict_string.hpp" + +namespace xo { namespace scm { class IProcedure_DPrimitive_gco_2_dict_string; } } + +namespace xo { + namespace facet { + template <> + struct FacetImplementation + { + using ImplType = xo::scm::IProcedure_Xfer + ; + }; + } +} + +namespace xo { + namespace scm { + /** @class IProcedure_DPrimitive_gco_2_dict_string + **/ + class IProcedure_DPrimitive_gco_2_dict_string { + public: + /** @defgroup scm-procedure-dprimitive_gco_2_dict_string-type-traits **/ + ///@{ + using AGCObject = xo::scm::AProcedure::AGCObject; + using Copaque = xo::scm::AProcedure::Copaque; + using Opaque = xo::scm::AProcedure::Opaque; + ///@} + /** @defgroup scm-procedure-dprimitive_gco_2_dict_string-methods **/ + ///@{ + // const methods + /** true iff procedure takes n arguments **/ + static bool is_nary(const DPrimitive_gco_2_dict_string & self) noexcept; + /** number of arguments. -1 for n-ary **/ + static std::int32_t n_args(const DPrimitive_gco_2_dict_string & self) noexcept; + + // non-const methods + /** invoke procedure; assume arguments satisfy type system **/ + static obj apply_nocheck(DPrimitive_gco_2_dict_string & self, obj rcx, const DArray * args); + ///@} + }; + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end */ \ No newline at end of file diff --git a/src/procedure2/CMakeLists.txt b/src/procedure2/CMakeLists.txt index f38ea2f1..6ac08bb5 100644 --- a/src/procedure2/CMakeLists.txt +++ b/src/procedure2/CMakeLists.txt @@ -23,6 +23,9 @@ set(SELF_SRCS facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp facet/IProcedure_DPrimitive_gco_2_gco_gco.cpp facet/IPrintable_DPrimitive_gco_2_gco_gco.cpp + facet/IGCObject_DPrimitive_gco_2_dict_string.cpp + facet/IProcedure_DPrimitive_gco_2_dict_string.cpp + facet/IPrintable_DPrimitive_gco_2_dict_string.cpp facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp facet/IProcedure_DPrimitive_gco_3_dict_string_gco.cpp facet/IPrintable_DPrimitive_gco_3_dict_string_gco.cpp diff --git a/src/procedure2/ObjectPrimitives.cpp b/src/procedure2/ObjectPrimitives.cpp index 29e9e9bb..fcb8ba20 100644 --- a/src/procedure2/ObjectPrimitives.cpp +++ b/src/procedure2/ObjectPrimitives.cpp @@ -4,6 +4,7 @@ **/ #include "ObjectPrimitives.hpp" +#include #include #include #include @@ -100,6 +101,35 @@ namespace xo { return DPrimitive_gco_0::_make(mm, "dict_make", &xfer_dict_make); } + // ----- dict_at ----- + + obj + xfer_dict_lookup(obj rcx, + obj dict, + obj key) + { + auto opt = dict->lookup(key.data()); + + if (opt) { + return opt.value(); + } else { + DString * src_fn = DString::from_cstr(rcx.allocator(), "dict_lookup"); + DString * error = DString::printf(rcx.allocator(), + 100, + "no value in dict for key [%s]", key.data()->data()); + + return obj + (DRuntimeError::_make(rcx.allocator(), + src_fn, error)); + } + } + + DPrimitive_gco_2_dict_string * + ObjectPrimitives::make_dict_lookup_pm(obj mm) + { + return DPrimitive_gco_2_dict_string::_make(mm, "dict_lookup", &xfer_dict_lookup); + } + // ----- dict_upsert ----- obj diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp new file mode 100644 index 00000000..ec65d3d0 --- /dev/null +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp @@ -0,0 +1,39 @@ +/** @file IGCObject_DPrimitive_gco_2_dict_string.cpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IGCObject_DPrimitive_gco_2_dict_string.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/IGCObject_DPrimitive_gco_2_dict_string.json5] +**/ + +#include "detail/IGCObject_DPrimitive_gco_2_dict_string.hpp" + +namespace xo { + namespace scm { + auto + IGCObject_DPrimitive_gco_2_dict_string::shallow_size(const DPrimitive_gco_2_dict_string & self) noexcept -> size_type + { + return self.shallow_size(); + } + + auto + IGCObject_DPrimitive_gco_2_dict_string::shallow_copy(const DPrimitive_gco_2_dict_string & self, obj mm) noexcept -> Opaque + { + return self.shallow_copy(mm); + } + + auto + IGCObject_DPrimitive_gco_2_dict_string::forward_children(DPrimitive_gco_2_dict_string & self, obj gc) noexcept -> size_type + { + return self.forward_children(gc); + } + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end IGCObject_DPrimitive_gco_2_dict_string.cpp */ diff --git a/src/procedure2/facet/IPrintable_DPrimitive_gco_2_dict_string.cpp b/src/procedure2/facet/IPrintable_DPrimitive_gco_2_dict_string.cpp new file mode 100644 index 00000000..dea86c00 --- /dev/null +++ b/src/procedure2/facet/IPrintable_DPrimitive_gco_2_dict_string.cpp @@ -0,0 +1,28 @@ +/** @file IPrintable_DPrimitive_gco_2_dict_string.cpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IPrintable_DPrimitive_gco_2_dict_string.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/IPrintable_DPrimitive_gco_2_dict_string.json5] +**/ + +#include "detail/IPrintable_DPrimitive_gco_2_dict_string.hpp" + +namespace xo { + namespace scm { + auto + IPrintable_DPrimitive_gco_2_dict_string::pretty(const DPrimitive_gco_2_dict_string & self, const ppindentinfo & ppii) -> bool + { + return self.pretty(ppii); + } + + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end IPrintable_DPrimitive_gco_2_dict_string.cpp */ diff --git a/src/procedure2/facet/IProcedure_DPrimitive_gco_2_dict_string.cpp b/src/procedure2/facet/IProcedure_DPrimitive_gco_2_dict_string.cpp new file mode 100644 index 00000000..ddc92094 --- /dev/null +++ b/src/procedure2/facet/IProcedure_DPrimitive_gco_2_dict_string.cpp @@ -0,0 +1,39 @@ +/** @file IProcedure_DPrimitive_gco_2_dict_string.cpp + * + * Generated automagically from ingredients: + * 1. code generator: + * [xo-facet/codegen/genfacet] + * arguments: + * --input [idl/IProcedure_DPrimitive_gco_2_dict_string.json5] + * 2. jinja2 template for abstract facet .hpp file: + * [iface_facet_any.hpp.j2] + * 3. idl for facet methods + * [idl/IProcedure_DPrimitive_gco_2_dict_string.json5] +**/ + +#include "detail/IProcedure_DPrimitive_gco_2_dict_string.hpp" + +namespace xo { + namespace scm { + auto + IProcedure_DPrimitive_gco_2_dict_string::is_nary(const DPrimitive_gco_2_dict_string & self) noexcept -> bool + { + return self.is_nary(); + } + + auto + IProcedure_DPrimitive_gco_2_dict_string::n_args(const DPrimitive_gco_2_dict_string & self) noexcept -> std::int32_t + { + return self.n_args(); + } + + auto + IProcedure_DPrimitive_gco_2_dict_string::apply_nocheck(DPrimitive_gco_2_dict_string & self, obj rcx, const DArray * args) -> obj + { + return self.apply_nocheck(rcx, args); + } + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end IProcedure_DPrimitive_gco_2_dict_string.cpp */ diff --git a/src/procedure2/procedure2_register_facets.cpp b/src/procedure2/procedure2_register_facets.cpp index 0fb14fe7..031aa538 100644 --- a/src/procedure2/procedure2_register_facets.cpp +++ b/src/procedure2/procedure2_register_facets.cpp @@ -8,6 +8,7 @@ #include "Primitive_gco_0.hpp" #include "Primitive_gco_1_gco.hpp" #include "Primitive_gco_2_gco_gco.hpp" +#include "Primitive_gco_2_dict_string.hpp" #include "Primitive_gco_3_dict_string_gco.hpp" #include @@ -40,6 +41,10 @@ namespace xo { FacetRegistry::register_impl(); FacetRegistry::register_impl(); + FacetRegistry::register_impl(); + FacetRegistry::register_impl(); + FacetRegistry::register_impl(); + FacetRegistry::register_impl(); FacetRegistry::register_impl(); FacetRegistry::register_impl(); @@ -48,6 +53,7 @@ namespace xo { log && log(xtag("DPrimitive_gco_0.tseq", typeseq::id())); log && log(xtag("DPrimitive_gco_1_gco.tseq", typeseq::id())); log && log(xtag("DPrimitive_gco_2_gco_gco.tseq", typeseq::id())); + log && log(xtag("DPrimitive_gco_2_dict_string.tseq", typeseq::id())); log && log(xtag("DPrimitive_gco_3_dict_string_gco.tseq", typeseq::id())); log && log(xtag("ARuntimeContext.tseq", typeseq::id())); diff --git a/src/procedure2/procedure2_register_primitives.cpp b/src/procedure2/procedure2_register_primitives.cpp index 2585457b..fee0bd91 100644 --- a/src/procedure2/procedure2_register_primitives.cpp +++ b/src/procedure2/procedure2_register_primitives.cpp @@ -65,6 +65,7 @@ namespace xo { ok = ok & install_aux(sink, ObjectPrimitives::make_nth_pm(mm), flags); ok = ok & install_aux(sink, ObjectPrimitives::make_cons_pm(mm), flags); ok = ok & install_aux(sink, ObjectPrimitives::make_dict_make_pm(mm), flags); + ok = ok & install_aux(sink, ObjectPrimitives::make_dict_lookup_pm(mm), flags); ok = ok & install_aux(sink, ObjectPrimitives::make_dict_upsert_pm(mm), flags); ok = ok & install_aux(sink, ObjectPrimitives::make_fn_n_args_pm(mm), flags); diff --git a/src/procedure2/procedure2_register_types.cpp b/src/procedure2/procedure2_register_types.cpp index 2484be68..0cf6206f 100644 --- a/src/procedure2/procedure2_register_types.cpp +++ b/src/procedure2/procedure2_register_types.cpp @@ -6,9 +6,9 @@ #include "procedure2_register_types.hpp" #include "Primitive_gco_0.hpp" -//#include "detail/IGCObject_DPrimitive_gco_0.hpp" #include "detail/IGCObject_DPrimitive_gco_1_gco.hpp" #include "detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp" +#include "detail/IGCObject_DPrimitive_gco_2_dict_string.hpp" #include "detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp" #include @@ -16,7 +16,6 @@ namespace xo { using xo::mm::ACollector; using xo::mm::AGCObject; using xo::facet::impl_for; - using xo::facet::typeseq; using xo::scope; namespace scm { @@ -32,6 +31,7 @@ namespace xo { ok &= gc.install_type(impl_for()); ok &= gc.install_type(impl_for()); ok &= gc.install_type(impl_for()); + ok &= gc.install_type(impl_for()); ok &= gc.install_type(impl_for()); return ok; From 0e12e2644eaa1be2e9d089748afa5904d7afb795 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Mon, 16 Mar 2026 01:27:25 -0500 Subject: [PATCH 56/90] xo-interpreter2 stack: + stringtable() in RuntimeContext api --- idl/RuntimeContext.json5 | 10 +++++++++ include/xo/procedure2/DPrimitive.hpp | 21 +++++++++++++------ include/xo/procedure2/DSimpleRcx.hpp | 6 +++++- .../xo/procedure2/detail/ARuntimeContext.hpp | 3 +++ .../procedure2/detail/IRuntimeContext_Any.hpp | 1 + .../detail/IRuntimeContext_DSimpleRcx.hpp | 2 ++ .../detail/IRuntimeContext_Xfer.hpp | 4 ++++ .../xo/procedure2/detail/RRuntimeContext.hpp | 3 +++ src/procedure2/ObjectPrimitives.cpp | 2 ++ .../facet/IRuntimeContext_DSimpleRcx.cpp | 6 ++++++ utest/DSimpleRcx.test.cpp | 13 ++++++++++-- 11 files changed, 62 insertions(+), 9 deletions(-) diff --git a/idl/RuntimeContext.json5 b/idl/RuntimeContext.json5 index 46623b45..fe1254b0 100644 --- a/idl/RuntimeContext.json5 +++ b/idl/RuntimeContext.json5 @@ -5,6 +5,7 @@ output_impl_subdir: "detail", // includes in ARuntimeContext.hpp includes: [ + "", "", "" ], @@ -46,6 +47,15 @@ noexcept: true, attributes: [], }, + { + name: "stringtable", + doc: [ "stringtable for unique symbols" ], + return_type: "StringTable *", + args: [], + const: true, + noexcept: true, + attributes: [], + }, { name: "visit_pools", doc: [ "invoke visitor for each distinct memory pool" ], diff --git a/include/xo/procedure2/DPrimitive.hpp b/include/xo/procedure2/DPrimitive.hpp index 07c19c4f..43310575 100644 --- a/include/xo/procedure2/DPrimitive.hpp +++ b/include/xo/procedure2/DPrimitive.hpp @@ -87,27 +87,36 @@ namespace xo { /** @defgroup scm-primitive-ctors constructors **/ ///@{ - Primitive(std::string_view name, Fn fn) + Primitive(std::string_view name, obj type, Fn fn) : name_{name}, + type_{type}, fn_td_{Reflect::require()}, fn_{fn} {} static Primitive * _make(obj mm, std::string_view name, Fn fn) { void * mem = mm.alloc_for(); - return new (mem) Primitive(name, fn); + return new (mem) Primitive(name, obj(), fn); } + static Primitive * _make(obj mm, + std::string_view name, + obj type, + Fn fn) + { + void * mem = mm.alloc_for(); + + return new (mem) Primitive(name, type, fn); + } + ///@} /** @defgroup scm-primitive-methods general methods **/ ///@{ - TypeDescr fn_td() const noexcept { return fn_td_; } - - std::string_view name() const noexcept { return name_; } - static constexpr std::int32_t n_args() noexcept { return Traits::n_args; } + TypeDescr fn_td() const noexcept { return fn_td_; } + std::string_view name() const noexcept { return name_; } bool is_nary() const noexcept { return false; } obj apply_nocheck(obj rcx, const DArray * args) { diff --git a/include/xo/procedure2/DSimpleRcx.hpp b/include/xo/procedure2/DSimpleRcx.hpp index 1efb802e..6a7163d1 100644 --- a/include/xo/procedure2/DSimpleRcx.hpp +++ b/include/xo/procedure2/DSimpleRcx.hpp @@ -5,6 +5,7 @@ #pragma once +#include #include namespace xo { @@ -21,13 +22,16 @@ namespace xo { using MemorySizeVisitor = xo::mm::MemorySizeVisitor; public: - DSimpleRcx(obj mm) : allocator_{mm} {} + DSimpleRcx(obj mm, StringTable * st) + : allocator_{mm}, stringtable_{st} {} obj allocator() const noexcept { return allocator_; } + StringTable * stringtable() const noexcept { return stringtable_; } void visit_pools(const MemorySizeVisitor & visitor) const; private: obj allocator_; + StringTable * stringtable_ = nullptr; }; } /*namespace scm*/ diff --git a/include/xo/procedure2/detail/ARuntimeContext.hpp b/include/xo/procedure2/detail/ARuntimeContext.hpp index 820dd8dd..716463d2 100644 --- a/include/xo/procedure2/detail/ARuntimeContext.hpp +++ b/include/xo/procedure2/detail/ARuntimeContext.hpp @@ -14,6 +14,7 @@ #pragma once // includes (via {facet_includes}) +#include #include #include #include @@ -54,6 +55,8 @@ public: virtual void _drop(Opaque d) const noexcept = 0; /** default allocator to use for objects **/ virtual obj allocator(Copaque data) const noexcept = 0; + /** stringtable for unique symbols **/ + virtual StringTable * stringtable(Copaque data) const noexcept = 0; /** invoke visitor for each distinct memory pool **/ virtual void visit_pools(Copaque data, MemorySizeVisitor visitor) const = 0; diff --git a/include/xo/procedure2/detail/IRuntimeContext_Any.hpp b/include/xo/procedure2/detail/IRuntimeContext_Any.hpp index 2caa9d34..b72f934f 100644 --- a/include/xo/procedure2/detail/IRuntimeContext_Any.hpp +++ b/include/xo/procedure2/detail/IRuntimeContext_Any.hpp @@ -61,6 +61,7 @@ namespace scm { // const methods [[noreturn]] obj allocator(Copaque) const noexcept override { _fatal(); } + [[noreturn]] StringTable * stringtable(Copaque) const noexcept override { _fatal(); } [[noreturn]] void visit_pools(Copaque, MemorySizeVisitor) const override { _fatal(); } // nonconst methods diff --git a/include/xo/procedure2/detail/IRuntimeContext_DSimpleRcx.hpp b/include/xo/procedure2/detail/IRuntimeContext_DSimpleRcx.hpp index 62d3e12d..82ab5219 100644 --- a/include/xo/procedure2/detail/IRuntimeContext_DSimpleRcx.hpp +++ b/include/xo/procedure2/detail/IRuntimeContext_DSimpleRcx.hpp @@ -49,6 +49,8 @@ namespace xo { // const methods /** default allocator to use for objects **/ static obj allocator(const DSimpleRcx & self) noexcept; + /** stringtable for unique symbols **/ + static StringTable * stringtable(const DSimpleRcx & self) noexcept; /** invoke visitor for each distinct memory pool **/ static void visit_pools(const DSimpleRcx & self, MemorySizeVisitor visitor); diff --git a/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp b/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp index 6257abb4..5dc9de5f 100644 --- a/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp +++ b/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp @@ -13,6 +13,7 @@ #pragma once +#include #include #include @@ -49,6 +50,9 @@ namespace scm { obj allocator(Copaque data) const noexcept override { return I::allocator(_dcast(data)); } + StringTable * stringtable(Copaque data) const noexcept override { + return I::stringtable(_dcast(data)); + } void visit_pools(Copaque data, MemorySizeVisitor visitor) const override { return I::visit_pools(_dcast(data), visitor); } diff --git a/include/xo/procedure2/detail/RRuntimeContext.hpp b/include/xo/procedure2/detail/RRuntimeContext.hpp index 5840743e..6553648c 100644 --- a/include/xo/procedure2/detail/RRuntimeContext.hpp +++ b/include/xo/procedure2/detail/RRuntimeContext.hpp @@ -57,6 +57,9 @@ public: obj allocator() const noexcept { return O::iface()->allocator(O::data()); } + StringTable * stringtable() const noexcept { + return O::iface()->stringtable(O::data()); + } void visit_pools(MemorySizeVisitor visitor) const { return O::iface()->visit_pools(O::data(), visitor); } diff --git a/src/procedure2/ObjectPrimitives.cpp b/src/procedure2/ObjectPrimitives.cpp index fcb8ba20..c247ab8c 100644 --- a/src/procedure2/ObjectPrimitives.cpp +++ b/src/procedure2/ObjectPrimitives.cpp @@ -75,6 +75,8 @@ namespace xo { auto cdr_list = obj::from(cdr); + //auto T = DTypeVarRef::_make(rcx.allocator(), "T"); + return DList::cons(rcx.allocator(), car, cdr_list.data()); diff --git a/src/procedure2/facet/IRuntimeContext_DSimpleRcx.cpp b/src/procedure2/facet/IRuntimeContext_DSimpleRcx.cpp index 2331b7c1..82dd310e 100644 --- a/src/procedure2/facet/IRuntimeContext_DSimpleRcx.cpp +++ b/src/procedure2/facet/IRuntimeContext_DSimpleRcx.cpp @@ -21,6 +21,12 @@ namespace xo { return self.allocator(); } + auto + IRuntimeContext_DSimpleRcx::stringtable(const DSimpleRcx & self) noexcept -> StringTable * + { + return self.stringtable(); + } + auto IRuntimeContext_DSimpleRcx::visit_pools(const DSimpleRcx & self, MemorySizeVisitor visitor) -> void { diff --git a/utest/DSimpleRcx.test.cpp b/utest/DSimpleRcx.test.cpp index cab1362d..365bd3f6 100644 --- a/utest/DSimpleRcx.test.cpp +++ b/utest/DSimpleRcx.test.cpp @@ -6,12 +6,14 @@ #include #include #include +#include #include #include namespace xo { using xo::scm::DSimpleRcx; using xo::scm::ARuntimeContext; + using xo::scm::StringTable; using xo::mm::AAllocator; using xo::mm::DArena; using xo::mm::ArenaConfig; @@ -30,12 +32,17 @@ namespace xo { { ArenaConfig cfg { .name_ = "testarena", .size_ = 4*1024 }; + DArena arena = DArena::map(cfg); auto alloc = with_facet::mkobj(&arena); - DSimpleRcx rcx(alloc); + auto stbl = StringTable(1024 /*hint_max_capacity*/, + false /*!debug_flag*/); + + DSimpleRcx rcx(alloc, &stbl); REQUIRE((void*)rcx.allocator().data() == (void*)alloc.data()); + REQUIRE(rcx.stringtable() == &stbl); } TEST_CASE("DSimpleRcx-as-ARuntimeContext", "[procedure2][DSimpleRcx]") @@ -44,8 +51,10 @@ namespace xo { .size_ = 4*1024 }; DArena arena = DArena::map(cfg); auto alloc = with_facet::mkobj(&arena); + auto stbl = StringTable(1024 /*hint_max_capacity*/, + false /*!debug_flag*/); - DSimpleRcx rcx(alloc); + DSimpleRcx rcx(alloc, &stbl); obj rcx_obj = with_facet::mkobj(&rcx); // verify we can recover allocator from obj From ba6754b37813c8c10f6ad6d83321093306f97bfb Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Mon, 16 Mar 2026 09:03:24 -0500 Subject: [PATCH 57/90] xo-interpreter2 stack: + dict type + pop more pm types --- include/xo/procedure2/ObjectPrimitives.hpp | 12 ++-- include/xo/procedure2/PrimitiveRegistry.hpp | 3 + .../procedure2_register_primitives.hpp | 1 + src/procedure2/ObjectPrimitives.cpp | 56 +++++++++++++++---- src/procedure2/PrimitiveRegistry.cpp | 3 +- .../procedure2_register_primitives.cpp | 9 +-- 6 files changed, 65 insertions(+), 19 deletions(-) diff --git a/include/xo/procedure2/ObjectPrimitives.hpp b/include/xo/procedure2/ObjectPrimitives.hpp index 2fc31766..696fc295 100644 --- a/include/xo/procedure2/ObjectPrimitives.hpp +++ b/include/xo/procedure2/ObjectPrimitives.hpp @@ -24,16 +24,20 @@ namespace xo { public: /** create primitive: report current working directory **/ - static DPrimitive_gco_0 * make_cwd_pm(obj mm); + static DPrimitive_gco_0 * make_cwd_pm(obj mm, + StringTable * stbl); /** create primitive: fetch nth element of a sequence **/ - static DPrimitive_gco_2_gco_gco * make_nth_pm(obj mm); + static DPrimitive_gco_2_gco_gco * make_nth_pm(obj mm, + StringTable * stbl); /** create primitive: create cons cell **/ - static DPrimitive_gco_2_gco_gco * make_cons_pm(obj mm); + static DPrimitive_gco_2_gco_gco * make_cons_pm(obj mm, + StringTable * stbl); /** create primitive for creating a dictionary instance **/ - static DPrimitive_gco_0 * make_dict_make_pm(obj mm); + static DPrimitive_gco_0 * make_dict_make_pm(obj mm, + StringTable * stbl); /** create primitive for creating a dictionary instance **/ static DPrimitive_gco_2_dict_string * make_dict_lookup_pm(obj mm); diff --git a/include/xo/procedure2/PrimitiveRegistry.hpp b/include/xo/procedure2/PrimitiveRegistry.hpp index 6f1f67ea..a4e24e2a 100644 --- a/include/xo/procedure2/PrimitiveRegistry.hpp +++ b/include/xo/procedure2/PrimitiveRegistry.hpp @@ -61,6 +61,7 @@ namespace xo { * to InstallSink sink. **/ using InstallSource = std::function mm, + StringTable * stbl, InstallSink sink, InstallFlags flags)>; @@ -72,9 +73,11 @@ namespace xo { void register_primitives(InstallSource source_fn); /** create primitives using memory from @p mm, + * with global strings in @p stbl. * delivering each primitive to @p sink. **/ bool install_primitives(obj mm, + StringTable * stbl, InstallSink sink, InstallFlags flags); diff --git a/include/xo/procedure2/procedure2_register_primitives.hpp b/include/xo/procedure2/procedure2_register_primitives.hpp index 69237697..396f645f 100644 --- a/include/xo/procedure2/procedure2_register_primitives.hpp +++ b/include/xo/procedure2/procedure2_register_primitives.hpp @@ -12,6 +12,7 @@ namespace xo { namespace scm { /** Register primitive-factories **/ bool procedure2_register_primitives(obj gc, + StringTable * stbl, InstallSink sink, InstallFlags flags); } diff --git a/src/procedure2/ObjectPrimitives.cpp b/src/procedure2/ObjectPrimitives.cpp index c247ab8c..d52c5304 100644 --- a/src/procedure2/ObjectPrimitives.cpp +++ b/src/procedure2/ObjectPrimitives.cpp @@ -9,6 +9,10 @@ #include #include #include +#include +#include +#include +#include #include #include #include // for getcwd() @@ -35,9 +39,15 @@ namespace xo { } DPrimitive_gco_0 * - ObjectPrimitives::make_cwd_pm(obj mm) + ObjectPrimitives::make_cwd_pm(obj mm, StringTable * stbl) { - return DPrimitive_gco_0::_make(mm, "cwd", &xfer_cwd); + (void)stbl; + + auto str_ty = DAtomicType::make(mm, Metatype::t_str()); + auto cwd_ty + = obj(DFunctionType::_make(mm, str_ty)); + + return DPrimitive_gco_0::_make(mm, "cwd", cwd_ty, &xfer_cwd); } // ----- nth ----- @@ -59,9 +69,20 @@ namespace xo { } DPrimitive_gco_2_gco_gco * - ObjectPrimitives::make_nth_pm(obj mm) + ObjectPrimitives::make_nth_pm(obj mm, StringTable * stbl) { - return DPrimitive_gco_2_gco_gco::_make(mm, "nth", &xfer_nth); + auto T_ty = DTypeVarRef::make(mm, stbl->intern("T")); + auto list_T_ty = DListType::make(mm, T_ty); + auto int_ty = DAtomicType::make(mm, Metatype::t_integer()); + /** nth_ty: list x int -> T **/ + auto nth_ty + = obj + (DFunctionType::_make(mm, + T_ty, + list_T_ty, + int_ty)); + + return DPrimitive_gco_2_gco_gco::_make(mm, "nth", nth_ty, &xfer_nth); } // ----- cons ----- @@ -75,17 +96,24 @@ namespace xo { auto cdr_list = obj::from(cdr); - //auto T = DTypeVarRef::_make(rcx.allocator(), "T"); - return DList::cons(rcx.allocator(), car, cdr_list.data()); } DPrimitive_gco_2_gco_gco * - ObjectPrimitives::make_cons_pm(obj mm) + ObjectPrimitives::make_cons_pm(obj mm, StringTable * stbl) { - return DPrimitive_gco_2_gco_gco::_make(mm, "cons", &xfer_cons); + auto T_ty = DTypeVarRef::make(mm, stbl->intern("T")); + auto list_T_ty = DListType::make(mm, T_ty); + /** cons_ty: T x list -> list **/ + auto cons_ty + = obj(DFunctionType::_make(mm, + list_T_ty, + T_ty, + list_T_ty)); + + return DPrimitive_gco_2_gco_gco::_make(mm, "cons", cons_ty, &xfer_cons); } // ----- dict_make ----- @@ -98,9 +126,17 @@ namespace xo { } DPrimitive_gco_0 * - ObjectPrimitives::make_dict_make_pm(obj mm) + ObjectPrimitives::make_dict_make_pm(obj mm, + StringTable * stbl) { - return DPrimitive_gco_0::_make(mm, "dict_make", &xfer_dict_make); + (void)stbl; + + // nit: technically better to use empty struct type here + auto dict_ty = DAtomicType::make(mm, Metatype::t_dict()); + auto pm_ty = obj(DFunctionType::_make(mm, + dict_ty)); + + return DPrimitive_gco_0::_make(mm, "dict_make", pm_ty, &xfer_dict_make); } // ----- dict_at ----- diff --git a/src/procedure2/PrimitiveRegistry.cpp b/src/procedure2/PrimitiveRegistry.cpp index e62b6794..420a435e 100644 --- a/src/procedure2/PrimitiveRegistry.cpp +++ b/src/procedure2/PrimitiveRegistry.cpp @@ -26,6 +26,7 @@ namespace xo { bool PrimitiveRegistry::install_primitives(obj mm, + StringTable * stbl, InstallSink sink, InstallFlags flags) { @@ -40,7 +41,7 @@ namespace xo { for (const auto & fn : init_seq_v_) { log && log("do install fn (", i+1, "/", n, ")"); - ok = ok & fn(mm, sink, flags); + ok = ok & fn(mm, stbl, sink, flags); ++i; } diff --git a/src/procedure2/procedure2_register_primitives.cpp b/src/procedure2/procedure2_register_primitives.cpp index fee0bd91..eed4cf55 100644 --- a/src/procedure2/procedure2_register_primitives.cpp +++ b/src/procedure2/procedure2_register_primitives.cpp @@ -54,6 +54,7 @@ namespace xo { bool procedure2_register_primitives(obj mm, + StringTable * stbl, InstallSink sink, InstallFlags flags) { @@ -61,10 +62,10 @@ namespace xo { bool ok = true; - ok = ok & install_aux(sink, ObjectPrimitives::make_cwd_pm(mm), flags); - ok = ok & install_aux(sink, ObjectPrimitives::make_nth_pm(mm), flags); - ok = ok & install_aux(sink, ObjectPrimitives::make_cons_pm(mm), flags); - ok = ok & install_aux(sink, ObjectPrimitives::make_dict_make_pm(mm), flags); + ok = ok & install_aux(sink, ObjectPrimitives::make_cwd_pm(mm, stbl), flags); + ok = ok & install_aux(sink, ObjectPrimitives::make_nth_pm(mm, stbl), flags); + ok = ok & install_aux(sink, ObjectPrimitives::make_cons_pm(mm, stbl), flags); + ok = ok & install_aux(sink, ObjectPrimitives::make_dict_make_pm(mm, stbl), flags); ok = ok & install_aux(sink, ObjectPrimitives::make_dict_lookup_pm(mm), flags); ok = ok & install_aux(sink, ObjectPrimitives::make_dict_upsert_pm(mm), flags); ok = ok & install_aux(sink, ObjectPrimitives::make_fn_n_args_pm(mm), flags); From 68c2d3211f9526907aca33d054f33e708b980ab0 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Mon, 16 Mar 2026 12:34:59 -0500 Subject: [PATCH 58/90] xo-interpreter2 stack: + more primitive function-type decoration --- include/xo/procedure2/ObjectPrimitives.hpp | 9 ++-- src/procedure2/ObjectPrimitives.cpp | 47 ++++++++++++++++--- .../procedure2_register_primitives.cpp | 14 +++--- 3 files changed, 54 insertions(+), 16 deletions(-) diff --git a/include/xo/procedure2/ObjectPrimitives.hpp b/include/xo/procedure2/ObjectPrimitives.hpp index 696fc295..c403dc17 100644 --- a/include/xo/procedure2/ObjectPrimitives.hpp +++ b/include/xo/procedure2/ObjectPrimitives.hpp @@ -40,13 +40,16 @@ namespace xo { StringTable * stbl); /** create primitive for creating a dictionary instance **/ - static DPrimitive_gco_2_dict_string * make_dict_lookup_pm(obj mm); + static DPrimitive_gco_2_dict_string * make_dict_lookup_pm(obj mm, + StringTable * stbl); /** create primitive that upserts a key,value pair into a dictionary **/ - static DPrimitive_gco_3_dict_string_gco * make_dict_upsert_pm(obj mm); + static DPrimitive_gco_3_dict_string_gco * make_dict_upsert_pm(obj mm, + StringTable * stbl); /** create primitive: get fixed number of args for function **/ - static DPrimitive_gco_1_gco * make_fn_n_args_pm(obj mm); + static DPrimitive_gco_1_gco * make_fn_n_args_pm(obj mm, + StringTable * stbl); }; } /*namespace scm*/ diff --git a/src/procedure2/ObjectPrimitives.cpp b/src/procedure2/ObjectPrimitives.cpp index d52c5304..4edd3873 100644 --- a/src/procedure2/ObjectPrimitives.cpp +++ b/src/procedure2/ObjectPrimitives.cpp @@ -163,9 +163,21 @@ namespace xo { } DPrimitive_gco_2_dict_string * - ObjectPrimitives::make_dict_lookup_pm(obj mm) + ObjectPrimitives::make_dict_lookup_pm(obj mm, + StringTable * stbl) { - return DPrimitive_gco_2_dict_string::_make(mm, "dict_lookup", &xfer_dict_lookup); + (void)stbl; + + // dict_ty: generic dictionary + auto dict_ty = DAtomicType::make(mm, Metatype::t_dict()); + auto str_ty = DAtomicType::make(mm, Metatype::t_str()); + auto any_ty = DAtomicType::make(mm, Metatype::t_any()); + // pm_ty: dict x string -> any + auto pm_ty = obj + (DFunctionType::_make(mm, any_ty, dict_ty, str_ty)); + + return DPrimitive_gco_2_dict_string::_make + (mm, "dict_lookup", pm_ty, &xfer_dict_lookup); } // ----- dict_upsert ----- @@ -196,9 +208,23 @@ namespace xo { } DPrimitive_gco_3_dict_string_gco * - ObjectPrimitives::make_dict_upsert_pm(obj mm) + ObjectPrimitives::make_dict_upsert_pm(obj mm, + StringTable * stbl) { - return DPrimitive_gco_3_dict_string_gco::_make(mm, "dict_upsert", &xfer_dict_upsert); + (void)stbl; + + auto dict_ty = DAtomicType::make(mm, Metatype::t_dict()); + auto str_ty = DAtomicType::make(mm, Metatype::t_str()); + auto any_ty = DAtomicType::make(mm, Metatype::t_any()); + // pm_ty: dict x string x any -> dict + auto pm_ty = obj(DFunctionType::_make(mm, + dict_ty, + dict_ty, + str_ty, + any_ty)); + + return DPrimitive_gco_3_dict_string_gco::_make + (mm, "dict_upsert", pm_ty, &xfer_dict_upsert); } // ----- fn_n_args ----- @@ -220,9 +246,18 @@ namespace xo { } DPrimitive_gco_1_gco * - ObjectPrimitives::make_fn_n_args_pm(obj mm) + ObjectPrimitives::make_fn_n_args_pm(obj mm, + StringTable * stbl) { - return DPrimitive_gco_1_gco::_make(mm, "fn_n_args", &xfer_fn_n_args); + (void)stbl; + + auto integer_ty = DAtomicType::make(mm, Metatype::t_integer()); + auto callable_ty = DAtomicType::make(mm, Metatype::t_callable()); + auto pm_ty = obj(DFunctionType::_make(mm, + integer_ty, + callable_ty)); + + return DPrimitive_gco_1_gco::_make(mm, "fn_n_args", pm_ty, &xfer_fn_n_args); } } /*namespace scm*/ diff --git a/src/procedure2/procedure2_register_primitives.cpp b/src/procedure2/procedure2_register_primitives.cpp index eed4cf55..29f3be19 100644 --- a/src/procedure2/procedure2_register_primitives.cpp +++ b/src/procedure2/procedure2_register_primitives.cpp @@ -62,13 +62,13 @@ namespace xo { bool ok = true; - ok = ok & install_aux(sink, ObjectPrimitives::make_cwd_pm(mm, stbl), flags); - ok = ok & install_aux(sink, ObjectPrimitives::make_nth_pm(mm, stbl), flags); - ok = ok & install_aux(sink, ObjectPrimitives::make_cons_pm(mm, stbl), flags); - ok = ok & install_aux(sink, ObjectPrimitives::make_dict_make_pm(mm, stbl), flags); - ok = ok & install_aux(sink, ObjectPrimitives::make_dict_lookup_pm(mm), flags); - ok = ok & install_aux(sink, ObjectPrimitives::make_dict_upsert_pm(mm), flags); - ok = ok & install_aux(sink, ObjectPrimitives::make_fn_n_args_pm(mm), flags); + ok = ok & install_aux(sink, ObjectPrimitives::make_cwd_pm (mm, stbl), flags); + ok = ok & install_aux(sink, ObjectPrimitives::make_nth_pm (mm, stbl), flags); + ok = ok & install_aux(sink, ObjectPrimitives::make_cons_pm (mm, stbl), flags); + ok = ok & install_aux(sink, ObjectPrimitives::make_dict_make_pm (mm, stbl), flags); + ok = ok & install_aux(sink, ObjectPrimitives::make_dict_lookup_pm (mm, stbl), flags); + ok = ok & install_aux(sink, ObjectPrimitives::make_dict_upsert_pm (mm, stbl), flags); + ok = ok & install_aux(sink, ObjectPrimitives::make_fn_n_args_pm (mm, stbl), flags); return ok; } From 406bb5d742585b427c950a5b0b3b5ac526134005 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Mon, 16 Mar 2026 14:09:03 -0500 Subject: [PATCH 59/90] xo-interpreter2 stack: use RuntimeContext to streamline setup --- include/xo/procedure2/PrimitiveRegistry.hpp | 10 ++++++---- .../xo/procedure2/procedure2_register_primitives.hpp | 5 +++-- src/procedure2/PrimitiveRegistry.cpp | 7 ++++--- src/procedure2/procedure2_register_primitives.cpp | 8 ++++++-- 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/include/xo/procedure2/PrimitiveRegistry.hpp b/include/xo/procedure2/PrimitiveRegistry.hpp index a4e24e2a..dd4e70b9 100644 --- a/include/xo/procedure2/PrimitiveRegistry.hpp +++ b/include/xo/procedure2/PrimitiveRegistry.hpp @@ -60,8 +60,9 @@ namespace xo { * Allocates primitives using memory from mm, delivering them * to InstallSink sink. **/ - using InstallSource = std::function mm, - StringTable * stbl, + using InstallSource = std::function rcx, + //obj mm, + //StringTable * stbl, InstallSink sink, InstallFlags flags)>; @@ -76,8 +77,9 @@ namespace xo { * with global strings in @p stbl. * delivering each primitive to @p sink. **/ - bool install_primitives(obj mm, - StringTable * stbl, + bool install_primitives(obj rcx, + //obj mm, + //StringTable * stbl, InstallSink sink, InstallFlags flags); diff --git a/include/xo/procedure2/procedure2_register_primitives.hpp b/include/xo/procedure2/procedure2_register_primitives.hpp index 396f645f..3b4fa61d 100644 --- a/include/xo/procedure2/procedure2_register_primitives.hpp +++ b/include/xo/procedure2/procedure2_register_primitives.hpp @@ -11,8 +11,9 @@ namespace xo { namespace scm { /** Register primitive-factories **/ - bool procedure2_register_primitives(obj gc, - StringTable * stbl, + bool procedure2_register_primitives(obj rcx, + //obj gc, + //StringTable * stbl, InstallSink sink, InstallFlags flags); } diff --git a/src/procedure2/PrimitiveRegistry.cpp b/src/procedure2/PrimitiveRegistry.cpp index 420a435e..ef5cb8c6 100644 --- a/src/procedure2/PrimitiveRegistry.cpp +++ b/src/procedure2/PrimitiveRegistry.cpp @@ -25,8 +25,9 @@ namespace xo { } bool - PrimitiveRegistry::install_primitives(obj mm, - StringTable * stbl, + PrimitiveRegistry::install_primitives(obj rcx, + //obj mm, + //StringTable * stbl, InstallSink sink, InstallFlags flags) { @@ -41,7 +42,7 @@ namespace xo { for (const auto & fn : init_seq_v_) { log && log("do install fn (", i+1, "/", n, ")"); - ok = ok & fn(mm, stbl, sink, flags); + ok = ok & fn(rcx, /*mm, stbl,*/ sink, flags); ++i; } diff --git a/src/procedure2/procedure2_register_primitives.cpp b/src/procedure2/procedure2_register_primitives.cpp index 29f3be19..7dd1513b 100644 --- a/src/procedure2/procedure2_register_primitives.cpp +++ b/src/procedure2/procedure2_register_primitives.cpp @@ -53,11 +53,15 @@ namespace xo { } bool - procedure2_register_primitives(obj mm, - StringTable * stbl, + procedure2_register_primitives(obj rcx, + //obj mm, + //StringTable * stbl, InstallSink sink, InstallFlags flags) { + obj mm = rcx.allocator(); + StringTable * stbl = rcx.stringtable(); + scope log(XO_DEBUG(true)); bool ok = true; From 15edbdd7553a0f4bb7cc36138217b896f9870da0 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Mon, 16 Mar 2026 15:45:47 -0500 Subject: [PATCH 60/90] xo-procedure2: streamline setup --- include/xo/procedure2/SetupProcedure2.hpp | 29 ++++ .../procedure2/procedure2_register_facets.hpp | 17 -- .../procedure2_register_primitives.hpp | 22 --- .../procedure2/procedure2_register_types.hpp | 17 -- src/procedure2/CMakeLists.txt | 4 +- src/procedure2/SetupProcedure2.cpp | 151 ++++++++++++++++++ src/procedure2/init_procedure2.cpp | 15 +- src/procedure2/procedure2_register_facets.cpp | 68 -------- .../procedure2_register_primitives.cpp | 83 ---------- src/procedure2/procedure2_register_types.cpp | 42 ----- 10 files changed, 186 insertions(+), 262 deletions(-) create mode 100644 include/xo/procedure2/SetupProcedure2.hpp delete mode 100644 include/xo/procedure2/procedure2_register_facets.hpp delete mode 100644 include/xo/procedure2/procedure2_register_primitives.hpp delete mode 100644 include/xo/procedure2/procedure2_register_types.hpp create mode 100644 src/procedure2/SetupProcedure2.cpp delete mode 100644 src/procedure2/procedure2_register_facets.cpp delete mode 100644 src/procedure2/procedure2_register_primitives.cpp delete mode 100644 src/procedure2/procedure2_register_types.cpp diff --git a/include/xo/procedure2/SetupProcedure2.hpp b/include/xo/procedure2/SetupProcedure2.hpp new file mode 100644 index 00000000..1363d7eb --- /dev/null +++ b/include/xo/procedure2/SetupProcedure2.hpp @@ -0,0 +1,29 @@ +/** @file SetupProcedure2.hpp + * + * @author Roland Conybeare, Jan 2026 + **/ + +#pragma once + +#include "PrimitiveRegistry.hpp" +#include + +namespace xo { + namespace scm { + struct SetupProcedure2 { + public: + using ACollector = xo::mm::ACollector; + + public: + /** Register procedure2 (facet,impl) combinations with FacetRegistry **/ + static bool register_facets(); + /** Register gc-aware (AGCObject,DRepr) combinations with garbage collector @p gc **/ + static bool register_types(obj gc); + static bool register_primitives(obj rcx, + InstallSink sink, + InstallFlags flags); + }; + } +} + +/* end SetupProcedure2.hpp */ diff --git a/include/xo/procedure2/procedure2_register_facets.hpp b/include/xo/procedure2/procedure2_register_facets.hpp deleted file mode 100644 index 2a7128cc..00000000 --- a/include/xo/procedure2/procedure2_register_facets.hpp +++ /dev/null @@ -1,17 +0,0 @@ -/** @file procedure2_register_facets.hpp - * - * @author Roland Conybeare, Jan 2026 - **/ - -#pragma once - -#include - -namespace xo { - namespace scm { - /** Register procedure2 (facet,impl) combinations with FacetRegistry **/ - bool procedure2_register_facets(); - } -} - -/* end procedure2_register_facets.hpp */ diff --git a/include/xo/procedure2/procedure2_register_primitives.hpp b/include/xo/procedure2/procedure2_register_primitives.hpp deleted file mode 100644 index 3b4fa61d..00000000 --- a/include/xo/procedure2/procedure2_register_primitives.hpp +++ /dev/null @@ -1,22 +0,0 @@ -/** @file procedure2_register_primitives.hpp - * - * @author Roland Conybeare, Mar 2026 - **/ - -#pragma once - -#include "PrimitiveRegistry.hpp" -#include - -namespace xo { - namespace scm { - /** Register primitive-factories **/ - bool procedure2_register_primitives(obj rcx, - //obj gc, - //StringTable * stbl, - InstallSink sink, - InstallFlags flags); - } -} - -/* end procedure2_register_primitives.hpp */ diff --git a/include/xo/procedure2/procedure2_register_types.hpp b/include/xo/procedure2/procedure2_register_types.hpp deleted file mode 100644 index 98b0c5f7..00000000 --- a/include/xo/procedure2/procedure2_register_types.hpp +++ /dev/null @@ -1,17 +0,0 @@ -/** @file procedure2_register_types.hpp - * - * @author Roland Conybeare, Dec 2025 - **/ - -#pragma once - -#include - -namespace xo { - namespace scm { - /** Register gc-aware (AGCObject,DRepr) combinations with garbage collector @p gc **/ - bool procedure2_register_types(obj gc); - } -} - -/* end procedure2_register_types.hpp */ diff --git a/src/procedure2/CMakeLists.txt b/src/procedure2/CMakeLists.txt index 6ac08bb5..2198403b 100644 --- a/src/procedure2/CMakeLists.txt +++ b/src/procedure2/CMakeLists.txt @@ -4,9 +4,7 @@ set(SELF_LIB xo_procedure2) set(SELF_SRCS init_procedure2.cpp init_primitives.cpp - procedure2_register_primitives.cpp - procedure2_register_types.cpp - procedure2_register_facets.cpp + SetupProcedure2.cpp ObjectPrimitives.cpp PrimitiveRegistry.cpp DPrimitive.cpp diff --git a/src/procedure2/SetupProcedure2.cpp b/src/procedure2/SetupProcedure2.cpp new file mode 100644 index 00000000..a31964a4 --- /dev/null +++ b/src/procedure2/SetupProcedure2.cpp @@ -0,0 +1,151 @@ +/** @file SetupProcedure2.cpp + * + * @author Roland Conybeare, Jan 2026 + **/ + +#include "SetupProcedure2.hpp" +#include "Procedure.hpp" +#include "ObjectPrimitives.hpp" +#include "SimpleRcx.hpp" +#include "Primitive_gco_0.hpp" +#include "Primitive_gco_1_gco.hpp" +#include "Primitive_gco_2_gco_gco.hpp" +#include "Primitive_gco_2_dict_string.hpp" +#include "Primitive_gco_3_dict_string_gco.hpp" + +#include +#include +#include +#include + +namespace xo { + using xo::mm::AAllocator; + using xo::facet::FacetRegistry; + using xo::facet::impl_for; + using xo::facet::typeseq; + using xo::print::APrintable; + + namespace scm { + bool + SetupProcedure2::register_facets() + { + scope log(XO_DEBUG(true)); + + FacetRegistry::register_impl(); + + FacetRegistry::register_impl(); + FacetRegistry::register_impl(); + FacetRegistry::register_impl(); + + FacetRegistry::register_impl(); + FacetRegistry::register_impl(); + FacetRegistry::register_impl(); + + FacetRegistry::register_impl(); + FacetRegistry::register_impl(); + FacetRegistry::register_impl(); + + FacetRegistry::register_impl(); + FacetRegistry::register_impl(); + FacetRegistry::register_impl(); + + FacetRegistry::register_impl(); + FacetRegistry::register_impl(); + FacetRegistry::register_impl(); + + log && log(xtag("DSimpleRcx.tseq", typeseq::id())); + log && log(xtag("DPrimitive_gco_0.tseq", typeseq::id())); + log && log(xtag("DPrimitive_gco_1_gco.tseq", typeseq::id())); + log && log(xtag("DPrimitive_gco_2_gco_gco.tseq", typeseq::id())); + log && log(xtag("DPrimitive_gco_2_dict_string.tseq", typeseq::id())); + log && log(xtag("DPrimitive_gco_3_dict_string_gco.tseq", typeseq::id())); + + log && log(xtag("ARuntimeContext.tseq", typeseq::id())); + log && log(xtag("AProcedure.tseq", typeseq::id())); + + return true; + } + + bool + SetupProcedure2::register_types(obj gc) + { + scope log(XO_DEBUG(true)); + + bool ok = true; + + // (note: don't currently intend to support AGCObject for DSimpleRcx) + + ok &= gc.install_type(impl_for()); + ok &= gc.install_type(impl_for()); + ok &= gc.install_type(impl_for()); + ok &= gc.install_type(impl_for()); + ok &= gc.install_type(impl_for()); + + return ok; + } + + template + bool install_aux(InstallSink sink, + PrimitiveRepr * pm, + InstallFlags flags) + { + scope log(XO_DEBUG(true)); + + if ((flags & InstallFlags::f_generalpurpose) == InstallFlags::f_generalpurpose) { + log && log("create primitive", xtag("name", pm->name())); + + return sink(pm->name(), + pm->fn_td(), + obj(pm), + flags); + } else { + log && log("skip primitive", xtag("name", pm->name())); + + return true; + } + } + + template + bool install_aux(InstallSink sink, + obj mm, + std::string_view name, + typename Primitive::FunctionPtrType impl, + InstallFlags flags) + { + if (flags != InstallFlags::f_none) { + auto pm + = Primitive::_make(mm, name, impl); + + return install_aux(sink, pm, flags); + } else { + return true; + } + } + + bool + SetupProcedure2::register_primitives(obj rcx, + InstallSink sink, + InstallFlags flags) + { + obj mm = rcx.allocator(); + StringTable * stbl = rcx.stringtable(); + + scope log(XO_DEBUG(true)); + + bool ok = true; + + ok = ok & install_aux(sink, ObjectPrimitives::make_cwd_pm (mm, stbl), flags); + ok = ok & install_aux(sink, ObjectPrimitives::make_nth_pm (mm, stbl), flags); + ok = ok & install_aux(sink, ObjectPrimitives::make_cons_pm (mm, stbl), flags); + ok = ok & install_aux(sink, ObjectPrimitives::make_dict_make_pm (mm, stbl), flags); + ok = ok & install_aux(sink, ObjectPrimitives::make_dict_lookup_pm (mm, stbl), flags); + ok = ok & install_aux(sink, ObjectPrimitives::make_dict_upsert_pm (mm, stbl), flags); + ok = ok & install_aux(sink, ObjectPrimitives::make_fn_n_args_pm (mm, stbl), flags); + + return ok; + } + + } /*namespace scm*/ +} /*namespace xo*/ + +/* end SetupProcedure2.cpp */ diff --git a/src/procedure2/init_procedure2.cpp b/src/procedure2/init_procedure2.cpp index 7c07f378..08f0c767 100644 --- a/src/procedure2/init_procedure2.cpp +++ b/src/procedure2/init_procedure2.cpp @@ -5,27 +5,22 @@ #include "init_procedure2.hpp" #include "init_primitives.hpp" -#include "procedure2_register_facets.hpp" -#include "procedure2_register_types.hpp" -#include "procedure2_register_primitives.hpp" - +#include "SetupProcedure2.hpp" #include #include namespace xo { - using xo::scm::procedure2_register_primitives; - using xo::scm::procedure2_register_facets; - using xo::scm::procedure2_register_types; + using xo::scm::SetupProcedure2; using xo::scm::PrimitiveRegistry; using xo::mm::CollectorTypeRegistry; void InitSubsys::init() { - procedure2_register_facets(); + SetupProcedure2::register_facets(); - CollectorTypeRegistry::instance().register_types(&procedure2_register_types); - PrimitiveRegistry::instance().register_primitives(&procedure2_register_primitives); + CollectorTypeRegistry::instance().register_types(&SetupProcedure2::register_types); + PrimitiveRegistry::instance().register_primitives(&SetupProcedure2::register_primitives); } InitEvidence diff --git a/src/procedure2/procedure2_register_facets.cpp b/src/procedure2/procedure2_register_facets.cpp deleted file mode 100644 index 031aa538..00000000 --- a/src/procedure2/procedure2_register_facets.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/** @file procedure2_register_facets.cpp - * - * @author Roland Conybeare, Jan 2026 - **/ - -#include "Procedure.hpp" -#include "SimpleRcx.hpp" -#include "Primitive_gco_0.hpp" -#include "Primitive_gco_1_gco.hpp" -#include "Primitive_gco_2_gco_gco.hpp" -#include "Primitive_gco_2_dict_string.hpp" -#include "Primitive_gco_3_dict_string_gco.hpp" - -#include -#include -#include -#include - -namespace xo { - using xo::facet::FacetRegistry; - using xo::facet::typeseq; - using xo::print::APrintable; - - namespace scm { - bool - procedure2_register_facets() - { - scope log(XO_DEBUG(true)); - - FacetRegistry::register_impl(); - - FacetRegistry::register_impl(); - FacetRegistry::register_impl(); - FacetRegistry::register_impl(); - - FacetRegistry::register_impl(); - FacetRegistry::register_impl(); - FacetRegistry::register_impl(); - - FacetRegistry::register_impl(); - FacetRegistry::register_impl(); - FacetRegistry::register_impl(); - - FacetRegistry::register_impl(); - FacetRegistry::register_impl(); - FacetRegistry::register_impl(); - - FacetRegistry::register_impl(); - FacetRegistry::register_impl(); - FacetRegistry::register_impl(); - - log && log(xtag("DSimpleRcx.tseq", typeseq::id())); - log && log(xtag("DPrimitive_gco_0.tseq", typeseq::id())); - log && log(xtag("DPrimitive_gco_1_gco.tseq", typeseq::id())); - log && log(xtag("DPrimitive_gco_2_gco_gco.tseq", typeseq::id())); - log && log(xtag("DPrimitive_gco_2_dict_string.tseq", typeseq::id())); - log && log(xtag("DPrimitive_gco_3_dict_string_gco.tseq", typeseq::id())); - - log && log(xtag("ARuntimeContext.tseq", typeseq::id())); - log && log(xtag("AProcedure.tseq", typeseq::id())); - - return true; - } - - } /*namespace scm*/ -} /*namespace xo*/ - -/* end procedure2_register_facets.cpp */ diff --git a/src/procedure2/procedure2_register_primitives.cpp b/src/procedure2/procedure2_register_primitives.cpp deleted file mode 100644 index 7dd1513b..00000000 --- a/src/procedure2/procedure2_register_primitives.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/** @file procedure2_register_primitives.cpp - * - * @author Roland Conybeare, Mar 2026 - **/ - -#include "procedure2_register_primitives.hpp" -#include "ObjectPrimitives.hpp" -#include -#include - -namespace xo { - using xo::scm::ASequence; - using xo::mm::AAllocator; - using xo::mm::AGCObject; - - namespace scm { - template - bool install_aux(InstallSink sink, - PrimitiveRepr * pm, - InstallFlags flags) - { - scope log(XO_DEBUG(true)); - - if ((flags & InstallFlags::f_generalpurpose) == InstallFlags::f_generalpurpose) { - log && log("create primitive", xtag("name", pm->name())); - - return sink(pm->name(), - pm->fn_td(), - obj(pm), - flags); - } else { - log && log("skip primitive", xtag("name", pm->name())); - - return true; - } - } - - template - bool install_aux(InstallSink sink, - obj mm, - std::string_view name, - typename Primitive::FunctionPtrType impl, - InstallFlags flags) - { - if (flags != InstallFlags::f_none) { - auto pm - = Primitive::_make(mm, name, impl); - - return install_aux(sink, pm, flags); - } else { - return true; - } - } - - bool - procedure2_register_primitives(obj rcx, - //obj mm, - //StringTable * stbl, - InstallSink sink, - InstallFlags flags) - { - obj mm = rcx.allocator(); - StringTable * stbl = rcx.stringtable(); - - scope log(XO_DEBUG(true)); - - bool ok = true; - - ok = ok & install_aux(sink, ObjectPrimitives::make_cwd_pm (mm, stbl), flags); - ok = ok & install_aux(sink, ObjectPrimitives::make_nth_pm (mm, stbl), flags); - ok = ok & install_aux(sink, ObjectPrimitives::make_cons_pm (mm, stbl), flags); - ok = ok & install_aux(sink, ObjectPrimitives::make_dict_make_pm (mm, stbl), flags); - ok = ok & install_aux(sink, ObjectPrimitives::make_dict_lookup_pm (mm, stbl), flags); - ok = ok & install_aux(sink, ObjectPrimitives::make_dict_upsert_pm (mm, stbl), flags); - ok = ok & install_aux(sink, ObjectPrimitives::make_fn_n_args_pm (mm, stbl), flags); - - return ok; - } - - } /*namespace scm*/ -} /*namespace xo*/ - -/* end procedure2_register_primitives.cpp */ diff --git a/src/procedure2/procedure2_register_types.cpp b/src/procedure2/procedure2_register_types.cpp deleted file mode 100644 index 0cf6206f..00000000 --- a/src/procedure2/procedure2_register_types.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/** @file procedure2_register_types.cpp - * - * @author Roland Conybeare, Jan 2026 - **/ - -#include "procedure2_register_types.hpp" - -#include "Primitive_gco_0.hpp" -#include "detail/IGCObject_DPrimitive_gco_1_gco.hpp" -#include "detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp" -#include "detail/IGCObject_DPrimitive_gco_2_dict_string.hpp" -#include "detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp" -#include - -namespace xo { - using xo::mm::ACollector; - using xo::mm::AGCObject; - using xo::facet::impl_for; - using xo::scope; - - namespace scm { - bool - procedure2_register_types(obj gc) - { - scope log(XO_DEBUG(true)); - - bool ok = true; - - // (note: don't currently intend to support AGCObject for DSimpleRcx) - - ok &= gc.install_type(impl_for()); - ok &= gc.install_type(impl_for()); - ok &= gc.install_type(impl_for()); - ok &= gc.install_type(impl_for()); - ok &= gc.install_type(impl_for()); - - return ok; - } - } -} /*namespace xo*/ - -/* end procedure2_register_types.cpp */ From 9c2a817eb360cd7beca539111dcbc4cc9be05d4d Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Mon, 16 Mar 2026 20:12:19 -0500 Subject: [PATCH 61/90] xo-procedure2: simplify primitive install --- include/xo/procedure2/PrimitiveRegistry.hpp | 23 ++++++- src/procedure2/SetupProcedure2.cpp | 73 ++++++++------------- 2 files changed, 49 insertions(+), 47 deletions(-) diff --git a/include/xo/procedure2/PrimitiveRegistry.hpp b/include/xo/procedure2/PrimitiveRegistry.hpp index dd4e70b9..c5227ec7 100644 --- a/include/xo/procedure2/PrimitiveRegistry.hpp +++ b/include/xo/procedure2/PrimitiveRegistry.hpp @@ -34,8 +34,6 @@ namespace xo { return InstallFlags(static_cast(x) & static_cast(y)); } - - /** provided by VSM to receive created primitives. * InstallSink(pm) adopts a primitive **/ @@ -70,6 +68,26 @@ namespace xo { /** singleton instance **/ static PrimitiveRegistry & instance(); + template + static bool install_aux(InstallSink sink, + PrimitiveRepr * pm, + InstallFlags flags) { + scope log(XO_DEBUG(true)); + + if (flags != InstallFlags::f_none) { + log && log("create primitive", xtag("name", pm->name())); + + return sink(pm->name(), + pm->fn_td(), + obj(pm), + flags); + } else { + log && log("skip primitive", xtag("name", pm->name())); + + return true; + } + } + /** remember primitive-factory @p source_fn **/ void register_primitives(InstallSource source_fn); @@ -83,6 +101,7 @@ namespace xo { InstallSink sink, InstallFlags flags); + private: /** a set of factories that create primitives **/ std::vector init_seq_v_; diff --git a/src/procedure2/SetupProcedure2.cpp b/src/procedure2/SetupProcedure2.cpp index a31964a4..60bd02ed 100644 --- a/src/procedure2/SetupProcedure2.cpp +++ b/src/procedure2/SetupProcedure2.cpp @@ -84,44 +84,6 @@ namespace xo { return ok; } - template - bool install_aux(InstallSink sink, - PrimitiveRepr * pm, - InstallFlags flags) - { - scope log(XO_DEBUG(true)); - - if ((flags & InstallFlags::f_generalpurpose) == InstallFlags::f_generalpurpose) { - log && log("create primitive", xtag("name", pm->name())); - - return sink(pm->name(), - pm->fn_td(), - obj(pm), - flags); - } else { - log && log("skip primitive", xtag("name", pm->name())); - - return true; - } - } - - template - bool install_aux(InstallSink sink, - obj mm, - std::string_view name, - typename Primitive::FunctionPtrType impl, - InstallFlags flags) - { - if (flags != InstallFlags::f_none) { - auto pm - = Primitive::_make(mm, name, impl); - - return install_aux(sink, pm, flags); - } else { - return true; - } - } - bool SetupProcedure2::register_primitives(obj rcx, InstallSink sink, @@ -134,13 +96,34 @@ namespace xo { bool ok = true; - ok = ok & install_aux(sink, ObjectPrimitives::make_cwd_pm (mm, stbl), flags); - ok = ok & install_aux(sink, ObjectPrimitives::make_nth_pm (mm, stbl), flags); - ok = ok & install_aux(sink, ObjectPrimitives::make_cons_pm (mm, stbl), flags); - ok = ok & install_aux(sink, ObjectPrimitives::make_dict_make_pm (mm, stbl), flags); - ok = ok & install_aux(sink, ObjectPrimitives::make_dict_lookup_pm (mm, stbl), flags); - ok = ok & install_aux(sink, ObjectPrimitives::make_dict_upsert_pm (mm, stbl), flags); - ok = ok & install_aux(sink, ObjectPrimitives::make_fn_n_args_pm (mm, stbl), flags); + ok = ok & (PrimitiveRegistry::install_aux + (sink, + ObjectPrimitives::make_cwd_pm(mm, stbl), + flags & InstallFlags::f_generalpurpose)); + ok = ok & (PrimitiveRegistry::install_aux + (sink, + ObjectPrimitives::make_nth_pm(mm, stbl), + flags & InstallFlags::f_generalpurpose)); + ok = ok & (PrimitiveRegistry::install_aux + (sink, + ObjectPrimitives::make_cons_pm(mm, stbl), + flags & InstallFlags::f_generalpurpose)); + ok = ok & (PrimitiveRegistry::install_aux + (sink, + ObjectPrimitives::make_dict_make_pm(mm, stbl), + flags & InstallFlags::f_generalpurpose)); + ok = ok & (PrimitiveRegistry::install_aux + (sink, + ObjectPrimitives::make_dict_lookup_pm(mm, stbl), + flags & InstallFlags::f_generalpurpose)); + ok = ok & (PrimitiveRegistry::install_aux + (sink, + ObjectPrimitives::make_dict_upsert_pm(mm, stbl), + flags & InstallFlags::f_generalpurpose)); + ok = ok & (PrimitiveRegistry::install_aux + (sink, + ObjectPrimitives::make_fn_n_args_pm(mm, stbl), + flags & InstallFlags::f_generalpurpose)); return ok; } From 80b80881b055fa1ad1ecba2a993dc1c4aa62e2f0 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Tue, 17 Mar 2026 12:27:31 -0400 Subject: [PATCH 62/90] xo-procedure2: bugfix: conform getcwd() api: must use return value --- src/procedure2/ObjectPrimitives.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/procedure2/ObjectPrimitives.cpp b/src/procedure2/ObjectPrimitives.cpp index 4edd3873..d9d86f4a 100644 --- a/src/procedure2/ObjectPrimitives.cpp +++ b/src/procedure2/ObjectPrimitives.cpp @@ -33,9 +33,9 @@ namespace xo { xfer_cwd(obj rcx) { char buf[PATH_MAX]; - ::getcwd(buf, sizeof(buf)); + char * cwd = ::getcwd(buf, sizeof(buf)); - return obj(DString::from_cstr(rcx.allocator(), buf)); + return obj(DString::from_cstr(rcx.allocator(), cwd)); } DPrimitive_gco_0 * From 9a6b01d3281838a5d9d9668a4876b1950709129d Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Tue, 17 Mar 2026 21:03:08 -0400 Subject: [PATCH 63/90] xo-procedure2: init -> trigger xo-type dep init --- src/procedure2/init_procedure2.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/procedure2/init_procedure2.cpp b/src/procedure2/init_procedure2.cpp index 08f0c767..34c349f6 100644 --- a/src/procedure2/init_procedure2.cpp +++ b/src/procedure2/init_procedure2.cpp @@ -7,6 +7,7 @@ #include "init_primitives.hpp" #include "SetupProcedure2.hpp" #include +#include #include namespace xo { @@ -30,6 +31,7 @@ namespace xo { /* recursive subsystem deps for xo-object2/ */ retval ^= InitSubsys::require(); + retval ^= InitSubsys::require(); /* xo-procedure2/'s own initialization code */ retval ^= Subsystem::provide("procedure2", &init); From f483d3db413a8ba49e74d2c0388508858052e821 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Tue, 24 Mar 2026 21:59:59 -0400 Subject: [PATCH 64/90] xo-reader2 stack: + ARuntimeContext.collector() access Collector API (if present) from runtime context --- idl/RuntimeContext.json5 | 14 ++++++++++++++ include/xo/procedure2/DSimpleRcx.hpp | 4 +++- include/xo/procedure2/detail/ARuntimeContext.hpp | 4 ++++ .../xo/procedure2/detail/IRuntimeContext_Any.hpp | 2 ++ .../detail/IRuntimeContext_DSimpleRcx.hpp | 3 +++ .../xo/procedure2/detail/IRuntimeContext_Xfer.hpp | 4 ++++ include/xo/procedure2/detail/RRuntimeContext.hpp | 4 ++++ src/procedure2/DSimpleRcx.cpp | 10 ++++++++++ .../facet/IRuntimeContext_DSimpleRcx.cpp | 6 ++++++ 9 files changed, 50 insertions(+), 1 deletion(-) diff --git a/idl/RuntimeContext.json5 b/idl/RuntimeContext.json5 index fe1254b0..481d0cbf 100644 --- a/idl/RuntimeContext.json5 +++ b/idl/RuntimeContext.json5 @@ -31,6 +31,11 @@ definition: "xo::mm::AAllocator", doc: [ "xo memory allocator" ], }, + { + name: "ACollector", + definition: "xo::mm::ACollector", + doc: [ "xo garbage collector" ], + }, { name: "MemorySizeVisitor", definition: "xo::mm::MemorySizeVisitor", @@ -47,6 +52,15 @@ noexcept: true, attributes: [], }, + { + name: "collector", + doc: [ "collector facet for allocator. If non-null, same data pointer as allocator" ], + return_type: "obj", + args: [], + const: true, + noexcept: true, + attributes: [], + }, { name: "stringtable", doc: [ "stringtable for unique symbols" ], diff --git a/include/xo/procedure2/DSimpleRcx.hpp b/include/xo/procedure2/DSimpleRcx.hpp index 6a7163d1..f6bee0b5 100644 --- a/include/xo/procedure2/DSimpleRcx.hpp +++ b/include/xo/procedure2/DSimpleRcx.hpp @@ -19,13 +19,15 @@ namespace xo { class DSimpleRcx { public: using AAllocator = xo::mm::AAllocator; + using ACollector = xo::mm::ACollector; using MemorySizeVisitor = xo::mm::MemorySizeVisitor; public: DSimpleRcx(obj mm, StringTable * st) - : allocator_{mm}, stringtable_{st} {} + : allocator_{mm}, stringtable_{st} {} obj allocator() const noexcept { return allocator_; } + obj collector() const noexcept; StringTable * stringtable() const noexcept { return stringtable_; } void visit_pools(const MemorySizeVisitor & visitor) const; diff --git a/include/xo/procedure2/detail/ARuntimeContext.hpp b/include/xo/procedure2/detail/ARuntimeContext.hpp index 716463d2..626e2ba6 100644 --- a/include/xo/procedure2/detail/ARuntimeContext.hpp +++ b/include/xo/procedure2/detail/ARuntimeContext.hpp @@ -42,6 +42,8 @@ public: using Opaque = void *; /** xo memory allocator **/ using AAllocator = xo::mm::AAllocator; + /** xo garbage collector **/ + using ACollector = xo::mm::ACollector; /** function to visit memory pools **/ using MemorySizeVisitor = xo::mm::MemorySizeVisitor; ///@} @@ -55,6 +57,8 @@ public: virtual void _drop(Opaque d) const noexcept = 0; /** default allocator to use for objects **/ virtual obj allocator(Copaque data) const noexcept = 0; + /** collector facet for allocator. If non-null, same data pointer as allocator **/ + virtual obj collector(Copaque data) const noexcept = 0; /** stringtable for unique symbols **/ virtual StringTable * stringtable(Copaque data) const noexcept = 0; /** invoke visitor for each distinct memory pool **/ diff --git a/include/xo/procedure2/detail/IRuntimeContext_Any.hpp b/include/xo/procedure2/detail/IRuntimeContext_Any.hpp index b72f934f..d0789e52 100644 --- a/include/xo/procedure2/detail/IRuntimeContext_Any.hpp +++ b/include/xo/procedure2/detail/IRuntimeContext_Any.hpp @@ -45,6 +45,7 @@ namespace scm { /** integer identifying a type **/ using typeseq = xo::facet::typeseq; using AAllocator = ARuntimeContext::AAllocator; + using ACollector = ARuntimeContext::ACollector; using MemorySizeVisitor = ARuntimeContext::MemorySizeVisitor; ///@} @@ -61,6 +62,7 @@ namespace scm { // const methods [[noreturn]] obj allocator(Copaque) const noexcept override { _fatal(); } + [[noreturn]] obj collector(Copaque) const noexcept override { _fatal(); } [[noreturn]] StringTable * stringtable(Copaque) const noexcept override { _fatal(); } [[noreturn]] void visit_pools(Copaque, MemorySizeVisitor) const override { _fatal(); } diff --git a/include/xo/procedure2/detail/IRuntimeContext_DSimpleRcx.hpp b/include/xo/procedure2/detail/IRuntimeContext_DSimpleRcx.hpp index 82ab5219..496b593c 100644 --- a/include/xo/procedure2/detail/IRuntimeContext_DSimpleRcx.hpp +++ b/include/xo/procedure2/detail/IRuntimeContext_DSimpleRcx.hpp @@ -40,6 +40,7 @@ namespace xo { /** @defgroup scm-runtimecontext-dsimplercx-type-traits **/ ///@{ using AAllocator = xo::scm::ARuntimeContext::AAllocator; + using ACollector = xo::scm::ARuntimeContext::ACollector; using MemorySizeVisitor = xo::scm::ARuntimeContext::MemorySizeVisitor; using Copaque = xo::scm::ARuntimeContext::Copaque; using Opaque = xo::scm::ARuntimeContext::Opaque; @@ -49,6 +50,8 @@ namespace xo { // const methods /** default allocator to use for objects **/ static obj allocator(const DSimpleRcx & self) noexcept; + /** collector facet for allocator. If non-null, same data pointer as allocator **/ + static obj collector(const DSimpleRcx & self) noexcept; /** stringtable for unique symbols **/ static StringTable * stringtable(const DSimpleRcx & self) noexcept; /** invoke visitor for each distinct memory pool **/ diff --git a/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp b/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp index 5dc9de5f..2c4e80e6 100644 --- a/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp +++ b/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp @@ -31,6 +31,7 @@ namespace scm { /** integer identifying a type **/ using typeseq = ARuntimeContext::typeseq; using AAllocator = ARuntimeContext::AAllocator; + using ACollector = ARuntimeContext::ACollector; using MemorySizeVisitor = ARuntimeContext::MemorySizeVisitor; ///@} @@ -50,6 +51,9 @@ namespace scm { obj allocator(Copaque data) const noexcept override { return I::allocator(_dcast(data)); } + obj collector(Copaque data) const noexcept override { + return I::collector(_dcast(data)); + } StringTable * stringtable(Copaque data) const noexcept override { return I::stringtable(_dcast(data)); } diff --git a/include/xo/procedure2/detail/RRuntimeContext.hpp b/include/xo/procedure2/detail/RRuntimeContext.hpp index 6553648c..b80cfce0 100644 --- a/include/xo/procedure2/detail/RRuntimeContext.hpp +++ b/include/xo/procedure2/detail/RRuntimeContext.hpp @@ -32,6 +32,7 @@ public: using DataPtr = Object::DataPtr; using typeseq = xo::reflect::typeseq; using AAllocator = ARuntimeContext::AAllocator; + using ACollector = ARuntimeContext::ACollector; using MemorySizeVisitor = ARuntimeContext::MemorySizeVisitor; ///@} @@ -57,6 +58,9 @@ public: obj allocator() const noexcept { return O::iface()->allocator(O::data()); } + obj collector() const noexcept { + return O::iface()->collector(O::data()); + } StringTable * stringtable() const noexcept { return O::iface()->stringtable(O::data()); } diff --git a/src/procedure2/DSimpleRcx.cpp b/src/procedure2/DSimpleRcx.cpp index 30ec9c95..471cad75 100644 --- a/src/procedure2/DSimpleRcx.cpp +++ b/src/procedure2/DSimpleRcx.cpp @@ -4,10 +4,20 @@ **/ #include "DSimpleRcx.hpp" +#include +#include namespace xo { + using xo::mm::ACollector; + namespace scm { + obj + DSimpleRcx::collector() const noexcept + { + return allocator_.try_to_facet(); + } + void DSimpleRcx::visit_pools(const MemorySizeVisitor & visitor) const { diff --git a/src/procedure2/facet/IRuntimeContext_DSimpleRcx.cpp b/src/procedure2/facet/IRuntimeContext_DSimpleRcx.cpp index 82dd310e..ba560969 100644 --- a/src/procedure2/facet/IRuntimeContext_DSimpleRcx.cpp +++ b/src/procedure2/facet/IRuntimeContext_DSimpleRcx.cpp @@ -21,6 +21,12 @@ namespace xo { return self.allocator(); } + auto + IRuntimeContext_DSimpleRcx::collector(const DSimpleRcx & self) noexcept -> obj + { + return self.collector(); + } + auto IRuntimeContext_DSimpleRcx::stringtable(const DSimpleRcx & self) noexcept -> StringTable * { From 7c347fc13977cc8bd244b0af295f24f1f2bc9041 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Tue, 24 Mar 2026 22:02:21 -0400 Subject: [PATCH 65/90] xo-procedure: drop PrimitiveRegistry.install_aux() debug --- include/xo/procedure2/PrimitiveRegistry.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/xo/procedure2/PrimitiveRegistry.hpp b/include/xo/procedure2/PrimitiveRegistry.hpp index c5227ec7..f2110d46 100644 --- a/include/xo/procedure2/PrimitiveRegistry.hpp +++ b/include/xo/procedure2/PrimitiveRegistry.hpp @@ -72,7 +72,7 @@ namespace xo { static bool install_aux(InstallSink sink, PrimitiveRepr * pm, InstallFlags flags) { - scope log(XO_DEBUG(true)); + scope log(XO_DEBUG(false)); if (flags != InstallFlags::f_none) { log && log("create primitive", xtag("name", pm->name())); From 1ec0d042d1d116108a6b07b0784950a91e9a590d Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Tue, 24 Mar 2026 22:17:41 -0400 Subject: [PATCH 66/90] xo-procedure2: + assign_head + set-car pm impl [WIP] Not actuall installed in global env --- include/xo/procedure2/ObjectPrimitives.hpp | 4 ++ src/procedure2/ObjectPrimitives.cpp | 43 ++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/include/xo/procedure2/ObjectPrimitives.hpp b/include/xo/procedure2/ObjectPrimitives.hpp index c403dc17..87a80457 100644 --- a/include/xo/procedure2/ObjectPrimitives.hpp +++ b/include/xo/procedure2/ObjectPrimitives.hpp @@ -35,6 +35,10 @@ namespace xo { static DPrimitive_gco_2_gco_gco * make_cons_pm(obj mm, StringTable * stbl); + /** create primitive: set first member of cons cell **/ + static DPrimitive_gco_2_gco_gco * make_set_car_pm(obj mm, + StringTable * stbl); + /** create primitive for creating a dictionary instance **/ static DPrimitive_gco_0 * make_dict_make_pm(obj mm, StringTable * stbl); diff --git a/src/procedure2/ObjectPrimitives.cpp b/src/procedure2/ObjectPrimitives.cpp index d9d86f4a..36dd2a37 100644 --- a/src/procedure2/ObjectPrimitives.cpp +++ b/src/procedure2/ObjectPrimitives.cpp @@ -116,6 +116,48 @@ namespace xo { return DPrimitive_gco_2_gco_gco::_make(mm, "cons", cons_ty, &xfer_cons); } + // ----- set-car ----- + + obj + xfer_set_car(obj rcx, + obj cell_arg, + obj dest) + { + scope log(XO_DEBUG(true)); + + (void)rcx; + (void)dest; + + auto cell = obj::from(cell_arg); + + assert(!cell->is_empty()); + + if (!cell->is_empty()) { + cell->assign_head(rcx.collector(), dest); + } + + return cell; + } + + DPrimitive_gco_2_gco_gco * + ObjectPrimitives::make_set_car_pm(obj mm, + StringTable * stbl) + { + (void)stbl; + + auto any_ty = DAtomicType::make(mm, Metatype::t_any()); + auto T_ty = DTypeVarRef::make(mm, stbl->intern("T")); + auto list_T_ty = DListType::make(mm, T_ty); + /** pm_ty: list x any -> list **/ + auto pm_ty + = obj(DFunctionType::_make(mm, + list_T_ty, + any_ty, + list_T_ty)); + + return DPrimitive_gco_2_gco_gco::_make(mm, "set-car", pm_ty, &xfer_set_car); + } + // ----- dict_make ----- obj @@ -233,6 +275,7 @@ namespace xo { xfer_fn_n_args(obj rcx, obj fn_gco) { + scope log(XO_DEBUG(true)); log && log(xtag("fn_gco.tseq", fn_gco._typeseq())); From 5369c82ed5ed678f09ea39267fa47385f313cd3e Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Tue, 24 Mar 2026 22:20:23 -0400 Subject: [PATCH 67/90] xo-gc: + scaffold for gc primitives --- include/xo/procedure2/GcPrimitives.hpp | 30 ++++++++++++++ src/procedure2/CMakeLists.txt | 1 + src/procedure2/GcPrimitives.cpp | 55 ++++++++++++++++++++++++++ src/procedure2/PrimitiveRegistry.cpp | 2 +- src/procedure2/SetupProcedure2.cpp | 1 + 5 files changed, 88 insertions(+), 1 deletion(-) create mode 100644 include/xo/procedure2/GcPrimitives.hpp create mode 100644 src/procedure2/GcPrimitives.cpp diff --git a/include/xo/procedure2/GcPrimitives.hpp b/include/xo/procedure2/GcPrimitives.hpp new file mode 100644 index 00000000..65ead09b --- /dev/null +++ b/include/xo/procedure2/GcPrimitives.hpp @@ -0,0 +1,30 @@ +/** @file GcPrimitives.hpp + * + * @author Roland Conybeare, Mar 2026 + **/ + +#pragma once + +#include "Primitive_gco_1_gco.hpp" + +namespace xo { + namespace scm { + + /** @rbief primitives centered on gc/ data structures. + * (i.e. X1Collector) + **/ + class GcPrimitives { + public: + using AAllocator = xo::mm::AAllocator; + + public: + /** create primitive: request collection **/ + static DPrimitive_gco_1_gco * make_request_gc_pm(obj mm, + StringTable * stbl); + }; + + } /*namespace scm*/ +} /*namespace xo*/ + + +/* end GcPrimitives.hpp */ diff --git a/src/procedure2/CMakeLists.txt b/src/procedure2/CMakeLists.txt index 2198403b..f4314fea 100644 --- a/src/procedure2/CMakeLists.txt +++ b/src/procedure2/CMakeLists.txt @@ -6,6 +6,7 @@ set(SELF_SRCS init_primitives.cpp SetupProcedure2.cpp ObjectPrimitives.cpp + GcPrimitives.cpp PrimitiveRegistry.cpp DPrimitive.cpp DSimpleRcx.cpp diff --git a/src/procedure2/GcPrimitives.cpp b/src/procedure2/GcPrimitives.cpp new file mode 100644 index 00000000..732608d4 --- /dev/null +++ b/src/procedure2/GcPrimitives.cpp @@ -0,0 +1,55 @@ +/** @file GcPrimitives.cpp + * + * @author Roland Conybeare, Mar 2026 + **/ + +#include "GcPrimitives.hpp" +#include +#include +#include +#include +#include +#include + +namespace xo { + using xo::mm::generation; + + namespace scm { + + // ----- request-gc ----- + + obj + xfer_request_gc(obj rcx, + obj upto_gco) + { + bool have_gc = false; + + if (rcx.collector()) { + generation upto(obj::from(upto_gco)); + + rcx.collector().request_gc(upto); + + have_gc = true; + } + + return DBoolean::box(rcx.allocator(), have_gc); + } + + DPrimitive_gco_1_gco * + GcPrimitives::make_request_gc_pm(obj mm, + StringTable * stbl) + { + (void)stbl; + + auto int_ty = DAtomicType::make(mm, Metatype::t_integer()); + auto bool_ty = DAtomicType::make(mm, Metatype::t_bool()); + auto pm_ty = obj(DFunctionType::_make(mm, + bool_ty, + int_ty)); + + return DPrimitive_gco_1_gco::_make(mm, "request_gc", pm_ty, &xfer_request_gc); + } + } +} + +/* end GcPrimitives.cpp */ diff --git a/src/procedure2/PrimitiveRegistry.cpp b/src/procedure2/PrimitiveRegistry.cpp index ef5cb8c6..6e606bea 100644 --- a/src/procedure2/PrimitiveRegistry.cpp +++ b/src/procedure2/PrimitiveRegistry.cpp @@ -31,7 +31,7 @@ namespace xo { InstallSink sink, InstallFlags flags) { - scope log(XO_DEBUG(true)); + scope log(XO_DEBUG(false)); bool ok = true; diff --git a/src/procedure2/SetupProcedure2.cpp b/src/procedure2/SetupProcedure2.cpp index 60bd02ed..520df9b4 100644 --- a/src/procedure2/SetupProcedure2.cpp +++ b/src/procedure2/SetupProcedure2.cpp @@ -6,6 +6,7 @@ #include "SetupProcedure2.hpp" #include "Procedure.hpp" #include "ObjectPrimitives.hpp" +#include "GcPrimitives.hpp" #include "SimpleRcx.hpp" #include "Primitive_gco_0.hpp" #include "Primitive_gco_1_gco.hpp" From 27736ed0b6fa86a31bd1bed24910d82ae8ff43cb Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Wed, 25 Mar 2026 00:10:42 -0400 Subject: [PATCH 68/90] xo-procedure: + set-car primitive --- src/procedure2/SetupProcedure2.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/procedure2/SetupProcedure2.cpp b/src/procedure2/SetupProcedure2.cpp index 520df9b4..9dec25cc 100644 --- a/src/procedure2/SetupProcedure2.cpp +++ b/src/procedure2/SetupProcedure2.cpp @@ -109,6 +109,10 @@ namespace xo { (sink, ObjectPrimitives::make_cons_pm(mm, stbl), flags & InstallFlags::f_generalpurpose)); + ok = ok & (PrimitiveRegistry::install_aux + (sink, + ObjectPrimitives::make_set_car_pm(mm, stbl), + flags & InstallFlags::f_generalpurpose)); ok = ok & (PrimitiveRegistry::install_aux (sink, ObjectPrimitives::make_dict_make_pm(mm, stbl), From 7789218ff2d317f34ad977687c0878adb010944e Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Wed, 25 Mar 2026 17:11:46 -0400 Subject: [PATCH 69/90] xo-reader2 stack: refactor for ssm file location --- src/procedure2/SetupProcedure2.cpp | 55 ++++++++++++++++-------------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/src/procedure2/SetupProcedure2.cpp b/src/procedure2/SetupProcedure2.cpp index 9dec25cc..00f24608 100644 --- a/src/procedure2/SetupProcedure2.cpp +++ b/src/procedure2/SetupProcedure2.cpp @@ -93,42 +93,47 @@ namespace xo { obj mm = rcx.allocator(); StringTable * stbl = rcx.stringtable(); - scope log(XO_DEBUG(true)); + scope log(XO_DEBUG(false)); bool ok = true; ok = ok & (PrimitiveRegistry::install_aux - (sink, - ObjectPrimitives::make_cwd_pm(mm, stbl), - flags & InstallFlags::f_generalpurpose)); + (sink, + ObjectPrimitives::make_cwd_pm(mm, stbl), + flags & InstallFlags::f_generalpurpose)); ok = ok & (PrimitiveRegistry::install_aux - (sink, - ObjectPrimitives::make_nth_pm(mm, stbl), - flags & InstallFlags::f_generalpurpose)); + (sink, + ObjectPrimitives::make_nth_pm(mm, stbl), + flags & InstallFlags::f_generalpurpose)); ok = ok & (PrimitiveRegistry::install_aux - (sink, - ObjectPrimitives::make_cons_pm(mm, stbl), - flags & InstallFlags::f_generalpurpose)); + (sink, + ObjectPrimitives::make_cons_pm(mm, stbl), + flags & InstallFlags::f_generalpurpose)); ok = ok & (PrimitiveRegistry::install_aux - (sink, - ObjectPrimitives::make_set_car_pm(mm, stbl), - flags & InstallFlags::f_generalpurpose)); + (sink, + ObjectPrimitives::make_set_car_pm(mm, stbl), + flags & InstallFlags::f_generalpurpose)); ok = ok & (PrimitiveRegistry::install_aux - (sink, - ObjectPrimitives::make_dict_make_pm(mm, stbl), - flags & InstallFlags::f_generalpurpose)); + (sink, + ObjectPrimitives::make_dict_make_pm(mm, stbl), + flags & InstallFlags::f_generalpurpose)); ok = ok & (PrimitiveRegistry::install_aux - (sink, - ObjectPrimitives::make_dict_lookup_pm(mm, stbl), - flags & InstallFlags::f_generalpurpose)); + (sink, + ObjectPrimitives::make_dict_lookup_pm(mm, stbl), + flags & InstallFlags::f_generalpurpose)); ok = ok & (PrimitiveRegistry::install_aux - (sink, - ObjectPrimitives::make_dict_upsert_pm(mm, stbl), - flags & InstallFlags::f_generalpurpose)); + (sink, + ObjectPrimitives::make_dict_upsert_pm(mm, stbl), + flags & InstallFlags::f_generalpurpose)); ok = ok & (PrimitiveRegistry::install_aux - (sink, - ObjectPrimitives::make_fn_n_args_pm(mm, stbl), - flags & InstallFlags::f_generalpurpose)); + (sink, + ObjectPrimitives::make_fn_n_args_pm(mm, stbl), + flags & InstallFlags::f_generalpurpose)); + + ok = ok & (PrimitiveRegistry::install_aux + (sink, + GcPrimitives::make_request_gc_pm(mm, stbl), + flags & InstallFlags::f_generalpurpose)); return ok; } From c29c760e68482e8b5ef38da8956c09422cff5c82 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Thu, 26 Mar 2026 10:27:00 -0400 Subject: [PATCH 70/90] xo-procedure2: rename request_gc pm -> request-gc --- src/procedure2/GcPrimitives.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/procedure2/GcPrimitives.cpp b/src/procedure2/GcPrimitives.cpp index 732608d4..a6a4fdb3 100644 --- a/src/procedure2/GcPrimitives.cpp +++ b/src/procedure2/GcPrimitives.cpp @@ -47,7 +47,7 @@ namespace xo { bool_ty, int_ty)); - return DPrimitive_gco_1_gco::_make(mm, "request_gc", pm_ty, &xfer_request_gc); + return DPrimitive_gco_1_gco::_make(mm, "request-gc", pm_ty, &xfer_request_gc); } } } From 47e6830eb96e0497e68976b0a426f6be7db5b580 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Thu, 26 Mar 2026 11:30:16 -0400 Subject: [PATCH 71/90] xo-gc: generation -> Generation + bugfix idle test --- src/procedure2/GcPrimitives.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/procedure2/GcPrimitives.cpp b/src/procedure2/GcPrimitives.cpp index a6a4fdb3..63a3d3a9 100644 --- a/src/procedure2/GcPrimitives.cpp +++ b/src/procedure2/GcPrimitives.cpp @@ -12,7 +12,7 @@ #include namespace xo { - using xo::mm::generation; + using xo::mm::Generation; namespace scm { @@ -25,7 +25,7 @@ namespace xo { bool have_gc = false; if (rcx.collector()) { - generation upto(obj::from(upto_gco)); + Generation upto(obj::from(upto_gco)); rcx.collector().request_gc(upto); From 7916971dc1f1c8b64169d0123b98438b8f8f56c4 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Fri, 27 Mar 2026 20:56:46 -0400 Subject: [PATCH 72/90] xo-alloc2: + ACollector2 temporary, planning to codegen Collector facet --- src/procedure2/GcPrimitives.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/procedure2/GcPrimitives.cpp b/src/procedure2/GcPrimitives.cpp index 63a3d3a9..9948ff65 100644 --- a/src/procedure2/GcPrimitives.cpp +++ b/src/procedure2/GcPrimitives.cpp @@ -6,16 +6,39 @@ #include "GcPrimitives.hpp" #include #include +//#include #include #include #include #include namespace xo { + using xo::mm::ACollector; + //using xo::mm::DX1Collector; using xo::mm::Generation; namespace scm { + // ----- report-gc-status ----- + +#ifdef NOT_YET + obj + xfer_report_gc_status(obj rcx) + { + bool have_gc = false; + + if (rcx.collector()) { + // status currently only implemented for X1 collector + + auto gc = obj::from(rcx.collector()); + + + } + + return DBoolean::box(rcx.allocator(), false); + } +#endif + // ----- request-gc ----- obj From f7c269a5052a4ab5d27f546914b63efc4166ef0f Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Sun, 29 Mar 2026 13:44:19 -0400 Subject: [PATCH 73/90] xo-gc stack: + request-gc-statistics() primitive 1. xo-gc now depends on xo-object2. 2. use genfacet for ICollector_DX1Collector 3. moves xo-gc utest previously in xo-object2 to more natural location in xo-gc/ --- idl/RuntimeContext.json5 | 9 +++++++ include/xo/procedure2/DSimpleRcx.hpp | 7 +++-- include/xo/procedure2/GcPrimitives.hpp | 5 ++++ include/xo/procedure2/detail/AProcedure.hpp | 5 ++++ .../xo/procedure2/detail/ARuntimeContext.hpp | 7 +++++ .../procedure2/detail/IRuntimeContext_Any.hpp | 1 + .../detail/IRuntimeContext_DSimpleRcx.hpp | 2 ++ .../detail/IRuntimeContext_Xfer.hpp | 3 +++ .../xo/procedure2/detail/RRuntimeContext.hpp | 3 +++ src/procedure2/GcPrimitives.cpp | 26 ++++++++++++++----- src/procedure2/SetupProcedure2.cpp | 7 +++++ .../facet/IRuntimeContext_DSimpleRcx.cpp | 6 +++++ utest/DSimpleRcx.test.cpp | 4 +-- 13 files changed, 74 insertions(+), 11 deletions(-) diff --git a/idl/RuntimeContext.json5 b/idl/RuntimeContext.json5 index 481d0cbf..8736f38d 100644 --- a/idl/RuntimeContext.json5 +++ b/idl/RuntimeContext.json5 @@ -61,6 +61,15 @@ noexcept: true, attributes: [], }, + { + name: "error_allocator", + doc: [ "last-resort allocator for erros. e.g. regular allocator exhausted" ], + return_type: "obj", + args: [], + const: true, + noexcept: true, + attributes: [], + }, { name: "stringtable", doc: [ "stringtable for unique symbols" ], diff --git a/include/xo/procedure2/DSimpleRcx.hpp b/include/xo/procedure2/DSimpleRcx.hpp index f6bee0b5..1bdf1f73 100644 --- a/include/xo/procedure2/DSimpleRcx.hpp +++ b/include/xo/procedure2/DSimpleRcx.hpp @@ -23,16 +23,19 @@ namespace xo { using MemorySizeVisitor = xo::mm::MemorySizeVisitor; public: - DSimpleRcx(obj mm, StringTable * st) - : allocator_{mm}, stringtable_{st} {} + DSimpleRcx(obj mm, obj error_mm, StringTable * st) + : allocator_{mm}, error_allocator_{error_mm}, + stringtable_{st} {} obj allocator() const noexcept { return allocator_; } obj collector() const noexcept; + obj error_allocator() const noexcept { return error_allocator_; } StringTable * stringtable() const noexcept { return stringtable_; } void visit_pools(const MemorySizeVisitor & visitor) const; private: obj allocator_; + obj error_allocator_; StringTable * stringtable_ = nullptr; }; diff --git a/include/xo/procedure2/GcPrimitives.hpp b/include/xo/procedure2/GcPrimitives.hpp index 65ead09b..d0a1525a 100644 --- a/include/xo/procedure2/GcPrimitives.hpp +++ b/include/xo/procedure2/GcPrimitives.hpp @@ -5,6 +5,7 @@ #pragma once +#include "Primitive_gco_0.hpp" #include "Primitive_gco_1_gco.hpp" namespace xo { @@ -18,6 +19,10 @@ namespace xo { using AAllocator = xo::mm::AAllocator; public: + /** create primitive: report gc statistics **/ + static DPrimitive_gco_0 * make_report_gc_statistics_pm(obj mm, + StringTable * stbl); + /** create primitive: request collection **/ static DPrimitive_gco_1_gco * make_request_gc_pm(obj mm, StringTable * stbl); diff --git a/include/xo/procedure2/detail/AProcedure.hpp b/include/xo/procedure2/detail/AProcedure.hpp index a5c41b41..2197c5df 100644 --- a/include/xo/procedure2/detail/AProcedure.hpp +++ b/include/xo/procedure2/detail/AProcedure.hpp @@ -47,6 +47,11 @@ public: /** @defgroup scm-procedure-methods **/ ///@{ // const methods + /** An uninitialized AProcedure instance will have zero vtable pointer (per {linux,osx} abi). + * Use case for this is narrow. We go to some lengths to avoid null vtable pointers. For example + * obj will have non-null vtable (via IFacet_Any) with all methods terminating. + **/ + bool _has_null_vptr() const noexcept { return *reinterpret_cast(this) == nullptr; } /** RTTI: unique id# for actual runtime data representation **/ virtual typeseq _typeseq() const noexcept = 0; /** destroy instance @p d; calls c++ dtor only for actual runtime type; does not recover memory **/ diff --git a/include/xo/procedure2/detail/ARuntimeContext.hpp b/include/xo/procedure2/detail/ARuntimeContext.hpp index 626e2ba6..c9da6d6e 100644 --- a/include/xo/procedure2/detail/ARuntimeContext.hpp +++ b/include/xo/procedure2/detail/ARuntimeContext.hpp @@ -51,6 +51,11 @@ public: /** @defgroup scm-runtimecontext-methods **/ ///@{ // const methods + /** An uninitialized ARuntimeContext instance will have zero vtable pointer (per {linux,osx} abi). + * Use case for this is narrow. We go to some lengths to avoid null vtable pointers. For example + * obj will have non-null vtable (via IFacet_Any) with all methods terminating. + **/ + bool _has_null_vptr() const noexcept { return *reinterpret_cast(this) == nullptr; } /** RTTI: unique id# for actual runtime data representation **/ virtual typeseq _typeseq() const noexcept = 0; /** destroy instance @p d; calls c++ dtor only for actual runtime type; does not recover memory **/ @@ -59,6 +64,8 @@ public: virtual obj allocator(Copaque data) const noexcept = 0; /** collector facet for allocator. If non-null, same data pointer as allocator **/ virtual obj collector(Copaque data) const noexcept = 0; + /** last-resort allocator for erros. e.g. regular allocator exhausted **/ + virtual obj error_allocator(Copaque data) const noexcept = 0; /** stringtable for unique symbols **/ virtual StringTable * stringtable(Copaque data) const noexcept = 0; /** invoke visitor for each distinct memory pool **/ diff --git a/include/xo/procedure2/detail/IRuntimeContext_Any.hpp b/include/xo/procedure2/detail/IRuntimeContext_Any.hpp index d0789e52..89a0d7a9 100644 --- a/include/xo/procedure2/detail/IRuntimeContext_Any.hpp +++ b/include/xo/procedure2/detail/IRuntimeContext_Any.hpp @@ -63,6 +63,7 @@ namespace scm { // const methods [[noreturn]] obj allocator(Copaque) const noexcept override { _fatal(); } [[noreturn]] obj collector(Copaque) const noexcept override { _fatal(); } + [[noreturn]] obj error_allocator(Copaque) const noexcept override { _fatal(); } [[noreturn]] StringTable * stringtable(Copaque) const noexcept override { _fatal(); } [[noreturn]] void visit_pools(Copaque, MemorySizeVisitor) const override { _fatal(); } diff --git a/include/xo/procedure2/detail/IRuntimeContext_DSimpleRcx.hpp b/include/xo/procedure2/detail/IRuntimeContext_DSimpleRcx.hpp index 496b593c..cf2a052f 100644 --- a/include/xo/procedure2/detail/IRuntimeContext_DSimpleRcx.hpp +++ b/include/xo/procedure2/detail/IRuntimeContext_DSimpleRcx.hpp @@ -52,6 +52,8 @@ namespace xo { static obj allocator(const DSimpleRcx & self) noexcept; /** collector facet for allocator. If non-null, same data pointer as allocator **/ static obj collector(const DSimpleRcx & self) noexcept; + /** last-resort allocator for erros. e.g. regular allocator exhausted **/ + static obj error_allocator(const DSimpleRcx & self) noexcept; /** stringtable for unique symbols **/ static StringTable * stringtable(const DSimpleRcx & self) noexcept; /** invoke visitor for each distinct memory pool **/ diff --git a/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp b/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp index 2c4e80e6..d1a8e8c7 100644 --- a/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp +++ b/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp @@ -54,6 +54,9 @@ namespace scm { obj collector(Copaque data) const noexcept override { return I::collector(_dcast(data)); } + obj error_allocator(Copaque data) const noexcept override { + return I::error_allocator(_dcast(data)); + } StringTable * stringtable(Copaque data) const noexcept override { return I::stringtable(_dcast(data)); } diff --git a/include/xo/procedure2/detail/RRuntimeContext.hpp b/include/xo/procedure2/detail/RRuntimeContext.hpp index b80cfce0..9c047fd2 100644 --- a/include/xo/procedure2/detail/RRuntimeContext.hpp +++ b/include/xo/procedure2/detail/RRuntimeContext.hpp @@ -61,6 +61,9 @@ public: obj collector() const noexcept { return O::iface()->collector(O::data()); } + obj error_allocator() const noexcept { + return O::iface()->error_allocator(O::data()); + } StringTable * stringtable() const noexcept { return O::iface()->stringtable(O::data()); } diff --git a/src/procedure2/GcPrimitives.cpp b/src/procedure2/GcPrimitives.cpp index 9948ff65..9573f665 100644 --- a/src/procedure2/GcPrimitives.cpp +++ b/src/procedure2/GcPrimitives.cpp @@ -21,23 +21,35 @@ namespace xo { // ----- report-gc-status ----- -#ifdef NOT_YET obj - xfer_report_gc_status(obj rcx) + xfer_report_gc_statistics(obj rcx) { - bool have_gc = false; - if (rcx.collector()) { // status currently only implemented for X1 collector - auto gc = obj::from(rcx.collector()); - + obj stats; + bool ok = rcx.collector().report_statistics(rcx.allocator(), + rcx.error_allocator(), + &stats); + if (ok && stats) + return stats; } return DBoolean::box(rcx.allocator(), false); } -#endif + + DPrimitive_gco_0 * + GcPrimitives::make_report_gc_statistics_pm(obj mm, + StringTable * stbl) + { + (void)stbl; + + auto any_ty = DAtomicType::make(mm, Metatype::t_any()); + auto pm_ty = obj(DFunctionType::_make(mm, any_ty)); + + return DPrimitive_gco_0::_make(mm, "report-gc-statistics", pm_ty, &xfer_report_gc_statistics); + } // ----- request-gc ----- diff --git a/src/procedure2/SetupProcedure2.cpp b/src/procedure2/SetupProcedure2.cpp index 00f24608..6772fff3 100644 --- a/src/procedure2/SetupProcedure2.cpp +++ b/src/procedure2/SetupProcedure2.cpp @@ -130,6 +130,13 @@ namespace xo { ObjectPrimitives::make_fn_n_args_pm(mm, stbl), flags & InstallFlags::f_generalpurpose)); + // ----- gc primitives ----- + + ok = ok & (PrimitiveRegistry::install_aux + (sink, + GcPrimitives::make_report_gc_statistics_pm(mm, stbl), + flags & InstallFlags::f_generalpurpose)); + ok = ok & (PrimitiveRegistry::install_aux (sink, GcPrimitives::make_request_gc_pm(mm, stbl), diff --git a/src/procedure2/facet/IRuntimeContext_DSimpleRcx.cpp b/src/procedure2/facet/IRuntimeContext_DSimpleRcx.cpp index ba560969..d32f5740 100644 --- a/src/procedure2/facet/IRuntimeContext_DSimpleRcx.cpp +++ b/src/procedure2/facet/IRuntimeContext_DSimpleRcx.cpp @@ -27,6 +27,12 @@ namespace xo { return self.collector(); } + auto + IRuntimeContext_DSimpleRcx::error_allocator(const DSimpleRcx & self) noexcept -> obj + { + return self.error_allocator(); + } + auto IRuntimeContext_DSimpleRcx::stringtable(const DSimpleRcx & self) noexcept -> StringTable * { diff --git a/utest/DSimpleRcx.test.cpp b/utest/DSimpleRcx.test.cpp index 365bd3f6..0fe56b86 100644 --- a/utest/DSimpleRcx.test.cpp +++ b/utest/DSimpleRcx.test.cpp @@ -39,7 +39,7 @@ namespace xo { auto stbl = StringTable(1024 /*hint_max_capacity*/, false /*!debug_flag*/); - DSimpleRcx rcx(alloc, &stbl); + DSimpleRcx rcx(alloc, alloc, &stbl); REQUIRE((void*)rcx.allocator().data() == (void*)alloc.data()); REQUIRE(rcx.stringtable() == &stbl); @@ -54,7 +54,7 @@ namespace xo { auto stbl = StringTable(1024 /*hint_max_capacity*/, false /*!debug_flag*/); - DSimpleRcx rcx(alloc, &stbl); + DSimpleRcx rcx(alloc, alloc, &stbl); obj rcx_obj = with_facet::mkobj(&rcx); // verify we can recover allocator from obj From b6353ccc3dce4d7a0e3ff2e5776bea10a50c68dd Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Sun, 29 Mar 2026 17:19:23 -0400 Subject: [PATCH 74/90] xo-gc stack: + gc-report-object-types() primitive --- include/xo/procedure2/GcPrimitives.hpp | 4 ++++ src/procedure2/GcPrimitives.cpp | 32 ++++++++++++++++++++++++-- src/procedure2/SetupProcedure2.cpp | 5 ++++ 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/include/xo/procedure2/GcPrimitives.hpp b/include/xo/procedure2/GcPrimitives.hpp index d0a1525a..4b134fd7 100644 --- a/include/xo/procedure2/GcPrimitives.hpp +++ b/include/xo/procedure2/GcPrimitives.hpp @@ -23,6 +23,10 @@ namespace xo { static DPrimitive_gco_0 * make_report_gc_statistics_pm(obj mm, StringTable * stbl); + /** create primitive: report gc object-type statistics **/ + static DPrimitive_gco_0 * make_report_gc_object_types_pm(obj mm, + StringTable * stbl); + /** create primitive: request collection **/ static DPrimitive_gco_1_gco * make_request_gc_pm(obj mm, StringTable * stbl); diff --git a/src/procedure2/GcPrimitives.cpp b/src/procedure2/GcPrimitives.cpp index 9573f665..76570fa7 100644 --- a/src/procedure2/GcPrimitives.cpp +++ b/src/procedure2/GcPrimitives.cpp @@ -25,8 +25,6 @@ namespace xo { xfer_report_gc_statistics(obj rcx) { if (rcx.collector()) { - // status currently only implemented for X1 collector - obj stats; bool ok = rcx.collector().report_statistics(rcx.allocator(), rcx.error_allocator(), @@ -51,6 +49,36 @@ namespace xo { return DPrimitive_gco_0::_make(mm, "report-gc-statistics", pm_ty, &xfer_report_gc_statistics); } + // ----- report-gc-object-types ----- + + obj + xfer_report_gc_object_types(obj rcx) + { + if (rcx.collector()) { + obj stats; + bool ok = rcx.collector().report_object_types(rcx.allocator(), rcx.error_allocator(), &stats); + + + if (ok && stats) + return stats; + } + + return DBoolean::box(rcx.allocator(), false); + } + + DPrimitive_gco_0 * + GcPrimitives::make_report_gc_object_types_pm(obj mm, + StringTable * stbl) + { + (void)stbl; + + auto any_ty = DAtomicType::make(mm, Metatype::t_any()); + auto pm_ty = obj(DFunctionType::_make(mm, any_ty)); + + return DPrimitive_gco_0::_make(mm, "report-gc-object-types", pm_ty, &xfer_report_gc_object_types); + + } + // ----- request-gc ----- obj diff --git a/src/procedure2/SetupProcedure2.cpp b/src/procedure2/SetupProcedure2.cpp index 6772fff3..a07a6ffa 100644 --- a/src/procedure2/SetupProcedure2.cpp +++ b/src/procedure2/SetupProcedure2.cpp @@ -137,6 +137,11 @@ namespace xo { GcPrimitives::make_report_gc_statistics_pm(mm, stbl), flags & InstallFlags::f_generalpurpose)); + ok = ok & (PrimitiveRegistry::install_aux + (sink, + GcPrimitives::make_report_gc_object_types_pm(mm, stbl), + flags & InstallFlags::f_generalpurpose)); + ok = ok & (PrimitiveRegistry::install_aux (sink, GcPrimitives::make_request_gc_pm(mm, stbl), From 97723415b1239ef718c7fbd89335a1d92772a562 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Sun, 29 Mar 2026 19:47:15 -0400 Subject: [PATCH 75/90] xo-gc stack: + gc-location-of() primitive --- include/xo/procedure2/GcPrimitives.hpp | 4 ++++ src/procedure2/GcPrimitives.cpp | 28 +++++++++++++++++++++++++- src/procedure2/SetupProcedure2.cpp | 5 +++++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/include/xo/procedure2/GcPrimitives.hpp b/include/xo/procedure2/GcPrimitives.hpp index 4b134fd7..9b64ecaa 100644 --- a/include/xo/procedure2/GcPrimitives.hpp +++ b/include/xo/procedure2/GcPrimitives.hpp @@ -27,6 +27,10 @@ namespace xo { static DPrimitive_gco_0 * make_report_gc_object_types_pm(obj mm, StringTable * stbl); + /** create primitive: report gc location of a value **/ + static DPrimitive_gco_1_gco * make_gc_location_of_pm(obj mm, + StringTable * stbl); + /** create primitive: request collection **/ static DPrimitive_gco_1_gco * make_request_gc_pm(obj mm, StringTable * stbl); diff --git a/src/procedure2/GcPrimitives.cpp b/src/procedure2/GcPrimitives.cpp index 76570fa7..f693bd01 100644 --- a/src/procedure2/GcPrimitives.cpp +++ b/src/procedure2/GcPrimitives.cpp @@ -58,7 +58,6 @@ namespace xo { obj stats; bool ok = rcx.collector().report_object_types(rcx.allocator(), rcx.error_allocator(), &stats); - if (ok && stats) return stats; } @@ -79,6 +78,33 @@ namespace xo { } + // ----- gc-location-of ----- + + obj + xfer_gc_location_of(obj rcx, obj gco) + { + std::int32_t location_code = 0; + + if (rcx.collector()) { + location_code = rcx.collector().locate_address(gco.data()); + } + + return DInteger::box(rcx.allocator(), location_code); + } + + DPrimitive_gco_1_gco * + GcPrimitives::make_gc_location_of_pm(obj mm, + StringTable * stbl) + { + (void)stbl; + + auto int_ty = DAtomicType::make(mm, Metatype::t_integer()); + auto any_ty = DAtomicType::make(mm, Metatype::t_any()); + auto pm_ty = obj(DFunctionType::_make(mm, int_ty, any_ty)); + + return DPrimitive_gco_1_gco::_make(mm, "gc-location-of", pm_ty, &xfer_gc_location_of); + } + // ----- request-gc ----- obj diff --git a/src/procedure2/SetupProcedure2.cpp b/src/procedure2/SetupProcedure2.cpp index a07a6ffa..44d9b3e9 100644 --- a/src/procedure2/SetupProcedure2.cpp +++ b/src/procedure2/SetupProcedure2.cpp @@ -142,6 +142,11 @@ namespace xo { GcPrimitives::make_report_gc_object_types_pm(mm, stbl), flags & InstallFlags::f_generalpurpose)); + ok = ok & (PrimitiveRegistry::install_aux + (sink, + GcPrimitives::make_gc_location_of_pm(mm, stbl), + flags & InstallFlags::f_generalpurpose)); + ok = ok & (PrimitiveRegistry::install_aux (sink, GcPrimitives::make_request_gc_pm(mm, stbl), From a9be64edb74d09f4ee7cfc4527cb06926e81c556 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Mon, 30 Mar 2026 14:51:51 -0400 Subject: [PATCH 76/90] xo-procedure2 stack: + report-gc-object-ages() primitive --- include/xo/procedure2/GcPrimitives.hpp | 4 ++++ src/procedure2/GcPrimitives.cpp | 28 ++++++++++++++++++++++++++ src/procedure2/SetupProcedure2.cpp | 5 +++++ 3 files changed, 37 insertions(+) diff --git a/include/xo/procedure2/GcPrimitives.hpp b/include/xo/procedure2/GcPrimitives.hpp index 9b64ecaa..b52b12c2 100644 --- a/include/xo/procedure2/GcPrimitives.hpp +++ b/include/xo/procedure2/GcPrimitives.hpp @@ -27,6 +27,10 @@ namespace xo { static DPrimitive_gco_0 * make_report_gc_object_types_pm(obj mm, StringTable * stbl); + /** create primitive: report gc object-age statistics **/ + static DPrimitive_gco_0 * make_report_gc_object_ages_pm(obj mm, + StringTable * stbl); + /** create primitive: report gc location of a value **/ static DPrimitive_gco_1_gco * make_gc_location_of_pm(obj mm, StringTable * stbl); diff --git a/src/procedure2/GcPrimitives.cpp b/src/procedure2/GcPrimitives.cpp index f693bd01..261a8c6a 100644 --- a/src/procedure2/GcPrimitives.cpp +++ b/src/procedure2/GcPrimitives.cpp @@ -78,6 +78,34 @@ namespace xo { } + // ----- report-gc-object-ages ----- + + obj + xfer_report_gc_object_ages(obj rcx) + { + if (rcx.collector()) { + obj stats; + bool ok = rcx.collector().report_object_ages(rcx.allocator(), rcx.error_allocator(), &stats); + + if (ok && stats) + return stats; + } + + return DBoolean::box(rcx.allocator(), false); + } + + DPrimitive_gco_0 * + GcPrimitives::make_report_gc_object_ages_pm(obj mm, + StringTable * stbl) + { + (void)stbl; + + auto any_ty = DAtomicType::make(mm, Metatype::t_any()); + auto pm_ty = obj(DFunctionType::_make(mm, any_ty)); + + return DPrimitive_gco_0::_make(mm, "report-gc-object-ages", pm_ty, &xfer_report_gc_object_ages); + } + // ----- gc-location-of ----- obj diff --git a/src/procedure2/SetupProcedure2.cpp b/src/procedure2/SetupProcedure2.cpp index 44d9b3e9..3ab0b52d 100644 --- a/src/procedure2/SetupProcedure2.cpp +++ b/src/procedure2/SetupProcedure2.cpp @@ -142,6 +142,11 @@ namespace xo { GcPrimitives::make_report_gc_object_types_pm(mm, stbl), flags & InstallFlags::f_generalpurpose)); + ok = ok & (PrimitiveRegistry::install_aux + (sink, + GcPrimitives::make_report_gc_object_ages_pm(mm, stbl), + flags & InstallFlags::f_generalpurpose)); + ok = ok & (PrimitiveRegistry::install_aux (sink, GcPrimitives::make_gc_location_of_pm(mm, stbl), From 5fcf935a3eac2ec8139701d392885d726c1a95c4 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Fri, 3 Apr 2026 00:04:34 -0400 Subject: [PATCH 77/90] xo-alloc2: tidy: generation.hpp -> Generation.hpp --- src/procedure2/GcPrimitives.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/procedure2/GcPrimitives.cpp b/src/procedure2/GcPrimitives.cpp index 261a8c6a..353c0741 100644 --- a/src/procedure2/GcPrimitives.cpp +++ b/src/procedure2/GcPrimitives.cpp @@ -10,7 +10,7 @@ #include #include #include -#include +#include namespace xo { using xo::mm::ACollector; From b91f45d934953727de22fe61f2f1b2f19817c407 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Sat, 4 Apr 2026 14:38:14 -0400 Subject: [PATCH 78/90] refactor: make AGCObject.shallow_copy() non-const prep for moving to ACollector interface --- include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp | 4 ++-- .../xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp | 4 ++-- .../detail/IGCObject_DPrimitive_gco_2_dict_string.hpp | 4 ++-- .../procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp | 4 ++-- .../detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp | 4 ++-- src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp | 3 +-- src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp | 3 +-- .../facet/IGCObject_DPrimitive_gco_2_dict_string.cpp | 3 +-- src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp | 3 +-- .../facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp | 3 +-- 10 files changed, 15 insertions(+), 20 deletions(-) diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp index c8865270..6660dad2 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp @@ -52,10 +52,10 @@ namespace xo { // const methods /** memory consumption for this instance **/ static size_type shallow_size(const DPrimitive_gco_0 & self) noexcept; - /** copy instance using allocator **/ - static Opaque shallow_copy(const DPrimitive_gco_0 & self, obj mm) noexcept; // non-const methods + /** copy instance using allocator **/ + static Opaque shallow_copy(DPrimitive_gco_0 & self, obj mm) noexcept; /** during GC: forward immdiate children **/ static size_type forward_children(DPrimitive_gco_0 & self, obj gc) noexcept; ///@} diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp index ac5a4439..a4aa56e2 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp @@ -52,10 +52,10 @@ namespace xo { // const methods /** memory consumption for this instance **/ static size_type shallow_size(const DPrimitive_gco_1_gco & self) noexcept; - /** copy instance using allocator **/ - static Opaque shallow_copy(const DPrimitive_gco_1_gco & self, obj mm) noexcept; // non-const methods + /** copy instance using allocator **/ + static Opaque shallow_copy(DPrimitive_gco_1_gco & self, obj mm) noexcept; /** during GC: forward immdiate children **/ static size_type forward_children(DPrimitive_gco_1_gco & self, obj gc) noexcept; ///@} diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp index 256ad716..a2e6e32a 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp @@ -52,10 +52,10 @@ namespace xo { // const methods /** memory consumption for this instance **/ static size_type shallow_size(const DPrimitive_gco_2_dict_string & self) noexcept; - /** copy instance using allocator **/ - static Opaque shallow_copy(const DPrimitive_gco_2_dict_string & self, obj mm) noexcept; // non-const methods + /** copy instance using allocator **/ + static Opaque shallow_copy(DPrimitive_gco_2_dict_string & self, obj mm) noexcept; /** during GC: forward immdiate children **/ static size_type forward_children(DPrimitive_gco_2_dict_string & self, obj gc) noexcept; ///@} diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp index fee6d62b..bad1200f 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp @@ -52,10 +52,10 @@ namespace xo { // const methods /** memory consumption for this instance **/ static size_type shallow_size(const DPrimitive_gco_2_gco_gco & self) noexcept; - /** copy instance using allocator **/ - static Opaque shallow_copy(const DPrimitive_gco_2_gco_gco & self, obj mm) noexcept; // non-const methods + /** copy instance using allocator **/ + static Opaque shallow_copy(DPrimitive_gco_2_gco_gco & self, obj mm) noexcept; /** during GC: forward immdiate children **/ static size_type forward_children(DPrimitive_gco_2_gco_gco & self, obj gc) noexcept; ///@} diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp index 951bda1c..6b5ddc3b 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp @@ -52,10 +52,10 @@ namespace xo { // const methods /** memory consumption for this instance **/ static size_type shallow_size(const DPrimitive_gco_3_dict_string_gco & self) noexcept; - /** copy instance using allocator **/ - static Opaque shallow_copy(const DPrimitive_gco_3_dict_string_gco & self, obj mm) noexcept; // non-const methods + /** copy instance using allocator **/ + static Opaque shallow_copy(DPrimitive_gco_3_dict_string_gco & self, obj mm) noexcept; /** during GC: forward immdiate children **/ static size_type forward_children(DPrimitive_gco_3_dict_string_gco & self, obj gc) noexcept; ///@} diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp index 1864246d..9e078589 100644 --- a/src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp @@ -22,11 +22,10 @@ namespace xo { } auto - IGCObject_DPrimitive_gco_0::shallow_copy(const DPrimitive_gco_0 & self, obj mm) noexcept -> Opaque + IGCObject_DPrimitive_gco_0::shallow_copy(DPrimitive_gco_0 & self, obj mm) noexcept -> Opaque { return self.shallow_copy(mm); } - auto IGCObject_DPrimitive_gco_0::forward_children(DPrimitive_gco_0 & self, obj gc) noexcept -> size_type { diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp index 6d7205d5..b9a1b354 100644 --- a/src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp @@ -22,11 +22,10 @@ namespace xo { } auto - IGCObject_DPrimitive_gco_1_gco::shallow_copy(const DPrimitive_gco_1_gco & self, obj mm) noexcept -> Opaque + IGCObject_DPrimitive_gco_1_gco::shallow_copy(DPrimitive_gco_1_gco & self, obj mm) noexcept -> Opaque { return self.shallow_copy(mm); } - auto IGCObject_DPrimitive_gco_1_gco::forward_children(DPrimitive_gco_1_gco & self, obj gc) noexcept -> size_type { diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp index ec65d3d0..7bc9965f 100644 --- a/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp @@ -22,11 +22,10 @@ namespace xo { } auto - IGCObject_DPrimitive_gco_2_dict_string::shallow_copy(const DPrimitive_gco_2_dict_string & self, obj mm) noexcept -> Opaque + IGCObject_DPrimitive_gco_2_dict_string::shallow_copy(DPrimitive_gco_2_dict_string & self, obj mm) noexcept -> Opaque { return self.shallow_copy(mm); } - auto IGCObject_DPrimitive_gco_2_dict_string::forward_children(DPrimitive_gco_2_dict_string & self, obj gc) noexcept -> size_type { diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp index b889d0d0..e770888b 100644 --- a/src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp @@ -22,11 +22,10 @@ namespace xo { } auto - IGCObject_DPrimitive_gco_2_gco_gco::shallow_copy(const DPrimitive_gco_2_gco_gco & self, obj mm) noexcept -> Opaque + IGCObject_DPrimitive_gco_2_gco_gco::shallow_copy(DPrimitive_gco_2_gco_gco & self, obj mm) noexcept -> Opaque { return self.shallow_copy(mm); } - auto IGCObject_DPrimitive_gco_2_gco_gco::forward_children(DPrimitive_gco_2_gco_gco & self, obj gc) noexcept -> size_type { diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp index 7b199bd6..f2dd967d 100644 --- a/src/procedure2/facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp @@ -22,11 +22,10 @@ namespace xo { } auto - IGCObject_DPrimitive_gco_3_dict_string_gco::shallow_copy(const DPrimitive_gco_3_dict_string_gco & self, obj mm) noexcept -> Opaque + IGCObject_DPrimitive_gco_3_dict_string_gco::shallow_copy(DPrimitive_gco_3_dict_string_gco & self, obj mm) noexcept -> Opaque { return self.shallow_copy(mm); } - auto IGCObject_DPrimitive_gco_3_dict_string_gco::forward_children(DPrimitive_gco_3_dict_string_gco & self, obj gc) noexcept -> size_type { From 3f2e58db5377ac412850c444f25ba769d321a450 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Sat, 4 Apr 2026 15:00:53 -0400 Subject: [PATCH 79/90] refactor: rename GCObject.shallow_copy -> shallow_move resolve conflict since relying on move constructor in std_copy_for --- include/xo/procedure2/DPrimitive.hpp | 4 ++-- include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp | 4 ++-- .../xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp | 4 ++-- .../detail/IGCObject_DPrimitive_gco_2_dict_string.hpp | 4 ++-- .../procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp | 4 ++-- .../detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp | 4 ++-- src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp | 4 ++-- src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp | 4 ++-- .../facet/IGCObject_DPrimitive_gco_2_dict_string.cpp | 4 ++-- src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp | 4 ++-- .../facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp | 4 ++-- 11 files changed, 22 insertions(+), 22 deletions(-) diff --git a/include/xo/procedure2/DPrimitive.hpp b/include/xo/procedure2/DPrimitive.hpp index 43310575..f602ebb6 100644 --- a/include/xo/procedure2/DPrimitive.hpp +++ b/include/xo/procedure2/DPrimitive.hpp @@ -134,7 +134,7 @@ namespace xo { /** @defgroup scm-primitive-gcobject-facet **/ ///@{ std::size_t shallow_size() const noexcept; - Primitive * shallow_copy(obj mm) const noexcept; + Primitive * shallow_move(obj mm) const noexcept; std::size_t forward_children(obj gc) noexcept; ///@} @@ -198,7 +198,7 @@ namespace xo { template Primitive * - Primitive::shallow_copy(obj mm) const noexcept { + Primitive::shallow_move(obj mm) const noexcept { void * mem = mm.alloc_copy((std::byte *)this); if (mem) { diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp index 6660dad2..cecc298c 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp @@ -54,8 +54,8 @@ namespace xo { static size_type shallow_size(const DPrimitive_gco_0 & self) noexcept; // non-const methods - /** copy instance using allocator **/ - static Opaque shallow_copy(DPrimitive_gco_0 & self, obj mm) noexcept; + /** move instance using allocator **/ + static Opaque shallow_move(DPrimitive_gco_0 & self, obj mm) noexcept; /** during GC: forward immdiate children **/ static size_type forward_children(DPrimitive_gco_0 & self, obj gc) noexcept; ///@} diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp index a4aa56e2..ac5c4f51 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp @@ -54,8 +54,8 @@ namespace xo { static size_type shallow_size(const DPrimitive_gco_1_gco & self) noexcept; // non-const methods - /** copy instance using allocator **/ - static Opaque shallow_copy(DPrimitive_gco_1_gco & self, obj mm) noexcept; + /** move instance using allocator **/ + static Opaque shallow_move(DPrimitive_gco_1_gco & self, obj mm) noexcept; /** during GC: forward immdiate children **/ static size_type forward_children(DPrimitive_gco_1_gco & self, obj gc) noexcept; ///@} diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp index a2e6e32a..772aabb3 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp @@ -54,8 +54,8 @@ namespace xo { static size_type shallow_size(const DPrimitive_gco_2_dict_string & self) noexcept; // non-const methods - /** copy instance using allocator **/ - static Opaque shallow_copy(DPrimitive_gco_2_dict_string & self, obj mm) noexcept; + /** move instance using allocator **/ + static Opaque shallow_move(DPrimitive_gco_2_dict_string & self, obj mm) noexcept; /** during GC: forward immdiate children **/ static size_type forward_children(DPrimitive_gco_2_dict_string & self, obj gc) noexcept; ///@} diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp index bad1200f..266d1f42 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp @@ -54,8 +54,8 @@ namespace xo { static size_type shallow_size(const DPrimitive_gco_2_gco_gco & self) noexcept; // non-const methods - /** copy instance using allocator **/ - static Opaque shallow_copy(DPrimitive_gco_2_gco_gco & self, obj mm) noexcept; + /** move instance using allocator **/ + static Opaque shallow_move(DPrimitive_gco_2_gco_gco & self, obj mm) noexcept; /** during GC: forward immdiate children **/ static size_type forward_children(DPrimitive_gco_2_gco_gco & self, obj gc) noexcept; ///@} diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp index 6b5ddc3b..7abc1367 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp @@ -54,8 +54,8 @@ namespace xo { static size_type shallow_size(const DPrimitive_gco_3_dict_string_gco & self) noexcept; // non-const methods - /** copy instance using allocator **/ - static Opaque shallow_copy(DPrimitive_gco_3_dict_string_gco & self, obj mm) noexcept; + /** move instance using allocator **/ + static Opaque shallow_move(DPrimitive_gco_3_dict_string_gco & self, obj mm) noexcept; /** during GC: forward immdiate children **/ static size_type forward_children(DPrimitive_gco_3_dict_string_gco & self, obj gc) noexcept; ///@} diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp index 9e078589..948d1d60 100644 --- a/src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp @@ -22,9 +22,9 @@ namespace xo { } auto - IGCObject_DPrimitive_gco_0::shallow_copy(DPrimitive_gco_0 & self, obj mm) noexcept -> Opaque + IGCObject_DPrimitive_gco_0::shallow_move(DPrimitive_gco_0 & self, obj mm) noexcept -> Opaque { - return self.shallow_copy(mm); + return self.shallow_move(mm); } auto IGCObject_DPrimitive_gco_0::forward_children(DPrimitive_gco_0 & self, obj gc) noexcept -> size_type diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp index b9a1b354..b5c1754b 100644 --- a/src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp @@ -22,9 +22,9 @@ namespace xo { } auto - IGCObject_DPrimitive_gco_1_gco::shallow_copy(DPrimitive_gco_1_gco & self, obj mm) noexcept -> Opaque + IGCObject_DPrimitive_gco_1_gco::shallow_move(DPrimitive_gco_1_gco & self, obj mm) noexcept -> Opaque { - return self.shallow_copy(mm); + return self.shallow_move(mm); } auto IGCObject_DPrimitive_gco_1_gco::forward_children(DPrimitive_gco_1_gco & self, obj gc) noexcept -> size_type diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp index 7bc9965f..7c58550a 100644 --- a/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp @@ -22,9 +22,9 @@ namespace xo { } auto - IGCObject_DPrimitive_gco_2_dict_string::shallow_copy(DPrimitive_gco_2_dict_string & self, obj mm) noexcept -> Opaque + IGCObject_DPrimitive_gco_2_dict_string::shallow_move(DPrimitive_gco_2_dict_string & self, obj mm) noexcept -> Opaque { - return self.shallow_copy(mm); + return self.shallow_move(mm); } auto IGCObject_DPrimitive_gco_2_dict_string::forward_children(DPrimitive_gco_2_dict_string & self, obj gc) noexcept -> size_type diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp index e770888b..347295b3 100644 --- a/src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp @@ -22,9 +22,9 @@ namespace xo { } auto - IGCObject_DPrimitive_gco_2_gco_gco::shallow_copy(DPrimitive_gco_2_gco_gco & self, obj mm) noexcept -> Opaque + IGCObject_DPrimitive_gco_2_gco_gco::shallow_move(DPrimitive_gco_2_gco_gco & self, obj mm) noexcept -> Opaque { - return self.shallow_copy(mm); + return self.shallow_move(mm); } auto IGCObject_DPrimitive_gco_2_gco_gco::forward_children(DPrimitive_gco_2_gco_gco & self, obj gc) noexcept -> size_type diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp index f2dd967d..26a9f3fd 100644 --- a/src/procedure2/facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp @@ -22,9 +22,9 @@ namespace xo { } auto - IGCObject_DPrimitive_gco_3_dict_string_gco::shallow_copy(DPrimitive_gco_3_dict_string_gco & self, obj mm) noexcept -> Opaque + IGCObject_DPrimitive_gco_3_dict_string_gco::shallow_move(DPrimitive_gco_3_dict_string_gco & self, obj mm) noexcept -> Opaque { - return self.shallow_copy(mm); + return self.shallow_move(mm); } auto IGCObject_DPrimitive_gco_3_dict_string_gco::forward_children(DPrimitive_gco_3_dict_string_gco & self, obj gc) noexcept -> size_type From b4a7a85bfbd711f6b2e8c41db8ab76cf41b4b96e Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Sat, 4 Apr 2026 16:33:35 -0400 Subject: [PATCH 80/90] refactor: rename shallow_copy -> shallow_move + streamline Use RCollector.std_copy_for where appropriate --- include/xo/procedure2/DPrimitive.hpp | 12 +++--------- .../procedure2/detail/IGCObject_DPrimitive_gco_0.hpp | 2 +- .../detail/IGCObject_DPrimitive_gco_1_gco.hpp | 2 +- .../IGCObject_DPrimitive_gco_2_dict_string.hpp | 2 +- .../detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp | 2 +- .../IGCObject_DPrimitive_gco_3_dict_string_gco.hpp | 2 +- src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp | 4 ++-- .../facet/IGCObject_DPrimitive_gco_1_gco.cpp | 4 ++-- .../facet/IGCObject_DPrimitive_gco_2_dict_string.cpp | 4 ++-- .../facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp | 4 ++-- .../IGCObject_DPrimitive_gco_3_dict_string_gco.cpp | 4 ++-- 11 files changed, 18 insertions(+), 24 deletions(-) diff --git a/include/xo/procedure2/DPrimitive.hpp b/include/xo/procedure2/DPrimitive.hpp index f602ebb6..d55e01ee 100644 --- a/include/xo/procedure2/DPrimitive.hpp +++ b/include/xo/procedure2/DPrimitive.hpp @@ -134,7 +134,7 @@ namespace xo { /** @defgroup scm-primitive-gcobject-facet **/ ///@{ std::size_t shallow_size() const noexcept; - Primitive * shallow_move(obj mm) const noexcept; + Primitive * shallow_move(obj gc) noexcept; std::size_t forward_children(obj gc) noexcept; ///@} @@ -198,14 +198,8 @@ namespace xo { template Primitive * - Primitive::shallow_move(obj mm) const noexcept { - void * mem = mm.alloc_copy((std::byte *)this); - - if (mem) { - return new (mem) Primitive(*this); - } - - return nullptr; + Primitive::shallow_move(obj gc) noexcept { + return gc.std_copy_for(this); } template diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp index cecc298c..53c073a4 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp @@ -55,7 +55,7 @@ namespace xo { // non-const methods /** move instance using allocator **/ - static Opaque shallow_move(DPrimitive_gco_0 & self, obj mm) noexcept; + static Opaque shallow_move(DPrimitive_gco_0 & self, obj gc) noexcept; /** during GC: forward immdiate children **/ static size_type forward_children(DPrimitive_gco_0 & self, obj gc) noexcept; ///@} diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp index ac5c4f51..e2dd6381 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp @@ -55,7 +55,7 @@ namespace xo { // non-const methods /** move instance using allocator **/ - static Opaque shallow_move(DPrimitive_gco_1_gco & self, obj mm) noexcept; + static Opaque shallow_move(DPrimitive_gco_1_gco & self, obj gc) noexcept; /** during GC: forward immdiate children **/ static size_type forward_children(DPrimitive_gco_1_gco & self, obj gc) noexcept; ///@} diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp index 772aabb3..c21ab140 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp @@ -55,7 +55,7 @@ namespace xo { // non-const methods /** move instance using allocator **/ - static Opaque shallow_move(DPrimitive_gco_2_dict_string & self, obj mm) noexcept; + static Opaque shallow_move(DPrimitive_gco_2_dict_string & self, obj gc) noexcept; /** during GC: forward immdiate children **/ static size_type forward_children(DPrimitive_gco_2_dict_string & self, obj gc) noexcept; ///@} diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp index 266d1f42..b35e1004 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp @@ -55,7 +55,7 @@ namespace xo { // non-const methods /** move instance using allocator **/ - static Opaque shallow_move(DPrimitive_gco_2_gco_gco & self, obj mm) noexcept; + static Opaque shallow_move(DPrimitive_gco_2_gco_gco & self, obj gc) noexcept; /** during GC: forward immdiate children **/ static size_type forward_children(DPrimitive_gco_2_gco_gco & self, obj gc) noexcept; ///@} diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp index 7abc1367..d0e23e33 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp @@ -55,7 +55,7 @@ namespace xo { // non-const methods /** move instance using allocator **/ - static Opaque shallow_move(DPrimitive_gco_3_dict_string_gco & self, obj mm) noexcept; + static Opaque shallow_move(DPrimitive_gco_3_dict_string_gco & self, obj gc) noexcept; /** during GC: forward immdiate children **/ static size_type forward_children(DPrimitive_gco_3_dict_string_gco & self, obj gc) noexcept; ///@} diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp index 948d1d60..2e0198f5 100644 --- a/src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp @@ -22,9 +22,9 @@ namespace xo { } auto - IGCObject_DPrimitive_gco_0::shallow_move(DPrimitive_gco_0 & self, obj mm) noexcept -> Opaque + IGCObject_DPrimitive_gco_0::shallow_move(DPrimitive_gco_0 & self, obj gc) noexcept -> Opaque { - return self.shallow_move(mm); + return self.shallow_move(gc); } auto IGCObject_DPrimitive_gco_0::forward_children(DPrimitive_gco_0 & self, obj gc) noexcept -> size_type diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp index b5c1754b..2612c887 100644 --- a/src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp @@ -22,9 +22,9 @@ namespace xo { } auto - IGCObject_DPrimitive_gco_1_gco::shallow_move(DPrimitive_gco_1_gco & self, obj mm) noexcept -> Opaque + IGCObject_DPrimitive_gco_1_gco::shallow_move(DPrimitive_gco_1_gco & self, obj gc) noexcept -> Opaque { - return self.shallow_move(mm); + return self.shallow_move(gc); } auto IGCObject_DPrimitive_gco_1_gco::forward_children(DPrimitive_gco_1_gco & self, obj gc) noexcept -> size_type diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp index 7c58550a..6173f6ca 100644 --- a/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp @@ -22,9 +22,9 @@ namespace xo { } auto - IGCObject_DPrimitive_gco_2_dict_string::shallow_move(DPrimitive_gco_2_dict_string & self, obj mm) noexcept -> Opaque + IGCObject_DPrimitive_gco_2_dict_string::shallow_move(DPrimitive_gco_2_dict_string & self, obj gc) noexcept -> Opaque { - return self.shallow_move(mm); + return self.shallow_move(gc); } auto IGCObject_DPrimitive_gco_2_dict_string::forward_children(DPrimitive_gco_2_dict_string & self, obj gc) noexcept -> size_type diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp index 347295b3..ab7cc1be 100644 --- a/src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp @@ -22,9 +22,9 @@ namespace xo { } auto - IGCObject_DPrimitive_gco_2_gco_gco::shallow_move(DPrimitive_gco_2_gco_gco & self, obj mm) noexcept -> Opaque + IGCObject_DPrimitive_gco_2_gco_gco::shallow_move(DPrimitive_gco_2_gco_gco & self, obj gc) noexcept -> Opaque { - return self.shallow_move(mm); + return self.shallow_move(gc); } auto IGCObject_DPrimitive_gco_2_gco_gco::forward_children(DPrimitive_gco_2_gco_gco & self, obj gc) noexcept -> size_type diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp index 26a9f3fd..4134581c 100644 --- a/src/procedure2/facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp @@ -22,9 +22,9 @@ namespace xo { } auto - IGCObject_DPrimitive_gco_3_dict_string_gco::shallow_move(DPrimitive_gco_3_dict_string_gco & self, obj mm) noexcept -> Opaque + IGCObject_DPrimitive_gco_3_dict_string_gco::shallow_move(DPrimitive_gco_3_dict_string_gco & self, obj gc) noexcept -> Opaque { - return self.shallow_move(mm); + return self.shallow_move(gc); } auto IGCObject_DPrimitive_gco_3_dict_string_gco::forward_children(DPrimitive_gco_3_dict_string_gco & self, obj gc) noexcept -> size_type From f82c16321086aca2ddf25451f79cf6632265b2a9 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Sat, 4 Apr 2026 16:37:17 -0400 Subject: [PATCH 81/90] refactor: rename RCollector.std_copy_for -> std_move_for --- include/xo/procedure2/DPrimitive.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/xo/procedure2/DPrimitive.hpp b/include/xo/procedure2/DPrimitive.hpp index d55e01ee..0c386a50 100644 --- a/include/xo/procedure2/DPrimitive.hpp +++ b/include/xo/procedure2/DPrimitive.hpp @@ -199,7 +199,7 @@ namespace xo { template Primitive * Primitive::shallow_move(obj gc) noexcept { - return gc.std_copy_for(this); + return gc.std_move_for(this); } template From 1bad724e481b782ab34c515528b074029a4f5918 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Sat, 4 Apr 2026 16:54:46 -0400 Subject: [PATCH 82/90] refactor: void return type for Collector.forward_children() --- include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp | 2 +- .../xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp | 2 +- .../detail/IGCObject_DPrimitive_gco_2_dict_string.hpp | 2 +- .../procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp | 2 +- .../detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp | 2 +- src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp | 4 ++-- src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp | 4 ++-- .../facet/IGCObject_DPrimitive_gco_2_dict_string.cpp | 4 ++-- src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp | 4 ++-- .../facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp | 4 ++-- 10 files changed, 15 insertions(+), 15 deletions(-) diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp index 53c073a4..0b6b6e1c 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp @@ -57,7 +57,7 @@ namespace xo { /** move instance using allocator **/ static Opaque shallow_move(DPrimitive_gco_0 & self, obj gc) noexcept; /** during GC: forward immdiate children **/ - static size_type forward_children(DPrimitive_gco_0 & self, obj gc) noexcept; + static void forward_children(DPrimitive_gco_0 & self, obj gc) noexcept; ///@} }; diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp index e2dd6381..1536f0a9 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp @@ -57,7 +57,7 @@ namespace xo { /** move instance using allocator **/ static Opaque shallow_move(DPrimitive_gco_1_gco & self, obj gc) noexcept; /** during GC: forward immdiate children **/ - static size_type forward_children(DPrimitive_gco_1_gco & self, obj gc) noexcept; + static void forward_children(DPrimitive_gco_1_gco & self, obj gc) noexcept; ///@} }; diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp index c21ab140..b971bd46 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp @@ -57,7 +57,7 @@ namespace xo { /** move instance using allocator **/ static Opaque shallow_move(DPrimitive_gco_2_dict_string & self, obj gc) noexcept; /** during GC: forward immdiate children **/ - static size_type forward_children(DPrimitive_gco_2_dict_string & self, obj gc) noexcept; + static void forward_children(DPrimitive_gco_2_dict_string & self, obj gc) noexcept; ///@} }; diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp index b35e1004..e8f709b2 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp @@ -57,7 +57,7 @@ namespace xo { /** move instance using allocator **/ static Opaque shallow_move(DPrimitive_gco_2_gco_gco & self, obj gc) noexcept; /** during GC: forward immdiate children **/ - static size_type forward_children(DPrimitive_gco_2_gco_gco & self, obj gc) noexcept; + static void forward_children(DPrimitive_gco_2_gco_gco & self, obj gc) noexcept; ///@} }; diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp index d0e23e33..c4a87ace 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp @@ -57,7 +57,7 @@ namespace xo { /** move instance using allocator **/ static Opaque shallow_move(DPrimitive_gco_3_dict_string_gco & self, obj gc) noexcept; /** during GC: forward immdiate children **/ - static size_type forward_children(DPrimitive_gco_3_dict_string_gco & self, obj gc) noexcept; + static void forward_children(DPrimitive_gco_3_dict_string_gco & self, obj gc) noexcept; ///@} }; diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp index 2e0198f5..170b5f2c 100644 --- a/src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp @@ -27,9 +27,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DPrimitive_gco_0::forward_children(DPrimitive_gco_0 & self, obj gc) noexcept -> size_type + IGCObject_DPrimitive_gco_0::forward_children(DPrimitive_gco_0 & self, obj gc) noexcept -> void { - return self.forward_children(gc); + self.forward_children(gc); } } /*namespace scm*/ diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp index 2612c887..77979f20 100644 --- a/src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp @@ -27,9 +27,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DPrimitive_gco_1_gco::forward_children(DPrimitive_gco_1_gco & self, obj gc) noexcept -> size_type + IGCObject_DPrimitive_gco_1_gco::forward_children(DPrimitive_gco_1_gco & self, obj gc) noexcept -> void { - return self.forward_children(gc); + self.forward_children(gc); } } /*namespace scm*/ diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp index 6173f6ca..0c423e7e 100644 --- a/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp @@ -27,9 +27,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DPrimitive_gco_2_dict_string::forward_children(DPrimitive_gco_2_dict_string & self, obj gc) noexcept -> size_type + IGCObject_DPrimitive_gco_2_dict_string::forward_children(DPrimitive_gco_2_dict_string & self, obj gc) noexcept -> void { - return self.forward_children(gc); + self.forward_children(gc); } } /*namespace scm*/ diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp index ab7cc1be..b7ed3c99 100644 --- a/src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp @@ -27,9 +27,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DPrimitive_gco_2_gco_gco::forward_children(DPrimitive_gco_2_gco_gco & self, obj gc) noexcept -> size_type + IGCObject_DPrimitive_gco_2_gco_gco::forward_children(DPrimitive_gco_2_gco_gco & self, obj gc) noexcept -> void { - return self.forward_children(gc); + self.forward_children(gc); } } /*namespace scm*/ diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp index 4134581c..9a43c8ce 100644 --- a/src/procedure2/facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp @@ -27,9 +27,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DPrimitive_gco_3_dict_string_gco::forward_children(DPrimitive_gco_3_dict_string_gco & self, obj gc) noexcept -> size_type + IGCObject_DPrimitive_gco_3_dict_string_gco::forward_children(DPrimitive_gco_3_dict_string_gco & self, obj gc) noexcept -> void { - return self.forward_children(gc); + self.forward_children(gc); } } /*namespace scm*/ From f7ffc553bfcb39fac9004cbddfddd9584687397d Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Sat, 4 Apr 2026 17:30:03 -0400 Subject: [PATCH 83/90] refactor: retire GCObject.shallow_size() Not needed. Rely on size stored in gc-owned object header --- include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp | 2 -- .../xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp | 2 -- .../detail/IGCObject_DPrimitive_gco_2_dict_string.hpp | 2 -- .../detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp | 2 -- .../detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp | 2 -- src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp | 6 ------ src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp | 6 ------ .../facet/IGCObject_DPrimitive_gco_2_dict_string.cpp | 6 ------ src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp | 6 ------ .../facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp | 6 ------ 10 files changed, 40 deletions(-) diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp index 0b6b6e1c..a8b25c9b 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp @@ -50,8 +50,6 @@ namespace xo { /** @defgroup scm-gcobject-dprimitive_gco_0-methods **/ ///@{ // const methods - /** memory consumption for this instance **/ - static size_type shallow_size(const DPrimitive_gco_0 & self) noexcept; // non-const methods /** move instance using allocator **/ diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp index 1536f0a9..89c13e30 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp @@ -50,8 +50,6 @@ namespace xo { /** @defgroup scm-gcobject-dprimitive_gco_1_gco-methods **/ ///@{ // const methods - /** memory consumption for this instance **/ - static size_type shallow_size(const DPrimitive_gco_1_gco & self) noexcept; // non-const methods /** move instance using allocator **/ diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp index b971bd46..24dc8775 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp @@ -50,8 +50,6 @@ namespace xo { /** @defgroup scm-gcobject-dprimitive_gco_2_dict_string-methods **/ ///@{ // const methods - /** memory consumption for this instance **/ - static size_type shallow_size(const DPrimitive_gco_2_dict_string & self) noexcept; // non-const methods /** move instance using allocator **/ diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp index e8f709b2..51db4ff8 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp @@ -50,8 +50,6 @@ namespace xo { /** @defgroup scm-gcobject-dprimitive_gco_2_gco_gco-methods **/ ///@{ // const methods - /** memory consumption for this instance **/ - static size_type shallow_size(const DPrimitive_gco_2_gco_gco & self) noexcept; // non-const methods /** move instance using allocator **/ diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp index c4a87ace..81e0b418 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp @@ -50,8 +50,6 @@ namespace xo { /** @defgroup scm-gcobject-dprimitive_gco_3_dict_string_gco-methods **/ ///@{ // const methods - /** memory consumption for this instance **/ - static size_type shallow_size(const DPrimitive_gco_3_dict_string_gco & self) noexcept; // non-const methods /** move instance using allocator **/ diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp index 170b5f2c..24a68f64 100644 --- a/src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp @@ -15,12 +15,6 @@ namespace xo { namespace scm { - auto - IGCObject_DPrimitive_gco_0::shallow_size(const DPrimitive_gco_0 & self) noexcept -> size_type - { - return self.shallow_size(); - } - auto IGCObject_DPrimitive_gco_0::shallow_move(DPrimitive_gco_0 & self, obj gc) noexcept -> Opaque { diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp index 77979f20..9d411bf9 100644 --- a/src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp @@ -15,12 +15,6 @@ namespace xo { namespace scm { - auto - IGCObject_DPrimitive_gco_1_gco::shallow_size(const DPrimitive_gco_1_gco & self) noexcept -> size_type - { - return self.shallow_size(); - } - auto IGCObject_DPrimitive_gco_1_gco::shallow_move(DPrimitive_gco_1_gco & self, obj gc) noexcept -> Opaque { diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp index 0c423e7e..32c43775 100644 --- a/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp @@ -15,12 +15,6 @@ namespace xo { namespace scm { - auto - IGCObject_DPrimitive_gco_2_dict_string::shallow_size(const DPrimitive_gco_2_dict_string & self) noexcept -> size_type - { - return self.shallow_size(); - } - auto IGCObject_DPrimitive_gco_2_dict_string::shallow_move(DPrimitive_gco_2_dict_string & self, obj gc) noexcept -> Opaque { diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp index b7ed3c99..281c426e 100644 --- a/src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp @@ -15,12 +15,6 @@ namespace xo { namespace scm { - auto - IGCObject_DPrimitive_gco_2_gco_gco::shallow_size(const DPrimitive_gco_2_gco_gco & self) noexcept -> size_type - { - return self.shallow_size(); - } - auto IGCObject_DPrimitive_gco_2_gco_gco::shallow_move(DPrimitive_gco_2_gco_gco & self, obj gc) noexcept -> Opaque { diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp index 9a43c8ce..b15cc565 100644 --- a/src/procedure2/facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp @@ -15,12 +15,6 @@ namespace xo { namespace scm { - auto - IGCObject_DPrimitive_gco_3_dict_string_gco::shallow_size(const DPrimitive_gco_3_dict_string_gco & self) noexcept -> size_type - { - return self.shallow_size(); - } - auto IGCObject_DPrimitive_gco_3_dict_string_gco::shallow_move(DPrimitive_gco_3_dict_string_gco & self, obj gc) noexcept -> Opaque { From 52fbf801ab8ea7a8d56f50cc70d0618ca1e93bab Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Sat, 4 Apr 2026 18:01:25 -0400 Subject: [PATCH 84/90] refactor: retire GCObject.shallow_copy() Collector gets this info from gc-owned object header --- include/xo/procedure2/DPrimitive.hpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/include/xo/procedure2/DPrimitive.hpp b/include/xo/procedure2/DPrimitive.hpp index 0c386a50..6463ccd8 100644 --- a/include/xo/procedure2/DPrimitive.hpp +++ b/include/xo/procedure2/DPrimitive.hpp @@ -133,9 +133,8 @@ namespace xo { ///@} /** @defgroup scm-primitive-gcobject-facet **/ ///@{ - std::size_t shallow_size() const noexcept; Primitive * shallow_move(obj gc) noexcept; - std::size_t forward_children(obj gc) noexcept; + void forward_children(obj gc) noexcept; ///@} private: @@ -190,12 +189,6 @@ namespace xo { refrtag("fn", fn_)); } - template - std::size_t - Primitive::shallow_size() const noexcept { - return sizeof(*this); - } - template Primitive * Primitive::shallow_move(obj gc) noexcept { @@ -203,14 +196,12 @@ namespace xo { } template - std::size_t + void Primitive::forward_children(obj gc) noexcept { { auto e = type_.to_facet(); // FacetRegistry dep gc.forward_inplace(e.iface(), (void **)&(type_.data_)); } - - return this->shallow_size(); } } /*namespace scm*/ From 8fe1871094cd168455481b7de853d621db32b34c Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Sun, 5 Apr 2026 23:53:02 -0400 Subject: [PATCH 85/90] refactor: + narrower interface for gc pointer forwarding add AGCObjectVisitor, instead of requiring ACollector. --- include/xo/procedure2/DPrimitive.hpp | 17 ++++++++++------- .../detail/IGCObject_DPrimitive_gco_0.hpp | 7 +++++-- .../detail/IGCObject_DPrimitive_gco_1_gco.hpp | 7 +++++-- .../IGCObject_DPrimitive_gco_2_dict_string.hpp | 7 +++++-- .../IGCObject_DPrimitive_gco_2_gco_gco.hpp | 7 +++++-- ...CObject_DPrimitive_gco_3_dict_string_gco.hpp | 7 +++++-- .../facet/IGCObject_DPrimitive_gco_0.cpp | 4 ++-- .../facet/IGCObject_DPrimitive_gco_1_gco.cpp | 4 ++-- .../IGCObject_DPrimitive_gco_2_dict_string.cpp | 4 ++-- .../IGCObject_DPrimitive_gco_2_gco_gco.cpp | 4 ++-- ...CObject_DPrimitive_gco_3_dict_string_gco.cpp | 4 ++-- 11 files changed, 45 insertions(+), 27 deletions(-) diff --git a/include/xo/procedure2/DPrimitive.hpp b/include/xo/procedure2/DPrimitive.hpp index 6463ccd8..f0e1b5e8 100644 --- a/include/xo/procedure2/DPrimitive.hpp +++ b/include/xo/procedure2/DPrimitive.hpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -76,8 +77,9 @@ namespace xo { using Traits = detail::PmFnTraits; using ACollector = xo::mm::ACollector; - using AAllocator = xo::mm::AAllocator; using AGCObject = xo::mm::AGCObject; + using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using AAllocator = xo::mm::AAllocator; using DArray = xo::scm::DArray; using Reflect = xo::reflect::Reflect; using TypeDescr = xo::reflect::TypeDescr; @@ -134,7 +136,7 @@ namespace xo { /** @defgroup scm-primitive-gcobject-facet **/ ///@{ Primitive * shallow_move(obj gc) noexcept; - void forward_children(obj gc) noexcept; + void visit_gco_children(obj gc) noexcept; ///@} private: @@ -197,11 +199,12 @@ namespace xo { template void - Primitive::forward_children(obj gc) noexcept { - { - auto e = type_.to_facet(); // FacetRegistry dep - gc.forward_inplace(e.iface(), (void **)&(type_.data_)); - } + Primitive::visit_gco_children(obj gc) noexcept { + gc.visit_poly_child(&type_); + //{ + // auto e = type_.to_facet(); // FacetRegistry dep + // gc.forward_inplace(e.iface(), (void **)&(type_.data_)); + //} } } /*namespace scm*/ diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp index a8b25c9b..9d4d338c 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp @@ -44,6 +44,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -54,8 +55,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DPrimitive_gco_0 & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DPrimitive_gco_0 & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DPrimitive_gco_0 & self, obj fn) noexcept; ///@} }; diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp index 89c13e30..6b3e9992 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp @@ -44,6 +44,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -54,8 +55,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DPrimitive_gco_1_gco & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DPrimitive_gco_1_gco & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DPrimitive_gco_1_gco & self, obj fn) noexcept; ///@} }; diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp index 24dc8775..d54fc0b7 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp @@ -44,6 +44,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -54,8 +55,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DPrimitive_gco_2_dict_string & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DPrimitive_gco_2_dict_string & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DPrimitive_gco_2_dict_string & self, obj fn) noexcept; ///@} }; diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp index 51db4ff8..eba31977 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp @@ -44,6 +44,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -54,8 +55,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DPrimitive_gco_2_gco_gco & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DPrimitive_gco_2_gco_gco & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DPrimitive_gco_2_gco_gco & self, obj fn) noexcept; ///@} }; diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp index 81e0b418..09f9c35c 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp @@ -44,6 +44,7 @@ namespace xo { using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; + using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -54,8 +55,10 @@ namespace xo { // non-const methods /** move instance using allocator **/ static Opaque shallow_move(DPrimitive_gco_3_dict_string_gco & self, obj gc) noexcept; - /** during GC: forward immdiate children **/ - static void forward_children(DPrimitive_gco_3_dict_string_gco & self, obj gc) noexcept; + /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. +Context: provides address of data pointer so it can be updated in place +when @p fn invokes garbage collector reentry point **/ + static void visit_gco_children(DPrimitive_gco_3_dict_string_gco & self, obj fn) noexcept; ///@} }; diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp index 24a68f64..0819f51e 100644 --- a/src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DPrimitive_gco_0::forward_children(DPrimitive_gco_0 & self, obj gc) noexcept -> void + IGCObject_DPrimitive_gco_0::visit_gco_children(DPrimitive_gco_0 & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp index 9d411bf9..7561d167 100644 --- a/src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DPrimitive_gco_1_gco::forward_children(DPrimitive_gco_1_gco & self, obj gc) noexcept -> void + IGCObject_DPrimitive_gco_1_gco::visit_gco_children(DPrimitive_gco_1_gco & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp index 32c43775..522cba9b 100644 --- a/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DPrimitive_gco_2_dict_string::forward_children(DPrimitive_gco_2_dict_string & self, obj gc) noexcept -> void + IGCObject_DPrimitive_gco_2_dict_string::visit_gco_children(DPrimitive_gco_2_dict_string & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp index 281c426e..6f7de390 100644 --- a/src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DPrimitive_gco_2_gco_gco::forward_children(DPrimitive_gco_2_gco_gco & self, obj gc) noexcept -> void + IGCObject_DPrimitive_gco_2_gco_gco::visit_gco_children(DPrimitive_gco_2_gco_gco & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp index b15cc565..aa6c85c0 100644 --- a/src/procedure2/facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp @@ -21,9 +21,9 @@ namespace xo { return self.shallow_move(gc); } auto - IGCObject_DPrimitive_gco_3_dict_string_gco::forward_children(DPrimitive_gco_3_dict_string_gco & self, obj gc) noexcept -> void + IGCObject_DPrimitive_gco_3_dict_string_gco::visit_gco_children(DPrimitive_gco_3_dict_string_gco & self, obj fn) noexcept -> void { - self.forward_children(gc); + self.visit_gco_children(fn); } } /*namespace scm*/ From 15e090252286fa774ad5d0b01062ccf9d25bc05d Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Mon, 6 Apr 2026 00:11:08 -0400 Subject: [PATCH 86/90] refactor: make shallow_move() available from AGCObjectVisitor --- include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp | 2 +- include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp | 2 +- .../detail/IGCObject_DPrimitive_gco_2_dict_string.hpp | 2 +- .../xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp | 2 +- .../detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp index 9d4d338c..4fa87f2d 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp @@ -53,7 +53,7 @@ namespace xo { // const methods // non-const methods - /** move instance using allocator **/ + /** move instance using collector **/ static Opaque shallow_move(DPrimitive_gco_0 & self, obj gc) noexcept; /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. Context: provides address of data pointer so it can be updated in place diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp index 6b3e9992..9b87a837 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp @@ -53,7 +53,7 @@ namespace xo { // const methods // non-const methods - /** move instance using allocator **/ + /** move instance using collector **/ static Opaque shallow_move(DPrimitive_gco_1_gco & self, obj gc) noexcept; /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. Context: provides address of data pointer so it can be updated in place diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp index d54fc0b7..85dda05b 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp @@ -53,7 +53,7 @@ namespace xo { // const methods // non-const methods - /** move instance using allocator **/ + /** move instance using collector **/ static Opaque shallow_move(DPrimitive_gco_2_dict_string & self, obj gc) noexcept; /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. Context: provides address of data pointer so it can be updated in place diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp index eba31977..4acfd814 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp @@ -53,7 +53,7 @@ namespace xo { // const methods // non-const methods - /** move instance using allocator **/ + /** move instance using collector **/ static Opaque shallow_move(DPrimitive_gco_2_gco_gco & self, obj gc) noexcept; /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. Context: provides address of data pointer so it can be updated in place diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp index 09f9c35c..0a23e793 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp @@ -53,7 +53,7 @@ namespace xo { // const methods // non-const methods - /** move instance using allocator **/ + /** move instance using collector **/ static Opaque shallow_move(DPrimitive_gco_3_dict_string_gco & self, obj gc) noexcept; /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. Context: provides address of data pointer so it can be updated in place From 6188b6398b71c4829d526deac3c85e7c780fa9a9 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Mon, 6 Apr 2026 15:21:48 -0400 Subject: [PATCH 87/90] refactor: use GCObjectVisitor api w/ gco_shallow_move --- idl/Procedure.json5 | 2 +- idl/RuntimeContext.json5 | 1 + include/xo/procedure2/DPrimitive.hpp | 6 +++--- include/xo/procedure2/detail/ARuntimeContext.hpp | 1 + include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp | 5 +++-- .../xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp | 5 +++-- .../detail/IGCObject_DPrimitive_gco_2_dict_string.hpp | 5 +++-- .../detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp | 5 +++-- .../detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp | 5 +++-- include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp | 1 + src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp | 4 ++-- src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp | 4 ++-- .../facet/IGCObject_DPrimitive_gco_2_dict_string.cpp | 4 ++-- src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp | 4 ++-- .../facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp | 4 ++-- 15 files changed, 32 insertions(+), 24 deletions(-) diff --git a/idl/Procedure.json5 b/idl/Procedure.json5 index e73c6d87..25e1fed7 100644 --- a/idl/Procedure.json5 +++ b/idl/Procedure.json5 @@ -17,7 +17,7 @@ ], namespace1: "xo", namespace2: "scm", - // text after includes, before ASyntaxStateMachine + // text after includes, before AProcedure pretext: [ //"namespace xo { namespace scm { class ARuntimeContext; } }", "namespace xo { namespace scm { class DArray; } }", diff --git a/idl/RuntimeContext.json5 b/idl/RuntimeContext.json5 index 8736f38d..fd829e6d 100644 --- a/idl/RuntimeContext.json5 +++ b/idl/RuntimeContext.json5 @@ -7,6 +7,7 @@ includes: [ "", "", + "", "" ], // extra includes in RuntimeContext.hpp, if any diff --git a/include/xo/procedure2/DPrimitive.hpp b/include/xo/procedure2/DPrimitive.hpp index f0e1b5e8..37798319 100644 --- a/include/xo/procedure2/DPrimitive.hpp +++ b/include/xo/procedure2/DPrimitive.hpp @@ -76,7 +76,7 @@ namespace xo { using FunctionPtrType = Fn; using Traits = detail::PmFnTraits; - using ACollector = xo::mm::ACollector; + //using ACollector = xo::mm::ACollector; using AGCObject = xo::mm::AGCObject; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; using AAllocator = xo::mm::AAllocator; @@ -135,7 +135,7 @@ namespace xo { ///@} /** @defgroup scm-primitive-gcobject-facet **/ ///@{ - Primitive * shallow_move(obj gc) noexcept; + Primitive * gco_shallow_move(obj gc) noexcept; void visit_gco_children(obj gc) noexcept; ///@} @@ -193,7 +193,7 @@ namespace xo { template Primitive * - Primitive::shallow_move(obj gc) noexcept { + Primitive::gco_shallow_move(obj gc) noexcept { return gc.std_move_for(this); } diff --git a/include/xo/procedure2/detail/ARuntimeContext.hpp b/include/xo/procedure2/detail/ARuntimeContext.hpp index c9da6d6e..a6d6d4c3 100644 --- a/include/xo/procedure2/detail/ARuntimeContext.hpp +++ b/include/xo/procedure2/detail/ARuntimeContext.hpp @@ -16,6 +16,7 @@ // includes (via {facet_includes}) #include #include +#include #include #include #include diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp index 4fa87f2d..beca0850 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp @@ -53,8 +53,9 @@ namespace xo { // const methods // non-const methods - /** move instance using collector **/ - static Opaque shallow_move(DPrimitive_gco_0 & self, obj gc) noexcept; + /** move instance using object visitor. +Arguably abusing the word 'visitor' here **/ + static Opaque gco_shallow_move(DPrimitive_gco_0 & self, obj gc) noexcept; /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. Context: provides address of data pointer so it can be updated in place when @p fn invokes garbage collector reentry point **/ diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp index 9b87a837..3092e52f 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp @@ -53,8 +53,9 @@ namespace xo { // const methods // non-const methods - /** move instance using collector **/ - static Opaque shallow_move(DPrimitive_gco_1_gco & self, obj gc) noexcept; + /** move instance using object visitor. +Arguably abusing the word 'visitor' here **/ + static Opaque gco_shallow_move(DPrimitive_gco_1_gco & self, obj gc) noexcept; /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. Context: provides address of data pointer so it can be updated in place when @p fn invokes garbage collector reentry point **/ diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp index 85dda05b..1fca4b6c 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp @@ -53,8 +53,9 @@ namespace xo { // const methods // non-const methods - /** move instance using collector **/ - static Opaque shallow_move(DPrimitive_gco_2_dict_string & self, obj gc) noexcept; + /** move instance using object visitor. +Arguably abusing the word 'visitor' here **/ + static Opaque gco_shallow_move(DPrimitive_gco_2_dict_string & self, obj gc) noexcept; /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. Context: provides address of data pointer so it can be updated in place when @p fn invokes garbage collector reentry point **/ diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp index 4acfd814..14e66c34 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp @@ -53,8 +53,9 @@ namespace xo { // const methods // non-const methods - /** move instance using collector **/ - static Opaque shallow_move(DPrimitive_gco_2_gco_gco & self, obj gc) noexcept; + /** move instance using object visitor. +Arguably abusing the word 'visitor' here **/ + static Opaque gco_shallow_move(DPrimitive_gco_2_gco_gco & self, obj gc) noexcept; /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. Context: provides address of data pointer so it can be updated in place when @p fn invokes garbage collector reentry point **/ diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp index 0a23e793..994682cd 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp @@ -53,8 +53,9 @@ namespace xo { // const methods // non-const methods - /** move instance using collector **/ - static Opaque shallow_move(DPrimitive_gco_3_dict_string_gco & self, obj gc) noexcept; + /** move instance using object visitor. +Arguably abusing the word 'visitor' here **/ + static Opaque gco_shallow_move(DPrimitive_gco_3_dict_string_gco & self, obj gc) noexcept; /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. Context: provides address of data pointer so it can be updated in place when @p fn invokes garbage collector reentry point **/ diff --git a/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp b/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp index d1a8e8c7..07b30748 100644 --- a/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp +++ b/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp @@ -15,6 +15,7 @@ #include #include +#include #include namespace xo { diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp index 0819f51e..150adfd8 100644 --- a/src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp @@ -16,9 +16,9 @@ namespace xo { namespace scm { auto - IGCObject_DPrimitive_gco_0::shallow_move(DPrimitive_gco_0 & self, obj gc) noexcept -> Opaque + IGCObject_DPrimitive_gco_0::gco_shallow_move(DPrimitive_gco_0 & self, obj gc) noexcept -> Opaque { - return self.shallow_move(gc); + return self.gco_shallow_move(gc); } auto IGCObject_DPrimitive_gco_0::visit_gco_children(DPrimitive_gco_0 & self, obj fn) noexcept -> void diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp index 7561d167..202389d0 100644 --- a/src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp @@ -16,9 +16,9 @@ namespace xo { namespace scm { auto - IGCObject_DPrimitive_gco_1_gco::shallow_move(DPrimitive_gco_1_gco & self, obj gc) noexcept -> Opaque + IGCObject_DPrimitive_gco_1_gco::gco_shallow_move(DPrimitive_gco_1_gco & self, obj gc) noexcept -> Opaque { - return self.shallow_move(gc); + return self.gco_shallow_move(gc); } auto IGCObject_DPrimitive_gco_1_gco::visit_gco_children(DPrimitive_gco_1_gco & self, obj fn) noexcept -> void diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp index 522cba9b..c9b4717b 100644 --- a/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp @@ -16,9 +16,9 @@ namespace xo { namespace scm { auto - IGCObject_DPrimitive_gco_2_dict_string::shallow_move(DPrimitive_gco_2_dict_string & self, obj gc) noexcept -> Opaque + IGCObject_DPrimitive_gco_2_dict_string::gco_shallow_move(DPrimitive_gco_2_dict_string & self, obj gc) noexcept -> Opaque { - return self.shallow_move(gc); + return self.gco_shallow_move(gc); } auto IGCObject_DPrimitive_gco_2_dict_string::visit_gco_children(DPrimitive_gco_2_dict_string & self, obj fn) noexcept -> void diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp index 6f7de390..65851b1f 100644 --- a/src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp @@ -16,9 +16,9 @@ namespace xo { namespace scm { auto - IGCObject_DPrimitive_gco_2_gco_gco::shallow_move(DPrimitive_gco_2_gco_gco & self, obj gc) noexcept -> Opaque + IGCObject_DPrimitive_gco_2_gco_gco::gco_shallow_move(DPrimitive_gco_2_gco_gco & self, obj gc) noexcept -> Opaque { - return self.shallow_move(gc); + return self.gco_shallow_move(gc); } auto IGCObject_DPrimitive_gco_2_gco_gco::visit_gco_children(DPrimitive_gco_2_gco_gco & self, obj fn) noexcept -> void diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp index aa6c85c0..89be54af 100644 --- a/src/procedure2/facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp @@ -16,9 +16,9 @@ namespace xo { namespace scm { auto - IGCObject_DPrimitive_gco_3_dict_string_gco::shallow_move(DPrimitive_gco_3_dict_string_gco & self, obj gc) noexcept -> Opaque + IGCObject_DPrimitive_gco_3_dict_string_gco::gco_shallow_move(DPrimitive_gco_3_dict_string_gco & self, obj gc) noexcept -> Opaque { - return self.shallow_move(gc); + return self.gco_shallow_move(gc); } auto IGCObject_DPrimitive_gco_3_dict_string_gco::visit_gco_children(DPrimitive_gco_3_dict_string_gco & self, obj fn) noexcept -> void From 694332a36c649e71b2ed86d4631c38f85d959493 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Fri, 10 Apr 2026 01:10:03 -0400 Subject: [PATCH 88/90] xo-interpreter2 stack: + reason arg to visit_gco_children() Helps streamline DX1Collector in xo-gc/. Want both forward and verify entry points for the same representation. --- include/xo/procedure2/DPrimitive.hpp | 10 +++++----- .../procedure2/detail/IGCObject_DPrimitive_gco_0.hpp | 3 ++- .../detail/IGCObject_DPrimitive_gco_1_gco.hpp | 3 ++- .../detail/IGCObject_DPrimitive_gco_2_dict_string.hpp | 3 ++- .../detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp | 3 ++- .../IGCObject_DPrimitive_gco_3_dict_string_gco.hpp | 3 ++- src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp | 4 ++-- .../facet/IGCObject_DPrimitive_gco_1_gco.cpp | 4 ++-- .../facet/IGCObject_DPrimitive_gco_2_dict_string.cpp | 4 ++-- .../facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp | 4 ++-- .../IGCObject_DPrimitive_gco_3_dict_string_gco.cpp | 4 ++-- 11 files changed, 25 insertions(+), 20 deletions(-) diff --git a/include/xo/procedure2/DPrimitive.hpp b/include/xo/procedure2/DPrimitive.hpp index 37798319..a5b01251 100644 --- a/include/xo/procedure2/DPrimitive.hpp +++ b/include/xo/procedure2/DPrimitive.hpp @@ -75,10 +75,9 @@ namespace xo { public: using FunctionPtrType = Fn; using Traits = detail::PmFnTraits; - - //using ACollector = xo::mm::ACollector; using AGCObject = xo::mm::AGCObject; using AGCObjectVisitor = xo::mm::AGCObjectVisitor; + using VisitReason = xo::mm::VisitReason; using AAllocator = xo::mm::AAllocator; using DArray = xo::scm::DArray; using Reflect = xo::reflect::Reflect; @@ -136,7 +135,7 @@ namespace xo { /** @defgroup scm-primitive-gcobject-facet **/ ///@{ Primitive * gco_shallow_move(obj gc) noexcept; - void visit_gco_children(obj gc) noexcept; + void visit_gco_children(VisitReason reason, obj gc) noexcept; ///@} private: @@ -199,8 +198,9 @@ namespace xo { template void - Primitive::visit_gco_children(obj gc) noexcept { - gc.visit_poly_child(&type_); + Primitive::visit_gco_children(xo::mm::VisitReason reason, + obj gc) noexcept { + gc.visit_poly_child(reason, &type_); //{ // auto e = type_.to_facet(); // FacetRegistry dep // gc.forward_inplace(e.iface(), (void **)&(type_.data_)); diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp index beca0850..63986f85 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp @@ -45,6 +45,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -59,7 +60,7 @@ Arguably abusing the word 'visitor' here **/ /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. Context: provides address of data pointer so it can be updated in place when @p fn invokes garbage collector reentry point **/ - static void visit_gco_children(DPrimitive_gco_0 & self, obj fn) noexcept; + static void visit_gco_children(DPrimitive_gco_0 & self, VisitReason reason, obj fn) noexcept; ///@} }; diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp index 3092e52f..c15dedb4 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp @@ -45,6 +45,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -59,7 +60,7 @@ Arguably abusing the word 'visitor' here **/ /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. Context: provides address of data pointer so it can be updated in place when @p fn invokes garbage collector reentry point **/ - static void visit_gco_children(DPrimitive_gco_1_gco & self, obj fn) noexcept; + static void visit_gco_children(DPrimitive_gco_1_gco & self, VisitReason reason, obj fn) noexcept; ///@} }; diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp index 1fca4b6c..6cc1754d 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp @@ -45,6 +45,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -59,7 +60,7 @@ Arguably abusing the word 'visitor' here **/ /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. Context: provides address of data pointer so it can be updated in place when @p fn invokes garbage collector reentry point **/ - static void visit_gco_children(DPrimitive_gco_2_dict_string & self, obj fn) noexcept; + static void visit_gco_children(DPrimitive_gco_2_dict_string & self, VisitReason reason, obj fn) noexcept; ///@} }; diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp index 14e66c34..52c46f49 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp @@ -45,6 +45,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -59,7 +60,7 @@ Arguably abusing the word 'visitor' here **/ /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. Context: provides address of data pointer so it can be updated in place when @p fn invokes garbage collector reentry point **/ - static void visit_gco_children(DPrimitive_gco_2_gco_gco & self, obj fn) noexcept; + static void visit_gco_children(DPrimitive_gco_2_gco_gco & self, VisitReason reason, obj fn) noexcept; ///@} }; diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp index 994682cd..cc8294e2 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp @@ -45,6 +45,7 @@ namespace xo { using AAllocator = xo::mm::AGCObject::AAllocator; using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; + using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; using Opaque = xo::mm::AGCObject::Opaque; ///@} @@ -59,7 +60,7 @@ Arguably abusing the word 'visitor' here **/ /** Invoke fn.visit_child(iface,data) for each child GCObject pointer. Context: provides address of data pointer so it can be updated in place when @p fn invokes garbage collector reentry point **/ - static void visit_gco_children(DPrimitive_gco_3_dict_string_gco & self, obj fn) noexcept; + static void visit_gco_children(DPrimitive_gco_3_dict_string_gco & self, VisitReason reason, obj fn) noexcept; ///@} }; diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp index 150adfd8..80b04c15 100644 --- a/src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_0.cpp @@ -21,9 +21,9 @@ namespace xo { return self.gco_shallow_move(gc); } auto - IGCObject_DPrimitive_gco_0::visit_gco_children(DPrimitive_gco_0 & self, obj fn) noexcept -> void + IGCObject_DPrimitive_gco_0::visit_gco_children(DPrimitive_gco_0 & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, fn); } } /*namespace scm*/ diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp index 202389d0..865cd641 100644 --- a/src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_1_gco.cpp @@ -21,9 +21,9 @@ namespace xo { return self.gco_shallow_move(gc); } auto - IGCObject_DPrimitive_gco_1_gco::visit_gco_children(DPrimitive_gco_1_gco & self, obj fn) noexcept -> void + IGCObject_DPrimitive_gco_1_gco::visit_gco_children(DPrimitive_gco_1_gco & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, fn); } } /*namespace scm*/ diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp index c9b4717b..5e9bbcb3 100644 --- a/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_2_dict_string.cpp @@ -21,9 +21,9 @@ namespace xo { return self.gco_shallow_move(gc); } auto - IGCObject_DPrimitive_gco_2_dict_string::visit_gco_children(DPrimitive_gco_2_dict_string & self, obj fn) noexcept -> void + IGCObject_DPrimitive_gco_2_dict_string::visit_gco_children(DPrimitive_gco_2_dict_string & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, fn); } } /*namespace scm*/ diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp index 65851b1f..ef410d88 100644 --- a/src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_2_gco_gco.cpp @@ -21,9 +21,9 @@ namespace xo { return self.gco_shallow_move(gc); } auto - IGCObject_DPrimitive_gco_2_gco_gco::visit_gco_children(DPrimitive_gco_2_gco_gco & self, obj fn) noexcept -> void + IGCObject_DPrimitive_gco_2_gco_gco::visit_gco_children(DPrimitive_gco_2_gco_gco & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, fn); } } /*namespace scm*/ diff --git a/src/procedure2/facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp b/src/procedure2/facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp index 89be54af..58e26deb 100644 --- a/src/procedure2/facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp +++ b/src/procedure2/facet/IGCObject_DPrimitive_gco_3_dict_string_gco.cpp @@ -21,9 +21,9 @@ namespace xo { return self.gco_shallow_move(gc); } auto - IGCObject_DPrimitive_gco_3_dict_string_gco::visit_gco_children(DPrimitive_gco_3_dict_string_gco & self, obj fn) noexcept -> void + IGCObject_DPrimitive_gco_3_dict_string_gco::visit_gco_children(DPrimitive_gco_3_dict_string_gco & self, VisitReason reason, obj fn) noexcept -> void { - self.visit_gco_children(fn); + self.visit_gco_children(reason, fn); } } /*namespace scm*/ From 9b92c891edcfbb308c6f74d45d91ce8f9bd1a41c Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Fri, 1 May 2026 19:54:26 -0400 Subject: [PATCH 89/90] refactor focusing on xo-alloc2/ xo-gc/ write-barrier ability to inform allocator of gco->gco mutation, via AAllocator i/face. --- src/procedure2/ObjectPrimitives.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/procedure2/ObjectPrimitives.cpp b/src/procedure2/ObjectPrimitives.cpp index 36dd2a37..367a0bc4 100644 --- a/src/procedure2/ObjectPrimitives.cpp +++ b/src/procedure2/ObjectPrimitives.cpp @@ -133,7 +133,7 @@ namespace xo { assert(!cell->is_empty()); if (!cell->is_empty()) { - cell->assign_head(rcx.collector(), dest); + cell->assign_head(rcx.allocator(), dest); } return cell; From 58848bc9928836e54a0f9291fe1b08f8b5ffaded Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Sat, 2 May 2026 13:49:29 -0400 Subject: [PATCH 90/90] xo-gc stack: refactor + streamline. Retiring unused Collector typealiases. Fix #include topology. Fix/improve write barrier setup. --- .../xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp | 1 - .../procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp | 1 - .../detail/IGCObject_DPrimitive_gco_2_dict_string.hpp | 1 - .../detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp | 1 - .../detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp | 1 - include/xo/procedure2/detail/IProcedure_Xfer.hpp | 8 ++++++++ include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp | 8 ++++++++ 7 files changed, 16 insertions(+), 5 deletions(-) diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp index 63986f85..93e4f5d4 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_0.hpp @@ -43,7 +43,6 @@ namespace xo { ///@{ using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; - using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp index c15dedb4..40388dff 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_1_gco.hpp @@ -43,7 +43,6 @@ namespace xo { ///@{ using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; - using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp index 6cc1754d..29705521 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_dict_string.hpp @@ -43,7 +43,6 @@ namespace xo { ///@{ using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; - using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp index 52c46f49..13ab7b3e 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_2_gco_gco.hpp @@ -43,7 +43,6 @@ namespace xo { ///@{ using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; - using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; diff --git a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp index cc8294e2..bcf0f9ba 100644 --- a/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp +++ b/include/xo/procedure2/detail/IGCObject_DPrimitive_gco_3_dict_string_gco.hpp @@ -43,7 +43,6 @@ namespace xo { ///@{ using size_type = xo::mm::AGCObject::size_type; using AAllocator = xo::mm::AGCObject::AAllocator; - using ACollector = xo::mm::AGCObject::ACollector; using AGCObjectVisitor = xo::mm::AGCObject::AGCObjectVisitor; using VisitReason = xo::mm::AGCObject::VisitReason; using Copaque = xo::mm::AGCObject::Copaque; diff --git a/include/xo/procedure2/detail/IProcedure_Xfer.hpp b/include/xo/procedure2/detail/IProcedure_Xfer.hpp index 59742f32..ebbbeb41 100644 --- a/include/xo/procedure2/detail/IProcedure_Xfer.hpp +++ b/include/xo/procedure2/detail/IProcedure_Xfer.hpp @@ -9,10 +9,18 @@ * [iface_facet_any.hpp.j2] * 3. idl for facet methods * [idl/Procedure.json5] + * + * variables: + * {facet_hpp_fname} -> Procedure.hpp + * {impl_hpp_subdir} -> detail + * {facet_ns1} -> xo + * {facet_detail_subdir} -> detail + * {abstract_facet_fname} -> AProcedure.hpp **/ #pragma once +#include "AProcedure.hpp" #include "RuntimeContext.hpp" #include diff --git a/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp b/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp index 07b30748..ad33ea54 100644 --- a/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp +++ b/include/xo/procedure2/detail/IRuntimeContext_Xfer.hpp @@ -9,10 +9,18 @@ * [iface_facet_any.hpp.j2] * 3. idl for facet methods * [idl/RuntimeContext.json5] + * + * variables: + * {facet_hpp_fname} -> RuntimeContext.hpp + * {impl_hpp_subdir} -> detail + * {facet_ns1} -> xo + * {facet_detail_subdir} -> detail + * {abstract_facet_fname} -> ARuntimeContext.hpp **/ #pragma once +#include "ARuntimeContext.hpp" #include #include #include