xo-interpreter: + toplevel env in VSM

This commit is contained in:
Roland Conybeare 2025-11-23 21:41:14 -05:00
commit eec5bc0981
2 changed files with 32 additions and 2 deletions

View file

@ -132,11 +132,15 @@ namespace xo {
up<GC>
GC::make(const Config & config)
{
//GC * gc = new GC(config);
return std::make_unique<GC>(config);
}
GC *
GC::from(IAlloc * mm)
{
return dynamic_cast<GC *>(mm);
}
const std::string &
GC::name() const
{
@ -390,6 +394,19 @@ namespace xo {
gc_root_v_.push_back(addr);
}
void
GC::remove_gc_root(Object ** addr)
{
/* Multithreaded GC not supported */
assert(!this->gc_in_progress());
auto new_end_ix = std::remove(gc_root_v_.begin(), gc_root_v_.end(), addr);
/* erase now-unused slots */
gc_root_v_.erase(new_end_ix, gc_root_v_.end());
}
auto
GC::add_gc_copy_callback(up<GcCopyCallback> fn) -> CallbackId
{