jam 0.0.1
A compacting generational garbage collector for C++26
Loading...
Searching...
No Matches
jam.ccm File Reference
module jam

A compacting generational heap with four-byte pointers and tracing roots. More...

#include <hint.h>
#include <array>
#include <cstddef>
#include <span>
#include <type_traits>
#include <utility>
import jam.units;
import jam.heap;
Include dependency graph for jam.ccm:

Go to the source code of this file.

Functions

template<traceable K, traceable V, traceable F>
weak< V > jam::mk_weak (ptr< K > const &key, ptr< V > const &value, ptr< F > const &finalizer, std::type_identity_t< void(*)(F *) noexcept > runner) noexcept
 Register a weak key/value pair and managed finalizer in the current heap. The captureless runner receives a nullable F* and obeys normal borrow rules; no destructor is invoked.
template<traceable T, class... Args>
ptr< T > jam::mk (Args &&... args) noexcept
 Allocate a record in the current heap; register a root before collection.
template<class T, std::size_t N>
constexpr void jam::unsafe_assign (std::array< ptr< T >, N > &target, std::array< ptr< T >, N > const &source) noexcept
 Bulk-copy pointer bits without registration; the caller owns the barrier.
template<class T, std::size_t N>
constexpr void jam::assign (std::array< ptr< T >, N > &target, std::array< ptr< T >, N > const &source) noexcept
 Copy an array and register young lanes with one old-range check.
template<class T, std::size_t N>
constexpr void jam::unsafe_assign (std::array< weak_ptr< T >, N > &target, std::array< weak_ptr< T >, N > const &source) noexcept
 Bulk-copy weak pointer bits without registration; caller owns the barriers.
template<class T, std::size_t N>
constexpr void jam::assign (std::array< weak_ptr< T >, N > &target, std::array< weak_ptr< T >, N > const &source) noexcept
 Copy weak fields and update remembered entries with one old-range check.
void jam::collect () noexcept
 Collect the current heap; only registered roots remain meaningful outside it.
void jam::collect_major () noexcept
 Collect both generations of the current heap; reset its collection countdown.
void jam::collect_minor (bool promote=false) noexcept
 Collect the current heap's young generation; optionally promote survivors.

Detailed Description

A compacting generational heap with four-byte pointers and tracing roots.

Definition in file jam.ccm.