summaryrefslogtreecommitdiff
path: root/TSRM
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2014-10-15 16:33:40 +0200
committerAnatol Belski <ab@php.net>2014-10-15 16:33:40 +0200
commit8aeffdd74c826b5012c9b052848cfa8e593776ed (patch)
treef1ba84465211d50075c5e3a14e9d7eaf08bd95be /TSRM
parent991a04b068c0b49ed5022d8da735002c5187031b (diff)
downloadphp-git-8aeffdd74c826b5012c9b052848cfa8e593776ed.tar.gz
moved most of the core to use static tsrm ls cache pointer
plus apache2handler, cli and cgi
Diffstat (limited to 'TSRM')
-rw-r--r--TSRM/TSRM.c4
-rw-r--r--TSRM/TSRM.h4
-rw-r--r--TSRM/config.w321
-rw-r--r--TSRM/tsrm_win32.c3
-rw-r--r--TSRM/tsrm_win32.h3
5 files changed, 13 insertions, 2 deletions
diff --git a/TSRM/TSRM.c b/TSRM/TSRM.c
index b1f992c91d..df831f31b8 100644
--- a/TSRM/TSRM.c
+++ b/TSRM/TSRM.c
@@ -22,6 +22,10 @@
typedef struct _tsrm_tls_entry tsrm_tls_entry;
+#if defined(TSRM_WIN32)
+/* TSRMLS_CACHE_DEFINE; is already done in Zend, this is being always compiled statically. */
+#endif
+
struct _tsrm_tls_entry {
void **storage;
int count;
diff --git a/TSRM/TSRM.h b/TSRM/TSRM.h
index de5908f4b2..e5b9e54954 100644
--- a/TSRM/TSRM.h
+++ b/TSRM/TSRM.h
@@ -173,7 +173,8 @@ TSRM_API inline void *tsrm_get_ls_cache(void);
#define TSRMG_STATIC(id, type, element) (((type) (*((void ***) _tsrm_ls_cache))[TSRM_UNSHUFFLE_RSRC_ID(id)])->element)
#define TSRMLS_CACHE_EXTERN extern TSRM_TLS void *_tsrm_ls_cache
#define TSRMLS_CACHE_DEFINE TSRM_TLS void *_tsrm_ls_cache
-#define TSRMLS_CACHE_UPDATE _tsrm_ls_cache = tsrm_get_ls_cache()
+#define TSRMLS_CACHE_UPDATE if (!TSRMLS_CACHE) _tsrm_ls_cache = tsrm_get_ls_cache()
+#define TSRMLS_CACHE _tsrm_ls_cache
/* BC only */
#define TSRMLS_D
@@ -196,6 +197,7 @@ TSRM_API inline void *tsrm_get_ls_cache(void);
#define TSRMLS_CACHE_EXTERN
#define TSRMLS_CACHE_DEFINE
#define TSRMLS_CACHE_UPDATE
+#define TSRMLS_CACHE
/* BC only */
#define TSRMLS_D void
diff --git a/TSRM/config.w32 b/TSRM/config.w32
index 91b4eead2a..e7d3f3b976 100644
--- a/TSRM/config.w32
+++ b/TSRM/config.w32
@@ -2,4 +2,5 @@
// $Id$
ADD_SOURCES("TSRM", "TSRM.c tsrm_strtok_r.c tsrm_win32.c");
+ADD_FLAG("CFLAGS_BD_TSRM", "/D ZEND_ENABLE_STATIC_TSRMLS_CACHE=1");
diff --git a/TSRM/tsrm_win32.c b/TSRM/tsrm_win32.c
index faa186a1bb..9358718648 100644
--- a/TSRM/tsrm_win32.c
+++ b/TSRM/tsrm_win32.c
@@ -42,6 +42,9 @@ static tsrm_win32_globals win32_globals;
static void tsrm_win32_ctor(tsrm_win32_globals *globals TSRMLS_DC)
{
+#ifdef ZTS
+TSRMLS_CACHE_UPDATE;
+#endif
globals->process = NULL;
globals->shm = NULL;
globals->process_size = 0;
diff --git a/TSRM/tsrm_win32.h b/TSRM/tsrm_win32.h
index 5933b54ddf..ae96505590 100644
--- a/TSRM/tsrm_win32.h
+++ b/TSRM/tsrm_win32.h
@@ -68,7 +68,8 @@ typedef struct {
} tsrm_win32_globals;
#ifdef ZTS
-# define TWG(v) TSRMG(win32_globals_id, tsrm_win32_globals *, v)
+# define TWG(v) TSRMG_STATIC(win32_globals_id, tsrm_win32_globals *, v)
+TSRMLS_CACHE_EXTERN;
#else
# define TWG(v) (win32_globals.v)
#endif