From 5676a69dd38ba689345b89f9abe1f8a8e05f15cc Mon Sep 17 00:00:00 2001 From: Roland Conybeare Date: Sat, 4 Apr 2026 18:01:25 -0400 Subject: [PATCH] refactor: retire GCObject.shallow_copy() Collector gets this info from gc-owned object header --- include/xo/object2/DArray.hpp | 6 ++---- include/xo/object2/DBoolean.hpp | 3 +-- include/xo/object2/DDictionary.hpp | 6 ++---- include/xo/object2/DFloat.hpp | 3 +-- include/xo/object2/DInteger.hpp | 3 +-- include/xo/object2/DList.hpp | 3 +-- include/xo/object2/DStruct.hpp | 2 -- src/object2/DArray.cpp | 10 +--------- src/object2/DBoolean.cpp | 10 ++-------- src/object2/DDictionary.cpp | 10 +--------- src/object2/DFloat.cpp | 10 ++-------- src/object2/DInteger.cpp | 11 ++--------- src/object2/DList.cpp | 16 ++-------------- 13 files changed, 18 insertions(+), 75 deletions(-) diff --git a/include/xo/object2/DArray.hpp b/include/xo/object2/DArray.hpp index a455046..ac44c32 100644 --- a/include/xo/object2/DArray.hpp +++ b/include/xo/object2/DArray.hpp @@ -145,12 +145,10 @@ namespace xo { ///@} /** @defgroup darray-gcobject-methods **/ ///@{ - /** shallow memory consumption. Excludes child objects **/ - AAllocator::size_type shallow_size() const noexcept; - /** return shallow copy of this array, using memory from @p mm **/ + /** move to new address, mandated by @p gc **/ DArray * shallow_move(obj gc) noexcept; /** forward elements to @p gc to-space; replace originals with forarding pointers **/ - AAllocator::size_type forward_children(obj gc) noexcept; + void forward_children(obj gc) noexcept; ///@} private: diff --git a/include/xo/object2/DBoolean.hpp b/include/xo/object2/DBoolean.hpp index 31bf41b..f6374e3 100644 --- a/include/xo/object2/DBoolean.hpp +++ b/include/xo/object2/DBoolean.hpp @@ -37,9 +37,8 @@ namespace xo { // GCObject facet - std::size_t shallow_size() const noexcept; DBoolean * shallow_move(obj gc) noexcept; - std::size_t forward_children(obj gc) noexcept; + void forward_children(obj gc) noexcept; private: /** boxed boolean value **/ diff --git a/include/xo/object2/DDictionary.hpp b/include/xo/object2/DDictionary.hpp index 219e783..8183a67 100644 --- a/include/xo/object2/DDictionary.hpp +++ b/include/xo/object2/DDictionary.hpp @@ -200,12 +200,10 @@ namespace xo { ///@} /** @defgroup ddictionary-gcobject-methods **/ ///@{ - /** shallow memory consumption. Excludes child objects **/ - AAllocator::size_type shallow_size() const noexcept; /** return shallow copy of this array, using memory from @p mm **/ DDictionary * shallow_move(obj gc) noexcept; - /** forward elements to @p gc to-space; replace originals with forarding pointers **/ - AAllocator::size_type forward_children(obj gc) noexcept; + /** forward elements to @p gc to-space; replace originals with forwarding pointers **/ + void forward_children(obj gc) noexcept; ///@} private: diff --git a/include/xo/object2/DFloat.hpp b/include/xo/object2/DFloat.hpp index 949883a..50b0828 100644 --- a/include/xo/object2/DFloat.hpp +++ b/include/xo/object2/DFloat.hpp @@ -34,9 +34,8 @@ namespace xo { bool pretty(const ppindentinfo & ppii) const; // GCObject facet - std::size_t shallow_size() const noexcept; DFloat * shallow_move(obj gc) noexcept; - std::size_t forward_children(obj gc) noexcept; + void forward_children(obj gc) noexcept; private: diff --git a/include/xo/object2/DInteger.hpp b/include/xo/object2/DInteger.hpp index d3969b7..4105d92 100644 --- a/include/xo/object2/DInteger.hpp +++ b/include/xo/object2/DInteger.hpp @@ -39,9 +39,8 @@ namespace xo { // GCObject facet - std::size_t shallow_size() const noexcept; DInteger * shallow_move(obj gc) noexcept; - std::size_t forward_children(obj gc) noexcept; + void forward_children(obj gc) noexcept; private: /** boxed integer value **/ diff --git a/include/xo/object2/DList.hpp b/include/xo/object2/DList.hpp index 199ec6e..4c37045 100644 --- a/include/xo/object2/DList.hpp +++ b/include/xo/object2/DList.hpp @@ -69,9 +69,8 @@ namespace xo { /** @defgroup xo-scm-list-gcobject-facet gcobject facet **/ ///@{ - size_type shallow_size() const noexcept; DList * shallow_move(obj gc) noexcept; - size_type forward_children(obj gc) noexcept; + void forward_children(obj gc) noexcept; ///@} /** first member of list **/ diff --git a/include/xo/object2/DStruct.hpp b/include/xo/object2/DStruct.hpp index d7a7d84..3776e37 100644 --- a/include/xo/object2/DStruct.hpp +++ b/include/xo/object2/DStruct.hpp @@ -141,8 +141,6 @@ namespace xo { ///@{ /** shallow memory consumption. Excludes child objects **/ AAllocator::size_type shallow_size() const noexcept; - /** return shallow copy of this array, using memory from @p mm **/ - DStruct * shallow_copy(obj mm) const noexcept; /** forward elements to @p gc to-space; replace originals with forarding pointers **/ AAllocator::size_type forward_children(obj gc) noexcept; ///@} diff --git a/src/object2/DArray.cpp b/src/object2/DArray.cpp index a9ed928..4be2ff6 100644 --- a/src/object2/DArray.cpp +++ b/src/object2/DArray.cpp @@ -174,12 +174,6 @@ namespace xo { // gc hooks for IGCObject_DArray - std::size_t - DArray::shallow_size() const noexcept - { - return sizeof(DArray) + (capacity_ * sizeof(obj)); - } - DArray * DArray::shallow_move(obj gc) noexcept { @@ -203,7 +197,7 @@ namespace xo { return copy; } - std::size_t + void DArray::forward_children(obj gc) noexcept { scope log(XO_DEBUG(false)); @@ -215,8 +209,6 @@ namespace xo { gc.forward_inplace(&elt); } - - return shallow_size(); } } /*namespace scm*/ diff --git a/src/object2/DBoolean.cpp b/src/object2/DBoolean.cpp index f24429e..2a196d5 100644 --- a/src/object2/DBoolean.cpp +++ b/src/object2/DBoolean.cpp @@ -29,22 +29,16 @@ namespace xo { (value_ ? "true" : "false")); } - size_t - DBoolean::shallow_size() const noexcept - { - return sizeof(DBoolean); - } - DBoolean * DBoolean::shallow_move(obj gc) noexcept { return gc.std_move_for(this); } - size_t + void DBoolean::forward_children(obj) noexcept { - return shallow_size(); + // no-op } diff --git a/src/object2/DDictionary.cpp b/src/object2/DDictionary.cpp index 48b0c97..bd9ad11 100644 --- a/src/object2/DDictionary.cpp +++ b/src/object2/DDictionary.cpp @@ -267,26 +267,18 @@ namespace xo { // ----- gcobject facet ----- - std::size_t - DDictionary::shallow_size() const noexcept - { - return sizeof(DDictionary); - } - DDictionary * DDictionary::shallow_move(obj gc) noexcept { return gc.std_move_for(this); } - std::size_t + void DDictionary::forward_children(obj gc) noexcept { gc.forward_inplace(&keys_); gc.forward_inplace(&values_); - - return this->shallow_size(); } } /*namespace scm*/ diff --git a/src/object2/DFloat.cpp b/src/object2/DFloat.cpp index c00286c..32f3438 100644 --- a/src/object2/DFloat.cpp +++ b/src/object2/DFloat.cpp @@ -27,22 +27,16 @@ namespace xo { return ppdetail_atomic::print_pretty(ppii, value_); } - size_t - DFloat::shallow_size() const noexcept - { - return sizeof(DFloat); - } - DFloat * DFloat::shallow_move(obj gc) noexcept { return gc.std_move_for(this); } - size_t + void DFloat::forward_children(obj) noexcept { - return shallow_size(); + // noop } } /*namespace scm*/ diff --git a/src/object2/DInteger.cpp b/src/object2/DInteger.cpp index 53625fd..2b0a4c0 100644 --- a/src/object2/DInteger.cpp +++ b/src/object2/DInteger.cpp @@ -27,25 +27,18 @@ namespace xo { return ppdetail_atomic::print_pretty(ppii, value_); } - size_t - DInteger::shallow_size() const noexcept - { - return sizeof(DInteger); - } - DInteger * DInteger::shallow_move(obj gc) noexcept { return gc.std_move_for(this); } - size_t + void DInteger::forward_children(obj) noexcept { - return shallow_size(); + // no-op } - } /*namespace scm*/ } /*namespace xo*/ diff --git a/src/object2/DList.cpp b/src/object2/DList.cpp index d9e5317..fbba2e3 100644 --- a/src/object2/DList.cpp +++ b/src/object2/DList.cpp @@ -178,31 +178,19 @@ namespace xo { // ----- GCObject facet ------ - auto - DList::shallow_size() const noexcept -> size_type - { - return sizeof(DList); - } - DList * DList::shallow_move(obj gc) noexcept { return gc.std_move_for(this); } - auto - DList::forward_children(obj gc) noexcept -> size_type + void + DList::forward_children(obj gc) noexcept { //scope log(XO_DEBUG(true)); gc.forward_inplace(&head_); - //gc.forward_inplace(head_.iface(), (void **)&(head_.data_)); - gc.forward_inplace(&rest_); - //auto iface = xo::facet::impl_for(); - //gc.forward_inplace(&iface, (void **)(&rest_)); - - return this->shallow_size(); } } /*namespace scm*/ } /*namespace xo*/