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

@ -5,12 +5,17 @@
#include "String.hpp"
#include "GC.hpp"
#include "TaggedPtr.hpp"
#include "xo/reflect/Reflect.hpp"
#include <bsd/string.h>
#include <cstddef>
#include <cstring>
#include <cassert>
namespace xo {
using xo::reflect::Reflect;
using xo::reflect::TaggedPtr;
namespace obj {
String::String(owner owner, std::size_t z, char * s)
: owner_{owner}, z_chars_{z}, chars_{s}
@ -86,6 +91,11 @@ namespace xo {
return ::strlen(chars_);
}
TaggedPtr
String::self_tp() const {
return Reflect::make_tp(const_cast<String*>(this));
}
// ----- GC support -----
std::size_t