refactor: make AGCObject.shallow_copy() non-const
prep for moving to ACollector interface
This commit is contained in:
parent
53223b38ff
commit
d2aa0d0c55
30 changed files with 49 additions and 50 deletions
|
|
@ -73,7 +73,7 @@ namespace xo {
|
|||
///@{
|
||||
|
||||
std::size_t shallow_size() const noexcept;
|
||||
DDefineExpr * shallow_copy(obj<AAllocator> mm) const noexcept;
|
||||
DDefineExpr * shallow_copy(obj<AAllocator> mm) noexcept;
|
||||
std::size_t forward_children(obj<ACollector> gc) noexcept;
|
||||
|
||||
///@}
|
||||
|
|
|
|||
|
|
@ -98,7 +98,7 @@ namespace xo {
|
|||
///@{
|
||||
|
||||
std::size_t shallow_size() const noexcept;
|
||||
DLocalSymtab * shallow_copy(obj<AAllocator> mm) const noexcept;
|
||||
DLocalSymtab * shallow_copy(obj<AAllocator> mm) noexcept;
|
||||
std::size_t forward_children(obj<ACollector> gc) noexcept;
|
||||
|
||||
///@}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ namespace xo {
|
|||
///@{
|
||||
|
||||
size_t shallow_size() const noexcept;
|
||||
DTypename * shallow_copy(obj<AAllocator> mm) const noexcept;
|
||||
DTypename * shallow_copy(obj<AAllocator> mm) noexcept;
|
||||
size_t forward_children(obj<ACollector> gc) noexcept;
|
||||
|
||||
///@}
|
||||
|
|
|
|||
|
|
@ -52,10 +52,10 @@ namespace xo {
|
|||
// const methods
|
||||
/** memory consumption for this instance **/
|
||||
static size_type shallow_size(const DDefineExpr & self) noexcept;
|
||||
/** copy instance using allocator **/
|
||||
static Opaque shallow_copy(const DDefineExpr & self, obj<AAllocator> mm) noexcept;
|
||||
|
||||
// non-const methods
|
||||
/** copy instance using allocator **/
|
||||
static Opaque shallow_copy(DDefineExpr & self, obj<AAllocator> mm) noexcept;
|
||||
/** during GC: forward immdiate children **/
|
||||
static size_type forward_children(DDefineExpr & self, obj<ACollector> gc) noexcept;
|
||||
///@}
|
||||
|
|
|
|||
|
|
@ -48,6 +48,11 @@ public:
|
|||
/** @defgroup scm-expression-methods **/
|
||||
///@{
|
||||
// const methods
|
||||
/** An uninitialized AExpression 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 **/
|
||||
|
|
|
|||
|
|
@ -52,10 +52,10 @@ namespace xo {
|
|||
// const methods
|
||||
/** memory consumption for this instance **/
|
||||
static size_type shallow_size(const DApplyExpr & self) noexcept;
|
||||
/** copy instance using allocator **/
|
||||
static Opaque shallow_copy(const DApplyExpr & self, obj<AAllocator> mm) noexcept;
|
||||
|
||||
// non-const methods
|
||||
/** copy instance using allocator **/
|
||||
static Opaque shallow_copy(DApplyExpr & self, obj<AAllocator> mm) noexcept;
|
||||
/** during GC: forward immdiate children **/
|
||||
static size_type forward_children(DApplyExpr & self, obj<ACollector> gc) noexcept;
|
||||
///@}
|
||||
|
|
|
|||
|
|
@ -52,10 +52,10 @@ namespace xo {
|
|||
// const methods
|
||||
/** memory consumption for this instance **/
|
||||
static size_type shallow_size(const DConstant & self) noexcept;
|
||||
/** copy instance using allocator **/
|
||||
static Opaque shallow_copy(const DConstant & self, obj<AAllocator> mm) noexcept;
|
||||
|
||||
// non-const methods
|
||||
/** copy instance using allocator **/
|
||||
static Opaque shallow_copy(DConstant & self, obj<AAllocator> mm) noexcept;
|
||||
/** during GC: forward immdiate children **/
|
||||
static size_type forward_children(DConstant & self, obj<ACollector> gc) noexcept;
|
||||
///@}
|
||||
|
|
|
|||
|
|
@ -52,10 +52,10 @@ namespace xo {
|
|||
// const methods
|
||||
/** memory consumption for this instance **/
|
||||
static size_type shallow_size(const DIfElseExpr & self) noexcept;
|
||||
/** copy instance using allocator **/
|
||||
static Opaque shallow_copy(const DIfElseExpr & self, obj<AAllocator> mm) noexcept;
|
||||
|
||||
// non-const methods
|
||||
/** copy instance using allocator **/
|
||||
static Opaque shallow_copy(DIfElseExpr & self, obj<AAllocator> mm) noexcept;
|
||||
/** during GC: forward immdiate children **/
|
||||
static size_type forward_children(DIfElseExpr & self, obj<ACollector> gc) noexcept;
|
||||
///@}
|
||||
|
|
|
|||
|
|
@ -52,10 +52,10 @@ namespace xo {
|
|||
// const methods
|
||||
/** memory consumption for this instance **/
|
||||
static size_type shallow_size(const DLambdaExpr & self) noexcept;
|
||||
/** copy instance using allocator **/
|
||||
static Opaque shallow_copy(const DLambdaExpr & self, obj<AAllocator> mm) noexcept;
|
||||
|
||||
// non-const methods
|
||||
/** copy instance using allocator **/
|
||||
static Opaque shallow_copy(DLambdaExpr & self, obj<AAllocator> mm) noexcept;
|
||||
/** during GC: forward immdiate children **/
|
||||
static size_type forward_children(DLambdaExpr & self, obj<ACollector> gc) noexcept;
|
||||
///@}
|
||||
|
|
|
|||
|
|
@ -52,10 +52,10 @@ namespace xo {
|
|||
// const methods
|
||||
/** memory consumption for this instance **/
|
||||
static size_type shallow_size(const DSequenceExpr & self) noexcept;
|
||||
/** copy instance using allocator **/
|
||||
static Opaque shallow_copy(const DSequenceExpr & self, obj<AAllocator> mm) noexcept;
|
||||
|
||||
// non-const methods
|
||||
/** copy instance using allocator **/
|
||||
static Opaque shallow_copy(DSequenceExpr & self, obj<AAllocator> mm) noexcept;
|
||||
/** during GC: forward immdiate children **/
|
||||
static size_type forward_children(DSequenceExpr & self, obj<ACollector> gc) noexcept;
|
||||
///@}
|
||||
|
|
|
|||
|
|
@ -52,10 +52,10 @@ namespace xo {
|
|||
// const methods
|
||||
/** memory consumption for this instance **/
|
||||
static size_type shallow_size(const DVarRef & self) noexcept;
|
||||
/** copy instance using allocator **/
|
||||
static Opaque shallow_copy(const DVarRef & self, obj<AAllocator> mm) noexcept;
|
||||
|
||||
// non-const methods
|
||||
/** copy instance using allocator **/
|
||||
static Opaque shallow_copy(DVarRef & self, obj<AAllocator> mm) noexcept;
|
||||
/** during GC: forward immdiate children **/
|
||||
static size_type forward_children(DVarRef & self, obj<ACollector> gc) noexcept;
|
||||
///@}
|
||||
|
|
|
|||
|
|
@ -45,6 +45,11 @@ public:
|
|||
/** @defgroup scm-symboltable-methods **/
|
||||
///@{
|
||||
// const methods
|
||||
/** An uninitialized ASymbolTable 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 **/
|
||||
|
|
|
|||
|
|
@ -52,10 +52,10 @@ namespace xo {
|
|||
// const methods
|
||||
/** memory consumption for this instance **/
|
||||
static size_type shallow_size(const DGlobalSymtab & self) noexcept;
|
||||
/** copy instance using allocator **/
|
||||
static Opaque shallow_copy(const DGlobalSymtab & self, obj<AAllocator> mm) noexcept;
|
||||
|
||||
// non-const methods
|
||||
/** copy instance using allocator **/
|
||||
static Opaque shallow_copy(DGlobalSymtab & self, obj<AAllocator> mm) noexcept;
|
||||
/** during GC: forward immdiate children **/
|
||||
static size_type forward_children(DGlobalSymtab & self, obj<ACollector> gc) noexcept;
|
||||
///@}
|
||||
|
|
|
|||
|
|
@ -52,10 +52,10 @@ namespace xo {
|
|||
// const methods
|
||||
/** memory consumption for this instance **/
|
||||
static size_type shallow_size(const DLocalSymtab & self) noexcept;
|
||||
/** copy instance using allocator **/
|
||||
static Opaque shallow_copy(const DLocalSymtab & self, obj<AAllocator> mm) noexcept;
|
||||
|
||||
// non-const methods
|
||||
/** copy instance using allocator **/
|
||||
static Opaque shallow_copy(DLocalSymtab & self, obj<AAllocator> mm) noexcept;
|
||||
/** during GC: forward immdiate children **/
|
||||
static size_type forward_children(DLocalSymtab & self, obj<ACollector> gc) noexcept;
|
||||
///@}
|
||||
|
|
|
|||
|
|
@ -50,10 +50,10 @@ namespace xo {
|
|||
// const methods
|
||||
/** memory consumption for this instance **/
|
||||
static size_type shallow_size(const DTypename & self) noexcept;
|
||||
/** copy instance using allocator **/
|
||||
static Opaque shallow_copy(const DTypename & self, obj<AAllocator> mm) noexcept;
|
||||
|
||||
// non-const methods
|
||||
/** copy instance using allocator **/
|
||||
static Opaque shallow_copy(DTypename & self, obj<AAllocator> mm) noexcept;
|
||||
/** during GC: forward immdiate children **/
|
||||
static size_type forward_children(DTypename & self, obj<ACollector> gc) noexcept;
|
||||
///@}
|
||||
|
|
|
|||
|
|
@ -52,10 +52,10 @@ namespace xo {
|
|||
// const methods
|
||||
/** memory consumption for this instance **/
|
||||
static size_type shallow_size(const DVariable & self) noexcept;
|
||||
/** copy instance using allocator **/
|
||||
static Opaque shallow_copy(const DVariable & self, obj<AAllocator> mm) noexcept;
|
||||
|
||||
// non-const methods
|
||||
/** copy instance using allocator **/
|
||||
static Opaque shallow_copy(DVariable & self, obj<AAllocator> mm) noexcept;
|
||||
/** during GC: forward immdiate children **/
|
||||
static size_type forward_children(DVariable & self, obj<ACollector> gc) noexcept;
|
||||
///@}
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ namespace xo {
|
|||
}
|
||||
|
||||
DDefineExpr *
|
||||
DDefineExpr::shallow_copy(obj<AAllocator> mm) const noexcept
|
||||
DDefineExpr::shallow_copy(obj<AAllocator> mm) noexcept
|
||||
{
|
||||
return mm.std_copy_for(this);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ namespace xo {
|
|||
}
|
||||
|
||||
DLocalSymtab *
|
||||
DLocalSymtab::shallow_copy(obj<AAllocator> mm) const noexcept
|
||||
DLocalSymtab::shallow_copy(obj<AAllocator> mm) noexcept
|
||||
{
|
||||
return mm.std_copy_for(this);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ namespace xo {
|
|||
}
|
||||
|
||||
DTypename *
|
||||
DTypename::shallow_copy(obj<AAllocator> mm) const noexcept
|
||||
DTypename::shallow_copy(obj<AAllocator> mm) noexcept
|
||||
{
|
||||
return mm.std_copy_for(this);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,11 +22,10 @@ namespace xo {
|
|||
}
|
||||
|
||||
auto
|
||||
IGCObject_DApplyExpr::shallow_copy(const DApplyExpr & self, obj<AAllocator> mm) noexcept -> Opaque
|
||||
IGCObject_DApplyExpr::shallow_copy(DApplyExpr & self, obj<AAllocator> mm) noexcept -> Opaque
|
||||
{
|
||||
return self.shallow_copy(mm);
|
||||
}
|
||||
|
||||
auto
|
||||
IGCObject_DApplyExpr::forward_children(DApplyExpr & self, obj<ACollector> gc) noexcept -> size_type
|
||||
{
|
||||
|
|
|
|||
|
|
@ -22,11 +22,10 @@ namespace xo {
|
|||
}
|
||||
|
||||
auto
|
||||
IGCObject_DConstant::shallow_copy(const DConstant & self, obj<AAllocator> mm) noexcept -> Opaque
|
||||
IGCObject_DConstant::shallow_copy(DConstant & self, obj<AAllocator> mm) noexcept -> Opaque
|
||||
{
|
||||
return self.shallow_copy(mm);
|
||||
}
|
||||
|
||||
auto
|
||||
IGCObject_DConstant::forward_children(DConstant & self, obj<ACollector> gc) noexcept -> size_type
|
||||
{
|
||||
|
|
|
|||
|
|
@ -22,11 +22,10 @@ namespace xo {
|
|||
}
|
||||
|
||||
auto
|
||||
IGCObject_DDefineExpr::shallow_copy(const DDefineExpr & self, obj<AAllocator> mm) noexcept -> Opaque
|
||||
IGCObject_DDefineExpr::shallow_copy(DDefineExpr & self, obj<AAllocator> mm) noexcept -> Opaque
|
||||
{
|
||||
return self.shallow_copy(mm);
|
||||
}
|
||||
|
||||
auto
|
||||
IGCObject_DDefineExpr::forward_children(DDefineExpr & self, obj<ACollector> gc) noexcept -> size_type
|
||||
{
|
||||
|
|
|
|||
|
|
@ -22,11 +22,10 @@ namespace xo {
|
|||
}
|
||||
|
||||
auto
|
||||
IGCObject_DGlobalSymtab::shallow_copy(const DGlobalSymtab & self, obj<AAllocator> mm) noexcept -> Opaque
|
||||
IGCObject_DGlobalSymtab::shallow_copy(DGlobalSymtab & self, obj<AAllocator> mm) noexcept -> Opaque
|
||||
{
|
||||
return self.shallow_copy(mm);
|
||||
}
|
||||
|
||||
auto
|
||||
IGCObject_DGlobalSymtab::forward_children(DGlobalSymtab & self, obj<ACollector> gc) noexcept -> size_type
|
||||
{
|
||||
|
|
|
|||
|
|
@ -22,11 +22,10 @@ namespace xo {
|
|||
}
|
||||
|
||||
auto
|
||||
IGCObject_DIfElseExpr::shallow_copy(const DIfElseExpr & self, obj<AAllocator> mm) noexcept -> Opaque
|
||||
IGCObject_DIfElseExpr::shallow_copy(DIfElseExpr & self, obj<AAllocator> mm) noexcept -> Opaque
|
||||
{
|
||||
return self.shallow_copy(mm);
|
||||
}
|
||||
|
||||
auto
|
||||
IGCObject_DIfElseExpr::forward_children(DIfElseExpr & self, obj<ACollector> gc) noexcept -> size_type
|
||||
{
|
||||
|
|
|
|||
|
|
@ -22,11 +22,10 @@ namespace xo {
|
|||
}
|
||||
|
||||
auto
|
||||
IGCObject_DLambdaExpr::shallow_copy(const DLambdaExpr & self, obj<AAllocator> mm) noexcept -> Opaque
|
||||
IGCObject_DLambdaExpr::shallow_copy(DLambdaExpr & self, obj<AAllocator> mm) noexcept -> Opaque
|
||||
{
|
||||
return self.shallow_copy(mm);
|
||||
}
|
||||
|
||||
auto
|
||||
IGCObject_DLambdaExpr::forward_children(DLambdaExpr & self, obj<ACollector> gc) noexcept -> size_type
|
||||
{
|
||||
|
|
|
|||
|
|
@ -22,11 +22,10 @@ namespace xo {
|
|||
}
|
||||
|
||||
auto
|
||||
IGCObject_DLocalSymtab::shallow_copy(const DLocalSymtab & self, obj<AAllocator> mm) noexcept -> Opaque
|
||||
IGCObject_DLocalSymtab::shallow_copy(DLocalSymtab & self, obj<AAllocator> mm) noexcept -> Opaque
|
||||
{
|
||||
return self.shallow_copy(mm);
|
||||
}
|
||||
|
||||
auto
|
||||
IGCObject_DLocalSymtab::forward_children(DLocalSymtab & self, obj<ACollector> gc) noexcept -> size_type
|
||||
{
|
||||
|
|
|
|||
|
|
@ -22,11 +22,10 @@ namespace xo {
|
|||
}
|
||||
|
||||
auto
|
||||
IGCObject_DSequenceExpr::shallow_copy(const DSequenceExpr & self, obj<AAllocator> mm) noexcept -> Opaque
|
||||
IGCObject_DSequenceExpr::shallow_copy(DSequenceExpr & self, obj<AAllocator> mm) noexcept -> Opaque
|
||||
{
|
||||
return self.shallow_copy(mm);
|
||||
}
|
||||
|
||||
auto
|
||||
IGCObject_DSequenceExpr::forward_children(DSequenceExpr & self, obj<ACollector> gc) noexcept -> size_type
|
||||
{
|
||||
|
|
|
|||
|
|
@ -22,11 +22,10 @@ namespace xo {
|
|||
}
|
||||
|
||||
auto
|
||||
IGCObject_DTypename::shallow_copy(const DTypename & self, obj<AAllocator> mm) noexcept -> Opaque
|
||||
IGCObject_DTypename::shallow_copy(DTypename & self, obj<AAllocator> mm) noexcept -> Opaque
|
||||
{
|
||||
return self.shallow_copy(mm);
|
||||
}
|
||||
|
||||
auto
|
||||
IGCObject_DTypename::forward_children(DTypename & self, obj<ACollector> gc) noexcept -> size_type
|
||||
{
|
||||
|
|
|
|||
|
|
@ -22,11 +22,10 @@ namespace xo {
|
|||
}
|
||||
|
||||
auto
|
||||
IGCObject_DVarRef::shallow_copy(const DVarRef & self, obj<AAllocator> mm) noexcept -> Opaque
|
||||
IGCObject_DVarRef::shallow_copy(DVarRef & self, obj<AAllocator> mm) noexcept -> Opaque
|
||||
{
|
||||
return self.shallow_copy(mm);
|
||||
}
|
||||
|
||||
auto
|
||||
IGCObject_DVarRef::forward_children(DVarRef & self, obj<ACollector> gc) noexcept -> size_type
|
||||
{
|
||||
|
|
|
|||
|
|
@ -22,11 +22,10 @@ namespace xo {
|
|||
}
|
||||
|
||||
auto
|
||||
IGCObject_DVariable::shallow_copy(const DVariable & self, obj<AAllocator> mm) noexcept -> Opaque
|
||||
IGCObject_DVariable::shallow_copy(DVariable & self, obj<AAllocator> mm) noexcept -> Opaque
|
||||
{
|
||||
return self.shallow_copy(mm);
|
||||
}
|
||||
|
||||
auto
|
||||
IGCObject_DVariable::forward_children(DVariable & self, obj<ACollector> gc) noexcept -> size_type
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue