From b5e290e98508c58d699bbc957e44ef2b0bfe315d Mon Sep 17 00:00:00 2001 From: Justin Viiret Date: Mon, 2 Nov 2015 11:57:55 +1100 Subject: [PATCH] LimEx NFA: no need to zero estate cache in STREAM 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 | 3 ++- src/nfa/limex_native.c | 3 ++- src/nfa/limex_runtime_impl.h | 2 -- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/nfa/limex_exceptional.h b/src/nfa/limex_exceptional.h index dcc302d4..26c5e5a5 100644 --- a/src/nfa/limex_exceptional.h +++ b/src/nfa/limex_exceptional.h @@ -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)) { diff --git a/src/nfa/limex_native.c b/src/nfa/limex_native.c index 675c18bd..49c10199 100644 --- a/src/nfa/limex_native.c +++ b/src/nfa/limex_native.c @@ -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)) { diff --git a/src/nfa/limex_runtime_impl.h b/src/nfa/limex_runtime_impl.h index 703a7d19..6ef3bae9 100644 --- a/src/nfa/limex_runtime_impl.h +++ b/src/nfa/limex_runtime_impl.h @@ -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)); */