Skip to content

Commit ea0110f

Browse files
committed
Improve registers reuse
1 parent 850feff commit ea0110f

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

ext/opcache/jit/zend_jit.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,10 +1391,6 @@ static int zend_jit_try_allocate_free_reg(const zend_op_array *op_array, zend_ss
13911391
*/
13921392
available = ZEND_REGSET_DIFFERENCE(available, ZEND_REGSET_PRESERVED);
13931393

1394-
if (ZEND_REGSET_IS_EMPTY(available)) {
1395-
return 0;
1396-
}
1397-
13981394
/* Set freeUntilPos of all physical registers to maxInt */
13991395
for (i = 0; i < ZREG_NUM; i++) {
14001396
freeUntilPos[i] = 0xffffffff;
@@ -1432,6 +1428,10 @@ static int zend_jit_try_allocate_free_reg(const zend_op_array *op_array, zend_ss
14321428
}
14331429
}
14341430

1431+
if (hint == ZREG_NONE && ZEND_REGSET_IS_EMPTY(available)) {
1432+
return 0;
1433+
}
1434+
14351435
/* See "Linear Scan Register Allocation on SSA Form", Christian Wimmer and
14361436
Michael Franz, CGO'10 (2010), Figure 6. */
14371437
if (current->flags & ZREG_SPLIT) {
@@ -1519,6 +1519,10 @@ static int zend_jit_try_allocate_free_reg(const zend_op_array *op_array, zend_ss
15191519
return 1;
15201520
}
15211521

1522+
if (ZEND_REGSET_IS_EMPTY(available)) {
1523+
return 0;
1524+
}
1525+
15221526
pos = 0; reg = ZREG_NONE;
15231527
pos2 = 0; reg2 = ZREG_NONE;
15241528
low_priority_regs = *hints;

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10947,7 +10947,7 @@ static zend_bool zend_jit_verify_return_type(dasm_State **Dst, const zend_op *op
1094710947

1094810948
static zend_bool zend_jit_may_reuse_reg(const zend_op *opline, const zend_ssa_op *ssa_op, zend_ssa *ssa, int def_var, int use_var)
1094910949
{
10950-
if (ssa->var_info[def_var].type != ssa->var_info[use_var].type) {
10950+
if ((ssa->var_info[def_var].type & ~MAY_BE_GUARD) != (ssa->var_info[use_var].type & ~MAY_BE_GUARD)) {
1095110951
return 0;
1095210952
}
1095310953

0 commit comments

Comments
 (0)