com php-src: approach local pointers in performance sensitive areas: TSRM/TSRM.h Zend/zend_alloc.c Zend/zend_ini.c

From: Date: Sat, 27 Sep 2014 16:11:56 +0000
Subject: com php-src: approach local pointers in performance sensitive areas: TSRM/TSRM.h Zend/zend_alloc.c Zend/zend_ini.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-81985@lists.php.net to get a copy of this message
Commit: 7d4f7c04b3057e41b617e33816119755e0a4fd73 Author: krakjoe <joe.watkins@live.co.uk> Sat, 27 Sep 2014 17:11:56 +0100 Parents: 3e5dd17dada58634d85363e74b53c00ecd7201b2 Branches: native-tls Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=7d4f7c04b3057e41b617e33816119755e0a4fd73 Log: approach local pointers in performance sensitive areas Changed paths: M TSRM/TSRM.h M Zend/zend_alloc.c M Zend/zend_ini.c Diff: diff --git a/TSRM/TSRM.h b/TSRM/TSRM.h index 41cd948..8290216 100644 --- a/TSRM/TSRM.h +++ b/TSRM/TSRM.h @@ -160,10 +160,13 @@ TSRM_API inline void *tsrm_get_ls_cache(void); #define TSRM_SHUFFLE_RSRC_ID(rsrc_id) ((rsrc_id)+1) #define TSRM_UNSHUFFLE_RSRC_ID(rsrc_id) ((rsrc_id)-1) -#define TSRMLS_FETCH() void ***tsrm_ls = (void ***) ts_resource_ex(0, NULL) -#define TSRMLS_FETCH_FROM_CTX(ctx) void ***tsrm_ls = (void ***) ctx -#define TSRMLS_SET_CTX(ctx) ctx = (void ***) tsrm_get_ls_cache() -#define TSRMG(id, type, element) (((type) (*((void ***) tsrm_get_ls_cache()))[TSRM_UNSHUFFLE_RSRC_ID(id)])->element) +#define TSRMLS_FETCH() void ***tsrm_ls = (void ***) ts_resource_ex(0, NULL) +#define TSRMLS_FETCH_FROM_CTX(ctx) void ***tsrm_ls = (void ***) ctx +#define TSRMLS_SET_CTX(ctx) ctx = (void ***) tsrm_get_ls_cache() +#define TSRMX(name) tsrm_ls_cache_##name +#define TSRMX_D(name) static void*** TSRMX(name) +#define TSRMGX(cache, id, type, element) (((type) (*((void ***) cache))[TSRM_UNSHUFFLE_RSRC_ID(id)])->element) +#define TSRMG(id, type, element) TSRMGX(tsrm_get_ls_cache(), id, type, element) #define TSRMLS_D #define TSRMLS_DC #define TSRMLS_C diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c index 4d65e2d..c0774d9 100644 --- a/Zend/zend_alloc.c +++ b/Zend/zend_alloc.c @@ -2007,7 +2007,8 @@ typedef struct _zend_alloc_globals { #ifdef ZTS static int alloc_globals_id; -# define AG(v) TSRMG(alloc_globals_id, zend_alloc_globals *, v) +TSRMX_D(alloc); +# define AG(v) TSRMGX(TSRMX(alloc), alloc_globals_id, zend_alloc_globals *, v) #else # define AG(v) (alloc_globals.v) static zend_alloc_globals alloc_globals; @@ -2311,7 +2312,9 @@ static void alloc_globals_dtor(zend_alloc_globals *alloc_globals TSRMLS_DC) ZEND_API void start_memory_manager(TSRMLS_D) { #ifdef ZTS - ts_allocate_id(&alloc_globals_id, sizeof(zend_alloc_globals), (ts_allocate_ctor) alloc_globals_ctor, (ts_allocate_dtor) alloc_globals_dtor); + ts_allocate_id + (&alloc_globals_id, sizeof(zend_alloc_globals), (ts_allocate_ctor) alloc_globals_ctor, (ts_allocate_dtor) alloc_globals_dtor); + TSRMX(alloc) = tsrm_get_ls_cache(); #else alloc_globals_ctor(&alloc_globals); #endif diff --git a/Zend/zend_ini.c b/Zend/zend_ini.c index 1c827bb..25155c4 100644 --- a/Zend/zend_ini.c +++ b/Zend/zend_ini.c @@ -169,6 +169,7 @@ ZEND_API int zend_copy_ini_directives(TSRMLS_D) /* {{{ */ EG(ini_directives) = (HashTable *) malloc(sizeof(HashTable)); zend_hash_init_ex(EG(ini_directives), registered_zend_ini_directives->nNumOfElements, NULL, free_ini_entry, 1, 0); zend_hash_copy(EG(ini_directives), registered_zend_ini_directives, copy_ini_entry); + return SUCCESS; } /* }}} */

« previous php.cvs (#81985) next »