]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
nfa: unify NfaCallback and SomNfaCallback
authorJustin Viiret <justin.viiret@intel.com>
Fri, 24 Jun 2016 06:22:43 +0000 (16:22 +1000)
committerMatthew Barr <matthew.barr@intel.com>
Fri, 8 Jul 2016 01:01:56 +0000 (11:01 +1000)
Use just one callback type, with both start and end offsets.

29 files changed:
src/nfa/callback.h
src/nfa/castle.c
src/nfa/gough.c
src/nfa/gough.h
src/nfa/lbr.c
src/nfa/lbr_common_impl.h
src/nfa/limex.h
src/nfa/limex_common_impl.h
src/nfa/limex_runtime.h
src/nfa/limex_runtime_impl.h
src/nfa/mcclellan.c
src/nfa/mcclellan.h
src/nfa/mpv.c
src/nfa/nfa_api.h
src/nfa/nfa_api_dispatch.c
src/nfa/nfa_api_queue.h
src/nfa/tamarama.c
src/nfa/tamarama.h
src/rose/catchup.c
src/rose/match.c
src/rose/match.h
src/rose/program_runtime.h
src/rose/rose.h
src/rose/rose_build_bytecode.cpp
src/rose/rose_internal.h
src/runtime.c
src/som/som_runtime.c
unit/internal/lbr.cpp
unit/internal/limex_nfa.cpp

index dfcd1b9f2f8fbaead929400da84d4ffe4ce78a36..0284f1d5392bed5d4830ce91fc0c25dd7ae0c6ea 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Intel Corporation
+ * Copyright (c) 2015-2016, Intel Corporation
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
  * are 0, which means 'stop running the engine' or non-zero, which means
  * 'continue matching'.
  */
-typedef int (*NfaCallback)(u64a offset, ReportID id, void *context);
-
-/** \brief The type for an NFA callback which also tracks start of match.
- *
- * see \ref NfaCallback
- */
-typedef int (*SomNfaCallback)(u64a from_offset, u64a to_offset, ReportID id,
-                              void *context);
+typedef int (*NfaCallback)(u64a from_offset, u64a to_offset, ReportID id,
+                           void *context);
 
 /**
  * standard \ref NfaCallback return value indicating that engine execution
index bfdcf6b54f66fa81c0944cccf37e8c8debacc660..6a72ae3168ea725160c5ac9234a7867384f66e4e 100644 (file)
@@ -98,7 +98,7 @@ char subCastleReportCurrent(const struct Castle *c, struct mq *q,
     if (match == REPEAT_MATCH) {
         DEBUG_PRINTF("firing match at %llu for sub %u, report %u\n", offset,
                      subIdx, sub->report);
-        if (q->cb(offset, sub->report, q->context) == MO_HALT_MATCHING) {
+        if (q->cb(0, offset, sub->report, q->context) == MO_HALT_MATCHING) {
             return MO_HALT_MATCHING;
         }
     }
@@ -457,7 +457,7 @@ char subCastleFireMatch(const struct Castle *c, const void *full_state,
          i = mmbit_iterate(matching, c->numRepeats, i)) {
         const struct SubCastle *sub = getSubCastle(c, i);
         DEBUG_PRINTF("firing match at %llu for sub %u\n", offset, i);
-        if (cb(offset, sub->report, ctx) == MO_HALT_MATCHING) {
+        if (cb(0, offset, sub->report, ctx) == MO_HALT_MATCHING) {
             DEBUG_PRINTF("caller told us to halt\n");
             return MO_HALT_MATCHING;
         }
index 3b7a115d9363b7131c70dbf0b01b10973945eeb5..520aca932d7417db302ca6d10f3b733b63ec063a 100644 (file)
@@ -110,7 +110,7 @@ u64a expandSomValue(u32 comp_slot_width, u64a curr_offset,
 }
 
 static really_inline
-char doReports(SomNfaCallback cb, void *ctxt, const struct mcclellan *m,
+char doReports(NfaCallback cb, void *ctxt, const struct mcclellan *m,
                const struct gough_som_info *som, u16 s, u64a loc,
                char eod, u16 * const cached_accept_state,
                u32 * const cached_accept_id, u32 * const cached_accept_som) {
@@ -307,7 +307,7 @@ u16 goughEnableStarts(const struct mcclellan *m, u16 s, u64a som_offset,
 static really_inline
 char goughExec16_i(const struct mcclellan *m, struct gough_som_info *som,
                    u16 *state, const u8 *buf, size_t len, u64a offAdj,
-                   SomNfaCallback cb, void *ctxt, const u8 **c_final,
+                   NfaCallback cb, void *ctxt, const u8 **c_final,
                    enum MatchMode mode) {
     assert(ISALIGNED_N(state, 2));
 
@@ -461,7 +461,7 @@ with_accel:
 static really_inline
 char goughExec8_i(const struct mcclellan *m, struct gough_som_info *som,
                   u8 *state, const u8 *buf, size_t len, u64a offAdj,
-                  SomNfaCallback cb, void *ctxt, const u8 **c_final,
+                  NfaCallback cb, void *ctxt, const u8 **c_final,
                   enum MatchMode mode) {
     u8 s = *state;
     const u8 *c = buf, *c_end = buf + len;
@@ -595,7 +595,7 @@ with_accel:
 static never_inline
 char goughExec8_i_ni(const struct mcclellan *m, struct gough_som_info *som,
                      u8 *state, const u8 *buf, size_t len, u64a offAdj,
-                     SomNfaCallback cb, void *ctxt, const u8 **final_point,
+                     NfaCallback cb, void *ctxt, const u8 **final_point,
                      enum MatchMode mode) {
     return goughExec8_i(m, som, state, buf, len, offAdj, cb, ctxt, final_point,
                         mode);
@@ -604,7 +604,7 @@ char goughExec8_i_ni(const struct mcclellan *m, struct gough_som_info *som,
 static never_inline
 char goughExec16_i_ni(const struct mcclellan *m, struct gough_som_info *som,
                       u16 *state, const u8 *buf, size_t len, u64a offAdj,
-                      SomNfaCallback cb, void *ctxt, const u8 **final_point,
+                      NfaCallback cb, void *ctxt, const u8 **final_point,
                       enum MatchMode mode) {
     return goughExec16_i(m, som, state, buf, len, offAdj, cb, ctxt, final_point,
                          mode);
@@ -622,7 +622,7 @@ const struct gough_som_info *getSomInfoConst(const char *state_base) {
 
 static really_inline
 char nfaExecGough8_Q2i(const struct NFA *n, u64a offset, const u8 *buffer,
-                      const u8 *hend, SomNfaCallback cb, void *context,
+                      const u8 *hend, NfaCallback cb, void *context,
                       struct mq *q, s64a end, enum MatchMode mode) {
     DEBUG_PRINTF("enter\n");
     struct gough_som_info *som = getSomInfo(q->state);
@@ -755,7 +755,7 @@ char nfaExecGough8_Q2i(const struct NFA *n, u64a offset, const u8 *buffer,
 
 static really_inline
 char nfaExecGough16_Q2i(const struct NFA *n, u64a offset, const u8 *buffer,
-                       const u8 *hend, SomNfaCallback cb, void *context,
+                       const u8 *hend, NfaCallback cb, void *context,
                        struct mq *q, s64a end, enum MatchMode mode) {
     struct gough_som_info *som = getSomInfo(q->state);
     assert(n->type == GOUGH_NFA_16);
@@ -887,7 +887,7 @@ char nfaExecGough16_Q2i(const struct NFA *n, u64a offset, const u8 *buffer,
 char nfaExecGough8_Q(const struct NFA *n, struct mq *q, s64a end) {
     u64a offset = q->offset;
     const u8 *buffer = q->buffer;
-    SomNfaCallback cb = q->som_cb;
+    NfaCallback cb = q->cb;
     void *context = q->context;
     assert(n->type == GOUGH_NFA_8);
     const u8 *hend = q->history + q->hlength;
@@ -899,7 +899,7 @@ char nfaExecGough8_Q(const struct NFA *n, struct mq *q, s64a end) {
 char nfaExecGough16_Q(const struct NFA *n, struct mq *q, s64a end) {
     u64a offset = q->offset;
     const u8 *buffer = q->buffer;
-    SomNfaCallback cb = q->som_cb;
+    NfaCallback cb = q->cb;
     void *context = q->context;
     assert(n->type == GOUGH_NFA_16);
     const u8 *hend = q->history + q->hlength;
@@ -911,7 +911,7 @@ char nfaExecGough16_Q(const struct NFA *n, struct mq *q, s64a end) {
 char nfaExecGough8_Q2(const struct NFA *n, struct mq *q, s64a end) {
     u64a offset = q->offset;
     const u8 *buffer = q->buffer;
-    SomNfaCallback cb = q->som_cb;
+    NfaCallback cb = q->cb;
     void *context = q->context;
     assert(n->type == GOUGH_NFA_8);
     const u8 *hend = q->history + q->hlength;
@@ -923,7 +923,7 @@ char nfaExecGough8_Q2(const struct NFA *n, struct mq *q, s64a end) {
 char nfaExecGough16_Q2(const struct NFA *n, struct mq *q, s64a end) {
     u64a offset = q->offset;
     const u8 *buffer = q->buffer;
-    SomNfaCallback cb = q->som_cb;
+    NfaCallback cb = q->cb;
     void *context = q->context;
     assert(n->type == GOUGH_NFA_16);
     const u8 *hend = q->history + q->hlength;
@@ -935,7 +935,7 @@ char nfaExecGough16_Q2(const struct NFA *n, struct mq *q, s64a end) {
 char nfaExecGough8_QR(const struct NFA *n, struct mq *q, ReportID report) {
     u64a offset = q->offset;
     const u8 *buffer = q->buffer;
-    SomNfaCallback cb = q->som_cb;
+    NfaCallback cb = q->cb;
     void *context = q->context;
     assert(n->type == GOUGH_NFA_8);
     const u8 *hend = q->history + q->hlength;
@@ -952,7 +952,7 @@ char nfaExecGough8_QR(const struct NFA *n, struct mq *q, ReportID report) {
 char nfaExecGough16_QR(const struct NFA *n, struct mq *q, ReportID report) {
     u64a offset = q->offset;
     const u8 *buffer = q->buffer;
-    SomNfaCallback cb = q->som_cb;
+    NfaCallback cb = q->cb;
     void *context = q->context;
     assert(n->type == GOUGH_NFA_16);
     const u8 *hend = q->history + q->hlength;
@@ -994,7 +994,7 @@ char nfaExecGough16_initCompressedState(const struct NFA *nfa, u64a offset,
 
 char nfaExecGough8_reportCurrent(const struct NFA *n, struct mq *q) {
     const struct mcclellan *m = (const struct mcclellan *)getImplNfa(n);
-    SomNfaCallback cb = q->som_cb;
+    NfaCallback cb = q->cb;
     void *ctxt = q->context;
     u8 s = *(u8 *)q->state;
     u64a offset = q_cur_offset(q);
@@ -1016,7 +1016,7 @@ char nfaExecGough8_reportCurrent(const struct NFA *n, struct mq *q) {
 
 char nfaExecGough16_reportCurrent(const struct NFA *n, struct mq *q) {
     const struct mcclellan *m = (const struct mcclellan *)getImplNfa(n);
-    SomNfaCallback cb = q->som_cb;
+    NfaCallback cb = q->cb;
     void *ctxt = q->context;
     u16 s = *(u16 *)q->state;
     const struct mstate_aux *aux = get_aux(m, s);
@@ -1059,7 +1059,7 @@ char nfaExecGough16_inAnyAccept(const struct NFA *n, struct mq *q) {
 static
 char goughCheckEOD(const struct NFA *nfa, u16 s,
                    const struct gough_som_info *som,
-                   u64a offset, SomNfaCallback cb, void *ctxt) {
+                   u64a offset, NfaCallback cb, void *ctxt) {
     const struct mcclellan *m = (const struct mcclellan *)getImplNfa(nfa);
     const struct mstate_aux *aux = get_aux(m, s);
 
@@ -1070,21 +1070,19 @@ char goughCheckEOD(const struct NFA *nfa, u16 s,
 }
 
 char nfaExecGough8_testEOD(const struct NFA *nfa, const char *state,
-                          UNUSED const char *streamState, u64a offset,
-                          UNUSED NfaCallback callback,
-                          SomNfaCallback som_callback, void *context) {
+                           UNUSED const char *streamState, u64a offset,
+                           NfaCallback callback, void *context) {
     const struct gough_som_info *som = getSomInfoConst(state);
-    return goughCheckEOD(nfa, *(const u8 *)state, som, offset, som_callback,
+    return goughCheckEOD(nfa, *(const u8 *)state, som, offset, callback,
                          context);
 }
 
 char nfaExecGough16_testEOD(const struct NFA *nfa, const char *state,
-                           UNUSED const char *streamState, u64a offset,
-                           UNUSED NfaCallback callback,
-                           SomNfaCallback som_callback, void *context) {
+                            UNUSED const char *streamState, u64a offset,
+                            NfaCallback callback, void *context) {
     assert(ISALIGNED_N(state, 8));
     const struct gough_som_info *som = getSomInfoConst(state);
-    return goughCheckEOD(nfa, *(const u16 *)state, som, offset, som_callback,
+    return goughCheckEOD(nfa, *(const u16 *)state, som, offset, callback,
                          context);
 }
 
index 1a7dbd74de19a630ad261ab3431e12e58a148c29..a7f4889232eb72ef9ad26d9d5eabef1a44522444 100644 (file)
@@ -39,8 +39,7 @@ struct mq;
 
 char nfaExecGough8_testEOD(const struct NFA *nfa, const char *state,
                            const char *streamState, u64a offset,
-                           NfaCallback callback, SomNfaCallback som_cb,
-                           void *context);
+                           NfaCallback callback, void *context);
 char nfaExecGough8_Q(const struct NFA *n, struct mq *q, s64a end);
 char nfaExecGough8_Q2(const struct NFA *n, struct mq *q, s64a end);
 char nfaExecGough8_QR(const struct NFA *n, struct mq *q, ReportID report);
@@ -62,8 +61,7 @@ char nfaExecGough8_expandState(const struct NFA *nfa, void *dest,
 
 char nfaExecGough16_testEOD(const struct NFA *nfa, const char *state,
                             const char *streamState, u64a offset,
-                            NfaCallback callback, SomNfaCallback som_cb,
-                            void *context);
+                            NfaCallback callback, void *context);
 char nfaExecGough16_Q(const struct NFA *n, struct mq *q, s64a end);
 char nfaExecGough16_Q2(const struct NFA *n, struct mq *q, s64a end);
 char nfaExecGough16_QR(const struct NFA *n, struct mq *q, ReportID report);
index 0d69cc2ab3ab6d9146567ab0d8c1defc19d66122..07e59239206f1a02eedf0cb67ee3698b20068773 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Intel Corporation
+ * Copyright (c) 2015-2016, Intel Corporation
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -293,7 +293,7 @@ char lbrMatchLoop(const struct lbr_common *l, const u64a begin, const u64a end,
         }
 
         DEBUG_PRINTF("firing match at %llu\n", i);
-        if (cb(i, l->report, ctx) == MO_HALT_MATCHING) {
+        if (cb(0, i, l->report, ctx) == MO_HALT_MATCHING) {
             return MO_HALT_MATCHING;
         }
     }
index 4fb8f62a58cd0e613fcc5ca7a42316bad3133344..5ae35431e43d9b0e9847f46c7a5d5a0d11fe2569 100644 (file)
@@ -72,7 +72,7 @@ char JOIN(ENGINE_EXEC_NAME, _reportCurrent)(const struct NFA *nfa,
     const struct lbr_common *l = getImplNfa(nfa);
     u64a offset = q_cur_offset(q);
     DEBUG_PRINTF("firing match %u at %llu\n", l->report, offset);
-    q->cb(offset, l->report, q->context);
+    q->cb(0, offset, l->report, q->context);
     return 0;
 }
 
@@ -215,7 +215,7 @@ char JOIN(ENGINE_EXEC_NAME, _Q_i)(const struct NFA *nfa, struct mq *q,
 
     if (q->report_current) {
         DEBUG_PRINTF("report_current: fire match at %llu\n", q_cur_offset(q));
-        int rv = q->cb(q_cur_offset(q), l->report, q->context);
+        int rv = q->cb(0, q_cur_offset(q), l->report, q->context);
         q->report_current = 0;
         if (rv == MO_HALT_MATCHING) {
             return MO_HALT_MATCHING;
index 9266b5dee1c2476377664ceaa3cd743a863adf99..ad53503c17472d6ed3f364c98f2c6979152d9996 100644 (file)
@@ -54,8 +54,7 @@ extern "C"
 #define GENERATE_NFA_DECL(gf_name)                                             \
     char gf_name##_testEOD(const struct NFA *nfa, const char *state,           \
                            const char *streamState, u64a offset,               \
-                           NfaCallback callback, SomNfaCallback som_cb,        \
-                           void *context);                                     \
+                           NfaCallback callback, void *context);               \
     char gf_name##_Q(const struct NFA *n, struct mq *q, s64a end);             \
     char gf_name##_Q2(const struct NFA *n, struct mq *q, s64a end);            \
     char gf_name##_QR(const struct NFA *n, struct mq *q, ReportID report);     \
index 68e0c0ade2c70ca27329d9a4a2718c67002b525c..9523b0739069343c3fc4610d511551e450bd10e8 100644 (file)
@@ -119,7 +119,7 @@ char PROCESS_ACCEPTS_FN(const IMPL_NFA_T *limex, STATE_T *s,
         if (TESTBIT_STATE(s, a->state)) {
             DEBUG_PRINTF("state %u is on, firing report id=%u, offset=%llu\n",
                          a->state, a->externalId, offset);
-            int rv = callback(offset, a->externalId, context);
+            int rv = callback(0, offset, a->externalId, context);
             if (unlikely(rv == MO_HALT_MATCHING)) {
                 return 1;
             }
@@ -150,7 +150,7 @@ char PROCESS_ACCEPTS_NOSQUASH_FN(const STATE_T *s,
         if (TESTBIT_STATE(s, a->state)) {
             DEBUG_PRINTF("state %u is on, firing report id=%u, offset=%llu\n",
                          a->state, a->externalId, offset);
-            int rv = callback(offset, a->externalId, context);
+            int rv = callback(0, offset, a->externalId, context);
             if (unlikely(rv == MO_HALT_MATCHING)) {
                 return 1;
             }
index 778d376df6dfe4db2ce3f3d1457f247089a125b0..70601e27245675d1ff35b1d9a5470adef5cb35a7 100644 (file)
@@ -130,7 +130,7 @@ int limexRunReports(const ReportID *reports, NfaCallback callback,
     for (; *reports != MO_INVALID_IDX; ++reports) {
         DEBUG_PRINTF("firing report for id %u at offset %llu\n",
                      *reports, offset);
-        int rv = callback(offset, *reports, context);
+        int rv = callback(0, offset, *reports, context);
         if (rv == MO_HALT_MATCHING) {
             return MO_HALT_MATCHING;
         }
index 19a5ebd3ee4c132958e9a5ac7316dd3ea4c24842..e6c1c06faf5032210629a81686ae4e257f858a78 100644 (file)
@@ -809,10 +809,8 @@ char JOIN(LIMEX_API_ROOT, _QR)(const struct NFA *n, struct mq *q,
 }
 
 char JOIN(LIMEX_API_ROOT, _testEOD)(const struct NFA *n, const char *state,
-                                       const char *streamState, u64a offset,
-                                       NfaCallback callback,
-                                       UNUSED SomNfaCallback som_callback,
-                                       void *context) {
+                                    const char *streamState, u64a offset,
+                                    NfaCallback callback, void *context) {
     assert(n && state);
 
     const IMPL_NFA_T *limex = getImplNfa(n);
index ac26c6a103f5382d632415208911e9e171e50c38..88da27c0ff2a05f1d2fbece2eeb1fa1b4f1ba1b8 100644 (file)
 
 static really_inline
 char doComplexReport(NfaCallback cb, void *ctxt, const struct mcclellan *m,
-                     u16 s, u64a loc, char eod, u16 * const cached_accept_state,
-                     u32 * const cached_accept_id) {
+                     u16 s, u64a loc, char eod, u16 *const cached_accept_state,
+                     u32 *const cached_accept_id) {
     DEBUG_PRINTF("reporting state = %hu, loc=%llu, eod %hhu\n",
                  (u16)(s & STATE_MASK), loc, eod);
 
     if (!eod && s == *cached_accept_state) {
-        if (cb(loc, *cached_accept_id, ctxt) == MO_HALT_MATCHING) {
+        if (cb(0, loc, *cached_accept_id, ctxt) == MO_HALT_MATCHING) {
             return MO_HALT_MATCHING; /* termination requested */
         }
 
@@ -71,7 +71,7 @@ char doComplexReport(NfaCallback cb, void *ctxt, const struct mcclellan *m,
         *cached_accept_id = rl->report[0];
 
         DEBUG_PRINTF("reporting %u\n", rl->report[0]);
-        if (cb(loc, rl->report[0], ctxt) == MO_HALT_MATCHING) {
+        if (cb(0, loc, rl->report[0], ctxt) == MO_HALT_MATCHING) {
             return MO_HALT_MATCHING; /* termination requested */
         }
 
@@ -80,7 +80,7 @@ char doComplexReport(NfaCallback cb, void *ctxt, const struct mcclellan *m,
 
     for (u32 i = 0; i < count; i++) {
         DEBUG_PRINTF("reporting %u\n", rl->report[i]);
-        if (cb(loc, rl->report[i], ctxt) == MO_HALT_MATCHING) {
+        if (cb(0, loc, rl->report[i], ctxt) == MO_HALT_MATCHING) {
             return MO_HALT_MATCHING; /* termination requested */
         }
     }
@@ -146,7 +146,7 @@ without_accel:
 
             if (single) {
                 DEBUG_PRINTF("reporting %u\n", m->arb_report);
-                if (cb(loc, m->arb_report, ctxt) == MO_HALT_MATCHING) {
+                if (cb(0, loc, m->arb_report, ctxt) == MO_HALT_MATCHING) {
                     return MO_HALT_MATCHING; /* termination requested */
                 }
             } else if (doComplexReport(cb, ctxt, m, s & STATE_MASK, loc, 0,
@@ -186,7 +186,7 @@ with_accel:
 
             if (single) {
                 DEBUG_PRINTF("reporting %u\n", m->arb_report);
-                if (cb(loc, m->arb_report, ctxt) == MO_HALT_MATCHING) {
+                if (cb(0, loc, m->arb_report, ctxt) == MO_HALT_MATCHING) {
                     return MO_HALT_MATCHING; /* termination requested */
                 }
             } else if (doComplexReport(cb, ctxt, m, s & STATE_MASK, loc, 0,
@@ -328,7 +328,7 @@ without_accel:
             u64a loc = (c - 1) - buf + offAdj + 1;
             if (single) {
                 DEBUG_PRINTF("reporting %u\n", m->arb_report);
-                if (cb(loc, m->arb_report, ctxt) == MO_HALT_MATCHING) {
+                if (cb(0, loc, m->arb_report, ctxt) == MO_HALT_MATCHING) {
                     return MO_HALT_MATCHING;
                 }
             } else if (doComplexReport(cb, ctxt, m, s, loc, 0,
@@ -360,7 +360,7 @@ with_accel:
                 u64a loc = (c - 1) - buf + offAdj + 1;
                 if (single) {
                     DEBUG_PRINTF("reporting %u\n", m->arb_report);
-                    if (cb(loc, m->arb_report, ctxt) == MO_HALT_MATCHING) {
+                    if (cb(0, loc, m->arb_report, ctxt) == MO_HALT_MATCHING) {
                         return MO_HALT_MATCHING;
                     }
                 } else if (doComplexReport(cb, ctxt, m, s, loc, 0,
@@ -475,7 +475,7 @@ char nfaExecMcClellan16_Q2i(const struct NFA *n, u64a offset, const u8 *buffer,
         int rv;
         if (single) {
             DEBUG_PRINTF("reporting %u\n", m->arb_report);
-            rv = cb(q_cur_offset(q), m->arb_report, context);
+            rv = cb(0, q_cur_offset(q), m->arb_report, context);
         } else {
             u32 cached_accept_id = 0;
             u16 cached_accept_state = 0;
@@ -632,7 +632,7 @@ char nfaExecMcClellan8_Q2i(const struct NFA *n, u64a offset, const u8 *buffer,
         int rv;
         if (single) {
             DEBUG_PRINTF("reporting %u\n", m->arb_report);
-            rv = cb(q_cur_offset(q), m->arb_report, context);
+            rv = cb(0, q_cur_offset(q), m->arb_report, context);
         } else {
             u32 cached_accept_id = 0;
             u16 cached_accept_state = 0;
@@ -836,7 +836,7 @@ char nfaExecMcClellan8_reportCurrent(const struct NFA *n, struct mq *q) {
     if (s >= m->accept_limit_8) {
         if (single) {
             DEBUG_PRINTF("reporting %u\n", m->arb_report);
-            cb(offset, m->arb_report, ctxt);
+            cb(0, offset, m->arb_report, ctxt);
         } else {
             u32 cached_accept_id = 0;
             u16 cached_accept_state = 0;
@@ -864,7 +864,7 @@ char nfaExecMcClellan16_reportCurrent(const struct NFA *n, struct mq *q) {
     if (aux->accept) {
         if (single) {
             DEBUG_PRINTF("reporting %u\n", m->arb_report);
-            cb(offset, m->arb_report, ctxt);
+            cb(0, offset, m->arb_report, ctxt);
         } else {
             u32 cached_accept_id = 0;
             u16 cached_accept_state = 0;
@@ -1073,17 +1073,15 @@ void nfaExecMcClellan16_SimpStream(const struct NFA *nfa, char *state,
 }
 
 char nfaExecMcClellan8_testEOD(const struct NFA *nfa, const char *state,
-                               UNUSED const char *streamState,
-                               u64a offset, NfaCallback callback,
-                               UNUSED SomNfaCallback som_cb, void *context) {
+                               UNUSED const char *streamState, u64a offset,
+                               NfaCallback callback, void *context) {
     return mcclellanCheckEOD(nfa, *(const u8 *)state, offset, callback,
                              context);
 }
 
 char nfaExecMcClellan16_testEOD(const struct NFA *nfa, const char *state,
-                                UNUSED const char *streamState,
-                                u64a offset, NfaCallback callback,
-                                UNUSED SomNfaCallback som_cb, void *context) {
+                                UNUSED const char *streamState, u64a offset,
+                                NfaCallback callback, void *context) {
     assert(ISALIGNED_N(state, 2));
     return mcclellanCheckEOD(nfa, *(const u16 *)state, offset, callback,
                              context);
index 677265f5b3df6f2d77ca58c59a3c3c7f25ca00ec..9c6b3eecb16cb2278a65d18a33e27560295f446b 100644 (file)
@@ -39,8 +39,7 @@ struct NFA;
 
 char nfaExecMcClellan8_testEOD(const struct NFA *nfa, const char *state,
                                const char *streamState, u64a offset,
-                               NfaCallback callback, SomNfaCallback som_cb,
-                               void *context);
+                               NfaCallback callback, void *context);
 char nfaExecMcClellan8_Q(const struct NFA *n, struct mq *q, s64a end);
 char nfaExecMcClellan8_Q2(const struct NFA *n, struct mq *q, s64a end);
 char nfaExecMcClellan8_QR(const struct NFA *n, struct mq *q, ReportID report);
@@ -63,8 +62,7 @@ char nfaExecMcClellan8_expandState(const struct NFA *nfa, void *dest,
 
 char nfaExecMcClellan16_testEOD(const struct NFA *nfa, const char *state,
                                 const char *streamState, u64a offset,
-                                NfaCallback callback, SomNfaCallback som_cb,
-                                void *context);
+                                NfaCallback callback, void *context);
 char nfaExecMcClellan16_Q(const struct NFA *n, struct mq *q, s64a end);
 char nfaExecMcClellan16_Q2(const struct NFA *n, struct mq *q, s64a end);
 char nfaExecMcClellan16_QR(const struct NFA *n, struct mq *q, ReportID report);
index 4bae7b186b8bdc97eec1d0532070f12b10fb35a7..c6c8cb88f593a6911f6c354cc67a5b49b5f0cccc 100644 (file)
@@ -131,7 +131,8 @@ char processReports(const struct mpv *m, u8 *reporters,
                     rl_count++;
                 }
 
-                if (cb(report_offset, curr->report, ctxt) == MO_HALT_MATCHING) {
+                if (cb(0, report_offset, curr->report, ctxt) ==
+                    MO_HALT_MATCHING) {
                     DEBUG_PRINTF("bailing\n");
                     return MO_HALT_MATCHING;
                 }
@@ -180,7 +181,7 @@ char processReportsForRange(const struct mpv *m, u8 *reporters,
 
     for (size_t i = 2; i <= length; i++) {
         for (u32 j = 0; j < rl_count; j++) {
-            if (cb(first_offset + i, rl[j], ctxt) == MO_HALT_MATCHING) {
+            if (cb(0, first_offset + i, rl[j], ctxt) == MO_HALT_MATCHING) {
                 DEBUG_PRINTF("bailing\n");
                 return MO_HALT_MATCHING;
             }
index 3ef6dfca90aa510bf247499912da3f8164a2d261..9e0b6f89d9ede005a1d382e5d10458dd2f58afb7 100644 (file)
@@ -225,6 +225,9 @@ char nfaQueueExecRose(const struct NFA *nfa, struct mq *q, ReportID report);
  * Runs an NFA in reverse from (buf + buflen) to buf and then from (hbuf + hlen)
  * to hbuf (main buffer and history buffer).
  *
+ * Note: provides the match location as the "end" offset when the callback is
+ * called.
+ *
  * @param nfa engine to run
  * @param offset base offset of buf
  * @param buf main buffer
@@ -249,7 +252,6 @@ char nfaBlockExecReverse(const struct NFA *nfa, u64a offset, const u8 *buf,
  *        (including br region)
  * @param offset the offset to return (via the callback) with each match
  * @param callback the callback to call for each match raised
- * @param som_cb the callback to call for each match raised (Haig)
  * @param context context pointer passed to each callback
  *
  * @return @ref MO_HALT_MATCHING if the user instructed us to halt, otherwise
@@ -257,8 +259,7 @@ char nfaBlockExecReverse(const struct NFA *nfa, u64a offset, const u8 *buf,
  */
 char nfaCheckFinalState(const struct NFA *nfa, const char *state,
                         const char *streamState, u64a offset,
-                        NfaCallback callback, SomNfaCallback som_cb,
-                        void *context);
+                        NfaCallback callback, void *context);
 
 /**
  * Indicates if an engine is a zombie.
index b9c9f2ea7a6a7ce052bd4ddab560403fc42a5fa7..789c3014413c7ddfc1ca060019910a03942a920c 100644 (file)
 
 char nfaCheckFinalState(const struct NFA *nfa, const char *state,
                         const char *streamState, u64a offset,
-                        NfaCallback callback, SomNfaCallback som_cb,
-                        void *context) {
+                        NfaCallback callback, void *context) {
     assert(ISALIGNED_CL(nfa) && ISALIGNED_CL(getImplNfa(nfa)));
 
     // Caller should avoid calling us if we can never produce matches.
     assert(nfaAcceptsEod(nfa));
 
     DISPATCH_BY_NFA_TYPE(_testEOD(nfa, state, streamState, offset, callback,
-                                  som_cb, context));
+                                  context));
     return 0;
 }
 
index 59c18fcaefee022c7f2dc3e8933a2149ba33e332..e3579a7ee2aaeaa8515f9f10196bfea61e87c710 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Intel Corporation
+ * Copyright (c) 2015-2016, Intel Corporation
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -97,7 +97,6 @@ struct mq {
                           * callback. If true, the queue must be located at a
                           * point where MO_MATCHES_PENDING was returned */
     NfaCallback cb; /**< callback to trigger on matches */
-    SomNfaCallback som_cb; /**< callback with som info;  used by haig */
     void *context; /**< context to pass along with a callback */
     struct mq_item items[MAX_MQE_LEN]; /**< queue items */
 };
index e8dd769061c9343f82c089c3f6bd6f40f7149dfa..b7ba126c265d86064649d9ff63684957cb920d24 100644 (file)
@@ -85,7 +85,6 @@ void copyQueueProperties(const struct mq *q1, struct mq *q2,
     q2->history = q1->history;
     q2->hlength = q1->hlength;
     q2->cb = q1->cb;
-    q2->som_cb = q1->som_cb;
     q2->context = q1->context;
     q2->scratch = q1->scratch;
     q2->report_current = q1->report_current;
@@ -266,8 +265,7 @@ void copyBack(const struct  Tamarama *t, struct mq *q, struct mq *q1) {
 
 char nfaExecTamarama0_testEOD(const struct NFA *n, const char *state,
                               const char *streamState, u64a offset,
-                              NfaCallback callback, SomNfaCallback som_cb,
-                              void *context) {
+                              NfaCallback callback, void *context) {
     const struct Tamarama *t = getImplNfa(n);
     u32 activeIdx = loadActiveIdx(streamState, t->activeIdxSize);
     if (activeIdx == t->numSubEngines) {
@@ -278,8 +276,8 @@ char nfaExecTamarama0_testEOD(const struct NFA *n, const char *state,
     if (nfaAcceptsEod(sub)) {
         assert(!isContainerType(sub->type));
         const char *subStreamState = streamState + t->activeIdxSize;
-        return nfaCheckFinalState(sub, state, subStreamState,
-                                  offset, callback, som_cb, context);
+        return nfaCheckFinalState(sub, state, subStreamState, offset, callback,
+                                  context);
     }
 
     return MO_CONTINUE_MATCHING;
index c39639a6ad6c412c3d90ceadceb1cafb0932f8b9..7ccfa5a09a1f7413a5731314c18d8cf9f92706f1 100644 (file)
@@ -43,8 +43,7 @@ struct hs_scratch;
 
 char nfaExecTamarama0_testEOD(const struct NFA *n, const char *state,
                               const char *streamState, u64a offset,
-                              NfaCallback callback, SomNfaCallback som_cb,
-                              void *context);
+                              NfaCallback callback, void *context);
 char nfaExecTamarama0_QR(const struct NFA *n, struct mq *q, ReportID report);
 char nfaExecTamarama0_reportCurrent(const struct NFA *n, struct mq *q);
 char nfaExecTamarama0_inAccept(const struct NFA *n, ReportID report,
index f61cf3909e07b8b560923d390344da25b3f683e1..9a075d179a6b9b89116e56d013e01f2d1be8e835 100644 (file)
@@ -281,14 +281,15 @@ restart:
 
 /* for use by mpv (chained) only */
 static
-int roseNfaFinalBlastAdaptor(u64a offset, ReportID id, void *context) {
+int roseNfaFinalBlastAdaptor(u64a som, u64a offset, ReportID id,
+                             void *context) {
     struct hs_scratch *scratch = context;
     const struct RoseEngine *t = scratch->core_info.rose;
 
     DEBUG_PRINTF("masky got himself a blasted match @%llu id %u !woot!\n",
                  offset, id);
 
-    int cb_rv = roseNfaRunProgram(t, scratch, 0, offset, id, 1);
+    int cb_rv = roseNfaRunProgram(t, scratch, som, offset, id, 1);
     if (cb_rv == MO_HALT_MATCHING) {
         return MO_HALT_MATCHING;
     } else if (cb_rv == ROSE_CONTINUE_MATCHING_NO_EXHAUST) {
@@ -394,7 +395,6 @@ hwlmcb_rv_t roseCatchUpMPV_i(const struct RoseEngine *t, s64a loc,
     assert(!q->report_current);
 
     q->cb = roseNfaFinalBlastAdaptor;
-    q->som_cb = NULL;
 
     DEBUG_PRINTF("queue %u blasting, %u/%u [%lld/%lld]\n",
                   qi, q->cur, q->end, q->items[q->cur].location, loc);
@@ -449,7 +449,7 @@ char in_mpv(const struct RoseEngine *rose, const struct hs_scratch *scratch) {
 }
 
 static
-int roseNfaBlastAdaptor(u64a offset, ReportID id, void *context) {
+int roseNfaBlastAdaptor(u64a som, u64a offset, ReportID id, void *context) {
     struct hs_scratch *scratch = context;
     struct RoseContext *tctxt = &scratch->tctxt;
     const struct RoseEngine *t = scratch->core_info.rose;
@@ -458,7 +458,7 @@ int roseNfaBlastAdaptor(u64a offset, ReportID id, void *context) {
                  offset, id);
 
     const char from_mpv = in_mpv(t, scratch);
-    int cb_rv = roseNfaRunProgram(t, scratch, 0, offset, id, from_mpv);
+    int cb_rv = roseNfaRunProgram(t, scratch, som, offset, id, from_mpv);
     if (cb_rv == MO_HALT_MATCHING) {
         return MO_HALT_MATCHING;
     } else if (cb_rv == ROSE_CONTINUE_MATCHING_NO_EXHAUST) {
@@ -470,65 +470,8 @@ int roseNfaBlastAdaptor(u64a offset, ReportID id, void *context) {
     }
 }
 
-static
-int roseNfaBlastAdaptorNoInternal(u64a offset, ReportID id, void *context) {
-    struct hs_scratch *scratch = context;
-    struct RoseContext *tctxt = &scratch->tctxt;
-    const struct RoseEngine *t = scratch->core_info.rose;
-
-    DEBUG_PRINTF("masky got himself a blasted match @%llu id %u !woot!\n",
-                 offset, id);
-
-    assert(!in_mpv(t, scratch));
-
-    int cb_rv = roseNfaRunProgram(t, scratch, 0, offset, id, 0);
-    if (cb_rv == MO_HALT_MATCHING) {
-        return MO_HALT_MATCHING;
-    } else if (cb_rv == ROSE_CONTINUE_MATCHING_NO_EXHAUST) {
-        return MO_CONTINUE_MATCHING;
-    } else {
-        assert(cb_rv == MO_CONTINUE_MATCHING);
-        return !roseSuffixIsExhausted(t, tctxt->curr_qi,
-                                      scratch->core_info.exhaustionVector);
-    }
-}
-
-static
-int roseNfaBlastSomAdaptor(u64a from_offset, u64a offset, ReportID id,
-                           void *context) {
-    struct hs_scratch *scratch = context;
-    struct RoseContext *tctxt = &scratch->tctxt;
-    const struct RoseEngine *t = scratch->core_info.rose;
-
-    DEBUG_PRINTF("masky got himself a blasted match @%llu id %u !woot!\n",
-                 offset, id);
-
-    assert(!in_mpv(t, scratch));
-
-    /* must be a external report as haig cannot directly participate in chain */
-    int cb_rv = roseNfaRunProgram(scratch->core_info.rose, scratch, from_offset,
-                                  offset, id, 0);
-    if (cb_rv == MO_HALT_MATCHING) {
-        return MO_HALT_MATCHING;
-    } else if (cb_rv == ROSE_CONTINUE_MATCHING_NO_EXHAUST) {
-        return MO_CONTINUE_MATCHING;
-    } else {
-        assert(cb_rv == MO_CONTINUE_MATCHING);
-        return !roseSuffixIsExhausted(t, tctxt->curr_qi,
-                                      scratch->core_info.exhaustionVector);
-    }
-}
-
-int roseNfaAdaptor(u64a offset, ReportID id, void *context) {
-    struct hs_scratch *scratch = context;
-    DEBUG_PRINTF("masky got himself a match @%llu id %u !woot!\n", offset, id);
-
-    return roseNfaRunProgram(scratch->core_info.rose, scratch, 0, offset, id,
-                             0);
-}
-
-int roseNfaSomAdaptor(u64a from_offset, u64a offset, ReportID id,
-                      void *context) {
+int roseNfaAdaptor(u64a from_offset, u64a offset, ReportID id,
+                   void *context) {
     struct hs_scratch *scratch = context;
     DEBUG_PRINTF("masky got himself a match @%llu id %u !woot!\n", offset, id);
 
@@ -538,24 +481,15 @@ int roseNfaSomAdaptor(u64a from_offset, u64a offset, ReportID id,
 }
 
 static really_inline
-char blast_queue(const struct RoseEngine *t, struct hs_scratch *scratch,
-                 struct mq *q, u32 qi, s64a to_loc, char report_current) {
-    struct RoseContext *tctxt = &scratch->tctxt;
-    const struct NfaInfo *info = getNfaInfoByQueue(t, qi);
-
-    tctxt->curr_qi = qi;
-    if (info->only_external) {
-        q->cb = roseNfaBlastAdaptorNoInternal;
-    } else {
-        q->cb = roseNfaBlastAdaptor;
-    }
+char blast_queue(struct hs_scratch *scratch, struct mq *q, u32 qi, s64a to_loc,
+                 char report_current) {
+    scratch->tctxt.curr_qi = qi;
+    q->cb = roseNfaBlastAdaptor;
     q->report_current = report_current;
-    q->som_cb = roseNfaBlastSomAdaptor;
     DEBUG_PRINTF("queue %u blasting, %u/%u [%lld/%lld]\n", qi, q->cur, q->end,
                  q_cur_loc(q), to_loc);
     char alive = nfaQueueExec(q->nfa, q, to_loc);
     q->cb = roseNfaAdaptor;
-    q->som_cb = roseNfaSomAdaptor;
     assert(!q->report_current);
 
     return alive;
@@ -585,7 +519,7 @@ hwlmcb_rv_t buildSufPQ_final(const struct RoseEngine *t, s64a report_ok_loc,
 
     ensureEnd(q, a_qi, final_loc);
 
-    char alive = blast_queue(t, scratch, q, a_qi, second_place_loc, 0);
+    char alive = blast_queue(scratch, q, a_qi, second_place_loc, 0);
 
     /* We have three possible outcomes:
      * (1) the nfa died
@@ -881,7 +815,7 @@ hwlmcb_rv_t roseCatchUpNfas(const struct RoseEngine *t, s64a loc,
             continue;
         }
 
-        char alive = blast_queue(t, scratch, q, qi, second_place_loc, 1);
+        char alive = blast_queue(scratch, q, qi, second_place_loc, 1);
 
         if (!alive) {
             if (can_stop_matching(scratch)) {
index bea2b5d24e73b7e20d388ef0ffc04981a25b61fa..eb8def9b60adefaf16865303495a0b22d2465293 100644 (file)
@@ -211,7 +211,7 @@ event_enqueued:
     return HWLM_CONTINUE_MATCHING;
 }
 
-int roseAnchoredCallback(u64a end, u32 id, void *ctx) {
+int roseAnchoredCallback(u64a som, u64a end, u32 id, void *ctx) {
     struct hs_scratch *scratch = ctx;
     struct RoseContext *tctxt = &scratch->tctxt;
     struct core_info *ci = &scratch->core_info;
@@ -243,7 +243,6 @@ int roseAnchoredCallback(u64a end, u32 id, void *ctx) {
 
     const u32 *programs = getByOffset(t, t->litProgramOffset);
     assert(id < t->literalCount);
-    const u64a som = 0;
     const u8 flags = ROSE_PROG_FLAG_IN_ANCHORED;
     if (roseRunProgram(t, scratch, programs[id], som, real_end, match_len,
                        flags) == HWLM_TERMINATE_MATCHING) {
@@ -648,8 +647,8 @@ int roseRunBoundaryProgram(const struct RoseEngine *rose, u32 program,
     return MO_CONTINUE_MATCHING;
 }
 
-static really_inline
-int roseReportAdaptor_i(u64a som, u64a offset, ReportID id, void *context) {
+int roseReportAdaptor(u64a som, u64a offset, ReportID id, void *context) {
+    DEBUG_PRINTF("som=%llu, offset=%llu, id=%u\n", som, offset, id);
     struct hs_scratch *scratch = context;
     assert(scratch && scratch->magic == SCRATCH_MAGIC);
 
@@ -667,13 +666,3 @@ int roseReportAdaptor_i(u64a som, u64a offset, ReportID id, void *context) {
 
     return can_stop_matching(scratch) ? MO_HALT_MATCHING : MO_CONTINUE_MATCHING;
 }
-
-int roseReportAdaptor(u64a offset, ReportID id, void *context) {
-    DEBUG_PRINTF("offset=%llu, id=%u\n", offset, id);
-    return roseReportAdaptor_i(0, offset, id, context);
-}
-
-int roseReportSomAdaptor(u64a som, u64a offset, ReportID id, void *context) {
-    DEBUG_PRINTF("som=%llu, offset=%llu, id=%u\n", som, offset, id);
-    return roseReportAdaptor_i(som, offset, id, context);
-}
index 48866d1f4b8d4e8180c7cbf52563f6b277ed9d34..49afa588c4146c8d2c4f25caffd9e79db9d9a216 100644 (file)
@@ -48,8 +48,7 @@
 
 /* Callbacks, defined in catchup.c */
 
-int roseNfaAdaptor(u64a offset, ReportID id, void *context);
-int roseNfaSomAdaptor(u64a from_offset, u64a offset, ReportID id, void *context);
+int roseNfaAdaptor(u64a from_offset, u64a offset, ReportID id, void *context);
 
 /* Callbacks, defined in match.c */
 
@@ -57,7 +56,7 @@ hwlmcb_rv_t roseCallback(size_t start, size_t end, u32 id, void *ctx);
 hwlmcb_rv_t roseFloatingCallback(size_t start, size_t end, u32 id, void *ctx);
 hwlmcb_rv_t roseDelayRebuildCallback(size_t start, size_t end, u32 id,
                                      void *ctx);
-int roseAnchoredCallback(u64a end, u32 id, void *ctx);
+int roseAnchoredCallback(u64a som, u64a end, u32 id, void *ctx);
 
 /* Common code, used all over Rose runtime */
 
@@ -82,7 +81,6 @@ void initQueue(struct mq *q, u32 qi, const struct RoseEngine *t,
     q->history = scratch->core_info.hbuf;
     q->hlength = scratch->core_info.hlen;
     q->cb = roseNfaAdaptor;
-    q->som_cb = roseNfaSomAdaptor;
     q->context = scratch;
     q->report_current = 0;
 
index 7f8c32e500fdb0f2e49b1fb49cec3d94b278cfff..e90395fb5bbc7c9c33eb2076cf9d01b2c66b163b 100644 (file)
@@ -722,13 +722,13 @@ u64a roseGetHaigSom(const struct RoseEngine *t, struct hs_scratch *scratch,
     u64a start = ~0ULL;
 
     /* switch the callback + context for a fun one */
-    q->som_cb = roseNfaEarliestSom;
+    q->cb = roseNfaEarliestSom;
     q->context = &start;
 
     nfaReportCurrentMatches(q->nfa, q);
 
     /* restore the old callback + context */
-    q->som_cb = roseNfaSomAdaptor;
+    q->cb = roseNfaAdaptor;
     q->context = NULL;
     DEBUG_PRINTF("earliest som is %llu\n", start);
     return start;
@@ -779,7 +779,7 @@ hwlmcb_rv_t roseEnginesEod(const struct RoseEngine *rose,
         }
 
         if (nfaCheckFinalState(q->nfa, q->state, q->streamState, offset,
-                               roseReportAdaptor, roseReportSomAdaptor,
+                               roseReportAdaptor,
                                scratch) == MO_HALT_MATCHING) {
             DEBUG_PRINTF("user instructed us to stop\n");
             return HWLM_TERMINATE_MATCHING;
@@ -815,7 +815,7 @@ hwlmcb_rv_t roseSuffixesEod(const struct RoseEngine *rose,
             continue;
         }
         if (nfaCheckFinalState(q->nfa, q->state, q->streamState, offset,
-                               roseReportAdaptor, roseReportSomAdaptor,
+                               roseReportAdaptor,
                                scratch) == MO_HALT_MATCHING) {
             DEBUG_PRINTF("user instructed us to stop\n");
             return HWLM_TERMINATE_MATCHING;
index ca8bf35331d4004498f3982a5e958e8829049995..ecf16854f91517c26fbabe2e7e7f306fd4275b3d 100644 (file)
@@ -49,8 +49,7 @@ void roseStreamEodExec(const struct RoseEngine *t, u64a offset,
 hwlmcb_rv_t rosePureLiteralCallback(size_t start, size_t end, u32 id,
                                     void *context);
 
-int roseReportAdaptor(u64a offset, ReportID id, void *context);
-int roseReportSomAdaptor(u64a som, u64a offset, ReportID id, void *context);
+int roseReportAdaptor(u64a som, u64a offset, ReportID id, void *context);
 
 int roseRunBoundaryProgram(const struct RoseEngine *rose, u32 program,
                            u64a stream_offset, struct hs_scratch *scratch);
index 23e025d0b37135210e71ed714213135c7b3a0589..5b3806a2dc7c6e2675d54ed9109614ccf18cfe5a 100644 (file)
@@ -2616,16 +2616,6 @@ bool anyEndfixMpvTriggers(const RoseBuildImpl &tbi) {
     return false;
 }
 
-static
-bool hasInternalReport(const set<ReportID> &reports, const ReportManager &rm) {
-    for (ReportID r : reports) {
-        if (!isExternalReport(rm.getReport(r))) {
-            return true;
-        }
-    }
-    return false;
-}
-
 static
 void populateNfaInfoBasics(const RoseBuildImpl &build, const build_context &bc,
                            const vector<OutfixInfo> &outfixes,
@@ -2643,24 +2633,10 @@ void populateNfaInfoBasics(const RoseBuildImpl &build, const build_context &bc,
         info.no_retrigger = contains(no_retrigger_queues, qi) ? 1 : 0;
     }
 
-    // Mark outfixes that only trigger external reports.
+    // Mark outfixes that are in the small block matcher.
     for (const auto &out : outfixes) {
         const u32 qi = out.get_queue();
-
         infos[qi].in_sbmatcher = out.in_sbmatcher;
-        if (!hasInternalReport(all_reports(out), build.rm)) {
-            infos[qi].only_external = 1;
-        }
-    }
-
-    // Mark suffixes that only trigger external reports.
-    for (const auto &e : bc.suffixes) {
-        const suffix_id &s = e.first;
-        u32 qi = e.second;
-
-        if (!hasInternalReport(all_reports(s), build.rm)) {
-            infos[qi].only_external = 1;
-        }
     }
 
     // Mark suffixes triggered by EOD table literals.
index 5b6a9dc6bf791edb88d5bea5b41877da320e20a8..803810b0a624303929ea5d68ebc2fc103d37e2f5 100644 (file)
@@ -156,8 +156,6 @@ struct NfaInfo {
     u32 fullStateOffset; /* offset in scratch, relative to ??? */
     u32 ekeyListOffset; /* suffix, relative to base of rose, 0 if no ekeys */
     u8 no_retrigger; /* TODO */
-    u8 only_external; /**< does not raise any som internal events or chained
-                       * rose events */
     u8 in_sbmatcher;  /**< this outfix should not be run in small-block
                        * execution, as it will be handled by the sbmatcher
                        * HWLM table. */
index 7da41d298d3263bbe205b0ce7f6d07e07e6f50c4..2def17c8581e943fa615b1e9d83c52dfe0f57cd7 100644 (file)
@@ -217,7 +217,6 @@ void initOutfixQueue(struct mq *q, u32 qi, const struct RoseEngine *t,
     q->history = scratch->core_info.hbuf;
     q->hlength = scratch->core_info.hlen;
     q->cb = roseReportAdaptor;
-    q->som_cb = roseReportSomAdaptor;
     q->context = scratch;
     q->report_current = 0;
 
@@ -257,8 +256,8 @@ void soleOutfixBlockExec(const struct RoseEngine *t,
     char rv = nfaQueueExec(q->nfa, q, scratch->core_info.len);
 
     if (rv && nfaAcceptsEod(nfa) && len == scratch->core_info.len) {
-        nfaCheckFinalState(nfa, q->state, q->streamState, q->length,
-                        q->cb, q->som_cb, scratch);
+        nfaCheckFinalState(nfa, q->state, q->streamState, q->length, q->cb,
+                           scratch);
     }
 }
 
@@ -568,7 +567,7 @@ void soleOutfixEodExec(hs_stream_t *id, hs_scratch_t *scratch) {
 
     assert(nfaAcceptsEod(nfa));
     nfaCheckFinalState(nfa, q->state, q->streamState, q->offset, q->cb,
-                       q->som_cb, scratch);
+                       scratch);
 }
 
 static really_inline
index 9d0a1390e238e147e56b4ee8475344163aa66b82..b9972b2c6efec5d8ef7600edeb431d420e196bdc 100644 (file)
@@ -87,7 +87,7 @@ char ok_and_mark_if_unset(u8 *som_store_valid, struct fatbit *som_set_now,
 }
 
 static
-int somRevCallback(u64a offset, ReportID id, void *ctx) {
+int somRevCallback(UNUSED u64a som, u64a offset, ReportID id, void *ctx) {
     DEBUG_PRINTF("offset=%llu, id=%u\n", offset, id);
 
     // We use the id to store the offset adjustment (for assertions like a
index f335e184a5f8a127cbf5bf24ef4111c33df93d6e..bd799c0fbe27881f675beb285c31672c4a2f5f6b 100644 (file)
@@ -71,7 +71,7 @@ struct LbrTestParams {
 };
 
 static
-int onMatch(u64a, ReportID, void *ctx) {
+int onMatch(u64a, u64a, ReportID, void *ctx) {
     unsigned *matches = (unsigned *)ctx;
     (*matches)++;
     return MO_CONTINUE_MATCHING;
@@ -125,7 +125,6 @@ protected:
         q.scratch = nullptr; // not needed by LBR
         q.report_current = 0;
         q.cb = onMatch;
-        q.som_cb = nullptr; // only used by Haig
         q.context = &matches;
     }
 
index eb6ce08bce9d7228da8e43dd0b25e774a03c69ad..c3cfb3dd3bd52dc4d422e4b8392025a2de4b671e 100644 (file)
@@ -51,7 +51,7 @@ static const string SCAN_DATA = "___foo______\n___foofoo_foo_^^^^^^^^^^^^^^^^^^"
 static const u32 MATCH_REPORT = 1024;
 
 static
-int onMatch(u64a, ReportID, void *ctx) {
+int onMatch(u64a, u64a, ReportID, void *ctx) {
     unsigned *matches = (unsigned *)ctx;
     (*matches)++;
     return MO_CONTINUE_MATCHING;
@@ -105,7 +105,6 @@ protected:
         q.scratch = nullptr; /* limex does not use scratch */
         q.report_current = 0;
         q.cb = onMatch;
-        q.som_cb = nullptr; // only used by Haig
         q.context = &matches;
     }
 
@@ -293,8 +292,7 @@ TEST_P(LimExModelTest, CheckFinalState) {
 
     // Check for EOD matches.
     char rv = nfaCheckFinalState(nfa.get(), full_state.get(),
-                                 stream_state.get(), end, onMatch, nullptr,
-                                 &matches);
+                                 stream_state.get(), end, onMatch, &matches);
     ASSERT_EQ(MO_CONTINUE_MATCHING, rv);
 }
 
@@ -400,7 +398,6 @@ protected:
         q.scratch = nullptr; /* limex does not use scratch */
         q.report_current = 0;
         q.cb = onMatch;
-        q.som_cb = nullptr; // only used by Haig
         q.context = &matches;
     }