-
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
Use enum for frametype not v table #112166
base: main
Are you sure you want to change the base?
Use enum for frametype not v table #112166
Conversation
…ize, and make it reviewable
…s easier to search for
…ForFrametypeNotVTable
Tagging subscribers to this area: @mangod9 |
…ForFrametypeNotVTable
…ForFrametypeNotVTable
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 otherwise. Thank you!
src/coreclr/vm/frames.cpp
Outdated
@@ -269,77 +512,30 @@ void Frame::LogFrameChain( | |||
|
|||
#ifndef DACCESS_COMPILE | |||
|
|||
// This hashtable contains the vtable value of every Frame type. | |||
static PtrHashMap* s_pFrameVTables = NULL; | |||
|
|||
// static |
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.
// static |
src/coreclr/vm/frames.cpp
Outdated
@@ -198,19 +445,19 @@ const size_t FRAME_TYPES_COUNT = | |||
//----------------------------------------------------------------------- | |||
// Implementation of the global table of names. On the DAC side, just the global pointer. | |||
// On the runtime side, the array of names. | |||
#define FRAME_TYPE_NAME(x) {x::GetMethodFrameVPtr(), #x} , | |||
#define FRAME_TYPE_NAME(x) {FrameIdentifier::x, #x} , |
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.
FrameIdentifier
does not need to be in the table anymore. We can just index into the table.
@@ -198,19 +445,19 @@ const size_t FRAME_TYPES_COUNT = | |||
//----------------------------------------------------------------------- |
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.
FRAME_TYPES_COUNT
above can be deleted
src/coreclr/vm/frames.cpp
Outdated
} // void Frame::Init() | ||
|
||
#endif // DACCESS_COMPILE | ||
|
||
// Returns true if the Frame's VTablePtr is valid | ||
|
||
// static | ||
bool Frame::HasValidVTablePtr(Frame * pFrame) | ||
bool Frame::HasFrameIdentifier(Frame * pFrame) |
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.
bool Frame::HasFrameIdentifier(Frame * pFrame) | |
bool Frame::HasValidFrameIdentifier(Frame * pFrame) |
?
src/coreclr/vm/frames.cpp
Outdated
#include "frames.h" | ||
|
||
LIMITED_METHOD_CONTRACT; | ||
_frameIdentifier = frameIdentifier; | ||
} // void Frame::Init() | ||
|
||
#endif // DACCESS_COMPILE | ||
|
||
// Returns true if the Frame's VTablePtr is valid |
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.
// Returns true if the Frame's VTablePtr is valid | |
// Returns true if the Frame has a valid FrameIdentifier |
src/coreclr/vm/frames.cpp
Outdated
|
||
void Frame::GcScanRoots(promote_func *fn, ScanContext* sc) | ||
{ | ||
switch (this->GetFrameIdentifier()) |
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.
switch (this->GetFrameIdentifier()) | |
switch (GetFrameIdentifier()) |
Nit: this->
should not be needed
FRAME_POLYMORPHIC_DISPATCH_UNREACHABLE(); | ||
return NULL; | ||
} | ||
} |
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.
} | |
} | |
src/coreclr/vm/frames.cpp
Outdated
|
||
#endif |
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.
#endif | |
#endif | |
src/coreclr/vm/frames.cpp
Outdated
} | ||
} | ||
|
||
|
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.
Resolves #111875 |
Frames are currently identified by VTable, which is convenient for writing C++ code, but less so for writing asm, or out of process inspection. This change changes that to a
FrameIdentifier
enum, make the polymorphic dispatch occur using if statements, and removes GS cookies for Frame's as we no longer need to protect the vtable.