-
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
Remove uses of FCThrow in interlocked helpers #96916
Conversation
public static extern object? Exchange([NotNullIfNotNull(nameof(value))] ref object? location1, object? value); | ||
public static object? Exchange([NotNullIfNotNull(nameof(value))] ref object? location1, object? value) | ||
{ | ||
if (Unsafe.IsNullRef(ref location1)) |
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.
The change moves the null check + throw from the C/C++ to C#. The JIT is smart enough to eliminate the null check in number of cases. I was not able to measure any actual perf improvement from that. The CAS operation dominates the perf and the extra null check is noise.
This is going to have small conflict with #92974. |
FCThrow is implemented usign HELPER_METHOD_FRAME. All uses of FCThrow need to be removed to fix dotnet#95695.
src/coreclr/System.Private.CoreLib/src/System/Threading/Interlocked.CoreCLR.cs
Show resolved
Hide resolved
FCThrow is implemented usign HELPER_METHOD_FRAME. All uses of FCThrow need to be removed to fix dotnet#95695.
FCThrow is implemented usign HELPER_METHOD_FRAME. All uses of FCThrow need to be removed to fix #95695.