refactor: make AGCObject.shallow_copy() non-const

prep for moving to ACollector interface
This commit is contained in:
Roland Conybeare 2026-04-04 14:38:14 -04:00
commit e41d69be23
125 changed files with 196 additions and 281 deletions

View file

@ -42,7 +42,7 @@ namespace xo {
/** @defgroup xo-scm-arraytype-gcobject-facet **/
///@{
std::size_t shallow_size() const noexcept;
DArrayType * shallow_copy(obj<AAllocator> mm) const noexcept;
DArrayType * shallow_copy(obj<AAllocator> mm) noexcept;
std::size_t forward_children(obj<ACollector> gc) noexcept;
///@}

View file

@ -43,7 +43,7 @@ namespace xo {
/** @defgroup xo-scm-atomictype-gcobject-facet **/
///@{
std::size_t shallow_size() const noexcept;
DAtomicType * shallow_copy(obj<AAllocator> mm) const noexcept;
DAtomicType * shallow_copy(obj<AAllocator> mm) noexcept;
std::size_t forward_children(obj<ACollector> gc) noexcept;
///@}

View file

@ -64,7 +64,7 @@ namespace xo {
/** @defgroup xo-scm-arraytype-gcobject-facet **/
///@{
std::size_t shallow_size() const noexcept;
DFunctionType * shallow_copy(obj<AAllocator> mm) const noexcept;
DFunctionType * shallow_copy(obj<AAllocator> mm) noexcept;
std::size_t forward_children(obj<ACollector> gc) noexcept;
///@}

View file

@ -50,7 +50,7 @@ namespace xo {
/** @defgroup xo-scm-listtype-gcobject-facet **/
///@{
std::size_t shallow_size() const noexcept;
DListType * shallow_copy(obj<AAllocator> mm) const noexcept;
DListType * shallow_copy(obj<AAllocator> mm) noexcept;
std::size_t forward_children(obj<ACollector> gc) noexcept;
///@}

View file

@ -50,10 +50,10 @@ namespace xo {
// const methods
/** memory consumption for this instance **/
static size_type shallow_size(const DArrayType & self) noexcept;
/** copy instance using allocator **/
static Opaque shallow_copy(const DArrayType & self, obj<AAllocator> mm) noexcept;
// non-const methods
/** copy instance using allocator **/
static Opaque shallow_copy(DArrayType & self, obj<AAllocator> mm) noexcept;
/** during GC: forward immdiate children **/
static size_type forward_children(DArrayType & self, obj<ACollector> gc) noexcept;
///@}

View file

@ -50,10 +50,10 @@ namespace xo {
// const methods
/** memory consumption for this instance **/
static size_type shallow_size(const DAtomicType & self) noexcept;
/** copy instance using allocator **/
static Opaque shallow_copy(const DAtomicType & self, obj<AAllocator> mm) noexcept;
// non-const methods
/** copy instance using allocator **/
static Opaque shallow_copy(DAtomicType & self, obj<AAllocator> mm) noexcept;
/** during GC: forward immdiate children **/
static size_type forward_children(DAtomicType & self, obj<ACollector> gc) noexcept;
///@}

View file

@ -50,10 +50,10 @@ namespace xo {
// const methods
/** memory consumption for this instance **/
static size_type shallow_size(const DFunctionType & self) noexcept;
/** copy instance using allocator **/
static Opaque shallow_copy(const DFunctionType & self, obj<AAllocator> mm) noexcept;
// non-const methods
/** copy instance using allocator **/
static Opaque shallow_copy(DFunctionType & self, obj<AAllocator> mm) noexcept;
/** during GC: forward immdiate children **/
static size_type forward_children(DFunctionType & self, obj<ACollector> gc) noexcept;
///@}

View file

@ -50,10 +50,10 @@ namespace xo {
// const methods
/** memory consumption for this instance **/
static size_type shallow_size(const DListType & self) noexcept;
/** copy instance using allocator **/
static Opaque shallow_copy(const DListType & self, obj<AAllocator> mm) noexcept;
// non-const methods
/** copy instance using allocator **/
static Opaque shallow_copy(DListType & self, obj<AAllocator> mm) noexcept;
/** during GC: forward immdiate children **/
static size_type forward_children(DListType & self, obj<ACollector> gc) noexcept;
///@}

View file

@ -50,6 +50,11 @@ public:
/** @defgroup scm-type-methods **/
///@{
// const methods
/** An uninitialized AType instance will have zero vtable pointer (per {linux,osx} abi).
* Use case for this is narrow. We go to some lengths to avoid null vtable pointers. For example
* obj<AFacet> will have non-null vtable (via IFacet_Any) with all methods terminating.
**/
bool _has_null_vptr() const noexcept { return *reinterpret_cast<const void * const *>(this) == nullptr; }
/** RTTI: unique id# for actual runtime data representation **/
virtual typeseq _typeseq() const noexcept = 0;
/** destroy instance @p d; calls c++ dtor only for actual runtime type; does not recover memory **/

View file

@ -54,7 +54,7 @@ namespace xo {
/** @defgroup xo-scm-atomictype-gcobject-facet **/
///@{
std::size_t shallow_size() const noexcept;
DTypeVarRef * shallow_copy(obj<AAllocator> mm) const noexcept;
DTypeVarRef * shallow_copy(obj<AAllocator> mm) noexcept;
std::size_t forward_children(obj<ACollector> gc) noexcept;
///@}

View file

@ -50,10 +50,10 @@ namespace xo {
// const methods
/** memory consumption for this instance **/
static size_type shallow_size(const DTypeVarRef & self) noexcept;
/** copy instance using allocator **/
static Opaque shallow_copy(const DTypeVarRef & self, obj<AAllocator> mm) noexcept;
// non-const methods
/** copy instance using allocator **/
static Opaque shallow_copy(DTypeVarRef & self, obj<AAllocator> mm) noexcept;
/** during GC: forward immdiate children **/
static size_type forward_children(DTypeVarRef & self, obj<ACollector> gc) noexcept;
///@}

View file

@ -83,7 +83,7 @@ namespace xo {
}
DArrayType *
DArrayType::shallow_copy(obj<AAllocator> mm) const noexcept
DArrayType::shallow_copy(obj<AAllocator> mm) noexcept
{
return mm.std_copy_for(this);
}

View file

@ -61,7 +61,7 @@ namespace xo {
}
DAtomicType *
DAtomicType::shallow_copy(obj<AAllocator> mm) const noexcept
DAtomicType::shallow_copy(obj<AAllocator> mm) noexcept
{
return mm.std_copy_for(this);
}

View file

@ -94,7 +94,7 @@ namespace xo {
}
DFunctionType *
DFunctionType::shallow_copy(obj<AAllocator> mm) const noexcept
DFunctionType::shallow_copy(obj<AAllocator> mm) noexcept
{
return mm.std_copy_for(this);
}

View file

@ -88,7 +88,7 @@ namespace xo {
}
DListType *
DListType::shallow_copy(obj<AAllocator> mm) const noexcept
DListType::shallow_copy(obj<AAllocator> mm) noexcept
{
return mm.std_copy_for(this);
}

View file

@ -82,7 +82,7 @@ namespace xo {
}
DTypeVarRef *
DTypeVarRef::shallow_copy(obj<AAllocator> mm) const noexcept
DTypeVarRef::shallow_copy(obj<AAllocator> mm) noexcept
{
return mm.std_copy_for(this);
}

View file

@ -22,11 +22,10 @@ namespace xo {
}
auto
IGCObject_DArrayType::shallow_copy(const DArrayType & self, obj<AAllocator> mm) noexcept -> Opaque
IGCObject_DArrayType::shallow_copy(DArrayType & self, obj<AAllocator> mm) noexcept -> Opaque
{
return self.shallow_copy(mm);
}
auto
IGCObject_DArrayType::forward_children(DArrayType & self, obj<ACollector> gc) noexcept -> size_type
{

View file

@ -22,11 +22,10 @@ namespace xo {
}
auto
IGCObject_DAtomicType::shallow_copy(const DAtomicType & self, obj<AAllocator> mm) noexcept -> Opaque
IGCObject_DAtomicType::shallow_copy(DAtomicType & self, obj<AAllocator> mm) noexcept -> Opaque
{
return self.shallow_copy(mm);
}
auto
IGCObject_DAtomicType::forward_children(DAtomicType & self, obj<ACollector> gc) noexcept -> size_type
{

View file

@ -22,11 +22,10 @@ namespace xo {
}
auto
IGCObject_DFunctionType::shallow_copy(const DFunctionType & self, obj<AAllocator> mm) noexcept -> Opaque
IGCObject_DFunctionType::shallow_copy(DFunctionType & self, obj<AAllocator> mm) noexcept -> Opaque
{
return self.shallow_copy(mm);
}
auto
IGCObject_DFunctionType::forward_children(DFunctionType & self, obj<ACollector> gc) noexcept -> size_type
{

View file

@ -22,11 +22,10 @@ namespace xo {
}
auto
IGCObject_DListType::shallow_copy(const DListType & self, obj<AAllocator> mm) noexcept -> Opaque
IGCObject_DListType::shallow_copy(DListType & self, obj<AAllocator> mm) noexcept -> Opaque
{
return self.shallow_copy(mm);
}
auto
IGCObject_DListType::forward_children(DListType & self, obj<ACollector> gc) noexcept -> size_type
{

View file

@ -22,11 +22,10 @@ namespace xo {
}
auto
IGCObject_DTypeVarRef::shallow_copy(const DTypeVarRef & self, obj<AAllocator> mm) noexcept -> Opaque
IGCObject_DTypeVarRef::shallow_copy(DTypeVarRef & self, obj<AAllocator> mm) noexcept -> Opaque
{
return self.shallow_copy(mm);
}
auto
IGCObject_DTypeVarRef::forward_children(DTypeVarRef & self, obj<ACollector> gc) noexcept -> size_type
{