Skip to content

Commit

Permalink
JIT: Fix named arguments handling
Browse files Browse the repository at this point in the history
Fixes oss-fuzz #41486
  • Loading branch information
dstogov committed Nov 29, 2021
1 parent 8f4cfe0 commit d955415
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions ext/opcache/jit/zend_jit.c
Original file line number Diff line number Diff line change
Expand Up @@ -2392,6 +2392,7 @@ static int zend_jit(const zend_op_array *op_array, zend_ssa *ssa, const zend_op
&& (i + 1) <= end
&& (opline+1)->opcode == ZEND_SEND_VAL
&& (opline+1)->op1_type == IS_TMP_VAR
&& (opline+1)->op2_type != IS_CONST
&& (opline+1)->op1.var == opline->result.var) {
i++;
res_use_info = -1;
Expand Down Expand Up @@ -2446,6 +2447,7 @@ static int zend_jit(const zend_op_array *op_array, zend_ssa *ssa, const zend_op
&& (i + 1) <= end
&& (opline+1)->opcode == ZEND_SEND_VAL
&& (opline+1)->op1_type == IS_TMP_VAR
&& (opline+1)->op2_type != IS_CONST
&& (opline+1)->op1.var == opline->result.var) {
i++;
res_use_info = -1;
Expand Down Expand Up @@ -2504,6 +2506,7 @@ static int zend_jit(const zend_op_array *op_array, zend_ssa *ssa, const zend_op
&& (i + 1) <= end
&& (opline+1)->opcode == ZEND_SEND_VAL
&& (opline+1)->op1_type == IS_TMP_VAR
&& (opline+1)->op2_type != IS_CONST
&& (opline+1)->op1.var == opline->result.var) {
i++;
res_addr = ZEND_ADDR_MEM_ZVAL(ZREG_RX, (opline+1)->result.var);
Expand Down Expand Up @@ -2727,6 +2730,7 @@ static int zend_jit(const zend_op_array *op_array, zend_ssa *ssa, const zend_op
&& (i + 1) <= end
&& (opline+1)->opcode == ZEND_SEND_VAL
&& (opline+1)->op1_type == IS_TMP_VAR
&& (opline+1)->op2_type != IS_CONST
&& (opline+1)->op1.var == opline->result.var
&& (!(op1_info & MAY_HAVE_DTOR) || !(op1_info & MAY_BE_RC1))) {
i++;
Expand Down
9 changes: 8 additions & 1 deletion ext/opcache/jit/zend_jit_x86.dasc
Original file line number Diff line number Diff line change
Expand Up @@ -15520,10 +15520,11 @@ static zend_bool zend_jit_opline_supports_reg(const zend_op_array *op_array, zen
uint32_t op1_info, op2_info;

switch (opline->opcode) {
case ZEND_QM_ASSIGN:
case ZEND_SEND_VAR:
case ZEND_SEND_VAL:
case ZEND_SEND_VAL_EX:
return (opline->op2_type != IS_CONST);
case ZEND_QM_ASSIGN:
case ZEND_IS_SMALLER:
case ZEND_IS_SMALLER_OR_EQUAL:
case ZEND_IS_EQUAL:
Expand Down Expand Up @@ -15717,6 +15718,9 @@ static zend_regset zend_jit_get_scratch_regset(const zend_op *opline, const zend
/* break missing intentionally */
case ZEND_SEND_VAL:
case ZEND_SEND_VAL_EX:
if (opline->op2_type == IS_CONST) {
break;
}
if (ssa_op->op1_use == current_var) {
regset = ZEND_REGSET(ZREG_R0);
break;
Expand All @@ -15733,6 +15737,9 @@ static zend_regset zend_jit_get_scratch_regset(const zend_op *opline, const zend
}
break;
case ZEND_SEND_VAR:
if (opline->op2_type == IS_CONST) {
break;
}
if (ssa_op->op1_use == current_var ||
ssa_op->op1_def == current_var) {
regset = ZEND_REGSET_EMPTY;
Expand Down

0 comments on commit d955415

Please sign in to comment.