xo-interpreter2: + VsmApplyClosureFrame [WIP, not used]

This commit is contained in:
Roland Conybeare 2026-02-13 00:09:43 -05:00
commit eecc70d6eb
17 changed files with 410 additions and 12 deletions

View file

@ -16,6 +16,10 @@ set(SELF_SRCS
IGCObject_DVsmApplyFrame.cpp
IPrintable_DVsmApplyFrame.cpp
DVsmApplyClosureFrame.cpp
IGCObject_DVsmApplyClosureFrame.cpp
IPrintable_DVsmApplyClosureFrame.cpp
DClosure.cpp
IProcedure_DClosure.cpp
IGCObject_DClosure.cpp

View file

@ -0,0 +1,59 @@
/** @file DVsmApplyClosureFrame.cpp
*
* @author Roland Conybeare, Feb 2026
**/
#include "DVsmApplyClosureFrame.hpp"
namespace xo {
using xo::mm::AGCObject;
namespace scm {
DVsmApplyClosureFrame::DVsmApplyClosureFrame(obj<AGCObject> stack,
VsmInstr cont,
DLocalEnv * local_env)
: stack_{stack},
cont_{cont},
local_env_{local_env}
{}
std::size_t
DVsmApplyClosureFrame::shallow_size() const noexcept
{
return sizeof(DVsmApplyClosureFrame);
}
DVsmApplyClosureFrame *
DVsmApplyClosureFrame::shallow_copy(obj<AAllocator> mm) const noexcept
{
DVsmApplyClosureFrame * copy
= (DVsmApplyClosureFrame *)mm.alloc_copy((std::byte *)this);
if (copy)
*copy = *this;
return copy;
}
std::size_t
DVsmApplyClosureFrame::forward_children(obj<ACollector> gc) noexcept
{
(void)gc;
return this->shallow_size();
}
bool
DVsmApplyClosureFrame::pretty(const ppindentinfo & ppii) const
{
return ppii.pps()->pretty_struct
(ppii,
"DVsmApplyClosureFrame",
refrtag("cont", cont_),
refrtag("env", local_env_));
}
} /*namespace scm*/
} /*namespace xo*/
/* end DVsmApplyClosureFrame.cpp */

View file

@ -14,8 +14,9 @@ namespace xo {
DVsmApplyFrame::DVsmApplyFrame(obj<AGCObject> old_parent,
VsmInstr old_cont,
DArray * args)
: VsmFrame(old_parent, old_cont),
args_{args}
: parent_{old_parent},
cont_{old_cont},
args_{args}
{}
DVsmApplyFrame *

View file

@ -49,7 +49,8 @@ namespace xo {
DVsmEvalArgsFrame *
DVsmEvalArgsFrame::shallow_copy(obj<AAllocator> mm) const noexcept
{
DVsmEvalArgsFrame * copy = (DVsmEvalArgsFrame *)mm.alloc_copy((std::byte *)this);
DVsmEvalArgsFrame * copy
= (DVsmEvalArgsFrame *)mm.alloc_copy((std::byte *)this);
if (copy)
*copy = *this;

View file

@ -0,0 +1,39 @@
/** @file IGCObject_DVsmApplyClosureFrame.cpp
*
* Generated automagically from ingredients:
* 1. code generator:
* [xo-facet/codegen/genfacet]
* arguments:
* --input [idl/IGCObject_DVsmApplyClosureFrame.json5]
* 2. jinja2 template for abstract facet .hpp file:
* [iface_facet_any.hpp.j2]
* 3. idl for facet methods
* [idl/IGCObject_DVsmApplyClosureFrame.json5]
**/
#include "detail/IGCObject_DVsmApplyClosureFrame.hpp"
namespace xo {
namespace scm {
auto
IGCObject_DVsmApplyClosureFrame::shallow_size(const DVsmApplyClosureFrame & self) noexcept -> size_type
{
return self.shallow_size();
}
auto
IGCObject_DVsmApplyClosureFrame::shallow_copy(const DVsmApplyClosureFrame & self, obj<AAllocator> mm) noexcept -> Opaque
{
return self.shallow_copy(mm);
}
auto
IGCObject_DVsmApplyClosureFrame::forward_children(DVsmApplyClosureFrame & self, obj<ACollector> gc) noexcept -> size_type
{
return self.forward_children(gc);
}
} /*namespace scm*/
} /*namespace xo*/
/* end IGCObject_DVsmApplyClosureFrame.cpp */

View file

@ -0,0 +1,28 @@
/** @file IPrintable_DVsmApplyClosureFrame.cpp
*
* Generated automagically from ingredients:
* 1. code generator:
* [xo-facet/codegen/genfacet]
* arguments:
* --input [idl/IPrintable_DVsmApplyClosureFrame.json5]
* 2. jinja2 template for abstract facet .hpp file:
* [iface_facet_any.hpp.j2]
* 3. idl for facet methods
* [idl/IPrintable_DVsmApplyClosureFrame.json5]
**/
#include "detail/IPrintable_DVsmApplyClosureFrame.hpp"
namespace xo {
namespace scm {
auto
IPrintable_DVsmApplyClosureFrame::pretty(const DVsmApplyClosureFrame & self, const ppindentinfo & ppii) -> bool
{
return self.pretty(ppii);
}
} /*namespace scm*/
} /*namespace xo*/
/* end IPrintable_DVsmApplyClosureFrame.cpp */

View file

@ -62,7 +62,7 @@ namespace xo {
error_mm_.adopt(obj<AAllocator,DArena>(arena));
}
// TODO: allocate global_env
}

View file

@ -5,8 +5,11 @@
#include "interpreter2_register_facets.hpp"
#include "DPrimitive_gco_2_gco_gco.hpp"
#include "VsmApplyFrame.hpp"
#include "VsmEvalArgsFrame.hpp"
#include "VsmApplyClosureFrame.hpp"
#include "Primitive_gco_2_gco_gco.hpp"
#include "Closure.hpp"
#include "LocalEnv.hpp"
#include "VsmRcx.hpp"
@ -31,7 +34,8 @@ namespace xo {
// VsmStackFrame
// +- VsmApplyFrame
// \- VsmEvalArgsFrame
// +- VsmEvalArgsFrame
// \- VsmApplyClosureFrame
FacetRegistry::register_impl<AGCObject, DVsmApplyFrame>();
FacetRegistry::register_impl<APrintable, DVsmApplyFrame>();
@ -39,9 +43,10 @@ namespace xo {
FacetRegistry::register_impl<AGCObject, DVsmEvalArgsFrame>();
FacetRegistry::register_impl<APrintable, DVsmEvalArgsFrame>();
FacetRegistry::register_impl<AProcedure, DClosure>();
FacetRegistry::register_impl<AGCObject, DClosure>();
FacetRegistry::register_impl<APrintable, DClosure>();
FacetRegistry::register_impl<AGCObject, DVsmApplyClosureFrame>();
FacetRegistry::register_impl<APrintable, DVsmApplyClosureFrame>();
// LocalEnv
FacetRegistry::register_impl<AGCObject, DLocalEnv>();
FacetRegistry::register_impl<APrintable, DLocalEnv>();
@ -50,7 +55,13 @@ namespace xo {
// +- Primitive_gco_2_gco_gco
// \- Closure
FacetRegistry::register_impl<AProcedure, DPrimitive_gco_2_gco_gco>();
FacetRegistry::register_impl<AGCObject, DPrimitive_gco_2_gco_gco>();
FacetRegistry::register_impl<APrintable, DPrimitive_gco_2_gco_gco>();
FacetRegistry::register_impl<AProcedure, DClosure>();
FacetRegistry::register_impl<AGCObject, DClosure>();
FacetRegistry::register_impl<APrintable, DClosure>();
// RuntimeContext
// \- VsmRcx