diff --git a/idl/GCObject.json5 b/idl/GCObject.json5 index cbc2ab7..8f7e071 100644 --- a/idl/GCObject.json5 +++ b/idl/GCObject.json5 @@ -56,10 +56,10 @@ }, ], nonconst_methods: [ - // Opaque shallow_copy(obj>) noexcept + // Opaque shallow_move(obj>) noexcept { - name: "shallow_copy", - doc: ["copy instance using allocator"], + name: "shallow_move", + doc: ["move instance using allocator"], return_type: "Opaque", args:[ {type: "obj", name: "mm"}, diff --git a/include/xo/alloc2/gc/AGCObject.hpp b/include/xo/alloc2/gc/AGCObject.hpp index e9a4e51..ee0703d 100644 --- a/include/xo/alloc2/gc/AGCObject.hpp +++ b/include/xo/alloc2/gc/AGCObject.hpp @@ -66,8 +66,8 @@ public: virtual size_type shallow_size(Copaque data) const noexcept = 0; // nonconst methods - /** copy instance using allocator **/ - virtual Opaque shallow_copy(Opaque data, obj mm) const noexcept = 0; + /** move instance using allocator **/ + virtual Opaque shallow_move(Opaque data, obj mm) const noexcept = 0; /** during GC: forward immdiate children **/ virtual size_type forward_children(Opaque data, obj gc) const noexcept = 0; ///@} diff --git a/include/xo/alloc2/gc/IGCObject_Any.hpp b/include/xo/alloc2/gc/IGCObject_Any.hpp index 2658c59..000c85f 100644 --- a/include/xo/alloc2/gc/IGCObject_Any.hpp +++ b/include/xo/alloc2/gc/IGCObject_Any.hpp @@ -64,7 +64,7 @@ namespace mm { [[noreturn]] size_type shallow_size(Copaque) const noexcept override { _fatal(); } // nonconst methods - [[noreturn]] Opaque shallow_copy(Opaque, obj) const noexcept override; + [[noreturn]] Opaque shallow_move(Opaque, obj) const noexcept override; [[noreturn]] size_type forward_children(Opaque, obj) const noexcept override; ///@} diff --git a/include/xo/alloc2/gc/IGCObject_Xfer.hpp b/include/xo/alloc2/gc/IGCObject_Xfer.hpp index e00595e..35e23a6 100644 --- a/include/xo/alloc2/gc/IGCObject_Xfer.hpp +++ b/include/xo/alloc2/gc/IGCObject_Xfer.hpp @@ -54,8 +54,8 @@ namespace mm { } // non-const methods - Opaque shallow_copy(Opaque data, obj mm) const noexcept override { - return I::shallow_copy(_dcast(data), mm); + Opaque shallow_move(Opaque data, obj mm) const noexcept override { + return I::shallow_move(_dcast(data), mm); } size_type forward_children(Opaque data, obj gc) const noexcept override { return I::forward_children(_dcast(data), gc); diff --git a/include/xo/alloc2/gc/RCollector.hpp b/include/xo/alloc2/gc/RCollector.hpp index 4bf2ad1..6192c08 100644 --- a/include/xo/alloc2/gc/RCollector.hpp +++ b/include/xo/alloc2/gc/RCollector.hpp @@ -58,9 +58,9 @@ public: void * std_copy_for(const T * src) noexcept { void * mem = this->alloc_copy_for(src); if (mem) { - new (mem) T(std::move(*src)); + return new (mem) T(std::move(*src)); } - return (T *)mem; + return nullptr; } /** forward faceted object pointer in place. Defined in GCObject.hpp to avoid #include cycle **/ diff --git a/include/xo/alloc2/gc/RGCObject.hpp b/include/xo/alloc2/gc/RGCObject.hpp index c4a668e..1839f83 100644 --- a/include/xo/alloc2/gc/RGCObject.hpp +++ b/include/xo/alloc2/gc/RGCObject.hpp @@ -60,8 +60,8 @@ public: } // non-const methods (still const in router!) - Opaque shallow_copy(obj mm) noexcept { - return O::iface()->shallow_copy(O::data(), mm); + Opaque shallow_move(obj mm) noexcept { + return O::iface()->shallow_move(O::data(), mm); } size_type forward_children(obj gc) noexcept { return O::iface()->forward_children(O::data(), gc); diff --git a/src/alloc2/IGCObject_Any.cpp b/src/alloc2/IGCObject_Any.cpp index 426f68a..c9b9329 100644 --- a/src/alloc2/IGCObject_Any.cpp +++ b/src/alloc2/IGCObject_Any.cpp @@ -36,7 +36,7 @@ IGCObject_Any::_valid // nonconst methods auto -IGCObject_Any::shallow_copy(Opaque, obj) const noexcept -> Opaque +IGCObject_Any::shallow_move(Opaque, obj) const noexcept -> Opaque { _fatal(); }