Use CORINFO_CALLCONV to check for unmanaged calls (dotnet/coreclr#9697)
authorMichal Strehovský <MichalStrehovsky@users.noreply.github.com>
Wed, 22 Feb 2017 00:37:04 +0000 (16:37 -0800)
committerGitHub <noreply@github.com>
Wed, 22 Feb 2017 00:37:04 +0000 (16:37 -0800)
`GTF_CALL_UNMANAGED` is a member of the wrong enum and it's something
that would be set on `call->gtFlags` except that at this point it isn't.
Check against the actual unmanaged calling conventions.

Commit migrated from https://github.com/dotnet/coreclr/commit/0b4e58ac7a455640a5410b6f647ca3044426ea56

src/coreclr/src/jit/importer.cpp

index c1b8790..743cae2 100644 (file)
@@ -6464,7 +6464,10 @@ var_types Compiler::impImportCall(OPCODE                  opcode,
 
         if (IsTargetAbi(CORINFO_CORERT_ABI))
         {
-            bool managedCall = (calliSig.callConv & GTF_CALL_UNMANAGED) == 0;
+            bool managedCall = (((calliSig.callConv & CORINFO_CALLCONV_MASK) != CORINFO_CALLCONV_STDCALL) &&
+                                ((calliSig.callConv & CORINFO_CALLCONV_MASK) != CORINFO_CALLCONV_C) &&
+                                ((calliSig.callConv & CORINFO_CALLCONV_MASK) != CORINFO_CALLCONV_THISCALL) &&
+                                ((calliSig.callConv & CORINFO_CALLCONV_MASK) != CORINFO_CALLCONV_FASTCALL));
             if (managedCall)
             {
                 addFatPointerCandidate(call->AsCall());