Copy-on-write pool of capture blocks, the one capture-slot mechanism for both storages.
More...
|
| constexpr void | reset (std::uint16_t slot_count) |
| | Reset for a new match run: block 0 = all-npos, never freed. Under static storage the static_vec capacity bounds the live-block count.
|
| |
| constexpr std::size_t * | slots (std::uint32_t b) |
| | Pointer to block b's width slots. Invalidated by any allocate that grows data.
|
| |
| constexpr std::uint32_t | allocate () |
| | A fresh block with refcount 1 (a recycled index if available, else a grown one).
|
| |
| constexpr void | incref (std::uint32_t b) |
| | Take a reference on block b (each closure seeded into the next list holds its own).
|
| |
| constexpr void | decref (std::uint32_t b) |
| | Drop a reference on block b, recycling it into the free list at zero.
|
| |
| constexpr std::uint32_t | cow_write (std::uint32_t b, std::uint16_t slot, std::size_t value) |
| | Write slots(b)[slot] = value, detaching first if b is shared. The one place a block mutates.
|
| |
| constexpr long long | total_refs () const |
| | Sum of live refcounts, which the debug Σ-invariant compares with the references the VM holds (list blocks + stack frames).
|
| |
template<typename DataVec, typename RefVec, typename FreeVec>
struct real::detail::basic_capture_pool< DataVec, RefVec, FreeVec >
Copy-on-write pool of capture blocks, the one capture-slot mechanism for both storages.
A thread references a block by index; a split shares it (refcount++) and a save, the one write, detaches it first if shared (cow_write). Snapshotting slot values per thread instead cost a fifth to a third of match time on capture-heavy loads.
Block 0 is the canonical all-npos block, held by a permanent sentinel ref, so seeding costs one incref. Indices and a free list only, no RAII handles: the SBO / static thread lists run no destructors.