-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Proposal: add comments to specific kinds of generated code disassembly #97060
Comments
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch Issue DetailsThere are many patterns of RyuJIT codegen where something interesting is known about the code when generating it, and that interesting information would be valuable if displayed as a comment on the generated code. The JIT already generates some comments on generated code, e.g., for handles and strings:
One example of additional comments that could be added is around PInvoke handling. For example, the JIT could add:
Other examples might be when generating explicit null checks, prolog/epilog actions, locals zeroing, etc. To implement this, we would want a mechanism to associate an arbitrary comment text (or perhaps even multiple?) with any GenTree node. When generating a GenTree node or node tree to a set of instructions (instrDesc), the set of comments would need to be associated with the generated instructions, and then output during disassembly. Perhaps these associations should be done using side tables which could be DEBUG only, or perhaps easily enabled for non-DEBUG builds if that was determined to be useful. Comments? @dotnet/jit-contrib
|
This will certainly be very useful to have for debugging purpose. I wanted to do something similar to associate Interval/RefPositions to the assembly code to track the register allocation to the generated code. There are lot of other examples where annotating the code would help:
Should be fairly simple to do this once comment is attached to GenTree nodes. Before |
It's possible there will be multiple types of comments, e.g.:
|
There are many patterns of RyuJIT codegen where something interesting is known about the code when generating it, and that interesting information would be valuable if displayed as a comment on the generated code.
The JIT already generates some comments on generated code, e.g., for handles and strings:
One example of additional comments that could be added is around PInvoke handling. For example, the JIT could add:
Other examples might be when generating explicit null checks, prolog/epilog actions, locals zeroing, etc.
To implement this, we would want a mechanism to associate an arbitrary comment text (or perhaps even multiple?) with any GenTree node. When generating a GenTree node or node tree to a set of instructions (instrDesc), the set of comments would need to be associated with the generated instructions, and then output during disassembly. Perhaps these associations should be done using side tables which could be DEBUG only, or perhaps easily enabled for non-DEBUG builds if that was determined to be useful.
Comments?
@dotnet/jit-contrib
The text was updated successfully, but these errors were encountered: