Skip to content
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

Merged
merged 2 commits into from
Jan 13, 2024
Merged

Conversation

jkotas
Copy link
Member

@jkotas jkotas commented Jan 12, 2024

FCThrow is implemented usign HELPER_METHOD_FRAME. All uses of FCThrow need to be removed to fix #95695.

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))
Copy link
Member Author

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.

@jkotas
Copy link
Member Author

jkotas commented Jan 12, 2024

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.
@jkotas jkotas merged commit 3e2bc17 into dotnet:main Jan 13, 2024
106 of 111 checks passed
@jkotas jkotas deleted the fcthrow branch January 13, 2024 01:12
tmds pushed a commit to tmds/runtime that referenced this pull request Jan 23, 2024
FCThrow is implemented usign HELPER_METHOD_FRAME. All uses of FCThrow need to be removed to fix dotnet#95695.
@github-actions github-actions bot locked and limited conversation to collaborators Feb 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Convert all FCalls with HELPER_METHOD_FRAME to QCalls
3 participants