mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-09-29 19:24:25 +03:00
bytecode_ptr: add make_zeroed_bytecode_ptr
Rather than always zeroing memory.
This commit is contained in:
committed by
Matthew Barr
parent
5653fa55a1
commit
63fe84c3f1
@@ -891,7 +891,8 @@ buildAnchoredMatcher(RoseBuildImpl &build, const vector<LitFragment> &fragments,
|
||||
throw ResourceLimitError();
|
||||
}
|
||||
|
||||
auto atable = make_bytecode_ptr<anchored_matcher_info>(total_size, 64);
|
||||
auto atable =
|
||||
make_zeroed_bytecode_ptr<anchored_matcher_info>(total_size, 64);
|
||||
char *curr = (char *)atable.get();
|
||||
|
||||
u32 state_offset = 0;
|
||||
|
@@ -5612,7 +5612,7 @@ bytecode_ptr<RoseEngine> addSmallWriteEngine(const RoseBuildImpl &build,
|
||||
const size_t smwrOffset = ROUNDUP_CL(mainSize);
|
||||
const size_t newSize = smwrOffset + smallWriteSize;
|
||||
|
||||
auto rose2 = make_bytecode_ptr<RoseEngine>(newSize, 64);
|
||||
auto rose2 = make_zeroed_bytecode_ptr<RoseEngine>(newSize, 64);
|
||||
char *ptr = (char *)rose2.get();
|
||||
memcpy(ptr, rose.get(), mainSize);
|
||||
memcpy(ptr + smwrOffset, smwr_engine.get(), smallWriteSize);
|
||||
@@ -5958,7 +5958,7 @@ bytecode_ptr<RoseEngine> RoseBuildImpl::buildFinalEngine(u32 minWidth) {
|
||||
proto.size = currOffset;
|
||||
|
||||
// Time to allocate the real RoseEngine structure, at cacheline alignment.
|
||||
auto engine = make_bytecode_ptr<RoseEngine>(currOffset, 64);
|
||||
auto engine = make_zeroed_bytecode_ptr<RoseEngine>(currOffset, 64);
|
||||
assert(engine); // will have thrown bad_alloc otherwise.
|
||||
|
||||
// Copy in our prototype engine data.
|
||||
|
Reference in New Issue
Block a user