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 --- main/php_globals.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'main/php_globals.h') diff --git a/main/php_globals.h b/main/php_globals.h index a60efe69de..0e088d20f0 100644 --- a/main/php_globals.h +++ b/main/php_globals.h @@ -27,7 +27,7 @@ typedef struct _php_core_globals php_core_globals; #ifdef ZTS # define PG(v) TSRMG(core_globals_id, php_core_globals *, v) -extern PHPAPI int core_globals_id; +TSRMG_DH(php_core_globals, core_globals_id); #else # define PG(v) (core_globals.v) extern ZEND_API struct _php_core_globals core_globals; -- 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. --- main/php_globals.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'main/php_globals.h') diff --git a/main/php_globals.h b/main/php_globals.h index 0e088d20f0..a60efe69de 100644 --- a/main/php_globals.h +++ b/main/php_globals.h @@ -27,7 +27,7 @@ typedef struct _php_core_globals php_core_globals; #ifdef ZTS # define PG(v) TSRMG(core_globals_id, php_core_globals *, v) -TSRMG_DH(php_core_globals, core_globals_id); +extern PHPAPI int core_globals_id; #else # define PG(v) (core_globals.v) extern ZEND_API struct _php_core_globals core_globals; -- cgit v1.2.1 From ebaa6a74a51d435c81489d7ea5df41e286135465 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Tue, 7 Oct 2014 09:09:46 +0200 Subject: force more static tsrmls cache usage --- main/php_globals.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'main/php_globals.h') diff --git a/main/php_globals.h b/main/php_globals.h index a60efe69de..76933d8f07 100644 --- a/main/php_globals.h +++ b/main/php_globals.h @@ -26,7 +26,7 @@ typedef struct _php_core_globals php_core_globals; #ifdef ZTS -# define PG(v) TSRMG(core_globals_id, php_core_globals *, v) +# define PG(v) ZEND_TSRMG(core_globals_id, php_core_globals *, v) extern PHPAPI int core_globals_id; #else # define PG(v) (core_globals.v) -- cgit v1.2.1