Skip to content

Commit 355b0df

Browse files
Report CORINFO_ASYNC_SAVE_CONTEXTS when needed (#121613)
This was added in #121448 on the VM side, managed side needs a matching change (I actually found this because we had a newly failing test, yay). Cc @dotnet/ilc-contrib @jakobbotsch
1 parent 217fd74 commit 355b0df

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,16 @@ private bool Get_CORINFO_METHOD_INFO(MethodDesc method, MethodIL methodIL, CORIN
807807
{
808808
methodInfo->options |= CorInfoOptions.CORINFO_GENERICS_CTXT_FROM_METHODTABLE;
809809
}
810+
811+
// Indicate this is an async method that requires save and restore
812+
// of async contexts. Regular user implemented runtime async methods
813+
// require this behavior, but thunks should be transparent and should not
814+
// come with this behavior.
815+
if (method.IsAsyncVariant() && method.IsAsync)
816+
{
817+
methodInfo->options |= CorInfoOptions.CORINFO_ASYNC_SAVE_CONTEXTS;
818+
}
819+
810820
methodInfo->regionKind = CorInfoRegionKind.CORINFO_REGION_NONE;
811821
Get_CORINFO_SIG_INFO(method, sig: &methodInfo->args, methodIL);
812822
Get_CORINFO_SIG_INFO(methodIL.GetLocals(), &methodInfo->locals);

src/coreclr/tools/Common/JitInterface/CorInfoTypes.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,7 @@ public enum CorInfoOptions
438438
CORINFO_GENERICS_CTXT_FROM_METHODDESC |
439439
CORINFO_GENERICS_CTXT_FROM_METHODTABLE),
440440
CORINFO_GENERICS_CTXT_KEEP_ALIVE = 0x00000100, // Keep the generics context alive throughout the method even if there is no explicit use, and report its location to the CLR
441+
CORINFO_ASYNC_SAVE_CONTEXTS = 0x00000200, // Runtime async method must save and restore contexts
441442
}
442443

443444
// These are used to detect array methods as NamedIntrinsic in JIT importer,

0 commit comments

Comments
 (0)