refactor: retire GCObject.shallow_copy()
Collector gets this info from gc-owned object header
This commit is contained in:
parent
210f568f7b
commit
5676a69dd3
13 changed files with 18 additions and 75 deletions
|
|
@ -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<ACollector> gc) noexcept;
|
||||
/** forward elements to @p gc to-space; replace originals with forarding pointers **/
|
||||
AAllocator::size_type forward_children(obj<ACollector> gc) noexcept;
|
||||
void forward_children(obj<ACollector> gc) noexcept;
|
||||
///@}
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -37,9 +37,8 @@ namespace xo {
|
|||
|
||||
// GCObject facet
|
||||
|
||||
std::size_t shallow_size() const noexcept;
|
||||
DBoolean * shallow_move(obj<ACollector> gc) noexcept;
|
||||
std::size_t forward_children(obj<ACollector> gc) noexcept;
|
||||
void forward_children(obj<ACollector> gc) noexcept;
|
||||
|
||||
private:
|
||||
/** boxed boolean value **/
|
||||
|
|
|
|||
|
|
@ -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<ACollector> gc) noexcept;
|
||||
/** forward elements to @p gc to-space; replace originals with forarding pointers **/
|
||||
AAllocator::size_type forward_children(obj<ACollector> gc) noexcept;
|
||||
/** forward elements to @p gc to-space; replace originals with forwarding pointers **/
|
||||
void forward_children(obj<ACollector> gc) noexcept;
|
||||
///@}
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -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<ACollector> gc) noexcept;
|
||||
std::size_t forward_children(obj<ACollector> gc) noexcept;
|
||||
void forward_children(obj<ACollector> gc) noexcept;
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
|||
|
|
@ -39,9 +39,8 @@ namespace xo {
|
|||
|
||||
// GCObject facet
|
||||
|
||||
std::size_t shallow_size() const noexcept;
|
||||
DInteger * shallow_move(obj<ACollector> gc) noexcept;
|
||||
std::size_t forward_children(obj<ACollector> gc) noexcept;
|
||||
void forward_children(obj<ACollector> gc) noexcept;
|
||||
|
||||
private:
|
||||
/** boxed integer value **/
|
||||
|
|
|
|||
|
|
@ -69,9 +69,8 @@ namespace xo {
|
|||
|
||||
/** @defgroup xo-scm-list-gcobject-facet gcobject facet **/
|
||||
///@{
|
||||
size_type shallow_size() const noexcept;
|
||||
DList * shallow_move(obj<ACollector> gc) noexcept;
|
||||
size_type forward_children(obj<ACollector> gc) noexcept;
|
||||
void forward_children(obj<ACollector> gc) noexcept;
|
||||
///@}
|
||||
|
||||
/** first member of list **/
|
||||
|
|
|
|||
|
|
@ -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<AAllocator> mm) const noexcept;
|
||||
/** forward elements to @p gc to-space; replace originals with forarding pointers **/
|
||||
AAllocator::size_type forward_children(obj<ACollector> gc) noexcept;
|
||||
///@}
|
||||
|
|
|
|||
|
|
@ -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<AGCObject>));
|
||||
}
|
||||
|
||||
DArray *
|
||||
DArray::shallow_move(obj<ACollector> gc) noexcept
|
||||
{
|
||||
|
|
@ -203,7 +197,7 @@ namespace xo {
|
|||
return copy;
|
||||
}
|
||||
|
||||
std::size_t
|
||||
void
|
||||
DArray::forward_children(obj<ACollector> gc) noexcept
|
||||
{
|
||||
scope log(XO_DEBUG(false));
|
||||
|
|
@ -215,8 +209,6 @@ namespace xo {
|
|||
|
||||
gc.forward_inplace(&elt);
|
||||
}
|
||||
|
||||
return shallow_size();
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
|
|
|
|||
|
|
@ -29,22 +29,16 @@ namespace xo {
|
|||
(value_ ? "true" : "false"));
|
||||
}
|
||||
|
||||
size_t
|
||||
DBoolean::shallow_size() const noexcept
|
||||
{
|
||||
return sizeof(DBoolean);
|
||||
}
|
||||
|
||||
DBoolean *
|
||||
DBoolean::shallow_move(obj<ACollector> gc) noexcept
|
||||
{
|
||||
return gc.std_move_for(this);
|
||||
}
|
||||
|
||||
size_t
|
||||
void
|
||||
DBoolean::forward_children(obj<ACollector>) noexcept
|
||||
{
|
||||
return shallow_size();
|
||||
// no-op
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -267,26 +267,18 @@ namespace xo {
|
|||
|
||||
// ----- gcobject facet -----
|
||||
|
||||
std::size_t
|
||||
DDictionary::shallow_size() const noexcept
|
||||
{
|
||||
return sizeof(DDictionary);
|
||||
}
|
||||
|
||||
DDictionary *
|
||||
DDictionary::shallow_move(obj<ACollector> gc) noexcept
|
||||
{
|
||||
return gc.std_move_for(this);
|
||||
}
|
||||
|
||||
std::size_t
|
||||
void
|
||||
DDictionary::forward_children(obj<ACollector> gc) noexcept
|
||||
{
|
||||
|
||||
gc.forward_inplace(&keys_);
|
||||
gc.forward_inplace(&values_);
|
||||
|
||||
return this->shallow_size();
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
|
|
|
|||
|
|
@ -27,22 +27,16 @@ namespace xo {
|
|||
return ppdetail_atomic<double>::print_pretty(ppii, value_);
|
||||
}
|
||||
|
||||
size_t
|
||||
DFloat::shallow_size() const noexcept
|
||||
{
|
||||
return sizeof(DFloat);
|
||||
}
|
||||
|
||||
DFloat *
|
||||
DFloat::shallow_move(obj<ACollector> gc) noexcept
|
||||
{
|
||||
return gc.std_move_for(this);
|
||||
}
|
||||
|
||||
size_t
|
||||
void
|
||||
DFloat::forward_children(obj<ACollector>) noexcept
|
||||
{
|
||||
return shallow_size();
|
||||
// noop
|
||||
}
|
||||
|
||||
} /*namespace scm*/
|
||||
|
|
|
|||
|
|
@ -27,25 +27,18 @@ namespace xo {
|
|||
return ppdetail_atomic<long>::print_pretty(ppii, value_);
|
||||
}
|
||||
|
||||
size_t
|
||||
DInteger::shallow_size() const noexcept
|
||||
{
|
||||
return sizeof(DInteger);
|
||||
}
|
||||
|
||||
DInteger *
|
||||
DInteger::shallow_move(obj<ACollector> gc) noexcept
|
||||
{
|
||||
return gc.std_move_for(this);
|
||||
}
|
||||
|
||||
size_t
|
||||
void
|
||||
DInteger::forward_children(obj<ACollector>) noexcept
|
||||
{
|
||||
return shallow_size();
|
||||
// no-op
|
||||
}
|
||||
|
||||
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
||||
|
|
|
|||
|
|
@ -178,31 +178,19 @@ namespace xo {
|
|||
|
||||
// ----- GCObject facet ------
|
||||
|
||||
auto
|
||||
DList::shallow_size() const noexcept -> size_type
|
||||
{
|
||||
return sizeof(DList);
|
||||
}
|
||||
|
||||
DList *
|
||||
DList::shallow_move(obj<ACollector> gc) noexcept
|
||||
{
|
||||
return gc.std_move_for(this);
|
||||
}
|
||||
|
||||
auto
|
||||
DList::forward_children(obj<ACollector> gc) noexcept -> size_type
|
||||
void
|
||||
DList::forward_children(obj<ACollector> 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<AGCObject,DList>();
|
||||
//gc.forward_inplace(&iface, (void **)(&rest_));
|
||||
|
||||
return this->shallow_size();
|
||||
}
|
||||
} /*namespace scm*/
|
||||
} /*namespace xo*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue