-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[cDAC] Set RejitFlags to use a known underlying type #109935
Conversation
Tagging subscribers to this area: @tommcdon |
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.
LGTM modulo the comment about usage.
src/coreclr/vm/codeversion.h
Outdated
@@ -184,7 +184,7 @@ class ILCodeVersion | |||
HRESULT SetActiveNativeCodeVersion(NativeCodeVersion activeNativeCodeVersion); | |||
#endif //DACCESS_COMPILE | |||
|
|||
enum RejitFlags | |||
enum class RejitFlags : uint32_t |
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.
Could we do some C++ to make us not have to write out ILCodeVersion::RejitFlags::
every time? I think we could put using enum RejitFlags
in the ILCodeVersion
class definition so the usage is the same. It feels too long to type out all of it every time.
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 don't think this is possible to do for enum class
's in C++14. It looks like using enum
is only available in C++20 and higher.
I see some approaches online manually dumping each enum value, but that feels worse than referencing them directly. https://stackoverflow.com/a/48932002
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.
It is a bit unfortunate. Sometimes in the past I've simply elevated the enum to no longer be contained within the class when I do this conversion. Then I can just use RejitFlags::BLAH wherever it needs to be used. You still have to touch all of the places where the enum is touched, but the major reason to put an enum within ILCodeVersion
was probably to give its members a namespace to live in, and enum class does that all by itself.
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 pulled the enum out of ILCodeVersion
. Now it is referenced with RejitState::<enum_value>
instead of ILCodeVersion::<enum_value>
.
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've made another comment about how I might have pulled the enum out of the ILCodeVersion
class to avoid the ILCodeVersion::RejitState
prefix on everything, but it is not critical to me.
set RejitFlags enum to use uint32_t as backing type for use in cDAC
The previous implementation using an
enum
should be the size of auint32_t
but it isn't explicitly defined. To make the size ofRejitFlags
more clear, changing it to anenum class
with an explicituint32_t
backing.Will be used #109936 by the cDAC
GetMethodDescData
to fetchReJIT
information.