]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
remove start argument in literal matcher callbacks
authorWang, Xiang W <xiang.w.wang@intel.com>
Thu, 6 Jul 2017 16:23:41 +0000 (12:23 -0400)
committerMatthew Barr <matthew.barr@intel.com>
Mon, 21 Aug 2017 01:12:36 +0000 (11:12 +1000)
19 files changed:
src/fdr/fdr_confirm_runtime.h
src/fdr/fdr_internal.h
src/fdr/flood_compile.cpp
src/fdr/flood_runtime.h
src/hwlm/hwlm.h
src/hwlm/noodle_build.cpp
src/hwlm/noodle_engine.c
src/hwlm/noodle_internal.h
src/rose/block.c
src/rose/catchup.c
src/rose/match.c
src/rose/match.h
src/rose/program_runtime.c
src/rose/program_runtime.h
src/rose/rose.h
src/rose/stream.c
unit/internal/fdr.cpp
unit/internal/fdr_flood.cpp
unit/internal/noodle.cpp

index d75408f43469b7a52134e3456b7bbc6f4a25c1ee..557873b72d6cabee015a1135f8d0c14bde0816c8 100644 (file)
@@ -88,7 +88,7 @@ void confWithBit(const struct FDRConfirm *fdrc, const struct FDR_Runtime_Args *a
         }
 
         *last_match = li->id;
-        *control = a->cb(loc - buf, i, li->id, a->ctxt);
+        *control = a->cb(i, li->id, a->ctxt);
     out:
         oldNext = li->next; // oldNext is either 0 or an 'adjust' value
         li++;
index 2315b2d8157e7a2bf0a9c87f1fcce9c99ad9fb49..4147099746b823bdbecfb4ab0a243398d53192a5 100644 (file)
@@ -56,7 +56,6 @@ struct FDRFlood {
 
     u32 ids[FDR_FLOOD_MAX_IDS]; //!< the ids
     hwlm_group_t groups[FDR_FLOOD_MAX_IDS]; //!< group ids to go with string ids
-    u32 len[FDR_FLOOD_MAX_IDS]; //!< lengths to go with the string ids
 };
 
 /** \brief FDR structure.
index 7dcc17d186575f69f871e0f418deb9367e633c35..6304ab2f8584e5b1b7586c709d9922cf7de879cd 100644 (file)
@@ -82,7 +82,6 @@ void addFlood(vector<FDRFlood> &tmpFlood, u8 c, const hwlmLiteral &lit,
         fl.ids[fl.idCount] = lit.id;
         fl.allGroups |= lit.groups;
         fl.groups[fl.idCount] = lit.groups;
-        fl.len[fl.idCount] = suffix;
         // when idCount gets to max_ids this flood no longer happens
         // only incremented one more time to avoid arithmetic overflow
         DEBUG_PRINTF("Added Flood for char '%c' suffix=%u len[%hu]=%u\n",
index d3f6b3b29ae77ad968d0da51476b904cf80d5c9f..93079afb9e395bd43eceedd33a37c0d68e17779e 100644 (file)
@@ -196,120 +196,110 @@ const u8 * floodDetect(const struct FDR * fdr,
                 for (u32 t = 0; t < floodSize && (*control & fl->allGroups);
                      t += 4) {
                     DEBUG_PRINTF("aaa %u %llx\n", t, fl->groups[0]);
-                    u32 len0 = fl->len[0] - 1;
                     if (*control & fl->groups[0]) {
-                        *control = cb(i + t + 0 - len0, i + t + 0, fl->ids[0], ctxt);
+                        *control = cb(i + t + 0, fl->ids[0], ctxt);
                     }
                     if (*control & fl->groups[0]) {
-                        *control = cb(i + t + 1 - len0, i + t + 1, fl->ids[0], ctxt);
+                        *control = cb(i + t + 1, fl->ids[0], ctxt);
                     }
                     if (*control & fl->groups[0]) {
-                        *control = cb(i + t + 2 - len0, i + t + 2, fl->ids[0], ctxt);
+                        *control = cb(i + t + 2, fl->ids[0], ctxt);
                     }
                     if (*control & fl->groups[0]) {
-                        *control = cb(i + t + 3 - len0, i + t + 3, fl->ids[0], ctxt);
+                        *control = cb(i + t + 3, fl->ids[0], ctxt);
                     }
                 }
                 break;
             case 2:
                 for (u32 t = 0; t < floodSize && (*control & fl->allGroups); t += 4) {
-                    u32 len0 = fl->len[0] - 1;
-                    u32 len1 = fl->len[1] - 1;
                     if (*control & fl->groups[0]) {
-                        *control = cb(i + t - len0, i + t, fl->ids[0], ctxt);
+                        *control = cb(i + t, fl->ids[0], ctxt);
                     }
                     if (*control & fl->groups[1]) {
-                        *control = cb(i + t - len1, i + t, fl->ids[1], ctxt);
+                        *control = cb(i + t, fl->ids[1], ctxt);
                     }
                     if (*control & fl->groups[0]) {
                         *control =
-                            cb(i + t + 1 - len0, i + t + 1, fl->ids[0], ctxt);
+                            cb(i + t + 1, fl->ids[0], ctxt);
                     }
                     if (*control & fl->groups[1]) {
-                        *control = cb(i + t + 1 - len1, i + t + 1, fl->ids[1], ctxt);
+                        *control = cb(i + t + 1, fl->ids[1], ctxt);
                     }
                     if (*control & fl->groups[0]) {
-                        *control = cb(i + t + 2 - len0, i + t + 2, fl->ids[0], ctxt);
+                        *control = cb(i + t + 2, fl->ids[0], ctxt);
                     }
                     if (*control & fl->groups[1]) {
-                        *control = cb(i + t + 2 - len1, i + t + 2, fl->ids[1], ctxt);
+                        *control = cb(i + t + 2, fl->ids[1], ctxt);
                     }
                     if (*control & fl->groups[0]) {
-                        *control = cb(i + t + 3 - len0, i + t + 3, fl->ids[0], ctxt);
+                        *control = cb(i + t + 3, fl->ids[0], ctxt);
                     }
                     if (*control & fl->groups[1]) {
-                        *control = cb(i + t + 3 - len1, i + t + 3, fl->ids[1], ctxt);
+                        *control = cb(i + t + 3, fl->ids[1], ctxt);
                     }
                 }
                 break;
             case 3:
                 for (u32 t = 0; t < floodSize && (*control & fl->allGroups); t += 2) {
-                    u32 len0 = fl->len[0] - 1;
-                    u32 len1 = fl->len[1] - 1;
-                    u32 len2 = fl->len[2] - 1;
                     if (*control & fl->groups[0]) {
-                        *control = cb(i + t - len0, i + t, fl->ids[0], ctxt);
+                        *control = cb(i + t, fl->ids[0], ctxt);
                     }
                     if (*control & fl->groups[1]) {
-                        *control = cb(i + t - len1, i + t, fl->ids[1], ctxt);
+                        *control = cb(i + t, fl->ids[1], ctxt);
                     }
                     if (*control & fl->groups[2]) {
-                        *control = cb(i + t - len2, i + t, fl->ids[2], ctxt);
+                        *control = cb(i + t, fl->ids[2], ctxt);
                     }
                     if (*control & fl->groups[0]) {
-                        *control = cb(i + t + 1 - len0, i + t + 1, fl->ids[0], ctxt);
+                        *control = cb(i + t + 1, fl->ids[0], ctxt);
                     }
                     if (*control & fl->groups[1]) {
-                        *control = cb(i + t + 1 - len1, i + t + 1, fl->ids[1], ctxt);
+                        *control = cb(i + t + 1, fl->ids[1], ctxt);
                     }
                     if (*control & fl->groups[2]) {
-                        *control = cb(i + t + 1 - len2, i + t + 1, fl->ids[2], ctxt);
+                        *control = cb(i + t + 1, fl->ids[2], ctxt);
                     }
                 }
                 break;
             default:
                 // slow generalized loop
                 for (u32 t = 0; t < floodSize && (*control & fl->allGroups); t += 2) {
-                    u32 len0 = fl->len[0] - 1;
-                    u32 len1 = fl->len[1] - 1;
-                    u32 len2 = fl->len[2] - 1;
-                    u32 len3 = fl->len[3] - 1;
 
                     if (*control & fl->groups[0]) {
-                        *control = cb(i + t - len0, i + t, fl->ids[0], ctxt);
+                        *control = cb(i + t, fl->ids[0], ctxt);
                     }
                     if (*control & fl->groups[1]) {
-                        *control = cb(i + t - len1, i + t, fl->ids[1], ctxt);
+                        *control = cb(i + t, fl->ids[1], ctxt);
                     }
                     if (*control & fl->groups[2]) {
-                        *control = cb(i + t - len2, i + t, fl->ids[2], ctxt);
+                        *control = cb(i + t, fl->ids[2], ctxt);
                     }
                     if (*control & fl->groups[3]) {
-                        *control = cb(i + t - len3, i + t, fl->ids[3], ctxt);
+                        *control = cb(i + t, fl->ids[3], ctxt);
                     }
 
                     for (u32 t2 = 4; t2 < fl->idCount; t2++) {
                         if (*control & fl->groups[t2]) {
-                            *control = cb(i + t - (fl->len[t2] - 1), i + t, fl->ids[t2], ctxt);
+                            *control = cb(i + t, fl->ids[t2], ctxt);
                         }
                     }
 
                     if (*control & fl->groups[0]) {
-                        *control = cb(i + t + 1 - len0, i + t + 1, fl->ids[0], ctxt);
+                        *control = cb(i + t + 1, fl->ids[0], ctxt);
                     }
                     if (*control & fl->groups[1]) {
-                        *control = cb(i + t + 1 - len1, i + t + 1, fl->ids[1], ctxt);
+                        *control = cb(i + t + 1, fl->ids[1], ctxt);
                     }
                     if (*control & fl->groups[2]) {
-                        *control = cb(i + t + 1 - len2, i + t + 1, fl->ids[2], ctxt);
+                        *control = cb(i + t + 1, fl->ids[2], ctxt);
                     }
                     if (*control & fl->groups[3]) {
-                        *control = cb(i + t + 1 - len3, i + t + 1, fl->ids[3], ctxt);
+                        *control = cb(i + t + 1, fl->ids[3], ctxt);
                     }
 
                     for (u32 t2 = 4; t2 < fl->idCount; t2++) {
                         if (*control & fl->groups[t2]) {
-                            *control = cb(i + t + 1 - (fl->len[t2] - 1), i + t + 1, fl->ids[t2], ctxt);
+                            *control = cb(i + t + 1, fl->ids[t2], ctxt);
                         }
                     }
                 }
@@ -320,7 +310,7 @@ const u8 * floodDetect(const struct FDR * fdr,
                 for (u32 t = 0; t < floodSize && (*control & fl->allGroups); t++) {
                     for (u32 t2 = 0; t2 < fl->idCount; t2++) {
                         if (*control & fl->groups[t2]) {
-                            *control = cb(i + t - (fl->len[t2] - 1), i + t, fl->ids[t2], ctxt);
+                            *control = cb(i + t, fl->ids[t2], ctxt);
                         }
                     }
                 }
index 005613461154bd399618c51773c14301d681026b..92d4bfdb4dff3219d4df1f697b1514e6f2afb620 100644 (file)
@@ -79,9 +79,9 @@ struct HWLM;
 
 /** \brief The type for an HWLM callback.
  *
- * This callback receives a start-of-match offset, an end-of-match offset, the
- * ID of the match and the context pointer that was passed into \ref
- * hwlmExec or \ref hwlmExecStreaming.
+ * This callback receives an end-of-match offset, the ID of the match and
+ * the context pointer that was passed into \ref hwlmExec or
+ * \ref hwlmExecStreaming.
  *
  * A callback return of \ref HWLM_TERMINATE_MATCHING will stop matching.
  *
@@ -95,8 +95,7 @@ struct HWLM;
  * belonging to the literal which was active at the when the end match location
  * was first reached.
  */
-typedef hwlmcb_rv_t (*HWLMCallback)(size_t start, size_t end, u32 id,
-                                    void *context);
+typedef hwlmcb_rv_t (*HWLMCallback)(size_t end, u32 id, void *context);
 
 /** \brief Match strings in table.
  *
index 4a6ac8d716b386d6918ecf9d0716ef0ee1557b28..a0128d0ad78345a6f1bf265a95061bccd592074f 100644 (file)
@@ -121,9 +121,8 @@ bytecode_ptr<noodTable> noodBuildTable(const hwlmLiteral &lit) {
     size_t key_offset = findNoodFragOffset(lit);
 
     n->id = lit.id;
-    n->lit_len = s.length();
     n->single = s.length() == 1 ? 1 : 0;
-    n->key_offset = verify_u8(n->lit_len - key_offset);
+    n->key_offset = verify_u8(s.length() - key_offset);
     n->nocase = lit.nocase ? 1 : 0;
     n->key0 = s[key_offset];
     if (n->single) {
@@ -151,12 +150,12 @@ namespace ue2 {
 
 void noodPrintStats(const noodTable *n, FILE *f) {
     fprintf(f, "Noodle table\n");
-    fprintf(f, "Len: %u Key Offset: %u\n", n->lit_len, n->key_offset);
+    fprintf(f, "Key Offset: %u\n", n->key_offset);
     fprintf(f, "Msk: %llx Cmp: %llx MskLen %u\n",
             n->msk >> 8 * (8 - n->msk_len), n->cmp >> 8 * (8 - n->msk_len),
             n->msk_len);
     fprintf(f, "String: ");
-    for (u32 i = n->msk_len - n->lit_len; i < n->msk_len; i++) {
+    for (u32 i = 0; i < n->msk_len; i++) {
         const u8 *m = (const u8 *)&n->cmp;
         if (isgraph(m[i]) && m[i] != '\\') {
             fprintf(f, "%c", m[i]);
index f0d711b2ce0f448cba345c4eff3031a735793d63..009c4b985516740c2039b5824d7b6aecd2feabac 100644 (file)
@@ -128,10 +128,8 @@ hwlm_error_t final(const struct noodTable *n, const u8 *buf, UNUSED size_t len,
 
 match:
     pos -= cbi->offsetAdj;
-    DEBUG_PRINTF("match @ %zu->%zu\n", pos + n->key_offset - n->lit_len,
-                 pos + n->key_offset);
-    hwlmcb_rv_t rv = cbi->cb(pos + n->key_offset - n->lit_len,
-                             pos + n->key_offset - 1, cbi->id, cbi->ctx);
+    DEBUG_PRINTF("match @ %zu\n", pos + n->key_offset);
+    hwlmcb_rv_t rv = cbi->cb(pos + n->key_offset - 1, cbi->id, cbi->ctx);
     if (rv == HWLM_TERMINATE_MATCHING) {
         return HWLM_TERMINATED;
     }
@@ -377,8 +375,8 @@ hwlm_error_t noodExec(const struct noodTable *n, const u8 *buf, size_t len,
     assert(n && buf);
 
     struct cb_info cbi = {cb, n->id, ctxt, 0};
-    DEBUG_PRINTF("nood scan of %zu bytes for %*s @ %p\n", len, n->lit_len,
-                 (const char *)&n->cmp + n->msk_len - n->lit_len, buf);
+    DEBUG_PRINTF("nood scan of %zu bytes for %*s @ %p\n", len, n->msk_len,
+                 (const char *)&n->cmp, buf);
 
     return scan(n, buf, len, start, n->single, n->nocase, &cbi);
 }
@@ -396,8 +394,7 @@ hwlm_error_t noodExecStreaming(const struct noodTable *n, const u8 *hbuf,
 
     struct cb_info cbi = {cb, n->id, ctxt, 0};
     DEBUG_PRINTF("nood scan of %zu bytes (%zu hlen) for %*s @ %p\n", len, hlen,
-                 n->lit_len, (const char *)&n->cmp + n->msk_len - n->lit_len,
-                 buf);
+                 n->msk_len, (const char *)&n->cmp, buf);
 
     if (hlen && n->msk_len > 1) {
         /*
@@ -427,9 +424,8 @@ hwlm_error_t noodExecStreaming(const struct noodTable *n, const u8 *hbuf,
             u64a v = unaligned_load_u64a(temp_buf + i);
             if ((v & n->msk) == n->cmp) {
                 size_t m_end = -tl1 + i + n->msk_len - 1;
-                size_t m_start = m_end - n->lit_len;
-                DEBUG_PRINTF("match @ %zu->%zu (i %zu)\n", m_start, m_end, i);
-                hwlmcb_rv_t rv = cb(m_start, m_end, n->id, ctxt);
+                DEBUG_PRINTF("match @ %zu (i %zu)\n", m_end, i);
+                hwlmcb_rv_t rv = cb(m_end, n->id, ctxt);
                 if (rv == HWLM_TERMINATE_MATCHING) {
                     return HWLM_TERMINATED;
                 }
index bfb1a9e277f34f21decc6cbdf52cc21aec384a2b..8f76f177e1eabec876760045a850c8b03690933c 100644 (file)
@@ -39,7 +39,6 @@ struct noodTable {
     u32 id;
     u64a msk;
     u64a cmp;
-    u8 lit_len;
     u8 msk_len;
     u8 key_offset;
     u8 nocase;
index fc72c6e96c61ca3a50f653c4b5875aae35fbb961..2c49321996d7b5c3a68a75325993cd9ce2d8be25 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2016, Intel Corporation
+ * Copyright (c) 2015-2017, Intel Corporation
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -178,13 +178,11 @@ void roseBlockEodExec(const struct RoseEngine *t, u64a offset,
     assert(!scratch->tctxt.filledDelayedSlots);
 
     const u64a som = 0;
-    const size_t match_len = 0;
     const u8 flags = ROSE_PROG_FLAG_SKIP_MPV_CATCHUP;
 
     // Note: we ignore the result, as this is the last thing to ever happen on
     // a scan.
-    roseRunProgram(t, scratch, t->eodProgramOffset, som, offset, match_len,
-                   flags);
+    roseRunProgram(t, scratch, t->eodProgramOffset, som, offset, flags);
 }
 
 /**
index 8253724178193ac9c48b804c5cb2098b09bb78f4..9e36d091461e948cd32fc775f3b1f3243dbfa78b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2016, Intel Corporation
+ * Copyright (c) 2015-2017, Intel Corporation
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -51,13 +51,12 @@ static really_inline
 int roseNfaRunProgram(const struct RoseEngine *rose, struct hs_scratch *scratch,
                       u64a som, u64a offset, ReportID id, const char from_mpv) {
     const u32 program = id;
-    const size_t match_len = 0; // Unused in this path.
     u8 flags = ROSE_PROG_FLAG_IN_CATCHUP;
     if (from_mpv) {
         flags |= ROSE_PROG_FLAG_FROM_MPV;
     }
 
-    roseRunProgram(rose, scratch, program, som, offset, match_len, flags);
+    roseRunProgram(rose, scratch, program, som, offset, flags);
 
     return can_stop_matching(scratch) ? MO_HALT_MATCHING : MO_CONTINUE_MATCHING;
 }
index daf81eac0d0500bf30bf23ad7ca983cdf6e36f38..91e045a50f6707069294541e8d00d4f98dab9b5a 100644 (file)
@@ -66,8 +66,7 @@ void printMatch(const struct core_info *ci, u64a start, u64a end) {
 }
 #endif
 
-hwlmcb_rv_t roseDelayRebuildCallback(size_t start, size_t end, u32 id,
-                                     void *ctx) {
+hwlmcb_rv_t roseDelayRebuildCallback(size_t end, u32 id, void *ctx) {
     struct hs_scratch *scratch = ctx;
     struct RoseContext *tctx = &scratch->tctxt;
     struct core_info *ci = &scratch->core_info;
@@ -77,9 +76,9 @@ hwlmcb_rv_t roseDelayRebuildCallback(size_t start, size_t end, u32 id,
     u64a real_end = ci->buf_offset - rb_len + end + 1; // index after last byte
 
 #ifdef DEBUG
-    DEBUG_PRINTF("REBUILD MATCH id=%u offsets=[%llu,%llu]: ", id,
-                 start + ci->buf_offset - rb_len, real_end);
-    printMatch(ci, start + ci->buf_offset - rb_len, real_end);
+    DEBUG_PRINTF("REBUILD MATCH id=%u end offset@%llu]: ", id, real_end);
+    u64a start = real_end < 8 ? 1 : real_end - 7;
+    printMatch(ci, start, real_end);
     printf("\n");
 #endif
 
@@ -87,10 +86,9 @@ hwlmcb_rv_t roseDelayRebuildCallback(size_t start, size_t end, u32 id,
 
     assert(id && id < t->size); // id is a program offset
     const u64a som = 0;
-    const size_t match_len = end - start + 1;
     const u8 flags = 0;
     UNUSED hwlmcb_rv_t rv =
-        roseRunProgram(t, scratch, id, som, real_end, match_len, flags);
+        roseRunProgram(t, scratch, id, som, real_end, flags);
     assert(rv != HWLM_TERMINATE_MATCHING);
 
     /* we are just repopulating the delay queue, groups should be
@@ -200,8 +198,6 @@ int roseAnchoredCallback(u64a start, u64a end, u32 id, void *ctx) {
         return MO_HALT_MATCHING;
     }
 
-    const size_t match_len = 0;
-
     /* delayed literals need to be delivered before real literals; however
      * delayed literals only come from the floating table so if we are going
      * to deliver a literal here it must be too early for a delayed literal */
@@ -216,8 +212,8 @@ int roseAnchoredCallback(u64a start, u64a end, u32 id, void *ctx) {
 
     // Note that the "id" we have been handed is the program offset.
     const u8 flags = ROSE_PROG_FLAG_IN_ANCHORED;
-    if (roseRunProgram(t, scratch, id, start, real_end, match_len,
-                       flags) == HWLM_TERMINATE_MATCHING) {
+    if (roseRunProgram(t, scratch, id, start, real_end, flags)
+                       == HWLM_TERMINATE_MATCHING) {
         assert(can_stop_matching(scratch));
         DEBUG_PRINTF("caller requested termination\n");
         return MO_HALT_MATCHING;
@@ -237,12 +233,12 @@ int roseAnchoredCallback(u64a start, u64a end, u32 id, void *ctx) {
 static really_inline
 hwlmcb_rv_t roseProcessMatchInline(const struct RoseEngine *t,
                                    struct hs_scratch *scratch, u64a end,
-                                   size_t match_len, u32 id) {
+                                   u32 id) {
     DEBUG_PRINTF("id=%u\n", id);
     assert(id && id < t->size); // id is an offset into bytecode
     const u64a som = 0;
     const u8 flags = 0;
-    return roseRunProgram_i(t, scratch, id, som, end, match_len, flags);
+    return roseRunProgram_i(t, scratch, id, som, end, flags);
 }
 
 static rose_inline
@@ -274,7 +270,7 @@ hwlmcb_rv_t playDelaySlot(const struct RoseEngine *t,
         const u64a som = 0;
         const u8 flags = 0;
         hwlmcb_rv_t rv = roseRunProgram(t, scratch, programs[it], som, offset,
-                                        0, flags);
+                                        flags);
         DEBUG_PRINTF("DONE groups=0x%016llx\n", tctxt->groups);
 
         /* delayed literals can't safely set groups.
@@ -311,7 +307,7 @@ hwlmcb_rv_t flushAnchoredLiteralAtLoc(const struct RoseEngine *t,
         const u64a som = 0;
         const u8 flags = 0;
         hwlmcb_rv_t rv = roseRunProgram(t, scratch, programs[it], som, curr_loc,
-                                        0, flags);
+                                        flags);
         DEBUG_PRINTF("DONE groups=0x%016llx\n", tctxt->groups);
 
         /* anchored literals can't safely set groups.
@@ -476,7 +472,7 @@ anchored_leftovers:;
 }
 
 static really_inline
-hwlmcb_rv_t roseCallback_i(size_t start, size_t end, u32 id, void *ctxt) {
+hwlmcb_rv_t roseCallback_i(size_t end, u32 id, void *ctxt) {
     struct hs_scratch *scratch = ctxt;
     struct RoseContext *tctx = &scratch->tctxt;
     const struct RoseEngine *t = scratch->core_info.rose;
@@ -484,9 +480,9 @@ hwlmcb_rv_t roseCallback_i(size_t start, size_t end, u32 id, void *ctxt) {
     u64a real_end = end + tctx->lit_offset_adjust;
 
 #if defined(DEBUG)
-    DEBUG_PRINTF("MATCH id=%u offsets=[%llu,%llu]: ", id,
-                 start + tctx->lit_offset_adjust, real_end);
-    printMatch(&scratch->core_info, start + tctx->lit_offset_adjust, real_end);
+    DEBUG_PRINTF("MATCH id=%u end offset@%llu: ", id, real_end);
+    u64a start = real_end < 8 ? 1 : real_end - 7;
+    printMatch(&scratch->core_info, start, real_end);
     printf("\n");
 #endif
     DEBUG_PRINTF("last end %llu\n", tctx->lastEndOffset);
@@ -510,8 +506,7 @@ hwlmcb_rv_t roseCallback_i(size_t start, size_t end, u32 id, void *ctxt) {
         return HWLM_TERMINATE_MATCHING;
     }
 
-    size_t match_len = end - start + 1;
-    rv = roseProcessMatchInline(t, scratch, real_end, match_len, id);
+    rv = roseProcessMatchInline(t, scratch, real_end, id);
 
     DEBUG_PRINTF("DONE groups=0x%016llx\n", tctx->groups);
 
@@ -524,15 +519,15 @@ hwlmcb_rv_t roseCallback_i(size_t start, size_t end, u32 id, void *ctxt) {
     return HWLM_TERMINATE_MATCHING;
 }
 
-hwlmcb_rv_t roseCallback(size_t start, size_t end, u32 id, void *ctxt) {
-    return roseCallback_i(start, end, id, ctxt);
+hwlmcb_rv_t roseCallback(size_t end, u32 id, void *ctxt) {
+    return roseCallback_i(end, id, ctxt);
 }
 
-hwlmcb_rv_t roseFloatingCallback(size_t start, size_t end, u32 id, void *ctxt) {
+hwlmcb_rv_t roseFloatingCallback(size_t end, u32 id, void *ctxt) {
     struct hs_scratch *scratch = ctxt;
     const struct RoseEngine *t = scratch->core_info.rose;
 
-    return roseCallback_i(start, end, id, ctxt) & t->floating_group_mask;
+    return roseCallback_i(end, id, ctxt) & t->floating_group_mask;
 }
 
 /**
@@ -567,10 +562,9 @@ int roseRunBoundaryProgram(const struct RoseEngine *rose, u32 program,
     scratch->tctxt.minMatchOffset = stream_offset;
 
     const u64a som = 0;
-    const size_t match_len = 0;
     const u8 flags = 0;
     hwlmcb_rv_t rv = roseRunProgram(rose, scratch, program, som, stream_offset,
-                                    match_len, flags);
+                                    flags);
     if (rv == HWLM_TERMINATE_MATCHING) {
         return MO_HALT_MATCHING;
     }
@@ -588,10 +582,9 @@ int roseReportAdaptor(u64a start, u64a end, ReportID id, void *context) {
 
     // Our match ID is the program offset.
     const u32 program = id;
-    const size_t match_len = 0; // Unused in this path.
     const u8 flags = ROSE_PROG_FLAG_SKIP_MPV_CATCHUP;
     hwlmcb_rv_t rv =
-        roseRunProgram(rose, scratch, program, start, end, match_len, flags);
+        roseRunProgram(rose, scratch, program, start, end, flags);
     if (rv == HWLM_TERMINATE_MATCHING) {
         return MO_HALT_MATCHING;
     }
index b69ff15851ee3ddb9eb0465dad0fe59e12531d6c..7cd0541d46e6960390379cf94c752fd1282cd36d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2016, Intel Corporation
+ * Copyright (c) 2015-2017, Intel Corporation
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -52,10 +52,9 @@ int roseNfaAdaptor(u64a start, u64a end, ReportID id, void *context);
 
 /* Callbacks, defined in match.c */
 
-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);
+hwlmcb_rv_t roseCallback(size_t end, u32 id, void *ctx);
+hwlmcb_rv_t roseFloatingCallback(size_t end, u32 id, void *ctx);
+hwlmcb_rv_t roseDelayRebuildCallback(size_t end, u32 id, void *ctx);
 int roseAnchoredCallback(u64a start, u64a end, u32 id, void *ctx);
 
 /* Common code, used all over Rose runtime */
index 23532d4066688b22986a84043c35ad9406cd4d26..2f2a6aa307013f0b02f45d1cc92871a6eab10446 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2016, Intel Corporation
+ * Copyright (c) 2015-2017, Intel Corporation
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -43,8 +43,6 @@ int roseNfaEarliestSom(u64a start, UNUSED u64a end, UNUSED ReportID id,
 
 hwlmcb_rv_t roseRunProgram(const struct RoseEngine *t,
                            struct hs_scratch *scratch, u32 programOffset,
-                           u64a som, u64a end, size_t match_len,
-                           u8 prog_flags) {
-    return roseRunProgram_i(t, scratch, programOffset, som, end, match_len,
-                            prog_flags);
+                           u64a som, u64a end, u8 prog_flags) {
+    return roseRunProgram_i(t, scratch, programOffset, som, end, prog_flags);
 }
index b140a2bcdda974cdd540e1bd5d78ab39456769cf..83a34a396d9e7d5e253bc520d86b1466a7f95ca8 100644 (file)
@@ -69,7 +69,7 @@
 
 hwlmcb_rv_t roseRunProgram(const struct RoseEngine *t,
                            struct hs_scratch *scratch, u32 programOffset,
-                           u64a som, u64a end, size_t match_len, u8 prog_flags);
+                           u64a som, u64a end, u8 prog_flags);
 
 /* Inline implementation follows. */
 
@@ -1838,8 +1838,7 @@ void updateSeqPoint(struct RoseContext *tctxt, u64a offset,
 static rose_inline
 hwlmcb_rv_t roseRunProgram_i(const struct RoseEngine *t,
                              struct hs_scratch *scratch, u32 programOffset,
-                             u64a som, u64a end, UNUSED size_t match_len,
-                             u8 prog_flags) {
+                             u64a som, u64a end, u8 prog_flags) {
     DEBUG_PRINTF("program=%u, offsets [%llu,%llu], flags=%u\n", programOffset,
                  som, end, prog_flags);
 
index 9a50f0e91a3a92b184fd9c63e5901632ec663018..568c2b40bfcfc11de3d0628135de83cd758f5fe3 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2016, Intel Corporation
+ * Copyright (c) 2015-2017, Intel Corporation
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -46,7 +46,7 @@ void roseStreamExec(const struct RoseEngine *t, struct hs_scratch *scratch);
 void roseStreamEodExec(const struct RoseEngine *t, u64a offset,
                        struct hs_scratch *scratch);
 
-hwlmcb_rv_t roseCallback(size_t start, size_t end, u32 id, void *context);
+hwlmcb_rv_t roseCallback(size_t end, u32 id, void *context);
 
 int roseReportAdaptor(u64a start, u64a end, ReportID id, void *context);
 
index c68cd8ab99f2eeb3919c5f418e38bb6bee962a6c..1ee0b6d505f27eb976e526d2ebd5d8d1b08005a6 100644 (file)
@@ -742,11 +742,9 @@ void roseStreamEodExec(const struct RoseEngine *t, u64a offset,
     assert(!scratch->tctxt.filledDelayedSlots);
 
     const u64a som = 0;
-    const size_t match_len = 0;
     const u8 flags = ROSE_PROG_FLAG_SKIP_MPV_CATCHUP;
 
     // Note: we ignore the result, as this is the last thing to ever happen on
     // a scan.
-    roseRunProgram(t, scratch, t->eodProgramOffset, som, offset, match_len,
-                   flags);
+    roseRunProgram(t, scratch, t->eodProgramOffset, som, offset, flags);
 }
index bd0bb4c0c047654221a883759ce1de8e9fa733b1..aa14e5d9cfc4aa3ce73e6b841171c922df22967a 100644 (file)
@@ -70,53 +70,43 @@ using namespace ue2;
 namespace {
 
 struct match {
-    size_t start;
     size_t end;
     u32 id;
-    match(size_t start_in, size_t end_in, u32 id_in)
-        : start(start_in), end(end_in), id(id_in) {}
+    match(size_t end_in, u32 id_in)
+        : end(end_in), id(id_in) {}
     bool operator==(const match &b) const {
-        return start == b.start && end == b.end && id == b.id;
+        return end == b.end && id == b.id;
     }
     bool operator<(const match &b) const {
-        if (id < b.id) {
-            return true;
-        } else if (id == b.id) {
-            if (start < b.start) {
-                return true;
-            } else if (start == b.start) {
-                return end < b.end;
-            }
-        }
-        return false;
+        return tie(id, end) < tie(b.id, b.end);
     }
     match operator+(size_t adj) {
-        return match(start + adj, end + adj, id);
+        return match(end + adj, id);
     }
 };
 
 extern "C" {
 
 static
-hwlmcb_rv_t decentCallback(size_t start, size_t end, u32 id, void *ctxt) {
-    DEBUG_PRINTF("match %zu-%zu : %u\n", start, end, id);
+hwlmcb_rv_t decentCallback(size_t end, u32 id, void *ctxt) {
+    DEBUG_PRINTF("match @%zu : %u\n", end, id);
     if (!ctxt) {
         return HWLM_CONTINUE_MATCHING;
     }
 
     vector<match> *out = (vector<match> *)ctxt;
-    out->push_back(match(start, end, id));
+    out->push_back(match(end, id));
     return HWLM_CONTINUE_MATCHING;
 }
 
 static
-hwlmcb_rv_t decentCallbackT(size_t start, size_t end, u32 id, void *ctxt) {
+hwlmcb_rv_t decentCallbackT(size_t end, u32 id, void *ctxt) {
     if (!ctxt) {
         return HWLM_TERMINATE_MATCHING;
     }
 
     vector<match> *out = (vector<match> *)ctxt;
-    out->push_back(match(start, end, id));
+    out->push_back(match(end, id));
     return HWLM_TERMINATE_MATCHING;
 }
 
@@ -169,9 +159,9 @@ TEST_P(FDRp, Simple) {
             &matches, HWLM_ALL_GROUPS);
 
     ASSERT_EQ(3U, matches.size());
-    EXPECT_EQ(match(0, 5, 0), matches[0]);
-    EXPECT_EQ(match(18, 23, 0), matches[1]);
-    EXPECT_EQ(match(78, 83, 0), matches[2]);
+    EXPECT_EQ(match(5, 0), matches[0]);
+    EXPECT_EQ(match(23, 0), matches[1]);
+    EXPECT_EQ(match(83, 0), matches[2]);
 }
 
 TEST_P(FDRp, SimpleSingle) {
@@ -191,10 +181,10 @@ TEST_P(FDRp, SimpleSingle) {
             decentCallback, &matches, HWLM_ALL_GROUPS);
 
     ASSERT_EQ(4U, matches.size());
-    EXPECT_EQ(match(0, 0, 0), matches[0]);
-    EXPECT_EQ(match(18, 18, 0), matches[1]);
-    EXPECT_EQ(match(78, 78, 0), matches[2]);
-    EXPECT_EQ(match(80, 80, 0), matches[3]);
+    EXPECT_EQ(match(0, 0), matches[0]);
+    EXPECT_EQ(match(18, 0), matches[1]);
+    EXPECT_EQ(match(78, 0), matches[2]);
+    EXPECT_EQ(match(80, 0), matches[3]);
 }
 
 TEST_P(FDRp, MultiLocation) {
@@ -217,7 +207,7 @@ TEST_P(FDRp, MultiLocation) {
         fdrExec(fdr.get(), data.data(), testSize, 0, decentCallback, &matches,
                 HWLM_ALL_GROUPS);
         ASSERT_EQ(1U, matches.size());
-        EXPECT_EQ(match(i, i+2, 1), matches[0]);
+        EXPECT_EQ(match(i + 2, 1), matches[0]);
         memset(data.data() + i, 0, 3);
     }
 }
@@ -239,7 +229,7 @@ TEST_P(FDRp, NoRepeat1) {
             decentCallback, &matches, HWLM_ALL_GROUPS);
 
     ASSERT_EQ(1U, matches.size());
-    EXPECT_EQ(match(0, 0, 0), matches[0]);
+    EXPECT_EQ(match(0, 0), matches[0]);
 }
 
 TEST_P(FDRp, NoRepeat2) {
@@ -260,8 +250,8 @@ TEST_P(FDRp, NoRepeat2) {
             decentCallback, &matches, HWLM_ALL_GROUPS);
 
     ASSERT_EQ(3U, matches.size());
-    EXPECT_EQ(match(0, 0, 0), matches[0]);
-    EXPECT_EQ(match(78, 78, 0), matches[2]);
+    EXPECT_EQ(match(0, 0), matches[0]);
+    EXPECT_EQ(match(78, 0), matches[2]);
 }
 
 TEST_P(FDRp, NoRepeat3) {
@@ -282,7 +272,7 @@ TEST_P(FDRp, NoRepeat3) {
             decentCallback, &matches, HWLM_ALL_GROUPS);
 
     ASSERT_EQ(1U, matches.size());
-    EXPECT_EQ(match(31, 32, 0), matches[0]);
+    EXPECT_EQ(match(32, 0), matches[0]);
 }
 
 /**
@@ -315,9 +305,9 @@ TEST_P(FDRp, SmallStreaming) {
     CHECK_WITH_TEDDY_OK_TO_FAIL(fdr, hint);
 
     vector<match> expected, matches;
-    expected.push_back(match(0, 0, 1));
-    expected.push_back(match(1, 1, 1));
-    expected.push_back(match(2, 2, 1));
+    expected.push_back(match(0, 1));
+    expected.push_back(match(1, 1));
+    expected.push_back(match(2, 1));
 
     safeExecStreaming(fdr.get(), (const u8 *)"", 0, (const u8 *)"aaar", 4, 0,
                       decentCallback, &matches, HWLM_ALL_GROUPS);
@@ -328,8 +318,8 @@ TEST_P(FDRp, SmallStreaming) {
     expected.clear();
     matches.clear();
 
-    expected.push_back(match(6, 6, 1));
-    expected.push_back(match(1, 8, 10));
+    expected.push_back(match(6, 1));
+    expected.push_back(match(8, 10));
 
     safeExecStreaming(fdr.get(), (const u8 *)"aaar", 4, (const u8 *)"dvark", 5,
                       0, decentCallback, &matches, HWLM_ALL_GROUPS);
@@ -352,12 +342,12 @@ TEST_P(FDRp, SmallStreaming2) {
     CHECK_WITH_TEDDY_OK_TO_FAIL(fdr, hint);
 
     vector<match> expected, matches;
-    expected.push_back(match(6,6,1));
-    expected.push_back(match(7,7,1));
-    expected.push_back(match(11,11,1));
-    expected.push_back(match(6,13,10));
-    expected.push_back(match(13,14,2));
-    expected.push_back(match(14,15,2));
+    expected.push_back(match(6,1));
+    expected.push_back(match(7,1));
+    expected.push_back(match(11,1));
+    expected.push_back(match(13,10));
+    expected.push_back(match(14,2));
+    expected.push_back(match(15,2));
 
     safeExecStreaming(fdr.get(), (const u8 *)"foobar", 6,
                       (const u8 *)"aardvarkkk", 10, 0, decentCallback, &matches,
@@ -402,7 +392,7 @@ TEST_P(FDRp, moveByteStream) {
     ASSERT_EQ(0, fdrStatus);
 
     ASSERT_EQ(1U, matches.size());
-    EXPECT_EQ(match(12, 17, 0), matches[0]);
+    EXPECT_EQ(match(17, 0), matches[0]);
 }
 
 TEST_P(FDRp, Stream1) {
@@ -431,7 +421,7 @@ TEST_P(FDRp, Stream1) {
 
     ASSERT_EQ(4U, matches.size());
     for (size_t i = 0; i < matches.size(); i++) {
-        EXPECT_EQ(match(i, i, 0), matches[i]);
+        EXPECT_EQ(match(i, 0), matches[i]);
     }
 }
 
@@ -506,8 +496,8 @@ TEST_P(FDRpp, AlignAndTooEarly) {
                     // we should get two and only two matches - at the beginning and
                     // at the end of unaligned buffer
                     ASSERT_EQ(2U, matches.size());
-                    ASSERT_EQ(match(0, litLen - 1, 0), matches[0]);
-                    ASSERT_EQ(match(4 * buf_alignment - litLen, 4 * buf_alignment - 1, 0), matches[1]);
+                    ASSERT_EQ(match(litLen - 1, 0), matches[0]);
+                    ASSERT_EQ(match(4 * buf_alignment - 1, 0), matches[1]);
                     matches.clear();
                 } else {
                     // "Too early" / "too late" condition - should not match anything
@@ -628,7 +618,7 @@ TEST_P(FDRpa, ShortWritings) {
 
                 for (int j = 0; j <= (int)bufLen - (int)patLen; j++) {
                     if (!buf.compare(j, patLen, pat)) {
-                        expMatches.push_back(match(j, j + patLen - 1,
+                        expMatches.push_back(match(j + patLen - 1,
                                                 testSigs[pIdx].id));
                     }
                 }
index 952fffc199fa2fac8ad3d3639ecbe1bc93df1331..3dc79442264b7950d0184d9e847d11e6c09f2107 100644 (file)
@@ -64,34 +64,23 @@ using namespace ue2;
 namespace {
 
 struct match {
-    size_t start;
     size_t end;
     u32 id;
-    match(size_t start_in, size_t end_in, u32 id_in)
-        : start(start_in), end(end_in), id(id_in) {}
+    match(size_t end_in, u32 id_in) : end(end_in), id(id_in) {}
     bool operator==(const match &b) const {
-        return start == b.start && end == b.end && id == b.id;
+        return end == b.end && id == b.id;
     }
     bool operator<(const match &b) const {
-        if (id < b.id) {
-            return true;
-        } else if (id == b.id) {
-            if (start < b.start) {
-                return true;
-            } else if (start == b.start) {
-                return end < b.end;
-            }
-        }
-        return false;
+        return tie(id, end) < tie(b.id, b.end);
     }
     match operator+(size_t adj) {
-        return match(start + adj, end + adj, id);
+        return match(end + adj, id);
     }
 };
 
 template<typename T>
 T &operator<<(T &a, const match &b) {
-    a << "(" << b.start << ", " << b.end << ", " << b.id << ")";
+    a << "(" << b.end << ", " << b.id << ")";
     return a;
 }
 
@@ -107,8 +96,7 @@ T &operator<<(T &a, const vector<match> &b) {
 
 extern "C" {
 
-static hwlmcb_rv_t countCallback(UNUSED size_t start, UNUSED size_t end, u32 id,
-                                 void *cntxt) {
+static hwlmcb_rv_t countCallback(UNUSED size_t end, u32 id, void *cntxt) {
     if (cntxt) {
         map<u32, int> *matchesCounts = (map<u32, int> *)cntxt;
         (*matchesCounts)[id]++;
index 5df662369b1b5142b8a7d4f816df53a285be8d2e..460e77c54828ff9ad0c8b8428bab459d7f5199f2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015-2016, Intel Corporation
+ * Copyright (c) 2015-2017, Intel Corporation
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -45,22 +45,21 @@ using std::vector;
 using namespace ue2;
 
 struct hlmMatchEntry {
-    size_t from;
     size_t to;
     u32 id;
-    hlmMatchEntry(size_t start, size_t end, u32 identifier) :
-            from(start), to(end), id(identifier) {}
+    hlmMatchEntry(size_t end, u32 identifier) :
+            to(end), id(identifier) {}
 };
 
 typedef vector<hlmMatchEntry> hlmMatchRecord;
 
 static
-hwlmcb_rv_t hlmSimpleCallback(size_t from, size_t to, u32 id, void *context) {
+hwlmcb_rv_t hlmSimpleCallback(size_t to, u32 id, void *context) {
     hlmMatchRecord *mr = (hlmMatchRecord *)context;
 
     DEBUG_PRINTF("match @%zu = %u,%p\n", to, id, context);
 
-    mr->push_back(hlmMatchEntry(from, to, id));
+    mr->push_back(hlmMatchEntry(to, id));
 
     return HWLM_CONTINUE_MATCHING;
 }
@@ -89,7 +88,6 @@ TEST(Noodle, nood1) {
     noodleMatch(data, data_len, "a", 1, 0, hlmSimpleCallback, &ctxt);
     ASSERT_EQ(1024U, ctxt.size());
     for (i = 0; i < 1024; i++) {
-        ASSERT_EQ(i, ctxt[i].from);
         ASSERT_EQ(i, ctxt[i].to);
     }
 
@@ -101,7 +99,6 @@ TEST(Noodle, nood1) {
     noodleMatch(data, data_len, "A", 1, 1, hlmSimpleCallback, &ctxt);
     ASSERT_EQ(1024U, ctxt.size());
     for (i = 0; i < 1024; i++) {
-        ASSERT_EQ(i, ctxt[i].from);
         ASSERT_EQ(i, ctxt[i].to);
     }
 
@@ -111,7 +108,6 @@ TEST(Noodle, nood1) {
                     &ctxt);
         ASSERT_EQ(1024 - j, ctxt.size());
         for (i = 0; i < 1024 - j; i++) {
-            ASSERT_EQ(i, ctxt[i].from);
             ASSERT_EQ(i, ctxt[i].to);
         }
 
@@ -119,7 +115,6 @@ TEST(Noodle, nood1) {
         noodleMatch(data, data_len - j, "A", 1, 1, hlmSimpleCallback, &ctxt);
         ASSERT_EQ(1024 - j, ctxt.size());
         for (i = 0; i < 1024 - j; i++) {
-            ASSERT_EQ(i, ctxt[i].from);
             ASSERT_EQ(i, ctxt[i].to);
         }
     }
@@ -136,7 +131,6 @@ TEST(Noodle, nood2) {
     noodleMatch(data, data_len, "aa", 2, 0, hlmSimpleCallback, &ctxt);
     ASSERT_EQ(1023U, ctxt.size());
     for (i = 0; i < 1023; i++) {
-        ASSERT_EQ(i, ctxt[i].from);
         ASSERT_EQ(i + 1, ctxt[i].to);
     }
 
@@ -152,7 +146,6 @@ TEST(Noodle, nood2) {
     noodleMatch(data, data_len, "aa", 2, 1, hlmSimpleCallback, &ctxt);
     ASSERT_EQ(1023U, ctxt.size());
     for (i = 0; i < 1023; i++) {
-        ASSERT_EQ(i, ctxt[i].from);
         ASSERT_EQ(i + 1, ctxt[i].to);
     }
 
@@ -160,7 +153,6 @@ TEST(Noodle, nood2) {
     noodleMatch(data, data_len, "Aa", 2, 1, hlmSimpleCallback, &ctxt);
     ASSERT_EQ(1023U, ctxt.size());
     for (i = 0; i < 1023; i++) {
-        ASSERT_EQ(i, ctxt[i].from);
         ASSERT_EQ(i + 1, ctxt[i].to);
     }
 
@@ -168,7 +160,6 @@ TEST(Noodle, nood2) {
     noodleMatch(data, data_len, "AA", 2, 1, hlmSimpleCallback, &ctxt);
     ASSERT_EQ(1023U, ctxt.size());
     for (i = 0; i < 1023; i++) {
-        ASSERT_EQ(i, ctxt[i].from);
         ASSERT_EQ(i + 1, ctxt[i].to);
     }
 
@@ -178,7 +169,6 @@ TEST(Noodle, nood2) {
                     &ctxt);
         ASSERT_EQ(1023 - j, ctxt.size());
         for (i = 0; i < 1023 - j; i++) {
-            ASSERT_EQ(i, ctxt[i].from);
             ASSERT_EQ(i + 1, ctxt[i].to);
         }
 
@@ -186,7 +176,6 @@ TEST(Noodle, nood2) {
         noodleMatch(data, data_len - j, "aA", 2, 1, hlmSimpleCallback, &ctxt);
         ASSERT_EQ(1023 - j, ctxt.size());
         for (i = 0; i < 1023 - j; i++) {
-            ASSERT_EQ(i, ctxt[i].from);
             ASSERT_EQ(i + 1, ctxt[i].to);
         }
     }
@@ -203,7 +192,6 @@ TEST(Noodle, noodLong) {
     noodleMatch(data, data_len, "aaaa", 4, 0, hlmSimpleCallback, &ctxt);
     ASSERT_EQ(1021U, ctxt.size());
     for (i = 0; i < 1021; i++) {
-        ASSERT_EQ(i, ctxt[i].from);
         ASSERT_EQ(i + 3, ctxt[i].to);
     }
 
@@ -215,7 +203,6 @@ TEST(Noodle, noodLong) {
     noodleMatch(data, data_len, "aaAA", 4, 1, hlmSimpleCallback, &ctxt);
     ASSERT_EQ(1021U, ctxt.size());
     for (i = 0; i < 1021; i++) {
-        ASSERT_EQ(i, ctxt[i].from);
         ASSERT_EQ(i + 3, ctxt[i].to);
     }
 
@@ -225,7 +212,6 @@ TEST(Noodle, noodLong) {
                     &ctxt);
         ASSERT_EQ(1021 - j, ctxt.size());
         for (i = 0; i < 1021 - j; i++) {
-            ASSERT_EQ(i, ctxt[i].from);
             ASSERT_EQ(i + 3, ctxt[i].to);
         }
 
@@ -234,7 +220,6 @@ TEST(Noodle, noodLong) {
                     &ctxt);
         ASSERT_EQ(1021 - j, ctxt.size());
         for (i = 0; i < 1021 - j; i++) {
-            ASSERT_EQ(i, ctxt[i].from);
             ASSERT_EQ(i + 3, ctxt[i].to);
         }
     }
@@ -253,7 +238,6 @@ TEST(Noodle, noodCutoverSingle) {
             noodleMatch(data + align, len, "a", 1, 0, hlmSimpleCallback, &ctxt);
             EXPECT_EQ(len, ctxt.size());
             for (u32 i = 0; i < ctxt.size(); i++) {
-                ASSERT_EQ(i, ctxt[i].from);
                 ASSERT_EQ(i, ctxt[i].to);
             }
         }
@@ -274,7 +258,6 @@ TEST(Noodle, noodCutoverDouble) {
                         &ctxt);
             EXPECT_EQ(len ? len - 1 : 0U, ctxt.size());
             for (u32 i = 0; i < ctxt.size(); i++) {
-                ASSERT_EQ(i, ctxt[i].from);
                 ASSERT_EQ(i + 1, ctxt[i].to);
             }
         }