xo-interpreter2: vsm stack: facet + gcobject + printable + init
This commit is contained in:
parent
dc88663271
commit
5292518eaf
33 changed files with 980 additions and 141 deletions
82
src/interpreter2/DVsmApplyFrame.cpp
Normal file
82
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 */
|
||||
Loading…
Add table
Add a link
Reference in a new issue