Implement (*NO_JIT)

This commit is contained in:
Philip.Hazel 2015-01-26 14:57:27 +00:00
parent 221cf10975
commit ca77bdd5c4
8 changed files with 38 additions and 5 deletions

View File

@ -29,6 +29,8 @@ include the general overhead. This has been corrected.
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
-----------------------------

View File

@ -130,6 +130,14 @@ of arbitrary characters). For more details, see the
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

View File

@ -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 @@ appear.
(*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 @@ Cambridge, England.
.rs
.sp
.nf
Last updated: 02 January 2015
Last updated: 26 January 2015
Copyright (c) 1997-2015 University of Cambridge.
.fi

View File

@ -604,6 +604,7 @@ static pso pso_list[] = {
{ (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 },

View File

@ -524,6 +524,7 @@ bytes in a code unit in that mode. */
#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 @@ a positive value. */
#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 @@ only. */
#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

View File

@ -10324,7 +10324,8 @@ Arguments:
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 (code == NULL)
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;

View File

@ -16,6 +16,10 @@
abcd
xyz
/(*NO_JIT)abcd/I
abcd
xyz
/abcd/
abcd
ab\=ps

15
testdata/testoutput16 vendored
View File

@ -28,6 +28,17 @@ JIT compilation was successful
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 @@ No match
# 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 @@ JIT compilation was successful
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