mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
rose: use bytecode_ptr<RoseEngine>
This commit is contained in:
parent
73ef7f1e44
commit
813f1e3fb9
@ -56,7 +56,7 @@
|
|||||||
#include "parser/utf8_validate.h"
|
#include "parser/utf8_validate.h"
|
||||||
#include "rose/rose_build.h"
|
#include "rose/rose_build.h"
|
||||||
#include "som/slot_manager_dump.h"
|
#include "som/slot_manager_dump.h"
|
||||||
#include "util/alloc.h"
|
#include "util/bytecode_ptr.h"
|
||||||
#include "util/compile_error.h"
|
#include "util/compile_error.h"
|
||||||
#include "util/target_info.h"
|
#include "util/target_info.h"
|
||||||
#include "util/verify_types.h"
|
#include "util/verify_types.h"
|
||||||
@ -288,7 +288,7 @@ void addExpression(NG &ng, unsigned index, const char *expression,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
aligned_unique_ptr<RoseEngine> generateRoseEngine(NG &ng) {
|
bytecode_ptr<RoseEngine> generateRoseEngine(NG &ng) {
|
||||||
const u32 minWidth =
|
const u32 minWidth =
|
||||||
ng.minWidth.is_finite() ? verify_u32(ng.minWidth) : ROSE_BOUND_INF;
|
ng.minWidth.is_finite() ? verify_u32(ng.minWidth) : ROSE_BOUND_INF;
|
||||||
auto rose = ng.rose->buildRose(minWidth);
|
auto rose = ng.rose->buildRose(minWidth);
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
#include "ue2common.h"
|
#include "ue2common.h"
|
||||||
#include "rose_common.h"
|
#include "rose_common.h"
|
||||||
#include "rose_in_graph.h"
|
#include "rose_in_graph.h"
|
||||||
#include "util/alloc.h"
|
#include "util/bytecode_ptr.h"
|
||||||
#include "util/charreach.h"
|
#include "util/charreach.h"
|
||||||
#include "util/noncopyable.h"
|
#include "util/noncopyable.h"
|
||||||
#include "util/ue2_containers.h"
|
#include "util/ue2_containers.h"
|
||||||
@ -113,7 +113,7 @@ public:
|
|||||||
bool eod) = 0;
|
bool eod) = 0;
|
||||||
|
|
||||||
/** \brief Construct a runtime implementation. */
|
/** \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;
|
virtual std::unique_ptr<RoseDedupeAux> generateDedupeAux() const = 0;
|
||||||
|
|
||||||
|
@ -5589,8 +5589,8 @@ u32 writeEagerQueueIter(const set<u32> &eager, u32 leftfixBeginQueue,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
aligned_unique_ptr<RoseEngine> addSmallWriteEngine(const RoseBuildImpl &build,
|
bytecode_ptr<RoseEngine> addSmallWriteEngine(const RoseBuildImpl &build,
|
||||||
aligned_unique_ptr<RoseEngine> rose) {
|
bytecode_ptr<RoseEngine> rose) {
|
||||||
assert(rose);
|
assert(rose);
|
||||||
|
|
||||||
if (roseIsPureLiteral(rose.get())) {
|
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 smwrOffset = ROUNDUP_CL(mainSize);
|
||||||
const size_t newSize = smwrOffset + smallWriteSize;
|
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();
|
char *ptr = (char *)rose2.get();
|
||||||
memcpy(ptr, rose.get(), mainSize);
|
memcpy(ptr, rose.get(), mainSize);
|
||||||
memcpy(ptr + smwrOffset, smwr_engine.get(), smallWriteSize);
|
memcpy(ptr + smwrOffset, smwr_engine.get(), smallWriteSize);
|
||||||
@ -5709,7 +5709,7 @@ map<left_id, u32> makeLeftQueueMap(const RoseGraph &g,
|
|||||||
return lqm;
|
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
|
// 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
|
// will copy into the real one once it is allocated: we can't do this
|
||||||
// until we know how big it will be.
|
// until we know how big it will be.
|
||||||
@ -5963,8 +5963,8 @@ aligned_unique_ptr<RoseEngine> RoseBuildImpl::buildFinalEngine(u32 minWidth) {
|
|||||||
|
|
||||||
proto.size = currOffset;
|
proto.size = currOffset;
|
||||||
|
|
||||||
// Time to allocate the real RoseEngine structure.
|
// Time to allocate the real RoseEngine structure, at cacheline alignment.
|
||||||
auto engine = aligned_zmalloc_unique<RoseEngine>(currOffset);
|
auto engine = make_bytecode_ptr<RoseEngine>(currOffset, 64);
|
||||||
assert(engine); // will have thrown bad_alloc otherwise.
|
assert(engine); // will have thrown bad_alloc otherwise.
|
||||||
|
|
||||||
// Copy in our prototype engine data.
|
// Copy in our prototype engine data.
|
||||||
|
@ -1668,7 +1668,7 @@ bool roleOffsetsAreValid(const RoseGraph &g) {
|
|||||||
}
|
}
|
||||||
#endif // NDEBUG
|
#endif // NDEBUG
|
||||||
|
|
||||||
aligned_unique_ptr<RoseEngine> RoseBuildImpl::buildRose(u32 minWidth) {
|
bytecode_ptr<RoseEngine> RoseBuildImpl::buildRose(u32 minWidth) {
|
||||||
dumpRoseGraph(*this, "rose_early.dot");
|
dumpRoseGraph(*this, "rose_early.dot");
|
||||||
|
|
||||||
// Early check for Rose implementability.
|
// Early check for Rose implementability.
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
#include "nfa/nfa_internal.h"
|
#include "nfa/nfa_internal.h"
|
||||||
#include "nfagraph/ng_holder.h"
|
#include "nfagraph/ng_holder.h"
|
||||||
#include "nfagraph/ng_revacc.h"
|
#include "nfagraph/ng_revacc.h"
|
||||||
#include "util/alloc.h"
|
#include "util/bytecode_ptr.h"
|
||||||
#include "util/order_check.h"
|
#include "util/order_check.h"
|
||||||
#include "util/queue_index_factory.h"
|
#include "util/queue_index_factory.h"
|
||||||
#include "util/ue2_containers.h"
|
#include "util/ue2_containers.h"
|
||||||
@ -471,8 +471,8 @@ public:
|
|||||||
bool eod) override;
|
bool eod) override;
|
||||||
|
|
||||||
// Construct a runtime implementation.
|
// Construct a runtime implementation.
|
||||||
aligned_unique_ptr<RoseEngine> buildRose(u32 minWidth) override;
|
bytecode_ptr<RoseEngine> buildRose(u32 minWidth) override;
|
||||||
aligned_unique_ptr<RoseEngine> buildFinalEngine(u32 minWidth);
|
bytecode_ptr<RoseEngine> buildFinalEngine(u32 minWidth);
|
||||||
|
|
||||||
void setSom() override { hasSom = true; }
|
void setSom() override { hasSom = true; }
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user