Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow contained indirections in tailcalls on x64 (#58686)
This adds support for contained indirections in tailcalls on x64. The significant diff of this change is refactoring to be able to reuse the code for generating call instructions when generating tailcalls as well. Other than that, the main change is to allow contained indirs in lowering and to ensure LSRA uses volatile registers for the addressing mode so that the registers are not overridden by the epilog sequence. To be sure we insert rex. prefix correctly I also refactored the emitter to base the decision on a new instruction (INS_i_jmp) and emit it when necessary. The rex. prefix is necessary because the unwinder uses it to determine that a tail jmp is non-local and thus part of the epilog. Finally, unlike the OS unwinder our unwinder needs to compute the size of the epilog. This computation was wrong for jmp [foo] for addressing modes/rip-relative addressing, so fix this as well. Presumably that has not been a problem before since we did not generate these instructions in managed code (although native code may have had these instructions -- not sure if we use that unwinder for native code).
- Loading branch information