62
62
63
63
PHPAPI ZEND_DECLARE_MODULE_GLOBALS (pcre )
64
64
65
- #ifdef PCRE_STUDY_JIT_COMPILE
65
+ #ifdef HAVE_PCRE_JIT_SUPPORT
66
66
#define PCRE_JIT_STACK_MIN_SIZE (32 * 1024)
67
67
#define PCRE_JIT_STACK_MAX_SIZE (64 * 1024)
68
68
ZEND_TLS pcre_jit_stack * jit_stack = NULL ;
@@ -89,7 +89,7 @@ static void pcre_handle_exec_error(int pcre_code) /* {{{ */
89
89
preg_code = PHP_PCRE_BAD_UTF8_OFFSET_ERROR ;
90
90
break ;
91
91
92
- #ifdef PCRE_STUDY_JIT_COMPILE
92
+ #ifdef HAVE_PCRE_JIT_SUPPORT
93
93
case PCRE_ERROR_JIT_STACKLIMIT :
94
94
preg_code = PHP_PCRE_JIT_STACKLIMIT_ERROR ;
95
95
break ;
@@ -135,7 +135,7 @@ static PHP_GSHUTDOWN_FUNCTION(pcre) /* {{{ */
135
135
{
136
136
zend_hash_destroy (& pcre_globals -> pcre_cache );
137
137
138
- #ifdef PCRE_STUDY_JIT_COMPILE
138
+ #ifdef HAVE_PCRE_JIT_SUPPORT
139
139
/* Stack may only be destroyed when no cached patterns
140
140
possibly associated with it do exist. */
141
141
if (jit_stack ) {
@@ -150,7 +150,7 @@ static PHP_GSHUTDOWN_FUNCTION(pcre) /* {{{ */
150
150
PHP_INI_BEGIN ()
151
151
STD_PHP_INI_ENTRY ("pcre.backtrack_limit" , "1000000" , PHP_INI_ALL , OnUpdateLong , backtrack_limit , zend_pcre_globals , pcre_globals )
152
152
STD_PHP_INI_ENTRY ("pcre.recursion_limit" , "100000" , PHP_INI_ALL , OnUpdateLong , recursion_limit , zend_pcre_globals , pcre_globals )
153
- #ifdef PCRE_STUDY_JIT_COMPILE
153
+ #ifdef HAVE_PCRE_JIT_SUPPORT
154
154
STD_PHP_INI_ENTRY ("pcre.jit" , "1" , PHP_INI_ALL , OnUpdateBool , jit , zend_pcre_globals , pcre_globals )
155
155
#endif
156
156
PHP_INI_END ()
@@ -159,17 +159,23 @@ PHP_INI_END()
159
159
/* {{{ PHP_MINFO_FUNCTION(pcre) */
160
160
static PHP_MINFO_FUNCTION (pcre )
161
161
{
162
+ #ifdef HAVE_PCRE_JIT_SUPPORT
162
163
int jit_yes = 0 ;
164
+ #endif
163
165
164
166
php_info_print_table_start ();
165
167
php_info_print_table_row (2 , "PCRE (Perl Compatible Regular Expressions) Support" , "enabled" );
166
168
php_info_print_table_row (2 , "PCRE Library Version" , pcre_version () );
167
169
170
+ #ifdef HAVE_PCRE_JIT_SUPPORT
168
171
if (!pcre_config (PCRE_CONFIG_JIT , & jit_yes )) {
169
172
php_info_print_table_row (2 , "PCRE JIT Support" , jit_yes ? "enabled" : "disabled" );
170
173
} else {
171
174
php_info_print_table_row (2 , "PCRE JIT Support" , "unknown" );
172
175
}
176
+ #else
177
+ php_info_print_table_row (2 , "PCRE JIT Support" , "not compiled in" );
178
+ #endif
173
179
174
180
php_info_print_table_end ();
175
181
@@ -212,7 +218,7 @@ static PHP_MSHUTDOWN_FUNCTION(pcre)
212
218
}
213
219
/* }}} */
214
220
215
- #ifdef PCRE_STUDY_JIT_COMPILE
221
+ #ifdef HAVE_PCRE_JIT_SUPPORT
216
222
/* {{{ PHP_RINIT_FUNCTION(pcre) */
217
223
static PHP_RINIT_FUNCTION (pcre )
218
224
{
@@ -474,7 +480,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
474
480
return NULL ;
475
481
}
476
482
477
- #ifdef PCRE_STUDY_JIT_COMPILE
483
+ #ifdef HAVE_PCRE_JIT_SUPPORT
478
484
if (PCRE_G (jit )) {
479
485
/* Enable PCRE JIT compiler */
480
486
do_study = 1 ;
@@ -490,7 +496,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
490
496
extra -> flags |= PCRE_EXTRA_MATCH_LIMIT | PCRE_EXTRA_MATCH_LIMIT_RECURSION ;
491
497
extra -> match_limit = (unsigned long )PCRE_G (backtrack_limit );
492
498
extra -> match_limit_recursion = (unsigned long )PCRE_G (recursion_limit );
493
- #ifdef PCRE_STUDY_JIT_COMPILE
499
+ #ifdef HAVE_PCRE_JIT_SUPPORT
494
500
if (PCRE_G (jit ) && jit_stack ) {
495
501
pcre_assign_jit_stack (extra , NULL , jit_stack );
496
502
}
@@ -2180,10 +2186,10 @@ zend_module_entry pcre_module_entry = {
2180
2186
pcre_functions ,
2181
2187
PHP_MINIT (pcre ),
2182
2188
PHP_MSHUTDOWN (pcre ),
2183
- #ifdef PCRE_STUDY_JIT_COMPILE
2189
+ #ifdef HAVE_PCRE_JIT_SUPPORT
2184
2190
PHP_RINIT (pcre ),
2185
2191
#else
2186
- NULL
2192
+ NULL ,
2187
2193
#endif
2188
2194
NULL ,
2189
2195
PHP_MINFO (pcre ),
0 commit comments