xo-alloc: IAlloc* i/face sufficient for Object._forward_children

This commit is contained in:
Roland Conybeare 2025-11-24 12:58:54 -05:00
commit c5c9441c1e
19 changed files with 22 additions and 22 deletions

View file

@ -32,7 +32,7 @@ namespace xo {
/** required by Object i/face, but never called on Forwarding1 **/
virtual Object * _shallow_copy(gc::IAlloc * mm) const final override;
/** required by Object i/face, but never called on Forwarding1 **/
virtual std::size_t _forward_children(gc::GC * mm) final override;
virtual std::size_t _forward_children(gc::IAlloc * mm) final override;
private:
/** the object that used to be located at this address (i.e. @c this)

View file

@ -119,17 +119,17 @@ namespace xo {
* @p src. source object to be forwarded
* @p gc. garbage collector
*/
static Object * _forward(Object * src, gc::GC * gc);
static Object * _forward(Object * src, gc::IAlloc * gc);
template <typename T>
static void _forward_inplace(T ** src_addr, gc::GC * gc) {
static void _forward_inplace(T ** src_addr, gc::IAlloc * gc) {
Object * fwd = _forward(*src_addr, gc);
*src_addr = reinterpret_cast<T *>(fwd);
}
template <typename T>
static void _forward_inplace(gp<T> & src, gc::GC * gc) {
static void _forward_inplace(gp<T> & src, gc::IAlloc * gc) {
_forward_inplace<T>(src.ptr_address(), gc);
}
@ -243,7 +243,7 @@ namespace xo {
* allocated by @ref _shallow_move
*
**/
virtual std::size_t _forward_children(gc::GC * gc) = 0;
virtual std::size_t _forward_children(gc::IAlloc * gc) = 0;
};
template <typename T>

View file

@ -60,7 +60,7 @@ namespace xo {
// LCOV_EXCL_START
std::size_t
Forwarding1::_forward_children(gc::GC *) {
Forwarding1::_forward_children(gc::IAlloc *) {
assert(false);
return 0;
}

View file

@ -24,7 +24,7 @@ namespace xo {
Object::mm = nullptr;
Object *
Object::_forward(Object * src, gc::GC * gc)
Object::_forward(Object * src, gc::IAlloc * gc)
{
if (!src)
return src;

View file

@ -34,7 +34,7 @@ namespace xo {
virtual std::size_t _shallow_size() const final override { return sizeof(*this); }
virtual Object * _shallow_copy(gc::IAlloc * mm) const final override { return new (Cpof(mm, this)) DummyObject(*this); }
virtual std::size_t _forward_children(gc::GC * gc) final override { return _shallow_size(); }
virtual std::size_t _forward_children(gc::IAlloc * gc) final override { return _shallow_size(); }
private:
std::array<char, 128> data_;