From 406bb5d742585b427c950a5b0b3b5ac526134005 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Mon, 16 Mar 2026 14:09:03 -0500 Subject: [PATCH] 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 a4e24e2..dd4e70b 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 396f645..3b4fa61 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 420a435..ef5cb8c 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 29f3be1..7dd1513 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;