Commit 2016d85
committed
ZJIT: Preserve argument profiles in polymorphic dispatch arms
Each arm of a polymorphic dispatch takes a fresh Snapshot so that the
receiver resolves from its refined type instead of the polymorphic
profile. However, the fresh Snapshot had no ProfileOracle entries at
all, so argument-profile-dependent specializations were disabled in
every arm: e.g. Array#[] stayed a CCallVariadic because likely_a
could not see the Fixnum profile of the index.
Copy the profile entries from the original Snapshot to the per-arm
Snapshot, excluding only the receiver's entry (chased through guards),
since resolve_receiver_type prefers profiles over static types.
On optcarrot, this lets the Array arm of the polymorphic `@fetch[addr]`
callsites inline ArrayAref, removing ~3.9M frame-pushing Array#[]
calls per iteration (53% of all not-inlined cfunc calls).1 parent 3da63e6 commit 2016d85
2 files changed
Lines changed: 94 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7680 | 7680 | | |
7681 | 7681 | | |
7682 | 7682 | | |
| 7683 | + | |
| 7684 | + | |
| 7685 | + | |
| 7686 | + | |
| 7687 | + | |
| 7688 | + | |
| 7689 | + | |
| 7690 | + | |
| 7691 | + | |
| 7692 | + | |
| 7693 | + | |
| 7694 | + | |
| 7695 | + | |
| 7696 | + | |
| 7697 | + | |
| 7698 | + | |
| 7699 | + | |
7683 | 7700 | | |
7684 | 7701 | | |
7685 | 7702 | | |
| |||
9150 | 9167 | | |
9151 | 9168 | | |
9152 | 9169 | | |
| 9170 | + | |
| 9171 | + | |
| 9172 | + | |
| 9173 | + | |
| 9174 | + | |
| 9175 | + | |
9153 | 9176 | | |
9154 | 9177 | | |
9155 | 9178 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16855 | 16855 | | |
16856 | 16856 | | |
16857 | 16857 | | |
| 16858 | + | |
| 16859 | + | |
| 16860 | + | |
| 16861 | + | |
| 16862 | + | |
| 16863 | + | |
| 16864 | + | |
| 16865 | + | |
| 16866 | + | |
| 16867 | + | |
| 16868 | + | |
| 16869 | + | |
| 16870 | + | |
| 16871 | + | |
| 16872 | + | |
| 16873 | + | |
| 16874 | + | |
| 16875 | + | |
| 16876 | + | |
| 16877 | + | |
| 16878 | + | |
| 16879 | + | |
| 16880 | + | |
| 16881 | + | |
| 16882 | + | |
| 16883 | + | |
| 16884 | + | |
| 16885 | + | |
| 16886 | + | |
| 16887 | + | |
| 16888 | + | |
| 16889 | + | |
| 16890 | + | |
| 16891 | + | |
| 16892 | + | |
| 16893 | + | |
| 16894 | + | |
| 16895 | + | |
| 16896 | + | |
| 16897 | + | |
| 16898 | + | |
| 16899 | + | |
| 16900 | + | |
| 16901 | + | |
| 16902 | + | |
| 16903 | + | |
| 16904 | + | |
| 16905 | + | |
| 16906 | + | |
| 16907 | + | |
| 16908 | + | |
| 16909 | + | |
| 16910 | + | |
| 16911 | + | |
| 16912 | + | |
| 16913 | + | |
| 16914 | + | |
| 16915 | + | |
| 16916 | + | |
| 16917 | + | |
| 16918 | + | |
| 16919 | + | |
| 16920 | + | |
| 16921 | + | |
| 16922 | + | |
16858 | 16923 | | |
16859 | 16924 | | |
16860 | 16925 | | |
| |||
18519 | 18584 | | |
18520 | 18585 | | |
18521 | 18586 | | |
| 18587 | + | |
| 18588 | + | |
| 18589 | + | |
18522 | 18590 | | |
18523 | 18591 | | |
18524 | | - | |
18525 | 18592 | | |
18526 | 18593 | | |
18527 | 18594 | | |
| |||
18573 | 18640 | | |
18574 | 18641 | | |
18575 | 18642 | | |
18576 | | - | |
18577 | | - | |
| 18643 | + | |
| 18644 | + | |
| 18645 | + | |
18578 | 18646 | | |
18579 | 18647 | | |
18580 | 18648 | | |
| |||
0 commit comments