Skip to content

Commit 1d10fce

Browse files
committed
Allocate a fast thread-safe-resource id for opcache
1 parent 659f55a commit 1d10fce

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

ext/opcache/ZendAccelerator.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3162,7 +3162,7 @@ void start_accel_extension(void)
31623162
static int accel_startup(zend_extension *extension)
31633163
{
31643164
#ifdef ZTS
3165-
accel_globals_id = ts_allocate_id(&accel_globals_id, sizeof(zend_accel_globals), (ts_allocate_ctor) accel_globals_ctor, (ts_allocate_dtor) accel_globals_dtor);
3165+
accel_globals_id = ts_allocate_fast_id(&accel_globals_id, sizeof(zend_accel_globals), (ts_allocate_ctor) accel_globals_ctor, (ts_allocate_dtor) accel_globals_dtor);
31663166
#else
31673167
accel_globals_ctor(&accel_globals);
31683168
#endif

ext/opcache/ZendAccelerator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ extern zend_accel_shared_globals *accel_shared_globals;
300300
#define ZCSG(element) (accel_shared_globals->element)
301301

302302
#ifdef ZTS
303-
# define ZCG(v) ZEND_TSRMG(accel_globals_id, zend_accel_globals *, v)
303+
# define ZCG(v) ZEND_TSRMG_FAST(accel_globals_id, zend_accel_globals *, v)
304304
extern int accel_globals_id;
305305
#else
306306
# define ZCG(v) (accel_globals.v)

main/main.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
#include "ext/date/php_date.h"
5252
#include "ext/random/php_random_csprng.h"
5353
#include "ext/random/php_random_zend_utils.h"
54+
#include "ext/opcache/ZendAccelerator.h"
5455
#include "php_variables.h"
5556
#include "ext/standard/credits.h"
5657
#ifdef PHP_WIN32
@@ -2773,7 +2774,8 @@ PHPAPI void php_reserve_tsrm_memory(void)
27732774
TSRM_ALIGNED_SIZE(zend_mm_globals_size()) +
27742775
TSRM_ALIGNED_SIZE(zend_gc_globals_size()) +
27752776
TSRM_ALIGNED_SIZE(sizeof(php_core_globals)) +
2776-
TSRM_ALIGNED_SIZE(sizeof(sapi_globals_struct))
2777+
TSRM_ALIGNED_SIZE(sizeof(sapi_globals_struct)) +
2778+
TSRM_ALIGNED_SIZE(sizeof(zend_accel_shared_globals))
27772779
);
27782780
}
27792781
/* }}} */

0 commit comments

Comments
 (0)