Revision: 744
http://www.exim.org/viewvc/pcre2?view=rev&revision=744
Author: zherczeg
Date: 2017-04-13 12:52:36 +0100 (Thu, 13 Apr 2017)
Log Message:
-----------
Support end anchored in JIT.
Modified Paths:
--------------
code/trunk/src/pcre2_jit_compile.c
code/trunk/testdata/testinput2
code/trunk/testdata/testoutput2
Modified: code/trunk/src/pcre2_jit_compile.c
===================================================================
--- code/trunk/src/pcre2_jit_compile.c 2017-04-12 13:48:11 UTC (rev 743)
+++ code/trunk/src/pcre2_jit_compile.c 2017-04-13 11:52:36 UTC (rev 744)
@@ -9554,6 +9554,9 @@
return cc + 1;
}
+if (*cc == OP_ACCEPT && common->currententry == NULL && (common->re->overall_options & PCRE2_ENDANCHORED) != 0)
+ add_jump(compiler, &common->reset_match, CMP(SLJIT_NOT_EQUAL, STR_PTR, 0, STR_END, 0));
+
if (*cc == OP_ASSERT_ACCEPT || common->currententry != NULL || !common->might_be_empty)
{
/* No need to check notempty conditions. */
@@ -11295,6 +11298,7 @@
struct sljit_jump *minlength_check_failed = NULL;
struct sljit_jump *reqbyte_notfound = NULL;
struct sljit_jump *empty_match = NULL;
+struct sljit_jump *end_anchor_failed = NULL;
SLJIT_ASSERT(tables);
@@ -11577,6 +11581,9 @@
return PCRE2_ERROR_NOMEMORY;
}
+if ((re->overall_options & PCRE2_ENDANCHORED) != 0)
+ end_anchor_failed = CMP(SLJIT_NOT_EQUAL, STR_PTR, 0, STR_END, 0);
+
if (common->might_be_empty)
{
empty_match = CMP(SLJIT_EQUAL, STR_PTR, 0, SLJIT_MEM1(SLJIT_SP), OVECTOR(0));
@@ -11598,6 +11605,9 @@
SET_LABEL(minlength_check_failed, common->forced_quit_label);
sljit_emit_return(compiler, SLJIT_MOV, SLJIT_RETURN_REG, 0);
+if ((re->overall_options & PCRE2_ENDANCHORED) != 0)
+ JUMPHERE(end_anchor_failed);
+
if (mode != PCRE2_JIT_COMPLETE)
{
common->partialmatchlabel = LABEL();
Modified: code/trunk/testdata/testinput2
===================================================================
--- code/trunk/testdata/testinput2 2017-04-12 13:48:11 UTC (rev 743)
+++ code/trunk/testdata/testinput2 2017-04-13 11:52:36 UTC (rev 744)
@@ -5011,9 +5011,6 @@
/(a(*MARK:m)(*ACCEPT)){0}(?1)/mark
abc
-# Temporary, until JIT is updated.
-#subject no_jit
-
/abc/endanchored
xyzabc
\= Expect no match
@@ -5041,8 +5038,6 @@
/a(*ACCEPT)x|aa/endanchored
aaa
-#subject -no_jit
-
# Check auto-anchoring when there is a group that is never obeyed at
# the start of a branch.
Modified: code/trunk/testdata/testoutput2
===================================================================
--- code/trunk/testdata/testoutput2 2017-04-12 13:48:11 UTC (rev 743)
+++ code/trunk/testdata/testoutput2 2017-04-13 11:52:36 UTC (rev 744)
@@ -15537,9 +15537,6 @@
0: a
MK: m
-# Temporary, until JIT is updated.
-#subject no_jit
-
/abc/endanchored
xyzabc
0: abc
@@ -15578,8 +15575,6 @@
aaa
0: a
-#subject -no_jit
-
# Check auto-anchoring when there is a group that is never obeyed at
# the start of a branch.