refactor: rename shallow_copy -> shallow_move + streamline
Use RCollector.std_copy_for where appropriate
This commit is contained in:
parent
0cb20c3789
commit
8ac5ba9bbb
28 changed files with 45 additions and 62 deletions
|
|
@ -148,7 +148,7 @@ 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 **/
|
||||
DArray * shallow_move(obj<AAllocator> mm) const noexcept;
|
||||
DArray * shallow_move(obj<ACollector> gc) noexcept;
|
||||
/** forward elements to @p gc to-space; replace originals with forarding pointers **/
|
||||
AAllocator::size_type forward_children(obj<ACollector> gc) noexcept;
|
||||
///@}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ namespace xo {
|
|||
// GCObject facet
|
||||
|
||||
std::size_t shallow_size() const noexcept;
|
||||
DBoolean * shallow_move(obj<AAllocator> mm) const noexcept;
|
||||
DBoolean * shallow_move(obj<ACollector> gc) noexcept;
|
||||
std::size_t forward_children(obj<ACollector> gc) noexcept;
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -203,7 +203,7 @@ 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 **/
|
||||
DDictionary * shallow_move(obj<AAllocator> mm) noexcept;
|
||||
DDictionary * shallow_move(obj<ACollector> gc) noexcept;
|
||||
/** forward elements to @p gc to-space; replace originals with forarding pointers **/
|
||||
AAllocator::size_type forward_children(obj<ACollector> gc) noexcept;
|
||||
///@}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ namespace xo {
|
|||
|
||||
// GCObject facet
|
||||
std::size_t shallow_size() const noexcept;
|
||||
DFloat * shallow_move(obj<AAllocator> mm) const noexcept;
|
||||
DFloat * shallow_move(obj<ACollector> gc) noexcept;
|
||||
std::size_t forward_children(obj<ACollector> gc) noexcept;
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ namespace xo {
|
|||
// GCObject facet
|
||||
|
||||
std::size_t shallow_size() const noexcept;
|
||||
DInteger * shallow_move(obj<AAllocator> mm) const noexcept;
|
||||
DInteger * shallow_move(obj<ACollector> gc) noexcept;
|
||||
std::size_t forward_children(obj<ACollector> gc) noexcept;
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ namespace xo {
|
|||
/** @defgroup xo-scm-list-gcobject-facet gcobject facet **/
|
||||
///@{
|
||||
size_type shallow_size() const noexcept;
|
||||
DList * shallow_move(obj<AAllocator> mm) noexcept;
|
||||
DList * shallow_move(obj<ACollector> gc) noexcept;
|
||||
size_type forward_children(obj<ACollector> gc) noexcept;
|
||||
///@}
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ namespace xo {
|
|||
///@{
|
||||
|
||||
std::size_t shallow_size() const noexcept;
|
||||
DRuntimeError * shallow_move(obj<AAllocator> mm) const noexcept;
|
||||
DRuntimeError * shallow_move(obj<ACollector> gc) noexcept;
|
||||
std::size_t forward_children(obj<ACollector> gc) noexcept;
|
||||
|
||||
///@}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ namespace xo {
|
|||
|
||||
// non-const methods
|
||||
/** move instance using allocator **/
|
||||
static Opaque shallow_move(DArray & self, obj<AAllocator> mm) noexcept;
|
||||
static Opaque shallow_move(DArray & self, obj<ACollector> gc) noexcept;
|
||||
/** during GC: forward immdiate children **/
|
||||
static size_type forward_children(DArray & self, obj<ACollector> gc) noexcept;
|
||||
///@}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ namespace xo {
|
|||
|
||||
// non-const methods
|
||||
/** move instance using allocator **/
|
||||
static Opaque shallow_move(DBoolean & self, obj<AAllocator> mm) noexcept;
|
||||
static Opaque shallow_move(DBoolean & self, obj<ACollector> gc) noexcept;
|
||||
/** during GC: forward immdiate children **/
|
||||
static size_type forward_children(DBoolean & self, obj<ACollector> gc) noexcept;
|
||||
///@}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ namespace xo {
|
|||
|
||||
// non-const methods
|
||||
/** move instance using allocator **/
|
||||
static Opaque shallow_move(DDictionary & self, obj<AAllocator> mm) noexcept;
|
||||
static Opaque shallow_move(DDictionary & self, obj<ACollector> gc) noexcept;
|
||||
/** during GC: forward immdiate children **/
|
||||
static size_type forward_children(DDictionary & self, obj<ACollector> gc) noexcept;
|
||||
///@}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ namespace xo {
|
|||
|
||||
// non-const methods
|
||||
/** move instance using allocator **/
|
||||
static Opaque shallow_move(DRuntimeError & self, obj<AAllocator> mm) noexcept;
|
||||
static Opaque shallow_move(DRuntimeError & self, obj<ACollector> gc) noexcept;
|
||||
/** during GC: forward immdiate children **/
|
||||
static size_type forward_children(DRuntimeError & self, obj<ACollector> gc) noexcept;
|
||||
///@}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ namespace xo {
|
|||
|
||||
// non-const methods
|
||||
/** move instance using allocator **/
|
||||
static Opaque shallow_move(DList & self, obj<AAllocator> mm) noexcept;
|
||||
static Opaque shallow_move(DList & self, obj<ACollector> gc) noexcept;
|
||||
/** during GC: forward immdiate children **/
|
||||
static size_type forward_children(DList & self, obj<ACollector> gc) noexcept;
|
||||
///@}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ namespace xo {
|
|||
|
||||
// non-const methods
|
||||
/** move instance using allocator **/
|
||||
static Opaque shallow_move(DFloat & self, obj<AAllocator> mm) noexcept;
|
||||
static Opaque shallow_move(DFloat & self, obj<ACollector> gc) noexcept;
|
||||
/** during GC: forward immdiate children **/
|
||||
static size_type forward_children(DFloat & self, obj<ACollector> gc) noexcept;
|
||||
///@}
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ namespace xo {
|
|||
|
||||
// non-const methods
|
||||
/** move instance using allocator **/
|
||||
static Opaque shallow_move(DInteger & self, obj<AAllocator> mm) noexcept;
|
||||
static Opaque shallow_move(DInteger & self, obj<ACollector> gc) noexcept;
|
||||
/** during GC: forward immdiate children **/
|
||||
static size_type forward_children(DInteger & self, obj<ACollector> gc) noexcept;
|
||||
///@}
|
||||
|
|
|
|||
|
|
@ -181,9 +181,12 @@ namespace xo {
|
|||
}
|
||||
|
||||
DArray *
|
||||
DArray::shallow_move(obj<AAllocator> mm) const noexcept
|
||||
DArray::shallow_move(obj<ACollector> gc) noexcept
|
||||
{
|
||||
DArray * copy = (DArray *)mm.alloc_copy((std::byte *)this);
|
||||
// note: not using gc.std_copy_for() here.
|
||||
// flexible array -> compiler doesn't know actual DArray allocation size
|
||||
|
||||
DArray * copy = (DArray *)gc.alloc_copy((std::byte *)this);
|
||||
|
||||
if (copy) {
|
||||
copy->capacity_ = capacity_;
|
||||
|
|
|
|||
|
|
@ -36,14 +36,9 @@ namespace xo {
|
|||
}
|
||||
|
||||
DBoolean *
|
||||
DBoolean::shallow_move(obj<AAllocator> mm) const noexcept
|
||||
DBoolean::shallow_move(obj<ACollector> gc) noexcept
|
||||
{
|
||||
DBoolean * copy = (DBoolean *)mm.alloc_copy((std::byte *)this);
|
||||
|
||||
if (copy)
|
||||
*copy = *this;
|
||||
|
||||
return copy;
|
||||
return gc.std_copy_for(this);
|
||||
}
|
||||
|
||||
size_t
|
||||
|
|
|
|||
|
|
@ -274,9 +274,9 @@ namespace xo {
|
|||
}
|
||||
|
||||
DDictionary *
|
||||
DDictionary::shallow_move(obj<AAllocator> mm) noexcept
|
||||
DDictionary::shallow_move(obj<ACollector> gc) noexcept
|
||||
{
|
||||
return mm.std_copy_for(this);
|
||||
return gc.std_copy_for(this);
|
||||
}
|
||||
|
||||
std::size_t
|
||||
|
|
|
|||
|
|
@ -34,14 +34,9 @@ namespace xo {
|
|||
}
|
||||
|
||||
DFloat *
|
||||
DFloat::shallow_move(obj<AAllocator> mm) const noexcept
|
||||
DFloat::shallow_move(obj<ACollector> gc) noexcept
|
||||
{
|
||||
DFloat * copy = (DFloat *)mm.alloc_copy((std::byte *)this);
|
||||
|
||||
if (copy)
|
||||
*copy = *this;
|
||||
|
||||
return copy;
|
||||
return gc.std_copy_for(this);
|
||||
}
|
||||
|
||||
size_t
|
||||
|
|
|
|||
|
|
@ -34,14 +34,9 @@ namespace xo {
|
|||
}
|
||||
|
||||
DInteger *
|
||||
DInteger::shallow_move(obj<AAllocator> mm) const noexcept
|
||||
DInteger::shallow_move(obj<ACollector> gc) noexcept
|
||||
{
|
||||
DInteger * copy = (DInteger *)mm.alloc_copy((std::byte *)this);
|
||||
|
||||
if (copy)
|
||||
*copy = *this;
|
||||
|
||||
return copy;
|
||||
return gc.std_copy_for(this);
|
||||
}
|
||||
|
||||
size_t
|
||||
|
|
|
|||
|
|
@ -185,9 +185,9 @@ namespace xo {
|
|||
}
|
||||
|
||||
DList *
|
||||
DList::shallow_move(obj<AAllocator> mm) noexcept
|
||||
DList::shallow_move(obj<ACollector> gc) noexcept
|
||||
{
|
||||
return mm.std_copy_for(this);
|
||||
return gc.std_copy_for(this);
|
||||
}
|
||||
|
||||
auto
|
||||
|
|
|
|||
|
|
@ -59,14 +59,9 @@ namespace xo {
|
|||
}
|
||||
|
||||
DRuntimeError *
|
||||
DRuntimeError::shallow_move(obj<AAllocator> mm) const noexcept
|
||||
DRuntimeError::shallow_move(obj<ACollector> gc) noexcept
|
||||
{
|
||||
DRuntimeError * copy = (DRuntimeError *)mm.alloc_copy((std::byte *)this);
|
||||
|
||||
if (copy)
|
||||
*copy = *this;
|
||||
|
||||
return copy;
|
||||
return gc.std_copy_for(this);
|
||||
}
|
||||
|
||||
std::size_t
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ namespace xo {
|
|||
}
|
||||
|
||||
auto
|
||||
IGCObject_DArray::shallow_move(DArray & self, obj<AAllocator> mm) noexcept -> Opaque
|
||||
IGCObject_DArray::shallow_move(DArray & self, obj<ACollector> gc) noexcept -> Opaque
|
||||
{
|
||||
return self.shallow_move(mm);
|
||||
return self.shallow_move(gc);
|
||||
}
|
||||
auto
|
||||
IGCObject_DArray::forward_children(DArray & self, obj<ACollector> gc) noexcept -> size_type
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ namespace xo {
|
|||
}
|
||||
|
||||
auto
|
||||
IGCObject_DBoolean::shallow_move(DBoolean & self, obj<AAllocator> mm) noexcept -> Opaque
|
||||
IGCObject_DBoolean::shallow_move(DBoolean & self, obj<ACollector> gc) noexcept -> Opaque
|
||||
{
|
||||
return self.shallow_move(mm);
|
||||
return self.shallow_move(gc);
|
||||
}
|
||||
auto
|
||||
IGCObject_DBoolean::forward_children(DBoolean & self, obj<ACollector> gc) noexcept -> size_type
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ namespace xo {
|
|||
}
|
||||
|
||||
auto
|
||||
IGCObject_DDictionary::shallow_move(DDictionary & self, obj<AAllocator> mm) noexcept -> Opaque
|
||||
IGCObject_DDictionary::shallow_move(DDictionary & self, obj<ACollector> gc) noexcept -> Opaque
|
||||
{
|
||||
return self.shallow_move(mm);
|
||||
return self.shallow_move(gc);
|
||||
}
|
||||
auto
|
||||
IGCObject_DDictionary::forward_children(DDictionary & self, obj<ACollector> gc) noexcept -> size_type
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ namespace xo {
|
|||
}
|
||||
|
||||
auto
|
||||
IGCObject_DFloat::shallow_move(DFloat & self, obj<AAllocator> mm) noexcept -> Opaque
|
||||
IGCObject_DFloat::shallow_move(DFloat & self, obj<ACollector> gc) noexcept -> Opaque
|
||||
{
|
||||
return self.shallow_move(mm);
|
||||
return self.shallow_move(gc);
|
||||
}
|
||||
auto
|
||||
IGCObject_DFloat::forward_children(DFloat & self, obj<ACollector> gc) noexcept -> size_type
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ namespace xo {
|
|||
}
|
||||
|
||||
auto
|
||||
IGCObject_DInteger::shallow_move(DInteger & self, obj<AAllocator> mm) noexcept -> Opaque
|
||||
IGCObject_DInteger::shallow_move(DInteger & self, obj<ACollector> gc) noexcept -> Opaque
|
||||
{
|
||||
return self.shallow_move(mm);
|
||||
return self.shallow_move(gc);
|
||||
}
|
||||
auto
|
||||
IGCObject_DInteger::forward_children(DInteger & self, obj<ACollector> gc) noexcept -> size_type
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ namespace xo {
|
|||
}
|
||||
|
||||
auto
|
||||
IGCObject_DList::shallow_move(DList & self, obj<AAllocator> mm) noexcept -> Opaque
|
||||
IGCObject_DList::shallow_move(DList & self, obj<ACollector> gc) noexcept -> Opaque
|
||||
{
|
||||
return self.shallow_move(mm);
|
||||
return self.shallow_move(gc);
|
||||
}
|
||||
auto
|
||||
IGCObject_DList::forward_children(DList & self, obj<ACollector> gc) noexcept -> size_type
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ namespace xo {
|
|||
}
|
||||
|
||||
auto
|
||||
IGCObject_DRuntimeError::shallow_move(DRuntimeError & self, obj<AAllocator> mm) noexcept -> Opaque
|
||||
IGCObject_DRuntimeError::shallow_move(DRuntimeError & self, obj<ACollector> gc) noexcept -> Opaque
|
||||
{
|
||||
return self.shallow_move(mm);
|
||||
return self.shallow_move(gc);
|
||||
}
|
||||
auto
|
||||
IGCObject_DRuntimeError::forward_children(DRuntimeError & self, obj<ACollector> gc) noexcept -> size_type
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue