Skip to content

Commit 1b9d659

Browse files
authored
Fix register allocarion for result of ASSIGN_OBJ (#17994)
This fixes few failures in Symfony unit tests with function JIT
1 parent 7634484 commit 1b9d659

File tree

1 file changed

+15
-20
lines changed

1 file changed

+15
-20
lines changed

ext/opcache/jit/zend_jit_ir.c

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -14748,13 +14748,6 @@ static int zend_jit_assign_obj(zend_jit_ctx *jit,
1474814748
// CACHE_PTR_EX(cache_slot + 2, NULL);
1474914749
}
1475014750

14751-
if (RETURN_VALUE_USED(opline) && Z_MODE(res_addr) == IS_REG) {
14752-
zend_jit_addr real_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->result.var);
14753-
if (!zend_jit_load_reg(jit, real_addr, res_addr, res_info)) {
14754-
return 0;
14755-
}
14756-
}
14757-
1475814751
ir_END_list(end_inputs);
1475914752
ir_IF_FALSE(if_has_prop_info);
1476014753
}
@@ -14820,12 +14813,6 @@ static int zend_jit_assign_obj(zend_jit_ctx *jit,
1482014813
arg3,
1482114814
arg4);
1482214815

14823-
if (RETURN_VALUE_USED(opline) && Z_MODE(res_addr) == IS_REG) {
14824-
zend_jit_addr real_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->result.var);
14825-
if (!zend_jit_load_reg(jit, real_addr, res_addr, res_info)) {
14826-
return 0;
14827-
}
14828-
}
1482914816
ir_END_list(end_inputs);
1483014817
}
1483114818
}
@@ -14838,7 +14825,14 @@ static int zend_jit_assign_obj(zend_jit_ctx *jit,
1483814825
return 0;
1483914826
}
1484014827
} else {
14841-
if (!zend_jit_assign_to_variable(jit, opline, prop_addr, prop_addr, -1, -1, (opline+1)->op1_type, val_addr, val_info, res_addr, 0, 0)) {
14828+
zend_jit_addr real_res_addr;
14829+
14830+
if (res_addr && Z_MODE(res_addr) == IS_REG) {
14831+
real_res_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->result.var);
14832+
} else {
14833+
real_res_addr = res_addr;
14834+
}
14835+
if (!zend_jit_assign_to_variable(jit, opline, prop_addr, prop_addr, -1, -1, (opline+1)->op1_type, val_addr, val_info, real_res_addr, 0, 0)) {
1484214836
return 0;
1484314837
}
1484414838
}
@@ -14888,12 +14882,6 @@ static int zend_jit_assign_obj(zend_jit_ctx *jit,
1488814882
ir_ADD_OFFSET(run_time_cache, opline->extended_value & ~ZEND_FETCH_OBJ_FLAGS),
1488914883
arg5);
1489014884

14891-
if (RETURN_VALUE_USED(opline) && Z_MODE(res_addr) == IS_REG) {
14892-
zend_jit_addr real_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->result.var);
14893-
if (!zend_jit_load_reg(jit, real_addr, res_addr, res_info)) {
14894-
return 0;
14895-
}
14896-
}
1489714885
ir_END_list(end_inputs);
1489814886
}
1489914887

@@ -14914,6 +14902,13 @@ static int zend_jit_assign_obj(zend_jit_ctx *jit,
1491414902
jit_FREE_OP(jit, opline->op1_type, opline->op1, op1_info, opline);
1491514903
}
1491614904

14905+
if (RETURN_VALUE_USED(opline) && Z_MODE(res_addr) == IS_REG) {
14906+
zend_jit_addr real_addr = ZEND_ADDR_MEM_ZVAL(ZREG_FP, opline->result.var);
14907+
if (!zend_jit_load_reg(jit, real_addr, res_addr, res_info)) {
14908+
return 0;
14909+
}
14910+
}
14911+
1491714912
if (may_throw) {
1491814913
zend_jit_check_exception(jit);
1491914914
}

0 commit comments

Comments
 (0)