summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzherczeg <zherczeg@6239d852-aaf2-0410-a92c-79f79f948069>2017-06-08 12:07:05 +0000
committerzherczeg <zherczeg@6239d852-aaf2-0410-a92c-79f79f948069>2017-06-08 12:07:05 +0000
commit04a3d3bc4012f747f077829a461ab677c94ee23f (patch)
tree8fd0562166b8f4f361f9c48b7b0e4f7376188bcf
parent35bfa4113e31deb70c324ec6e55d28490e551f9e (diff)
downloadpcre2-04a3d3bc4012f747f077829a461ab677c94ee23f.tar.gz
Improve char range match in JIT.
git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@822 6239d852-aaf2-0410-a92c-79f79f948069
-rw-r--r--src/pcre2_jit_compile.c42
1 files changed, 22 insertions, 20 deletions
diff --git a/src/pcre2_jit_compile.c b/src/pcre2_jit_compile.c
index 859436e..71bdb5e 100644
--- a/src/pcre2_jit_compile.c
+++ b/src/pcre2_jit_compile.c
@@ -5783,8 +5783,9 @@ uint16_t char_list[MAX_CLASS_CHARS_SIZE];
uint8_t byte;
sljit_s32 type;
int i, j, k, len, c;
-struct sljit_jump *jump;
-jump_list *found = NULL;
+
+if (!sljit_has_cpu_feature(SLJIT_HAS_CMOV))
+ return FALSE;
if (invert)
nclass = !nclass;
@@ -5831,23 +5832,28 @@ for (i = 0; i < 32; i++)
}
}
-jump = NULL;
+i = 0;
j = 0;
-for (i = 0; i < len; i++)
+if (char_list[0] == 0)
+ {
+ i++;
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, 0);
+ OP_FLAGS(SLJIT_MOV, TMP2, 0, SLJIT_ZERO);
+ }
+else
+ OP1(SLJIT_MOV, TMP2, 0, SLJIT_IMM, 0);
+
+while (i < len)
{
if ((char_list[i] & 0x100) != 0)
j++;
- else
+ else
{
- type = SLJIT_EQUAL;
- if (!nclass && j == 0 && i + 1 == len)
- type = SLJIT_NOT_EQUAL;
-
- jump = CMP(type, TMP1, 0, SLJIT_IMM, char_list[i]);
-
- add_jump(compiler, (nclass || type == SLJIT_NOT_EQUAL) ? backtracks : &found, jump);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, char_list[i]);
+ CMOV(SLJIT_ZERO, TMP2, TMP1, 0);
}
+ i++;
}
if (j != 0)
@@ -5858,17 +5864,13 @@ if (j != 0)
if ((char_list[i] & 0x100) != 0)
{
j--;
-
- type = SLJIT_EQUAL;
- if (!nclass && j == 0)
- type = SLJIT_NOT_EQUAL;
-
- jump = CMP(type, TMP1, 0, SLJIT_IMM, char_list[i] & 0xff);
- add_jump(compiler, (nclass || type == SLJIT_NOT_EQUAL) ? backtracks : &found, jump);
+ OP2(SLJIT_SUB | SLJIT_SET_Z, SLJIT_UNUSED, 0, TMP1, 0, SLJIT_IMM, char_list[i] & 0xff);
+ CMOV(SLJIT_ZERO, TMP2, TMP1, 0);
}
}
-set_jumps(found, LABEL());
+type = nclass ? SLJIT_NOT_EQUAL : SLJIT_EQUAL;
+add_jump(compiler, backtracks, CMP(type, TMP2, 0, SLJIT_IMM, 0));
return TRUE;
}