xo-interpreter2 stack: use RuntimeContext to streamline setup

This commit is contained in:
Roland Conybeare 2026-03-16 14:09:03 -05:00
commit cb9961c6c3
9 changed files with 46 additions and 25 deletions

View file

@ -60,8 +60,9 @@ namespace xo {
* Allocates primitives using memory from mm, delivering them
* to InstallSink sink.
**/
using InstallSource = std::function<bool (obj<AAllocator> mm,
StringTable * stbl,
using InstallSource = std::function<bool (obj<ARuntimeContext> rcx,
//obj<AAllocator> 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<AAllocator> mm,
StringTable * stbl,
bool install_primitives(obj<ARuntimeContext> rcx,
//obj<AAllocator> mm,
//StringTable * stbl,
InstallSink sink,
InstallFlags flags);

View file

@ -11,8 +11,9 @@
namespace xo {
namespace scm {
/** Register primitive-factories **/
bool procedure2_register_primitives(obj<xo::mm::AAllocator> gc,
StringTable * stbl,
bool procedure2_register_primitives(obj<ARuntimeContext> rcx,
//obj<xo::mm::AAllocator> gc,
//StringTable * stbl,
InstallSink sink,
InstallFlags flags);
}

View file

@ -25,8 +25,9 @@ namespace xo {
}
bool
PrimitiveRegistry::install_primitives(obj<AAllocator> mm,
StringTable * stbl,
PrimitiveRegistry::install_primitives(obj<ARuntimeContext> rcx,
//obj<AAllocator> 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;
}

View file

@ -53,11 +53,15 @@ namespace xo {
}
bool
procedure2_register_primitives(obj<xo::mm::AAllocator> mm,
StringTable * stbl,
procedure2_register_primitives(obj<ARuntimeContext> rcx,
//obj<xo::mm::AAllocator> mm,
//StringTable * stbl,
InstallSink sink,
InstallFlags flags)
{
obj<AAllocator> mm = rcx.allocator();
StringTable * stbl = rcx.stringtable();
scope log(XO_DEBUG(true));
bool ok = true;