mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-11-16 17:31:51 +03:00
Merge branch 'develop' into wip-isildur-g-cppcheck-47-48-58
This commit is contained in:
@@ -193,9 +193,6 @@ void reduceGraph(NGHolder &g, som_type som, bool utf8,
|
||||
|
||||
if (!som) {
|
||||
mergeCyclicDotStars(g);
|
||||
}
|
||||
|
||||
if (!som) {
|
||||
removeSiblingsOfStartDotStar(g);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,9 +165,9 @@ void reformAnchoredRepeatsComponent(NGHolder &g,
|
||||
return;
|
||||
}
|
||||
|
||||
NFAVertex dotV = NGHolder::null_vertex();
|
||||
|
||||
set<NFAVertex> otherV;
|
||||
dotV = findReformable(g, compAnchoredStarts, otherV);
|
||||
NFAVertex dotV = findReformable(g, compAnchoredStarts, otherV);
|
||||
if (dotV == NGHolder::null_vertex()) {
|
||||
DEBUG_PRINTF("no candidate reformable dot found.\n");
|
||||
return;
|
||||
@@ -268,9 +268,9 @@ void reformUnanchoredRepeatsComponent(NGHolder &g,
|
||||
}
|
||||
|
||||
while (true) {
|
||||
NFAVertex dotV = NGHolder::null_vertex();
|
||||
|
||||
set<NFAVertex> otherV;
|
||||
dotV = findReformable(g, compUnanchoredStarts, otherV);
|
||||
NFAVertex dotV = findReformable(g, compUnanchoredStarts, otherV);
|
||||
if (dotV == NGHolder::null_vertex()) {
|
||||
DEBUG_PRINTF("no candidate reformable dot found.\n");
|
||||
return;
|
||||
|
||||
@@ -513,12 +513,12 @@ static
|
||||
bool doHaig(const NGHolder &g, som_type som,
|
||||
const vector<vector<CharReach>> &triggers, bool unordered_som,
|
||||
raw_som_dfa *rdfa) {
|
||||
u32 state_limit = HAIG_FINAL_DFA_STATE_LIMIT; /* haig never backs down from
|
||||
a fight */
|
||||
using StateSet = typename Auto::StateSet;
|
||||
vector<StateSet> nfa_state_map;
|
||||
Auto n(g, som, triggers, unordered_som);
|
||||
try {
|
||||
u32 state_limit = HAIG_FINAL_DFA_STATE_LIMIT; /* haig never backs down from
|
||||
a fight */
|
||||
if (!determinise(n, rdfa->states, state_limit, &nfa_state_map)) {
|
||||
DEBUG_PRINTF("state limit exceeded\n");
|
||||
return false;
|
||||
|
||||
@@ -321,7 +321,7 @@ struct DAccelScheme {
|
||||
bool cd_a = buildDvermMask(a.double_byte);
|
||||
bool cd_b = buildDvermMask(b.double_byte);
|
||||
if (cd_a != cd_b) {
|
||||
return cd_a > cd_b;
|
||||
return cd_a;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -811,11 +811,9 @@ depth_done:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Second option: a two-byte shufti (i.e. less than eight 2-byte
|
||||
// literals)
|
||||
if (depth > 1) {
|
||||
for (unsigned int i = 0; i < (depth - 1); i++) {
|
||||
if (depthReach[i].count() * depthReach[i+1].count()
|
||||
<= DOUBLE_SHUFTI_LIMIT) {
|
||||
|
||||
@@ -636,12 +636,12 @@ bool reversePathReachSubset(const NFAEdge &e, const NFAVertex &dom,
|
||||
|
||||
NFAVertex start = source(e, g);
|
||||
using RevGraph = boost::reverse_graph<NGHolder, const NGHolder &>;
|
||||
map<RevGraph::vertex_descriptor, boost::default_color_type> vertexColor;
|
||||
|
||||
// Walk the graph backwards from v, examining each node. We fail (return
|
||||
// false) if we encounter a node with reach NOT a subset of domReach, and
|
||||
// we stop searching at dom.
|
||||
try {
|
||||
map<RevGraph::vertex_descriptor, boost::default_color_type> vertexColor;
|
||||
depth_first_visit(RevGraph(g), start,
|
||||
ReachSubsetVisitor(domReach),
|
||||
make_assoc_property_map(vertexColor),
|
||||
@@ -664,12 +664,12 @@ bool forwardPathReachSubset(const NFAEdge &e, const NFAVertex &dom,
|
||||
}
|
||||
|
||||
NFAVertex start = target(e, g);
|
||||
map<NFAVertex, boost::default_color_type> vertexColor;
|
||||
|
||||
// Walk the graph forward from v, examining each node. We fail (return
|
||||
// false) if we encounter a node with reach NOT a subset of domReach, and
|
||||
// we stop searching at dom.
|
||||
try {
|
||||
map<NFAVertex, boost::default_color_type> vertexColor;
|
||||
depth_first_visit(g, start, ReachSubsetVisitor(domReach),
|
||||
make_assoc_property_map(vertexColor),
|
||||
VertexIs<NGHolder, NFAVertex>(dom));
|
||||
|
||||
@@ -1292,8 +1292,8 @@ bool doTreePlanningIntl(const NGHolder &g,
|
||||
DEBUG_PRINTF("add mapped reporters for region %u\n", it->first);
|
||||
addMappedReporterVertices(it->second, g, copy_to_orig,
|
||||
plan.back().reporters);
|
||||
} while (it->second.optional && it != info.rend() &&
|
||||
(++it)->first > furthest->first);
|
||||
} while (it != info.rend() && it->second.optional &&
|
||||
(++it)->first > furthest->first);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1551,7 +1551,7 @@ bool doSomPlanning(NGHolder &g, bool stuck_in,
|
||||
DEBUG_PRINTF("region %u contributes reporters to last plan\n",
|
||||
it->first);
|
||||
addReporterVertices(it->second, g, plan.back().reporters);
|
||||
} while (it->second.optional && it != info.rend() &&
|
||||
} while (it != info.rend() && it->second.optional &&
|
||||
(++it)->first > furthest->first);
|
||||
|
||||
DEBUG_PRINTF("done!\n");
|
||||
|
||||
@@ -267,18 +267,6 @@ bool somMayGoBackwards(NFAVertex u, const NGHolder &g,
|
||||
boost::depth_first_search(c_g, visitor(backEdgeVisitor)
|
||||
.root_vertex(c_g.start));
|
||||
|
||||
for (const auto &e : be) {
|
||||
NFAVertex s = source(e, c_g);
|
||||
NFAVertex t = target(e, c_g);
|
||||
DEBUG_PRINTF("back edge %zu %zu\n", c_g[s].index, c_g[t].index);
|
||||
if (s != t) {
|
||||
assert(0);
|
||||
DEBUG_PRINTF("eek big cycle\n");
|
||||
rv = true; /* big cycle -> eek */
|
||||
goto exit;
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG_PRINTF("checking acyclic+selfloop graph\n");
|
||||
|
||||
rv = !firstMatchIsFirst(c_g);
|
||||
|
||||
@@ -589,7 +589,7 @@ void getHighlanderReporters(const NGHolder &g, const NFAVertex accept,
|
||||
|
||||
verts.insert(v);
|
||||
next_vertex:
|
||||
continue;
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -314,7 +314,7 @@ void duplicateReport(NGHolder &g, ReportID r_old, ReportID r_new);
|
||||
|
||||
/** Construct a reversed copy of an arbitrary NGHolder, mapping starts to
|
||||
* accepts. */
|
||||
void reverseHolder(const NGHolder &g, NGHolder &out);
|
||||
void reverseHolder(const NGHolder &g_in, NGHolder &g);
|
||||
|
||||
/** \brief Returns the delay or ~0U if the graph cannot match with
|
||||
* the trailing literal. */
|
||||
|
||||
@@ -348,10 +348,9 @@ void getSimpleRoseLiterals(const NGHolder &g, bool seeking_anchored,
|
||||
|
||||
map<NFAVertex, u64a> scores;
|
||||
map<NFAVertex, unique_ptr<VertLitInfo>> lit_info;
|
||||
set<ue2_literal> s;
|
||||
|
||||
for (auto v : a_dom) {
|
||||
s = getLiteralSet(g, v, true); /* RHS will take responsibility for any
|
||||
set<ue2_literal> s = getLiteralSet(g, v, true); /* RHS will take responsibility for any
|
||||
revisits to the target vertex */
|
||||
|
||||
if (s.empty()) {
|
||||
@@ -2868,7 +2867,6 @@ static
|
||||
bool splitForImplementability(RoseInGraph &vg, NGHolder &h,
|
||||
const vector<RoseInEdge> &edges,
|
||||
const CompileContext &cc) {
|
||||
vector<pair<ue2_literal, u32>> succ_lits;
|
||||
DEBUG_PRINTF("trying to split %s with %zu vertices on %zu edges\n",
|
||||
to_string(h.kind).c_str(), num_vertices(h), edges.size());
|
||||
|
||||
@@ -2877,6 +2875,7 @@ bool splitForImplementability(RoseInGraph &vg, NGHolder &h,
|
||||
}
|
||||
|
||||
if (!generates_callbacks(h)) {
|
||||
vector<pair<ue2_literal, u32>> succ_lits;
|
||||
for (const auto &e : edges) {
|
||||
const auto &lit = vg[target(e, vg)].s;
|
||||
u32 delay = vg[e].graph_lag;
|
||||
@@ -2889,8 +2888,8 @@ bool splitForImplementability(RoseInGraph &vg, NGHolder &h,
|
||||
}
|
||||
|
||||
unique_ptr<VertLitInfo> split;
|
||||
bool last_chance = true;
|
||||
if (h.kind == NFA_PREFIX) {
|
||||
bool last_chance = true;
|
||||
auto depths = calcDepths(h);
|
||||
|
||||
split = findBestPrefixSplit(h, depths, vg, edges, last_chance, cc);
|
||||
|
||||
Reference in New Issue
Block a user