Skip to content

Commit 3d576db

Browse files
committed
JIT: Avoid dead type store
1 parent 2d11d8b commit 3d576db

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

ext/opcache/jit/zend_jit_arm64.dasc

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3470,12 +3470,20 @@ static int zend_jit_spill_store(dasm_State **Dst, zend_jit_addr src, zend_jit_ad
34703470

34713471
if ((info & MAY_BE_ANY) == MAY_BE_LONG) {
34723472
| SET_ZVAL_LVAL_FROM_REG dst, Rx(Z_REG(src)), TMP1
3473-
if (set_type) {
3473+
if (set_type &&
3474+
(Z_REG(dst) != ZREG_FP ||
3475+
!JIT_G(current_frame) ||
3476+
!JIT_G(current_frame)->stack ||
3477+
STACK_MEM_TYPE(JIT_G(current_frame)->stack, EX_VAR_TO_NUM(Z_OFFSET(dst))) != IS_LONG)) {
34743478
| SET_ZVAL_TYPE_INFO dst, IS_LONG, TMP1w, TMP2
34753479
}
34763480
} else if ((info & MAY_BE_ANY) == MAY_BE_DOUBLE) {
34773481
| SET_ZVAL_DVAL dst, Z_REG(src), ZREG_TMP1
3478-
if (set_type) {
3482+
if (set_type &&
3483+
(Z_REG(dst) != ZREG_FP ||
3484+
!JIT_G(current_frame) ||
3485+
!JIT_G(current_frame)->stack ||
3486+
STACK_MEM_TYPE(JIT_G(current_frame)->stack, EX_VAR_TO_NUM(Z_OFFSET(dst))) != IS_DOUBLE)) {
34793487
| SET_ZVAL_TYPE_INFO dst, IS_DOUBLE, TMP1w, TMP2
34803488
}
34813489
} else {

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3821,12 +3821,20 @@ static int zend_jit_spill_store(dasm_State **Dst, zend_jit_addr src, zend_jit_ad
38213821

38223822
if ((info & MAY_BE_ANY) == MAY_BE_LONG) {
38233823
| SET_ZVAL_LVAL dst, Ra(Z_REG(src))
3824-
if (set_type) {
3824+
if (set_type &&
3825+
(Z_REG(dst) != ZREG_FP ||
3826+
!JIT_G(current_frame) ||
3827+
!JIT_G(current_frame)->stack ||
3828+
STACK_MEM_TYPE(JIT_G(current_frame)->stack, EX_VAR_TO_NUM(Z_OFFSET(dst))) != IS_LONG)) {
38253829
| SET_ZVAL_TYPE_INFO dst, IS_LONG
38263830
}
38273831
} else if ((info & MAY_BE_ANY) == MAY_BE_DOUBLE) {
38283832
| DOUBLE_SET_ZVAL_DVAL dst, Z_REG(src)
3829-
if (set_type) {
3833+
if (set_type &&
3834+
(Z_REG(dst) != ZREG_FP ||
3835+
!JIT_G(current_frame) ||
3836+
!JIT_G(current_frame)->stack ||
3837+
STACK_MEM_TYPE(JIT_G(current_frame)->stack, EX_VAR_TO_NUM(Z_OFFSET(dst))) != IS_DOUBLE)) {
38303838
| SET_ZVAL_TYPE_INFO dst, IS_DOUBLE
38313839
}
38323840
} else {

0 commit comments

Comments
 (0)