refactor: use GCObjectVisitor api w/ gco_shallow_move
This commit is contained in:
parent
547f897c31
commit
e95353f1c8
169 changed files with 391 additions and 402 deletions
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include "Type.hpp"
|
||||
#include "Metatype.hpp"
|
||||
#include <xo/alloc2/Collector.hpp>
|
||||
//#include <xo/alloc2/Collector.hpp>
|
||||
#include <xo/alloc2/Allocator.hpp>
|
||||
#include <xo/alloc2/GCObjectVisitor.hpp>
|
||||
|
||||
|
|
@ -19,7 +19,7 @@ namespace xo {
|
|||
**/
|
||||
class DArrayType {
|
||||
public:
|
||||
using ACollector = xo::mm::ACollector;
|
||||
//using ACollector = xo::mm::ACollector;
|
||||
using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
|
||||
using AAllocator = xo::mm::AAllocator;
|
||||
using TypeDescr = xo::reflect::TypeDescr;
|
||||
|
|
@ -43,8 +43,7 @@ namespace xo {
|
|||
///@}
|
||||
/** @defgroup xo-scm-arraytype-gcobject-facet **/
|
||||
///@{
|
||||
std::size_t shallow_size() const noexcept;
|
||||
DArrayType * shallow_move(obj<ACollector> gc) noexcept;
|
||||
DArrayType * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept;
|
||||
void visit_gco_children(obj<AGCObjectVisitor> gc) noexcept;
|
||||
///@}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include "Type.hpp"
|
||||
#include "Metatype.hpp"
|
||||
#include <xo/alloc2/Collector.hpp>
|
||||
//#include <xo/alloc2/Collector.hpp>
|
||||
#include <xo/alloc2/GCObjectVisitor.hpp>
|
||||
#include <xo/alloc2/Allocator.hpp>
|
||||
|
||||
|
|
@ -22,7 +22,7 @@ namespace xo {
|
|||
**/
|
||||
class DAtomicType {
|
||||
public:
|
||||
using ACollector = xo::mm::ACollector;
|
||||
//using ACollector = xo::mm::ACollector;
|
||||
using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
|
||||
using AAllocator = xo::mm::AAllocator;
|
||||
using TypeDescr = xo::reflect::TypeDescr;
|
||||
|
|
@ -44,8 +44,7 @@ namespace xo {
|
|||
///@}
|
||||
/** @defgroup xo-scm-atomictype-gcobject-facet **/
|
||||
///@{
|
||||
std::size_t shallow_size() const noexcept;
|
||||
DAtomicType * shallow_move(obj<ACollector> gc) noexcept;
|
||||
DAtomicType * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept;
|
||||
void visit_gco_children(obj<AGCObjectVisitor> gc) noexcept;
|
||||
///@}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
#include "Type.hpp"
|
||||
#include "Metatype.hpp"
|
||||
#include <xo/object2/Array.hpp>
|
||||
#include <xo/alloc2/Collector.hpp>
|
||||
//#include <xo/alloc2/Collector.hpp>
|
||||
#include <xo/alloc2/GCObjectVisitor.hpp>
|
||||
#include <xo/alloc2/Allocator.hpp>
|
||||
|
||||
|
|
@ -20,7 +20,7 @@ namespace xo {
|
|||
**/
|
||||
class DFunctionType {
|
||||
public:
|
||||
using ACollector = xo::mm::ACollector;
|
||||
//using ACollector = xo::mm::ACollector;
|
||||
using AGCObject = xo::mm::AGCObject;
|
||||
using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
|
||||
using AAllocator = xo::mm::AAllocator;
|
||||
|
|
@ -65,8 +65,7 @@ namespace xo {
|
|||
///@}
|
||||
/** @defgroup xo-scm-arraytype-gcobject-facet **/
|
||||
///@{
|
||||
std::size_t shallow_size() const noexcept;
|
||||
DFunctionType * shallow_move(obj<ACollector> gc) noexcept;
|
||||
DFunctionType * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept;
|
||||
void visit_gco_children(obj<AGCObjectVisitor> gc) noexcept;
|
||||
///@}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
#include "Type.hpp"
|
||||
#include "Metatype.hpp"
|
||||
#include <xo/reflect/TypeDescr.hpp>
|
||||
#include <xo/alloc2/Collector.hpp>
|
||||
//#include <xo/alloc2/Collector.hpp>
|
||||
#include <xo/alloc2/GCObjectVisitor.hpp>
|
||||
#include <xo/alloc2/Allocator.hpp>
|
||||
|
||||
|
|
@ -24,7 +24,7 @@ namespace xo {
|
|||
class DListType {
|
||||
public:
|
||||
using TypeDescr = xo::reflect::TypeDescr;
|
||||
using ACollector = xo::mm::ACollector;
|
||||
//using ACollector = xo::mm::ACollector;
|
||||
using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
|
||||
using AAllocator = xo::mm::AAllocator;
|
||||
|
||||
|
|
@ -51,8 +51,7 @@ namespace xo {
|
|||
///@}
|
||||
/** @defgroup xo-scm-listtype-gcobject-facet **/
|
||||
///@{
|
||||
std::size_t shallow_size() const noexcept;
|
||||
DListType * shallow_move(obj<ACollector> gc) noexcept;
|
||||
DListType * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept;
|
||||
void visit_gco_children(obj<AGCObjectVisitor> gc) noexcept;
|
||||
///@}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,8 +51,9 @@ namespace xo {
|
|||
// const methods
|
||||
|
||||
// non-const methods
|
||||
/** move instance using collector **/
|
||||
static Opaque shallow_move(DArrayType & self, obj<ACollector> gc) noexcept;
|
||||
/** move instance using object visitor.
|
||||
Arguably abusing the word 'visitor' here **/
|
||||
static Opaque gco_shallow_move(DArrayType & self, obj<AGCObjectVisitor> gc) noexcept;
|
||||
/** Invoke fn.visit_child(iface,data) for each child GCObject pointer.
|
||||
Context: provides address of data pointer so it can be updated in place
|
||||
when @p fn invokes garbage collector reentry point **/
|
||||
|
|
|
|||
|
|
@ -51,8 +51,9 @@ namespace xo {
|
|||
// const methods
|
||||
|
||||
// non-const methods
|
||||
/** move instance using collector **/
|
||||
static Opaque shallow_move(DAtomicType & self, obj<ACollector> gc) noexcept;
|
||||
/** move instance using object visitor.
|
||||
Arguably abusing the word 'visitor' here **/
|
||||
static Opaque gco_shallow_move(DAtomicType & self, obj<AGCObjectVisitor> gc) noexcept;
|
||||
/** Invoke fn.visit_child(iface,data) for each child GCObject pointer.
|
||||
Context: provides address of data pointer so it can be updated in place
|
||||
when @p fn invokes garbage collector reentry point **/
|
||||
|
|
|
|||
|
|
@ -51,8 +51,9 @@ namespace xo {
|
|||
// const methods
|
||||
|
||||
// non-const methods
|
||||
/** move instance using collector **/
|
||||
static Opaque shallow_move(DFunctionType & self, obj<ACollector> gc) noexcept;
|
||||
/** move instance using object visitor.
|
||||
Arguably abusing the word 'visitor' here **/
|
||||
static Opaque gco_shallow_move(DFunctionType & self, obj<AGCObjectVisitor> gc) noexcept;
|
||||
/** Invoke fn.visit_child(iface,data) for each child GCObject pointer.
|
||||
Context: provides address of data pointer so it can be updated in place
|
||||
when @p fn invokes garbage collector reentry point **/
|
||||
|
|
|
|||
|
|
@ -51,8 +51,9 @@ namespace xo {
|
|||
// const methods
|
||||
|
||||
// non-const methods
|
||||
/** move instance using collector **/
|
||||
static Opaque shallow_move(DListType & self, obj<ACollector> gc) noexcept;
|
||||
/** move instance using object visitor.
|
||||
Arguably abusing the word 'visitor' here **/
|
||||
static Opaque gco_shallow_move(DListType & self, obj<AGCObjectVisitor> gc) noexcept;
|
||||
/** Invoke fn.visit_child(iface,data) for each child GCObject pointer.
|
||||
Context: provides address of data pointer so it can be updated in place
|
||||
when @p fn invokes garbage collector reentry point **/
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
#include "Type.hpp"
|
||||
#include "Metatype.hpp"
|
||||
#include <xo/alloc2/Collector.hpp>
|
||||
//#include <xo/alloc2/Collector.hpp>
|
||||
#include <xo/alloc2/Allocator.hpp>
|
||||
#include <xo/stringtable2/UniqueString.hpp>
|
||||
|
||||
|
|
@ -22,7 +22,7 @@ namespace xo {
|
|||
**/
|
||||
class DTypeVarRef {
|
||||
public:
|
||||
using ACollector = xo::mm::ACollector;
|
||||
//using ACollector = xo::mm::ACollector;
|
||||
using AGCObjectVisitor = xo::mm::AGCObjectVisitor;
|
||||
using AAllocator = xo::mm::AAllocator;
|
||||
using TypeDescr = xo::reflect::TypeDescr;
|
||||
|
|
@ -54,8 +54,7 @@ namespace xo {
|
|||
///@}
|
||||
/** @defgroup xo-scm-atomictype-gcobject-facet **/
|
||||
///@{
|
||||
std::size_t shallow_size() const noexcept;
|
||||
DTypeVarRef * shallow_move(obj<ACollector> gc) noexcept;
|
||||
DTypeVarRef * gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept;
|
||||
void visit_gco_children(obj<AGCObjectVisitor> gc) noexcept;
|
||||
///@}
|
||||
|
||||
|
|
|
|||
|
|
@ -51,8 +51,9 @@ namespace xo {
|
|||
// const methods
|
||||
|
||||
// non-const methods
|
||||
/** move instance using collector **/
|
||||
static Opaque shallow_move(DTypeVarRef & self, obj<ACollector> gc) noexcept;
|
||||
/** move instance using object visitor.
|
||||
Arguably abusing the word 'visitor' here **/
|
||||
static Opaque gco_shallow_move(DTypeVarRef & self, obj<AGCObjectVisitor> gc) noexcept;
|
||||
/** Invoke fn.visit_child(iface,data) for each child GCObject pointer.
|
||||
Context: provides address of data pointer so it can be updated in place
|
||||
when @p fn invokes garbage collector reentry point **/
|
||||
|
|
|
|||
|
|
@ -76,14 +76,8 @@ namespace xo {
|
|||
|
||||
// ----- gcobject facet -----
|
||||
|
||||
std::size_t
|
||||
DArrayType::shallow_size() const noexcept
|
||||
{
|
||||
return sizeof(*this);
|
||||
}
|
||||
|
||||
DArrayType *
|
||||
DArrayType::shallow_move(obj<ACollector> gc) noexcept
|
||||
DArrayType::gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept
|
||||
{
|
||||
return gc.std_move_for(this);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,14 +54,8 @@ namespace xo {
|
|||
|
||||
// ----- GCObject facet -----
|
||||
|
||||
std::size_t
|
||||
DAtomicType::shallow_size() const noexcept
|
||||
{
|
||||
return sizeof(DAtomicType);
|
||||
}
|
||||
|
||||
DAtomicType *
|
||||
DAtomicType::shallow_move(obj<ACollector> gc) noexcept
|
||||
DAtomicType::gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept
|
||||
{
|
||||
return gc.std_move_for(this);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,14 +87,8 @@ namespace xo {
|
|||
|
||||
// ----- gcobject facet -----
|
||||
|
||||
std::size_t
|
||||
DFunctionType::shallow_size() const noexcept
|
||||
{
|
||||
return sizeof(*this);
|
||||
}
|
||||
|
||||
DFunctionType *
|
||||
DFunctionType::shallow_move(obj<ACollector> gc) noexcept
|
||||
DFunctionType::gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept
|
||||
{
|
||||
return gc.std_move_for(this);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81,14 +81,8 @@ namespace xo {
|
|||
|
||||
// ----- gcobject facet -----
|
||||
|
||||
std::size_t
|
||||
DListType::shallow_size() const noexcept
|
||||
{
|
||||
return sizeof(*this);
|
||||
}
|
||||
|
||||
DListType *
|
||||
DListType::shallow_move(obj<ACollector> gc) noexcept
|
||||
DListType::gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept
|
||||
{
|
||||
return gc.std_move_for(this);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,14 +75,8 @@ namespace xo {
|
|||
|
||||
// ----- GCObject facet -----
|
||||
|
||||
std::size_t
|
||||
DTypeVarRef::shallow_size() const noexcept
|
||||
{
|
||||
return sizeof(DTypeVarRef);
|
||||
}
|
||||
|
||||
DTypeVarRef *
|
||||
DTypeVarRef::shallow_move(obj<ACollector> gc) noexcept
|
||||
DTypeVarRef::gco_shallow_move(obj<AGCObjectVisitor> gc) noexcept
|
||||
{
|
||||
return gc.std_move_for(this);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,9 +16,9 @@
|
|||
namespace xo {
|
||||
namespace scm {
|
||||
auto
|
||||
IGCObject_DArrayType::shallow_move(DArrayType & self, obj<ACollector> gc) noexcept -> Opaque
|
||||
IGCObject_DArrayType::gco_shallow_move(DArrayType & self, obj<AGCObjectVisitor> gc) noexcept -> Opaque
|
||||
{
|
||||
return self.shallow_move(gc);
|
||||
return self.gco_shallow_move(gc);
|
||||
}
|
||||
auto
|
||||
IGCObject_DArrayType::visit_gco_children(DArrayType & self, obj<AGCObjectVisitor> fn) noexcept -> void
|
||||
|
|
|
|||
|
|
@ -16,9 +16,9 @@
|
|||
namespace xo {
|
||||
namespace scm {
|
||||
auto
|
||||
IGCObject_DAtomicType::shallow_move(DAtomicType & self, obj<ACollector> gc) noexcept -> Opaque
|
||||
IGCObject_DAtomicType::gco_shallow_move(DAtomicType & self, obj<AGCObjectVisitor> gc) noexcept -> Opaque
|
||||
{
|
||||
return self.shallow_move(gc);
|
||||
return self.gco_shallow_move(gc);
|
||||
}
|
||||
auto
|
||||
IGCObject_DAtomicType::visit_gco_children(DAtomicType & self, obj<AGCObjectVisitor> fn) noexcept -> void
|
||||
|
|
|
|||
|
|
@ -16,9 +16,9 @@
|
|||
namespace xo {
|
||||
namespace scm {
|
||||
auto
|
||||
IGCObject_DFunctionType::shallow_move(DFunctionType & self, obj<ACollector> gc) noexcept -> Opaque
|
||||
IGCObject_DFunctionType::gco_shallow_move(DFunctionType & self, obj<AGCObjectVisitor> gc) noexcept -> Opaque
|
||||
{
|
||||
return self.shallow_move(gc);
|
||||
return self.gco_shallow_move(gc);
|
||||
}
|
||||
auto
|
||||
IGCObject_DFunctionType::visit_gco_children(DFunctionType & self, obj<AGCObjectVisitor> fn) noexcept -> void
|
||||
|
|
|
|||
|
|
@ -16,9 +16,9 @@
|
|||
namespace xo {
|
||||
namespace scm {
|
||||
auto
|
||||
IGCObject_DListType::shallow_move(DListType & self, obj<ACollector> gc) noexcept -> Opaque
|
||||
IGCObject_DListType::gco_shallow_move(DListType & self, obj<AGCObjectVisitor> gc) noexcept -> Opaque
|
||||
{
|
||||
return self.shallow_move(gc);
|
||||
return self.gco_shallow_move(gc);
|
||||
}
|
||||
auto
|
||||
IGCObject_DListType::visit_gco_children(DListType & self, obj<AGCObjectVisitor> fn) noexcept -> void
|
||||
|
|
|
|||
|
|
@ -16,9 +16,9 @@
|
|||
namespace xo {
|
||||
namespace scm {
|
||||
auto
|
||||
IGCObject_DTypeVarRef::shallow_move(DTypeVarRef & self, obj<ACollector> gc) noexcept -> Opaque
|
||||
IGCObject_DTypeVarRef::gco_shallow_move(DTypeVarRef & self, obj<AGCObjectVisitor> gc) noexcept -> Opaque
|
||||
{
|
||||
return self.shallow_move(gc);
|
||||
return self.gco_shallow_move(gc);
|
||||
}
|
||||
auto
|
||||
IGCObject_DTypeVarRef::visit_gco_children(DTypeVarRef & self, obj<AGCObjectVisitor> fn) noexcept -> void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue