Mono 中的尾调用消除

Tailcall elimination in Mono(Mono 中的尾调用消除)
本文介绍了Mono 中的尾调用消除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个大量使用尾递归(用 F# 编程)的 .NET 4.0 应用程序.它在 .NET VM 上运行良好,但在 Mono-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.

我尝试过使用 mono --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?

推荐答案

最近有一个非常相似的问题有帮助:StackMono下的大小

There is a very similar more recent question with helpful answers: Stack size under Mono

正如 Robert Harvey 在评论中已经指出的那样,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 方式 在 Mono 中不起作用.要更改 PE,您可能会 需要 MS Visual Studio,因为它的 editbin.exe/stack.

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.

这篇关于Mono 中的尾调用消除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

c# Generic Setlt;Tgt; implementation to access objects by type(按类型访问对象的C#泛型集实现)
InvalidOperationException When using Context Injection in ASP.Net Core(在ASP.NET核心中使用上下文注入时发生InvalidOperationException)
quot;Overflowquot; compiler error with -9223372036854775808L(编译器错误-9223372036854775808L(Q;溢出Q))
Visual Studio 2010 ReportViewer Assembly References(Visual Studio 2010 ReportViewer程序集引用)
Weird behaviour when I open a reportviewer in WPF(在WPF中打开报表查看器时出现奇怪的行为)
how do i pass parameters to aspnet reportviewer(如何将参数传递给aspnet report查看器)