From 697273cff445a400547b48b5077ebe768813d022 Mon Sep 17 00:00:00 2001 From: Tanner Gooding Date: Thu, 2 Aug 2018 09:16:11 -0700 Subject: [PATCH] Make `Vector64`, `Vector128`, and `Vector256` readonly Commit migrated from https://github.com/dotnet/coreclr/commit/e45ee4e0236da11c7f12f1e17087aeda0d37abe6 --- .../src/System/Runtime/Intrinsics/Vector128.cs | 6 +++--- .../src/System/Runtime/Intrinsics/Vector128DebugView.cs | 4 ++-- .../src/System/Runtime/Intrinsics/Vector256.cs | 10 +++++----- .../src/System/Runtime/Intrinsics/Vector256DebugView.cs | 4 ++-- .../src/System/Runtime/Intrinsics/Vector64.cs | 4 ++-- .../src/System/Runtime/Intrinsics/Vector64DebugView.cs | 4 ++-- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector128.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector128.cs index f61310e..b2e72dd 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector128.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector128.cs @@ -13,12 +13,12 @@ namespace System.Runtime.Intrinsics [DebuggerDisplay("{DisplayString,nq}")] [DebuggerTypeProxy(typeof(Vector128DebugView<>))] [StructLayout(LayoutKind.Sequential, Size = 16)] - public struct Vector128 where T : struct + public readonly struct Vector128 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 { diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector128DebugView.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector128DebugView.cs index 7119757..ccdc655 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector128DebugView.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector128DebugView.cs @@ -6,9 +6,9 @@ using Internal.Runtime.CompilerServices; namespace System.Runtime.Intrinsics { - internal struct Vector128DebugView where T : struct + internal readonly struct Vector128DebugView where T : struct { - private Vector128 _value; + private readonly Vector128 _value; public Vector128DebugView(Vector128 value) { diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector256.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector256.cs index 88fd997..48744bb 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector256.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector256.cs @@ -13,14 +13,14 @@ namespace System.Runtime.Intrinsics [DebuggerDisplay("{DisplayString,nq}")] [DebuggerTypeProxy(typeof(Vector256DebugView<>))] [StructLayout(LayoutKind.Sequential, Size = 32)] - public struct Vector256 where T : struct + public readonly struct Vector256 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 { diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector256DebugView.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector256DebugView.cs index f072776..5131341 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector256DebugView.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector256DebugView.cs @@ -6,9 +6,9 @@ using Internal.Runtime.CompilerServices; namespace System.Runtime.Intrinsics { - internal struct Vector256DebugView where T : struct + internal readonly struct Vector256DebugView where T : struct { - private Vector256 _value; + private readonly Vector256 _value; public Vector256DebugView(Vector256 value) { diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector64.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector64.cs index 776fe20..8ce90b9 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector64.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector64.cs @@ -13,11 +13,11 @@ namespace System.Runtime.Intrinsics [DebuggerDisplay("{DisplayString,nq}")] [DebuggerTypeProxy(typeof(Vector64DebugView<>))] [StructLayout(LayoutKind.Sequential, Size = 8)] - public struct Vector64 where T : struct + public readonly struct Vector64 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 { diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector64DebugView.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector64DebugView.cs index 129832a..878e299 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector64DebugView.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/Intrinsics/Vector64DebugView.cs @@ -6,9 +6,9 @@ using Internal.Runtime.CompilerServices; namespace System.Runtime.Intrinsics { - internal struct Vector64DebugView where T : struct + internal readonly struct Vector64DebugView where T : struct { - private Vector64 _value; + private readonly Vector64 _value; public Vector64DebugView(Vector64 value) { -- 2.7.4