xo-alloc xo-object: + Object.self_tp

This commit is contained in:
Roland Conybeare 2025-08-06 14:11:28 -05:00
commit 150bfa4aa2
11 changed files with 76 additions and 14 deletions

View file

@ -12,6 +12,7 @@ namespace xo {
explicit Forwarding1(gp<Object> dest);
// inherited from Object..
virtual TaggedPtr self_tp() const final override;
virtual bool _is_forwarded() const final override { return true; }
virtual Object * _offset_destination(Object * src) const final override;
virtual Object * _destination() final override;

View file

@ -5,7 +5,7 @@
#pragma once
#include "xo/reflect/SelfTagging.hpp"
#include "xo/reflect/TaggedPtr.hpp"
#include "IAlloc.hpp"
#include <concepts>
#include <cstdint>
@ -79,6 +79,9 @@ namespace xo {
* but cost would be an extra layer of indirection
**/
class Object {
public:
using TaggedPtr = xo::reflect::TaggedPtr;
public:
virtual ~Object() = default;
@ -148,6 +151,12 @@ namespace xo {
**/
static Object * _shallow_move(Object * src, gc::GC * gc);
// Reflection support
/** tagged pointer with runtime type information
**/
virtual TaggedPtr self_tp() const = 0;
// GC support
/** true iff this object represents a forwarding pointer.