}
int main(){
- int matches[] = {0, MAX_MATCHES};
+ const int matches[] = {0, MAX_MATCHES};
std::vector<size_t> sizes;
for (size_t i = 0; i < N; i++) sizes.push_back(16000 << i*2);
const char charset[] = "aAaAaAaAAAaaaaAAAAaaaaAAAAAAaaaAAaaa";
// Close all open Hyperscan streams (potentially generating any
// end-anchored matches)
void closeStreams() {
- for (auto &stream : streams) {
+ for (const auto &stream : streams) {
hs_error_t err =
hs_close_stream(stream, scratch, onMatch, &matchCount);
if (err != HS_SUCCESS) {
}
static
-double eval_set(Benchmark &bench, Sigdata &sigs, unsigned int mode,
+double eval_set(Benchmark &bench, const Sigdata &sigs, unsigned int mode,
unsigned repeatCount, Criterion criterion,
bool diagnose = true) {
double compileTime = 0;
// Close all open Hyperscan streams (potentially generating any
// end-anchored matches)
void closeStreams() {
- for (auto &stream : streams) {
+ for (const auto &stream : streams) {
hs_error_t err = hs_close_stream(stream, scratch, onMatch,
&matchCount);
if (err != HS_SUCCESS) {
map<u32, vector<LiteralIndex> > res2lits;
hwlm_group_t gm = 0;
for (LiteralIndex i = 0; i < lits.size(); i++) {
- LitInfo & li = tmpLitInfo[i];
+ const LitInfo & li = tmpLitInfo[i];
u32 hash = CONF_HASH_CALL(li.v, andmsk, mult, nBits);
DEBUG_PRINTF("%016llx --> %u\n", li.v, hash);
res2lits[hash].emplace_back(i);
static
bool assignStringsToBuckets(
const vector<hwlmLiteral> &lits,
- TeddyEngineDescription &eng,
+ const TeddyEngineDescription &eng,
map<BucketIndex, vector<LiteralIndex>> &bucketToLits) {
assert(eng.numMasks <= MAX_NUM_MASKS);
if (lits.size() > eng.getNumBuckets() * TEDDY_BUCKET_LOAD) {
verts[gbs.gg[v].state_id] = v;
}
- for (auto &m : gbs.built_accel) {
+ for (const auto &m : gbs.built_accel) {
gough_accel *ga = m.first;
assert(!ga->prog_offset);
GoughVertex v = verts[m.second];
}
static
-void update_local_slots(GoughGraph &g, set<GoughSSAVar *> &locals,
+void update_local_slots(GoughGraph &g, const set<GoughSSAVar *> &locals,
u32 local_base) {
DEBUG_PRINTF("%zu local variables\n", locals.size());
/* local variables only occur on edges (joins are never local) */
raw_report_list(const flat_set<ReportID> &reports_in,
const ReportManager &rm, bool do_remap) {
if (do_remap) {
- for (auto &id : reports_in) {
+ for (const auto &id : reports_in) {
reports.insert(rm.getProgramOffset(id));
}
} else {
static
void fillInAux(mstate_aux *aux, dstate_id_t i, const dfa_info &info,
const vector<u32> &reports, const vector<u32> &reports_eod,
- vector<u32> &reportOffsets) {
+ const vector<u32> &reportOffsets) {
const dstate &raw_state = info.states[i];
aux->accept = raw_state.reports.empty() ? 0 : reportOffsets[reports[i]];
aux->accept_eod = raw_state.reports_eod.empty() ? 0
}
for (size_t i : order) {
- vector<dstate_id_t> &state_chain = info.wide_state_chain[i];
- vector<symbol_t> &symbol_chain = info.wide_symbol_chain[i];
+ const vector<dstate_id_t> &state_chain = info.wide_state_chain[i];
+ const vector<symbol_t> &symbol_chain = info.wide_symbol_chain[i];
u16 width = verify_u16(symbol_chain.size());
*(u16 *)(curr_wide_entry + WIDE_WIDTH_OFFSET) = width;
/* \brief Generate wide_symbol_chain from wide_state_chain. */
static
void generate_symbol_chain(dfa_info &info, vector<symbol_t> &chain_tail) {
- raw_dfa &rdfa = info.raw;
+ const raw_dfa &rdfa = info.raw;
assert(chain_tail.size() == info.wide_state_chain.size());
for (size_t i = 0; i < info.wide_state_chain.size(); i++) {
- vector<dstate_id_t> &state_chain = info.wide_state_chain[i];
+ const vector<dstate_id_t> &state_chain = info.wide_state_chain[i];
vector<symbol_t> symbol_chain;
info.extra[state_chain[0]].wideHead = true;
}
static
-void fill_in_sherman(NFA *nfa, dfa_info &info, UNUSED u16 sherman_limit) {
+void fill_in_sherman(NFA *nfa, const dfa_info &info, UNUSED u16 sherman_limit) {
char *nfa_base = (char *)nfa;
mcsheng *m = (mcsheng *)getMutableImplNfa(nfa);
char *sherman_table = nfa_base + m->sherman_offset;
}
static
-void fill_in_sherman64(NFA *nfa, dfa_info &info, UNUSED u16 sherman_limit) {
+void fill_in_sherman64(NFA *nfa, const dfa_info &info, UNUSED u16 sherman_limit) {
char *nfa_base = (char *)nfa;
mcsheng64 *m = (mcsheng64 *)getMutableImplNfa(nfa);
char *sherman_table = nfa_base + m->sherman_offset;
return next(idx, TOP);
}
dstate &next(dstate_id_t idx, u16 chr) {
- auto &src = (*this)[idx];
+ const auto &src = (*this)[idx];
auto next_id = src.next[raw.alpha_remap[chr]];
return states[next_id];
}
// if DFA can't die, shift all indices left by 1
return can_die ? idx : idx + 1;
}
- bool isDead(dstate &state) {
+ bool isDead(const dstate &state) {
return raw_id(state.impl_id) == DEAD_STATE;
}
bool isDead(dstate_id_t idx) {
}
private:
- static bool dfaCanDie(raw_dfa &rdfa) {
+ static bool dfaCanDie(const raw_dfa &rdfa) {
for (unsigned chr = 0; chr < 256; chr++) {
for (dstate_id_t state = 0; state < rdfa.states.size(); state++) {
auto succ = rdfa.states[state].next[rdfa.alpha_remap[chr]];
raw_report_list(const flat_set<ReportID> &reports_in,
const ReportManager &rm, bool do_remap) {
if (do_remap) {
- for (auto &id : reports_in) {
+ for (const auto &id : reports_in) {
reports.insert(rm.getProgramOffset(id));
}
} else {
}
template <uint16_t S>
-const u8 *truffleExecReal(m128 &shuf_mask_lo_highclear, m128 shuf_mask_lo_highset, const u8 *buf, const u8 *buf_end) {
+const u8 *truffleExecReal(const m128 &shuf_mask_lo_highclear, m128 shuf_mask_lo_highset, const u8 *buf, const u8 *buf_end) {
assert(buf && buf_end);
assert(buf < buf_end);
DEBUG_PRINTF("truffle %p len %zu\n", buf, buf_end - buf);
return buf - 1;
}
-#endif //HAVE_SVE
\ No newline at end of file
+#endif //HAVE_SVE
// Returns true if all components have been added.
static
-bool processComponents(NG &ng, ExpressionInfo &expr,
+bool processComponents(NG &ng, const ExpressionInfo &expr,
deque<unique_ptr<NGHolder>> &g_comp,
const som_type som) {
const u32 num_components = g_comp.size();
static
void reformUnanchoredRepeatsComponent(NGHolder &g,
- set<NFAVertex> &compAnchoredStarts,
+ const set<NFAVertex> &compAnchoredStarts,
set<NFAVertex> &compUnanchoredStarts,
set<NFAVertex> &dead,
depth *startBegin, depth *startEnd) {
}
static
-void addDotsBetween(NGHolder &g, NFAVertex lhs, vector<NFAVertex> &rhs,
+void addDotsBetween(NGHolder &g, NFAVertex lhs, const vector<NFAVertex> &rhs,
depth min_repeat, depth max_repeat) {
const bool unbounded = max_repeat.is_infinite();
if (unbounded) {
return id;
}
- void append(WorkQueue &other) {
+ void append(const WorkQueue &other) {
for (const auto &e : other) {
push(e);
}
}
static
-bool outIsIrreducible(NFAVertex &v, const NGHolder &g) {
+bool outIsIrreducible(const NFAVertex &v, const NGHolder &g) {
unsigned nonSpecialVertices = 0;
for (auto w : adjacent_vertices_range(v, g)) {
if (!is_special(w, g) && w != v) {
}
static
-bool inIsIrreducible(NFAVertex &v, const NGHolder &g) {
+bool inIsIrreducible(const NFAVertex &v, const NGHolder &g) {
unsigned nonSpecialVertices = 0;
for (auto u : inv_adjacent_vertices_range(v, g)) {
if (!is_special(u, g) && u != v) {
}
static
-bool hasOffsetAdjust(const ReportManager &rm, NGHolder &g,
+bool hasOffsetAdjust(const ReportManager &rm, const NGHolder &g,
int *adjust) {
const auto &reports = all_reports(g);
if (reports.empty()) {
// set up all reports
bool clone = false;
- for (auto &pair : reports_to_vertices) {
+ for (const auto &pair : reports_to_vertices) {
const auto &reports = pair.first;
const auto &vertices = pair.second;
}
static
-bool splitOffLiteral(NG &ng, NGHolder &g, NFAVertex v, const bool anchored,
+bool splitOffLiteral(NG &ng, const NGHolder &g, NFAVertex v, const bool anchored,
set<NFAVertex> &dead) {
DEBUG_PRINTF("examine vertex %zu\n", g[v].index);
bool nocase = false, casefixed = false;
/** Gives a stronger puff trigger when the trigger is connected to a wide
* cyclic state (aside from sds) */
static
-void improveHead(NGHolder &g, NFAVertex *a, vector<NFAVertex> *nodes) {
+void improveHead(const NGHolder &g, NFAVertex *a, vector<NFAVertex> *nodes) {
DEBUG_PRINTF("attempting to improve puff trigger\n");
assert(!nodes->empty());
const CharReach &puff_cr = g[nodes->back()].char_reach;
}
static
-void constructPuff(NGHolder &g, const NFAVertex a, const NFAVertex puffv,
+void constructPuff(const NGHolder &g, const NFAVertex a, const NFAVertex puffv,
const CharReach &cr, const ReportID report, u32 width,
bool fixed_depth, bool unbounded, bool auto_restart,
RoseBuild &rose, ReportManager &rm,
bool changed = false;
for (auto v : vertices_range(g)) {
- VertexInfo &info = infoMap[v];
+ const VertexInfo &info = infoMap[v];
if (info.isRemoved) {
continue;
continue; // Conservatively skip anything with nonzero tops.
}
- CharReach &otherReach = g[t].char_reach;
+ const CharReach &otherReach = g[t].char_reach;
if (currReach.isSubsetOf(otherReach)) {
DEBUG_PRINTF("removing redundant vertex %zu (keeping %zu)\n",
g[v].index, g[t].index);
}
static
-void findCyclicDom(NGHolder &g, vector<bool> &cyclic,
+void findCyclicDom(const NGHolder &g, vector<bool> &cyclic,
set<NFAEdge> &dead, som_type som) {
auto dominators = findDominators(g);
}
static
-void findCyclicPostDom(NGHolder &g, vector<bool> &cyclic,
+void findCyclicPostDom(const NGHolder &g, vector<bool> &cyclic,
set<NFAEdge> &dead) {
auto postdominators = findPostDominators(g);
* offset.
*/
static
-bool improveLeadingRepeat(NGHolder &g, BoundedRepeatData &rd,
+bool improveLeadingRepeat(NGHolder &g, const BoundedRepeatData &rd,
unordered_set<NFAVertex> &created,
const vector<BoundedRepeatData> &all_repeats) {
assert(edge(g.startDs, g.startDs, g).second);
}
static
-vector<NFAVertex> makeOwnStraw(NGHolder &g, BoundedRepeatData &rd,
+vector<NFAVertex> makeOwnStraw(NGHolder &g, const BoundedRepeatData &rd,
const vector<NFAVertex> &straw) {
// Straw runs from startDs to our pos trigger.
assert(!straw.empty());
}
static
-bool doTreePlanningIntl(NGHolder &g,
+bool doTreePlanningIntl(const NGHolder &g,
const unordered_map<NFAVertex, u32> ®ions,
const map<u32, region_info> &info,
map<u32, region_info>::const_iterator picked, u32 bad_region,
}
static
-u32 doSomRevNfaPrefix(NG &ng, const ExpressionInfo &expr, NGHolder &g,
+u32 doSomRevNfaPrefix(NG &ng, const ExpressionInfo &expr, const NGHolder &g,
const CompileContext &cc) {
depth maxWidth = findMaxWidth(g);
}
static
-bool tryHaig(RoseBuild &rose, NGHolder &g,
+bool tryHaig(RoseBuild &rose, const NGHolder &g,
const unordered_map<NFAVertex, u32> ®ions,
som_type som, u32 somPrecision,
map<u32, region_info>::const_iterator picked,
}
static
-bool doLitHaigSom(NG &ng, NGHolder &g, som_type som) {
+bool doLitHaigSom(NG &ng, const NGHolder &g, som_type som) {
ue2_literal lit;
shared_ptr<NGHolder> rhs = make_shared<NGHolder>();
if (!rhs) {
}
static
-bool doMultiLitHaigSom(NG &ng, NGHolder &g, som_type som) {
+bool doMultiLitHaigSom(NG &ng, const NGHolder &g, som_type som) {
set<ue2_literal> lits;
shared_ptr<NGHolder> rhs = make_shared<NGHolder>();
if (!ng.cc.grey.allowLitHaig) {
}
*numNewVertices += predGroups.size();
- for (auto &group : predGroups) {
+ for (const auto &group : predGroups) {
const depth &predDepth = group.first;
const vector<NFAEdge> &preds = group.second;
}
}
- NGHolder &g_i = *(cluster[ci]);
- NGHolder &g_j = *(cluster[cj]);
+ const NGHolder &g_i = *(cluster[ci]);
+ const NGHolder &g_j = *(cluster[cj]);
if (!compatibleStarts(g_i, g_j)) {
continue;
}
if (seeking_transient) {
- for (auto &a : lits) {
+ for (const auto &a : lits) {
a->creates_transient
= createsTransientLHS(g, a->vv, *depths, cc.grey);
}
if (last_chance) {
const size_t num_verts = num_vertices(g);
auto color_map = make_small_color_map(g);
- for (auto &a : lits) {
+ for (const auto &a : lits) {
size_t num_reachable = count_reachable(g, a->vv, color_map);
double ratio = (double)num_reachable / (double)num_verts;
a->split_ratio = ratio > 0.5 ? 1 - ratio : ratio;
#define MAX_LEN_2_LITERALS_PER_CUT 3
static
-bool checkValidNetflowLits(NGHolder &h, const vector<u64a> &scores,
+bool checkValidNetflowLits(const NGHolder &h, const vector<u64a> &scores,
const map<NFAEdge, set<ue2_literal>> &cut_lits,
u32 min_allowed_length) {
DEBUG_PRINTF("cut width %zu; min allowed %u\n", cut_lits.size(),
}
static
-void splitEdgesByCut(NGHolder &h, RoseInGraph &vg,
+void splitEdgesByCut(const NGHolder &h, RoseInGraph &vg,
const vector<RoseInEdge> &to_cut,
const vector<NFAEdge> &cut,
const map<NFAEdge, set<ue2_literal>> &cut_lits) {
}
static
-RoseInVertex getStart(RoseInGraph &vg) {
+RoseInVertex getStart(const RoseInGraph &vg) {
for (RoseInVertex v : vertices_range(vg)) {
if (vg[v].type == RIV_START || vg[v].type == RIV_ANCHORED_START) {
return v;
#define SHORT_TRIGGER_LEN 16
static
-bool makeTransientFromLongLiteral(NGHolder &h, RoseInGraph &vg,
+bool makeTransientFromLongLiteral(const NGHolder &h, RoseInGraph &vg,
const vector<RoseInEdge> &ee,
const CompileContext &cc) {
/* check max width and literal lengths to see if possible */
#define MAX_EXTRACT_STRONG_LITERAL_GRAPHS 10
static
-bool extractStrongLiteral(NGHolder &h, RoseInGraph &vg,
+bool extractStrongLiteral(const NGHolder &h, RoseInGraph &vg,
const vector<RoseInEdge> &ee,
const CompileContext &cc) {
DEBUG_PRINTF("looking for string literal\n");
}
static
-vector<vector<CharReach>> getDfaTriggers(RoseInGraph &vg,
+vector<vector<CharReach>> getDfaTriggers(const RoseInGraph &vg,
const vector<RoseInEdge> &edges,
bool *single_trigger) {
vector<vector<CharReach>> triggers;
vector<RoseInEdge>> edges_by_graph;
for (const RoseInEdge &ve : edges_range(vg)) {
if (vg[ve].graph && !vg[ve].dfa) {
- auto &h = vg[ve].graph;
+ const auto &h = vg[ve].graph;
edges_by_graph[h].emplace_back(ve);
}
}
}
static
-void checkPositions(vector<PositionInfo> &v, const GlushkovBuildState &bs) {
+void checkPositions(const vector<PositionInfo> &v, const GlushkovBuildState &bs) {
const NFABuilder& builder = bs.getBuilder();
for (const auto &e : v) {
if (builder.isSpecialState(e.pos)) {
static
void generateAccepts(GlushkovBuildStateImpl &bs, const PositionInfo &from,
vector<PositionInfo> *tolist) {
- NFABuilder &builder = bs.getBuilder();
+ const NFABuilder &builder = bs.getBuilder();
u32 flags = from.flags;
bool require_eod = flags & POS_FLAG_WIRE_EOD;
edge_props.minBound, edge_props.maxBound);
}
- for (auto &m : created) {
+ for (const auto &m : created) {
tbi->ghost[m.second] = g_v;
}
}
}
static
-void populateRoseGraph(RoseBuildImpl *tbi, RoseBuildData &bd) {
+void populateRoseGraph(RoseBuildImpl *tbi, const RoseBuildData &bd) {
const RoseInGraph &ig = bd.ig;
/* add the pattern in to the main rose graph */
}
assert(suff.graph());
- NGHolder &holder = *suff.graph();
+ const NGHolder &holder = *suff.graph();
assert(holder.kind == NFA_SUFFIX);
const bool oneTop = onlyOneTop(holder);
bool compress_state = cc.streaming;
const vector<ExclusiveInfo> &exclusive_info,
set<u32> *no_retrigger_queues) {
const RoseGraph &g = build.g;
- for (auto &info : exclusive_info) {
+ for (const auto &info : exclusive_info) {
const auto &qi = info.queue;
const auto &subengines = info.subengines;
bool no_retrigger = true;
build.rm);
}
- bytecode_ptr<NFA> operator()(unique_ptr<NGHolder> &holder) const {
+ bytecode_ptr<NFA> operator()(const unique_ptr<NGHolder> &holder) const {
const CompileContext &cc = build.cc;
const ReportManager &rm = build.rm;
- NGHolder &h = *holder;
+ const NGHolder &h = *holder;
assert(h.kind == NFA_OUTFIX);
// Build NFA.
return n;
}
- bytecode_ptr<NFA> operator()(UNUSED MpvProto &mpv) const {
+ bytecode_ptr<NFA> operator()(UNUSED const MpvProto &mpv) const {
// MPV construction handled separately.
assert(mpv.puffettes.empty());
return nullptr;
}
static
-RoseProgram makeLiteralProgram(const RoseBuildImpl &build, build_context &bc,
+RoseProgram makeLiteralProgram(const RoseBuildImpl &build, const build_context &bc,
ProgramBuild &prog_build, u32 lit_id,
const vector<vector<RoseEdge>> &lit_edge_map,
bool is_anchored_replay_program) {
pfrag.lit_ids, lit_edge_map);
if (pfrag.included_frag_id != INVALID_FRAG_ID &&
!lit_prog.empty()) {
- auto &cfrag = fragments[pfrag.included_frag_id];
+ const auto &cfrag = fragments[pfrag.included_frag_id];
assert(pfrag.s.length() >= cfrag.s.length() &&
!pfrag.s.any_nocase() >= !cfrag.s.any_nocase());
u32 child_offset = cfrag.lit_program_offset;
pfrag.lit_ids);
if (pfrag.included_delay_frag_id != INVALID_FRAG_ID &&
!rebuild_prog.empty()) {
- auto &cfrag = fragments[pfrag.included_delay_frag_id];
+ const auto &cfrag = fragments[pfrag.included_delay_frag_id];
assert(pfrag.s.length() >= cfrag.s.length() &&
!pfrag.s.any_nocase() >= !cfrag.s.any_nocase());
u32 child_offset = cfrag.delay_program_offset;
auto &proto = *litProto.hwlmProto;
for (auto &lit : proto.lits) {
auto fragId = lit.id;
- auto &frag = fragments[fragId];
+ const auto &frag = fragments[fragId];
if (delay) {
DEBUG_PRINTF("delay_program_offset:%u\n",
frag.delay_program_offset);
for (auto v : adjacent_vertices_range(start, h)) {
if (v != h.startDs) {
- for (auto &t : tails) {
+ for (const auto &t : tails) {
add_edge(t, v, h);
}
}
clear_out_edges(start, h);
add_edge(h.start, h.start, h);
- for (auto &t : heads) {
+ for (const auto &t : heads) {
add_edge(start, t, h);
}
// Second pass: the other literals.
for (u32 id = 0; id < literals.size(); id++) {
const rose_literal_id &lit = literals.at(id);
- rose_literal_info &info = literal_info[id];
+ const rose_literal_info &info = literal_info[id];
if (!requires_group_assignment(lit, info)) {
continue;
}
static
-insertion_ordered_map<left_id, vector<RoseVertex>> get_eng_verts(RoseGraph &g) {
+insertion_ordered_map<left_id, vector<RoseVertex>> get_eng_verts(const RoseGraph &g) {
insertion_ordered_map<left_id, vector<RoseVertex>> eng_verts;
for (auto v : vertices_range(g)) {
const auto &left = g[v].left;
}
assert(left.graph());
- NGHolder &h = *left.graph();
+ const NGHolder &h = *left.graph();
/* Ensure that kind on the graph is correct */
assert(h.kind == (tbi.isRootSuccessor(v) ? NFA_PREFIX : NFA_INFIX));
return;
}
- RoseGraph &g = build.g;
+ const RoseGraph &g = build.g;
insertion_ordered_map<left_id, vector<RoseVertex>> eng_verts;
}
static
-map<NGHolder *, NGHolder *> chunkedNfaMerge(RoseBuildImpl &build,
+map<NGHolder *, NGHolder *> chunkedNfaMerge(const RoseBuildImpl &build,
const vector<NGHolder *> &nfas) {
map<NGHolder *, NGHolder *> merged;
assert(a != b);
RoseGraph &g = build.g;
- LeftEngInfo &a_left = g[a].left;
- LeftEngInfo &b_left = g[b].left;
+ const LeftEngInfo &a_left = g[a].left;
+ const LeftEngInfo &b_left = g[b].left;
// Trivial case.
if (a_left == b_left) {
vector<RoseVertex> *dead, bool mergeRoses,
RoseAliasingInfo &rai) {
DEBUG_PRINTF("begin\n");
- RoseGraph &g = build.g;
+ const RoseGraph &g = build.g;
if (candidates.empty()) {
return;
* merge.
*/
static
-void filterDiamondCandidates(RoseGraph &g, CandidateSet &candidates) {
+void filterDiamondCandidates(const RoseGraph &g, CandidateSet &candidates) {
DEBUG_PRINTF("%zu candidates enter\n", candidates.size());
vector<RoseVertex> dead;
find_if(reset.entries.begin(), reset.entries.end(),
has_prefix_func) != reset.entries.end();
- for (auto &e : reset.entries) {
+ for (const auto &e : reset.entries) {
u32 temp = 0;
/* we don't need to test against sentinels which are identical to
* our current one as races don't matter and we know it clears
// Choose a vertex from the graph
u32 id = g[0];
- CliqueVertex &n = vertexMap.at(id);
+ const CliqueVertex &n = vertexMap.at(id);
clique.emplace_back(id);
// Corresponding vertex in the original graph
set<u32> subgraphId(g.begin(), g.end());
ResultEntry &result, EngineContext &ectx) const {
assert(data);
- EngineHSContext &ctx = static_cast<EngineHSContext &>(ectx);
+ const EngineHSContext &ctx = static_cast<EngineHSContext &>(ectx);
ScanHSContext sc(id, result, nullptr);
auto callback = echo_matches ? onMatchEcho : onMatch;
hs_error_t rv = hs_scan(db, data, len, 0, ctx.scratch, callback, &sc);
assert(data);
assert(len);
- EngineHSContext &ctx = static_cast<EngineHSContext &>(ectx);
+ const EngineHSContext &ctx = static_cast<EngineHSContext &>(ectx);
ScanHSContext sc(streamId, result, nullptr);
auto callback = echo_matches ? onMatchEcho : onMatch;
hs_error_t rv =
ResultEntry &result) const {
assert(data);
- auto &s = static_cast<EngineHSStream &>(stream);
- EngineHSContext &ctx = *s.ctx;
+ const auto &s = static_cast<EngineHSStream &>(stream);
+ const EngineHSContext &ctx = *s.ctx;
ScanHSContext sc(id, result, &s);
auto callback = echo_matches ? onMatchEcho : onMatch;
void EngineHyperscan::streamCompressExpand(EngineStream &stream,
vector<char> &temp) const {
size_t used = 0;
- auto &s = static_cast<EngineHSStream &>(stream);
+ const auto &s = static_cast<EngineHSStream &>(stream);
hs_error_t err = hs_compress_stream(s.id, temp.data(), temp.size(),
&used);
if (err == HS_INSUFFICIENT_SPACE) {
string data = "abcdefxxfoobarrrghabcxdefxteakettleeeeexxxxijklmxxdef";
const char *expr[] = {"abc", "def", "foobar.*gh", "teakettle{4,10}",
"ijkl[mMn]", "(101 & 102 & 103) | (104 & !105)"};
- unsigned flags[] = {0, 0, 0, 0, 0, HS_FLAG_COMBINATION};
- unsigned ids[] = {101, 102, 103, 104, 105, 1001};
+ const unsigned flags[] = {0, 0, 0, 0, 0, HS_FLAG_COMBINATION};
+ const unsigned ids[] = {101, 102, 103, 104, 105, 1001};
hs_error_t err = hs_compile_multi(expr, flags, ids, 6, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err);
string data = "abcdefxxfoobarrrghabcxdefxteakettleeeeexxxxijklmxxdef";
const char *expr[] = {"abc", "def", "foobar.*gh", "teakettle{4,10}",
"ijkl[mMn]", "(101 & 102 & 103) | (104 & !105)"};
- unsigned flags[] = {HS_FLAG_QUIET, HS_FLAG_QUIET, HS_FLAG_QUIET,
+ const unsigned flags[] = {HS_FLAG_QUIET, HS_FLAG_QUIET, HS_FLAG_QUIET,
HS_FLAG_QUIET, 0, HS_FLAG_COMBINATION};
- unsigned ids[] = {101, 102, 103, 104, 105, 1001};
+ const unsigned ids[] = {101, 102, 103, 104, 105, 1001};
hs_error_t err = hs_compile_multi(expr, flags, ids, 6, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err);
const char *expr[] = {"abc", "def", "foobar.*gh", "teakettle{4,10}",
"ijkl[mMn]", "(101 & 102 & 103) | (104 & !105)",
"!101 & 102", "!(!101 | 102)", "101 & !102"};
- unsigned flags[] = {HS_FLAG_QUIET, HS_FLAG_QUIET, HS_FLAG_QUIET,
+ const unsigned flags[] = {HS_FLAG_QUIET, HS_FLAG_QUIET, HS_FLAG_QUIET,
HS_FLAG_QUIET, 0, HS_FLAG_COMBINATION,
HS_FLAG_COMBINATION, HS_FLAG_COMBINATION,
HS_FLAG_COMBINATION};
- unsigned ids[] = {101, 102, 103, 104, 105, 1001, 1002, 1003, 1004};
+ const unsigned ids[] = {101, 102, 103, 104, 105, 1001, 1002, 1003, 1004};
hs_error_t err = hs_compile_multi(expr, flags, ids, 9, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err);
const char *expr[] = {"abc", "def", "foobar.*gh", "teakettle{4,10}",
"ijkl[mMn]", "(101 & 102 & 103) | (104 & !105)",
"!101 & 102", "!(!101 | 102)", "101 & !102"};
- unsigned flags[] = {HS_FLAG_QUIET, HS_FLAG_QUIET, HS_FLAG_QUIET,
+ const unsigned flags[] = {HS_FLAG_QUIET, HS_FLAG_QUIET, HS_FLAG_QUIET,
HS_FLAG_QUIET, 0,
HS_FLAG_COMBINATION | HS_FLAG_SINGLEMATCH,
HS_FLAG_COMBINATION,
HS_FLAG_COMBINATION | HS_FLAG_SINGLEMATCH,
HS_FLAG_COMBINATION | HS_FLAG_SINGLEMATCH};
- unsigned ids[] = {101, 102, 103, 104, 105, 1001, 1002, 1003, 1004};
+ const unsigned ids[] = {101, 102, 103, 104, 105, 1001, 1002, 1003, 1004};
hs_error_t err = hs_compile_multi(expr, flags, ids, 9, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err);
const char *expr[] = {"abc", "def", "foobar.*gh", "teakettle{4,10}",
"ijkl[mMn]", "(101 & 102 & 103) | (104 & !105)",
"!101 & 102", "!(!101 | 102)", "101 & !102"};
- unsigned flags[] = {HS_FLAG_QUIET, HS_FLAG_QUIET, HS_FLAG_QUIET,
+ const unsigned flags[] = {HS_FLAG_QUIET, HS_FLAG_QUIET, HS_FLAG_QUIET,
HS_FLAG_QUIET, 0, HS_FLAG_COMBINATION | HS_FLAG_QUIET,
HS_FLAG_COMBINATION, HS_FLAG_COMBINATION,
HS_FLAG_COMBINATION | HS_FLAG_QUIET};
- unsigned ids[] = {101, 102, 103, 104, 105, 1001, 1002, 1003, 1004};
+ const unsigned ids[] = {101, 102, 103, 104, 105, 1001, 1002, 1003, 1004};
hs_error_t err = hs_compile_multi(expr, flags, ids, 9, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err);
string data = "abbdefxxfoobarrrghabcxdefxteakettleeeeexxxxijklmxxdef";
const char *expr[] = {"abc", "def", "foobar.*gh", "teakettle{4,10}",
"ijkl[mMn]", "(201 | 202 & 203) & (!204 | 205)"};
- unsigned flags[] = {0, 0, 0, 0, 0, HS_FLAG_COMBINATION};
- unsigned ids[] = {201, 202, 203, 204, 205, 1002};
+ const unsigned flags[] = {0, 0, 0, 0, 0, HS_FLAG_COMBINATION};
+ const unsigned ids[] = {201, 202, 203, 204, 205, 1002};
hs_error_t err = hs_compile_multi(expr, flags, ids, 6, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err);
string data = "abbdefxxfoobarrrghabcxdefxteakettleeeeexxxxijklmxxdef";
const char *expr[] = {"abc", "def", "foobar.*gh", "teakettle{4,10}",
"ijkl[mMn]", "(201 | 202 & 203) & (!204 | 205)"};
- unsigned flags[] = {0, HS_FLAG_QUIET, HS_FLAG_QUIET, 0, HS_FLAG_QUIET,
+ const unsigned flags[] = {0, HS_FLAG_QUIET, HS_FLAG_QUIET, 0, HS_FLAG_QUIET,
HS_FLAG_COMBINATION};
- unsigned ids[] = {201, 202, 203, 204, 205, 1002};
+ const unsigned ids[] = {201, 202, 203, 204, 205, 1002};
hs_error_t err = hs_compile_multi(expr, flags, ids, 6, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err);
string data = "abcijklndefxxfoobarrrghabcxdefxteakettleeeeexxxxijklnxxdef";
const char *expr[] = {"abc", "def", "foobar.*gh", "teakettle{4,10}",
"ijkl[mMn]", "((301 | 302) & 303) & (304 | 305)"};
- unsigned flags[] = {0, 0, 0, 0, 0, HS_FLAG_COMBINATION};
- unsigned ids[] = {301, 302, 303, 304, 305, 1003};
+ const unsigned flags[] = {0, 0, 0, 0, 0, HS_FLAG_COMBINATION};
+ const unsigned ids[] = {301, 302, 303, 304, 305, 1003};
hs_error_t err = hs_compile_multi(expr, flags, ids, 6, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err);
string data = "abcijklndefxxfoobarrrghabcxdefxteakettleeeeexxxxijklnxxdef";
const char *expr[] = {"abc", "def", "foobar.*gh", "teakettle{4,10}",
"ijkl[mMn]", "((301 | 302) & 303) & (304 | 305)"};
- unsigned flags[] = {HS_FLAG_QUIET, HS_FLAG_QUIET, 0, HS_FLAG_QUIET,
+ const unsigned flags[] = {HS_FLAG_QUIET, HS_FLAG_QUIET, 0, HS_FLAG_QUIET,
HS_FLAG_QUIET, HS_FLAG_COMBINATION};
- unsigned ids[] = {301, 302, 303, 304, 305, 1003};
+ const unsigned ids[] = {301, 302, 303, 304, 305, 1003};
hs_error_t err = hs_compile_multi(expr, flags, ids, 6, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err);
"ijkl[mMn]", "(201 & 202 & 203) | (204 & !205)",
"(201 | 202 & 203) & (!204 | 205)",
"((201 | 202) & 203) & (204 | 205)"};
- unsigned flags[] = {0, 0, 0, 0, 0, HS_FLAG_COMBINATION,
+ const unsigned flags[] = {0, 0, 0, 0, 0, HS_FLAG_COMBINATION,
HS_FLAG_COMBINATION, HS_FLAG_COMBINATION};
- unsigned ids[] = {201, 202, 203, 204, 205, 1001, 1002, 1003};
+ const unsigned ids[] = {201, 202, 203, 204, 205, 1001, 1002, 1003};
hs_error_t err = hs_compile_multi(expr, flags, ids, 8, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err);
"ijkl[mMn]", "(201 & 202 & 203) | (204 & !205)",
"(201 | 202 & 203) & (!204 | 205)",
"((201 | 202) & 203) & (204 | 205)"};
- unsigned flags[] = {HS_FLAG_QUIET, HS_FLAG_QUIET, HS_FLAG_QUIET, 0,
+ const unsigned flags[] = {HS_FLAG_QUIET, HS_FLAG_QUIET, HS_FLAG_QUIET, 0,
HS_FLAG_QUIET, HS_FLAG_COMBINATION,
HS_FLAG_COMBINATION, HS_FLAG_COMBINATION};
- unsigned ids[] = {201, 202, 203, 204, 205, 1001, 1002, 1003};
+ const unsigned ids[] = {201, 202, 203, 204, 205, 1001, 1002, 1003};
hs_error_t err = hs_compile_multi(expr, flags, ids, 8, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err);
"(101 & 102 & 103) | (104 & !105)",
"(201 | 202 & 203) & (!204 | 205)",
"((301 | 302) & 303) & (304 | 305)"};
- unsigned flags[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ const unsigned flags[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
HS_FLAG_COMBINATION, HS_FLAG_COMBINATION,
HS_FLAG_COMBINATION};
- unsigned ids[] = {101, 102, 103, 104, 105, 201, 202, 203, 204, 205, 301,
+ const unsigned ids[] = {101, 102, 103, 104, 105, 201, 202, 203, 204, 205, 301,
302, 303, 304, 305, 1001, 1002, 1003};
hs_error_t err = hs_compile_multi(expr, flags, ids, 18, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err);
"(101 & 102 & 103) | (104 & !105)",
"(201 | 202 & 203) & (!204 | 205)",
"((301 | 302) & 303) & (304 | 305)"};
- unsigned flags[] = {0, HS_FLAG_QUIET, HS_FLAG_QUIET, HS_FLAG_QUIET, 0,
+ const unsigned flags[] = {0, HS_FLAG_QUIET, HS_FLAG_QUIET, HS_FLAG_QUIET, 0,
HS_FLAG_QUIET, 0, HS_FLAG_QUIET, 0, HS_FLAG_QUIET,
HS_FLAG_QUIET, HS_FLAG_QUIET, 0, HS_FLAG_QUIET, 0,
HS_FLAG_COMBINATION, HS_FLAG_COMBINATION,
HS_FLAG_COMBINATION};
- unsigned ids[] = {101, 102, 103, 104, 105, 201, 202, 203, 204, 205, 301,
+ const unsigned ids[] = {101, 102, 103, 104, 105, 201, 202, 203, 204, 205, 301,
302, 303, 304, 305, 1001, 1002, 1003};
hs_error_t err = hs_compile_multi(expr, flags, ids, 18, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err);
string data = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
const char *expr[] = {"abc", "def", "foobar.*gh", "teakettle{4,10}",
"ijkl[mMn]", "(!201 | 202 & 203) & (!204 | 205)"};
- unsigned flags[] = {0, 0, 0, 0, 0, HS_FLAG_COMBINATION};
- unsigned ids[] = {201, 202, 203, 204, 205, 1002};
+ const unsigned flags[] = {0, 0, 0, 0, 0, HS_FLAG_COMBINATION};
+ const unsigned ids[] = {201, 202, 203, 204, 205, 1002};
hs_error_t err = hs_compile_multi(expr, flags, ids, 6, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err);
string data = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
const char *expr[] = {"abc", "def", "foobar.*gh", "teakettle{4,10}",
"ijkl[mMn]", "(!201 | 202 & 203) & (!204 | 205)"};
- unsigned flags[] = {0, 0, 0, 0, 0, HS_FLAG_COMBINATION | HS_FLAG_QUIET};
- unsigned ids[] = {201, 202, 203, 204, 205, 1002};
+ const unsigned flags[] = {0, 0, 0, 0, 0, HS_FLAG_COMBINATION | HS_FLAG_QUIET};
+ const unsigned ids[] = {201, 202, 203, 204, 205, 1002};
hs_error_t err = hs_compile_multi(expr, flags, ids, 6, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err);
"(101 & 102 & 103) | (!104 & !105)",
"(!201 | 202 & 203) & (!204 | 205)",
"((301 | 302) & 303) & (304 | 305)"};
- unsigned flags[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ const unsigned flags[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
HS_FLAG_COMBINATION, HS_FLAG_COMBINATION,
HS_FLAG_COMBINATION};
- unsigned ids[] = {101, 102, 103, 104, 105, 201, 202, 203, 204, 205, 301,
+ const unsigned ids[] = {101, 102, 103, 104, 105, 201, 202, 203, 204, 205, 301,
302, 303, 304, 305, 1001, 1002, 1003};
hs_error_t err = hs_compile_multi(expr, flags, ids, 18, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err);
"(101 & 102 & 103) | (!104 & !105)",
"(!201 | 202 & 203) & (!204 | 205)",
"((301 | 302) & 303) & (304 | 305)"};
- unsigned flags[] = {0, 0, 0, 0, 0, 0, HS_FLAG_MULTILINE,
+ const unsigned flags[] = {0, 0, 0, 0, 0, 0, HS_FLAG_MULTILINE,
0, 0, 0, 0, 0, 0, 0, 0,
HS_FLAG_COMBINATION, HS_FLAG_COMBINATION,
HS_FLAG_COMBINATION};
- unsigned ids[] = {101, 102, 103, 104, 105, 201, 202, 203, 204, 205, 301,
+ const unsigned ids[] = {101, 102, 103, 104, 105, 201, 202, 203, 204, 205, 301,
302, 303, 304, 305, 1001, 1002, 1003};
hs_error_t err = hs_compile_multi(expr, flags, ids, 18, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err);
"z"};
const char *expr[] = {"abc", "def", "xyz", "zxyz",
"101 & 102", "201 & !202"};
- unsigned flags[] = {0, 0, 0, 0, HS_FLAG_COMBINATION, HS_FLAG_COMBINATION};
- unsigned ids[] = {101, 102, 201, 202, 1001, 1002};
+ const unsigned flags[] = {0, 0, 0, 0, HS_FLAG_COMBINATION, HS_FLAG_COMBINATION};
+ const unsigned ids[] = {101, 102, 201, 202, 1001, 1002};
hs_error_t err = hs_compile_multi(expr, flags, ids, 6, HS_MODE_STREAM,
nullptr, &db, &compile_err);
CallBackContext c;
string data = "aooAaooAbarZ";
const char *expr[] = {"aoo[A-K]", "bar[L-Z]"};
- unsigned flags[] = {0, 0};
- unsigned ids[] = {30, 31};
+ const unsigned flags[] = {0, 0};
+ const unsigned ids[] = {30, 31};
hs_error_t err = hs_compile_multi(expr, flags, ids, 2, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err);
CallBackContext c;
string data = "aooAaooAbarZ ";
const char *expr[] = {"aoo[A-K][^\n]{16}", "bar[L-Z][^\n]{16}"};
- unsigned flags[] = {0, 0};
- unsigned ids[] = {30, 31};
+ const unsigned flags[] = {0, 0};
+ const unsigned ids[] = {30, 31};
hs_error_t err = hs_compile_multi(expr, flags, ids, 2, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err);
CallBackContext c;
string data = "aooAaooAbarZ";
const char *expr[] = {"aoo[A-K]", "bar[L-Z]"};
- unsigned flags[] = {0, 0};
- unsigned ids[] = {30, 31};
+ const unsigned flags[] = {0, 0};
+ const unsigned ids[] = {30, 31};
hs_error_t err = hs_compile_multi(expr, flags, ids, 2, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err);
CallBackContext c;
string data = "aooAaooAbarZ ";
const char *expr[] = {"aoo[A-K][^\n]{16}", "bar[L-Z][^\n]{16}"};
- unsigned flags[] = {0, 0};
- unsigned ids[] = {30, 31};
+ const unsigned flags[] = {0, 0};
+ const unsigned ids[] = {30, 31};
hs_error_t err = hs_compile_multi(expr, flags, ids, 2, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err);
CallBackContext c;
string data = "aooAaooAbarZ";
const char *expr[] = {"aoo[A-K]", "bar[L-Z]"};
- unsigned flags[] = {HS_FLAG_SINGLEMATCH, 0};
- unsigned ids[] = {30, 31};
+ const unsigned flags[] = {HS_FLAG_SINGLEMATCH, 0};
+ const unsigned ids[] = {30, 31};
hs_error_t err = hs_compile_multi(expr, flags, ids, 2, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err);
CallBackContext c;
string data = "aooAaooAbarZ ";
const char *expr[] = {"aoo[A-K][^\n]{16}", "bar[L-Z][^\n]{16}"};
- unsigned flags[] = {HS_FLAG_SINGLEMATCH, 0};
- unsigned ids[] = {30, 31};
+ const unsigned flags[] = {HS_FLAG_SINGLEMATCH, 0};
+ const unsigned ids[] = {30, 31};
hs_error_t err = hs_compile_multi(expr, flags, ids, 2, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err);
CallBackContext c;
string data = "aooAaooAbarZ";
const char *expr[] = {"aoo[A-K]", "bar[L-Z]"};
- unsigned flags[] = {HS_FLAG_SINGLEMATCH, 0};
- unsigned ids[] = {30, 31};
+ const unsigned flags[] = {HS_FLAG_SINGLEMATCH, 0};
+ const unsigned ids[] = {30, 31};
hs_error_t err = hs_compile_multi(expr, flags, ids, 2, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err);
CallBackContext c;
string data = "aooAaooAbarZbarZaooA ";
const char *expr[] = {"aoo[A-K][^\n]{16}", "bar[L-Z][^\n]{16}"};
- unsigned flags[] = {HS_FLAG_SINGLEMATCH, 0};
- unsigned ids[] = {30, 31};
+ const unsigned flags[] = {HS_FLAG_SINGLEMATCH, 0};
+ const unsigned ids[] = {30, 31};
hs_error_t err = hs_compile_multi(expr, flags, ids, 2, HS_MODE_NOSTREAM,
nullptr, &db, &compile_err);
const char *expr[] = {"/odezhda-dlya-bega/",
"kurtki-i-vetrovki-dlya-bega",
"futbolki-i-mayki-dlya-bega"};
- unsigned flags[] = {HS_FLAG_DOTALL | HS_FLAG_SINGLEMATCH,
+ const unsigned flags[] = {HS_FLAG_DOTALL | HS_FLAG_SINGLEMATCH,
HS_FLAG_DOTALL | HS_FLAG_SINGLEMATCH,
HS_FLAG_DOTALL | HS_FLAG_SINGLEMATCH};
hs_error_t err = hs_compile_multi(expr, flags, nullptr, 3, HS_MODE_BLOCK,
// Helper function: construct a graph from an expression, flags and context.
inline
std::unique_ptr<NGHolder> constructGraphWithCC(const std::string &expr,
- CompileContext &cc,
+ const CompileContext &cc,
unsigned flags) {
ReportManager rm(cc.grey);
ParsedExpression parsed(0, expr.c_str(), flags, 0);
TEST(state_compress, m128_2) {
char buf[sizeof(m128)] = { 0 };
- char val_raw[16] = { '0', '1', '2', '3', '4', '5', '6', '7',
+ const char val_raw[16] = { '0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
m128 val;
memcpy(&val, val_raw, sizeof(val));
TEST(state_compress, m256_2) {
char buf[sizeof(m256)] = { 0 };
- char val_raw[32] = { '0', '1', '2', '3', '4', '5', '6', '7',
+ const char val_raw[32] = { '0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f',
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P' };
TEST(state_compress, m384_2) {
char buf[sizeof(m384)] = { 0 };
- char val_raw[48] = { '0', '1', '2', '3', '4', '5', '6', '7',
+ const char val_raw[48] = { '0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f',
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
TEST(state_compress, m512_2) {
char buf[sizeof(m512)] = { 0 };
- char val_raw[64] = { '0', '1', '2', '3', '4', '5', '6', '7',
+ const char val_raw[64] = { '0', '1', '2', '3', '4', '5', '6', '7',
'8', '9', 'a', 'b', 'c', 'd', 'e', 'f',
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
}
static
-bool canReach(const NGHolder &g, const NFAEdge &e, struct fmstate &state) {
+bool canReach(const NGHolder &g, const NFAEdge &e, const struct fmstate &state) {
auto flags = g[e].assert_flags;
if (!flags) {
return true;