Adding System.Runtime.CompilerServices.Unsafe.BitCast (#82917)
authorTanner Gooding <tagoo@outlook.com>
Wed, 8 Mar 2023 22:18:53 +0000 (14:18 -0800)
committerGitHub <noreply@github.com>
Wed, 8 Mar 2023 22:18:53 +0000 (14:18 -0800)
commit3f3db9550ee2a66b5949fa94bd51987814f96f87
tree24fd4eebda04a14443d0821cf1c13d689081aeaa
parentf5fd94bef6478c143771221c19b947ac83fea870
Adding System.Runtime.CompilerServices.Unsafe.BitCast (#82917)

* Adding System.Runtime.CompilerServices.Unsafe.BitCast

* Adding some basic intrinsic recognition for Unsafe.BitCast

* Use ClassLayout::AreCompatible as part of Unsafe.BitCast

* Fixup BitConverter to use Unsafe.BitCast

* Fixup Enum to use Unsafe.BitCast

* Ensure BitCast resolves the right generic type for toTypeHnd

* Use Unsafe.BitCast in places using the `*(TTo*)&tfrom` pattern

* Don't use BitCast in places the generic constraints disallows it

* Missing semicolon

* Don't use Unsafe.BitCast where it introduces additional generic instantiations

* Don't regress the files that are used for both netstandard and netcoreapp

* Responding to PR feedback

* Fix a typo in the bitcast tests
14 files changed:
src/coreclr/jit/fgbasic.cpp
src/coreclr/jit/importercalls.cpp
src/coreclr/jit/namedintrinsiclist.h
src/libraries/System.Data.Odbc/src/Common/System/Data/ProviderBase/DbBuffer.cs
src/libraries/System.Data.OleDb/src/System/Data/ProviderBase/DbBuffer.cs
src/libraries/System.Memory/tests/ParsersAndFormatters/Parser/ValidateParser.cs
src/libraries/System.Private.CoreLib/src/System/BitConverter.cs
src/libraries/System.Private.CoreLib/src/System/Decimal.DecCalc.cs
src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/Unsafe.cs
src/libraries/System.Private.CoreLib/src/System/Threading/Volatile.cs
src/libraries/System.Private.DataContractSerialization/src/System/Xml/XmlConverter.cs
src/libraries/System.Reflection.Metadata/src/System/Reflection/Internal/Utilities/BlobUtilities.cs
src/libraries/System.Runtime.CompilerServices.Unsafe/tests/UnsafeTests.cs
src/libraries/System.Runtime/ref/System.Runtime.cs