refactor: rename shallow_copy -> shallow_move + streamline

Use RCollector.std_copy_for where appropriate
This commit is contained in:
Roland Conybeare 2026-04-04 16:33:35 -04:00
commit e179c9795b
36 changed files with 58 additions and 82 deletions

View file

@ -58,7 +58,7 @@ namespace xo {
///@{
std::size_t shallow_size() const noexcept;
DClosure * shallow_move(obj<AAllocator> mm) const noexcept;
DClosure * shallow_move(obj<ACollector> gc) noexcept;
std::size_t forward_children(obj<ACollector> gc) noexcept;
///@}

View file

@ -55,7 +55,7 @@ namespace xo {
///@{
std::size_t shallow_size() const noexcept;
DLocalEnv * shallow_move(obj<AAllocator> mm) const noexcept;
DLocalEnv * shallow_move(obj<ACollector> gc) noexcept;
std::size_t forward_children(obj<ACollector> gc) noexcept;
///@}

View file

@ -40,7 +40,7 @@ namespace xo {
/** gcobject facet **/
std::size_t shallow_size() const noexcept;
DVsmApplyClosureFrame * shallow_move(obj<AAllocator> mm) const noexcept;
DVsmApplyClosureFrame * shallow_move(obj<ACollector> gc) noexcept;
std::size_t forward_children(obj<ACollector> gc) noexcept;
/** pretty-printing support **/

View file

@ -38,7 +38,7 @@ namespace xo {
void assign_fn(obj<AGCObject> x) { this->fn_ = x; }
std::size_t shallow_size() const noexcept;
DVsmApplyFrame * shallow_move(obj<AAllocator> mm) const noexcept;
DVsmApplyFrame * shallow_move(obj<ACollector> gc) noexcept;
std::size_t forward_children(obj<ACollector> gc) noexcept;
/** pretty-printing support **/

View file

@ -51,7 +51,7 @@ namespace xo {
///@{
std::size_t shallow_size() const noexcept;
DVsmDefContFrame * shallow_move(obj<AAllocator> mm) noexcept;
DVsmDefContFrame * shallow_move(obj<ACollector> gc) noexcept;
std::size_t forward_children(obj<ACollector> gc) noexcept;
///@}

View file

@ -43,7 +43,7 @@ namespace xo {
int32_t increment_arg() { return ++i_arg_; }
std::size_t shallow_size() const noexcept;
DVsmEvalArgsFrame * shallow_move(obj<AAllocator> mm) const noexcept;
DVsmEvalArgsFrame * shallow_move(obj<ACollector> gc) noexcept;
std::size_t forward_children(obj<ACollector> gc) noexcept;
bool pretty(const ppindentinfo & ppii) const;

View file

@ -51,7 +51,7 @@ namespace xo {
///@{
std::size_t shallow_size() const noexcept;
DVsmIfElseContFrame * shallow_move(obj<AAllocator> mm) noexcept;
DVsmIfElseContFrame * shallow_move(obj<ACollector> gc) noexcept;
std::size_t forward_children(obj<ACollector> gc) noexcept;
///@}

View file

@ -56,7 +56,7 @@ namespace xo {
///@{
std::size_t shallow_size() const noexcept;
DVsmSeqContFrame * shallow_move(obj<AAllocator> mm) noexcept;
DVsmSeqContFrame * shallow_move(obj<ACollector> gc) noexcept;
std::size_t forward_children(obj<ACollector> gc) noexcept;
///@}

View file

@ -55,7 +55,7 @@ namespace xo {
// non-const methods
/** move instance using allocator **/
static Opaque shallow_move(DVsmDefContFrame & self, obj<AAllocator> mm) noexcept;
static Opaque shallow_move(DVsmDefContFrame & self, obj<ACollector> gc) noexcept;
/** during GC: forward immdiate children **/
static size_type forward_children(DVsmDefContFrame & self, obj<ACollector> gc) noexcept;
///@}

View file

@ -55,7 +55,7 @@ namespace xo {
// non-const methods
/** move instance using allocator **/
static Opaque shallow_move(DClosure & self, obj<AAllocator> mm) noexcept;
static Opaque shallow_move(DClosure & self, obj<ACollector> gc) noexcept;
/** during GC: forward immdiate children **/
static size_type forward_children(DClosure & self, obj<ACollector> gc) noexcept;
///@}

View file

@ -55,7 +55,7 @@ namespace xo {
// non-const methods
/** move instance using allocator **/
static Opaque shallow_move(DVsmApplyClosureFrame & self, obj<AAllocator> mm) noexcept;
static Opaque shallow_move(DVsmApplyClosureFrame & self, obj<ACollector> gc) noexcept;
/** during GC: forward immdiate children **/
static size_type forward_children(DVsmApplyClosureFrame & self, obj<ACollector> gc) noexcept;
///@}

View file

@ -55,7 +55,7 @@ namespace xo {
// non-const methods
/** move instance using allocator **/
static Opaque shallow_move(DVsmApplyFrame & self, obj<AAllocator> mm) noexcept;
static Opaque shallow_move(DVsmApplyFrame & self, obj<ACollector> gc) noexcept;
/** during GC: forward immdiate children **/
static size_type forward_children(DVsmApplyFrame & self, obj<ACollector> gc) noexcept;
///@}

View file

@ -55,7 +55,7 @@ namespace xo {
// non-const methods
/** move instance using allocator **/
static Opaque shallow_move(DVsmEvalArgsFrame & self, obj<AAllocator> mm) noexcept;
static Opaque shallow_move(DVsmEvalArgsFrame & self, obj<ACollector> gc) noexcept;
/** during GC: forward immdiate children **/
static size_type forward_children(DVsmEvalArgsFrame & self, obj<ACollector> gc) noexcept;
///@}

View file

@ -55,7 +55,7 @@ namespace xo {
// non-const methods
/** move instance using allocator **/
static Opaque shallow_move(DLocalEnv & self, obj<AAllocator> mm) noexcept;
static Opaque shallow_move(DLocalEnv & self, obj<ACollector> gc) noexcept;
/** during GC: forward immdiate children **/
static size_type forward_children(DLocalEnv & self, obj<ACollector> gc) noexcept;
///@}

View file

@ -55,7 +55,7 @@ namespace xo {
// non-const methods
/** move instance using allocator **/
static Opaque shallow_move(DVsmIfElseContFrame & self, obj<AAllocator> mm) noexcept;
static Opaque shallow_move(DVsmIfElseContFrame & self, obj<ACollector> gc) noexcept;
/** during GC: forward immdiate children **/
static size_type forward_children(DVsmIfElseContFrame & self, obj<ACollector> gc) noexcept;
///@}

View file

@ -55,7 +55,7 @@ namespace xo {
// non-const methods
/** move instance using allocator **/
static Opaque shallow_move(DVsmSeqContFrame & self, obj<AAllocator> mm) noexcept;
static Opaque shallow_move(DVsmSeqContFrame & self, obj<ACollector> gc) noexcept;
/** during GC: forward immdiate children **/
static size_type forward_children(DVsmSeqContFrame & self, obj<ACollector> gc) noexcept;
///@}

View file

@ -153,7 +153,7 @@ namespace xo {
/** shallow copy during gc cycle. Not implemented! Only intending to support
* VSM as virtual root
**/
DVirtualSchematikaMachine * shallow_move(obj<AAllocator> mm) const noexcept;
DVirtualSchematikaMachine * shallow_move(obj<ACollector> gc) noexcept;
/** forward gc-aware child pointers
**/

View file

@ -55,7 +55,7 @@ namespace xo {
// non-const methods
/** move instance using allocator **/
static Opaque shallow_move(DVirtualSchematikaMachine & self, obj<AAllocator> mm) noexcept;
static Opaque shallow_move(DVirtualSchematikaMachine & self, obj<ACollector> gc) noexcept;
/** during GC: forward immdiate children **/
static size_type forward_children(DVirtualSchematikaMachine & self, obj<ACollector> gc) noexcept;
///@}

View file

@ -70,13 +70,8 @@ namespace xo {
}
DClosure *
DClosure::shallow_move(obj<AAllocator> mm) const noexcept {
DClosure * copy = (DClosure *)mm.alloc_copy((std::byte *)this);
if (copy)
*copy = *this;
return copy;
DClosure::shallow_move(obj<ACollector> gc) noexcept {
return gc.std_copy_for(this);
}
std::size_t

View file

@ -97,13 +97,8 @@ namespace xo {
}
DLocalEnv *
DLocalEnv::shallow_move(obj<AAllocator> mm) const noexcept {
DLocalEnv * copy = (DLocalEnv *)mm.alloc_copy((std::byte *)this);
if (copy)
*copy = *this;
return copy;
DLocalEnv::shallow_move(obj<ACollector> gc) noexcept {
return gc.std_copy_for(this);
}
std::size_t

View file

@ -954,11 +954,14 @@ namespace xo {
}
DVirtualSchematikaMachine *
DVirtualSchematikaMachine::shallow_move(obj<AAllocator> mm) const noexcept
DVirtualSchematikaMachine::shallow_move(obj<ACollector> gc) noexcept
{
(void)mm;
(void)gc;
/** not copyable (because SchematikaReader isn't) **/
/** TODO: should be able to use gc.std_copy_for(this) now
* that shallow_move uses move construction.
* DVirtualSchematikaMachine is (or can be made) moveable.
**/
assert(false);

View file

@ -39,15 +39,9 @@ namespace xo {
}
DVsmApplyClosureFrame *
DVsmApplyClosureFrame::shallow_move(obj<AAllocator> mm) const noexcept
DVsmApplyClosureFrame::shallow_move(obj<ACollector> gc) noexcept
{
DVsmApplyClosureFrame * copy
= (DVsmApplyClosureFrame *)mm.alloc_copy((std::byte *)this);
if (copy)
*copy = *this;
return copy;
return gc.std_copy_for(this);
}
std::size_t

View file

@ -47,14 +47,9 @@ namespace xo {
}
DVsmApplyFrame *
DVsmApplyFrame::shallow_move(obj<AAllocator> mm) const noexcept
DVsmApplyFrame::shallow_move(obj<ACollector> gc) noexcept
{
DVsmApplyFrame * copy = (DVsmApplyFrame *)mm.alloc_copy((std::byte *)this);
if (copy)
*copy = *this;
return copy;
return gc.std_copy_for(this);
}
std::size_t

View file

@ -38,9 +38,9 @@ namespace xo {
}
DVsmDefContFrame *
DVsmDefContFrame::shallow_move(obj<AAllocator> mm) noexcept
DVsmDefContFrame::shallow_move(obj<ACollector> gc) noexcept
{
return mm.std_copy_for<DVsmDefContFrame>(this);
return gc.std_copy_for<DVsmDefContFrame>(this);
}
std::size_t

View file

@ -48,15 +48,9 @@ namespace xo {
}
DVsmEvalArgsFrame *
DVsmEvalArgsFrame::shallow_move(obj<AAllocator> mm) const noexcept
DVsmEvalArgsFrame::shallow_move(obj<ACollector> gc) noexcept
{
DVsmEvalArgsFrame * copy
= (DVsmEvalArgsFrame *)mm.alloc_copy((std::byte *)this);
if (copy)
*copy = *this;
return copy;
return gc.std_copy_for(this);
}
std::size_t

View file

@ -36,9 +36,9 @@ namespace xo {
}
DVsmIfElseContFrame *
DVsmIfElseContFrame::shallow_move(obj<AAllocator> mm) noexcept
DVsmIfElseContFrame::shallow_move(obj<ACollector> gc) noexcept
{
return mm.std_copy_for<DVsmIfElseContFrame>(this);
return gc.std_copy_for<DVsmIfElseContFrame>(this);
}
std::size_t

View file

@ -39,9 +39,9 @@ namespace xo {
}
DVsmSeqContFrame *
DVsmSeqContFrame::shallow_move(obj<AAllocator> mm) noexcept
DVsmSeqContFrame::shallow_move(obj<ACollector> gc) noexcept
{
return mm.std_copy_for<DVsmSeqContFrame>(this);
return gc.std_copy_for<DVsmSeqContFrame>(this);
}
std::size_t

View file

@ -22,9 +22,9 @@ namespace xo {
}
auto
IGCObject_DClosure::shallow_move(DClosure & self, obj<AAllocator> mm) noexcept -> Opaque
IGCObject_DClosure::shallow_move(DClosure & self, obj<ACollector> gc) noexcept -> Opaque
{
return self.shallow_move(mm);
return self.shallow_move(gc);
}
auto
IGCObject_DClosure::forward_children(DClosure & self, obj<ACollector> gc) noexcept -> size_type

View file

@ -22,9 +22,9 @@ namespace xo {
}
auto
IGCObject_DVsmApplyClosureFrame::shallow_move(DVsmApplyClosureFrame & self, obj<AAllocator> mm) noexcept -> Opaque
IGCObject_DVsmApplyClosureFrame::shallow_move(DVsmApplyClosureFrame & self, obj<ACollector> gc) noexcept -> Opaque
{
return self.shallow_move(mm);
return self.shallow_move(gc);
}
auto
IGCObject_DVsmApplyClosureFrame::forward_children(DVsmApplyClosureFrame & self, obj<ACollector> gc) noexcept -> size_type

View file

@ -22,9 +22,9 @@ namespace xo {
}
auto
IGCObject_DVsmApplyFrame::shallow_move(DVsmApplyFrame & self, obj<AAllocator> mm) noexcept -> Opaque
IGCObject_DVsmApplyFrame::shallow_move(DVsmApplyFrame & self, obj<ACollector> gc) noexcept -> Opaque
{
return self.shallow_move(mm);
return self.shallow_move(gc);
}
auto
IGCObject_DVsmApplyFrame::forward_children(DVsmApplyFrame & self, obj<ACollector> gc) noexcept -> size_type

View file

@ -22,9 +22,9 @@ namespace xo {
}
auto
IGCObject_DVsmDefContFrame::shallow_move(DVsmDefContFrame & self, obj<AAllocator> mm) noexcept -> Opaque
IGCObject_DVsmDefContFrame::shallow_move(DVsmDefContFrame & self, obj<ACollector> gc) noexcept -> Opaque
{
return self.shallow_move(mm);
return self.shallow_move(gc);
}
auto
IGCObject_DVsmDefContFrame::forward_children(DVsmDefContFrame & self, obj<ACollector> gc) noexcept -> size_type

View file

@ -22,9 +22,9 @@ namespace xo {
}
auto
IGCObject_DVsmEvalArgsFrame::shallow_move(DVsmEvalArgsFrame & self, obj<AAllocator> mm) noexcept -> Opaque
IGCObject_DVsmEvalArgsFrame::shallow_move(DVsmEvalArgsFrame & self, obj<ACollector> gc) noexcept -> Opaque
{
return self.shallow_move(mm);
return self.shallow_move(gc);
}
auto
IGCObject_DVsmEvalArgsFrame::forward_children(DVsmEvalArgsFrame & self, obj<ACollector> gc) noexcept -> size_type

View file

@ -22,9 +22,9 @@ namespace xo {
}
auto
IGCObject_DVsmIfElseContFrame::shallow_move(DVsmIfElseContFrame & self, obj<AAllocator> mm) noexcept -> Opaque
IGCObject_DVsmIfElseContFrame::shallow_move(DVsmIfElseContFrame & self, obj<ACollector> gc) noexcept -> Opaque
{
return self.shallow_move(mm);
return self.shallow_move(gc);
}
auto
IGCObject_DVsmIfElseContFrame::forward_children(DVsmIfElseContFrame & self, obj<ACollector> gc) noexcept -> size_type

View file

@ -22,9 +22,9 @@ namespace xo {
}
auto
IGCObject_DVsmSeqContFrame::shallow_move(DVsmSeqContFrame & self, obj<AAllocator> mm) noexcept -> Opaque
IGCObject_DVsmSeqContFrame::shallow_move(DVsmSeqContFrame & self, obj<ACollector> gc) noexcept -> Opaque
{
return self.shallow_move(mm);
return self.shallow_move(gc);
}
auto
IGCObject_DVsmSeqContFrame::forward_children(DVsmSeqContFrame & self, obj<ACollector> gc) noexcept -> size_type

View file

@ -22,9 +22,9 @@ namespace xo {
}
auto
IGCObject_DLocalEnv::shallow_move(DLocalEnv & self, obj<AAllocator> mm) noexcept -> Opaque
IGCObject_DLocalEnv::shallow_move(DLocalEnv & self, obj<ACollector> gc) noexcept -> Opaque
{
return self.shallow_move(mm);
return self.shallow_move(gc);
}
auto
IGCObject_DLocalEnv::forward_children(DLocalEnv & self, obj<ACollector> gc) noexcept -> size_type

View file

@ -22,9 +22,9 @@ namespace xo {
}
auto
IGCObject_DVirtualSchematikaMachine::shallow_move(DVirtualSchematikaMachine & self, obj<AAllocator> mm) noexcept -> Opaque
IGCObject_DVirtualSchematikaMachine::shallow_move(DVirtualSchematikaMachine & self, obj<ACollector> gc) noexcept -> Opaque
{
return self.shallow_move(mm);
return self.shallow_move(gc);
}
auto
IGCObject_DVirtualSchematikaMachine::forward_children(DVirtualSchematikaMachine & self, obj<ACollector> gc) noexcept -> size_type