return dfas;
}
-aligned_unique_ptr<anchored_matcher_info>
+bytecode_ptr<anchored_matcher_info>
buildAnchoredMatcher(RoseBuildImpl &build, const vector<LitFragment> &fragments,
- vector<raw_dfa> &dfas, size_t *asize) {
+ vector<raw_dfa> &dfas) {
const CompileContext &cc = build.cc;
if (dfas.empty()) {
DEBUG_PRINTF("empty\n");
- *asize = 0;
return nullptr;
}
throw ResourceLimitError();
}
- *asize = total_size;
- auto atable = aligned_zmalloc_unique<anchored_matcher_info>(total_size);
+ auto atable = make_bytecode_ptr<anchored_matcher_info>(total_size, 64);
char *curr = (char *)atable.get();
u32 state_offset = 0;
ami->anchoredMinDistance = start_offset[i];
}
- DEBUG_PRINTF("success %zu\n", *asize);
+ DEBUG_PRINTF("success %zu\n", atable.size());
return atable;
}
#include "ue2common.h"
#include "rose_build_impl.h"
#include "nfagraph/ng_holder.h"
-#include "util/alloc.h"
+#include "util/bytecode_ptr.h"
#include <map>
#include <vector>
* Remap the literal final_ids used for raw_dfa reports to the program offsets
* given in litPrograms.
*/
-aligned_unique_ptr<anchored_matcher_info>
+bytecode_ptr<anchored_matcher_info>
buildAnchoredMatcher(RoseBuildImpl &build,
const std::vector<LitFragment> &fragments,
- std::vector<raw_dfa> &dfas, size_t *asize);
+ std::vector<raw_dfa> &dfas);
u32 anchoredStateSize(const anchored_matcher_info &atable);
writeLeftInfo(bc.engine_blob, proto, leftInfoTable);
// Build anchored matcher.
- size_t asize = 0;
- auto atable = buildAnchoredMatcher(*this, fragments, anchored_dfas, &asize);
+ auto atable = buildAnchoredMatcher(*this, fragments, anchored_dfas);
if (atable) {
- proto.amatcherOffset = bc.engine_blob.add(atable.get(), asize, 64);
+ proto.amatcherOffset = bc.engine_blob.add(atable);
}
// Build floating HWLM matcher.
proto.initialGroups = getInitialGroups();
proto.floating_group_mask = fgroups;
proto.totalNumLiterals = verify_u32(literal_info.size());
- proto.asize = verify_u32(asize);
+ proto.asize = verify_u32(atable.size());
proto.ematcherRegionSize = ematcher_region_size;
proto.longLitStreamState = verify_u32(longLitStreamStateRequired);