mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
rose: tighten up requirements for catch up
We only need to catch up when there is an actual anchored table, not merely when there are successors of anchored_root in the Rose graph.
This commit is contained in:
parent
e74b141e95
commit
f4fa6cd4dd
@ -554,33 +554,30 @@ u32 countRosePrefixes(const vector<LeftNfaInfo> &roses) {
|
|||||||
* \brief True if this Rose engine needs to run a catch up whenever a report is
|
* \brief True if this Rose engine needs to run a catch up whenever a report is
|
||||||
* generated.
|
* generated.
|
||||||
*
|
*
|
||||||
* This is only the case if there are no anchored literals, suffixes, outfixes
|
* Catch up is necessary if there are output-exposed engines (suffixes,
|
||||||
* etc.
|
* outfixes) or an anchored table (anchored literals, acyclic DFAs).
|
||||||
*/
|
*/
|
||||||
static
|
static
|
||||||
bool needsCatchup(const RoseBuildImpl &build) {
|
bool needsCatchup(const RoseBuildImpl &build,
|
||||||
|
const vector<raw_dfa> &anchored_dfas) {
|
||||||
if (!build.outfixes.empty()) {
|
if (!build.outfixes.empty()) {
|
||||||
DEBUG_PRINTF("has outfixes\n");
|
DEBUG_PRINTF("has outfixes\n");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (!anchored_dfas.empty()) {
|
||||||
|
DEBUG_PRINTF("has anchored dfas\n");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
const RoseGraph &g = build.g;
|
const RoseGraph &g = build.g;
|
||||||
|
|
||||||
if (!isLeafNode(build.anchored_root, g)) {
|
|
||||||
DEBUG_PRINTF("has anchored vertices\n");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto v : vertices_range(g)) {
|
for (auto v : vertices_range(g)) {
|
||||||
if (build.root == v) {
|
if (build.root == v) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (build.anchored_root == v) {
|
if (build.anchored_root == v) {
|
||||||
assert(isLeafNode(v, g));
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g[v].suffix) {
|
if (g[v].suffix) {
|
||||||
DEBUG_PRINTF("vertex %zu has suffix\n", g[v].idx);
|
DEBUG_PRINTF("vertex %zu has suffix\n", g[v].idx);
|
||||||
return true;
|
return true;
|
||||||
@ -5286,7 +5283,7 @@ aligned_unique_ptr<RoseEngine> RoseBuildImpl::buildFinalEngine(u32 minWidth) {
|
|||||||
build_context bc;
|
build_context bc;
|
||||||
bc.floatingMinLiteralMatchOffset =
|
bc.floatingMinLiteralMatchOffset =
|
||||||
findMinFloatingLiteralMatch(*this, anchored_dfas);
|
findMinFloatingLiteralMatch(*this, anchored_dfas);
|
||||||
bc.needs_catchup = needsCatchup(*this);
|
bc.needs_catchup = needsCatchup(*this, anchored_dfas);
|
||||||
recordResources(bc.resources, *this);
|
recordResources(bc.resources, *this);
|
||||||
if (!anchored_dfas.empty()) {
|
if (!anchored_dfas.empty()) {
|
||||||
bc.resources.has_anchored = true;
|
bc.resources.has_anchored = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user