mirror of
https://github.com/php/php-src.git
synced 2025-01-08 20:17:28 +08:00
Fixed JIT for PTR_INC instruction to return de-referenced value of reference
This commit is contained in:
parent
e1a46de938
commit
170cc10519
@ -444,6 +444,8 @@ static int zend_jit_disasm_init(void)
|
||||
REGISTER_HELPER(zend_jit_only_vars_by_reference);
|
||||
REGISTER_HELPER(zend_jit_invalid_array_access);
|
||||
REGISTER_HELPER(zend_jit_prepare_assign_dim_ref);
|
||||
REGISTER_HELPER(zend_jit_pre_inc);
|
||||
REGISTER_HELPER(zend_jit_pre_dec);
|
||||
REGISTER_HELPER(zend_runtime_jit);
|
||||
REGISTER_HELPER(zend_jit_hot_func);
|
||||
#undef REGISTER_HELPER
|
||||
|
@ -1477,3 +1477,15 @@ static zval * ZEND_FASTCALL zend_jit_prepare_assign_dim_ref(zval *ref) {
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
static void ZEND_FASTCALL zend_jit_pre_inc(zval *var_ptr, zval *ret)
|
||||
{
|
||||
increment_function(var_ptr);
|
||||
ZVAL_COPY(ret, var_ptr);
|
||||
}
|
||||
|
||||
static void ZEND_FASTCALL zend_jit_pre_dec(zval *var_ptr, zval *ret)
|
||||
{
|
||||
decrement_function(var_ptr);
|
||||
ZVAL_COPY(ret, var_ptr);
|
||||
}
|
||||
|
@ -2938,9 +2938,19 @@ static int zend_jit_inc_dec(dasm_State **Dst, const zend_op *opline, const zend_
|
||||
| TRY_ADDREF op1_info, ah, r2
|
||||
}
|
||||
if (opline->opcode == ZEND_PRE_INC || opline->opcode == ZEND_POST_INC) {
|
||||
| EXT_CALL increment_function, r0
|
||||
if (opline->opcode == ZEND_PRE_INC && opline->result_type != IS_UNUSED) {
|
||||
| LOAD_ZVAL_ADDR FCARG2a, res_addr
|
||||
| EXT_CALL zend_jit_pre_inc, r0
|
||||
} else {
|
||||
| EXT_CALL increment_function, r0
|
||||
}
|
||||
} else {
|
||||
| EXT_CALL decrement_function, r0
|
||||
if (opline->opcode == ZEND_PRE_DEC && opline->result_type != IS_UNUSED) {
|
||||
| LOAD_ZVAL_ADDR FCARG2a, res_addr
|
||||
| EXT_CALL zend_jit_pre_dec, r0
|
||||
} else {
|
||||
| EXT_CALL decrement_function, r0
|
||||
}
|
||||
}
|
||||
} else {
|
||||
zend_reg tmp_reg;
|
||||
@ -2970,11 +2980,11 @@ static int zend_jit_inc_dec(dasm_State **Dst, const zend_op *opline, const zend_
|
||||
}
|
||||
}
|
||||
| SSE_SET_ZVAL_DVAL op1_def_addr, tmp_reg
|
||||
}
|
||||
if ((opline->opcode == ZEND_PRE_INC || opline->opcode == ZEND_PRE_DEC) &&
|
||||
opline->result_type != IS_UNUSED) {
|
||||
| ZVAL_COPY_VALUE res_addr, res_use_info, op1_addr, op1_def_info, ZREG_R0, ZREG_R1
|
||||
| TRY_ADDREF op1_def_info, ah, r1
|
||||
if ((opline->opcode == ZEND_PRE_INC || opline->opcode == ZEND_PRE_DEC) &&
|
||||
opline->result_type != IS_UNUSED) {
|
||||
| ZVAL_COPY_VALUE res_addr, res_use_info, op1_addr, op1_def_info, ZREG_R0, ZREG_R1
|
||||
| TRY_ADDREF op1_def_info, ah, r1
|
||||
}
|
||||
}
|
||||
| jmp >3
|
||||
|.code
|
||||
|
Loading…
Reference in New Issue
Block a user