-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Interpreter GC info stage 1: Use templates to specialize gc info encoder/decoder #113223
Conversation
… templates that accept a type argument that provides encoding traits
Changing the
|
…hich one is being used in the debugger
… from reading the code
…_SLOT and NORMALIZE_STACK_SLOT to fix msvc build warnings
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.
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
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.
Many of the casts should not be needed anymore. (I am not sure whether I got all of them in the comments - you may want to double check.)
Will batch apply your cast removals and then try and do a cleanup pass myself. Gets a little fussy since clang and MSVC both complain about different implicit conversions from each other, so I have to test on both OSes. |
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
OK, I think I found all the unnecessary casts and removed them. I also removed (DE)NORMALIZE_REGISTER since it was a no-op. |
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.
Thanks!
Right now we have a single GcInfoEncoder/Decoder pair that is configured by platform-specific
#define
s ingcinfotypes.h
. This makes it unsuitable for use in the interpreter, since the interpreter has its own IR independent of the host/target platforms, and things like the size of an opcode might not match.This is the first step towards being able to configure the encoder/decoder to work for either target code (i.e. x86-64 or arm64) or interpreter code depending on whether the current frame is interpreted or not.
The platform-specific defines now move into a
struct TargetGcInfoEncoding
and become eitherconst
s orconstexpr
functions, and the encoder/decoder become template classes (TGcInfoEncoder<GcInfoEncoding>
andTGcInfoDecoder<GcInfoEncoding>
) that accept an encoding. In the future I'll add an encoding for the interpreter, right now there's only the one for the target.To reduce the blast radius of this change I renamed the encoder/decoder when templatizing them, and then added typedefs with the previous names, i.e.
typedef TGcInfoDecoder<TargetGcInfoEncoding> GcInfoDecoder
. This opens a path to defining atypedef TGcInfoDecoder<InterpreterGcInfoEncoding> InterpreterGcInfoDecoder
in the future or what have you.I think this unavoidably will break the diagnostics repo the next time they update https://github.com/dotnet/diagnostics/tree/main/src/shared but maybe I did my job correctly and it won't?