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
28 changes: 27 additions & 1 deletion src/coreclr/tools/Common/JitInterface/CorInfoImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3358,7 +3358,33 @@ private void getEEInfo(ref CORINFO_EE_INFO pEEInfoOut)

private void getAsyncInfo(ref CORINFO_ASYNC_INFO pAsyncInfoOut)
{
throw new NotImplementedException();
DefType continuation = MethodBeingCompiled.Context.SystemModule.GetType("System.Runtime.CompilerServices"u8, "Continuation"u8);
Comment thread
jkotas marked this conversation as resolved.
Outdated
pAsyncInfoOut.continuationClsHnd = ObjectToHandle(continuation);
// 'Next' field
pAsyncInfoOut.continuationNextFldHnd = ObjectToHandle(continuation.GetField("Next"u8));
Comment thread
jkotas marked this conversation as resolved.
Outdated
// 'Resume' field
pAsyncInfoOut.continuationResumeFldHnd = ObjectToHandle(continuation.GetField("Resume"u8));
// 'State' field
pAsyncInfoOut.continuationStateFldHnd = ObjectToHandle(continuation.GetField("State"u8));
// 'Flags' field
pAsyncInfoOut.continuationFlagsFldHnd = ObjectToHandle(continuation.GetField("Flags"u8));
// 'Data' field
pAsyncInfoOut.continuationDataFldHnd = ObjectToHandle(continuation.GetField("Data"u8));
// 'GCData' field
pAsyncInfoOut.continuationGCDataFldHnd = ObjectToHandle(continuation.GetField("Data"u8));
Comment thread
jtschuster marked this conversation as resolved.
Outdated
// Whether or not the continuation needs to be allocated through the
// helper that also takes a method handle
pAsyncInfoOut.continuationsNeedMethodHandle = false;
Comment thread
jkotas marked this conversation as resolved.
Outdated
DefType asyncHelpers = MethodBeingCompiled.Context.SystemModule.GetType("System.Runtime.CompilerServices"u8, "AsyncHelpers"u8);
DefType executionContext = MethodBeingCompiled.Context.SystemModule.GetType("System.Threading"u8, "ExecutionContext"u8);
DefType @void = MethodBeingCompiled.Context.GetWellKnownType(WellKnownType.Void);
Comment thread
jkotas marked this conversation as resolved.
Outdated
// Method handle for AsyncHelpers.CaptureExecutionContext
pAsyncInfoOut.captureExecutionContextMethHnd = ObjectToHandle(asyncHelpers.GetMethod("CaptureExecutionContext"u8, null));
Comment thread
jkotas marked this conversation as resolved.
Outdated
// Method handle for AsyncHelpers.RestoreExecutionContext
pAsyncInfoOut.restoreExecutionContextMethHnd = ObjectToHandle(asyncHelpers.GetMethod("RestoreExecutionContext"u8, null));
pAsyncInfoOut.captureContinuationContextMethHnd = ObjectToHandle(asyncHelpers.GetMethod("CaptureContinuationContext"u8, null));
pAsyncInfoOut.captureContextsMethHnd = ObjectToHandle(asyncHelpers.GetMethod("CaptureContexts"u8, null));
pAsyncInfoOut.restoreContextsMethHnd = ObjectToHandle(asyncHelpers.GetMethod("RestoreContexts"u8, null));
}

private mdToken getMethodDefFromMethod(CORINFO_METHOD_STRUCT_* hMethod)
Expand Down
16 changes: 16 additions & 0 deletions src/coreclr/tools/Common/JitInterface/CorInfoTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -878,10 +878,26 @@ public unsafe struct CORINFO_ASYNC_INFO
public CORINFO_CLASS_STRUCT_* continuationClsHnd;
// 'Next' field
public CORINFO_FIELD_STRUCT_* continuationNextFldHnd;
// 'Resume' field
public CORINFO_FIELD_STRUCT_* continuationResumeFldHnd;
// 'State' field
public CORINFO_FIELD_STRUCT_* continuationStateFldHnd;
// 'Flags' field
public CORINFO_FIELD_STRUCT_* continuationFlagsFldHnd;
// 'Data' field
public CORINFO_FIELD_STRUCT_* continuationDataFldHnd;
// 'GCData' field
public CORINFO_FIELD_STRUCT_* continuationGCDataFldHnd;
// Whether or not the continuation needs to be allocated through the
// helper that also takes a method handle
public bool continuationsNeedMethodHandle; // byte?
// Method handle for AsyncHelpers.CaptureExecutionContext
public CORINFO_METHOD_STRUCT_* captureExecutionContextMethHnd;
// Method handle for AsyncHelpers.RestoreExecutionContext
public CORINFO_METHOD_STRUCT_* restoreExecutionContextMethHnd;
public CORINFO_METHOD_STRUCT_* captureContinuationContextMethHnd;
public CORINFO_METHOD_STRUCT_* captureContextsMethHnd;
public CORINFO_METHOD_STRUCT_* restoreContextsMethHnd;
}

// Flags passed from JIT to runtime.
Expand Down
Loading