-
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
Make it possible to construct StackFrame without MethodBase #80681
Make it possible to construct StackFrame without MethodBase #80681
Conversation
Contributes to dotnet#80165. Resolving a `MethodBase` is a pretty expensive operation and currently even a hello world needs it because of `Exception.ToString()`. This pull request is trying to get `MethodBase` out of the picture when constructing the exception string. We currently only need `_method` for two things - the public `GetMethod` API, and `StackFrame.ToString`. The `StackFrame.ToString` can already deal with `_method` being null (and that codepath exists solely for NativeAOT). This is the minimal change. We could potentially explore other approaches - leave `MethodBase` always at null, or unshare the `StackFrame` class.
Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas Issue DetailsContributes to #80165. Resolving a We currently only need
|
|
||
private bool TryInitializeMethodBase() | ||
{ | ||
if (_noMethodBaseAvailable || _ipAddress == IntPtr.Zero) |
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.
Does this need to handle Exception.EdiSeparator
?
if (_method != null) | ||
return true; | ||
|
||
IntPtr methodStartAddress = RuntimeImports.RhFindMethodStartAddress(_ipAddress); |
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.
This can be just _ipAddress - _nativeOffset
. (We can assert that it is same value as what RhFindMethodStartAddress
returns.)
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
Contributes to #80165.
Resolving a
MethodBase
is a pretty expensive operation and currently even a hello world needs it because ofException.ToString()
. This pull request is trying to getMethodBase
out of the picture when constructing the exception string.We currently only need
_method
for two things - the publicGetMethod
API, andStackFrame.ToString
. TheStackFrame.ToString
can already deal with_method
being null (and that codepath exists solely for NativeAOT). This is the minimal change. We could potentially explore other approaches - leaveMethodBase
always at null, or unshare theStackFrame
class.Cc @dotnet/ilc-contrib