[Pcre-svn] [992] code/trunk/pcre_jit_compile.c: One more ran…

Página superior
Eliminar este mensaje
Autor: Subversion repository
Fecha:  
A: pcre-svn
Asunto: [Pcre-svn] [992] code/trunk/pcre_jit_compile.c: One more range optimization in the JIT compiler for case insensitive, English letter ranges
Revision: 992
          http://vcs.pcre.org/viewvc?view=rev&revision=992
Author:   zherczeg
Date:     2012-07-08 18:10:07 +0100 (Sun, 08 Jul 2012)


Log Message:
-----------
One more range optimization in the JIT compiler for case insensitive, English letter ranges

Modified Paths:
--------------
    code/trunk/pcre_jit_compile.c


Modified: code/trunk/pcre_jit_compile.c
===================================================================
--- code/trunk/pcre_jit_compile.c    2012-07-08 16:44:39 UTC (rev 991)
+++ code/trunk/pcre_jit_compile.c    2012-07-08 17:10:07 UTC (rev 992)
@@ -3181,6 +3181,15 @@
       }
     return TRUE;
     }
+  if ((ranges[3] - ranges[2]) == (ranges[5] - ranges[4]) && ispowerof2(ranges[4] - ranges[2]))
+    {
+    if (readch)
+      read_char(common);
+    OP2(SLJIT_OR, TMP1, 0, TMP1, 0, SLJIT_IMM, ranges[4] - ranges[2]);
+    OP2(SLJIT_SUB, TMP1, 0, TMP1, 0, SLJIT_IMM, ranges[4]);
+    add_jump(compiler, backtracks, CMP(ranges[1] != 0 ? SLJIT_C_LESS : SLJIT_C_GREATER_EQUAL, TMP1, 0, SLJIT_IMM, ranges[5] - ranges[4]));
+    return TRUE;
+    }
   return FALSE;


default:
@@ -3194,6 +3203,7 @@
const pcre_uint8 *ctypes = (const pcre_uint8*)common->ctypes;

bit = ctypes[0] & flag;
+ranges[0] = -1;
ranges[1] = bit != 0 ? 1 : 0;
length = 0;

@@ -3201,10 +3211,7 @@
   if ((ctypes[i] & flag) != bit)
     {
     if (length >= MAX_RANGE_SIZE)
-      {
-      ranges[0] = -1;
       return;
-      }
     ranges[2 + length] = i;
     length++;
     bit ^= flag;
@@ -3213,10 +3220,7 @@
 if (bit != 0)
   {
   if (length >= MAX_RANGE_SIZE)
-    {
-    ranges[0] = -1;
     return;
-    }
   ranges[2 + length] = 256;
   length++;
   }