|
REAL
Regular Expression Algorithmic Library — constexpr C++20 regex
|
Process-wide shared DFA transition caches keyed by regex_immutables*. More...
#include <onepass.hpp>
Public Attributes | |
| std::mutex | mu |
| Guards every DFA below: warm-up and scan alike. | |
| std::optional< lazy_dfa > | fwd |
| Forward lazy DFA, absent until a route first needs it. | |
| std::optional< reverse_dfa > | rev |
| Reverse lazy DFA, for finding a match start from its end. | |
| std::optional< reverse_dfa > | il_prefix_rev |
| std::atomic< bool > | il_warmed {false} |
| True after this regex has been IL-candidate-scanned at least once (any size). Cold first scan keeps the high regex_immutables::il_min_haystack floor; warm scans use il_warm_floor. Not "il_prefix_rev is built" — a always-<floor corpus would never build the reverse DFA and so would never drop the floor. | |
| std::atomic< const regex_immutables * > | owner {nullptr} |
| The regex this slot belongs to, or null once erase_shared_dfas has retired it. | |
Process-wide shared DFA transition caches keyed by regex_immutables*.
Thread-safe: map insert/erase under shared_dfa_map_mu, DFA warm/scan under mu. Slots are shared_ptr so a concurrent erase_shared_dfas (from a destructor) cannot free a slot a thread is still scanning — the slot dies when the last holder, map or thread-local cache, releases it.
| std::optional<reverse_dfa> real::detail::shared_dfa_slot::il_prefix_rev |
Reverse DFA over the inner-literal PREFIX sub-program only.
| std::atomic<const regex_immutables*> real::detail::shared_dfa_slot::owner {nullptr} |
The regex this slot belongs to, or null once erase_shared_dfas has retired it.
This is what validates a thread's last-hit cache in shared_dfa_for — a cached slot is still this regex's slot exactly while owner == immut. The predecessor was a single process-wide epoch counter bumped on every erase, which meant ANY regex's destruction invalidated EVERY thread's cache and sent them all back to shared_dfa_map_mu — the global mutex the cache exists to avoid, once per inner-literal candidate. Ownership is per slot, so one regex dying now costs only the threads that were actually using it.