[Pcre-svn] [230] code/trunk: Fix JIT compilation of conditio…

トップ ページ
このメッセージを削除
著者: Subversion repository
日付:  
To: pcre-svn
題目: [Pcre-svn] [230] code/trunk: Fix JIT compilation of conditional blocks whose assertion is converted to (*FAIL).
Revision: 230
          http://www.exim.org/viewvc/pcre2?view=rev&revision=230
Author:   zherczeg
Date:     2015-03-24 08:43:52 +0000 (Tue, 24 Mar 2015)


Log Message:
-----------
Fix JIT compilation of conditional blocks whose assertion is converted to (*FAIL).

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


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2015-03-23 15:52:08 UTC (rev 229)
+++ code/trunk/ChangeLog    2015-03-24 08:43:52 UTC (rev 230)
@@ -14,7 +14,10 @@


4. Implemented pcre2_callout_enumerate().

+5. Fix JIT compilation of conditional blocks whose assertion
+ is converted to (*FAIL). E.g: /(?(?!))/.

+
Version 10.10 06-March-2015
---------------------------


Modified: code/trunk/src/pcre2_jit_compile.c
===================================================================
--- code/trunk/src/pcre2_jit_compile.c    2015-03-23 15:52:08 UTC (rev 229)
+++ code/trunk/src/pcre2_jit_compile.c    2015-03-24 08:43:52 UTC (rev 230)
@@ -7044,7 +7044,7 @@
   {
   SLJIT_COMPILE_ASSERT(OP_DNRREF == OP_RREF + 1 && OP_FALSE == OP_RREF + 2 && OP_TRUE == OP_RREF + 3,
     compile_time_checks_must_be_grouped_together);
-  has_alternatives = (*matchingpath >= OP_RREF && *matchingpath <= OP_TRUE) ? FALSE : TRUE;
+  has_alternatives = ((*matchingpath >= OP_RREF && *matchingpath <= OP_TRUE) || *matchingpath == OP_FAIL) ? FALSE : TRUE;
   }


 if (SLJIT_UNLIKELY(opcode == OP_COND) && (*cc == OP_KETRMAX || *cc == OP_KETRMIN))
@@ -7303,7 +7303,7 @@
     add_jump(compiler, &(BACKTRACK_AS(bracket_backtrack)->u.condfailed), JUMP(SLJIT_ZERO));
     matchingpath += 1 + 2 * IMM2_SIZE;
     }
-  else if (*matchingpath >= OP_RREF && *matchingpath <= OP_TRUE)
+  else if ((*matchingpath >= OP_RREF && *matchingpath <= OP_TRUE) || *matchingpath == OP_FAIL)
     {
     /* Never has other case. */
     BACKTRACK_AS(bracket_backtrack)->u.condfailed = NULL;
@@ -7314,7 +7314,7 @@
       stacksize = 1;
       matchingpath++;
       }
-    else if (*matchingpath == OP_FALSE)
+    else if (*matchingpath == OP_FALSE || *matchingpath == OP_FAIL)
       stacksize = 0;
     else if (*matchingpath == OP_RREF)
       {


Modified: code/trunk/src/pcre2_jit_test.c
===================================================================
--- code/trunk/src/pcre2_jit_test.c    2015-03-23 15:52:08 UTC (rev 229)
+++ code/trunk/src/pcre2_jit_test.c    2015-03-24 08:43:52 UTC (rev 230)
@@ -647,6 +647,9 @@
     { MU, A, 0, 0, "(?P<Name>a)?(?P<Name2>b)?(?(Name)c|d)+?dd", "bcabcacdb bdddd" },
     { MU, A, 0, 0, "(?P<Name>a)?(?P<Name2>b)?(?(Name)c|d)+l", "ababccddabdbccd abcccl" },
     { MU, A, 0, 0, "((?:a|aa)(?(1)aaa))x", "aax" },
+    { MU, A, 0, 0, "(?(?!)a|b)", "ab" },
+    { MU, A, 0, 0, "(?(?!)a)", "ab" },
+    { MU, A, 0, 0 | F_NOMATCH, "(?(?!)a|b)", "ac" },


     /* Set start of match. */
     { MU, A, 0, 0, "(?:\\Ka)*aaaab", "aaaaaaaa aaaaaaabb" },