summaryrefslogtreecommitdiff
path: root/ext/opcache/ZendAccelerator.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/opcache/ZendAccelerator.c')
-rw-r--r--ext/opcache/ZendAccelerator.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
index 21dba385da..7cc301013b 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -4052,7 +4052,8 @@ static void preload_register_trait_methods(zend_class_entry *ce) {
zend_op_array *op_array;
ZEND_HASH_FOREACH_PTR(&ce->function_table, op_array) {
if (!(op_array->fn_flags & ZEND_ACC_TRAIT_CLONE)) {
- zend_shared_alloc_register_xlat_entry(op_array->opcodes, op_array);
+ ZEND_ASSERT(op_array->refcount && "Must have refcount pointer");
+ zend_shared_alloc_register_xlat_entry(op_array->refcount, op_array);
}
} ZEND_HASH_FOREACH_END();
}
@@ -4063,18 +4064,18 @@ static void preload_fix_trait_methods(zend_class_entry *ce)
ZEND_HASH_FOREACH_PTR(&ce->function_table, op_array) {
if (op_array->fn_flags & ZEND_ACC_TRAIT_CLONE) {
- zend_op_array *orig_op_array = zend_shared_alloc_get_xlat_entry(op_array->opcodes);
- if (orig_op_array) {
- zend_class_entry *scope = op_array->scope;
- uint32_t fn_flags = op_array->fn_flags;
- zend_function *prototype = op_array->prototype;
- HashTable *ht = op_array->static_variables;
- *op_array = *orig_op_array;
- op_array->scope = scope;
- op_array->fn_flags = fn_flags;
- op_array->prototype = prototype;
- op_array->static_variables = ht;
- }
+ zend_op_array *orig_op_array = zend_shared_alloc_get_xlat_entry(op_array->refcount);
+ ZEND_ASSERT(orig_op_array && "Must be in xlat table");
+
+ zend_class_entry *scope = op_array->scope;
+ uint32_t fn_flags = op_array->fn_flags;
+ zend_function *prototype = op_array->prototype;
+ HashTable *ht = op_array->static_variables;
+ *op_array = *orig_op_array;
+ op_array->scope = scope;
+ op_array->fn_flags = fn_flags;
+ op_array->prototype = prototype;
+ op_array->static_variables = ht;
}
} ZEND_HASH_FOREACH_END();
}
@@ -4105,16 +4106,12 @@ static int preload_optimize(zend_persistent_script *script)
}
ZEND_HASH_FOREACH_PTR(&script->script.class_table, ce) {
- if (ce->ce_flags & ZEND_ACC_IMPLEMENT_TRAITS) {
- preload_fix_trait_methods(ce);
- }
+ preload_fix_trait_methods(ce);
} ZEND_HASH_FOREACH_END();
ZEND_HASH_FOREACH_PTR(preload_scripts, script) {
ZEND_HASH_FOREACH_PTR(&script->script.class_table, ce) {
- if (ce->ce_flags & ZEND_ACC_IMPLEMENT_TRAITS) {
- preload_fix_trait_methods(ce);
- }
+ preload_fix_trait_methods(ce);
} ZEND_HASH_FOREACH_END();
} ZEND_HASH_FOREACH_END();