xo-gc: copy/move step for collection phase

This commit is contained in:
Roland Conybeare 2026-01-04 00:34:19 -05:00
commit ed0ca0a16b
3 changed files with 19 additions and 3 deletions

View file

@ -6,6 +6,7 @@
#pragma once
#include "AllocHeader.hpp"
#include "padding.hpp"
#include <utility>
namespace xo {
@ -121,6 +122,11 @@ namespace xo {
return (hdr.repr_ & size_mask());
}
/** extract padded size from alloc header @p hdr **/
std::size_t size_with_padding(repr_type hdr) const noexcept {
return padding::with_padding(this->size(hdr));
}
/** true iff sentinel tseq, flagging a forwarding pointer **/
bool is_forwarding_tseq(repr_type hdr) const noexcept {
// e.g.
@ -134,6 +140,11 @@ namespace xo {
bool is_size_enabled() const noexcept { return size_bits_ > 0; }
/** construct alloc header for a forwarding object **/
AllocHeader mark_forwarding_tseq(AllocHeader hdr) const noexcept {
return AllocHeader((hdr.repr_ & ~tseq_mask()) | tseq_mask());
}
/** if non-zero, allocate extra space between allocs, and fill
* with fixed test-pattern contents. Allows for simple
* runtime arena sanitizing checks.