]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
LimEx NFA: no need to zero estate cache in STREAM
authorJustin Viiret <justin.viiret@intel.com>
Mon, 2 Nov 2015 00:57:55 +0000 (11:57 +1100)
committerMatthew Barr <matthew.barr@intel.com>
Tue, 10 Nov 2015 03:36:14 +0000 (14:36 +1100)
We believe that we have solved the issues that required zeroing of the
exception state in STREAM_FN and REV_STREAM_FN nowadays.

src/nfa/limex_exceptional.h
src/nfa/limex_native.c
src/nfa/limex_runtime_impl.h

index dcc302d4585a354b2f35019867e025d696e6fec8..26c5e5a5f55ca0f9deac3a10f9838a3c30c1ae27 100644 (file)
@@ -218,7 +218,8 @@ int PE_FN(STATE_ARG, ESTATE_ARG, u32 diffmask, STATE_T *succ,
     if (EQ_STATE(estate, LOAD_STATE(&ctx->cached_estate))) {
         DEBUG_PRINTF("using cached succ from previous state\n");
         STORE_STATE(succ, OR_STATE(LOAD_STATE(succ), LOAD_STATE(&ctx->cached_esucc)));
-        if (ctx->cached_reports) {
+        if (ctx->cached_reports && (flags & CALLBACK_OUTPUT)) {
+            DEBUG_PRINTF("firing cached reports from previous state\n");
             if (unlikely(limexRunReports(ctx->cached_reports, ctx->callback,
                                          ctx->context, offset)
                         == MO_HALT_MATCHING)) {
index 675c18bd03eaacc4b89b7f60f2d3ee3ae344e19c..49c101999a49fd4680571d7319ab52f41c0d9d86 100644 (file)
@@ -83,7 +83,8 @@ int processExceptional32(u32 s, u32 estate, UNUSED u32 diffmask, u32 *succ,
     if (estate == ctx->cached_estate) {
         DEBUG_PRINTF("using cached succ from previous state\n");
         *succ |= ctx->cached_esucc;
-        if (ctx->cached_reports) {
+        if (ctx->cached_reports && (flags & CALLBACK_OUTPUT)) {
+            DEBUG_PRINTF("firing cached reports from previous state\n");
             if (unlikely(limexRunReports(ctx->cached_reports, ctx->callback,
                                          ctx->context, offset)
                         == MO_HALT_MATCHING)) {
index 703a7d19207be443d45d00f1a1e2ce944ef61cc5..6ef3bae9887a9ca4e775157f1e7b67f28ab79250 100644 (file)
@@ -179,7 +179,6 @@ char STREAM_FN(const IMPL_NFA_T *limex, const u8 *input, size_t length,
     assert(ISALIGNED_CL(ctx));
     assert(ISALIGNED_CL(&ctx->s));
     STATE_T s = LOAD_STATE(&ctx->s);
-    STORE_STATE(&ctx->cached_estate, ZERO_STATE); /* TODO: understand why this is required */
 
     /* assert(ISALIGNED_16(exceptions)); */
     /* assert(ISALIGNED_16(reach)); */
@@ -305,7 +304,6 @@ char REV_STREAM_FN(const IMPL_NFA_T *limex, const u8 *input, size_t length,
     const ReportID *exReports = getExReports(limex);
     const u32 *exceptionMap = limex->exceptionMap;
     STATE_T s = LOAD_STATE(&ctx->s);
-    STORE_STATE(&ctx->cached_estate, ZERO_STATE); /* TODO: understand why this is required */
 
     /* assert(ISALIGNED_16(exceptions)); */
     /* assert(ISALIGNED_16(reach)); */