From b3aebda9eaf55706af2e21178f229a171725a168 Mon Sep 17 00:00:00 2001 From: krakjoe Date: Sat, 20 Sep 2014 20:22:14 +0100 Subject: native tls initial patch --- Zend/zend_modules.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Zend/zend_modules.h') diff --git a/Zend/zend_modules.h b/Zend/zend_modules.h index 0cd9ca4d16..142e73e7dc 100644 --- a/Zend/zend_modules.h +++ b/Zend/zend_modules.h @@ -53,7 +53,7 @@ #define NO_MODULE_GLOBALS 0, NULL, NULL, NULL #ifdef ZTS -# define ZEND_MODULE_GLOBALS(module_name) sizeof(zend_##module_name##_globals), &module_name##_globals_id +# define ZEND_MODULE_GLOBALS(module_name) sizeof(zend_##module_name##_globals), &module_name##_globals_id, &module_name##_globals_id_offset #else # define ZEND_MODULE_GLOBALS(module_name) sizeof(zend_##module_name##_globals), &module_name##_globals #endif @@ -88,6 +88,7 @@ struct _zend_module_entry { size_t globals_size; #ifdef ZTS ts_rsrc_id* globals_id_ptr; + ts_rsrc_offset* globals_offset; #else void* globals_ptr; #endif -- cgit v1.2.1 From 8bbc2a56caf878898f1ae1b8ae86367959fecc2d Mon Sep 17 00:00:00 2001 From: krakjoe Date: Sat, 20 Sep 2014 21:59:39 +0100 Subject: fix STANDARD_MODULE_PROPERTIES --- Zend/zend_modules.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Zend/zend_modules.h') diff --git a/Zend/zend_modules.h b/Zend/zend_modules.h index 142e73e7dc..cc3a0aedb5 100644 --- a/Zend/zend_modules.h +++ b/Zend/zend_modules.h @@ -50,7 +50,11 @@ #define STANDARD_MODULE_PROPERTIES_EX 0, 0, NULL, 0, ZEND_MODULE_BUILD_ID +#ifdef ZTS +#define NO_MODULE_GLOBALS 0, NULL, NULL, NULL, NULL +#else #define NO_MODULE_GLOBALS 0, NULL, NULL, NULL +#endif #ifdef ZTS # define ZEND_MODULE_GLOBALS(module_name) sizeof(zend_##module_name##_globals), &module_name##_globals_id, &module_name##_globals_id_offset -- cgit v1.2.1 From d11734b4b00f57de80d931ad1c522e00082443af Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Thu, 25 Sep 2014 18:48:27 +0200 Subject: reworked the patch, less new stuff but worky TLS is already used in TSRM, the way exporting the tsrm cache through a thread local variable is not portable. Additionally, the current patch suffers from bugs which are hard to find, but prevent it to be worky with apache. What is done here is mainly uses the idea from the RFC patch, but - __thread variable is removed - offset math and declarations are removed - extra macros and definitions are removed What is done merely is - use an inline function to access the tsrm cache. The function uses the portable tsrm_tls_get macro which is cheap - all the TSRM_* macros are set to placebo. Thus this opens the way remove them later Except that, the logic is old. TSRMLS_FETCH will have to be done once per thread, then tsrm_get_ls_cache() can be used. Things seeming to be worky are cli, cli server and apache. I also tried to enable bz2 shared and it has worked out of the box. The change is yet minimal diffing to the current master bus is a worky start, IMHO. Though will have to recheck the other previously done SAPIs - embed and cgi. The offsets can be added to the tsrm_resource_type struct, then it'll not be needed to declare them in the userspace. Even the "done" member type can be changed to int16 or smaller, then adding the offset as int16 will not change the struct size. As well on the todo might be removing the hashed storage, thread_id != thread_id and linked list logic in favour of the explicit TLS operations. --- Zend/zend_modules.h | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'Zend/zend_modules.h') diff --git a/Zend/zend_modules.h b/Zend/zend_modules.h index cc3a0aedb5..0cd9ca4d16 100644 --- a/Zend/zend_modules.h +++ b/Zend/zend_modules.h @@ -50,14 +50,10 @@ #define STANDARD_MODULE_PROPERTIES_EX 0, 0, NULL, 0, ZEND_MODULE_BUILD_ID -#ifdef ZTS -#define NO_MODULE_GLOBALS 0, NULL, NULL, NULL, NULL -#else #define NO_MODULE_GLOBALS 0, NULL, NULL, NULL -#endif #ifdef ZTS -# define ZEND_MODULE_GLOBALS(module_name) sizeof(zend_##module_name##_globals), &module_name##_globals_id, &module_name##_globals_id_offset +# define ZEND_MODULE_GLOBALS(module_name) sizeof(zend_##module_name##_globals), &module_name##_globals_id #else # define ZEND_MODULE_GLOBALS(module_name) sizeof(zend_##module_name##_globals), &module_name##_globals #endif @@ -92,7 +88,6 @@ struct _zend_module_entry { size_t globals_size; #ifdef ZTS ts_rsrc_id* globals_id_ptr; - ts_rsrc_offset* globals_offset; #else void* globals_ptr; #endif -- cgit v1.2.1 From c161b95cdfbd45bd90c0327d29e1c967a4152c28 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Wed, 1 Oct 2014 17:14:53 +0200 Subject: increment Zend module API number --- Zend/zend_modules.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zend/zend_modules.h') diff --git a/Zend/zend_modules.h b/Zend/zend_modules.h index 0cd9ca4d16..9b1717d5df 100644 --- a/Zend/zend_modules.h +++ b/Zend/zend_modules.h @@ -33,7 +33,7 @@ #define ZEND_MODULE_INFO_FUNC_ARGS zend_module_entry *zend_module TSRMLS_DC #define ZEND_MODULE_INFO_FUNC_ARGS_PASSTHRU zend_module TSRMLS_CC -#define ZEND_MODULE_API_NO 20140815 +#define ZEND_MODULE_API_NO 20141001 #ifdef ZTS #define USING_ZTS 1 #else -- cgit v1.2.1 From bdeb220f48825642f84cdbf3ff23a30613c92e86 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Sat, 13 Dec 2014 23:06:14 +0100 Subject: first shot remove TSRMLS_* things --- Zend/zend_modules.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Zend/zend_modules.h') diff --git a/Zend/zend_modules.h b/Zend/zend_modules.h index 9b1717d5df..b757af642e 100644 --- a/Zend/zend_modules.h +++ b/Zend/zend_modules.h @@ -91,8 +91,8 @@ struct _zend_module_entry { #else void* globals_ptr; #endif - void (*globals_ctor)(void *global TSRMLS_DC); - void (*globals_dtor)(void *global TSRMLS_DC); + void (*globals_ctor)(void *global); + void (*globals_dtor)(void *global); int (*post_deactivate_func)(void); int module_started; unsigned char type; @@ -125,8 +125,8 @@ struct _zend_module_dep { extern ZEND_API HashTable module_registry; void module_destructor(zend_module_entry *module); -int module_registry_request_startup(zend_module_entry *module TSRMLS_DC); -int module_registry_unload_temp(const zend_module_entry *module TSRMLS_DC); +int module_registry_request_startup(zend_module_entry *module); +int module_registry_unload_temp(const zend_module_entry *module); #endif -- cgit v1.2.1 From e112f6a04e0cddc6276c426c09c0249201878f5a Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Sun, 14 Dec 2014 14:07:59 +0100 Subject: second shot on removing TSRMLS_* --- Zend/zend_modules.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'Zend/zend_modules.h') diff --git a/Zend/zend_modules.h b/Zend/zend_modules.h index b757af642e..96f1e7598f 100644 --- a/Zend/zend_modules.h +++ b/Zend/zend_modules.h @@ -26,12 +26,12 @@ #include "zend_compile.h" #include "zend_build.h" -#define INIT_FUNC_ARGS int type, int module_number TSRMLS_DC -#define INIT_FUNC_ARGS_PASSTHRU type, module_number TSRMLS_CC -#define SHUTDOWN_FUNC_ARGS int type, int module_number TSRMLS_DC -#define SHUTDOWN_FUNC_ARGS_PASSTHRU type, module_number TSRMLS_CC -#define ZEND_MODULE_INFO_FUNC_ARGS zend_module_entry *zend_module TSRMLS_DC -#define ZEND_MODULE_INFO_FUNC_ARGS_PASSTHRU zend_module TSRMLS_CC +#define INIT_FUNC_ARGS int type, int module_number +#define INIT_FUNC_ARGS_PASSTHRU type, module_number +#define SHUTDOWN_FUNC_ARGS int type, int module_number +#define SHUTDOWN_FUNC_ARGS_PASSTHRU type, module_number +#define ZEND_MODULE_INFO_FUNC_ARGS zend_module_entry *zend_module +#define ZEND_MODULE_INFO_FUNC_ARGS_PASSTHRU zend_module #define ZEND_MODULE_API_NO 20141001 #ifdef ZTS -- cgit v1.2.1