rose: use bytecode_ptr<RoseEngine>

This commit is contained in:
Justin Viiret 2017-03-31 13:22:04 +11:00 committed by Matthew Barr
parent 73ef7f1e44
commit 813f1e3fb9
5 changed files with 14 additions and 14 deletions

View 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);

View 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;

View 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.

View 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.

View 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; }