From 5a5b9187030f974dcd84044e54604fd195c3c82c Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Thu, 26 Mar 2026 15:04:22 -0400 Subject: [PATCH] xo-interpreter2: bugfix: install types for vsm collector instance --- include/xo/interpreter2/VsmConfig.hpp | 10 +++++++++ .../DVirtualSchematikaMachine.cpp | 21 ++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/include/xo/interpreter2/VsmConfig.hpp b/include/xo/interpreter2/VsmConfig.hpp index 166a63dd..21d25234 100644 --- a/include/xo/interpreter2/VsmConfig.hpp +++ b/include/xo/interpreter2/VsmConfig.hpp @@ -31,12 +31,22 @@ namespace xo { return retval; } + VsmConfig with_x1_config(const X1CollectorConfig & x) const { + VsmConfig retval = *this; + retval.x1_config_ = x; + return retval; + } + VsmConfig with_x1_debug_flag(bool x) const { VsmConfig retval = *this; retval.x1_config_.debug_flag_ = x; return retval; } + static X1CollectorConfig std_x1_config() { + return X1CollectorConfig().with_name("gc").with_size(4*1024*1024); + } + /** true for interactive parser session; false for batch session **/ bool interactive_flag_ = true; diff --git a/src/interpreter2/DVirtualSchematikaMachine.cpp b/src/interpreter2/DVirtualSchematikaMachine.cpp index 52cdbf78..5c3d35d2 100644 --- a/src/interpreter2/DVirtualSchematikaMachine.cpp +++ b/src/interpreter2/DVirtualSchematikaMachine.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -46,9 +47,11 @@ namespace xo { using xo::reflect::Reflect; using xo::mm::AGCObject; using xo::mm::MemorySizeInfo; + using xo::mm::CollectorTypeRegistry; using xo::mm::AAllocator; using xo::mm::ACollector; using xo::mm::DX1Collector; + using xo::mm::X1CollectorConfig; using xo::mm::DArena; using xo::facet::FacetRegistry; using xo::facet::TypeRegistry; @@ -68,6 +71,22 @@ namespace xo { } } + namespace { + /** helper function to create X1 collector instance **/ + abox + vsm_make_gc(obj aux_mm, + const X1CollectorConfig & config) + { + auto retval = abox::make(aux_mm, config); + + // establish the set of types that mm_ will be able to collect + + CollectorTypeRegistry::instance().install_types(retval.to_op().to_facet()); + + return retval; + } + } + // NOTE: using heap here for {DX1Collector, DArena, DVsmRcx} instances // (though DX1Collector allocations will be from explictly mmap'd memory) // @@ -76,7 +95,7 @@ namespace xo { : config_{config}, self_vroot_{obj(this)}, aux_mm_{aux_mm}, - mm_(abox::make(aux_mm_, config.x1_config_)), + mm_(vsm_make_gc(aux_mm_, config.x1_config_)), rcx_(abox::make(aux_mm_, this)), reader_{config.rdr_config_, mm_.to_op(), aux_mm_} {