rfc:native-tls

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
rfc:native-tls [2014/11/19 21:38]
ab
rfc:native-tls [2017/09/22 13:28] (current)
Line 3: Line 3:
   * Date: 2014-11-19   * Date: 2014-11-19
   * Author: Anatol Belski, ab@php.net   * Author: Anatol Belski, ab@php.net
-  * Status: Draft /* (or Under Discussion or Accepted or Declined) */ +  * Status: Accepted
-  /* * First Published at: http://wiki.php.net/rfc/your_rfc_name */+
  
 ===== Introduction ===== ===== Introduction =====
Line 30: Line 29:
  
   - all the TSRMLS_* macros was made placebo   - all the TSRMLS_* macros was made placebo
-  - TSRMG macro which is used to access the globals now can has two variants+  - TSRMG macro which is used to access the globals now can have two variants
     - using the tsrm_tls_cache() function which fetches the thread specific globals using the underlaying platform API (for example pthreads on linux or windows specific on windows)     - using the tsrm_tls_cache() function which fetches the thread specific globals using the underlaying platform API (for example pthreads on linux or windows specific on windows)
-    - using a previously defined pointer +    - using a previously defined pointer which is global within a binary unit and is updated per thread 
 +  - core was ported to use the static per binary unit cache (the second variant above), the enablement was done step by step
  
-As also described in the base RFC, the main difficulty to make this process cross platform is that it is not every compiler (for instance Visual Studio) support sharing a thread specific variable between shared objects. For that reason, the function call to tsrm_get_ls_cache() is needed at least once per thread in order to work with the thread specific resources. Such an operation is needed to be done within every binary unit.+As also described in the base RFC, the main difficulty to make this process cross platform is that not every compiler (for instance Visual Studio) support sharing a thread specific variable between shared objects. For that reason, the function call to tsrm_get_ls_cache() is needed at least once per thread in order to work with the thread specific resources. Such an operation is needed to be done within every binary unit.
  
-In the patch, almost any macros accessing globals, like EG, CG, etc. are ported to use a local TSRMLS pointer which is static to that binary unit. For that three steps required+In the patch, almost any macros accessing globals, like EG, CG, etc. are ported to use a local TSRMLS pointer which is static to that binary unit (i.e. shared extension or SAPI bin/dll/so). For that three steps are required
  
   - defining a tsrmls cache holder for a binary unit (ZEND_TSRMLS_CACHE_DEFINE macro)   - defining a tsrmls cache holder for a binary unit (ZEND_TSRMLS_CACHE_DEFINE macro)
Line 42: Line 42:
   - integrate a mechanism to update that pointer per thread and binary unit (ZEND_TSRMLS_CACHE_UPDATE macro)   - integrate a mechanism to update that pointer per thread and binary unit (ZEND_TSRMLS_CACHE_UPDATE macro)
  
 +These are also the steps required to port an extension/SAPI to be compatible with the patch. The porting was done step by step and the static TSRMLS cache is only enabled when ZEND_ENABLE_STATIC_TSRMLS_CACHE macro is defined from the config.* script. Otherwise the method with dynamic cache fetching per tsrm_get_ls_cache() is used.
 +
 +**Currently all the ocurrencies with TSRMLS_* macros evaluate to empty but left at their places, so then the diff shows the real change done. They are going to be removed once the RFC is accepted and before it was merged**
  
 ===== Proposed PHP Version(s) ===== ===== Proposed PHP Version(s) =====
Line 52: Line 55:
 ==== To Existing Extensions ==== ==== To Existing Extensions ====
 See implementation details. See implementation details.
 +
 +==== To operating systems ====
 +A potential incompatibility to not widely used operating systems can be introduced. Any Unix (like) OS using pthreads or other threads implementation supported by the TSRM layer, or any x86/x64 Windows system, are supported. That covers good 99% of the target OSes (please read the base RFC for more details).
  
 ===== Open Issues ===== ===== Open Issues =====
Line 63: Line 69:
   * depending on compiler evolution, fetching thread id per function could be replaced with a real global variable shared across all the binary units (.so, .dll, .exe)   * depending on compiler evolution, fetching thread id per function could be replaced with a real global variable shared across all the binary units (.so, .dll, .exe)
  
-===== Proposed Voting Choices ===== +===== Vote ===== 
-yes, no +<doodle title="Native TLS" auth="ab" voteType="single" closed="true"> 
- +   * Yes 
-50%+1 majority required+   * No 
 +</doodle> 
 +\\ 
 +The vote starts on 12/10/2014 at 21:00 CET and ends on 12/17/2014 at 21:00 CET. 50%+1 majority required.
  
 ===== Patches and Tests ===== ===== Patches and Tests =====
rfc/native-tls.1416433107.txt.gz · Last modified: 2017/09/22 13:28 (external edit)