Skip to content

Commit 7b69855

Browse files
committed
Fixed type_info for new array element (it may be only NULL)
1 parent cc29cbe commit 7b69855

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4564,6 +4564,9 @@ static int zend_jit_assign_dim(dasm_State **Dst, const zend_op *opline, const ze
45644564
if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY)) {
45654565
|6:
45664566
if (opline->op2_type == IS_UNUSED) {
4567+
uint32_t var_info = MAY_BE_NULL;
4568+
zend_jit_addr var_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 0);
4569+
45674570
| // var_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(container), &EG(uninitialized_zval));
45684571
| LOAD_ADDR_ZTS FCARG2a, executor_globals, uninitialized_zval
45694572
| EXT_CALL zend_hash_next_index_insert, r0
@@ -4578,29 +4581,21 @@ static int zend_jit_assign_dim(dasm_State **Dst, const zend_op *opline, const ze
45784581
| jmp >9
45794582
|.code
45804583
| mov FCARG1a, r0
4581-
} else {
4582-
if (!zend_jit_fetch_dimension_address_inner(Dst, opline, BP_VAR_W, op1_info, op2_info, 8, 8)) {
4583-
return 0;
4584-
}
45854584

4586-
|8:
4587-
| mov FCARG1a, r0
4588-
}
4589-
4590-
if (opline->op2_type == IS_UNUSED) {
4591-
uint32_t var_info = zend_array_element_type(op1_info, 0, 0);
4592-
zend_jit_addr var_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 0);
4593-
4594-
if (op1_info & (MAY_BE_ARRAY_OF_REF|MAY_BE_OBJECT)) {
4595-
var_info |= MAY_BE_REF;
4596-
}
45974585
if (!zend_jit_simple_assign(Dst, opline, op_array, var_addr, var_info, -1, (opline+1)->op1_type, (opline+1)->op1, op3_addr, val_info, res_addr, 0)) {
45984586
return 0;
45994587
}
46004588
} else {
46014589
uint32_t var_info = zend_array_element_type(op1_info, 0, 0);
46024590
zend_jit_addr var_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FCARG1a, 0);
46034591

4592+
if (!zend_jit_fetch_dimension_address_inner(Dst, opline, BP_VAR_W, op1_info, op2_info, 8, 8)) {
4593+
return 0;
4594+
}
4595+
4596+
|8:
4597+
| mov FCARG1a, r0
4598+
46044599
if (op1_info & (MAY_BE_ARRAY_OF_REF|MAY_BE_OBJECT)) {
46054600
var_info |= MAY_BE_REF;
46064601
}
@@ -4789,14 +4784,13 @@ static int zend_jit_assign_dim_op(dasm_State **Dst, const zend_op *opline, const
47894784
}
47904785

47914786
if (op1_info & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_ARRAY)) {
4792-
uint32_t var_info = zend_array_element_type(op1_info, 0, 0);
4787+
uint32_t var_info;
47934788
uint32_t var_def_info = zend_array_element_type(op1_def_info, 1, 0);
47944789

4795-
if (op1_info & (MAY_BE_ARRAY_OF_REF|MAY_BE_OBJECT)) {
4796-
var_info |= MAY_BE_REF;
4797-
}
47984790
|6:
47994791
if (opline->op2_type == IS_UNUSED) {
4792+
var_info = MAY_BE_NULL;
4793+
48004794
| // var_ptr = zend_hash_next_index_insert(Z_ARRVAL_P(container), &EG(uninitialized_zval));
48014795
| LOAD_ADDR_ZTS FCARG2a, executor_globals, uninitialized_zval
48024796
| EXT_CALL zend_hash_next_index_insert, r0
@@ -4812,6 +4806,11 @@ static int zend_jit_assign_dim_op(dasm_State **Dst, const zend_op *opline, const
48124806
|.code
48134807
| mov FCARG1a, r0
48144808
} else {
4809+
var_info = zend_array_element_type(op1_info, 0, 0);
4810+
if (op1_info & (MAY_BE_ARRAY_OF_REF|MAY_BE_OBJECT)) {
4811+
var_info |= MAY_BE_REF;
4812+
}
4813+
48154814
if (!zend_jit_fetch_dimension_address_inner(Dst, opline, BP_VAR_RW, op1_info, op2_info, 8, 8)) {
48164815
return 0;
48174816
}

0 commit comments

Comments
 (0)