开发者

Architecture that can optimize tail calls for C#

Reading a blog entry by Eric Lippert, I came across this snippet:

...you're going to either loop forever (if you're on an architecture that can optimize tail calls) or run out of stack 开发者_StackOverflowand crash the process.

I'm aware that a compiler can optimize tail recursion, but what does an architecture that can optimize tail calls mean?


It means that the .NET JIT on x64 behaves differently to the JIT on x86 - the x64 one applies tail call optimizations much more aggressively.

See this blog post from 2007 and this one from 2009 for some implementation details (not to be depended upon) for some of the rules that are followed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜