mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-06-28 16:41:01 +03:00
block: unify roseBlockExec and roseBlockExec_i
This commit is contained in:
parent
513ac11dbc
commit
66e0b77aa4
@ -266,13 +266,28 @@ int roseBlockFloating(const struct RoseEngine *t, struct hs_scratch *scratch) {
|
|||||||
return can_stop_matching(scratch);
|
return can_stop_matching(scratch);
|
||||||
}
|
}
|
||||||
|
|
||||||
void roseBlockExec_i(const struct RoseEngine *t, struct hs_scratch *scratch) {
|
void roseBlockExec(const struct RoseEngine *t, struct hs_scratch *scratch) {
|
||||||
assert(t);
|
assert(t);
|
||||||
assert(scratch);
|
assert(scratch);
|
||||||
assert(scratch->core_info.buf);
|
assert(scratch->core_info.buf);
|
||||||
assert(mmbit_sparse_iter_state_size(t->rolesWithStateCount)
|
assert(mmbit_sparse_iter_state_size(t->rolesWithStateCount)
|
||||||
< MAX_SPARSE_ITER_STATES);
|
< MAX_SPARSE_ITER_STATES);
|
||||||
|
|
||||||
|
// We should not have been called if we've already been told to terminate
|
||||||
|
// matching.
|
||||||
|
assert(!told_to_stop_matching(scratch));
|
||||||
|
|
||||||
|
// If this block is shorter than our minimum width, then no pattern in this
|
||||||
|
// RoseEngine could match.
|
||||||
|
/* minWidth checks should have already been performed by the caller */
|
||||||
|
assert(scratch->core_info.len >= t->minWidth);
|
||||||
|
|
||||||
|
// Similarly, we may have a maximum width (for engines constructed entirely
|
||||||
|
// of bi-anchored patterns).
|
||||||
|
/* This check is now handled by the interpreter */
|
||||||
|
assert(t->maxBiAnchoredWidth == ROSE_BOUND_INF
|
||||||
|
|| scratch->core_info.len <= t->maxBiAnchoredWidth);
|
||||||
|
|
||||||
const size_t length = scratch->core_info.len;
|
const size_t length = scratch->core_info.len;
|
||||||
|
|
||||||
// We have optimizations for small block scans: we run a single coalesced
|
// We have optimizations for small block scans: we run a single coalesced
|
||||||
|
@ -29,42 +29,16 @@
|
|||||||
#ifndef ROSE_H
|
#ifndef ROSE_H
|
||||||
#define ROSE_H
|
#define ROSE_H
|
||||||
|
|
||||||
#include "rose_types.h"
|
|
||||||
#include "rose_internal.h"
|
|
||||||
#include "runtime.h"
|
|
||||||
#include "scratch.h"
|
|
||||||
#include "ue2common.h"
|
#include "ue2common.h"
|
||||||
#include "util/multibit.h"
|
|
||||||
|
struct RoseEngine;
|
||||||
|
struct hs_scratch;
|
||||||
|
|
||||||
// Initialise state space for engine use.
|
// Initialise state space for engine use.
|
||||||
void roseInitState(const struct RoseEngine *t, char *state);
|
void roseInitState(const struct RoseEngine *t, char *state);
|
||||||
|
|
||||||
void roseBlockExec_i(const struct RoseEngine *t, struct hs_scratch *scratch);
|
|
||||||
|
|
||||||
/* assumes core_info in scratch has been init to point to data */
|
/* assumes core_info in scratch has been init to point to data */
|
||||||
static really_inline
|
void roseBlockExec(const struct RoseEngine *t, struct hs_scratch *scratch);
|
||||||
void roseBlockExec(const struct RoseEngine *t, struct hs_scratch *scratch) {
|
|
||||||
assert(t);
|
|
||||||
assert(scratch);
|
|
||||||
assert(scratch->core_info.buf);
|
|
||||||
|
|
||||||
// We should not have been called if we've already been told to terminate
|
|
||||||
// matching.
|
|
||||||
assert(!told_to_stop_matching(scratch));
|
|
||||||
|
|
||||||
// If this block is shorter than our minimum width, then no pattern in this
|
|
||||||
// RoseEngine could match.
|
|
||||||
/* minWidth checks should have already been performed by the caller */
|
|
||||||
assert(scratch->core_info.len >= t->minWidth);
|
|
||||||
|
|
||||||
// Similarly, we may have a maximum width (for engines constructed entirely
|
|
||||||
// of bi-anchored patterns).
|
|
||||||
/* This check is now handled by the interpreter */
|
|
||||||
assert(t->maxBiAnchoredWidth == ROSE_BOUND_INF
|
|
||||||
|| scratch->core_info.len <= t->maxBiAnchoredWidth);
|
|
||||||
|
|
||||||
roseBlockExec_i(t, scratch);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* assumes core_info in scratch has been init to point to data */
|
/* assumes core_info in scratch has been init to point to data */
|
||||||
void roseStreamExec(const struct RoseEngine *t, struct hs_scratch *scratch);
|
void roseStreamExec(const struct RoseEngine *t, struct hs_scratch *scratch);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user