From c8d893a875fda8a37eadf16c690dbeebf3262ead Mon Sep 17 00:00:00 2001 From: =?utf8?q?Michal=20Strehovsk=C3=BD?= Date: Tue, 21 Feb 2017 16:37:04 -0800 Subject: [PATCH] Use CORINFO_CALLCONV to check for unmanaged calls (dotnet/coreclr#9697) `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 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/coreclr/src/jit/importer.cpp b/src/coreclr/src/jit/importer.cpp index c1b8790..743cae2 100644 --- a/src/coreclr/src/jit/importer.cpp +++ b/src/coreclr/src/jit/importer.cpp @@ -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()); -- 2.7.4