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

Fixing SpanHelpers.LastIndexOfAnyValueType to no longer create out of bounds GC refs #75857

Merged
merged 3 commits into from
Sep 20, 2022

Conversation

tannergooding
Copy link
Member

This resolves #75792

@ghost
Copy link

ghost commented Sep 19, 2022

Tagging subscribers to this area: @dotnet/area-system-memory
See info in area-owners.md if you want to be subscribed.

Issue Details

This resolves #75792

Author: tannergooding
Assignees: -
Labels:

area-System.Memory

Milestone: -

Copy link
Member

@adamsitnik adamsitnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tannergooding big thanks for your help! PTAL at my comments, I think I've found a bug

Co-authored-by: Adam Sitnik <adam.sitnik@gmail.com>
Copy link
Member

@adamsitnik adamsitnik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@tannergooding
Copy link
Member Author

@stephentoub, would appreciate a secondary sign-off from you before merging.

Great to have a second pair of eyes since we're backporting for .NET 7

continue;
}

return ComputeLastIndex(ref searchSpace, ref currentSearchSpace, equals);
return ComputeLastIndex(offset, equals);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't affect this PR, but I wonder why it's written like this rather than:

if (equals != Vector128<TValue>.Zero)
{
    return ComputeLastIndex(offset, equals);
}

Is this just style, or we expect the not found case to be the most common and want the branch predictor to default to that?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we expect the not found case to be the most common and want the branch predictor to default to that

That was my assumption when I was implementing it.

@adamsitnik adamsitnik merged commit 81d75bd into dotnet:main Sep 20, 2022
@tannergooding
Copy link
Member Author

/backport to release/7.0-rc2

@github-actions
Copy link
Contributor

Started backporting to release/7.0-rc2: https://github.com/dotnet/runtime/actions/runs/3089699377

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.

GCStress crash stable repro
5 participants