Commit 940ff20
authored
JIT: Use interned constants for offsets in jit_ADD_OFFSET() (#23952)
* JIT: Use interned constants for offsets in jit_ADD_OFFSET()
`jit_ADD_OFFSET()` created the offset through `jit_CONST_ADDR()`, which
returns a unique (non-interned) constant. IR's own folding of nested
offsets, `ADD(ADD(x, c1), c2)`, creates an interned constant for `c1+c2`.
The same address can therefore end up with two different offset
refs, and CSE and store-to-load forwarding, which both need an
identical address ref, miss it.
The uniqueing exists likely for the exit addresses mostly, but for
offsets this is wrong.
For example, the type store and the type load of the same zval end up
with different refs:
```php
function count_big($n) {
$c = 0;
for ($i = 0; $i < $n; $i++) {
$big = $i > 5;
if ($big) {
$c++;
}
}
return $c;
}
```
Loop body before:
```asm
movl %esi, 0x88(%r14)
cmpb $3, 0x88(%r14)
jne jit$$trace_exit_4
```
After:
```asm
movl %esi, 0x88(%r14)
cmpb $3, %sil ; no reload
jne jit$$trace_exit_4
```
In general, more redundant loads can be avoided, and in some cases type
guards can be eliminated due to store->load forwarding.
* get rid of php-specific interning table
* restore some static cache1 parent fe3d1ba commit 940ff20
1 file changed
Lines changed: 5 additions & 59 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
93 | | - | |
94 | 92 | | |
95 | 93 | | |
96 | 94 | | |
| |||
101 | 99 | | |
102 | 100 | | |
103 | 101 | | |
104 | | - | |
| 102 | + | |
105 | 103 | | |
106 | 104 | | |
107 | 105 | | |
| |||
317 | 315 | | |
318 | 316 | | |
319 | 317 | | |
320 | | - | |
321 | 318 | | |
322 | 319 | | |
323 | 320 | | |
| |||
531 | 528 | | |
532 | 529 | | |
533 | 530 | | |
534 | | - | |
535 | | - | |
536 | | - | |
537 | | - | |
538 | | - | |
539 | | - | |
540 | | - | |
541 | | - | |
542 | | - | |
543 | | - | |
544 | | - | |
545 | | - | |
546 | | - | |
547 | | - | |
548 | | - | |
549 | | - | |
550 | | - | |
551 | | - | |
552 | | - | |
553 | | - | |
554 | | - | |
555 | | - | |
556 | | - | |
557 | | - | |
558 | | - | |
559 | | - | |
560 | | - | |
561 | | - | |
562 | | - | |
563 | | - | |
564 | | - | |
565 | | - | |
566 | | - | |
567 | | - | |
568 | | - | |
569 | | - | |
570 | | - | |
571 | | - | |
572 | | - | |
573 | | - | |
574 | 531 | | |
575 | 532 | | |
576 | 533 | | |
| |||
580 | 537 | | |
581 | 538 | | |
582 | 539 | | |
583 | | - | |
| 540 | + | |
584 | 541 | | |
585 | 542 | | |
586 | 543 | | |
| |||
604 | 561 | | |
605 | 562 | | |
606 | 563 | | |
607 | | - | |
| 564 | + | |
608 | 565 | | |
609 | 566 | | |
610 | 567 | | |
| |||
616 | 573 | | |
617 | 574 | | |
618 | 575 | | |
619 | | - | |
| 576 | + | |
620 | 577 | | |
621 | 578 | | |
622 | 579 | | |
| |||
625 | 582 | | |
626 | 583 | | |
627 | 584 | | |
628 | | - | |
629 | 585 | | |
630 | 586 | | |
631 | | - | |
632 | | - | |
633 | | - | |
634 | | - | |
635 | | - | |
636 | | - | |
637 | | - | |
638 | | - | |
639 | | - | |
| 587 | + | |
640 | 588 | | |
641 | 589 | | |
642 | 590 | | |
| |||
2842 | 2790 | | |
2843 | 2791 | | |
2844 | 2792 | | |
2845 | | - | |
2846 | 2793 | | |
2847 | 2794 | | |
2848 | 2795 | | |
| |||
2853 | 2800 | | |
2854 | 2801 | | |
2855 | 2802 | | |
2856 | | - | |
2857 | 2803 | | |
2858 | 2804 | | |
2859 | 2805 | | |
| |||
0 commit comments