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);
}
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;
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.
*
/* 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);
}
// 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) {
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;
}
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()) {
return nullptr;
}
+ for (const hwlmLiteral &hlit : fl) {
+ *fgroups |= hlit.groups;
+ }
+
hwlmStreamingControl ctl;
hwlmStreamingControl *ctlp;
if (build.cc.streaming) {
rose_literal_table table);
aligned_unique_ptr<HWLM> buildFloatingMatcher(const RoseBuildImpl &build,
+ rose_group *fgroups,
size_t *fsize,
size_t *historyRequired,
size_t *streamStateRequired);
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");
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);
* 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.
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;
}
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: