Skip to content

Commit 080784a

Browse files
committed
Eliminate more dead type stores
1 parent 6188b7a commit 080784a

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3838,7 +3838,7 @@ static int zend_jit_load_var(dasm_State **Dst, uint32_t info, int var, zend_reg
38383838
return zend_jit_load_reg(Dst, src, dst, info);
38393839
}
38403840

3841-
static int zend_jit_update_regs(dasm_State **Dst, zend_jit_addr src, zend_jit_addr dst, uint32_t info)
3841+
static int zend_jit_update_regs(dasm_State **Dst, uint32_t var, zend_jit_addr src, zend_jit_addr dst, uint32_t info)
38423842
{
38433843
if (!zend_jit_same_addr(src, dst)) {
38443844
if (Z_MODE(src) == IS_REG) {
@@ -3852,7 +3852,12 @@ static int zend_jit_update_regs(dasm_State **Dst, zend_jit_addr src, zend_jit_ad
38523852
}
38533853
} else if (Z_MODE(dst) == IS_MEM_ZVAL) {
38543854
if (!Z_LOAD(src) && !Z_STORE(src)) {
3855-
if (!zend_jit_spill_store(Dst, src, dst, info, 1)) {
3855+
if (!zend_jit_spill_store(Dst, src, dst, info,
3856+
JIT_G(trigger) != ZEND_JIT_ON_HOT_TRACE ||
3857+
JIT_G(current_frame) == NULL ||
3858+
STACK_MEM_TYPE(JIT_G(current_frame)->stack, EX_VAR_TO_NUM(var)) == IS_UNKNOWN ||
3859+
(1 << STACK_MEM_TYPE(JIT_G(current_frame)->stack, EX_VAR_TO_NUM(var))) != (info & MAY_BE_ANY)
3860+
)) {
38563861
return 0;
38573862
}
38583863
}
@@ -3959,7 +3964,7 @@ static int zend_jit_inc_dec(dasm_State **Dst, const zend_op *opline, uint32_t op
39593964
if (opline->opcode == ZEND_POST_INC || opline->opcode == ZEND_POST_DEC) {
39603965
| ZVAL_COPY_VALUE res_addr, res_use_info, op1_addr, MAY_BE_LONG, ZREG_R0, ZREG_R1
39613966
}
3962-
if (!zend_jit_update_regs(Dst, op1_addr, op1_def_addr, MAY_BE_LONG)) {
3967+
if (!zend_jit_update_regs(Dst, opline->op1.var, op1_addr, op1_def_addr, MAY_BE_LONG)) {
39633968
return 0;
39643969
}
39653970
if (opline->opcode == ZEND_PRE_INC || opline->opcode == ZEND_POST_INC) {
@@ -8561,7 +8566,7 @@ static int zend_jit_bool_jmpznz(dasm_State **Dst, const zend_op *opline, uint32_
85618566
static int zend_jit_qm_assign(dasm_State **Dst, const zend_op *opline, uint32_t op1_info, zend_jit_addr op1_addr, zend_jit_addr op1_def_addr, uint32_t res_use_info, uint32_t res_info, zend_jit_addr res_addr)
85628567
{
85638568
if (op1_addr != op1_def_addr) {
8564-
if (!zend_jit_update_regs(Dst, op1_addr, op1_def_addr, op1_info)) {
8569+
if (!zend_jit_update_regs(Dst, opline->op1.var, op1_addr, op1_def_addr, op1_info)) {
85658570
return 0;
85668571
}
85678572
if (Z_MODE(op1_def_addr) == IS_REG && Z_MODE(op1_addr) != IS_REG) {
@@ -8583,7 +8588,7 @@ static int zend_jit_assign(dasm_State **Dst, const zend_op *opline, uint32_t op1
85838588
ZEND_ASSERT(opline->op1_type == IS_CV);
85848589

85858590
if (op2_addr != op2_def_addr) {
8586-
if (!zend_jit_update_regs(Dst, op2_addr, op2_def_addr, op2_info)) {
8591+
if (!zend_jit_update_regs(Dst, opline->op2.var, op2_addr, op2_def_addr, op2_info)) {
85878592
return 0;
85888593
}
85898594
if (Z_MODE(op2_def_addr) == IS_REG && Z_MODE(op2_addr) != IS_REG) {
@@ -10515,7 +10520,7 @@ static int zend_jit_send_var(dasm_State **Dst, const zend_op *opline, const zend
1051510520
}
1051610521
} else {
1051710522
if (op1_addr != op1_def_addr) {
10518-
if (!zend_jit_update_regs(Dst, op1_addr, op1_def_addr, op1_info)) {
10523+
if (!zend_jit_update_regs(Dst, opline->op1.var, op1_addr, op1_def_addr, op1_info)) {
1051910524
return 0;
1052010525
}
1052110526
if (Z_MODE(op1_def_addr) == IS_REG && Z_MODE(op1_addr) != IS_REG) {

0 commit comments

Comments
 (0)