簡體   English   中英

在Mono下運行的F#編譯器中的堆棧溢出

[英]stack overflow in F# compiler running under mono

我正在更新項目llvm-fs的工具,因此我安裝了新版本的mono並嘗試對其進行編譯。 在OS X下使用fsharpc 3.1 mono 3.10.0或在ubuntu下將fsharpc 3.0 mono 3.2.8結合使用時,編譯失敗並出現堆棧溢出:

Unhandled Exception:
System.StackOverflowException: The requested operation caused a stack overflow.
  at (wrapper managed-to-native) object:__icall_wrapper_mono_object_isinst (object,intptr)
  at (wrapper castclass) object:__castclass_with_cache (object,intptr,intptr)
  at Microsoft.FSharp.Compiler.Driver+DelayedDisposables.System-IDisposable-Dispose () [0x00000] in <filename unknown>:0 
  at Microsoft.FSharp.Compiler.Driver.typecheckAndCompile (System.String[] argv, Boolean bannerAlreadyPrinted, Exiter exiter, Microsoft.FSharp.Compiler.ErrorLoggerProvider errorLoggerProvider) [0x00000] in <filename unknown>:0 
  at Microsoft.FSharp.Compiler.Driver.mainCompile (System.String[] argv, Boolean bannerAlreadyPrinted, Exiter exiter) [0x00000] in <filename unknown>:0 
  at Microsoft.FSharp.Compiler.CommandLineMain.runMain (System.String[] argv) [0x00000] in <filename unknown>:0 
  at Microsoft.FSharp.Compiler.CommandLineMain.main (System.String[] argv) [0x00000] in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.StackOverflowException: The requested operation caused a stack overflow.
  at (wrapper managed-to-native) object:__icall_wrapper_mono_object_isinst (object,intptr)
  at (wrapper castclass) object:__castclass_with_cache (object,intptr,intptr)
  at Microsoft.FSharp.Compiler.Driver+DelayedDisposables.System-IDisposable-Dispose () [0x00000] in <filename unknown>:0 
  at Microsoft.FSharp.Compiler.Driver.typecheckAndCompile (System.String[] argv, Boolean bannerAlreadyPrinted, Exiter exiter, Microsoft.FSharp.Compiler.ErrorLoggerProvider errorLoggerProvider) [0x00000] in <filename unknown>:0 
  at Microsoft.FSharp.Compiler.Driver.mainCompile (System.String[] argv, Boolean bannerAlreadyPrinted, Exiter exiter) [0x00000] in <filename unknown>:0 
  at Microsoft.FSharp.Compiler.CommandLineMain.runMain (System.String[] argv) [0x00000] in <filename unknown>:0 
  at Microsoft.FSharp.Compiler.CommandLineMain.main (System.String[] argv) [0x00000] in <filename unknown>:0 

您可以通過執行以下操作在Linux或OS X上重現此錯誤:

git clone git@github.com:fsprojects/llvm-fs.git
cd llvm-fs/
FSC=fsharpc ./build.bash

在Windows fsc 12.0.30815.0 ,編譯完成,沒有錯誤:

fsc --nologo --debug --sig:LLVMFSharp.fsi --target:library --out:LLVMFSharp.dll src/LLVM/FFIUtil.fs src/LLVM/Generated.fs src/LLVM/Core.fs src/LLVM/BitReader.fs src/LLVM/ExecutionEngine.fs src/LLVM/Extra.fs src/LLVM/Target.fs src/LLVM/Quote.fs

這是一個已知問題,是否有任何解決方法? 我嘗試將不同的選項傳遞給mono運行時,但沒有一個導致編譯器正常退出。 我確實記得在過去,單聲道在遵循尾調用指令時遇到了一些問題,但我認為這些問題已基本解決。 謝謝!

這對於注釋來說太長了,但是錯誤是由generate.fs的這段代碼觸發的(因為注釋掉它會停止堆棧溢出-注釋掉以后會出現錯誤)(來自6496-6506行) ):

 [<DllImport(
            llvmAssemblyName,
            EntryPoint="LLVMRunFunction",
            CallingConvention=CallingConvention.Cdecl,
            CharSet=CharSet.Ansi)>]
        extern void* (* LLVMGenericValueRef *) runFunctionNative(
            void* (* LLVMExecutionEngineRef *) EE,
            void* (* LLVMValueRef *) F,
            uint32 NumArgs,
            void* (* LLVMGenericValueRef* *) Args)
        // I don't know how to generate an "F# friendly" version of LLVMRunFunction

在輸出簽名文件的代碼中發生崩潰。

禁用簽名文件可以解決此問題(但是仍然存在某個潛在的錯誤)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM