literal matchers: change context passed to callback to scratch

This commit is contained in:
Wang, Xiang W
2017-07-04 12:24:11 -04:00
committed by Matthew Barr
parent bc232d272f
commit 67a8f43355
17 changed files with 203 additions and 188 deletions

View File

@@ -66,8 +66,8 @@ void printMatch(const struct core_info *ci, u64a start, u64a end) {
}
#endif
hwlmcb_rv_t roseDelayRebuildCallback(size_t end, u32 id, void *ctx) {
struct hs_scratch *scratch = ctx;
hwlmcb_rv_t roseDelayRebuildCallback(size_t end, u32 id,
struct hs_scratch *scratch) {
struct RoseContext *tctx = &scratch->tctxt;
struct core_info *ci = &scratch->core_info;
const struct RoseEngine *t = ci->rose;
@@ -472,8 +472,7 @@ anchored_leftovers:;
}
static really_inline
hwlmcb_rv_t roseCallback_i(size_t end, u32 id, void *ctxt) {
struct hs_scratch *scratch = ctxt;
hwlmcb_rv_t roseCallback_i(size_t end, u32 id, struct hs_scratch *scratch) {
struct RoseContext *tctx = &scratch->tctxt;
const struct RoseEngine *t = scratch->core_info.rose;
@@ -519,15 +518,15 @@ hwlmcb_rv_t roseCallback_i(size_t end, u32 id, void *ctxt) {
return HWLM_TERMINATE_MATCHING;
}
hwlmcb_rv_t roseCallback(size_t end, u32 id, void *ctxt) {
return roseCallback_i(end, id, ctxt);
hwlmcb_rv_t roseCallback(size_t end, u32 id, struct hs_scratch *scratch) {
return roseCallback_i(end, id, scratch);
}
hwlmcb_rv_t roseFloatingCallback(size_t end, u32 id, void *ctxt) {
struct hs_scratch *scratch = ctxt;
hwlmcb_rv_t roseFloatingCallback(size_t end, u32 id,
struct hs_scratch *scratch) {
const struct RoseEngine *t = scratch->core_info.rose;
return roseCallback_i(end, id, ctxt) & t->floating_group_mask;
return roseCallback_i(end, id, scratch) & t->floating_group_mask;
}
/**

View File

@@ -52,9 +52,11 @@ int roseNfaAdaptor(u64a start, u64a end, ReportID id, void *context);
/* Callbacks, defined in match.c */
hwlmcb_rv_t roseCallback(size_t end, u32 id, void *ctx);
hwlmcb_rv_t roseFloatingCallback(size_t end, u32 id, void *ctx);
hwlmcb_rv_t roseDelayRebuildCallback(size_t end, u32 id, void *ctx);
hwlmcb_rv_t roseCallback(size_t end, u32 id, struct hs_scratch *scratch);
hwlmcb_rv_t roseFloatingCallback(size_t end, u32 id,
struct hs_scratch *scratch);
hwlmcb_rv_t roseDelayRebuildCallback(size_t end, u32 id,
struct hs_scratch *scratch);
int roseAnchoredCallback(u64a start, u64a end, u32 id, void *ctx);
/* Common code, used all over Rose runtime */

View File

@@ -46,7 +46,7 @@ void roseStreamExec(const struct RoseEngine *t, struct hs_scratch *scratch);
void roseStreamEodExec(const struct RoseEngine *t, u64a offset,
struct hs_scratch *scratch);
hwlmcb_rv_t roseCallback(size_t end, u32 id, void *context);
hwlmcb_rv_t roseCallback(size_t end, u32 id, struct hs_scratch *scratch);
int roseReportAdaptor(u64a start, u64a end, ReportID id, void *context);

View File

@@ -659,8 +659,8 @@ void roseStreamExec(const struct RoseEngine *t, struct hs_scratch *scratch) {
DEBUG_PRINTF("start=%zu\n", start);
DEBUG_PRINTF("BEGIN FLOATING (over %zu/%zu)\n", flen, length);
hwlmExecStreaming(ftable, scratch, flen, start, roseFloatingCallback,
scratch, tctxt->groups & t->floating_group_mask);
hwlmExecStreaming(ftable, flen, start, roseFloatingCallback, scratch,
tctxt->groups & t->floating_group_mask);
}
flush_delay_and_exit: