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_;

View file

@ -35,7 +35,7 @@ namespace xo {
virtual void display(std::ostream & os) const final override;
virtual std::size_t _shallow_size() const final override;
virtual Object * _shallow_copy(gc::IAlloc * mm) const final override;
virtual std::size_t _forward_children(gc::GC * /*gc*/) final override;
virtual std::size_t _forward_children(gc::IAlloc * /*gc*/) final override;
private:
GlobalEnv(const GlobalEnv & x);

View file

@ -103,7 +103,7 @@ namespace xo {
virtual void display(std::ostream & os) const final override;
virtual std::size_t _shallow_size() const final override;
virtual Object * _shallow_copy(gc::IAlloc * mm) const final override;
virtual std::size_t _forward_children(gc::GC * /*gc*/) final override;
virtual std::size_t _forward_children(gc::IAlloc * /*gc*/) final override;
private:
/** parent stack frame **/

View file

@ -90,7 +90,7 @@ namespace xo {
}
std::size_t
GlobalEnv::_forward_children(gc::GC * gc)
GlobalEnv::_forward_children(gc::IAlloc * gc)
{
for (auto & ix : *slot_map_) {
Object::_forward_inplace(ix.second, gc);

View file

@ -121,7 +121,7 @@ namespace xo {
}
std::size_t
LocalEnv::_forward_children(gc::GC * gc)
LocalEnv::_forward_children(gc::IAlloc * gc)
{
static_assert(decltype(symtab_)::is_gc_ptr == false);

View file

@ -25,7 +25,7 @@ namespace xo {
virtual void display(std::ostream & os) const final override;
virtual std::size_t _shallow_size() const final override;
virtual Object * _shallow_copy(gc::IAlloc * gc) const final override;
virtual std::size_t _forward_children(gc::GC * gc) final override;
virtual std::size_t _forward_children(gc::IAlloc * gc) final override;
private:
explicit Boolean(bool x) : value_{x} {}

View file

@ -30,7 +30,7 @@ namespace xo {
virtual void display(std::ostream & os) const final override;
virtual std::size_t _shallow_size() const final override;
virtual Object * _shallow_copy(gc::IAlloc * gc) const final override;
virtual std::size_t _forward_children(gc::GC * gc) final override;
virtual std::size_t _forward_children(gc::IAlloc * gc) final override;
private:
float_type value_ = 0.0;

View file

@ -30,7 +30,7 @@ namespace xo {
virtual void display(std::ostream & os) const final override;
virtual std::size_t _shallow_size() const final override;
virtual Object * _shallow_copy(gc::IAlloc * gc) const final override;
virtual std::size_t _forward_children(gc::GC * gc) final override;
virtual std::size_t _forward_children(gc::IAlloc * gc) final override;
private:
int_type value_ = 0;

View file

@ -59,7 +59,7 @@ namespace xo {
virtual void display(std::ostream & os) const final override;
virtual std::size_t _shallow_size() const final override;
virtual Object * _shallow_copy(gc::IAlloc * gc) const final override;
virtual std::size_t _forward_children(gc::GC * gc) final override;
virtual std::size_t _forward_children(gc::IAlloc * gc) final override;
private:
List(gp<Object> head, gp<List> rest);

View file

@ -37,7 +37,7 @@ namespace xo {
virtual void display(std::ostream & os) const final override;
virtual std::size_t _shallow_size() const final override;
virtual Object * _shallow_copy(gc::IAlloc * gc) const final override;
virtual std::size_t _forward_children(gc::GC * gc) final override;
virtual std::size_t _forward_children(gc::IAlloc * gc) final override;
private:
String(owner owner, std::size_t z, char * s);

View file

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

View file

@ -48,7 +48,7 @@ namespace xo {
}
std::size_t
Float::_forward_children(gc::GC * /*gc*/) {
Float::_forward_children(gc::IAlloc * /*gc*/) {
return Float::_shallow_size();
}
}

View file

@ -49,7 +49,7 @@ namespace xo {
}
std::size_t
Integer::_forward_children(gc::GC * /*gc*/) {
Integer::_forward_children(gc::IAlloc * /*gc*/) {
return Integer::_shallow_size();
}

View file

@ -110,7 +110,7 @@ namespace xo {
}
std::size_t
List::_forward_children(gc::GC * gc)
List::_forward_children(gc::IAlloc * gc)
{
Object::_forward_inplace(head_, gc);
Object::_forward_inplace(rest_, gc);

View file

@ -152,7 +152,7 @@ namespace xo {
}
std::size_t
String::_forward_children(gc::GC *)
String::_forward_children(gc::IAlloc *)
{
return this->_shallow_size();
}