Skip to content
Merged
Show file tree
Hide file tree
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
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.IsRuntimeAsync)
{
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
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 IsRuntimeAsync
{
get
{
return false;
}
}

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

/// <summary>
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 IsRuntimeAsync
{
get
{
return (GetMethodFlags(MethodFlags.BasicMetadataCache | MethodFlags.Async) & MethodFlags.Async) != 0;
}
}

public MethodAttributes Attributes
{
get
Expand Down
Loading