DEBUG_PRINTF("This DFA %s die so effective number of states is %zu\n",
info.can_die ? "can" : "cannot", info.size());
if (info.size() > 16) {
-#if defined(HAVE_AVX512VBMI)
- if (info.size() > 32) {
- DEBUG_PRINTF("Too many states\n");
- return nullptr;
- }
- return shengCompile_int<sheng32>(raw, cc, accel_states, strat, info);
-#else
DEBUG_PRINTF("Too many states\n");
return nullptr;
-#endif
}
return shengCompile_int<sheng>(raw, cc, accel_states, strat, info);
}
+#if defined(HAVE_AVX512VBMI)
+bytecode_ptr<NFA> sheng32Compile(raw_dfa &raw, const CompileContext &cc,
+ const ReportManager &rm, bool only_accel_init,
+ set<dstate_id_t> *accel_states) {
+ if (!cc.grey.allowSheng) {
+ DEBUG_PRINTF("Sheng is not allowed!\n");
+ return nullptr;
+ }
+
+ sheng_build_strat strat(raw, rm, only_accel_init);
+ dfa_info info(strat);
+
+ DEBUG_PRINTF("Trying to compile a %zu state Sheng\n", raw.states.size());
+
+ DEBUG_PRINTF("Anchored start state id: %u, floating start state id: %u\n",
+ raw.start_anchored, raw.start_floating);
+
+ DEBUG_PRINTF("This DFA %s die so effective number of states is %zu\n",
+ info.can_die ? "can" : "cannot", info.size());
+ assert(info.size() > 16);
+ if (info.size() > 32) {
+ DEBUG_PRINTF("Too many states\n");
+ return nullptr;
+ }
+
+ return shengCompile_int<sheng32>(raw, cc, accel_states, strat, info);
+}
+#endif
+
} // namespace ue2
const ReportManager &rm, bool only_accel_init,
std::set<dstate_id_t> *accel_states = nullptr);
+#if defined(HAVE_AVX512VBMI)
+bytecode_ptr<NFA> sheng32Compile(raw_dfa &raw, const CompileContext &cc,
+ const ReportManager &rm, bool only_accel_init,
+ std::set<dstate_id_t> *accel_states = nullptr);
+#endif
+
struct sheng_escape_info {
CharReach outs;
CharReach outs2_single;
* bytecode and that they are usually run on small blocks */
dfa = mcshengCompile(rdfa, cc, rm);
}
+#if defined(HAVE_AVX512VBMI)
+ if (!dfa) {
+ dfa = sheng32Compile(rdfa, cc, rm, false);
+ }
+#endif
if (!dfa) {
// Sheng wasn't successful, so unleash McClellan!
dfa = mcclellanCompile(rdfa, cc, rm, false);
bytecode_ptr<NFA> dfa = nullptr;
if (cc.grey.allowSmallWriteSheng) {
dfa = shengCompile(rdfa, cc, rm, only_accel_init, &accel_states);
+#if defined(HAVE_AVX512VBMI)
+ if (!dfa) {
+ dfa = sheng32Compile(rdfa, cc, rm, only_accel_init, &accel_states);
+ }
+#endif
}
if (!dfa) {
dfa = mcclellanCompile(rdfa, cc, rm, only_accel_init,