-
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
Add DebuggerHidden
to managed JitHelpers
#106167
Add DebuggerHidden
to managed JitHelpers
#106167
Conversation
What's the intended user experience in the debugger this is aiming to achieve? |
I do not think that this makes to apply wholesale to all throw helpers. If this is necessary to make the recently introduce managed JIT throw helpers to behave more like the unmanaged JIT throw helpers, we should move the JIT throw helpers into a different type and only apply DebuggerHidden to methods in that type. There will be a bit of code duplication and that's fine. |
Same thought as @stephentoub, its helpful to understand where these helpers are going to be used and what aspect of the debugging experience we are trying to change. My default principle is that what users see in the stack should match what they'd see reading the source code. So if the BCL C# code calls the helpers I'd prefer not to have those helpers hidden. If the JIT is inserting the helper where no such call exists in the source that would be a good place to hide it. I think @jkotas suggestion alludes to the same principle. |
This was suggested after trying to fix a diagnostic issue. We do seem slightly inconsistent when we apply this or not, so I just applied to all JitHelpers. The arguments presented by both @jkotas and @noahfalk make sense to me though. I figured it was appropriate to hide them in all cases. Seems that is not the case. @tommcdon Did I misunderstand the suggestion? |
ThrowHelpers are not the same as JitHelpers. |
#105671 added an extra managed frame on to the stack for certain exceptions, regressing the developer experience. For example with Just My Code off, we are now seeing a managed frame on the stack for IndexOutOfRangeException on array access:
We are seeing the same behavior with DivideByZeroException on ARM. |
Right, I think the fix for this issue should be:
|
Sure, that is fair. Several of the functions in this file are also JitHelpers. I naively applied it to all as if they were. I'll more narrowly apply
Will do. |
@jkotas I took your suggestion. I'm sure I missed something so this is likely to fail on native AOT or something, but can you take a look at the general direction? |
Make members public for native AOT.
All green. @jkotas and @dotnet/dotnet-diag Please take another look. |
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, thanks Aaron!
src/coreclr/System.Private.CoreLib/src/Internal/Runtime/CompilerHelpers/ThrowHelpers.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/Internal/Runtime/CompilerHelpers/ThrowHelpers.cs
Outdated
Show resolved
Hide resolved
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
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.
Oops, sorry I reviewed yesterday but apparently forgot to hit submit :(
src/coreclr/System.Private.CoreLib/src/Internal/Runtime/CompilerHelpers/ThrowHelpers.cs
Show resolved
Hide resolved
...oreclr/nativeaot/System.Private.CoreLib/src/Internal/Runtime/CompilerHelpers/ThrowHelpers.cs
Outdated
Show resolved
Hide resolved
Ugh. This is all sorts of messed up. I'll need to sit down and change more of this. There are API compat and protection levels issues when I change native AOT to For example:
|
You can fix this by changing the NAOT TypeLoader to call RuntimeAugments, and move the throw helpers that are needed by the type loader there. I think Internal\Runtime\CompilerHelpers\ThrowHelpers.cs should be only used for ThrowHelpers that are called by the JITed code directly. It should not be used for cases where some random code needs to throw an exception. |
Updated. |
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
Looking for thoughts on this before I move it out of draft.
/cc @dotnet/dotnet-diag @jkotas