From 8f360b74e212c39aabbdab238ecb19dac5973502 Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Sat, 4 Apr 2026 17:30:03 -0400 Subject: [PATCH] refactor: retire GCObject.shallow_size() Not needed. Rely on size stored in gc-owned object header --- idl/GCObject.json5 | 18 +++++++++--------- include/xo/alloc2/gc/AGCObject.hpp | 2 -- include/xo/alloc2/gc/IGCObject_Any.hpp | 1 - include/xo/alloc2/gc/IGCObject_Xfer.hpp | 3 --- include/xo/alloc2/gc/RGCObject.hpp | 3 --- 5 files changed, 9 insertions(+), 18 deletions(-) diff --git a/idl/GCObject.json5 b/idl/GCObject.json5 index 13f9771..2b0b669 100644 --- a/idl/GCObject.json5 +++ b/idl/GCObject.json5 @@ -45,15 +45,15 @@ ], const_methods: [ // size_type shallow_size() const noexcept - { - name: "shallow_size", - doc: ["memory consumption for this instance"], - return_type: "size_type", - args: [], - const: true, - noexcept: true, - attributes: [], - }, +// { +// name: "shallow_size", +// doc: ["memory consumption for this instance"], +// return_type: "size_type", +// args: [], +// const: true, +// noexcept: true, +// attributes: [], +// }, ], nonconst_methods: [ // Opaque shallow_move(obj>) noexcept diff --git a/include/xo/alloc2/gc/AGCObject.hpp b/include/xo/alloc2/gc/AGCObject.hpp index 463b330..b5b9fb0 100644 --- a/include/xo/alloc2/gc/AGCObject.hpp +++ b/include/xo/alloc2/gc/AGCObject.hpp @@ -62,8 +62,6 @@ public: virtual typeseq _typeseq() const noexcept = 0; /** destroy instance @p d; calls c++ dtor only for actual runtime type; does not recover memory **/ virtual void _drop(Opaque d) const noexcept = 0; - /** memory consumption for this instance **/ - virtual size_type shallow_size(Copaque data) const noexcept = 0; // nonconst methods /** move instance using allocator **/ diff --git a/include/xo/alloc2/gc/IGCObject_Any.hpp b/include/xo/alloc2/gc/IGCObject_Any.hpp index e3ebe17..34f0bca 100644 --- a/include/xo/alloc2/gc/IGCObject_Any.hpp +++ b/include/xo/alloc2/gc/IGCObject_Any.hpp @@ -61,7 +61,6 @@ namespace mm { [[noreturn]] void _drop(Opaque) const noexcept override { _fatal(); } // const methods - [[noreturn]] size_type shallow_size(Copaque) const noexcept override { _fatal(); } // nonconst methods [[noreturn]] Opaque shallow_move(Opaque, obj) const noexcept override; diff --git a/include/xo/alloc2/gc/IGCObject_Xfer.hpp b/include/xo/alloc2/gc/IGCObject_Xfer.hpp index 3b786fb..d69184c 100644 --- a/include/xo/alloc2/gc/IGCObject_Xfer.hpp +++ b/include/xo/alloc2/gc/IGCObject_Xfer.hpp @@ -49,9 +49,6 @@ namespace mm { void _drop(Opaque d) const noexcept override { _dcast(d).~DRepr(); } // const methods - size_type shallow_size(Copaque data) const noexcept override { - return I::shallow_size(_dcast(data)); - } // non-const methods Opaque shallow_move(Opaque data, obj gc) const noexcept override { diff --git a/include/xo/alloc2/gc/RGCObject.hpp b/include/xo/alloc2/gc/RGCObject.hpp index f992728..a0de103 100644 --- a/include/xo/alloc2/gc/RGCObject.hpp +++ b/include/xo/alloc2/gc/RGCObject.hpp @@ -55,9 +55,6 @@ public: void _drop() const noexcept { O::iface()->_drop(O::data()); } // const methods - size_type shallow_size() const noexcept { - return O::iface()->shallow_size(O::data()); - } // non-const methods (still const in router!) Opaque shallow_move(obj gc) noexcept {