Skip to content

move remaining globals into native tls storage - #25277

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

henderkes wants to merge 2 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
Comment on lines 54 to +60
- The ZTS symbols compiler_globals_offset and executor_globals_offset have been
removed: CG()/EG() now reach the globals through a __thread struct.
- PG(), SG(), CWDG(), SIGG(), ZCG(), JIT_G() and INI_SCNG() use native TLS.
The core_globals_offset, sapi_globals_offset, cwd_globals_offset,
zend_signal_globals_offset, accel_globals_offset, jit_globals_offset and
ini_scanner_globals_offset symbols have been removed.
- php_reserve_tsrm_memory() has been removed.

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.

What are the conventions here, could I just amend the initial upgrading entry?

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.

Yeah

Comment thread main/main.c

#ifdef ZTS
/* {{{ php_reserve_tsrm_memory */
PHPAPI void php_reserve_tsrm_memory(void)

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.

I assume it's fine to remove this in one go?

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.

Yes 👍

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)

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