@@ -559,10 +559,9 @@ static void* dasm_labels[zend_lb_MAX];
559
559
|.endmacro
560
560
561
561
|.macro UNDEF_OPLINE_RESULT_IF_USED
562
- | mov r0, EX->opline
563
- | test byte OP:r0->result_type, (IS_TMP_VAR|IS_VAR)
562
+ | test byte OP:RX->result_type, (IS_TMP_VAR|IS_VAR)
564
563
| jz >1
565
- | mov eax, dword OP:r0 ->result.var
564
+ | mov eax, dword OP:RX ->result.var
566
565
| SET_Z_TYPE_INFO FP + r0, IS_UNDEF
567
566
|1:
568
567
|.endmacro
@@ -1841,6 +1840,42 @@ static int zend_jit_exception_handler_undef_stub(dasm_State **Dst)
1841
1840
return 1;
1842
1841
}
1843
1842
1843
+
1844
+ static int zend_jit_exception_handler_free_op1_op2_stub(dasm_State **Dst)
1845
+ {
1846
+ |->exception_handler_free_op1_op2:
1847
+ | UNDEF_OPLINE_RESULT_IF_USED
1848
+ | test byte OP:RX->op1_type, (IS_TMP_VAR|IS_VAR)
1849
+ | je >9
1850
+ | mov eax, dword OP:RX->op1.var
1851
+ | add r0, FP
1852
+ | ZVAL_PTR_DTOR ZEND_ADDR_MEM_ZVAL(ZREG_R0, 0), MAY_BE_ANY|MAY_BE_RC1|MAY_BE_RCN|MAY_BE_REF, 0, 0, NULL
1853
+ |9:
1854
+ | test byte OP:RX->op2_type, (IS_TMP_VAR|IS_VAR)
1855
+ | je >9
1856
+ | mov eax, dword OP:RX->op2.var
1857
+ | add r0, FP
1858
+ | ZVAL_PTR_DTOR ZEND_ADDR_MEM_ZVAL(ZREG_R0, 0), MAY_BE_ANY|MAY_BE_RC1|MAY_BE_RCN|MAY_BE_REF, 0, 0, NULL
1859
+ |9:
1860
+ | jmp ->exception_handler
1861
+ return 1;
1862
+ }
1863
+
1864
+ static int zend_jit_exception_handler_free_op2_stub(dasm_State **Dst)
1865
+ {
1866
+ |->exception_handler_free_op2:
1867
+ | MEM_OP2_2_ZTS mov, RX, aword, executor_globals, opline_before_exception, r0
1868
+ | UNDEF_OPLINE_RESULT_IF_USED
1869
+ | test byte OP:RX->op2_type, (IS_TMP_VAR|IS_VAR)
1870
+ | je >9
1871
+ | mov eax, dword OP:RX->op2.var
1872
+ | add r0, FP
1873
+ | ZVAL_PTR_DTOR ZEND_ADDR_MEM_ZVAL(ZREG_R0, 0), MAY_BE_ANY|MAY_BE_RC1|MAY_BE_RCN|MAY_BE_REF, 0, 0, NULL
1874
+ |9:
1875
+ | jmp ->exception_handler
1876
+ return 1;
1877
+ }
1878
+
1844
1879
static int zend_jit_leave_function_stub(dasm_State **Dst)
1845
1880
{
1846
1881
|->leave_function_handler:
@@ -2154,7 +2189,6 @@ static int zend_jit_negative_shift_stub(dasm_State **Dst)
2154
2189
{
2155
2190
|->negative_shift:
2156
2191
| mov RX, EX->opline
2157
- | UNDEF_OPLINE_RESULT_IF_USED
2158
2192
|.if X64
2159
2193
|.if WIN
2160
2194
| LOAD_ADDR CARG1, &zend_ce_arithmetic_error
@@ -2176,27 +2210,14 @@ static int zend_jit_negative_shift_stub(dasm_State **Dst)
2176
2210
| EXT_CALL zend_throw_error, r0
2177
2211
| add r4, 16
2178
2212
|.endif
2179
- | test byte OP:RX->op1_type, (IS_TMP_VAR|IS_VAR)
2180
- | je >9
2181
- | mov eax, dword OP:RX->op1.var
2182
- | add r0, FP
2183
- | ZVAL_PTR_DTOR ZEND_ADDR_MEM_ZVAL(ZREG_R0, 0), MAY_BE_ANY|MAY_BE_RC1|MAY_BE_RCN|MAY_BE_REF, 0, 0, NULL
2184
- |9:
2185
- | test byte OP:RX->op2_type, (IS_TMP_VAR|IS_VAR)
2186
- | je >9
2187
- | mov eax, dword OP:RX->op2.var
2188
- | add r0, FP
2189
- | ZVAL_PTR_DTOR ZEND_ADDR_MEM_ZVAL(ZREG_R0, 0), MAY_BE_ANY|MAY_BE_RC1|MAY_BE_RCN|MAY_BE_REF, 0, 0, NULL
2190
- |9:
2191
- | jmp ->exception_handler
2213
+ | jmp ->exception_handler_free_op1_op2
2192
2214
return 1;
2193
2215
}
2194
2216
2195
2217
static int zend_jit_mod_by_zero_stub(dasm_State **Dst)
2196
2218
{
2197
2219
|->mod_by_zero:
2198
2220
| mov RX, EX->opline
2199
- | UNDEF_OPLINE_RESULT_IF_USED
2200
2221
|.if X64
2201
2222
|.if WIN
2202
2223
| LOAD_ADDR CARG1, &zend_ce_division_by_zero_error
@@ -2218,19 +2239,7 @@ static int zend_jit_mod_by_zero_stub(dasm_State **Dst)
2218
2239
| EXT_CALL zend_throw_error, r0
2219
2240
| add r4, 16
2220
2241
|.endif
2221
- | test byte OP:RX->op1_type, (IS_TMP_VAR|IS_VAR)
2222
- | je >9
2223
- | mov eax, dword OP:RX->op1.var
2224
- | add r0, FP
2225
- | ZVAL_PTR_DTOR ZEND_ADDR_MEM_ZVAL(ZREG_R0, 0), MAY_BE_ANY|MAY_BE_RC1|MAY_BE_RCN|MAY_BE_REF, 0, 0, NULL
2226
- |9:
2227
- | test byte OP:RX->op2_type, (IS_TMP_VAR|IS_VAR)
2228
- | je >9
2229
- | mov eax, dword OP:RX->op2.var
2230
- | add r0, FP
2231
- | ZVAL_PTR_DTOR ZEND_ADDR_MEM_ZVAL(ZREG_R0, 0), MAY_BE_ANY|MAY_BE_RC1|MAY_BE_RCN|MAY_BE_REF, 0, 0, NULL
2232
- |9:
2233
- | jmp ->exception_handler
2242
+ | jmp ->exception_handler_free_op1_op2
2234
2243
return 1;
2235
2244
}
2236
2245
@@ -2852,6 +2861,8 @@ static const zend_jit_stub zend_jit_stubs[] = {
2852
2861
JIT_STUB(interrupt_handler),
2853
2862
JIT_STUB(exception_handler),
2854
2863
JIT_STUB(exception_handler_undef),
2864
+ JIT_STUB(exception_handler_free_op1_op2),
2865
+ JIT_STUB(exception_handler_free_op2),
2855
2866
JIT_STUB(leave_function),
2856
2867
JIT_STUB(leave_throw),
2857
2868
JIT_STUB(icall_throw),
@@ -5242,7 +5253,10 @@ static int zend_jit_long_math_helper(dasm_State **Dst,
5242
5253
| FREE_OP op1_type, op1, op1_info, 0, opline
5243
5254
| FREE_OP op2_type, op2, op2_info, 0, opline
5244
5255
if (may_throw) {
5245
- if (Z_MODE(res_addr) == IS_MEM_ZVAL && Z_REG(res_addr) == ZREG_RX) {
5256
+ if (opline->opcode == ZEND_ASSIGN_DIM_OP && (opline->op2_type & (IS_VAR|IS_TMP_VAR))) {
5257
+ | MEM_OP2_1_ZTS cmp, aword, executor_globals, exception, 0, r0
5258
+ | jne ->exception_handler_free_op2
5259
+ } else if (Z_MODE(res_addr) == IS_MEM_ZVAL && Z_REG(res_addr) == ZREG_RX) {
5246
5260
zend_jit_check_exception_undef_result(Dst, opline);
5247
5261
} else {
5248
5262
zend_jit_check_exception(Dst);
0 commit comments