-
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?
Conversation
- Add new JIT-EE API to report back debug information about the generated state machine and continuations - Refactor debug info storage on VM side to be more easily extensible. The new format has either a thin or fat header. The fat header is used when we have either uninstrumented bounds, patchpoint info, rich debug info or async debug info, and stores the blob sizes of all of those components in addition to the bounds and vars. - Add new async debug information to the storage on the VM side - Set get target method desc for async resumption stubs, to be used for mapping from continuations back to the async IL function that it will resume.
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
// Offset in continuation's data where this variable is stored | ||
uint32_t Offset; |
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 the Data
/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.
CONTRACTL | ||
{ | ||
NOTHROW; | ||
THROWS; |
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.
RestorePatchpointInfo
is called from JitPatchpointWorker
, which has STANDARD_VM_CONTRACT
. I think throwing should be ok, since we only throw here on an internal inconsistency in the compressed data when encountered by NibbleReader
. That's consistent with the other Restore
routines and saves us having to write separate decoding routines for the patchpoint info.
}; | ||
|
||
#define DebugInfoBoundsHasInstrumentedBounds 0xFFFFFFFF | ||
#define DebugInfoFat 0 |
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.
Switched this to 0 since encoding 0xFFFFFFFF
takes up a full 6 bytes, and the value 0 is not a common value for cbBounds
(JIT never reports empty bounds over all 1+ million methods in our SPMI collections, I suspect we always have at minimum a prolog bound)
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.
Although I am somewhat worried it is possible to see this from the R2R path. I wonder if we should update R2R major version and teach crossgen2 to produce the fat header if necessary. We'll probably need to encode the debug info in R2R anyway during .NET 11, so I guess we might as well take that update 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.
@davidwrighton Any thoughts on 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.
Updating the R2R major version, and such is the thing to do.
CompressDebugInfo::RestoreRichDebugInfo( | ||
fpNew, pNewData, | ||
pDebugInfo, | ||
ppInlineTree, pNumInlineTree, | ||
ppRichMappings, pNumRichMappings); | ||
|
||
return TRUE; | ||
} |
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.
I figured I might as well hook this one up in ReadyToRunJitManager
too since the format now technically allows for R2R images that contain the rich debug info, eeven if crossgen2 doesn't produce it.
--- | ||
mode: 'agent' | ||
tools: ['githubRepo', 'codebase', 'terminalLastCommand'] | ||
tools: ['fetch', 'codebase', 'runCommands', 'usages', 'search', 'think'] |
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.
Updating these tools based on @EgorBo's instructions (I used the prompt to add the JIT-EE boilerplate, but the agent was not making the changes automatically without allowing it access to these tools)
uint32_t ILOffset; | ||
// Count of AsyncContinuationVarInfo in array of locals starting where | ||
// the previous suspension point's locals end. | ||
uint32_t NumContinuationVars; |
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.
Just curious, do we expect it will be common that variables stay homed in the same place across multiple suspension points or they are likely to adjust every time? If I understand correctly this current format is reporting a new AsyncContinuationVarInfo for each suspension point where the variable is live.
Uh oh!
There was an error while loading. Please reload this page.