Delete duplicate Buffer.Memmove implementations and avoid unnecessary pinning (#44118)
authorStephen Toub <stoub@microsoft.com>
Mon, 2 Nov 2020 16:21:49 +0000 (11:21 -0500)
committerGitHub <noreply@github.com>
Mon, 2 Nov 2020 16:21:49 +0000 (11:21 -0500)
commitc3c768b4c36012661baf46a717649ae04d642c90
tree8edd582b7cf35412f6fae6b3b2d45b5a7ff99ef9
parent5111ab23613f5a035c9fc576c02d2930ed9f846f
Delete duplicate Buffer.Memmove implementations and avoid unnecessary pinning (#44118)

* Delete duplicate Buffer.Memmove implementations and avoid unnecessary pinning

We have several versions of Buffer.Memmove, including one implemented around `byte*` and one implemented around `ref byte`.  We can delete the former and just use the latter everywhere.  In doing so, we can also remove a few wrapper helpers, and reduce pinning in places where those wrappers were pinning to get pointers only to eventually end up in the ref-based implementation, anyway.

* Use ThrowHelper in more places
23 files changed:
src/coreclr/src/System.Private.CoreLib/src/System/Buffer.CoreCLR.cs
src/coreclr/src/System.Private.CoreLib/src/System/String.CoreCLR.cs
src/coreclr/src/System.Private.CoreLib/src/System/StubHelpers.cs
src/coreclr/src/System.Private.CoreLib/src/System/Text/StringBuilder.CoreCLR.cs
src/coreclr/src/vm/ilmarshalers.cpp
src/libraries/System.Private.CoreLib/src/System/Buffer.cs
src/libraries/System.Private.CoreLib/src/System/Char.cs
src/libraries/System.Private.CoreLib/src/System/Convert.cs
src/libraries/System.Private.CoreLib/src/System/IO/StringReader.cs
src/libraries/System.Private.CoreLib/src/System/IO/UnmanagedMemoryStream.cs
src/libraries/System.Private.CoreLib/src/System/Number.BigInteger.cs
src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.Unix.cs
src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/Marshal.cs
src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/SafeBuffer.cs
src/libraries/System.Private.CoreLib/src/System/String.Manipulation.cs
src/libraries/System.Private.CoreLib/src/System/String.cs
src/libraries/System.Private.CoreLib/src/System/Text/Encoding.cs
src/libraries/System.Private.CoreLib/src/System/Text/StringBuilder.cs
src/libraries/System.Private.CoreLib/src/System/Text/UTF32Encoding.cs
src/libraries/System.Private.CoreLib/src/System/Text/UTF7Encoding.cs
src/libraries/System.Private.CoreLib/src/System/Text/UnicodeEncoding.cs
src/mono/netcore/System.Private.CoreLib/src/System/Buffer.Mono.cs
src/mono/netcore/System.Private.CoreLib/src/System/String.Mono.cs