Simplify call frame initialization

This commit is contained in:
Dmitry Stogov 2019-04-11 02:08:32 +03:00
parent 0d91b046a3
commit cc900edd77
12 changed files with 392 additions and 344 deletions

View file

@ -634,6 +634,8 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /
zend_execute_data *call, dummy_execute_data;
zend_fcall_info_cache fci_cache_local;
zend_function *func;
uint32_t call_info;
void *object_or_called_scope;
ZVAL_UNDEF(fci->retval);
@ -695,11 +697,18 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache) /
}
func = fci_cache->function_handler;
fci->object = (func->common.fn_flags & ZEND_ACC_STATIC) ?
NULL : fci_cache->object;
if ((func->common.fn_flags & ZEND_ACC_STATIC) || !fci_cache->object) {
fci->object = NULL;
object_or_called_scope = fci_cache->called_scope;
call_info = ZEND_CALL_TOP_FUNCTION | ZEND_CALL_DYNAMIC;
} else {
fci->object = fci_cache->object;
object_or_called_scope = fci->object;
call_info = ZEND_CALL_TOP_FUNCTION | ZEND_CALL_DYNAMIC | ZEND_CALL_HAS_THIS;
}
call = zend_vm_stack_push_call_frame(ZEND_CALL_TOP_FUNCTION | ZEND_CALL_DYNAMIC,
func, fci->param_count, fci_cache->called_scope, fci->object);
call = zend_vm_stack_push_call_frame(call_info,
func, fci->param_count, object_or_called_scope);
if (UNEXPECTED(func->common.fn_flags & ZEND_ACC_DEPRECATED)) {
zend_error(E_DEPRECATED, "Function %s%s%s() is deprecated",