From 15ba03fc80d88481b68ad6aaa8d6b6070b26a1ba Mon Sep 17 00:00:00 2001 From: Dmitry Stogov Date: Tue, 10 Jun 2014 00:16:18 +0400 Subject: [PATCH] Avoid repeatable zend_is_autogolobal() calls --- ext/opcache/ZendAccelerator.c | 4 +++- ext/opcache/ZendAccelerator.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index 70dbc2cb08..37e0b3b361 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -1281,7 +1281,8 @@ static void zend_accel_set_auto_globals(int mask TSRMLS_DC) int n = 1; for (i = 0; i < ag_size ; i++) { - if (mask & n) { + if ((mask & n) && !(ZCG(auto_globals_mask) & n)) { + ZCG(auto_globals_mask) |= n; zend_is_auto_global(jit_auto_globals_str[i] TSRMLS_CC); } n += n; @@ -2110,6 +2111,7 @@ static void accel_activate(void) SHM_UNPROTECT(); /* PHP-5.4 and above return "double", but we use 1 sec precision */ + ZCG(auto_globals_mask) = 0; ZCG(request_time) = (time_t)sapi_get_request_time(TSRMLS_C); ZCG(cache_opline) = NULL; ZCG(cache_persistent_script) = NULL; diff --git a/ext/opcache/ZendAccelerator.h b/ext/opcache/ZendAccelerator.h index 46e97a4dd0..bfa0386697 100644 --- a/ext/opcache/ZendAccelerator.h +++ b/ext/opcache/ZendAccelerator.h @@ -261,6 +261,7 @@ typedef struct _zend_accel_globals { char *include_path; /* current section of "include_path" directive */ int include_path_len; /* "include_path" string length */ int include_path_check; + int auto_globals_mask; time_t request_time; /* preallocated shared-memory block to save current script */ void *mem; -- 2.40.0