xo-interpreter2: vsm stack: facet + gcobject + printable + init
This commit is contained in:
parent
771a0e640c
commit
b75010fa49
35 changed files with 983 additions and 143 deletions
|
|
@ -317,7 +317,7 @@ xo_add_genfacetimpl(
|
||||||
TARGET xo-expression2-facetimpl-printable-uniquestring
|
TARGET xo-expression2-facetimpl-printable-uniquestring
|
||||||
FACET_PKG xo_printable2
|
FACET_PKG xo_printable2
|
||||||
FACET Printable
|
FACET Printable
|
||||||
REPR DUniqueString
|
REPR UniqueString
|
||||||
INPUT idl/IPrintable_DUniqueString.json5
|
INPUT idl/IPrintable_DUniqueString.json5
|
||||||
OUTPUT_HPP_DIR include/xo/expression2
|
OUTPUT_HPP_DIR include/xo/expression2
|
||||||
OUTPUT_IMPL_SUBDIR detail
|
OUTPUT_IMPL_SUBDIR detail
|
||||||
|
|
|
||||||
|
|
@ -189,7 +189,8 @@ namespace xo {
|
||||||
VirtualSchematikaMachine::execute_one()
|
VirtualSchematikaMachine::execute_one()
|
||||||
{
|
{
|
||||||
scope log(XO_DEBUG(true));
|
scope log(XO_DEBUG(true));
|
||||||
log && log("stack", stack_);
|
log && log(xtag("pc", pc_), xtag("cont", cont_));
|
||||||
|
log && log(xtag("stack", stack_));
|
||||||
|
|
||||||
using Opcode = VsmInstr::Opcode;
|
using Opcode = VsmInstr::Opcode;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,65 @@ add_definitions(${PROJECT_CXX_FLAGS})
|
||||||
add_subdirectory(src/interpreter2)
|
add_subdirectory(src/interpreter2)
|
||||||
add_subdirectory(utest)
|
add_subdirectory(utest)
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------
|
||||||
|
|
||||||
|
# note: manual target; generated code committed to git
|
||||||
|
xo_add_genfacetimpl(
|
||||||
|
TARGET xo-interpreter2-facetimpl-gcobject-vsmapplyframe
|
||||||
|
FACET_PKG xo_gc
|
||||||
|
FACET GCObject
|
||||||
|
REPR VsmApplyFrame
|
||||||
|
INPUT idl/IGCObject_DVsmApplyFrame.json5
|
||||||
|
OUTPUT_HPP_DIR include/xo/interpreter2
|
||||||
|
OUTPUT_IMPL_SUBDIR detail
|
||||||
|
OUTPUT_CPP_DIR src/interpreter2
|
||||||
|
)
|
||||||
|
|
||||||
|
# note: manual target; generated code committed to git
|
||||||
|
xo_add_genfacetimpl(
|
||||||
|
TARGET xo-interpreter2-facetimpl-printable-vsmapplyframe
|
||||||
|
FACET_PKG xo_printable2
|
||||||
|
FACET Printable
|
||||||
|
REPR VsmApplyFrame
|
||||||
|
INPUT idl/IPrintable_DVsmApplyFrame.json5
|
||||||
|
OUTPUT_HPP_DIR include/xo/interpreter2
|
||||||
|
OUTPUT_IMPL_SUBDIR detail
|
||||||
|
OUTPUT_CPP_DIR src/interpreter2
|
||||||
|
)
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------
|
||||||
|
|
||||||
|
# note: manual target; generated code committed to git
|
||||||
|
xo_add_genfacetimpl(
|
||||||
|
TARGET xo-interpreter2-facetimpl-gcobject-vsmevalargsframe
|
||||||
|
FACET_PKG xo_gc
|
||||||
|
FACET GCObject
|
||||||
|
REPR VsmEvalArgsFrame
|
||||||
|
INPUT idl/IGCObject_DVsmEvalArgsFrame.json5
|
||||||
|
OUTPUT_HPP_DIR include/xo/interpreter2
|
||||||
|
OUTPUT_IMPL_SUBDIR detail
|
||||||
|
OUTPUT_CPP_DIR src/interpreter2
|
||||||
|
)
|
||||||
|
|
||||||
|
# note: manual target; generated code committed to git
|
||||||
|
xo_add_genfacetimpl(
|
||||||
|
TARGET xo-interpreter2-facetimpl-printable-vsmevalargsframe
|
||||||
|
FACET_PKG xo_printable2
|
||||||
|
FACET Printable
|
||||||
|
REPR DVsmEvalArgsFrame
|
||||||
|
INPUT idl/IPrintable_DVsmEvalArgsFrame.json5
|
||||||
|
OUTPUT_HPP_DIR include/xo/interpreter2
|
||||||
|
OUTPUT_IMPL_SUBDIR detail
|
||||||
|
OUTPUT_CPP_DIR src/interpreter2
|
||||||
|
)
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------
|
||||||
|
|
||||||
|
xo_add_genfacet_all(xo-interpreter2-genfacet-all)
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------
|
||||||
|
# cmake helper (for external xo-interpreter2 users)
|
||||||
|
|
||||||
xo_export_cmake_config(${PROJECT_NAME} ${PROJECT_VERSION} ${PROJECT_NAME}Targets)
|
xo_export_cmake_config(${PROJECT_NAME} ${PROJECT_VERSION} ${PROJECT_NAME}Targets)
|
||||||
|
|
||||||
# ----------------------------------------------------------------
|
# ----------------------------------------------------------------
|
||||||
|
|
|
||||||
15
xo-interpreter2/idl/IGCObject_DVsmApplyFrame.json5
Normal file
15
xo-interpreter2/idl/IGCObject_DVsmApplyFrame.json5
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
mode: "implementation",
|
||||||
|
includes: [
|
||||||
|
"<xo/gc/GCObject.hpp>",
|
||||||
|
"<xo/alloc2/Allocator.hpp>"
|
||||||
|
],
|
||||||
|
local_types: [ ],
|
||||||
|
namespace1: "xo",
|
||||||
|
namespace2: "scm",
|
||||||
|
facet_idl: "idl/GCObject.json5",
|
||||||
|
brief: "provide AGCObject interface for DVsmApplyFrame",
|
||||||
|
using_doxygen: true,
|
||||||
|
repr: "DVsmApplyFrame",
|
||||||
|
doc: [ "implement AGCObject for DVsmApplyFrame" ],
|
||||||
|
}
|
||||||
15
xo-interpreter2/idl/IGCObject_DVsmEvalArgsFrame.json5
Normal file
15
xo-interpreter2/idl/IGCObject_DVsmEvalArgsFrame.json5
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
mode: "implementation",
|
||||||
|
includes: [
|
||||||
|
"<xo/gc/GCObject.hpp>",
|
||||||
|
"<xo/alloc2/Allocator.hpp>"
|
||||||
|
],
|
||||||
|
local_types: [ ],
|
||||||
|
namespace1: "xo",
|
||||||
|
namespace2: "scm",
|
||||||
|
facet_idl: "idl/GCObject.json5",
|
||||||
|
brief: "provide AGCObject interface for DVsmEvalArgsFrame",
|
||||||
|
using_doxygen: true,
|
||||||
|
repr: "DVsmEvalArgsFrame",
|
||||||
|
doc: [ "implement AGCObject for DVsmEvalArgsFrame" ],
|
||||||
|
}
|
||||||
13
xo-interpreter2/idl/IPrintable_DVsmApplyFrame.json5
Normal file
13
xo-interpreter2/idl/IPrintable_DVsmApplyFrame.json5
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
mode: "implementation",
|
||||||
|
includes: [ "<xo/printable2/Printable.hpp>",
|
||||||
|
"<xo/printable2/detail/IPrintable_Xfer.hpp>" ],
|
||||||
|
local_types: [ ],
|
||||||
|
namespace1: "xo",
|
||||||
|
namespace2: "scm",
|
||||||
|
facet_idl: "idl/Printable.json5",
|
||||||
|
brief: "provide APrintable interface for DVsmApplyFrame",
|
||||||
|
using_doxygen: true,
|
||||||
|
repr: "DVsmApplyFrame",
|
||||||
|
doc: [ "implement APrintable for DVsmApplyFrame" ],
|
||||||
|
}
|
||||||
13
xo-interpreter2/idl/IPrintable_DVsmEvalArgsFrame.json5
Normal file
13
xo-interpreter2/idl/IPrintable_DVsmEvalArgsFrame.json5
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
mode: "implementation",
|
||||||
|
includes: [ "<xo/printable2/Printable.hpp>",
|
||||||
|
"<xo/printable2/detail/IPrintable_Xfer.hpp>" ],
|
||||||
|
local_types: [ ],
|
||||||
|
namespace1: "xo",
|
||||||
|
namespace2: "scm",
|
||||||
|
facet_idl: "idl/Printable.json5",
|
||||||
|
brief: "provide APrintable interface for DVsmEvalArgsFrame",
|
||||||
|
using_doxygen: true,
|
||||||
|
repr: "DVsmEvalArgsFrame",
|
||||||
|
doc: [ "implement APrintable for DVsmEvalArgsFrame" ],
|
||||||
|
}
|
||||||
53
xo-interpreter2/include/xo/interpreter2/DVsmApplyFrame.hpp
Normal file
53
xo-interpreter2/include/xo/interpreter2/DVsmApplyFrame.hpp
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
/** @file DVsmApplyFrame.hpp
|
||||||
|
*
|
||||||
|
* @author Roland Conybeare, Feb 2026
|
||||||
|
**/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "VsmFrame.hpp"
|
||||||
|
|
||||||
|
namespace xo {
|
||||||
|
namespace scm {
|
||||||
|
class DVsmApplyFrame : public VsmFrame {
|
||||||
|
public:
|
||||||
|
using AProcedure = xo::scm::AProcedure;
|
||||||
|
using ACollector = xo::mm::ACollector;
|
||||||
|
using AAllocator = xo::mm::AAllocator;
|
||||||
|
using ppindentinfo = xo::print::ppindentinfo;
|
||||||
|
|
||||||
|
public:
|
||||||
|
DVsmApplyFrame(obj<AGCObject> old_parent,
|
||||||
|
VsmInstr old_cont,
|
||||||
|
DArray * args);
|
||||||
|
|
||||||
|
static DVsmApplyFrame * make(obj<AAllocator> mm,
|
||||||
|
obj<AGCObject> old_parent,
|
||||||
|
VsmInstr old_cont,
|
||||||
|
DArray * args);
|
||||||
|
|
||||||
|
obj<AProcedure> fn() const noexcept { return fn_; }
|
||||||
|
DArray * args() const noexcept { return args_; }
|
||||||
|
|
||||||
|
std::size_t shallow_size() const noexcept;
|
||||||
|
DVsmApplyFrame * shallow_copy(obj<AAllocator> mm) const noexcept;
|
||||||
|
std::size_t forward_children(obj<ACollector> gc) noexcept;
|
||||||
|
|
||||||
|
/** pretty-printing support **/
|
||||||
|
bool pretty(const ppindentinfo & ppii) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
/** evaluated target procedure.
|
||||||
|
*
|
||||||
|
* note: when initially created, this will be unpopulated;
|
||||||
|
* don't know correct value until we evaluate
|
||||||
|
* expression in head position
|
||||||
|
**/
|
||||||
|
obj<AProcedure> fn_;
|
||||||
|
/** evaluated arguments (to target procedure) **/
|
||||||
|
DArray * args_;
|
||||||
|
};
|
||||||
|
} /*namespace scm*/
|
||||||
|
} /*namespace xo*/
|
||||||
|
|
||||||
|
/* end DVsmApplyFrame.hpp */
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
/** @file DVsmEvalArgsFrame.hpp
|
||||||
|
*
|
||||||
|
* @author Roland Conybeare, Feb 2026
|
||||||
|
**/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "DVsmApplyFrame.hpp"
|
||||||
|
|
||||||
|
namespace xo {
|
||||||
|
namespace scm {
|
||||||
|
|
||||||
|
/** frame for executing an apply expression **/
|
||||||
|
class DVsmEvalArgsFrame : public VsmFrame {
|
||||||
|
public:
|
||||||
|
using ACollector = xo::mm::ACollector;
|
||||||
|
using AAllocator = xo::mm::AAllocator;
|
||||||
|
using ppindentinfo = xo::print::ppindentinfo;
|
||||||
|
|
||||||
|
public:
|
||||||
|
/** see picture in VirtualSchematikaMachine._do_eval_apply_op()
|
||||||
|
*
|
||||||
|
* old_parent = [apply frame]
|
||||||
|
* old_cont = [xfer to called function]
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
DVsmEvalArgsFrame(obj<AGCObject> old_parent,
|
||||||
|
VsmInstr old_cont);
|
||||||
|
|
||||||
|
static DVsmEvalArgsFrame * make(obj<AAllocator> mm,
|
||||||
|
obj<AGCObject> apply_frame,
|
||||||
|
VsmInstr old_cont);
|
||||||
|
|
||||||
|
std::size_t shallow_size() const noexcept;
|
||||||
|
DVsmEvalArgsFrame * shallow_copy(obj<AAllocator> mm) const noexcept;
|
||||||
|
std::size_t forward_children(obj<ACollector> gc) noexcept;
|
||||||
|
|
||||||
|
bool pretty(const ppindentinfo & ppii) const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/** next argument to be evaluated. -1 means function head **/
|
||||||
|
int32_t i_arg_ = -1;
|
||||||
|
};
|
||||||
|
|
||||||
|
} /*namespace scm*/
|
||||||
|
} /*namespace xo*/
|
||||||
|
|
||||||
|
/* end DVsmEvalArgsFrame.hpp */
|
||||||
|
|
@ -181,7 +181,7 @@ namespace xo {
|
||||||
VsmInstr pc_ = VsmInstr::c_halt;
|
VsmInstr pc_ = VsmInstr::c_halt;
|
||||||
|
|
||||||
/** stack pointer **/
|
/** stack pointer **/
|
||||||
VsmFrame * stack_ = nullptr;
|
obj<AGCObject> stack_;
|
||||||
|
|
||||||
/** expression register **/
|
/** expression register **/
|
||||||
obj<AExpression> expr_;
|
obj<AExpression> expr_;
|
||||||
|
|
|
||||||
12
xo-interpreter2/include/xo/interpreter2/VsmApplyFrame.hpp
Normal file
12
xo-interpreter2/include/xo/interpreter2/VsmApplyFrame.hpp
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
/** @file VsmApplyFrame.hpp
|
||||||
|
*
|
||||||
|
* @author Roland Conybeare, Feb 2026
|
||||||
|
**/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "DVsmApplyFrame.hpp"
|
||||||
|
#include "detail/IGCObject_DVsmApplyFrame.hpp"
|
||||||
|
#include "detail/IPrintable_DVsmApplyFrame.hpp"
|
||||||
|
|
||||||
|
/* end VsmApplyFrame.hpp */
|
||||||
12
xo-interpreter2/include/xo/interpreter2/VsmEvalArgsFrame.hpp
Normal file
12
xo-interpreter2/include/xo/interpreter2/VsmEvalArgsFrame.hpp
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
/** @file VsmEvalArgsFrame.hpp
|
||||||
|
*
|
||||||
|
* @author Roland Conybeare, Feb 2026
|
||||||
|
**/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "DVsmEvalArgsFrame.hpp"
|
||||||
|
#include "detail/IGCObject_DVsmEvalArgsFrame.hpp"
|
||||||
|
#include "detail/IPrintable_DVsmEvalArgsFrame.hpp"
|
||||||
|
|
||||||
|
/* end VsmEvalArgsFrame.hpp */
|
||||||
|
|
@ -13,74 +13,26 @@ namespace xo {
|
||||||
namespace scm {
|
namespace scm {
|
||||||
class VsmFrame {
|
class VsmFrame {
|
||||||
public:
|
public:
|
||||||
VsmFrame(VsmFrame * parent, VsmInstr cont) : parent_{parent}, cont_{cont} {}
|
using AGCObject = xo::mm::AGCObject;
|
||||||
|
|
||||||
VsmFrame * parent() const noexcept { return parent_; }
|
public:
|
||||||
|
VsmFrame(obj<AGCObject> parent,
|
||||||
|
VsmInstr cont) : parent_{parent}, cont_{cont} {}
|
||||||
|
|
||||||
|
//obj<AGCObject> parent() const noexcept { return parent_; }
|
||||||
|
VsmFrame * parent() const noexcept {
|
||||||
|
return reinterpret_cast<VsmFrame *>(parent_.data());
|
||||||
|
}
|
||||||
VsmInstr cont() const noexcept { return cont_; }
|
VsmInstr cont() const noexcept { return cont_; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/** saved VSM stack; restore when this frame consumed **/
|
/** saved VSM stack; restore when this frame consumed **/
|
||||||
VsmFrame * parent_ = nullptr;
|
obj<AGCObject> parent_;
|
||||||
/** saved continuation; restore when this frame consumed **/
|
/** saved continuation; restore when this frame consumed **/
|
||||||
VsmInstr cont_;
|
VsmInstr cont_;
|
||||||
};
|
};
|
||||||
|
|
||||||
class VsmApplyFrame : public VsmFrame {
|
|
||||||
public:
|
|
||||||
using AProcedure = xo::scm::AProcedure;
|
|
||||||
using AAllocator = xo::mm::AAllocator;
|
|
||||||
|
|
||||||
public:
|
|
||||||
VsmApplyFrame(VsmFrame * old_parent,
|
|
||||||
VsmInstr old_cont,
|
|
||||||
DArray * args);
|
|
||||||
|
|
||||||
static VsmApplyFrame * make(obj<AAllocator> mm,
|
|
||||||
VsmFrame * old_parent,
|
|
||||||
VsmInstr old_cont,
|
|
||||||
DArray * args);
|
|
||||||
|
|
||||||
obj<AProcedure> fn() const noexcept { return fn_; }
|
|
||||||
DArray * args() const noexcept { return args_; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
/** evaluated target procedure.
|
|
||||||
*
|
|
||||||
* note: when initially created, this will be unpopulated;
|
|
||||||
* don't know correct value until we evaluate
|
|
||||||
* expression in head position
|
|
||||||
**/
|
|
||||||
obj<AProcedure> fn_;
|
|
||||||
/** evaluated arguments (to target procedure) **/
|
|
||||||
DArray * args_;
|
|
||||||
};
|
|
||||||
|
|
||||||
/** frame for executing an apply expression **/
|
|
||||||
class VsmEvalArgsFrame : public VsmFrame {
|
|
||||||
public:
|
|
||||||
using AAllocator = xo::mm::AAllocator;
|
|
||||||
|
|
||||||
public:
|
|
||||||
/** see picture in VirtualSchematikaMachine._do_eval_apply_op()
|
|
||||||
*
|
|
||||||
* old_parent = [apply frame]
|
|
||||||
* old_cont = [xfer to called function]
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
VsmEvalArgsFrame(VsmApplyFrame * old_parent,
|
|
||||||
VsmInstr old_cont);
|
|
||||||
|
|
||||||
static VsmEvalArgsFrame * make(obj<AAllocator> mm,
|
|
||||||
VsmApplyFrame * apply_frame,
|
|
||||||
VsmInstr old_cont);
|
|
||||||
|
|
||||||
private:
|
|
||||||
/** next argument to be evaluated. -1 means function head **/
|
|
||||||
int32_t i_arg_ = -1;
|
|
||||||
};
|
|
||||||
|
|
||||||
} /*namespace scm*/
|
} /*namespace scm*/
|
||||||
} /*namespace xo*/
|
} /*namespace xo*/
|
||||||
|
|
||||||
/* end VsmFrame.hpp */
|
/* end VsmFrame.hpp */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,12 @@ namespace xo {
|
||||||
private:
|
private:
|
||||||
vsm_opcode opcode_;
|
vsm_opcode opcode_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline std::ostream &
|
||||||
|
operator<<(std::ostream & os, VsmInstr x) {
|
||||||
|
os << x.opcode();
|
||||||
|
return os;
|
||||||
|
}
|
||||||
} /*namespace scm*/
|
} /*namespace scm*/
|
||||||
} /*namespace xo*/
|
} /*namespace xo*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <ostream>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
namespace xo {
|
namespace xo {
|
||||||
|
|
@ -32,6 +33,16 @@ namespace xo {
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr uint32_t n_opcode = static_cast<uint32_t>(vsm_opcode::N);
|
static constexpr uint32_t n_opcode = static_cast<uint32_t>(vsm_opcode::N);
|
||||||
|
|
||||||
|
/** stringified enum value **/
|
||||||
|
const char *
|
||||||
|
vsm_opcode_descr(vsm_opcode x);
|
||||||
|
|
||||||
|
inline std::ostream &
|
||||||
|
operator<<(std::ostream & os, vsm_opcode x) {
|
||||||
|
os << vsm_opcode_descr(x);
|
||||||
|
return os;
|
||||||
|
}
|
||||||
} /*namespace scm*/
|
} /*namespace scm*/
|
||||||
} /*namespace xo*/
|
} /*namespace xo*/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,67 @@
|
||||||
|
/** @file IGCObject_DVsmApplyFrame.hpp
|
||||||
|
*
|
||||||
|
* Generated automagically from ingredients:
|
||||||
|
* 1. code generator:
|
||||||
|
* [xo-facet/codegen/genfacet]
|
||||||
|
* arguments:
|
||||||
|
* --input [idl/IGCObject_DVsmApplyFrame.json5]
|
||||||
|
* 2. jinja2 template for abstract facet .hpp file:
|
||||||
|
* [iface_facet_repr.hpp.j2]
|
||||||
|
* 3. idl for facet methods
|
||||||
|
* [idl/IGCObject_DVsmApplyFrame.json5]
|
||||||
|
**/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "GCObject.hpp"
|
||||||
|
#include <xo/gc/GCObject.hpp>
|
||||||
|
#include <xo/alloc2/Allocator.hpp>
|
||||||
|
#include "DVsmApplyFrame.hpp"
|
||||||
|
|
||||||
|
namespace xo { namespace scm { class IGCObject_DVsmApplyFrame; } }
|
||||||
|
|
||||||
|
namespace xo {
|
||||||
|
namespace facet {
|
||||||
|
template <>
|
||||||
|
struct FacetImplementation<xo::mm::AGCObject,
|
||||||
|
xo::scm::DVsmApplyFrame>
|
||||||
|
{
|
||||||
|
using ImplType = xo::mm::IGCObject_Xfer
|
||||||
|
<xo::scm::DVsmApplyFrame,
|
||||||
|
xo::scm::IGCObject_DVsmApplyFrame>;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace xo {
|
||||||
|
namespace scm {
|
||||||
|
/** @class IGCObject_DVsmApplyFrame
|
||||||
|
**/
|
||||||
|
class IGCObject_DVsmApplyFrame {
|
||||||
|
public:
|
||||||
|
/** @defgroup scm-gcobject-dvsmapplyframe-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-dvsmapplyframe-methods **/
|
||||||
|
///@{
|
||||||
|
// const methods
|
||||||
|
/** memory consumption for this instance **/
|
||||||
|
static size_type shallow_size(const DVsmApplyFrame & self) noexcept;
|
||||||
|
/** copy instance using allocator **/
|
||||||
|
static Opaque shallow_copy(const DVsmApplyFrame & self, obj<AAllocator> mm) noexcept;
|
||||||
|
|
||||||
|
// non-const methods
|
||||||
|
/** during GC: forward immdiate children **/
|
||||||
|
static size_type forward_children(DVsmApplyFrame & self, obj<ACollector> gc) noexcept;
|
||||||
|
///@}
|
||||||
|
};
|
||||||
|
|
||||||
|
} /*namespace scm*/
|
||||||
|
} /*namespace xo*/
|
||||||
|
|
||||||
|
/* end */
|
||||||
|
|
@ -0,0 +1,67 @@
|
||||||
|
/** @file IGCObject_DVsmEvalArgsFrame.hpp
|
||||||
|
*
|
||||||
|
* Generated automagically from ingredients:
|
||||||
|
* 1. code generator:
|
||||||
|
* [xo-facet/codegen/genfacet]
|
||||||
|
* arguments:
|
||||||
|
* --input [idl/IGCObject_DVsmEvalArgsFrame.json5]
|
||||||
|
* 2. jinja2 template for abstract facet .hpp file:
|
||||||
|
* [iface_facet_repr.hpp.j2]
|
||||||
|
* 3. idl for facet methods
|
||||||
|
* [idl/IGCObject_DVsmEvalArgsFrame.json5]
|
||||||
|
**/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "GCObject.hpp"
|
||||||
|
#include <xo/gc/GCObject.hpp>
|
||||||
|
#include <xo/alloc2/Allocator.hpp>
|
||||||
|
#include "DVsmEvalArgsFrame.hpp"
|
||||||
|
|
||||||
|
namespace xo { namespace scm { class IGCObject_DVsmEvalArgsFrame; } }
|
||||||
|
|
||||||
|
namespace xo {
|
||||||
|
namespace facet {
|
||||||
|
template <>
|
||||||
|
struct FacetImplementation<xo::mm::AGCObject,
|
||||||
|
xo::scm::DVsmEvalArgsFrame>
|
||||||
|
{
|
||||||
|
using ImplType = xo::mm::IGCObject_Xfer
|
||||||
|
<xo::scm::DVsmEvalArgsFrame,
|
||||||
|
xo::scm::IGCObject_DVsmEvalArgsFrame>;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace xo {
|
||||||
|
namespace scm {
|
||||||
|
/** @class IGCObject_DVsmEvalArgsFrame
|
||||||
|
**/
|
||||||
|
class IGCObject_DVsmEvalArgsFrame {
|
||||||
|
public:
|
||||||
|
/** @defgroup scm-gcobject-dvsmevalargsframe-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-dvsmevalargsframe-methods **/
|
||||||
|
///@{
|
||||||
|
// const methods
|
||||||
|
/** memory consumption for this instance **/
|
||||||
|
static size_type shallow_size(const DVsmEvalArgsFrame & self) noexcept;
|
||||||
|
/** copy instance using allocator **/
|
||||||
|
static Opaque shallow_copy(const DVsmEvalArgsFrame & self, obj<AAllocator> mm) noexcept;
|
||||||
|
|
||||||
|
// non-const methods
|
||||||
|
/** during GC: forward immdiate children **/
|
||||||
|
static size_type forward_children(DVsmEvalArgsFrame & self, obj<ACollector> gc) noexcept;
|
||||||
|
///@}
|
||||||
|
};
|
||||||
|
|
||||||
|
} /*namespace scm*/
|
||||||
|
} /*namespace xo*/
|
||||||
|
|
||||||
|
/* end */
|
||||||
|
|
@ -0,0 +1,62 @@
|
||||||
|
/** @file IPrintable_DVsmApplyFrame.hpp
|
||||||
|
*
|
||||||
|
* Generated automagically from ingredients:
|
||||||
|
* 1. code generator:
|
||||||
|
* [xo-facet/codegen/genfacet]
|
||||||
|
* arguments:
|
||||||
|
* --input [idl/IPrintable_DVsmApplyFrame.json5]
|
||||||
|
* 2. jinja2 template for abstract facet .hpp file:
|
||||||
|
* [iface_facet_repr.hpp.j2]
|
||||||
|
* 3. idl for facet methods
|
||||||
|
* [idl/IPrintable_DVsmApplyFrame.json5]
|
||||||
|
**/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Printable.hpp"
|
||||||
|
#include <xo/printable2/Printable.hpp>
|
||||||
|
#include <xo/printable2/detail/IPrintable_Xfer.hpp>
|
||||||
|
#include "DVsmApplyFrame.hpp"
|
||||||
|
|
||||||
|
namespace xo { namespace scm { class IPrintable_DVsmApplyFrame; } }
|
||||||
|
|
||||||
|
namespace xo {
|
||||||
|
namespace facet {
|
||||||
|
template <>
|
||||||
|
struct FacetImplementation<xo::print::APrintable,
|
||||||
|
xo::scm::DVsmApplyFrame>
|
||||||
|
{
|
||||||
|
using ImplType = xo::print::IPrintable_Xfer
|
||||||
|
<xo::scm::DVsmApplyFrame,
|
||||||
|
xo::scm::IPrintable_DVsmApplyFrame>;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace xo {
|
||||||
|
namespace scm {
|
||||||
|
/** @class IPrintable_DVsmApplyFrame
|
||||||
|
**/
|
||||||
|
class IPrintable_DVsmApplyFrame {
|
||||||
|
public:
|
||||||
|
/** @defgroup scm-printable-dvsmapplyframe-type-traits **/
|
||||||
|
///@{
|
||||||
|
using ppindentinfo = xo::print::APrintable::ppindentinfo;
|
||||||
|
using Copaque = xo::print::APrintable::Copaque;
|
||||||
|
using Opaque = xo::print::APrintable::Opaque;
|
||||||
|
///@}
|
||||||
|
/** @defgroup scm-printable-dvsmapplyframe-methods **/
|
||||||
|
///@{
|
||||||
|
// const methods
|
||||||
|
/** Pretty-printing support for this object.
|
||||||
|
See [xo-indentlog/xo/indentlog/pretty.hpp] **/
|
||||||
|
static bool pretty(const DVsmApplyFrame & self, const ppindentinfo & ppii);
|
||||||
|
|
||||||
|
// non-const methods
|
||||||
|
///@}
|
||||||
|
};
|
||||||
|
|
||||||
|
} /*namespace scm*/
|
||||||
|
} /*namespace xo*/
|
||||||
|
|
||||||
|
/* end */
|
||||||
|
|
@ -0,0 +1,62 @@
|
||||||
|
/** @file IPrintable_DVsmEvalArgsFrame.hpp
|
||||||
|
*
|
||||||
|
* Generated automagically from ingredients:
|
||||||
|
* 1. code generator:
|
||||||
|
* [xo-facet/codegen/genfacet]
|
||||||
|
* arguments:
|
||||||
|
* --input [idl/IPrintable_DVsmEvalArgsFrame.json5]
|
||||||
|
* 2. jinja2 template for abstract facet .hpp file:
|
||||||
|
* [iface_facet_repr.hpp.j2]
|
||||||
|
* 3. idl for facet methods
|
||||||
|
* [idl/IPrintable_DVsmEvalArgsFrame.json5]
|
||||||
|
**/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "Printable.hpp"
|
||||||
|
#include <xo/printable2/Printable.hpp>
|
||||||
|
#include <xo/printable2/detail/IPrintable_Xfer.hpp>
|
||||||
|
#include "DVsmEvalArgsFrame.hpp"
|
||||||
|
|
||||||
|
namespace xo { namespace scm { class IPrintable_DVsmEvalArgsFrame; } }
|
||||||
|
|
||||||
|
namespace xo {
|
||||||
|
namespace facet {
|
||||||
|
template <>
|
||||||
|
struct FacetImplementation<xo::print::APrintable,
|
||||||
|
xo::scm::DVsmEvalArgsFrame>
|
||||||
|
{
|
||||||
|
using ImplType = xo::print::IPrintable_Xfer
|
||||||
|
<xo::scm::DVsmEvalArgsFrame,
|
||||||
|
xo::scm::IPrintable_DVsmEvalArgsFrame>;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace xo {
|
||||||
|
namespace scm {
|
||||||
|
/** @class IPrintable_DVsmEvalArgsFrame
|
||||||
|
**/
|
||||||
|
class IPrintable_DVsmEvalArgsFrame {
|
||||||
|
public:
|
||||||
|
/** @defgroup scm-printable-dvsmevalargsframe-type-traits **/
|
||||||
|
///@{
|
||||||
|
using ppindentinfo = xo::print::APrintable::ppindentinfo;
|
||||||
|
using Copaque = xo::print::APrintable::Copaque;
|
||||||
|
using Opaque = xo::print::APrintable::Opaque;
|
||||||
|
///@}
|
||||||
|
/** @defgroup scm-printable-dvsmevalargsframe-methods **/
|
||||||
|
///@{
|
||||||
|
// const methods
|
||||||
|
/** Pretty-printing support for this object.
|
||||||
|
See [xo-indentlog/xo/indentlog/pretty.hpp] **/
|
||||||
|
static bool pretty(const DVsmEvalArgsFrame & self, const ppindentinfo & ppii);
|
||||||
|
|
||||||
|
// non-const methods
|
||||||
|
///@}
|
||||||
|
};
|
||||||
|
|
||||||
|
} /*namespace scm*/
|
||||||
|
} /*namespace xo*/
|
||||||
|
|
||||||
|
/* end */
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
/** @file interpreter2_register_facets.hpp
|
||||||
|
*
|
||||||
|
* @author Roland Conybeare, Feb 2026
|
||||||
|
**/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
namespace xo {
|
||||||
|
namespace scm {
|
||||||
|
/** Register interpreter2 (facet,impl) combinations with FacetRegistry **/
|
||||||
|
bool interpreter2_register_facets();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* end interpreter2_register_facets.hpp */
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
/** @file interpreter2_register_types.hpp
|
||||||
|
*
|
||||||
|
* @author Roland Conybeare, Dec 2025
|
||||||
|
**/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <xo/gc/Collector.hpp>
|
||||||
|
|
||||||
|
namespace xo {
|
||||||
|
namespace scm {
|
||||||
|
/** Register interpreter2 (facet,impl) combinations with FacetRegistry **/
|
||||||
|
bool interpreter2_register_types(obj<xo::mm::ACollector> gc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* end interpreter2_register_types.hpp */
|
||||||
|
|
@ -3,11 +3,21 @@
|
||||||
set(SELF_LIB xo_interpreter2)
|
set(SELF_LIB xo_interpreter2)
|
||||||
set(SELF_SRCS
|
set(SELF_SRCS
|
||||||
init_interpreter2.cpp
|
init_interpreter2.cpp
|
||||||
|
interpreter2_register_facets.cpp
|
||||||
|
interpreter2_register_types.cpp
|
||||||
|
|
||||||
VirtualSchematikaMachine.cpp
|
VirtualSchematikaMachine.cpp
|
||||||
VsmFrame.cpp
|
|
||||||
|
DVsmEvalArgsFrame.cpp
|
||||||
|
IGCObject_DVsmEvalArgsFrame.cpp
|
||||||
|
IPrintable_DVsmEvalArgsFrame.cpp
|
||||||
|
|
||||||
|
DVsmApplyFrame.cpp
|
||||||
|
IGCObject_DVsmApplyFrame.cpp
|
||||||
|
IPrintable_DVsmApplyFrame.cpp
|
||||||
|
|
||||||
VsmInstr.cpp
|
VsmInstr.cpp
|
||||||
#IExpression_Any.cpp
|
#IExpression_Any.cpp
|
||||||
#interpreter2_register_facets.cpp
|
|
||||||
)
|
)
|
||||||
|
|
||||||
xo_add_shared_library4(${SELF_LIB} ${PROJECT_NAME}Targets ${PROJECT_VERSION} 1 ${SELF_SRCS})
|
xo_add_shared_library4(${SELF_LIB} ${PROJECT_NAME}Targets ${PROJECT_VERSION} 1 ${SELF_SRCS})
|
||||||
|
|
|
||||||
82
xo-interpreter2/src/interpreter2/DVsmApplyFrame.cpp
Normal file
82
xo-interpreter2/src/interpreter2/DVsmApplyFrame.cpp
Normal file
|
|
@ -0,0 +1,82 @@
|
||||||
|
/** @file DVsmApplyFrame.cpp
|
||||||
|
*
|
||||||
|
* @author Roland Conybeare, Feb 2026
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include "DVsmApplyFrame.hpp"
|
||||||
|
#include <xo/indentlog/print/pretty.hpp>
|
||||||
|
|
||||||
|
namespace xo {
|
||||||
|
using xo::facet::typeseq;
|
||||||
|
|
||||||
|
namespace scm {
|
||||||
|
|
||||||
|
DVsmApplyFrame::DVsmApplyFrame(obj<AGCObject> old_parent,
|
||||||
|
VsmInstr old_cont,
|
||||||
|
DArray * args)
|
||||||
|
: VsmFrame(old_parent, old_cont),
|
||||||
|
args_{args}
|
||||||
|
{}
|
||||||
|
|
||||||
|
DVsmApplyFrame *
|
||||||
|
DVsmApplyFrame::make(obj<AAllocator> mm,
|
||||||
|
obj<AGCObject> old_parent,
|
||||||
|
VsmInstr old_cont,
|
||||||
|
DArray * args)
|
||||||
|
{
|
||||||
|
DVsmApplyFrame * result = nullptr;
|
||||||
|
|
||||||
|
void * mem = mm.alloc(typeseq::id<DVsmApplyFrame>(),
|
||||||
|
sizeof(DVsmApplyFrame));
|
||||||
|
|
||||||
|
result = new (mem) DVsmApplyFrame(old_parent,
|
||||||
|
old_cont,
|
||||||
|
args);
|
||||||
|
|
||||||
|
assert(result);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::size_t
|
||||||
|
DVsmApplyFrame::shallow_size() const noexcept
|
||||||
|
{
|
||||||
|
return sizeof(DVsmApplyFrame);
|
||||||
|
}
|
||||||
|
|
||||||
|
DVsmApplyFrame *
|
||||||
|
DVsmApplyFrame::shallow_copy(obj<AAllocator> mm) const noexcept
|
||||||
|
{
|
||||||
|
DVsmApplyFrame * copy = (DVsmApplyFrame *)mm.alloc_copy((std::byte *)this);
|
||||||
|
|
||||||
|
if (copy)
|
||||||
|
*copy = *this;
|
||||||
|
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::size_t
|
||||||
|
DVsmApplyFrame::forward_children(obj<ACollector> gc) noexcept
|
||||||
|
{
|
||||||
|
// GC needs to locate AGCObject iface for each member
|
||||||
|
|
||||||
|
(void)gc;
|
||||||
|
|
||||||
|
return this->shallow_size();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
DVsmApplyFrame::pretty(const ppindentinfo & ppii) const
|
||||||
|
{
|
||||||
|
return ppii.pps()->pretty_struct
|
||||||
|
(ppii,
|
||||||
|
"DVsmApplyFrame",
|
||||||
|
refrtag("cont", cont_),
|
||||||
|
refrtag("n_args", args_->size())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
} /*namespace scm*/
|
||||||
|
} /*namespace xo*/
|
||||||
|
|
||||||
|
/* end DVsmApplyFrame.cpp */
|
||||||
77
xo-interpreter2/src/interpreter2/DVsmEvalArgsFrame.cpp
Normal file
77
xo-interpreter2/src/interpreter2/DVsmEvalArgsFrame.cpp
Normal file
|
|
@ -0,0 +1,77 @@
|
||||||
|
/** @file DVsmEvalArgsFrame.cpp
|
||||||
|
*
|
||||||
|
* @author Roland Conybeare, Feb 2026
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include "DVsmEvalArgsFrame.hpp"
|
||||||
|
#include <xo/indentlog/print/pretty.hpp>
|
||||||
|
|
||||||
|
namespace xo {
|
||||||
|
using xo::facet::typeseq;
|
||||||
|
using xo::print::ppindentinfo;
|
||||||
|
|
||||||
|
namespace scm {
|
||||||
|
|
||||||
|
// ----- VsmEvalArgsFrame -----
|
||||||
|
|
||||||
|
DVsmEvalArgsFrame::DVsmEvalArgsFrame(obj<AGCObject> old_parent,
|
||||||
|
VsmInstr old_cont)
|
||||||
|
: VsmFrame(old_parent, old_cont)
|
||||||
|
{}
|
||||||
|
|
||||||
|
DVsmEvalArgsFrame *
|
||||||
|
DVsmEvalArgsFrame::make(obj<AAllocator> mm,
|
||||||
|
obj<AGCObject> apply_frame,
|
||||||
|
VsmInstr cont)
|
||||||
|
{
|
||||||
|
DVsmEvalArgsFrame * result = nullptr;
|
||||||
|
|
||||||
|
void * mem = mm.alloc(typeseq::id<DVsmEvalArgsFrame>(),
|
||||||
|
sizeof(DVsmEvalArgsFrame));
|
||||||
|
|
||||||
|
result = new (mem) DVsmEvalArgsFrame(apply_frame, cont);
|
||||||
|
|
||||||
|
assert(result);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::size_t
|
||||||
|
DVsmEvalArgsFrame::shallow_size() const noexcept
|
||||||
|
{
|
||||||
|
return sizeof(DVsmEvalArgsFrame);
|
||||||
|
}
|
||||||
|
|
||||||
|
DVsmEvalArgsFrame *
|
||||||
|
DVsmEvalArgsFrame::shallow_copy(obj<AAllocator> mm) const noexcept
|
||||||
|
{
|
||||||
|
DVsmEvalArgsFrame * copy = (DVsmEvalArgsFrame *)mm.alloc_copy((std::byte *)this);
|
||||||
|
|
||||||
|
if (copy)
|
||||||
|
*copy = *this;
|
||||||
|
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::size_t
|
||||||
|
DVsmEvalArgsFrame::forward_children(obj<ACollector> gc) noexcept
|
||||||
|
{
|
||||||
|
(void)gc;
|
||||||
|
|
||||||
|
return this->shallow_size();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
DVsmEvalArgsFrame::pretty(const ppindentinfo & ppii) const
|
||||||
|
{
|
||||||
|
return ppii.pps()->pretty_struct
|
||||||
|
(ppii,
|
||||||
|
"DVsmEvalArgsFrame",
|
||||||
|
refrtag("cont", cont_),
|
||||||
|
refrtag("i_arg", i_arg_)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
} /*namespace scm*/
|
||||||
|
} /*namespace xo*/
|
||||||
|
|
||||||
|
/* end VsmEvalArgsFrame.cpp */
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
/** @file IGCObject_DVsmApplyFrame.cpp
|
||||||
|
*
|
||||||
|
* Generated automagically from ingredients:
|
||||||
|
* 1. code generator:
|
||||||
|
* [xo-facet/codegen/genfacet]
|
||||||
|
* arguments:
|
||||||
|
* --input [idl/IGCObject_DVsmApplyFrame.json5]
|
||||||
|
* 2. jinja2 template for abstract facet .hpp file:
|
||||||
|
* [iface_facet_any.hpp.j2]
|
||||||
|
* 3. idl for facet methods
|
||||||
|
* [idl/IGCObject_DVsmApplyFrame.json5]
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include "detail/IGCObject_DVsmApplyFrame.hpp"
|
||||||
|
|
||||||
|
namespace xo {
|
||||||
|
namespace scm {
|
||||||
|
auto
|
||||||
|
IGCObject_DVsmApplyFrame::shallow_size(const DVsmApplyFrame & self) noexcept -> size_type
|
||||||
|
{
|
||||||
|
return self.shallow_size();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto
|
||||||
|
IGCObject_DVsmApplyFrame::shallow_copy(const DVsmApplyFrame & self, obj<AAllocator> mm) noexcept -> Opaque
|
||||||
|
{
|
||||||
|
return self.shallow_copy(mm);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto
|
||||||
|
IGCObject_DVsmApplyFrame::forward_children(DVsmApplyFrame & self, obj<ACollector> gc) noexcept -> size_type
|
||||||
|
{
|
||||||
|
return self.forward_children(gc);
|
||||||
|
}
|
||||||
|
|
||||||
|
} /*namespace scm*/
|
||||||
|
} /*namespace xo*/
|
||||||
|
|
||||||
|
/* end IGCObject_DVsmApplyFrame.cpp */
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
/** @file IGCObject_DVsmEvalArgsFrame.cpp
|
||||||
|
*
|
||||||
|
* Generated automagically from ingredients:
|
||||||
|
* 1. code generator:
|
||||||
|
* [xo-facet/codegen/genfacet]
|
||||||
|
* arguments:
|
||||||
|
* --input [idl/IGCObject_DVsmEvalArgsFrame.json5]
|
||||||
|
* 2. jinja2 template for abstract facet .hpp file:
|
||||||
|
* [iface_facet_any.hpp.j2]
|
||||||
|
* 3. idl for facet methods
|
||||||
|
* [idl/IGCObject_DVsmEvalArgsFrame.json5]
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include "detail/IGCObject_DVsmEvalArgsFrame.hpp"
|
||||||
|
|
||||||
|
namespace xo {
|
||||||
|
namespace scm {
|
||||||
|
auto
|
||||||
|
IGCObject_DVsmEvalArgsFrame::shallow_size(const DVsmEvalArgsFrame & self) noexcept -> size_type
|
||||||
|
{
|
||||||
|
return self.shallow_size();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto
|
||||||
|
IGCObject_DVsmEvalArgsFrame::shallow_copy(const DVsmEvalArgsFrame & self, obj<AAllocator> mm) noexcept -> Opaque
|
||||||
|
{
|
||||||
|
return self.shallow_copy(mm);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto
|
||||||
|
IGCObject_DVsmEvalArgsFrame::forward_children(DVsmEvalArgsFrame & self, obj<ACollector> gc) noexcept -> size_type
|
||||||
|
{
|
||||||
|
return self.forward_children(gc);
|
||||||
|
}
|
||||||
|
|
||||||
|
} /*namespace scm*/
|
||||||
|
} /*namespace xo*/
|
||||||
|
|
||||||
|
/* end IGCObject_DVsmEvalArgsFrame.cpp */
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
/** @file IPrintable_DVsmApplyFrame.cpp
|
||||||
|
*
|
||||||
|
* Generated automagically from ingredients:
|
||||||
|
* 1. code generator:
|
||||||
|
* [xo-facet/codegen/genfacet]
|
||||||
|
* arguments:
|
||||||
|
* --input [idl/IPrintable_DVsmApplyFrame.json5]
|
||||||
|
* 2. jinja2 template for abstract facet .hpp file:
|
||||||
|
* [iface_facet_any.hpp.j2]
|
||||||
|
* 3. idl for facet methods
|
||||||
|
* [idl/IPrintable_DVsmApplyFrame.json5]
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include "detail/IPrintable_DVsmApplyFrame.hpp"
|
||||||
|
|
||||||
|
namespace xo {
|
||||||
|
namespace scm {
|
||||||
|
auto
|
||||||
|
IPrintable_DVsmApplyFrame::pretty(const DVsmApplyFrame & self, const ppindentinfo & ppii) -> bool
|
||||||
|
{
|
||||||
|
return self.pretty(ppii);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} /*namespace scm*/
|
||||||
|
} /*namespace xo*/
|
||||||
|
|
||||||
|
/* end IPrintable_DVsmApplyFrame.cpp */
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
/** @file IPrintable_DVsmEvalArgsFrame.cpp
|
||||||
|
*
|
||||||
|
* Generated automagically from ingredients:
|
||||||
|
* 1. code generator:
|
||||||
|
* [xo-facet/codegen/genfacet]
|
||||||
|
* arguments:
|
||||||
|
* --input [idl/IPrintable_DVsmEvalArgsFrame.json5]
|
||||||
|
* 2. jinja2 template for abstract facet .hpp file:
|
||||||
|
* [iface_facet_any.hpp.j2]
|
||||||
|
* 3. idl for facet methods
|
||||||
|
* [idl/IPrintable_DVsmEvalArgsFrame.json5]
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include "detail/IPrintable_DVsmEvalArgsFrame.hpp"
|
||||||
|
|
||||||
|
namespace xo {
|
||||||
|
namespace scm {
|
||||||
|
auto
|
||||||
|
IPrintable_DVsmEvalArgsFrame::pretty(const DVsmEvalArgsFrame & self, const ppindentinfo & ppii) -> bool
|
||||||
|
{
|
||||||
|
return self.pretty(ppii);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} /*namespace scm*/
|
||||||
|
} /*namespace xo*/
|
||||||
|
|
||||||
|
/* end IPrintable_DVsmEvalArgsFrame.cpp */
|
||||||
|
|
@ -4,6 +4,8 @@
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#include "VirtualSchematikaMachine.hpp"
|
#include "VirtualSchematikaMachine.hpp"
|
||||||
|
#include "VsmApplyFrame.hpp"
|
||||||
|
#include "VsmEvalArgsFrame.hpp"
|
||||||
#include <xo/expression2/ApplyExpr.hpp>
|
#include <xo/expression2/ApplyExpr.hpp>
|
||||||
#include <xo/expression2/Constant.hpp>
|
#include <xo/expression2/Constant.hpp>
|
||||||
#include <xo/gc/DX1Collector.hpp>
|
#include <xo/gc/DX1Collector.hpp>
|
||||||
|
|
@ -111,6 +113,17 @@ namespace xo {
|
||||||
bool
|
bool
|
||||||
VirtualSchematikaMachine::execute_one()
|
VirtualSchematikaMachine::execute_one()
|
||||||
{
|
{
|
||||||
|
scope log(XO_DEBUG(true));
|
||||||
|
log && log(xtag("pc", pc_),
|
||||||
|
xtag("cont", cont_));
|
||||||
|
|
||||||
|
obj<APrintable> stack_pr
|
||||||
|
= (FacetRegistry::instance()
|
||||||
|
.try_variant<APrintable,AGCObject>(stack_));
|
||||||
|
|
||||||
|
if (stack_pr)
|
||||||
|
log && log(xtag("stack", stack_pr));
|
||||||
|
|
||||||
switch (pc_.opcode()) {
|
switch (pc_.opcode()) {
|
||||||
case vsm_opcode::halt:
|
case vsm_opcode::halt:
|
||||||
case vsm_opcode::N:
|
case vsm_opcode::N:
|
||||||
|
|
@ -222,11 +235,13 @@ namespace xo {
|
||||||
|
|
||||||
// TODO: check function signature
|
// TODO: check function signature
|
||||||
|
|
||||||
VsmApplyFrame * apply_frame
|
auto apply_frame
|
||||||
= VsmApplyFrame::make(mm_.to_op(), stack_, cont_, args);
|
= obj<AGCObject,DVsmApplyFrame>
|
||||||
|
(DVsmApplyFrame::make(mm_.to_op(), stack_, cont_, args));
|
||||||
|
|
||||||
VsmEvalArgsFrame * evalargs_frame
|
auto evalargs_frame
|
||||||
= VsmEvalArgsFrame::make(mm_.to_op(), apply_frame, VsmInstr::c_apply);
|
= obj<AGCObject,DVsmEvalArgsFrame>
|
||||||
|
(DVsmEvalArgsFrame::make(mm_.to_op(), apply_frame, VsmInstr::c_apply));
|
||||||
|
|
||||||
this->stack_ = evalargs_frame;
|
this->stack_ = evalargs_frame;
|
||||||
|
|
||||||
|
|
|
||||||
0
xo-interpreter2/src/interpreter2/VsmApplyFrame.cpp
Normal file
0
xo-interpreter2/src/interpreter2/VsmApplyFrame.cpp
Normal file
|
|
@ -1,68 +0,0 @@
|
||||||
/** @file VsmFrame.cpp
|
|
||||||
*
|
|
||||||
* @author Roland Conybeare, Feb 2026
|
|
||||||
**/
|
|
||||||
|
|
||||||
#include "VsmFrame.hpp"
|
|
||||||
|
|
||||||
namespace xo {
|
|
||||||
using xo::facet::typeseq;
|
|
||||||
|
|
||||||
namespace scm {
|
|
||||||
|
|
||||||
VsmApplyFrame::VsmApplyFrame(VsmFrame * old_parent,
|
|
||||||
VsmInstr old_cont,
|
|
||||||
DArray * args)
|
|
||||||
: VsmFrame(old_parent, old_cont),
|
|
||||||
args_{args}
|
|
||||||
{}
|
|
||||||
|
|
||||||
VsmApplyFrame *
|
|
||||||
VsmApplyFrame::make(obj<AAllocator> mm,
|
|
||||||
VsmFrame * old_parent,
|
|
||||||
VsmInstr old_cont,
|
|
||||||
DArray * args)
|
|
||||||
{
|
|
||||||
VsmApplyFrame * result = nullptr;
|
|
||||||
|
|
||||||
void * mem = mm.alloc(typeseq::id<VsmApplyFrame>(),
|
|
||||||
sizeof(VsmApplyFrame));
|
|
||||||
|
|
||||||
result = new (mem) VsmApplyFrame(old_parent,
|
|
||||||
old_cont,
|
|
||||||
args);
|
|
||||||
|
|
||||||
assert(result);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----- VsmEvalArgsFrame -----
|
|
||||||
|
|
||||||
VsmEvalArgsFrame::VsmEvalArgsFrame(VsmApplyFrame * old_parent,
|
|
||||||
VsmInstr old_cont)
|
|
||||||
: VsmFrame(old_parent, old_cont)
|
|
||||||
{}
|
|
||||||
|
|
||||||
VsmEvalArgsFrame *
|
|
||||||
VsmEvalArgsFrame::make(obj<AAllocator> mm,
|
|
||||||
VsmApplyFrame * apply_frame,
|
|
||||||
VsmInstr cont)
|
|
||||||
{
|
|
||||||
VsmEvalArgsFrame * result = nullptr;
|
|
||||||
|
|
||||||
void * mem = mm.alloc(typeseq::id<VsmEvalArgsFrame>(),
|
|
||||||
sizeof(VsmEvalArgsFrame));
|
|
||||||
|
|
||||||
result = new (mem) VsmEvalArgsFrame(apply_frame, cont);
|
|
||||||
|
|
||||||
assert(result);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
} /*namespace scm*/
|
|
||||||
} /*namespace xo*/
|
|
||||||
|
|
||||||
/* end VsmFrame.cpp */
|
|
||||||
|
|
||||||
|
|
@ -7,6 +7,21 @@
|
||||||
|
|
||||||
namespace xo {
|
namespace xo {
|
||||||
namespace scm {
|
namespace scm {
|
||||||
|
const char *
|
||||||
|
vsm_opcode_descr(vsm_opcode x)
|
||||||
|
{
|
||||||
|
switch (x) {
|
||||||
|
case vsm_opcode::halt: return "halt";
|
||||||
|
case vsm_opcode::eval: return "eval";
|
||||||
|
case vsm_opcode::apply: return "apply";
|
||||||
|
case vsm_opcode::evalargs: return "evalargs";
|
||||||
|
case vsm_opcode::N:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return "opcode?";
|
||||||
|
}
|
||||||
|
|
||||||
VsmInstr
|
VsmInstr
|
||||||
VsmInstr::c_halt = VsmInstr(vsm_opcode::halt);
|
VsmInstr::c_halt = VsmInstr(vsm_opcode::halt);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,31 +5,23 @@
|
||||||
|
|
||||||
#include "init_interpreter2.hpp"
|
#include "init_interpreter2.hpp"
|
||||||
|
|
||||||
#ifdef NOT_YET
|
|
||||||
#include "interpreter2_register_facets.hpp"
|
#include "interpreter2_register_facets.hpp"
|
||||||
#include "interpreter2_register_types.hpp"
|
#include "interpreter2_register_types.hpp"
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <xo/reader2/init_reader2.hpp>
|
#include <xo/reader2/init_reader2.hpp>
|
||||||
#ifdef NOT_YET
|
|
||||||
#include <xo/gc/CollectorTypeRegistry.hpp>
|
#include <xo/gc/CollectorTypeRegistry.hpp>
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace xo {
|
namespace xo {
|
||||||
#ifdef NOT_YET
|
|
||||||
using xo::scm::interpreter2_register_facets;
|
using xo::scm::interpreter2_register_facets;
|
||||||
using xo::scm::interpreter2_register_types;
|
using xo::scm::interpreter2_register_types;
|
||||||
using xo::mm::CollectorTypeRegistry;
|
using xo::mm::CollectorTypeRegistry;
|
||||||
#endif
|
|
||||||
|
|
||||||
void
|
void
|
||||||
InitSubsys<S_interpreter2_tag>::init()
|
InitSubsys<S_interpreter2_tag>::init()
|
||||||
{
|
{
|
||||||
#ifdef NOT_YET
|
|
||||||
interpreter2_register_facets();
|
interpreter2_register_facets();
|
||||||
|
|
||||||
CollectorTypeRegistry::instance().register_types(&interpreter2_register_types);
|
CollectorTypeRegistry::instance().register_types(&interpreter2_register_types);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
InitEvidence
|
InitEvidence
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,47 @@
|
||||||
|
/** @file interpreter2_register_facets.cpp
|
||||||
|
*
|
||||||
|
* @author Roland Conybeare, Feb 2026
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include "interpreter2_register_facets.hpp"
|
||||||
|
|
||||||
|
#include "VsmApplyFrame.hpp"
|
||||||
|
#include "VsmEvalArgsFrame.hpp"
|
||||||
|
|
||||||
|
#include <xo/printable2/detail/APrintable.hpp>
|
||||||
|
#include <xo/facet/FacetRegistry.hpp>
|
||||||
|
#include <xo/reflectutil/typeseq.hpp>
|
||||||
|
#include <xo/indentlog/scope.hpp>
|
||||||
|
|
||||||
|
namespace xo {
|
||||||
|
using xo::mm::AGCObject;
|
||||||
|
using xo::print::APrintable;
|
||||||
|
using xo::facet::FacetRegistry;
|
||||||
|
using xo::reflect::typeseq;
|
||||||
|
using xo::xtag;
|
||||||
|
|
||||||
|
namespace scm {
|
||||||
|
bool
|
||||||
|
interpreter2_register_facets()
|
||||||
|
{
|
||||||
|
scope log(XO_DEBUG(true));
|
||||||
|
|
||||||
|
// VsmStackFrame
|
||||||
|
// +- VsmApplyFrame
|
||||||
|
// \- VsmEvalArgsFrame
|
||||||
|
|
||||||
|
FacetRegistry::register_impl<AGCObject, DVsmApplyFrame>();
|
||||||
|
FacetRegistry::register_impl<APrintable, DVsmApplyFrame>();
|
||||||
|
|
||||||
|
FacetRegistry::register_impl<AGCObject, DVsmEvalArgsFrame>();
|
||||||
|
FacetRegistry::register_impl<APrintable, DVsmEvalArgsFrame>();
|
||||||
|
|
||||||
|
log && log(xtag("DVsmApplyFrame.tseq", typeseq::id<DVsmApplyFrame>()));
|
||||||
|
log && log(xtag("DVsmEvalArgsFrame.tseq", typeseq::id<DVsmEvalArgsFrame>()));
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} /*namespace scm*/
|
||||||
|
} /*namespace xo*/
|
||||||
|
|
||||||
|
/* end interpreter2_register_facets.cpp */
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
/** @file interpreter2_register_types.cpp
|
||||||
|
*
|
||||||
|
* @author Roland Conybeare, Jan 2026
|
||||||
|
**/
|
||||||
|
|
||||||
|
#include "interpreter2_register_types.hpp"
|
||||||
|
|
||||||
|
#include "VsmApplyFrame.hpp"
|
||||||
|
#include "VsmEvalArgsFrame.hpp"
|
||||||
|
|
||||||
|
#include <xo/indentlog/scope.hpp>
|
||||||
|
|
||||||
|
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
|
||||||
|
interpreter2_register_types(obj<ACollector> gc)
|
||||||
|
{
|
||||||
|
scope log(XO_DEBUG(true));
|
||||||
|
|
||||||
|
bool ok = true;
|
||||||
|
|
||||||
|
ok &= gc.install_type(impl_for<AGCObject, DVsmApplyFrame>());
|
||||||
|
ok &= gc.install_type(impl_for<AGCObject, DVsmEvalArgsFrame>());
|
||||||
|
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} /*namespace xo*/
|
||||||
|
|
||||||
|
/* end interpreter2_register_types.cpp */
|
||||||
Loading…
Add table
Add a link
Reference in a new issue