mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
only show floating groups to the floating table
This commit is contained in:
parent
1c2b0a271d
commit
575e8c06dc
@ -260,8 +260,8 @@ int roseBlockFloating(const struct RoseEngine *t, struct hs_scratch *scratch) {
|
||||
|
||||
DEBUG_PRINTF("BEGIN FLOATING (over %zu/%zu)\n", flen, length);
|
||||
DEBUG_PRINTF("-- %016llx\n", tctxt->groups);
|
||||
hwlmExec(ftable, buffer, flen, t->floatingMinDistance, roseCallback,
|
||||
scratch, tctxt->groups);
|
||||
hwlmExec(ftable, buffer, flen, t->floatingMinDistance, roseFloatingCallback,
|
||||
scratch, tctxt->groups & t->floating_group_mask);
|
||||
|
||||
return can_stop_matching(scratch);
|
||||
}
|
||||
|
@ -516,7 +516,8 @@ anchored_leftovers:;
|
||||
return rv;
|
||||
}
|
||||
|
||||
hwlmcb_rv_t roseCallback(size_t start, size_t end, u32 id, void *ctxt) {
|
||||
static really_inline
|
||||
hwlmcb_rv_t roseCallback_i(size_t start, size_t end, u32 id, void *ctxt) {
|
||||
struct hs_scratch *scratch = ctxt;
|
||||
struct RoseContext *tctx = &scratch->tctxt;
|
||||
const struct RoseEngine *t = scratch->core_info.rose;
|
||||
@ -564,6 +565,17 @@ hwlmcb_rv_t roseCallback(size_t start, size_t end, u32 id, void *ctxt) {
|
||||
return HWLM_TERMINATE_MATCHING;
|
||||
}
|
||||
|
||||
hwlmcb_rv_t roseCallback(size_t start, size_t end, u32 id, void *ctxt) {
|
||||
return roseCallback_i(start, end, id, ctxt);
|
||||
}
|
||||
|
||||
hwlmcb_rv_t roseFloatingCallback(size_t start, size_t end, u32 id, void *ctxt) {
|
||||
struct hs_scratch *scratch = ctxt;
|
||||
const struct RoseEngine *t = scratch->core_info.rose;
|
||||
|
||||
return roseCallback_i(start, end, id, ctxt) & t->floating_group_mask;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Match callback adaptor used for matches from pure-literal cases.
|
||||
*
|
||||
|
@ -51,6 +51,7 @@ int roseNfaSomAdaptor(u64a from_offset, u64a offset, ReportID id, void *context)
|
||||
/* Callbacks, defined in match.c */
|
||||
|
||||
hwlmcb_rv_t roseCallback(size_t start, size_t end, u32 id, void *ctx);
|
||||
hwlmcb_rv_t roseFloatingCallback(size_t start, size_t end, u32 id, void *ctx);
|
||||
hwlmcb_rv_t roseDelayRebuildCallback(size_t start, size_t end, u32 id,
|
||||
void *ctx);
|
||||
int roseAnchoredCallback(u64a end, u32 id, void *ctx);
|
||||
|
@ -4370,9 +4370,10 @@ aligned_unique_ptr<RoseEngine> RoseBuildImpl::buildFinalEngine(u32 minWidth) {
|
||||
}
|
||||
|
||||
// Build floating HWLM matcher.
|
||||
rose_group fgroups = 0;
|
||||
size_t fsize = 0;
|
||||
size_t floatingStreamStateRequired = 0;
|
||||
auto ftable = buildFloatingMatcher(*this, &fsize, &historyRequired,
|
||||
auto ftable = buildFloatingMatcher(*this, &fgroups, &fsize, &historyRequired,
|
||||
&floatingStreamStateRequired);
|
||||
u32 fmatcherOffset = 0;
|
||||
if (ftable) {
|
||||
@ -4584,6 +4585,7 @@ aligned_unique_ptr<RoseEngine> RoseBuildImpl::buildFinalEngine(u32 minWidth) {
|
||||
fillMatcherDistances(*this, engine.get());
|
||||
|
||||
engine->initialGroups = getInitialGroups();
|
||||
engine->floating_group_mask = fgroups;
|
||||
engine->totalNumLiterals = verify_u32(literal_info.size());
|
||||
engine->asize = verify_u32(asize);
|
||||
engine->ematcherRegionSize = ematcher_region_size;
|
||||
|
@ -580,10 +580,12 @@ vector<hwlmLiteral> fillHamsterLiteralList(const RoseBuildImpl &build,
|
||||
}
|
||||
|
||||
aligned_unique_ptr<HWLM> buildFloatingMatcher(const RoseBuildImpl &build,
|
||||
rose_group *fgroups,
|
||||
size_t *fsize,
|
||||
size_t *historyRequired,
|
||||
size_t *streamStateRequired) {
|
||||
*fsize = 0;
|
||||
*fgroups = 0;
|
||||
|
||||
auto fl = fillHamsterLiteralList(build, ROSE_FLOATING);
|
||||
if (fl.empty()) {
|
||||
@ -591,6 +593,10 @@ aligned_unique_ptr<HWLM> buildFloatingMatcher(const RoseBuildImpl &build,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
for (const hwlmLiteral &hlit : fl) {
|
||||
*fgroups |= hlit.groups;
|
||||
}
|
||||
|
||||
hwlmStreamingControl ctl;
|
||||
hwlmStreamingControl *ctlp;
|
||||
if (build.cc.streaming) {
|
||||
|
@ -48,6 +48,7 @@ std::vector<hwlmLiteral> fillHamsterLiteralList(const RoseBuildImpl &build,
|
||||
rose_literal_table table);
|
||||
|
||||
aligned_unique_ptr<HWLM> buildFloatingMatcher(const RoseBuildImpl &build,
|
||||
rose_group *fgroups,
|
||||
size_t *fsize,
|
||||
size_t *historyRequired,
|
||||
size_t *streamStateRequired);
|
||||
|
@ -930,6 +930,7 @@ void roseDumpText(const RoseEngine *t, FILE *f) {
|
||||
fprintf(f, "\n");
|
||||
|
||||
fprintf(f, "initial groups : 0x%016llx\n", t->initialGroups);
|
||||
fprintf(f, "floating groups : 0x%016llx\n", t->floating_group_mask);
|
||||
fprintf(f, "handled key count : %u\n", t->handledKeyCount);
|
||||
fprintf(f, "\n");
|
||||
|
||||
@ -1035,6 +1036,7 @@ void roseDumpStructRaw(const RoseEngine *t, FILE *f) {
|
||||
DUMP_U32(t, floatingMinLiteralMatchOffset);
|
||||
DUMP_U32(t, nfaInfoOffset);
|
||||
DUMP_U64(t, initialGroups);
|
||||
DUMP_U64(t, floating_group_mask);
|
||||
DUMP_U32(t, size);
|
||||
DUMP_U32(t, delay_count);
|
||||
DUMP_U32(t, delay_base_id);
|
||||
|
@ -401,6 +401,7 @@ struct RoseEngine {
|
||||
* table */
|
||||
u32 nfaInfoOffset; /* offset to the nfa info offset array */
|
||||
rose_group initialGroups;
|
||||
rose_group floating_group_mask; /* groups that are used by the ftable */
|
||||
u32 size; // (bytes)
|
||||
u32 delay_count; /* number of delayed literal ids. */
|
||||
u32 delay_base_id; /* literal id of the first delayed literal.
|
||||
|
@ -461,8 +461,8 @@ void roseStreamExec(const struct RoseEngine *t, struct hs_scratch *scratch) {
|
||||
tctxt->minMatchOffset = offset;
|
||||
tctxt->minNonMpvMatchOffset = offset;
|
||||
tctxt->next_mpv_offset = 0;
|
||||
DEBUG_PRINTF("BEGIN: history len=%zu, buffer len=%zu\n",
|
||||
scratch->core_info.hlen, scratch->core_info.len);
|
||||
DEBUG_PRINTF("BEGIN: history len=%zu, buffer len=%zu groups=%016llx\n",
|
||||
scratch->core_info.hlen, scratch->core_info.len, tctxt->groups);
|
||||
|
||||
fatbit_clear(scratch->aqa);
|
||||
scratch->al_log_sum = 0;
|
||||
@ -540,8 +540,9 @@ void roseStreamExec(const struct RoseEngine *t, struct hs_scratch *scratch) {
|
||||
}
|
||||
|
||||
DEBUG_PRINTF("BEGIN FLOATING (over %zu/%zu)\n", flen, length);
|
||||
hwlmExecStreaming(ftable, scratch, flen, start, roseCallback, scratch,
|
||||
tctxt->groups, stream_state);
|
||||
hwlmExecStreaming(ftable, scratch, flen, start, roseFloatingCallback,
|
||||
scratch, tctxt->groups & t->floating_group_mask,
|
||||
stream_state);
|
||||
}
|
||||
|
||||
flush_delay_and_exit:
|
||||
|
Loading…
x
Reference in New Issue
Block a user