mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
engine_blob: add_range() member function
This commit is contained in:
parent
10aa806d67
commit
6013fb1546
@ -2352,7 +2352,7 @@ vector<u32> buildSuffixEkeyLists(const RoseBuildImpl &build, build_context &bc,
|
|||||||
auto &ekeys = e.second;
|
auto &ekeys = e.second;
|
||||||
assert(!ekeys.empty());
|
assert(!ekeys.empty());
|
||||||
ekeys.push_back(INVALID_EKEY); /* terminator */
|
ekeys.push_back(INVALID_EKEY); /* terminator */
|
||||||
out[qi] = bc.engine_blob.add(ekeys.begin(), ekeys.end());
|
out[qi] = bc.engine_blob.add_range(ekeys);
|
||||||
}
|
}
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
@ -2448,8 +2448,7 @@ void addSomRevNfas(build_context &bc, RoseEngine &proto,
|
|||||||
}
|
}
|
||||||
|
|
||||||
proto.somRevCount = verify_u32(nfas.size());
|
proto.somRevCount = verify_u32(nfas.size());
|
||||||
proto.somRevOffsetOffset =
|
proto.somRevOffsetOffset = bc.engine_blob.add_range(nfa_offsets);
|
||||||
bc.engine_blob.add(begin(nfa_offsets), end(nfa_offsets));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
@ -2678,17 +2677,15 @@ void writeLookaroundTables(build_context &bc, RoseEngine &proto) {
|
|||||||
reach += REACH_BITVECTOR_LEN;
|
reach += REACH_BITVECTOR_LEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
proto.lookaroundTableOffset =
|
proto.lookaroundTableOffset = bc.engine_blob.add_range(look_table);
|
||||||
bc.engine_blob.add(begin(look_table), end(look_table));
|
proto.lookaroundReachOffset = bc.engine_blob.add_range(reach_table);
|
||||||
proto.lookaroundReachOffset =
|
|
||||||
bc.engine_blob.add(begin(reach_table), end(reach_table));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
void writeDkeyInfo(const ReportManager &rm, build_context &bc,
|
void writeDkeyInfo(const ReportManager &rm, build_context &bc,
|
||||||
RoseEngine &proto) {
|
RoseEngine &proto) {
|
||||||
const auto inv_dkeys = rm.getDkeyToReportTable();
|
const auto inv_dkeys = rm.getDkeyToReportTable();
|
||||||
proto.invDkeyOffset = bc.engine_blob.add(begin(inv_dkeys), end(inv_dkeys));
|
proto.invDkeyOffset = bc.engine_blob.add_range(inv_dkeys);
|
||||||
proto.dkeyCount = rm.numDkeys();
|
proto.dkeyCount = rm.numDkeys();
|
||||||
proto.dkeyLogSize = fatbit_size(proto.dkeyCount);
|
proto.dkeyLogSize = fatbit_size(proto.dkeyCount);
|
||||||
}
|
}
|
||||||
@ -2696,8 +2693,7 @@ void writeDkeyInfo(const ReportManager &rm, build_context &bc,
|
|||||||
static
|
static
|
||||||
void writeLeftInfo(build_context &bc, RoseEngine &proto,
|
void writeLeftInfo(build_context &bc, RoseEngine &proto,
|
||||||
const vector<LeftNfaInfo> &leftInfoTable) {
|
const vector<LeftNfaInfo> &leftInfoTable) {
|
||||||
proto.leftOffset =
|
proto.leftOffset = bc.engine_blob.add_range(leftInfoTable);
|
||||||
bc.engine_blob.add(begin(leftInfoTable), end(leftInfoTable));
|
|
||||||
proto.activeLeftIterOffset = writeActiveLeftIter(bc, leftInfoTable);
|
proto.activeLeftIterOffset = writeActiveLeftIter(bc, leftInfoTable);
|
||||||
proto.roseCount = verify_u32(leftInfoTable.size());
|
proto.roseCount = verify_u32(leftInfoTable.size());
|
||||||
proto.activeLeftCount = verify_u32(leftInfoTable.size());
|
proto.activeLeftCount = verify_u32(leftInfoTable.size());
|
||||||
@ -2744,7 +2740,7 @@ void writeNfaInfo(const RoseBuildImpl &build, build_context &bc,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
proto.nfaInfoOffset = bc.engine_blob.add(begin(infos), end(infos));
|
proto.nfaInfoOffset = bc.engine_blob.add_range(infos);
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
@ -3994,8 +3990,7 @@ void buildLeftInfoTable(const RoseBuildImpl &tbi, build_context &bc,
|
|||||||
|
|
||||||
if (hasUsefulStops(lbi)) {
|
if (hasUsefulStops(lbi)) {
|
||||||
assert(lbi.stopAlphabet.size() == N_CHARS);
|
assert(lbi.stopAlphabet.size() == N_CHARS);
|
||||||
left.stopTable = bc.engine_blob.add(lbi.stopAlphabet.begin(),
|
left.stopTable = bc.engine_blob.add_range(lbi.stopAlphabet);
|
||||||
lbi.stopAlphabet.end());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(lbi.countingMiracleOffset || !lbi.countingMiracleCount);
|
assert(lbi.countingMiracleOffset || !lbi.countingMiracleCount);
|
||||||
@ -4791,8 +4786,7 @@ pair<u32, u32> writeDelayPrograms(RoseBuildImpl &build, build_context &bc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_PRINTF("%zu delay programs\n", programs.size());
|
DEBUG_PRINTF("%zu delay programs\n", programs.size());
|
||||||
return {bc.engine_blob.add(begin(programs), end(programs)),
|
return {bc.engine_blob.add_range(programs), verify_u32(programs.size())};
|
||||||
verify_u32(programs.size())};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -4850,8 +4844,7 @@ pair<u32, u32> writeAnchoredPrograms(RoseBuildImpl &build, build_context &bc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_PRINTF("%zu anchored programs\n", programs.size());
|
DEBUG_PRINTF("%zu anchored programs\n", programs.size());
|
||||||
return {bc.engine_blob.add(begin(programs), end(programs)),
|
return {bc.engine_blob.add_range(programs), verify_u32(programs.size())};
|
||||||
verify_u32(programs.size())};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -4900,7 +4893,7 @@ pair<u32, u32> buildReportPrograms(RoseBuildImpl &build, build_context &bc) {
|
|||||||
programs.back(), program.size());
|
programs.back(), program.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 offset = bc.engine_blob.add(begin(programs), end(programs));
|
u32 offset = bc.engine_blob.add_range(programs);
|
||||||
u32 count = verify_u32(programs.size());
|
u32 count = verify_u32(programs.size());
|
||||||
return {offset, count};
|
return {offset, count};
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2016, Intel Corporation
|
* Copyright (c) 2016-2017, Intel Corporation
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are met:
|
* modification, are permitted provided that the following conditions are met:
|
||||||
@ -106,6 +106,11 @@ public:
|
|||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename Range>
|
||||||
|
u32 add_range(const Range &range) {
|
||||||
|
return add(begin(range), end(range));
|
||||||
|
}
|
||||||
|
|
||||||
u32 add_iterator(const std::vector<mmbit_sparse_iter> &iter) {
|
u32 add_iterator(const std::vector<mmbit_sparse_iter> &iter) {
|
||||||
auto cache_it = cached_iters.find(iter);
|
auto cache_it = cached_iters.find(iter);
|
||||||
if (cache_it != cached_iters.end()) {
|
if (cache_it != cached_iters.end()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user