xo-umbrella2/xo-interpreter2/include/xo/interpreter2/DVsmApplyClosureFrame.hpp
Roland Conybeare 7f4b4e7cbd git subrepo clone (merge) git@github.com:Rconybea/xo-interpreter2.git xo-interpreter2
subrepo:
  subdir:   "xo-interpreter2"
  merged:   "e4c6ff57"
upstream:
  origin:   "git@github.com:Rconybea/xo-interpreter2.git"
  branch:   "main"
  commit:   "e4c6ff57"
git-subrepo:
  version:  "0.4.9"
  origin:   "???"
  commit:   "???"
2026-06-06 22:13:05 -04:00

64 lines
2.1 KiB
C++

/** @file DVsmApplyClosureFrame.hpp
*
* @author Roland Conybeare, Feb 2026
**/
#pragma once
#include "VsmInstr.hpp"
#include "DLocalEnv.hpp"
#include <xo/expression2/DApplyExpr.hpp>
namespace xo {
namespace scm {
/** Frame to preserve VSM registers:
* (stack_, parent_, cont_)
* while applying a closure.
**/
class DVsmApplyClosureFrame {
public:
using ACollector = xo::mm::ACollector;
using AGCObject = xo::mm::AGCObject;
using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using VisitReason = xo::mm::VisitReason;
using AAllocator = xo::mm::AAllocator;
using ppindentinfo = xo::print::ppindentinfo;
public:
DVsmApplyClosureFrame(obj<AGCObject> stack,
VsmInstr cont,
DLocalEnv * env);
/** create instance, using memory from @p mm **/
static DVsmApplyClosureFrame * make(obj<AAllocator> mm,
obj<AGCObject> parent,
VsmInstr cont,
DLocalEnv * env);
obj<AGCObject> parent() const { return stack_; }
VsmInstr cont() const { return cont_; }
DLocalEnv * local_env() const { return local_env_; }
/** gcobject facet **/
std::size_t shallow_size() const noexcept;
DVsmApplyClosureFrame * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept;
void visit_gco_children(VisitReason reason, obj<AGCObjectVisitor> gc) noexcept;
/** pretty-printing support **/
bool pretty(const ppindentinfo & ppii) const;
protected:
/** saved VSM stack_ register **/
obj<AGCObject> stack_;
/** saved VSM cont_ register **/
VsmInstr cont_;
/** saved VSM local_env_ register **/
DLocalEnv * local_env_ = nullptr;
};
} /*namespace scm*/
} /*namespace xo*/
/* end DVsmApplyClosureFrame.hpp */