[Pcre-svn] [958] code/trunk: support NO_START_OPTIMIZE in JI…

Startseite
Nachricht löschen
Autor: Subversion repository
Datum:  
To: pcre-svn
Betreff: [Pcre-svn] [958] code/trunk: support NO_START_OPTIMIZE in JIT
Revision: 958
          http://vcs.pcre.org/viewvc?view=rev&revision=958
Author:   zherczeg
Date:     2012-04-11 11:19:10 +0100 (Wed, 11 Apr 2012)


Log Message:
-----------
support NO_START_OPTIMIZE in JIT

Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/pcre_jit_compile.c
    code/trunk/testdata/testinput12
    code/trunk/testdata/testoutput12


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2012-04-04 16:18:29 UTC (rev 957)
+++ code/trunk/ChangeLog    2012-04-11 10:19:10 UTC (rev 958)
@@ -80,7 +80,9 @@
 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
-----------------------------


Modified: code/trunk/pcre_jit_compile.c
===================================================================
--- code/trunk/pcre_jit_compile.c    2012-04-04 16:18:29 UTC (rev 957)
+++ code/trunk/pcre_jit_compile.c    2012-04-11 10:19:10 UTC (rev 958)
@@ -6903,7 +6903,7 @@
   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 @@

/* 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 @@
   {
   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 ((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 (mode == JIT_COMPILE && (re->flags & PCRE_REQCHSET) != 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_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 @@
   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);


Modified: code/trunk/testdata/testinput12
===================================================================
--- code/trunk/testdata/testinput12    2012-04-04 16:18:29 UTC (rev 957)
+++ code/trunk/testdata/testinput12    2012-04-11 10:19:10 UTC (rev 958)
@@ -77,4 +77,7 @@
     ab\P\P
     xyz


+/(*NO_START_OPT)a(*:m)b/KS++
+    a
+
 /-- End of testinput12 --/


Modified: code/trunk/testdata/testoutput12
===================================================================
--- code/trunk/testdata/testoutput12    2012-04-04 16:18:29 UTC (rev 957)
+++ code/trunk/testdata/testoutput12    2012-04-11 10:19:10 UTC (rev 958)
@@ -148,4 +148,8 @@
     xyz
 No match (JIT)


+/(*NO_START_OPT)a(*:m)b/KS++
+    a
+No match, mark = m (JIT)
+
 /-- End of testinput12 --/