mirror of
https://github.com/php/php-src.git
synced 2025-08-16 14:08:47 +02:00
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.
This commit is contained in:
parent
994d4199d5
commit
709e45d89b
3 changed files with 32 additions and 30 deletions
|
@ -461,18 +461,10 @@ static void zend_file_cache_serialize_op_array(zend_op_array *op_arra
|
||||||
return;
|
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 (op_array->scope) {
|
||||||
if (UNEXPECTED(zend_shared_alloc_get_xlat_entry(op_array->opcodes))) {
|
if (UNEXPECTED(zend_shared_alloc_get_xlat_entry(op_array->opcodes))) {
|
||||||
op_array->refcount = (uint32_t*)(intptr_t)-1;
|
op_array->refcount = (uint32_t*)(intptr_t)-1;
|
||||||
|
SERIALIZE_PTR(op_array->static_variables);
|
||||||
SERIALIZE_PTR(op_array->literals);
|
SERIALIZE_PTR(op_array->literals);
|
||||||
SERIALIZE_PTR(op_array->opcodes);
|
SERIALIZE_PTR(op_array->opcodes);
|
||||||
SERIALIZE_PTR(op_array->arg_info);
|
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);
|
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) {
|
if (op_array->literals) {
|
||||||
zval *p, *end;
|
zval *p, *end;
|
||||||
|
|
||||||
|
@ -1274,17 +1275,9 @@ static void zend_file_cache_unserialize_op_array(zend_op_array *op_arr
|
||||||
return;
|
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) {
|
if (op_array->refcount) {
|
||||||
op_array->refcount = NULL;
|
op_array->refcount = NULL;
|
||||||
|
UNSERIALIZE_PTR(op_array->static_variables);
|
||||||
UNSERIALIZE_PTR(op_array->literals);
|
UNSERIALIZE_PTR(op_array->literals);
|
||||||
UNSERIALIZE_PTR(op_array->opcodes);
|
UNSERIALIZE_PTR(op_array->opcodes);
|
||||||
UNSERIALIZE_PTR(op_array->arg_info);
|
UNSERIALIZE_PTR(op_array->arg_info);
|
||||||
|
@ -1300,6 +1293,15 @@ static void zend_file_cache_unserialize_op_array(zend_op_array *op_arr
|
||||||
return;
|
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) {
|
if (op_array->literals) {
|
||||||
zval *p, *end;
|
zval *p, *end;
|
||||||
|
|
||||||
|
|
|
@ -480,6 +480,12 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc
|
||||||
op_array->prototype = NULL;
|
op_array->prototype = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (op_array->scope
|
||||||
|
&& !(op_array->fn_flags & ZEND_ACC_CLOSURE)
|
||||||
|
&& (op_array->scope->ce_flags & ZEND_ACC_CACHED)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (op_array->static_variables && !zend_accel_in_shm(op_array->static_variables)) {
|
if (op_array->static_variables && !zend_accel_in_shm(op_array->static_variables)) {
|
||||||
Bucket *p;
|
Bucket *p;
|
||||||
|
|
||||||
|
@ -495,12 +501,6 @@ static void zend_persist_op_array_ex(zend_op_array *op_array, zend_persistent_sc
|
||||||
GC_TYPE_INFO(op_array->static_variables) = GC_ARRAY | ((IS_ARRAY_IMMUTABLE|GC_NOT_COLLECTABLE) << GC_FLAGS_SHIFT);
|
GC_TYPE_INFO(op_array->static_variables) = GC_ARRAY | ((IS_ARRAY_IMMUTABLE|GC_NOT_COLLECTABLE) << GC_FLAGS_SHIFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (op_array->scope
|
|
||||||
&& !(op_array->fn_flags & ZEND_ACC_CLOSURE)
|
|
||||||
&& (op_array->scope->ce_flags & ZEND_ACC_CACHED)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (op_array->literals) {
|
if (op_array->literals) {
|
||||||
zval *p, *end;
|
zval *p, *end;
|
||||||
|
|
||||||
|
|
|
@ -203,6 +203,12 @@ static void zend_persist_op_array_calc_ex(zend_op_array *op_array)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (op_array->scope
|
||||||
|
&& !(op_array->fn_flags & ZEND_ACC_CLOSURE)
|
||||||
|
&& (op_array->scope->ce_flags & ZEND_ACC_CACHED)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (op_array->static_variables && !zend_accel_in_shm(op_array->static_variables)) {
|
if (op_array->static_variables && !zend_accel_in_shm(op_array->static_variables)) {
|
||||||
if (!zend_shared_alloc_get_xlat_entry(op_array->static_variables)) {
|
if (!zend_shared_alloc_get_xlat_entry(op_array->static_variables)) {
|
||||||
Bucket *p;
|
Bucket *p;
|
||||||
|
@ -218,12 +224,6 @@ static void zend_persist_op_array_calc_ex(zend_op_array *op_array)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (op_array->scope
|
|
||||||
&& !(op_array->fn_flags & ZEND_ACC_CLOSURE)
|
|
||||||
&& (op_array->scope->ce_flags & ZEND_ACC_CACHED)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (op_array->literals) {
|
if (op_array->literals) {
|
||||||
zval *p = op_array->literals;
|
zval *p = op_array->literals;
|
||||||
zval *end = p + op_array->last_literal;
|
zval *end = p + op_array->last_literal;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue