summaryrefslogtreecommitdiff
path: root/ext/opcache
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2021-03-11 13:42:35 +0300
committerDmitry Stogov <dmitry@zend.com>2021-03-11 13:42:35 +0300
commit65859fe17e2d0b39a7376704e46b9d240d4d2ef7 (patch)
treee3a96d3ffa90de7469e3ed2cb4193c8ae52f8f67 /ext/opcache
parentd02197853e5c2f01acd0986e2b496f502c4fe462 (diff)
downloadphp-git-65859fe17e2d0b39a7376704e46b9d240d4d2ef7.tar.gz
Inheritance cache optimization
Diffstat (limited to 'ext/opcache')
-rw-r--r--ext/opcache/ZendAccelerator.c6
-rw-r--r--ext/opcache/zend_accelerator_util_funcs.c4
2 files changed, 7 insertions, 3 deletions
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
index c2e5690273..d2349b90bd 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -2251,7 +2251,7 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type)
return zend_accel_load_script(persistent_script, from_shared_memory);
}
-static zend_inheritance_cache_entry* zend_accel_inheritance_cache_find(zend_inheritance_cache_entry *entry, zend_class_entry *ce, zend_class_entry *parent, zend_class_entry **traits_and_interfaces, bool *needs_autoload_ptr)
+static zend_always_inline zend_inheritance_cache_entry* zend_accel_inheritance_cache_find(zend_inheritance_cache_entry *entry, zend_class_entry *ce, zend_class_entry *parent, zend_class_entry **traits_and_interfaces, bool *needs_autoload_ptr)
{
uint32_t i;
@@ -2306,7 +2306,9 @@ static zend_class_entry* zend_accel_inheritance_cache_get(zend_class_entry *ce,
entry = zend_accel_inheritance_cache_find(entry, ce, parent, traits_and_interfaces, &needs_autoload);
if (entry) {
if (!needs_autoload) {
- zend_map_ptr_extend(ZCSG(map_ptr_last));
+ if (ZCSG(map_ptr_last) > CG(map_ptr_last)) {
+ zend_map_ptr_extend(ZCSG(map_ptr_last));
+ }
return entry->ce;
}
diff --git a/ext/opcache/zend_accelerator_util_funcs.c b/ext/opcache/zend_accelerator_util_funcs.c
index ad456c1bcb..6f101b0915 100644
--- a/ext/opcache/zend_accelerator_util_funcs.c
+++ b/ext/opcache/zend_accelerator_util_funcs.c
@@ -236,7 +236,9 @@ zend_op_array* zend_accel_load_script(zend_persistent_script *persistent_script,
zend_string_release_ex(name, 0);
}
- zend_map_ptr_extend(ZCSG(map_ptr_last));
+ if (ZCSG(map_ptr_last) > CG(map_ptr_last)) {
+ zend_map_ptr_extend(ZCSG(map_ptr_last));
+ }
}
if (persistent_script->script.first_early_binding_opline != (uint32_t)-1) {