-
Notifications
You must be signed in to change notification settings - Fork 508
RyuJit doesn't support inlining P/Invokes whose return type is a struct #2144
Comments
We need to get onto the |
We can force that in JIT startup by setting CorJitFlag.CORJIT_FLG_IL_STUB for p/invokes. That only works for Calli though. We maybe need something CoreRT-specific in that area of the importer to allow it for direct calls. |
Agree. |
Is there a workaround for this, to prevent the inlining from taking place? |
The proper fix should be like a five line change in RyuJIT. I will try to do it in a next several days. There is a related problem (#158) that causes structs on Unix to not be always passed in registers according to the platform calling convention. If you have PInvokes that return structs, you are likely to hit that one too. |
In importer.cpp,
Compiler::impCanPInvokeInlineCallSite
excludes P/Invokes from being emitted inline if they return a struct. This prevents CoreRT from compiling invoke stubs. The actual external method call ends up as a managed direct call instead.See, ie:
System.Console!mincore.GetLargestConsoleWindowSize
The text was updated successfully, but these errors were encountered: