@@ -830,11 +830,10 @@ static bool logical_immediate_p(uint64_t value, uint32_t reg_size)
830
830
|.endmacro
831
831
832
832
|.macro UNDEF_OPLINE_RESULT_IF_USED, tmp_reg1, tmp_reg2
833
- | ldr REG0, EX->opline
834
- | ldrb tmp_reg1, OP:REG0->result_type
833
+ | ldrb tmp_reg1, OP:RX->result_type
835
834
| TST_32_WITH_CONST tmp_reg1, (IS_TMP_VAR|IS_VAR), tmp_reg2
836
835
| beq >1
837
- | ldr REG0w, OP:REG0 ->result.var
836
+ | ldr REG0w, OP:RX ->result.var
838
837
| add REG0, FP, REG0
839
838
| SET_Z_TYPE_INFO REG0, IS_UNDEF, tmp_reg1
840
839
|1:
@@ -1850,6 +1849,48 @@ static int zend_jit_exception_handler_undef_stub(dasm_State **Dst)
1850
1849
return 1;
1851
1850
}
1852
1851
1852
+ static int zend_jit_exception_handler_free_op1_op2_stub(dasm_State **Dst)
1853
+ {
1854
+ zend_jit_addr addr = ZEND_ADDR_MEM_ZVAL(ZREG_REG0, 0);
1855
+
1856
+ |->exception_handler_free_op1_op2:
1857
+ | UNDEF_OPLINE_RESULT_IF_USED TMP1w, TMP2w
1858
+ | ldrb TMP1w, OP:RX->op1_type
1859
+ | TST_32_WITH_CONST TMP1w, (IS_TMP_VAR|IS_VAR), TMP2w
1860
+ | beq >9
1861
+ | ldr REG0w, OP:RX->op1.var
1862
+ | add REG0, REG0, FP
1863
+ | ZVAL_PTR_DTOR addr, MAY_BE_ANY|MAY_BE_RC1|MAY_BE_RCN|MAY_BE_REF, 0, 0, NULL, ZREG_TMP1, ZREG_TMP2
1864
+ |9:
1865
+ | ldrb TMP1w, OP:RX->op2_type
1866
+ | TST_32_WITH_CONST TMP1w, (IS_TMP_VAR|IS_VAR), TMP2w
1867
+ | beq >9
1868
+ | ldr REG0w, OP:RX->op2.var
1869
+ | add REG0, REG0, FP
1870
+ | ZVAL_PTR_DTOR addr, MAY_BE_ANY|MAY_BE_RC1|MAY_BE_RCN|MAY_BE_REF, 0, 0, NULL, ZREG_TMP1, ZREG_TMP2
1871
+ |9:
1872
+ | b ->exception_handler
1873
+ return 1;
1874
+ }
1875
+
1876
+ static int zend_jit_exception_handler_free_op2_stub(dasm_State **Dst)
1877
+ {
1878
+ zend_jit_addr addr = ZEND_ADDR_MEM_ZVAL(ZREG_REG0, 0);
1879
+
1880
+ |->exception_handler_free_op2:
1881
+ | MEM_LOAD_64_ZTS ldr, RX, executor_globals, opline_before_exception, REG0
1882
+ | UNDEF_OPLINE_RESULT_IF_USED TMP1w, TMP2w
1883
+ | ldrb TMP1w, OP:RX->op2_type
1884
+ | TST_32_WITH_CONST TMP1w, (IS_TMP_VAR|IS_VAR), TMP2w
1885
+ | beq >9
1886
+ | ldr REG0w, OP:RX->op2.var
1887
+ | add REG0, REG0, FP
1888
+ | ZVAL_PTR_DTOR addr, MAY_BE_ANY|MAY_BE_RC1|MAY_BE_RCN|MAY_BE_REF, 0, 0, NULL, ZREG_TMP1, ZREG_TMP2
1889
+ |9:
1890
+ | b ->exception_handler
1891
+ return 1;
1892
+ }
1893
+
1853
1894
static int zend_jit_leave_function_stub(dasm_State **Dst)
1854
1895
{
1855
1896
|->leave_function_handler:
@@ -2121,57 +2162,23 @@ static int zend_jit_undefined_function_stub(dasm_State **Dst)
2121
2162
2122
2163
static int zend_jit_negative_shift_stub(dasm_State **Dst)
2123
2164
{
2124
- zend_jit_addr addr = ZEND_ADDR_MEM_ZVAL(ZREG_REG0, 0);
2125
-
2126
2165
|->negative_shift:
2127
2166
| ldr RX, EX->opline
2128
- | UNDEF_OPLINE_RESULT_IF_USED TMP1w, TMP2w
2129
2167
| LOAD_ADDR CARG1, zend_ce_arithmetic_error
2130
2168
| LOAD_ADDR CARG2, "Bit shift by negative number"
2131
2169
| EXT_CALL zend_throw_error, REG0
2132
- | ldrb TMP1w, OP:RX->op1_type
2133
- | TST_32_WITH_CONST TMP1w, (IS_TMP_VAR|IS_VAR), TMP2w
2134
- | beq >9
2135
- | ldr REG0w, OP:RX->op1.var
2136
- | add REG0, REG0, FP
2137
- | ZVAL_PTR_DTOR addr, MAY_BE_ANY|MAY_BE_RC1|MAY_BE_RCN|MAY_BE_REF, 0, 0, NULL, ZREG_TMP1, ZREG_TMP2
2138
- |9:
2139
- | ldrb TMP1w, OP:RX->op2_type
2140
- | TST_32_WITH_CONST TMP1w, (IS_TMP_VAR|IS_VAR), TMP2w
2141
- | beq >9
2142
- | ldr REG0w, OP:RX->op2.var
2143
- | add REG0, REG0, FP
2144
- | ZVAL_PTR_DTOR addr, MAY_BE_ANY|MAY_BE_RC1|MAY_BE_RCN|MAY_BE_REF, 0, 0, NULL, ZREG_TMP1, ZREG_TMP2
2145
- |9:
2146
- | b ->exception_handler
2170
+ | b ->exception_handler_free_op1_op2
2147
2171
return 1;
2148
2172
}
2149
2173
2150
2174
static int zend_jit_mod_by_zero_stub(dasm_State **Dst)
2151
2175
{
2152
- zend_jit_addr addr = ZEND_ADDR_MEM_ZVAL(ZREG_REG0, 0);
2153
-
2154
2176
|->mod_by_zero:
2155
2177
| ldr RX, EX->opline
2156
- | UNDEF_OPLINE_RESULT_IF_USED TMP1w, TMP2w
2157
2178
| LOAD_ADDR CARG1, zend_ce_division_by_zero_error
2158
2179
| LOAD_ADDR CARG2, "Modulo by zero"
2159
2180
| EXT_CALL zend_throw_error, REG0
2160
- | ldrb TMP1w, OP:RX->op1_type
2161
- | TST_32_WITH_CONST TMP1w, (IS_TMP_VAR|IS_VAR), TMP2w
2162
- | beq >9
2163
- | ldr REG0w, OP:RX->op1.var
2164
- | add REG0, REG0, FP
2165
- | ZVAL_PTR_DTOR addr, MAY_BE_ANY|MAY_BE_RC1|MAY_BE_RCN|MAY_BE_REF, 0, 0, NULL, ZREG_TMP1, ZREG_TMP2
2166
- |9:
2167
- | ldrb TMP1w, OP:RX->op2_type
2168
- | TST_32_WITH_CONST TMP1w, (IS_TMP_VAR|IS_VAR), TMP2w
2169
- | beq >9
2170
- | ldr REG0w, OP:RX->op2.var
2171
- | add REG0, REG0, FP
2172
- | ZVAL_PTR_DTOR addr, MAY_BE_ANY|MAY_BE_RC1|MAY_BE_RCN|MAY_BE_REF, 0, 0, NULL, ZREG_TMP1, ZREG_TMP2
2173
- |9:
2174
- | b ->exception_handler
2181
+ | b ->exception_handler_free_op1_op2
2175
2182
return 1;
2176
2183
}
2177
2184
@@ -2701,6 +2708,8 @@ static const zend_jit_stub zend_jit_stubs[] = {
2701
2708
JIT_STUB(interrupt_handler, SP_ADJ_JIT, SP_ADJ_VM),
2702
2709
JIT_STUB(exception_handler, SP_ADJ_JIT, SP_ADJ_VM),
2703
2710
JIT_STUB(exception_handler_undef, SP_ADJ_JIT, SP_ADJ_VM),
2711
+ JIT_STUB(exception_handler_free_op1_op2, SP_ADJ_JIT, SP_ADJ_VM),
2712
+ JIT_STUB(exception_handler_free_op2, SP_ADJ_JIT, SP_ADJ_VM),
2704
2713
JIT_STUB(leave_function, SP_ADJ_JIT, SP_ADJ_VM),
2705
2714
JIT_STUB(leave_throw, SP_ADJ_JIT, SP_ADJ_VM),
2706
2715
JIT_STUB(icall_throw, SP_ADJ_JIT, SP_ADJ_VM),
@@ -4873,7 +4882,10 @@ static int zend_jit_long_math_helper(dasm_State **Dst,
4873
4882
| FREE_OP op1_type, op1, op1_info, 0, NULL, ZREG_TMP1, ZREG_TMP2
4874
4883
| FREE_OP op2_type, op2, op2_info, 0, NULL, ZREG_TMP1, ZREG_TMP2
4875
4884
if (may_throw) {
4876
- if (Z_MODE(res_addr) == IS_MEM_ZVAL && Z_REG(res_addr) == ZREG_RX) {
4885
+ if (opline->opcode == ZEND_ASSIGN_DIM_OP && (opline->op2_type & (IS_VAR|IS_TMP_VAR))) {
4886
+ | MEM_LOAD_64_ZTS ldr, TMP2, executor_globals, exception, TMP1
4887
+ | cbnz TMP2, ->exception_handler_free_op2
4888
+ } else if (Z_MODE(res_addr) == IS_MEM_ZVAL && Z_REG(res_addr) == ZREG_RX) {
4877
4889
zend_jit_check_exception_undef_result(Dst, opline);
4878
4890
} else {
4879
4891
zend_jit_check_exception(Dst);
0 commit comments