xo-interpreter2 stack: + reason arg to visit_gco_children()
Helps streamline DX1Collector in xo-gc/. Want both forward and verify entry points for the same representation.
This commit is contained in:
parent
997d3d8264
commit
822af3a246
46 changed files with 124 additions and 142 deletions
|
|
@ -125,23 +125,16 @@ namespace xo {
|
|||
}
|
||||
|
||||
void
|
||||
DApplyExpr::visit_gco_children(obj<AGCObjectVisitor> gc) noexcept
|
||||
DApplyExpr::visit_gco_children(VisitReason reason, obj<AGCObjectVisitor> gc) noexcept
|
||||
{
|
||||
typeref_.visit_gco_children(gc);
|
||||
typeref_.visit_gco_children(reason, gc);
|
||||
|
||||
{
|
||||
gc.visit_poly_child(&fn_);
|
||||
//obj<AGCObject> fn_gco = fn_.to_facet<AGCObject>();
|
||||
//gc.forward_inplace(fn_gco.iface(), (void **)&fn_.data_);
|
||||
}
|
||||
gc.visit_poly_child(reason, &fn_);
|
||||
|
||||
for (size_type i = 0; i < n_args_; ++i) {
|
||||
obj<AExpression> & arg = args_[i];
|
||||
|
||||
// runtime poly here
|
||||
gc.visit_poly_child(&arg);
|
||||
//obj<AGCObject> arg_gco = arg.to_facet<AGCObject>();
|
||||
//gc.forward_inplace(arg_gco.iface(), (void **)(&arg.data_));
|
||||
gc.visit_poly_child(reason, &arg);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
* @author Roland Conybeare, Jan 2026
|
||||
**/
|
||||
|
||||
#include "DConstant.hpp"
|
||||
#include "detail/IExpression_DConstant.hpp"
|
||||
#include "Constant.hpp"
|
||||
//#include "detail/IExpression_DConstant.hpp"
|
||||
#include "TypeDescr.hpp"
|
||||
#include <xo/object2/DFloat.hpp>
|
||||
#include <xo/object2/DInteger.hpp>
|
||||
|
|
@ -78,11 +78,12 @@ namespace xo {
|
|||
}
|
||||
|
||||
void
|
||||
DConstant::visit_gco_children(obj<AGCObjectVisitor> gc) noexcept
|
||||
DConstant::visit_gco_children(VisitReason reason,
|
||||
obj<AGCObjectVisitor> gc) noexcept
|
||||
{
|
||||
typeref_.visit_gco_children(gc);
|
||||
typeref_.visit_gco_children(reason, gc);
|
||||
|
||||
gc.visit_child(&value_);
|
||||
gc.visit_child(reason, &value_);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
|||
|
|
@ -85,11 +85,11 @@ namespace xo {
|
|||
}
|
||||
|
||||
void
|
||||
DDefineExpr::visit_gco_children(obj<AGCObjectVisitor> gc) noexcept
|
||||
DDefineExpr::visit_gco_children(VisitReason reason,
|
||||
obj<AGCObjectVisitor> gc) noexcept
|
||||
{
|
||||
gc.visit_child(&lhs_var_);
|
||||
//gc.forward_inplace(&rhs_); // complicated - need to access via GCObject facet
|
||||
gc.visit_poly_child(&rhs_);
|
||||
gc.visit_child(reason, &lhs_var_);
|
||||
gc.visit_poly_child(reason, &rhs_);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
@ -104,9 +104,6 @@ namespace xo {
|
|||
if (lhs_var_)
|
||||
assert(lhs.data());
|
||||
|
||||
(void)lhs;
|
||||
(void)rhs;
|
||||
|
||||
if (rhs_)
|
||||
assert(rhs.data());
|
||||
|
||||
|
|
|
|||
|
|
@ -269,15 +269,22 @@ namespace xo {
|
|||
}
|
||||
|
||||
void
|
||||
DGlobalSymtab::visit_gco_children(obj<AGCObjectVisitor> gc) noexcept
|
||||
DGlobalSymtab::visit_gco_children(VisitReason reason,
|
||||
obj<AGCObjectVisitor> gc) noexcept
|
||||
{
|
||||
// map_ doesn't contain any gc-owned data, can skip
|
||||
|
||||
#ifdef __APPLE__
|
||||
// clang not recognizing these as comptime eligible
|
||||
assert(var_map_.is_gc_eligible() == false);
|
||||
assert(type_map_.is_gc_eligible() == false);
|
||||
#else
|
||||
static_assert(var_map_.is_gc_eligible() == false);
|
||||
static_assert(type_map_.is_gc_eligible() == false);
|
||||
#endif
|
||||
|
||||
gc.visit_child(&vars_);
|
||||
gc.visit_child(&types_);
|
||||
gc.visit_child(reason, &vars_);
|
||||
gc.visit_child(reason, &types_);
|
||||
}
|
||||
|
||||
// ----- printable facet -----
|
||||
|
|
|
|||
|
|
@ -89,26 +89,15 @@ namespace xo {
|
|||
}
|
||||
|
||||
void
|
||||
DIfElseExpr::visit_gco_children(obj<AGCObjectVisitor> gc) noexcept
|
||||
DIfElseExpr::visit_gco_children(VisitReason reason,
|
||||
obj<AGCObjectVisitor> gc) noexcept
|
||||
{
|
||||
typeref_.visit_gco_children(gc);
|
||||
typeref_.visit_gco_children(reason, gc);
|
||||
|
||||
// GC needs to locate AGCObject iface for each member.
|
||||
{
|
||||
gc.visit_poly_child(&test_);
|
||||
//auto gco = test_.to_facet<AGCObject>();
|
||||
//gc.forward_inplace(gco.iface(), (void **)&(test_.data_));
|
||||
}
|
||||
{
|
||||
gc.visit_poly_child(&when_true_);
|
||||
//auto gco = when_true_.to_facet<AGCObject>();
|
||||
//gc.forward_inplace(gco.iface(), (void **)&(when_true_.data_));
|
||||
}
|
||||
{
|
||||
gc.visit_poly_child(&when_false_);
|
||||
//auto gco = when_false_.to_facet<AGCObject>();
|
||||
//gc.forward_inplace(gco.iface(), (void **)&(when_false_.data_));
|
||||
}
|
||||
gc.visit_poly_child(reason, &test_);
|
||||
gc.visit_poly_child(reason, &when_true_);
|
||||
gc.visit_poly_child(reason, &when_false_);
|
||||
}
|
||||
|
||||
// ----- printable facet -----
|
||||
|
|
|
|||
|
|
@ -146,26 +146,15 @@ namespace xo {
|
|||
}
|
||||
|
||||
void
|
||||
DLambdaExpr::visit_gco_children(obj<AGCObjectVisitor> gc) noexcept {
|
||||
typeref_.visit_gco_children(gc);
|
||||
|
||||
gc.visit_child(&name_);
|
||||
//{
|
||||
// auto iface = xo::facet::impl_for<AGCObject,DUniqueString>();
|
||||
// gc.forward_inplace(&iface, (void **)(&name_));
|
||||
//}
|
||||
DLambdaExpr::visit_gco_children(VisitReason reason,
|
||||
obj<AGCObjectVisitor> gc) noexcept {
|
||||
typeref_.visit_gco_children(reason, gc);
|
||||
|
||||
gc.visit_child(reason, &name_);
|
||||
// type_name_str_
|
||||
|
||||
{
|
||||
gc.visit_child(&local_symtab_);
|
||||
//gc.forward_inplace(&local_symtab_);
|
||||
}
|
||||
|
||||
{
|
||||
gc.visit_poly_child(&body_expr_);
|
||||
//gc.forward_pivot_inplace(&body_expr_);
|
||||
}
|
||||
gc.visit_child(reason, &local_symtab_);
|
||||
gc.visit_poly_child(reason, &body_expr_);
|
||||
|
||||
// xxx free_var_set
|
||||
// xxx captured_var_set
|
||||
|
|
|
|||
|
|
@ -119,11 +119,12 @@ namespace xo {
|
|||
}
|
||||
|
||||
void
|
||||
DLocalSymtab::visit_gco_children(obj<AGCObjectVisitor> gc) noexcept
|
||||
DLocalSymtab::visit_gco_children(VisitReason reason,
|
||||
obj<AGCObjectVisitor> gc) noexcept
|
||||
{
|
||||
gc.visit_child(&parent_);
|
||||
gc.visit_child(&vars_);
|
||||
gc.visit_child(&types_);
|
||||
gc.visit_child(reason, &parent_);
|
||||
gc.visit_child(reason, &vars_);
|
||||
gc.visit_child(reason, &types_);
|
||||
}
|
||||
|
||||
// ----- printable facet -----
|
||||
|
|
|
|||
|
|
@ -120,11 +120,11 @@ namespace xo {
|
|||
}
|
||||
|
||||
void
|
||||
DSequenceExpr::visit_gco_children(obj<AGCObjectVisitor> gc) noexcept
|
||||
DSequenceExpr::visit_gco_children(VisitReason reason, obj<AGCObjectVisitor> gc) noexcept
|
||||
{
|
||||
typeref_.visit_gco_children(gc);
|
||||
typeref_.visit_gco_children(reason, gc);
|
||||
|
||||
gc.visit_child(&expr_v_);
|
||||
gc.visit_child(reason, &expr_v_);
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
|
|
|
|||
|
|
@ -47,15 +47,11 @@ namespace xo {
|
|||
}
|
||||
|
||||
void
|
||||
DTypename::visit_gco_children(obj<AGCObjectVisitor> gc) noexcept
|
||||
DTypename::visit_gco_children(VisitReason reason,
|
||||
obj<AGCObjectVisitor> gc) noexcept
|
||||
{
|
||||
gc.visit_child(&name_);
|
||||
//gc.forward_inplace(const_cast<DUniqueString**>(&name_));
|
||||
{
|
||||
gc.visit_poly_child(&type_);
|
||||
//auto e = type_.to_facet<AGCObject>();
|
||||
//gc.forward_inplace(e.iface(), (void **)&(type_.data_));
|
||||
}
|
||||
gc.visit_child(reason, &name_);
|
||||
gc.visit_poly_child(reason, &type_);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
|||
|
|
@ -65,9 +65,10 @@ namespace xo {
|
|||
}
|
||||
|
||||
void
|
||||
DVarRef::visit_gco_children(obj<AGCObjectVisitor> gc) noexcept
|
||||
DVarRef::visit_gco_children(VisitReason reason,
|
||||
obj<AGCObjectVisitor> gc) noexcept
|
||||
{
|
||||
gc.visit_child(&vardef_);
|
||||
gc.visit_child(reason, &vardef_);
|
||||
//auto iface = xo::facet::impl_for<AGCObject,DVariable>();
|
||||
//gc.forward_inplace(&iface, (void **)vardef_.data_);
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@
|
|||
#include <cstddef>
|
||||
|
||||
namespace xo {
|
||||
using xo::mm::ACollector;
|
||||
using xo::facet::typeseq;
|
||||
|
||||
namespace scm {
|
||||
|
|
@ -45,9 +44,9 @@ namespace xo {
|
|||
}
|
||||
|
||||
void
|
||||
DVariable::visit_gco_children(obj<AGCObjectVisitor> gc) noexcept
|
||||
DVariable::visit_gco_children(VisitReason reason, obj<AGCObjectVisitor> gc) noexcept
|
||||
{
|
||||
typeref_.visit_gco_children(gc);
|
||||
typeref_.visit_gco_children(reason, gc);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@ namespace xo {
|
|||
return self.gco_shallow_move(gc);
|
||||
}
|
||||
auto
|
||||
IGCObject_DApplyExpr::visit_gco_children(DApplyExpr & self, obj<AGCObjectVisitor> fn) noexcept -> void
|
||||
IGCObject_DApplyExpr::visit_gco_children(DApplyExpr & self, VisitReason reason, obj<AGCObjectVisitor> fn) noexcept -> void
|
||||
{
|
||||
self.visit_gco_children(fn);
|
||||
self.visit_gco_children(reason, fn);
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@ namespace xo {
|
|||
return self.gco_shallow_move(gc);
|
||||
}
|
||||
auto
|
||||
IGCObject_DConstant::visit_gco_children(DConstant & self, obj<AGCObjectVisitor> fn) noexcept -> void
|
||||
IGCObject_DConstant::visit_gco_children(DConstant & self, VisitReason reason, obj<AGCObjectVisitor> fn) noexcept -> void
|
||||
{
|
||||
self.visit_gco_children(fn);
|
||||
self.visit_gco_children(reason, fn);
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@ namespace xo {
|
|||
return self.gco_shallow_move(gc);
|
||||
}
|
||||
auto
|
||||
IGCObject_DDefineExpr::visit_gco_children(DDefineExpr & self, obj<AGCObjectVisitor> fn) noexcept -> void
|
||||
IGCObject_DDefineExpr::visit_gco_children(DDefineExpr & self, VisitReason reason, obj<AGCObjectVisitor> fn) noexcept -> void
|
||||
{
|
||||
self.visit_gco_children(fn);
|
||||
self.visit_gco_children(reason, fn);
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@ namespace xo {
|
|||
return self.gco_shallow_move(gc);
|
||||
}
|
||||
auto
|
||||
IGCObject_DGlobalSymtab::visit_gco_children(DGlobalSymtab & self, obj<AGCObjectVisitor> fn) noexcept -> void
|
||||
IGCObject_DGlobalSymtab::visit_gco_children(DGlobalSymtab & self, VisitReason reason, obj<AGCObjectVisitor> fn) noexcept -> void
|
||||
{
|
||||
self.visit_gco_children(fn);
|
||||
self.visit_gco_children(reason, fn);
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@ namespace xo {
|
|||
return self.gco_shallow_move(gc);
|
||||
}
|
||||
auto
|
||||
IGCObject_DIfElseExpr::visit_gco_children(DIfElseExpr & self, obj<AGCObjectVisitor> fn) noexcept -> void
|
||||
IGCObject_DIfElseExpr::visit_gco_children(DIfElseExpr & self, VisitReason reason, obj<AGCObjectVisitor> fn) noexcept -> void
|
||||
{
|
||||
self.visit_gco_children(fn);
|
||||
self.visit_gco_children(reason, fn);
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@ namespace xo {
|
|||
return self.gco_shallow_move(gc);
|
||||
}
|
||||
auto
|
||||
IGCObject_DLambdaExpr::visit_gco_children(DLambdaExpr & self, obj<AGCObjectVisitor> fn) noexcept -> void
|
||||
IGCObject_DLambdaExpr::visit_gco_children(DLambdaExpr & self, VisitReason reason, obj<AGCObjectVisitor> fn) noexcept -> void
|
||||
{
|
||||
self.visit_gco_children(fn);
|
||||
self.visit_gco_children(reason, fn);
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@ namespace xo {
|
|||
return self.gco_shallow_move(gc);
|
||||
}
|
||||
auto
|
||||
IGCObject_DLocalSymtab::visit_gco_children(DLocalSymtab & self, obj<AGCObjectVisitor> fn) noexcept -> void
|
||||
IGCObject_DLocalSymtab::visit_gco_children(DLocalSymtab & self, VisitReason reason, obj<AGCObjectVisitor> fn) noexcept -> void
|
||||
{
|
||||
self.visit_gco_children(fn);
|
||||
self.visit_gco_children(reason, fn);
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@ namespace xo {
|
|||
return self.gco_shallow_move(gc);
|
||||
}
|
||||
auto
|
||||
IGCObject_DSequenceExpr::visit_gco_children(DSequenceExpr & self, obj<AGCObjectVisitor> fn) noexcept -> void
|
||||
IGCObject_DSequenceExpr::visit_gco_children(DSequenceExpr & self, VisitReason reason, obj<AGCObjectVisitor> fn) noexcept -> void
|
||||
{
|
||||
self.visit_gco_children(fn);
|
||||
self.visit_gco_children(reason, fn);
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@ namespace xo {
|
|||
return self.gco_shallow_move(gc);
|
||||
}
|
||||
auto
|
||||
IGCObject_DTypename::visit_gco_children(DTypename & self, obj<AGCObjectVisitor> fn) noexcept -> void
|
||||
IGCObject_DTypename::visit_gco_children(DTypename & self, VisitReason reason, obj<AGCObjectVisitor> fn) noexcept -> void
|
||||
{
|
||||
self.visit_gco_children(fn);
|
||||
self.visit_gco_children(reason, fn);
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@ namespace xo {
|
|||
return self.gco_shallow_move(gc);
|
||||
}
|
||||
auto
|
||||
IGCObject_DVarRef::visit_gco_children(DVarRef & self, obj<AGCObjectVisitor> fn) noexcept -> void
|
||||
IGCObject_DVarRef::visit_gco_children(DVarRef & self, VisitReason reason, obj<AGCObjectVisitor> fn) noexcept -> void
|
||||
{
|
||||
self.visit_gco_children(fn);
|
||||
self.visit_gco_children(reason, fn);
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
|
|
|
|||
|
|
@ -102,11 +102,10 @@ namespace xo {
|
|||
}
|
||||
|
||||
void
|
||||
TypeRef::visit_gco_children(obj<AGCObjectVisitor> gc) noexcept
|
||||
TypeRef::visit_gco_children(VisitReason reason,
|
||||
obj<AGCObjectVisitor> gc) noexcept
|
||||
{
|
||||
//scope log(XO_DEBUG(true), xtag("type", type_.data()), xtag("type.tseq", type_._typeseq()));
|
||||
|
||||
gc.visit_poly_child(&type_);
|
||||
gc.visit_poly_child(reason, &type_);
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@ namespace xo {
|
|||
return self.gco_shallow_move(gc);
|
||||
}
|
||||
auto
|
||||
IGCObject_DVariable::visit_gco_children(DVariable & self, obj<AGCObjectVisitor> fn) noexcept -> void
|
||||
IGCObject_DVariable::visit_gco_children(DVariable & self, VisitReason reason, obj<AGCObjectVisitor> fn) noexcept -> void
|
||||
{
|
||||
self.visit_gco_children(fn);
|
||||
self.visit_gco_children(reason, fn);
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue