ext/iconv, ext/json and ext/session use static tsrmls pointer

This commit is contained in:
Anatol Belski 2014-10-17 14:16:40 +02:00
parent 83b8e281db
commit fea10f6a5e
12 changed files with 37 additions and 9 deletions

View file

@ -171,7 +171,7 @@ int main() {
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
]) ])
PHP_NEW_EXTENSION(iconv, iconv.c, $ext_shared,, [-I\"$PHP_ICONV_PREFIX/include\"]) PHP_NEW_EXTENSION(iconv, iconv.c, $ext_shared,, [-I\"$PHP_ICONV_PREFIX/include\" -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1])
PHP_SUBST(ICONV_SHARED_LIBADD) PHP_SUBST(ICONV_SHARED_LIBADD)
PHP_INSTALL_HEADERS([ext/iconv/]) PHP_INSTALL_HEADERS([ext/iconv/])
else else

View file

@ -8,7 +8,7 @@ if (PHP_ICONV != "no") {
CHECK_LIB("iconv_a.lib", "iconv", PHP_ICONV) || CHECK_LIB("iconv.lib", "iconv", PHP_ICONV)) && CHECK_LIB("iconv_a.lib", "iconv", PHP_ICONV) || CHECK_LIB("iconv.lib", "iconv", PHP_ICONV)) &&
CHECK_HEADER_ADD_INCLUDE("iconv.h", "CFLAGS_ICONV", PHP_ICONV)) { CHECK_HEADER_ADD_INCLUDE("iconv.h", "CFLAGS_ICONV", PHP_ICONV)) {
EXTENSION("iconv", "iconv.c"); EXTENSION("iconv", "iconv.c", null, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
AC_DEFINE("HAVE_ICONV", 1, "Define if iconv extension is enabled"); AC_DEFINE("HAVE_ICONV", 1, "Define if iconv extension is enabled");
AC_DEFINE("HAVE_LIBICONV", 1, "Define if libiconv is available"); AC_DEFINE("HAVE_LIBICONV", 1, "Define if libiconv is available");

View file

@ -164,12 +164,18 @@ zend_module_entry iconv_module_entry = {
/* }}} */ /* }}} */
#ifdef COMPILE_DL_ICONV #ifdef COMPILE_DL_ICONV
#ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE;
#endif
ZEND_GET_MODULE(iconv) ZEND_GET_MODULE(iconv)
#endif #endif
/* {{{ PHP_GINIT_FUNCTION */ /* {{{ PHP_GINIT_FUNCTION */
static PHP_GINIT_FUNCTION(iconv) static PHP_GINIT_FUNCTION(iconv)
{ {
#if defined(COMPILE_DL_ICONV) && defined(ZTS)
ZEND_TSRMLS_CACHE_UPDATE;
#endif
iconv_globals->input_encoding = NULL; iconv_globals->input_encoding = NULL;
iconv_globals->output_encoding = NULL; iconv_globals->output_encoding = NULL;
iconv_globals->internal_encoding = NULL; iconv_globals->internal_encoding = NULL;

View file

@ -73,7 +73,10 @@ ZEND_BEGIN_MODULE_GLOBALS(iconv)
ZEND_END_MODULE_GLOBALS(iconv) ZEND_END_MODULE_GLOBALS(iconv)
#ifdef ZTS #ifdef ZTS
# define ICONVG(v) TSRMG(iconv_globals_id, zend_iconv_globals *, v) # define ICONVG(v) ZEND_TSRMG(iconv_globals_id, zend_iconv_globals *, v)
# ifdef COMPILE_DL_ICONV
ZEND_TSRMLS_CACHE_EXTERN;
# endif
#else #else
# define ICONVG(v) (iconv_globals.v) # define ICONVG(v) (iconv_globals.v)
#endif #endif

View file

@ -9,7 +9,7 @@ if test "$PHP_JSON" != "no"; then
AC_DEFINE([HAVE_JSON],1 ,[whether to enable JavaScript Object Serialization support]) AC_DEFINE([HAVE_JSON],1 ,[whether to enable JavaScript Object Serialization support])
AC_HEADER_STDC AC_HEADER_STDC
PHP_NEW_EXTENSION(json, json.c utf8_decode.c JSON_parser.c, $ext_shared) PHP_NEW_EXTENSION(json, json.c utf8_decode.c JSON_parser.c, $ext_shared, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
PHP_INSTALL_HEADERS([ext/json], [php_json.h]) PHP_INSTALL_HEADERS([ext/json], [php_json.h])
PHP_SUBST(JSON_SHARED_LIBADD) PHP_SUBST(JSON_SHARED_LIBADD)
fi fi

View file

@ -4,7 +4,7 @@
ARG_ENABLE("json", "JavaScript Object Serialization support", "yes"); ARG_ENABLE("json", "JavaScript Object Serialization support", "yes");
if (PHP_JSON != "no") { if (PHP_JSON != "no") {
EXTENSION('json', 'json.c', PHP_JSON_SHARED, ""); EXTENSION('json', 'json.c', PHP_JSON_SHARED, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
ADD_SOURCES(configure_module_dirname, "JSON_parser.c utf8_decode.c", "json"); ADD_SOURCES(configure_module_dirname, "JSON_parser.c utf8_decode.c", "json");
PHP_INSTALL_HEADERS("ext/json/", "php_json.h"); PHP_INSTALL_HEADERS("ext/json/", "php_json.h");
} }

View file

@ -125,6 +125,9 @@ static PHP_MINIT_FUNCTION(json)
*/ */
static PHP_GINIT_FUNCTION(json) static PHP_GINIT_FUNCTION(json)
{ {
#if defined(COMPILE_DL_JSON) && defined(ZTS)
ZEND_TSRMLS_CACHE_UPDATE;
#endif
json_globals->encoder_depth = 0; json_globals->encoder_depth = 0;
json_globals->error_code = 0; json_globals->error_code = 0;
json_globals->encode_max_depth = 0; json_globals->encode_max_depth = 0;
@ -153,6 +156,9 @@ zend_module_entry json_module_entry = {
/* }}} */ /* }}} */
#ifdef COMPILE_DL_JSON #ifdef COMPILE_DL_JSON
#ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE;
#endif
ZEND_GET_MODULE(json) ZEND_GET_MODULE(json)
#endif #endif

View file

@ -44,7 +44,10 @@ ZEND_BEGIN_MODULE_GLOBALS(json)
ZEND_END_MODULE_GLOBALS(json) ZEND_END_MODULE_GLOBALS(json)
#ifdef ZTS #ifdef ZTS
# define JSON_G(v) TSRMG(json_globals_id, zend_json_globals *, v) # define JSON_G(v) ZEND_TSRMG(json_globals_id, zend_json_globals *, v)
# ifdef COMPILE_DL_JSON
ZEND_TSRMLS_CACHE_EXTERN;
# endif
#else #else
# define JSON_G(v) (json_globals.v) # define JSON_G(v) (json_globals.v)
#endif #endif

View file

@ -11,7 +11,7 @@ PHP_ARG_WITH(mm,for mm support,
if test "$PHP_SESSION" != "no"; then if test "$PHP_SESSION" != "no"; then
PHP_PWRITE_TEST PHP_PWRITE_TEST
PHP_PREAD_TEST PHP_PREAD_TEST
PHP_NEW_EXTENSION(session, mod_user_class.c session.c mod_files.c mod_mm.c mod_user.c, $ext_shared) PHP_NEW_EXTENSION(session, mod_user_class.c session.c mod_files.c mod_mm.c mod_user.c, $ext_shared, -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1)
PHP_ADD_EXTENSION_DEP(session, hash, true) PHP_ADD_EXTENSION_DEP(session, hash, true)
PHP_ADD_EXTENSION_DEP(session, spl) PHP_ADD_EXTENSION_DEP(session, spl)
PHP_SUBST(SESSION_SHARED_LIBADD) PHP_SUBST(SESSION_SHARED_LIBADD)

View file

@ -4,7 +4,7 @@
ARG_ENABLE("session", "session support", "yes"); ARG_ENABLE("session", "session support", "yes");
if (PHP_SESSION == "yes") { if (PHP_SESSION == "yes") {
EXTENSION("session", "mod_user_class.c session.c mod_files.c mod_mm.c mod_user.c", false /* never shared */); EXTENSION("session", "mod_user_class.c session.c mod_files.c mod_mm.c mod_user.c", false /* never shared */, "/DZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
AC_DEFINE("HAVE_PHP_SESSION", 1, "Session support"); AC_DEFINE("HAVE_PHP_SESSION", 1, "Session support");
PHP_INSTALL_HEADERS("ext/session/", "mod_mm.h php_session.h mod_files.h mod_user.h"); PHP_INSTALL_HEADERS("ext/session/", "mod_mm.h php_session.h mod_files.h mod_user.h");
} }

View file

@ -189,7 +189,10 @@ extern zend_module_entry session_module_entry;
#define phpext_session_ptr &session_module_entry #define phpext_session_ptr &session_module_entry
#ifdef ZTS #ifdef ZTS
#define PS(v) TSRMG(ps_globals_id, php_ps_globals *, v) #define PS(v) ZEND_TSRMG(ps_globals_id, php_ps_globals *, v)
#ifdef COMPILE_DL_SESSION
ZEND_TSRMLS_CACHE_EXTERN;
#endif
#else #else
#define PS(v) (ps_globals.v) #define PS(v) (ps_globals.v)
#endif #endif

View file

@ -2399,6 +2399,10 @@ static PHP_GINIT_FUNCTION(ps) /* {{{ */
{ {
int i; int i;
#if defined(COMPILE_DL_SESSION) && defined(ZTS)
ZEND_TSRMLS_CACHE_UPDATE;
#endif
ps_globals->save_path = NULL; ps_globals->save_path = NULL;
ps_globals->session_name = NULL; ps_globals->session_name = NULL;
ps_globals->id = NULL; ps_globals->id = NULL;
@ -2825,6 +2829,9 @@ zend_module_entry session_module_entry = {
}; };
#ifdef COMPILE_DL_SESSION #ifdef COMPILE_DL_SESSION
#ifdef ZTS
ZEND_TSRMLS_CACHE_DEFINE;
#endif
ZEND_GET_MODULE(session) ZEND_GET_MODULE(session)
#endif #endif