Skip to content

move remaining globals into native tls storage - #25277

Open
henderkes wants to merge 5 commits into
php:masterfrom
henderkes:perf/remaining-tls-globals
Open

henderkes wants to merge 5 commits into
php:masterfrom
henderkes:perf/remaining-tls-globals

Conversation

@henderkes

Copy link
Copy Markdown
Contributor

@arnaud-lb forgive me for the PR so soon again, but thanks to the prior PRs it's purely mechanical this time around.

Next up, kind of hoping to get rid of TLS_DIRECT macro and the resource id indirection access machinery which only still exist because of Windows, but I don't know if it's feasible.

Comment thread UPGRADING.INTERNALS Resolved
Comment thread main/main.c Resolved
Comment thread ext/opcache/jit/zend_jit.c Outdated
Comment on lines +50 to +51
ZEND_API int jit_globals_id;
ZEND_TLS_API TSRM_TLS TSRM_TLS_MODEL_ATTR zend_jit_globals jit_globals;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine removing the ZEND_API / ZEND_TLS_API here, as JIT_G() is not supposed to be used outside of ext/opcache and zend_jit.h is not installed.

In zend_jit.h, we can assume ZEND_TLS_DIRECT as these globals are not accessed by other modules.

Ditto for ext/opcache/ZendAccelerator.c / ext/opcache/ZendAccelerator.h.

Comment thread Zend/zend_virtual_cwd.c
size_t cwd_globals_offset;
CWD_API ts_rsrc_id cwd_globals_id;
ZEND_TLS_API TSRM_TLS TSRM_TLS_MODEL_ATTR virtual_cwd_globals cwd_globals;
static void *cwd_globals_tls_addr(void) { return &cwd_globals; }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto (not API)

Comment thread Zend/zend_signal.h
Comment on lines +67 to +72
# ifdef ZEND_TLS_DIRECT
# define SIGG(v) (zend_signal_globals.v)
extern ZEND_TLS_API TSRM_TLS TSRM_TLS_MODEL_ATTR zend_signal_globals_t zend_signal_globals;
# else
# define SIGG(v) ZEND_TSRMG(zend_signal_globals_id, zend_signal_globals_t *, v)
# endif

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

technically there are no signals on windows, should I remove the ZEND_TLS_DIRECT check?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants