]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
fdr: remove dead code to do with link structures
authorJustin Viiret <justin.viiret@intel.com>
Wed, 25 Jan 2017 00:49:53 +0000 (11:49 +1100)
committerMatthew Barr <matthew.barr@intel.com>
Wed, 26 Apr 2017 04:43:43 +0000 (14:43 +1000)
src/fdr/fdr_compile.cpp
src/fdr/fdr_internal.h
src/fdr/teddy_compile.cpp
src/fdr/teddy_compile.h

index cd3b57deb7b6ae5746b3a28a63f90517ea5ec925..953b2dab879bbca6b76059cb0a7e87ae421214e4 100644 (file)
@@ -84,7 +84,7 @@ private:
     void dumpMasks(const u8 *defaultMask);
 #endif
     void setupTab();
-    aligned_unique_ptr<FDR> setupFDR(pair<aligned_unique_ptr<u8>, size_t> &link);
+    aligned_unique_ptr<FDR> setupFDR();
     void createInitialState(FDR *fdr);
 
 public:
@@ -93,7 +93,7 @@ public:
         : eng(eng_in), tab(eng_in.getTabSizeBytes()), lits(move(lits_in)),
           make_small(make_small_in) {}
 
-    aligned_unique_ptr<FDR> build(pair<aligned_unique_ptr<u8>, size_t> &link);
+    aligned_unique_ptr<FDR> build();
 };
 
 u8 *FDRCompiler::tabIndexToMask(u32 indexInTable) {
@@ -142,8 +142,7 @@ void FDRCompiler::createInitialState(FDR *fdr) {
     }
 }
 
-aligned_unique_ptr<FDR>
-FDRCompiler::setupFDR(pair<aligned_unique_ptr<u8>, size_t> &link) {
+aligned_unique_ptr<FDR> FDRCompiler::setupFDR() {
     size_t tabSize = eng.getTabSizeBytes();
 
     auto floodControlTmp = setupFDRFloodControl(lits, eng);
@@ -152,10 +151,9 @@ FDRCompiler::setupFDR(pair<aligned_unique_ptr<u8>, size_t> &link) {
     assert(ISALIGNED_16(tabSize));
     assert(ISALIGNED_16(confirmTmp.second));
     assert(ISALIGNED_16(floodControlTmp.second));
-    assert(ISALIGNED_16(link.second));
     size_t headerSize = ROUNDUP_16(sizeof(FDR));
     size_t size = ROUNDUP_16(headerSize + tabSize + confirmTmp.second +
-                             floodControlTmp.second + link.second);
+                             floodControlTmp.second);
 
     DEBUG_PRINTF("sizes base=%zu tabSize=%zu confirm=%zu floodControl=%zu "
                  "total=%zu\n",
@@ -189,13 +187,6 @@ FDRCompiler::setupFDR(pair<aligned_unique_ptr<u8>, size_t> &link) {
     fdr->tabSize = (1 << eng.bits) * (eng.schemeWidth / 8);
     fdr->stride = eng.stride;
 
-    if (link.first) {
-        fdr->link = verify_u32(ptr - fdr_base);
-        memcpy(ptr, link.first.get(), link.second);
-    } else {
-        fdr->link = 0;
-    }
-
     return fdr;
 }
 
@@ -535,11 +526,10 @@ void FDRCompiler::setupTab() {
 #endif
 }
 
-aligned_unique_ptr<FDR>
-FDRCompiler::build(pair<aligned_unique_ptr<u8>, size_t> &link) {
+aligned_unique_ptr<FDR> FDRCompiler::build() {
     assignStringsToBuckets();
     setupTab();
-    return setupFDR(link);
+    return setupFDR();
 }
 
 } // namespace
@@ -549,12 +539,10 @@ aligned_unique_ptr<FDR> fdrBuildTableInternal(const vector<hwlmLiteral> &lits,
                                               bool make_small,
                                               const target_t &target,
                                               const Grey &grey, u32 hint) {
-    pair<aligned_unique_ptr<u8>, size_t> link(nullptr, 0);
-
     DEBUG_PRINTF("cpu has %s\n", target.has_avx2() ? "avx2" : "no-avx2");
 
     if (grey.fdrAllowTeddy) {
-        auto fdr = teddyBuildTableHinted(lits, make_small, hint, target, link);
+        auto fdr = teddyBuildTableHinted(lits, make_small, hint, target);
         if (fdr) {
             DEBUG_PRINTF("build with teddy succeeded\n");
             return fdr;
@@ -578,7 +566,7 @@ aligned_unique_ptr<FDR> fdrBuildTableInternal(const vector<hwlmLiteral> &lits,
     }
 
     FDRCompiler fc(lits, *des, make_small);
-    return fc.build(link);
+    return fc.build();
 }
 
 aligned_unique_ptr<FDR> fdrBuildTable(const vector<hwlmLiteral> &lits,
index 3bf828377fbdf0aeceacbcf4411e88d73a085cc2..a425d78c894d930accdf5ea2d271b18530ade329 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:
@@ -71,11 +71,6 @@ struct FDR {
     u32 maxStringLen;
     u32 floodOffset;
 
-    /** link is the relative offset of a secondary included FDR table for
-     * stream handling if we're a primary FDR table or the subsidiary tertiary
-     * structures (spillover strings and hash table) if we're a secondary
-     * structure. */
-    u32 link;
     u8 stride; /* stride - how frequeuntly the data is consulted by the first
                 * stage matcher */
     u8 domain; /* number of bits used to index into main FDR table. This value
index ac3a02032d67ddc8a1d47f53cd2184223c72affe..66466e6cb4205dac3934b061615c4dd6c959f635 100644 (file)
@@ -74,7 +74,7 @@ public:
                   const TeddyEngineDescription &eng_in, bool make_small_in)
         : eng(eng_in), lits(lits_in), make_small(make_small_in) {}
 
-    aligned_unique_ptr<FDR> build(pair<aligned_unique_ptr<u8>, size_t> &link);
+    aligned_unique_ptr<FDR> build();
     bool pack(map<BucketIndex, std::vector<LiteralIndex> > &bucketToLits);
 };
 
@@ -274,8 +274,7 @@ bool TeddyCompiler::pack(map<BucketIndex,
     return true;
 }
 
-aligned_unique_ptr<FDR>
-TeddyCompiler::build(pair<aligned_unique_ptr<u8>, size_t> &link) {
+aligned_unique_ptr<FDR> TeddyCompiler::build() {
     if (lits.size() > eng.getNumBuckets() * TEDDY_BUCKET_LOAD) {
         DEBUG_PRINTF("too many literals: %zu\n", lits.size());
         return nullptr;
@@ -312,10 +311,10 @@ TeddyCompiler::build(pair<aligned_unique_ptr<u8>, size_t> &link) {
     auto confirmTmp = setupFullConfs(lits, eng, bucketToLits, make_small);
 
     size_t size = ROUNDUP_N(sizeof(Teddy) +
-                             maskLen +
-                             confirmTmp.second +
-                             floodControlTmp.second +
-                             link.second, 16 * maskWidth);
+                            maskLen +
+                            confirmTmp.second +
+                            floodControlTmp.second,
+                            16 * maskWidth);
 
     aligned_unique_ptr<FDR> fdr = aligned_zmalloc_unique<FDR>(size);
     assert(fdr); // otherwise would have thrown std::bad_alloc
@@ -334,13 +333,6 @@ TeddyCompiler::build(pair<aligned_unique_ptr<u8>, size_t> &link) {
     memcpy(ptr, floodControlTmp.first.get(), floodControlTmp.second);
     ptr += floodControlTmp.second;
 
-    if (link.first) {
-        teddy->link = verify_u32(ptr - teddy_base);
-        memcpy(ptr, link.first.get(), link.second);
-    } else {
-        teddy->link = 0;
-    }
-
     u8 *baseMsk = teddy_base + sizeof(Teddy);
 
     for (const auto &b2l : bucketToLits) {
@@ -423,10 +415,9 @@ TeddyCompiler::build(pair<aligned_unique_ptr<u8>, size_t> &link) {
 
 } // namespace
 
-aligned_unique_ptr<FDR>
-teddyBuildTableHinted(const vector<hwlmLiteral> &lits, bool make_small,
-                      u32 hint, const target_t &target,
-                      pair<aligned_unique_ptr<u8>, size_t> &link) {
+aligned_unique_ptr<FDR> teddyBuildTableHinted(const vector<hwlmLiteral> &lits,
+                                              bool make_small, u32 hint,
+                                              const target_t &target) {
     unique_ptr<TeddyEngineDescription> des;
     if (hint == HINT_INVALID) {
         des = chooseTeddyEngine(target, lits);
@@ -437,7 +428,7 @@ teddyBuildTableHinted(const vector<hwlmLiteral> &lits, bool make_small,
         return nullptr;
     }
     TeddyCompiler tc(lits, *des, make_small);
-    return tc.build(link);
+    return tc.build();
 }
 
 } // namespace ue2
index 276c1347be2d73c4f676f6df14d9266a74e4e3b5..bdd1586575317355580caeab3bfcc1bc7f347c48 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:
@@ -37,7 +37,6 @@
 #include "util/alloc.h"
 
 #include <vector>
-#include <utility> // std::pair
 
 struct FDR;
 struct target_t;
@@ -48,8 +47,7 @@ struct hwlmLiteral;
 
 ue2::aligned_unique_ptr<FDR>
 teddyBuildTableHinted(const std::vector<hwlmLiteral> &lits, bool make_small,
-                      u32 hint, const target_t &target,
-                      std::pair<aligned_unique_ptr<u8>, size_t> &link);
+                      u32 hint, const target_t &target);
 
 } // namespace ue2