From ea31dbf0d3b90beed6714fa556ecf69789f8722f Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Mon, 16 Mar 2026 12:34:59 -0500 Subject: [PATCH] xo-interpreter2 stack: + more primitive function-type decoration --- include/xo/interpreter2/VsmPrimitives.hpp | 3 ++- src/interpreter2/VsmPrimitives.cpp | 12 +++++++++++- .../interpreter2_register_primitives.cpp | 4 +--- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/include/xo/interpreter2/VsmPrimitives.hpp b/include/xo/interpreter2/VsmPrimitives.hpp index 59f52fc3..9690d03e 100644 --- a/include/xo/interpreter2/VsmPrimitives.hpp +++ b/include/xo/interpreter2/VsmPrimitives.hpp @@ -18,7 +18,8 @@ namespace xo { public: /** create primitive: report memory use to console **/ - static DPrimitive_gco_0 * make_report_memory_use_pm(obj mm); + static DPrimitive_gco_0 * make_report_memory_use_pm(obj mm, + StringTable * stbl); }; } /*namespace scm*/ diff --git a/src/interpreter2/VsmPrimitives.cpp b/src/interpreter2/VsmPrimitives.cpp index a3eb79e0..e725c241 100644 --- a/src/interpreter2/VsmPrimitives.cpp +++ b/src/interpreter2/VsmPrimitives.cpp @@ -6,6 +6,8 @@ #include "VsmPrimitives.hpp" #include #include +#include +#include namespace xo { //using xo::scm::NumericDispatch; @@ -38,10 +40,18 @@ namespace xo { } DPrimitive_gco_0 * - VsmPrimitives::make_report_memory_use_pm(obj mm) + VsmPrimitives::make_report_memory_use_pm(obj mm, + StringTable * stbl) { + (void)stbl; + + auto bool_ty = DAtomicType::make(mm, Metatype::t_bool()); + // report_memory_use: () -> bool + auto pm_ty = obj(DFunctionType::_make(mm, bool_ty)); + return DPrimitive_gco_0::_make(mm, "report_memory_use", + pm_ty, &xfer_report_memory_use); } diff --git a/src/interpreter2/interpreter2_register_primitives.cpp b/src/interpreter2/interpreter2_register_primitives.cpp index 9b165b17..f0da9a8e 100644 --- a/src/interpreter2/interpreter2_register_primitives.cpp +++ b/src/interpreter2/interpreter2_register_primitives.cpp @@ -56,13 +56,11 @@ namespace xo { InstallSink sink, InstallFlags flags) { - (void)stbl; - scope log(XO_DEBUG(true)); bool ok = true; - ok = ok & install_aux(sink, VsmPrimitives::make_report_memory_use_pm(mm), flags); + ok = ok & install_aux(sink, VsmPrimitives::make_report_memory_use_pm(mm, stbl), flags); return ok; }