]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
util: switch from Boost to std::unordered set/map
authorJustin Viiret <justin.viiret@intel.com>
Fri, 14 Jul 2017 04:59:52 +0000 (14:59 +1000)
committerMatthew Barr <matthew.barr@intel.com>
Mon, 21 Aug 2017 01:14:55 +0000 (11:14 +1000)
This commit replaces the ue2::unordered_{set,map} types with their STL
versions, with some new hashing utilities in util/hash.h. The new types
ue2_unordered_set<T> and ue2_unordered_map<Key, T> default to using the
ue2_hasher.

The header util/ue2_containers.h has been removed, and the flat_set/map
containers moved to util/flat_containers.h.

123 files changed:
CMakeLists.txt
src/fdr/fdr_compile.cpp
src/fdr/fdr_engine_description.h
src/fdr/teddy_compile.cpp
src/nfa/accel_dfa_build_strat.cpp
src/nfa/accel_dump.cpp
src/nfa/accelcompile.h
src/nfa/castlecompile.cpp
src/nfa/castlecompile.h
src/nfa/dfa_min.cpp
src/nfa/goughcompile.cpp
src/nfa/goughcompile.h
src/nfa/goughcompile_internal.h
src/nfa/goughcompile_reg.cpp
src/nfa/limex_compile.cpp
src/nfa/limex_compile.h
src/nfa/mcclellancompile.cpp
src/nfa/mcclellancompile.h
src/nfa/mcclellancompile_util.cpp
src/nfa/mcsheng_compile.cpp
src/nfa/rdfa.h
src/nfa/rdfa_merge.cpp
src/nfa/shengcompile.h
src/nfa/shufticompile.cpp
src/nfa/shufticompile.h
src/nfa/trufflecompile.cpp
src/nfagraph/ng.h
src/nfagraph/ng_calc_components.cpp
src/nfagraph/ng_cyclic_redundancy.cpp
src/nfagraph/ng_dominators.cpp
src/nfagraph/ng_dominators.h
src/nfagraph/ng_dump.cpp
src/nfagraph/ng_dump.h
src/nfagraph/ng_edge_redundancy.cpp
src/nfagraph/ng_equivalence.cpp
src/nfagraph/ng_execute.h
src/nfagraph/ng_haig.cpp
src/nfagraph/ng_holder.h
src/nfagraph/ng_is_equal.cpp
src/nfagraph/ng_limex.cpp
src/nfagraph/ng_limex_accel.h
src/nfagraph/ng_literal_analysis.cpp
src/nfagraph/ng_literal_component.cpp
src/nfagraph/ng_mcclellan.cpp
src/nfagraph/ng_mcclellan_internal.h
src/nfagraph/ng_misc_opt.cpp
src/nfagraph/ng_prefilter.cpp
src/nfagraph/ng_prune.cpp
src/nfagraph/ng_redundancy.cpp
src/nfagraph/ng_region.cpp
src/nfagraph/ng_region.h
src/nfagraph/ng_region_redundancy.cpp
src/nfagraph/ng_repeat.cpp
src/nfagraph/ng_repeat.h
src/nfagraph/ng_restructuring.cpp
src/nfagraph/ng_restructuring.h
src/nfagraph/ng_revacc.cpp
src/nfagraph/ng_som.cpp
src/nfagraph/ng_som_util.cpp
src/nfagraph/ng_som_util.h
src/nfagraph/ng_split.cpp
src/nfagraph/ng_split.h
src/nfagraph/ng_squash.cpp
src/nfagraph/ng_squash.h
src/nfagraph/ng_undirected.h
src/nfagraph/ng_util.cpp
src/nfagraph/ng_util.h
src/nfagraph/ng_violet.cpp
src/parser/Parser.rl
src/parser/buildstate.cpp
src/parser/check_refs.cpp
src/parser/check_refs.h
src/rose/rose_build.h
src/rose/rose_build_add.cpp
src/rose/rose_build_anchored.cpp
src/rose/rose_build_bytecode.cpp
src/rose/rose_build_castle.cpp
src/rose/rose_build_compile.cpp
src/rose/rose_build_convert.cpp
src/rose/rose_build_engine_blob.h
src/rose/rose_build_exclusive.cpp
src/rose/rose_build_groups.h
src/rose/rose_build_impl.h
src/rose/rose_build_infix.cpp
src/rose/rose_build_instructions.h
src/rose/rose_build_lookaround.cpp
src/rose/rose_build_lookaround.h
src/rose/rose_build_merge.cpp
src/rose/rose_build_misc.cpp
src/rose/rose_build_program.cpp
src/rose/rose_build_program.h
src/rose/rose_build_role_aliasing.cpp
src/rose/rose_graph.h
src/rose/rose_in_graph.h
src/rose/rose_in_util.cpp
src/som/slot_manager.cpp
src/som/slot_manager.h
src/som/slot_manager_internal.h
src/util/accel_scheme.h
src/util/bitfield.h
src/util/charreach.h
src/util/clique.cpp
src/util/depth.h
src/util/flat_containers.h [moved from src/util/ue2_containers.h with 96% similarity]
src/util/graph.h
src/util/hash.h
src/util/hash_dynamic_bitset.h
src/util/multibit_build.h
src/util/partitioned_set.h
src/util/report.h
src/util/report_manager.h
src/util/ue2_graph.h
src/util/ue2string.cpp
src/util/ue2string.h
src/util/unordered.h [new file with mode: 0644]
unit/internal/bitfield.cpp
unit/internal/depth.cpp
unit/internal/flat_map.cpp
unit/internal/flat_set.cpp
unit/internal/nfagraph_util.cpp
unit/internal/rose_build_merge.cpp
util/ng_corpus_generator.cpp
util/ng_find_matches.cpp

index c51d613371ff443761d01897a2c09bc269502d55..9aa308190853e68ae7b3288b85a2e980c28b3c99 100644 (file)
@@ -997,6 +997,7 @@ SET (hs_SRCS
     src/util/dump_mask.h
     src/util/fatbit_build.cpp
     src/util/fatbit_build.h
+    src/util/flat_containers.h
     src/util/graph.h
     src/util/graph_range.h
     src/util/graph_small_color_map.h
@@ -1019,7 +1020,6 @@ SET (hs_SRCS
     src/util/small_vector.h
     src/util/target_info.cpp
     src/util/target_info.h
-    src/util/ue2_containers.h
     src/util/ue2_graph.h
     src/util/ue2string.cpp
     src/util/ue2string.h
@@ -1027,6 +1027,7 @@ SET (hs_SRCS
     src/util/unicode_def.h
     src/util/unicode_set.h
     src/util/uniform_ops.h
+    src/util/unordered.h
     src/util/verify_types.h
 )
 
index dc91010e2a795bf74b6f4c6d9576f64f2ade1eec..210729a7bd50100e28fbfcd06b9327e5c6c86f97 100644 (file)
@@ -48,7 +48,6 @@
 #include "util/math.h"
 #include "util/noncopyable.h"
 #include "util/target_info.h"
-#include "util/ue2_containers.h"
 #include "util/ue2string.h"
 #include "util/verify_types.h"
 
@@ -64,6 +63,8 @@
 #include <numeric>
 #include <set>
 #include <string>
+#include <unordered_map>
+#include <unordered_set>
 #include <vector>
 
 #include <boost/multi_array.hpp>
@@ -459,7 +460,7 @@ bool getMultiEntriesAtPosition(const FDREngineDescription &eng,
                                const vector<LiteralIndex> &vl,
                                const vector<hwlmLiteral> &lits,
                                SuffixPositionInString pos,
-                               std::map<u32, ue2::unordered_set<u32> > &m2) {
+                               map<u32, unordered_set<u32>> &m2) {
     assert(eng.bits < 32);
 
     u32 distance = 0;
@@ -530,7 +531,7 @@ void FDRCompiler::setupTab() {
         SuffixPositionInString pLimit = eng.getBucketWidth(b);
         for (SuffixPositionInString pos = 0; pos < pLimit; pos++) {
             u32 bit = eng.getSchemeBit(b, pos);
-            map<u32, ue2::unordered_set<u32>> m2;
+            map<u32, unordered_set<u32>> m2;
             bool done = getMultiEntriesAtPosition(eng, vl, lits, pos, m2);
             if (done) {
                 clearbit(&defaultMask[0], bit);
@@ -538,7 +539,7 @@ void FDRCompiler::setupTab() {
             }
             for (const auto &elem : m2) {
                 u32 dc = elem.first;
-                const ue2::unordered_set<u32> &mskSet = elem.second;
+                const unordered_set<u32> &mskSet = elem.second;
                 u32 v = ~dc;
                 do {
                     u32 b2 = v & dc;
index 09c5ce867130dc5d3ab502c649d0f1d75bbf1df1..1c464fe3ad1241dd0f7d834808374d4d99bd41ba 100644 (file)
@@ -30,7 +30,6 @@
 #define FDR_ENGINE_DESCRIPTION_H
 
 #include "engine_description.h"
-#include "util/ue2_containers.h"
 
 #include <map>
 #include <memory>
index bb02f7598629c874f5b5bdc740e400a21cab3275..987361347edb6d110849429a16912227e8db71bb 100644 (file)
@@ -49,6 +49,7 @@
 #include "util/make_unique.h"
 #include "util/noncopyable.h"
 #include "util/popcount.h"
+#include "util/small_vector.h"
 #include "util/target_info.h"
 #include "util/verify_types.h"
 
index 7c56ba72366462d027ea6c58e8badae1ceaf2c2d..928e078e2df9c9e710804e2e3e4e27792605556f 100644 (file)
@@ -41,6 +41,7 @@
 #include "util/verify_types.h"
 
 #include <sstream>
+#include <unordered_set>
 #include <vector>
 
 #define PATHS_LIMIT 500
@@ -254,7 +255,7 @@ dstate_id_t get_sds_or_proxy(const raw_dfa &raw) {
 
     u16 top_remap = raw.alpha_remap[TOP];
 
-    ue2::unordered_set<dstate_id_t> seen;
+    std::unordered_set<dstate_id_t> seen;
     while (true) {
         seen.insert(s);
         DEBUG_PRINTF("basis %hu\n", s);
index 0d19fa8c6dfb8f69b1261445ba9c9d82107fbd40..4c33b3516d768cc1133af34c3ce6b2e924d3ea43 100644 (file)
@@ -44,6 +44,8 @@
 #include "util/simd_types.h"
 
 #include <cstdio>
+#include <map>
+#include <set>
 #include <vector>
 
 #ifndef DUMP_SUPPORT
index 9bd4ff18d28f34549732a4b2d3fdb901ca3d6b30..d0b3cdc74f79c011f64c6c23ddaedff0ec1b8fdd 100644 (file)
@@ -31,7 +31,7 @@
 
 #include "ue2common.h"
 #include "util/charreach.h"
-#include "util/ue2_containers.h"
+#include "util/flat_containers.h"
 
 union AccelAux;
 
index 40fbc18cb5da8a1f134c6514b74a071ea76fdfa8..3505e08afa6efc4d33c559589e32d904b03fcebc 100644 (file)
 #include "util/compile_context.h"
 #include "util/container.h"
 #include "util/dump_charclass.h"
+#include "util/flat_containers.h"
 #include "util/graph.h"
 #include "util/make_unique.h"
 #include "util/multibit_build.h"
 #include "util/report_manager.h"
-#include "util/ue2_containers.h"
 #include "util/verify_types.h"
 #include "grey.h"
 
@@ -153,7 +153,7 @@ static
 void getNeighborInfo(const CliqueGraph &g, vector<u32> &neighbor,
                      const CliqueVertex &cv, const set<u32> &group) {
     u32 id = g[cv].stateId;
-    ue2::unordered_set<u32> neighborId;
+    unordered_set<u32> neighborId;
 
     // find neighbors for cv
     for (const auto &v : adjacent_vertices_range(cv, g)) {
index 9f44692d4146f5fa744101e9422253a3226ddb48..aa4ed354942adbf4a42a800e4f1aaf741ebe9109 100644 (file)
 #include "nfagraph/ng_repeat.h"
 #include "util/bytecode_ptr.h"
 #include "util/depth.h"
-#include "util/ue2_containers.h"
+#include "util/flat_containers.h"
 
 #include <map>
 #include <memory>
 #include <set>
+#include <unordered_map>
 #include <vector>
 
 struct NFA;
@@ -89,7 +90,7 @@ struct CastleProto {
     std::map<u32, PureRepeat> repeats;
 
     /** \brief Mapping from report to associated tops. */
-    ue2::unordered_map<ReportID, flat_set<u32>> report_map;
+    std::unordered_map<ReportID, flat_set<u32>> report_map;
 
     /**
      * \brief Next top id to use. Repeats may be removed without top remapping,
@@ -155,7 +156,7 @@ bool is_equal(const CastleProto &c1, const CastleProto &c2);
  * of the reports in the given set.
  */
 bool requiresDedupe(const CastleProto &proto,
-                    const ue2::flat_set<ReportID> &reports);
+                    const flat_set<ReportID> &reports);
 
 /**
  * \brief Build an NGHolder from a CastleProto.
index c97ca5fb989dc5ce3f4769af7ececc5520def494..1a07e8a7d364b4d18f800e5ba390ce9829250960 100644 (file)
@@ -63,9 +63,9 @@
 #include "rdfa.h"
 #include "ue2common.h"
 #include "util/container.h"
+#include "util/flat_containers.h"
 #include "util/noncopyable.h"
 #include "util/partitioned_set.h"
-#include "util/ue2_containers.h"
 
 #include <algorithm>
 #include <functional>
index 58b05d3d17d526f73a8ef58c18b8fbd357f3c102..ba7f271844842c3ce6084e88850af49370545a8f 100644 (file)
 #include "nfa_internal.h"
 #include "util/compile_context.h"
 #include "util/container.h"
+#include "util/flat_containers.h"
 #include "util/graph_range.h"
 #include "util/make_unique.h"
 #include "util/order_check.h"
 #include "util/report_manager.h"
-#include "util/ue2_containers.h"
 #include "util/verify_types.h"
 
 #include "ue2common.h"
index 72469f3caf1e2dbede56a704c934724561a611ec..00da1891ec03f2698595574c6e685929945d9be5 100644 (file)
@@ -33,7 +33,7 @@
 #include "nfa_kind.h"
 #include "ue2common.h"
 #include "util/bytecode_ptr.h"
-#include "util/ue2_containers.h"
+#include "util/flat_containers.h"
 #include "util/order_check.h"
 
 #include <map>
index a6ba0d1b82763771366c5570fb1139c30aff1956..9de88c77293a2b5ec3915c0585ec0735e6592c15 100644 (file)
@@ -33,9 +33,9 @@
 #include "mcclellancompile.h"
 #include "ue2common.h"
 #include "util/charreach.h"
+#include "util/flat_containers.h"
 #include "util/noncopyable.h"
 #include "util/order_check.h"
-#include "util/ue2_containers.h"
 
 #include <map>
 #include <memory>
index a9370450e97d01d3066bb3b842288b24fd4e61ed..48e515b9ad32d95474470a0bb20b0557ae93ca91 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 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:
 #include "gough_internal.h"
 #include "grey.h"
 #include "util/container.h"
+#include "util/flat_containers.h"
 #include "util/graph.h"
 #include "util/graph_range.h"
 #include "util/order_check.h"
-#include "util/ue2_containers.h"
 
 #include "ue2common.h"
 
@@ -235,7 +235,7 @@ void handle_pending_vertices(GoughSSAVar *def, const GoughGraph &g,
     if (contains(aux.containing_v, def)) {
         def_v = aux.containing_v.at(def);
     }
-    ue2::unordered_set<GoughVertex> done;
+    unordered_set<GoughVertex> done;
     while (!pending_vertex.empty()) {
         GoughVertex current = *pending_vertex.begin();
         pending_vertex.erase(current);
index 5e18b80047f8de0990ae1f5e42695e50c9d9050f..94d9961bf9cf260f90a5d9343cf8c12739b07a89 100644 (file)
 #include "util/charreach.h"
 #include "util/compile_context.h"
 #include "util/container.h"
+#include "util/flat_containers.h"
 #include "util/graph.h"
 #include "util/graph_range.h"
 #include "util/graph_small_color_map.h"
 #include "util/order_check.h"
+#include "util/unordered.h"
 #include "util/verify_types.h"
-#include "util/ue2_containers.h"
 
 #include <algorithm>
 #include <cassert>
@@ -97,16 +98,16 @@ struct precalcAccel {
 };
 
 struct limex_accel_info {
-    ue2::unordered_set<NFAVertex> accelerable;
+    unordered_set<NFAVertex> accelerable;
     map<NFAStateSet, precalcAccel> precalc;
-    ue2::unordered_map<NFAVertex, flat_set<NFAVertex>> friends;
-    ue2::unordered_map<NFAVertex, AccelScheme> accel_map;
+    unordered_map<NFAVertex, flat_set<NFAVertex>> friends;
+    unordered_map<NFAVertex, AccelScheme> accel_map;
 };
 
 static
 map<NFAVertex, NFAStateSet>
 reindexByStateId(const map<NFAVertex, NFAStateSet> &in, const NGHolder &g,
-                 const ue2::unordered_map<NFAVertex, u32> &state_ids,
+                 const unordered_map<NFAVertex, u32> &state_ids,
                  const u32 num_states) {
     map<NFAVertex, NFAStateSet> out;
 
@@ -138,7 +139,7 @@ reindexByStateId(const map<NFAVertex, NFAStateSet> &in, const NGHolder &g,
 
 struct build_info {
     build_info(NGHolder &hi,
-               const ue2::unordered_map<NFAVertex, u32> &states_in,
+               const unordered_map<NFAVertex, u32> &states_in,
                const vector<BoundedRepeatData> &ri,
                const map<NFAVertex, NFAStateSet> &rsmi,
                const map<NFAVertex, NFAStateSet> &smi,
@@ -161,7 +162,7 @@ struct build_info {
     }
 
     NGHolder &h;
-    const ue2::unordered_map<NFAVertex, u32> &state_ids;
+    const unordered_map<NFAVertex, u32> &state_ids;
     const vector<BoundedRepeatData> &repeats;
 
     // Squash maps; state sets are indexed by state_id.
@@ -169,7 +170,7 @@ struct build_info {
     map<NFAVertex, NFAStateSet> squashMap;
 
     const map<u32, set<NFAVertex>> &tops;
-    ue2::unordered_set<NFAVertex> tugs;
+    unordered_set<NFAVertex> tugs;
     map<NFAVertex, BoundedRepeatSummary> br_cyclic;
     const set<NFAVertex> &zombies;
     bool do_accel;
@@ -479,7 +480,7 @@ bool allow_wide_accel(const vector<NFAVertex> &vv, const NGHolder &g,
 static
 void nfaFindAccelSchemes(const NGHolder &g,
                          const map<NFAVertex, BoundedRepeatSummary> &br_cyclic,
-                         ue2::unordered_map<NFAVertex, AccelScheme> *out) {
+                         unordered_map<NFAVertex, AccelScheme> *out) {
     vector<CharReach> refined_cr = reduced_cr(g, br_cyclic);
 
     NFAVertex sds_or_proxy = get_sds_or_proxy(g);
@@ -504,8 +505,8 @@ void nfaFindAccelSchemes(const NGHolder &g,
 }
 
 struct fas_visitor : public boost::default_bfs_visitor {
-    fas_visitor(const ue2::unordered_map<NFAVertex, AccelScheme> &am_in,
-                ue2::unordered_map<NFAVertex, AccelScheme> *out_in)
+    fas_visitor(const unordered_map<NFAVertex, AccelScheme> &am_in,
+                unordered_map<NFAVertex, AccelScheme> *out_in)
         : accel_map(am_in), out(out_in) {}
 
     void discover_vertex(NFAVertex v, const NGHolder &) {
@@ -516,13 +517,13 @@ struct fas_visitor : public boost::default_bfs_visitor {
             throw this; /* done */
         }
     }
-    const ue2::unordered_map<NFAVertex, AccelScheme> &accel_map;
-    ue2::unordered_map<NFAVertex, AccelScheme> *out;
+    const unordered_map<NFAVertex, AccelScheme> &accel_map;
+    unordered_map<NFAVertex, AccelScheme> *out;
 };
 
 static
 void filterAccelStates(NGHolder &g, const map<u32, set<NFAVertex>> &tops,
-                       ue2::unordered_map<NFAVertex, AccelScheme> *accel_map) {
+                       unordered_map<NFAVertex, AccelScheme> *accel_map) {
     /* We want the NFA_MAX_ACCEL_STATES best acceleration states, everything
      * else should be ditched. We use a simple BFS to choose accel states near
      * the start. */
@@ -542,7 +543,7 @@ void filterAccelStates(NGHolder &g, const map<u32, set<NFAVertex>> &tops,
         tempEdges.push_back(e); // Remove edge later.
     }
 
-    ue2::unordered_map<NFAVertex, AccelScheme> out;
+    unordered_map<NFAVertex, AccelScheme> out;
 
     try {
         boost::breadth_first_search(g, g.start,
@@ -982,16 +983,18 @@ u32 addSquashMask(const build_info &args, const NFAVertex &v,
     return idx;
 }
 
+using ReportListCache = ue2_unordered_map<vector<ReportID>, u32>;
+
 static
 u32 addReports(const flat_set<ReportID> &r, vector<ReportID> &reports,
-               unordered_map<vector<ReportID>, u32> &reportListCache) {
+               ReportListCache &reports_cache) {
     assert(!r.empty());
 
     vector<ReportID> my_reports(begin(r), end(r));
     my_reports.push_back(MO_INVALID_IDX); // sentinel
 
-    auto cache_it = reportListCache.find(my_reports);
-    if (cache_it != end(reportListCache)) {
+    auto cache_it = reports_cache.find(my_reports);
+    if (cache_it != end(reports_cache)) {
         u32 offset = cache_it->second;
         DEBUG_PRINTF("reusing cached report list at %u\n", offset);
         return offset;
@@ -1007,13 +1010,12 @@ u32 addReports(const flat_set<ReportID> &r, vector<ReportID> &reports,
 
     u32 offset = verify_u32(reports.size());
     insert(&reports, reports.end(), my_reports);
-    reportListCache.emplace(move(my_reports), offset);
+    reports_cache.emplace(move(my_reports), offset);
     return offset;
 }
 
 static
-void buildAcceptsList(const build_info &args,
-                      unordered_map<vector<ReportID>, u32> &reports_cache,
+void buildAcceptsList(const build_info &args, ReportListCache &reports_cache,
                       vector<NFAVertex> &verts, vector<NFAAccept> &accepts,
                       vector<ReportID> &reports, vector<NFAStateSet> &squash) {
     if (verts.empty()) {
@@ -1051,8 +1053,7 @@ void buildAcceptsList(const build_info &args,
 }
 
 static
-void buildAccepts(const build_info &args,
-                  unordered_map<vector<ReportID>, u32> &reports_cache,
+void buildAccepts(const build_info &args, ReportListCache &reports_cache,
                   NFAStateSet &acceptMask, NFAStateSet &acceptEodMask,
                   vector<NFAAccept> &accepts, vector<NFAAccept> &acceptsEod,
                   vector<ReportID> &reports, vector<NFAStateSet> &squash) {
@@ -1119,7 +1120,7 @@ u32 uncompressedStateSize(u32 num_states) {
 
 static
 u32 compressedStateSize(const NGHolder &h, const NFAStateSet &maskedStates,
-                        const ue2::unordered_map<NFAVertex, u32> &state_ids) {
+                        const unordered_map<NFAVertex, u32> &state_ids) {
     // Shrink state requirement to enough to fit the compressed largest reach.
     vector<u32> allreach(N_CHARS, 0);
 
@@ -1190,7 +1191,7 @@ bool hasSquashableInitDs(const build_info &args) {
 
 static
 bool hasInitDsStates(const NGHolder &h,
-                     const ue2::unordered_map<NFAVertex, u32> &state_ids) {
+                     const unordered_map<NFAVertex, u32> &state_ids) {
     if (state_ids.at(h.startDs) != NO_STATE) {
         return true;
     }
@@ -1358,17 +1359,16 @@ struct ExceptionProto {
 };
 
 static
-u32 buildExceptionMap(const build_info &args,
-                      unordered_map<vector<ReportID>, u32> &reports_cache,
-                      const ue2::unordered_set<NFAEdge> &exceptional,
+u32 buildExceptionMap(const build_info &args, ReportListCache &reports_cache,
+                      const unordered_set<NFAEdge> &exceptional,
                       map<ExceptionProto, vector<u32>> &exceptionMap,
                       vector<ReportID> &reportList) {
     const NGHolder &h = args.h;
     const u32 num_states = args.num_states;
     u32 exceptionCount = 0;
 
-    ue2::unordered_map<NFAVertex, u32> pos_trigger;
-    ue2::unordered_map<NFAVertex, u32> tug_trigger;
+    unordered_map<NFAVertex, u32> pos_trigger;
+    unordered_map<NFAVertex, u32> tug_trigger;
 
     for (u32 i = 0; i < args.repeats.size(); i++) {
         const BoundedRepeatData &br = args.repeats[i];
@@ -1893,7 +1893,7 @@ struct Factory {
 
     static
     void findExceptionalTransitions(const build_info &args,
-                                    ue2::unordered_set<NFAEdge> &exceptional,
+                                    unordered_set<NFAEdge> &exceptional,
                                     u32 maxShift) {
         const NGHolder &h = args.h;
 
@@ -2168,9 +2168,9 @@ struct Factory {
 
         // We track report lists that have already been written into the global
         // list in case we can reuse them.
-        unordered_map<vector<ReportID>, u32> reports_cache;
+        ReportListCache reports_cache;
 
-        ue2::unordered_set<NFAEdge> exceptional;
+        unordered_set<NFAEdge> exceptional;
         u32 shiftCount = findBestNumOfVarShifts(args);
         assert(shiftCount);
         u32 maxShift = findMaxVarShift(args, shiftCount);
@@ -2374,10 +2374,10 @@ MAKE_LIMEX_TRAITS(512)
 // Some sanity tests, called by an assertion in generate().
 static UNUSED
 bool isSane(const NGHolder &h, const map<u32, set<NFAVertex>> &tops,
-            const ue2::unordered_map<NFAVertex, u32> &state_ids,
+            const unordered_map<NFAVertex, u32> &state_ids,
             u32 num_states) {
-    ue2::unordered_set<u32> seen;
-    ue2::unordered_set<NFAVertex> top_starts;
+    unordered_set<u32> seen;
+    unordered_set<NFAVertex> top_starts;
     for (const auto &vv : tops | map_values) {
         insert(&top_starts, vv);
     }
@@ -2424,7 +2424,7 @@ bool isSane(const NGHolder &h, const map<u32, set<NFAVertex>> &tops,
 #endif // NDEBUG
 
 static
-u32 max_state(const ue2::unordered_map<NFAVertex, u32> &state_ids) {
+u32 max_state(const unordered_map<NFAVertex, u32> &state_ids) {
     u32 rv = 0;
     for (const auto &m : state_ids) {
         DEBUG_PRINTF("state %u\n", m.second);
@@ -2437,7 +2437,7 @@ u32 max_state(const ue2::unordered_map<NFAVertex, u32> &state_ids) {
 }
 
 bytecode_ptr<NFA> generate(NGHolder &h,
-                           const ue2::unordered_map<NFAVertex, u32> &states,
+                           const unordered_map<NFAVertex, u32> &states,
                            const vector<BoundedRepeatData> &repeats,
                            const map<NFAVertex, NFAStateSet> &reportSquashMap,
                            const map<NFAVertex, NFAStateSet> &squashMap,
@@ -2507,7 +2507,7 @@ bytecode_ptr<NFA> generate(NGHolder &h,
 }
 
 u32 countAccelStates(NGHolder &h,
-                     const ue2::unordered_map<NFAVertex, u32> &states,
+                     const unordered_map<NFAVertex, u32> &states,
                      const vector<BoundedRepeatData> &repeats,
                      const map<NFAVertex, NFAStateSet> &reportSquashMap,
                      const map<NFAVertex, NFAStateSet> &squashMap,
index a12ae9f6ee2e05c2679b1918828ae70231a06a52..3b819739475550f1a86c8cd57e0c0257d0f6cd7a 100644 (file)
 #ifndef LIMEX_COMPILE_H
 #define LIMEX_COMPILE_H
 
-#include <map>
-#include <memory>
-#include <vector>
-
 #include "nfagraph/ng_holder.h"
 #include "nfagraph/ng_squash.h" // for NFAStateSet
 #include "ue2common.h"
 #include "util/bytecode_ptr.h"
-#include "util/ue2_containers.h"
+
+#include <set>
+#include <map>
+#include <memory>
+#include <unordered_map>
+#include <vector>
 
 struct NFA;
 
@@ -69,7 +70,7 @@ struct CompileContext;
  * graph.
  */
 bytecode_ptr<NFA> generate(NGHolder &g,
-                        const ue2::unordered_map<NFAVertex, u32> &states,
+                        const std::unordered_map<NFAVertex, u32> &states,
                         const std::vector<BoundedRepeatData> &repeats,
                         const std::map<NFAVertex, NFAStateSet> &reportSquashMap,
                         const std::map<NFAVertex, NFAStateSet> &squashMap,
@@ -87,7 +88,7 @@ bytecode_ptr<NFA> generate(NGHolder &g,
  * implementable.
  */
 u32 countAccelStates(NGHolder &h,
-                     const ue2::unordered_map<NFAVertex, u32> &states,
+                     const std::unordered_map<NFAVertex, u32> &states,
                      const std::vector<BoundedRepeatData> &repeats,
                      const std::map<NFAVertex, NFAStateSet> &reportSquashMap,
                      const std::map<NFAVertex, NFAStateSet> &squashMap,
index 9374677703b6eaf20156833b01b7256f7f38b79d..8f73d077b7da095ac2fd1d0d90debaa8d25f6353 100644 (file)
@@ -46,7 +46,7 @@
 #include "util/make_unique.h"
 #include "util/order_check.h"
 #include "util/report_manager.h"
-#include "util/ue2_containers.h"
+#include "util/flat_containers.h"
 #include "util/unaligned.h"
 #include "util/verify_types.h"
 
index baf72d9ce68ac0efb711a8c42543d9ab6d36c90a..ce63fbbfaa883e390fcca8598a99f388b3150677 100644 (file)
@@ -33,7 +33,6 @@
 #include "rdfa.h"
 #include "ue2common.h"
 #include "util/bytecode_ptr.h"
-#include "util/ue2_containers.h"
 
 #include <memory>
 #include <vector>
index 317c588948940434afc3fa2a8126a67b6a0133ba..977cf3d57a70a215a09c58a219f0c03adb7560a5 100644 (file)
 
 #include "rdfa.h"
 #include "util/container.h"
-#include "util/ue2_containers.h"
+#include "util/hash.h"
 #include "ue2common.h"
 
 #include <deque>
-
-#include <boost/functional/hash/hash.hpp>
+#include <map>
 
 using namespace std;
 
@@ -232,22 +231,18 @@ bool has_non_eod_accepts(const raw_dfa &rdfa) {
 }
 
 size_t hash_dfa_no_reports(const raw_dfa &rdfa) {
-    using boost::hash_combine;
-    using boost::hash_range;
-
     size_t v = 0;
     hash_combine(v, rdfa.alpha_size);
-    hash_combine(v, hash_range(begin(rdfa.alpha_remap), end(rdfa.alpha_remap)));
+    hash_combine(v, rdfa.alpha_remap);
 
     for (const auto &ds : rdfa.states) {
-        hash_combine(v, hash_range(begin(ds.next), end(ds.next)));
+        hash_combine(v, ds.next);
     }
 
     return v;
 }
 
 size_t hash_dfa(const raw_dfa &rdfa) {
-    using boost::hash_combine;
     size_t v = 0;
     hash_combine(v, hash_dfa_no_reports(rdfa));
     hash_combine(v, all_reports(rdfa));
index 2049fee03d9551c34e067f4380a8809d3e4908d9..728f03bec2a0a30678699ac043f1581a44893f72 100644 (file)
 #include "util/compare.h"
 #include "util/compile_context.h"
 #include "util/container.h"
+#include "util/flat_containers.h"
 #include "util/graph.h"
 #include "util/graph_range.h"
 #include "util/make_unique.h"
 #include "util/order_check.h"
 #include "util/report_manager.h"
-#include "util/ue2_containers.h"
 #include "util/unaligned.h"
+#include "util/unordered.h"
 #include "util/verify_types.h"
 
 #include <algorithm>
@@ -383,6 +384,8 @@ CharReach get_edge_reach(dstate_id_t u, dstate_id_t v, const dfa_info &info) {
 #define MAX_SHENG_STATES 16
 #define MAX_SHENG_LEAKINESS 0.05
 
+using LeakinessCache = ue2_unordered_map<pair<RdfaVertex, u32>, double>;
+
 /**
  * Returns the proportion of strings of length 'depth' which will leave the
  * sheng region when starting at state 'u'.
@@ -390,8 +393,7 @@ CharReach get_edge_reach(dstate_id_t u, dstate_id_t v, const dfa_info &info) {
 static
 double leakiness(const RdfaGraph &g, dfa_info &info,
                  const flat_set<RdfaVertex> &sheng_states, RdfaVertex u,
-                 u32 depth,
-                 unordered_map<pair<RdfaVertex, u32>, double> &cache) {
+                 u32 depth, LeakinessCache &cache) {
     double rv = 0;
     if (contains(cache, make_pair(u, depth))) {
         return cache[make_pair(u, depth)];
@@ -426,7 +428,7 @@ double leakiness(const RdfaGraph &g, dfa_info &info,
 static
 double leakiness(const RdfaGraph &g, dfa_info &info,
                  const flat_set<RdfaVertex> &sheng_states, RdfaVertex u) {
-    unordered_map<pair<RdfaVertex, u32>, double> cache;
+    LeakinessCache cache;
     double rv = leakiness(g, info, sheng_states, u, 8, cache);
     return rv;
 }
index fc60f17756c31d674957bcc761353172bab0e14e..0936fb15aca2bbde63d57bb80e77b5e46f35712e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 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:
@@ -32,7 +32,7 @@
 #include "nfa_kind.h"
 #include "ue2common.h"
 
-#include "util/ue2_containers.h"
+#include "util/flat_containers.h"
 
 #include <array>
 #include <vector>
index 0905dc08c304de8ae02f064d073b55c7115045ea..2ad871234f0a4521c33ed49cc68013fd60220492 100644 (file)
 #include "nfagraph/ng_mcclellan_internal.h"
 #include "util/container.h"
 #include "util/determinise.h"
+#include "util/flat_containers.h"
 #include "util/make_unique.h"
 #include "util/report_manager.h"
-#include "util/ue2_containers.h"
+#include "util/unordered.h"
 
 #include <algorithm>
 #include <queue>
@@ -54,7 +55,7 @@ namespace {
 class Automaton_Merge {
 public:
     using StateSet = vector<u16>;
-    using StateMap = unordered_map<StateSet, dstate_id_t>;
+    using StateMap = ue2_unordered_map<StateSet, dstate_id_t>;
 
     Automaton_Merge(const raw_dfa *rdfa1, const raw_dfa *rdfa2,
                     const ReportManager *rm_in, const Grey &grey_in)
index 9885cd16fc5e713b70c139484e9dc04288b946e5..2fe1e35691e51f4950a7dc6447bfa20a4220984d 100644 (file)
 #include "rdfa.h"
 #include "util/bytecode_ptr.h"
 #include "util/charreach.h"
-#include "util/ue2_containers.h"
+#include "util/flat_containers.h"
+
+#include <memory>
+#include <set>
 
 struct NFA;
 
index 12a94b7b0b7c3d0b6d9f5e35b133369e669a2711..f712ef94a49a35a135341e5495e334a49ac27d44 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:
@@ -33,7 +33,7 @@
 #include "ue2common.h"
 #include "util/charreach.h"
 #include "util/container.h"
-#include "util/ue2_containers.h"
+#include "util/flat_containers.h"
 
 #include <array>
 #include <cassert>
index a72904e055599564c7b2c80a3fcc19752e6ae074..59b9c38dff9c223092e071a03225480c6f8fe898 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:
@@ -35,7 +35,7 @@
 
 #include "ue2common.h"
 #include "util/charreach.h"
-#include "util/ue2_containers.h"
+#include "util/flat_containers.h"
 
 #include <utility>
 
index 9442d046d245eae2538550103e4f14336fa18973..f19de0ee04ad5baf8f08d157747e98217ea66cf6 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:
  * truffle is always able to represent an entire character class, providing a
  * backstop to other acceleration engines.
  */
+
 #include "trufflecompile.h"
+
 #include "ue2common.h"
 #include "util/charreach.h"
+#include "util/dump_mask.h"
 #include "util/simd_types.h"
 
-#include "util/dump_mask.h"
+#include <cstring>
 
 using namespace std;
 
index a5a5c235a4284e93f87f8c69d407e8cf13a166ab..a13045834e42d5ea353c1eaec0037f47b6f4188b 100644 (file)
@@ -44,7 +44,6 @@
 #include "util/graph.h"
 #include "util/noncopyable.h"
 #include "util/report_manager.h"
-#include "util/ue2_containers.h"
 
 #include <deque>
 #include <map>
index 7ac57dab2ec9de643a74547da5b88b4f2eac8b61..65574b50b867f14f3f8984df6e698d4bf43ea59a 100644 (file)
@@ -310,11 +310,11 @@ void splitIntoComponents(unique_ptr<NGHolder> g,
         return;
     }
 
-    ue2::unordered_map<NFAVertex, NFAUndirectedVertex> old2new;
+    unordered_map<NFAVertex, NFAUndirectedVertex> old2new;
     auto ug = createUnGraph(*g, true, true, old2new);
 
     // Construct reverse mapping.
-    ue2::unordered_map<NFAUndirectedVertex, NFAVertex> new2old;
+    unordered_map<NFAUndirectedVertex, NFAVertex> new2old;
     for (const auto &m : old2new) {
         new2old.emplace(m.second, m.first);
     }
@@ -356,7 +356,7 @@ void splitIntoComponents(unique_ptr<NGHolder> g,
         DEBUG_PRINTF("vertex %zu is in comp %u\n", (*g)[v].index, c);
     }
 
-    ue2::unordered_map<NFAVertex, NFAVertex> v_map; // temp map for fillHolder
+    unordered_map<NFAVertex, NFAVertex> v_map; // temp map for fillHolder
     for (auto &vv : verts) {
         // Shells are in every component.
         vv.insert(vv.end(), begin(head_shell), end(head_shell));
index 80980a66a628fb432a1a3ef35f733b1466038453..c8d34687e00c9b45eed09f1b07c1bd28ad5cb8df 100644 (file)
@@ -62,9 +62,9 @@
 #include "ng_prune.h"
 #include "ng_util.h"
 #include "util/container.h"
+#include "util/flat_containers.h"
 #include "util/graph_range.h"
 #include "util/graph_small_color_map.h"
-#include "util/ue2_containers.h"
 
 #include <algorithm>
 #include <boost/graph/depth_first_search.hpp>
index 50536b7602bdab3bf20b021c114b5fa162963761..d6a064d12fd11b362166799c055d7fa68ef9e13b 100644 (file)
@@ -36,7 +36,6 @@
 #include "ue2common.h"
 #include "ng_holder.h"
 #include "ng_util.h"
-#include "util/ue2_containers.h"
 
 #include <boost-patched/graph/dominator_tree.hpp> // locally patched version
 #include <boost-patched/graph/reverse_graph.hpp>
index 81b7e037b7704bbda8d87121e3e13eec21a6c55e..f505b7e47109733382de15ade9fb1fa59c4fa209 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 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:
 #define NG_DOMINATORS_H
 
 #include "ng_holder.h"
-#include "util/ue2_containers.h"
 
-namespace ue2 {
+#include <unordered_map>
 
-class NGHolder;
+namespace ue2 {
 
-ue2::unordered_map<NFAVertex, NFAVertex> findDominators(const NGHolder &g);
+std::unordered_map<NFAVertex, NFAVertex> findDominators(const NGHolder &g);
 
-ue2::unordered_map<NFAVertex, NFAVertex> findPostDominators(const NGHolder &g);
+std::unordered_map<NFAVertex, NFAVertex> findPostDominators(const NGHolder &g);
 
 } // namespace ue2
 
index 9624f76249a3b6af78e87a3d6b716ada566932aa..8777a75035584d8c7fbcb0e7474ee44763f1f6bf 100644 (file)
@@ -176,7 +176,7 @@ public:
         : g(g_in), rm(&rm_in) {}
 
     NFAWriter(const GraphT &g_in,
-              const ue2::unordered_map<NFAVertex, u32> &region_map_in)
+              const unordered_map<NFAVertex, u32> &region_map_in)
         : g(g_in), region_map(&region_map_in) {}
 
     void operator()(ostream& os, const VertexT& v) const {
@@ -254,7 +254,7 @@ public:
 private:
     const GraphT &g;
     const ReportManager *rm = nullptr;
-    const ue2::unordered_map<NFAVertex, u32> *region_map = nullptr;
+    const unordered_map<NFAVertex, u32> *region_map = nullptr;
 };
 }
 
@@ -278,7 +278,7 @@ void dumpGraphImpl(const char *name, const GraphT &g, const ReportManager &rm) {
 
 template <typename GraphT>
 void dumpGraphImpl(const char *name, const GraphT &g,
-                   const ue2::unordered_map<NFAVertex, u32> &region_map) {
+                   const unordered_map<NFAVertex, u32> &region_map) {
     typedef typename boost::graph_traits<GraphT>::vertex_descriptor VertexT;
     typedef typename boost::graph_traits<GraphT>::edge_descriptor EdgeT;
     ofstream os(name);
@@ -332,7 +332,7 @@ void dumpHolderImpl(const NGHolder &h, unsigned int stageNumber,
 }
 
 void dumpHolderImpl(const NGHolder &h,
-                    const ue2::unordered_map<NFAVertex, u32> &region_map,
+                    const unordered_map<NFAVertex, u32> &region_map,
                     unsigned int stageNumber, const char *stageName,
                     const Grey &grey) {
     if (grey.dumpFlags & Grey::DUMP_INT_GRAPH) {
index 077f07cef280d7e59774c2e73e66c484a1e6c23b..3e12d1d22e4bbbcc9a3b71f628d3f00a13888076 100644 (file)
@@ -36,7 +36,8 @@
 #include "grey.h"
 #include "ng_holder.h" // for graph types
 #include "ue2common.h"
-#include "util/ue2_containers.h"
+
+#include <unordered_map>
 
 #ifdef DUMP_SUPPORT
 #include <fstream>
@@ -75,7 +76,7 @@ void dumpHolderImpl(const NGHolder &h, unsigned int stageNumber,
 
 // Variant that takes a region map as well.
 void dumpHolderImpl(const NGHolder &h,
-                    const ue2::unordered_map<NFAVertex, u32> &region_map,
+                    const std::unordered_map<NFAVertex, u32> &region_map,
                     unsigned int stageNumber, const char *stageName,
                     const Grey &grey);
 
@@ -123,7 +124,7 @@ void dumpHolder(UNUSED const NGHolder &h, UNUSED unsigned int stageNumber,
 
 UNUSED static inline
 void dumpHolder(UNUSED const NGHolder &h,
-                UNUSED const ue2::unordered_map<NFAVertex, u32> &region_map,
+                UNUSED const std::unordered_map<NFAVertex, u32> &region_map,
                 UNUSED unsigned int stageNumber, UNUSED const char *name,
                 UNUSED const Grey &grey) {
 #ifdef DUMP_SUPPORT
index 1578d2e4d5a1bf18597541cd1b8c1b09c3c57044..b8354bd42ae4c5b7be5c06c4e0055bf376eeec8b 100644 (file)
@@ -38,8 +38,8 @@
 #include "parser/position.h"
 #include "util/compile_context.h"
 #include "util/container.h"
+#include "util/flat_containers.h"
 #include "util/graph_range.h"
-#include "util/ue2_containers.h"
 
 #include <set>
 #include <vector>
index 438e5ea8a8d7bd8233957f85fba485ea27c66204..a42a0ac717c09e909f8cf7dd752386d1c799eaba 100644 (file)
 #include "ng_holder.h"
 #include "ng_util.h"
 #include "util/compile_context.h"
+#include "util/flat_containers.h"
 #include "util/graph_range.h"
 #include "util/make_unique.h"
-#include "util/ue2_containers.h"
+#include "util/unordered.h"
 
 #include <algorithm>
 #include <memory>
@@ -121,16 +122,9 @@ public:
                vertex_flags == b.vertex_flags && rs == b.rs;
     }
 
-    friend size_t hash_value(const ClassInfo &c) {
-        size_t val = 0;
-        boost::hash_combine(val, c.rs);
-        boost::hash_combine(val, c.vertex_flags);
-        boost::hash_combine(val, c.cr);
-        boost::hash_combine(val, c.adjacent_cr);
-        boost::hash_combine(val, c.node_type);
-        boost::hash_combine(val, c.depth.d1);
-        boost::hash_combine(val, c.depth.d2);
-        return val;
+    size_t hash() const {
+        return hash_all(rs, vertex_flags, cr, adjacent_cr, node_type, depth.d1,
+                        depth.d2);
     }
 
 private:
@@ -319,7 +313,7 @@ vector<VertexInfoSet> partitionGraph(vector<unique_ptr<VertexInfo>> &infos,
     const size_t num_verts = infos.size();
 
     vector<VertexInfoSet> classes;
-    unordered_map<ClassInfo, unsigned> classinfomap;
+    ue2_unordered_map<ClassInfo, unsigned> classinfomap;
 
     // assume we will have lots of classes, so we don't waste time resizing
     // these structures.
index bdcfecfd42a35ff6822b8cb4dd4658a6a0ae6703..32f5520d3316c7c9688db00da25760075501adba 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:
@@ -35,7 +35,7 @@
 #define NG_EXECUTE_H
 
 #include "ng_holder.h"
-#include "util/ue2_containers.h"
+#include "util/flat_containers.h"
 
 #include <vector>
 
index 9582a1e8811c2cb7c6e99d144316e69dddbe2df3..992faf7ce149acca02e778df35c32d9c440a5849 100644 (file)
 #include "util/bitfield.h"
 #include "util/container.h"
 #include "util/determinise.h"
+#include "util/flat_containers.h"
 #include "util/graph.h"
 #include "util/graph_range.h"
 #include "util/hash_dynamic_bitset.h"
 #include "util/make_unique.h"
-#include "util/ue2_containers.h"
+#include "util/unordered.h"
 
 #include <algorithm>
 #include <functional>
@@ -258,7 +259,7 @@ public:
 
 struct Graph_Traits {
     using StateSet = bitfield<NFA_STATE_LIMIT>;
-    using StateMap = ue2::unordered_map<StateSet, dstate_id_t>;
+    using StateMap = unordered_map<StateSet, dstate_id_t>;
 
     static StateSet init_states(UNUSED u32 num) {
         assert(num <= NFA_STATE_LIMIT);
@@ -286,7 +287,7 @@ public:
 class Automaton_Haig_Merge {
 public:
     using StateSet = vector<u16>;
-    using StateMap = unordered_map<StateSet, dstate_id_t>;
+    using StateMap = ue2_unordered_map<StateSet, dstate_id_t>;
 
     explicit Automaton_Haig_Merge(const vector<const raw_som_dfa *> &in)
         : nfas(in.begin(), in.end()), dead(in.size()) {
index fbb6ac5290c7811ae8f8302b455ce81400d07d77..f61c476a5b0d2f91626de7af881709b9d2a6a73b 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:
@@ -40,7 +40,7 @@
 #include "ue2common.h"
 #include "nfa/nfa_kind.h"
 #include "util/charreach.h"
-#include "util/ue2_containers.h"
+#include "util/flat_containers.h"
 #include "util/ue2_graph.h"
 
 namespace ue2 {
index 2df79f501cc16d03f1235072adfb00c8bfc87068..35a09d0ea25f416d29e7cc4da9e1d21ee7403200 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:
 #include "ng_util.h"
 #include "ue2common.h"
 #include "util/container.h"
+#include "util/flat_containers.h"
 #include "util/graph_range.h"
 #include "util/make_unique.h"
-#include "util/ue2_containers.h"
-
-#include <set>
-
-#include <boost/functional/hash/hash.hpp>
 
 using namespace std;
 
@@ -200,11 +196,11 @@ u64a hash_holder(const NGHolder &g) {
     size_t rv = 0;
 
     for (auto v : vertices_range(g)) {
-        boost::hash_combine(rv, g[v].index);
-        boost::hash_combine(rv, g[v].char_reach);
+        hash_combine(rv, g[v].index);
+        hash_combine(rv, g[v].char_reach);
 
         for (auto w : adjacent_vertices_range(v, g)) {
-            boost::hash_combine(rv, g[w].index);
+            hash_combine(rv, g[w].index);
         }
     }
 
index 283bba22c8d6c9229be85e65d1210b2681aa6667..1daec578c576ce1b3899d3fdb1a7fda8d10f3a99 100644 (file)
 #include "util/container.h"
 #include "util/graph_range.h"
 #include "util/report_manager.h"
-#include "util/ue2_containers.h"
+#include "util/flat_containers.h"
 #include "util/verify_types.h"
 
 #include <algorithm>
 #include <map>
+#include <unordered_map>
+#include <unordered_set>
 #include <vector>
 
 #include <boost/range/adaptor/map.hpp>
@@ -73,8 +75,8 @@ namespace ue2 {
 // Only used in assertions.
 static
 bool sanityCheckGraph(const NGHolder &g,
-                      const ue2::unordered_map<NFAVertex, u32> &state_ids) {
-    ue2::unordered_set<u32> seen_states;
+                      const unordered_map<NFAVertex, u32> &state_ids) {
+    unordered_set<u32> seen_states;
 
     for (auto v : vertices_range(g)) {
         // Non-specials should have non-empty reachability.
@@ -468,7 +470,7 @@ void makeTopStates(NGHolder &g, map<u32, set<NFAVertex>> &tops_out,
 static
 set<NFAVertex> findZombies(const NGHolder &h,
             const map<NFAVertex, BoundedRepeatSummary> &br_cyclic,
-            const ue2::unordered_map<NFAVertex, u32> &state_ids,
+            const unordered_map<NFAVertex, u32> &state_ids,
             const CompileContext &cc) {
     set<NFAVertex> zombies;
     if (!cc.grey.allowZombies) {
@@ -516,7 +518,7 @@ set<NFAVertex> findZombies(const NGHolder &h,
 }
 
 static
-void reverseStateOrdering(ue2::unordered_map<NFAVertex, u32> &state_ids) {
+void reverseStateOrdering(unordered_map<NFAVertex, u32> &state_ids) {
     vector<NFAVertex> ordering;
     for (auto &e : state_ids) {
         if (e.second == NO_STATE) {
@@ -569,7 +571,7 @@ prepareGraph(const NGHolder &h_in, const ReportManager *rm,
              const map<u32, u32> &fixed_depth_tops,
              const map<u32, vector<vector<CharReach>>> &triggers,
              bool impl_test_only, const CompileContext &cc,
-             ue2::unordered_map<NFAVertex, u32> &state_ids,
+             unordered_map<NFAVertex, u32> &state_ids,
              vector<BoundedRepeatData> &repeats,
              map<u32, set<NFAVertex>> &tops) {
     assert(is_triggered(h_in) || fixed_depth_tops.empty());
@@ -637,7 +639,7 @@ constructNFA(const NGHolder &h_in, const ReportManager *rm,
         assert(rm);
     }
 
-    ue2::unordered_map<NFAVertex, u32> state_ids;
+    unordered_map<NFAVertex, u32> state_ids;
     vector<BoundedRepeatData> repeats;
     map<u32, set<NFAVertex>> tops;
     unique_ptr<NGHolder> h
@@ -785,7 +787,7 @@ u32 isImplementableNFA(const NGHolder &g, const ReportManager *rm,
      * resultant NGHolder has <= NFA_MAX_STATES. If it does, we know we can
      * implement it as an NFA. */
 
-    ue2::unordered_map<NFAVertex, u32> state_ids;
+    unordered_map<NFAVertex, u32> state_ids;
     vector<BoundedRepeatData> repeats;
     map<u32, set<NFAVertex>> tops;
     unique_ptr<NGHolder> h
@@ -832,7 +834,7 @@ u32 countAccelStates(const NGHolder &g, const ReportManager *rm,
     const map<u32, u32> fixed_depth_tops; // empty
     const map<u32, vector<vector<CharReach>>> triggers; // empty
 
-    ue2::unordered_map<NFAVertex, u32> state_ids;
+    unordered_map<NFAVertex, u32> state_ids;
     vector<BoundedRepeatData> repeats;
     map<u32, set<NFAVertex>> tops;
     unique_ptr<NGHolder> h
index f0c98db2cb38a9f6127b0536b56dfd3d05cf2870..4c3d2b91d70b64e3bface5198943aca68779994d 100644 (file)
@@ -39,8 +39,8 @@
 #include "nfa/accelcompile.h"
 #include "util/accel_scheme.h"
 #include "util/charreach.h"
+#include "util/flat_containers.h"
 #include "util/order_check.h"
-#include "util/ue2_containers.h"
 
 #include <map>
 #include <vector>
index 87c4e79e9e3653d0c88fd16ba74ca7126a3bc159..ea0def0218aa94f465514d8048cf10be93f13421 100644 (file)
@@ -811,7 +811,7 @@ bool splitOffLeadingLiteral(const NGHolder &g, ue2_literal *lit_out,
     }
     assert(u != g.startDs);
 
-    ue2::unordered_map<NFAVertex, NFAVertex> rhs_map;
+    unordered_map<NFAVertex, NFAVertex> rhs_map;
     vector<NFAVertex> pivots = make_vector_from(adjacent_vertices(u, g));
     splitRHS(g, pivots, rhs, &rhs_map);
 
index de05e49090fb4dc71e9fada9af749f2a7df94811..4d3965dfe241dcb5214afb48861c241360244dd9 100644 (file)
@@ -45,6 +45,8 @@
 #include "util/graph_range.h"
 #include "util/ue2string.h"
 
+#include <unordered_set>
+
 using namespace std;
 
 namespace ue2 {
@@ -196,7 +198,7 @@ bool splitOffLiterals(NG &ng, NGHolder &g) {
     bool changed = false;
     set<NFAVertex> dead;
 
-    ue2::unordered_set<NFAVertex> unanchored; // for faster lookup.
+    unordered_set<NFAVertex> unanchored; // for faster lookup.
     insert(&unanchored, adjacent_vertices(g.startDs, g));
 
     // Anchored literals.
index ec8ae2237f84a70ed5fcd6669193a4d91a785281..091b89b8a2d1ead141cf8c6a65785ad2fd4e9759 100644 (file)
 #include "ue2common.h"
 #include "util/bitfield.h"
 #include "util/determinise.h"
+#include "util/flat_containers.h"
 #include "util/graph_range.h"
 #include "util/hash.h"
 #include "util/hash_dynamic_bitset.h"
 #include "util/make_unique.h"
 #include "util/report_manager.h"
-#include "util/ue2_containers.h"
 
 #include <algorithm>
 #include <functional>
 #include <map>
 #include <set>
+#include <unordered_map>
 #include <vector>
 
 #include <boost/dynamic_bitset.hpp>
@@ -483,7 +484,7 @@ public:
 
 struct Graph_Traits {
     using StateSet = bitfield<NFA_STATE_LIMIT>;
-    using StateMap = ue2::unordered_map<StateSet, dstate_id_t>;
+    using StateMap = unordered_map<StateSet, dstate_id_t>;
 
     static StateSet init_states(UNUSED u32 num) {
         assert(num <= NFA_STATE_LIMIT);
index b78dac3b1266deba2d0253648b8ed7f24c89e7dc..f069d7336f90dc740475ca4789286755d30733b4 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:
@@ -38,7 +38,7 @@
 #include "nfagraph/ng_holder.h"
 #include "util/charreach.h"
 #include "util/graph_range.h"
-#include "util/ue2_containers.h"
+#include "util/flat_containers.h"
 
 #include <boost/dynamic_bitset.hpp>
 
index c8dfcbab6842c2cadadafd54bd36077947af4a56..8aaaf99fdecda4fb6d280c0fc72f54282b93f410 100644 (file)
@@ -70,7 +70,7 @@
 #include "util/container.h"
 #include "util/graph_range.h"
 #include "util/graph_small_color_map.h"
-#include "util/ue2_containers.h"
+#include "util/flat_containers.h"
 #include "ue2common.h"
 
 #include <boost/dynamic_bitset.hpp>
index 64d4cf2f5ee87c50bea345764848a175527b04c9..04611872a43300f1a8e2dd4dda022f208f250fd1 100644 (file)
 #include "util/compile_context.h"
 #include "util/container.h"
 #include "util/dump_charclass.h"
-#include "util/ue2_containers.h"
 #include "util/graph_range.h"
 
 #include <queue>
+#include <unordered_map>
+#include <unordered_set>
 
 #include <boost/range/adaptor/map.hpp>
 
@@ -127,10 +128,10 @@ struct RegionInfoQueueComp {
 
 static
 void findWidths(const NGHolder &g,
-                const ue2::unordered_map<NFAVertex, u32> &region_map,
+                const unordered_map<NFAVertex, u32> &region_map,
                 RegionInfo &ri) {
     NGHolder rg;
-    ue2::unordered_map<NFAVertex, NFAVertex> mapping;
+    unordered_map<NFAVertex, NFAVertex> mapping;
     fillHolder(&rg, g, ri.vertices, &mapping);
 
     // Wire our entries to start and our exits to accept.
@@ -155,7 +156,7 @@ void findWidths(const NGHolder &g,
 // acc can be either h.accept or h.acceptEod.
 static
 void markBoundaryRegions(const NGHolder &h,
-                         const ue2::unordered_map<NFAVertex, u32> &region_map,
+                         const unordered_map<NFAVertex, u32> &region_map,
                          map<u32, RegionInfo> &regions, NFAVertex acc) {
     for (auto v : inv_adjacent_vertices_range(acc, h)) {
         if (is_special(v, h)) {
@@ -174,7 +175,7 @@ void markBoundaryRegions(const NGHolder &h,
 
 static
 map<u32, RegionInfo> findRegionInfo(const NGHolder &h,
-               const ue2::unordered_map<NFAVertex, u32> &region_map) {
+               const unordered_map<NFAVertex, u32> &region_map) {
     map<u32, RegionInfo> regions;
     for (auto v : vertices_range(h)) {
         if (is_special(v, h)) {
index 72d017ae6ab9fa2166b6cf3d5e83ea881d0ca625..adda70312f0a752713caaa417692147edd4d6fb4 100644 (file)
@@ -223,7 +223,7 @@ void pruneHighlanderAccepts(NGHolder &g, const ReportManager &rm) {
 
 static
 bool isDominatedByReporter(const NGHolder &g,
-                           const ue2::unordered_map<NFAVertex, NFAVertex> &dom,
+                           const unordered_map<NFAVertex, NFAVertex> &dom,
                            NFAVertex v, ReportID report_id) {
     for (auto it = dom.find(v); it != end(dom); it = dom.find(v)) {
         NFAVertex u = it->second;
index 76bc93da138ef614f987326d67f3ec66dbd22208..06b9daeecacd4fd5381ff6f712e6c4ca272416a3 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:
@@ -78,8 +78,8 @@
 #include "ng_util.h"
 #include "ue2common.h"
 #include "util/container.h"
+#include "util/flat_containers.h"
 #include "util/graph_range.h"
-#include "util/ue2_containers.h"
 
 #include <algorithm>
 #include <cassert>
@@ -747,7 +747,7 @@ u32 findCyclic(const NGHolder &g, vector<bool> &cyclic) {
 static
 void findCyclicDom(NGHolder &g, vector<bool> &cyclic,
                    set<NFAEdge> &dead, som_type som) {
-    ue2::unordered_map<NFAVertex, NFAVertex> dominators = findDominators(g);
+    auto dominators = findDominators(g);
 
     for (auto v : vertices_range(g)) {
         if (is_special(v, g)) {
@@ -791,8 +791,7 @@ void findCyclicDom(NGHolder &g, vector<bool> &cyclic,
 static
 void findCyclicPostDom(NGHolder &g, vector<bool> &cyclic,
                        set<NFAEdge> &dead) {
-    ue2::unordered_map<NFAVertex, NFAVertex> postdominators =
-        findPostDominators(g);
+    auto postdominators = findPostDominators(g);
 
     for (auto v : vertices_range(g)) {
         if (is_special(v, g)) {
index 6463a28111fbb3bf82e6d59903a078ffd98f2013..2675be643f3b757f8a910de32a01eb8571a4be26 100644 (file)
@@ -56,7 +56,7 @@
 #include "ng_util.h"
 #include "ue2common.h"
 #include "util/container.h"
-#include "util/ue2_containers.h"
+#include "util/flat_containers.h"
 #include "util/graph_range.h"
 #include "util/graph_small_color_map.h"
 
index a56933dc47373d8f2c95f5bbac40026b7f0f7e5e..a4708a582ed25216bd1a62700aab67d3475c61ce 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:
 #include "ng_holder.h"
 #include "util/container.h"
 #include "util/graph_range.h"
-#include "util/ue2_containers.h"
 
+#include <unordered_map>
 #include <vector>
 
 namespace ue2 {
 
 /** \brief Assign a region ID to every vertex in the graph. */
-ue2::unordered_map<NFAVertex, u32> assignRegions(const NGHolder &g);
+std::unordered_map<NFAVertex, u32> assignRegions(const NGHolder &g);
 
 /** \brief True if vertices \p a and \p b are in the same region. */
 template <class Graph>
 bool inSameRegion(const Graph &g, NFAVertex a, NFAVertex b,
-                  const ue2::unordered_map<NFAVertex, u32> &region_map) {
+                  const std::unordered_map<NFAVertex, u32> &region_map) {
     assert(contains(region_map, a) && contains(region_map, b));
 
     return region_map.at(a) == region_map.at(b) &&
@@ -58,7 +58,7 @@ bool inSameRegion(const Graph &g, NFAVertex a, NFAVertex b,
 /** \brief True if vertex \p b is in a later region than vertex \p a. */
 template <class Graph>
 bool inLaterRegion(const Graph &g, NFAVertex a, NFAVertex b,
-                   const ue2::unordered_map<NFAVertex, u32> &region_map) {
+                   const std::unordered_map<NFAVertex, u32> &region_map) {
     assert(contains(region_map, a) && contains(region_map, b));
 
     u32 aa = g[a].index;
@@ -85,7 +85,7 @@ bool inLaterRegion(const Graph &g, NFAVertex a, NFAVertex b,
 /** \brief True if vertex \p b is in an earlier region than vertex \p a. */
 template <class Graph>
 bool inEarlierRegion(const Graph &g, NFAVertex a, NFAVertex b,
-                     const ue2::unordered_map<NFAVertex, u32> &region_map) {
+                     const std::unordered_map<NFAVertex, u32> &region_map) {
     assert(contains(region_map, a) && contains(region_map, b));
 
     u32 aa = g[a].index;
@@ -112,7 +112,7 @@ bool inEarlierRegion(const Graph &g, NFAVertex a, NFAVertex b,
 /** \brief True if vertex \p v is an entry vertex for its region. */
 template <class Graph>
 bool isRegionEntry(const Graph &g, NFAVertex v,
-                   const ue2::unordered_map<NFAVertex, u32> &region_map) {
+                   const std::unordered_map<NFAVertex, u32> &region_map) {
     // Note that some graph types do not have inv_adjacent_vertices, so we must
     // use in_edges here.
     for (const auto &e : in_edges_range(v, g)) {
@@ -127,7 +127,7 @@ bool isRegionEntry(const Graph &g, NFAVertex v,
 /** \brief True if vertex \p v is an exit vertex for its region. */
 template <class Graph>
 bool isRegionExit(const Graph &g, NFAVertex v,
-                  const ue2::unordered_map<NFAVertex, u32> &region_map) {
+                  const std::unordered_map<NFAVertex, u32> &region_map) {
     for (auto w : adjacent_vertices_range(v, g)) {
         if (!inSameRegion(g, v, w, region_map)) {
             return true;
@@ -140,7 +140,7 @@ bool isRegionExit(const Graph &g, NFAVertex v,
 /** \brief True if vertex \p v is in a region all on its own. */
 template <class Graph>
 bool isSingletonRegion(const Graph &g, NFAVertex v,
-                       const ue2::unordered_map<NFAVertex, u32> &region_map) {
+                       const std::unordered_map<NFAVertex, u32> &region_map) {
     for (const auto &e : in_edges_range(v, g)) {
         auto u = source(e, g);
         if (u != v && inSameRegion(g, v, u, region_map)) {
@@ -178,7 +178,7 @@ bool isSingletonRegion(const Graph &g, NFAVertex v,
  */
 template <class Graph>
 bool isOptionalRegion(const Graph &g, NFAVertex v,
-                      const ue2::unordered_map<NFAVertex, u32> &region_map) {
+                      const std::unordered_map<NFAVertex, u32> &region_map) {
     assert(isRegionEntry(g, v, region_map));
 
     DEBUG_PRINTF("check if r%u is optional (inspecting v%zu)\n",
index 264e43128fc888730a97eaf9693b3b3c54b427f7..1126d4d6c986f3871266303513de01276a7fc4e0 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:
@@ -60,7 +60,7 @@ struct RegionInfo {
 static
 bool regionHasUnexpectedAccept(const NGHolder &g, const u32 region,
                        const flat_set<ReportID> &expected_reports,
-                       const ue2::unordered_map<NFAVertex, u32> &region_map) {
+                       const unordered_map<NFAVertex, u32> &region_map) {
     /* TODO: only check vertices connected to accept/acceptEOD */
     for (auto v : vertices_range(g)) {
         if (region != region_map.at(v)) {
@@ -84,7 +84,7 @@ bool regionHasUnexpectedAccept(const NGHolder &g, const u32 region,
 static
 void processCyclicStateForward(NGHolder &h, NFAVertex cyc,
                          const map<u32, RegionInfo> &info,
-                         const ue2::unordered_map<NFAVertex, u32> &region_map,
+                         const unordered_map<NFAVertex, u32> &region_map,
                          set<u32> &deadRegions) {
     u32 region = region_map.at(cyc);
     CharReach cr = h[cyc].char_reach;
@@ -130,7 +130,7 @@ void processCyclicStateForward(NGHolder &h, NFAVertex cyc,
 static
 void processCyclicStateReverse(NGHolder &h, NFAVertex cyc,
                          const map<u32, RegionInfo> &info,
-                         const ue2::unordered_map<NFAVertex, u32> &region_map,
+                         const unordered_map<NFAVertex, u32> &region_map,
                          set<u32> &deadRegions) {
     u32 region = region_map.at(cyc);
     CharReach cr = h[cyc].char_reach;
@@ -179,7 +179,7 @@ void processCyclicStateReverse(NGHolder &h, NFAVertex cyc,
 
 static
 map<u32, RegionInfo> buildRegionInfoMap(const NGHolder &g,
-                   const ue2::unordered_map<NFAVertex, u32> &region_map) {
+                   const unordered_map<NFAVertex, u32> &region_map) {
     map<u32, RegionInfo> info;
 
     for (auto v : vertices_range(g)) {
index 4487376ad17b0089aedef2168492b5dd4c47b5f5..da42b36d6771829f0619991d61529c90997cbb83 100644 (file)
 #include "util/graph_range.h"
 #include "util/graph_small_color_map.h"
 #include "util/report_manager.h"
+#include "util/unordered.h"
 
 #include <algorithm>
 #include <map>
 #include <queue>
+#include <unordered_map>
+#include <unordered_set>
 
 #include <boost/graph/connected_components.hpp>
 #include <boost/graph/depth_first_search.hpp>
@@ -64,6 +67,7 @@
 using namespace std;
 using boost::depth_first_search;
 using boost::depth_first_visit;
+using boost::make_assoc_property_map;
 
 namespace ue2 {
 
@@ -118,7 +122,7 @@ struct ReachSubgraph {
 
 static
 void findInitDepths(const NGHolder &g,
-                    ue2::unordered_map<NFAVertex, NFAVertexDepth> &depths) {
+                    unordered_map<NFAVertex, NFAVertexDepth> &depths) {
     auto d = calcDepths(g);
 
     for (auto v : vertices_range(g)) {
@@ -133,12 +137,12 @@ vector<NFAVertex> buildTopoOrder(const RepeatGraph &g) {
     /* Note: RepeatGraph is a filtered version of NGHolder and still has
      * NFAVertex as its vertex descriptor */
 
-    typedef ue2::unordered_set<NFAEdge> EdgeSet;
+    typedef unordered_set<NFAEdge> EdgeSet;
     EdgeSet deadEdges;
 
     // We don't have indices spanning [0,N] on our filtered graph, so we
     // provide a colour map.
-    ue2::unordered_map<NFAVertex, boost::default_color_type> colours;
+    unordered_map<NFAVertex, boost::default_color_type> colours;
 
     depth_first_search(g, visitor(BackEdges<EdgeSet>(deadEdges)).
                           color_map(make_assoc_property_map(colours)));
@@ -155,22 +159,22 @@ vector<NFAVertex> buildTopoOrder(const RepeatGraph &g) {
 
 static
 void proper_pred(const NGHolder &g, NFAVertex v,
-                 ue2::unordered_set<NFAVertex> &p) {
+                 unordered_set<NFAVertex> &p) {
     pred(g, v, &p);
     p.erase(v); // self-loops
 }
 
 static
 void proper_succ(const NGHolder &g, NFAVertex v,
-                 ue2::unordered_set<NFAVertex> &s) {
+                 unordered_set<NFAVertex> &s) {
     succ(g, v, &s);
     s.erase(v); // self-loops
 }
 
 static
 bool roguePredecessor(const NGHolder &g, NFAVertex v,
-                      const ue2::unordered_set<NFAVertex> &involved,
-                      const ue2::unordered_set<NFAVertex> &pred) {
+                      const unordered_set<NFAVertex> &involved,
+                      const unordered_set<NFAVertex> &pred) {
     u32 seen = 0;
 
     for (auto u : inv_adjacent_vertices_range(v, g)) {
@@ -195,8 +199,8 @@ bool roguePredecessor(const NGHolder &g, NFAVertex v,
 
 static
 bool rogueSuccessor(const NGHolder &g, NFAVertex v,
-                    const ue2::unordered_set<NFAVertex> &involved,
-                    const ue2::unordered_set<NFAVertex> &succ) {
+                    const unordered_set<NFAVertex> &involved,
+                    const unordered_set<NFAVertex> &succ) {
     u32 seen = 0;
     for (auto w : adjacent_vertices_range(v, g)) {
         if (contains(involved, w)) {
@@ -245,10 +249,10 @@ bool hasDifferentTops(const NGHolder &g, const vector<NFAVertex> &verts) {
 
 static
 bool vertexIsBad(const NGHolder &g, NFAVertex v,
-                 const ue2::unordered_set<NFAVertex> &involved,
-                 const ue2::unordered_set<NFAVertex> &tail,
-                 const ue2::unordered_set<NFAVertex> &pred,
-                 const ue2::unordered_set<NFAVertex> &succ,
+                 const unordered_set<NFAVertex> &involved,
+                 const unordered_set<NFAVertex> &tail,
+                 const unordered_set<NFAVertex> &pred,
+                 const unordered_set<NFAVertex> &succ,
                  const flat_set<ReportID> &reports) {
     DEBUG_PRINTF("check vertex %zu\n", g[v].index);
 
@@ -293,13 +297,13 @@ void splitSubgraph(const NGHolder &g, const deque<NFAVertex> &verts,
     // We construct a copy of the graph using just the vertices we want, rather
     // than using a filtered_graph -- this way is faster.
     NGHolder verts_g;
-    ue2::unordered_map<NFAVertex, NFAVertex> verts_map; // in g -> in verts_g
+    unordered_map<NFAVertex, NFAVertex> verts_map; // in g -> in verts_g
     fillHolder(&verts_g, g, verts, &verts_map);
 
-    ue2::unordered_map<NFAVertex, NFAUndirectedVertex> old2new;
+    unordered_map<NFAVertex, NFAUndirectedVertex> old2new;
     auto ug = createUnGraph(verts_g, true, true, old2new);
 
-    ue2::unordered_map<NFAUndirectedVertex, u32> repeatMap;
+    unordered_map<NFAUndirectedVertex, u32> repeatMap;
 
     size_t num = connected_components(ug, make_assoc_property_map(repeatMap));
     DEBUG_PRINTF("found %zu connected repeat components\n", num);
@@ -377,10 +381,10 @@ void checkReachSubgraphs(const NGHolder &g, vector<ReachSubgraph> &rs,
             continue;
         }
 
-        ue2::unordered_set<NFAVertex> involved(rsi.vertices.begin(),
-                                               rsi.vertices.end());
-        ue2::unordered_set<NFAVertex> tail(involved); // to look for back-edges.
-        ue2::unordered_set<NFAVertex> pred, succ;
+        unordered_set<NFAVertex> involved(rsi.vertices.begin(),
+                                          rsi.vertices.end());
+        unordered_set<NFAVertex> tail(involved); // to look for back-edges.
+        unordered_set<NFAVertex> pred, succ;
         proper_pred(g, rsi.vertices.front(), pred);
         proper_succ(g, rsi.vertices.back(), succ);
 
@@ -514,7 +518,7 @@ bool processSubgraph(const NGHolder &g, ReachSubgraph &rsi,
     NFAVertex first = rsi.vertices.front();
     NFAVertex last = rsi.vertices.back();
 
-    typedef ue2::unordered_map<NFAVertex, DistanceSet> DistanceMap;
+    typedef unordered_map<NFAVertex, DistanceSet> DistanceMap;
     DistanceMap dist;
 
     // Initial distance sets.
@@ -608,7 +612,7 @@ bool processSubgraph(const NGHolder &g, ReachSubgraph &rsi,
 
 static
 bool allPredsInSubgraph(NFAVertex v, const NGHolder &g,
-                        const ue2::unordered_set<NFAVertex> &involved) {
+                        const unordered_set<NFAVertex> &involved) {
     for (auto u : inv_adjacent_vertices_range(v, g)) {
         if (!contains(involved, u)) {
             return false;
@@ -619,8 +623,8 @@ bool allPredsInSubgraph(NFAVertex v, const NGHolder &g,
 
 static
 void buildTugTrigger(NGHolder &g, NFAVertex cyclic, NFAVertex v,
-                     const ue2::unordered_set<NFAVertex> &involved,
-                     ue2::unordered_map<NFAVertex, NFAVertexDepth> &depths,
+                     const unordered_set<NFAVertex> &involved,
+                     unordered_map<NFAVertex, NFAVertexDepth> &depths,
                      vector<NFAVertex> &tugs) {
     if (allPredsInSubgraph(v, g, involved)) {
         // We can transform this vertex into a tug trigger in-place.
@@ -699,7 +703,7 @@ u32 unpeelAmount(const NGHolder &g, const ReachSubgraph &rsi) {
 
 static
 void unpeelNearEnd(NGHolder &g, ReachSubgraph &rsi,
-                   ue2::unordered_map<NFAVertex, NFAVertexDepth> &depths,
+                   unordered_map<NFAVertex, NFAVertexDepth> &depths,
                    vector<NFAVertex> *succs) {
     u32 unpeel = unpeelAmount(g, rsi);
     DEBUG_PRINTF("unpeeling %u vertices\n", unpeel);
@@ -759,8 +763,8 @@ void getSuccessors(const NGHolder &g, const ReachSubgraph &rsi,
 static
 void replaceSubgraphWithSpecial(NGHolder &g, ReachSubgraph &rsi,
                                 vector<BoundedRepeatData> *repeats,
-                                ue2::unordered_map<NFAVertex, NFAVertexDepth> &depths,
-                                ue2::unordered_set<NFAVertex> &created) {
+                                unordered_map<NFAVertex, NFAVertexDepth> &depths,
+                                unordered_set<NFAVertex> &created) {
     assert(!rsi.bad);
     assert(rsi.repeatMin > depth(0));
     assert(rsi.repeatMax >= rsi.repeatMin);
@@ -768,7 +772,7 @@ void replaceSubgraphWithSpecial(NGHolder &g, ReachSubgraph &rsi,
 
     DEBUG_PRINTF("entry\n");
 
-    const ue2::unordered_set<NFAVertex> involved(rsi.vertices.begin(),
+    const unordered_set<NFAVertex> involved(rsi.vertices.begin(),
                                                  rsi.vertices.end());
     vector<NFAVertex> succs;
     getSuccessors(g, rsi, &succs);
@@ -829,16 +833,16 @@ void replaceSubgraphWithSpecial(NGHolder &g, ReachSubgraph &rsi,
 static
 void replaceSubgraphWithLazySpecial(NGHolder &g, ReachSubgraph &rsi,
                           vector<BoundedRepeatData> *repeats,
-                          ue2::unordered_map<NFAVertex, NFAVertexDepth> &depths,
-                          ue2::unordered_set<NFAVertex> &created) {
+                          unordered_map<NFAVertex, NFAVertexDepth> &depths,
+                          unordered_set<NFAVertex> &created) {
     assert(!rsi.bad);
     assert(rsi.repeatMin);
     assert(rsi.repeatMax >= rsi.repeatMin);
 
     DEBUG_PRINTF("entry\n");
 
-    const ue2::unordered_set<NFAVertex> involved(rsi.vertices.begin(),
-                                                 rsi.vertices.end());
+    const unordered_set<NFAVertex> involved(rsi.vertices.begin(),
+                                            rsi.vertices.end());
     vector<NFAVertex> succs;
     getSuccessors(g, rsi, &succs);
 
@@ -932,7 +936,7 @@ void reprocessSubgraph(const NGHolder &h, const Grey &grey,
  * involved in other repeats as a result of earlier repeat transformations. */
 static
 bool peelSubgraph(const NGHolder &g, const Grey &grey, ReachSubgraph &rsi,
-                  const ue2::unordered_set<NFAVertex> &created) {
+                  const unordered_set<NFAVertex> &created) {
     assert(!rsi.bad);
 
     if (created.empty()) {
@@ -994,8 +998,8 @@ bool peelSubgraph(const NGHolder &g, const Grey &grey, ReachSubgraph &rsi,
  * idea to extend to cyclic states, too. */
 static
 void peelStartDotStar(const NGHolder &g,
-                    const ue2::unordered_map<NFAVertex, NFAVertexDepth> &depths,
-                    const Grey &grey, ReachSubgraph &rsi) {
+                      const unordered_map<NFAVertex, NFAVertexDepth> &depths,
+                      const Grey &grey, ReachSubgraph &rsi) {
     if (rsi.vertices.size() < 1) {
         return;
     }
@@ -1073,8 +1077,8 @@ bool hasSkipEdges(const NGHolder &g, const ReachSubgraph &rsi) {
 /* depth info is valid as calculated at entry */
 static
 bool entered_at_fixed_offset(NFAVertex v, const NGHolder &g,
-            const ue2::unordered_map<NFAVertex, NFAVertexDepth> &depths,
-            const ue2::unordered_set<NFAVertex> &reached_by_fixed_tops) {
+            const unordered_map<NFAVertex, NFAVertexDepth> &depths,
+            const unordered_set<NFAVertex> &reached_by_fixed_tops) {
     DEBUG_PRINTF("|reached_by_fixed_tops| %zu\n",
                   reached_by_fixed_tops.size());
     if (is_triggered(g) && !contains(reached_by_fixed_tops, v)) {
@@ -1200,12 +1204,12 @@ CharReach predReach(const NGHolder &g, NFAVertex v) {
  */
 static
 void filterMap(const NGHolder &subg,
-               ue2::unordered_map<NFAVertex, NFAVertex> &vmap) {
+               unordered_map<NFAVertex, NFAVertex> &vmap) {
     NGHolder::vertex_iterator vi, ve;
     tie(vi, ve) = vertices(subg);
-    const ue2::unordered_set<NFAVertex> remaining_verts(vi, ve);
+    const unordered_set<NFAVertex> remaining_verts(vi, ve);
 
-    ue2::unordered_map<NFAVertex, NFAVertex> fmap; // filtered map
+    unordered_map<NFAVertex, NFAVertex> fmap; // filtered map
 
     for (const auto &m : vmap) {
         if (contains(remaining_verts, m.second)) {
@@ -1220,7 +1224,7 @@ void filterMap(const NGHolder &subg,
  * the bounded repeat. */
 static
 void buildRepeatGraph(NGHolder &rg,
-                      ue2::unordered_map<NFAVertex, NFAVertex> &rg_map,
+                      unordered_map<NFAVertex, NFAVertex> &rg_map,
                       const NGHolder &g, const ReachSubgraph &rsi,
                       const map<u32, vector<vector<CharReach>>> &triggers) {
     cloneHolder(rg, g, &rg_map);
@@ -1231,7 +1235,7 @@ void buildRepeatGraph(NGHolder &rg,
     add_edge(rg.accept, rg.acceptEod, rg);
 
     // Find the set of vertices in rg involved in the repeat.
-    ue2::unordered_set<NFAVertex> rg_involved;
+    unordered_set<NFAVertex> rg_involved;
     for (const auto &v : rsi.vertices) {
         assert(contains(rg_map, v));
         rg_involved.insert(rg_map.at(v));
@@ -1273,7 +1277,7 @@ void buildRepeatGraph(NGHolder &rg,
  */
 static
 void buildInputGraph(NGHolder &lhs,
-                     ue2::unordered_map<NFAVertex, NFAVertex> &lhs_map,
+                     unordered_map<NFAVertex, NFAVertex> &lhs_map,
                      const NGHolder &g, const NFAVertex first,
                      const map<u32, vector<vector<CharReach>>> &triggers) {
     DEBUG_PRINTF("building lhs with first=%zu\n", g[first].index);
@@ -1327,8 +1331,8 @@ static const size_t MAX_SOLE_ENTRY_VERTICES = 10000;
  * single offset at runtime. See UE-1361. */
 static
 bool hasSoleEntry(const NGHolder &g, const ReachSubgraph &rsi,
-                  const ue2::unordered_map<NFAVertex, NFAVertexDepth> &depths,
-                  const ue2::unordered_set<NFAVertex> &reached_by_fixed_tops,
+                  const unordered_map<NFAVertex, NFAVertexDepth> &depths,
+                  const unordered_set<NFAVertex> &reached_by_fixed_tops,
                   const map<u32, vector<vector<CharReach>>> &triggers) {
     DEBUG_PRINTF("checking repeat {%s,%s}\n", rsi.repeatMin.str().c_str(),
                  rsi.repeatMax.str().c_str());
@@ -1358,12 +1362,12 @@ bool hasSoleEntry(const NGHolder &g, const ReachSubgraph &rsi,
     }
 
     NGHolder rg;
-    ue2::unordered_map<NFAVertex, NFAVertex> rg_map;
+    unordered_map<NFAVertex, NFAVertex> rg_map;
     buildRepeatGraph(rg, rg_map, g, rsi, triggers);
     assert(rg.kind == g.kind);
 
     NGHolder lhs;
-    ue2::unordered_map<NFAVertex, NFAVertex> lhs_map;
+    unordered_map<NFAVertex, NFAVertex> lhs_map;
     buildInputGraph(lhs, lhs_map, g, first, triggers);
     assert(lhs.kind == g.kind);
 
@@ -1377,7 +1381,7 @@ bool hasSoleEntry(const NGHolder &g, const ReachSubgraph &rsi,
     // are in one region, vertices in the bounded repeat are in another.
     const u32 lhs_region = 1;
     const u32 repeat_region = 2;
-    ue2::unordered_map<NFAVertex, u32> region_map;
+    unordered_map<NFAVertex, u32> region_map;
 
     for (const auto &v : rsi.vertices) {
         assert(!is_special(v, g)); // no specials in repeats
@@ -1473,7 +1477,7 @@ struct StrawWalker {
 
     NFAVertex walk(NFAVertex v, vector<NFAVertex> &straw) const {
         DEBUG_PRINTF("walk from %zu\n", g[v].index);
-        ue2::unordered_set<NFAVertex> visited;
+        unordered_set<NFAVertex> visited;
         straw.clear();
 
         while (!is_special(v, g)) {
@@ -1695,7 +1699,7 @@ vector<vector<CharReach>> getRepeatTriggers(const NGHolder &g,
     assert(!done.empty());
 
     // Convert our path list into a set of unique triggers.
-    ue2::unordered_set<vector<CharReach>> unique_triggers;
+    ue2_unordered_set<vector<CharReach>> unique_triggers;
     for (const auto &path : done) {
         vector<CharReach> reach_path;
         for (auto jt = path.rbegin(), jte = path.rend(); jt != jte; ++jt) {
@@ -1743,8 +1747,8 @@ static
 void
 selectHistoryScheme(const NGHolder &g, const ReportManager *rm,
                     ReachSubgraph &rsi,
-                    const ue2::unordered_map<NFAVertex, NFAVertexDepth> &depths,
-                    const ue2::unordered_set<NFAVertex> &reached_by_fixed_tops,
+                    const unordered_map<NFAVertex, NFAVertexDepth> &depths,
+                    const unordered_set<NFAVertex> &reached_by_fixed_tops,
                     const map<u32, vector<vector<CharReach>>> &triggers,
                     const vector<BoundedRepeatData> &all_repeats,
                     const bool simple_model_selection) {
@@ -1812,7 +1816,7 @@ selectHistoryScheme(const NGHolder &g, const ReportManager *rm,
 
 static
 void buildFeeder(NGHolder &g, const BoundedRepeatData &rd,
-                 ue2::unordered_set<NFAVertex> &created,
+                 unordered_set<NFAVertex> &created,
                  const vector<NFAVertex> &straw) {
     if (!g[rd.cyclic].char_reach.all()) {
         // Create another cyclic feeder state with flipped reach.  It has an
@@ -1859,7 +1863,7 @@ void buildFeeder(NGHolder &g, const BoundedRepeatData &rd,
  */
 static
 bool improveLeadingRepeat(NGHolder &g, BoundedRepeatData &rd,
-                          ue2::unordered_set<NFAVertex> &created,
+                          unordered_set<NFAVertex> &created,
                           const vector<BoundedRepeatData> &all_repeats) {
     assert(edge(g.startDs, g.startDs, g).second);
 
@@ -1963,7 +1967,7 @@ vector<NFAVertex> makeOwnStraw(NGHolder &g, BoundedRepeatData &rd,
  */
 static
 bool improveLeadingRepeatOutfix(NGHolder &g, BoundedRepeatData &rd,
-                                ue2::unordered_set<NFAVertex> &created,
+                                unordered_set<NFAVertex> &created,
                                 const vector<BoundedRepeatData> &all_repeats) {
     assert(g.kind == NFA_OUTFIX);
 
@@ -2061,7 +2065,7 @@ bool endsInAcceptEod(const NGHolder &g, const ReachSubgraph &rsi) {
 namespace {
 class pfti_visitor : public boost::default_dfs_visitor {
 public:
-    pfti_visitor(ue2::unordered_map<NFAVertex, depth> &top_depths_in,
+    pfti_visitor(unordered_map<NFAVertex, depth> &top_depths_in,
                  const depth &our_depth_in)
         : top_depths(top_depths_in), our_depth(our_depth_in) {}
 
@@ -2077,7 +2081,7 @@ public:
             top_depths[v] = our_depth;
         }
     }
-    ue2::unordered_map<NFAVertex, depth> &top_depths;
+    unordered_map<NFAVertex, depth> &top_depths;
     const depth &our_depth;
 };
 } // namespace
@@ -2091,7 +2095,7 @@ void populateFixedTopInfo(const map<u32, u32> &fixed_depth_tops,
     }
 
     assert(!proper_out_degree(g.startDs, g));
-    ue2::unordered_map<NFAVertex, depth> top_depths;
+    unordered_map<NFAVertex, depth> top_depths;
     auto colours = make_small_color_map(g);
 
     for (const auto &e : out_edges_range(g.start, g)) {
@@ -2142,7 +2146,7 @@ void populateFixedTopInfo(const map<u32, u32> &fixed_depth_tops,
 static
 bool hasOverlappingRepeats(UNUSED const NGHolder &g,
                            const vector<BoundedRepeatData> &repeats) {
-    ue2::unordered_set<NFAVertex> involved;
+    unordered_set<NFAVertex> involved;
 
     for (const auto &br : repeats) {
         if (contains(involved, br.cyclic)) {
@@ -2177,7 +2181,7 @@ bool hasOverlappingRepeats(UNUSED const NGHolder &g,
  */
 static
 bool repeatIsNasty(const NGHolder &g, const ReachSubgraph &rsi,
-                   const ue2::unordered_map<NFAVertex, NFAVertexDepth> &depths) {
+                   const unordered_map<NFAVertex, NFAVertexDepth> &depths) {
     if (num_vertices(g) > NFA_MAX_STATES) {
         // We may have no choice but to implement this repeat to get the graph
         // down to a tractable number of vertices.
@@ -2236,7 +2240,7 @@ void analyseRepeats(NGHolder &g, const ReportManager *rm,
     // Later on, we're (a little bit) dependent on depth information for
     // unpeeling and so forth. Note that these depths MUST be maintained when
     // new vertices are added.
-    ue2::unordered_map<NFAVertex, NFAVertexDepth> depths;
+    unordered_map<NFAVertex, NFAVertexDepth> depths;
     findInitDepths(g, depths);
 
     // Construct our list of subgraphs with the same reach using BGL magic.
@@ -2293,13 +2297,13 @@ void analyseRepeats(NGHolder &g, const ReportManager *rm,
     // could make this unnecessary?
     const unique_ptr<const NGHolder> orig_g(cloneHolder(g));
 
-    ue2::unordered_set<NFAVertex> reached_by_fixed_tops;
+    unordered_set<NFAVertex> reached_by_fixed_tops;
     if (is_triggered(g)) {
         populateFixedTopInfo(fixed_depth_tops, g, &reached_by_fixed_tops);
     }
 
     // Go to town on the remaining acceptable subgraphs.
-    ue2::unordered_set<NFAVertex> created;
+    unordered_set<NFAVertex> created;
     for (auto &rsi : rs) {
         DEBUG_PRINTF("subgraph (beginning vertex %zu) is a {%s,%s} repeat\n",
                      g[rsi.vertices.front()].index,
index 2f14cb0c6b2d8a6e7be7353832169b0e67d2fab4..cfd804b7eff50db6700eff7a7c57f0c2d6aec973 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 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,7 @@
 #include "ue2common.h"
 #include "nfa/repeat_internal.h"
 #include "util/depth.h"
-#include "util/ue2_containers.h"
+#include "util/flat_containers.h"
 
 #include <map>
 #include <vector>
@@ -122,7 +122,7 @@ void findRepeats(const NGHolder &h, u32 minRepeatVertices,
 struct PureRepeat {
     CharReach reach;
     DepthMinMax bounds;
-    ue2::flat_set<ReportID> reports;
+    flat_set<ReportID> reports;
 
     bool operator==(const PureRepeat &a) const {
         return reach == a.reach && bounds == a.bounds && reports == a.reports;
index 32cdac2364c032c37c649b9967b50d14c61f31f6..704697e57fc3146b563f8f7c959053a57a39c911 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:
@@ -131,9 +131,9 @@ void getStateOrdering(NGHolder &g, const flat_set<NFAVertex> &tops,
 
 // Returns the number of states.
 static
-ue2::unordered_map<NFAVertex, u32>
+unordered_map<NFAVertex, u32>
 getStateIndices(const NGHolder &h, const vector<NFAVertex> &ordering) {
-    ue2::unordered_map<NFAVertex, u32> states;
+    unordered_map<NFAVertex, u32> states;
     for (const auto &v : vertices_range(h)) {
         states[v] = NO_STATE;
     }
index bbd478d53768dd931e66d18fe47d7b984fe3ddae..75d19c6294ef7bc3528d2fd2eda79300c5564bd0 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:
 
 /** \file
  * \brief State numbering and late graph restructuring code.
-
  */
+
 #ifndef NG_RESTRUCTURING_H
 #define NG_RESTRUCTURING_H
 
 #include "ng_holder.h"
 #include "ue2common.h"
-#include "util/ue2_containers.h"
+#include "util/flat_containers.h"
+
+#include <unordered_map>
 
 namespace ue2 {
 
@@ -48,14 +50,14 @@ static constexpr u32 NO_STATE = ~0;
 /**
  * \brief Gives each participating vertex in the graph a unique state index.
  */
-unordered_map<NFAVertex, u32>
+std::unordered_map<NFAVertex, u32>
 numberStates(NGHolder &h, const flat_set<NFAVertex> &tops);
 
 /**
  * \brief Counts the number of states (vertices with state indices) in the
  * graph.
  */
-u32 countStates(const unordered_map<NFAVertex, u32> &state_ids);
+u32 countStates(const std::unordered_map<NFAVertex, u32> &state_ids);
 
 } // namespace ue2
 
index dc86dd44a1aa880d425b419fa67384141c69e551..0f932668c9f855298054b7069cbacfbe38e944f9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 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:
@@ -40,6 +40,8 @@
 #include "util/charreach.h"
 #include "util/graph_range.h"
 
+#include <set>
+
 using namespace std;
 
 namespace ue2 {
index 67438103129880f0c87efd6defc3ed714b5e3e2a..6520a590702602b7bf3041861a5419cd37becabe 100644 (file)
@@ -69,6 +69,8 @@
 
 #include <algorithm>
 #include <map>
+#include <unordered_map>
+#include <unordered_set>
 #include <vector>
 
 using namespace std;
@@ -103,7 +105,7 @@ struct som_plan {
 
 static
 bool regionCanEstablishSom(const NGHolder &g,
-                           const ue2::unordered_map<NFAVertex, u32> &regions,
+                           const unordered_map<NFAVertex, u32> &regions,
                            const u32 region, const vector<NFAVertex> &r_exits,
                            const vector<DepthMinMax> &depths) {
     if (region == regions.at(g.accept) ||
@@ -149,7 +151,7 @@ struct region_info {
 
 static
 void buildRegionMapping(const NGHolder &g,
-                        const ue2::unordered_map<NFAVertex, u32> &regions,
+                        const unordered_map<NFAVertex, u32> &regions,
                         map<u32, region_info> &info,
                         bool include_region_0 = false) {
     for (auto v : vertices_range(g)) {
@@ -228,7 +230,7 @@ void buildRegionMapping(const NGHolder &g,
 
 static
 bool validateXSL(const NGHolder &g,
-                 const ue2::unordered_map<NFAVertex, u32> &regions,
+                 const unordered_map<NFAVertex, u32> &regions,
                  const u32 region, const CharReach &escapes, u32 *bad_region) {
     /* need to check that the escapes escape all of the graph past region */
     u32 first_bad_region = ~0U;
@@ -251,7 +253,7 @@ bool validateXSL(const NGHolder &g,
 
 static
 bool validateEXSL(const NGHolder &g,
-                  const ue2::unordered_map<NFAVertex, u32> &regions,
+                  const unordered_map<NFAVertex, u32> &regions,
                   const u32 region, const CharReach &escapes,
                   const NGHolder &prefix, u32 *bad_region) {
     /* EXSL: To be a valid EXSL with escapes e, we require that all states
@@ -353,7 +355,7 @@ bool isPossibleLock(const NGHolder &g,
 
 static
 unique_ptr<NGHolder>
-makePrefix(const NGHolder &g, const ue2::unordered_map<NFAVertex, u32> &regions,
+makePrefix(const NGHolder &g, const unordered_map<NFAVertex, u32> &regions,
            const region_info &curr, const region_info &next,
            bool renumber = true) {
     const vector<NFAVertex> &curr_exits = curr.exits;
@@ -368,12 +370,12 @@ makePrefix(const NGHolder &g, const ue2::unordered_map<NFAVertex, u32> &regions,
     deque<NFAVertex> lhs_verts;
     insert(&lhs_verts, lhs_verts.end(), vertices(g));
 
-    ue2::unordered_map<NFAVertex, NFAVertex> lhs_map; // g -> prefix
+    unordered_map<NFAVertex, NFAVertex> lhs_map; // g -> prefix
     fillHolder(&prefix, g, lhs_verts, &lhs_map);
     prefix.kind = NFA_OUTFIX;
 
     // We need a reverse mapping to track regions.
-    ue2::unordered_map<NFAVertex, NFAVertex> rev_map; // prefix -> g
+    unordered_map<NFAVertex, NFAVertex> rev_map; // prefix -> g
     for (const auto &e : lhs_map) {
         rev_map.emplace(e.second, e.first);
     }
@@ -541,7 +543,7 @@ void setMidfixReports(ReportManager &rm, const som_plan &item,
 
 static
 bool finalRegion(const NGHolder &g,
-                 const ue2::unordered_map<NFAVertex, u32> &regions,
+                 const unordered_map<NFAVertex, u32> &regions,
                  NFAVertex v) {
     u32 region = regions.at(v);
     for (auto w : adjacent_vertices_range(v, g)) {
@@ -771,7 +773,7 @@ void fillHolderForLockCheck(NGHolder *out, const NGHolder &g,
 
 static
 void fillRoughMidfix(NGHolder *out, const NGHolder &g,
-                     const ue2::unordered_map<NFAVertex, u32> &regions,
+                     const unordered_map<NFAVertex, u32> &regions,
                      const map<u32, region_info> &info,
                      map<u32, region_info>::const_iterator picked) {
     /* as we are not the first prefix, we are probably not acyclic. We need to
@@ -941,7 +943,7 @@ bool isMandRegionBetween(map<u32, region_info>::const_iterator a,
 // (woot!); updates picked, plan and bad_region.
 static
 bool advancePlan(const NGHolder &g,
-                 const ue2::unordered_map<NFAVertex, u32> &regions,
+                 const unordered_map<NFAVertex, u32> &regions,
                  const NGHolder &prefix, bool stuck,
                  map<u32, region_info>::const_iterator &picked,
                  const map<u32, region_info>::const_iterator furthest,
@@ -1051,13 +1053,12 @@ void addReporterVertices(const region_info &r, const NGHolder &g,
 // Fetches the mappings of all preds of {accept, acceptEod} in this region.
 static
 void addMappedReporterVertices(const region_info &r, const NGHolder &g,
-                        const ue2::unordered_map<NFAVertex, NFAVertex> &mapping,
+                        const unordered_map<NFAVertex, NFAVertex> &mapping,
                         vector<NFAVertex> &reporters) {
     for (auto v : r.exits) {
         if (edge(v, g.accept, g).second || edge(v, g.acceptEod, g).second) {
             DEBUG_PRINTF("adding v=%zu\n", g[v].index);
-            ue2::unordered_map<NFAVertex, NFAVertex>::const_iterator it =
-                mapping.find(v);
+            auto it = mapping.find(v);
             assert(it != mapping.end());
             reporters.push_back(it->second);
         }
@@ -1068,9 +1069,9 @@ void addMappedReporterVertices(const region_info &r, const NGHolder &g,
 // from earlier regions.
 static
 void cloneGraphWithOneEntry(NGHolder &out, const NGHolder &g,
-                       const ue2::unordered_map<NFAVertex, u32> &regions,
+                       const unordered_map<NFAVertex, u32> &regions,
                        NFAVertex entry, const vector<NFAVertex> &enters,
-                       ue2::unordered_map<NFAVertex, NFAVertex> &orig_to_copy) {
+                       unordered_map<NFAVertex, NFAVertex> &orig_to_copy) {
     orig_to_copy.clear();
     cloneHolder(out, g, &orig_to_copy);
 
@@ -1095,7 +1096,7 @@ void cloneGraphWithOneEntry(NGHolder &out, const NGHolder &g,
 }
 
 static
-void expandGraph(NGHolder &g, ue2::unordered_map<NFAVertex, u32> &regions,
+void expandGraph(NGHolder &g, unordered_map<NFAVertex, u32> &regions,
                  vector<NFAVertex> &enters) {
     assert(!enters.empty());
     const u32 split_region = regions.at(enters.front());
@@ -1178,11 +1179,11 @@ void expandGraph(NGHolder &g, ue2::unordered_map<NFAVertex, u32> &regions,
 
 static
 bool doTreePlanningIntl(NGHolder &g,
-            const ue2::unordered_map<NFAVertex, u32> &regions,
+            const unordered_map<NFAVertex, u32> &regions,
             const map<u32, region_info> &info,
             map<u32, region_info>::const_iterator picked, u32 bad_region,
             u32 parent_plan,
-            const ue2::unordered_map<NFAVertex, NFAVertex> &copy_to_orig,
+            const unordered_map<NFAVertex, NFAVertex> &copy_to_orig,
             vector<som_plan> &plan, const Grey &grey) {
     assert(picked != info.end());
 
@@ -1341,7 +1342,7 @@ bool doTreePlanning(NGHolder &g,
         // regions.
 
         NGHolder g_path;
-        ue2::unordered_map<NFAVertex, NFAVertex> orig_to_copy;
+        unordered_map<NFAVertex, NFAVertex> orig_to_copy;
         cloneGraphWithOneEntry(g_path, g, g_regions, v, enters, orig_to_copy);
         auto regions = assignRegions(g_path);
         dumpHolder(g_path, regions, 14, "som_treepath", grey);
@@ -1375,7 +1376,7 @@ bool doTreePlanning(NGHolder &g,
         }
 
         // Construct reverse mapping from vertices in g_path to g.
-        ue2::unordered_map<NFAVertex, NFAVertex> copy_to_orig;
+        unordered_map<NFAVertex, NFAVertex> copy_to_orig;
         for (const auto &m : orig_to_copy) {
             copy_to_orig.insert(make_pair(m.second, m.first));
         }
@@ -1398,7 +1399,7 @@ enum dsp_behaviour {
 
 static
 bool doSomPlanning(NGHolder &g, bool stuck_in,
-                   const ue2::unordered_map<NFAVertex, u32> &regions,
+                   const unordered_map<NFAVertex, u32> &regions,
                    const map<u32, region_info> &info,
                    map<u32, region_info>::const_iterator picked,
                    vector<som_plan> &plan,
@@ -1940,7 +1941,7 @@ map<u32, region_info>::const_iterator findLaterLiteral(const NGHolder &g,
 
 static
 bool attemptToBuildChainAfterSombe(SomSlotManager &ssm, NGHolder &g,
-                  const ue2::unordered_map<NFAVertex, u32> &regions,
+                  const unordered_map<NFAVertex, u32> &regions,
                   const map<u32, region_info> &info,
                   map<u32, region_info>::const_iterator picked,
                   const Grey &grey,
@@ -2014,7 +2015,7 @@ void setReportOnHaigPrefix(RoseBuild &rose, NGHolder &h) {
 
 static
 bool tryHaig(RoseBuild &rose, NGHolder &g,
-             const ue2::unordered_map<NFAVertex, u32> &regions,
+             const unordered_map<NFAVertex, u32> &regions,
              som_type som, u32 somPrecision,
              map<u32, region_info>::const_iterator picked,
              shared_ptr<raw_som_dfa> *haig, shared_ptr<NGHolder> *haig_prefix,
@@ -2062,7 +2063,7 @@ void roseAddHaigLiteral(RoseBuild &tb, const shared_ptr<NGHolder> &prefix,
 static
 sombe_rv doHaigLitSom(NG &ng, NGHolder &g, const ExpressionInfo &expr,
                       u32 comp_id, som_type som,
-                      const ue2::unordered_map<NFAVertex, u32> &regions,
+                      const unordered_map<NFAVertex, u32> &regions,
                       const map<u32, region_info> &info,
                       map<u32, region_info>::const_iterator lower_bound) {
     DEBUG_PRINTF("entry\n");
@@ -2343,7 +2344,7 @@ bool splitOffLeadingLiterals(const NGHolder &g, set<ue2_literal> *lit_out,
         }
     }
 
-    ue2::unordered_map<NFAVertex, NFAVertex> rhs_map;
+    unordered_map<NFAVertex, NFAVertex> rhs_map;
     vector<NFAVertex> pivots;
     insert(&pivots, pivots.end(), adj_term1);
     splitRHS(g, pivots, rhs, &rhs_map);
@@ -2354,7 +2355,7 @@ bool splitOffLeadingLiterals(const NGHolder &g, set<ue2_literal> *lit_out,
 
 static
 void findBestLiteral(const NGHolder &g,
-                     const ue2::unordered_map<NFAVertex, u32> &regions,
+                     const unordered_map<NFAVertex, u32> &regions,
                      ue2_literal *lit_out, NFAVertex *v,
                      const CompileContext &cc) {
     map<u32, region_info> info;
@@ -2394,7 +2395,7 @@ void findBestLiteral(const NGHolder &g,
 
 static
 bool splitOffBestLiteral(const NGHolder &g,
-                         const ue2::unordered_map<NFAVertex, u32> &regions,
+                         const unordered_map<NFAVertex, u32> &regions,
                          ue2_literal *lit_out, NGHolder *lhs, NGHolder *rhs,
                          const CompileContext &cc) {
     NFAVertex v = NGHolder::null_vertex();
@@ -2406,8 +2407,8 @@ bool splitOffBestLiteral(const NGHolder &g,
 
     DEBUG_PRINTF("literal is '%s'\n", dumpString(*lit_out).c_str());
 
-    ue2::unordered_map<NFAVertex, NFAVertex> lhs_map;
-    ue2::unordered_map<NFAVertex, NFAVertex> rhs_map;
+    unordered_map<NFAVertex, NFAVertex> lhs_map;
+    unordered_map<NFAVertex, NFAVertex> rhs_map;
 
     splitGraph(g, v, lhs, &lhs_map, rhs, &rhs_map);
 
@@ -2498,7 +2499,7 @@ bool doLitHaigSom(NG &ng, NGHolder &g, som_type som) {
 
 static
 bool doHaigLitHaigSom(NG &ng, NGHolder &g,
-                      const ue2::unordered_map<NFAVertex, u32> &regions,
+                      const unordered_map<NFAVertex, u32> &regions,
                       som_type som) {
     if (!ng.cc.grey.allowLitHaig) {
         return false;
@@ -2732,7 +2733,7 @@ bool trySombe(NG &ng, NGHolder &g, som_type som) {
 
 static
 map<u32, region_info>::const_iterator pickInitialSomCut(const NGHolder &g,
-                        const ue2::unordered_map<NFAVertex, u32> &regions,
+                        const unordered_map<NFAVertex, u32> &regions,
                         const map<u32, region_info> &info,
                         const vector<DepthMinMax> &depths) {
     map<u32, region_info>::const_iterator picked = info.end();
@@ -2757,7 +2758,7 @@ map<u32, region_info>::const_iterator pickInitialSomCut(const NGHolder &g,
 
 static
 map<u32, region_info>::const_iterator tryForLaterRevNfaCut(const NGHolder &g,
-                              const ue2::unordered_map<NFAVertex, u32> &regions,
+                              const unordered_map<NFAVertex, u32> &regions,
                               const map<u32, region_info> &info,
                               const vector<DepthMinMax> &depths,
                               const map<u32, region_info>::const_iterator &orig,
@@ -2849,7 +2850,7 @@ map<u32, region_info>::const_iterator tryForLaterRevNfaCut(const NGHolder &g,
 
 static
 unique_ptr<NGHolder> makePrefixForChain(NGHolder &g,
-                         const ue2::unordered_map<NFAVertex, u32> &regions,
+                         const unordered_map<NFAVertex, u32> &regions,
                          const map<u32, region_info> &info,
                          const map<u32, region_info>::const_iterator &picked,
                          vector<DepthMinMax> *depths, bool prefix_by_rev,
index a3b6ee5fd201290931896e5983f2c376926d0747..1e7a41bb0ca9ecd73585c277a920e5509fd229df 100644 (file)
@@ -54,7 +54,7 @@ vector<DepthMinMax> getDistancesFromSOM(const NGHolder &g_orig) {
     // We operate on a temporary copy of the original graph here, so we don't
     // have to mutate the original.
     NGHolder g;
-    ue2::unordered_map<NFAVertex, NFAVertex> vmap; // vertex in g_orig to vertex in g
+    unordered_map<NFAVertex, NFAVertex> vmap; // vertex in g_orig to vertex in g
     cloneHolder(g, g_orig, &vmap);
 
     vector<NFAVertex> vstarts;
@@ -136,7 +136,7 @@ bool firstMatchIsFirst(const NGHolder &p) {
         return false;
     }
 
-    ue2::flat_set<NFAVertex> states;
+    flat_set<NFAVertex> states;
     /* turn on all states (except starts - avoid suffix matches) */
     /* If we were doing (1) we would also except states leading to accepts -
        avoid prefix matches */
@@ -166,7 +166,7 @@ bool firstMatchIsFirst(const NGHolder &p) {
 }
 
 bool somMayGoBackwards(NFAVertex u, const NGHolder &g,
-                       const ue2::unordered_map<NFAVertex, u32> &region_map,
+                       const unordered_map<NFAVertex, u32> &region_map,
                        smgb_cache &cache) {
     /* Need to ensure all matches of the graph g up to u contain no infixes
      * which are also matches of the graph to u.
@@ -215,7 +215,7 @@ bool somMayGoBackwards(NFAVertex u, const NGHolder &g,
         }
     }
 
-    ue2::unordered_map<NFAVertex, NFAVertex> orig_to_copy;
+    unordered_map<NFAVertex, NFAVertex> orig_to_copy;
     NGHolder c_g;
     cloneHolder(c_g, g, &orig_to_copy);
 
@@ -287,7 +287,7 @@ bool somMayGoBackwards(NFAVertex u, const NGHolder &g,
 }
 
 bool sentClearsTail(const NGHolder &g,
-                    const ue2::unordered_map<NFAVertex, u32> &region_map,
+                    const unordered_map<NFAVertex, u32> &region_map,
                     const NGHolder &sent, u32 last_head_region,
                     u32 *bad_region) {
     /* if a subsequent match from the prefix clears the rest of the pattern
@@ -312,7 +312,7 @@ bool sentClearsTail(const NGHolder &g,
      */
 
     u32 first_bad_region = ~0U;
-    ue2::flat_set<NFAVertex> states;
+    flat_set<NFAVertex> states;
     /* turn on all states */
     DEBUG_PRINTF("region %u is cutover\n", last_head_region);
     for (auto v : vertices_range(g)) {
index 793dd2c34cd6a31460cea924a2032b05100878ac..e2d38642c4f2dc90e3756ccb96ad31c7f4142c3b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 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:
@@ -35,9 +35,9 @@
 
 #include "ng_util.h"
 #include "util/depth.h"
-#include "util/ue2_containers.h"
 
 #include <map>
+#include <unordered_map>
 #include <vector>
 
 namespace ue2 {
@@ -61,7 +61,7 @@ struct smgb_cache : public mbsb_cache {
 };
 
 bool somMayGoBackwards(NFAVertex u, const NGHolder &g,
-                       const ue2::unordered_map<NFAVertex, u32> &region_map,
+                       const std::unordered_map<NFAVertex, u32> &region_map,
                        smgb_cache &cache);
 
 /**
@@ -75,7 +75,7 @@ bool somMayGoBackwards(NFAVertex u, const NGHolder &g,
  *   region ID associated with a tail state that is still on.
  */
 bool sentClearsTail(const NGHolder &g,
-                    const ue2::unordered_map<NFAVertex, u32> &region_map,
+                    const std::unordered_map<NFAVertex, u32> &region_map,
                     const NGHolder &sent, u32 last_head_region,
                     u32 *bad_region);
 
index 3c2baee42cf673205508ba0d6ca8738a8b16e203..91a099fc38abd2f0b39b58bfe937fcaa52b5b2b8 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/container.h"
 #include "util/graph.h"
 #include "util/graph_range.h"
-#include "util/ue2_containers.h"
 
 #include <map>
 #include <set>
@@ -63,12 +62,13 @@ void clearAccepts(NGHolder &g) {
 }
 
 static
-void filterSplitMap(const NGHolder &g, ue2::unordered_map<NFAVertex, NFAVertex> *out_map) {
-    ue2::unordered_set<NFAVertex> verts;
+void filterSplitMap(const NGHolder &g,
+                    unordered_map<NFAVertex, NFAVertex> *out_map) {
+    unordered_set<NFAVertex> verts;
     insert(&verts, vertices(g));
-    ue2::unordered_map<NFAVertex, NFAVertex>::iterator it = out_map->begin();
+    auto it = out_map->begin();
     while (it != out_map->end()) {
-        ue2::unordered_map<NFAVertex, NFAVertex>::iterator jt = it;
+        auto jt = it;
         ++it;
         if (!contains(verts, jt->second)) {
             out_map->erase(jt);
@@ -78,8 +78,8 @@ void filterSplitMap(const NGHolder &g, ue2::unordered_map<NFAVertex, NFAVertex>
 
 static
 void splitLHS(const NGHolder &base, const vector<NFAVertex> &pivots,
-              const vector<NFAVertex> &rhs_pivots,
-              NGHolder *lhs, ue2::unordered_map<NFAVertex, NFAVertex> *lhs_map) {
+              const vector<NFAVertex> &rhs_pivots, NGHolder *lhs,
+              unordered_map<NFAVertex, NFAVertex> *lhs_map) {
     assert(lhs && lhs_map);
 
     cloneHolder(*lhs, base, lhs_map);
@@ -131,7 +131,7 @@ void splitLHS(const NGHolder &base, const vector<NFAVertex> &pivots,
 }
 
 void splitLHS(const NGHolder &base, NFAVertex pivot,
-              NGHolder *lhs, ue2::unordered_map<NFAVertex, NFAVertex> *lhs_map) {
+              NGHolder *lhs, unordered_map<NFAVertex, NFAVertex> *lhs_map) {
     vector<NFAVertex> pivots(1, pivot);
     vector<NFAVertex> rhs_pivots;
     insert(&rhs_pivots, rhs_pivots.end(), adjacent_vertices(pivot, base));
@@ -139,7 +139,7 @@ void splitLHS(const NGHolder &base, NFAVertex pivot,
 }
 
 void splitRHS(const NGHolder &base, const vector<NFAVertex> &pivots,
-              NGHolder *rhs, ue2::unordered_map<NFAVertex, NFAVertex> *rhs_map) {
+              NGHolder *rhs, unordered_map<NFAVertex, NFAVertex> *rhs_map) {
     assert(rhs && rhs_map);
 
     cloneHolder(*rhs, base, rhs_map);
@@ -211,8 +211,8 @@ void findCommonSuccessors(const NGHolder &g, const vector<NFAVertex> &pivots,
 }
 
 void splitGraph(const NGHolder &base, const vector<NFAVertex> &pivots,
-                NGHolder *lhs, ue2::unordered_map<NFAVertex, NFAVertex> *lhs_map,
-                NGHolder *rhs, ue2::unordered_map<NFAVertex, NFAVertex> *rhs_map) {
+                NGHolder *lhs, unordered_map<NFAVertex, NFAVertex> *lhs_map,
+                NGHolder *rhs, unordered_map<NFAVertex, NFAVertex> *rhs_map) {
     DEBUG_PRINTF("splitting graph at %zu vertices\n", pivots.size());
 
     assert(!has_parallel_edge(base));
@@ -235,8 +235,8 @@ void splitGraph(const NGHolder &base, const vector<NFAVertex> &pivots,
 }
 
 void splitGraph(const NGHolder &base, NFAVertex pivot,
-                NGHolder *lhs, ue2::unordered_map<NFAVertex, NFAVertex> *lhs_map,
-                NGHolder *rhs, ue2::unordered_map<NFAVertex, NFAVertex> *rhs_map) {
+                NGHolder *lhs, unordered_map<NFAVertex, NFAVertex> *lhs_map,
+                NGHolder *rhs, unordered_map<NFAVertex, NFAVertex> *rhs_map) {
     vector<NFAVertex> pivots(1, pivot);
     splitGraph(base, pivots, lhs, lhs_map, rhs, rhs_map);
 }
index 31c1cf3514add727af97e5b19b67664ef4082443..9ddc0332570d47cadbe78cfaa8994b01fd2b93bc 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:
 #ifndef NG_SPLIT_H
 #define NG_SPLIT_H
 
-#include <vector>
-
 #include "ng_holder.h"
-#include "util/ue2_containers.h"
+
+#include <unordered_map>
+#include <vector>
 
 namespace ue2 {
 
@@ -55,21 +55,21 @@ class NGHolder;
  *   vertices which have an edge to every pivot
  */
 void splitGraph(const NGHolder &base, NFAVertex pivot, NGHolder *lhs,
-                ue2::unordered_map<NFAVertex, NFAVertex> *lhs_map,
+                std::unordered_map<NFAVertex, NFAVertex> *lhs_map,
                 NGHolder *rhs,
-                ue2::unordered_map<NFAVertex, NFAVertex> *rhs_map);
+                std::unordered_map<NFAVertex, NFAVertex> *rhs_map);
 
 void splitGraph(const NGHolder &base, const std::vector<NFAVertex> &pivots,
                 NGHolder *lhs,
-                ue2::unordered_map<NFAVertex, NFAVertex> *lhs_map,
+                std::unordered_map<NFAVertex, NFAVertex> *lhs_map,
                 NGHolder *rhs,
-                ue2::unordered_map<NFAVertex, NFAVertex> *rhs_map);
+                std::unordered_map<NFAVertex, NFAVertex> *rhs_map);
 
 void splitLHS(const NGHolder &base, NFAVertex pivot, NGHolder *lhs,
-              ue2::unordered_map<NFAVertex, NFAVertex> *lhs_map);
+              std::unordered_map<NFAVertex, NFAVertex> *lhs_map);
 
 void splitRHS(const NGHolder &base, const std::vector<NFAVertex> &pivots,
-              NGHolder *rhs, ue2::unordered_map<NFAVertex, NFAVertex> *rhs_map);
+              NGHolder *rhs, std::unordered_map<NFAVertex, NFAVertex> *rhs_map);
 
 } // namespace ue2
 
index ebec3a4a17d4b72abad2181781f3e21ce960c47d..df77668e8b0064c7b83d6e1a8aa9fae0c764c790 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:
 #include "ng_region.h"
 #include "ng_som_util.h"
 #include "ng_util.h"
-#include "ng_util.h"
 #include "util/container.h"
 #include "util/graph_range.h"
 #include "util/report_manager.h"
 
 #include <deque>
 #include <map>
+#include <unordered_map>
+#include <unordered_set>
 
 #include <boost/graph/depth_first_search.hpp>
 #include <boost/graph/reverse_graph.hpp>
@@ -120,13 +121,11 @@ using namespace std;
 
 namespace ue2 {
 
-typedef ue2::unordered_map<NFAVertex,
-                           ue2::unordered_set<NFAVertex> > PostDomTree;
+typedef unordered_map<NFAVertex, unordered_set<NFAVertex>> PostDomTree;
 
 static
 void buildPDomTree(const NGHolder &g, PostDomTree &tree) {
-    ue2::unordered_map<NFAVertex, NFAVertex> postdominators =
-        findPostDominators(g);
+    auto postdominators = findPostDominators(g);
 
     for (auto v : vertices_range(g)) {
         if (is_special(v, g)) {
@@ -150,7 +149,7 @@ void buildSquashMask(NFAStateSet &mask, const NGHolder &g, NFAVertex v,
                      const CharReach &cr, const NFAStateSet &init,
                      const vector<NFAVertex> &vByIndex, const PostDomTree &tree,
                      som_type som, const vector<DepthMinMax> &som_depths,
-                     const ue2::unordered_map<NFAVertex, u32> &region_map,
+                     const unordered_map<NFAVertex, u32> &region_map,
                      smgb_cache &cache) {
     DEBUG_PRINTF("build base squash mask for vertex %zu)\n", g[v].index);
 
@@ -274,7 +273,7 @@ void findDerivedSquashers(const NGHolder &g, const vector<NFAVertex> &vByIndex,
                           const PostDomTree &pdom_tree, const NFAStateSet &init,
                           map<NFAVertex, NFAStateSet> *squash, som_type som,
                           const vector<DepthMinMax> &som_depths,
-                          const ue2::unordered_map<NFAVertex, u32> &region_map,
+                          const unordered_map<NFAVertex, u32> &region_map,
                           smgb_cache &cache) {
     deque<NFAVertex> remaining;
     for (const auto &m : *squash) {
@@ -619,7 +618,7 @@ static
 vector<NFAVertex> findUnreachable(const NGHolder &g) {
     const boost::reverse_graph<NGHolder, const NGHolder &> revg(g);
 
-    ue2::unordered_map<NFAVertex, boost::default_color_type> colours;
+    unordered_map<NFAVertex, boost::default_color_type> colours;
     colours.reserve(num_vertices(g));
 
     depth_first_visit(revg, g.acceptEod,
@@ -661,7 +660,7 @@ findHighlanderSquashers(const NGHolder &g, const ReportManager &rm) {
         // cutting the appropriate out-edges to accept and seeing which
         // vertices become unreachable.
 
-        ue2::unordered_map<NFAVertex, NFAVertex> orig_to_copy;
+        unordered_map<NFAVertex, NFAVertex> orig_to_copy;
         NGHolder h;
         cloneHolder(h, g, &orig_to_copy);
         removeEdgesToAccept(h, orig_to_copy[v]);
index 66621a7dc0b7059ab29ba9cde43237c36d7bf90e..51ce245a0a2eb600039e4362becf89e8668e4f97 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 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:
@@ -35,7 +35,6 @@
 #include "ng_holder.h"
 #include "som/som.h"
 #include "ue2common.h"
-#include "util/ue2_containers.h"
 
 #include <map>
 #include <boost/dynamic_bitset.hpp>
@@ -45,7 +44,9 @@ namespace ue2 {
 class NGHolder;
 class ReportManager;
 
-/** Dynamically-sized bitset, as an NFA can have an arbitrary number of states. */
+/**
+ * Dynamically-sized bitset, as an NFA can have an arbitrary number of states.
+ */
 typedef boost::dynamic_bitset<> NFAStateSet;
 
 /**
index 1e27ad791721dd16bac60f68cecf08e937dba61c..036adcbff5cbdea87672d167152b7db7bc7dd6cc 100644 (file)
@@ -37,7 +37,7 @@
 #include "ng_util.h"
 #include "ue2common.h"
 #include "util/graph_range.h"
-#include "util/ue2_containers.h"
+#include "util/unordered.h"
 
 #include <vector>
 
@@ -71,8 +71,8 @@ template <typename Graph>
 NFAUndirectedGraph createUnGraph(const Graph &g,
            bool excludeStarts,
            bool excludeAccepts,
-           unordered_map<typename Graph::vertex_descriptor,
-                         NFAUndirectedVertex> &old2new) {
+           std::unordered_map<typename Graph::vertex_descriptor,
+                              NFAUndirectedVertex> &old2new) {
     NFAUndirectedGraph ug;
     size_t idx = 0;
 
@@ -97,7 +97,7 @@ NFAUndirectedGraph createUnGraph(const Graph &g,
 
     // Track seen edges so that we don't insert parallel edges.
     using Vertex = typename Graph::vertex_descriptor;
-    unordered_set<std::pair<Vertex, Vertex>> seen;
+    ue2_unordered_set<std::pair<Vertex, Vertex>> seen;
     seen.reserve(num_edges(g));
     auto make_ordered_edge = [](Vertex a, Vertex b) {
         return std::make_pair(std::min(a, b), std::max(a, b));
index 14082407d79b84426a21cf98548460bef0892e3a..83b29257cb972036b800c8af2964915488ef90ae 100644 (file)
@@ -48,6 +48,9 @@
 #include <limits>
 #include <map>
 #include <set>
+#include <unordered_map>
+#include <unordered_set>
+
 #include <boost/graph/filtered_graph.hpp>
 #include <boost/graph/topological_sort.hpp>
 #include <boost/range/adaptor/map.hpp>
@@ -353,7 +356,7 @@ vector<NFAVertex> getTopoOrdering(const NGHolder &g) {
     // having to reallocate it, etc.
     auto colors = make_small_color_map(g);
 
-    using EdgeSet = ue2::unordered_set<NFAEdge>;
+    using EdgeSet = unordered_set<NFAEdge>;
     EdgeSet backEdges;
     BackEdges<EdgeSet> be(backEdges);
 
@@ -467,7 +470,7 @@ void setTops(NGHolder &h, u32 top) {
 
 void clearReports(NGHolder &g) {
     DEBUG_PRINTF("clearing reports without an accept edge\n");
-    ue2::unordered_set<NFAVertex> allow;
+    unordered_set<NFAVertex> allow;
     insert(&allow, inv_adjacent_vertices(g.accept, g));
     insert(&allow, inv_adjacent_vertices(g.acceptEod, g));
     allow.erase(g.accept); // due to stylised edge.
@@ -491,7 +494,7 @@ void duplicateReport(NGHolder &g, ReportID r_old, ReportID r_new) {
 
 static
 void fillHolderOutEdges(NGHolder &out, const NGHolder &in,
-                        const ue2::unordered_map<NFAVertex, NFAVertex> &v_map,
+                        const unordered_map<NFAVertex, NFAVertex> &v_map,
                         NFAVertex u) {
     NFAVertex u_new = v_map.at(u);
 
@@ -513,9 +516,9 @@ void fillHolderOutEdges(NGHolder &out, const NGHolder &in,
 }
 
 void fillHolder(NGHolder *outp, const NGHolder &in, const deque<NFAVertex> &vv,
-                ue2::unordered_map<NFAVertex, NFAVertex> *v_map_out) {
+                unordered_map<NFAVertex, NFAVertex> *v_map_out) {
     NGHolder &out = *outp;
-    ue2::unordered_map<NFAVertex, NFAVertex> &v_map = *v_map_out;
+    unordered_map<NFAVertex, NFAVertex> &v_map = *v_map_out;
 
     out.kind = in.kind;
 
@@ -597,7 +600,7 @@ void cloneHolder(NGHolder &out, const NGHolder &in) {
 }
 
 void cloneHolder(NGHolder &out, const NGHolder &in,
-                 ue2::unordered_map<NFAVertex, NFAVertex> *mapping) {
+                 unordered_map<NFAVertex, NFAVertex> *mapping) {
     cloneHolder(out, in);
     vector<NFAVertex> out_verts(num_vertices(in));
     for (auto v : vertices_range(out)) {
@@ -620,7 +623,7 @@ unique_ptr<NGHolder> cloneHolder(const NGHolder &in) {
 
 void reverseHolder(const NGHolder &g_in, NGHolder &g) {
     // Make the BGL do the grunt work.
-    ue2::unordered_map<NFAVertex, NFAVertex> vertexMap;
+    unordered_map<NFAVertex, NFAVertex> vertexMap;
     boost::transpose_graph(g_in, g,
                 orig_to_copy(boost::make_assoc_property_map(vertexMap)));
 
index 4c529a83f577d8a7c0e45c36981db89c1266e7ee..3cc9c7c3edfba4216f4820f67dcdd7e96896108f 100644 (file)
 #ifndef NG_UTIL_H
 #define NG_UTIL_H
 
-#include <map>
-#include <vector>
-
-#include <boost/graph/depth_first_search.hpp> // for default_dfs_visitor
-
 #include "ng_holder.h"
 #include "ue2common.h"
+#include "util/flat_containers.h"
 #include "util/graph.h"
 #include "util/graph_range.h"
-#include "util/ue2_containers.h"
+
+#include <boost/graph/depth_first_search.hpp> // for default_dfs_visitor
+
+#include <map>
+#include <unordered_map>
+#include <vector>
 
 namespace ue2 {
 
@@ -272,12 +273,12 @@ void appendLiteral(NGHolder &h, const ue2_literal &s);
  * \a in). A vertex mapping is returned in \a v_map_out. */
 void fillHolder(NGHolder *outp, const NGHolder &in,
                 const std::deque<NFAVertex> &vv,
-                unordered_map<NFAVertex, NFAVertex> *v_map_out);
+                std::unordered_map<NFAVertex, NFAVertex> *v_map_out);
 
 /** \brief Clone the graph in \a in into graph \a out, returning a vertex
  * mapping in \a v_map_out. */
 void cloneHolder(NGHolder &out, const NGHolder &in,
-                 unordered_map<NFAVertex, NFAVertex> *v_map_out);
+                 std::unordered_map<NFAVertex, NFAVertex> *v_map_out);
 
 /** \brief Clone the graph in \a in into graph \a out. */
 void cloneHolder(NGHolder &out, const NGHolder &in);
index d330398535a220d48ebd8f0ec0950c9fe35f1c27..6742fec910c031c9137efc59bc114f681af48965 100644 (file)
 #include "util/compare.h"
 #include "util/compile_context.h"
 #include "util/container.h"
+#include "util/flat_containers.h"
 #include "util/graph.h"
 #include "util/graph_range.h"
 #include "util/make_unique.h"
 #include "util/order_check.h"
 #include "util/target_info.h"
 #include "util/ue2string.h"
-#include "util/ue2_containers.h"
 
 #include <set>
 #include <utility>
@@ -559,7 +559,7 @@ void filterCandPivots(const NGHolder &g, const set<NFAVertex> &cand_raw,
 static
 void getCandidatePivots(const NGHolder &g, set<NFAVertex> *cand,
                         set<NFAVertex> *cand_raw) {
-    ue2::unordered_map<NFAVertex, NFAVertex> dominators = findDominators(g);
+    auto dominators = findDominators(g);
 
     set<NFAVertex> accepts;
 
@@ -1023,8 +1023,8 @@ bool splitRoseEdge(const NGHolder &base_graph, RoseInGraph &vg,
     shared_ptr<NGHolder> lhs = make_shared<NGHolder>();
     shared_ptr<NGHolder> rhs = make_shared<NGHolder>();
 
-    ue2::unordered_map<NFAVertex, NFAVertex> lhs_map;
-    ue2::unordered_map<NFAVertex, NFAVertex> rhs_map;
+    unordered_map<NFAVertex, NFAVertex> lhs_map;
+    unordered_map<NFAVertex, NFAVertex> rhs_map;
 
     splitGraph(base_graph, splitters, lhs.get(), &lhs_map, rhs.get(), &rhs_map);
     DEBUG_PRINTF("split %s:%zu into %s:%zu + %s:%zu\n",
@@ -1217,7 +1217,7 @@ void splitEdgesByCut(NGHolder &h, RoseInGraph &vg,
             NFAVertex pivot = target(e, h);
 
             DEBUG_PRINTF("splitting on pivot %zu\n", h[pivot].index);
-            ue2::unordered_map<NFAVertex, NFAVertex> temp_map;
+            unordered_map<NFAVertex, NFAVertex> temp_map;
             shared_ptr<NGHolder> new_lhs = make_shared<NGHolder>();
             splitLHS(h, pivot, new_lhs.get(), &temp_map);
 
@@ -1298,7 +1298,7 @@ void splitEdgesByCut(NGHolder &h, RoseInGraph &vg,
                effort */
 
             if (!contains(done_rhs, adj)) {
-                ue2::unordered_map<NFAVertex, NFAVertex> temp_map;
+                unordered_map<NFAVertex, NFAVertex> temp_map;
                 shared_ptr<NGHolder> new_rhs = make_shared<NGHolder>();
                 splitRHS(h, adj, new_rhs.get(), &temp_map);
                 remove_edge(new_rhs->start, new_rhs->accept, *new_rhs);
index ce9ca865b66f5a1f1a926757d2d900421579bfd4..43dfc76055ffe69b5b46b541acc4cd886519de41 100644 (file)
@@ -53,8 +53,8 @@
 #include "parser/Parser.h"
 #include "ue2common.h"
 #include "util/compare.h"
+#include "util/flat_containers.h"
 #include "util/make_unique.h"
-#include "util/ue2_containers.h"
 #include "util/unicode_def.h"
 #include "util/verify_types.h"
 
index eb25550bc013114c934da5b4f6587eb7016eb136..75cfbb7b2d3ed5e29e7cb46db608bc3a6c43723c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 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:
 #include "nfagraph/ng_builder.h"
 #include "util/charreach.h"
 #include "util/container.h"
+#include "util/flat_containers.h"
+#include "util/hash.h"
 #include "util/make_unique.h"
-#include "util/ue2_containers.h"
+#include "util/unordered.h"
 
 #include <algorithm>
 #include <iterator>
@@ -449,7 +451,7 @@ unique_ptr<GlushkovBuildState> makeGlushkovBuildState(NFABuilder &b,
  * Scans through a list of positions and retains only the highest priority
  * version of a given (position, flags) entry. */
 void cleanupPositions(vector<PositionInfo> &a) {
-    ue2::unordered_set<pair<Position, int>> seen; // track dupes
+    ue2_unordered_set<pair<Position, int>> seen;
 
     vector<PositionInfo> out;
     out.reserve(a.size()); // output should be close to input in size.
index fae68f7457f61092e32e12493e69834084ef8625..0badc7806d209d47c5c1973fa376728e069287c0 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:
@@ -36,7 +36,7 @@
 #include "ConstComponentVisitor.h"
 #include "parse_error.h"
 #include "util/container.h"
-#include "util/ue2_containers.h"
+#include "util/flat_containers.h"
 
 #include <sstream>
 
index ede448966ad2e8ed86c6965f576726a2dfa5afdf..26912fb8e447a8102ff9e0efe8600622241c06bd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 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:
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-/** \file
+/**
+ * \file
  * \brief Component tree analysis that checks that references (such as
  * back-refs, conditionals) have valid referents.
  */
-#ifndef PARSER_CHECK_REFS_H_
-#define PARSER_CHECK_REFS_H_
 
-#include "util/ue2_containers.h"
+#ifndef PARSER_CHECK_REFS_H
+#define PARSER_CHECK_REFS_H
+
+#include "util/flat_containers.h"
 
 #include <string>
 
@@ -43,8 +45,8 @@ class Component;
 class ComponentSequence;
 
 void checkReferences(const Component &root, unsigned int groupIndices,
-                     const ue2::flat_set<std::string> &groupNames);
+                     const flat_set<std::string> &groupNames);
 
 } // namespace ue2
 
-#endif // PARSER_CHECK_REFS_H_
+#endif // PARSER_CHECK_REFS_H
index cbb925f79d79657b70a3ed693c741c529df33163..2219f12e5811d56ef71ec2b6514408332e747666 100644 (file)
@@ -42,8 +42,8 @@
 #include "rose_in_graph.h"
 #include "util/bytecode_ptr.h"
 #include "util/charreach.h"
+#include "util/flat_containers.h"
 #include "util/noncopyable.h"
-#include "util/ue2_containers.h"
 #include "util/ue2string.h"
 
 #include <memory>
@@ -73,7 +73,7 @@ public:
 
     /** \brief True if we can not establish that at most a single callback will
      * be generated at a given offset from this set of reports. */
-    virtual bool requiresDedupeSupport(const ue2::flat_set<ReportID> &reports)
+    virtual bool requiresDedupeSupport(const flat_set<ReportID> &reports)
         const = 0;
 };
 
@@ -85,7 +85,7 @@ public:
 
     /** \brief Adds a single literal. */
     virtual void add(bool anchored, bool eod, const ue2_literal &lit,
-                     const ue2::flat_set<ReportID> &ids) = 0;
+                     const flat_set<ReportID> &ids) = 0;
 
     virtual bool addRose(const RoseInGraph &ig, bool prefilter) = 0;
     virtual bool addSombeRose(const RoseInGraph &ig) = 0;
@@ -99,17 +99,17 @@ public:
 
     /** \brief Returns true if we were able to add it as a mask. */
     virtual bool add(bool anchored, const std::vector<CharReach> &mask,
-                     const ue2::flat_set<ReportID> &reports) = 0;
+                     const flat_set<ReportID> &reports) = 0;
 
     /** \brief Attempts to add the graph to the anchored acyclic table. Returns
      * true on success. */
     virtual bool addAnchoredAcyclic(const NGHolder &graph) = 0;
 
     virtual bool validateMask(const std::vector<CharReach> &mask,
-                              const ue2::flat_set<ReportID> &reports,
+                              const flat_set<ReportID> &reports,
                               bool anchored, bool eod) const = 0;
     virtual void addMask(const std::vector<CharReach> &mask,
-                         const ue2::flat_set<ReportID> &reports, bool anchored,
+                         const flat_set<ReportID> &reports, bool anchored,
                          bool eod) = 0;
 
     /** \brief Construct a runtime implementation. */
index 4c895cafce5c347e7a410df34f7e1b5f28605d82..f36fa576eeacc7172bdfa8591b27abace43522d1 100644 (file)
@@ -85,7 +85,7 @@ struct RoseBuildData : noncopyable {
 
     /** Edges we've transformed (in \ref transformAnchoredLiteralOverlap) which
      * require ANCH history to prevent overlap. */
-    ue2::unordered_set<RoseInEdge> anch_history_edges;
+    unordered_set<RoseInEdge> anch_history_edges;
 
     /** True if we're tracking Start of Match. */
     bool som;
index 74626a829e676fd68624f30e91ef9c2c3dc5df5e..8ea07c95d3a21366bc4430a5f9e47618842f6626 100644 (file)
 #include "util/compile_error.h"
 #include "util/container.h"
 #include "util/determinise.h"
+#include "util/flat_containers.h"
 #include "util/graph_range.h"
 #include "util/make_unique.h"
 #include "util/order_check.h"
-#include "util/ue2_containers.h"
 #include "util/ue2string.h"
+#include "util/unordered.h"
 #include "util/verify_types.h"
 
 #include <map>
@@ -285,19 +286,16 @@ struct Holder_StateSet {
     bool operator==(const Holder_StateSet &b) const {
         return wdelay == b.wdelay && wrap_state == b.wrap_state;
     }
-};
 
-size_t hash_value(const Holder_StateSet &s) {
-    size_t val = 0;
-    boost::hash_combine(val, s.wrap_state);
-    boost::hash_combine(val, s.wdelay);
-    return val;
-}
+    size_t hash() const {
+        return hash_all(wrap_state, wdelay);
+    }
+};
 
 class Automaton_Holder {
 public:
     using StateSet = Holder_StateSet;
-    using StateMap = unordered_map<StateSet, dstate_id_t>;
+    using StateMap = ue2_unordered_map<StateSet, dstate_id_t>;
 
     explicit Automaton_Holder(const NGHolder &g_in) : g(g_in) {
         for (auto v : vertices_range(g)) {
@@ -416,7 +414,7 @@ public:
 
 private:
     const NGHolder &g;
-    ue2::unordered_map<NFAVertex, u32> vertexToIndex;
+    unordered_map<NFAVertex, u32> vertexToIndex;
     vector<NFAVertex> indexToVertex;
     vector<CharReach> cr_by_index;
     StateSet init;
@@ -712,7 +710,7 @@ int addAutomaton(RoseBuildImpl &build, const NGHolder &h, ReportID *remap) {
 
 static
 void setReports(NGHolder &h, const map<NFAVertex, set<u32>> &reportMap,
-                const ue2::unordered_map<NFAVertex, NFAVertex> &orig_to_copy) {
+                const unordered_map<NFAVertex, NFAVertex> &orig_to_copy) {
     for (const auto &m : reportMap) {
         NFAVertex t = orig_to_copy.at(m.first);
         assert(!m.second.empty());
@@ -724,7 +722,7 @@ void setReports(NGHolder &h, const map<NFAVertex, set<u32>> &reportMap,
 int addAnchoredNFA(RoseBuildImpl &build, const NGHolder &wrapper,
                    const map<NFAVertex, set<u32>> &reportMap) {
     NGHolder h;
-    ue2::unordered_map<NFAVertex, NFAVertex> orig_to_copy;
+    unordered_map<NFAVertex, NFAVertex> orig_to_copy;
     cloneHolder(h, wrapper, &orig_to_copy);
     clear_in_edges(h.accept, h);
     clear_in_edges(h.acceptEod, h);
index a41f03229855a05b944880372e419ce906d5408f..e7fd62713629efe3ce3da88a47c5da9d9483ea53 100644 (file)
@@ -145,8 +145,8 @@ struct build_context : noncopyable {
 
     /** \brief Simple cache of programs written to engine blob, used for
      * deduplication. */
-    ue2::unordered_map<RoseProgram, u32, RoseProgramHash,
-                       RoseProgramEquivalence> program_cache;
+    unordered_map<RoseProgram, u32, RoseProgramHash,
+                  RoseProgramEquivalence> program_cache;
 
     /** \brief State indices, for those roles that have them.
      * Each vertex present has a unique state index in the range
@@ -155,7 +155,7 @@ struct build_context : noncopyable {
 
     /** \brief Mapping from queue index to bytecode offset for built engines
      * that have already been pushed into the engine_blob. */
-    ue2::unordered_map<u32, u32> engineOffsets;
+    unordered_map<u32, u32> engineOffsets;
 
     /** \brief List of long literals (ones with CHECK_LONG_LIT instructions)
      * that need hash table support. */
@@ -1470,7 +1470,7 @@ bool buildLeftfixes(RoseBuildImpl &tbi, build_context &bc,
 
     map<left_id, set<PredTopPair> > infixTriggers;
     vector<left_id> order;
-    unordered_map<left_id, vector<RoseVertex> > succs;
+    unordered_map<left_id, vector<RoseVertex>> succs;
     findInfixTriggers(tbi, &infixTriggers);
 
     if (cc.grey.allowTamarama && cc.streaming && !do_prefix) {
@@ -2269,9 +2269,9 @@ bool hasMpvTrigger(const set<u32> &reports, const ReportManager &rm) {
 }
 
 static
-bool anyEndfixMpvTriggers(const RoseBuildImpl &tbi) {
-    const RoseGraph &g = tbi.g;
-    ue2::unordered_set<suffix_id> done;
+bool anyEndfixMpvTriggers(const RoseBuildImpl &build) {
+    const RoseGraph &g = build.g;
+    unordered_set<suffix_id> done;
 
     /* suffixes */
     for (auto v : vertices_range(g)) {
@@ -2283,14 +2283,14 @@ bool anyEndfixMpvTriggers(const RoseBuildImpl &tbi) {
         }
         done.insert(g[v].suffix);
 
-        if (hasMpvTrigger(all_reports(g[v].suffix), tbi.rm)) {
+        if (hasMpvTrigger(all_reports(g[v].suffix), build.rm)) {
             return true;
         }
     }
 
     /* outfixes */
-    for (const auto &out : tbi.outfixes) {
-        if (hasMpvTrigger(all_reports(out), tbi.rm)) {
+    for (const auto &out : build.outfixes) {
+        if (hasMpvTrigger(all_reports(out), build.rm)) {
             return true;
         }
     }
@@ -2588,7 +2588,7 @@ void buildLeftInfoTable(const RoseBuildImpl &tbi, build_context &bc,
     const RoseGraph &g = tbi.g;
     const CompileContext &cc = tbi.cc;
 
-    ue2::unordered_set<u32> done_core;
+    unordered_set<u32> done_core;
 
     leftTable.resize(leftfixCount);
 
index a85a784fc1e0c0c747393e84d8094254eec67cb8..59bab3b1f98c4585571d3b55d3730e1950161f53 100644 (file)
@@ -38,7 +38,6 @@
 #include "util/container.h"
 #include "util/dump_charclass.h"
 #include "util/graph_range.h"
-#include "util/ue2_containers.h"
 #include "util/ue2string.h"
 
 #include <map>
@@ -55,7 +54,7 @@ namespace ue2 {
 
 static
 void makeCastle(LeftEngInfo &left,
-               unordered_map<const NGHolder *, shared_ptr<CastleProto>> &cache) {
+            unordered_map<const NGHolder *, shared_ptr<CastleProto>> &cache) {
     if (left.dfa || left.haig || left.castle) {
         return;
     }
@@ -85,7 +84,7 @@ void makeCastle(LeftEngInfo &left,
 
 static
 void makeCastleSuffix(RoseBuildImpl &tbi, RoseVertex v,
-        ue2::unordered_map<const NGHolder *, shared_ptr<CastleProto> > &cache) {
+            unordered_map<const NGHolder *, shared_ptr<CastleProto>> &cache) {
     RoseSuffixInfo &suffix = tbi.g[v].suffix;
     if (!suffix.graph) {
         return;
@@ -298,8 +297,8 @@ bool unmakeCastles(RoseBuildImpl &tbi) {
 }
 
 void remapCastleTops(RoseBuildImpl &tbi) {
-    ue2::unordered_map<CastleProto *, vector<RoseVertex> > rose_castles;
-    ue2::unordered_map<CastleProto *, vector<RoseVertex> > suffix_castles;
+    unordered_map<CastleProto *, vector<RoseVertex>> rose_castles;
+    unordered_map<CastleProto *, vector<RoseVertex>> suffix_castles;
 
     RoseGraph &g = tbi.g;
     for (auto v : vertices_range(g)) {
index 96241e39d1a747d929948168138182924d4c4d39..e24d0b2ef76fcf704b72dc091a378617bf13fd03 100644 (file)
 #include "util/compile_context.h"
 #include "util/container.h"
 #include "util/dump_charclass.h"
+#include "util/flat_containers.h"
 #include "util/graph_range.h"
 #include "util/order_check.h"
 #include "util/report_manager.h"
-#include "util/ue2_containers.h"
 #include "util/ue2string.h"
 #include "util/verify_types.h"
 
@@ -1639,7 +1639,7 @@ static
 bool danglingVertexRef(RoseBuildImpl &tbi) {
     RoseGraph::vertex_iterator vi, ve;
     tie(vi, ve) = vertices(tbi.g);
-    const ue2::unordered_set<RoseVertex> valid_vertices(vi, ve);
+    const unordered_set<RoseVertex> valid_vertices(vi, ve);
 
     if (!contains(valid_vertices, tbi.anchored_root)) {
         DEBUG_PRINTF("anchored root vertex %zu not in graph\n",
index f80e25cb191f9132592b8cb35a6f4741226e29cc..33351099f70c84abea196108b274e1820a568386 100644 (file)
@@ -58,8 +58,9 @@
 #include <queue>
 #include <set>
 #include <string>
-#include <vector>
+#include <unordered_map>
 #include <utility>
+#include <vector>
 
 #include <boost/range/adaptor/map.hpp>
 
@@ -561,7 +562,7 @@ bool handleMixedPrefixCliche(const NGHolder &h, RoseGraph &g, RoseVertex v,
     DEBUG_PRINTF("woot?\n");
 
     shared_ptr<NGHolder> h_new = make_shared<NGHolder>();
-    ue2::unordered_map<NFAVertex, NFAVertex> rhs_map;
+    unordered_map<NFAVertex, NFAVertex> rhs_map;
     vector<NFAVertex> exits_vec;
     insert(&exits_vec, exits_vec.end(), exits);
     splitRHS(h, exits_vec, h_new.get(), &rhs_map);
index 3aa501b477b29ef2483833509552e30232d7471f..da4e355de2073e0385456b6aca11e80e08727f2a 100644 (file)
 #include "util/bytecode_ptr.h"
 #include "util/charreach.h"
 #include "util/container.h"
+#include "util/hash.h"
 #include "util/multibit_build.h"
 #include "util/noncopyable.h"
-#include "util/ue2_containers.h"
 #include "util/verify_types.h"
+#include "util/unordered.h"
 
-#include <vector>
 #include <type_traits>
+#include <vector>
 
 namespace ue2 {
 
@@ -56,9 +57,10 @@ struct lookaround_info : noncopyable {
     u32 get_offset_of(const std::vector<s8> &look, RoseEngineBlob &blob);
 
 private:
-    unordered_map<std::vector<std::vector<CharReach>>, u32> multi_cache;
-    unordered_map<std::vector<s8>, u32> lcache;
-    unordered_map<std::vector<CharReach>, u32> rcache;
+    using Path = std::vector<CharReach>;
+    ue2_unordered_map<std::vector<Path>, u32> multi_cache;
+    ue2_unordered_map<std::vector<s8>, u32> lcache;
+    ue2_unordered_map<Path, u32> rcache;
 };
 
 class RoseEngineBlob : noncopyable {
@@ -160,7 +162,7 @@ private:
     }
 
     /** \brief Cache of previously-written sparse iterators. */
-    unordered_map<std::vector<mmbit_sparse_iter>, u32> cached_iters;
+    ue2_unordered_map<std::vector<mmbit_sparse_iter>, u32> cached_iters;
 
     /**
      * \brief Contents of the Rose bytecode immediately following the
index e91cc297107df3744a0056a34b05d6980a8ec662..25585ec049e6c573531ea560304619d2814f0945 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Intel Corporation
+ * Copyright (c) 2016-2017, Intel Corporation
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -87,7 +87,7 @@ vector<RoleChunk<role_id>> divideIntoChunks(const RoseBuildImpl &build,
 
 /* add prefix literals to engine graph */
 static
-bool addPrefixLiterals(NGHolder &h, ue2::unordered_set<u32> &tailId,
+bool addPrefixLiterals(NGHolder &h, unordered_set<u32> &tailId,
                        const vector<vector<CharReach>> &triggers) {
     DEBUG_PRINTF("add literals to graph\n");
 
@@ -196,8 +196,8 @@ vector<CharReach> findStartPos(const CharReach &cr1,
 template<typename role_id>
 static
 bool isExclusive(const NGHolder &h,
-                 const u32 num, ue2::unordered_set<u32> &tailId,
-                 map<u32, ue2::unordered_set<u32>> &skipList,
+                 const u32 num, unordered_set<u32> &tailId,
+                 map<u32, unordered_set<u32>> &skipList,
                  const RoleInfo<role_id> &role1,
                  const RoleInfo<role_id> &role2) {
     const u32 id1 = role1.id;
@@ -253,12 +253,12 @@ bool isExclusive(const NGHolder &h,
 
 template<typename role_id>
 static
-ue2::unordered_set<u32> checkExclusivity(const NGHolder &h,
-                            const u32 num, ue2::unordered_set<u32> &tailId,
-                            map<u32, ue2::unordered_set<u32>> &skipList,
-                            const RoleInfo<role_id> &role1,
-                            const RoleChunk<role_id> &roleChunk) {
-    ue2::unordered_set<u32> info;
+unordered_set<u32> checkExclusivity(const NGHolder &h,
+                                    const u32 num, unordered_set<u32> &tailId,
+                                    map<u32, unordered_set<u32>> &skipList,
+                                    const RoleInfo<role_id> &role1,
+                                    const RoleChunk<role_id> &roleChunk) {
+    unordered_set<u32> info;
     const u32 id1 = role1.id;
     for (const auto &role2 : roleChunk.roles) {
         const u32 id2 = role2.id;
@@ -316,7 +316,7 @@ void findCliques(const map<u32, set<u32>> &exclusiveGroups,
 
 static
 map<u32, set<u32>> findExclusiveGroups(const RoseBuildImpl &build,
-            const map<u32, ue2::unordered_set<u32>> &exclusiveInfo,
+            const map<u32, unordered_set<u32>> &exclusiveInfo,
             const map<u32, vector<RoseVertex>> &vertex_map,
             const bool is_infix) {
     map<u32, set<u32>> exclusiveGroups;
@@ -396,10 +396,10 @@ void exclusiveAnalysis(const RoseBuildImpl &build,
                vector<vector<u32>> &exclusive_roles, const bool is_infix) {
     const auto &chunks = divideIntoChunks(build, roleInfoSet);
     DEBUG_PRINTF("Exclusivity analysis entry\n");
-    map<u32, ue2::unordered_set<u32>> exclusiveInfo;
+    map<u32, unordered_set<u32>> exclusiveInfo;
 
     for (const auto &roleChunk : chunks) {
-        map<u32, ue2::unordered_set<u32>> skipList;
+        map<u32, unordered_set<u32>> skipList;
         for (const auto &role1 : roleChunk.roles) {
             const u32 id1 = role1.id;
             const role_id &s1 = role1.role;
index 3ab5eb786552ffff5be82cfbd74e188ec2798c59..ada64b809fefa953d95e922e33b9f5ec601f0934 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Intel Corporation
+ * Copyright (c) 2016-2017, Intel Corporation
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
 #define ROSE_BUILD_GROUPS_H
 
 #include "rose_build_impl.h"
-#include "util/ue2_containers.h"
+
+#include <unordered_map>
 
 namespace ue2 {
 
-unordered_map<RoseVertex, rose_group>
+std::unordered_map<RoseVertex, rose_group>
 getVertexGroupMap(const RoseBuildImpl &build);
 
 rose_group getSquashableGroups(const RoseBuildImpl &build);
index 13f1cfc9c655895f10aaa459cb6fca5857dc7f66..42ae054a38af30c219cb14462130ff215b09563e 100644 (file)
 #include "nfagraph/ng_holder.h"
 #include "nfagraph/ng_revacc.h"
 #include "util/bytecode_ptr.h"
+#include "util/flat_containers.h"
 #include "util/hash.h"
 #include "util/order_check.h"
 #include "util/queue_index_factory.h"
-#include "util/ue2_containers.h"
 #include "util/ue2string.h"
+#include "util/unordered.h"
 #include "util/verify_types.h"
 
 #include <deque>
@@ -177,7 +178,6 @@ depth findMinWidth(const suffix_id &s);
 depth findMaxWidth(const suffix_id &s);
 depth findMinWidth(const suffix_id &s, u32 top);
 depth findMaxWidth(const suffix_id &s, u32 top);
-size_t hash_value(const suffix_id &s);
 
 /** \brief represents an engine to the left of a rose role */
 struct left_id {
@@ -258,11 +258,10 @@ bool isAnchored(const left_id &r);
 depth findMinWidth(const left_id &r);
 depth findMaxWidth(const left_id &r);
 u32 num_tops(const left_id &r);
-size_t hash_value(const left_id &r);
 
 struct rose_literal_info {
-    ue2::flat_set<u32> delayed_ids;
-    ue2::flat_set<RoseVertex> vertices;
+    flat_set<u32> delayed_ids;
+    flat_set<RoseVertex> vertices;
     rose_group group_mask = 0;
     u32 undelayed_id = MO_INVALID_IDX;
     bool squash_group = false;
@@ -306,6 +305,10 @@ struct rose_literal_id {
         return s == b.s && msk == b.msk && cmp == b.cmp && table == b.table &&
                delay == b.delay && distinctiveness == b.distinctiveness;
     }
+
+    size_t hash() const {
+        return hash_all(s, msk, cmp, table, delay, distinctiveness);
+    }
 };
 
 static inline
@@ -319,12 +322,6 @@ bool operator<(const rose_literal_id &a, const rose_literal_id &b) {
     return 0;
 }
 
-inline
-size_t hash_value(const rose_literal_id &lit) {
-    return hash_all(lit.s, lit.msk, lit.cmp, lit.table, lit.delay,
-                    lit.distinctiveness);
-}
-
 class RoseLiteralMap {
     /**
      * \brief Main storage for literals.
@@ -336,7 +333,7 @@ class RoseLiteralMap {
     std::deque<rose_literal_id> lits;
 
     /** \brief Quick-lookup index from literal -> index in lits. */
-    unordered_map<rose_literal_id, u32> lits_index;
+    ue2_unordered_map<rose_literal_id, u32> lits_index;
 
 public:
     std::pair<u32, bool> insert(const rose_literal_id &lit) {
@@ -504,7 +501,7 @@ public:
 
     // Adds a single literal.
     void add(bool anchored, bool eod, const ue2_literal &lit,
-             const ue2::flat_set<ReportID> &ids) override;
+             const flat_set<ReportID> &ids) override;
 
     bool addRose(const RoseInGraph &ig, bool prefilter) override;
     bool addSombeRose(const RoseInGraph &ig) override;
@@ -517,15 +514,15 @@ public:
 
     // Returns true if we were able to add it as a mask
     bool add(bool anchored, const std::vector<CharReach> &mask,
-             const ue2::flat_set<ReportID> &reports) override;
+             const flat_set<ReportID> &reports) override;
 
     bool addAnchoredAcyclic(const NGHolder &graph) override;
 
     bool validateMask(const std::vector<CharReach> &mask,
-                      const ue2::flat_set<ReportID> &reports, bool anchored,
+                      const flat_set<ReportID> &reports, bool anchored,
                       bool eod) const override;
     void addMask(const std::vector<CharReach> &mask,
-                 const ue2::flat_set<ReportID> &reports, bool anchored,
+                 const flat_set<ReportID> &reports, bool anchored,
                  bool eod) override;
 
     // Construct a runtime implementation.
@@ -627,8 +624,8 @@ public:
      * overlap calculation in history assignment. */
     std::map<u32, rose_literal_id> anchoredLitSuffix;
 
-    unordered_set<left_id> transient;
-    unordered_map<left_id, rose_group> rose_squash_masks;
+    ue2_unordered_set<left_id> transient;
+    ue2_unordered_map<left_id, rose_group> rose_squash_masks;
 
     std::vector<OutfixInfo> outfixes;
 
@@ -689,4 +686,22 @@ bool canImplementGraphs(const RoseBuildImpl &tbi);
 
 } // namespace ue2
 
+namespace std {
+
+template<>
+struct hash<ue2::left_id> {
+    size_t operator()(const ue2::left_id &l) const {
+        return l.hash();
+    }
+};
+
+template<>
+struct hash<ue2::suffix_id> {
+    size_t operator()(const ue2::suffix_id &s) const {
+        return s.hash();
+    }
+};
+
+} // namespace std
+
 #endif /* ROSE_BUILD_IMPL_H */
index 4bbb35259a6e16089296b6b23b0365019ec32099..80e12542360e0ff98e3c73c8b8b457a5b988c406 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:
 #include "rose/rose_build_impl.h"
 #include "util/container.h"
 #include "util/dump_charclass.h"
+#include "util/flat_containers.h"
 #include "util/graph_range.h"
 #include "util/graph.h"
-#include "util/ue2_containers.h"
+#include "util/hash.h"
 #include "util/ue2string.h"
+#include "util/unordered.h"
 
 #include <algorithm>
 #include <set>
@@ -51,7 +53,7 @@ namespace ue2 {
 static
 bool couldEndLiteral(const ue2_literal &s, NFAVertex initial,
                      const NGHolder &h) {
-    ue2::flat_set<NFAVertex> curr, next;
+    flat_set<NFAVertex> curr, next;
     curr.insert(initial);
 
     for (auto it = s.rbegin(), ite = s.rend(); it != ite; ++it) {
@@ -82,9 +84,10 @@ bool couldEndLiteral(const ue2_literal &s, NFAVertex initial,
     return true;
 }
 
+using EdgeCache = ue2_unordered_set<pair<NFAVertex, NFAVertex>>;
+
 static
-void contractVertex(NGHolder &g, NFAVertex v,
-                    ue2::unordered_set<pair<NFAVertex, NFAVertex>> &all_edges) {
+void contractVertex(NGHolder &g, NFAVertex v, EdgeCache &all_edges) {
     for (auto u : inv_adjacent_vertices_range(v, g)) {
         if (u == v) {
             continue; // self-edge
@@ -144,8 +147,9 @@ u32 findMaxLiteralMatches(const NGHolder &h, const set<ue2_literal> &lits) {
     cloneHolder(g, h);
     vector<NFAVertex> dead;
 
-    // The set of all edges in the graph is used for existence checks in contractVertex.
-    ue2::unordered_set<pair<NFAVertex, NFAVertex>> all_edges;
+    // The set of all edges in the graph is used for existence checks in
+    // contractVertex.
+    EdgeCache all_edges;
     for (const auto &e : edges_range(g)) {
         all_edges.emplace(source(e, g), target(e, g));
     }
index 3bc3266b45812238ff60809e8e3b1968728fb41b..d3ede29b69d534648663a79e04c0b1c389bb9c31 100644 (file)
@@ -39,6 +39,7 @@
 
 #include "rose_build_lookaround.h"
 #include "rose_build_program.h"
+#include "util/hash.h"
 #include "util/verify_types.h"
 
 namespace ue2 {
@@ -65,7 +66,7 @@ public:
     /** \brief Length of the bytecode instruction in bytes. */
     virtual size_t byte_length() const = 0;
 
-    using OffsetMap = unordered_map<const RoseInstruction *, u32>;
+    using OffsetMap = std::unordered_map<const RoseInstruction *, u32>;
 
     /**
      * \brief Writes a concrete implementation of this instruction.
@@ -149,6 +150,10 @@ private:
     }
 };
 
+template<RoseInstructionCode Opcode, class ImplType, class RoseInstrType>
+constexpr RoseInstructionCode
+    RoseInstrBase<Opcode, ImplType, RoseInstrType>::opcode;
+
 /**
  * \brief Refinement of RoseInstrBase to use for instructions that have
  * just a single target member, called "target".
@@ -190,7 +195,7 @@ public:
     virtual bool operator==(const RoseInstrType &) const { return true; }
 
     size_t hash() const override {
-        return boost::hash_value(static_cast<int>(Opcode));
+        return hash_all(Opcode);
     }
 
     bool equiv_to(const RoseInstrType &, const RoseInstruction::OffsetMap &,
@@ -222,7 +227,7 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), groups, anch_id);
+        return hash_all(opcode, groups, anch_id);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -251,7 +256,7 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), min_offset);
+        return hash_all(opcode, min_offset);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -278,7 +283,7 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), groups);
+        return hash_all(opcode, groups);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -305,7 +310,7 @@ public:
     }
 
     size_t hash() const override {
-        return boost::hash_value(static_cast<int>(opcode));
+        return hash_all(opcode);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -335,7 +340,7 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), min_bound, max_bound);
+        return hash_all(opcode, min_bound, max_bound);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -364,7 +369,7 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), key);
+        return hash_all(opcode, key);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -395,7 +400,7 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), offset, reach);
+        return hash_all(opcode, offset, reach);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -426,7 +431,7 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), look);
+        return hash_all(opcode, look);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -462,8 +467,7 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), and_mask, cmp_mask, neg_mask,
-                        offset);
+        return hash_all(opcode, and_mask, cmp_mask, neg_mask, offset);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -501,8 +505,7 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), and_mask, cmp_mask, neg_mask,
-                        offset);
+        return hash_all(opcode, and_mask, cmp_mask, neg_mask, offset);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -539,8 +542,7 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), and_mask, cmp_mask, negation,
-                        offset);
+        return hash_all(opcode, and_mask, cmp_mask, negation, offset);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -581,8 +583,7 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), nib_mask,
-                        bucket_select_mask, neg_mask, offset);
+        return hash_all(opcode, nib_mask, bucket_select_mask, neg_mask, offset);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -626,8 +627,8 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), hi_mask, lo_mask,
-                        bucket_select_mask, neg_mask, offset);
+        return hash_all(opcode, hi_mask, lo_mask, bucket_select_mask, neg_mask,
+                        offset);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -671,8 +672,8 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), hi_mask, lo_mask,
-                        bucket_select_mask, neg_mask, offset);
+        return hash_all(opcode, hi_mask, lo_mask, bucket_select_mask, neg_mask,
+                        offset);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -720,9 +721,8 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), hi_mask, lo_mask,
-                        bucket_select_mask_hi, bucket_select_mask_lo,
-                        neg_mask, offset);
+        return hash_all(opcode, hi_mask, lo_mask, bucket_select_mask_hi,
+                        bucket_select_mask_lo, neg_mask, offset);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -758,7 +758,7 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), queue, lag, report);
+        return hash_all(opcode, queue, lag, report);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -791,7 +791,7 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), queue, lag, report);
+        return hash_all(opcode, queue, lag, report);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -820,7 +820,7 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), delay, index);
+        return hash_all(opcode, delay, index);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -861,7 +861,7 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), distance);
+        return hash_all(opcode, distance);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -889,7 +889,7 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), queue, lag);
+        return hash_all(opcode, queue, lag);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -917,7 +917,7 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), som.type, som.onmatch);
+        return hash_all(opcode, som.type, som.onmatch);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -953,7 +953,7 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), cancel, queue, event);
+        return hash_all(opcode, cancel, queue, event);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -981,7 +981,7 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), queue, event);
+        return hash_all(opcode, queue, event);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -1013,8 +1013,7 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), quash_som, dkey,
-                        offset_adjust);
+        return hash_all(opcode, quash_som, dkey, offset_adjust);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -1049,8 +1048,7 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), quash_som, dkey,
-                        offset_adjust);
+        return hash_all(opcode, quash_som, dkey, offset_adjust);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -1081,7 +1079,7 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), event, top_squash_distance);
+        return hash_all(opcode, event, top_squash_distance);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -1110,7 +1108,7 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), som.type, som.onmatch);
+        return hash_all(opcode, som.type, som.onmatch);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -1138,7 +1136,7 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), som.type, som.onmatch);
+        return hash_all(opcode, som.type, som.onmatch);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -1165,7 +1163,7 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), onmatch, offset_adjust);
+        return hash_all(opcode, onmatch, offset_adjust);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -1196,7 +1194,7 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), onmatch, offset_adjust, ekey);
+        return hash_all(opcode, onmatch, offset_adjust, ekey);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -1225,7 +1223,7 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), onmatch, offset_adjust);
+        return hash_all(opcode, onmatch, offset_adjust);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -1256,7 +1254,7 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), onmatch, offset_adjust, ekey);
+        return hash_all(opcode, onmatch, offset_adjust, ekey);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -1293,8 +1291,7 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), quash_som, dkey, onmatch,
-                        offset_adjust);
+        return hash_all(opcode, quash_som, dkey, onmatch, offset_adjust);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -1324,7 +1321,7 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), onmatch, offset_adjust);
+        return hash_all(opcode, onmatch, offset_adjust);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -1352,7 +1349,7 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), ekey);
+        return hash_all(opcode, ekey);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -1384,7 +1381,7 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), end_adj, min_length);
+        return hash_all(opcode, end_adj, min_length);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -1410,7 +1407,7 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), index);
+        return hash_all(opcode, index);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -1436,7 +1433,7 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), groups);
+        return hash_all(opcode, groups);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -1462,7 +1459,7 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), groups);
+        return hash_all(opcode, groups);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -1490,7 +1487,7 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), index);
+        return hash_all(opcode, index);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -1522,9 +1519,9 @@ public:
     }
 
     size_t hash() const override {
-        size_t v = hash_all(static_cast<int>(opcode), num_keys);
+        size_t v = hash_all(opcode, num_keys);
         for (const u32 &key : jump_table | boost::adaptors::map_keys) {
-            boost::hash_combine(v, key);
+            hash_combine(v, key);
         }
         return v;
     }
@@ -1594,7 +1591,7 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), state);
+        return hash_all(opcode, state);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -1638,7 +1635,7 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), num_keys, keys);
+        return hash_all(opcode, num_keys, keys);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -1665,7 +1662,7 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), iter_offset);
+        return hash_all(opcode, iter_offset);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -1709,7 +1706,7 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), literal);
+        return hash_all(opcode, literal);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -1741,7 +1738,7 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), literal);
+        return hash_all(opcode, literal);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -1772,7 +1769,7 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), literal);
+        return hash_all(opcode, literal);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -1804,7 +1801,7 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), literal);
+        return hash_all(opcode, literal);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -1849,8 +1846,7 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), multi_look, last_start,
-                        start_mask);
+        return hash_all(opcode, multi_look, last_start, start_mask);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -1905,9 +1901,9 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), nib_mask,
-                        bucket_select_mask, data_select_mask, hi_bits_mask,
-                        lo_bits_mask, neg_mask, base_offset, last_start);
+        return hash_all(opcode, nib_mask, bucket_select_mask, data_select_mask,
+                        hi_bits_mask, lo_bits_mask, neg_mask, base_offset,
+                        last_start);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -1968,9 +1964,9 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), hi_mask, lo_mask,
-                        bucket_select_mask, data_select_mask, hi_bits_mask,
-                        lo_bits_mask, neg_mask, base_offset, last_start);
+        return hash_all(opcode, hi_mask, lo_mask, bucket_select_mask,
+                        data_select_mask, hi_bits_mask, lo_bits_mask, neg_mask,
+                        base_offset, last_start);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -2035,10 +2031,9 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), hi_mask, lo_mask,
-                        bucket_select_mask_hi, bucket_select_mask_lo,
-                        data_select_mask, hi_bits_mask, lo_bits_mask, neg_mask,
-                        base_offset, last_start);
+        return hash_all(opcode, hi_mask, lo_mask, bucket_select_mask_hi,
+                        bucket_select_mask_lo, data_select_mask, hi_bits_mask,
+                        lo_bits_mask, neg_mask, base_offset, last_start);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
@@ -2100,9 +2095,9 @@ public:
     }
 
     size_t hash() const override {
-        return hash_all(static_cast<int>(opcode), hi_mask, lo_mask,
-                        bucket_select_mask, data_select_mask, hi_bits_mask,
-                        lo_bits_mask, neg_mask, base_offset, last_start);
+        return hash_all(opcode, hi_mask, lo_mask, bucket_select_mask,
+                        data_select_mask, hi_bits_mask, lo_bits_mask, neg_mask,
+                        base_offset, last_start);
     }
 
     void write(void *dest, RoseEngineBlob &blob,
index a46a1aeb6ca129be6f09445f5d33cf9fed6f9f9e..dd495fd31bef7d79b3381625e5a440a40412bfba 100644 (file)
@@ -40,7 +40,7 @@
 #include "util/container.h"
 #include "util/dump_charclass.h"
 #include "util/graph_range.h"
-#include "util/ue2_containers.h"
+#include "util/flat_containers.h"
 #include "util/verify_types.h"
 
 #include <cstdlib>
@@ -79,7 +79,7 @@ string dump(const map<s32, CharReach> &look) {
 
 static
 void getForwardReach(const NGHolder &g, u32 top, map<s32, CharReach> &look) {
-    ue2::flat_set<NFAVertex> curr, next;
+    flat_set<NFAVertex> curr, next;
 
     // Consider only successors of start with the required top.
     for (const auto &e : out_edges_range(g.start, g)) {
@@ -116,7 +116,7 @@ void getForwardReach(const NGHolder &g, u32 top, map<s32, CharReach> &look) {
 static
 void getBackwardReach(const NGHolder &g, ReportID report, u32 lag,
                       map<s32, CharReach> &look) {
-    ue2::flat_set<NFAVertex> curr, next;
+    flat_set<NFAVertex> curr, next;
 
     for (auto v : inv_adjacent_vertices_range(g.accept, g)) {
         if (contains(g[v].reports, report)) {
@@ -187,7 +187,7 @@ void getForwardReach(const raw_dfa &rdfa, map<s32, CharReach> &look) {
         return;
     }
 
-    ue2::flat_set<dstate_id_t> curr, next;
+    flat_set<dstate_id_t> curr, next;
     curr.insert(rdfa.start_anchored);
 
     for (u32 i = 0; i < MAX_FWD_LEN && !curr.empty(); i++) {
@@ -849,7 +849,7 @@ void mergeLookaround(vector<LookEntry> &lookaround,
     }
 
     // Don't merge lookarounds at offsets we already have entries for.
-    ue2::flat_set<s8> offsets;
+    flat_set<s8> offsets;
     for (const auto &e : lookaround) {
         offsets.insert(e.offset);
     }
index aea87ccf860c0f4b4e1d2c1e59ffec7346d83164..70d4217ccc172affb6b66641de8402fa7226654d 100644 (file)
@@ -33,6 +33,7 @@
 #define ROSE_ROSE_BUILD_LOOKAROUND_H
 
 #include "rose_graph.h"
+#include "util/hash.h"
 
 #include <vector>
 
@@ -58,14 +59,6 @@ struct LookEntry {
     }
 };
 
-static inline
-size_t hash_value(const LookEntry &l) {
-    size_t val = 0;
-    boost::hash_combine(val, l.offset);
-    boost::hash_combine(val, l.reach);
-    return val;
-}
-
 void findLookaroundMasks(const RoseBuildImpl &tbi, const RoseVertex v,
                          std::vector<LookEntry> &look_more);
 
@@ -83,4 +76,15 @@ void mergeLookaround(std::vector<LookEntry> &lookaround,
 
 } // namespace ue2
 
+namespace std {
+
+template<>
+struct hash<ue2::LookEntry> {
+    size_t operator()(const ue2::LookEntry &l) const {
+        return ue2::hash_all(l.offset, l.reach);
+    }
+};
+
+} // namespace std
+
 #endif // ROSE_ROSE_BUILD_LOOKAROUND_H
index d638e589e74384e9f70b8ce54c2d4e85df68c24c..15a1ae785ef2f128a0b7fe23dc027046fa6ec9b5 100644 (file)
 #include "util/container.h"
 #include "util/dump_charclass.h"
 #include "util/graph_range.h"
+#include "util/hash.h"
 #include "util/order_check.h"
 #include "util/report_manager.h"
 #include "util/ue2string.h"
+#include "util/unordered.h"
 
 #include <algorithm>
 #include <functional>
 #include <vector>
 #include <utility>
 
-#include <boost/functional/hash/hash_fwd.hpp>
 #include <boost/range/adaptor/map.hpp>
 
 using namespace std;
 using boost::adaptors::map_values;
-using boost::hash_combine;
 
 namespace ue2 {
 
@@ -336,7 +336,7 @@ void findUncalcLeavesCandidates(RoseBuildImpl &tbi,
     const RoseGraph &g = tbi.g;
 
     vector<RoseVertex> suffix_vertices; // vertices with suffix graphs
-    ue2::unordered_map<const NGHolder *, u32> fcount; // ref count per graph
+    unordered_map<const NGHolder *, u32> fcount; // ref count per graph
 
     for (auto v : vertices_range(g)) {
         if (g[v].suffix) {
@@ -566,7 +566,7 @@ bool dedupeLeftfixes(RoseBuildImpl &tbi) {
     for (deque<RoseVertex> &verts : roses | map_values) {
         DEBUG_PRINTF("group has %zu vertices\n", verts.size());
 
-        ue2::unordered_set<left_id> seen;
+        unordered_set<left_id> seen;
 
         for (auto jt = verts.begin(), jte = verts.end(); jt != jte; ++jt) {
             RoseVertex v = *jt;
@@ -636,7 +636,7 @@ bool is_equal(const suffix_id &s1, const suffix_id &s2) {
 void dedupeSuffixes(RoseBuildImpl &tbi) {
     DEBUG_PRINTF("deduping suffixes\n");
 
-    ue2::unordered_map<suffix_id, set<RoseVertex>> suffix_map;
+    unordered_map<suffix_id, set<RoseVertex>> suffix_map;
     map<pair<size_t, set<ReportID>>, vector<suffix_id>> part;
 
     // Collect suffixes into groups.
@@ -703,7 +703,7 @@ template<class EngineRef>
 class Bouquet {
 private:
     list<EngineRef> ordering; // Unique list in insert order.
-    typedef ue2::unordered_map<EngineRef, deque<RoseVertex> > BouquetMap;
+    using BouquetMap = ue2_unordered_map<EngineRef, deque<RoseVertex>>;
     BouquetMap bouquet;
 public:
     void insert(const EngineRef &h, RoseVertex v) {
@@ -1331,7 +1331,7 @@ bool mergeRosePair(RoseBuildImpl &tbi, left_id &r1, left_id &r2,
 static
 void processMergeQueue(RoseBuildImpl &tbi, RoseBouquet &roses,
                        priority_queue<RoseMergeCandidate> &pq) {
-    ue2::unordered_set<left_id> dead;
+    unordered_set<left_id> dead;
 
     DEBUG_PRINTF("merge queue has %zu entries\n", pq.size());
 
@@ -1862,7 +1862,7 @@ void mergeNfaLeftfixes(RoseBuildImpl &tbi, RoseBouquet &roses) {
 
     // We track the number of accelerable states for each graph in a map and
     // only recompute them when the graph is modified.
-    ue2::unordered_map<left_id, u32> accel_count;
+    unordered_map<left_id, u32> accel_count;
     for (const auto &rose : roses) {
         assert(rose.graph()->kind == NFA_INFIX);
         accel_count[rose] = estimatedAccelStates(tbi, *rose.graph());
@@ -2157,7 +2157,7 @@ void mergeSuffixes(RoseBuildImpl &tbi, SuffixBouquet &suffixes,
     // If this isn't an acyclic case, we track the number of accelerable states
     // for each graph in a map and only recompute them when the graph is
     // modified.
-    ue2::unordered_map<suffix_id, u32> accel_count;
+    unordered_map<suffix_id, u32> accel_count;
     if (!acyclic) {
         for (const auto &suffix : suffixes) {
             assert(suffix.graph() && suffix.graph()->kind == NFA_SUFFIX);
@@ -2499,7 +2499,7 @@ private:
 template<class RawDfa, class MergeFunctor>
 static
 void pairwiseDfaMerge(vector<RawDfa *> &dfas,
-                      ue2::unordered_map<RawDfa *, size_t> &dfa_mapping,
+                      unordered_map<RawDfa *, size_t> &dfa_mapping,
                       vector<OutfixInfo> &outfixes,
                       MergeFunctor merge_func) {
     DEBUG_PRINTF("merging group of size %zu\n", dfas.size());
@@ -2541,7 +2541,7 @@ void pairwiseDfaMerge(vector<RawDfa *> &dfas,
 template<class RawDfa, class MergeFunctor>
 static
 void chunkedDfaMerge(vector<RawDfa *> &dfas,
-                     ue2::unordered_map<RawDfa *, size_t> &dfa_mapping,
+                     unordered_map<RawDfa *, size_t> &dfa_mapping,
                      vector<OutfixInfo> &outfixes,
                      MergeFunctor merge_func) {
     DEBUG_PRINTF("begin merge of %zu dfas\n", dfas.size());
@@ -2575,7 +2575,7 @@ void mergeOutfixDfas(RoseBuildImpl &tbi, vector<raw_dfa *> &dfas) {
 
     /* key is index into outfix array as iterators, etc may be invalidated by
      * element addition. */
-    ue2::unordered_map<raw_dfa *, size_t> dfa_mapping;
+    unordered_map<raw_dfa *, size_t> dfa_mapping;
     for (size_t i = 0; i < outfixes.size(); i++) {
         auto *rdfa = outfixes[i].rdfa();
         if (rdfa) {
@@ -2619,7 +2619,7 @@ void mergeOutfixCombo(RoseBuildImpl &tbi, const ReportManager &rm,
     /* key is index into outfix array as iterators, etc may be invalidated by
      * element addition. */
     size_t new_dfas = 0;
-    ue2::unordered_map<raw_dfa *, size_t> dfa_mapping;
+    unordered_map<raw_dfa *, size_t> dfa_mapping;
     vector<raw_dfa *> dfas;
 
     for (auto it = tbi.outfixes.begin(); it != tbi.outfixes.end(); ++it) {
@@ -2670,7 +2670,7 @@ void mergeOutfixHaigs(RoseBuildImpl &tbi, vector<raw_som_dfa *> &dfas,
 
     vector<OutfixInfo> &outfixes = tbi.outfixes;
 
-    ue2::unordered_map<raw_som_dfa *, size_t> dfa_mapping;
+    unordered_map<raw_som_dfa *, size_t> dfa_mapping;
     for (size_t i = 0; i < outfixes.size(); i++) {
         auto *haig = outfixes[i].haig();
         if (haig) {
index 01be11ef8a4cfc60a7d87801fcc4faf39954230a..839fd47846f001e07d69c5c5e00d8561cf5ffcbc 100644 (file)
 #include "ue2common.h"
 #include "grey.h"
 
-#include <boost/functional/hash/hash_fwd.hpp>
 #include <boost/graph/breadth_first_search.hpp>
 
 using namespace std;
-using boost::hash_combine;
 
 namespace ue2 {
 
@@ -691,16 +689,7 @@ set<u32> all_tops(const suffix_id &s) {
 }
 
 size_t suffix_id::hash() const {
-    size_t val = 0;
-    hash_combine(val, g);
-    hash_combine(val, c);
-    hash_combine(val, d);
-    hash_combine(val, h);
-    return val;
-}
-
-size_t hash_value(const suffix_id &s) {
-    return s.hash();
+    return hash_all(g, c, d, h);
 }
 
 bool isAnchored(const left_id &r) {
@@ -761,16 +750,7 @@ u32 num_tops(const left_id &r) {
 }
 
 size_t left_id::hash() const {
-    size_t val = 0;
-    hash_combine(val, g);
-    hash_combine(val, c);
-    hash_combine(val, d);
-    hash_combine(val, h);
-    return val;
-}
-
-size_t hash_value(const left_id &r) {
-    return r.hash();
+    return hash_all(g, c, d, h);
 }
 
 u64a findMaxOffset(const set<ReportID> &reports, const ReportManager &rm) {
@@ -997,8 +977,8 @@ bool canImplementGraphs(const RoseBuildImpl &tbi) {
 bool hasOrphanedTops(const RoseBuildImpl &build) {
     const RoseGraph &g = build.g;
 
-    ue2::unordered_map<left_id, set<u32> > roses;
-    ue2::unordered_map<suffix_id, set<u32> > suffixes;
+    unordered_map<left_id, set<u32>> roses;
+    unordered_map<suffix_id, set<u32>> suffixes;
 
     for (auto v : vertices_range(g)) {
         if (g[v].left) {
index 01bd7c546bc6793b7d6c4af1d21a1a3039c82907..8f350e2952ddf1c0b8323b89fbd0d8438d7be9b8 100644 (file)
@@ -41,6 +41,7 @@
 #include "util/compile_context.h"
 #include "util/compile_error.h"
 #include "util/report_manager.h"
+#include "util/unordered.h"
 #include "util/verify_types.h"
 
 #include <boost/range/adaptor/map.hpp>
@@ -226,7 +227,7 @@ size_t RoseProgramHash::operator()(const RoseProgram &program) const {
     size_t v = 0;
     for (const auto &ri : program) {
         assert(ri);
-        boost::hash_combine(v, ri->hash());
+        hash_combine(v, ri->hash());
     }
     return v;
 }
@@ -1934,14 +1935,14 @@ void makeGroupSquashInstruction(const RoseBuildImpl &build, u32 lit_id,
 
 namespace {
 struct ProgKey {
-    ProgKey(const RoseProgram &p) : prog(&p) { }
+    ProgKey(const RoseProgram &p) : prog(&p) {}
 
     bool operator==(const ProgKey &b) const {
         return RoseProgramEquivalence()(*prog, *b.prog);
     }
 
-    friend size_t hash_value(const ProgKey &a) {
-        return RoseProgramHash()(*a.prog);
+    size_t hash() const {
+        return RoseProgramHash()(*prog);
     }
 private:
     const RoseProgram *prog;
@@ -1954,7 +1955,7 @@ RoseProgram assembleProgramBlocks(vector<RoseProgram> &&blocks_in) {
     vector<RoseProgram> blocks;
     blocks.reserve(blocks_in.size()); /* to ensure stable reference for seen */
 
-    unordered_set<ProgKey> seen;
+    ue2_unordered_set<ProgKey> seen;
     for (auto &block : blocks_in) {
         if (contains(seen, block)) {
             continue;
index afbaa36e551f262a01ef4e990f0b19ec1cb53627..cc59303f2d77da708777bfe3acc1bf525128eadd 100644 (file)
@@ -34,8 +34,8 @@
 #include "util/bytecode_ptr.h"
 #include "util/hash.h"
 #include "util/make_unique.h"
-#include "util/ue2_containers.h"
 
+#include <unordered_map>
 #include <vector>
 
 #include <boost/range/adaptor/map.hpp>
@@ -168,7 +168,7 @@ struct ProgramBuild : noncopyable {
 
     /** \brief Mapping from vertex to key, for vertices with a
      * CHECK_NOT_HANDLED instruction. */
-    ue2::unordered_map<RoseVertex, u32> handledKeys;
+    std::unordered_map<RoseVertex, u32> handledKeys;
 
     /** \brief Mapping from Rose literal ID to anchored program index. */
     std::map<u32, u32> anchored_programs;
@@ -178,7 +178,7 @@ struct ProgramBuild : noncopyable {
 
     /** \brief Mapping from every vertex to the groups that must be on for that
      * vertex to be reached. */
-    ue2::unordered_map<RoseVertex, rose_group> vertex_group_map;
+    std::unordered_map<RoseVertex, rose_group> vertex_group_map;
 
     /** \brief Global bitmap of groups that can be squashed. */
     rose_group squashable_groups = 0;
@@ -239,13 +239,13 @@ struct engine_info {
 RoseProgram assembleProgramBlocks(std::vector<RoseProgram> &&blocks);
 
 RoseProgram makeLiteralProgram(const RoseBuildImpl &build,
-                      const std::map<RoseVertex, left_build_info> &leftfix_info,
-                      const std::map<suffix_id, u32> &suffixes,
-                      const std::map<u32, engine_info> &engine_info_by_queue,
-                      const unordered_map<RoseVertex, u32> &roleStateIndices,
-                      ProgramBuild &prog_build, u32 lit_id,
-                      const std::vector<RoseEdge> &lit_edges,
-                      bool is_anchored_replay_program);
+                    const std::map<RoseVertex, left_build_info> &leftfix_info,
+                    const std::map<suffix_id, u32> &suffixes,
+                    const std::map<u32, engine_info> &engine_info_by_queue,
+                    const std::unordered_map<RoseVertex, u32> &roleStateIndices,
+                    ProgramBuild &prog_build, u32 lit_id,
+                    const std::vector<RoseEdge> &lit_edges,
+                    bool is_anchored_replay_program);
 
 RoseProgram makeDelayRebuildProgram(const RoseBuildImpl &build,
                                     ProgramBuild &prog_build,
index 0e78ec7db43c69a5a5f364d1563a1a0d75a1ca81..b5e69ef9465b0eff83a68ba7eac2fffd044d9421 100644 (file)
 #include "util/bitutils.h"
 #include "util/compile_context.h"
 #include "util/container.h"
+#include "util/flat_containers.h"
 #include "util/graph.h"
 #include "util/graph_range.h"
 #include "util/hash.h"
 #include "util/order_check.h"
-#include "util/ue2_containers.h"
 
 #include <algorithm>
 #include <numeric>
 #include <vector>
-#include <boost/functional/hash/hash.hpp>
 #include <boost/graph/adjacency_iterator.hpp>
 #include <boost/range/adaptor/map.hpp>
 
@@ -154,7 +153,7 @@ public:
 private:
     /* if a vertex is worth storing, it is worth storing twice */
     set<RoseVertex> main_cont; /* deterministic iterator */
-    ue2::unordered_set<RoseVertex> hash_cont; /* member checks */
+    unordered_set<RoseVertex> hash_cont; /* member checks */
 };
 
 struct RoseAliasingInfo {
@@ -175,10 +174,10 @@ struct RoseAliasingInfo {
     }
 
     /** \brief Mapping from leftfix to vertices. */
-    ue2::unordered_map<left_id, set<RoseVertex>> rev_leftfix;
+    unordered_map<left_id, set<RoseVertex>> rev_leftfix;
 
     /** \brief Mapping from undelayed ghost to delayed vertices. */
-    ue2::unordered_map<RoseVertex, set<RoseVertex>> rev_ghost;
+    unordered_map<RoseVertex, set<RoseVertex>> rev_ghost;
 };
 
 } // namespace
@@ -787,7 +786,7 @@ void updateEdgeTops(RoseGraph &g, RoseVertex v, const map<u32, u32> &top_map) {
 static
 void pruneUnusedTops(CastleProto &castle, const RoseGraph &g,
                      const set<RoseVertex> &verts) {
-    ue2::unordered_set<u32> used_tops;
+    unordered_set<u32> used_tops;
     for (auto v : verts) {
         assert(g[v].left.castle.get() == &castle);
 
@@ -818,7 +817,7 @@ void pruneUnusedTops(NGHolder &h, const RoseGraph &g,
     }
     assert(isCorrectlyTopped(h));
     DEBUG_PRINTF("pruning unused tops\n");
-    ue2::flat_set<u32> used_tops;
+    flat_set<u32> used_tops;
     for (auto v : verts) {
         assert(g[v].left.graph.get() == &h);
 
@@ -1415,7 +1414,7 @@ void removeSingletonBuckets(vector<vector<RoseVertex>> &buckets) {
 
 static
 void buildInvBucketMap(const vector<vector<RoseVertex>> &buckets,
-                       ue2::unordered_map<RoseVertex, size_t> &inv) {
+                       unordered_map<RoseVertex, size_t> &inv) {
     inv.clear();
     for (size_t i = 0; i < buckets.size(); i++) {
         for (auto v : buckets[i]) {
@@ -1469,7 +1468,7 @@ void splitByReportSuffixBehaviour(const RoseGraph &g,
                                   vector<vector<RoseVertex>> &buckets) {
     // Split by report set and suffix info.
     auto make_split_key = [&g](RoseVertex v) {
-        return hash_all(g[v].reports, g[v].suffix);
+        return hash_all(g[v].reports, suffix_id(g[v].suffix));
     };
     splitAndFilterBuckets(buckets, make_split_key);
 }
@@ -1483,14 +1482,15 @@ void splitByLiteralTable(const RoseBuildImpl &build,
     auto make_split_key = [&](RoseVertex v) {
         const auto &lits = g[v].literals;
         assert(!lits.empty());
-        return build.literals.at(*lits.begin()).table;
+        auto table = build.literals.at(*lits.begin()).table;
+        return std::underlying_type<decltype(table)>::type(table);
     };
     splitAndFilterBuckets(buckets, make_split_key);
 }
 
 static
 void splitByNeighbour(const RoseGraph &g, vector<vector<RoseVertex>> &buckets,
-                      ue2::unordered_map<RoseVertex, size_t> &inv, bool succ) {
+                      unordered_map<RoseVertex, size_t> &inv, bool succ) {
     vector<vector<RoseVertex>> extras;
     map<size_t, vector<RoseVertex>> neighbours_by_bucket;
     set<RoseVertex> picked;
@@ -1575,7 +1575,7 @@ splitDiamondMergeBuckets(CandidateSet &candidates, const RoseBuildImpl &build) {
     }
 
     // Neighbour splits require inverse map.
-    ue2::unordered_map<RoseVertex, size_t> inv;
+    unordered_map<RoseVertex, size_t> inv;
     buildInvBucketMap(buckets, inv);
 
     splitByNeighbour(g, buckets, inv, true);
index b7e092bbd20971cd20f184b375be8b3faa4248f7..d1181063a2cc3e657cd59a5f001eed8f3aefe0c5 100644 (file)
@@ -43,7 +43,7 @@
 #include "nfa/nfa_internal.h" // for MO_INVALID_IDX
 #include "util/charreach.h"
 #include "util/depth.h"
-#include "util/ue2_containers.h"
+#include "util/flat_containers.h"
 #include "util/ue2_graph.h"
 
 #include <memory>
index 42c59932d23d06a7991eaa6dcc9bb2010356d61a..ed4644ae48fa12b826bfb2efa7f3d934d421a56d 100644 (file)
@@ -45,7 +45,7 @@
 
 #include "ue2common.h"
 #include "rose/rose_common.h"
-#include "util/ue2_containers.h"
+#include "util/flat_containers.h"
 #include "util/ue2_graph.h"
 #include "util/ue2string.h"
 
index 3b31b38e065e2adae9c0561b361b1a7c8ade1410..9fe47c2765f3ca429573a94dcce072a08dfff2fa 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:
@@ -36,7 +36,6 @@
 #include "util/container.h"
 #include "util/graph_range.h"
 #include "util/make_unique.h"
-#include "util/ue2_containers.h"
 
 #include <vector>
 
index 3dc74d3da3b78746ff17bbff52eb88a7fd2571ee..d97e8fc1d7efdb510557a582155c4c6af17dbfbf 100644 (file)
@@ -40,6 +40,7 @@
 #include "nfagraph/ng_som_util.h"
 #include "nfagraph/ng_region.h"
 #include "util/charreach.h"
+#include "util/hash.h"
 #include "util/make_unique.h"
 #include "util/dump_charclass.h"
 #include "util/verify_types.h"
@@ -48,8 +49,6 @@
 #include <deque>
 #include <utility>
 
-#include <boost/functional/hash/hash.hpp>
-
 using namespace std;
 
 namespace ue2 {
@@ -67,13 +66,8 @@ SlotCacheEntry::SlotCacheEntry(const NGHolder &prefix_in,
 size_t SlotEntryHasher::operator()(const SlotCacheEntry &e) const {
     assert(e.prefix);
 
-    using boost::hash_combine;
-
-    size_t v = 0;
-    hash_combine(v, hash_holder(*e.prefix));
-    hash_combine(v, e.parent_slot);
-    hash_combine(v, e.is_reset);
-    hash_combine(v, e.escapes.hash());
+    size_t v = hash_all(hash_holder(*e.prefix), e.parent_slot,
+                        e.is_reset, e.escapes);
 
     DEBUG_PRINTF("%zu vertices, parent_slot=%u, escapes=%s, is_reset=%d "
                  "hashes to %zx\n", num_vertices(*e.prefix), e.parent_slot,
@@ -143,7 +137,7 @@ u32 SomSlotManager::getSomSlot(const NGHolder &prefix,
 
 u32 SomSlotManager::getInitialResetSomSlot(const NGHolder &prefix,
                 const NGHolder &g,
-                const ue2::unordered_map<NFAVertex, u32> &region_map,
+                const unordered_map<NFAVertex, u32> &region_map,
                 u32 last_sent_region, bool *prefix_already_implemented) {
     DEBUG_PRINTF("getting initial reset; last sent region %u\n",
                  last_sent_region);
@@ -171,9 +165,9 @@ u32 SomSlotManager::getInitialResetSomSlot(const NGHolder &prefix,
     // Clone a copy of g (and its region map) that we will be able to store
     // later on.
     shared_ptr<NGHolder> gg = make_shared<NGHolder>();
-    ue2::unordered_map<NFAVertex, NFAVertex> orig_to_copy;
+    unordered_map<NFAVertex, NFAVertex> orig_to_copy;
     cloneHolder(*gg, g, &orig_to_copy);
-    ue2::unordered_map<NFAVertex, u32> gg_region_map;
+    unordered_map<NFAVertex, u32> gg_region_map;
     for (const auto &m : region_map) {
         assert(contains(region_map, m.first));
         gg_region_map.emplace(orig_to_copy.at(m.first), m.second);
index ddb105f5344abb66e4d7b7a53002171c38541dc6..e5b2d794c0799128b939d08c8cbbb49c2e0dec76 100644 (file)
 #include "nfagraph/ng_holder.h"
 #include "util/bytecode_ptr.h"
 #include "util/noncopyable.h"
-#include "util/ue2_containers.h"
 
 #include <deque>
 #include <memory>
+#include <unordered_map>
 
 struct NFA;
 
@@ -69,7 +69,7 @@ public:
     /** prefix must be acting as a resetting sentinel and should be a dag (if
      * not how are we establish som?) */
     u32 getInitialResetSomSlot(const NGHolder &prefix, const NGHolder &g,
-                           const ue2::unordered_map<NFAVertex, u32> &region_map,
+                           const std::unordered_map<NFAVertex, u32> &region_map,
                            u32 last_sent_region,
                            bool *prefix_already_implemented);
 
index 46bfbe838f10d8945162e31f482d57f997bb1d11..7e1fecc7e65adc81a58621a21e372a8302539cb8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 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:
 #include "nfagraph/ng.h"
 #include "nfagraph/ng_is_equal.h"
 #include "util/charreach.h"
-#include "util/ue2_containers.h"
 #include "ue2common.h"
 
 #include <memory>
+#include <unordered_map>
+#include <unordered_set>
 #include <vector>
 
 namespace ue2 {
@@ -43,14 +44,14 @@ namespace ue2 {
 struct InitialResetEntry {
     InitialResetEntry(std::shared_ptr<const NGHolder> sent_in,
                       std::shared_ptr<const NGHolder> body_in,
-                      const ue2::unordered_map<NFAVertex, u32> &body_regions_in,
+                      const std::unordered_map<NFAVertex, u32> &body_regions_in,
                       u32 sent_region_in, u32 first_bad_region_in)
         : sent(sent_in), body(body_in), body_regions(body_regions_in),
           sent_region(sent_region_in), first_bad_region(first_bad_region_in) {}
 
     std::shared_ptr<const NGHolder> sent;
     std::shared_ptr<const NGHolder> body;
-    ue2::unordered_map<NFAVertex, u32> body_regions;
+    std::unordered_map<NFAVertex, u32> body_regions;
     u32 sent_region;
     u32 first_bad_region; /* ~0U if it must cover the whole g */
 };
@@ -85,7 +86,7 @@ struct SlotEntryEqual {
 };
 
 struct SlotCache {
-    typedef ue2::unordered_set<SlotCacheEntry, SlotEntryHasher,
+    typedef std::unordered_set<SlotCacheEntry, SlotEntryHasher,
                                SlotEntryEqual> CacheStore;
 
     void insert(const NGHolder &prefix, const CharReach &escapes,
@@ -96,8 +97,8 @@ struct SlotCache {
 
     CacheStore store;
 
-    ue2::unordered_set<std::shared_ptr<const NGHolder>, NGHolderHasher,
-                       NGHolderEqual> initial_prefixes;
+    std::unordered_set<std::shared_ptr<const NGHolder>, NGHolderHasher,
+                  NGHolderEqual> initial_prefixes;
     std::vector<InitialResetInfo> initial_resets;
 };
 
index f524fe937b0ee396b9bc4fc5318de229f5ccb881..2a067b30c6d97b25d5e01b8cf94d5b0fba19175d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Intel Corporation
+ * Copyright (c) 2016-2017, Intel Corporation
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -30,7 +30,7 @@
 #define ACCEL_SCHEME_H
 
 #include "util/charreach.h"
-#include "util/ue2_containers.h"
+#include "util/flat_containers.h"
 
 #include <utility>
 
@@ -39,7 +39,7 @@ namespace ue2 {
 #define MAX_ACCEL_DEPTH 4
 
 struct AccelScheme {
-    flat_set<std::pair<u8, u8> > double_byte;
+    flat_set<std::pair<u8, u8>> double_byte;
     CharReach cr = CharReach::dot();
     CharReach double_cr;
     u32 offset = MAX_ACCEL_DEPTH + 1;
index a71c1f88d5efe88f455820dee81b2d38ecc8d2e9..24c0c5804f72d48c772ffd505d535cf51a0e4962 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:
 #include "ue2common.h"
 #include "popcount.h"
 #include "util/bitutils.h"
+#include "util/hash.h"
 
 #include <array>
 #include <cassert>
 
 #include <boost/dynamic_bitset.hpp>
-#include <boost/functional/hash/hash.hpp>
 
 namespace ue2 {
 
@@ -373,7 +373,7 @@ public:
 
     /// Simple hash.
     size_t hash() const {
-        return boost::hash_range(std::begin(bits), std::end(bits));
+        return ue2_hasher()(bits);
     }
 
     /// Sentinel value meaning "no more bits", used by find_first and
@@ -420,12 +420,17 @@ private:
     std::array<block_type, num_blocks> bits;
 };
 
-/** \brief Boost-style hash free function. */
+} // namespace ue2
+
+namespace std {
+
 template<size_t requested_size>
-size_t hash_value(const bitfield<requested_size> &b) {
-    return b.hash();
-}
+struct hash<ue2::bitfield<requested_size>> {
+    size_t operator()(const ue2::bitfield<requested_size> &b) const {
+        return b.hash();
+    }
+};
 
-} // namespace ue2
+} // namespace std
 
 #endif // BITFIELD_H
index 53f2a5d27bb032b1708b3bd15e662c29457ae8f2..f6d3a2af3ebd2fb423fb75f84c96f41d70e3f339 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:
@@ -196,12 +196,17 @@ bool isSubsetOf(const CharReach &small, const CharReach &big);
 bool isutf8ascii(const CharReach &cr);
 bool isutf8start(const CharReach &cr);
 
-/** \brief Boost-style hash free function. */
-static really_inline
-size_t hash_value(const CharReach &cr) {
-    return cr.hash();
-}
-
 } // namespace ue2
 
+namespace std {
+
+template<>
+struct hash<ue2::CharReach> {
+    size_t operator()(const ue2::CharReach &cr) const {
+        return cr.hash();
+    }
+};
+
+} // namespace std
+
 #endif // NG_CHARREACH_H
index 79f0693233a15fd8c5b278e65a5a43b85da31d48..c2befea4971bd0d2707482c7ad5d569f025a65c2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Intel Corporation
+ * Copyright (c) 2016-2017, Intel Corporation
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are met:
@@ -34,7 +34,6 @@
 #include "container.h"
 #include "graph_range.h"
 #include "make_unique.h"
-#include "ue2_containers.h"
 
 #include <map>
 #include <set>
index 9af1ded880d9c511b3f7d51ac0fecf941679be36..5305c6f1b3371245e137012b188fcf2a6efc63a2 100644 (file)
@@ -221,8 +221,8 @@ public:
     std::string str() const;
 #endif
 
-    friend size_t hash_value(const depth &d) {
-        return d.val;
+    size_t hash() const {
+        return val;
     }
 
 private:
@@ -260,10 +260,6 @@ struct DepthMinMax : totally_ordered<DepthMinMax> {
 
 };
 
-inline size_t hash_value(const DepthMinMax &d) {
-    return hash_all(d.min, d.max);
-}
-
 /**
  * \brief Merge two DepthMinMax values together to produce their union.
  */
@@ -271,4 +267,22 @@ DepthMinMax unionDepthMinMax(const DepthMinMax &a, const DepthMinMax &b);
 
 } // namespace ue2
 
+namespace std {
+
+template<>
+struct hash<ue2::depth> {
+    size_t operator()(const ue2::depth &d) const {
+        return d.hash();
+    }
+};
+
+template<>
+struct hash<ue2::DepthMinMax> {
+    size_t operator()(const ue2::DepthMinMax &d) const {
+        return hash_all(d.min, d.max);
+    }
+};
+
+} // namespace
+
 #endif // DEPTH_H
similarity index 96%
rename from src/util/ue2_containers.h
rename to src/util/flat_containers.h
index d345a4faa45310e032522706df17dbaa554c8c31..41452eb42ac7bdbbe53a409e5d3ea6e3dfc2da83 100644 (file)
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef UTIL_UE2_CONTAINERS_H_
-#define UTIL_UE2_CONTAINERS_H_
+#ifndef UTIL_FLAT_CONTAINERS_H
+#define UTIL_FLAT_CONTAINERS_H
 
 #include "ue2common.h"
+#include "util/hash.h"
 #include "util/operators.h"
 #include "util/small_vector.h"
 
 #include <type_traits>
 #include <utility>
 
-#include <boost/functional/hash/hash_fwd.hpp>
 #include <boost/iterator/iterator_facade.hpp>
-#include <boost/unordered/unordered_map.hpp>
-#include <boost/unordered/unordered_set.hpp>
 
 namespace ue2 {
 
-/** \brief Unordered set container implemented internally as a hash table. */
-using boost::unordered_set;
-
-/** \brief Unordered map container implemented internally as a hash table. */
-using boost::unordered_map;
-
 namespace flat_detail {
 
 // Iterator facade that wraps an underlying iterator, so that we get our
@@ -363,11 +355,6 @@ public:
     friend void swap(flat_set &a, flat_set &b) {
         a.swap(b);
     }
-
-    // Free hash function.
-    friend size_t hash_value(const flat_set &a) {
-        return boost::hash_range(a.begin(), a.end());
-    }
 };
 
 /**
@@ -652,13 +639,26 @@ public:
     friend void swap(flat_map &a, flat_map &b) {
         a.swap(b);
     }
+};
+
+} // namespace ue2
+
+namespace std {
+
+template<typename T, typename Compare, typename Allocator>
+struct hash<ue2::flat_set<T, Compare, Allocator>> {
+    size_t operator()(const ue2::flat_set<T, Compare, Allocator> &f) {
+        return ue2::ue2_hasher()(f);
+    }
+};
 
-    // Free hash function.
-    friend size_t hash_value(const flat_map &a) {
-        return boost::hash_range(a.begin(), a.end());
+template<typename Key, typename T, typename Compare, typename Allocator>
+struct hash<ue2::flat_map<Key, T, Compare, Allocator>> {
+    size_t operator()(const ue2::flat_map<Key, T, Compare, Allocator> &f) {
+        return ue2::ue2_hasher()(f);
     }
 };
 
-} // namespace
+} // namespace std
 
-#endif // UTIL_UE2_CONTAINERS_H_
+#endif // UTIL_FLAT_CONTAINERS_H
index 39e86487aa981cee12f18da49c711a293396b432..9d6bb955509a9116f7d677da445d17d2680be68c 100644 (file)
@@ -35,8 +35,9 @@
 
 #include "container.h"
 #include "ue2common.h"
+#include "util/flat_containers.h"
 #include "util/graph_range.h"
-#include "util/ue2_containers.h"
+#include "util/unordered.h"
 
 #include <boost/graph/depth_first_search.hpp>
 #include <boost/graph/strong_components.hpp>
@@ -115,7 +116,7 @@ bool has_proper_successor(const typename Graph::vertex_descriptor &v,
 template<class Graph, class SourceCont, class OutCont>
 void find_reachable(const Graph &g, const SourceCont &sources, OutCont *out) {
     using vertex_descriptor = typename Graph::vertex_descriptor;
-    ue2::unordered_map<vertex_descriptor, boost::default_color_type> colours;
+    std::unordered_map<vertex_descriptor, boost::default_color_type> colours;
 
     for (auto v : sources) {
         boost::depth_first_visit(g, v,
@@ -133,7 +134,7 @@ void find_reachable(const Graph &g, const SourceCont &sources, OutCont *out) {
 template<class Graph, class SourceCont, class OutCont>
 void find_unreachable(const Graph &g, const SourceCont &sources, OutCont *out) {
     using vertex_descriptor = typename Graph::vertex_descriptor;
-    ue2::unordered_set<vertex_descriptor> reachable;
+    std::unordered_set<vertex_descriptor> reachable;
 
     find_reachable(g, sources, &reachable);
 
@@ -182,7 +183,8 @@ find_vertices_in_cycles(const Graph &g) {
 template <class Graph>
 bool has_parallel_edge(const Graph &g) {
     using vertex_descriptor = typename Graph::vertex_descriptor;
-    ue2::unordered_set<std::pair<vertex_descriptor, vertex_descriptor>> seen;
+    ue2_unordered_set<std::pair<vertex_descriptor, vertex_descriptor>> seen;
+
     for (const auto &e : edges_range(g)) {
         auto u = source(e, g);
         auto v = target(e, g);
index 6f76e43de9f39506a7859b899f2d9120873b3ebd..1c35d20c3872a5ca9bf08c83eac39d7245f337f3 100644 (file)
 #ifndef UTIL_HASH_H
 #define UTIL_HASH_H
 
-#include <iterator>
-#include <boost/functional/hash/hash_fwd.hpp>
+#include <functional>
+#include <type_traits>
+#include <utility>
 
 namespace ue2 {
 
 namespace hash_detail {
 
+inline
+void hash_combine_impl(size_t &seed, size_t value) {
+    // Note: constants explicitly truncated on 32-bit platforms.
+    const size_t a = (size_t)0x0b4e0ef37bc32127ULL;
+    const size_t b = (size_t)0x318f07b0c8eb9be9ULL;
+    seed ^= value * a;
+    seed += b;
+}
+
+/** \brief Helper that determines whether std::begin() exists for T. */
+template<typename T>
+struct is_container_check {
+private:
+    template<typename C>
+    static auto has_begin_function(const C &obj) -> decltype(std::begin(obj)) {
+        return std::begin(obj);
+    }
+    static void has_begin_function(...) {
+        return;
+    }
+    using has_begin_type = decltype(has_begin_function(std::declval<T>()));
+
+public:
+    static const bool value = !std::is_void<has_begin_type>::value;
+};
+
+/** \brief Type trait to enable on whether T is a container. */
+template<typename T>
+struct is_container
+    : public ::std::integral_constant<bool, is_container_check<T>::value> {};
+
+/** \brief Helper that determines whether T::hash() exists. */
+template<typename T>
+struct has_hash_member_check {
+private:
+    template<typename C>
+    static auto has_hash_member_function(const C &obj) -> decltype(obj.hash()) {
+        return obj.hash();
+    }
+    static void has_hash_member_function(...) {
+        return;
+    }
+    using has_hash = decltype(has_hash_member_function(std::declval<T>()));
+
+public:
+    static const bool value = !std::is_void<has_hash>::value;
+};
+
+/** \brief Type trait to enable on whether T::hash() exists. */
+template<typename T>
+struct has_hash_member
+    : public ::std::integral_constant<bool, has_hash_member_check<T>::value> {};
+
+/** \brief Default hash: falls back to std::hash. */
+template<typename T, typename Enable = void>
+struct ue2_hash {
+    using decayed_type = typename std::decay<T>::type;
+    size_t operator()(const T &obj) const {
+        return std::hash<decayed_type>()(obj);
+    }
+};
+
+/** \brief Hash for std::pair. */
+template<typename A, typename B>
+struct ue2_hash<std::pair<A, B>, void> {
+    size_t operator()(const std::pair<A, B> &p) const {
+        size_t v = 0;
+        hash_combine_impl(v, ue2_hash<A>()(p.first));
+        hash_combine_impl(v, ue2_hash<B>()(p.second));
+        return v;
+    }
+};
+
+/** \brief Hash for any type that has a hash() member function. */
+template<typename T>
+struct ue2_hash<T, typename std::enable_if<has_hash_member<T>::value>::type> {
+    size_t operator()(const T &obj) const {
+        return obj.hash();
+    }
+};
+
+/** \brief Hash for any container type that supports std::begin(). */
+template<typename T>
+struct ue2_hash<T, typename std::enable_if<is_container<T>::value &&
+                                           !has_hash_member<T>::value>::type> {
+    size_t operator()(const T &obj) const {
+        size_t v = 0;
+        for (const auto &elem : obj) {
+            using element_type = typename std::decay<decltype(elem)>::type;
+            hash_combine_impl(v, ue2_hash<element_type>()(elem));
+        }
+        return v;
+    }
+};
+
+/** \brief Hash for enum types. */
+template<typename T>
+struct ue2_hash<T, typename std::enable_if<std::is_enum<T>::value>::type> {
+    size_t operator()(const T &obj) const {
+        using utype = typename std::underlying_type<T>::type;
+        return ue2_hash<utype>()(static_cast<utype>(obj));
+    }
+};
+
+template<typename T>
+void hash_combine(size_t &seed, const T &obj) {
+    hash_combine_impl(seed, ue2_hash<T>()(obj));
+}
+
 template<typename T>
 void hash_build(size_t &v, const T &obj) {
-    boost::hash_combine(v, obj);
+    hash_combine(v, obj);
 }
 
 template<typename T, typename... Args>
@@ -54,6 +164,21 @@ void hash_build(size_t &v, const T &obj, Args&&... args) {
 
 } // namespace hash_detail
 
+using hash_detail::hash_combine;
+
+/**
+ * \brief Hasher for general use.
+ *
+ * Provides operators for most standard containers and falls back to
+ * std::hash<T>.
+ */
+struct ue2_hasher {
+    template<typename T>
+    size_t operator()(const T &obj) const {
+        return hash_detail::ue2_hash<T>()(obj);
+    }
+};
+
 /**
  * \brief Computes the combined hash of all its arguments.
  *
@@ -70,15 +195,6 @@ size_t hash_all(Args&&... args) {
     return v;
 }
 
-/**
- * \brief Compute the hash of all the elements of any range on which we can
- * call std::begin() and std::end().
- */
-template<typename Range>
-size_t hash_range(const Range &r) {
-    return boost::hash_range(std::begin(r), std::end(r));
-}
-
 } // namespace ue2
 
 #endif // UTIL_HASH_H
index 315aed34f9641b5f05c95022b47ba3cb66d35a5e..65bc29c30b7668cdda3b84555315a411739505c1 100644 (file)
@@ -34,8 +34,9 @@
 #ifndef UTIL_HASH_DYNAMIC_BITSET_H
 #define UTIL_HASH_DYNAMIC_BITSET_H
 
+#include "hash.h"
+
 #include <boost/dynamic_bitset.hpp>
-#include <boost/functional/hash/hash.hpp>
 
 #include <iterator>
 
@@ -68,7 +69,7 @@ struct hash_output_it {
 
         template<typename T>
         void operator=(const T &val) const {
-            boost::hash_combine(*out, val);
+            hash_combine(*out, val);
         }
 
     private:
index 2d7b5fc26877813e89c8d80b1f2733f0011a139c..ba5c8dfa735bbaa5e25cb6bacbee637d2196d8d4 100644 (file)
@@ -43,10 +43,16 @@ bool operator==(const mmbit_sparse_iter &a, const mmbit_sparse_iter &b) {
     return a.mask == b.mask && a.val == b.val;
 }
 
-inline
-size_t hash_value(const mmbit_sparse_iter &iter) {
-    return ue2::hash_all(iter.mask, iter.val);
-}
+namespace std {
+
+template<>
+struct hash<mmbit_sparse_iter> {
+    size_t operator()(const mmbit_sparse_iter &iter) const {
+        return ue2::hash_all(iter.mask, iter.val);
+    }
+};
+
+} // namespace std
 
 namespace ue2 {
 
index a9e4644d1d996c3c4b2a2f9378180e31feea1a86..41710fe738b58088578d48669483daed56b22a02 100644 (file)
@@ -31,7 +31,7 @@
 
 #include "container.h"
 #include "noncopyable.h"
-#include "ue2_containers.h"
+#include "flat_containers.h"
 #include "ue2common.h"
 
 #include <algorithm>
index a8e233ffd801f871725ff55f49ab7ef1e1794b6e..0d5e69b8f3ba6268333f6a690dd2ed25bdd2b4f8 100644 (file)
@@ -206,13 +206,6 @@ bool operator==(const Report &a, const Report &b) {
            a.topSquashDistance == b.topSquashDistance;
 }
 
-inline
-size_t hash_value(const Report &r) {
-    return hash_all(r.type, r.quashSom, r.minOffset, r.maxOffset, r.minLength,
-                    r.ekey, r.offsetAdjust, r.onmatch, r.revNfaIndex,
-                    r.somDistance, r.topSquashDistance);
-}
-
 static inline
 Report makeECallback(u32 report, s32 offsetAdjust, u32 ekey) {
     Report ir(EXTERNAL_CALLBACK, report);
@@ -262,6 +255,19 @@ bool isSimpleExhaustible(const Report &ir) {
     return true;
 }
 
-} // namespace
+} // namespace ue2
+
+namespace std {
+
+template<>
+struct hash<ue2::Report> {
+    std::size_t operator()(const ue2::Report &r) const {
+        return ue2::hash_all(r.type, r.quashSom, r.minOffset, r.maxOffset,
+                             r.minLength, r.ekey, r.offsetAdjust, r.onmatch,
+                             r.revNfaIndex, r.somDistance, r.topSquashDistance);
+    }
+};
+
+} // namespace std
 
 #endif // UTIL_REPORT_H
index 95e14a2c33ce725a343fb5c8495a3c8683128959..aa359ed76a778f22af80166e6d6bb0d7d1b68cd1 100644 (file)
 #include "util/compile_error.h"
 #include "util/noncopyable.h"
 #include "util/report.h"
-#include "util/ue2_containers.h"
 
 #include <map>
 #include <set>
+#include <unordered_map>
 #include <vector>
 
 namespace ue2 {
@@ -131,17 +131,17 @@ private:
 
     /** \brief Mapping from Report to ID (inverse of \ref reportIds
      * vector). */
-    unordered_map<Report, size_t> reportIdToInternalMap;
+    std::unordered_map<Report, size_t> reportIdToInternalMap;
 
     /** \brief Mapping from ReportID to dedupe key. */
-    unordered_map<ReportID, u32> reportIdToDedupeKey;
+    std::unordered_map<ReportID, u32> reportIdToDedupeKey;
 
     /** \brief Mapping from ReportID to Rose program offset in bytecode. */
-    unordered_map<ReportID, u32> reportIdToProgramOffset;
+    std::unordered_map<ReportID, u32> reportIdToProgramOffset;
 
     /** \brief Mapping from external match ids to information about that
      * id. */
-    unordered_map<ReportID, external_report_info> externalIdMap;
+    std::unordered_map<ReportID, external_report_info> externalIdMap;
 
     /** \brief Mapping from expression index to exhaustion key. */
     std::map<s64a, u32> toExhaustibleKeyMap;
index 1409e0919576ca376c56c0d00f9c0c48880780e7..bf719fd7a4d5b15221326278886d52fa5f58c112 100644 (file)
@@ -34,7 +34,6 @@
 #include "util/noncopyable.h"
 #include "util/operators.h"
 
-#include <boost/functional/hash.hpp>
 #include <boost/graph/properties.hpp> /* vertex_index_t, ... */
 #include <boost/pending/property.hpp> /* no_property */
 #include <boost/property_map/property_map.hpp>
@@ -42,7 +41,9 @@
 #include <boost/iterator/iterator_adaptor.hpp>
 #include <boost/iterator/iterator_facade.hpp>
 
+#include <functional> /* hash */
 #include <tuple> /* tie */
+#include <type_traits> /* is_same, etc */
 #include <utility> /* pair, declval */
 
 /*
@@ -187,9 +188,8 @@ public:
     }
     bool operator==(const vertex_descriptor b) const { return p == b.p; }
 
-    friend size_t hash_value(vertex_descriptor v) {
-        using boost::hash_value;
-        return hash_value(v.serial);
+    size_t hash() const {
+        return std::hash<u64a>()(serial);
     }
 
 private:
@@ -227,9 +227,8 @@ public:
     }
     bool operator==(const edge_descriptor b) const { return p == b.p; }
 
-    friend size_t hash_value(edge_descriptor e) {
-        using boost::hash_value;
-        return hash_value(e.serial);
+    size_t hash() const {
+        return std::hash<u64a>()(serial);
     }
 
 private:
@@ -1288,7 +1287,7 @@ edge_index_upper_bound(const Graph &g) {
 using boost::vertex_index;
 using boost::edge_index;
 
-}
+} // namespace ue2
 
 namespace boost {
 
@@ -1305,5 +1304,29 @@ struct property_map<Graph, Prop,
                          std::declval<const Graph &>())) const_type;
 };
 
-}
+} // namespace boost
+
+namespace std {
+
+/* Specialization of std::hash so that vertex_descriptor can be used in
+ * unordered containers. */
+template<typename Graph>
+struct hash<ue2::graph_detail::vertex_descriptor<Graph>> {
+    using vertex_descriptor = ue2::graph_detail::vertex_descriptor<Graph>;
+    std::size_t operator()(const vertex_descriptor &v) const {
+        return v.hash();
+    }
+};
+
+/* Specialization of std::hash so that edge_descriptor can be used in
+ * unordered containers. */
+template<typename Graph>
+struct hash<ue2::graph_detail::edge_descriptor<Graph>> {
+    using edge_descriptor = ue2::graph_detail::edge_descriptor<Graph>;
+    std::size_t operator()(const edge_descriptor &e) const {
+        return e.hash();
+    }
+};
+
+} // namespace std
 #endif
index bde975ad9997856087b4a7c30d7bd891423cfcd3..02d7b713c4b8e3921750e900b2b4400558a498da 100644 (file)
 /** \file
  * \brief Tools for string manipulation, ue2_literal definition.
  */
+
+#include "ue2string.h"
+
 #include "charreach.h"
 #include "compare.h"
-#include "ue2string.h"
 
 #include <algorithm>
+#include <cstring>
 #include <iomanip>
 #include <sstream>
 #include <string>
index d9fbadcd6aa299f7964a107665b15d8376099c03..9eef65da1111ed1b19694b3a20baa09a201b503a 100644 (file)
@@ -208,14 +208,6 @@ private:
     std::vector<bool> nocase; /* for trolling value */
 };
 
-inline
-size_t hash_value(const ue2_literal::elem &elem) {
-    return hash_all(elem.c, elem.nocase);
-}
-
-inline
-size_t hash_value(const ue2_literal &lit) { return hash_range(lit); }
-
 /// Return a reversed copy of this literal.
 ue2_literal reverse_literal(const ue2_literal &in);
 
@@ -314,4 +306,22 @@ std::string escapeString(const ue2_literal &lit);
 
 } // namespace ue2
 
+namespace std {
+
+template<>
+struct hash<ue2::ue2_literal::elem> {
+    size_t operator()(const ue2::ue2_literal::elem &elem) const {
+        return ue2::hash_all(elem.c, elem.nocase);
+    }
+};
+
+template<>
+struct hash<ue2::ue2_literal> {
+    size_t operator()(const ue2::ue2_literal &lit) const {
+        return ue2::ue2_hasher()(lit);
+    }
+};
+
+} // namespace std
+
 #endif
diff --git a/src/util/unordered.h b/src/util/unordered.h
new file mode 100644 (file)
index 0000000..a8aa61c
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2017, Intel Corporation
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  * Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *  * Neither the name of Intel Corporation nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef UTIL_UNORDERED_H
+#define UTIL_UNORDERED_H
+
+/**
+ * \file
+ * \brief Unordered set and map containers that default to using our own hasher.
+ */
+
+#include "hash.h"
+
+#include <unordered_set>
+#include <unordered_map>
+
+namespace ue2 {
+
+template<class Key, class Hash = ue2_hasher>
+using ue2_unordered_set = std::unordered_set<Key, Hash>;
+
+template<class Key, class T, class Hash = ue2_hasher>
+using ue2_unordered_map = std::unordered_map<Key, T, Hash>;
+
+} // namespace ue2
+
+
+#endif // UTIL_UNORDERED_H
index e5c5f0ce4ad6e8bac35cd58252b8ed01942908d9..40087ef7400c8d71b965c09e1e003e52dc16db59 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 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:
 
 #include "gtest/gtest.h"
 #include "util/bitfield.h"
-#include "util/ue2_containers.h"
 
 #include <algorithm>
+#include <unordered_set>
 
+using namespace std;
 using namespace ue2;
 
 template<size_t N>
@@ -393,9 +394,9 @@ TYPED_TEST(BitfieldTest, find_nth_sparse) {
 TYPED_TEST(BitfieldTest, unordered_set) {
     const size_t size = TypeParam::size();
 
-    // Exercise the hash_value free function by adding bitfields to an
+    // Exercise the hash specialisation by adding bitfields to an
     // unordered_set.
-    ue2::unordered_set<TypeParam> s;
+    unordered_set<TypeParam> s;
     s.reserve(size);
 
     for (size_t i = 0; i < size; ++i) {
index ad9ffe38806daedb57a718f8e53abff8fed6940f..726aa92ce593b744be9f77779ac10d1ac5193b11 100644 (file)
 #include "config.h"
 
 #include "util/depth.h"
-#include "util/ue2_containers.h"
 #include "gtest/gtest.h"
 
+#include <unordered_set>
+
+using namespace std;
 using namespace ue2;
 
 static UNUSED
@@ -265,7 +267,7 @@ TEST(depth, u64a_operators) {
 }
 
 TEST(depth, unordered_set) {
-    ue2::unordered_set<depth> depths;
+    unordered_set<depth> depths;
 
     for (const auto &val : finite_values) {
         depths.emplace(val);
index 6a81bbfed6df00bb0dd9145d9a88f52273849af7..610c71e16862412d554195f8d245880cac94cfea 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 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:
@@ -28,7 +28,7 @@
 
 #include "config.h"
 
-#include "util/ue2_containers.h"
+#include "util/flat_containers.h"
 #include "ue2common.h"
 
 #include "gtest/gtest.h"
@@ -403,6 +403,11 @@ TEST(flat_map, max_size) {
     ASSERT_LE(1ULL << 24, f.max_size());
 }
 
+template<typename FlatMap>
+size_t hash_value(const FlatMap &f) {
+    return std::hash<FlatMap>()(f);
+}
+
 TEST(flat_map, hash_value) {
     const vector<pair<u32, u32>> input = {
         {0, 0}, {3, 1}, {76, 2}, {132, 3}, {77, 4}, {99999, 5}, {100, 6}};
index 3bee0edbe0bc591561f70dde8c85b3442efb494d..10607a6fb04b4c21eaa9daaad3a0d774e2d3751d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 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:
@@ -28,7 +28,7 @@
 
 #include "config.h"
 
-#include "util/ue2_containers.h"
+#include "util/flat_containers.h"
 #include "ue2common.h"
 
 #include "gtest/gtest.h"
@@ -393,6 +393,11 @@ TEST(flat_set, max_size) {
     ASSERT_LE(1ULL << 24, f.max_size());
 }
 
+template<typename FlatSet>
+size_t hash_value(const FlatSet &f) {
+    return std::hash<FlatSet>()(f);
+}
+
 TEST(flat_set, hash_value) {
     const vector<u32> input = {0,        15, 3,   1,   20,  32768,
                                24000000, 17, 100, 101, 104, 99999};
index b6952f5a1e0bab6e9de8ab13b1d0044a56b439e8..e6a58b551033b27e1d3a46e5da34bbdb23d81c38 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:
@@ -79,8 +79,8 @@ TEST(NFAGraph, split1) {
 
     NFAVertex pivot = c;
 
-    ue2::unordered_map<NFAVertex, NFAVertex> lhs_map;
-    ue2::unordered_map<NFAVertex, NFAVertex> rhs_map;
+    unordered_map<NFAVertex, NFAVertex> lhs_map;
+    unordered_map<NFAVertex, NFAVertex> rhs_map;
 
     splitGraph(src, pivot, &lhs, &lhs_map, &rhs, &rhs_map);
 
@@ -130,8 +130,8 @@ TEST(NFAGraph, split2) {
 
     NFAVertex pivot = c;
 
-    ue2::unordered_map<NFAVertex, NFAVertex> lhs_map;
-    ue2::unordered_map<NFAVertex, NFAVertex> rhs_map;
+    unordered_map<NFAVertex, NFAVertex> lhs_map;
+    unordered_map<NFAVertex, NFAVertex> rhs_map;
 
     splitGraph(src, pivot, &lhs, &lhs_map, &rhs, &rhs_map);
 
@@ -203,8 +203,8 @@ TEST(NFAGraph, split3) {
     pivots.push_back(d);
     pivots.push_back(g);
 
-    ue2::unordered_map<NFAVertex, NFAVertex> lhs_map;
-    ue2::unordered_map<NFAVertex, NFAVertex> rhs_map;
+    unordered_map<NFAVertex, NFAVertex> lhs_map;
+    unordered_map<NFAVertex, NFAVertex> rhs_map;
 
     splitGraph(src, pivots, &lhs, &lhs_map, &rhs, &rhs_map);
 
@@ -280,8 +280,8 @@ TEST(NFAGraph, split4) {
     pivots.push_back(d);
     pivots.push_back(g);
 
-    ue2::unordered_map<NFAVertex, NFAVertex> lhs_map;
-    ue2::unordered_map<NFAVertex, NFAVertex> rhs_map;
+    unordered_map<NFAVertex, NFAVertex> lhs_map;
+    unordered_map<NFAVertex, NFAVertex> rhs_map;
 
     splitGraph(src, pivots, &lhs, &lhs_map, &rhs, &rhs_map);
 
index 291c241a2165ff8853e59900169a9a4a8ec54d96..ed7c2bdc5ba97a5825060934523914724cbdb841 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:
 #include "smallwrite/smallwrite_build.h"
 #include "som/slot_manager.h"
 
-using std::vector;
+#include <memory>
+#include <unordered_set>
+#include <vector>
+
+using namespace std;
 using namespace ue2;
 
 static
@@ -78,7 +82,7 @@ RoseVertex addVertex(RoseBuildImpl &build, RoseVertex parent, u32 lit_id) {
 
 static
 size_t numUniqueSuffixGraphs(const RoseGraph &g) {
-    ue2::unordered_set<const NGHolder *> seen;
+    unordered_set<const NGHolder *> seen;
 
     for (const auto &v : vertices_range(g)) {
         if (g[v].suffix) {
index 19ab7edf23b3b0415850c6de5b3362b6f4f5cf4a..c5fad785eabffcda8d289c7412fe0f9fee074cdd 100644 (file)
@@ -42,7 +42,6 @@
 #include "util/container.h"
 #include "util/graph_range.h"
 #include "util/make_unique.h"
-#include "util/ue2_containers.h"
 #include "util/ue2string.h"
 #include "util/unicode_def.h"
 #include "util/unicode_set.h"
@@ -52,6 +51,7 @@
 #include <memory>
 #include <set>
 #include <sstream>
+#include <unordered_set>
 #include <vector>
 
 #include <boost/utility.hpp>
@@ -143,7 +143,7 @@ void findPaths(const NGHolder &g, CorpusProperties &cProps,
     vector<unique_ptr<VertexPath>> open;
     open.push_back(ue2::make_unique<VertexPath>(1, g.start));
 
-    ue2::unordered_set<NFAVertex> one_way_in;
+    unordered_set<NFAVertex> one_way_in;
     for (const auto &v : vertices_range(g)) {
         if (in_degree(v, g) <= 1) {
             one_way_in.insert(v);
index 97a183751ebf8f295b7a35991d9b70959358625b..0a896f7328a44e645c8a90bc3e077281816b6175 100644 (file)
@@ -41,6 +41,7 @@
 #include "util/compare.h"
 #include "util/report.h"
 #include "util/report_manager.h"
+#include "util/unordered.h"
 
 #include <algorithm>
 
@@ -770,7 +771,7 @@ struct EdgeCache {
     }
 
 private:
-    unordered_map<pair<NFAVertex, NFAVertex>, NFAEdge> cache;
+    ue2_unordered_map<pair<NFAVertex, NFAVertex>, NFAEdge> cache;
 };
 
 struct fmstate {