-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Use Roslyn support for RuntimeHelpers.CreateSpan #70179
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
Conversation
|
I couldn't figure out the best area label to add to this PR. If you have write-permissions please help me learn by adding exactly one area label. |
dee4484 to
196281d
Compare
src/libraries/System.Data.Common/src/System/Data/SQLTypes/SQLGuid.cs
Outdated
Show resolved
Hide resolved
|
Current implementation throws hardly for big endian. It still allows the option to copy the field and reverse the endianness in memory, right? Just make sure this feature is not impossible or extremely inefficient to implement for big endian. |
The purpose of the CreateSpan API is to address endianness. coreclr doesn't support big endian at all today (well beyond this particular method), but mono does, including with this method. runtime/src/mono/mono/metadata/icall.c Line 960 in 5adac4a
|
|
Tagging subscribers to this area: @dotnet/area-meta Issue DetailsAs of dotnet/roslyn#61414, the optimization that previously extended only to byte/sbyte/bool will now also support char/ushort/short/uint/int/ulong/long/float/double. This PR uses it throughout dotnet/runtime. However, because of endianness issues, this requires the RuntimeHelpers.CreateSpan method that only exists as of .NET 7, so trying to use this optimization in builds targeting < .NET 7 will be a significant deoptimization. Until we have dedicated syntax (ala dotnet/csharplang#5295) and/or an analyzer (#69577) to avoid such issues, we need to be very careful where this applied. I'm putting this up as a draft now for feedback, but we must not merge this until we've picked up a Roslyn compiler that has the aforementioned improvement. Closes #60948
|
196281d to
5597557
Compare
src/libraries/System.Private.Xml/src/System/Xml/Xsl/XPath/XPathParser.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Globalization/EastAsianLunisolarCalendar.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.CoreLib/src/System/Reflection/AssemblyNameParser.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Text.RegularExpressions/tools/DataTable.cs
Outdated
Show resolved
Hide resolved
3248a47 to
06c0d49
Compare
06c0d49 to
bc5d3be
Compare
src/libraries/System.Net.HttpListener/src/System/Net/HttpListenerResponse.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.
Wondering if there is analyzer for such patterns
9854abc to
19bfd81
Compare
The optimization that previously extended only to byte/sbyte/bool now also supports char/ushort/short/uint/int/ulong/long/float/double.
19bfd81 to
4919275
Compare
|
It looks like the compiler dependency won't land in time for the compiler change to be merged. Closing for .NET 7. |
As of dotnet/roslyn#61414, the optimization that previously extended only to byte/sbyte/bool will now also support char/ushort/short/uint/int/ulong/long/float/double. This PR uses it throughout dotnet/runtime. However, because of endianness issues, this requires the RuntimeHelpers.CreateSpan method that only exists as of .NET 7, so trying to use this optimization in builds targeting < .NET 7 will be a significant deoptimization. Until we have dedicated syntax (ala dotnet/csharplang#5295) and/or an analyzer (#69577) to avoid such issues, we need to be very careful where this applied.
I'm putting this up as a draft now for feedback, but we must not merge this until we've picked up a Roslyn compiler that has the aforementioned improvement.
Closes #60948
cc: @VSadov, @jcouv, @davidwrighton, @GrabYourPitchforks