From fed2d03930891836cdaef231d2a131a5cd1fe0b7 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Fri, 13 Feb 2026 15:15:08 -0500 Subject: [PATCH] xo-gc stack: streamline object pointer forwarding --- idl/GCObject.json5 | 2 +- include/xo/gc/GCObject.hpp | 28 +++++++++++++++++++++++++++- include/xo/gc/detail/RCollector.hpp | 10 ++++++++++ 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/idl/GCObject.json5 b/idl/GCObject.json5 index bf0d78c..30fc0d3 100644 --- a/idl/GCObject.json5 +++ b/idl/GCObject.json5 @@ -76,5 +76,5 @@ attributes: [], }, ], - router_facet_explicit_content: [ ], + router_facet_explicit_content: [] } diff --git a/include/xo/gc/GCObject.hpp b/include/xo/gc/GCObject.hpp index 2eede6b..970d2c3 100644 --- a/include/xo/gc/GCObject.hpp +++ b/include/xo/gc/GCObject.hpp @@ -18,5 +18,31 @@ #include "detail/IGCObject_Xfer.hpp" #include "detail/RGCObject.hpp" +namespace xo { + namespace mm { + /** defined here to avoid #include cycle, since + * template obj awkward to make available there + **/ + template + template + void + RCollector::forward_inplace(xo::facet::obj * p_obj) + { + this->forward_inplace(p_obj->iface(), (void **)&(p_obj->data_)); + } + + template + template + void + RCollector::forward_inplace(DRepr ** p_repr) + { + // fetch static interface for DRepr + auto iface = xo::facet::impl_for(); + + this->forward_inplace(&iface, (void **)p_repr); + } + } +} + +/* end GCObject.hpp */ -/* end GCObject.hpp */ \ No newline at end of file diff --git a/include/xo/gc/detail/RCollector.hpp b/include/xo/gc/detail/RCollector.hpp index 5e3eddb..9cce484 100644 --- a/include/xo/gc/detail/RCollector.hpp +++ b/include/xo/gc/detail/RCollector.hpp @@ -23,6 +23,16 @@ namespace xo { RCollector() = default; RCollector(DataPtr data) : Object{std::move(data)} {} + /** forward op in place. Defined in GCObject.hpp to avoid #include cycle **/ + template + void forward_inplace(obj * p_obj); + + /** another convenience template for forwarding. + * Defined in RGCObject.hpp to avoid #include cycle. + **/ + template + void forward_inplace(DRepr ** pp_repr); + int32_t _typeseq() const noexcept { return O::iface()->_typeseq(); } size_type allocated(generation g, role r) const noexcept { return O::iface()->allocated(O::data(), g, r); } size_type reserved(generation g, role r) const noexcept { return O::iface()->reserved(O::data(), g, r); }