Revision: 187
http://www.exim.org/viewvc/pcre2?view=rev&revision=187
Author: ph10
Date: 2015-01-26 14:57:27 +0000 (Mon, 26 Jan 2015)
Log Message:
-----------
Implement (*NO_JIT)
Modified Paths:
--------------
code/trunk/ChangeLog
code/trunk/doc/pcre2pattern.3
code/trunk/doc/pcre2syntax.3
code/trunk/src/pcre2_compile.c
code/trunk/src/pcre2_internal.h
code/trunk/src/pcre2_jit_compile.c
code/trunk/testdata/testinput16
code/trunk/testdata/testoutput16
Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog 2015-01-26 14:21:45 UTC (rev 186)
+++ code/trunk/ChangeLog 2015-01-26 14:57:27 UTC (rev 187)
@@ -29,7 +29,9 @@
4. All code units in every slot in the table of group names are now set, again
in order to avoid accessing uninitialized data when serializing.
+5. The (*NO_JIT) feature is implemented.
+
Version 10.00 05-January-2015
-----------------------------
Modified: code/trunk/doc/pcre2pattern.3
===================================================================
--- code/trunk/doc/pcre2pattern.3 2015-01-26 14:21:45 UTC (rev 186)
+++ code/trunk/doc/pcre2pattern.3 2015-01-26 14:57:27 UTC (rev 187)
@@ -130,6 +130,14 @@
documentation.
.
.
+.SS "Disabling JIT compilation"
+.rs
+.sp
+If a pattern that starts with (*NO_JIT) is successfully compiled, an attempt by
+the application to apply the JIT optimization by calling
+\fBpcre2_jit_compile()\fP is ignored.
+.
+.
.SS "Setting match and recursion limits"
.rs
.sp
Modified: code/trunk/doc/pcre2syntax.3
===================================================================
--- code/trunk/doc/pcre2syntax.3 2015-01-26 14:21:45 UTC (rev 186)
+++ code/trunk/doc/pcre2syntax.3 2015-01-26 14:57:27 UTC (rev 187)
@@ -1,4 +1,4 @@
-.TH PCRE2SYNTAX 3 "02 January 2015" "PCRE2 10.00"
+.TH PCRE2SYNTAX 3 "26 January 2015" "PCRE2 10.00"
.SH NAME
PCRE2 - Perl-compatible regular expressions (revised API)
.SH "PCRE2 REGULAR EXPRESSION SYNTAX SUMMARY"
@@ -390,6 +390,7 @@
(*NOTEMPTY_ATSTART) set PCRE2_NOTEMPTY_ATSTART when matching
(*NO_AUTO_POSSESS) no auto-possessification (PCRE2_NO_AUTO_POSSESS)
(*NO_DOTSTAR_ANCHOR) no .* anchoring (PCRE2_NO_DOTSTAR_ANCHOR)
+ (*NO_JIT) disable JIT optimization
(*NO_START_OPT) no start-match optimization (PCRE2_NO_START_OPTIMIZE)
(*UTF) set appropriate UTF mode for the library in use
(*UCP) set PCRE2_UCP (use Unicode properties for \ed etc)
@@ -537,6 +538,6 @@
.rs
.sp
.nf
-Last updated: 02 January 2015
+Last updated: 26 January 2015
Copyright (c) 1997-2015 University of Cambridge.
.fi
Modified: code/trunk/src/pcre2_compile.c
===================================================================
--- code/trunk/src/pcre2_compile.c 2015-01-26 14:21:45 UTC (rev 186)
+++ code/trunk/src/pcre2_compile.c 2015-01-26 14:57:27 UTC (rev 187)
@@ -604,6 +604,7 @@
{ (uint8_t *)STRING_NOTEMPTY_ATSTART_RIGHTPAR, 17, PSO_FLG, PCRE2_NE_ATST_SET },
{ (uint8_t *)STRING_NO_AUTO_POSSESS_RIGHTPAR, 16, PSO_OPT, PCRE2_NO_AUTO_POSSESS },
{ (uint8_t *)STRING_NO_DOTSTAR_ANCHOR_RIGHTPAR, 18, PSO_OPT, PCRE2_NO_DOTSTAR_ANCHOR },
+ { (uint8_t *)STRING_NO_JIT_RIGHTPAR, 7, PSO_FLG, PCRE2_NOJIT },
{ (uint8_t *)STRING_NO_START_OPT_RIGHTPAR, 13, PSO_OPT, PCRE2_NO_START_OPTIMIZE },
{ (uint8_t *)STRING_LIMIT_MATCH_EQ, 12, PSO_LIMM, 0 },
{ (uint8_t *)STRING_LIMIT_RECURSION_EQ, 16, PSO_LIMR, 0 },
Modified: code/trunk/src/pcre2_internal.h
===================================================================
--- code/trunk/src/pcre2_internal.h 2015-01-26 14:21:45 UTC (rev 186)
+++ code/trunk/src/pcre2_internal.h 2015-01-26 14:57:27 UTC (rev 187)
@@ -524,6 +524,7 @@
#define PCRE2_NOTEMPTY_SET 0x00010000 /* (*NOTEMPTY) used ) keep */
#define PCRE2_NE_ATST_SET 0x00020000 /* (*NOTEMPTY_ATSTART) used) together */
#define PCRE2_DEREF_TABLES 0x00040000 /* Release character tables. */
+#define PCRE2_NOJIT 0x00080000 /* (*NOJIT) used */
#define PCRE2_MODE_MASK (PCRE2_MODE8 | PCRE2_MODE16 | PCRE2_MODE32)
@@ -906,6 +907,7 @@
#define STRING_UCP_RIGHTPAR "UCP)"
#define STRING_NO_AUTO_POSSESS_RIGHTPAR "NO_AUTO_POSSESS)"
#define STRING_NO_DOTSTAR_ANCHOR_RIGHTPAR "NO_DOTSTAR_ANCHOR)"
+#define STRING_NO_JIT_RIGHTPAR "NO_JIT)"
#define STRING_NO_START_OPT_RIGHTPAR "NO_START_OPT)"
#define STRING_NOTEMPTY_RIGHTPAR "NOTEMPTY)"
#define STRING_NOTEMPTY_ATSTART_RIGHTPAR "NOTEMPTY_ATSTART)"
@@ -1176,6 +1178,7 @@
#define STRING_UCP_RIGHTPAR STR_U STR_C STR_P STR_RIGHT_PARENTHESIS
#define STRING_NO_AUTO_POSSESS_RIGHTPAR STR_N STR_O STR_UNDERSCORE STR_A STR_U STR_T STR_O STR_UNDERSCORE STR_P STR_O STR_S STR_S STR_E STR_S STR_S STR_RIGHT_PARENTHESIS
#define STRING_NO_DOTSTAR_ANCHOR_RIGHTPAR STR_N STR_O STR_UNDERSCORE STR_D STR_O STR_T STR_S STR_T STR_A STR_R STR_UNDERSCORE STR_A STR_N STR_C STR_H STR_O STR_R STR_RIGHT_PARENTHESIS
+#define STRING_NO_JIT_RIGHTPAR STR_N STR_O STR_UNDERSCORE STR_J STR_I STR_T STR_RIGHT_PARENTHESIS
#define STRING_NO_START_OPT_RIGHTPAR STR_N STR_O STR_UNDERSCORE STR_S STR_T STR_A STR_R STR_T STR_UNDERSCORE STR_O STR_P STR_T STR_RIGHT_PARENTHESIS
#define STRING_NOTEMPTY_RIGHTPAR STR_N STR_O STR_T STR_E STR_M STR_P STR_T STR_Y STR_RIGHT_PARENTHESIS
#define STRING_NOTEMPTY_ATSTART_RIGHTPAR STR_N STR_O STR_T STR_E STR_M STR_P STR_T STR_Y STR_UNDERSCORE STR_A STR_T STR_S STR_T STR_A STR_R STR_T STR_RIGHT_PARENTHESIS
Modified: code/trunk/src/pcre2_jit_compile.c
===================================================================
--- code/trunk/src/pcre2_jit_compile.c 2015-01-26 14:21:45 UTC (rev 186)
+++ code/trunk/src/pcre2_jit_compile.c 2015-01-26 14:57:27 UTC (rev 187)
@@ -10324,7 +10324,8 @@
code a compiled pattern
options JIT option bits
-Returns: nothing
+Returns: 0: success or (*NOJIT) was used
+ <0: an error code
*/
#define PUBLIC_JIT_COMPILE_OPTIONS \
@@ -10350,6 +10351,8 @@
if ((options & ~PUBLIC_JIT_COMPILE_OPTIONS) != 0)
return PCRE2_ERROR_JIT_BADOPTION;
+
+if ((re->flags & PCRE2_NOJIT) != 0) return 0;
functions = (executable_functions *)re->executable_jit;
Modified: code/trunk/testdata/testinput16
===================================================================
--- code/trunk/testdata/testinput16 2015-01-26 14:21:45 UTC (rev 186)
+++ code/trunk/testdata/testinput16 2015-01-26 14:57:27 UTC (rev 187)
@@ -16,6 +16,10 @@
abcd
xyz
+/(*NO_JIT)abcd/I
+ abcd
+ xyz
+
/abcd/
abcd
ab\=ps
Modified: code/trunk/testdata/testoutput16
===================================================================
--- code/trunk/testdata/testoutput16 2015-01-26 14:21:45 UTC (rev 186)
+++ code/trunk/testdata/testoutput16 2015-01-26 14:57:27 UTC (rev 187)
@@ -28,6 +28,17 @@
xyz
No match (JIT)
+/(*NO_JIT)abcd/I
+Capturing subpattern count = 0
+First code unit = 'a'
+Last code unit = 'd'
+Subject length lower bound = 4
+JIT compilation was not successful
+ abcd
+ 0: abcd
+ xyz
+No match
+
/abcd/
abcd
0: abcd (JIT)
@@ -326,7 +337,7 @@
# compilation, but serializing (save/load) discards JIT data completely.
/^abc\Kdef/info,push
-** Applied only to compile when pattern is stacked with 'push': jitverify
+** Applies only to compile when pattern is stacked with 'push': jitverify
Capturing subpattern count = 0
Compile options: <none>
Overall options: anchored
@@ -337,7 +348,7 @@
0: def (JIT)
/^abc\Kdef/info,push
-** Applied only to compile when pattern is stacked with 'push': jitverify
+** Applies only to compile when pattern is stacked with 'push': jitverify
Capturing subpattern count = 0
Compile options: <none>
Overall options: anchored