Commit 367b006
authored
Support fast tailcalls in R2R (#56669)
* Support fast tailcalls in R2R
Partially addresses #5857
* Support ARM64
* Run jit-format
* Fix non-R2R ARM build
* Fix recursive-call-to-loop optimization with non-standard args
* Implement new delay load helper for fast tailcalls
* Minor changes and fix build break
* Switch to a define for tailcall register
* Fix x86
* Implement DefType.IsUnsafeValueType
* Emit rex.jmp for tailcall jumps on x64
* Refactor non standard args + refix recursive tailcall opt
* Set nonStandardArgKind for stack args also
* Regenerate JIT interface
* Improve recursion-to-loop decision about which args need to be reassigned
* Use INS_tail_i_jmp for func token indir
* More efficient arm64 VSD fast tailcalls, fix some bad merging
Also fix logic since we removed tailcall register. For ARM64 that means
we now use the single temp reg that is available for R2R/VSD calls, and
in LSRA we ensure this goes into a volatile register.
* Take R2R indirection into account for tail call profitability
On x64 an R2R indirected direct call normally disassembles the call site
to determine the indirection cell, so it is more expensive to do tail
calls in this scenario as the indirection cell needs to be passed in a
register. Take this into account: if there is no tail. prefix, do normal
calls, and otherwise use tail calls.
* Disallow tailcalls via JIT helper in R2R builds
* Revert "Take R2R indirection into account for tail call profitability"
This reverts commit 863ad4d.
Let's not divert on the behavior here. It is not clear that having a
smaller call site is better than tail calling albeit with a larger call
site.
* Add SPMI support, clean up mcPackets enum
* Take necessary conditions into account in canTailCall
Do not do implicit tailcalls when
* The caller is the entry point
* The caller is marked NoInline
* The callee requires security object1 parent a258c4f commit 367b006
File tree
41 files changed
+668
-314
lines changed- src/coreclr
- ToolBox/superpmi
- superpmi-shim-collector
- superpmi-shim-counter
- superpmi-shim-simple
- superpmi
- inc
- jit
- tools
- Common/JitInterface
- ThunkGenerator
- aot
- ILCompiler.ReadyToRun
- Compiler/DependencyAnalysis
- ReadyToRun
- Target_ARM64
- Target_ARM
- Target_X64
- Target_X86
- JitInterface
- jitinterface
- vm
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
41 files changed
+668
-314
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
128 | 128 | | |
129 | 129 | | |
130 | 130 | | |
| 131 | + | |
131 | 132 | | |
132 | 133 | | |
133 | 134 | | |
| |||
Lines changed: 35 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6608 | 6608 | | |
6609 | 6609 | | |
6610 | 6610 | | |
| 6611 | + | |
| 6612 | + | |
| 6613 | + | |
| 6614 | + | |
| 6615 | + | |
| 6616 | + | |
| 6617 | + | |
| 6618 | + | |
| 6619 | + | |
| 6620 | + | |
| 6621 | + | |
| 6622 | + | |
| 6623 | + | |
| 6624 | + | |
| 6625 | + | |
| 6626 | + | |
| 6627 | + | |
| 6628 | + | |
| 6629 | + | |
| 6630 | + | |
| 6631 | + | |
| 6632 | + | |
| 6633 | + | |
| 6634 | + | |
| 6635 | + | |
| 6636 | + | |
| 6637 | + | |
| 6638 | + | |
| 6639 | + | |
| 6640 | + | |
| 6641 | + | |
| 6642 | + | |
| 6643 | + | |
| 6644 | + | |
| 6645 | + | |
6611 | 6646 | | |
6612 | 6647 | | |
6613 | 6648 | | |
| |||
Lines changed: 193 additions & 193 deletions
Large diffs are not rendered by default.
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
97 | 97 | | |
98 | 98 | | |
99 | 99 | | |
100 | | - | |
| 100 | + | |
101 | 101 | | |
102 | | - | |
| 102 | + | |
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| |||
459 | 459 | | |
460 | 460 | | |
461 | 461 | | |
462 | | - | |
| 462 | + | |
463 | 463 | | |
464 | 464 | | |
465 | 465 | | |
| |||
469 | 469 | | |
470 | 470 | | |
471 | 471 | | |
472 | | - | |
| 472 | + | |
473 | 473 | | |
474 | 474 | | |
475 | 475 | | |
| |||
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1776 | 1776 | | |
1777 | 1777 | | |
1778 | 1778 | | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
1779 | 1787 | | |
1780 | 1788 | | |
1781 | 1789 | | |
| |||
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1250 | 1250 | | |
1251 | 1251 | | |
1252 | 1252 | | |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
1253 | 1260 | | |
1254 | 1261 | | |
1255 | 1262 | | |
| |||
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1094 | 1094 | | |
1095 | 1095 | | |
1096 | 1096 | | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
1097 | 1103 | | |
1098 | 1104 | | |
1099 | 1105 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1556 | 1556 | | |
1557 | 1557 | | |
1558 | 1558 | | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
1559 | 1565 | | |
1560 | 1566 | | |
1561 | 1567 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3164 | 3164 | | |
3165 | 3165 | | |
3166 | 3166 | | |
| 3167 | + | |
| 3168 | + | |
| 3169 | + | |
| 3170 | + | |
| 3171 | + | |
| 3172 | + | |
| 3173 | + | |
3167 | 3174 | | |
3168 | 3175 | | |
3169 | 3176 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
635 | 635 | | |
636 | 636 | | |
637 | 637 | | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
638 | 641 | | |
639 | 642 | | |
640 | 643 | | |
| |||
0 commit comments