Skip to content

Commit df1f4e0

Browse files
committed
Initialize icall undef args in jit
1 parent a3c7adf commit df1f4e0

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

Zend/zend_execute.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4449,7 +4449,7 @@ zval * ZEND_FASTCALL zend_handle_named_arg(
44494449
return arg;
44504450
}
44514451

4452-
static int zend_handle_icall_undef_args(zend_execute_data *call) {
4452+
ZEND_API int ZEND_FASTCALL zend_handle_icall_undef_args(zend_execute_data *call) {
44534453
zend_function *fbc = call->func;
44544454
if (fbc->common.fn_flags & ZEND_ACC_USER_ARG_INFO) {
44554455
/* Magic function, let it deal with it. */

Zend/zend_execute.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@ ZEND_API void zend_cleanup_unfinished_execution(zend_execute_data *execute_data,
349349
zval * ZEND_FASTCALL zend_handle_named_arg(
350350
zend_execute_data **call_ptr, zend_string *arg_name,
351351
uint32_t *arg_num_ptr, void **cache_slot);
352+
ZEND_API int ZEND_FASTCALL zend_handle_icall_undef_args(zend_execute_data *call);
352353

353354
#define CACHE_ADDR(num) \
354355
((void**)((char*)EX(run_time_cache) + (num)))

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8986,6 +8986,23 @@ static int zend_jit_do_fcall(dasm_State **Dst, const zend_op *opline, const zend
89868986
}
89878987
}
89888988

8989+
| // EG(current_execute_data) = execute_data;
8990+
| MEM_OP2_1_ZTS mov, aword, executor_globals, current_execute_data, RX, r1
8991+
8992+
if (may_have_named_args) {
8993+
| test byte [RX + offsetof(zend_execute_data, This.u1.type_info) + 3], (ZEND_CALL_MAY_HAVE_UNDEF >> 24)
8994+
| jnz >1
8995+
|.cold_code
8996+
|1:
8997+
| mov FCARG1a, RX
8998+
| EXT_CALL zend_handle_icall_undef_args, r0
8999+
| jnz ->exception_handler
9000+
| mov r0, EX:RX->func // reload
9001+
| jmp >2
9002+
|.code
9003+
|2:
9004+
}
9005+
89899006
if (!RETURN_VALUE_USED(opline)) {
89909007
|.if not(X64WIN)
89919008
| sub r4, 16 /* alloca() */
@@ -8996,9 +9013,6 @@ static int zend_jit_do_fcall(dasm_State **Dst, const zend_op *opline, const zend
89969013
| LOAD_ZVAL_ADDR FCARG2a, res_addr
89979014
| SET_Z_TYPE_INFO FCARG2a, IS_NULL
89989015

8999-
| // EG(current_execute_data) = execute_data;
9000-
| MEM_OP2_1_ZTS mov, aword, executor_globals, current_execute_data, RX, r1
9001-
90029016
zend_jit_reset_opline(Dst, NULL);
90039017

90049018
| // fbc->internal_function.handler(call, ret);
@@ -9025,8 +9039,8 @@ static int zend_jit_do_fcall(dasm_State **Dst, const zend_op *opline, const zend
90259039
if (may_have_named_args) {
90269040
| test byte [RX + offsetof(zend_execute_data, This.u1.type_info) + 3], (ZEND_CALL_HAS_EXTRA_NAMED_PARAMS >> 24)
90279041
| jnz >1
9028-
|1:
90299042
|.cold_code
9043+
|1:
90309044
| mov FCARG1a, aword [RX + offsetof(zend_execute_data, extra_named_params)]
90319045
| EXT_CALL zend_array_destroy, r0
90329046
| jmp >2

0 commit comments

Comments
 (0)