summaryrefslogtreecommitdiff
path: root/ext/opcache/zend_file_cache.c
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2021-03-17 12:19:09 +0100
committerNikita Popov <nikita.ppv@gmail.com>2021-03-17 12:20:58 +0100
commit709e45d89b35f77d1cdc89f57a8150fc6c9b859c (patch)
treef88de7872274afa84b543e32e4b493a99d68e606 /ext/opcache/zend_file_cache.c
parent994d4199d558aefbdca09394541164106e8abc28 (diff)
downloadphp-git-709e45d89b35f77d1cdc89f57a8150fc6c9b859c.tar.gz
Avoid unnecessary static_variables persistence
static_variables should be treated the same way as all other op_array components nowadays (only static_variables_ptr is special). There's no need to persist/serialize it is separately per shared op_array.
Diffstat (limited to 'ext/opcache/zend_file_cache.c')
-rw-r--r--ext/opcache/zend_file_cache.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/ext/opcache/zend_file_cache.c b/ext/opcache/zend_file_cache.c
index 1021992b3a..4c7611d36d 100644
--- a/ext/opcache/zend_file_cache.c
+++ b/ext/opcache/zend_file_cache.c
@@ -461,18 +461,10 @@ static void zend_file_cache_serialize_op_array(zend_op_array *op_arra
return;
}
- if (op_array->static_variables) {
- HashTable *ht;
-
- SERIALIZE_PTR(op_array->static_variables);
- ht = op_array->static_variables;
- UNSERIALIZE_PTR(ht);
- zend_file_cache_serialize_hash(ht, script, info, buf, zend_file_cache_serialize_zval);
- }
-
if (op_array->scope) {
if (UNEXPECTED(zend_shared_alloc_get_xlat_entry(op_array->opcodes))) {
op_array->refcount = (uint32_t*)(intptr_t)-1;
+ SERIALIZE_PTR(op_array->static_variables);
SERIALIZE_PTR(op_array->literals);
SERIALIZE_PTR(op_array->opcodes);
SERIALIZE_PTR(op_array->arg_info);
@@ -490,6 +482,15 @@ static void zend_file_cache_serialize_op_array(zend_op_array *op_arra
zend_shared_alloc_register_xlat_entry(op_array->opcodes, op_array->opcodes);
}
+ if (op_array->static_variables) {
+ HashTable *ht;
+
+ SERIALIZE_PTR(op_array->static_variables);
+ ht = op_array->static_variables;
+ UNSERIALIZE_PTR(ht);
+ zend_file_cache_serialize_hash(ht, script, info, buf, zend_file_cache_serialize_zval);
+ }
+
if (op_array->literals) {
zval *p, *end;
@@ -1274,17 +1275,9 @@ static void zend_file_cache_unserialize_op_array(zend_op_array *op_arr
return;
}
- if (op_array->static_variables) {
- HashTable *ht;
-
- UNSERIALIZE_PTR(op_array->static_variables);
- ht = op_array->static_variables;
- zend_file_cache_unserialize_hash(ht,
- script, buf, zend_file_cache_unserialize_zval, ZVAL_PTR_DTOR);
- }
-
if (op_array->refcount) {
op_array->refcount = NULL;
+ UNSERIALIZE_PTR(op_array->static_variables);
UNSERIALIZE_PTR(op_array->literals);
UNSERIALIZE_PTR(op_array->opcodes);
UNSERIALIZE_PTR(op_array->arg_info);
@@ -1300,6 +1293,15 @@ static void zend_file_cache_unserialize_op_array(zend_op_array *op_arr
return;
}
+ if (op_array->static_variables) {
+ HashTable *ht;
+
+ UNSERIALIZE_PTR(op_array->static_variables);
+ ht = op_array->static_variables;
+ zend_file_cache_unserialize_hash(ht,
+ script, buf, zend_file_cache_unserialize_zval, ZVAL_PTR_DTOR);
+ }
+
if (op_array->literals) {
zval *p, *end;