mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-11-15 17:02:14 +03:00
rose: use program offsets directly in lit tables
This commit is contained in:
committed by
Matthew Barr
parent
ac858cd47c
commit
76f72b6ab4
@@ -637,12 +637,12 @@ u64a literalMinReportOffset(const RoseBuildImpl &build,
|
||||
|
||||
static
|
||||
map<u32, hwlm_group_t> makeFragGroupMap(const RoseBuildImpl &build,
|
||||
const map<u32, u32> &final_to_frag_map) {
|
||||
const map<u32, LitFragment> &final_to_frag_map) {
|
||||
map<u32, hwlm_group_t> frag_to_group;
|
||||
|
||||
for (const auto &m : final_to_frag_map) {
|
||||
u32 final_id = m.first;
|
||||
u32 frag_id = m.second;
|
||||
u32 frag_id = m.second.fragment_id;
|
||||
hwlm_group_t groups = 0;
|
||||
const auto &lits = build.final_id_to_literal.at(final_id);
|
||||
for (auto lit_id : lits) {
|
||||
@@ -665,7 +665,7 @@ void trim_to_suffix(Container &c, size_t len) {
|
||||
}
|
||||
|
||||
MatcherProto makeMatcherProto(const RoseBuildImpl &build,
|
||||
const map<u32, u32> &final_to_frag_map,
|
||||
const map<u32, LitFragment> &final_to_frag_map,
|
||||
rose_literal_table table, bool delay_rebuild,
|
||||
size_t max_len, u32 max_offset) {
|
||||
MatcherProto mp;
|
||||
@@ -758,9 +758,11 @@ MatcherProto makeMatcherProto(const RoseBuildImpl &build,
|
||||
for (auto &lit : mp.lits) {
|
||||
u32 final_id = lit.id;
|
||||
assert(contains(final_to_frag_map, final_id));
|
||||
lit.id = final_to_frag_map.at(final_id);
|
||||
assert(contains(frag_group_map, lit.id));
|
||||
lit.groups = frag_group_map.at(lit.id);
|
||||
const auto &frag = final_to_frag_map.at(final_id);
|
||||
lit.id = delay_rebuild ? frag.delay_program_offset
|
||||
: frag.lit_program_offset;
|
||||
assert(contains(frag_group_map, frag.fragment_id));
|
||||
lit.groups = frag_group_map.at(frag.fragment_id);
|
||||
}
|
||||
|
||||
sort_and_unique(mp.lits);
|
||||
@@ -803,7 +805,7 @@ void buildAccel(const RoseBuildImpl &build, const MatcherProto &mp,
|
||||
|
||||
aligned_unique_ptr<HWLM>
|
||||
buildFloatingMatcher(const RoseBuildImpl &build, size_t longLitLengthThreshold,
|
||||
const map<u32, u32> &final_to_frag_map,
|
||||
const map<u32, LitFragment> &final_to_frag_map,
|
||||
rose_group *fgroups, size_t *fsize,
|
||||
size_t *historyRequired) {
|
||||
*fsize = 0;
|
||||
@@ -841,7 +843,7 @@ buildFloatingMatcher(const RoseBuildImpl &build, size_t longLitLengthThreshold,
|
||||
|
||||
aligned_unique_ptr<HWLM> buildDelayRebuildMatcher(
|
||||
const RoseBuildImpl &build, size_t longLitLengthThreshold,
|
||||
const map<u32, u32> &final_to_frag_map, size_t *drsize) {
|
||||
const map<u32, LitFragment> &final_to_frag_map, size_t *drsize) {
|
||||
*drsize = 0;
|
||||
|
||||
if (!build.cc.streaming) {
|
||||
@@ -871,7 +873,8 @@ aligned_unique_ptr<HWLM> buildDelayRebuildMatcher(
|
||||
|
||||
aligned_unique_ptr<HWLM>
|
||||
buildSmallBlockMatcher(const RoseBuildImpl &build,
|
||||
const map<u32, u32> &final_to_frag_map, size_t *sbsize) {
|
||||
const map<u32, LitFragment> &final_to_frag_map,
|
||||
size_t *sbsize) {
|
||||
*sbsize = 0;
|
||||
|
||||
if (build.cc.streaming) {
|
||||
@@ -931,7 +934,8 @@ buildSmallBlockMatcher(const RoseBuildImpl &build,
|
||||
|
||||
aligned_unique_ptr<HWLM>
|
||||
buildEodAnchoredMatcher(const RoseBuildImpl &build,
|
||||
const map<u32, u32> &final_to_frag_map, size_t *esize) {
|
||||
const map<u32, LitFragment> &final_to_frag_map,
|
||||
size_t *esize) {
|
||||
*esize = 0;
|
||||
|
||||
auto mp = makeMatcherProto(build, final_to_frag_map, ROSE_EOD_ANCHORED,
|
||||
|
||||
Reference in New Issue
Block a user