Make `Vector64<T>`, `Vector128<T>`, and `Vector256<T>` readonly
authorTanner Gooding <tagoo@outlook.com>
Thu, 2 Aug 2018 16:16:11 +0000 (09:16 -0700)
committerTanner Gooding <tagoo@outlook.com>
Thu, 2 Aug 2018 20:53:50 +0000 (13:53 -0700)
src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/Vector128.cs
src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/Vector128DebugView.cs
src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/Vector256.cs
src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/Vector256DebugView.cs
src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/Vector64.cs
src/System.Private.CoreLib/shared/System/Runtime/Intrinsics/Vector64DebugView.cs

index f61310e4e9f71822d876d172d21002b388446e35..b2e72ddf89334a0d242af86ab53e8c16eab4ec0b 100644 (file)
@@ -13,12 +13,12 @@ namespace System.Runtime.Intrinsics
     [DebuggerDisplay("{DisplayString,nq}")]
     [DebuggerTypeProxy(typeof(Vector128DebugView<>))]
     [StructLayout(LayoutKind.Sequential, Size = 16)]
-    public struct Vector128<T> where T : struct
+    public readonly struct Vector128<T> where T : struct
     {
         // These fields exist to ensure the alignment is 8, rather than 1.
         // This also allows the debug view to work https://github.com/dotnet/coreclr/issues/15694)
-        private ulong _00;
-        private ulong _01;
+        private readonly ulong _00;
+        private readonly ulong _01;
 
         private unsafe string DisplayString
         {
index 7119757b793f70953c0244e364b2c01004b34378..ccdc655949c60db22520efd3b8255eaa037a7f4d 100644 (file)
@@ -6,9 +6,9 @@ using Internal.Runtime.CompilerServices;
 
 namespace System.Runtime.Intrinsics
 {
-    internal struct Vector128DebugView<T> where T : struct
+    internal readonly struct Vector128DebugView<T> where T : struct
     {
-        private Vector128<T> _value;
+        private readonly Vector128<T> _value;
 
         public Vector128DebugView(Vector128<T> value)
         {
index 88fd9973e332dc03a6ee4dc2f8f6bd284d549d6d..48744bb5eab33e6e647df2e679ded0b8caf086cf 100644 (file)
@@ -13,14 +13,14 @@ namespace System.Runtime.Intrinsics
     [DebuggerDisplay("{DisplayString,nq}")]
     [DebuggerTypeProxy(typeof(Vector256DebugView<>))]
     [StructLayout(LayoutKind.Sequential, Size = 32)]
-    public struct Vector256<T> where T : struct
+    public readonly struct Vector256<T> where T : struct
     {
         // These fields exist to ensure the alignment is 8, rather than 1.
         // This also allows the debug view to work https://github.com/dotnet/coreclr/issues/15694)
-        private ulong _00;
-        private ulong _01;
-        private ulong _02;
-        private ulong _03;
+        private readonly ulong _00;
+        private readonly ulong _01;
+        private readonly ulong _02;
+        private readonly ulong _03;
 
         private unsafe string DisplayString
         {
index f07277604c2834591e215ddeb4218d3734e5629d..5131341ad89e51d8489e5d4f9cc4c22ff8f84e69 100644 (file)
@@ -6,9 +6,9 @@ using Internal.Runtime.CompilerServices;
 
 namespace System.Runtime.Intrinsics
 {
-    internal struct Vector256DebugView<T> where T : struct
+    internal readonly struct Vector256DebugView<T> where T : struct
     {
-        private Vector256<T> _value;
+        private readonly Vector256<T> _value;
 
         public Vector256DebugView(Vector256<T> value)
         {
index 776fe2017dbb3d887b098f3bee00f0a912a8c35d..8ce90b9d0fa7694bfc0c788b460d1353f8b3d1dc 100644 (file)
@@ -13,11 +13,11 @@ namespace System.Runtime.Intrinsics
     [DebuggerDisplay("{DisplayString,nq}")]
     [DebuggerTypeProxy(typeof(Vector64DebugView<>))]
     [StructLayout(LayoutKind.Sequential, Size = 8)]
-    public struct Vector64<T> where T : struct
+    public readonly struct Vector64<T> where T : struct
     {
         // These fields exist to ensure the alignment is 8, rather than 1.
         // This also allows the debug view to work https://github.com/dotnet/coreclr/issues/15694)
-        private ulong _00;
+        private readonly ulong _00;
 
         private unsafe string DisplayString
         {
index 129832a3c399d4589766a64426d0dc88218734bc..878e29949e38e999fb711d96c8d0ae12bdb170d2 100644 (file)
@@ -6,9 +6,9 @@ using Internal.Runtime.CompilerServices;
 
 namespace System.Runtime.Intrinsics
 {
-    internal struct Vector64DebugView<T> where T : struct
+    internal readonly struct Vector64DebugView<T> where T : struct
     {
-        private Vector64<T> _value;
+        private readonly Vector64<T> _value;
 
         public Vector64DebugView(Vector64<T> value)
         {