dotnet / corert

This repo contains CoreRT, an experimental .NET Core runtime optimized for AOT (ahead of time compilation) scenarios, with the accompanying compiler toolchain.
http://dot.net
MIT License
2.91k stars 508 forks source link

canGetCookieForPInvokeCalliSig not implemented #5587

Closed mellinoe closed 6 years ago

mellinoe commented 6 years ago

I was trying to compile this project with CoreRT: https://github.com/mellinoe/veldrid/tree/master/src/NeoDemo.

I added the latest Microsoft.DotNet.ILCompiler package and simply ran dotnet publish -r win-x64.

  ILCompiler.CodeGenerationFailedException: Code generation failed ---> System.NotImplementedException: canGetCookieForPInvokeCalliSig
     at Internal.JitInterface.CorInfoImpl.canGetCookieForPInvokeCalliSig(CORINFO_SIG_INFO* szMetaSig)
     at Internal.JitInterface.CorInfoImpl._canGetCookieForPInvokeCalliSig(IntPtr thisHandle, IntPtr* ppException, CORINFO_SIG_INFO* szMetaSig)
     --- End of inner exception stack trace ---
     at Internal.JitInterface.CorInfoImpl.CompileMethod(IMethodCodeNode methodCodeNodeNeedingCode, MethodIL methodIL)
     at ILCompiler.RyuJitCompilation.ComputeDependencyNodeDependencies(List`1 obj)
     at ILCompiler.DependencyAnalysisFramework.DependencyAnalyzer`2.ComputeMarkedNodes()
     at ILCompiler.RyuJitCompilation.CompileInternal(String outputFile, ObjectDumper dumper)
     at ILCompiler.Compilation.ILCompiler.ICompilation.Compile(String outputFile, ObjectDumper dumper)
     at ILCompiler.Program.Run(String[] args)
     at ILCompiler.Program.Main(String[] args)

Any plans to implement this functionality, or is it tracked anywhere else? I searched briefly but didn't find anything.

MichalStrehovsky commented 6 years ago

Thanks for reporting it! We don't track this anywhere because we didn't hit it yet. Seems like this is from a calli to a p/invoke. I'll have a look if we can do something easy there in the next couple of days.

mellinoe commented 6 years ago

Seems like this is from a calli to a p/invoke.

Yes, that's likely, and it's probably from this library. If that's the case, then a simpler repro could probably be created from that package alone.

mellinoe commented 6 years ago

Small update: I checked again and this is indeed caused by the above library. SharpDX hits the same issue since it also uses calli directly.

Krakean commented 6 years ago

@MichalStrehovsky +1, can't use SharpDX due this :-\

feliwir commented 6 years ago

@MichalStrehovsky +1 we are hitting this issue aswell in our project. Would greatly appreciate a fix

jkotas commented 6 years ago

@mellinoe @Krakean @feliwir The CoreRT packages with the fix are available now. Please give it a try and please let us know if you run into other blocking issues for you project.

mellinoe commented 6 years ago

@jkotas I get a lot further now, and most of my code works. I still have an issue with SharpDX which I filed over in #6042 .