You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
JIT: add option to print GC info interleaved with asm output #41647
Currently, when using COMPlus_JitGCDump/COMPlus_NgenGCDump, GC info is displayed in a block at the end of compilation.
Create options that allow the information to be interleaved into the asm dumped with COMPlus_JitDisasm/COMPlus_NgenDisasm. These options would be in addition to the current ones, which are still useful.
Interleaved output allows us to always add GC info into our asm diffs process. Currently, adding GC info into asm diffs requires enabling adding (back) instruction offsets into the asm output, because GC info is based on asm offsets. But adding these means that as soon as there is a single new instruction, or change in encoding size of an instruction, then all subsequent instructions in the function show up as a diff. This is really noisy. Thus, we rarely if ever pay attention to GC info diffs, which we should.
Note that the JIT dump does emit interleaved GC info as part of the "Instructions as they come out of the scheduler" phase. It would be better if the interleaved GC info dump suggested here come from decoding the fully generated GC info, the way the SOS !u -gcinfo command does it. Perhaps the code for !u -gcinfo could be borrowed for this (see dotnet/diagnostics#403).
@dotnet/jit-contrib I'm currently working on this, but would like to get some early feedback.
For the first iteration of this, I am continuing to use the GC info represented in the JIT data structures, rather than decoding the GC info after it's generated.
In addition, I'm modifying the GC dump to dump the info after the instruction that it pertains to, since it reflects the state after the instruction has been executed (I have always found it confusing that it printed it before). I'm also deleting some information that was redundant, and consolidating multiple updates into a single line.
Here's a snippet of a disassembly (with COMPlus_JitDiffableDasm and a new COMPlus_JitDisasmWithGC=1:
I'm modifying the GC dump to dump the info after the instruction that it pertains to, since it reflects the state after the instruction has been executed (I have always found it confusing that it printed it before)
I've also often been confused by this. Does the new behavior match !u -gcinfo in SOS? Will all output of GC info in JIT dump be consistent here?
I'm not sure - I'm not much of a user of SOS, but I'll check.
Will all output of GC info in JIT dump be consistent here?
Yes, that's the plan. The output methods are shared, at least for now, and I would presume we'd keep the same approach when/if we actually decode the GC info.
AFAICT, R2RDump simply dumps the GC info after the method (and doesn't seem to actually report ranges, just slots)
I don't propose to implement interleaving of GC info for R2RDump, so I'm not sure in what way I would match R2RDump.
OK, it seems that R2RDump also does the right thing and reports the deltas after the instruction.
However, it individually reports each register or stack location (my changes will report them collectively). Also, the JIT dump reports variables on the stack by their JIT name (e.g. ; GC ptr vars +{V27}).
I don't see any value in unifying these.
The interleaving of GC info was implemented in #42552, but work remains to incorporate its use in jitutils.
We should also consider whether additional information should be in the assembly dump with COMPlus_JitDisasmWithGC so that any diff in the GC info is readily visible in an assembly diff.
Activity
CarolEidt commentedon Sep 16, 2020
@dotnet/jit-contrib I'm currently working on this, but would like to get some early feedback.
For the first iteration of this, I am continuing to use the GC info represented in the JIT data structures, rather than decoding the GC info after it's generated.
In addition, I'm modifying the GC dump to dump the info after the instruction that it pertains to, since it reflects the state after the instruction has been executed (I have always found it confusing that it printed it before). I'm also deleting some information that was redundant, and consolidating multiple updates into a single line.
Here's a snippet of a disassembly (with
COMPlus_JitDiffableDasmand a newCOMPlus_JitDisasmWithGC=1:Here's the 'before' snippet of the corresponding jitdump for those same instructions:
Here's the same snippet with my changes:
BruceForstall commentedon Sep 16, 2020
I like it!
I've also often been confused by this. Does the new behavior match
!u -gcinfoin SOS? Will all output of GC info in JIT dump be consistent here?CarolEidt commentedon Sep 16, 2020
I'm not sure - I'm not much of a user of SOS, but I'll check.
Yes, that's the plan. The output methods are shared, at least for now, and I would presume we'd keep the same approach when/if we actually decode the GC info.
janvorli commentedon Sep 16, 2020
It would be also nice to match where R2RDump puts it.
CarolEidt commentedon Sep 16, 2020
I'm not aware of R2RDump - can you point me to it?
BruceForstall commentedon Sep 16, 2020
It's in the source tree as src\coreclr\src\Tools\r2rdump
CarolEidt commentedon Sep 16, 2020
AFAICT, R2RDump simply dumps the GC info after the method (and doesn't seem to actually report ranges, just slots)
I don't propose to implement interleaving of GC info for R2RDump, so I'm not sure in what way I would match R2RDump.
janvorli commentedon Sep 16, 2020
R2RDump actually interleaves the stuff with disassembly. Here is an example that I've just created from S.P.C.:
CarolEidt commentedon Sep 16, 2020
OK, it seems that R2RDump also does the right thing and reports the deltas after the instruction.
However, it individually reports each register or stack location (my changes will report them collectively). Also, the JIT dump reports variables on the stack by their JIT name (e.g.
; GC ptr vars +{V27}).I don't see any value in unifying these.
Interleave GC Info with assembly (#42552)
CarolEidt commentedon Sep 24, 2020
The interleaving of GC info was implemented in #42552, but work remains to incorporate its use in jitutils.
We should also consider whether additional information should be in the assembly dump with
COMPlus_JitDisasmWithGCso that any diff in the GC info is readily visible in an assembly diff.Enable COMPlus_JitDisasmWithGC by default