summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2016-09-23 01:55:17 +0200
committerAnatol Belski <ab@php.net>2016-09-23 01:55:17 +0200
commitf7e5481a10ce0b4041893ed298f89574ab07e27d (patch)
treebc6e9fe564c223d3a2c2212be958e6b3e4d8109c
parent5b46c2b67d2e1d68d8fb1b0a6584906366983b9e (diff)
parent54d8053ac5008efa122211b2aeec57a4931f5d56 (diff)
downloadphp-git-f7e5481a10ce0b4041893ed298f89574ab07e27d.tar.gz
Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0: Fix bug #73121 Bundled PCRE doesn't compile because JIT isn't supported on s390
-rw-r--r--ext/pcre/config.w326
-rw-r--r--ext/pcre/config0.m412
-rw-r--r--ext/pcre/pcrelib/config.h6
-rw-r--r--ext/pcre/php_pcre.c24
-rw-r--r--ext/pcre/php_pcre.h2
5 files changed, 39 insertions, 11 deletions
diff --git a/ext/pcre/config.w32 b/ext/pcre/config.w32
index 1fe4b687f6..02256887a1 100644
--- a/ext/pcre/config.w32
+++ b/ext/pcre/config.w32
@@ -11,3 +11,9 @@ AC_DEFINE('HAVE_PCRE', 1, 'Have PCRE library');
PHP_PCRE="yes";
PHP_INSTALL_HEADERS("ext/pcre", "php_pcre.h pcrelib/");
ADD_FLAG("CFLAGS_PCRE", " /D HAVE_CONFIG_H");
+
+ARG_WITH("pcre-jit", "Enable PCRE JIT support", "yes");
+if (PHP_PCRE_JIT != "no") {
+ AC_DEFINE('HAVE_PCRE_JIT_SUPPORT', 1, 'PCRE library');
+}
+
diff --git a/ext/pcre/config0.m4 b/ext/pcre/config0.m4
index 7749bb68df..35fc585d51 100644
--- a/ext/pcre/config0.m4
+++ b/ext/pcre/config0.m4
@@ -66,3 +66,15 @@ PHP_ARG_WITH(pcre-regex,,
PHP_INSTALL_HEADERS([ext/pcre], [php_pcre.h pcrelib/])
AC_DEFINE(HAVE_BUNDLED_PCRE, 1, [ ])
fi
+
+PHP_ARG_WITH(pcre-jit,,[ --with-pcre-jit Enable PCRE JIT functionality], yes, no)
+ if test "$PHP_PCRE_REGEX" != "no"; then
+ AC_MSG_CHECKING([whether to enable PCRE JIT functionality])
+ if test "$PHP_PCRE_JIT" != "no"; then
+ AC_DEFINE(HAVE_PCRE_JIT_SUPPORT, 1, [ ])
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ fi
+ fi
+
diff --git a/ext/pcre/pcrelib/config.h b/ext/pcre/pcrelib/config.h
index 0f7a9f73ff..e3ed148190 100644
--- a/ext/pcre/pcrelib/config.h
+++ b/ext/pcre/pcrelib/config.h
@@ -1,7 +1,9 @@
#include <php_compat.h>
-#ifndef PHP_WIN32
+#ifdef PHP_WIN32
+# include <config.w32.h>
+#else
# include <php_config.h>
#endif
@@ -397,7 +399,9 @@ them both to 0; an emulation function will be used. */
#undef SUPPORT_GCOV
/* Define to any value to enable support for Just-In-Time compiling. */
+#if HAVE_PCRE_JIT_SUPPORT
#define SUPPORT_JIT
+#endif
/* Define to any value to allow pcregrep to be linked with libbz2, so that it
is able to handle .bz2 files. */
diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c
index 8be2f3a9df..56d1f44293 100644
--- a/ext/pcre/php_pcre.c
+++ b/ext/pcre/php_pcre.c
@@ -62,7 +62,7 @@ enum {
PHPAPI ZEND_DECLARE_MODULE_GLOBALS(pcre)
-#ifdef PCRE_STUDY_JIT_COMPILE
+#ifdef HAVE_PCRE_JIT_SUPPORT
#define PCRE_JIT_STACK_MIN_SIZE (32 * 1024)
#define PCRE_JIT_STACK_MAX_SIZE (64 * 1024)
ZEND_TLS pcre_jit_stack *jit_stack = NULL;
@@ -89,7 +89,7 @@ static void pcre_handle_exec_error(int pcre_code) /* {{{ */
preg_code = PHP_PCRE_BAD_UTF8_OFFSET_ERROR;
break;
-#ifdef PCRE_STUDY_JIT_COMPILE
+#ifdef HAVE_PCRE_JIT_SUPPORT
case PCRE_ERROR_JIT_STACKLIMIT:
preg_code = PHP_PCRE_JIT_STACKLIMIT_ERROR;
break;
@@ -135,7 +135,7 @@ static PHP_GSHUTDOWN_FUNCTION(pcre) /* {{{ */
{
zend_hash_destroy(&pcre_globals->pcre_cache);
-#ifdef PCRE_STUDY_JIT_COMPILE
+#ifdef HAVE_PCRE_JIT_SUPPORT
/* Stack may only be destroyed when no cached patterns
possibly associated with it do exist. */
if (jit_stack) {
@@ -150,7 +150,7 @@ static PHP_GSHUTDOWN_FUNCTION(pcre) /* {{{ */
PHP_INI_BEGIN()
STD_PHP_INI_ENTRY("pcre.backtrack_limit", "1000000", PHP_INI_ALL, OnUpdateLong, backtrack_limit, zend_pcre_globals, pcre_globals)
STD_PHP_INI_ENTRY("pcre.recursion_limit", "100000", PHP_INI_ALL, OnUpdateLong, recursion_limit, zend_pcre_globals, pcre_globals)
-#ifdef PCRE_STUDY_JIT_COMPILE
+#ifdef HAVE_PCRE_JIT_SUPPORT
STD_PHP_INI_ENTRY("pcre.jit", "1", PHP_INI_ALL, OnUpdateBool, jit, zend_pcre_globals, pcre_globals)
#endif
PHP_INI_END()
@@ -159,17 +159,23 @@ PHP_INI_END()
/* {{{ PHP_MINFO_FUNCTION(pcre) */
static PHP_MINFO_FUNCTION(pcre)
{
+#ifdef HAVE_PCRE_JIT_SUPPORT
int jit_yes = 0;
+#endif
php_info_print_table_start();
php_info_print_table_row(2, "PCRE (Perl Compatible Regular Expressions) Support", "enabled" );
php_info_print_table_row(2, "PCRE Library Version", pcre_version() );
+#ifdef HAVE_PCRE_JIT_SUPPORT
if (!pcre_config(PCRE_CONFIG_JIT, &jit_yes)) {
php_info_print_table_row(2, "PCRE JIT Support", jit_yes ? "enabled" : "disabled");
} else {
php_info_print_table_row(2, "PCRE JIT Support", "unknown" );
}
+#else
+ php_info_print_table_row(2, "PCRE JIT Support", "not compiled in" );
+#endif
php_info_print_table_end();
@@ -212,7 +218,7 @@ static PHP_MSHUTDOWN_FUNCTION(pcre)
}
/* }}} */
-#ifdef PCRE_STUDY_JIT_COMPILE
+#ifdef HAVE_PCRE_JIT_SUPPORT
/* {{{ PHP_RINIT_FUNCTION(pcre) */
static PHP_RINIT_FUNCTION(pcre)
{
@@ -474,7 +480,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
return NULL;
}
-#ifdef PCRE_STUDY_JIT_COMPILE
+#ifdef HAVE_PCRE_JIT_SUPPORT
if (PCRE_G(jit)) {
/* Enable PCRE JIT compiler */
do_study = 1;
@@ -490,7 +496,7 @@ PHPAPI pcre_cache_entry* pcre_get_compiled_regex_cache(zend_string *regex)
extra->flags |= PCRE_EXTRA_MATCH_LIMIT | PCRE_EXTRA_MATCH_LIMIT_RECURSION;
extra->match_limit = (unsigned long)PCRE_G(backtrack_limit);
extra->match_limit_recursion = (unsigned long)PCRE_G(recursion_limit);
-#ifdef PCRE_STUDY_JIT_COMPILE
+#ifdef HAVE_PCRE_JIT_SUPPORT
if (PCRE_G(jit) && jit_stack) {
pcre_assign_jit_stack(extra, NULL, jit_stack);
}
@@ -2180,10 +2186,10 @@ zend_module_entry pcre_module_entry = {
pcre_functions,
PHP_MINIT(pcre),
PHP_MSHUTDOWN(pcre),
-#ifdef PCRE_STUDY_JIT_COMPILE
+#ifdef HAVE_PCRE_JIT_SUPPORT
PHP_RINIT(pcre),
#else
- NULL
+ NULL,
#endif
NULL,
PHP_MINFO(pcre),
diff --git a/ext/pcre/php_pcre.h b/ext/pcre/php_pcre.h
index 7515726449..5ce3cedcda 100644
--- a/ext/pcre/php_pcre.h
+++ b/ext/pcre/php_pcre.h
@@ -75,7 +75,7 @@ ZEND_BEGIN_MODULE_GLOBALS(pcre)
HashTable pcre_cache;
zend_long backtrack_limit;
zend_long recursion_limit;
-#ifdef PCRE_STUDY_JIT_COMPILE
+#ifdef HAVE_PCRE_JIT_SUPPORT
zend_bool jit;
#endif
int error_code;