Use more spans in System.Reflection.Metadata et. al.#76574
Use more spans in System.Reflection.Metadata et. al.#76574stephentoub merged 16 commits intodotnet:mainfrom
System.Reflection.Metadata et. al.#76574Conversation
|
Tagging subscribers to this area: @dotnet/area-system-reflection-metadata Issue DetailsThis PR among other things changes the buffer code of
|
...braries/System.Reflection.Metadata/src/System/Reflection/Internal/Utilities/BlobUtilities.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Reflection.Metadata/src/System/Reflection/PortableExecutable/PEReader.cs
Outdated
Show resolved
Hide resolved
...em.Reflection.Metadata/src/System/Reflection/Internal/Utilities/ImmutableByteArrayInterop.cs
Outdated
Show resolved
Hide resolved
...braries/System.Reflection.Metadata/src/System/Reflection/Internal/Utilities/BlobUtilities.cs
Outdated
Show resolved
Hide resolved
...braries/System.Reflection.Metadata/src/System/Reflection/Internal/Utilities/BlobUtilities.cs
Outdated
Show resolved
Hide resolved
...braries/System.Reflection.Metadata/src/System/Reflection/Internal/Utilities/BlobUtilities.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/BlobBuilder.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/BlobBuilder.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/BlobContentId.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Nit: You could tidy this (and the others like it) up to just be:
public static void WriteUInt16(this byte[] buffer, int start, ushort value) =>
Unsafe.WriteUnaligned(ref buffer[start], BitConverter.IsLittleEndian ? BinaryPrimitives.ReverseEndianness(value) : value);
src/libraries/System.Reflection.Metadata/src/System/Reflection/Metadata/BlobBuilder.cs
Outdated
Show resolved
Hide resolved
|
Are there any remaining CI issues? There were some Mono build failures, but I suspect infrastructure and just re-ran those. |
|
@teo-tsirpanis can you rebase to the latest? There are these build errors that have already recently been fixed (see this PR): |
Code quality increases.
It prevents the JIT from looking into the method's body, realizing it's a throw helper, and doing what's best (such as considering it cold).
…UnderlyingArray`.
0232f77 to
d466b38
Compare
|
Done @steveharter. |
This PR among other things changes the buffer code of
System.Reflection.Metadataso that it uses spans and framework methods that are more optimized, and reduces pinning and unsafely converting between immutable and mutable arrays.