Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse CallConvSwift in CoreCLR/NativeAOT #96707

Merged
merged 16 commits into from
Jan 30, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Flip branch logic
  • Loading branch information
jkoritzinsky committed Jan 30, 2024
commit 1b8eb2c76347275eed0d1b81b1c77dbc478e5740
jkoritzinsky marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -139,18 +139,16 @@ public static UnmanagedCallingConventions GetDelegateCallingConventions(this Typ
{
Debug.Assert(delegateType.IsDelegate);

if (delegateType is not EcmaType ecmaDelegate)
if (delegateType is EcmaType ecmaDelegate)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Might want to either do delegateType.GetTypeDefinition() is EcmaType ecmaDelegate or assert the type is not generic so that we just don't do bad codegen if we ever allow interop with generic delegates.

{
return GetPlatformDefaultUnmanagedCallingConvention(delegateType.Context);
}

MethodSignatureFlags unmanagedCallConv = ecmaDelegate.GetDelegatePInvokeFlags().UnmanagedCallingConvention;
if (unmanagedCallConv != MethodSignatureFlags.None)
{
Debug.Assert((int)MethodSignatureFlags.UnmanagedCallingConventionCdecl == (int)UnmanagedCallingConventions.Cdecl
&& (int)MethodSignatureFlags.UnmanagedCallingConventionStdCall == (int)UnmanagedCallingConventions.Stdcall
&& (int)MethodSignatureFlags.UnmanagedCallingConventionThisCall == (int)UnmanagedCallingConventions.Thiscall);
return (UnmanagedCallingConventions)unmanagedCallConv;
MethodSignatureFlags unmanagedCallConv = ecmaDelegate.GetDelegatePInvokeFlags().UnmanagedCallingConvention;
if (unmanagedCallConv != MethodSignatureFlags.None)
{
Debug.Assert((int)MethodSignatureFlags.UnmanagedCallingConventionCdecl == (int)UnmanagedCallingConventions.Cdecl
&& (int)MethodSignatureFlags.UnmanagedCallingConventionStdCall == (int)UnmanagedCallingConventions.Stdcall
&& (int)MethodSignatureFlags.UnmanagedCallingConventionThisCall == (int)UnmanagedCallingConventions.Thiscall);
return (UnmanagedCallingConventions)unmanagedCallConv;
}
}

return GetPlatformDefaultUnmanagedCallingConvention(delegateType.Context);
Expand Down
Loading