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
7 changes: 6 additions & 1 deletion src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3713,7 +3713,7 @@ private bool getTailCallHelpers(ref CORINFO_RESOLVED_TOKEN callToken, CORINFO_SI
private CORINFO_METHOD_STRUCT_* getAsyncResumptionStub()
#pragma warning restore CA1822 // Mark members as static
{
return null;
throw new NotImplementedException("Crossgen2 does not support runtime-async yet");
}

private byte[] _code;
Expand Down Expand Up @@ -4297,6 +4297,11 @@ private uint getJitFlags(ref CORJIT_FLAGS flags, uint sizeInBytes)
flags.Set(CorJitFlag.CORJIT_FLAG_SOFTFP_ABI);
}

if (this.MethodBeingCompiled.IsAsync)
{
flags.Set(CorJitFlag.CORJIT_FLAG_ASYNC);
}

return (uint)sizeof(CORJIT_FLAGS);
}

Expand Down
1 change: 1 addition & 0 deletions src/coreclr/tools/Common/JitInterface/CorInfoTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1414,6 +1414,7 @@ public enum CorJitFlag : uint
// ARM only
CORJIT_FLAG_RELATIVE_CODE_RELOCS = 29, // JIT should generate PC-relative address computations instead of EE relocation records
CORJIT_FLAG_SOFTFP_ABI = 30, // Enable armel calling convention
CORJIT_FLAG_ASYNC = 31, // Generate code for use as an async function
}

public struct CORJIT_FLAGS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,15 @@ public override bool IsPublic
}
}

public override bool IsAsync
{
get
{
return _methodDef.IsAsync;
}
}


public override bool HasCustomAttribute(string attributeNamespace, string attributeName)
{
return _methodDef.HasCustomAttribute(attributeNamespace, attributeName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public MethodDelegator(MethodDesc wrappedMethod)

public override bool IsFinal => _wrappedMethod.IsFinal;

public override bool IsAsync => _wrappedMethod.IsAsync;

public override bool HasCustomAttribute(string attributeNamespace, string attributeName)
{
return _wrappedMethod.HasCustomAttribute(attributeNamespace, attributeName);
Expand Down
8 changes: 8 additions & 0 deletions src/coreclr/tools/Common/TypeSystem/Common/MethodDesc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,14 @@ public virtual bool IsPublic
}
}

public virtual bool IsAsync
{
get
{
return false;
}
}

public abstract bool HasCustomAttribute(string attributeNamespace, string attributeName);

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,14 @@ public override bool IsPublic
}
}

public override bool IsAsync
{
get
{
return _typicalMethodDef.IsAsync;
}
}

public override bool HasCustomAttribute(string attributeNamespace, string attributeName)
{
return _typicalMethodDef.HasCustomAttribute(attributeNamespace, attributeName);
Expand Down
12 changes: 12 additions & 0 deletions src/coreclr/tools/Common/TypeSystem/Ecma/EcmaMethod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ private static class MethodFlags
public const int AttributeMetadataCache = 0x02000;
public const int Intrinsic = 0x04000;
public const int UnmanagedCallersOnly = 0x08000;
public const int Async = 0x10000;
};

private EcmaType _type;
Expand Down Expand Up @@ -167,6 +168,9 @@ private int InitializeMethodFlags(int mask)
if ((methodImplAttributes & MethodImplAttributes.Synchronized) != 0)
flags |= MethodFlags.Synchronized;

if ((methodImplAttributes & MethodImplAttributes.Async) != 0)
flags |= MethodFlags.Async;

flags |= MethodFlags.BasicMetadataCache;
}

Expand Down Expand Up @@ -367,6 +371,14 @@ public override bool IsStaticConstructor
}
}

public override bool IsAsync
{
get
{
return (GetMethodFlags(MethodFlags.BasicMetadataCache | MethodFlags.Async) & MethodFlags.Async) != 0;
}
}

public MethodAttributes Attributes
{
get
Expand Down