]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
Don't use depth for in-flight check
authorJustin Viiret <justin.viiret@intel.com>
Thu, 7 Jan 2016 22:58:20 +0000 (09:58 +1100)
committerMatthew Barr <matthew.barr@intel.com>
Tue, 1 Mar 2016 00:23:11 +0000 (11:23 +1100)
src/rose/block.c
src/rose/match.h
src/rose/stream.c

index cfcb8341658d2605c92835c818899952bdf7c8f8..b3833d4b54fe9cf3225f9bc089ada680ac27dbd8 100644 (file)
@@ -233,7 +233,7 @@ void roseBlockExec_i(const struct RoseEngine *t, struct hs_scratch *scratch,
     if (ftable) {
         DEBUG_PRINTF("ftable fd=%u fmd %u\n", t->floatingDistance,
             t->floatingMinDistance);
-        if (t->noFloatingRoots && tctxt->depth == 1) {
+        if (t->noFloatingRoots && !roseHasInFlightMatches(t, state, scratch)) {
             DEBUG_PRINTF("skip FLOATING: no inflight matches\n");
             goto exit;
         }
index 19a07c9a1a4ae0935a314a52d8cecbe62d70d193..59d83a42626fb97e4b7039436315e4afaeb076b8 100644 (file)
@@ -299,4 +299,25 @@ void roseFlushLastByteHistory(const struct RoseEngine *t, u8 *state,
     mmbit_sparse_iter_unset(role_state, numStates, it, si_state);
 }
 
+static rose_inline
+int roseHasInFlightMatches(const struct RoseEngine *t, u8 *state,
+                           const struct hs_scratch *scratch) {
+    if (scratch->al_log_sum) {
+        DEBUG_PRINTF("anchored literals in log\n");
+        return 1;
+    }
+
+    if (scratch->tctxt.filledDelayedSlots) {
+        DEBUG_PRINTF("delayed literal\n");
+        return 1;
+    }
+
+    if (mmbit_any(getRoleState(state), t->rolesWithStateCount)) {
+        DEBUG_PRINTF("role state is set\n");
+        return 1;
+    }
+
+    return 0;
+}
+
 #endif
index ab23346a40a2733f050dd62177927ad3d3110ffc..ae119bcf64d8cb210e327b9fab8c91c78c580b97 100644 (file)
@@ -502,7 +502,7 @@ void roseStreamExec(const struct RoseEngine *t, u8 *state,
 
     const struct HWLM *ftable = getFLiteralMatcher(t);
     if (ftable) {
-        if (t->noFloatingRoots && tctxt->depth == 1) {
+        if (t->noFloatingRoots && !roseHasInFlightMatches(t, state, scratch)) {
             DEBUG_PRINTF("skip FLOATING: no inflight matches\n");
             goto flush_delay_and_exit;
         }