]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
limex: fold TESTEOD_REV_FN use into TESTEOD_FN
authorJustin Viiret <justin.viiret@intel.com>
Thu, 1 Sep 2016 06:42:00 +0000 (16:42 +1000)
committerMatthew Barr <matthew.barr@intel.com>
Fri, 28 Oct 2016 03:45:57 +0000 (14:45 +1100)
src/nfa/limex_common_impl.h
src/nfa/limex_runtime_impl.h

index 86dd31037ac2dad0d836acf2acbe5f337a917351..ae0d1da88bdee4e1f74213ec81444ba4252b44d4 100644 (file)
@@ -39,7 +39,6 @@
 #define IMPL_NFA_T          JOIN(struct LimExNFA, SIZE)
 
 #define TESTEOD_FN          JOIN(moNfaTestEod, SIZE)
-#define TESTEOD_REV_FN      JOIN(moNfaRevTestEod, SIZE)
 #define LIMEX_INACCEPT_FN   JOIN(limexInAccept, SIZE)
 #define LIMEX_INANYACCEPT_FN   JOIN(limexInAnyAccept, SIZE)
 #define EXPIRE_ESTATE_FN    JOIN(limexExpireExtendedState, SIZE)
@@ -158,7 +157,8 @@ char PROCESS_ACCEPTS_NOSQUASH_FN(const STATE_T *s,
     return 0;
 }
 
-// Run EOD accepts.
+// Run EOD accepts. Note that repeat_ctrl and repeat_state may be NULL if this
+// LimEx contains no repeat structures.
 static really_inline
 char TESTEOD_FN(const IMPL_NFA_T *limex, const STATE_T *s,
                 const union RepeatControl *repeat_ctrl,
@@ -189,33 +189,6 @@ char TESTEOD_FN(const IMPL_NFA_T *limex, const STATE_T *s,
     return MO_CONTINUE_MATCHING;
 }
 
-static really_inline
-char TESTEOD_REV_FN(const IMPL_NFA_T *limex, const STATE_T *s, u64a offset,
-                    NfaCallback callback, void *context) {
-    assert(limex && s);
-
-    // There may not be any EOD accepts in this NFA.
-    if (!limex->acceptEodCount) {
-        return MO_CONTINUE_MATCHING;
-    }
-
-    STATE_T acceptEodMask = LOAD_FROM_ENG(&limex->acceptAtEOD);
-    STATE_T foundAccepts = AND_STATE(*s, acceptEodMask);
-
-    assert(!limex->repeatCount);
-
-    if (unlikely(ISNONZERO_STATE(foundAccepts))) {
-        const struct NFAAccept *acceptEodTable = getAcceptEodTable(limex);
-        if (PROCESS_ACCEPTS_NOSQUASH_FN(&foundAccepts, acceptEodTable,
-                                        limex->acceptEodCount, offset, callback,
-                                        context)) {
-            return MO_HALT_MATCHING;
-        }
-    }
-
-    return MO_CONTINUE_MATCHING;
-}
-
 // Run accepts corresponding to current state.
 static really_inline
 char REPORTCURRENT_FN(const IMPL_NFA_T *limex, const struct mq *q) {
@@ -391,7 +364,6 @@ char LIMEX_INANYACCEPT_FN(const IMPL_NFA_T *limex, STATE_T state,
 }
 
 #undef TESTEOD_FN
-#undef TESTEOD_REV_FN
 #undef REPORTCURRENT_FN
 #undef EXPIRE_ESTATE_FN
 #undef LIMEX_INACCEPT_FN
index 4f4563889ee0c472e09afa7eda0f6237374a08ef..5bc79c24d4a0e996cc66a65e6fbb0d70655600c3 100644 (file)
@@ -46,7 +46,6 @@
 #define IMPL_NFA_T          JOIN(struct LimExNFA, SIZE)
 
 #define TESTEOD_FN          JOIN(moNfaTestEod, SIZE)
-#define TESTEOD_REV_FN      JOIN(moNfaRevTestEod, SIZE)
 #define INITIAL_FN          JOIN(moNfaInitial, SIZE)
 #define TOP_FN              JOIN(moNfaTop, SIZE)
 #define TOPN_FN             JOIN(moNfaTopN, SIZE)
@@ -927,8 +926,11 @@ char JOIN(LIMEX_API_ROOT, _B_Reverse)(const struct NFA *n, u64a offset,
         REV_STREAM_FN(limex, hbuf, hlen, &ctx, offset);
     }
 
-    if (offset == 0 && ISNONZERO_STATE(ctx.s)) {
-        TESTEOD_REV_FN(limex, &ctx.s, offset, cb, context);
+    if (offset == 0 && limex->acceptEodCount && ISNONZERO_STATE(ctx.s)) {
+        const union RepeatControl *repeat_ctrl = NULL;
+        const char *repeat_state = NULL;
+        TESTEOD_FN(limex, &ctx.s, repeat_ctrl, repeat_state, offset, cb,
+                   context);
     }
 
     // NOTE: return value is unused.
@@ -991,7 +993,6 @@ enum nfa_zombie_status JOIN(LIMEX_API_ROOT, _zombie_status)(
 }
 
 #undef TESTEOD_FN
-#undef TESTEOD_REV_FN
 #undef INITIAL_FN
 #undef TOP_FN
 #undef TOPN_FN