]> granicus.if.org Git - php/commitdiff
Fix bug #73121 Bundled PCRE doesn't compile because JIT isn't supported on s390
authorAnatol Belski <ab@php.net>
Thu, 22 Sep 2016 23:52:42 +0000 (01:52 +0200)
committerAnatol Belski <ab@php.net>
Thu, 22 Sep 2016 23:52:42 +0000 (01:52 +0200)
ext/pcre/config.w32
ext/pcre/config0.m4
ext/pcre/pcrelib/config.h
ext/pcre/php_pcre.c
ext/pcre/php_pcre.h

index 1fe4b687f6214e015381eda2699ea2f65631da1d..02256887a1ead395fb7a6650902bcd1a77c36fe9 100644 (file)
@@ -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');
+}
+
index 7749bb68dfbe167ab23ae5c934176d4d2d1c7adc..35fc585d51117b721bf196093eb19ff980909863 100644 (file)
@@ -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
+
index 0f7a9f73ff0e9bd2db9af391a1d577c6d89313f3..e3ed14819079ecfaf2319fa3a8f569e34fcda44d 100644 (file)
@@ -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. */
index 8541feb523875faf1667052c0653afb03102ba9a..5170cb2e7fb5573a9f00a15fbf400afd3dfee2ca 100644 (file)
@@ -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),
index 75157264499461a3646eec6178ad8d05a34e9430..5ce3cedcda457ba1ca83939e5ccd98b115dcbfdf 100644 (file)
@@ -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;