mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
ng_violet: fail on added_count limit quicker
- also fixes typo "splitForImplementability" - adds more detail in debug output
This commit is contained in:
parent
cdb281df42
commit
e8f09aa8c6
@ -1198,7 +1198,8 @@ void splitEdgesByCut(NGHolder &h, RoseInGraph &vg,
|
|||||||
const vector<RoseInEdge> &to_cut,
|
const vector<RoseInEdge> &to_cut,
|
||||||
const vector<NFAEdge> &cut,
|
const vector<NFAEdge> &cut,
|
||||||
const map<NFAEdge, set<ue2_literal>> &cut_lits) {
|
const map<NFAEdge, set<ue2_literal>> &cut_lits) {
|
||||||
DEBUG_PRINTF("splitting %s:\n", to_string(h.kind).c_str());
|
DEBUG_PRINTF("splitting %s (%zu vertices)\n", to_string(h.kind).c_str(),
|
||||||
|
num_vertices(h));
|
||||||
|
|
||||||
/* create literal vertices and connect preds */
|
/* create literal vertices and connect preds */
|
||||||
unordered_set<RoseInVertex> done_sources;
|
unordered_set<RoseInVertex> done_sources;
|
||||||
@ -1233,7 +1234,9 @@ void splitEdgesByCut(NGHolder &h, RoseInGraph &vg,
|
|||||||
renumber_vertices(*new_lhs);
|
renumber_vertices(*new_lhs);
|
||||||
renumber_edges(*new_lhs);
|
renumber_edges(*new_lhs);
|
||||||
|
|
||||||
DEBUG_PRINTF(" into lhs %s\n", to_string(new_lhs->kind).c_str());
|
DEBUG_PRINTF(" into lhs %s (%zu vertices)\n",
|
||||||
|
to_string(new_lhs->kind).c_str(),
|
||||||
|
num_vertices(*new_lhs));
|
||||||
|
|
||||||
assert(hasCorrectlyNumberedVertices(*new_lhs));
|
assert(hasCorrectlyNumberedVertices(*new_lhs));
|
||||||
assert(hasCorrectlyNumberedEdges(*new_lhs));
|
assert(hasCorrectlyNumberedEdges(*new_lhs));
|
||||||
@ -1301,8 +1304,9 @@ void splitEdgesByCut(NGHolder &h, RoseInGraph &vg,
|
|||||||
remove_edge(new_rhs->start, new_rhs->accept, *new_rhs);
|
remove_edge(new_rhs->start, new_rhs->accept, *new_rhs);
|
||||||
remove_edge(new_rhs->start, new_rhs->acceptEod, *new_rhs);
|
remove_edge(new_rhs->start, new_rhs->acceptEod, *new_rhs);
|
||||||
renumber_edges(*new_rhs);
|
renumber_edges(*new_rhs);
|
||||||
DEBUG_PRINTF(" into rhs %s\n",
|
DEBUG_PRINTF(" into rhs %s (%zu vertices)\n",
|
||||||
to_string(new_rhs->kind).c_str());
|
to_string(new_rhs->kind).c_str(),
|
||||||
|
num_vertices(*new_rhs));
|
||||||
done_rhs.emplace(adj, new_rhs);
|
done_rhs.emplace(adj, new_rhs);
|
||||||
assert(isCorrectlyTopped(*new_rhs));
|
assert(isCorrectlyTopped(*new_rhs));
|
||||||
}
|
}
|
||||||
@ -2828,9 +2832,9 @@ bool doEarlyDfa(RoseBuild &rose, RoseInGraph &vg, NGHolder &h,
|
|||||||
#define MAX_EDGES_FOR_IMPLEMENTABILITY 50
|
#define MAX_EDGES_FOR_IMPLEMENTABILITY 50
|
||||||
|
|
||||||
static
|
static
|
||||||
bool splitForImplementabilty(RoseInGraph &vg, NGHolder &h,
|
bool splitForImplementability(RoseInGraph &vg, NGHolder &h,
|
||||||
const vector<RoseInEdge> &edges,
|
const vector<RoseInEdge> &edges,
|
||||||
const CompileContext &cc) {
|
const CompileContext &cc) {
|
||||||
vector<pair<ue2_literal, u32>> succ_lits;
|
vector<pair<ue2_literal, u32>> succ_lits;
|
||||||
DEBUG_PRINTF("trying to split %s with %zu vertices on %zu edges\n",
|
DEBUG_PRINTF("trying to split %s with %zu vertices on %zu edges\n",
|
||||||
to_string(h.kind).c_str(), num_vertices(h), edges.size());
|
to_string(h.kind).c_str(), num_vertices(h), edges.size());
|
||||||
@ -2912,8 +2916,12 @@ bool ensureImplementable(RoseBuild &rose, RoseInGraph &vg, bool allow_changes,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (splitForImplementabilty(vg, *h, edges_by_graph[h], cc)) {
|
if (splitForImplementability(vg, *h, edges_by_graph[h], cc)) {
|
||||||
added_count++;
|
added_count++;
|
||||||
|
if (added_count > MAX_IMPLEMENTABLE_SPLITS) {
|
||||||
|
DEBUG_PRINTF("added_count hit limit\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
changed = true;
|
changed = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -2921,9 +2929,7 @@ bool ensureImplementable(RoseBuild &rose, RoseInGraph &vg, bool allow_changes,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (added_count > MAX_IMPLEMENTABLE_SPLITS) {
|
assert(added_count <= MAX_IMPLEMENTABLE_SPLITS);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (changed) {
|
if (changed) {
|
||||||
removeRedundantLiterals(vg, cc);
|
removeRedundantLiterals(vg, cc);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user