-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Don't use write barriers for byref-like struct copies #102316
Conversation
PTAL @jakobbotsch @kunalspathak @dotnet/jit-contrib diffs are relatively small since there are not so many byref structs without ref fields. |
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
{ | ||
unsigned slots = GetSlotCount(); | ||
for (unsigned i = 0; i < slots; i++) | ||
// Byref-like structs are stack only |
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.
Is there a documentation that I can read more about this?
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.
Yep, e.g. https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/ref-struct Basically, Span itself is the most popular example
Byref-like structs are stack only so we can omit write barriers for them. It looks like JIT already knew that, but only if such structs had
ref
fields, which they might not have.Current codegen for
Test
:New codegen for
Test
: