-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Implement getAsyncInfo in ILCompiler #120859
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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); | ||||||
pAsyncInfoOut.continuationClsHnd = ObjectToHandle(continuation); | ||||||
// 'Next' field | ||||||
pAsyncInfoOut.continuationNextFldHnd = ObjectToHandle(continuation.GetField("Next"u8)); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also a better exception if corelib is mismatched (same comment for other
Suggested change
|
||||||
// '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)); | ||||||
jtschuster marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
// Whether or not the continuation needs to be allocated through the | ||||||
// helper that also takes a method handle | ||||||
pAsyncInfoOut.continuationsNeedMethodHandle = false; | ||||||
jkotas marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
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); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doesn't seem used? |
||||||
// Method handle for AsyncHelpers.CaptureExecutionContext | ||||||
pAsyncInfoOut.captureExecutionContextMethHnd = ObjectToHandle(asyncHelpers.GetMethod("CaptureExecutionContext"u8, null)); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
// 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) | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Same comment for all
GetType
uses below.)GetType
can return null and we'd nullref,GetKnownType
won't return null and will print a better error message if e.g. CoreLib is mismatched._compilation.TypeSystemContext
.