REAL
Regular Expression Algorithmic Library — constexpr C++20 regex
Loading...
Searching...
No Matches
real::detail::basic_thread_list< PcVec, SlotVec, MarkVec > Struct Template Reference

One priority-ordered list of NFA threads (leftmost-greedy semantics). More...

#include <pike.hpp>

Public Member Functions

constexpr void reset (std::size_t code_size)
 Clears the list in O(1) by bumping the generation.
 
constexpr bool seen (std::int32_t pc) const
 Returns true if pc is already in this generation.
 
constexpr void mark_seen (std::int32_t pc)
 Marks pc as present in the current generation.
 

Public Attributes

PcVec pcs
 Live program counters, in priority order.
 
SlotVec slots
 Flattened capture slots, parallel to pcs.
 
MarkVec mark
 Per-pc generation stamp (see seen).
 
std::uint64_t generation {}
 Current generation; bumped by reset.
 

Detailed Description

template<typename PcVec, typename SlotVec, typename MarkVec>
struct real::detail::basic_thread_list< PcVec, SlotVec, MarkVec >

One priority-ordered list of NFA threads (leftmost-greedy semantics).

mark is generation-stamped so clearing the list between positions is O(1).

Template Parameters
PcVecContainer of program counters.
SlotVecFlattened capture slots (pcs.size() * slot_count).
MarkVecPer-pc generation marks for O(1) dedup.

Member Function Documentation

◆ mark_seen()

template<typename PcVec , typename SlotVec , typename MarkVec >
constexpr void real::detail::basic_thread_list< PcVec, SlotVec, MarkVec >::mark_seen ( std::int32_t  pc)
inlineconstexpr

Marks pc as present in the current generation.

Parameters
[in]pcThe program counter.

◆ reset()

template<typename PcVec , typename SlotVec , typename MarkVec >
constexpr void real::detail::basic_thread_list< PcVec, SlotVec, MarkVec >::reset ( std::size_t  code_size)
inlineconstexpr

Clears the list in O(1) by bumping the generation.

noinline, and it buys codegen rather than cycles: this runs twice per search, so outlining it is free, while mark.assign inlined here is a per-element construct_at loop whose mere presence charges the class-scan routes on gcc/x86 – routes that never build a thread list at all. Measured alone the outlining is a REGRESSION; it pays only together with the SBO mark table, whose codegen it is repairing. The two belong together or not at all.

Parameters
[in]code_sizeNumber of instructions (sizes the mark table once).

◆ seen()

template<typename PcVec , typename SlotVec , typename MarkVec >
constexpr bool real::detail::basic_thread_list< PcVec, SlotVec, MarkVec >::seen ( std::int32_t  pc) const
inlineconstexpr

Returns true if pc is already in this generation.

Parameters
[in]pcA program counter.
Returns
true if pc is already in this generation.

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