]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
rose: disable switch optimization for windows
authorWang, Xiang W <xiang.w.wang@intel.com>
Mon, 24 Dec 2018 05:45:59 +0000 (00:45 -0500)
committerChang, Harry <harry.chang@intel.com>
Mon, 21 Jan 2019 01:58:38 +0000 (09:58 +0800)
src/rose/program_runtime.c

index 1c6133baf57f4478ee2a53e0d6f7166e4ced429d..4fffcd86e1d4b68ff0f34e69c8157c714eab1bf0 100644 (file)
@@ -1875,6 +1875,7 @@ hwlmcb_rv_t flushActiveCombinations(const struct RoseEngine *t,
     return HWLM_CONTINUE_MATCHING;
 }
 
+#if !defined(_WIN32)
 #define PROGRAM_CASE(name)                                                     \
     case ROSE_INSTR_##name: {                                                  \
     LABEL_ROSE_INSTR_##name:                                                   \
@@ -1890,6 +1891,21 @@ hwlmcb_rv_t flushActiveCombinations(const struct RoseEngine *t,
 
 #define PROGRAM_NEXT_INSTRUCTION_JUMP                                          \
     goto *(next_instr[*(const u8 *)pc]);
+#else
+#define PROGRAM_CASE(name)                                                     \
+    case ROSE_INSTR_##name: {                                                  \
+        DEBUG_PRINTF("instruction: " #name " (pc=%u)\n",                       \
+                     programOffset + (u32)(pc - pc_base));                     \
+        const struct ROSE_STRUCT_##name *ri =                                  \
+            (const struct ROSE_STRUCT_##name *)pc;
+
+#define PROGRAM_NEXT_INSTRUCTION                                               \
+    pc += ROUNDUP_N(sizeof(*ri), ROSE_INSTR_MIN_ALIGN);                        \
+    break;                                                                     \
+    }
+
+#define PROGRAM_NEXT_INSTRUCTION_JUMP
+#endif
 
 hwlmcb_rv_t roseRunProgram(const struct RoseEngine *t,
                            struct hs_scratch *scratch, u32 programOffset,
@@ -1921,6 +1937,7 @@ hwlmcb_rv_t roseRunProgram(const struct RoseEngine *t,
 
     assert(*(const u8 *)pc != ROSE_INSTR_END);
 
+#if !defined(_WIN32)
     static const void *next_instr[] = {
         &&LABEL_ROSE_INSTR_END,               //!< End of program.
         &&LABEL_ROSE_INSTR_ANCHORED_DELAY,    //!< Delay until after anchored matcher.
@@ -1989,6 +2006,7 @@ hwlmcb_rv_t roseRunProgram(const struct RoseEngine *t,
         &&LABEL_ROSE_INSTR_FLUSH_COMBINATION,
         &&LABEL_ROSE_INSTR_SET_EXHAUST
     };
+#endif
 
     for (;;) {
         assert(ISALIGNED_N(pc, ROSE_INSTR_MIN_ALIGN));