[Pcre-svn] [287] code/trunk/src/pcre2_jit_compile.c: Improve…

トップ ページ
このメッセージを削除
著者: Subversion repository
日付:  
To: pcre-svn
題目: [Pcre-svn] [287] code/trunk/src/pcre2_jit_compile.c: Improve exact character repeat length check.
Revision: 287
          http://www.exim.org/viewvc/pcre2?view=rev&revision=287
Author:   zherczeg
Date:     2015-06-17 12:32:06 +0100 (Wed, 17 Jun 2015)
Log Message:
-----------
Improve exact character repeat length check.


Modified Paths:
--------------
    code/trunk/src/pcre2_jit_compile.c


Modified: code/trunk/src/pcre2_jit_compile.c
===================================================================
--- code/trunk/src/pcre2_jit_compile.c    2015-06-16 11:37:19 UTC (rev 286)
+++ code/trunk/src/pcre2_jit_compile.c    2015-06-17 11:32:06 UTC (rev 287)
@@ -8079,11 +8079,28 @@
 /* Handle fixed part first. */
 if (exact > 1)
   {
-  OP1(SLJIT_MOV, tmp_base, tmp_offset, SLJIT_IMM, exact);
-  label = LABEL();
-  compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks, TRUE);
-  OP2(SLJIT_SUB | SLJIT_SET_E, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
-  JUMPTO(SLJIT_NOT_ZERO, label);
+  if (common->mode == PCRE2_JIT_COMPLETE
+#ifdef SUPPORT_UNICODE
+      && !common->utf
+#endif
+      )
+    {
+    OP2(SLJIT_ADD, TMP1, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(exact));
+    add_jump(compiler, &backtrack->topbacktracks, CMP(SLJIT_GREATER, TMP1, 0, STR_END, 0));
+    OP1(SLJIT_MOV, tmp_base, tmp_offset, SLJIT_IMM, exact);
+    label = LABEL();
+    compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks, FALSE);
+    OP2(SLJIT_SUB | SLJIT_SET_E, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
+    JUMPTO(SLJIT_NOT_ZERO, label);
+    }
+  else
+    {
+    OP1(SLJIT_MOV, tmp_base, tmp_offset, SLJIT_IMM, exact);
+    label = LABEL();
+    compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks, TRUE);
+    OP2(SLJIT_SUB | SLJIT_SET_E, tmp_base, tmp_offset, tmp_base, tmp_offset, SLJIT_IMM, 1);
+    JUMPTO(SLJIT_NOT_ZERO, label);
+    }
   }
 else if (exact == 1)
   compile_char1_matchingpath(common, type, cc, &backtrack->topbacktracks, TRUE);