From fe752bc6d31d73d11cb2fd0a5a7363aea2d5e1ba Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Wed, 25 Mar 2026 20:06:40 -0400 Subject: [PATCH] xo-interpreter2: virtual root for VSM itself --- src/interpreter2/DVirtualSchematikaMachine.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/interpreter2/DVirtualSchematikaMachine.cpp b/src/interpreter2/DVirtualSchematikaMachine.cpp index 788a16a4..52cdbf78 100644 --- a/src/interpreter2/DVirtualSchematikaMachine.cpp +++ b/src/interpreter2/DVirtualSchematikaMachine.cpp @@ -47,6 +47,7 @@ namespace xo { using xo::mm::AGCObject; using xo::mm::MemorySizeInfo; using xo::mm::AAllocator; + using xo::mm::ACollector; using xo::mm::DX1Collector; using xo::mm::DArena; using xo::facet::FacetRegistry; @@ -71,8 +72,9 @@ namespace xo { // (though DX1Collector allocations will be from explictly mmap'd memory) // DVirtualSchematikaMachine::DVirtualSchematikaMachine(const VsmConfig & config, - obj aux_mm) + obj aux_mm) : config_{config}, + self_vroot_{obj(this)}, aux_mm_{aux_mm}, mm_(abox::make(aux_mm_, config.x1_config_)), rcx_(abox::make(aux_mm_, this)), @@ -88,7 +90,13 @@ namespace xo { this->global_env_ = obj(reader_.global_env()); - //this->_add_gc_roots(); + // TODO: + // annoying to have to create self_vroot_ to appease + // add_gc_root_poly() signature. + // In practice gc won't modify the pointer + // (instead traverses it to find +update children) + // + mm_.to_op().to_facet().add_gc_root_poly(&self_vroot_); } DVirtualSchematikaMachine *