REAL
Regular Expression Algorithmic Library — constexpr C++20 regex
Loading...
Searching...
No Matches
real::detail::static_pike_scratch< CodeSize, SlotCount, WantsIL > Struct Template Reference

Compile-time-storage VM scratch, all fixed-capacity (zero heap), keyed on DIMENSIONS ONLY. More...

#include <storage.hpp>

Inheritance diagram for real::detail::static_pike_scratch< CodeSize, SlotCount, WantsIL >:
[legend]
Collaboration diagram for real::detail::static_pike_scratch< CodeSize, SlotCount, WantsIL >:
[legend]

Public Attributes

basic_capture_pool< static_vec< std::size_t, max_blocks *SlotCount >, static_vec< std::int32_t, max_blocks >, static_vec< std::uint32_t, max_blocks > > pool
 COW capture blocks (zero heap).
 
- Public Attributes inherited from real::detail::basic_pike_state< basic_thread_list< static_vec< std::int32_t, CodeSize >, static_vec< std::size_t, CodeSize >, static_vec< std::uint64_t, CodeSize > >, static_vec< eps_entry,(3 *CodeSize)+4 > >
basic_thread_list< static_vec< std::int32_t, CodeSize >, static_vec< std::size_t, CodeSize >, static_vec< std::uint64_t, CodeSize > > list_a
 One of the two thread lists; the run rotates pointers, not indices.
 
basic_thread_list< static_vec< std::int32_t, CodeSize >, static_vec< std::size_t, CodeSize >, static_vec< std::uint64_t, CodeSize > > list_b
 The other one — see list_a.
 
static_vec< eps_entry,(3 *CodeSize)+4 > stack
 Epsilon-closure DFS stack.
 
std::int32_t table_class
 Flat 256-byte membership table for the hot single-class scan, and the class index it was built for (-1 = none).
 
std::array< std::uint8_t, 256 > table
 1 where the byte is in table_class (filled on a class_table miss).
 
std::int32_t cp_page_class
 Membership bitmap for a cp_class over the 2-byte UTF-8 range [U+0080, U+07FF], and the class it was built for. European text lives almost entirely in this range (Latin, IPA, Greek, Cyrillic, Hebrew, Arabic…), so a 240-byte bitmap answers it in one load. Built once per class and reused across a find_all-style walk.
 
std::array< std::uint64_t, 30 > cp_page
 1 where the code point (U+0080..U+07FF) is a member (filled on a cp_page_table miss).
 
const void * rows_verified_for
 Program whose membership rows this state has already verified as filled. Lets a walk skip the two acquire loads class_table would otherwise do once per run() — see there.
 
const std::uint8_t * row_ptr
 The verified byte row, cached so the hot path returns it without re-deriving the address.
 
const std::uint64_t * page_ptr
 As row_ptr, for the two-byte page bitmap.
 
std::int32_t hi_class
 Class hi_ptr / hi_never were resolved for; -1 while unresolved.
 
const cp_hi_tablehi_ptr
 The resolved sparse hi table for hi_class, or null when it has none usable.
 
bool hi_never
 Set when hi_class has no high ranges at all, so every cp past the page bitmap misses.
 

Static Public Attributes

static constexpr std::size_t max_blocks {(5 * CodeSize) + 8}
 Worst-case live capture blocks: every reference (a DFS stack frame or a thread in either list) could point at a distinct block, and the stack is (3*CodeSize)+4 with each list holding up to CodeSize threads. Freed blocks recycle through the pool's free list, so the pool never grows past this. Derived from CodeSize HERE rather than passed in, so it cannot disagree with the tier: a bound computed from the exact program length would vary between two patterns sharing a tier and split them back into separate types.
 

Additional Inherited Members

- Public Member Functions inherited from real::detail::basic_pike_state< basic_thread_list< static_vec< std::int32_t, CodeSize >, static_vec< std::size_t, CodeSize >, static_vec< std::uint64_t, CodeSize > >, static_vec< eps_entry,(3 *CodeSize)+4 > >
constexpr basic_pike_state () noexcept
 Value-initializes table and cp_page during constant evaluation only.
 

Detailed Description

template<std::size_t CodeSize, std::size_t SlotCount, bool WantsIL>
struct real::detail::static_pike_scratch< CodeSize, SlotCount, WantsIL >

Compile-time-storage VM scratch, all fixed-capacity (zero heap), keyed on DIMENSIONS ONLY.

The epsilon DFS stack is bounded because each pc is processed once and pushes at most two explore entries plus one restore entry. Capture slots live in a copy-on-write basic_capture_pool (a thread carries one block index, not a slot run), sized for the worst-case block count — the same zero-heap, compile-sized discipline.

Note
Deliberately parameterised on sizes rather than on the pattern, so two patterns of the same shape can share one instantiation. Anything that depends on the pattern's value belongs in the thin per-pattern type deriving from this, not here — see 10.1 The inlining budget for what the distinction costs when it is not maintained.
Template Parameters
CodeSizeScratch capacity in instructions — a TIER (see scratch_code_tier), not the exact program length, so neighbouring shapes share one instantiation.
SlotCountCapture slots.
WantsILWhether the inner-literal route is compiled in.

The documentation for this struct was generated from the following file: