Skip to content

Commit 66a4437

Browse files
committed
Avoid redundand argument type verification
1 parent 67d6c2d commit 66a4437

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

ext/opcache/jit/zend_jit_arm64.dasc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11520,6 +11520,17 @@ static int zend_jit_verify_arg_type(dasm_State **Dst, const zend_op *opline, zen
1152011520
uint32_t type_mask = ZEND_TYPE_PURE_MASK(arg_info->type) & MAY_BE_ANY;
1152111521
zend_reg tmp_reg = (type_mask == 0 || is_power_of_two(type_mask)) ? ZREG_FCARG1x : ZREG_REG0;
1152211522

11523+
if (JIT_G(trigger) == ZEND_JIT_ON_HOT_TRACE
11524+
&& JIT_G(current_frame)
11525+
&& JIT_G(current_frame)->prev) {
11526+
zend_jit_trace_stack *stack = JIT_G(current_frame)->stack;
11527+
uint8_t type = STACK_TYPE(stack, EX_VAR_TO_NUM(opline->result.var));
11528+
11529+
if (type != IS_UNKNOWN && (type_mask & (1u << type))) {
11530+
return 1;
11531+
}
11532+
}
11533+
1152311534
if (ZEND_ARG_SEND_MODE(arg_info)) {
1152411535
if (opline->opcode == ZEND_RECV_INIT) {
1152511536
| LOAD_ZVAL_ADDR Rx(tmp_reg), res_addr

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12186,6 +12186,17 @@ static int zend_jit_verify_arg_type(dasm_State **Dst, const zend_op *opline, zen
1218612186
uint32_t type_mask = ZEND_TYPE_PURE_MASK(arg_info->type) & MAY_BE_ANY;
1218712187
zend_reg tmp_reg = (type_mask == 0 || is_power_of_two(type_mask)) ? ZREG_FCARG1a : ZREG_R0;
1218812188

12189+
if (JIT_G(trigger) == ZEND_JIT_ON_HOT_TRACE
12190+
&& JIT_G(current_frame)
12191+
&& JIT_G(current_frame)->prev) {
12192+
zend_jit_trace_stack *stack = JIT_G(current_frame)->stack;
12193+
uint8_t type = STACK_TYPE(stack, EX_VAR_TO_NUM(opline->result.var));
12194+
12195+
if (type != IS_UNKNOWN && (type_mask & (1u << type))) {
12196+
return 1;
12197+
}
12198+
}
12199+
1218912200
if (ZEND_ARG_SEND_MODE(arg_info)) {
1219012201
if (opline->opcode == ZEND_RECV_INIT) {
1219112202
| LOAD_ZVAL_ADDR Ra(tmp_reg), res_addr

0 commit comments

Comments
 (0)