|
|
constexpr | ptr () noexcept=default |
| | Construct a null reference.
|
|
constexpr | ptr (std::same_as< std::nullptr_t > auto) noexcept |
| | Implicitly construct a null pointer.
|
|
constexpr | ptr (offset at) noexcept |
| | Name a record start in the matching heap; the caller supplies its type.
|
|
constexpr | ptr (ptr const &other) noexcept |
| | Copy a pointer and register a young target when the destination is old.
|
template<class U>
requires (!std::same_as<T, U>) && std::derived_from<U, T> && detail::allocation_trace<T> && requires(T * p) { static_cast<U *>(p); } |
| constexpr | ptr (ptr< U > const &other) noexcept |
| | Convert to a nonvirtual base with an allocation-tracing hook.
|
|
constexpr | ptr (ptr &&other) noexcept |
| | Transfer the pointer and its source-slot registration, leaving other null.
|
|
constexpr ptr & | operator= (ptr &&other) noexcept |
| | Transfer the pointer, leaving other null; self-move leaves it unchanged.
|
|
constexpr void | swap (ptr &other) noexcept |
| | Exchange targets and update the remembered entries for both slots.
|
|
constexpr | ~ptr () noexcept |
| | Remove a dying old pointer slot from the remembered set.
|
|
constexpr ptr & | unsafe_assign (ptr const &other) noexcept |
| | Assign without a write barrier; the caller must register old-to-young edges.
|
|
constexpr ptr & | unsafe_assign (offset bits) noexcept |
| | Install encoded bits without registration; the caller owns the barrier.
|
|
constexpr bool | is_young () const noexcept |
| | Whether the target belongs to generation one.
|
|
constexpr offset | local_offset () const noexcept |
| | Cell index within the target generation.
|
|
constexpr offset | get () const noexcept |
| | Read the cell offset; unregistered copies expire on collection.
|
|
constexpr | operator bool () const noexcept |
| | Whether the reference is nonnull.
|
| T * | operator-> () const noexcept |
| | Borrow the target in the current heap; expires on growth or collection.
|
|
T & | operator* () const noexcept |
| | Borrow the target in the current heap.
|
|
void | prefetch_marks () const noexcept |
| | Prefetch the target's mark metadata without claiming or reading it. Null does nothing, even without a current heap. Nonnull pointers must belong to the current heap. This cache hint provides no synchronization.
|
|
void | prefetch () const noexcept |
| | Prefetch the cache line containing the target's first byte for reading. Null does nothing, even without a current heap. Nonnull pointers must belong to the current heap. No target is claimed or dereferenced.
|
|
constexpr auto | operator<=> (ptr const &) const noexcept=default |
| | Order offsets within one heap; forwarding preserves surviving order. Compare fresh pointers after collection; unregistered copies still expire.
|
template<class T>
class jam::ptr< T >
A typed heap offset, with no root registration or ownership.
- Template Parameters
-
| T | Target record type; it may be incomplete here. No runtime type tag is stored. Null is zero. Copies preserve the offset; only declared heap fields and registered roots are forwarded. Using a pointer under a different heap is undefined behavior; pointers carry no owner ID. Outside the managed heap, do not retain a ptr for use across heap.collect(). Stack variables, external containers and loaded snapshots are not rewritten, even if a root keeps the target alive. Obtain a fresh pointer from that root after collection; only registered roots preserve external object identity. |
Definition at line 570 of file heap.ccm.
template<class T>
requires (!std::same_as<T, U>) && std::derived_from<U, T> && detail::allocation_trace<T> && requires(T * p) { static_cast<U *>(p); }
template<class U>
requires (!std::same_as<T, U>) && std::derived_from<U, T> && detail::allocation_trace<T> && requires(T * p) { static_cast<U *>(p); }
| jam::ptr< T >::ptr |
( |
ptr< U > const & | other | ) |
|
|
inlineconstexprnoexcept |
Convert to a nonvirtual base with an allocation-tracing hook.
- Precondition
- The base subobject shares the complete allocation's address.
Definition at line 2551 of file heap.ccm.