dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.09k stars 4.7k forks source link

Document conditions under which tail calls are honored by CoreCLR for each architecture along with info on fast and slow (or helper based) tail calls. #4911

Open sivarv opened 8 years ago

sivarv commented 8 years ago

To start with here is a blog post on Legacy JIT64 http://blogs.msdn.com/b/davbr/archive/2007/06/20/tail-call-jit-conditions.aspx

Since RyuJIT replaces LegacyJit64, the conditions remain the same modulo some differences that needs to be documented.

Also, document details on when a tail call is dispatched as fast tail call (epilog+jmp) and when it is dispatched via a slow mechanism (via tail call helper).

category:documentation theme:tail-call skill-level:intermediate cost:medium impact:small

jkotas commented 8 years ago

https://github.com/dotnet/coreclr/issues/2556#issuecomment-169755535 has a simple rule about when fast tail calls are used. IMHO, writing down a simple rules like this one is much more useful than documenting the exact conditions under which the current implementation performs fast tail-calls.

BruceForstall commented 5 years ago

cc @jashook @jakobbotsch