mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-10-02 04:27:42 +03:00
smallwrite: don't recompile the dfa if prune fails
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Intel Corporation
|
||||
* Copyright (c) 2015-2016, Intel Corporation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -317,21 +317,23 @@ aligned_unique_ptr<NFA> prepEngine(raw_dfa &rdfa, u32 roseQuality,
|
||||
}
|
||||
|
||||
if (is_slow(rdfa, accel_states, roseQuality)) {
|
||||
DEBUG_PRINTF("is slow\n");
|
||||
*small_region = cc.grey.smallWriteLargestBufferBad;
|
||||
if (*small_region <= *start_offset) {
|
||||
return nullptr;
|
||||
}
|
||||
prune_overlong(rdfa, *small_region - *start_offset);
|
||||
if (rdfa.start_anchored == DEAD_STATE) {
|
||||
DEBUG_PRINTF("all patterns pruned out\n");
|
||||
return nullptr;
|
||||
}
|
||||
if (prune_overlong(rdfa, *small_region - *start_offset)) {
|
||||
if (rdfa.start_anchored == DEAD_STATE) {
|
||||
DEBUG_PRINTF("all patterns pruned out\n");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nfa = mcclellanCompile(rdfa, cc, &accel_states);
|
||||
if (!nfa) {
|
||||
DEBUG_PRINTF("mcclellan compile failed for smallwrite NFA\n");
|
||||
assert(0); /* we were able to build orig dfa but not the trimmed? */
|
||||
return nullptr;
|
||||
nfa = mcclellanCompile(rdfa, cc, &accel_states);
|
||||
if (!nfa) {
|
||||
DEBUG_PRINTF("mcclellan compile failed for smallwrite NFA\n");
|
||||
assert(0); /* able to build orig dfa but not the trimmed? */
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
*small_region = cc.grey.smallWriteLargestBuffer;
|
||||
|
Reference in New Issue
Block a user