From 1d7b27ed1adf1a41f7fb16c9597364bca570e086 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Mon, 5 Apr 2021 16:07:28 -0700 Subject: [PATCH 1/2] Fix Crossgen2 of PlatformDefaultMemberFunction methods and calls. --- src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs b/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs index 52d696e5e13d3b..dc05e9bcee1852 100644 --- a/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs +++ b/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs @@ -592,7 +592,7 @@ private CorInfoCallConvExtension GetUnmanagedCallingConventionFromAttribute(Cust } } - if (found && memberFunctionVariant) + if (memberFunctionVariant) { callConv = GetMemberFunctionCallingConventionVariant(callConv); } @@ -649,9 +649,9 @@ private bool TryGetUnmanagedCallingConventionFromModOpt(MethodSignature signatur } } - if (found && memberFunctionVariant) + if (memberFunctionVariant) { - callConv = GetMemberFunctionCallingConventionVariant(callConv); + callConv = GetMemberFunctionCallingConventionVariant(found ? callConv : (CorInfoCallConvExtension)PlatformDefaultUnmanagedCallingConvention()); } return found; From 6ad568db970f615ce91e288f4b828bddd8bd0515 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Mon, 5 Apr 2021 16:42:37 -0700 Subject: [PATCH 2/2] Update CorInfoImpl.cs --- src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs b/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs index dc05e9bcee1852..d99c51d236950c 100644 --- a/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs +++ b/src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs @@ -603,6 +603,8 @@ private CorInfoCallConvExtension GetUnmanagedCallingConventionFromAttribute(Cust private bool TryGetUnmanagedCallingConventionFromModOpt(MethodSignature signature, out CorInfoCallConvExtension callConv, out bool suppressGCTransition) { suppressGCTransition = false; + // Default to managed since in the modopt case we need to differentiate explicitly using a calling convention that matches the default + // and not specifying a calling convention at all and using the implicit default case in P/Invoke stub inlining. callConv = CorInfoCallConvExtension.Managed; if (!signature.HasEmbeddedSignatureData || signature.GetEmbeddedSignatureData() == null) return false;