]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
rose: use bytecode_ptr<RoseEngine>
authorJustin Viiret <justin.viiret@intel.com>
Fri, 31 Mar 2017 02:22:04 +0000 (13:22 +1100)
committerMatthew Barr <matthew.barr@intel.com>
Wed, 26 Apr 2017 05:19:36 +0000 (15:19 +1000)
src/compiler/compiler.cpp
src/rose/rose_build.h
src/rose/rose_build_bytecode.cpp
src/rose/rose_build_compile.cpp
src/rose/rose_build_impl.h

index 47bf514c3350af5b5ae336b32716283ff0613439..b2deae3273b0b6976c4a586c5468ee5fd842e05f 100644 (file)
@@ -56,7 +56,7 @@
 #include "parser/utf8_validate.h"
 #include "rose/rose_build.h"
 #include "som/slot_manager_dump.h"
-#include "util/alloc.h"
+#include "util/bytecode_ptr.h"
 #include "util/compile_error.h"
 #include "util/target_info.h"
 #include "util/verify_types.h"
@@ -288,7 +288,7 @@ void addExpression(NG &ng, unsigned index, const char *expression,
 }
 
 static
-aligned_unique_ptr<RoseEngine> generateRoseEngine(NG &ng) {
+bytecode_ptr<RoseEngine> generateRoseEngine(NG &ng) {
     const u32 minWidth =
         ng.minWidth.is_finite() ? verify_u32(ng.minWidth) : ROSE_BOUND_INF;
     auto rose = ng.rose->buildRose(minWidth);
index 2949fcc91951a7f8829c08cb5b042ba81a469e59..a14ea8ff21e5c4cd5e54b2af2c8f7fe901785ad6 100644 (file)
@@ -40,7 +40,7 @@
 #include "ue2common.h"
 #include "rose_common.h"
 #include "rose_in_graph.h"
-#include "util/alloc.h"
+#include "util/bytecode_ptr.h"
 #include "util/charreach.h"
 #include "util/noncopyable.h"
 #include "util/ue2_containers.h"
@@ -113,7 +113,7 @@ public:
                          bool eod) = 0;
 
     /** \brief Construct a runtime implementation. */
-    virtual ue2::aligned_unique_ptr<RoseEngine> buildRose(u32 minWidth) = 0;
+    virtual bytecode_ptr<RoseEngine> buildRose(u32 minWidth) = 0;
 
     virtual std::unique_ptr<RoseDedupeAux> generateDedupeAux() const = 0;
 
index b9df1af63d3fc3997954f9c81535c44e82ebed61..4447646a385d7935b5fb51103443d7d54b42bdf5 100644 (file)
@@ -5589,8 +5589,8 @@ u32 writeEagerQueueIter(const set<u32> &eager, u32 leftfixBeginQueue,
 }
 
 static
-aligned_unique_ptr<RoseEngine> addSmallWriteEngine(const RoseBuildImpl &build,
-                                        aligned_unique_ptr<RoseEngine> rose) {
+bytecode_ptr<RoseEngine> addSmallWriteEngine(const RoseBuildImpl &build,
+                                             bytecode_ptr<RoseEngine> rose) {
     assert(rose);
 
     if (roseIsPureLiteral(rose.get())) {
@@ -5612,7 +5612,7 @@ aligned_unique_ptr<RoseEngine> addSmallWriteEngine(const RoseBuildImpl &build,
     const size_t smwrOffset = ROUNDUP_CL(mainSize);
     const size_t newSize = smwrOffset + smallWriteSize;
 
-    auto rose2 = aligned_zmalloc_unique<RoseEngine>(newSize);
+    auto rose2 = make_bytecode_ptr<RoseEngine>(newSize, 64);
     char *ptr = (char *)rose2.get();
     memcpy(ptr, rose.get(), mainSize);
     memcpy(ptr + smwrOffset, smwr_engine.get(), smallWriteSize);
@@ -5709,7 +5709,7 @@ map<left_id, u32> makeLeftQueueMap(const RoseGraph &g,
     return lqm;
 }
 
-aligned_unique_ptr<RoseEngine> RoseBuildImpl::buildFinalEngine(u32 minWidth) {
+bytecode_ptr<RoseEngine> RoseBuildImpl::buildFinalEngine(u32 minWidth) {
     // We keep all our offsets, counts etc. in a prototype RoseEngine which we
     // will copy into the real one once it is allocated: we can't do this
     // until we know how big it will be.
@@ -5963,8 +5963,8 @@ aligned_unique_ptr<RoseEngine> RoseBuildImpl::buildFinalEngine(u32 minWidth) {
 
     proto.size = currOffset;
 
-    // Time to allocate the real RoseEngine structure.
-    auto engine = aligned_zmalloc_unique<RoseEngine>(currOffset);
+    // Time to allocate the real RoseEngine structure, at cacheline alignment.
+    auto engine = make_bytecode_ptr<RoseEngine>(currOffset, 64);
     assert(engine); // will have thrown bad_alloc otherwise.
 
     // Copy in our prototype engine data.
index 791a68ab6db442d3a22d924f6eed27c892618921..c0096a977b8845cdc8f73ee88e2d32df7aaef0ce 100644 (file)
@@ -1668,7 +1668,7 @@ bool roleOffsetsAreValid(const RoseGraph &g) {
 }
 #endif // NDEBUG
 
-aligned_unique_ptr<RoseEngine> RoseBuildImpl::buildRose(u32 minWidth) {
+bytecode_ptr<RoseEngine> RoseBuildImpl::buildRose(u32 minWidth) {
     dumpRoseGraph(*this, "rose_early.dot");
 
     // Early check for Rose implementability.
index 93c0f18c5c02d85bdcc4ce98c1d91038ebc6915f..21db7a8ee3175b3970ba9e6e49a247042b9d18df 100644 (file)
@@ -38,7 +38,7 @@
 #include "nfa/nfa_internal.h"
 #include "nfagraph/ng_holder.h"
 #include "nfagraph/ng_revacc.h"
-#include "util/alloc.h"
+#include "util/bytecode_ptr.h"
 #include "util/order_check.h"
 #include "util/queue_index_factory.h"
 #include "util/ue2_containers.h"
@@ -471,8 +471,8 @@ public:
                  bool eod) override;
 
     // Construct a runtime implementation.
-    aligned_unique_ptr<RoseEngine> buildRose(u32 minWidth) override;
-    aligned_unique_ptr<RoseEngine> buildFinalEngine(u32 minWidth);
+    bytecode_ptr<RoseEngine> buildRose(u32 minWidth) override;
+    bytecode_ptr<RoseEngine> buildFinalEngine(u32 minWidth);
 
     void setSom() override { hasSom = true; }