Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 0 additions & 2 deletions src/coreclr/tools/Common/Compiler/AsyncMethodVariant.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,10 @@ public override MethodSignature Signature
private MethodSignature InitializeSignature()
{
var signature = _wrappedMethod.Signature;
Debug.Assert(!signature.IsAsyncCall);
Debug.Assert(signature.ReturnsTaskOrValueTask());
TypeDesc md = signature.ReturnType;
MethodSignatureBuilder builder = new MethodSignatureBuilder(signature);
builder.ReturnType = md.HasInstantiation ? md.Instantiation[0] : this.Context.GetWellKnownType(WellKnownType.Void);
builder.Flags = signature.Flags | MethodSignatureFlags.AsyncCall;
return (_asyncSignature = builder.ToSignature());
}

Expand Down
7 changes: 7 additions & 0 deletions src/coreclr/tools/Common/Compiler/MethodExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,5 +153,12 @@ public static bool ReturnsTaskOrValueTask(this MethodSignature method)
}
return false;
}

/// <summary>
/// Determines whether a method uses the async calling convention.
/// Returns true for async variants (compiler-generated wrappers around Task-returning methods)
/// and for special async intrinsics that don't return Task/ValueTask but use async calling convention.
/// </summary>
public static bool IsAsyncCall(this MethodDesc method) => method.IsAsync && (method.IsAsyncVariant() || !method.Signature.ReturnsTaskOrValueTask());
}
}
6 changes: 4 additions & 2 deletions src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,9 @@ private void Get_CORINFO_SIG_INFO(MethodDesc method, CORINFO_SIG_INFO* sig, Meth
{
Get_CORINFO_SIG_INFO(method.Signature, sig, scope);

if (method.IsAsyncCall())
sig->callConv |= CorInfoCallConv.CORINFO_CALLCONV_ASYNCCALL;

// Does the method have a hidden parameter?
bool hasHiddenParameter = !suppressHiddenArgument && method.RequiresInstArg();

Expand Down Expand Up @@ -877,7 +880,6 @@ private void Get_CORINFO_SIG_INFO(MethodSignature signature, CORINFO_SIG_INFO* s

if (!signature.IsStatic) sig->callConv |= CorInfoCallConv.CORINFO_CALLCONV_HASTHIS;
if (signature.IsExplicitThis) sig->callConv |= CorInfoCallConv.CORINFO_CALLCONV_EXPLICITTHIS;
if (signature.IsAsyncCall) sig->callConv |= CorInfoCallConv.CORINFO_CALLCONV_ASYNCCALL;

TypeDesc returnType = signature.ReturnType;

Expand Down Expand Up @@ -4332,7 +4334,7 @@ private uint getJitFlags(ref CORJIT_FLAGS flags, uint sizeInBytes)
flags.Set(CorJitFlag.CORJIT_FLAG_SOFTFP_ABI);
}

if (this.MethodBeingCompiled.Signature.IsAsyncCall)
if (this.MethodBeingCompiled.IsAsyncCall())
{
flags.Set(CorJitFlag.CORJIT_FLAG_ASYNC);
}
Expand Down
10 changes: 0 additions & 10 deletions src/coreclr/tools/Common/TypeSystem/Common/MethodDesc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ public enum MethodSignatureFlags

Static = 0x0010,
ExplicitThis = 0x0020,

AsyncCall = 0x0100,
}

public enum EmbeddedSignatureDataKind
Expand Down Expand Up @@ -140,14 +138,6 @@ public bool IsExplicitThis
}
}

public bool IsAsyncCall
{
get
{
return (_flags & MethodSignatureFlags.AsyncCall) != 0;
}
}

public int GenericParameterCount
{
get
Expand Down
Loading