Skip to content
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

Remove S.R.CS.Unsafe and Intrinsify Unsafe #64861

Merged
merged 29 commits into from
Feb 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
3c1cbc6
private assemblies moved from Internal to System Runtime.CompilerServ…
Wraith2 Feb 3, 2022
7868750
reformat existing unsafe vm intrinsics
Wraith2 Feb 3, 2022
b2a1eb0
implement Copy, CopyBlock, CopyBlockUnaligned
Wraith2 Feb 4, 2022
d6d55e0
implement InitBlock and InitBlockUnaligned
Wraith2 Feb 4, 2022
4dca514
implement Unbox
Wraith2 Feb 4, 2022
edaf95e
implement Add
Wraith2 Feb 4, 2022
49323d0
implement Subtract, SubtractByteOffset and minor fixes to sync il
Wraith2 Feb 5, 2022
779e611
implement new intrinsics in Crossgen2
Wraith2 Feb 5, 2022
1dcb2ff
fixup nativeaot corelib
Wraith2 Feb 5, 2022
4698818
fixup Unsafe ref and src differences according to ApiCompat
Wraith2 Feb 5, 2022
5a8cd96
remove System.Runtime.CompilerServices.Unsafe il project and replace …
Wraith2 Feb 5, 2022
ffc6356
change all ilproj references to csproj
Wraith2 Feb 6, 2022
0b1971a
fix post-rebase issues and feedback round 1
Wraith2 Feb 6, 2022
892f2bb
fixup stray Internal.R.CS references
Wraith2 Feb 6, 2022
cb757f8
fixup various internal reference issues
Wraith2 Feb 8, 2022
fa9f110
fixup metasig errors
Wraith2 Feb 8, 2022
99a4097
fixup uint case in metasig
Wraith2 Feb 8, 2022
edebf5d
add conditional package reference for S.R.CS.Unsafe on netcoreapp 6.0
Wraith2 Feb 8, 2022
45019b5
fix rebase conflicts
Wraith2 Feb 18, 2022
9ae953a
remove explicit S.R.CS.Unsafe reference in hostmodel
Wraith2 Feb 9, 2022
5d47014
fixup web S.T.E.Web reference
Wraith2 Feb 9, 2022
284729b
Add 6.0.0 pin to Unsafe tests on non-netcoreapp
Wraith2 Feb 9, 2022
69ea42c
review feedback 2
Wraith2 Feb 10, 2022
5a3ecdd
fix rebase conflicts, add basic mono intrinsics and regenerate solutions
Wraith2 Feb 18, 2022
e41d9cf
mono interp add IsAddressGreaterThan, SubtractByteOffset, InitBlock, …
Wraith2 Feb 14, 2022
b236eec
[mono][interp] Implement Copy and Unbox intrinsics
BrzVlad Feb 18, 2022
0b740d9
[mono][jit] Implement Copy and Unbox intrinsics
BrzVlad Feb 18, 2022
7b724fa
[mono] Review
BrzVlad Feb 18, 2022
ddb8ff5
move native aot Unsafe to System
Wraith2 Feb 19, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 0 additions & 4 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,6 @@
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>6e05d78deba320a54ef10a265c6025bbb686efe6</Sha>
</Dependency>
<Dependency Name="System.Runtime.CompilerServices.Unsafe" Version="7.0.0-preview.2.22113.2">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>6e05d78deba320a54ef10a265c6025bbb686efe6</Sha>
</Dependency>
<Dependency Name="Microsoft.NET.ILLink.Tasks" Version="7.0.100-1.22115.2">
<Uri>https://github.com/dotnet/linker</Uri>
<Sha>6e11d057a88b3fb403bfbb90317518c94e3e84a7</Sha>
Expand Down
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
<SystemSecurityPrincipalWindowsVersion>5.0.0</SystemSecurityPrincipalWindowsVersion>
<SystemServiceModelPrimitivesVersion>4.9.0</SystemServiceModelPrimitivesVersion>
<SystemTextJsonVersion>7.0.0-preview.2.22113.2</SystemTextJsonVersion>
<SystemRuntimeCompilerServicesUnsafeVersion>7.0.0-preview.2.22113.2</SystemRuntimeCompilerServicesUnsafeVersion>
<SystemRuntimeCompilerServicesUnsafeVersion>6.0.0</SystemRuntimeCompilerServicesUnsafeVersion>
Wraith2 marked this conversation as resolved.
Show resolved Hide resolved
<SystemThreadingTasksExtensionsVersion>4.5.4</SystemThreadingTasksExtensionsVersion>
<SystemValueTupleVersion>4.5.0</SystemValueTupleVersion>
<runtimenativeSystemIOPortsVersion>7.0.0-preview.2.22113.2</runtimenativeSystemIOPortsVersion>
Expand Down
10 changes: 0 additions & 10 deletions eng/generators.targets
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@
'$(MSBuildProjectName)' == 'System.Private.CoreLib'
or '$(EnableDllImportGenerator)' == 'true'
or ('@(Reference)' != ''
and (@(Reference->AnyHaveMetadataValue('Identity', 'System.Runtime.CompilerServices.Unsafe'))
or ('@(ProjectReference)' != ''
and @(ProjectReference->AnyHaveMetadataValue('Identity', $([MSBuild]::NormalizePath('$(LibrariesProjectRoot)', 'System.Runtime.CompilerServices.Unsafe', 'src', 'System.Runtime.CompilerServices.Unsafe.ilproj'))))))
and @(Reference->AnyHaveMetadataValue('Identity', 'System.Memory')))
or ('@(ProjectReference)' != ''
and @(ProjectReference->AnyHaveMetadataValue('Identity', '$(CoreLibProject)'))))" Include="$(LibrariesProjectRoot)Common\src\System\Runtime\InteropServices\ArrayMarshaller.cs" />
Expand All @@ -77,13 +74,6 @@
<PropertyGroup>
<DllImportGenerator_UseMarshalType>true</DllImportGenerator_UseMarshalType>
</PropertyGroup>
<!-- Projects that directly reference System.Private.CoreLib are typically low level enough that they don't reference
System.Runtime.CompilerServices.Unsafe, so we use the Unsafe type defined in CoreLib (Internal.Runtime.CompilerServices.Unsafe) for these projects. -->
<PropertyGroup Condition="'$(MSBuildProjectName)' == 'System.Private.CoreLib' or
('@(ProjectReference)' != '' and @(ProjectReference->AnyHaveMetadataValue('Identity', '$(CoreLibProject)')))">
<DllImportGenerator_UseInternalUnsafeType>true</DllImportGenerator_UseInternalUnsafeType>
<DefineConstants>$(DefineConstants);DLLIMPORTGENERATOR_INTERNALUNSAFE</DefineConstants>
</PropertyGroup>
</Target>

<Import Project="$(LibrariesProjectRoot)System.Runtime.InteropServices/gen/DllImportGenerator/Microsoft.Interop.DllImportGenerator.props" />
Expand Down
3 changes: 0 additions & 3 deletions eng/slngen.targets
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,4 @@
Include the reference project in the solution file if it targets more than just NetCoreAppCurrent as other frameworks like .NETFramework, .NETStandard or older .NETCoreApp ones require it. -->
<IncludeInSolutionFile Condition="'$(IsNETCoreAppRef)' == 'true' and '$(MSBuildProjectName)' != '$(SlnGenMainProject)' and '$(TargetFramework)' == '$(NetCoreAppCurrent)' and ('$(TargetFrameworks)' == '' or '$(TargetFrameworks)' == '$(NetCoreAppCurrent)')">false</IncludeInSolutionFile>
</PropertyGroup>
<ItemGroup>
<SlnGenCustomProjectTypeGuid Include=".ilproj" ProjectTypeGuid="{9A19103F-16F7-4668-BE54-9A1E7A4F7556}" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Internal.Runtime.CompilerServices;

namespace System
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Internal.Runtime.CompilerServices;

namespace System
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System.Diagnostics.Tracing;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Internal.Runtime.CompilerServices;

namespace System.Diagnostics.Tracing
{
Expand Down
1 change: 0 additions & 1 deletion src/coreclr/System.Private.CoreLib/src/System/GC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Internal.Runtime.CompilerServices;

namespace System
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
using System.Runtime.InteropServices;
using System.Runtime.Serialization;

using Internal.Runtime.CompilerServices;

namespace System
{
[ClassInterface(ClassInterfaceType.None)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Runtime.InteropServices;
using System.Threading;
using Internal.Runtime.CompilerServices;

namespace System.Reflection
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;

using Internal.Runtime.CompilerServices;

namespace System.Reflection
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
using System.Runtime.InteropServices;
using System.Threading;

using Internal.Runtime.CompilerServices;

namespace System.Runtime.CompilerServices
{
internal static unsafe class CastHelpers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
using Internal.Runtime.CompilerServices;

namespace System.Runtime.CompilerServices
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.Runtime.CompilerServices;
#if !DEBUG
using Internal.Runtime.CompilerServices;
#endif

namespace System.Runtime
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using System.Threading;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using Internal.Runtime.CompilerServices;

namespace System.Runtime.InteropServices
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.Runtime.CompilerServices;
#if !DEBUG
using Internal.Runtime.CompilerServices;
#endif

namespace System.Runtime.InteropServices
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using Internal.Runtime.CompilerServices;

namespace System.Runtime.InteropServices
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Internal.Runtime.CompilerServices;

namespace System.Runtime
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Threading;
using Internal.Runtime.CompilerServices;

namespace System
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using Internal.Runtime.CompilerServices;

using DebuggerStepThroughAttribute = System.Diagnostics.DebuggerStepThroughAttribute;
using MdToken = System.Reflection.MetadataToken;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

using System.Runtime.CompilerServices;
using System.Text;
using Internal.Runtime.CompilerServices;

namespace System
{
Expand Down
2 changes: 0 additions & 2 deletions src/coreclr/System.Private.CoreLib/src/System/StubHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.Text;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using System.Diagnostics;
using Internal.Runtime.CompilerServices;

namespace System.StubHelpers
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Internal.Runtime.CompilerServices;

namespace System.Threading
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
// TypedReference is basically only ever seen on the call stack, and in param arrays.
// These are blob that must be dealt with by the compiler.

using System.Reflection;
using System.Runtime.CompilerServices;
using Internal.Runtime.CompilerServices;

namespace System
{
[System.Runtime.Versioning.NonVersionable] // This only applies to field layout
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

using Internal.Runtime.CompilerServices;

using Debug = Internal.Runtime.CompilerHelpers.StartupDebug;

namespace Internal.Runtime.CompilerHelpers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using System.Runtime.InteropServices;

using Internal.NativeFormat;
using Internal.Runtime.CompilerServices;

using Debug = System.Diagnostics.Debug;

Expand Down
3 changes: 1 addition & 2 deletions src/coreclr/nativeaot/Runtime.Base/src/System/Array.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

using Internal.Runtime.CompilerServices;

namespace System
{
// CONTRACT with Runtime
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/nativeaot/Runtime.Base/src/System/Object.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

using Internal.Runtime;
using Internal.Runtime.CompilerServices;

namespace System
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using System.Runtime.CompilerServices;

using Internal.Runtime;
using Internal.Runtime.CompilerServices;

namespace System.Runtime
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System;
using System.Runtime.CompilerServices;

namespace Internal.Runtime.CompilerServices
namespace System.Runtime.CompilerServices
{
//
// Subsetted clone of System.Runtime.CompilerServices.Unsafe for internal runtime use.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
using System.Runtime.CompilerServices;
using System.Diagnostics;

using Internal.Runtime.CompilerServices;

namespace System.Runtime.InteropServices
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System;
using System.Diagnostics;
using System.Runtime;
using Internal.Runtime.CompilerServices;
using System.Runtime.CompilerServices;

namespace Internal.Runtime
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
using System.Runtime.CompilerServices;

using Internal.Runtime;
using Internal.Runtime.CompilerServices;

namespace System.Runtime
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using System.Runtime.InteropServices;

using Internal.Runtime;
using Internal.Runtime.CompilerServices;

namespace System.Runtime
{
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@
<Compile Include="Internal\IntrinsicSupport\ComparerHelpers.cs" />
<Compile Include="Internal\IntrinsicSupport\EqualityComparerHelpers.cs" />
<Compile Include="Internal\Reflection\Augments\ReflectionAugments.cs" />
<Compile Include="Internal\Runtime\CompilerServices\Unsafe.cs" />
<Compile Include="Internal\Runtime\IDynamicInterfaceCastableSupport.cs" />
<Compile Include="Internal\Runtime\MethodTable.Runtime.cs" />
<Compile Include="Internal\Runtime\CompilerHelpers\ThrowHelpers.cs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;

using Internal.Runtime.Augments;
using Internal.Runtime.CompilerServices;

namespace System.Runtime.InteropServices
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@

using System.Diagnostics.CodeAnalysis;
using System.Runtime;
using System.Runtime.CompilerServices;

using Internal.Runtime.CompilerServices;
using Internal.Runtime.Augments;

using Debug = System.Diagnostics.Debug;
Expand Down Expand Up @@ -146,11 +146,11 @@ private int RegularGetValueTypeHashCode(EETypePtr type, ref byte data, int numFi

if (fieldType.ElementType == Internal.Runtime.EETypeElementType.Single)
{
hashCode = Unsafe.Read<float>(ref fieldData).GetHashCode();
hashCode = Unsafe.As<byte, float>(ref fieldData).GetHashCode();
}
else if (fieldType.ElementType == Internal.Runtime.EETypeElementType.Double)
{
hashCode = Unsafe.Read<double>(ref fieldData).GetHashCode();
hashCode = Unsafe.As<byte, double>(ref fieldData).GetHashCode();
}
else if (fieldType.IsPrimitive)
{
Expand Down Expand Up @@ -178,7 +178,7 @@ private int RegularGetValueTypeHashCode(EETypePtr type, ref byte data, int numFi
}
else
{
object fieldValue = Unsafe.Read<object>(ref fieldData);
object fieldValue = Unsafe.As<byte, object>(ref fieldData);
if (fieldValue != null)
{
hashCode = fieldValue.GetHashCode();
Expand Down
Loading