mirror of
https://github.com/php/php-src.git
synced 2025-08-17 06:28:50 +02:00
Preloading: Also handle trait methods outside main script
This commit is contained in:
parent
e3d35b6434
commit
4a2646cf45
1 changed files with 18 additions and 6 deletions
|
@ -3893,6 +3893,15 @@ static void preload_remove_empty_includes(void)
|
||||||
} ZEND_HASH_FOREACH_END();
|
} ZEND_HASH_FOREACH_END();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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_HASH_FOREACH_END();
|
||||||
|
}
|
||||||
|
|
||||||
static void preload_fix_trait_methods(zend_class_entry *ce)
|
static void preload_fix_trait_methods(zend_class_entry *ce)
|
||||||
{
|
{
|
||||||
zend_op_array *op_array;
|
zend_op_array *op_array;
|
||||||
|
@ -3918,19 +3927,22 @@ static void preload_fix_trait_methods(zend_class_entry *ce)
|
||||||
static int preload_optimize(zend_persistent_script *script)
|
static int preload_optimize(zend_persistent_script *script)
|
||||||
{
|
{
|
||||||
zend_class_entry *ce;
|
zend_class_entry *ce;
|
||||||
zend_op_array *op_array;
|
|
||||||
|
|
||||||
zend_shared_alloc_init_xlat_table();
|
zend_shared_alloc_init_xlat_table();
|
||||||
|
|
||||||
ZEND_HASH_FOREACH_PTR(&script->script.class_table, ce) {
|
ZEND_HASH_FOREACH_PTR(&script->script.class_table, ce) {
|
||||||
if (ce->ce_flags & ZEND_ACC_TRAIT) {
|
if (ce->ce_flags & ZEND_ACC_TRAIT) {
|
||||||
ZEND_HASH_FOREACH_PTR(&ce->function_table, op_array) {
|
preload_register_trait_methods(ce);
|
||||||
if (!(op_array->fn_flags & ZEND_ACC_TRAIT_CLONE)) {
|
|
||||||
zend_shared_alloc_register_xlat_entry(op_array->opcodes, op_array);
|
|
||||||
}
|
}
|
||||||
} ZEND_HASH_FOREACH_END();
|
} 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_TRAIT) {
|
||||||
|
preload_register_trait_methods(ce);
|
||||||
}
|
}
|
||||||
} ZEND_HASH_FOREACH_END();
|
} ZEND_HASH_FOREACH_END();
|
||||||
|
} ZEND_HASH_FOREACH_END();
|
||||||
|
|
||||||
if (!zend_optimize_script(&script->script, ZCG(accel_directives).optimization_level, ZCG(accel_directives).opt_debug_level)) {
|
if (!zend_optimize_script(&script->script, ZCG(accel_directives).optimization_level, ZCG(accel_directives).opt_debug_level)) {
|
||||||
return FAILURE;
|
return FAILURE;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue