Files
Jakob Botsch Nielsen 367b006530 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 863ad4d344bcdacebb00c8c921c7345fd63c7d7b.

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 object
2021-10-07 10:15:59 +02:00
..
2021-07-22 12:08:27 -07:00
2021-07-11 16:46:53 +02:00
2021-03-20 09:16:59 -04:00
2021-07-11 16:46:53 +02:00

Updating idl files

This directory has a variety of .idl files (such as corprof.idl) that need a little special handling when you make changes. Originally when we built on Windows only the build rules would automatically convert the idls into corresponding .h/.c files and include them in compilations. On non-windows platforms we don't have an equivalent for midl.exe which did that conversion so we work around the issue by doing:

  • Build on Windows as normal, which will generate files in artifacts\obj\windows.x64.Debug\inc\idls_out\
  • Copy any updated headers into src\coreclr\pal\prebuilt\inc\
  • If needed, adjust any of the .cpp files in src\coreclr\pal\prebuilt\idl\ by hand, using the corresponding artifacts\obj\windows.x64.Debug\inc\idls_out\*_i.c as a guide.
    • Typically this is just adding MIDL_DEFINE_GUID(...) for any new classes/interfaces that have been added to the idl file.

Include these src changes with the remainder of your work when you submit a PR.