diff options
author | Ivan Blinkov <ivan@blinkov.ru> | 2022-02-10 16:47:10 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:47:10 +0300 |
commit | 1aeb9a455974457866f78722ad98114bafc84e8a (patch) | |
tree | e4340eaf1668684d83a0a58c36947c5def5350ad /contrib/libs/hyperscan/src/nfagraph/ng_puff.cpp | |
parent | bd5ef432f5cfb1e18851381329d94665a4c22470 (diff) | |
download | ydb-1aeb9a455974457866f78722ad98114bafc84e8a.tar.gz |
Restoring authorship annotation for Ivan Blinkov <ivan@blinkov.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/hyperscan/src/nfagraph/ng_puff.cpp')
-rw-r--r-- | contrib/libs/hyperscan/src/nfagraph/ng_puff.cpp | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/contrib/libs/hyperscan/src/nfagraph/ng_puff.cpp b/contrib/libs/hyperscan/src/nfagraph/ng_puff.cpp index 984518b0fc..76996b6da8 100644 --- a/contrib/libs/hyperscan/src/nfagraph/ng_puff.cpp +++ b/contrib/libs/hyperscan/src/nfagraph/ng_puff.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015-2017, Intel Corporation + * Copyright (c) 2015-2017, Intel Corporation * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -59,7 +59,7 @@ static size_t countChain(const NGHolder &g, NFAVertex v) { size_t count = 0; while (v) { - DEBUG_PRINTF("counting vertex %zu\n", g[v].index); + DEBUG_PRINTF("counting vertex %zu\n", g[v].index); if (is_special(v, g)) { break; } @@ -79,7 +79,7 @@ void wireNewAccepts(NGHolder &g, NFAVertex head, continue; } - DEBUG_PRINTF("adding edge: %zu -> accept\n", g[u].index); + DEBUG_PRINTF("adding edge: %zu -> accept\n", g[u].index); assert(!edge(u, g.accept, g).second); assert(!edge(u, g.acceptEod, g).second); add_edge(u, g.accept, g); @@ -94,7 +94,7 @@ void wireNewAccepts(NGHolder &g, NFAVertex head, static bool isFixedDepth(const NGHolder &g, NFAVertex v) { // If the vertex is reachable from startDs, it can't be fixed depth. - auto depthFromStartDs = calcDepthsFrom(g, g.startDs); + auto depthFromStartDs = calcDepthsFrom(g, g.startDs); u32 idx = g[v].index; const DepthMinMax &ds = depthFromStartDs.at(idx); @@ -103,7 +103,7 @@ bool isFixedDepth(const NGHolder &g, NFAVertex v) { return false; } - auto depthFromStart = calcDepthsFrom(g, g.start); + auto depthFromStart = calcDepthsFrom(g, g.start); /* we can still consider the head of a puff chain as at fixed depth if * it has a self-loop: so we look at all the preds of v (other than v @@ -134,13 +134,13 @@ bool singleStart(const NGHolder &g) { for (auto v : adjacent_vertices_range(g.start, g)) { if (!is_special(v, g)) { - DEBUG_PRINTF("saw %zu\n", g[v].index); + DEBUG_PRINTF("saw %zu\n", g[v].index); seen.insert(v); } } for (auto v : adjacent_vertices_range(g.startDs, g)) { if (!is_special(v, g)) { - DEBUG_PRINTF("saw %zu\n", g[v].index); + DEBUG_PRINTF("saw %zu\n", g[v].index); seen.insert(v); } } @@ -156,7 +156,7 @@ bool triggerResetsPuff(const NGHolder &g, NFAVertex head) { for (auto u : inv_adjacent_vertices_range(head, g)) { if (!g[u].char_reach.isSubsetOf(puff_escapes)) { - DEBUG_PRINTF("no reset on trigger %zu %zu\n", g[u].index, + DEBUG_PRINTF("no reset on trigger %zu %zu\n", g[u].index, g[head].index); return false; } @@ -170,7 +170,7 @@ bool triggerResetsPuff(const NGHolder &g, NFAVertex head) { * */ static bool triggerFloodsPuff(const NGHolder &g, NFAVertex head) { - DEBUG_PRINTF("head = %zu\n", g[head].index); + DEBUG_PRINTF("head = %zu\n", g[head].index); const CharReach &puff_cr = g[head].char_reach; @@ -184,14 +184,14 @@ bool triggerFloodsPuff(const NGHolder &g, NFAVertex head) { if (proper_in_degree(head, g) == 1 && puff_cr == g[getSoleSourceVertex(g, head)].char_reach) { head = getSoleSourceVertex(g, head); - DEBUG_PRINTF("temp new head = %zu\n", g[head].index); + DEBUG_PRINTF("temp new head = %zu\n", g[head].index); } for (auto s : inv_adjacent_vertices_range(head, g)) { - DEBUG_PRINTF("s = %zu\n", g[s].index); + DEBUG_PRINTF("s = %zu\n", g[s].index); if (!puff_cr.isSubsetOf(g[s].char_reach)) { - DEBUG_PRINTF("no flood on trigger %zu %zu\n", g[s].index, - g[head].index); + DEBUG_PRINTF("no flood on trigger %zu %zu\n", g[s].index, + g[head].index); return false; } @@ -266,18 +266,18 @@ void constructPuff(NGHolder &g, const NFAVertex a, const NFAVertex puffv, RoseBuild &rose, ReportManager &rm, flat_set<ReportID> &chain_reports, bool prefilter) { DEBUG_PRINTF("constructing Puff for report %u\n", report); - DEBUG_PRINTF("a = %zu\n", g[a].index); - - const Report &puff_report = rm.getReport(report); - const bool simple_exhaust = isSimpleExhaustible(puff_report); + DEBUG_PRINTF("a = %zu\n", g[a].index); + const Report &puff_report = rm.getReport(report); + const bool simple_exhaust = isSimpleExhaustible(puff_report); + const bool pureAnchored = a == g.start && singleStart(g); if (!pureAnchored) { if (a == g.startDs || a == g.start) { DEBUG_PRINTF("add outfix ar(false)\n"); - raw_puff rp(width, unbounded, report, cr, auto_restart, - simple_exhaust); + raw_puff rp(width, unbounded, report, cr, auto_restart, + simple_exhaust); rose.addOutfix(rp); return; } @@ -291,7 +291,7 @@ void constructPuff(NGHolder &g, const NFAVertex a, const NFAVertex puffv, u32 squashDistance = allowedSquashDistance(cr, width, g, puffv, prefilter); - Report ir = makeMpvTrigger(event, squashDistance); + Report ir = makeMpvTrigger(event, squashDistance); /* only need to trigger once if floatingUnboundedDot */ bool floatingUnboundedDot = unbounded && cr.all() && !fixed_depth; if (floatingUnboundedDot) { @@ -302,7 +302,7 @@ void constructPuff(NGHolder &g, const NFAVertex a, const NFAVertex puffv, } else { DEBUG_PRINTF("add outfix ar(%d)\n", (int)auto_restart); assert(!auto_restart || unbounded); - raw_puff rp(width, unbounded, report, cr, auto_restart, simple_exhaust); + raw_puff rp(width, unbounded, report, cr, auto_restart, simple_exhaust); rose.addOutfix(rp); } } @@ -347,7 +347,7 @@ bool doComponent(RoseBuild &rose, ReportManager &rm, NGHolder &g, NFAVertex a, } nodes.push_back(a); - DEBUG_PRINTF("vertex %zu has in_degree %zu\n", g[a].index, + DEBUG_PRINTF("vertex %zu has in_degree %zu\n", g[a].index, in_degree(a, g)); a = getSoleSourceVertex(g, a); @@ -385,10 +385,10 @@ bool doComponent(RoseBuild &rose, ReportManager &rm, NGHolder &g, NFAVertex a, bool auto_restart = false; - DEBUG_PRINTF("a = %zu\n", g[a].index); + DEBUG_PRINTF("a = %zu\n", g[a].index); if (nodes.size() < MIN_PUFF_LENGTH || a == g.startDs) { - DEBUG_PRINTF("bad %zu %zu\n", nodes.size(), g[a].index); + DEBUG_PRINTF("bad %zu %zu\n", nodes.size(), g[a].index); if (nodes.size() < MIN_PUFF_LENGTH) { return false; } else { @@ -470,7 +470,7 @@ bool doComponent(RoseBuild &rose, ReportManager &rm, NGHolder &g, NFAVertex a, } NFAVertex puffv = nodes.back(); - assert(puffv != NGHolder::null_vertex()); + assert(puffv != NGHolder::null_vertex()); u32 width = countChain(g, nodes.back()); flat_set<ReportID> chain_reports; |