refactor focusing on xo-alloc2/ xo-gc/ write-barrier

ability to inform allocator of gco->gco mutation, via AAllocator i/face.
This commit is contained in:
Roland Conybeare 2026-05-01 19:54:26 -04:00
commit a8397c78d7
4 changed files with 9 additions and 7 deletions

View file

@ -16,6 +16,7 @@ namespace xo {
class DLocalEnv {
public:
using DArray = xo::scm::DArray;
using ACollector = xo::mm::ACollector;
using AGCObject = xo::mm::AGCObject;
using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
using VisitReason = xo::mm::VisitReason;
@ -49,7 +50,7 @@ namespace xo {
obj<AGCObject> lookup_value(Binding ix) const noexcept;
/** assign value associated with binding @p ix to @p x **/
void assign_value(Binding ix, obj<AGCObject> x);
void assign_value(obj<AAllocator> mm, Binding ix, obj<AGCObject> x);
///@}
/** @defgroup scm-localenv-gcobject-facet **/

View file

@ -67,4 +67,4 @@ when @p fn invokes garbage collector reentry point **/
} /*namespace scm*/
} /*namespace xo*/
/* end */
/* end */

View file

@ -63,7 +63,9 @@ namespace xo {
}
void
DLocalEnv::assign_value(Binding ix, obj<AGCObject> x)
DLocalEnv::assign_value(obj<AAllocator> mm,
Binding ix,
obj<AGCObject> x)
{
scope log(XO_DEBUG(true));
@ -79,8 +81,7 @@ namespace xo {
auto j = ix.j_slot();
if (j < static_cast<decltype(j)>(env->n_vars())) {
log && log("STUB: need write barrier for GC here");
(*(env->args_))[j] = x;
env->args_->assign_at(mm, j, x);
} else {
assert(false);
}

View file

@ -821,9 +821,9 @@ namespace xo {
log && log(xtag("i_arg", i_arg), xtag("n_arg", args->size()), xtag("cap", args->capacity()));
auto gc = mm_.to_op().to_facet<ACollector>();
//auto gc = mm_.to_op().to_facet<ACollector>();
args->push_back(gc, value);
args->push_back(mm_.to_op(), value);
i_arg = evalargs_frame->increment_arg();