Skip to content

Commit 5557cb7

Browse files
committed
Fix edge cases in JIT for ASSIGN_DIM_OP.
1 parent ae6c1b0 commit 5557cb7

File tree

2 files changed

+38
-12
lines changed

2 files changed

+38
-12
lines changed

ext/opcache/jit/zend_jit_arm64.dasc

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6104,7 +6104,6 @@ static int zend_jit_assign_dim_op(dasm_State **Dst, const zend_op *opline, uint3
61046104
| LOAD_ADDR CARG3, binary_op
61056105
| SET_EX_OPLINE opline, REG0
61066106
| EXT_CALL zend_jit_assign_op_to_typed_ref, REG0
6107-
zend_jit_check_exception(Dst);
61086107
| b >9
61096108
|.code
61106109
|1:
@@ -6145,6 +6144,7 @@ static int zend_jit_assign_dim_op(dasm_State **Dst, const zend_op *opline, uint3
61456144
default:
61466145
ZEND_UNREACHABLE();
61476146
}
6147+
| FREE_OP opline->op2_type, opline->op2, op2_info, 0, opline, ZREG_TMP1, ZREG_TMP2
61486148
}
61496149

61506150
if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY))) {
@@ -6171,19 +6171,32 @@ static int zend_jit_assign_dim_op(dasm_State **Dst, const zend_op *opline, uint3
61716171
| LOAD_ZVAL_ADDR CARG3, op3_addr
61726172
| LOAD_ADDR CARG4, binary_op
61736173
| EXT_CALL zend_jit_assign_dim_op_helper, REG0
6174-
if (!zend_jit_check_exception(Dst)) {
6175-
return 0;
6174+
6175+
|9:
6176+
| FREE_OP (opline+1)->op1_type, (opline+1)->op1, op1_data_info, 0, opline
6177+
| FREE_OP opline->op2_type, opline->op2, op2_info, 0, opline
6178+
if (may_throw) {
6179+
zend_jit_check_exception(Dst);
61766180
}
61776181

61786182
if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY)) {
61796183
| b >9 // END
61806184
|.code
6185+
|9:
6186+
}
6187+
} else if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY)) {
6188+
|.cold_code
6189+
|9:
6190+
| FREE_OP (opline+1)->op1_type, (opline+1)->op1, op1_data_info, 0, opline
6191+
| FREE_OP opline->op2_type, opline->op2, op2_info, 0, opline
6192+
if (may_throw) {
6193+
zend_jit_check_exception(Dst);
61816194
}
6195+
| b >9
6196+
|.code
6197+
|9:
61826198
}
61836199

6184-
|9:
6185-
| FREE_OP opline->op2_type, opline->op2, op2_info, 0, opline, ZREG_TMP1, ZREG_TMP2
6186-
61876200
return 1;
61886201
}
61896202

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6558,7 +6558,6 @@ static int zend_jit_assign_dim_op(dasm_State **Dst, const zend_op *opline, uint3
65586558
|.if not(X64)
65596559
| add r4, 12
65606560
|.endif
6561-
zend_jit_check_exception(Dst);
65626561
| jmp >9
65636562
|.code
65646563
|1:
@@ -6599,6 +6598,7 @@ static int zend_jit_assign_dim_op(dasm_State **Dst, const zend_op *opline, uint3
65996598
default:
66006599
ZEND_UNREACHABLE();
66016600
}
6601+
| FREE_OP opline->op2_type, opline->op2, op2_info, 0, opline
66026602
}
66036603

66046604
if (op1_info & (MAY_BE_ANY-(MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY))) {
@@ -6634,19 +6634,32 @@ static int zend_jit_assign_dim_op(dasm_State **Dst, const zend_op *opline, uint3
66346634
|.if not(X64)
66356635
| add r4, 8
66366636
|.endif
6637-
if (!zend_jit_check_exception(Dst)) {
6638-
return 0;
6637+
6638+
|9:
6639+
| FREE_OP (opline+1)->op1_type, (opline+1)->op1, op1_data_info, 0, opline
6640+
| FREE_OP opline->op2_type, opline->op2, op2_info, 0, opline
6641+
if (may_throw) {
6642+
zend_jit_check_exception(Dst);
66396643
}
66406644

66416645
if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY)) {
66426646
| jmp >9 // END
66436647
|.code
6648+
|9:
6649+
}
6650+
} else if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY)) {
6651+
|.cold_code
6652+
|9:
6653+
| FREE_OP (opline+1)->op1_type, (opline+1)->op1, op1_data_info, 0, opline
6654+
| FREE_OP opline->op2_type, opline->op2, op2_info, 0, opline
6655+
if (may_throw) {
6656+
zend_jit_check_exception(Dst);
66446657
}
6658+
| jmp >9
6659+
|.code
6660+
|9:
66456661
}
66466662

6647-
|9:
6648-
| FREE_OP opline->op2_type, opline->op2, op2_info, 0, opline
6649-
66506663
return 1;
66516664
}
66526665

0 commit comments

Comments
 (0)