Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,6 @@ public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false)
continue;
}
MethodDesc inliner = methodNode.Method;
if (inliner.IsCompilerGeneratedILBodyForAsync())
{
// Async thunks are restricted from inlining. https://github.com/dotnet/runtime/issues/124665
continue;
}
EcmaMethod inlinerDefinition = (EcmaMethod)inliner.GetPrimaryMethodDesc().GetTypicalMethodDefinition();

if (inlinerDefinition.IsNonVersionable())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,6 @@ public bool CanInline(MethodDesc caller, MethodDesc callee)
}
}

// TODO: Enable async inlining. https://github.com/dotnet/runtime/issues/124665
if (callee.IsAsyncThunk() || callee.IsAsyncCall())
{
return false;
}

_nodeFactory.DetectGenericCycles(caller, callee);

return NodeFactory.CompilationModuleGroup.CanInline(caller, callee);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -520,10 +520,6 @@ private bool CrossModuleInlineableInternal(MethodDesc method)

private bool CrossModuleInlineableUncached(MethodDesc method)
{
// Async thunks and variants cannot currently be inlined cross module
if (method.IsAsyncVariant() || method.IsAsync || method.IsAsyncThunk())
return false;

// Defined in corelib
MetadataType owningMetadataType = method.OwningType.GetTypeDefinition() as MetadataType;
if (owningMetadataType == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3308,17 +3308,6 @@ private void reportInliningDecision(CORINFO_METHOD_STRUCT_* inlinerHnd, CORINFO_

var typicalMethod = inlinee.GetTypicalMethodDefinition();

if ((typicalMethod.IsAsyncVariant() || typicalMethod.IsAsync || typicalMethod.IsCompilerGeneratedILBodyForAsync()) && !_compilation.CompilationModuleGroup.VersionsWithMethodBody(typicalMethod))
{
// TODO: fix this restriction in runtime async. https://github.com/dotnet/runtime/issues/124665
// Disable async methods in cross module inlines for now, we need to trigger the CheckILBodyFixupSignature in the right situations, and that hasn't been implemented
// yet. Currently, we'll correctly trigger the _ilBodiesNeeded logic below, but we also need to avoid triggering the ILBodyFixupSignature for the async thunks, but we ALSO need to make
// sure we generate the CheckILBodyFixupSignature for the actual runtime-async body in which case I think the typicalMethod will be an AsyncVariantMethod, which doesn't appear
// to be handled here. This check is here in the place where I believe we actually would behave incorrectly, but we also have a check in CrossModuleInlineable which disallows
// the cross module inline of async methods currently.
throw new Exception("Inlining async methods is not supported in ReadyToRun compilation.");
}

MethodIL methodIL = _compilation.GetMethodIL(typicalMethod);
if (methodIL is ILStubMethodIL ilStubMethodIL && ilStubMethodIL.StubILHasGeneratedTokens)
{
Expand Down
Loading