[Pcre-svn] [1230] code/trunk: Follow ucp changes in JIT.

Kezdőlap
Üzenet törlése
Szerző: Subversion repository
Dátum:  
Címzett: pcre-svn
Tárgy: [Pcre-svn] [1230] code/trunk: Follow ucp changes in JIT.
Revision: 1230
          http://www.exim.org/viewvc/pcre2?view=rev&revision=1230
Author:   zherczeg
Date:     2020-02-26 10:18:43 +0000 (Wed, 26 Feb 2020)
Log Message:
-----------
Follow ucp changes in JIT.


Modified Paths:
--------------
    code/trunk/src/pcre2_jit_compile.c
    code/trunk/testdata/testinput10
    code/trunk/testdata/testinput12
    code/trunk/testdata/testoutput10
    code/trunk/testdata/testoutput12-16
    code/trunk/testdata/testoutput12-32


Modified: code/trunk/src/pcre2_jit_compile.c
===================================================================
--- code/trunk/src/pcre2_jit_compile.c    2020-02-25 16:47:36 UTC (rev 1229)
+++ code/trunk/src/pcre2_jit_compile.c    2020-02-26 10:18:43 UTC (rev 1230)
@@ -476,7 +476,7 @@
 #ifdef SUPPORT_UNICODE
   BOOL utf;
   BOOL invalid_utf;
-  BOOL use_ucp;
+  BOOL ucp;
   /* Points to saving area for iref. */
   sljit_s32 iref_ptr;
   jump_list *getucd;
@@ -3226,16 +3226,19 @@
 unsigned int c;


 #ifdef SUPPORT_UNICODE
-if (common->utf)
+if (common->utf || common->ucp)
   {
-  GETCHAR(c, cc);
+  if (common->utf)
+    {
+    GETCHAR(c, cc);
+    }
+  else
+    c = *cc;
+
   if (c > 127)
-    {
     return c != UCD_OTHERCASE(c);
-    }
-#if PCRE2_CODE_UNIT_WIDTH != 8
+
   return common->fcc[c] != c;
-#endif
   }
 else
 #endif
@@ -3247,10 +3250,8 @@
 {
 /* Returns with the othercase. */
 #ifdef SUPPORT_UNICODE
-if (common->utf && c > 127)
-  {
+if ((common->utf || common->ucp) && c > 127)
   return UCD_OTHERCASE(c);
-  }
 #endif
 return TABLE_GET(c, common->fcc, c);
 }
@@ -3264,15 +3265,19 @@
 #endif


 #ifdef SUPPORT_UNICODE
-if (common->utf)
+if (common->utf || common->ucp)
   {
-  GETCHAR(c, cc);
+  if (common->utf)
+    {
+    GETCHAR(c, cc);
+    }
+  else
+    c = *cc;
+
   if (c <= 127)
     oc = common->fcc[c];
   else
-    {
     oc = UCD_OTHERCASE(c);
-    }
   }
 else
   {
@@ -5493,7 +5498,12 @@
 #endif
       {
       chr = *cc;
-      othercase[0] = TABLE_GET(chr, common->fcc, chr);
+#ifdef SUPPORT_UNICODE
+      if (common->ucp && chr > 127)
+        othercase[0] = UCD_OTHERCASE(chr);
+      else
+#endif
+        othercase[0] = TABLE_GET(chr, common->fcc, chr);
       }
     }
   else
@@ -5922,8 +5932,8 @@
 if ((common->re->flags & PCRE2_FIRSTCASELESS) != 0)
   {
   oc = TABLE_GET(first_char, common->fcc, first_char);
-#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 8
-  if (first_char > 127 && common->utf)
+#if defined SUPPORT_UNICODE
+  if (first_char > 127 && (common->utf || common->ucp))
     oc = UCD_OTHERCASE(first_char);
 #endif
   }
@@ -6133,8 +6143,8 @@
 if (caseless)
   {
   oc = TABLE_GET(req_char, common->fcc, req_char);
-#if defined SUPPORT_UNICODE && PCRE2_CODE_UNIT_WIDTH != 8
-  if (req_char > 127 && common->utf)
+#if defined SUPPORT_UNICODE
+  if (req_char > 127 && (common->utf || common->ucp))
     oc = UCD_OTHERCASE(req_char);
 #endif
   }
@@ -6288,7 +6298,7 @@


/* Testing char type. */
#ifdef SUPPORT_UNICODE
-if (common->use_ucp)
+if (common->ucp)
{
OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, 1);
jump = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_UNDERSCORE);
@@ -6334,7 +6344,7 @@

valid_utf = LABEL();

-if (common->use_ucp)
+if (common->ucp)
{
OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, 1);
jump = CMP(SLJIT_EQUAL, TMP1, 0, SLJIT_IMM, CHAR_UNDERSCORE);
@@ -13216,7 +13226,7 @@
#ifdef SUPPORT_UNICODE
/* PCRE_UTF[16|32] have the same value as PCRE_UTF8. */
common->utf = (re->overall_options & PCRE2_UTF) != 0;
-common->use_ucp = (re->overall_options & PCRE2_UCP) != 0;
+common->ucp = (re->overall_options & PCRE2_UCP) != 0;
if (common->utf)
{
if (common->nltype == NLTYPE_ANY)

Modified: code/trunk/testdata/testinput10
===================================================================
--- code/trunk/testdata/testinput10    2020-02-25 16:47:36 UTC (rev 1229)
+++ code/trunk/testdata/testinput10    2020-02-26 10:18:43 UTC (rev 1230)
@@ -587,8 +587,6 @@
     abc\x80\=startchar
     abc\x80\=startchar,offset=3


-#subject no_jit
-
 /\x{c1}+\x{e1}/iIB,ucp
     \x{c1}\x{c1}\x{c1}
     \x{e1}\x{e1}\x{e1} 
@@ -612,6 +610,4 @@
 /X(\x{e1})Y/replace=>\U$1<,substitute_extended
     X\x{e1}Y


-#subject     
-
 # End of testinput10


Modified: code/trunk/testdata/testinput12
===================================================================
--- code/trunk/testdata/testinput12    2020-02-25 16:47:36 UTC (rev 1229)
+++ code/trunk/testdata/testinput12    2020-02-26 10:18:43 UTC (rev 1230)
@@ -481,8 +481,6 @@
 /[ab\x{120}]+/iB,ucp
     aABb\x{121}\x{120}


-#subject no_jit
-
 /\x{c1}/i,no_start_optimize
 \= Expect no match
     \x{e1}
@@ -532,8 +530,6 @@
 /X(\x{121})Y/ucp,replace=>\U$1<,substitute_extended
     X\x{121}Y


-#subject
-
# ----------------------------------------------------

# End of testinput12

Modified: code/trunk/testdata/testoutput10
===================================================================
--- code/trunk/testdata/testoutput10    2020-02-25 16:47:36 UTC (rev 1229)
+++ code/trunk/testdata/testoutput10    2020-02-26 10:18:43 UTC (rev 1230)
@@ -1817,8 +1817,6 @@
     abc\x80\=startchar,offset=3
 Error -36 (bad UTF-8 offset)


-#subject no_jit
-
 /\x{c1}+\x{e1}/iIB,ucp
 ------------------------------------------------------------------
         Bra
@@ -1873,6 +1871,4 @@
     X\x{e1}Y
  1: >\xe1<


-#subject     
-
 # End of testinput10


Modified: code/trunk/testdata/testoutput12-16
===================================================================
--- code/trunk/testdata/testoutput12-16    2020-02-25 16:47:36 UTC (rev 1229)
+++ code/trunk/testdata/testoutput12-16    2020-02-26 10:18:43 UTC (rev 1230)
@@ -1670,8 +1670,6 @@
     aABb\x{121}\x{120}
  0: aABb\x{121}\x{120}


-#subject no_jit
-
 /\x{c1}/i,no_start_optimize
 \= Expect no match
     \x{e1}
@@ -1763,8 +1761,6 @@
     X\x{121}Y
  1: >\x{120}<


-#subject
-
# ----------------------------------------------------

# End of testinput12

Modified: code/trunk/testdata/testoutput12-32
===================================================================
--- code/trunk/testdata/testoutput12-32    2020-02-25 16:47:36 UTC (rev 1229)
+++ code/trunk/testdata/testoutput12-32    2020-02-26 10:18:43 UTC (rev 1230)
@@ -1668,8 +1668,6 @@
     aABb\x{121}\x{120}
  0: aABb\x{121}\x{120}


-#subject no_jit
-
 /\x{c1}/i,no_start_optimize
 \= Expect no match
     \x{e1}
@@ -1761,8 +1759,6 @@
     X\x{121}Y
  1: >\x{120}<


-#subject
-
# ----------------------------------------------------

# End of testinput12