mirror of
https://github.com/php/php-src.git
synced 2024-11-23 18:04:36 +08:00
Merge branch 'master' into preload
* master: Call function_add_ref() in proper place Updated to version 2018.7 (2018g) Updated to version 2018.7 (2018g) Updated to version 2018.7 (2018g) Reslove inherited op_array references once afrer all optimizations.
This commit is contained in:
commit
eb6e2c529f
@ -1301,7 +1301,6 @@ static void zend_add_trait_method(zend_class_entry *ce, const char *name, zend_s
|
||||
}
|
||||
}
|
||||
|
||||
function_add_ref(fn);
|
||||
if (UNEXPECTED(fn->type == ZEND_INTERNAL_FUNCTION)) {
|
||||
new_fn = zend_arena_alloc(&CG(arena), sizeof(zend_internal_function));
|
||||
memcpy(new_fn, fn, sizeof(zend_internal_function));
|
||||
@ -1310,10 +1309,8 @@ static void zend_add_trait_method(zend_class_entry *ce, const char *name, zend_s
|
||||
new_fn = zend_arena_alloc(&CG(arena), sizeof(zend_op_array));
|
||||
memcpy(new_fn, fn, sizeof(zend_op_array));
|
||||
new_fn->op_array.fn_flags &= ~ZEND_ACC_IMMUTABLE;
|
||||
ZEND_MAP_PTR_INIT(new_fn->op_array.run_time_cache, zend_arena_alloc(&CG(arena), sizeof(void*)));
|
||||
ZEND_MAP_PTR_SET(new_fn->op_array.run_time_cache, NULL);
|
||||
ZEND_MAP_PTR_INIT(new_fn->op_array.static_variables_ptr, &new_fn->op_array.static_variables);
|
||||
}
|
||||
function_add_ref(new_fn);
|
||||
fn = zend_hash_update_ptr(&ce->function_table, key, new_fn);
|
||||
zend_add_magic_methods(ce, key, fn);
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1444,13 +1444,6 @@ int zend_optimize_script(zend_script *script, zend_long optimization_level, zend
|
||||
ZEND_HASH_FOREACH_STR_KEY_PTR(&ce->function_table, name, op_array) {
|
||||
if (op_array->scope == ce) {
|
||||
zend_optimize_op_array(op_array, &ctx);
|
||||
} else if (op_array->type == ZEND_USER_FUNCTION) {
|
||||
zend_op_array *orig_op_array;
|
||||
if ((orig_op_array = zend_hash_find_ptr(&op_array->scope->function_table, name)) != NULL) {
|
||||
HashTable *ht = op_array->static_variables;
|
||||
*op_array = *orig_op_array;
|
||||
op_array->static_variables = ht;
|
||||
}
|
||||
}
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
@ -1540,19 +1533,6 @@ int zend_optimize_script(zend_script *script, zend_long optimization_level, zend
|
||||
ZEND_SET_FUNC_INFO(call_graph.op_arrays[i], NULL);
|
||||
}
|
||||
|
||||
ZEND_HASH_FOREACH_PTR(&script->class_table, ce) {
|
||||
ZEND_HASH_FOREACH_STR_KEY_PTR(&ce->function_table, name, op_array) {
|
||||
if (op_array->scope != ce && op_array->type == ZEND_USER_FUNCTION) {
|
||||
zend_op_array *orig_op_array;
|
||||
if ((orig_op_array = zend_hash_find_ptr(&op_array->scope->function_table, name)) != NULL) {
|
||||
HashTable *ht = op_array->static_variables;
|
||||
*op_array = *orig_op_array;
|
||||
op_array->static_variables = ht;
|
||||
}
|
||||
}
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
|
||||
zend_arena_release(&ctx.arena, checkpoint);
|
||||
} else
|
||||
#endif
|
||||
@ -1568,18 +1548,28 @@ int zend_optimize_script(zend_script *script, zend_long optimization_level, zend
|
||||
ZEND_HASH_FOREACH_STR_KEY_PTR(&ce->function_table, name, op_array) {
|
||||
if (op_array->scope == ce) {
|
||||
zend_adjust_fcall_stack_size(op_array, &ctx);
|
||||
} else if (op_array->type == ZEND_USER_FUNCTION) {
|
||||
zend_op_array *orig_op_array;
|
||||
if ((orig_op_array = zend_hash_find_ptr(&op_array->scope->function_table, name)) != NULL) {
|
||||
HashTable *ht = op_array->static_variables;
|
||||
*op_array = *orig_op_array;
|
||||
op_array->static_variables = ht;
|
||||
}
|
||||
}
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
}
|
||||
|
||||
ZEND_HASH_FOREACH_PTR(&script->class_table, ce) {
|
||||
ZEND_HASH_FOREACH_STR_KEY_PTR(&ce->function_table, name, op_array) {
|
||||
if (op_array->scope != ce && op_array->type == ZEND_USER_FUNCTION) {
|
||||
zend_op_array *orig_op_array =
|
||||
zend_hash_find_ptr(&op_array->scope->function_table, name);
|
||||
|
||||
ZEND_ASSERT(orig_op_array != NULL);
|
||||
if (orig_op_array != op_array) {
|
||||
HashTable *ht = op_array->static_variables;
|
||||
|
||||
*op_array = *orig_op_array;
|
||||
op_array->static_variables = ht;
|
||||
}
|
||||
}
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
|
||||
if ((debug_level & ZEND_DUMP_AFTER_OPTIMIZER) &&
|
||||
(ZEND_OPTIMIZER_PASS_7 & optimization_level)) {
|
||||
zend_dump_op_array(&script->main_op_array, ZEND_DUMP_RT_CONSTANTS, "after optimizer", NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user