-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Add debug information for runtime async methods #120303
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 15 commits
b7bb968
d5d0864
d7277fb
6addd0e
6a5bf19
262260a
4e2a829
820afa9
3621eae
f597424
6bb6cee
f580e3f
55b9522
c9c64be
db77446
c808390
3ec5160
bb12c77
bf3364b
b49f38f
d1bf49f
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 |
---|---|---|
|
@@ -431,4 +431,31 @@ class ICorDebugInfo | |
// Source information about the IL instruction in the inlinee | ||
SourceTypes Source; | ||
}; | ||
|
||
struct AsyncContinuationVarInfo | ||
{ | ||
// IL number of variable (or one of the special IL numbers, like UNKNOWN_ILNUM) | ||
uint32_t VarNumber; | ||
// Offset in continuation's data where this variable is stored | ||
uint32_t Offset; | ||
}; | ||
|
||
struct AsyncSuspensionPoint | ||
{ | ||
// IL offset in the root method that resulted in the creation of this suspension point. | ||
uint32_t RootILOffset; | ||
// Index of inline tree node containing the IL offset (0 for root) | ||
uint32_t Inlinee; | ||
// IL offset that resulted in the creation of the suspension point. | ||
uint32_t ILOffset; | ||
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. if we care about size, can IL offsets inside a method be 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. I don't think there is a 2^16 size limit on IL, but in any case we do not care about size in these data types. The actual storage of these is compressed in the VM, so when these values are small, they consume little space. |
||
// Count of AsyncContinuationVarInfo in array of locals starting where | ||
// the previous suspension point's locals end. | ||
uint32_t NumContinuationVars; | ||
noahfalk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}; | ||
|
||
struct AsyncInfo | ||
{ | ||
// Number of suspension points in the method. | ||
uint32_t NumSuspensionPoints; | ||
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. can this be 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. Same reason as above I don't think we need to limit this. |
||
}; | ||
}; |
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.
We probably need to include
GCData
offset here too, but I expect that we will end up with customized continuation layouts during .NET 11 that gets rid of theData
/GCData
split, so I designed some of these types around that expectation. It also should be possible to derive the GCData offset by iterating the vars linearly, so we can probably make do with that for now.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.
Storing variables in arrays may work well for some scenarios, like AOT, which is sensitive to generation of types or GC layouts.
I think
uint32_t Offset;
may still work if it means "if Offset is greater than GCData length, subtract the length of GCData and continue in non-GC data"Just in case we may end up using more than one shape, perhaps add some versioning/flavor marker in the
AsyncSuspensionPoint
?Uh oh!
There was an error while loading. Please reload this page.
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.
For some values we have data stored in both
Data
andGCData
arrays, and to reconstruct the value we need both offsets. Perhaps we can just do 2x 16-bit offsets in this field until we get tailored continuation layouts. I think it's something to investigate further once we look at actually implementing the diagnostics that access the continuation values.I expect we stabilize on something during .NET 11, so if we change it after I think we can take an R2R version update at the same time as well. If we do it like that we can version based on R2R module version (it's already what we do in
DebugInfo.cs
).