]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
minor eager prefixes improvements
authorAlex Coyte <a.coyte@intel.com>
Tue, 12 Jul 2016 04:01:51 +0000 (14:01 +1000)
committerMatthew Barr <matthew.barr@intel.com>
Wed, 10 Aug 2016 04:59:10 +0000 (14:59 +1000)
 - count eager prefixes as always run engine when comparing with smwr
 - only check if a prefix is vacuous after adding back literal fragments

src/rose/rose_build_bytecode.cpp
src/rose/rose_build_misc.cpp

index b8301dbdd30c95a905c42e0cb52b5eb066417fb3..37e6ae1320c6993565ece01eec0d6d445e810cf9 100644 (file)
@@ -1274,9 +1274,6 @@ bool checkSuitableForEager(bool is_prefix, const left_id &left,
         if (proper_out_degree(g.startDs, g)) {
             return false; /* not purely anchored */
         }
-        if (is_match_vertex(g.start, g)) {
-            return false; /* vacuous (todo: handle?) */
-        }
 
         ei.new_graph = cloneHolder(*left.graph());
         auto gg = ei.new_graph;
@@ -1284,6 +1281,10 @@ bool checkSuitableForEager(bool is_prefix, const left_id &left,
 
         ei.lag_adjust = decreaseLag(build, *gg, succs);
 
+        if (is_match_vertex(gg->start, *gg)) {
+            return false; /* should not still be vacuous as lag decreased */
+        }
+
         if (!can_die_early(*gg, EAGER_DIE_BEFORE_LIMIT)) {
             DEBUG_PRINTF("not eager as stuck alive\n");
             return false;
index 186f4d16d0652308e9ddf5d8c99bd92a686d7ac7..f7d49cbe2f3411abf3f85837c2c8c7553fa72a43 100644 (file)
@@ -1234,6 +1234,11 @@ u32 roseQuality(const RoseEngine *t) {
         always_run++;
     }
 
+    if (t->eagerIterOffset) {
+        /* eager prefixes are always run */
+        always_run++;
+    }
+
     const HWLM *ftable = getFLiteralMatcher(t);
     if (ftable) {
         /* TODO: ignore conditional ftables, or ftables beyond smwr region */