@@ -14,6 +14,7 @@ PHP 7.0 INTERNALS UPGRADE NOTES
14
14
m. Other portable macros info
15
15
n. ZEND_ENGINE_2 removal
16
16
o. Updated final class modifier
17
+ p. TSRM changes
17
18
18
19
2. Build system changes
19
20
a. Unix build system changes
@@ -128,6 +129,47 @@ PHP 7.0 INTERNALS UPGRADE NOTES
128
129
o. Removed ZEND_ACC_FINAL_CLASS in favour of ZEND_ACC_FINAL, turning final class
129
130
modifier now a different class entry flag. Update your extensions.
130
131
132
+ p. TSRM changes
133
+
134
+ The TSRM layer undergone significant changes. It is not necessary anymore to
135
+ pass the tsrm_ls pointer explicitly. The TSRMLS_* macros should not be used
136
+ in any new developments.
137
+
138
+ The recommended way accessing globals in TS builds is by implementing it
139
+ to use a local thread unique pointer to the corresponding data pool. These
140
+ are the new macros that serve to achieve this goal:
141
+
142
+ - ZEND_TSRMG - based on TSRMG and if static pointer for data pool access is
143
+ implemented, will use it
144
+ - ZEND_TSRMLS_CACHE_EXTERN - to be used in a header shared across multiple
145
+ C/C++ files
146
+ - ZEND_TSRMLS_CACHE_DEFINE - to be used in the main extension C/C++ file
147
+ - ZEND_TSRMLS_CACHE_UPDATE - to be integrated at the top of the globals
148
+ ctor or RINIT function
149
+ - ZEND_ENABLE_STATIC_TSRMLS_CACHE - to be used in the config.[m4|w32] for
150
+ enabling the globals access per thread unique pointer
151
+ - TSRMLS_CACHE - expands to the variable name which links to the thread
152
+ unique data pool
153
+
154
+ Note that usually it will work without implementing the globals access per
155
+ a thread unique pointer, however it might cause a slowdown. The reason is
156
+ that the access model to the extension/SAPI own globals as well as the
157
+ access to the core globals is determined in the compilation phase depending
158
+ on whether ZEND_ENABLE_STATIC_TSRMLS_CACHE macro is defined.
159
+
160
+ Due to the current compiler evolution state, the TSRMLS_CACHE pointer
161
+ (when implemented) has to be present and updated in every binary unit which
162
+ is not compiled statically into PHP. So any DLL, DSO, EXE, etc. has to take
163
+ care about defining and updating it's TSRMLS cache. An update should happen
164
+ before any globals was accessed.
165
+
166
+ Porting an extension or SAPI is usually as easy as removing all the TSRMLS_*
167
+ ocurrences and integrating the macros mentioned above. However if tsrm_ls
168
+ is used explicitly, its usage can considered obsolete in most cases.
169
+ Additionally, if an extension triggers its own threads, TSRMLS_CACHE shouldn't
170
+ be passed to that threads directly.
171
+
172
+
131
173
========================
132
174
2. Build system changes
133
175
========================
0 commit comments