Skip to content

Commit 1f350e2

Browse files
committed
Initialize icall undef args in jit
1 parent 980bb81 commit 1f350e2

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
@@ -4444,7 +4444,7 @@ zval * ZEND_FASTCALL zend_handle_named_arg(
44444444
return arg;
44454445
}
44464446

4447-
static int zend_handle_icall_undef_args(zend_execute_data *call) {
4447+
ZEND_API int ZEND_FASTCALL zend_handle_icall_undef_args(zend_execute_data *call) {
44484448
zend_function *fbc = call->func;
44494449
if (fbc->common.fn_flags & ZEND_ACC_USER_ARG_INFO) {
44504450
/* 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
@@ -8995,6 +8995,23 @@ static int zend_jit_do_fcall(dasm_State **Dst, const zend_op *opline, const zend
89958995
}
89968996
}
89978997

8998+
| // EG(current_execute_data) = execute_data;
8999+
| MEM_OP2_1_ZTS mov, aword, executor_globals, current_execute_data, RX, r1
9000+
9001+
if (may_have_named_args) {
9002+
| test byte [RX + offsetof(zend_execute_data, This.u1.type_info) + 3], (ZEND_CALL_MAY_HAVE_UNDEF >> 24)
9003+
| jnz >1
9004+
|.cold_code
9005+
|1:
9006+
| mov FCARG1a, RX
9007+
| EXT_CALL zend_handle_icall_undef_args, r0
9008+
| jnz ->exception_handler
9009+
| mov r0, EX:RX->func // reload
9010+
| jmp >2
9011+
|.code
9012+
|2:
9013+
}
9014+
89989015
if (!RETURN_VALUE_USED(opline)) {
89999016
|.if not(X64WIN)
90009017
| sub r4, 16 /* alloca() */
@@ -9005,9 +9022,6 @@ static int zend_jit_do_fcall(dasm_State **Dst, const zend_op *opline, const zend
90059022
| LOAD_ZVAL_ADDR FCARG2a, res_addr
90069023
| SET_Z_TYPE_INFO FCARG2a, IS_NULL
90079024

9008-
| // EG(current_execute_data) = execute_data;
9009-
| MEM_OP2_1_ZTS mov, aword, executor_globals, current_execute_data, RX, r1
9010-
90119025
zend_jit_reset_opline(Dst, NULL);
90129026

90139027
| // fbc->internal_function.handler(call, ret);
@@ -9034,8 +9048,8 @@ static int zend_jit_do_fcall(dasm_State **Dst, const zend_op *opline, const zend
90349048
if (may_have_named_args) {
90359049
| test byte [RX + offsetof(zend_execute_data, This.u1.type_info) + 3], (ZEND_CALL_HAS_EXTRA_NAMED_PARAMS >> 24)
90369050
| jnz >1
9037-
|1:
90389051
|.cold_code
9052+
|1:
90399053
| mov FCARG1a, aword [RX + offsetof(zend_execute_data, extra_named_params)]
90409054
| EXT_CALL zend_array_destroy, r0
90419055
| jmp >2

0 commit comments

Comments
 (0)