mirror of
https://github.com/php/php-src.git
synced 2025-08-16 14:08:47 +02:00
Separate slow path of ZEND_RECV into a cold function.
This commit is contained in:
parent
6cb0f434a4
commit
8b45fa2acb
4 changed files with 28 additions and 42 deletions
|
@ -861,6 +861,31 @@ static zend_always_inline int zend_verify_arg_type(zend_function *zf, uint32_t a
|
|||
return 1;
|
||||
}
|
||||
|
||||
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_missing_arg_error(zend_execute_data *execute_data)
|
||||
{
|
||||
zend_execute_data *ptr = EX(prev_execute_data);
|
||||
|
||||
if (ptr && ptr->func && ZEND_USER_CODE(ptr->func->common.type)) {
|
||||
zend_throw_error(NULL, "Too few arguments to function %s%s%s(), %d passed in %s on line %d and %s %d expected",
|
||||
EX(func)->common.scope ? ZSTR_VAL(EX(func)->common.scope->name) : "",
|
||||
EX(func)->common.scope ? "::" : "",
|
||||
ZSTR_VAL(EX(func)->common.function_name),
|
||||
EX_NUM_ARGS(),
|
||||
ZSTR_VAL(ptr->func->op_array.filename),
|
||||
ptr->opline->lineno,
|
||||
EX(func)->common.required_num_args == EX(func)->common.num_args ? "exactly" : "at least",
|
||||
EX(func)->common.required_num_args);
|
||||
} else {
|
||||
zend_throw_error(NULL, "Too few arguments to function %s%s%s(), %d passed and %s %d expected",
|
||||
EX(func)->common.scope ? ZSTR_VAL(EX(func)->common.scope->name) : "",
|
||||
EX(func)->common.scope ? "::" : "",
|
||||
ZSTR_VAL(EX(func)->common.function_name),
|
||||
EX_NUM_ARGS(),
|
||||
EX(func)->common.required_num_args == EX(func)->common.num_args ? "exactly" : "at least",
|
||||
EX(func)->common.required_num_args);
|
||||
}
|
||||
}
|
||||
|
||||
static ZEND_COLD void zend_verify_return_error(const zend_function *zf, const char *need_msg, const char *need_kind, const char *returned_msg, const char *returned_kind)
|
||||
{
|
||||
const char *fname = ZSTR_VAL(zf->common.function_name);
|
||||
|
|
|
@ -54,6 +54,7 @@ extern ZEND_API const zend_internal_function zend_pass_function;
|
|||
|
||||
ZEND_API void ZEND_FASTCALL zend_check_internal_arg_type(zend_function *zf, uint32_t arg_num, zval *arg);
|
||||
ZEND_API int ZEND_FASTCALL zend_check_arg_type(zend_function *zf, uint32_t arg_num, zval *arg, zval *default_value, void **cache_slot);
|
||||
ZEND_API ZEND_COLD void ZEND_FASTCALL zend_missing_arg_error(zend_execute_data *execute_data);
|
||||
|
||||
static zend_always_inline zval* zend_assign_to_variable(zval *variable_ptr, zval *value, zend_uchar value_type)
|
||||
{
|
||||
|
|
|
@ -4699,28 +4699,8 @@ ZEND_VM_HANDLER(63, ZEND_RECV, NUM, ANY)
|
|||
uint32_t arg_num = opline->op1.num;
|
||||
|
||||
if (UNEXPECTED(arg_num > EX_NUM_ARGS())) {
|
||||
zend_execute_data *ptr = EX(prev_execute_data);
|
||||
|
||||
SAVE_OPLINE();
|
||||
if (ptr && ptr->func && ZEND_USER_CODE(ptr->func->common.type)) {
|
||||
zend_throw_error(NULL, "Too few arguments to function %s%s%s(), %d passed in %s on line %d and %s %d expected",
|
||||
EX(func)->common.scope ? ZSTR_VAL(EX(func)->common.scope->name) : "",
|
||||
EX(func)->common.scope ? "::" : "",
|
||||
ZSTR_VAL(EX(func)->common.function_name),
|
||||
EX_NUM_ARGS(),
|
||||
ZSTR_VAL(ptr->func->op_array.filename),
|
||||
ptr->opline->lineno,
|
||||
EX(func)->common.required_num_args == EX(func)->common.num_args ? "exactly" : "at least",
|
||||
EX(func)->common.required_num_args);
|
||||
} else {
|
||||
zend_throw_error(NULL, "Too few arguments to function %s%s%s(), %d passed and %s %d expected",
|
||||
EX(func)->common.scope ? ZSTR_VAL(EX(func)->common.scope->name) : "",
|
||||
EX(func)->common.scope ? "::" : "",
|
||||
ZSTR_VAL(EX(func)->common.function_name),
|
||||
EX_NUM_ARGS(),
|
||||
EX(func)->common.required_num_args == EX(func)->common.num_args ? "exactly" : "at least",
|
||||
EX(func)->common.required_num_args);
|
||||
}
|
||||
zend_missing_arg_error(execute_data);
|
||||
HANDLE_EXCEPTION();
|
||||
} else if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) != 0)) {
|
||||
zval *param = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->result.var);
|
||||
|
|
|
@ -1468,28 +1468,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_RECV_SPEC_HANDLER(ZEND_OPCODE_
|
|||
uint32_t arg_num = opline->op1.num;
|
||||
|
||||
if (UNEXPECTED(arg_num > EX_NUM_ARGS())) {
|
||||
zend_execute_data *ptr = EX(prev_execute_data);
|
||||
|
||||
SAVE_OPLINE();
|
||||
if (ptr && ptr->func && ZEND_USER_CODE(ptr->func->common.type)) {
|
||||
zend_throw_error(NULL, "Too few arguments to function %s%s%s(), %d passed in %s on line %d and %s %d expected",
|
||||
EX(func)->common.scope ? ZSTR_VAL(EX(func)->common.scope->name) : "",
|
||||
EX(func)->common.scope ? "::" : "",
|
||||
ZSTR_VAL(EX(func)->common.function_name),
|
||||
EX_NUM_ARGS(),
|
||||
ZSTR_VAL(ptr->func->op_array.filename),
|
||||
ptr->opline->lineno,
|
||||
EX(func)->common.required_num_args == EX(func)->common.num_args ? "exactly" : "at least",
|
||||
EX(func)->common.required_num_args);
|
||||
} else {
|
||||
zend_throw_error(NULL, "Too few arguments to function %s%s%s(), %d passed and %s %d expected",
|
||||
EX(func)->common.scope ? ZSTR_VAL(EX(func)->common.scope->name) : "",
|
||||
EX(func)->common.scope ? "::" : "",
|
||||
ZSTR_VAL(EX(func)->common.function_name),
|
||||
EX_NUM_ARGS(),
|
||||
EX(func)->common.required_num_args == EX(func)->common.num_args ? "exactly" : "at least",
|
||||
EX(func)->common.required_num_args);
|
||||
}
|
||||
zend_missing_arg_error(execute_data);
|
||||
HANDLE_EXCEPTION();
|
||||
} else if (UNEXPECTED((EX(func)->op_array.fn_flags & ZEND_ACC_HAS_TYPE_HINTS) != 0)) {
|
||||
zval *param = _get_zval_ptr_cv_undef_BP_VAR_W(execute_data, opline->result.var);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue