尾调用消除单 [英] Tailcall elimination in Mono
问题描述
我有一个.NET 4.0的应用程序,使得大量使用尾递归的(在F#编程)。它运行良好,在.NET虚拟机,但它运行的堆栈单-3.0.1。
I have a .NET 4.0 application that makes heavy use of tail recursion (programmed in F#). It runs fine on the .NET VM, but it runs out of stack on Mono-3.0.1.
我试着单--optimize = tailc
运行,但似乎并没有改变任何东西。
I've tried running with mono --optimize=tailc
but that doesn't seem to change anything.
是否有某种方式来强制单声道,以消除尾调用? 是否有某种方式来增加最大堆栈大小的单?
Is there some way to force mono to eliminate tail calls? Is there some way to increase the maximum stack size in mono?
推荐答案
有一些有用的答案非常相似的更近的问题:堆栈下单尺寸
There is a very similar more recent question with helpful answers: Stack size under Mono
正如罗伯特·哈维已经指出的评论,单声道打破/ F#的不完整的尾调用支持(的缺陷476785:在F#尾呼叫支持)。解决这个问题是在Mono运行时的在建项目列表。
As Robert Harvey already pointed out in the comments, Mono has broken/incomplete tail call support for F# (bug 476785: Tail call support in F#). Fix for this problem is on Mono's runtime ongoing projects list.
堆栈大小可以增加或者使用 System.Threading.Thread
的构造函数或PE头。该 System.Threading.Thread
办法不能在单工作,虽然。为了改变PE,你可能会<一href="http://social.msdn.microsoft.com/Forums/vstudio/en-US/8a5e235b-5042-4b96-959c-497e865b73ba/how-to-increase-stack-size-of-a-net-exe-in-windows?forum=netfxbcl"相对=nofollow>需要微软的Visual Studio的,因为可能没有替代其的 editbin.exe /堆栈
。
Stack size can be increased either using System.Threading.Thread
constructor or in the PE header. The System.Threading.Thread
way does not work in Mono, though. For changing the PE, you'll probably need MS Visual Studio, since there may be no alternative to its editbin.exe /stack
.
这篇关于尾调用消除单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!