summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzherczeg <zherczeg@2f5784b3-3f2a-0410-8824-cb99058d5e15>2012-04-11 10:19:10 +0000
committerzherczeg <zherczeg@2f5784b3-3f2a-0410-8824-cb99058d5e15>2012-04-11 10:19:10 +0000
commite79a1e9603fedaee65b929b31b3b038e9ab628cb (patch)
tree8686a6685cabd2eca42d1d06244abf3bab284f2a
parent126ed5ec14c19a82419a8ab951ee9aacd330993a (diff)
downloadpcre-e79a1e9603fedaee65b929b31b3b038e9ab628cb.tar.gz
support NO_START_OPTIMIZE in JIT
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@958 2f5784b3-3f2a-0410-8824-cb99058d5e15
-rw-r--r--ChangeLog2
-rw-r--r--pcre_jit_compile.c27
-rw-r--r--testdata/testinput123
-rw-r--r--testdata/testoutput124
4 files changed, 24 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 048ba25..0f6701b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -80,6 +80,8 @@ Version 8.31
22. Changed the option for creating symbolic links for 16-bit man pages from
-s to -sf so that re-installing does not cause issues.
+23. Support PCRE_NO_START_OPTIMIZE in JIT as (*MARK) support requires it.
+
Version 8.30 04-February-2012
-----------------------------
diff --git a/pcre_jit_compile.c b/pcre_jit_compile.c
index fb21dff..3af8c4b 100644
--- a/pcre_jit_compile.c
+++ b/pcre_jit_compile.c
@@ -6903,7 +6903,7 @@ if (localsize < 0)
return;
/* Checking flags and updating ovector_start. */
-if (mode == JIT_COMPILE && (re->flags & PCRE_REQCHSET) != 0)
+if (mode == JIT_COMPILE && (re->flags & PCRE_REQCHSET) != 0 && (re->options & PCRE_NO_START_OPTIMIZE) == 0)
{
common->req_char_ptr = common->ovector_start;
common->ovector_start += sizeof(sljit_w);
@@ -6952,7 +6952,7 @@ sljit_emit_enter(compiler, 1, 5, 5, localsize);
/* Register init. */
reset_ovector(common, (re->top_bracket + 1) * 2);
-if (mode == JIT_COMPILE && (re->flags & PCRE_REQCHSET) != 0)
+if (common->req_char_ptr != 0)
OP1(SLJIT_MOV, SLJIT_MEM1(SLJIT_LOCALS_REG), common->req_char_ptr, SLJIT_TEMPORARY_REG1, 0);
OP1(SLJIT_MOV, ARGUMENTS, 0, SLJIT_SAVED_REG1, 0);
@@ -6973,14 +6973,17 @@ if ((re->options & PCRE_ANCHORED) == 0)
{
mainloop = mainloop_entry(common, (re->flags & PCRE_HASCRORLF) != 0, (re->options & PCRE_FIRSTLINE) != 0);
/* Forward search if possible. */
- if ((re->flags & PCRE_FIRSTSET) != 0)
- fast_forward_first_char(common, (pcre_uchar)re->first_char, (re->flags & PCRE_FCH_CASELESS) != 0, (re->options & PCRE_FIRSTLINE) != 0);
- else if ((re->flags & PCRE_STARTLINE) != 0)
- fast_forward_newline(common, (re->options & PCRE_FIRSTLINE) != 0);
- else if ((re->flags & PCRE_STARTLINE) == 0 && study != NULL && (study->flags & PCRE_STUDY_MAPPED) != 0)
- fast_forward_start_bits(common, (sljit_uw)study->start_bits, (re->options & PCRE_FIRSTLINE) != 0);
- }
-if (mode == JIT_COMPILE && (re->flags & PCRE_REQCHSET) != 0)
+ if ((re->options & PCRE_NO_START_OPTIMIZE) == 0)
+ {
+ if ((re->flags & PCRE_FIRSTSET) != 0)
+ fast_forward_first_char(common, (pcre_uchar)re->first_char, (re->flags & PCRE_FCH_CASELESS) != 0, (re->options & PCRE_FIRSTLINE) != 0);
+ else if ((re->flags & PCRE_STARTLINE) != 0)
+ fast_forward_newline(common, (re->options & PCRE_FIRSTLINE) != 0);
+ else if ((re->flags & PCRE_STARTLINE) == 0 && study != NULL && (study->flags & PCRE_STUDY_MAPPED) != 0)
+ fast_forward_start_bits(common, (sljit_uw)study->start_bits, (re->options & PCRE_FIRSTLINE) != 0);
+ }
+ }
+if (common->req_char_ptr != 0)
reqbyte_notfound = search_requested_char(common, (pcre_uchar)re->req_char, (re->flags & PCRE_RCH_CASELESS) != 0, (re->flags & PCRE_FIRSTSET) != 0);
/* Store the current STR_PTR in OVECTOR(0). */
@@ -7056,7 +7059,7 @@ if ((re->options & PCRE_ANCHORED) == 0)
{
if ((re->options & PCRE_FIRSTLINE) == 0)
{
- if (mode == JIT_COMPILE && study != NULL && study->minlength > 1)
+ if (mode == JIT_COMPILE && study != NULL && study->minlength > 1 && (re->options & PCRE_NO_START_OPTIMIZE) == 0)
{
OP2(SLJIT_ADD, TMP1, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(study->minlength + 1));
CMPTO(SLJIT_C_LESS_EQUAL, TMP1, 0, STR_END, 0, mainloop);
@@ -7067,7 +7070,7 @@ if ((re->options & PCRE_ANCHORED) == 0)
else
{
SLJIT_ASSERT(common->first_line_end != 0);
- if (mode == JIT_COMPILE && study != NULL && study->minlength > 1)
+ if (mode == JIT_COMPILE && study != NULL && study->minlength > 1 && (re->options & PCRE_NO_START_OPTIMIZE) == 0)
{
OP2(SLJIT_ADD, TMP1, 0, STR_PTR, 0, SLJIT_IMM, IN_UCHARS(study->minlength + 1));
OP2(SLJIT_SUB | SLJIT_SET_U, SLJIT_UNUSED, 0, TMP1, 0, STR_END, 0);
diff --git a/testdata/testinput12 b/testdata/testinput12
index fff8db1..b5e784d 100644
--- a/testdata/testinput12
+++ b/testdata/testinput12
@@ -77,4 +77,7 @@ and a couple of things that are different with JIT. --/
ab\P\P
xyz
+/(*NO_START_OPT)a(*:m)b/KS++
+ a
+
/-- End of testinput12 --/
diff --git a/testdata/testoutput12 b/testdata/testoutput12
index c9a428a..56f6587 100644
--- a/testdata/testoutput12
+++ b/testdata/testoutput12
@@ -148,4 +148,8 @@ Partial match: ab (JIT)
xyz
No match (JIT)
+/(*NO_START_OPT)a(*:m)b/KS++
+ a
+No match, mark = m (JIT)
+
/-- End of testinput12 --/