repo_name
stringclasses
6 values
pr_number
int64
512
78.9k
pr_title
stringlengths
3
144
pr_description
stringlengths
0
30.3k
author
stringlengths
2
21
date_created
timestamp[ns, tz=UTC]
date_merged
timestamp[ns, tz=UTC]
previous_commit
stringlengths
40
40
pr_commit
stringlengths
40
40
query
stringlengths
17
30.4k
filepath
stringlengths
9
210
before_content
stringlengths
0
112M
after_content
stringlengths
0
112M
label
int64
-1
1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/libraries/System.Security.Principal.Windows/tests/WindowsIdentityImpersonatedTests.netcoreapp.cs
// 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.ComponentModel; using System.Linq; using System.Net; using System.Runtime.InteropServices; using System.Security.Cryptography; using System.Security.Principal; using System.Threading.Tasks; using Microsoft.Win32.SafeHandles; using Xunit; // On nano server netapi32.dll is not present // we'll skip all tests on that platform public class WindowsIdentityImpersonatedTests : IClassFixture<WindowsIdentityFixture> { private readonly WindowsIdentityFixture _fixture; public WindowsIdentityImpersonatedTests(WindowsIdentityFixture windowsIdentityFixture) { _fixture = windowsIdentityFixture; Assert.False(_fixture.TestAccount.AccountTokenHandle.IsInvalid); Assert.False(string.IsNullOrEmpty(_fixture.TestAccount.AccountName)); } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.CanRunImpersonatedTests))] [OuterLoop] public async Task RunImpersonatedAsync_TaskAndTaskOfT() { WindowsIdentity currentWindowsIdentity = WindowsIdentity.GetCurrent(); await WindowsIdentity.RunImpersonatedAsync(_fixture.TestAccount.AccountTokenHandle, async () => { Asserts(currentWindowsIdentity); await Task.Delay(100); Asserts(currentWindowsIdentity); }); Assert.Equal(WindowsIdentity.GetCurrent().Name, currentWindowsIdentity.Name); int result = await WindowsIdentity.RunImpersonatedAsync(_fixture.TestAccount.AccountTokenHandle, async () => { Asserts(currentWindowsIdentity); await Task.Delay(100); Asserts(currentWindowsIdentity); return 42; }); Assert.Equal(42, result); Assert.Equal(WindowsIdentity.GetCurrent().Name, currentWindowsIdentity.Name); // Assertions void Asserts(WindowsIdentity currentWindowsIdentity) { Assert.Equal(_fixture.TestAccount.AccountName, WindowsIdentity.GetCurrent().Name); Assert.NotEqual(currentWindowsIdentity.Name, WindowsIdentity.GetCurrent().Name); } } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.CanRunImpersonatedTests))] [OuterLoop] public void RunImpersonated_NameResolution() { WindowsIdentity currentWindowsIdentity = WindowsIdentity.GetCurrent(); WindowsIdentity.RunImpersonated(_fixture.TestAccount.AccountTokenHandle, () => { Assert.Equal(_fixture.TestAccount.AccountName, WindowsIdentity.GetCurrent().Name); IPAddress[] a1 = Dns.GetHostAddressesAsync("").GetAwaiter().GetResult(); IPAddress[] a2 = Dns.GetHostAddresses(""); Assert.True(a1.Length > 0); Assert.True(a1.SequenceEqual(a2)); }); } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.CanRunImpersonatedTests))] [OuterLoop] public async Task RunImpersonatedAsync_NameResolution() { WindowsIdentity currentWindowsIdentity = WindowsIdentity.GetCurrent(); // make sure the assembly is loaded. _ = Dns.GetHostAddresses(""); await WindowsIdentity.RunImpersonatedAsync(_fixture.TestAccount.AccountTokenHandle, async () => { Assert.Equal(_fixture.TestAccount.AccountName, WindowsIdentity.GetCurrent().Name); IPAddress[] a1 = await Dns.GetHostAddressesAsync(""); IPAddress[] a2 = Dns.GetHostAddresses(""); Assert.True(a1.Length > 0); Assert.True(a1.SequenceEqual(a2)); }); } }
// 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.ComponentModel; using System.Linq; using System.Net; using System.Runtime.InteropServices; using System.Security.Cryptography; using System.Security.Principal; using System.Threading.Tasks; using Microsoft.Win32.SafeHandles; using Xunit; // On nano server netapi32.dll is not present // we'll skip all tests on that platform public class WindowsIdentityImpersonatedTests : IClassFixture<WindowsIdentityFixture> { private readonly WindowsIdentityFixture _fixture; public WindowsIdentityImpersonatedTests(WindowsIdentityFixture windowsIdentityFixture) { _fixture = windowsIdentityFixture; Assert.False(_fixture.TestAccount.AccountTokenHandle.IsInvalid); Assert.False(string.IsNullOrEmpty(_fixture.TestAccount.AccountName)); } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.CanRunImpersonatedTests))] [OuterLoop] public async Task RunImpersonatedAsync_TaskAndTaskOfT() { WindowsIdentity currentWindowsIdentity = WindowsIdentity.GetCurrent(); await WindowsIdentity.RunImpersonatedAsync(_fixture.TestAccount.AccountTokenHandle, async () => { Asserts(currentWindowsIdentity); await Task.Delay(100); Asserts(currentWindowsIdentity); }); Assert.Equal(WindowsIdentity.GetCurrent().Name, currentWindowsIdentity.Name); int result = await WindowsIdentity.RunImpersonatedAsync(_fixture.TestAccount.AccountTokenHandle, async () => { Asserts(currentWindowsIdentity); await Task.Delay(100); Asserts(currentWindowsIdentity); return 42; }); Assert.Equal(42, result); Assert.Equal(WindowsIdentity.GetCurrent().Name, currentWindowsIdentity.Name); // Assertions void Asserts(WindowsIdentity currentWindowsIdentity) { Assert.Equal(_fixture.TestAccount.AccountName, WindowsIdentity.GetCurrent().Name); Assert.NotEqual(currentWindowsIdentity.Name, WindowsIdentity.GetCurrent().Name); } } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.CanRunImpersonatedTests))] [OuterLoop] public void RunImpersonated_NameResolution() { WindowsIdentity currentWindowsIdentity = WindowsIdentity.GetCurrent(); WindowsIdentity.RunImpersonated(_fixture.TestAccount.AccountTokenHandle, () => { Assert.Equal(_fixture.TestAccount.AccountName, WindowsIdentity.GetCurrent().Name); IPAddress[] a1 = Dns.GetHostAddressesAsync("").GetAwaiter().GetResult(); IPAddress[] a2 = Dns.GetHostAddresses(""); Assert.True(a1.Length > 0); Assert.True(a1.SequenceEqual(a2)); }); } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.CanRunImpersonatedTests))] [OuterLoop] public async Task RunImpersonatedAsync_NameResolution() { WindowsIdentity currentWindowsIdentity = WindowsIdentity.GetCurrent(); // make sure the assembly is loaded. _ = Dns.GetHostAddresses(""); await WindowsIdentity.RunImpersonatedAsync(_fixture.TestAccount.AccountTokenHandle, async () => { Assert.Equal(_fixture.TestAccount.AccountName, WindowsIdentity.GetCurrent().Name); IPAddress[] a1 = await Dns.GetHostAddressesAsync(""); IPAddress[] a2 = Dns.GetHostAddresses(""); Assert.True(a1.Length > 0); Assert.True(a1.SequenceEqual(a2)); }); } }
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/libraries/System.Collections.Immutable/src/Properties/InternalsVisibleTo.cs
// 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; [assembly: InternalsVisibleTo("System.Collections.Immutable.Tests, PublicKey=00240000048000009400000006020000002400005253413100040000010001004b86c4cb78549b34bab61a3b1800e23bfeb5b3ec390074041536a7e3cbd97f5f04cf0f857155a8928eaa29ebfd11cfbbad3ba70efea7bda3226c6a8d370a4cd303f714486b6ebc225985a638471e6ef571cc92a4613c00b8fa65d61ccee0cbe5f36330c9a01f4183559f1bef24cc2917c6d913e3a541333a1d05d9bed22b38cb")]
// 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; [assembly: InternalsVisibleTo("System.Collections.Immutable.Tests, PublicKey=00240000048000009400000006020000002400005253413100040000010001004b86c4cb78549b34bab61a3b1800e23bfeb5b3ec390074041536a7e3cbd97f5f04cf0f857155a8928eaa29ebfd11cfbbad3ba70efea7bda3226c6a8d370a4cd303f714486b6ebc225985a638471e6ef571cc92a4613c00b8fa65d61ccee0cbe5f36330c9a01f4183559f1bef24cc2917c6d913e3a541333a1d05d9bed22b38cb")]
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/libraries/System.Reflection.Metadata/src/System/Reflection/Internal/Utilities/StreamExtensions.netstandard2.0.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.IO; using System.Runtime.InteropServices; namespace System.Reflection.Internal { internal static partial class StreamExtensions { private static bool IsWindows => Path.DirectorySeparatorChar == '\\'; private static SafeHandle? GetSafeFileHandle(FileStream stream) { SafeHandle handle; try { handle = stream.SafeFileHandle; } catch { // Some FileStream implementations (e.g. IsolatedStorage) restrict access to the underlying handle by throwing // Tolerate it and fall back to slow path. return null; } if (handle != null && handle.IsInvalid) { // Also allow for FileStream implementations that do return a non-null, but invalid underlying OS handle. // This is how brokered files on WinRT will work. Fall back to slow path. return null; } return handle; } internal static unsafe int Read(this Stream stream, byte* buffer, int size) { if (!IsWindows || stream is not FileStream fs) { return 0; } SafeHandle? handle = GetSafeFileHandle(fs); if (handle == null) { return 0; } int result = Interop.Kernel32.ReadFile(handle, buffer, size, out int bytesRead, IntPtr.Zero); return result == 0 ? 0 : bytesRead; } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.IO; using System.Runtime.InteropServices; namespace System.Reflection.Internal { internal static partial class StreamExtensions { private static bool IsWindows => Path.DirectorySeparatorChar == '\\'; private static SafeHandle? GetSafeFileHandle(FileStream stream) { SafeHandle handle; try { handle = stream.SafeFileHandle; } catch { // Some FileStream implementations (e.g. IsolatedStorage) restrict access to the underlying handle by throwing // Tolerate it and fall back to slow path. return null; } if (handle != null && handle.IsInvalid) { // Also allow for FileStream implementations that do return a non-null, but invalid underlying OS handle. // This is how brokered files on WinRT will work. Fall back to slow path. return null; } return handle; } internal static unsafe int Read(this Stream stream, byte* buffer, int size) { if (!IsWindows || stream is not FileStream fs) { return 0; } SafeHandle? handle = GetSafeFileHandle(fs); if (handle == null) { return 0; } int result = Interop.Kernel32.ReadFile(handle, buffer, size, out int bytesRead, IntPtr.Zero); return result == 0 ? 0 : bytesRead; } } }
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/tests/JIT/HardwareIntrinsics/General/Vector128_1/op_ExclusiveOr.Double.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; namespace JIT.HardwareIntrinsics.General { public static partial class Program { private static void op_ExclusiveOrDouble() { var test = new VectorBinaryOpTest__op_ExclusiveOrDouble(); // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); // Validates passing a static member works test.RunClsVarScenario(); // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); // Validates passing the field of a local class works test.RunClassLclFldScenario(); // Validates passing an instance member of a class works test.RunClassFldScenario(); // Validates passing the field of a local struct works test.RunStructLclFldScenario(); // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class VectorBinaryOpTest__op_ExclusiveOrDouble { private struct DataTable { private byte[] inArray1; private byte[] inArray2; private byte[] outArray; private GCHandle inHandle1; private GCHandle inHandle2; private GCHandle outHandle; private ulong alignment; public DataTable(Double[] inArray1, Double[] inArray2, Double[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Double>(); int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<Double>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<Double>(); if ((alignment != 32 && alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfinArray2 || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray1 = new byte[alignment * 2]; this.inArray2 = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned); this.inHandle2 = GCHandle.Alloc(this.inArray2, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<Double, byte>(ref inArray1[0]), (uint)sizeOfinArray1); Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<Double, byte>(ref inArray2[0]), (uint)sizeOfinArray2); } public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment); public void* inArray2Ptr => Align((byte*)(inHandle2.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle1.Free(); inHandle2.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector128<Double> _fld1; public Vector128<Double> _fld2; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetDouble(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref testStruct._fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetDouble(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref testStruct._fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>()); return testStruct; } public void RunStructFldScenario(VectorBinaryOpTest__op_ExclusiveOrDouble testClass) { var result = _fld1 ^ _fld2; Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } } private static readonly int LargestVectorSize = 16; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double); private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double); private static Double[] _data1 = new Double[Op1ElementCount]; private static Double[] _data2 = new Double[Op2ElementCount]; private static Vector128<Double> _clsVar1; private static Vector128<Double> _clsVar2; private Vector128<Double> _fld1; private Vector128<Double> _fld2; private DataTable _dataTable; static VectorBinaryOpTest__op_ExclusiveOrDouble() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetDouble(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetDouble(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>()); } public VectorBinaryOpTest__op_ExclusiveOrDouble() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetDouble(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetDouble(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetDouble(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetDouble(); } _dataTable = new DataTable(_data1, _data2, new Double[RetElementCount], LargestVectorSize); } public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = Unsafe.Read<Vector128<Double>>(_dataTable.inArray1Ptr) ^ Unsafe.Read<Vector128<Double>>(_dataTable.inArray2Ptr); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var result = typeof(Vector128<Double>).GetMethod("op_ExclusiveOr", new Type[] { typeof(Vector128<Double>), typeof(Vector128<Double>) }) .Invoke(null, new object[] { Unsafe.Read<Vector128<Double>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<Double>>(_dataTable.inArray2Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Double>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = _clsVar1 ^ _clsVar2; Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector128<Double>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector128<Double>>(_dataTable.inArray2Ptr); var result = op1 ^ op2; Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new VectorBinaryOpTest__op_ExclusiveOrDouble(); var result = test._fld1 ^ test._fld2; Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = _fld1 ^ _fld2; Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = test._fld1 ^ test._fld2; Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } private void ValidateResult(Vector128<Double> op1, Vector128<Double> op2, void* result, [CallerMemberName] string method = "") { Double[] inArray1 = new Double[Op1ElementCount]; Double[] inArray2 = new Double[Op2ElementCount]; Double[] outArray = new Double[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), op1); Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), op2); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(void* op1, void* op2, void* result, [CallerMemberName] string method = "") { Double[] inArray1 = new Double[Op1ElementCount]; Double[] inArray2 = new Double[Op2ElementCount]; Double[] outArray = new Double[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector128<Double>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector128<Double>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(Double[] left, Double[] right, Double[] result, [CallerMemberName] string method = "") { bool succeeded = true; if (BitConverter.DoubleToInt64Bits(result[0]) != (BitConverter.DoubleToInt64Bits(left[0]) ^ BitConverter.DoubleToInt64Bits(right[0]))) { succeeded = false; } else { for (var i = 1; i < RetElementCount; i++) { if (BitConverter.DoubleToInt64Bits(result[i]) != (BitConverter.DoubleToInt64Bits(left[i]) ^ BitConverter.DoubleToInt64Bits(right[i]))) { succeeded = false; break; } } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(Vector128)}.op_ExclusiveOr<Double>(Vector128<Double>, Vector128<Double>): {method} failed:"); TestLibrary.TestFramework.LogInformation($" left: ({string.Join(", ", left)})"); TestLibrary.TestFramework.LogInformation($" right: ({string.Join(", ", right)})"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; namespace JIT.HardwareIntrinsics.General { public static partial class Program { private static void op_ExclusiveOrDouble() { var test = new VectorBinaryOpTest__op_ExclusiveOrDouble(); // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); // Validates passing a static member works test.RunClsVarScenario(); // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); // Validates passing the field of a local class works test.RunClassLclFldScenario(); // Validates passing an instance member of a class works test.RunClassFldScenario(); // Validates passing the field of a local struct works test.RunStructLclFldScenario(); // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class VectorBinaryOpTest__op_ExclusiveOrDouble { private struct DataTable { private byte[] inArray1; private byte[] inArray2; private byte[] outArray; private GCHandle inHandle1; private GCHandle inHandle2; private GCHandle outHandle; private ulong alignment; public DataTable(Double[] inArray1, Double[] inArray2, Double[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Double>(); int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<Double>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<Double>(); if ((alignment != 32 && alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfinArray2 || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray1 = new byte[alignment * 2]; this.inArray2 = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned); this.inHandle2 = GCHandle.Alloc(this.inArray2, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<Double, byte>(ref inArray1[0]), (uint)sizeOfinArray1); Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<Double, byte>(ref inArray2[0]), (uint)sizeOfinArray2); } public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment); public void* inArray2Ptr => Align((byte*)(inHandle2.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle1.Free(); inHandle2.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector128<Double> _fld1; public Vector128<Double> _fld2; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetDouble(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref testStruct._fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetDouble(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref testStruct._fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>()); return testStruct; } public void RunStructFldScenario(VectorBinaryOpTest__op_ExclusiveOrDouble testClass) { var result = _fld1 ^ _fld2; Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } } private static readonly int LargestVectorSize = 16; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double); private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double); private static Double[] _data1 = new Double[Op1ElementCount]; private static Double[] _data2 = new Double[Op2ElementCount]; private static Vector128<Double> _clsVar1; private static Vector128<Double> _clsVar2; private Vector128<Double> _fld1; private Vector128<Double> _fld2; private DataTable _dataTable; static VectorBinaryOpTest__op_ExclusiveOrDouble() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetDouble(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetDouble(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _clsVar2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>()); } public VectorBinaryOpTest__op_ExclusiveOrDouble() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetDouble(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld1), ref Unsafe.As<Double, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Double>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetDouble(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Double>, byte>(ref _fld2), ref Unsafe.As<Double, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Double>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetDouble(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetDouble(); } _dataTable = new DataTable(_data1, _data2, new Double[RetElementCount], LargestVectorSize); } public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = Unsafe.Read<Vector128<Double>>(_dataTable.inArray1Ptr) ^ Unsafe.Read<Vector128<Double>>(_dataTable.inArray2Ptr); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var result = typeof(Vector128<Double>).GetMethod("op_ExclusiveOr", new Type[] { typeof(Vector128<Double>), typeof(Vector128<Double>) }) .Invoke(null, new object[] { Unsafe.Read<Vector128<Double>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<Double>>(_dataTable.inArray2Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Double>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = _clsVar1 ^ _clsVar2; Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector128<Double>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector128<Double>>(_dataTable.inArray2Ptr); var result = op1 ^ op2; Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new VectorBinaryOpTest__op_ExclusiveOrDouble(); var result = test._fld1 ^ test._fld2; Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = _fld1 ^ _fld2; Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = test._fld1 ^ test._fld2; Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } private void ValidateResult(Vector128<Double> op1, Vector128<Double> op2, void* result, [CallerMemberName] string method = "") { Double[] inArray1 = new Double[Op1ElementCount]; Double[] inArray2 = new Double[Op2ElementCount]; Double[] outArray = new Double[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), op1); Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), op2); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(void* op1, void* op2, void* result, [CallerMemberName] string method = "") { Double[] inArray1 = new Double[Op1ElementCount]; Double[] inArray2 = new Double[Op2ElementCount]; Double[] outArray = new Double[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector128<Double>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector128<Double>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Double, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Double>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(Double[] left, Double[] right, Double[] result, [CallerMemberName] string method = "") { bool succeeded = true; if (BitConverter.DoubleToInt64Bits(result[0]) != (BitConverter.DoubleToInt64Bits(left[0]) ^ BitConverter.DoubleToInt64Bits(right[0]))) { succeeded = false; } else { for (var i = 1; i < RetElementCount; i++) { if (BitConverter.DoubleToInt64Bits(result[i]) != (BitConverter.DoubleToInt64Bits(left[i]) ^ BitConverter.DoubleToInt64Bits(right[i]))) { succeeded = false; break; } } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(Vector128)}.op_ExclusiveOr<Double>(Vector128<Double>, Vector128<Double>): {method} failed:"); TestLibrary.TestFramework.LogInformation($" left: ({string.Join(", ", left)})"); TestLibrary.TestFramework.LogInformation($" right: ({string.Join(", ", right)})"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/libraries/Common/src/Interop/Windows/Kernel32/Interop.CopyFile.cs
// 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.Runtime.InteropServices; internal static partial class Interop { internal static partial class Kernel32 { internal static int CopyFile(string src, string dst, bool failIfExists) { int copyFlags = failIfExists ? Interop.Kernel32.FileOperations.COPY_FILE_FAIL_IF_EXISTS : 0; int cancel = 0; if (!Interop.Kernel32.CopyFileEx(src, dst, IntPtr.Zero, IntPtr.Zero, ref cancel, copyFlags)) { return Marshal.GetLastWin32Error(); } return Interop.Errors.ERROR_SUCCESS; } } }
// 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.Runtime.InteropServices; internal static partial class Interop { internal static partial class Kernel32 { internal static int CopyFile(string src, string dst, bool failIfExists) { int copyFlags = failIfExists ? Interop.Kernel32.FileOperations.COPY_FILE_FAIL_IF_EXISTS : 0; int cancel = 0; if (!Interop.Kernel32.CopyFileEx(src, dst, IntPtr.Zero, IntPtr.Zero, ref cancel, copyFlags)) { return Marshal.GetLastWin32Error(); } return Interop.Errors.ERROR_SUCCESS; } } }
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/libraries/System.Private.Xml/tests/Writers/RwFactory/CXmlDriverVariation.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using OLEDB.Test.ModuleCore; namespace System.Xml.Tests { /// <summary> /// CXmlDriverVariation /// </summary> public class CXmlDriverVariation : CVariation { private CXmlDriverParam _xmlDriverParams; //Constructor internal CXmlDriverVariation(CXmlDriverScenario testCase, string name, string description, int id, int pri, CXmlDriverParam xmlDriverParams) : base(testCase) { _xmlDriverParams = xmlDriverParams; // use name as a description if provided if (name != null) this.Desc = name; else this.Desc = description; this.Name = name; this.Pri = pri; this.id = id; } private bool CheckSkipped() { string skipped = XmlDriverParam.GetTopLevelAttributeValue("Skipped"); if (skipped == null || !bool.Parse(skipped)) return true; return false; } public override tagVARIATION_STATUS Execute() { tagVARIATION_STATUS res = (tagVARIATION_STATUS)TEST_FAIL; try { if (!CheckSkipped()) return (tagVARIATION_STATUS)TEST_SKIPPED; CXmlDriverScenario scenario = (CXmlDriverScenario)Parent; res = (tagVARIATION_STATUS)scenario.ExecuteVariation(XmlDriverParam); } catch (CTestSkippedException e) { res = (tagVARIATION_STATUS)HandleException(e); } catch (Exception e) { res = (tagVARIATION_STATUS)HandleException(e); } return res; } public CXmlDriverParam XmlDriverParam { get { return _xmlDriverParams; } set { _xmlDriverParams = value; } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using OLEDB.Test.ModuleCore; namespace System.Xml.Tests { /// <summary> /// CXmlDriverVariation /// </summary> public class CXmlDriverVariation : CVariation { private CXmlDriverParam _xmlDriverParams; //Constructor internal CXmlDriverVariation(CXmlDriverScenario testCase, string name, string description, int id, int pri, CXmlDriverParam xmlDriverParams) : base(testCase) { _xmlDriverParams = xmlDriverParams; // use name as a description if provided if (name != null) this.Desc = name; else this.Desc = description; this.Name = name; this.Pri = pri; this.id = id; } private bool CheckSkipped() { string skipped = XmlDriverParam.GetTopLevelAttributeValue("Skipped"); if (skipped == null || !bool.Parse(skipped)) return true; return false; } public override tagVARIATION_STATUS Execute() { tagVARIATION_STATUS res = (tagVARIATION_STATUS)TEST_FAIL; try { if (!CheckSkipped()) return (tagVARIATION_STATUS)TEST_SKIPPED; CXmlDriverScenario scenario = (CXmlDriverScenario)Parent; res = (tagVARIATION_STATUS)scenario.ExecuteVariation(XmlDriverParam); } catch (CTestSkippedException e) { res = (tagVARIATION_STATUS)HandleException(e); } catch (Exception e) { res = (tagVARIATION_STATUS)HandleException(e); } return res; } public CXmlDriverParam XmlDriverParam { get { return _xmlDriverParams; } set { _xmlDriverParams = value; } } } }
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/libraries/System.Composition/tests/MetadataConstraintTests.cs
// 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.Collections.Generic; using System.Composition.Hosting.Core; using System.Linq; using System.Text; using System.Threading.Tasks; using Xunit; namespace System.Composition.UnitTests { public class MetadataConstraintTests : ContainerTests { [Export, ExportMetadata("SettingName", "TheName")] public class SomeSetting { } [Export] public class SomeSettingUser { [Import, ImportMetadataConstraint("SettingName", "TheName")] public SomeSetting Setting { get; set; } } [Export] public class ManySettingUser { [ImportMany, ImportMetadataConstraint("SettingName", "TheName")] public IEnumerable<SomeSetting> Settings { get; set; } } [Fact] public void AnImportMetadataConstraintMatchesMetadataOnTheExport() { var cc = CreateContainer(typeof(SomeSetting), typeof(SomeSettingUser)); var ssu = cc.GetExport<SomeSettingUser>(); Assert.NotNull(ssu.Setting); } [Fact] public void AnImportMetadataConstraintMatchesMetadataOnTheExportEvenIfDiscoveryHasCompletedForTheExport() { var cc = CreateContainer(typeof(SomeSetting), typeof(SomeSettingUser)); cc.GetExport<SomeSetting>(); var ssu = cc.GetExport<SomeSettingUser>(); Assert.NotNull(ssu.Setting); } [Fact] public void ImportMetadataConstraintsComposeWithOtherRelationshipTypes() { var cc = CreateContainer(typeof(SomeSetting), typeof(ManySettingUser)); var ssu = cc.GetExport<ManySettingUser>(); Assert.Equal(1, ssu.Settings.Count()); } [Export, ExportMetadata("SettingName", "TheName")] public class SomeSetting<T> { } [Fact] public void ConstraintsCanBeAppliedToGenerics() { var contract = new CompositionContract(typeof(SomeSetting<string>), null, new Dictionary<string, object> { { "SettingName", "TheName" } }); var c = CreateContainer(typeof(SomeSetting<>)); object s; Assert.True(c.TryGetExport(contract, out s)); } [Export, ExportMetadata("Items", new[] { 1, 2, 3 })] public class Presenter { } [Export] public class Controller { [Import, ImportMetadataConstraint("Items", new[] { 1, 2, 3 })] public Presenter Presenter { get; set; } } [Fact] public void ItemEqualityIsUsedWhenMatchingMetadataValuesThatAreArrays() { var c = CreateContainer(typeof(Presenter), typeof(Controller)); var ctrl = c.GetExport<Controller>(); Assert.IsAssignableFrom<Presenter>(ctrl.Presenter); } } }
// 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.Collections.Generic; using System.Composition.Hosting.Core; using System.Linq; using System.Text; using System.Threading.Tasks; using Xunit; namespace System.Composition.UnitTests { public class MetadataConstraintTests : ContainerTests { [Export, ExportMetadata("SettingName", "TheName")] public class SomeSetting { } [Export] public class SomeSettingUser { [Import, ImportMetadataConstraint("SettingName", "TheName")] public SomeSetting Setting { get; set; } } [Export] public class ManySettingUser { [ImportMany, ImportMetadataConstraint("SettingName", "TheName")] public IEnumerable<SomeSetting> Settings { get; set; } } [Fact] public void AnImportMetadataConstraintMatchesMetadataOnTheExport() { var cc = CreateContainer(typeof(SomeSetting), typeof(SomeSettingUser)); var ssu = cc.GetExport<SomeSettingUser>(); Assert.NotNull(ssu.Setting); } [Fact] public void AnImportMetadataConstraintMatchesMetadataOnTheExportEvenIfDiscoveryHasCompletedForTheExport() { var cc = CreateContainer(typeof(SomeSetting), typeof(SomeSettingUser)); cc.GetExport<SomeSetting>(); var ssu = cc.GetExport<SomeSettingUser>(); Assert.NotNull(ssu.Setting); } [Fact] public void ImportMetadataConstraintsComposeWithOtherRelationshipTypes() { var cc = CreateContainer(typeof(SomeSetting), typeof(ManySettingUser)); var ssu = cc.GetExport<ManySettingUser>(); Assert.Equal(1, ssu.Settings.Count()); } [Export, ExportMetadata("SettingName", "TheName")] public class SomeSetting<T> { } [Fact] public void ConstraintsCanBeAppliedToGenerics() { var contract = new CompositionContract(typeof(SomeSetting<string>), null, new Dictionary<string, object> { { "SettingName", "TheName" } }); var c = CreateContainer(typeof(SomeSetting<>)); object s; Assert.True(c.TryGetExport(contract, out s)); } [Export, ExportMetadata("Items", new[] { 1, 2, 3 })] public class Presenter { } [Export] public class Controller { [Import, ImportMetadataConstraint("Items", new[] { 1, 2, 3 })] public Presenter Presenter { get; set; } } [Fact] public void ItemEqualityIsUsedWhenMatchingMetadataValuesThatAreArrays() { var c = CreateContainer(typeof(Presenter), typeof(Controller)); var ctrl = c.GetExport<Controller>(); Assert.IsAssignableFrom<Presenter>(ctrl.Presenter); } } }
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/tests/nativeaot/SmokeTests/PInvoke/PInvoke.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. #if MULTIMODULE_BUILD && !DEBUG // Some tests won't work if we're using optimizing codegen, but scanner doesn't run. // This currently happens in optimized multi-obj builds. #define OPTIMIZED_MODE_WITHOUT_SCANNER #endif using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Text; // Make sure the interop data are present even without reflection namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.All)] internal class __BlockAllReflectionAttribute : Attribute { } } // Name of namespace matches the name of the assembly on purpose to // ensure that we can handle this (mostly an issue for C++ code generation). namespace PInvokeTests { internal class Program { [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] private static extern int Square(int intValue); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] private static extern int IsTrue(bool boolValue); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] private static extern int CheckIncremental(int[] array, int sz); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] private static extern int CheckIncremental_Foo(Foo[] array, int sz); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] private static extern int Inc(ref int value); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] private static extern int VerifyByRefFoo(ref Foo value); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode)] private static extern bool GetNextChar(ref char c); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)] private static extern int VerifyAnsiString(string str); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)] private static extern int VerifyAnsiStringOut(out string str); [DllImport("PInvokeNative", EntryPoint = "VerifyAnsiString", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)] private static extern int VerifyUTF8String([MarshalAs(UnmanagedType.LPUTF8Str)] string str); [DllImport("PInvokeNative", EntryPoint = "VerifyAnsiStringOut", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)] private static extern int VerifyUTF8StringOut([Out, MarshalAs(UnmanagedType.LPUTF8Str)] out string str); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)] private static extern int VerifyAnsiStringRef(ref string str); [DllImport("PInvokeNative", EntryPoint = "VerifyAnsiStringRef", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)] private static extern int VerifyAnsiStringInRef([In]ref string str); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode)] private static extern int VerifyUnicodeString(string str); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode)] private static extern int VerifyUnicodeStringOut(out string str); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode)] private static extern int VerifyUnicodeStringRef(ref string str); [DllImport("PInvokeNative", EntryPoint = "VerifyUnicodeStringRef", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode)] private static extern int VerifyUnicodeStringInRef([In]ref string str); [DllImport("PInvokeNative", CharSet = CharSet.Ansi)] private static extern int VerifyAnsiStringArray([In, MarshalAs(UnmanagedType.LPArray)]string[] str); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)] private static extern bool VerifyAnsiCharArrayIn(char[] a); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)] private static extern bool VerifyAnsiCharArrayOut([Out]char[] a); [DllImport("PInvokeNative", CharSet = CharSet.Ansi)] private static extern void ToUpper([In, Out, MarshalAs(UnmanagedType.LPArray)]string[] str); [DllImport("PInvokeNative", CharSet = CharSet.Ansi)] private static extern bool VerifySizeParamIndex( [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] out byte[] arrByte, out byte arrSize); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode, EntryPoint = "VerifyUnicodeStringBuilder")] private static extern int VerifyUnicodeStringBuilder(StringBuilder sb); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode, EntryPoint = "VerifyUnicodeStringBuilder")] private static extern int VerifyUnicodeStringBuilderIn([In]StringBuilder sb); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode)] private static extern int VerifyUnicodeStringBuilderOut([Out]StringBuilder sb); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi, EntryPoint = "VerifyAnsiStringBuilder")] private static extern int VerifyAnsiStringBuilder(StringBuilder sb); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi, EntryPoint = "VerifyAnsiStringBuilder")] private static extern int VerifyAnsiStringBuilderIn([In]StringBuilder sb); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)] private static extern int VerifyAnsiStringBuilderOut([Out]StringBuilder sb); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, EntryPoint = "SafeHandleTest")] public static extern bool HandleRefTest(HandleRef hr, Int64 hrValue); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] public static extern bool SafeHandleTest(SafeMemoryHandle sh1, Int64 sh1Value); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] public static extern int SafeHandleOutTest(out SafeMemoryHandle sh1); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] public static extern int SafeHandleRefTest(ref SafeMemoryHandle sh1, bool change); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, SetLastError = true)] public static extern bool LastErrorTest(); delegate int Delegate_Int(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] static extern bool ReversePInvoke_Int(Delegate_Int del); delegate int Delegate_Int_AggressiveInlining(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, EntryPoint = "ReversePInvoke_Int")] #if OPTIMIZED_MODE_WITHOUT_SCANNER [MethodImpl(MethodImplOptions.NoInlining)] #else [MethodImpl(MethodImplOptions.AggressiveInlining)] #endif static extern bool ReversePInvoke_Int_AggressiveInlining(Delegate_Int_AggressiveInlining del); [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet=CharSet.Ansi)] delegate bool Delegate_String(string s); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] static extern bool ReversePInvoke_String(Delegate_String del); [DllImport("PInvokeNative", EntryPoint="ReversePInvoke_String", CallingConvention = CallingConvention.StdCall)] static extern bool ReversePInvoke_String_Delegate(Delegate del); [DllImport("PInvokeNative", EntryPoint="ReversePInvoke_String", CallingConvention = CallingConvention.StdCall)] static extern bool ReversePInvoke_String_MulticastDelegate(MulticastDelegate del); struct FieldDelegate { public Delegate d; } struct FieldMulticastDelegate { public MulticastDelegate d; } [DllImport("PInvokeNative", EntryPoint="ReversePInvoke_DelegateField", CallingConvention = CallingConvention.StdCall)] static extern bool ReversePInvoke_Field_Delegate(FieldDelegate del); [DllImport("PInvokeNative", EntryPoint="ReversePInvoke_DelegateField", CallingConvention = CallingConvention.StdCall)] static extern bool ReversePInvoke_Field_MulticastDelegate(FieldMulticastDelegate del); [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi)] delegate bool Delegate_OutString([MarshalAs(0x30)] out string s); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] static extern bool ReversePInvoke_OutString(Delegate_OutString del); [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi)] delegate bool Delegate_Array([MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] int[] array, IntPtr sz); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] static extern bool ReversePInvoke_Array(Delegate_Array del); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] static extern Delegate_String GetDelegate(); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] static extern bool Callback(ref Delegate_String d); delegate void Delegate_Unused(); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] static extern unsafe int* ReversePInvoke_Unused(Delegate_Unused del); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, EntryPoint = "StructTest")] static extern bool StructTest_Auto(AutoStruct ss); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] static extern bool StructTest_Sequential2(NesterOfSequentialStruct.SequentialStruct ss); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] static extern bool StructTest(SequentialStruct ss); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] static extern void StructTest_ByRef(ref SequentialStruct ss); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, EntryPoint = "StructTest_ByRef")] static extern bool ClassTest([In, Out] SequentialClass ss); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, EntryPoint = "StructTest_ByRef")] static extern bool AsAnyTest([In, Out, MarshalAs(40 /* UnmanagedType.AsAny */)] object o); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] static extern void StructTest_ByOut(out SequentialStruct ss); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] static extern bool StructTest_Explicit(ExplicitStruct es); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] static extern bool StructTest_Nested(NestedStruct ns); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, EntryPoint = "StructTest_Nested")] static extern bool StructTest_NestedClass(NestedClass nc); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] static extern bool StructTest_Array(SequentialStruct []ns, int length); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)] static extern bool IsNULL(char[] a); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)] static extern bool IsNULL(String sb); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] static extern bool IsNULL(Foo[] foo); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] static extern bool IsNULL(SequentialStruct[] foo); [StructLayout(LayoutKind.Sequential, CharSet= CharSet.Ansi, Pack = 4)] public unsafe struct InlineArrayStruct { public int f0; public int f1; public int f2; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] public short[] inlineArray; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 11)] public string inlineString; } [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode, Pack = 4)] public unsafe struct InlineUnicodeStruct { public int f0; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 11)] public string inlineString; } [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] static extern bool InlineArrayTest(ref InlineArrayStruct ias, ref InlineUnicodeStruct ius); [UnmanagedFunctionPointer(CallingConvention.Cdecl, SetLastError = true)] public unsafe delegate void SetLastErrorFuncDelegate(int errorCode); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] internal static extern IntPtr GetFunctionPointer(); [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] internal unsafe struct InlineString { internal uint size; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] internal string name; } [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] static extern bool InlineStringTest(ref InlineString ias); internal delegate int Callback0(); internal delegate int Callback1(); internal delegate int Callback2(); [DllImport("PInvokeNative")] internal static extern bool RegisterCallbacks(ref Callbacks callbacks); [StructLayout(LayoutKind.Sequential)] internal struct Callbacks { public Callback0 callback0; public Callback1 callback1; public Callback2 callback2; } public static int callbackFunc0() { return 0; } public static int callbackFunc1() { return 1; } public static int callbackFunc2() { return 2; } [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, PreserveSig = false)] static extern void ValidateSuccessCall(int errorCode); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, PreserveSig = false)] static extern int ValidateIntResult(int errorCode); [DllImport("PInvokeNative", EntryPoint = "ValidateIntResult", CallingConvention = CallingConvention.StdCall, PreserveSig = false)] static extern MagicEnum ValidateEnumResult(int errorCode); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] internal static extern decimal DecimalTest(decimal value); internal enum MagicEnum { MagicResult = 42, } public static int Main(string[] args) { TestBlittableType(); TestBoolean(); TestUnichar(); TestArrays(); TestByRef(); TestString(); TestStringBuilder(); TestLastError(); TestHandleRef(); TestSafeHandle(); TestStringArray(); TestSizeParamIndex(); TestDelegate(); TestStruct(); TestLayoutClassPtr(); TestLayoutClass(); TestAsAny(); TestMarshalStructAPIs(); TestWithoutPreserveSig(); TestForwardDelegateWithUnmanagedCallersOnly(); TestDecimal(); return 100; } public static void ThrowIfNotEquals<T>(T expected, T actual, string message) { if (!expected.Equals(actual)) { message += "\nExpected: " + expected.ToString() + "\n"; message += "Actual: " + actual.ToString() + "\n"; throw new Exception(message); } } public static void ThrowIfNotEquals(bool expected, bool actual, string message) { ThrowIfNotEquals(expected ? 1 : 0, actual ? 1 : 0, message); } private static void TestBlittableType() { Console.WriteLine("Testing marshalling blittable types"); ThrowIfNotEquals(100, Square(10), "Int marshalling failed"); } private static void TestBoolean() { Console.WriteLine("Testing marshalling boolean"); ThrowIfNotEquals(1, IsTrue(true), "Bool marshalling failed"); ThrowIfNotEquals(0, IsTrue(false), "Bool marshalling failed"); } private static void TestUnichar() { Console.WriteLine("Testing Unichar"); char c = 'a'; ThrowIfNotEquals(true, GetNextChar(ref c), "Unichar marshalling failed."); ThrowIfNotEquals('b', c, "Unichar marshalling failed."); } struct Foo { public int a; public float b; } private static void TestArrays() { Console.WriteLine("Testing marshalling int arrays"); const int ArraySize = 100; int[] arr = new int[ArraySize]; for (int i = 0; i < ArraySize; i++) arr[i] = i; ThrowIfNotEquals(0, CheckIncremental(arr, ArraySize), "Array marshalling failed"); Console.WriteLine("Testing marshalling blittable struct arrays"); Foo[] arr_foo = null; ThrowIfNotEquals(true, IsNULL(arr_foo), "Blittable array null check failed"); arr_foo = new Foo[ArraySize]; for (int i = 0; i < ArraySize; i++) { arr_foo[i].a = i; arr_foo[i].b = i; } ThrowIfNotEquals(0, CheckIncremental_Foo(arr_foo, ArraySize), "Array marshalling failed"); char[] a = "Hello World".ToCharArray(); ThrowIfNotEquals(true, VerifyAnsiCharArrayIn(a), "Ansi Char Array In failed"); char[] b = new char[12]; ThrowIfNotEquals(true, VerifyAnsiCharArrayOut(b), "Ansi Char Array Out failed"); ThrowIfNotEquals("Hello World!", new String(b), "Ansi Char Array Out failed2"); char[] c = null; ThrowIfNotEquals(true, IsNULL(c), "AnsiChar Array null check failed"); } private static void TestByRef() { Console.WriteLine("Testing marshalling by ref"); int value = 100; ThrowIfNotEquals(0, Inc(ref value), "By ref marshalling failed"); ThrowIfNotEquals(101, value, "By ref marshalling failed"); Foo foo = new Foo(); foo.a = 10; foo.b = 20; int ret = VerifyByRefFoo(ref foo); ThrowIfNotEquals(0, ret, "By ref struct marshalling failed"); ThrowIfNotEquals(foo.a, 11, "By ref struct unmarshalling failed"); ThrowIfNotEquals(foo.b, 21.0f, "By ref struct unmarshalling failed"); } private static void TestString() { Console.WriteLine("Testing marshalling string"); ThrowIfNotEquals(1, VerifyAnsiString("Hello World"), "Ansi String marshalling failed."); ThrowIfNotEquals(1, VerifyUnicodeString("Hello World"), "Unicode String marshalling failed."); string s; ThrowIfNotEquals(1, VerifyAnsiStringOut(out s), "Out Ansi String marshalling failed"); ThrowIfNotEquals("Hello World", s, "Out Ansi String marshalling failed"); VerifyAnsiStringInRef(ref s); ThrowIfNotEquals("Hello World", s, "In Ref ansi String marshalling failed"); VerifyAnsiStringRef(ref s); ThrowIfNotEquals("Hello World!", s, "Ref ansi String marshalling failed"); ThrowIfNotEquals(1, VerifyUnicodeStringOut(out s), "Out Unicode String marshalling failed"); ThrowIfNotEquals("Hello World", s, "Out Unicode String marshalling failed"); VerifyUnicodeStringInRef(ref s); ThrowIfNotEquals("Hello World", s, "In Ref Unicode String marshalling failed"); VerifyUnicodeStringRef(ref s); ThrowIfNotEquals("Hello World!", s, "Ref Unicode String marshalling failed"); string ss = null; ThrowIfNotEquals(true, IsNULL(ss), "Ansi String null check failed"); ThrowIfNotEquals(1, VerifyUTF8String("Hello World"), "UTF8 String marshalling failed."); ThrowIfNotEquals(1, VerifyUTF8StringOut(out s), "Out UTF8 String marshalling failed"); ThrowIfNotEquals("Hello World", s, "Out UTF8 String marshalling failed"); } private static void TestStringBuilder() { Console.WriteLine("Testing marshalling string builder"); StringBuilder sb = new StringBuilder("Hello World"); ThrowIfNotEquals(1, VerifyUnicodeStringBuilder(sb), "Unicode StringBuilder marshalling failed"); ThrowIfNotEquals("HELLO WORLD", sb.ToString(), "Unicode StringBuilder marshalling failed."); StringBuilder sb1 = null; // for null stringbuilder it should return -1 ThrowIfNotEquals(-1, VerifyUnicodeStringBuilder(sb1), "Null unicode StringBuilder marshalling failed"); StringBuilder sb2 = new StringBuilder("Hello World"); ThrowIfNotEquals(1, VerifyUnicodeStringBuilderIn(sb2), "In unicode StringBuilder marshalling failed"); // Only [In] should change stringbuilder value ThrowIfNotEquals("Hello World", sb2.ToString(), "In unicode StringBuilder marshalling failed"); StringBuilder sb3 = new StringBuilder(); ThrowIfNotEquals(1, VerifyUnicodeStringBuilderOut(sb3), "Out Unicode string marshalling failed"); ThrowIfNotEquals("Hello World", sb3.ToString(), "Out Unicode StringBuilder marshalling failed"); StringBuilder sb4 = new StringBuilder("Hello World"); ThrowIfNotEquals(1, VerifyAnsiStringBuilder(sb4), "Ansi StringBuilder marshalling failed"); ThrowIfNotEquals("HELLO WORLD", sb4.ToString(), "Ansi StringBuilder marshalling failed."); StringBuilder sb5 = null; // for null stringbuilder it should return -1 ThrowIfNotEquals(-1, VerifyAnsiStringBuilder(sb5), "Null Ansi StringBuilder marshalling failed"); StringBuilder sb6 = new StringBuilder("Hello World"); ThrowIfNotEquals(1, VerifyAnsiStringBuilderIn(sb6), "In unicode StringBuilder marshalling failed"); // Only [In] should change stringbuilder value ThrowIfNotEquals("Hello World", sb6.ToString(), "In unicode StringBuilder marshalling failed"); StringBuilder sb7 = new StringBuilder(); ThrowIfNotEquals(1, VerifyAnsiStringBuilderOut(sb7), "Out Ansi string marshalling failed"); ThrowIfNotEquals("Hello World!", sb7.ToString(), "Out Ansi StringBuilder marshalling failed"); } private static void TestStringArray() { Console.WriteLine("Testing marshalling string array"); string[] strArray = new string[] { "Hello", "World" }; ThrowIfNotEquals(1, VerifyAnsiStringArray(strArray), "Ansi string array in marshalling failed."); ToUpper(strArray); ThrowIfNotEquals(true, "HELLO" == strArray[0] && "WORLD" == strArray[1], "Ansi string array out marshalling failed."); } private static void TestLastError() { Console.WriteLine("Testing last error"); ThrowIfNotEquals(true, LastErrorTest(), "GetLastWin32Error is not zero"); ThrowIfNotEquals(12345, Marshal.GetLastWin32Error(), "Last Error test failed"); } private static void TestHandleRef() { Console.WriteLine("Testing marshalling HandleRef"); ThrowIfNotEquals(true, HandleRefTest(new HandleRef(new object(), (IntPtr)2018), 2018), "HandleRef marshalling failed"); } private static void TestSafeHandle() { Console.WriteLine("Testing marshalling SafeHandle"); SafeMemoryHandle hnd = SafeMemoryHandle.AllocateMemory(1000); IntPtr hndIntPtr = hnd.DangerousGetHandle(); //get the IntPtr associated with hnd long val = hndIntPtr.ToInt64(); //return the 64-bit value associated with hnd ThrowIfNotEquals(true, SafeHandleTest(hnd, val), "SafeHandle marshalling failed."); Console.WriteLine("Testing marshalling out SafeHandle"); SafeMemoryHandle hnd2; int actual = SafeHandleOutTest(out hnd2); int expected = unchecked((int)hnd2.DangerousGetHandle().ToInt64()); ThrowIfNotEquals(actual, expected, "SafeHandle out marshalling failed"); Console.WriteLine("Testing marshalling ref SafeHandle"); SafeMemoryHandle hndOriginal = hnd2; SafeHandleRefTest(ref hnd2, false); ThrowIfNotEquals(hndOriginal, hnd2, "SafeHandle no-op ref marshalling failed"); int actual3 = SafeHandleRefTest(ref hnd2, true); int expected3 = unchecked((int)hnd2.DangerousGetHandle().ToInt64()); ThrowIfNotEquals(actual3, expected3, "SafeHandle ref marshalling failed"); hndOriginal.Dispose(); hnd2.Dispose(); } private static void TestSizeParamIndex() { Console.WriteLine("Testing SizeParamIndex"); byte byte_Array_Size; byte[] arrByte; VerifySizeParamIndex(out arrByte, out byte_Array_Size); ThrowIfNotEquals(10, byte_Array_Size, "out size failed."); bool pass = true; for (int i = 0; i < byte_Array_Size; i++) { if (arrByte[i] != i) { pass = false; break; } } ThrowIfNotEquals(true, pass, "SizeParamIndex failed."); } private class ClosedDelegateCLass { public int Sum(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j) { return a + b + c + d + e + f + g + h + i + j; } public bool GetString(String s) { return s == "Hello World"; } public bool CheckArray(int[] a, IntPtr sz) { if (sz != new IntPtr(42)) return false; for (int i = 0; i < (int)sz; i++) { if (a[i] != i) return false; } return true; } } private static void TestDelegate() { Console.WriteLine("Testing Delegate"); Delegate_Int del = new Delegate_Int(Sum); ThrowIfNotEquals(true, ReversePInvoke_Int(del), "Delegate marshalling failed."); Delegate_Int_AggressiveInlining del_aggressive = new Delegate_Int_AggressiveInlining(Sum); ThrowIfNotEquals(true, ReversePInvoke_Int_AggressiveInlining(del_aggressive), "Delegate marshalling with aggressive inlining failed."); unsafe { // // We haven't instantiated Delegate_Unused and nobody // allocates it. If a EEType is not constructed for Delegate_Unused // it will fail during linking. // ReversePInvoke_Unused(null); } Delegate_Int closed = new Delegate_Int((new ClosedDelegateCLass()).Sum); ThrowIfNotEquals(true, ReversePInvoke_Int(closed), "Closed Delegate marshalling failed."); Delegate_String ret = GetDelegate(); ThrowIfNotEquals(true, ret("Hello World!"), "Delegate as P/Invoke return failed"); Delegate_String d = new Delegate_String(new ClosedDelegateCLass().GetString); ThrowIfNotEquals(true, Callback(ref d), "Delegate IN marshalling failed"); ThrowIfNotEquals(true, d("Hello World!"), "Delegate OUT marshalling failed"); Delegate_String ds = new Delegate_String((new ClosedDelegateCLass()).GetString); ThrowIfNotEquals(true, ReversePInvoke_String(ds), "Delegate marshalling failed."); ThrowIfNotEquals(true, ReversePInvoke_String_Delegate(ds), "Delegate marshalling failed."); ThrowIfNotEquals(true, ReversePInvoke_String_MulticastDelegate(ds), "Delegate marshalling failed."); FieldDelegate fd; fd.d = ds; ThrowIfNotEquals(true, ReversePInvoke_Field_Delegate(fd), "Delegate marshalling failed."); FieldMulticastDelegate fmd; fmd.d = ds; ThrowIfNotEquals(true, ReversePInvoke_Field_MulticastDelegate(fmd), "Delegate marshalling failed."); Delegate_OutString dos = new Delegate_OutString((out string x) => { x = "Hello there!"; return true; }); ThrowIfNotEquals(true, ReversePInvoke_OutString(dos), "Delegate string out marshalling failed."); Delegate_Array da = new Delegate_Array((new ClosedDelegateCLass()).CheckArray); ThrowIfNotEquals(true, ReversePInvoke_Array(da), "Delegate array marshalling failed."); IntPtr procAddress = GetFunctionPointer(); SetLastErrorFuncDelegate funcDelegate = Marshal.GetDelegateForFunctionPointer<SetLastErrorFuncDelegate>(procAddress); funcDelegate(0x204); ThrowIfNotEquals(0x204, Marshal.GetLastWin32Error(), "Not match"); } static int Sum(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j) { return a + b + c + d + e + f + g + h + i + j; } [StructLayout(LayoutKind.Auto)] public struct AutoStruct { public short f0; public int f1; public float f2; [MarshalAs(UnmanagedType.LPStr)] public String f3; } [StructLayout(LayoutKind.Sequential)] public struct SequentialStruct { // NOTE: Same members as SequentialClass below public short f0; public int f1; public float f2; [MarshalAs(UnmanagedType.LPStr)] public String f3; } [StructLayout(LayoutKind.Sequential)] public class SequentialClass { // NOTE: Same members as SequentialStruct above public short f0; public int f1; public float f2; [MarshalAs(UnmanagedType.LPStr)] public String f3; } // A second struct with the same name but nested. Regression test against native types being mangled into // the compiler-generated type and losing fully qualified type name information. class NesterOfSequentialStruct { [StructLayout(LayoutKind.Sequential)] public struct SequentialStruct { public float f1; public int f2; } } [StructLayout(LayoutKind.Explicit)] public struct ExplicitStruct { // NOTE: Same layout as ExplicitClass [FieldOffset(0)] public int f1; [FieldOffset(12)] public float f2; [FieldOffset(24)] [MarshalAs(UnmanagedType.LPStr)] public String f3; } [StructLayout(LayoutKind.Explicit)] public class ExplicitClass { // NOTE: Same layout as ExplicitStruct [FieldOffset(0)] public int f1; [FieldOffset(12)] public float f2; [FieldOffset(24)] [MarshalAs(UnmanagedType.LPStr)] public String f3; } [StructLayout(LayoutKind.Sequential)] public struct NestedStruct { public int f1; public ExplicitStruct f2; } [StructLayout(LayoutKind.Sequential)] public struct NestedClass { public int f1; public ExplicitClass f2; } [StructLayout(LayoutKind.Explicit)] public struct BlittableStruct { [FieldOffset(4)] public float FirstField; [FieldOffset(12)] public float SecondField; [FieldOffset(32)] public long ThirdField; } [StructLayout(LayoutKind.Sequential)] public struct NonBlittableStruct { public int f1; public bool f2; public bool f3; public bool f4; } [StructLayout(LayoutKind.Sequential)] public class BlittableClass { public long f1; public int f2; public int f3; public long f4; } [StructLayout(LayoutKind.Sequential)] public class NonBlittableClass { public bool f1; public bool f2; public int f3; } [StructLayout(LayoutKind.Sequential)] public class ClassForTestingFlowAnalysis { public int Field; } private static void TestStruct() { Console.WriteLine("Testing Structs"); SequentialStruct ss = new SequentialStruct(); ss.f0 = 100; ss.f1 = 1; ss.f2 = 10.0f; ss.f3 = "Hello"; ThrowIfNotEquals(true, StructTest(ss), "Struct marshalling scenario1 failed."); StructTest_ByRef(ref ss); ThrowIfNotEquals(true, ss.f1 == 2 && ss.f2 == 11.0 && ss.f3.Equals("Ifmmp"), "Struct marshalling scenario2 failed."); SequentialStruct ss2 = new SequentialStruct(); StructTest_ByOut(out ss2); ThrowIfNotEquals(true, ss2.f0 == 1 && ss2.f1 == 1.0 && ss2.f2 == 1.0 && ss2.f3.Equals("0123456"), "Struct marshalling scenario3 failed."); NesterOfSequentialStruct.SequentialStruct ss3 = new NesterOfSequentialStruct.SequentialStruct(); ss3.f1 = 10.0f; ss3.f2 = 123; ThrowIfNotEquals(true, StructTest_Sequential2(ss3), "Struct marshalling scenario1 failed."); ExplicitStruct es = new ExplicitStruct(); es.f1 = 100; es.f2 = 100.0f; es.f3 = "Hello"; ThrowIfNotEquals(true, StructTest_Explicit(es), "Struct marshalling scenario4 failed."); NestedStruct ns = new NestedStruct(); ns.f1 = 100; ns.f2 = es; ThrowIfNotEquals(true, StructTest_Nested(ns), "Struct marshalling scenario5 failed."); SequentialStruct[] ssa = null; ThrowIfNotEquals(true, IsNULL(ssa), "Non-blittable array null check failed"); ssa = new SequentialStruct[3]; for (int i = 0; i < 3; i++) { ssa[i].f1 = 0; ssa[i].f1 = i; ssa[i].f2 = i*i; ssa[i].f3 = i.LowLevelToString(); } ThrowIfNotEquals(true, StructTest_Array(ssa, ssa.Length), "Array of struct marshalling failed"); InlineString ils = new InlineString(); InlineStringTest(ref ils); ThrowIfNotEquals("Hello World!", ils.name, "Inline string marshalling failed"); InlineArrayStruct ias = new InlineArrayStruct(); ias.inlineArray = new short[128]; for (short i = 0; i < 128; i++) { ias.inlineArray[i] = i; } ias.inlineString = "Hello"; InlineUnicodeStruct ius = new InlineUnicodeStruct(); ius.inlineString = "Hello World"; ThrowIfNotEquals(true, InlineArrayTest(ref ias, ref ius), "inline array marshalling failed"); bool pass = true; for (short i = 0; i < 128; i++) { if (ias.inlineArray[i] != i + 1) { pass = false; } } ThrowIfNotEquals(true, pass, "inline array marshalling failed"); ThrowIfNotEquals("Hello World", ias.inlineString, "Inline ByValTStr Ansi marshalling failed"); ThrowIfNotEquals("Hello World", ius.inlineString, "Inline ByValTStr Unicode marshalling failed"); pass = false; AutoStruct autoStruct = new AutoStruct(); try { // passing struct with Auto layout should throw exception. StructTest_Auto(autoStruct); } catch (Exception) { pass = true; } ThrowIfNotEquals(true, pass, "Struct marshalling scenario6 failed."); Callbacks callbacks = new Callbacks(); callbacks.callback0 = new Callback0(callbackFunc0); callbacks.callback1 = new Callback1(callbackFunc1); callbacks.callback2 = new Callback2(callbackFunc2); ThrowIfNotEquals(true, RegisterCallbacks(ref callbacks), "Scenario 7: Struct with delegate marshalling failed"); } private static void TestLayoutClassPtr() { SequentialClass ss = new SequentialClass(); ss.f0 = 100; ss.f1 = 1; ss.f2 = 10.0f; ss.f3 = "Hello"; ClassTest(ss); ThrowIfNotEquals(true, ss.f1 == 2 && ss.f2 == 11.0 && ss.f3.Equals("Ifmmp"), "LayoutClassPtr marshalling scenario1 failed."); } #if OPTIMIZED_MODE_WITHOUT_SCANNER [MethodImpl(MethodImplOptions.NoOptimization | MethodImplOptions.NoInlining)] private static void Workaround() { // Ensure there's a standalone method body for these two - this method is marked NoOptimization+NoInlining. Marshal.SizeOf<SequentialClass>(); Marshal.SizeOf<SequentialStruct>(); } #endif private static void TestAsAny() { if (String.Empty.Length > 0) { // Make sure we saw these types being used in marshalling Marshal.SizeOf<SequentialClass>(); Marshal.SizeOf<SequentialStruct>(); #if OPTIMIZED_MODE_WITHOUT_SCANNER Workaround(); #endif } SequentialClass sc = new SequentialClass(); sc.f0 = 100; sc.f1 = 1; sc.f2 = 10.0f; sc.f3 = "Hello"; AsAnyTest(sc); ThrowIfNotEquals(true, sc.f1 == 2 && sc.f2 == 11.0 && sc.f3.Equals("Ifmmp"), "AsAny marshalling scenario1 failed."); SequentialStruct ss = new SequentialStruct(); ss.f0 = 100; ss.f1 = 1; ss.f2 = 10.0f; ss.f3 = "Hello"; object o = ss; AsAnyTest(o); ss = (SequentialStruct)o; ThrowIfNotEquals(true, ss.f1 == 2 && ss.f2 == 11.0 && ss.f3.Equals("Ifmmp"), "AsAny marshalling scenario2 failed."); } private static void TestLayoutClass() { ExplicitClass es = new ExplicitClass(); es.f1 = 100; es.f2 = 100.0f; es.f3 = "Hello"; NestedClass ns = new NestedClass(); ns.f1 = 100; ns.f2 = es; ThrowIfNotEquals(true, StructTest_NestedClass(ns), "LayoutClass marshalling scenario1 failed."); } private static unsafe void TestMarshalStructAPIs() { Console.WriteLine("Testing Marshal APIs for structs"); BlittableStruct bs = new BlittableStruct() { FirstField = 1.0f, SecondField = 2.0f, ThirdField = 3 }; int bs_size = Marshal.SizeOf<BlittableStruct>(bs); ThrowIfNotEquals(40, bs_size, "Marshal.SizeOf<BlittableStruct> failed"); IntPtr bs_memory = Marshal.AllocHGlobal(bs_size); try { Marshal.StructureToPtr<BlittableStruct>(bs, bs_memory, false); // Marshal.PtrToStructure uses reflection // BlittableStruct bs2 = Marshal.PtrToStructure<BlittableStruct>(bs_memory); BlittableStruct bs2 = *(BlittableStruct*)bs_memory; ThrowIfNotEquals(true, bs2.FirstField == 1.0f && bs2.SecondField == 2.0f && bs2.ThirdField == 3 , "BlittableStruct marshalling Marshal API failed"); IntPtr offset = Marshal.OffsetOf<BlittableStruct>("SecondField"); ThrowIfNotEquals(new IntPtr(12), offset, "Struct marshalling OffsetOf failed."); } finally { Marshal.FreeHGlobal(bs_memory); } NonBlittableStruct ts = new NonBlittableStruct() { f1 = 100, f2 = true, f3 = false, f4 = true }; int size = Marshal.SizeOf<NonBlittableStruct>(ts); ThrowIfNotEquals(16, size, "Marshal.SizeOf<NonBlittableStruct> failed"); IntPtr memory = Marshal.AllocHGlobal(size); try { Marshal.StructureToPtr<NonBlittableStruct>(ts, memory, false); // Marshal.PtrToStructure uses reflection // NonBlittableStruct ts2 = Marshal.PtrToStructure<NonBlittableStruct>(memory); // ThrowIfNotEquals(true, ts2.f1 == 100 && ts2.f2 == true && ts2.f3 == false && ts2.f4 == true, "NonBlittableStruct marshalling Marshal API failed"); IntPtr offset = Marshal.OffsetOf<NonBlittableStruct>("f2"); ThrowIfNotEquals(new IntPtr(4), offset, "Struct marshalling OffsetOf failed."); } finally { Marshal.FreeHGlobal(memory); } BlittableClass bc = new BlittableClass() { f1 = 100, f2 = 12345678, f3 = 999, f4 = -4 }; int bc_size = Marshal.SizeOf<BlittableClass>(bc); ThrowIfNotEquals(24, bc_size, "Marshal.SizeOf<BlittableClass> failed"); IntPtr bc_memory = Marshal.AllocHGlobal(bc_size); try { Marshal.StructureToPtr<BlittableClass>(bc, bc_memory, false); BlittableClass bc2 = new BlittableClass(); Marshal.PtrToStructure<BlittableClass>(bc_memory, bc2); ThrowIfNotEquals(true, bc2.f1 == 100 && bc2.f2 == 12345678 && bc2.f3 == 999 && bc2.f4 == -4, "BlittableClass marshalling Marshal API failed"); } finally { Marshal.FreeHGlobal(bc_memory); } NonBlittableClass nbc = new NonBlittableClass() { f1 = false, f2 = true, f3 = 42 }; int nbc_size = Marshal.SizeOf<NonBlittableClass>(nbc); ThrowIfNotEquals(12, nbc_size, "Marshal.SizeOf<NonBlittableClass> failed"); IntPtr nbc_memory = Marshal.AllocHGlobal(nbc_size); try { Marshal.StructureToPtr<NonBlittableClass>(nbc, nbc_memory, false); NonBlittableClass nbc2 = new NonBlittableClass(); Marshal.PtrToStructure<NonBlittableClass>(nbc_memory, nbc2); ThrowIfNotEquals(true, nbc2.f1 == false && nbc2.f2 == true && nbc2.f3 == 42, "NonBlittableClass marshalling Marshal API failed"); } finally { Marshal.FreeHGlobal(nbc_memory); } int cftf_size = Marshal.SizeOf(typeof(ClassForTestingFlowAnalysis)); ThrowIfNotEquals(4, cftf_size, "ClassForTestingFlowAnalysis marshalling Marshal API failed"); } private unsafe static void TestDecimal() { Console.WriteLine("Testing Decimals"); var d = new decimal(100, 101, 102, false, 1); var ret = DecimalTest(d); var expected = new decimal(99, 98, 97, true, 2); ThrowIfNotEquals(ret, expected, "Decimal marshalling failed."); } [UnmanagedCallersOnly] static void UnmanagedCallback() { GC.Collect(); } private static void TestWithoutPreserveSig() { Console.WriteLine("Testing with PreserveSig = false"); ValidateSuccessCall(0); try { const int E_NOTIMPL = -2147467263; ValidateSuccessCall(E_NOTIMPL); throw new Exception("Exception should be thrown for E_NOTIMPL error code"); } catch (NotImplementedException) { } var intResult = ValidateIntResult(0); ThrowIfNotEquals(intResult, 42, "Int32 marshalling failed."); try { const int E_NOTIMPL = -2147467263; intResult = ValidateIntResult(E_NOTIMPL); throw new Exception("Exception should be thrown for E_NOTIMPL error code"); } catch (NotImplementedException) { } var enumResult = ValidateEnumResult(0); ThrowIfNotEquals(enumResult, MagicEnum.MagicResult, "Enum marshalling failed."); } public static unsafe void TestForwardDelegateWithUnmanagedCallersOnly() { Console.WriteLine("Testing Forward Delegate with UnmanagedCallersOnly"); Action a = Marshal.GetDelegateForFunctionPointer<Action>((IntPtr)(void*)(delegate* unmanaged<void>)&UnmanagedCallback); a(); } } public class SafeMemoryHandle : SafeHandle //SafeHandle subclass { [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] public static extern SafeMemoryHandle AllocateMemory(int size); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] public static extern bool ReleaseMemory(IntPtr handle); public SafeMemoryHandle() : base(IntPtr.Zero, true) { } private static readonly IntPtr _invalidHandleValue = new IntPtr(-1); public override bool IsInvalid { get { return handle == IntPtr.Zero || handle == _invalidHandleValue; } } override protected bool ReleaseHandle() { return ReleaseMemory(handle); } } //end of SafeMemoryHandle class public static class LowLevelExtensions { // Int32.ToString() calls into glob/loc garbage that hits CppCodegen limitations public static string LowLevelToString(this int i) { char[] digits = new char[11]; int numDigits = 0; if (i == int.MinValue) return "-2147483648"; bool negative = i < 0; if (negative) i = -i; do { digits[numDigits] = (char)('0' + (i % 10)); numDigits++; i /= 10; } while (i != 0); if (negative) { digits[numDigits] = '-'; numDigits++; } Array.Reverse(digits); return new string(digits, digits.Length - numDigits, numDigits); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. #if MULTIMODULE_BUILD && !DEBUG // Some tests won't work if we're using optimizing codegen, but scanner doesn't run. // This currently happens in optimized multi-obj builds. #define OPTIMIZED_MODE_WITHOUT_SCANNER #endif using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Text; // Make sure the interop data are present even without reflection namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.All)] internal class __BlockAllReflectionAttribute : Attribute { } } // Name of namespace matches the name of the assembly on purpose to // ensure that we can handle this (mostly an issue for C++ code generation). namespace PInvokeTests { internal class Program { [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] private static extern int Square(int intValue); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] private static extern int IsTrue(bool boolValue); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] private static extern int CheckIncremental(int[] array, int sz); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] private static extern int CheckIncremental_Foo(Foo[] array, int sz); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] private static extern int Inc(ref int value); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] private static extern int VerifyByRefFoo(ref Foo value); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode)] private static extern bool GetNextChar(ref char c); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)] private static extern int VerifyAnsiString(string str); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)] private static extern int VerifyAnsiStringOut(out string str); [DllImport("PInvokeNative", EntryPoint = "VerifyAnsiString", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)] private static extern int VerifyUTF8String([MarshalAs(UnmanagedType.LPUTF8Str)] string str); [DllImport("PInvokeNative", EntryPoint = "VerifyAnsiStringOut", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)] private static extern int VerifyUTF8StringOut([Out, MarshalAs(UnmanagedType.LPUTF8Str)] out string str); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)] private static extern int VerifyAnsiStringRef(ref string str); [DllImport("PInvokeNative", EntryPoint = "VerifyAnsiStringRef", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)] private static extern int VerifyAnsiStringInRef([In]ref string str); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode)] private static extern int VerifyUnicodeString(string str); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode)] private static extern int VerifyUnicodeStringOut(out string str); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode)] private static extern int VerifyUnicodeStringRef(ref string str); [DllImport("PInvokeNative", EntryPoint = "VerifyUnicodeStringRef", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode)] private static extern int VerifyUnicodeStringInRef([In]ref string str); [DllImport("PInvokeNative", CharSet = CharSet.Ansi)] private static extern int VerifyAnsiStringArray([In, MarshalAs(UnmanagedType.LPArray)]string[] str); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)] private static extern bool VerifyAnsiCharArrayIn(char[] a); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)] private static extern bool VerifyAnsiCharArrayOut([Out]char[] a); [DllImport("PInvokeNative", CharSet = CharSet.Ansi)] private static extern void ToUpper([In, Out, MarshalAs(UnmanagedType.LPArray)]string[] str); [DllImport("PInvokeNative", CharSet = CharSet.Ansi)] private static extern bool VerifySizeParamIndex( [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] out byte[] arrByte, out byte arrSize); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode, EntryPoint = "VerifyUnicodeStringBuilder")] private static extern int VerifyUnicodeStringBuilder(StringBuilder sb); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode, EntryPoint = "VerifyUnicodeStringBuilder")] private static extern int VerifyUnicodeStringBuilderIn([In]StringBuilder sb); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Unicode)] private static extern int VerifyUnicodeStringBuilderOut([Out]StringBuilder sb); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi, EntryPoint = "VerifyAnsiStringBuilder")] private static extern int VerifyAnsiStringBuilder(StringBuilder sb); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi, EntryPoint = "VerifyAnsiStringBuilder")] private static extern int VerifyAnsiStringBuilderIn([In]StringBuilder sb); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)] private static extern int VerifyAnsiStringBuilderOut([Out]StringBuilder sb); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, EntryPoint = "SafeHandleTest")] public static extern bool HandleRefTest(HandleRef hr, Int64 hrValue); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] public static extern bool SafeHandleTest(SafeMemoryHandle sh1, Int64 sh1Value); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] public static extern int SafeHandleOutTest(out SafeMemoryHandle sh1); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] public static extern int SafeHandleRefTest(ref SafeMemoryHandle sh1, bool change); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, SetLastError = true)] public static extern bool LastErrorTest(); delegate int Delegate_Int(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] static extern bool ReversePInvoke_Int(Delegate_Int del); delegate int Delegate_Int_AggressiveInlining(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, EntryPoint = "ReversePInvoke_Int")] #if OPTIMIZED_MODE_WITHOUT_SCANNER [MethodImpl(MethodImplOptions.NoInlining)] #else [MethodImpl(MethodImplOptions.AggressiveInlining)] #endif static extern bool ReversePInvoke_Int_AggressiveInlining(Delegate_Int_AggressiveInlining del); [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet=CharSet.Ansi)] delegate bool Delegate_String(string s); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] static extern bool ReversePInvoke_String(Delegate_String del); [DllImport("PInvokeNative", EntryPoint="ReversePInvoke_String", CallingConvention = CallingConvention.StdCall)] static extern bool ReversePInvoke_String_Delegate(Delegate del); [DllImport("PInvokeNative", EntryPoint="ReversePInvoke_String", CallingConvention = CallingConvention.StdCall)] static extern bool ReversePInvoke_String_MulticastDelegate(MulticastDelegate del); struct FieldDelegate { public Delegate d; } struct FieldMulticastDelegate { public MulticastDelegate d; } [DllImport("PInvokeNative", EntryPoint="ReversePInvoke_DelegateField", CallingConvention = CallingConvention.StdCall)] static extern bool ReversePInvoke_Field_Delegate(FieldDelegate del); [DllImport("PInvokeNative", EntryPoint="ReversePInvoke_DelegateField", CallingConvention = CallingConvention.StdCall)] static extern bool ReversePInvoke_Field_MulticastDelegate(FieldMulticastDelegate del); [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi)] delegate bool Delegate_OutString([MarshalAs(0x30)] out string s); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] static extern bool ReversePInvoke_OutString(Delegate_OutString del); [UnmanagedFunctionPointer(CallingConvention.StdCall, CharSet = CharSet.Ansi)] delegate bool Delegate_Array([MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 1)] int[] array, IntPtr sz); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] static extern bool ReversePInvoke_Array(Delegate_Array del); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] static extern Delegate_String GetDelegate(); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] static extern bool Callback(ref Delegate_String d); delegate void Delegate_Unused(); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] static extern unsafe int* ReversePInvoke_Unused(Delegate_Unused del); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, EntryPoint = "StructTest")] static extern bool StructTest_Auto(AutoStruct ss); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] static extern bool StructTest_Sequential2(NesterOfSequentialStruct.SequentialStruct ss); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] static extern bool StructTest(SequentialStruct ss); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] static extern void StructTest_ByRef(ref SequentialStruct ss); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, EntryPoint = "StructTest_ByRef")] static extern bool ClassTest([In, Out] SequentialClass ss); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, EntryPoint = "StructTest_ByRef")] static extern bool AsAnyTest([In, Out, MarshalAs(40 /* UnmanagedType.AsAny */)] object o); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] static extern void StructTest_ByOut(out SequentialStruct ss); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] static extern bool StructTest_Explicit(ExplicitStruct es); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] static extern bool StructTest_Nested(NestedStruct ns); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, EntryPoint = "StructTest_Nested")] static extern bool StructTest_NestedClass(NestedClass nc); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] static extern bool StructTest_Array(SequentialStruct []ns, int length); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)] static extern bool IsNULL(char[] a); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, CharSet = CharSet.Ansi)] static extern bool IsNULL(String sb); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] static extern bool IsNULL(Foo[] foo); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] static extern bool IsNULL(SequentialStruct[] foo); [StructLayout(LayoutKind.Sequential, CharSet= CharSet.Ansi, Pack = 4)] public unsafe struct InlineArrayStruct { public int f0; public int f1; public int f2; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] public short[] inlineArray; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 11)] public string inlineString; } [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode, Pack = 4)] public unsafe struct InlineUnicodeStruct { public int f0; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 11)] public string inlineString; } [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] static extern bool InlineArrayTest(ref InlineArrayStruct ias, ref InlineUnicodeStruct ius); [UnmanagedFunctionPointer(CallingConvention.Cdecl, SetLastError = true)] public unsafe delegate void SetLastErrorFuncDelegate(int errorCode); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] internal static extern IntPtr GetFunctionPointer(); [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] internal unsafe struct InlineString { internal uint size; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] internal string name; } [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] static extern bool InlineStringTest(ref InlineString ias); internal delegate int Callback0(); internal delegate int Callback1(); internal delegate int Callback2(); [DllImport("PInvokeNative")] internal static extern bool RegisterCallbacks(ref Callbacks callbacks); [StructLayout(LayoutKind.Sequential)] internal struct Callbacks { public Callback0 callback0; public Callback1 callback1; public Callback2 callback2; } public static int callbackFunc0() { return 0; } public static int callbackFunc1() { return 1; } public static int callbackFunc2() { return 2; } [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, PreserveSig = false)] static extern void ValidateSuccessCall(int errorCode); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall, PreserveSig = false)] static extern int ValidateIntResult(int errorCode); [DllImport("PInvokeNative", EntryPoint = "ValidateIntResult", CallingConvention = CallingConvention.StdCall, PreserveSig = false)] static extern MagicEnum ValidateEnumResult(int errorCode); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] internal static extern decimal DecimalTest(decimal value); internal enum MagicEnum { MagicResult = 42, } public static int Main(string[] args) { TestBlittableType(); TestBoolean(); TestUnichar(); TestArrays(); TestByRef(); TestString(); TestStringBuilder(); TestLastError(); TestHandleRef(); TestSafeHandle(); TestStringArray(); TestSizeParamIndex(); TestDelegate(); TestStruct(); TestLayoutClassPtr(); TestLayoutClass(); TestAsAny(); TestMarshalStructAPIs(); TestWithoutPreserveSig(); TestForwardDelegateWithUnmanagedCallersOnly(); TestDecimal(); return 100; } public static void ThrowIfNotEquals<T>(T expected, T actual, string message) { if (!expected.Equals(actual)) { message += "\nExpected: " + expected.ToString() + "\n"; message += "Actual: " + actual.ToString() + "\n"; throw new Exception(message); } } public static void ThrowIfNotEquals(bool expected, bool actual, string message) { ThrowIfNotEquals(expected ? 1 : 0, actual ? 1 : 0, message); } private static void TestBlittableType() { Console.WriteLine("Testing marshalling blittable types"); ThrowIfNotEquals(100, Square(10), "Int marshalling failed"); } private static void TestBoolean() { Console.WriteLine("Testing marshalling boolean"); ThrowIfNotEquals(1, IsTrue(true), "Bool marshalling failed"); ThrowIfNotEquals(0, IsTrue(false), "Bool marshalling failed"); } private static void TestUnichar() { Console.WriteLine("Testing Unichar"); char c = 'a'; ThrowIfNotEquals(true, GetNextChar(ref c), "Unichar marshalling failed."); ThrowIfNotEquals('b', c, "Unichar marshalling failed."); } struct Foo { public int a; public float b; } private static void TestArrays() { Console.WriteLine("Testing marshalling int arrays"); const int ArraySize = 100; int[] arr = new int[ArraySize]; for (int i = 0; i < ArraySize; i++) arr[i] = i; ThrowIfNotEquals(0, CheckIncremental(arr, ArraySize), "Array marshalling failed"); Console.WriteLine("Testing marshalling blittable struct arrays"); Foo[] arr_foo = null; ThrowIfNotEquals(true, IsNULL(arr_foo), "Blittable array null check failed"); arr_foo = new Foo[ArraySize]; for (int i = 0; i < ArraySize; i++) { arr_foo[i].a = i; arr_foo[i].b = i; } ThrowIfNotEquals(0, CheckIncremental_Foo(arr_foo, ArraySize), "Array marshalling failed"); char[] a = "Hello World".ToCharArray(); ThrowIfNotEquals(true, VerifyAnsiCharArrayIn(a), "Ansi Char Array In failed"); char[] b = new char[12]; ThrowIfNotEquals(true, VerifyAnsiCharArrayOut(b), "Ansi Char Array Out failed"); ThrowIfNotEquals("Hello World!", new String(b), "Ansi Char Array Out failed2"); char[] c = null; ThrowIfNotEquals(true, IsNULL(c), "AnsiChar Array null check failed"); } private static void TestByRef() { Console.WriteLine("Testing marshalling by ref"); int value = 100; ThrowIfNotEquals(0, Inc(ref value), "By ref marshalling failed"); ThrowIfNotEquals(101, value, "By ref marshalling failed"); Foo foo = new Foo(); foo.a = 10; foo.b = 20; int ret = VerifyByRefFoo(ref foo); ThrowIfNotEquals(0, ret, "By ref struct marshalling failed"); ThrowIfNotEquals(foo.a, 11, "By ref struct unmarshalling failed"); ThrowIfNotEquals(foo.b, 21.0f, "By ref struct unmarshalling failed"); } private static void TestString() { Console.WriteLine("Testing marshalling string"); ThrowIfNotEquals(1, VerifyAnsiString("Hello World"), "Ansi String marshalling failed."); ThrowIfNotEquals(1, VerifyUnicodeString("Hello World"), "Unicode String marshalling failed."); string s; ThrowIfNotEquals(1, VerifyAnsiStringOut(out s), "Out Ansi String marshalling failed"); ThrowIfNotEquals("Hello World", s, "Out Ansi String marshalling failed"); VerifyAnsiStringInRef(ref s); ThrowIfNotEquals("Hello World", s, "In Ref ansi String marshalling failed"); VerifyAnsiStringRef(ref s); ThrowIfNotEquals("Hello World!", s, "Ref ansi String marshalling failed"); ThrowIfNotEquals(1, VerifyUnicodeStringOut(out s), "Out Unicode String marshalling failed"); ThrowIfNotEquals("Hello World", s, "Out Unicode String marshalling failed"); VerifyUnicodeStringInRef(ref s); ThrowIfNotEquals("Hello World", s, "In Ref Unicode String marshalling failed"); VerifyUnicodeStringRef(ref s); ThrowIfNotEquals("Hello World!", s, "Ref Unicode String marshalling failed"); string ss = null; ThrowIfNotEquals(true, IsNULL(ss), "Ansi String null check failed"); ThrowIfNotEquals(1, VerifyUTF8String("Hello World"), "UTF8 String marshalling failed."); ThrowIfNotEquals(1, VerifyUTF8StringOut(out s), "Out UTF8 String marshalling failed"); ThrowIfNotEquals("Hello World", s, "Out UTF8 String marshalling failed"); } private static void TestStringBuilder() { Console.WriteLine("Testing marshalling string builder"); StringBuilder sb = new StringBuilder("Hello World"); ThrowIfNotEquals(1, VerifyUnicodeStringBuilder(sb), "Unicode StringBuilder marshalling failed"); ThrowIfNotEquals("HELLO WORLD", sb.ToString(), "Unicode StringBuilder marshalling failed."); StringBuilder sb1 = null; // for null stringbuilder it should return -1 ThrowIfNotEquals(-1, VerifyUnicodeStringBuilder(sb1), "Null unicode StringBuilder marshalling failed"); StringBuilder sb2 = new StringBuilder("Hello World"); ThrowIfNotEquals(1, VerifyUnicodeStringBuilderIn(sb2), "In unicode StringBuilder marshalling failed"); // Only [In] should change stringbuilder value ThrowIfNotEquals("Hello World", sb2.ToString(), "In unicode StringBuilder marshalling failed"); StringBuilder sb3 = new StringBuilder(); ThrowIfNotEquals(1, VerifyUnicodeStringBuilderOut(sb3), "Out Unicode string marshalling failed"); ThrowIfNotEquals("Hello World", sb3.ToString(), "Out Unicode StringBuilder marshalling failed"); StringBuilder sb4 = new StringBuilder("Hello World"); ThrowIfNotEquals(1, VerifyAnsiStringBuilder(sb4), "Ansi StringBuilder marshalling failed"); ThrowIfNotEquals("HELLO WORLD", sb4.ToString(), "Ansi StringBuilder marshalling failed."); StringBuilder sb5 = null; // for null stringbuilder it should return -1 ThrowIfNotEquals(-1, VerifyAnsiStringBuilder(sb5), "Null Ansi StringBuilder marshalling failed"); StringBuilder sb6 = new StringBuilder("Hello World"); ThrowIfNotEquals(1, VerifyAnsiStringBuilderIn(sb6), "In unicode StringBuilder marshalling failed"); // Only [In] should change stringbuilder value ThrowIfNotEquals("Hello World", sb6.ToString(), "In unicode StringBuilder marshalling failed"); StringBuilder sb7 = new StringBuilder(); ThrowIfNotEquals(1, VerifyAnsiStringBuilderOut(sb7), "Out Ansi string marshalling failed"); ThrowIfNotEquals("Hello World!", sb7.ToString(), "Out Ansi StringBuilder marshalling failed"); } private static void TestStringArray() { Console.WriteLine("Testing marshalling string array"); string[] strArray = new string[] { "Hello", "World" }; ThrowIfNotEquals(1, VerifyAnsiStringArray(strArray), "Ansi string array in marshalling failed."); ToUpper(strArray); ThrowIfNotEquals(true, "HELLO" == strArray[0] && "WORLD" == strArray[1], "Ansi string array out marshalling failed."); } private static void TestLastError() { Console.WriteLine("Testing last error"); ThrowIfNotEquals(true, LastErrorTest(), "GetLastWin32Error is not zero"); ThrowIfNotEquals(12345, Marshal.GetLastWin32Error(), "Last Error test failed"); } private static void TestHandleRef() { Console.WriteLine("Testing marshalling HandleRef"); ThrowIfNotEquals(true, HandleRefTest(new HandleRef(new object(), (IntPtr)2018), 2018), "HandleRef marshalling failed"); } private static void TestSafeHandle() { Console.WriteLine("Testing marshalling SafeHandle"); SafeMemoryHandle hnd = SafeMemoryHandle.AllocateMemory(1000); IntPtr hndIntPtr = hnd.DangerousGetHandle(); //get the IntPtr associated with hnd long val = hndIntPtr.ToInt64(); //return the 64-bit value associated with hnd ThrowIfNotEquals(true, SafeHandleTest(hnd, val), "SafeHandle marshalling failed."); Console.WriteLine("Testing marshalling out SafeHandle"); SafeMemoryHandle hnd2; int actual = SafeHandleOutTest(out hnd2); int expected = unchecked((int)hnd2.DangerousGetHandle().ToInt64()); ThrowIfNotEquals(actual, expected, "SafeHandle out marshalling failed"); Console.WriteLine("Testing marshalling ref SafeHandle"); SafeMemoryHandle hndOriginal = hnd2; SafeHandleRefTest(ref hnd2, false); ThrowIfNotEquals(hndOriginal, hnd2, "SafeHandle no-op ref marshalling failed"); int actual3 = SafeHandleRefTest(ref hnd2, true); int expected3 = unchecked((int)hnd2.DangerousGetHandle().ToInt64()); ThrowIfNotEquals(actual3, expected3, "SafeHandle ref marshalling failed"); hndOriginal.Dispose(); hnd2.Dispose(); } private static void TestSizeParamIndex() { Console.WriteLine("Testing SizeParamIndex"); byte byte_Array_Size; byte[] arrByte; VerifySizeParamIndex(out arrByte, out byte_Array_Size); ThrowIfNotEquals(10, byte_Array_Size, "out size failed."); bool pass = true; for (int i = 0; i < byte_Array_Size; i++) { if (arrByte[i] != i) { pass = false; break; } } ThrowIfNotEquals(true, pass, "SizeParamIndex failed."); } private class ClosedDelegateCLass { public int Sum(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j) { return a + b + c + d + e + f + g + h + i + j; } public bool GetString(String s) { return s == "Hello World"; } public bool CheckArray(int[] a, IntPtr sz) { if (sz != new IntPtr(42)) return false; for (int i = 0; i < (int)sz; i++) { if (a[i] != i) return false; } return true; } } private static void TestDelegate() { Console.WriteLine("Testing Delegate"); Delegate_Int del = new Delegate_Int(Sum); ThrowIfNotEquals(true, ReversePInvoke_Int(del), "Delegate marshalling failed."); Delegate_Int_AggressiveInlining del_aggressive = new Delegate_Int_AggressiveInlining(Sum); ThrowIfNotEquals(true, ReversePInvoke_Int_AggressiveInlining(del_aggressive), "Delegate marshalling with aggressive inlining failed."); unsafe { // // We haven't instantiated Delegate_Unused and nobody // allocates it. If a EEType is not constructed for Delegate_Unused // it will fail during linking. // ReversePInvoke_Unused(null); } Delegate_Int closed = new Delegate_Int((new ClosedDelegateCLass()).Sum); ThrowIfNotEquals(true, ReversePInvoke_Int(closed), "Closed Delegate marshalling failed."); Delegate_String ret = GetDelegate(); ThrowIfNotEquals(true, ret("Hello World!"), "Delegate as P/Invoke return failed"); Delegate_String d = new Delegate_String(new ClosedDelegateCLass().GetString); ThrowIfNotEquals(true, Callback(ref d), "Delegate IN marshalling failed"); ThrowIfNotEquals(true, d("Hello World!"), "Delegate OUT marshalling failed"); Delegate_String ds = new Delegate_String((new ClosedDelegateCLass()).GetString); ThrowIfNotEquals(true, ReversePInvoke_String(ds), "Delegate marshalling failed."); ThrowIfNotEquals(true, ReversePInvoke_String_Delegate(ds), "Delegate marshalling failed."); ThrowIfNotEquals(true, ReversePInvoke_String_MulticastDelegate(ds), "Delegate marshalling failed."); FieldDelegate fd; fd.d = ds; ThrowIfNotEquals(true, ReversePInvoke_Field_Delegate(fd), "Delegate marshalling failed."); FieldMulticastDelegate fmd; fmd.d = ds; ThrowIfNotEquals(true, ReversePInvoke_Field_MulticastDelegate(fmd), "Delegate marshalling failed."); Delegate_OutString dos = new Delegate_OutString((out string x) => { x = "Hello there!"; return true; }); ThrowIfNotEquals(true, ReversePInvoke_OutString(dos), "Delegate string out marshalling failed."); Delegate_Array da = new Delegate_Array((new ClosedDelegateCLass()).CheckArray); ThrowIfNotEquals(true, ReversePInvoke_Array(da), "Delegate array marshalling failed."); IntPtr procAddress = GetFunctionPointer(); SetLastErrorFuncDelegate funcDelegate = Marshal.GetDelegateForFunctionPointer<SetLastErrorFuncDelegate>(procAddress); funcDelegate(0x204); ThrowIfNotEquals(0x204, Marshal.GetLastWin32Error(), "Not match"); } static int Sum(int a, int b, int c, int d, int e, int f, int g, int h, int i, int j) { return a + b + c + d + e + f + g + h + i + j; } [StructLayout(LayoutKind.Auto)] public struct AutoStruct { public short f0; public int f1; public float f2; [MarshalAs(UnmanagedType.LPStr)] public String f3; } [StructLayout(LayoutKind.Sequential)] public struct SequentialStruct { // NOTE: Same members as SequentialClass below public short f0; public int f1; public float f2; [MarshalAs(UnmanagedType.LPStr)] public String f3; } [StructLayout(LayoutKind.Sequential)] public class SequentialClass { // NOTE: Same members as SequentialStruct above public short f0; public int f1; public float f2; [MarshalAs(UnmanagedType.LPStr)] public String f3; } // A second struct with the same name but nested. Regression test against native types being mangled into // the compiler-generated type and losing fully qualified type name information. class NesterOfSequentialStruct { [StructLayout(LayoutKind.Sequential)] public struct SequentialStruct { public float f1; public int f2; } } [StructLayout(LayoutKind.Explicit)] public struct ExplicitStruct { // NOTE: Same layout as ExplicitClass [FieldOffset(0)] public int f1; [FieldOffset(12)] public float f2; [FieldOffset(24)] [MarshalAs(UnmanagedType.LPStr)] public String f3; } [StructLayout(LayoutKind.Explicit)] public class ExplicitClass { // NOTE: Same layout as ExplicitStruct [FieldOffset(0)] public int f1; [FieldOffset(12)] public float f2; [FieldOffset(24)] [MarshalAs(UnmanagedType.LPStr)] public String f3; } [StructLayout(LayoutKind.Sequential)] public struct NestedStruct { public int f1; public ExplicitStruct f2; } [StructLayout(LayoutKind.Sequential)] public struct NestedClass { public int f1; public ExplicitClass f2; } [StructLayout(LayoutKind.Explicit)] public struct BlittableStruct { [FieldOffset(4)] public float FirstField; [FieldOffset(12)] public float SecondField; [FieldOffset(32)] public long ThirdField; } [StructLayout(LayoutKind.Sequential)] public struct NonBlittableStruct { public int f1; public bool f2; public bool f3; public bool f4; } [StructLayout(LayoutKind.Sequential)] public class BlittableClass { public long f1; public int f2; public int f3; public long f4; } [StructLayout(LayoutKind.Sequential)] public class NonBlittableClass { public bool f1; public bool f2; public int f3; } [StructLayout(LayoutKind.Sequential)] public class ClassForTestingFlowAnalysis { public int Field; } private static void TestStruct() { Console.WriteLine("Testing Structs"); SequentialStruct ss = new SequentialStruct(); ss.f0 = 100; ss.f1 = 1; ss.f2 = 10.0f; ss.f3 = "Hello"; ThrowIfNotEquals(true, StructTest(ss), "Struct marshalling scenario1 failed."); StructTest_ByRef(ref ss); ThrowIfNotEquals(true, ss.f1 == 2 && ss.f2 == 11.0 && ss.f3.Equals("Ifmmp"), "Struct marshalling scenario2 failed."); SequentialStruct ss2 = new SequentialStruct(); StructTest_ByOut(out ss2); ThrowIfNotEquals(true, ss2.f0 == 1 && ss2.f1 == 1.0 && ss2.f2 == 1.0 && ss2.f3.Equals("0123456"), "Struct marshalling scenario3 failed."); NesterOfSequentialStruct.SequentialStruct ss3 = new NesterOfSequentialStruct.SequentialStruct(); ss3.f1 = 10.0f; ss3.f2 = 123; ThrowIfNotEquals(true, StructTest_Sequential2(ss3), "Struct marshalling scenario1 failed."); ExplicitStruct es = new ExplicitStruct(); es.f1 = 100; es.f2 = 100.0f; es.f3 = "Hello"; ThrowIfNotEquals(true, StructTest_Explicit(es), "Struct marshalling scenario4 failed."); NestedStruct ns = new NestedStruct(); ns.f1 = 100; ns.f2 = es; ThrowIfNotEquals(true, StructTest_Nested(ns), "Struct marshalling scenario5 failed."); SequentialStruct[] ssa = null; ThrowIfNotEquals(true, IsNULL(ssa), "Non-blittable array null check failed"); ssa = new SequentialStruct[3]; for (int i = 0; i < 3; i++) { ssa[i].f1 = 0; ssa[i].f1 = i; ssa[i].f2 = i*i; ssa[i].f3 = i.LowLevelToString(); } ThrowIfNotEquals(true, StructTest_Array(ssa, ssa.Length), "Array of struct marshalling failed"); InlineString ils = new InlineString(); InlineStringTest(ref ils); ThrowIfNotEquals("Hello World!", ils.name, "Inline string marshalling failed"); InlineArrayStruct ias = new InlineArrayStruct(); ias.inlineArray = new short[128]; for (short i = 0; i < 128; i++) { ias.inlineArray[i] = i; } ias.inlineString = "Hello"; InlineUnicodeStruct ius = new InlineUnicodeStruct(); ius.inlineString = "Hello World"; ThrowIfNotEquals(true, InlineArrayTest(ref ias, ref ius), "inline array marshalling failed"); bool pass = true; for (short i = 0; i < 128; i++) { if (ias.inlineArray[i] != i + 1) { pass = false; } } ThrowIfNotEquals(true, pass, "inline array marshalling failed"); ThrowIfNotEquals("Hello World", ias.inlineString, "Inline ByValTStr Ansi marshalling failed"); ThrowIfNotEquals("Hello World", ius.inlineString, "Inline ByValTStr Unicode marshalling failed"); pass = false; AutoStruct autoStruct = new AutoStruct(); try { // passing struct with Auto layout should throw exception. StructTest_Auto(autoStruct); } catch (Exception) { pass = true; } ThrowIfNotEquals(true, pass, "Struct marshalling scenario6 failed."); Callbacks callbacks = new Callbacks(); callbacks.callback0 = new Callback0(callbackFunc0); callbacks.callback1 = new Callback1(callbackFunc1); callbacks.callback2 = new Callback2(callbackFunc2); ThrowIfNotEquals(true, RegisterCallbacks(ref callbacks), "Scenario 7: Struct with delegate marshalling failed"); } private static void TestLayoutClassPtr() { SequentialClass ss = new SequentialClass(); ss.f0 = 100; ss.f1 = 1; ss.f2 = 10.0f; ss.f3 = "Hello"; ClassTest(ss); ThrowIfNotEquals(true, ss.f1 == 2 && ss.f2 == 11.0 && ss.f3.Equals("Ifmmp"), "LayoutClassPtr marshalling scenario1 failed."); } #if OPTIMIZED_MODE_WITHOUT_SCANNER [MethodImpl(MethodImplOptions.NoOptimization | MethodImplOptions.NoInlining)] private static void Workaround() { // Ensure there's a standalone method body for these two - this method is marked NoOptimization+NoInlining. Marshal.SizeOf<SequentialClass>(); Marshal.SizeOf<SequentialStruct>(); } #endif private static void TestAsAny() { if (String.Empty.Length > 0) { // Make sure we saw these types being used in marshalling Marshal.SizeOf<SequentialClass>(); Marshal.SizeOf<SequentialStruct>(); #if OPTIMIZED_MODE_WITHOUT_SCANNER Workaround(); #endif } SequentialClass sc = new SequentialClass(); sc.f0 = 100; sc.f1 = 1; sc.f2 = 10.0f; sc.f3 = "Hello"; AsAnyTest(sc); ThrowIfNotEquals(true, sc.f1 == 2 && sc.f2 == 11.0 && sc.f3.Equals("Ifmmp"), "AsAny marshalling scenario1 failed."); SequentialStruct ss = new SequentialStruct(); ss.f0 = 100; ss.f1 = 1; ss.f2 = 10.0f; ss.f3 = "Hello"; object o = ss; AsAnyTest(o); ss = (SequentialStruct)o; ThrowIfNotEquals(true, ss.f1 == 2 && ss.f2 == 11.0 && ss.f3.Equals("Ifmmp"), "AsAny marshalling scenario2 failed."); } private static void TestLayoutClass() { ExplicitClass es = new ExplicitClass(); es.f1 = 100; es.f2 = 100.0f; es.f3 = "Hello"; NestedClass ns = new NestedClass(); ns.f1 = 100; ns.f2 = es; ThrowIfNotEquals(true, StructTest_NestedClass(ns), "LayoutClass marshalling scenario1 failed."); } private static unsafe void TestMarshalStructAPIs() { Console.WriteLine("Testing Marshal APIs for structs"); BlittableStruct bs = new BlittableStruct() { FirstField = 1.0f, SecondField = 2.0f, ThirdField = 3 }; int bs_size = Marshal.SizeOf<BlittableStruct>(bs); ThrowIfNotEquals(40, bs_size, "Marshal.SizeOf<BlittableStruct> failed"); IntPtr bs_memory = Marshal.AllocHGlobal(bs_size); try { Marshal.StructureToPtr<BlittableStruct>(bs, bs_memory, false); // Marshal.PtrToStructure uses reflection // BlittableStruct bs2 = Marshal.PtrToStructure<BlittableStruct>(bs_memory); BlittableStruct bs2 = *(BlittableStruct*)bs_memory; ThrowIfNotEquals(true, bs2.FirstField == 1.0f && bs2.SecondField == 2.0f && bs2.ThirdField == 3 , "BlittableStruct marshalling Marshal API failed"); IntPtr offset = Marshal.OffsetOf<BlittableStruct>("SecondField"); ThrowIfNotEquals(new IntPtr(12), offset, "Struct marshalling OffsetOf failed."); } finally { Marshal.FreeHGlobal(bs_memory); } NonBlittableStruct ts = new NonBlittableStruct() { f1 = 100, f2 = true, f3 = false, f4 = true }; int size = Marshal.SizeOf<NonBlittableStruct>(ts); ThrowIfNotEquals(16, size, "Marshal.SizeOf<NonBlittableStruct> failed"); IntPtr memory = Marshal.AllocHGlobal(size); try { Marshal.StructureToPtr<NonBlittableStruct>(ts, memory, false); // Marshal.PtrToStructure uses reflection // NonBlittableStruct ts2 = Marshal.PtrToStructure<NonBlittableStruct>(memory); // ThrowIfNotEquals(true, ts2.f1 == 100 && ts2.f2 == true && ts2.f3 == false && ts2.f4 == true, "NonBlittableStruct marshalling Marshal API failed"); IntPtr offset = Marshal.OffsetOf<NonBlittableStruct>("f2"); ThrowIfNotEquals(new IntPtr(4), offset, "Struct marshalling OffsetOf failed."); } finally { Marshal.FreeHGlobal(memory); } BlittableClass bc = new BlittableClass() { f1 = 100, f2 = 12345678, f3 = 999, f4 = -4 }; int bc_size = Marshal.SizeOf<BlittableClass>(bc); ThrowIfNotEquals(24, bc_size, "Marshal.SizeOf<BlittableClass> failed"); IntPtr bc_memory = Marshal.AllocHGlobal(bc_size); try { Marshal.StructureToPtr<BlittableClass>(bc, bc_memory, false); BlittableClass bc2 = new BlittableClass(); Marshal.PtrToStructure<BlittableClass>(bc_memory, bc2); ThrowIfNotEquals(true, bc2.f1 == 100 && bc2.f2 == 12345678 && bc2.f3 == 999 && bc2.f4 == -4, "BlittableClass marshalling Marshal API failed"); } finally { Marshal.FreeHGlobal(bc_memory); } NonBlittableClass nbc = new NonBlittableClass() { f1 = false, f2 = true, f3 = 42 }; int nbc_size = Marshal.SizeOf<NonBlittableClass>(nbc); ThrowIfNotEquals(12, nbc_size, "Marshal.SizeOf<NonBlittableClass> failed"); IntPtr nbc_memory = Marshal.AllocHGlobal(nbc_size); try { Marshal.StructureToPtr<NonBlittableClass>(nbc, nbc_memory, false); NonBlittableClass nbc2 = new NonBlittableClass(); Marshal.PtrToStructure<NonBlittableClass>(nbc_memory, nbc2); ThrowIfNotEquals(true, nbc2.f1 == false && nbc2.f2 == true && nbc2.f3 == 42, "NonBlittableClass marshalling Marshal API failed"); } finally { Marshal.FreeHGlobal(nbc_memory); } int cftf_size = Marshal.SizeOf(typeof(ClassForTestingFlowAnalysis)); ThrowIfNotEquals(4, cftf_size, "ClassForTestingFlowAnalysis marshalling Marshal API failed"); } private unsafe static void TestDecimal() { Console.WriteLine("Testing Decimals"); var d = new decimal(100, 101, 102, false, 1); var ret = DecimalTest(d); var expected = new decimal(99, 98, 97, true, 2); ThrowIfNotEquals(ret, expected, "Decimal marshalling failed."); } [UnmanagedCallersOnly] static void UnmanagedCallback() { GC.Collect(); } private static void TestWithoutPreserveSig() { Console.WriteLine("Testing with PreserveSig = false"); ValidateSuccessCall(0); try { const int E_NOTIMPL = -2147467263; ValidateSuccessCall(E_NOTIMPL); throw new Exception("Exception should be thrown for E_NOTIMPL error code"); } catch (NotImplementedException) { } var intResult = ValidateIntResult(0); ThrowIfNotEquals(intResult, 42, "Int32 marshalling failed."); try { const int E_NOTIMPL = -2147467263; intResult = ValidateIntResult(E_NOTIMPL); throw new Exception("Exception should be thrown for E_NOTIMPL error code"); } catch (NotImplementedException) { } var enumResult = ValidateEnumResult(0); ThrowIfNotEquals(enumResult, MagicEnum.MagicResult, "Enum marshalling failed."); } public static unsafe void TestForwardDelegateWithUnmanagedCallersOnly() { Console.WriteLine("Testing Forward Delegate with UnmanagedCallersOnly"); Action a = Marshal.GetDelegateForFunctionPointer<Action>((IntPtr)(void*)(delegate* unmanaged<void>)&UnmanagedCallback); a(); } } public class SafeMemoryHandle : SafeHandle //SafeHandle subclass { [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] public static extern SafeMemoryHandle AllocateMemory(int size); [DllImport("PInvokeNative", CallingConvention = CallingConvention.StdCall)] public static extern bool ReleaseMemory(IntPtr handle); public SafeMemoryHandle() : base(IntPtr.Zero, true) { } private static readonly IntPtr _invalidHandleValue = new IntPtr(-1); public override bool IsInvalid { get { return handle == IntPtr.Zero || handle == _invalidHandleValue; } } override protected bool ReleaseHandle() { return ReleaseMemory(handle); } } //end of SafeMemoryHandle class public static class LowLevelExtensions { // Int32.ToString() calls into glob/loc garbage that hits CppCodegen limitations public static string LowLevelToString(this int i) { char[] digits = new char[11]; int numDigits = 0; if (i == int.MinValue) return "-2147483648"; bool negative = i < 0; if (negative) i = -i; do { digits[numDigits] = (char)('0' + (i % 10)); numDigits++; i /= 10; } while (i != 0); if (negative) { digits[numDigits] = '-'; numDigits++; } Array.Reverse(digits); return new string(digits, digits.Length - numDigits, numDigits); } } }
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/coreclr/nativeaot/System.Private.CoreLib/src/System/Runtime/ExceptionIDs.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. namespace System.Runtime { public enum ExceptionIDs { OutOfMemory = 1, Arithmetic = 2, ArrayTypeMismatch = 3, DivideByZero = 4, IndexOutOfRange = 5, InvalidCast = 6, Overflow = 7, NullReference = 8, AccessViolation = 9, DataMisaligned = 10, EntrypointNotFound = 11, AmbiguousImplementation = 12, } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. namespace System.Runtime { public enum ExceptionIDs { OutOfMemory = 1, Arithmetic = 2, ArrayTypeMismatch = 3, DivideByZero = 4, IndexOutOfRange = 5, InvalidCast = 6, Overflow = 7, NullReference = 8, AccessViolation = 9, DataMisaligned = 10, EntrypointNotFound = 11, AmbiguousImplementation = 12, } }
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/libraries/System.Private.CoreLib/src/System/Guid.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Buffers.Binary; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; namespace System { // Represents a Globally Unique Identifier. [StructLayout(LayoutKind.Sequential)] [Serializable] [NonVersionable] // This only applies to field layout [TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public readonly partial struct Guid : ISpanFormattable, IComparable, IComparable<Guid>, IEquatable<Guid> #if FEATURE_GENERIC_MATH #pragma warning disable SA1001, CA2252 // SA1001: Comma positioning; CA2252: Preview Features , IComparisonOperators<Guid, Guid>, ISpanParseable<Guid> #pragma warning restore SA1001, CA2252 #endif // FEATURE_GENERIC_MATH { public static readonly Guid Empty; private readonly int _a; // Do not rename (binary serialization) private readonly short _b; // Do not rename (binary serialization) private readonly short _c; // Do not rename (binary serialization) private readonly byte _d; // Do not rename (binary serialization) private readonly byte _e; // Do not rename (binary serialization) private readonly byte _f; // Do not rename (binary serialization) private readonly byte _g; // Do not rename (binary serialization) private readonly byte _h; // Do not rename (binary serialization) private readonly byte _i; // Do not rename (binary serialization) private readonly byte _j; // Do not rename (binary serialization) private readonly byte _k; // Do not rename (binary serialization) // Creates a new guid from an array of bytes. public Guid(byte[] b!!) : this(new ReadOnlySpan<byte>(b)) { } // Creates a new guid from a read-only span. public Guid(ReadOnlySpan<byte> b) { if ((uint)b.Length != 16) { throw new ArgumentException(SR.Format(SR.Arg_GuidArrayCtor, "16"), nameof(b)); } if (BitConverter.IsLittleEndian) { this = MemoryMarshal.Read<Guid>(b); return; } // slower path for BigEndian: _k = b[15]; // hoist bounds checks _a = BinaryPrimitives.ReadInt32LittleEndian(b); _b = BinaryPrimitives.ReadInt16LittleEndian(b.Slice(4)); _c = BinaryPrimitives.ReadInt16LittleEndian(b.Slice(6)); _d = b[8]; _e = b[9]; _f = b[10]; _g = b[11]; _h = b[12]; _i = b[13]; _j = b[14]; } [CLSCompliant(false)] public Guid(uint a, ushort b, ushort c, byte d, byte e, byte f, byte g, byte h, byte i, byte j, byte k) { _a = (int)a; _b = (short)b; _c = (short)c; _d = d; _e = e; _f = f; _g = g; _h = h; _i = i; _j = j; _k = k; } // Creates a new GUID initialized to the value represented by the arguments. public Guid(int a, short b, short c, byte[] d!!) { if (d.Length != 8) { throw new ArgumentException(SR.Format(SR.Arg_GuidArrayCtor, "8"), nameof(d)); } _a = a; _b = b; _c = c; _k = d[7]; // hoist bounds checks _d = d[0]; _e = d[1]; _f = d[2]; _g = d[3]; _h = d[4]; _i = d[5]; _j = d[6]; } // Creates a new GUID initialized to the value represented by the // arguments. The bytes are specified like this to avoid endianness issues. public Guid(int a, short b, short c, byte d, byte e, byte f, byte g, byte h, byte i, byte j, byte k) { _a = a; _b = b; _c = c; _d = d; _e = e; _f = f; _g = g; _h = h; _i = i; _j = j; _k = k; } private enum GuidParseThrowStyle : byte { None = 0, All = 1, AllButOverflow = 2 } // This will store the result of the parsing. And it will eventually be used to construct a Guid instance. // We'll eventually reinterpret_cast<> a GuidResult as a Guid, so we need to give it a sequential // layout and ensure that its early fields match the layout of Guid exactly. [StructLayout(LayoutKind.Explicit)] private struct GuidResult { [FieldOffset(0)] internal uint _a; [FieldOffset(4)] internal uint _bc; [FieldOffset(4)] internal ushort _b; [FieldOffset(6)] internal ushort _c; [FieldOffset(8)] internal uint _defg; [FieldOffset(8)] internal ushort _de; [FieldOffset(8)] internal byte _d; [FieldOffset(10)] internal ushort _fg; [FieldOffset(12)] internal uint _hijk; [FieldOffset(16)] private readonly GuidParseThrowStyle _throwStyle; internal GuidResult(GuidParseThrowStyle canThrow) : this() { _throwStyle = canThrow; } internal readonly void SetFailure(bool overflow, string failureMessageID) { if (_throwStyle == GuidParseThrowStyle.None) { return; } if (overflow) { if (_throwStyle == GuidParseThrowStyle.All) { throw new OverflowException(SR.GetResourceString(failureMessageID)); } throw new FormatException(SR.Format_GuidUnrecognized); } throw new FormatException(SR.GetResourceString(failureMessageID)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public readonly Guid ToGuid() { return Unsafe.As<GuidResult, Guid>(ref Unsafe.AsRef(in this)); } public void ReverseAbcEndianness() { _a = BinaryPrimitives.ReverseEndianness(_a); _b = BinaryPrimitives.ReverseEndianness(_b); _c = BinaryPrimitives.ReverseEndianness(_c); } } // Creates a new guid based on the value in the string. The value is made up // of hex digits speared by the dash ("-"). The string may begin and end with // brackets ("{", "}"). // // The string must be of the form dddddddd-dddd-dddd-dddd-dddddddddddd. where // d is a hex digit. (That is 8 hex digits, followed by 4, then 4, then 4, // then 12) such as: "CA761232-ED42-11CE-BACD-00AA0057B223" public Guid(string g!!) { var result = new GuidResult(GuidParseThrowStyle.All); bool success = TryParseGuid(g, ref result); Debug.Assert(success, "GuidParseThrowStyle.All means throw on all failures"); this = result.ToGuid(); } public static Guid Parse(string input!!) => Parse((ReadOnlySpan<char>)input); public static Guid Parse(ReadOnlySpan<char> input) { var result = new GuidResult(GuidParseThrowStyle.AllButOverflow); bool success = TryParseGuid(input, ref result); Debug.Assert(success, "GuidParseThrowStyle.AllButOverflow means throw on all failures"); return result.ToGuid(); } public static bool TryParse([NotNullWhen(true)] string? input, out Guid result) { if (input == null) { result = default; return false; } return TryParse((ReadOnlySpan<char>)input, out result); } public static bool TryParse(ReadOnlySpan<char> input, out Guid result) { var parseResult = new GuidResult(GuidParseThrowStyle.None); if (TryParseGuid(input, ref parseResult)) { result = parseResult.ToGuid(); return true; } else { result = default; return false; } } public static Guid ParseExact(string input!!, string format!!) => ParseExact((ReadOnlySpan<char>)input, (ReadOnlySpan<char>)format); public static Guid ParseExact(ReadOnlySpan<char> input, ReadOnlySpan<char> format) { if (format.Length != 1) { // all acceptable format strings are of length 1 throw new FormatException(SR.Format_InvalidGuidFormatSpecification); } input = input.Trim(); var result = new GuidResult(GuidParseThrowStyle.AllButOverflow); bool success = ((char)(format[0] | 0x20)) switch { 'd' => TryParseExactD(input, ref result), 'n' => TryParseExactN(input, ref result), 'b' => TryParseExactB(input, ref result), 'p' => TryParseExactP(input, ref result), 'x' => TryParseExactX(input, ref result), _ => throw new FormatException(SR.Format_InvalidGuidFormatSpecification), }; Debug.Assert(success, "GuidParseThrowStyle.AllButOverflow means throw on all failures"); return result.ToGuid(); } public static bool TryParseExact([NotNullWhen(true)] string? input, [NotNullWhen(true)] string? format, out Guid result) { if (input == null) { result = default; return false; } return TryParseExact((ReadOnlySpan<char>)input, format, out result); } public static bool TryParseExact(ReadOnlySpan<char> input, ReadOnlySpan<char> format, out Guid result) { if (format.Length != 1) { result = default; return false; } input = input.Trim(); var parseResult = new GuidResult(GuidParseThrowStyle.None); bool success = false; switch ((char)(format[0] | 0x20)) { case 'd': success = TryParseExactD(input, ref parseResult); break; case 'n': success = TryParseExactN(input, ref parseResult); break; case 'b': success = TryParseExactB(input, ref parseResult); break; case 'p': success = TryParseExactP(input, ref parseResult); break; case 'x': success = TryParseExactX(input, ref parseResult); break; } if (success) { result = parseResult.ToGuid(); return true; } else { result = default; return false; } } private static bool TryParseGuid(ReadOnlySpan<char> guidString, ref GuidResult result) { guidString = guidString.Trim(); // Remove whitespace from beginning and end if (guidString.Length == 0) { result.SetFailure(overflow: false, nameof(SR.Format_GuidUnrecognized)); return false; } return (guidString[0]) switch { '(' => TryParseExactP(guidString, ref result), '{' => guidString.Contains('-') ? TryParseExactB(guidString, ref result) : TryParseExactX(guidString, ref result), _ => guidString.Contains('-') ? TryParseExactD(guidString, ref result) : TryParseExactN(guidString, ref result), }; } private static bool TryParseExactB(ReadOnlySpan<char> guidString, ref GuidResult result) { // e.g. "{d85b1407-351d-4694-9392-03acc5870eb1}" if ((uint)guidString.Length != 38 || guidString[0] != '{' || guidString[37] != '}') { result.SetFailure(overflow: false, nameof(SR.Format_GuidInvLen)); return false; } return TryParseExactD(guidString.Slice(1, 36), ref result); } private static bool TryParseExactD(ReadOnlySpan<char> guidString, ref GuidResult result) { // e.g. "d85b1407-351d-4694-9392-03acc5870eb1" if ((uint)guidString.Length != 36 || guidString[8] != '-' || guidString[13] != '-' || guidString[18] != '-' || guidString[23] != '-') { result.SetFailure(overflow: false, guidString.Length != 36 ? nameof(SR.Format_GuidInvLen) : nameof(SR.Format_GuidDashes)); return false; } Span<byte> bytes = MemoryMarshal.AsBytes(new Span<GuidResult>(ref result, 1)); int invalidIfNegative = 0; bytes[0] = DecodeByte(guidString[6], guidString[7], ref invalidIfNegative); bytes[1] = DecodeByte(guidString[4], guidString[5], ref invalidIfNegative); bytes[2] = DecodeByte(guidString[2], guidString[3], ref invalidIfNegative); bytes[3] = DecodeByte(guidString[0], guidString[1], ref invalidIfNegative); bytes[4] = DecodeByte(guidString[11], guidString[12], ref invalidIfNegative); bytes[5] = DecodeByte(guidString[9], guidString[10], ref invalidIfNegative); bytes[6] = DecodeByte(guidString[16], guidString[17], ref invalidIfNegative); bytes[7] = DecodeByte(guidString[14], guidString[15], ref invalidIfNegative); bytes[8] = DecodeByte(guidString[19], guidString[20], ref invalidIfNegative); bytes[9] = DecodeByte(guidString[21], guidString[22], ref invalidIfNegative); bytes[10] = DecodeByte(guidString[24], guidString[25], ref invalidIfNegative); bytes[11] = DecodeByte(guidString[26], guidString[27], ref invalidIfNegative); bytes[12] = DecodeByte(guidString[28], guidString[29], ref invalidIfNegative); bytes[13] = DecodeByte(guidString[30], guidString[31], ref invalidIfNegative); bytes[14] = DecodeByte(guidString[32], guidString[33], ref invalidIfNegative); bytes[15] = DecodeByte(guidString[34], guidString[35], ref invalidIfNegative); if (invalidIfNegative >= 0) { if (!BitConverter.IsLittleEndian) { result.ReverseAbcEndianness(); } return true; } // The 'D' format has some undesirable behavior leftover from its original implementation: // - Components may begin with "0x" and/or "+", but the expected length of each component // needs to include those prefixes, e.g. a four digit component could be "1234" or // "0x34" or "+0x4" or "+234", but not "0x1234" nor "+1234" nor "+0x1234". // - "0X" is valid instead of "0x" // We continue to support these but expect them to be incredibly rare. As such, we // optimize for correctly formed strings where all the digits are valid hex, and only // fall back to supporting these other forms if parsing fails. if (guidString.IndexOfAny('X', 'x', '+') >= 0 && TryCompatParsing(guidString, ref result)) { return true; } result.SetFailure(overflow: false, nameof(SR.Format_GuidInvalidChar)); return false; static bool TryCompatParsing(ReadOnlySpan<char> guidString, ref GuidResult result) { if (TryParseHex(guidString.Slice(0, 8), out result._a) && // _a TryParseHex(guidString.Slice(9, 4), out uint uintTmp)) // _b { result._b = (ushort)uintTmp; if (TryParseHex(guidString.Slice(14, 4), out uintTmp)) // _c { result._c = (ushort)uintTmp; if (TryParseHex(guidString.Slice(19, 4), out uintTmp)) // _d, _e { result._de = BitConverter.IsLittleEndian ? BinaryPrimitives.ReverseEndianness((ushort)uintTmp) : (ushort)uintTmp; if (TryParseHex(guidString.Slice(24, 4), out uintTmp)) // _f, _g { result._fg = BitConverter.IsLittleEndian ? BinaryPrimitives.ReverseEndianness((ushort)uintTmp) : (ushort)uintTmp; // Unlike the other components, this one never allowed 0x or +, so we can parse it as straight hex. if (Number.TryParseUInt32HexNumberStyle(guidString.Slice(28, 8), NumberStyles.AllowHexSpecifier, out uintTmp) == Number.ParsingStatus.OK) // _h, _i, _j, _k { result._hijk = BitConverter.IsLittleEndian ? BinaryPrimitives.ReverseEndianness(uintTmp) : uintTmp; return true; } } } } } return false; } } private static bool TryParseExactN(ReadOnlySpan<char> guidString, ref GuidResult result) { // e.g. "d85b1407351d4694939203acc5870eb1" if ((uint)guidString.Length != 32) { result.SetFailure(overflow: false, nameof(SR.Format_GuidInvLen)); return false; } Span<byte> bytes = MemoryMarshal.AsBytes(new Span<GuidResult>(ref result, 1)); int invalidIfNegative = 0; bytes[0] = DecodeByte(guidString[6], guidString[7], ref invalidIfNegative); bytes[1] = DecodeByte(guidString[4], guidString[5], ref invalidIfNegative); bytes[2] = DecodeByte(guidString[2], guidString[3], ref invalidIfNegative); bytes[3] = DecodeByte(guidString[0], guidString[1], ref invalidIfNegative); bytes[4] = DecodeByte(guidString[10], guidString[11], ref invalidIfNegative); bytes[5] = DecodeByte(guidString[8], guidString[9], ref invalidIfNegative); bytes[6] = DecodeByte(guidString[14], guidString[15], ref invalidIfNegative); bytes[7] = DecodeByte(guidString[12], guidString[13], ref invalidIfNegative); bytes[8] = DecodeByte(guidString[16], guidString[17], ref invalidIfNegative); bytes[9] = DecodeByte(guidString[18], guidString[19], ref invalidIfNegative); bytes[10] = DecodeByte(guidString[20], guidString[21], ref invalidIfNegative); bytes[11] = DecodeByte(guidString[22], guidString[23], ref invalidIfNegative); bytes[12] = DecodeByte(guidString[24], guidString[25], ref invalidIfNegative); bytes[13] = DecodeByte(guidString[26], guidString[27], ref invalidIfNegative); bytes[14] = DecodeByte(guidString[28], guidString[29], ref invalidIfNegative); bytes[15] = DecodeByte(guidString[30], guidString[31], ref invalidIfNegative); if (invalidIfNegative >= 0) { if (!BitConverter.IsLittleEndian) { result.ReverseAbcEndianness(); } return true; } result.SetFailure(overflow: false, nameof(SR.Format_GuidInvalidChar)); return false; } private static bool TryParseExactP(ReadOnlySpan<char> guidString, ref GuidResult result) { // e.g. "(d85b1407-351d-4694-9392-03acc5870eb1)" if ((uint)guidString.Length != 38 || guidString[0] != '(' || guidString[37] != ')') { result.SetFailure(overflow: false, nameof(SR.Format_GuidInvLen)); return false; } return TryParseExactD(guidString.Slice(1, 36), ref result); } private static bool TryParseExactX(ReadOnlySpan<char> guidString, ref GuidResult result) { // e.g. "{0xd85b1407,0x351d,0x4694,{0x93,0x92,0x03,0xac,0xc5,0x87,0x0e,0xb1}}" // Compat notes due to the previous implementation's implementation details. // - Each component need not be the full expected number of digits. // - Each component may contain any number of leading 0s // - The "short" components are parsed as 32-bits and only considered to overflow if they'd overflow 32 bits. // - The "byte" components are parsed as 32-bits and are considered to overflow if they'd overflow 8 bits, // but for the Guid ctor, whether they overflow 8 bits or 32 bits results in differing exceptions. // - Components may begin with "0x", "0x+", even "0x+0x". // - "0X" is valid instead of "0x" // Eat all of the whitespace. Unlike the other forms, X allows for any amount of whitespace // anywhere, not just at the beginning and end. guidString = EatAllWhitespace(guidString); // Check for leading '{' if ((uint)guidString.Length == 0 || guidString[0] != '{') { result.SetFailure(overflow: false, nameof(SR.Format_GuidBrace)); return false; } // Check for '0x' if (!IsHexPrefix(guidString, 1)) { result.SetFailure(overflow: false, nameof(SR.Format_GuidHexPrefix)); return false; } // Find the end of this hex number (since it is not fixed length) int numStart = 3; int numLen = guidString.Slice(numStart).IndexOf(','); if (numLen <= 0) { result.SetFailure(overflow: false, nameof(SR.Format_GuidComma)); return false; } bool overflow = false; if (!TryParseHex(guidString.Slice(numStart, numLen), out result._a, ref overflow) || overflow) { result.SetFailure(overflow, overflow ? nameof(SR.Overflow_UInt32) : nameof(SR.Format_GuidInvalidChar)); return false; } // Check for '0x' if (!IsHexPrefix(guidString, numStart + numLen + 1)) { result.SetFailure(overflow: false, nameof(SR.Format_GuidHexPrefix)); return false; } // +3 to get by ',0x' numStart = numStart + numLen + 3; numLen = guidString.Slice(numStart).IndexOf(','); if (numLen <= 0) { result.SetFailure(overflow: false, nameof(SR.Format_GuidComma)); return false; } // Read in the number if (!TryParseHex(guidString.Slice(numStart, numLen), out result._b, ref overflow) || overflow) { result.SetFailure(overflow, overflow ? nameof(SR.Overflow_UInt32) : nameof(SR.Format_GuidInvalidChar)); return false; } // Check for '0x' if (!IsHexPrefix(guidString, numStart + numLen + 1)) { result.SetFailure(overflow: false, nameof(SR.Format_GuidHexPrefix)); return false; } // +3 to get by ',0x' numStart = numStart + numLen + 3; numLen = guidString.Slice(numStart).IndexOf(','); if (numLen <= 0) { result.SetFailure(overflow: false, nameof(SR.Format_GuidComma)); return false; } // Read in the number if (!TryParseHex(guidString.Slice(numStart, numLen), out result._c, ref overflow) || overflow) { result.SetFailure(overflow, overflow ? nameof(SR.Overflow_UInt32) : nameof(SR.Format_GuidInvalidChar)); return false; } // Check for '{' if ((uint)guidString.Length <= (uint)(numStart + numLen + 1) || guidString[numStart + numLen + 1] != '{') { result.SetFailure(overflow: false, nameof(SR.Format_GuidBrace)); return false; } // Prepare for loop numLen++; for (int i = 0; i < 8; i++) { // Check for '0x' if (!IsHexPrefix(guidString, numStart + numLen + 1)) { result.SetFailure(overflow: false, nameof(SR.Format_GuidHexPrefix)); return false; } // +3 to get by ',0x' or '{0x' for first case numStart = numStart + numLen + 3; // Calculate number length if (i < 7) // first 7 cases { numLen = guidString.Slice(numStart).IndexOf(','); if (numLen <= 0) { result.SetFailure(overflow: false, nameof(SR.Format_GuidComma)); return false; } } else // last case ends with '}', not ',' { numLen = guidString.Slice(numStart).IndexOf('}'); if (numLen <= 0) { result.SetFailure(overflow: false, nameof(SR.Format_GuidBraceAfterLastNumber)); return false; } } // Read in the number if (!TryParseHex(guidString.Slice(numStart, numLen), out uint byteVal, ref overflow) || overflow || byteVal > byte.MaxValue) { // The previous implementation had some odd inconsistencies, which are carried forward here. // The byte values in the X format are treated as integers with regards to overflow, so // a "byte" value like 0xddd in Guid's ctor results in a FormatException but 0xddddddddd results // in OverflowException. result.SetFailure(overflow, overflow ? nameof(SR.Overflow_UInt32) : byteVal > byte.MaxValue ? nameof(SR.Overflow_Byte) : nameof(SR.Format_GuidInvalidChar)); return false; } Unsafe.Add(ref result._d, i) = (byte)byteVal; } // Check for last '}' if (numStart + numLen + 1 >= guidString.Length || guidString[numStart + numLen + 1] != '}') { result.SetFailure(overflow: false, nameof(SR.Format_GuidEndBrace)); return false; } // Check if we have extra characters at the end if (numStart + numLen + 1 != guidString.Length - 1) { result.SetFailure(overflow: false, nameof(SR.Format_ExtraJunkAtEnd)); return false; } return true; } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static byte DecodeByte(nuint ch1, nuint ch2, ref int invalidIfNegative) { // TODO https://github.com/dotnet/runtime/issues/13464: // Replace the Unsafe.Add with HexConverter.FromChar once the bounds checks are eliminated. ReadOnlySpan<byte> lookup = HexConverter.CharToHexLookup; int h1 = -1; if (ch1 < (nuint)lookup.Length) { h1 = (sbyte)Unsafe.Add(ref MemoryMarshal.GetReference(lookup), (nint)ch1); } h1 <<= 4; int h2 = -1; if (ch2 < (nuint)lookup.Length) { h2 = (sbyte)Unsafe.Add(ref MemoryMarshal.GetReference(lookup), (nint)ch2); } int result = h1 | h2; invalidIfNegative |= result; return (byte)result; } private static bool TryParseHex(ReadOnlySpan<char> guidString, out ushort result, ref bool overflow) { bool success = TryParseHex(guidString, out uint tmp, ref overflow); result = (ushort)tmp; return success; } private static bool TryParseHex(ReadOnlySpan<char> guidString, out uint result) { bool overflowIgnored = false; return TryParseHex(guidString, out result, ref overflowIgnored); } private static bool TryParseHex(ReadOnlySpan<char> guidString, out uint result, ref bool overflow) { if ((uint)guidString.Length > 0) { if (guidString[0] == '+') { guidString = guidString.Slice(1); } if ((uint)guidString.Length > 1 && guidString[0] == '0' && (guidString[1] | 0x20) == 'x') { guidString = guidString.Slice(2); } } // Skip past leading 0s. int i = 0; for (; i < guidString.Length && guidString[i] == '0'; i++) ; int processedDigits = 0; uint tmp = 0; for (; i < guidString.Length; i++) { char c = guidString[i]; int numValue = HexConverter.FromChar(c); if (numValue == 0xFF) { if (processedDigits > 8) overflow = true; result = 0; return false; } tmp = (tmp * 16) + (uint)numValue; processedDigits++; } if (processedDigits > 8) overflow = true; result = tmp; return true; } private static ReadOnlySpan<char> EatAllWhitespace(ReadOnlySpan<char> str) { // Find the first whitespace character. If there is none, just return the input. int i; for (i = 0; i < str.Length && !char.IsWhiteSpace(str[i]); i++) ; if (i == str.Length) { return str; } // There was at least one whitespace. Copy over everything prior to it to a new array. var chArr = new char[str.Length]; int newLength = 0; if (i > 0) { newLength = i; str.Slice(0, i).CopyTo(chArr); } // Loop through the remaining chars, copying over non-whitespace. for (; i < str.Length; i++) { char c = str[i]; if (!char.IsWhiteSpace(c)) { chArr[newLength++] = c; } } // Return the string with the whitespace removed. return new ReadOnlySpan<char>(chArr, 0, newLength); } private static bool IsHexPrefix(ReadOnlySpan<char> str, int i) => i + 1 < str.Length && str[i] == '0' && (str[i + 1] | 0x20) == 'x'; // Returns an unsigned byte array containing the GUID. public byte[] ToByteArray() { var g = new byte[16]; if (BitConverter.IsLittleEndian) { MemoryMarshal.TryWrite<Guid>(g, ref Unsafe.AsRef(in this)); } else { TryWriteBytes(g); } return g; } // Returns whether bytes are sucessfully written to given span. public bool TryWriteBytes(Span<byte> destination) { if (BitConverter.IsLittleEndian) { return MemoryMarshal.TryWrite(destination, ref Unsafe.AsRef(in this)); } // slower path for BigEndian if (destination.Length < 16) return false; destination[15] = _k; // hoist bounds checks BinaryPrimitives.WriteInt32LittleEndian(destination, _a); BinaryPrimitives.WriteInt16LittleEndian(destination.Slice(4), _b); BinaryPrimitives.WriteInt16LittleEndian(destination.Slice(6), _c); destination[8] = _d; destination[9] = _e; destination[10] = _f; destination[11] = _g; destination[12] = _h; destination[13] = _i; destination[14] = _j; return true; } // Returns the guid in "registry" format. public override string ToString() => ToString("D", null); public override int GetHashCode() { // Simply XOR all the bits of the GUID 32 bits at a time. ref int r = ref Unsafe.AsRef(in _a); return r ^ Unsafe.Add(ref r, 1) ^ Unsafe.Add(ref r, 2) ^ Unsafe.Add(ref r, 3); } // Returns true if and only if the guid represented // by o is the same as this instance. public override bool Equals([NotNullWhen(true)] object? o) => o is Guid g && EqualsCore(this, g); public bool Equals(Guid g) => EqualsCore(this, g); private static bool EqualsCore(in Guid left, in Guid right) { ref int rA = ref Unsafe.AsRef(in left._a); ref int rB = ref Unsafe.AsRef(in right._a); // Compare each element return rA == rB && Unsafe.Add(ref rA, 1) == Unsafe.Add(ref rB, 1) && Unsafe.Add(ref rA, 2) == Unsafe.Add(ref rB, 2) && Unsafe.Add(ref rA, 3) == Unsafe.Add(ref rB, 3); } private static int GetResult(uint me, uint them) => me < them ? -1 : 1; public int CompareTo(object? value) { if (value == null) { return 1; } if (!(value is Guid)) { throw new ArgumentException(SR.Arg_MustBeGuid, nameof(value)); } Guid g = (Guid)value; if (g._a != _a) { return GetResult((uint)_a, (uint)g._a); } if (g._b != _b) { return GetResult((uint)_b, (uint)g._b); } if (g._c != _c) { return GetResult((uint)_c, (uint)g._c); } if (g._d != _d) { return GetResult(_d, g._d); } if (g._e != _e) { return GetResult(_e, g._e); } if (g._f != _f) { return GetResult(_f, g._f); } if (g._g != _g) { return GetResult(_g, g._g); } if (g._h != _h) { return GetResult(_h, g._h); } if (g._i != _i) { return GetResult(_i, g._i); } if (g._j != _j) { return GetResult(_j, g._j); } if (g._k != _k) { return GetResult(_k, g._k); } return 0; } public int CompareTo(Guid value) { if (value._a != _a) { return GetResult((uint)_a, (uint)value._a); } if (value._b != _b) { return GetResult((uint)_b, (uint)value._b); } if (value._c != _c) { return GetResult((uint)_c, (uint)value._c); } if (value._d != _d) { return GetResult(_d, value._d); } if (value._e != _e) { return GetResult(_e, value._e); } if (value._f != _f) { return GetResult(_f, value._f); } if (value._g != _g) { return GetResult(_g, value._g); } if (value._h != _h) { return GetResult(_h, value._h); } if (value._i != _i) { return GetResult(_i, value._i); } if (value._j != _j) { return GetResult(_j, value._j); } if (value._k != _k) { return GetResult(_k, value._k); } return 0; } public static bool operator ==(Guid a, Guid b) => EqualsCore(a, b); public static bool operator !=(Guid a, Guid b) => !EqualsCore(a, b); public string ToString(string? format) { return ToString(format, null); } private static unsafe int HexsToChars(char* guidChars, int a, int b) { guidChars[0] = HexConverter.ToCharLower(a >> 4); guidChars[1] = HexConverter.ToCharLower(a); guidChars[2] = HexConverter.ToCharLower(b >> 4); guidChars[3] = HexConverter.ToCharLower(b); return 4; } private static unsafe int HexsToCharsHexOutput(char* guidChars, int a, int b) { guidChars[0] = '0'; guidChars[1] = 'x'; guidChars[2] = HexConverter.ToCharLower(a >> 4); guidChars[3] = HexConverter.ToCharLower(a); guidChars[4] = ','; guidChars[5] = '0'; guidChars[6] = 'x'; guidChars[7] = HexConverter.ToCharLower(b >> 4); guidChars[8] = HexConverter.ToCharLower(b); return 9; } // IFormattable interface // We currently ignore provider public string ToString(string? format, IFormatProvider? provider) { if (string.IsNullOrEmpty(format)) { format = "D"; } // all acceptable format strings are of length 1 if (format.Length != 1) { throw new FormatException(SR.Format_InvalidGuidFormatSpecification); } int guidSize; switch (format[0]) { case 'D': case 'd': guidSize = 36; break; case 'N': case 'n': guidSize = 32; break; case 'B': case 'b': case 'P': case 'p': guidSize = 38; break; case 'X': case 'x': guidSize = 68; break; default: throw new FormatException(SR.Format_InvalidGuidFormatSpecification); } string guidString = string.FastAllocateString(guidSize); bool result = TryFormat(new Span<char>(ref guidString.GetRawStringData(), guidString.Length), out int bytesWritten, format); Debug.Assert(result && bytesWritten == guidString.Length, "Formatting guid should have succeeded."); return guidString; } // Returns whether the guid is successfully formatted as a span. public bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format = default) { if (format.Length == 0) { format = "D"; } // all acceptable format strings are of length 1 if (format.Length != 1) { throw new FormatException(SR.Format_InvalidGuidFormatSpecification); } bool dash = true; bool hex = false; int braces = 0; int guidSize; switch (format[0]) { case 'D': case 'd': guidSize = 36; break; case 'N': case 'n': dash = false; guidSize = 32; break; case 'B': case 'b': braces = '{' + ('}' << 16); guidSize = 38; break; case 'P': case 'p': braces = '(' + (')' << 16); guidSize = 38; break; case 'X': case 'x': braces = '{' + ('}' << 16); dash = false; hex = true; guidSize = 68; break; default: throw new FormatException(SR.Format_InvalidGuidFormatSpecification); } if (destination.Length < guidSize) { charsWritten = 0; return false; } unsafe { fixed (char* guidChars = &MemoryMarshal.GetReference(destination)) { char* p = guidChars; if (braces != 0) *p++ = (char)braces; if (hex) { // {0xdddddddd,0xdddd,0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd}} *p++ = '0'; *p++ = 'x'; p += HexsToChars(p, _a >> 24, _a >> 16); p += HexsToChars(p, _a >> 8, _a); *p++ = ','; *p++ = '0'; *p++ = 'x'; p += HexsToChars(p, _b >> 8, _b); *p++ = ','; *p++ = '0'; *p++ = 'x'; p += HexsToChars(p, _c >> 8, _c); *p++ = ','; *p++ = '{'; p += HexsToCharsHexOutput(p, _d, _e); *p++ = ','; p += HexsToCharsHexOutput(p, _f, _g); *p++ = ','; p += HexsToCharsHexOutput(p, _h, _i); *p++ = ','; p += HexsToCharsHexOutput(p, _j, _k); *p++ = '}'; } else { // [{|(]dddddddd[-]dddd[-]dddd[-]dddd[-]dddddddddddd[}|)] p += HexsToChars(p, _a >> 24, _a >> 16); p += HexsToChars(p, _a >> 8, _a); if (dash) *p++ = '-'; p += HexsToChars(p, _b >> 8, _b); if (dash) *p++ = '-'; p += HexsToChars(p, _c >> 8, _c); if (dash) *p++ = '-'; p += HexsToChars(p, _d, _e); if (dash) *p++ = '-'; p += HexsToChars(p, _f, _g); p += HexsToChars(p, _h, _i); p += HexsToChars(p, _j, _k); } if (braces != 0) *p++ = (char)(braces >> 16); Debug.Assert(p - guidChars == guidSize); } } charsWritten = guidSize; return true; } bool ISpanFormattable.TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider? provider) { // Like with the IFormattable implementation, provider is ignored. return TryFormat(destination, out charsWritten, format); } #if FEATURE_GENERIC_MATH // // IComparisonOperators // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators<Guid, Guid>.operator <(Guid left, Guid right) { if (left._a != right._a) { return (uint)left._a < (uint)right._a; } if (left._b != right._b) { return (uint)left._b < (uint)right._b; } if (left._c != right._c) { return (uint)left._c < (uint)right._c; } if (left._d != right._d) { return left._d < right._d; } if (left._e != right._e) { return left._e < right._e; } if (left._f != right._f) { return left._f < right._f; } if (left._g != right._g) { return left._g < right._g; } if (left._h != right._h) { return left._h < right._h; } if (left._i != right._i) { return left._i < right._i; } if (left._j != right._j) { return left._j < right._j; } if (left._k != right._k) { return left._k < right._k; } return false; } [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators<Guid, Guid>.operator <=(Guid left, Guid right) { if (left._a != right._a) { return (uint)left._a < (uint)right._a; } if (left._b != right._b) { return (uint)left._b < (uint)right._b; } if (left._c != right._c) { return (uint)left._c < (uint)right._c; } if (left._d != right._d) { return left._d < right._d; } if (left._e != right._e) { return left._e < right._e; } if (left._f != right._f) { return left._f < right._f; } if (left._g != right._g) { return left._g < right._g; } if (left._h != right._h) { return left._h < right._h; } if (left._i != right._i) { return left._i < right._i; } if (left._j != right._j) { return left._j < right._j; } if (left._k != right._k) { return left._k < right._k; } return true; } [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators<Guid, Guid>.operator >(Guid left, Guid right) { if (left._a != right._a) { return (uint)left._a > (uint)right._a; } if (left._b != right._b) { return (uint)left._b > (uint)right._b; } if (left._c != right._c) { return (uint)left._c > (uint)right._c; } if (left._d != right._d) { return left._d > right._d; } if (left._e != right._e) { return left._e > right._e; } if (left._f != right._f) { return left._f > right._f; } if (left._g != right._g) { return left._g > right._g; } if (left._h != right._h) { return left._h > right._h; } if (left._i != right._i) { return left._i > right._i; } if (left._j != right._j) { return left._j > right._j; } if (left._k != right._k) { return left._k > right._k; } return false; } [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators<Guid, Guid>.operator >=(Guid left, Guid right) { if (left._a != right._a) { return (uint)left._a > (uint)right._a; } if (left._b != right._b) { return (uint)left._b > (uint)right._b; } if (left._c != right._c) { return (uint)left._c > (uint)right._c; } if (left._d != right._d) { return left._d > right._d; } if (left._e != right._e) { return left._e > right._e; } if (left._f != right._f) { return left._f > right._f; } if (left._g != right._g) { return left._g > right._g; } if (left._h != right._h) { return left._h > right._h; } if (left._i != right._i) { return left._i > right._i; } if (left._j != right._j) { return left._j > right._j; } if (left._k != right._k) { return left._k > right._k; } return true; } // // IEqualityOperators // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators<Guid, Guid>.operator ==(Guid left, Guid right) => left == right; [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators<Guid, Guid>.operator !=(Guid left, Guid right) => left != right; // // IParseable // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Guid IParseable<Guid>.Parse(string s, IFormatProvider? provider) => Parse(s); [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IParseable<Guid>.TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out Guid result) => TryParse(s, out result); // // ISpanParseable // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Guid ISpanParseable<Guid>.Parse(ReadOnlySpan<char> s, IFormatProvider? provider) => Parse(s); [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool ISpanParseable<Guid>.TryParse(ReadOnlySpan<char> s, IFormatProvider? provider, out Guid result) => TryParse(s, out result); #endif // FEATURE_GENERIC_MATH } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Buffers.Binary; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; namespace System { // Represents a Globally Unique Identifier. [StructLayout(LayoutKind.Sequential)] [Serializable] [NonVersionable] // This only applies to field layout [TypeForwardedFrom("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public readonly partial struct Guid : ISpanFormattable, IComparable, IComparable<Guid>, IEquatable<Guid> #if FEATURE_GENERIC_MATH #pragma warning disable SA1001, CA2252 // SA1001: Comma positioning; CA2252: Preview Features , IComparisonOperators<Guid, Guid>, ISpanParseable<Guid> #pragma warning restore SA1001, CA2252 #endif // FEATURE_GENERIC_MATH { public static readonly Guid Empty; private readonly int _a; // Do not rename (binary serialization) private readonly short _b; // Do not rename (binary serialization) private readonly short _c; // Do not rename (binary serialization) private readonly byte _d; // Do not rename (binary serialization) private readonly byte _e; // Do not rename (binary serialization) private readonly byte _f; // Do not rename (binary serialization) private readonly byte _g; // Do not rename (binary serialization) private readonly byte _h; // Do not rename (binary serialization) private readonly byte _i; // Do not rename (binary serialization) private readonly byte _j; // Do not rename (binary serialization) private readonly byte _k; // Do not rename (binary serialization) // Creates a new guid from an array of bytes. public Guid(byte[] b!!) : this(new ReadOnlySpan<byte>(b)) { } // Creates a new guid from a read-only span. public Guid(ReadOnlySpan<byte> b) { if ((uint)b.Length != 16) { throw new ArgumentException(SR.Format(SR.Arg_GuidArrayCtor, "16"), nameof(b)); } if (BitConverter.IsLittleEndian) { this = MemoryMarshal.Read<Guid>(b); return; } // slower path for BigEndian: _k = b[15]; // hoist bounds checks _a = BinaryPrimitives.ReadInt32LittleEndian(b); _b = BinaryPrimitives.ReadInt16LittleEndian(b.Slice(4)); _c = BinaryPrimitives.ReadInt16LittleEndian(b.Slice(6)); _d = b[8]; _e = b[9]; _f = b[10]; _g = b[11]; _h = b[12]; _i = b[13]; _j = b[14]; } [CLSCompliant(false)] public Guid(uint a, ushort b, ushort c, byte d, byte e, byte f, byte g, byte h, byte i, byte j, byte k) { _a = (int)a; _b = (short)b; _c = (short)c; _d = d; _e = e; _f = f; _g = g; _h = h; _i = i; _j = j; _k = k; } // Creates a new GUID initialized to the value represented by the arguments. public Guid(int a, short b, short c, byte[] d!!) { if (d.Length != 8) { throw new ArgumentException(SR.Format(SR.Arg_GuidArrayCtor, "8"), nameof(d)); } _a = a; _b = b; _c = c; _k = d[7]; // hoist bounds checks _d = d[0]; _e = d[1]; _f = d[2]; _g = d[3]; _h = d[4]; _i = d[5]; _j = d[6]; } // Creates a new GUID initialized to the value represented by the // arguments. The bytes are specified like this to avoid endianness issues. public Guid(int a, short b, short c, byte d, byte e, byte f, byte g, byte h, byte i, byte j, byte k) { _a = a; _b = b; _c = c; _d = d; _e = e; _f = f; _g = g; _h = h; _i = i; _j = j; _k = k; } private enum GuidParseThrowStyle : byte { None = 0, All = 1, AllButOverflow = 2 } // This will store the result of the parsing. And it will eventually be used to construct a Guid instance. // We'll eventually reinterpret_cast<> a GuidResult as a Guid, so we need to give it a sequential // layout and ensure that its early fields match the layout of Guid exactly. [StructLayout(LayoutKind.Explicit)] private struct GuidResult { [FieldOffset(0)] internal uint _a; [FieldOffset(4)] internal uint _bc; [FieldOffset(4)] internal ushort _b; [FieldOffset(6)] internal ushort _c; [FieldOffset(8)] internal uint _defg; [FieldOffset(8)] internal ushort _de; [FieldOffset(8)] internal byte _d; [FieldOffset(10)] internal ushort _fg; [FieldOffset(12)] internal uint _hijk; [FieldOffset(16)] private readonly GuidParseThrowStyle _throwStyle; internal GuidResult(GuidParseThrowStyle canThrow) : this() { _throwStyle = canThrow; } internal readonly void SetFailure(bool overflow, string failureMessageID) { if (_throwStyle == GuidParseThrowStyle.None) { return; } if (overflow) { if (_throwStyle == GuidParseThrowStyle.All) { throw new OverflowException(SR.GetResourceString(failureMessageID)); } throw new FormatException(SR.Format_GuidUnrecognized); } throw new FormatException(SR.GetResourceString(failureMessageID)); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public readonly Guid ToGuid() { return Unsafe.As<GuidResult, Guid>(ref Unsafe.AsRef(in this)); } public void ReverseAbcEndianness() { _a = BinaryPrimitives.ReverseEndianness(_a); _b = BinaryPrimitives.ReverseEndianness(_b); _c = BinaryPrimitives.ReverseEndianness(_c); } } // Creates a new guid based on the value in the string. The value is made up // of hex digits speared by the dash ("-"). The string may begin and end with // brackets ("{", "}"). // // The string must be of the form dddddddd-dddd-dddd-dddd-dddddddddddd. where // d is a hex digit. (That is 8 hex digits, followed by 4, then 4, then 4, // then 12) such as: "CA761232-ED42-11CE-BACD-00AA0057B223" public Guid(string g!!) { var result = new GuidResult(GuidParseThrowStyle.All); bool success = TryParseGuid(g, ref result); Debug.Assert(success, "GuidParseThrowStyle.All means throw on all failures"); this = result.ToGuid(); } public static Guid Parse(string input!!) => Parse((ReadOnlySpan<char>)input); public static Guid Parse(ReadOnlySpan<char> input) { var result = new GuidResult(GuidParseThrowStyle.AllButOverflow); bool success = TryParseGuid(input, ref result); Debug.Assert(success, "GuidParseThrowStyle.AllButOverflow means throw on all failures"); return result.ToGuid(); } public static bool TryParse([NotNullWhen(true)] string? input, out Guid result) { if (input == null) { result = default; return false; } return TryParse((ReadOnlySpan<char>)input, out result); } public static bool TryParse(ReadOnlySpan<char> input, out Guid result) { var parseResult = new GuidResult(GuidParseThrowStyle.None); if (TryParseGuid(input, ref parseResult)) { result = parseResult.ToGuid(); return true; } else { result = default; return false; } } public static Guid ParseExact(string input!!, string format!!) => ParseExact((ReadOnlySpan<char>)input, (ReadOnlySpan<char>)format); public static Guid ParseExact(ReadOnlySpan<char> input, ReadOnlySpan<char> format) { if (format.Length != 1) { // all acceptable format strings are of length 1 throw new FormatException(SR.Format_InvalidGuidFormatSpecification); } input = input.Trim(); var result = new GuidResult(GuidParseThrowStyle.AllButOverflow); bool success = ((char)(format[0] | 0x20)) switch { 'd' => TryParseExactD(input, ref result), 'n' => TryParseExactN(input, ref result), 'b' => TryParseExactB(input, ref result), 'p' => TryParseExactP(input, ref result), 'x' => TryParseExactX(input, ref result), _ => throw new FormatException(SR.Format_InvalidGuidFormatSpecification), }; Debug.Assert(success, "GuidParseThrowStyle.AllButOverflow means throw on all failures"); return result.ToGuid(); } public static bool TryParseExact([NotNullWhen(true)] string? input, [NotNullWhen(true)] string? format, out Guid result) { if (input == null) { result = default; return false; } return TryParseExact((ReadOnlySpan<char>)input, format, out result); } public static bool TryParseExact(ReadOnlySpan<char> input, ReadOnlySpan<char> format, out Guid result) { if (format.Length != 1) { result = default; return false; } input = input.Trim(); var parseResult = new GuidResult(GuidParseThrowStyle.None); bool success = false; switch ((char)(format[0] | 0x20)) { case 'd': success = TryParseExactD(input, ref parseResult); break; case 'n': success = TryParseExactN(input, ref parseResult); break; case 'b': success = TryParseExactB(input, ref parseResult); break; case 'p': success = TryParseExactP(input, ref parseResult); break; case 'x': success = TryParseExactX(input, ref parseResult); break; } if (success) { result = parseResult.ToGuid(); return true; } else { result = default; return false; } } private static bool TryParseGuid(ReadOnlySpan<char> guidString, ref GuidResult result) { guidString = guidString.Trim(); // Remove whitespace from beginning and end if (guidString.Length == 0) { result.SetFailure(overflow: false, nameof(SR.Format_GuidUnrecognized)); return false; } return (guidString[0]) switch { '(' => TryParseExactP(guidString, ref result), '{' => guidString.Contains('-') ? TryParseExactB(guidString, ref result) : TryParseExactX(guidString, ref result), _ => guidString.Contains('-') ? TryParseExactD(guidString, ref result) : TryParseExactN(guidString, ref result), }; } private static bool TryParseExactB(ReadOnlySpan<char> guidString, ref GuidResult result) { // e.g. "{d85b1407-351d-4694-9392-03acc5870eb1}" if ((uint)guidString.Length != 38 || guidString[0] != '{' || guidString[37] != '}') { result.SetFailure(overflow: false, nameof(SR.Format_GuidInvLen)); return false; } return TryParseExactD(guidString.Slice(1, 36), ref result); } private static bool TryParseExactD(ReadOnlySpan<char> guidString, ref GuidResult result) { // e.g. "d85b1407-351d-4694-9392-03acc5870eb1" if ((uint)guidString.Length != 36 || guidString[8] != '-' || guidString[13] != '-' || guidString[18] != '-' || guidString[23] != '-') { result.SetFailure(overflow: false, guidString.Length != 36 ? nameof(SR.Format_GuidInvLen) : nameof(SR.Format_GuidDashes)); return false; } Span<byte> bytes = MemoryMarshal.AsBytes(new Span<GuidResult>(ref result, 1)); int invalidIfNegative = 0; bytes[0] = DecodeByte(guidString[6], guidString[7], ref invalidIfNegative); bytes[1] = DecodeByte(guidString[4], guidString[5], ref invalidIfNegative); bytes[2] = DecodeByte(guidString[2], guidString[3], ref invalidIfNegative); bytes[3] = DecodeByte(guidString[0], guidString[1], ref invalidIfNegative); bytes[4] = DecodeByte(guidString[11], guidString[12], ref invalidIfNegative); bytes[5] = DecodeByte(guidString[9], guidString[10], ref invalidIfNegative); bytes[6] = DecodeByte(guidString[16], guidString[17], ref invalidIfNegative); bytes[7] = DecodeByte(guidString[14], guidString[15], ref invalidIfNegative); bytes[8] = DecodeByte(guidString[19], guidString[20], ref invalidIfNegative); bytes[9] = DecodeByte(guidString[21], guidString[22], ref invalidIfNegative); bytes[10] = DecodeByte(guidString[24], guidString[25], ref invalidIfNegative); bytes[11] = DecodeByte(guidString[26], guidString[27], ref invalidIfNegative); bytes[12] = DecodeByte(guidString[28], guidString[29], ref invalidIfNegative); bytes[13] = DecodeByte(guidString[30], guidString[31], ref invalidIfNegative); bytes[14] = DecodeByte(guidString[32], guidString[33], ref invalidIfNegative); bytes[15] = DecodeByte(guidString[34], guidString[35], ref invalidIfNegative); if (invalidIfNegative >= 0) { if (!BitConverter.IsLittleEndian) { result.ReverseAbcEndianness(); } return true; } // The 'D' format has some undesirable behavior leftover from its original implementation: // - Components may begin with "0x" and/or "+", but the expected length of each component // needs to include those prefixes, e.g. a four digit component could be "1234" or // "0x34" or "+0x4" or "+234", but not "0x1234" nor "+1234" nor "+0x1234". // - "0X" is valid instead of "0x" // We continue to support these but expect them to be incredibly rare. As such, we // optimize for correctly formed strings where all the digits are valid hex, and only // fall back to supporting these other forms if parsing fails. if (guidString.IndexOfAny('X', 'x', '+') >= 0 && TryCompatParsing(guidString, ref result)) { return true; } result.SetFailure(overflow: false, nameof(SR.Format_GuidInvalidChar)); return false; static bool TryCompatParsing(ReadOnlySpan<char> guidString, ref GuidResult result) { if (TryParseHex(guidString.Slice(0, 8), out result._a) && // _a TryParseHex(guidString.Slice(9, 4), out uint uintTmp)) // _b { result._b = (ushort)uintTmp; if (TryParseHex(guidString.Slice(14, 4), out uintTmp)) // _c { result._c = (ushort)uintTmp; if (TryParseHex(guidString.Slice(19, 4), out uintTmp)) // _d, _e { result._de = BitConverter.IsLittleEndian ? BinaryPrimitives.ReverseEndianness((ushort)uintTmp) : (ushort)uintTmp; if (TryParseHex(guidString.Slice(24, 4), out uintTmp)) // _f, _g { result._fg = BitConverter.IsLittleEndian ? BinaryPrimitives.ReverseEndianness((ushort)uintTmp) : (ushort)uintTmp; // Unlike the other components, this one never allowed 0x or +, so we can parse it as straight hex. if (Number.TryParseUInt32HexNumberStyle(guidString.Slice(28, 8), NumberStyles.AllowHexSpecifier, out uintTmp) == Number.ParsingStatus.OK) // _h, _i, _j, _k { result._hijk = BitConverter.IsLittleEndian ? BinaryPrimitives.ReverseEndianness(uintTmp) : uintTmp; return true; } } } } } return false; } } private static bool TryParseExactN(ReadOnlySpan<char> guidString, ref GuidResult result) { // e.g. "d85b1407351d4694939203acc5870eb1" if ((uint)guidString.Length != 32) { result.SetFailure(overflow: false, nameof(SR.Format_GuidInvLen)); return false; } Span<byte> bytes = MemoryMarshal.AsBytes(new Span<GuidResult>(ref result, 1)); int invalidIfNegative = 0; bytes[0] = DecodeByte(guidString[6], guidString[7], ref invalidIfNegative); bytes[1] = DecodeByte(guidString[4], guidString[5], ref invalidIfNegative); bytes[2] = DecodeByte(guidString[2], guidString[3], ref invalidIfNegative); bytes[3] = DecodeByte(guidString[0], guidString[1], ref invalidIfNegative); bytes[4] = DecodeByte(guidString[10], guidString[11], ref invalidIfNegative); bytes[5] = DecodeByte(guidString[8], guidString[9], ref invalidIfNegative); bytes[6] = DecodeByte(guidString[14], guidString[15], ref invalidIfNegative); bytes[7] = DecodeByte(guidString[12], guidString[13], ref invalidIfNegative); bytes[8] = DecodeByte(guidString[16], guidString[17], ref invalidIfNegative); bytes[9] = DecodeByte(guidString[18], guidString[19], ref invalidIfNegative); bytes[10] = DecodeByte(guidString[20], guidString[21], ref invalidIfNegative); bytes[11] = DecodeByte(guidString[22], guidString[23], ref invalidIfNegative); bytes[12] = DecodeByte(guidString[24], guidString[25], ref invalidIfNegative); bytes[13] = DecodeByte(guidString[26], guidString[27], ref invalidIfNegative); bytes[14] = DecodeByte(guidString[28], guidString[29], ref invalidIfNegative); bytes[15] = DecodeByte(guidString[30], guidString[31], ref invalidIfNegative); if (invalidIfNegative >= 0) { if (!BitConverter.IsLittleEndian) { result.ReverseAbcEndianness(); } return true; } result.SetFailure(overflow: false, nameof(SR.Format_GuidInvalidChar)); return false; } private static bool TryParseExactP(ReadOnlySpan<char> guidString, ref GuidResult result) { // e.g. "(d85b1407-351d-4694-9392-03acc5870eb1)" if ((uint)guidString.Length != 38 || guidString[0] != '(' || guidString[37] != ')') { result.SetFailure(overflow: false, nameof(SR.Format_GuidInvLen)); return false; } return TryParseExactD(guidString.Slice(1, 36), ref result); } private static bool TryParseExactX(ReadOnlySpan<char> guidString, ref GuidResult result) { // e.g. "{0xd85b1407,0x351d,0x4694,{0x93,0x92,0x03,0xac,0xc5,0x87,0x0e,0xb1}}" // Compat notes due to the previous implementation's implementation details. // - Each component need not be the full expected number of digits. // - Each component may contain any number of leading 0s // - The "short" components are parsed as 32-bits and only considered to overflow if they'd overflow 32 bits. // - The "byte" components are parsed as 32-bits and are considered to overflow if they'd overflow 8 bits, // but for the Guid ctor, whether they overflow 8 bits or 32 bits results in differing exceptions. // - Components may begin with "0x", "0x+", even "0x+0x". // - "0X" is valid instead of "0x" // Eat all of the whitespace. Unlike the other forms, X allows for any amount of whitespace // anywhere, not just at the beginning and end. guidString = EatAllWhitespace(guidString); // Check for leading '{' if ((uint)guidString.Length == 0 || guidString[0] != '{') { result.SetFailure(overflow: false, nameof(SR.Format_GuidBrace)); return false; } // Check for '0x' if (!IsHexPrefix(guidString, 1)) { result.SetFailure(overflow: false, nameof(SR.Format_GuidHexPrefix)); return false; } // Find the end of this hex number (since it is not fixed length) int numStart = 3; int numLen = guidString.Slice(numStart).IndexOf(','); if (numLen <= 0) { result.SetFailure(overflow: false, nameof(SR.Format_GuidComma)); return false; } bool overflow = false; if (!TryParseHex(guidString.Slice(numStart, numLen), out result._a, ref overflow) || overflow) { result.SetFailure(overflow, overflow ? nameof(SR.Overflow_UInt32) : nameof(SR.Format_GuidInvalidChar)); return false; } // Check for '0x' if (!IsHexPrefix(guidString, numStart + numLen + 1)) { result.SetFailure(overflow: false, nameof(SR.Format_GuidHexPrefix)); return false; } // +3 to get by ',0x' numStart = numStart + numLen + 3; numLen = guidString.Slice(numStart).IndexOf(','); if (numLen <= 0) { result.SetFailure(overflow: false, nameof(SR.Format_GuidComma)); return false; } // Read in the number if (!TryParseHex(guidString.Slice(numStart, numLen), out result._b, ref overflow) || overflow) { result.SetFailure(overflow, overflow ? nameof(SR.Overflow_UInt32) : nameof(SR.Format_GuidInvalidChar)); return false; } // Check for '0x' if (!IsHexPrefix(guidString, numStart + numLen + 1)) { result.SetFailure(overflow: false, nameof(SR.Format_GuidHexPrefix)); return false; } // +3 to get by ',0x' numStart = numStart + numLen + 3; numLen = guidString.Slice(numStart).IndexOf(','); if (numLen <= 0) { result.SetFailure(overflow: false, nameof(SR.Format_GuidComma)); return false; } // Read in the number if (!TryParseHex(guidString.Slice(numStart, numLen), out result._c, ref overflow) || overflow) { result.SetFailure(overflow, overflow ? nameof(SR.Overflow_UInt32) : nameof(SR.Format_GuidInvalidChar)); return false; } // Check for '{' if ((uint)guidString.Length <= (uint)(numStart + numLen + 1) || guidString[numStart + numLen + 1] != '{') { result.SetFailure(overflow: false, nameof(SR.Format_GuidBrace)); return false; } // Prepare for loop numLen++; for (int i = 0; i < 8; i++) { // Check for '0x' if (!IsHexPrefix(guidString, numStart + numLen + 1)) { result.SetFailure(overflow: false, nameof(SR.Format_GuidHexPrefix)); return false; } // +3 to get by ',0x' or '{0x' for first case numStart = numStart + numLen + 3; // Calculate number length if (i < 7) // first 7 cases { numLen = guidString.Slice(numStart).IndexOf(','); if (numLen <= 0) { result.SetFailure(overflow: false, nameof(SR.Format_GuidComma)); return false; } } else // last case ends with '}', not ',' { numLen = guidString.Slice(numStart).IndexOf('}'); if (numLen <= 0) { result.SetFailure(overflow: false, nameof(SR.Format_GuidBraceAfterLastNumber)); return false; } } // Read in the number if (!TryParseHex(guidString.Slice(numStart, numLen), out uint byteVal, ref overflow) || overflow || byteVal > byte.MaxValue) { // The previous implementation had some odd inconsistencies, which are carried forward here. // The byte values in the X format are treated as integers with regards to overflow, so // a "byte" value like 0xddd in Guid's ctor results in a FormatException but 0xddddddddd results // in OverflowException. result.SetFailure(overflow, overflow ? nameof(SR.Overflow_UInt32) : byteVal > byte.MaxValue ? nameof(SR.Overflow_Byte) : nameof(SR.Format_GuidInvalidChar)); return false; } Unsafe.Add(ref result._d, i) = (byte)byteVal; } // Check for last '}' if (numStart + numLen + 1 >= guidString.Length || guidString[numStart + numLen + 1] != '}') { result.SetFailure(overflow: false, nameof(SR.Format_GuidEndBrace)); return false; } // Check if we have extra characters at the end if (numStart + numLen + 1 != guidString.Length - 1) { result.SetFailure(overflow: false, nameof(SR.Format_ExtraJunkAtEnd)); return false; } return true; } [MethodImpl(MethodImplOptions.AggressiveInlining)] private static byte DecodeByte(nuint ch1, nuint ch2, ref int invalidIfNegative) { // TODO https://github.com/dotnet/runtime/issues/13464: // Replace the Unsafe.Add with HexConverter.FromChar once the bounds checks are eliminated. ReadOnlySpan<byte> lookup = HexConverter.CharToHexLookup; int h1 = -1; if (ch1 < (nuint)lookup.Length) { h1 = (sbyte)Unsafe.Add(ref MemoryMarshal.GetReference(lookup), (nint)ch1); } h1 <<= 4; int h2 = -1; if (ch2 < (nuint)lookup.Length) { h2 = (sbyte)Unsafe.Add(ref MemoryMarshal.GetReference(lookup), (nint)ch2); } int result = h1 | h2; invalidIfNegative |= result; return (byte)result; } private static bool TryParseHex(ReadOnlySpan<char> guidString, out ushort result, ref bool overflow) { bool success = TryParseHex(guidString, out uint tmp, ref overflow); result = (ushort)tmp; return success; } private static bool TryParseHex(ReadOnlySpan<char> guidString, out uint result) { bool overflowIgnored = false; return TryParseHex(guidString, out result, ref overflowIgnored); } private static bool TryParseHex(ReadOnlySpan<char> guidString, out uint result, ref bool overflow) { if ((uint)guidString.Length > 0) { if (guidString[0] == '+') { guidString = guidString.Slice(1); } if ((uint)guidString.Length > 1 && guidString[0] == '0' && (guidString[1] | 0x20) == 'x') { guidString = guidString.Slice(2); } } // Skip past leading 0s. int i = 0; for (; i < guidString.Length && guidString[i] == '0'; i++) ; int processedDigits = 0; uint tmp = 0; for (; i < guidString.Length; i++) { char c = guidString[i]; int numValue = HexConverter.FromChar(c); if (numValue == 0xFF) { if (processedDigits > 8) overflow = true; result = 0; return false; } tmp = (tmp * 16) + (uint)numValue; processedDigits++; } if (processedDigits > 8) overflow = true; result = tmp; return true; } private static ReadOnlySpan<char> EatAllWhitespace(ReadOnlySpan<char> str) { // Find the first whitespace character. If there is none, just return the input. int i; for (i = 0; i < str.Length && !char.IsWhiteSpace(str[i]); i++) ; if (i == str.Length) { return str; } // There was at least one whitespace. Copy over everything prior to it to a new array. var chArr = new char[str.Length]; int newLength = 0; if (i > 0) { newLength = i; str.Slice(0, i).CopyTo(chArr); } // Loop through the remaining chars, copying over non-whitespace. for (; i < str.Length; i++) { char c = str[i]; if (!char.IsWhiteSpace(c)) { chArr[newLength++] = c; } } // Return the string with the whitespace removed. return new ReadOnlySpan<char>(chArr, 0, newLength); } private static bool IsHexPrefix(ReadOnlySpan<char> str, int i) => i + 1 < str.Length && str[i] == '0' && (str[i + 1] | 0x20) == 'x'; // Returns an unsigned byte array containing the GUID. public byte[] ToByteArray() { var g = new byte[16]; if (BitConverter.IsLittleEndian) { MemoryMarshal.TryWrite<Guid>(g, ref Unsafe.AsRef(in this)); } else { TryWriteBytes(g); } return g; } // Returns whether bytes are sucessfully written to given span. public bool TryWriteBytes(Span<byte> destination) { if (BitConverter.IsLittleEndian) { return MemoryMarshal.TryWrite(destination, ref Unsafe.AsRef(in this)); } // slower path for BigEndian if (destination.Length < 16) return false; destination[15] = _k; // hoist bounds checks BinaryPrimitives.WriteInt32LittleEndian(destination, _a); BinaryPrimitives.WriteInt16LittleEndian(destination.Slice(4), _b); BinaryPrimitives.WriteInt16LittleEndian(destination.Slice(6), _c); destination[8] = _d; destination[9] = _e; destination[10] = _f; destination[11] = _g; destination[12] = _h; destination[13] = _i; destination[14] = _j; return true; } // Returns the guid in "registry" format. public override string ToString() => ToString("D", null); public override int GetHashCode() { // Simply XOR all the bits of the GUID 32 bits at a time. ref int r = ref Unsafe.AsRef(in _a); return r ^ Unsafe.Add(ref r, 1) ^ Unsafe.Add(ref r, 2) ^ Unsafe.Add(ref r, 3); } // Returns true if and only if the guid represented // by o is the same as this instance. public override bool Equals([NotNullWhen(true)] object? o) => o is Guid g && EqualsCore(this, g); public bool Equals(Guid g) => EqualsCore(this, g); private static bool EqualsCore(in Guid left, in Guid right) { ref int rA = ref Unsafe.AsRef(in left._a); ref int rB = ref Unsafe.AsRef(in right._a); // Compare each element return rA == rB && Unsafe.Add(ref rA, 1) == Unsafe.Add(ref rB, 1) && Unsafe.Add(ref rA, 2) == Unsafe.Add(ref rB, 2) && Unsafe.Add(ref rA, 3) == Unsafe.Add(ref rB, 3); } private static int GetResult(uint me, uint them) => me < them ? -1 : 1; public int CompareTo(object? value) { if (value == null) { return 1; } if (!(value is Guid)) { throw new ArgumentException(SR.Arg_MustBeGuid, nameof(value)); } Guid g = (Guid)value; if (g._a != _a) { return GetResult((uint)_a, (uint)g._a); } if (g._b != _b) { return GetResult((uint)_b, (uint)g._b); } if (g._c != _c) { return GetResult((uint)_c, (uint)g._c); } if (g._d != _d) { return GetResult(_d, g._d); } if (g._e != _e) { return GetResult(_e, g._e); } if (g._f != _f) { return GetResult(_f, g._f); } if (g._g != _g) { return GetResult(_g, g._g); } if (g._h != _h) { return GetResult(_h, g._h); } if (g._i != _i) { return GetResult(_i, g._i); } if (g._j != _j) { return GetResult(_j, g._j); } if (g._k != _k) { return GetResult(_k, g._k); } return 0; } public int CompareTo(Guid value) { if (value._a != _a) { return GetResult((uint)_a, (uint)value._a); } if (value._b != _b) { return GetResult((uint)_b, (uint)value._b); } if (value._c != _c) { return GetResult((uint)_c, (uint)value._c); } if (value._d != _d) { return GetResult(_d, value._d); } if (value._e != _e) { return GetResult(_e, value._e); } if (value._f != _f) { return GetResult(_f, value._f); } if (value._g != _g) { return GetResult(_g, value._g); } if (value._h != _h) { return GetResult(_h, value._h); } if (value._i != _i) { return GetResult(_i, value._i); } if (value._j != _j) { return GetResult(_j, value._j); } if (value._k != _k) { return GetResult(_k, value._k); } return 0; } public static bool operator ==(Guid a, Guid b) => EqualsCore(a, b); public static bool operator !=(Guid a, Guid b) => !EqualsCore(a, b); public string ToString(string? format) { return ToString(format, null); } private static unsafe int HexsToChars(char* guidChars, int a, int b) { guidChars[0] = HexConverter.ToCharLower(a >> 4); guidChars[1] = HexConverter.ToCharLower(a); guidChars[2] = HexConverter.ToCharLower(b >> 4); guidChars[3] = HexConverter.ToCharLower(b); return 4; } private static unsafe int HexsToCharsHexOutput(char* guidChars, int a, int b) { guidChars[0] = '0'; guidChars[1] = 'x'; guidChars[2] = HexConverter.ToCharLower(a >> 4); guidChars[3] = HexConverter.ToCharLower(a); guidChars[4] = ','; guidChars[5] = '0'; guidChars[6] = 'x'; guidChars[7] = HexConverter.ToCharLower(b >> 4); guidChars[8] = HexConverter.ToCharLower(b); return 9; } // IFormattable interface // We currently ignore provider public string ToString(string? format, IFormatProvider? provider) { if (string.IsNullOrEmpty(format)) { format = "D"; } // all acceptable format strings are of length 1 if (format.Length != 1) { throw new FormatException(SR.Format_InvalidGuidFormatSpecification); } int guidSize; switch (format[0]) { case 'D': case 'd': guidSize = 36; break; case 'N': case 'n': guidSize = 32; break; case 'B': case 'b': case 'P': case 'p': guidSize = 38; break; case 'X': case 'x': guidSize = 68; break; default: throw new FormatException(SR.Format_InvalidGuidFormatSpecification); } string guidString = string.FastAllocateString(guidSize); bool result = TryFormat(new Span<char>(ref guidString.GetRawStringData(), guidString.Length), out int bytesWritten, format); Debug.Assert(result && bytesWritten == guidString.Length, "Formatting guid should have succeeded."); return guidString; } // Returns whether the guid is successfully formatted as a span. public bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format = default) { if (format.Length == 0) { format = "D"; } // all acceptable format strings are of length 1 if (format.Length != 1) { throw new FormatException(SR.Format_InvalidGuidFormatSpecification); } bool dash = true; bool hex = false; int braces = 0; int guidSize; switch (format[0]) { case 'D': case 'd': guidSize = 36; break; case 'N': case 'n': dash = false; guidSize = 32; break; case 'B': case 'b': braces = '{' + ('}' << 16); guidSize = 38; break; case 'P': case 'p': braces = '(' + (')' << 16); guidSize = 38; break; case 'X': case 'x': braces = '{' + ('}' << 16); dash = false; hex = true; guidSize = 68; break; default: throw new FormatException(SR.Format_InvalidGuidFormatSpecification); } if (destination.Length < guidSize) { charsWritten = 0; return false; } unsafe { fixed (char* guidChars = &MemoryMarshal.GetReference(destination)) { char* p = guidChars; if (braces != 0) *p++ = (char)braces; if (hex) { // {0xdddddddd,0xdddd,0xdddd,{0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd,0xdd}} *p++ = '0'; *p++ = 'x'; p += HexsToChars(p, _a >> 24, _a >> 16); p += HexsToChars(p, _a >> 8, _a); *p++ = ','; *p++ = '0'; *p++ = 'x'; p += HexsToChars(p, _b >> 8, _b); *p++ = ','; *p++ = '0'; *p++ = 'x'; p += HexsToChars(p, _c >> 8, _c); *p++ = ','; *p++ = '{'; p += HexsToCharsHexOutput(p, _d, _e); *p++ = ','; p += HexsToCharsHexOutput(p, _f, _g); *p++ = ','; p += HexsToCharsHexOutput(p, _h, _i); *p++ = ','; p += HexsToCharsHexOutput(p, _j, _k); *p++ = '}'; } else { // [{|(]dddddddd[-]dddd[-]dddd[-]dddd[-]dddddddddddd[}|)] p += HexsToChars(p, _a >> 24, _a >> 16); p += HexsToChars(p, _a >> 8, _a); if (dash) *p++ = '-'; p += HexsToChars(p, _b >> 8, _b); if (dash) *p++ = '-'; p += HexsToChars(p, _c >> 8, _c); if (dash) *p++ = '-'; p += HexsToChars(p, _d, _e); if (dash) *p++ = '-'; p += HexsToChars(p, _f, _g); p += HexsToChars(p, _h, _i); p += HexsToChars(p, _j, _k); } if (braces != 0) *p++ = (char)(braces >> 16); Debug.Assert(p - guidChars == guidSize); } } charsWritten = guidSize; return true; } bool ISpanFormattable.TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider? provider) { // Like with the IFormattable implementation, provider is ignored. return TryFormat(destination, out charsWritten, format); } #if FEATURE_GENERIC_MATH // // IComparisonOperators // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators<Guid, Guid>.operator <(Guid left, Guid right) { if (left._a != right._a) { return (uint)left._a < (uint)right._a; } if (left._b != right._b) { return (uint)left._b < (uint)right._b; } if (left._c != right._c) { return (uint)left._c < (uint)right._c; } if (left._d != right._d) { return left._d < right._d; } if (left._e != right._e) { return left._e < right._e; } if (left._f != right._f) { return left._f < right._f; } if (left._g != right._g) { return left._g < right._g; } if (left._h != right._h) { return left._h < right._h; } if (left._i != right._i) { return left._i < right._i; } if (left._j != right._j) { return left._j < right._j; } if (left._k != right._k) { return left._k < right._k; } return false; } [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators<Guid, Guid>.operator <=(Guid left, Guid right) { if (left._a != right._a) { return (uint)left._a < (uint)right._a; } if (left._b != right._b) { return (uint)left._b < (uint)right._b; } if (left._c != right._c) { return (uint)left._c < (uint)right._c; } if (left._d != right._d) { return left._d < right._d; } if (left._e != right._e) { return left._e < right._e; } if (left._f != right._f) { return left._f < right._f; } if (left._g != right._g) { return left._g < right._g; } if (left._h != right._h) { return left._h < right._h; } if (left._i != right._i) { return left._i < right._i; } if (left._j != right._j) { return left._j < right._j; } if (left._k != right._k) { return left._k < right._k; } return true; } [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators<Guid, Guid>.operator >(Guid left, Guid right) { if (left._a != right._a) { return (uint)left._a > (uint)right._a; } if (left._b != right._b) { return (uint)left._b > (uint)right._b; } if (left._c != right._c) { return (uint)left._c > (uint)right._c; } if (left._d != right._d) { return left._d > right._d; } if (left._e != right._e) { return left._e > right._e; } if (left._f != right._f) { return left._f > right._f; } if (left._g != right._g) { return left._g > right._g; } if (left._h != right._h) { return left._h > right._h; } if (left._i != right._i) { return left._i > right._i; } if (left._j != right._j) { return left._j > right._j; } if (left._k != right._k) { return left._k > right._k; } return false; } [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IComparisonOperators<Guid, Guid>.operator >=(Guid left, Guid right) { if (left._a != right._a) { return (uint)left._a > (uint)right._a; } if (left._b != right._b) { return (uint)left._b > (uint)right._b; } if (left._c != right._c) { return (uint)left._c > (uint)right._c; } if (left._d != right._d) { return left._d > right._d; } if (left._e != right._e) { return left._e > right._e; } if (left._f != right._f) { return left._f > right._f; } if (left._g != right._g) { return left._g > right._g; } if (left._h != right._h) { return left._h > right._h; } if (left._i != right._i) { return left._i > right._i; } if (left._j != right._j) { return left._j > right._j; } if (left._k != right._k) { return left._k > right._k; } return true; } // // IEqualityOperators // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators<Guid, Guid>.operator ==(Guid left, Guid right) => left == right; [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IEqualityOperators<Guid, Guid>.operator !=(Guid left, Guid right) => left != right; // // IParseable // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Guid IParseable<Guid>.Parse(string s, IFormatProvider? provider) => Parse(s); [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool IParseable<Guid>.TryParse([NotNullWhen(true)] string? s, IFormatProvider? provider, out Guid result) => TryParse(s, out result); // // ISpanParseable // [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static Guid ISpanParseable<Guid>.Parse(ReadOnlySpan<char> s, IFormatProvider? provider) => Parse(s); [RequiresPreviewFeatures(Number.PreviewFeatureMessage, Url = Number.PreviewFeatureUrl)] static bool ISpanParseable<Guid>.TryParse(ReadOnlySpan<char> s, IFormatProvider? provider, out Guid result) => TryParse(s, out result); #endif // FEATURE_GENERIC_MATH } }
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/tests/JIT/HardwareIntrinsics/General/Vector128_1/op_Inequality.Single.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; namespace JIT.HardwareIntrinsics.General { public static partial class Program { private static void op_InequalitySingle() { var test = new VectorBooleanBinaryOpTest__op_InequalitySingle(); // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); // Validates passing a static member works test.RunClsVarScenario(); // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); // Validates passing the field of a local class works test.RunClassLclFldScenario(); // Validates passing an instance member of a class works test.RunClassFldScenario(); // Validates passing the field of a local struct works test.RunStructLclFldScenario(); // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class VectorBooleanBinaryOpTest__op_InequalitySingle { private struct DataTable { private byte[] inArray1; private byte[] inArray2; private GCHandle inHandle1; private GCHandle inHandle2; private ulong alignment; public DataTable(Single[] inArray1, Single[] inArray2, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Single>(); int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<Single>(); if ((alignment != 32 && alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfinArray2) { throw new ArgumentException("Invalid value of alignment"); } this.inArray1 = new byte[alignment * 2]; this.inArray2 = new byte[alignment * 2]; this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned); this.inHandle2 = GCHandle.Alloc(this.inArray2, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<Single, byte>(ref inArray1[0]), (uint)sizeOfinArray1); Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<Single, byte>(ref inArray2[0]), (uint)sizeOfinArray2); } public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment); public void* inArray2Ptr => Align((byte*)(inHandle2.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle1.Free(); inHandle2.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector128<Single> _fld1; public Vector128<Single> _fld2; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSingle(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref testStruct._fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSingle(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref testStruct._fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>()); return testStruct; } public void RunStructFldScenario(VectorBooleanBinaryOpTest__op_InequalitySingle testClass) { var result = _fld1 != _fld2; testClass.ValidateResult(_fld1, _fld2, result); } } private static readonly int LargestVectorSize = 16; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single); private static Single[] _data1 = new Single[Op1ElementCount]; private static Single[] _data2 = new Single[Op2ElementCount]; private static Vector128<Single> _clsVar1; private static Vector128<Single> _clsVar2; private Vector128<Single> _fld1; private Vector128<Single> _fld2; private DataTable _dataTable; static VectorBooleanBinaryOpTest__op_InequalitySingle() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSingle(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSingle(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>()); } public VectorBooleanBinaryOpTest__op_InequalitySingle() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSingle(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSingle(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSingle(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSingle(); } _dataTable = new DataTable(_data1, _data2, LargestVectorSize); } public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr) != Unsafe.Read<Vector128<Single>>(_dataTable.inArray2Ptr); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, result); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var result = typeof(Vector128<Single>).GetMethod("op_Inequality", new Type[] { typeof(Vector128<Single>), typeof(Vector128<Single>) }) .Invoke(null, new object[] { Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<Single>>(_dataTable.inArray2Ptr) }); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, (bool)(result)); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = _clsVar1 != _clsVar2; ValidateResult(_clsVar1, _clsVar2, result); } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector128<Single>>(_dataTable.inArray2Ptr); var result = op1 != op2; ValidateResult(op1, op2, result); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new VectorBooleanBinaryOpTest__op_InequalitySingle(); var result = test._fld1 != test._fld2; ValidateResult(test._fld1, test._fld2, result); } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = _fld1 != _fld2; ValidateResult(_fld1, _fld2, result); } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = test._fld1 != test._fld2; ValidateResult(test._fld1, test._fld2, result); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } private void ValidateResult(Vector128<Single> op1, Vector128<Single> op2, bool result, [CallerMemberName] string method = "") { Single[] inArray1 = new Single[Op1ElementCount]; Single[] inArray2 = new Single[Op2ElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), op1); Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), op2); ValidateResult(inArray1, inArray2, result, method); } private void ValidateResult(void* op1, void* op2, bool result, [CallerMemberName] string method = "") { Single[] inArray1 = new Single[Op1ElementCount]; Single[] inArray2 = new Single[Op2ElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector128<Single>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector128<Single>>()); ValidateResult(inArray1, inArray2, result, method); } private void ValidateResult(Single[] left, Single[] right, bool result, [CallerMemberName] string method = "") { bool succeeded = true; var expectedResult = true; for (var i = 0; i < Op1ElementCount; i++) { expectedResult |= (left[i] != right[i]); } succeeded = (expectedResult == result); if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(Vector128)}.op_Inequality<Single>(Vector128<Single>, Vector128<Single>): {method} failed:"); TestLibrary.TestFramework.LogInformation($" left: ({string.Join(", ", left)})"); TestLibrary.TestFramework.LogInformation($" right: ({string.Join(", ", right)})"); TestLibrary.TestFramework.LogInformation($" result: ({result})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; namespace JIT.HardwareIntrinsics.General { public static partial class Program { private static void op_InequalitySingle() { var test = new VectorBooleanBinaryOpTest__op_InequalitySingle(); // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); // Validates passing a static member works test.RunClsVarScenario(); // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); // Validates passing the field of a local class works test.RunClassLclFldScenario(); // Validates passing an instance member of a class works test.RunClassFldScenario(); // Validates passing the field of a local struct works test.RunStructLclFldScenario(); // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class VectorBooleanBinaryOpTest__op_InequalitySingle { private struct DataTable { private byte[] inArray1; private byte[] inArray2; private GCHandle inHandle1; private GCHandle inHandle2; private ulong alignment; public DataTable(Single[] inArray1, Single[] inArray2, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Single>(); int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<Single>(); if ((alignment != 32 && alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfinArray2) { throw new ArgumentException("Invalid value of alignment"); } this.inArray1 = new byte[alignment * 2]; this.inArray2 = new byte[alignment * 2]; this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned); this.inHandle2 = GCHandle.Alloc(this.inArray2, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<Single, byte>(ref inArray1[0]), (uint)sizeOfinArray1); Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<Single, byte>(ref inArray2[0]), (uint)sizeOfinArray2); } public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment); public void* inArray2Ptr => Align((byte*)(inHandle2.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle1.Free(); inHandle2.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector128<Single> _fld1; public Vector128<Single> _fld2; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSingle(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref testStruct._fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSingle(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref testStruct._fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>()); return testStruct; } public void RunStructFldScenario(VectorBooleanBinaryOpTest__op_InequalitySingle testClass) { var result = _fld1 != _fld2; testClass.ValidateResult(_fld1, _fld2, result); } } private static readonly int LargestVectorSize = 16; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Single>>() / sizeof(Single); private static Single[] _data1 = new Single[Op1ElementCount]; private static Single[] _data2 = new Single[Op2ElementCount]; private static Vector128<Single> _clsVar1; private static Vector128<Single> _clsVar2; private Vector128<Single> _fld1; private Vector128<Single> _fld2; private DataTable _dataTable; static VectorBooleanBinaryOpTest__op_InequalitySingle() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSingle(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSingle(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _clsVar2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>()); } public VectorBooleanBinaryOpTest__op_InequalitySingle() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSingle(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld1), ref Unsafe.As<Single, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Single>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSingle(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Single>, byte>(ref _fld2), ref Unsafe.As<Single, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Single>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSingle(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSingle(); } _dataTable = new DataTable(_data1, _data2, LargestVectorSize); } public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr) != Unsafe.Read<Vector128<Single>>(_dataTable.inArray2Ptr); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, result); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var result = typeof(Vector128<Single>).GetMethod("op_Inequality", new Type[] { typeof(Vector128<Single>), typeof(Vector128<Single>) }) .Invoke(null, new object[] { Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<Single>>(_dataTable.inArray2Ptr) }); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, (bool)(result)); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = _clsVar1 != _clsVar2; ValidateResult(_clsVar1, _clsVar2, result); } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector128<Single>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector128<Single>>(_dataTable.inArray2Ptr); var result = op1 != op2; ValidateResult(op1, op2, result); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new VectorBooleanBinaryOpTest__op_InequalitySingle(); var result = test._fld1 != test._fld2; ValidateResult(test._fld1, test._fld2, result); } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = _fld1 != _fld2; ValidateResult(_fld1, _fld2, result); } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = test._fld1 != test._fld2; ValidateResult(test._fld1, test._fld2, result); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } private void ValidateResult(Vector128<Single> op1, Vector128<Single> op2, bool result, [CallerMemberName] string method = "") { Single[] inArray1 = new Single[Op1ElementCount]; Single[] inArray2 = new Single[Op2ElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), op1); Unsafe.WriteUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), op2); ValidateResult(inArray1, inArray2, result, method); } private void ValidateResult(void* op1, void* op2, bool result, [CallerMemberName] string method = "") { Single[] inArray1 = new Single[Op1ElementCount]; Single[] inArray2 = new Single[Op2ElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector128<Single>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Single, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector128<Single>>()); ValidateResult(inArray1, inArray2, result, method); } private void ValidateResult(Single[] left, Single[] right, bool result, [CallerMemberName] string method = "") { bool succeeded = true; var expectedResult = true; for (var i = 0; i < Op1ElementCount; i++) { expectedResult |= (left[i] != right[i]); } succeeded = (expectedResult == result); if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(Vector128)}.op_Inequality<Single>(Vector128<Single>, Vector128<Single>): {method} failed:"); TestLibrary.TestFramework.LogInformation($" left: ({string.Join(", ", left)})"); TestLibrary.TestFramework.LogInformation($" right: ({string.Join(", ", right)})"); TestLibrary.TestFramework.LogInformation($" result: ({result})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamStreamToStreamTest.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Generic; using System.IO; using System.Linq; using System.Net.Sockets; using System.Net.Test.Common; using System.Security.Authentication; using System.Security.Cryptography.X509Certificates; using System.Text; using System.Threading; using System.Threading.Tasks; using Microsoft.DotNet.XUnitExtensions; using Xunit; namespace System.Net.Security.Tests { using Configuration = System.Net.Test.Common.Configuration; public abstract class SslStreamStreamToStreamTest { private readonly byte[] _sampleMsg = Encoding.UTF8.GetBytes("Sample Test Message"); protected static async Task WithServerCertificate(X509Certificate serverCertificate, Func<X509Certificate, string, Task> func) { X509Certificate certificate = serverCertificate ?? Configuration.Certificates.GetServerCertificate(); try { string name; if (certificate is X509Certificate2 cert2) { name = cert2.GetNameInfo(X509NameType.SimpleName, forIssuer: false); } else { using (cert2 = new X509Certificate2(certificate)) { name = cert2.GetNameInfo(X509NameType.SimpleName, forIssuer: false); } } await func(certificate, name).ConfigureAwait(false); } finally { if (certificate != serverCertificate) { certificate.Dispose(); } } } protected abstract Task DoHandshake(SslStream clientSslStream, SslStream serverSslStream, X509Certificate serverCertificate = null, X509Certificate clientCertificate = null); protected abstract Task<int> ReadAsync(Stream stream, byte[] buffer, int offset, int count, CancellationToken cancellationToken = default); protected abstract Task WriteAsync(Stream stream, byte[] buffer, int offset, int count, CancellationToken cancellationToken = default); public static IEnumerable<object[]> SslStream_StreamToStream_Authentication_Success_MemberData() { using (X509Certificate2 serverCert = Configuration.Certificates.GetServerCertificate()) using (X509Certificate2 clientCert = Configuration.Certificates.GetClientCertificate()) { yield return new object[] { new X509Certificate2(serverCert), new X509Certificate2(clientCert) }; yield return new object[] { new X509Certificate(serverCert.Export(X509ContentType.Pfx)), new X509Certificate(clientCert.Export(X509ContentType.Pfx)) }; } } [ConditionalTheory] [MemberData(nameof(SslStream_StreamToStream_Authentication_Success_MemberData))] [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "X509 certificate store is not supported on iOS or tvOS.")] public async Task SslStream_StreamToStream_Authentication_Success(X509Certificate serverCert = null, X509Certificate clientCert = null) { if (PlatformDetection.IsWindows10Version20348OrGreater) { // [ActiveIssue("https://github.com/dotnet/runtime/issues/58927")] throw new SkipTestException("Unstable on Windows 11"); } (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); using (var client = new SslStream(stream1, false, AllowAnyServerCertificate)) using (var server = new SslStream(stream2, false, delegate { return true; })) { await DoHandshake(client, server, serverCert, clientCert); Assert.True(client.IsAuthenticated); Assert.True(server.IsAuthenticated); } clientCert?.Dispose(); serverCert?.Dispose(); } [Fact] public async Task SslStream_StreamToStream_Authentication_IncorrectServerName_Fail() { (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); using (var client = new SslStream(stream1)) using (var server = new SslStream(stream2)) using (var certificate = Configuration.Certificates.GetServerCertificate()) { Task t1 = client.AuthenticateAsClientAsync("incorrectServer"); Task t2 = server.AuthenticateAsServerAsync(certificate); await Assert.ThrowsAsync<AuthenticationException>(() => t1); try { await t2; } catch { // Ignore outcome of t2. It can succeed or fail depending on timing. } } } [Fact] public async Task SslStream_ServerLocalCertificateSelectionCallbackReturnsNull_Throw() { var selectionCallback = new LocalCertificateSelectionCallback((object sender, string targetHost, X509CertificateCollection localCertificates, X509Certificate remoteCertificate, string[] issuers) => { return null; }); (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); using (var client = new SslStream(stream1, false, AllowAnyServerCertificate)) using (var server = new SslStream(stream2, false, null, selectionCallback)) using (X509Certificate2 certificate = Configuration.Certificates.GetServerCertificate()) { await Assert.ThrowsAsync<NotSupportedException>(async () => await TestConfiguration.WhenAllOrAnyFailedWithTimeout(client.AuthenticateAsClientAsync(certificate.GetNameInfo(X509NameType.SimpleName, false)), server.AuthenticateAsServerAsync(certificate)) ); } } [Fact] [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "X509 certificate store is not supported on iOS or tvOS.")] public async Task Read_CorrectlyUnlocksAfterFailure() { (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); var clientStream = new ThrowingDelegatingStream(stream1); using (var clientSslStream = new SslStream(clientStream, false, AllowAnyServerCertificate)) using (var serverSslStream = new SslStream(stream2)) { await DoHandshake(clientSslStream, serverSslStream); // Throw an exception from the wrapped stream's read operation clientStream.ExceptionToThrow = new FormatException(); IOException thrown = await Assert.ThrowsAsync<IOException>(() => ReadAsync(clientSslStream, new byte[1], 0, 1)); Assert.Same(clientStream.ExceptionToThrow, thrown.InnerException); clientStream.ExceptionToThrow = null; // Validate that the SslStream continues to be usable for (byte b = 42; b < 52; b++) // arbitrary test values { await WriteAsync(serverSslStream, new byte[1] { b }, 0, 1); byte[] buffer = new byte[1]; Assert.Equal(1, await ReadAsync(clientSslStream, buffer, 0, 1)); Assert.Equal(b, buffer[0]); } } } [Fact] [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "X509 certificate store is not supported on iOS or tvOS.")] public async Task Write_CorrectlyUnlocksAfterFailure() { (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); var clientStream = new ThrowingDelegatingStream(stream1); using (var clientSslStream = new SslStream(clientStream, false, AllowAnyServerCertificate)) using (var serverSslStream = new SslStream(stream2)) { await DoHandshake(clientSslStream, serverSslStream); // Throw an exception from the wrapped stream's write operation clientStream.ExceptionToThrow = new FormatException(); IOException thrown = await Assert.ThrowsAsync<IOException>(() => WriteAsync(clientSslStream, new byte[1], 0, 1)); Assert.Same(clientStream.ExceptionToThrow, thrown.InnerException); clientStream.ExceptionToThrow = null; // Validate that the SslStream continues to be writable. However, the stream is still largely // unusable: because the previously encrypted data won't have been written to the underlying // stream and thus not received by the reader, if we tried to validate this data being received // by the reader, it would likely fail with a decryption error. await WriteAsync(clientSslStream, new byte[1] { 42 }, 0, 1); } } [Fact] public async Task Read_InvokedSynchronously() { (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); var clientStream = new PreReadWriteActionDelegatingStream(stream1); using (var clientSslStream = new SslStream(clientStream, false, AllowAnyServerCertificate)) using (var serverSslStream = new SslStream(stream2)) { await DoHandshake(clientSslStream, serverSslStream); // Validate that the read call to the underlying stream is made as part of the // synchronous call to the read method on SslStream, even if the method is async. using (var tl = new ThreadLocal<int>()) { await WriteAsync(serverSslStream, new byte[1], 0, 1); tl.Value = 42; clientStream.PreReadWriteAction = () => Assert.Equal(42, tl.Value); Task t = ReadAsync(clientSslStream, new byte[1], 0, 1); tl.Value = 0; await t; } } } [Fact] [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "X509 certificate store is not supported on iOS or tvOS.")] public async Task Write_InvokedSynchronously() { (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); var clientStream = new PreReadWriteActionDelegatingStream(stream1); using (var clientSslStream = new SslStream(clientStream, false, AllowAnyServerCertificate)) using (var serverSslStream = new SslStream(stream2)) { await DoHandshake(clientSslStream, serverSslStream); // Validate that the write call to the underlying stream is made as part of the // synchronous call to the write method on SslStream, even if the method is async. using (var tl = new ThreadLocal<int>()) { tl.Value = 42; clientStream.PreReadWriteAction = () => Assert.Equal(42, tl.Value); Task t = WriteAsync(clientSslStream, new byte[1], 0, 1); tl.Value = 0; await t; } } } [Fact] public async Task SslStream_StreamToStream_Dispose_Throws() { if (this is SslStreamStreamToStreamTest_SyncBase) { // This test assumes operations complete asynchronously. return; } (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); using (var clientSslStream = new SslStream(DelegateDelegatingStream.NopDispose(stream1), false, AllowAnyServerCertificate)) { var serverSslStream = new SslStream(DelegateDelegatingStream.NopDispose(stream2)); await DoHandshake(clientSslStream, serverSslStream); var serverBuffer = new byte[1]; Task serverReadTask = ReadAsync(serverSslStream, serverBuffer, 0, serverBuffer.Length); await WriteAsync(serverSslStream, new byte[] { 1 }, 0, 1) .WaitAsync(TestConfiguration.PassingTestTimeout); // Shouldn't throw, the context is disposed now. // Since the server read task is in progress, the read buffer is not returned to ArrayPool. serverSslStream.Dispose(); // Read in client var clientBuffer = new byte[1]; await ReadAsync(clientSslStream, clientBuffer, 0, clientBuffer.Length); Assert.Equal(1, clientBuffer[0]); await WriteAsync(clientSslStream, new byte[] { 2 }, 0, 1); // We're inconsistent as to whether the ObjectDisposedException is thrown directly // or wrapped in an IOException. For Begin/End, it's always wrapped; for Async, // it's only wrapped on .NET Framework. if (this is SslStreamStreamToStreamTest_BeginEnd || PlatformDetection.IsNetFramework) { await Assert.ThrowsAsync<ObjectDisposedException>(() => serverReadTask); } else { IOException serverException = await Assert.ThrowsAsync<IOException>(() => serverReadTask); Assert.IsType<ObjectDisposedException>(serverException.InnerException); } await Assert.ThrowsAsync<ObjectDisposedException>(() => ReadAsync(serverSslStream, serverBuffer, 0, serverBuffer.Length)); // Now, there is no pending read, so the internal buffer will be returned to ArrayPool. serverSslStream.Dispose(); await Assert.ThrowsAsync<ObjectDisposedException>(() => ReadAsync(serverSslStream, serverBuffer, 0, serverBuffer.Length)); } } [Fact] public async Task SslStream_StreamToStream_EOFDuringFrameRead_ThrowsIOException() { (Stream clientStream, Stream serverStream) = TestHelper.GetConnectedStreams(); using (clientStream) using (serverStream) { int readMode = 0; var serverWrappedNetworkStream = new DelegateStream( canWriteFunc: () => true, canReadFunc: () => true, writeFunc: (buffer, offset, count) => serverStream.Write(buffer, offset, count), writeAsyncFunc: (buffer, offset, count, token) => serverStream.WriteAsync(buffer, offset, count, token), readFunc: (buffer, offset, count) => { // Do normal reads as requested until the read mode is set // to 1. Then do a single read of only 10 bytes to read only // part of the message, and subsequently return EOF. if (readMode == 0) { return serverStream.Read(buffer, offset, count); } else if (readMode == 1) { readMode = 2; return serverStream.Read(buffer, offset, 10); // read at least header but less than full frame } else { return 0; } }, readAsyncFunc: (buffer, offset, count, token) => { // Do normal reads as requested until the read mode is set // to 1. Then do a single read of only 10 bytes to read only // part of the message, and subsequently return EOF. if (readMode == 0) { return serverStream.ReadAsync(buffer, offset, count); } else if (readMode == 1) { readMode = 2; return serverStream.ReadAsync(buffer, offset, 10); // read at least header but less than full frame } else { return Task.FromResult(0); } }); using (var clientSslStream = new SslStream(clientStream, false, AllowAnyServerCertificate)) using (var serverSslStream = new SslStream(serverWrappedNetworkStream)) { await DoHandshake(clientSslStream, serverSslStream); await WriteAsync(clientSslStream, new byte[20], 0, 20); readMode = 1; await Assert.ThrowsAsync<IOException>(() => ReadAsync(serverSslStream, new byte[1], 0, 1)); } } } private bool VerifyOutput(byte[] actualBuffer, byte[] expectedBuffer) { return expectedBuffer.SequenceEqual(actualBuffer); } protected bool AllowAnyServerCertificate( object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { SslPolicyErrors expectedSslPolicyErrors = SslPolicyErrors.None; if (!Capability.IsTrustedRootCertificateInstalled()) { expectedSslPolicyErrors = SslPolicyErrors.RemoteCertificateChainErrors; } Assert.Equal(expectedSslPolicyErrors, sslPolicyErrors); if (sslPolicyErrors == expectedSslPolicyErrors) { return true; } else { return false; } } private class PreReadWriteActionDelegatingStream : Stream { private readonly Stream _stream; public PreReadWriteActionDelegatingStream(Stream stream) => _stream = stream; public Action PreReadWriteAction { get; set; } public override bool CanRead => _stream.CanRead; public override bool CanWrite => _stream.CanWrite; public override bool CanSeek => _stream.CanSeek; protected override void Dispose(bool disposing) => _stream.Dispose(); public override long Length => _stream.Length; public override long Position { get => _stream.Position; set => _stream.Position = value; } public override void Flush() => _stream.Flush(); public override long Seek(long offset, SeekOrigin origin) => _stream.Seek(offset, origin); public override void SetLength(long value) => _stream.SetLength(value); public override int Read(byte[] buffer, int offset, int count) { PreReadWriteAction?.Invoke(); return _stream.Read(buffer, offset, count); } public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state) { PreReadWriteAction?.Invoke(); return _stream.BeginRead(buffer, offset, count, callback, state); } public override int EndRead(IAsyncResult asyncResult) => _stream.EndRead(asyncResult); public override Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) { PreReadWriteAction?.Invoke(); return _stream.ReadAsync(buffer, offset, count, cancellationToken); } public override void Write(byte[] buffer, int offset, int count) { PreReadWriteAction?.Invoke(); _stream.Write(buffer, offset, count); } public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state) { PreReadWriteAction?.Invoke(); return _stream.BeginWrite(buffer, offset, count, callback, state); } public override void EndWrite(IAsyncResult asyncResult) => _stream.EndWrite(asyncResult); public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) { PreReadWriteAction?.Invoke(); return _stream.WriteAsync(buffer, offset, count, cancellationToken); } } private sealed class ThrowingDelegatingStream : PreReadWriteActionDelegatingStream { public ThrowingDelegatingStream(Stream stream) : base(stream) { PreReadWriteAction = () => { if (ExceptionToThrow != null) { throw ExceptionToThrow; } }; } public Exception ExceptionToThrow { get; set; } } } public sealed class SslStreamStreamToStreamTest_Async : SslStreamStreamToStreamTest { protected override async Task DoHandshake(SslStream clientSslStream, SslStream serverSslStream, X509Certificate serverCertificate = null, X509Certificate clientCertificate = null) { X509CertificateCollection clientCerts = clientCertificate != null ? new X509CertificateCollection() { clientCertificate } : null; await WithServerCertificate(serverCertificate, async(certificate, name) => { Task t1 = clientSslStream.AuthenticateAsClientAsync(name, clientCerts, SslProtocols.None, checkCertificateRevocation: false); Task t2 = serverSslStream.AuthenticateAsServerAsync(certificate, clientCertificateRequired: clientCertificate != null, checkCertificateRevocation: false); await TestConfiguration.WhenAllOrAnyFailedWithTimeout(t1, t2); }); } protected override Task<int> ReadAsync(Stream stream, byte[] buffer, int offset, int count, CancellationToken cancellationToken) => stream.ReadAsync(buffer, offset, count, cancellationToken); protected override Task WriteAsync(Stream stream, byte[] buffer, int offset, int count, CancellationToken cancellationToken) => stream.WriteAsync(buffer, offset, count, cancellationToken); } public sealed class SslStreamStreamToStreamTest_BeginEnd : SslStreamStreamToStreamTest { protected override async Task DoHandshake(SslStream clientSslStream, SslStream serverSslStream, X509Certificate serverCertificate = null, X509Certificate clientCertificate = null) { X509CertificateCollection clientCerts = clientCertificate != null ? new X509CertificateCollection() { clientCertificate } : null; await WithServerCertificate(serverCertificate, async (certificate, name) => { Task t1 = Task.Factory.FromAsync(clientSslStream.BeginAuthenticateAsClient(name, clientCerts, SslProtocols.None, checkCertificateRevocation: false, null, null), clientSslStream.EndAuthenticateAsClient); Task t2 = Task.Factory.FromAsync(serverSslStream.BeginAuthenticateAsServer(certificate, clientCertificateRequired: clientCertificate != null, checkCertificateRevocation: false, null, null), serverSslStream.EndAuthenticateAsServer); await TestConfiguration.WhenAllOrAnyFailedWithTimeout(t1, t2); }); } protected override Task<int> ReadAsync(Stream stream, byte[] buffer, int offset, int count, CancellationToken cancellationToken) => cancellationToken.IsCancellationRequested ? Task.FromCanceled<int>(cancellationToken) : Task.Factory.FromAsync(stream.BeginRead, stream.EndRead, buffer, offset, count, null); protected override Task WriteAsync(Stream stream, byte[] buffer, int offset, int count, CancellationToken cancellationToken) => cancellationToken.IsCancellationRequested ? Task.FromCanceled<int>(cancellationToken) : Task.Factory.FromAsync(stream.BeginWrite, stream.EndWrite, buffer, offset, count, null); } public abstract class SslStreamStreamToStreamTest_SyncBase : SslStreamStreamToStreamTest { protected override Task<int> ReadAsync(Stream stream, byte[] buffer, int offset, int count, CancellationToken cancellationToken) { if (cancellationToken.IsCancellationRequested) { return Task.FromCanceled<int>(cancellationToken); } try { return Task.FromResult<int>(stream.Read(buffer, offset, count)); } catch (Exception e) { return Task.FromException<int>(e); } } protected override Task WriteAsync(Stream stream, byte[] buffer, int offset, int count, CancellationToken cancellationToken) { if (cancellationToken.IsCancellationRequested) { return Task.FromCanceled<int>(cancellationToken); } try { stream.Write(buffer, offset, count); return Task.CompletedTask; } catch (Exception e) { return Task.FromException<int>(e); } } [Fact] public async Task SslStream_StreamToStream_Handshake_DisposeClient_Throws() { (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); using (var clientSslStream = new SslStream(stream1, false, AllowAnyServerCertificate)) using (var serverSslStream = new SslStream(stream2)) { stream1.Dispose(); await Assert.ThrowsAsync<AggregateException>(() => DoHandshake(clientSslStream, serverSslStream)); } } [Fact] public async Task SslStream_StreamToStream_Handshake_DisposeServer_Throws() { (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); using (var clientSslStream = new SslStream(stream1, false, AllowAnyServerCertificate)) using (var serverSslStream = new SslStream(stream2)) { stream2.Dispose(); await Assert.ThrowsAsync<AggregateException>(() => DoHandshake(clientSslStream, serverSslStream)); } } [Fact] public async Task SslStream_StreamToStream_Handshake_DisposeClientSsl_Throws() { (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); using (var serverSslStream = new SslStream(DelegateDelegatingStream.NopDispose(stream1))) { var clientSslStream = new SslStream(DelegateDelegatingStream.NopDispose(stream2), false, AllowAnyServerCertificate); clientSslStream.Dispose(); await Assert.ThrowsAsync<ObjectDisposedException>(() => DoHandshake(clientSslStream, serverSslStream)); } } [Fact] public async Task SslStream_StreamToStream_Handshake_DisposeServerSsl_Throws() { (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); using (var clientSslStream = new SslStream(DelegateDelegatingStream.NopDispose(stream1), false, AllowAnyServerCertificate)) { var serverSslStream = new SslStream(DelegateDelegatingStream.NopDispose(stream2)); serverSslStream.Dispose(); await Assert.ThrowsAsync<ObjectDisposedException>(() => DoHandshake(clientSslStream, serverSslStream)); } } } public sealed class SslStreamStreamToStreamTest_SyncParameters : SslStreamStreamToStreamTest_SyncBase { protected override async Task DoHandshake(SslStream clientSslStream, SslStream serverSslStream, X509Certificate serverCertificate = null, X509Certificate clientCertificate = null) { X509CertificateCollection clientCerts = clientCertificate != null ? new X509CertificateCollection() { clientCertificate } : null; await WithServerCertificate(serverCertificate, async (certificate, name) => { Task t1 = Task.Run(() => clientSslStream.AuthenticateAsClient(name, clientCerts, SslProtocols.None, checkCertificateRevocation: false)); Task t2 = Task.Run(() => serverSslStream.AuthenticateAsServer(certificate, clientCertificateRequired: clientCertificate != null, checkCertificateRevocation: false)); await TestConfiguration.WhenAllOrAnyFailedWithTimeout(t1, t2); }); } } public sealed class SslStreamStreamToStreamTest_SyncSslOptions : SslStreamStreamToStreamTest_SyncBase { protected override async Task DoHandshake(SslStream clientSslStream, SslStream serverSslStream, X509Certificate serverCertificate = null, X509Certificate clientCertificate = null) { X509CertificateCollection clientCerts = clientCertificate != null ? new X509CertificateCollection() { clientCertificate } : null; await WithServerCertificate(serverCertificate, async (certificate, name) => { SslClientAuthenticationOptions clientOptions = new SslClientAuthenticationOptions { TargetHost = name, ClientCertificates = clientCerts, EnabledSslProtocols = SslProtocols.None, }; SslServerAuthenticationOptions serverOptions = new SslServerAuthenticationOptions() { ServerCertificate = certificate, ClientCertificateRequired = clientCertificate != null, }; Task t1 = Task.Run(() => clientSslStream.AuthenticateAsClient(clientOptions)); Task t2 = Task.Run(() => serverSslStream.AuthenticateAsServer(serverOptions)); await TestConfiguration.WhenAllOrAnyFailedWithTimeout(t1, t2); }); } } public sealed class SslStreamStreamToStreamTest_MemoryAsync : SslStreamStreamToStreamTest { protected override async Task DoHandshake(SslStream clientSslStream, SslStream serverSslStream, X509Certificate serverCertificate = null, X509Certificate clientCertificate = null) { X509CertificateCollection clientCerts = clientCertificate != null ? new X509CertificateCollection() { clientCertificate } : null; await WithServerCertificate(serverCertificate, async(certificate, name) => { Task t1 = clientSslStream.AuthenticateAsClientAsync(new SslClientAuthenticationOptions() { TargetHost = name, ClientCertificates = clientCerts }, CancellationToken.None); Task t2 = serverSslStream.AuthenticateAsServerAsync(new SslServerAuthenticationOptions() { ServerCertificate = certificate, ClientCertificateRequired = clientCertificate != null }, CancellationToken.None); await TestConfiguration.WhenAllOrAnyFailedWithTimeout(t1, t2); }); } protected override Task<int> ReadAsync(Stream stream, byte[] buffer, int offset, int count, CancellationToken cancellationToken) => stream.ReadAsync(new Memory<byte>(buffer, offset, count), cancellationToken).AsTask(); protected override Task WriteAsync(Stream stream, byte[] buffer, int offset, int count, CancellationToken cancellationToken) => stream.WriteAsync(new ReadOnlyMemory<byte>(buffer, offset, count), cancellationToken).AsTask(); [Fact] public async Task Authenticate_Precanceled_ThrowsOperationCanceledException() { (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); using (var clientSslStream = new SslStream(stream1, false, AllowAnyServerCertificate)) using (var serverSslStream = new SslStream(stream2)) using (X509Certificate2 certificate = Configuration.Certificates.GetServerCertificate()) { await Assert.ThrowsAnyAsync<OperationCanceledException>(() => clientSslStream.AuthenticateAsClientAsync(new SslClientAuthenticationOptions() { TargetHost = certificate.GetNameInfo(X509NameType.SimpleName, false) }, new CancellationToken(true))); await Assert.ThrowsAnyAsync<OperationCanceledException>(() => serverSslStream.AuthenticateAsServerAsync(new SslServerAuthenticationOptions() { ServerCertificate = certificate }, new CancellationToken(true))); } } [Fact] public async Task AuthenticateAsClientAsync_MemoryBuffer_CanceledAfterStart_ThrowsOperationCanceledException() { (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); using (var clientSslStream = new SslStream(stream1, false, AllowAnyServerCertificate)) using (var serverSslStream = new SslStream(stream2)) using (X509Certificate2 certificate = Configuration.Certificates.GetServerCertificate()) { var cts = new CancellationTokenSource(); Task t = clientSslStream.AuthenticateAsClientAsync(new SslClientAuthenticationOptions() { TargetHost = certificate.GetNameInfo(X509NameType.SimpleName, false) }, cts.Token); cts.Cancel(); await Assert.ThrowsAnyAsync<OperationCanceledException>(() => t); } } [Fact] public async Task AuthenticateAsClientAsync_Sockets_CanceledAfterStart_ThrowsOperationCanceledException() { (Stream client, Stream server) = TestHelper.GetConnectedTcpStreams(); using (client) using (server) using (var clientSslStream = new SslStream(client, false, AllowAnyServerCertificate)) using (var serverSslStream = new SslStream(server)) using (X509Certificate2 certificate = Configuration.Certificates.GetServerCertificate()) { var cts = new CancellationTokenSource(); Task t = clientSslStream.AuthenticateAsClientAsync(new SslClientAuthenticationOptions() { TargetHost = certificate.GetNameInfo(X509NameType.SimpleName, false) }, cts.Token); cts.Cancel(); await Assert.ThrowsAnyAsync<OperationCanceledException>(() => t); } } [Fact] public async Task AuthenticateAsServerAsync_VirtualNetwork_CanceledAfterStart_ThrowsOperationCanceledException() { (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); using (var clientSslStream = new SslStream(stream1, false, AllowAnyServerCertificate)) using (var serverSslStream = new SslStream(stream2)) using (X509Certificate2 certificate = Configuration.Certificates.GetServerCertificate()) { var cts = new CancellationTokenSource(); Task t = serverSslStream.AuthenticateAsServerAsync(new SslServerAuthenticationOptions() { ServerCertificate = certificate }, cts.Token); cts.Cancel(); await Assert.ThrowsAnyAsync<OperationCanceledException>(() => t); } } [Fact] public async Task AuthenticateAsServerAsync_Sockets_CanceledAfterStart_ThrowsOperationCanceledException() { (Stream client, Stream server) = TestHelper.GetConnectedTcpStreams(); using (client) using (server) using (var clientSslStream = new SslStream(client, false, AllowAnyServerCertificate)) using (var serverSslStream = new SslStream(server)) using (X509Certificate2 certificate = Configuration.Certificates.GetServerCertificate()) { var cts = new CancellationTokenSource(); Task t = serverSslStream.AuthenticateAsServerAsync(new SslServerAuthenticationOptions() { ServerCertificate = certificate }, cts.Token); cts.Cancel(); await Assert.ThrowsAnyAsync<OperationCanceledException>(() => t); } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Generic; using System.IO; using System.Linq; using System.Net.Sockets; using System.Net.Test.Common; using System.Security.Authentication; using System.Security.Cryptography.X509Certificates; using System.Text; using System.Threading; using System.Threading.Tasks; using Microsoft.DotNet.XUnitExtensions; using Xunit; namespace System.Net.Security.Tests { using Configuration = System.Net.Test.Common.Configuration; public abstract class SslStreamStreamToStreamTest { private readonly byte[] _sampleMsg = Encoding.UTF8.GetBytes("Sample Test Message"); protected static async Task WithServerCertificate(X509Certificate serverCertificate, Func<X509Certificate, string, Task> func) { X509Certificate certificate = serverCertificate ?? Configuration.Certificates.GetServerCertificate(); try { string name; if (certificate is X509Certificate2 cert2) { name = cert2.GetNameInfo(X509NameType.SimpleName, forIssuer: false); } else { using (cert2 = new X509Certificate2(certificate)) { name = cert2.GetNameInfo(X509NameType.SimpleName, forIssuer: false); } } await func(certificate, name).ConfigureAwait(false); } finally { if (certificate != serverCertificate) { certificate.Dispose(); } } } protected abstract Task DoHandshake(SslStream clientSslStream, SslStream serverSslStream, X509Certificate serverCertificate = null, X509Certificate clientCertificate = null); protected abstract Task<int> ReadAsync(Stream stream, byte[] buffer, int offset, int count, CancellationToken cancellationToken = default); protected abstract Task WriteAsync(Stream stream, byte[] buffer, int offset, int count, CancellationToken cancellationToken = default); public static IEnumerable<object[]> SslStream_StreamToStream_Authentication_Success_MemberData() { using (X509Certificate2 serverCert = Configuration.Certificates.GetServerCertificate()) using (X509Certificate2 clientCert = Configuration.Certificates.GetClientCertificate()) { yield return new object[] { new X509Certificate2(serverCert), new X509Certificate2(clientCert) }; yield return new object[] { new X509Certificate(serverCert.Export(X509ContentType.Pfx)), new X509Certificate(clientCert.Export(X509ContentType.Pfx)) }; } } [ConditionalTheory] [MemberData(nameof(SslStream_StreamToStream_Authentication_Success_MemberData))] [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "X509 certificate store is not supported on iOS or tvOS.")] public async Task SslStream_StreamToStream_Authentication_Success(X509Certificate serverCert = null, X509Certificate clientCert = null) { if (PlatformDetection.IsWindows10Version20348OrGreater) { // [ActiveIssue("https://github.com/dotnet/runtime/issues/58927")] throw new SkipTestException("Unstable on Windows 11"); } (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); using (var client = new SslStream(stream1, false, AllowAnyServerCertificate)) using (var server = new SslStream(stream2, false, delegate { return true; })) { await DoHandshake(client, server, serverCert, clientCert); Assert.True(client.IsAuthenticated); Assert.True(server.IsAuthenticated); } clientCert?.Dispose(); serverCert?.Dispose(); } [Fact] public async Task SslStream_StreamToStream_Authentication_IncorrectServerName_Fail() { (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); using (var client = new SslStream(stream1)) using (var server = new SslStream(stream2)) using (var certificate = Configuration.Certificates.GetServerCertificate()) { Task t1 = client.AuthenticateAsClientAsync("incorrectServer"); Task t2 = server.AuthenticateAsServerAsync(certificate); await Assert.ThrowsAsync<AuthenticationException>(() => t1); try { await t2; } catch { // Ignore outcome of t2. It can succeed or fail depending on timing. } } } [Fact] public async Task SslStream_ServerLocalCertificateSelectionCallbackReturnsNull_Throw() { var selectionCallback = new LocalCertificateSelectionCallback((object sender, string targetHost, X509CertificateCollection localCertificates, X509Certificate remoteCertificate, string[] issuers) => { return null; }); (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); using (var client = new SslStream(stream1, false, AllowAnyServerCertificate)) using (var server = new SslStream(stream2, false, null, selectionCallback)) using (X509Certificate2 certificate = Configuration.Certificates.GetServerCertificate()) { await Assert.ThrowsAsync<NotSupportedException>(async () => await TestConfiguration.WhenAllOrAnyFailedWithTimeout(client.AuthenticateAsClientAsync(certificate.GetNameInfo(X509NameType.SimpleName, false)), server.AuthenticateAsServerAsync(certificate)) ); } } [Fact] [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "X509 certificate store is not supported on iOS or tvOS.")] public async Task Read_CorrectlyUnlocksAfterFailure() { (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); var clientStream = new ThrowingDelegatingStream(stream1); using (var clientSslStream = new SslStream(clientStream, false, AllowAnyServerCertificate)) using (var serverSslStream = new SslStream(stream2)) { await DoHandshake(clientSslStream, serverSslStream); // Throw an exception from the wrapped stream's read operation clientStream.ExceptionToThrow = new FormatException(); IOException thrown = await Assert.ThrowsAsync<IOException>(() => ReadAsync(clientSslStream, new byte[1], 0, 1)); Assert.Same(clientStream.ExceptionToThrow, thrown.InnerException); clientStream.ExceptionToThrow = null; // Validate that the SslStream continues to be usable for (byte b = 42; b < 52; b++) // arbitrary test values { await WriteAsync(serverSslStream, new byte[1] { b }, 0, 1); byte[] buffer = new byte[1]; Assert.Equal(1, await ReadAsync(clientSslStream, buffer, 0, 1)); Assert.Equal(b, buffer[0]); } } } [Fact] [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "X509 certificate store is not supported on iOS or tvOS.")] public async Task Write_CorrectlyUnlocksAfterFailure() { (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); var clientStream = new ThrowingDelegatingStream(stream1); using (var clientSslStream = new SslStream(clientStream, false, AllowAnyServerCertificate)) using (var serverSslStream = new SslStream(stream2)) { await DoHandshake(clientSslStream, serverSslStream); // Throw an exception from the wrapped stream's write operation clientStream.ExceptionToThrow = new FormatException(); IOException thrown = await Assert.ThrowsAsync<IOException>(() => WriteAsync(clientSslStream, new byte[1], 0, 1)); Assert.Same(clientStream.ExceptionToThrow, thrown.InnerException); clientStream.ExceptionToThrow = null; // Validate that the SslStream continues to be writable. However, the stream is still largely // unusable: because the previously encrypted data won't have been written to the underlying // stream and thus not received by the reader, if we tried to validate this data being received // by the reader, it would likely fail with a decryption error. await WriteAsync(clientSslStream, new byte[1] { 42 }, 0, 1); } } [Fact] public async Task Read_InvokedSynchronously() { (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); var clientStream = new PreReadWriteActionDelegatingStream(stream1); using (var clientSslStream = new SslStream(clientStream, false, AllowAnyServerCertificate)) using (var serverSslStream = new SslStream(stream2)) { await DoHandshake(clientSslStream, serverSslStream); // Validate that the read call to the underlying stream is made as part of the // synchronous call to the read method on SslStream, even if the method is async. using (var tl = new ThreadLocal<int>()) { await WriteAsync(serverSslStream, new byte[1], 0, 1); tl.Value = 42; clientStream.PreReadWriteAction = () => Assert.Equal(42, tl.Value); Task t = ReadAsync(clientSslStream, new byte[1], 0, 1); tl.Value = 0; await t; } } } [Fact] [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "X509 certificate store is not supported on iOS or tvOS.")] public async Task Write_InvokedSynchronously() { (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); var clientStream = new PreReadWriteActionDelegatingStream(stream1); using (var clientSslStream = new SslStream(clientStream, false, AllowAnyServerCertificate)) using (var serverSslStream = new SslStream(stream2)) { await DoHandshake(clientSslStream, serverSslStream); // Validate that the write call to the underlying stream is made as part of the // synchronous call to the write method on SslStream, even if the method is async. using (var tl = new ThreadLocal<int>()) { tl.Value = 42; clientStream.PreReadWriteAction = () => Assert.Equal(42, tl.Value); Task t = WriteAsync(clientSslStream, new byte[1], 0, 1); tl.Value = 0; await t; } } } [Fact] public async Task SslStream_StreamToStream_Dispose_Throws() { if (this is SslStreamStreamToStreamTest_SyncBase) { // This test assumes operations complete asynchronously. return; } (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); using (var clientSslStream = new SslStream(DelegateDelegatingStream.NopDispose(stream1), false, AllowAnyServerCertificate)) { var serverSslStream = new SslStream(DelegateDelegatingStream.NopDispose(stream2)); await DoHandshake(clientSslStream, serverSslStream); var serverBuffer = new byte[1]; Task serverReadTask = ReadAsync(serverSslStream, serverBuffer, 0, serverBuffer.Length); await WriteAsync(serverSslStream, new byte[] { 1 }, 0, 1) .WaitAsync(TestConfiguration.PassingTestTimeout); // Shouldn't throw, the context is disposed now. // Since the server read task is in progress, the read buffer is not returned to ArrayPool. serverSslStream.Dispose(); // Read in client var clientBuffer = new byte[1]; await ReadAsync(clientSslStream, clientBuffer, 0, clientBuffer.Length); Assert.Equal(1, clientBuffer[0]); await WriteAsync(clientSslStream, new byte[] { 2 }, 0, 1); // We're inconsistent as to whether the ObjectDisposedException is thrown directly // or wrapped in an IOException. For Begin/End, it's always wrapped; for Async, // it's only wrapped on .NET Framework. if (this is SslStreamStreamToStreamTest_BeginEnd || PlatformDetection.IsNetFramework) { await Assert.ThrowsAsync<ObjectDisposedException>(() => serverReadTask); } else { IOException serverException = await Assert.ThrowsAsync<IOException>(() => serverReadTask); Assert.IsType<ObjectDisposedException>(serverException.InnerException); } await Assert.ThrowsAsync<ObjectDisposedException>(() => ReadAsync(serverSslStream, serverBuffer, 0, serverBuffer.Length)); // Now, there is no pending read, so the internal buffer will be returned to ArrayPool. serverSslStream.Dispose(); await Assert.ThrowsAsync<ObjectDisposedException>(() => ReadAsync(serverSslStream, serverBuffer, 0, serverBuffer.Length)); } } [Fact] public async Task SslStream_StreamToStream_EOFDuringFrameRead_ThrowsIOException() { (Stream clientStream, Stream serverStream) = TestHelper.GetConnectedStreams(); using (clientStream) using (serverStream) { int readMode = 0; var serverWrappedNetworkStream = new DelegateStream( canWriteFunc: () => true, canReadFunc: () => true, writeFunc: (buffer, offset, count) => serverStream.Write(buffer, offset, count), writeAsyncFunc: (buffer, offset, count, token) => serverStream.WriteAsync(buffer, offset, count, token), readFunc: (buffer, offset, count) => { // Do normal reads as requested until the read mode is set // to 1. Then do a single read of only 10 bytes to read only // part of the message, and subsequently return EOF. if (readMode == 0) { return serverStream.Read(buffer, offset, count); } else if (readMode == 1) { readMode = 2; return serverStream.Read(buffer, offset, 10); // read at least header but less than full frame } else { return 0; } }, readAsyncFunc: (buffer, offset, count, token) => { // Do normal reads as requested until the read mode is set // to 1. Then do a single read of only 10 bytes to read only // part of the message, and subsequently return EOF. if (readMode == 0) { return serverStream.ReadAsync(buffer, offset, count); } else if (readMode == 1) { readMode = 2; return serverStream.ReadAsync(buffer, offset, 10); // read at least header but less than full frame } else { return Task.FromResult(0); } }); using (var clientSslStream = new SslStream(clientStream, false, AllowAnyServerCertificate)) using (var serverSslStream = new SslStream(serverWrappedNetworkStream)) { await DoHandshake(clientSslStream, serverSslStream); await WriteAsync(clientSslStream, new byte[20], 0, 20); readMode = 1; await Assert.ThrowsAsync<IOException>(() => ReadAsync(serverSslStream, new byte[1], 0, 1)); } } } private bool VerifyOutput(byte[] actualBuffer, byte[] expectedBuffer) { return expectedBuffer.SequenceEqual(actualBuffer); } protected bool AllowAnyServerCertificate( object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { SslPolicyErrors expectedSslPolicyErrors = SslPolicyErrors.None; if (!Capability.IsTrustedRootCertificateInstalled()) { expectedSslPolicyErrors = SslPolicyErrors.RemoteCertificateChainErrors; } Assert.Equal(expectedSslPolicyErrors, sslPolicyErrors); if (sslPolicyErrors == expectedSslPolicyErrors) { return true; } else { return false; } } private class PreReadWriteActionDelegatingStream : Stream { private readonly Stream _stream; public PreReadWriteActionDelegatingStream(Stream stream) => _stream = stream; public Action PreReadWriteAction { get; set; } public override bool CanRead => _stream.CanRead; public override bool CanWrite => _stream.CanWrite; public override bool CanSeek => _stream.CanSeek; protected override void Dispose(bool disposing) => _stream.Dispose(); public override long Length => _stream.Length; public override long Position { get => _stream.Position; set => _stream.Position = value; } public override void Flush() => _stream.Flush(); public override long Seek(long offset, SeekOrigin origin) => _stream.Seek(offset, origin); public override void SetLength(long value) => _stream.SetLength(value); public override int Read(byte[] buffer, int offset, int count) { PreReadWriteAction?.Invoke(); return _stream.Read(buffer, offset, count); } public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state) { PreReadWriteAction?.Invoke(); return _stream.BeginRead(buffer, offset, count, callback, state); } public override int EndRead(IAsyncResult asyncResult) => _stream.EndRead(asyncResult); public override Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) { PreReadWriteAction?.Invoke(); return _stream.ReadAsync(buffer, offset, count, cancellationToken); } public override void Write(byte[] buffer, int offset, int count) { PreReadWriteAction?.Invoke(); _stream.Write(buffer, offset, count); } public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state) { PreReadWriteAction?.Invoke(); return _stream.BeginWrite(buffer, offset, count, callback, state); } public override void EndWrite(IAsyncResult asyncResult) => _stream.EndWrite(asyncResult); public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) { PreReadWriteAction?.Invoke(); return _stream.WriteAsync(buffer, offset, count, cancellationToken); } } private sealed class ThrowingDelegatingStream : PreReadWriteActionDelegatingStream { public ThrowingDelegatingStream(Stream stream) : base(stream) { PreReadWriteAction = () => { if (ExceptionToThrow != null) { throw ExceptionToThrow; } }; } public Exception ExceptionToThrow { get; set; } } } public sealed class SslStreamStreamToStreamTest_Async : SslStreamStreamToStreamTest { protected override async Task DoHandshake(SslStream clientSslStream, SslStream serverSslStream, X509Certificate serverCertificate = null, X509Certificate clientCertificate = null) { X509CertificateCollection clientCerts = clientCertificate != null ? new X509CertificateCollection() { clientCertificate } : null; await WithServerCertificate(serverCertificate, async(certificate, name) => { Task t1 = clientSslStream.AuthenticateAsClientAsync(name, clientCerts, SslProtocols.None, checkCertificateRevocation: false); Task t2 = serverSslStream.AuthenticateAsServerAsync(certificate, clientCertificateRequired: clientCertificate != null, checkCertificateRevocation: false); await TestConfiguration.WhenAllOrAnyFailedWithTimeout(t1, t2); }); } protected override Task<int> ReadAsync(Stream stream, byte[] buffer, int offset, int count, CancellationToken cancellationToken) => stream.ReadAsync(buffer, offset, count, cancellationToken); protected override Task WriteAsync(Stream stream, byte[] buffer, int offset, int count, CancellationToken cancellationToken) => stream.WriteAsync(buffer, offset, count, cancellationToken); } public sealed class SslStreamStreamToStreamTest_BeginEnd : SslStreamStreamToStreamTest { protected override async Task DoHandshake(SslStream clientSslStream, SslStream serverSslStream, X509Certificate serverCertificate = null, X509Certificate clientCertificate = null) { X509CertificateCollection clientCerts = clientCertificate != null ? new X509CertificateCollection() { clientCertificate } : null; await WithServerCertificate(serverCertificate, async (certificate, name) => { Task t1 = Task.Factory.FromAsync(clientSslStream.BeginAuthenticateAsClient(name, clientCerts, SslProtocols.None, checkCertificateRevocation: false, null, null), clientSslStream.EndAuthenticateAsClient); Task t2 = Task.Factory.FromAsync(serverSslStream.BeginAuthenticateAsServer(certificate, clientCertificateRequired: clientCertificate != null, checkCertificateRevocation: false, null, null), serverSslStream.EndAuthenticateAsServer); await TestConfiguration.WhenAllOrAnyFailedWithTimeout(t1, t2); }); } protected override Task<int> ReadAsync(Stream stream, byte[] buffer, int offset, int count, CancellationToken cancellationToken) => cancellationToken.IsCancellationRequested ? Task.FromCanceled<int>(cancellationToken) : Task.Factory.FromAsync(stream.BeginRead, stream.EndRead, buffer, offset, count, null); protected override Task WriteAsync(Stream stream, byte[] buffer, int offset, int count, CancellationToken cancellationToken) => cancellationToken.IsCancellationRequested ? Task.FromCanceled<int>(cancellationToken) : Task.Factory.FromAsync(stream.BeginWrite, stream.EndWrite, buffer, offset, count, null); } public abstract class SslStreamStreamToStreamTest_SyncBase : SslStreamStreamToStreamTest { protected override Task<int> ReadAsync(Stream stream, byte[] buffer, int offset, int count, CancellationToken cancellationToken) { if (cancellationToken.IsCancellationRequested) { return Task.FromCanceled<int>(cancellationToken); } try { return Task.FromResult<int>(stream.Read(buffer, offset, count)); } catch (Exception e) { return Task.FromException<int>(e); } } protected override Task WriteAsync(Stream stream, byte[] buffer, int offset, int count, CancellationToken cancellationToken) { if (cancellationToken.IsCancellationRequested) { return Task.FromCanceled<int>(cancellationToken); } try { stream.Write(buffer, offset, count); return Task.CompletedTask; } catch (Exception e) { return Task.FromException<int>(e); } } [Fact] public async Task SslStream_StreamToStream_Handshake_DisposeClient_Throws() { (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); using (var clientSslStream = new SslStream(stream1, false, AllowAnyServerCertificate)) using (var serverSslStream = new SslStream(stream2)) { stream1.Dispose(); await Assert.ThrowsAsync<AggregateException>(() => DoHandshake(clientSslStream, serverSslStream)); } } [Fact] public async Task SslStream_StreamToStream_Handshake_DisposeServer_Throws() { (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); using (var clientSslStream = new SslStream(stream1, false, AllowAnyServerCertificate)) using (var serverSslStream = new SslStream(stream2)) { stream2.Dispose(); await Assert.ThrowsAsync<AggregateException>(() => DoHandshake(clientSslStream, serverSslStream)); } } [Fact] public async Task SslStream_StreamToStream_Handshake_DisposeClientSsl_Throws() { (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); using (var serverSslStream = new SslStream(DelegateDelegatingStream.NopDispose(stream1))) { var clientSslStream = new SslStream(DelegateDelegatingStream.NopDispose(stream2), false, AllowAnyServerCertificate); clientSslStream.Dispose(); await Assert.ThrowsAsync<ObjectDisposedException>(() => DoHandshake(clientSslStream, serverSslStream)); } } [Fact] public async Task SslStream_StreamToStream_Handshake_DisposeServerSsl_Throws() { (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); using (var clientSslStream = new SslStream(DelegateDelegatingStream.NopDispose(stream1), false, AllowAnyServerCertificate)) { var serverSslStream = new SslStream(DelegateDelegatingStream.NopDispose(stream2)); serverSslStream.Dispose(); await Assert.ThrowsAsync<ObjectDisposedException>(() => DoHandshake(clientSslStream, serverSslStream)); } } } public sealed class SslStreamStreamToStreamTest_SyncParameters : SslStreamStreamToStreamTest_SyncBase { protected override async Task DoHandshake(SslStream clientSslStream, SslStream serverSslStream, X509Certificate serverCertificate = null, X509Certificate clientCertificate = null) { X509CertificateCollection clientCerts = clientCertificate != null ? new X509CertificateCollection() { clientCertificate } : null; await WithServerCertificate(serverCertificate, async (certificate, name) => { Task t1 = Task.Run(() => clientSslStream.AuthenticateAsClient(name, clientCerts, SslProtocols.None, checkCertificateRevocation: false)); Task t2 = Task.Run(() => serverSslStream.AuthenticateAsServer(certificate, clientCertificateRequired: clientCertificate != null, checkCertificateRevocation: false)); await TestConfiguration.WhenAllOrAnyFailedWithTimeout(t1, t2); }); } } public sealed class SslStreamStreamToStreamTest_SyncSslOptions : SslStreamStreamToStreamTest_SyncBase { protected override async Task DoHandshake(SslStream clientSslStream, SslStream serverSslStream, X509Certificate serverCertificate = null, X509Certificate clientCertificate = null) { X509CertificateCollection clientCerts = clientCertificate != null ? new X509CertificateCollection() { clientCertificate } : null; await WithServerCertificate(serverCertificate, async (certificate, name) => { SslClientAuthenticationOptions clientOptions = new SslClientAuthenticationOptions { TargetHost = name, ClientCertificates = clientCerts, EnabledSslProtocols = SslProtocols.None, }; SslServerAuthenticationOptions serverOptions = new SslServerAuthenticationOptions() { ServerCertificate = certificate, ClientCertificateRequired = clientCertificate != null, }; Task t1 = Task.Run(() => clientSslStream.AuthenticateAsClient(clientOptions)); Task t2 = Task.Run(() => serverSslStream.AuthenticateAsServer(serverOptions)); await TestConfiguration.WhenAllOrAnyFailedWithTimeout(t1, t2); }); } } public sealed class SslStreamStreamToStreamTest_MemoryAsync : SslStreamStreamToStreamTest { protected override async Task DoHandshake(SslStream clientSslStream, SslStream serverSslStream, X509Certificate serverCertificate = null, X509Certificate clientCertificate = null) { X509CertificateCollection clientCerts = clientCertificate != null ? new X509CertificateCollection() { clientCertificate } : null; await WithServerCertificate(serverCertificate, async(certificate, name) => { Task t1 = clientSslStream.AuthenticateAsClientAsync(new SslClientAuthenticationOptions() { TargetHost = name, ClientCertificates = clientCerts }, CancellationToken.None); Task t2 = serverSslStream.AuthenticateAsServerAsync(new SslServerAuthenticationOptions() { ServerCertificate = certificate, ClientCertificateRequired = clientCertificate != null }, CancellationToken.None); await TestConfiguration.WhenAllOrAnyFailedWithTimeout(t1, t2); }); } protected override Task<int> ReadAsync(Stream stream, byte[] buffer, int offset, int count, CancellationToken cancellationToken) => stream.ReadAsync(new Memory<byte>(buffer, offset, count), cancellationToken).AsTask(); protected override Task WriteAsync(Stream stream, byte[] buffer, int offset, int count, CancellationToken cancellationToken) => stream.WriteAsync(new ReadOnlyMemory<byte>(buffer, offset, count), cancellationToken).AsTask(); [Fact] public async Task Authenticate_Precanceled_ThrowsOperationCanceledException() { (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); using (var clientSslStream = new SslStream(stream1, false, AllowAnyServerCertificate)) using (var serverSslStream = new SslStream(stream2)) using (X509Certificate2 certificate = Configuration.Certificates.GetServerCertificate()) { await Assert.ThrowsAnyAsync<OperationCanceledException>(() => clientSslStream.AuthenticateAsClientAsync(new SslClientAuthenticationOptions() { TargetHost = certificate.GetNameInfo(X509NameType.SimpleName, false) }, new CancellationToken(true))); await Assert.ThrowsAnyAsync<OperationCanceledException>(() => serverSslStream.AuthenticateAsServerAsync(new SslServerAuthenticationOptions() { ServerCertificate = certificate }, new CancellationToken(true))); } } [Fact] public async Task AuthenticateAsClientAsync_MemoryBuffer_CanceledAfterStart_ThrowsOperationCanceledException() { (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); using (var clientSslStream = new SslStream(stream1, false, AllowAnyServerCertificate)) using (var serverSslStream = new SslStream(stream2)) using (X509Certificate2 certificate = Configuration.Certificates.GetServerCertificate()) { var cts = new CancellationTokenSource(); Task t = clientSslStream.AuthenticateAsClientAsync(new SslClientAuthenticationOptions() { TargetHost = certificate.GetNameInfo(X509NameType.SimpleName, false) }, cts.Token); cts.Cancel(); await Assert.ThrowsAnyAsync<OperationCanceledException>(() => t); } } [Fact] public async Task AuthenticateAsClientAsync_Sockets_CanceledAfterStart_ThrowsOperationCanceledException() { (Stream client, Stream server) = TestHelper.GetConnectedTcpStreams(); using (client) using (server) using (var clientSslStream = new SslStream(client, false, AllowAnyServerCertificate)) using (var serverSslStream = new SslStream(server)) using (X509Certificate2 certificate = Configuration.Certificates.GetServerCertificate()) { var cts = new CancellationTokenSource(); Task t = clientSslStream.AuthenticateAsClientAsync(new SslClientAuthenticationOptions() { TargetHost = certificate.GetNameInfo(X509NameType.SimpleName, false) }, cts.Token); cts.Cancel(); await Assert.ThrowsAnyAsync<OperationCanceledException>(() => t); } } [Fact] public async Task AuthenticateAsServerAsync_VirtualNetwork_CanceledAfterStart_ThrowsOperationCanceledException() { (Stream stream1, Stream stream2) = TestHelper.GetConnectedStreams(); using (var clientSslStream = new SslStream(stream1, false, AllowAnyServerCertificate)) using (var serverSslStream = new SslStream(stream2)) using (X509Certificate2 certificate = Configuration.Certificates.GetServerCertificate()) { var cts = new CancellationTokenSource(); Task t = serverSslStream.AuthenticateAsServerAsync(new SslServerAuthenticationOptions() { ServerCertificate = certificate }, cts.Token); cts.Cancel(); await Assert.ThrowsAnyAsync<OperationCanceledException>(() => t); } } [Fact] public async Task AuthenticateAsServerAsync_Sockets_CanceledAfterStart_ThrowsOperationCanceledException() { (Stream client, Stream server) = TestHelper.GetConnectedTcpStreams(); using (client) using (server) using (var clientSslStream = new SslStream(client, false, AllowAnyServerCertificate)) using (var serverSslStream = new SslStream(server)) using (X509Certificate2 certificate = Configuration.Certificates.GetServerCertificate()) { var cts = new CancellationTokenSource(); Task t = serverSslStream.AuthenticateAsServerAsync(new SslServerAuthenticationOptions() { ServerCertificate = certificate }, cts.Token); cts.Cancel(); await Assert.ThrowsAnyAsync<OperationCanceledException>(() => t); } } } }
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/libraries/System.ComponentModel.Composition.Registration/tests/System/ComponentModel/Composition/Registration/ExportInterfacesContractExclusionTests.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Generic; using System.Linq; using System.Reflection; using System.ComponentModel.Composition.Hosting; using Xunit; namespace System.ComponentModel.Composition.Registration.Tests { public interface IContract1 { } public interface IContract2 { } public class ClassWithLifetimeConcerns : IContract1, IContract2, IDisposable, IPartImportsSatisfiedNotification { public void Dispose() { } public void OnImportsSatisfied() { } } static class DELETE_ME_TESTER { public static PartBuilder ExportInterfaces(this PartBuilder pb) { return null; } } public class ExportInterfacesContractExclusionTests { static readonly Type[] s_contractInterfaces = new[] { typeof(IContract1), typeof(IContract2) }; [Fact] public void WhenExportingInterfaces_NoPredicate_OnlyContractInterfacesAreExported() { var rb = new RegistrationBuilder(); rb.ForType<ClassWithLifetimeConcerns>() .ExportInterfaces(); Primitives.ComposablePartDefinition part = new TypeCatalog(new[] { typeof(ClassWithLifetimeConcerns) }, rb).Single(); var exportedContracts = part.ExportDefinitions.Select(ed => ed.ContractName).ToArray(); var expectedContracts = s_contractInterfaces.Select(ci => AttributedModelServices.GetContractName(ci)).ToArray(); Assert.Equal(expectedContracts, exportedContracts); } [Fact] public void WhenExportingInterfaces_PredicateSpecified_OnlyContractInterfacesAreSeenByThePredicate() { var seenInterfaces = new List<Type>(); var rb = new RegistrationBuilder(); rb.ForType<ClassWithLifetimeConcerns>() .ExportInterfaces(i => { seenInterfaces.Add(i); return true; }); rb.MapType(typeof(ClassWithLifetimeConcerns).GetTypeInfo()); Primitives.ComposablePartDefinition part = new TypeCatalog(new[] { typeof(ClassWithLifetimeConcerns) }, rb).Single(); Assert.Equal(s_contractInterfaces, seenInterfaces); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Generic; using System.Linq; using System.Reflection; using System.ComponentModel.Composition.Hosting; using Xunit; namespace System.ComponentModel.Composition.Registration.Tests { public interface IContract1 { } public interface IContract2 { } public class ClassWithLifetimeConcerns : IContract1, IContract2, IDisposable, IPartImportsSatisfiedNotification { public void Dispose() { } public void OnImportsSatisfied() { } } static class DELETE_ME_TESTER { public static PartBuilder ExportInterfaces(this PartBuilder pb) { return null; } } public class ExportInterfacesContractExclusionTests { static readonly Type[] s_contractInterfaces = new[] { typeof(IContract1), typeof(IContract2) }; [Fact] public void WhenExportingInterfaces_NoPredicate_OnlyContractInterfacesAreExported() { var rb = new RegistrationBuilder(); rb.ForType<ClassWithLifetimeConcerns>() .ExportInterfaces(); Primitives.ComposablePartDefinition part = new TypeCatalog(new[] { typeof(ClassWithLifetimeConcerns) }, rb).Single(); var exportedContracts = part.ExportDefinitions.Select(ed => ed.ContractName).ToArray(); var expectedContracts = s_contractInterfaces.Select(ci => AttributedModelServices.GetContractName(ci)).ToArray(); Assert.Equal(expectedContracts, exportedContracts); } [Fact] public void WhenExportingInterfaces_PredicateSpecified_OnlyContractInterfacesAreSeenByThePredicate() { var seenInterfaces = new List<Type>(); var rb = new RegistrationBuilder(); rb.ForType<ClassWithLifetimeConcerns>() .ExportInterfaces(i => { seenInterfaces.Add(i); return true; }); rb.MapType(typeof(ClassWithLifetimeConcerns).GetTypeInfo()); Primitives.ComposablePartDefinition part = new TypeCatalog(new[] { typeof(ClassWithLifetimeConcerns) }, rb).Single(); Assert.Equal(s_contractInterfaces, seenInterfaces); } } }
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/tests/JIT/HardwareIntrinsics/X86/Shared/SimpleUnOpTest_DataTable.cs
// 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.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.X86; namespace JIT.HardwareIntrinsics.X86 { public unsafe struct SimpleUnaryOpTest__DataTable<TResult, TOp1> : IDisposable where TResult : struct where TOp1 : struct { private byte[] inArray; private byte[] outArray; private GCHandle inHandle; private GCHandle outHandle; private ulong alignment; public SimpleUnaryOpTest__DataTable(TOp1[] inArray, TResult[] outArray, int alignment) { int sizeOfinArray = inArray.Length * Unsafe.SizeOf<TOp1>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<TResult>(); if ((alignment != 32 && alignment != 16) || (alignment * 2) < sizeOfinArray || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle = GCHandle.Alloc(this.inArray, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArrayPtr), ref Unsafe.As<TOp1, byte>(ref inArray[0]), (uint)sizeOfinArray); } public void* inArrayPtr => Align((byte*)(inHandle.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } }
// 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.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.X86; namespace JIT.HardwareIntrinsics.X86 { public unsafe struct SimpleUnaryOpTest__DataTable<TResult, TOp1> : IDisposable where TResult : struct where TOp1 : struct { private byte[] inArray; private byte[] outArray; private GCHandle inHandle; private GCHandle outHandle; private ulong alignment; public SimpleUnaryOpTest__DataTable(TOp1[] inArray, TResult[] outArray, int alignment) { int sizeOfinArray = inArray.Length * Unsafe.SizeOf<TOp1>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<TResult>(); if ((alignment != 32 && alignment != 16) || (alignment * 2) < sizeOfinArray || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle = GCHandle.Alloc(this.inArray, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArrayPtr), ref Unsafe.As<TOp1, byte>(ref inArray[0]), (uint)sizeOfinArray); } public void* inArrayPtr => Align((byte*)(inHandle.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } }
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/libraries/System.Net.ServicePoint/src/System/Net/SecurityProtocolType.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Security.Authentication; namespace System.Net { [Flags] public enum SecurityProtocolType { SystemDefault = 0, #pragma warning disable CS0618 Ssl3 = SslProtocols.Ssl3, #pragma warning restore CS0618 #pragma warning disable SYSLIB0039 // TLS 1.0 and 1.1 are obsolete Tls = SslProtocols.Tls, Tls11 = SslProtocols.Tls11, #pragma warning restore SYSLIB0039 Tls12 = SslProtocols.Tls12, Tls13 = SslProtocols.Tls13, } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Security.Authentication; namespace System.Net { [Flags] public enum SecurityProtocolType { SystemDefault = 0, #pragma warning disable CS0618 Ssl3 = SslProtocols.Ssl3, #pragma warning restore CS0618 #pragma warning disable SYSLIB0039 // TLS 1.0 and 1.1 are obsolete Tls = SslProtocols.Tls, Tls11 = SslProtocols.Tls11, #pragma warning restore SYSLIB0039 Tls12 = SslProtocols.Tls12, Tls13 = SslProtocols.Tls13, } }
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/libraries/System.Security.Cryptography.X509Certificates/tests/X509StoreMutableTests.iOS.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using Xunit; namespace System.Security.Cryptography.X509Certificates.Tests { public static partial class X509StoreMutableTests { public static bool PermissionsAllowStoreWrite { get; } = true; [Theory] [InlineData(nameof(TestData.RsaCertificate), TestData.RsaCertificate, TestData.RsaPkcs8Key)] [InlineData(nameof(TestData.EcDhCertificate), TestData.EcDhCertificate, TestData.EcDhPkcs8Key)] [InlineData(nameof(TestData.ECDsaCertificate), TestData.ECDsaCertificate, TestData.ECDsaPkcs8Key)] public static void AddRemove_CertWithPrivateKey(string testCase, string certPem, string keyPem) { _ = testCase; using (var store = new X509Store(StoreName.My, StoreLocation.CurrentUser)) using (var cert = X509Certificate2.CreateFromPem(certPem, keyPem)) { store.Open(OpenFlags.ReadWrite); // Make sure cert is not already in the store store.Remove(cert); Assert.False(IsCertInStore(cert, store), "Certificate should not be found on pre-condition"); // Add store.Add(cert); Assert.True(IsCertInStore(cert, store), "Certificate should be found after add"); Assert.True(StoreHasPrivateKey(store, cert), "Certificate in store should have a private key"); // Remove store.Remove(cert); Assert.False(IsCertInStore(cert, store), "Certificate should not be found after remove"); } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using Xunit; namespace System.Security.Cryptography.X509Certificates.Tests { public static partial class X509StoreMutableTests { public static bool PermissionsAllowStoreWrite { get; } = true; [Theory] [InlineData(nameof(TestData.RsaCertificate), TestData.RsaCertificate, TestData.RsaPkcs8Key)] [InlineData(nameof(TestData.EcDhCertificate), TestData.EcDhCertificate, TestData.EcDhPkcs8Key)] [InlineData(nameof(TestData.ECDsaCertificate), TestData.ECDsaCertificate, TestData.ECDsaPkcs8Key)] public static void AddRemove_CertWithPrivateKey(string testCase, string certPem, string keyPem) { _ = testCase; using (var store = new X509Store(StoreName.My, StoreLocation.CurrentUser)) using (var cert = X509Certificate2.CreateFromPem(certPem, keyPem)) { store.Open(OpenFlags.ReadWrite); // Make sure cert is not already in the store store.Remove(cert); Assert.False(IsCertInStore(cert, store), "Certificate should not be found on pre-condition"); // Add store.Add(cert); Assert.True(IsCertInStore(cert, store), "Certificate should be found after add"); Assert.True(StoreHasPrivateKey(store, cert), "Certificate in store should have a private key"); // Remove store.Remove(cert); Assert.False(IsCertInStore(cert, store), "Certificate should not be found after remove"); } } } }
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/FatFunctionPointerNode.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using Internal.Text; using Internal.TypeSystem; using Debug = System.Diagnostics.Debug; namespace ILCompiler.DependencyAnalysis { /// <summary> /// Represents a fat function pointer - a data structure that captures a pointer to a canonical /// method body along with the instantiation context the canonical body requires. /// Pointers to these structures can be created by e.g. ldftn/ldvirtftn of a method with a canonical body. /// </summary> public class FatFunctionPointerNode : ObjectNode, IMethodNode, ISymbolDefinitionNode { private bool _isUnboxingStub; public bool IsUnboxingStub => _isUnboxingStub; public FatFunctionPointerNode(MethodDesc methodRepresented, bool isUnboxingStub) { // We should not create these for methods that don't have a canonical method body Debug.Assert(methodRepresented.GetCanonMethodTarget(CanonicalFormKind.Specific) != methodRepresented); Method = methodRepresented; _isUnboxingStub = isUnboxingStub; } public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb) { string prefix = _isUnboxingStub ? "__fatunboxpointer_" : "__fatpointer_"; sb.Append(prefix).Append(nameMangler.GetMangledMethodName(Method)); } int ISymbolDefinitionNode.Offset => 0; int ISymbolNode.Offset => Method.Context.Target.Architecture == TargetArchitecture.Wasm32 ? 1 << 31 : 2; public override bool IsShareable => true; public MethodDesc Method { get; } public override ObjectNodeSection Section { get { if (Method.Context.Target.IsWindows) return ObjectNodeSection.ReadOnlyDataSection; else return ObjectNodeSection.DataSection; } } public override bool StaticDependenciesAreComputed => true; protected override string GetName(NodeFactory factory) => this.GetMangledName(factory.NameMangler); public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false) { var builder = new ObjectDataBuilder(factory, relocsOnly); // These need to be aligned the same as methods because they show up in same contexts builder.RequireInitialAlignment(factory.Target.MinimumFunctionAlignment); builder.AddSymbol(this); MethodDesc canonMethod = Method.GetCanonMethodTarget(CanonicalFormKind.Specific); // Pointer to the canonical body of the method builder.EmitPointerReloc(factory.MethodEntrypoint(canonMethod, _isUnboxingStub)); // Find out what's the context to use ISortableSymbolNode contextParameter; if (canonMethod.RequiresInstMethodDescArg()) { contextParameter = factory.MethodGenericDictionary(Method); } else { Debug.Assert(canonMethod.RequiresInstMethodTableArg()); // Ask for a constructed type symbol because we need the vtable to get to the dictionary contextParameter = factory.ConstructedTypeSymbol(Method.OwningType); } // The next entry is a pointer to the context to be used for the canonical method builder.EmitPointerReloc(contextParameter); return builder.ToObjectData(); } public override int ClassCode => 190463489; public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { var compare = _isUnboxingStub.CompareTo(((FatFunctionPointerNode)other)._isUnboxingStub); if (compare != 0) return compare; return comparer.Compare(Method, ((FatFunctionPointerNode)other).Method); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using Internal.Text; using Internal.TypeSystem; using Debug = System.Diagnostics.Debug; namespace ILCompiler.DependencyAnalysis { /// <summary> /// Represents a fat function pointer - a data structure that captures a pointer to a canonical /// method body along with the instantiation context the canonical body requires. /// Pointers to these structures can be created by e.g. ldftn/ldvirtftn of a method with a canonical body. /// </summary> public class FatFunctionPointerNode : ObjectNode, IMethodNode, ISymbolDefinitionNode { private bool _isUnboxingStub; public bool IsUnboxingStub => _isUnboxingStub; public FatFunctionPointerNode(MethodDesc methodRepresented, bool isUnboxingStub) { // We should not create these for methods that don't have a canonical method body Debug.Assert(methodRepresented.GetCanonMethodTarget(CanonicalFormKind.Specific) != methodRepresented); Method = methodRepresented; _isUnboxingStub = isUnboxingStub; } public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb) { string prefix = _isUnboxingStub ? "__fatunboxpointer_" : "__fatpointer_"; sb.Append(prefix).Append(nameMangler.GetMangledMethodName(Method)); } int ISymbolDefinitionNode.Offset => 0; int ISymbolNode.Offset => Method.Context.Target.Architecture == TargetArchitecture.Wasm32 ? 1 << 31 : 2; public override bool IsShareable => true; public MethodDesc Method { get; } public override ObjectNodeSection Section { get { if (Method.Context.Target.IsWindows) return ObjectNodeSection.ReadOnlyDataSection; else return ObjectNodeSection.DataSection; } } public override bool StaticDependenciesAreComputed => true; protected override string GetName(NodeFactory factory) => this.GetMangledName(factory.NameMangler); public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false) { var builder = new ObjectDataBuilder(factory, relocsOnly); // These need to be aligned the same as methods because they show up in same contexts builder.RequireInitialAlignment(factory.Target.MinimumFunctionAlignment); builder.AddSymbol(this); MethodDesc canonMethod = Method.GetCanonMethodTarget(CanonicalFormKind.Specific); // Pointer to the canonical body of the method builder.EmitPointerReloc(factory.MethodEntrypoint(canonMethod, _isUnboxingStub)); // Find out what's the context to use ISortableSymbolNode contextParameter; if (canonMethod.RequiresInstMethodDescArg()) { contextParameter = factory.MethodGenericDictionary(Method); } else { Debug.Assert(canonMethod.RequiresInstMethodTableArg()); // Ask for a constructed type symbol because we need the vtable to get to the dictionary contextParameter = factory.ConstructedTypeSymbol(Method.OwningType); } // The next entry is a pointer to the context to be used for the canonical method builder.EmitPointerReloc(contextParameter); return builder.ToObjectData(); } public override int ClassCode => 190463489; public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { var compare = _isUnboxingStub.CompareTo(((FatFunctionPointerNode)other)._isUnboxingStub); if (compare != 0) return compare; return comparer.Compare(Method, ((FatFunctionPointerNode)other).Method); } } }
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/tests/JIT/HardwareIntrinsics/Arm/AdvSimd/ShiftRightLogicalRounded.Vector128.UInt16.1.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.Arm; namespace JIT.HardwareIntrinsics.Arm { public static partial class Program { private static void ShiftRightLogicalRounded_Vector128_UInt16_1() { var test = new ImmUnaryOpTest__ShiftRightLogicalRounded_Vector128_UInt16_1(); if (test.IsSupported) { // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates basic functionality works, using Load test.RunBasicScenario_Load(); } // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates calling via reflection works, using Load test.RunReflectionScenario_Load(); } // Validates passing a static member works test.RunClsVarScenario(); if (AdvSimd.IsSupported) { // Validates passing a static member works, using pinning and Load test.RunClsVarScenario_Load(); } // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates passing a local works, using Load test.RunLclVarScenario_Load(); } // Validates passing the field of a local class works test.RunClassLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local class works, using pinning and Load test.RunClassLclFldScenario_Load(); } // Validates passing an instance member of a class works test.RunClassFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a class works, using pinning and Load test.RunClassFldScenario_Load(); } // Validates passing the field of a local struct works test.RunStructLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local struct works, using pinning and Load test.RunStructLclFldScenario_Load(); } // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a struct works, using pinning and Load test.RunStructFldScenario_Load(); } } else { // Validates we throw on unsupported hardware test.RunUnsupportedScenario(); } if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class ImmUnaryOpTest__ShiftRightLogicalRounded_Vector128_UInt16_1 { private struct DataTable { private byte[] inArray; private byte[] outArray; private GCHandle inHandle; private GCHandle outHandle; private ulong alignment; public DataTable(UInt16[] inArray, UInt16[] outArray, int alignment) { int sizeOfinArray = inArray.Length * Unsafe.SizeOf<UInt16>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<UInt16>(); if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle = GCHandle.Alloc(this.inArray, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArrayPtr), ref Unsafe.As<UInt16, byte>(ref inArray[0]), (uint)sizeOfinArray); } public void* inArrayPtr => Align((byte*)(inHandle.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector128<UInt16> _fld; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref testStruct._fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>()); return testStruct; } public void RunStructFldScenario(ImmUnaryOpTest__ShiftRightLogicalRounded_Vector128_UInt16_1 testClass) { var result = AdvSimd.ShiftRightLogicalRounded(_fld, 1); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr); } public void RunStructFldScenario_Load(ImmUnaryOpTest__ShiftRightLogicalRounded_Vector128_UInt16_1 testClass) { fixed (Vector128<UInt16>* pFld = &_fld) { var result = AdvSimd.ShiftRightLogicalRounded( AdvSimd.LoadVector128((UInt16*)(pFld)), 1 ); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr); } } } private static readonly int LargestVectorSize = 16; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16); private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16); private static readonly byte Imm = 1; private static UInt16[] _data = new UInt16[Op1ElementCount]; private static Vector128<UInt16> _clsVar; private Vector128<UInt16> _fld; private DataTable _dataTable; static ImmUnaryOpTest__ShiftRightLogicalRounded_Vector128_UInt16_1() { for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>()); } public ImmUnaryOpTest__ShiftRightLogicalRounded_Vector128_UInt16_1() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>()); for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt16(); } _dataTable = new DataTable(_data, new UInt16[RetElementCount], LargestVectorSize); } public bool IsSupported => AdvSimd.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = AdvSimd.ShiftRightLogicalRounded( Unsafe.Read<Vector128<UInt16>>(_dataTable.inArrayPtr), 1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr); } public void RunBasicScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load)); var result = AdvSimd.ShiftRightLogicalRounded( AdvSimd.LoadVector128((UInt16*)(_dataTable.inArrayPtr)), 1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.ShiftRightLogicalRounded), new Type[] { typeof(Vector128<UInt16>), typeof(byte) }) .Invoke(null, new object[] { Unsafe.Read<Vector128<UInt16>>(_dataTable.inArrayPtr), (byte)1 }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt16>)(result)); ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr); } public void RunReflectionScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load)); var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.ShiftRightLogicalRounded), new Type[] { typeof(Vector128<UInt16>), typeof(byte) }) .Invoke(null, new object[] { AdvSimd.LoadVector128((UInt16*)(_dataTable.inArrayPtr)), (byte)1 }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt16>)(result)); ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = AdvSimd.ShiftRightLogicalRounded( _clsVar, 1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar, _dataTable.outArrayPtr); } public void RunClsVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load)); fixed (Vector128<UInt16>* pClsVar = &_clsVar) { var result = AdvSimd.ShiftRightLogicalRounded( AdvSimd.LoadVector128((UInt16*)(pClsVar)), 1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar, _dataTable.outArrayPtr); } } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var firstOp = Unsafe.Read<Vector128<UInt16>>(_dataTable.inArrayPtr); var result = AdvSimd.ShiftRightLogicalRounded(firstOp, 1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(firstOp, _dataTable.outArrayPtr); } public void RunLclVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load)); var firstOp = AdvSimd.LoadVector128((UInt16*)(_dataTable.inArrayPtr)); var result = AdvSimd.ShiftRightLogicalRounded(firstOp, 1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(firstOp, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new ImmUnaryOpTest__ShiftRightLogicalRounded_Vector128_UInt16_1(); var result = AdvSimd.ShiftRightLogicalRounded(test._fld, 1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld, _dataTable.outArrayPtr); } public void RunClassLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load)); var test = new ImmUnaryOpTest__ShiftRightLogicalRounded_Vector128_UInt16_1(); fixed (Vector128<UInt16>* pFld = &test._fld) { var result = AdvSimd.ShiftRightLogicalRounded( AdvSimd.LoadVector128((UInt16*)(pFld)), 1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld, _dataTable.outArrayPtr); } } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = AdvSimd.ShiftRightLogicalRounded(_fld, 1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld, _dataTable.outArrayPtr); } public void RunClassFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load)); fixed (Vector128<UInt16>* pFld = &_fld) { var result = AdvSimd.ShiftRightLogicalRounded( AdvSimd.LoadVector128((UInt16*)(pFld)), 1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld, _dataTable.outArrayPtr); } } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = AdvSimd.ShiftRightLogicalRounded(test._fld, 1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld, _dataTable.outArrayPtr); } public void RunStructLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load)); var test = TestStruct.Create(); var result = AdvSimd.ShiftRightLogicalRounded( AdvSimd.LoadVector128((UInt16*)(&test._fld)), 1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } public void RunStructFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load)); var test = TestStruct.Create(); test.RunStructFldScenario_Load(this); } public void RunUnsupportedScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario)); bool succeeded = false; try { RunBasicScenario_UnsafeRead(); } catch (PlatformNotSupportedException) { succeeded = true; } if (!succeeded) { Succeeded = false; } } private void ValidateResult(Vector128<UInt16> firstOp, void* result, [CallerMemberName] string method = "") { UInt16[] inArray = new UInt16[Op1ElementCount]; UInt16[] outArray = new UInt16[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), firstOp); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>()); ValidateResult(inArray, outArray, method); } private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "") { UInt16[] inArray = new UInt16[Op1ElementCount]; UInt16[] outArray = new UInt16[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt16>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>()); ValidateResult(inArray, outArray, method); } private void ValidateResult(UInt16[] firstOp, UInt16[] result, [CallerMemberName] string method = "") { bool succeeded = true; for (var i = 0; i < RetElementCount; i++) { if (Helpers.ShiftRightLogicalRounded(firstOp[i], Imm) != result[i]) { succeeded = false; break; } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd)}.{nameof(AdvSimd.ShiftRightLogicalRounded)}<UInt16>(Vector128<UInt16>, 1): {method} failed:"); TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.Arm; namespace JIT.HardwareIntrinsics.Arm { public static partial class Program { private static void ShiftRightLogicalRounded_Vector128_UInt16_1() { var test = new ImmUnaryOpTest__ShiftRightLogicalRounded_Vector128_UInt16_1(); if (test.IsSupported) { // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates basic functionality works, using Load test.RunBasicScenario_Load(); } // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates calling via reflection works, using Load test.RunReflectionScenario_Load(); } // Validates passing a static member works test.RunClsVarScenario(); if (AdvSimd.IsSupported) { // Validates passing a static member works, using pinning and Load test.RunClsVarScenario_Load(); } // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates passing a local works, using Load test.RunLclVarScenario_Load(); } // Validates passing the field of a local class works test.RunClassLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local class works, using pinning and Load test.RunClassLclFldScenario_Load(); } // Validates passing an instance member of a class works test.RunClassFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a class works, using pinning and Load test.RunClassFldScenario_Load(); } // Validates passing the field of a local struct works test.RunStructLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local struct works, using pinning and Load test.RunStructLclFldScenario_Load(); } // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a struct works, using pinning and Load test.RunStructFldScenario_Load(); } } else { // Validates we throw on unsupported hardware test.RunUnsupportedScenario(); } if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class ImmUnaryOpTest__ShiftRightLogicalRounded_Vector128_UInt16_1 { private struct DataTable { private byte[] inArray; private byte[] outArray; private GCHandle inHandle; private GCHandle outHandle; private ulong alignment; public DataTable(UInt16[] inArray, UInt16[] outArray, int alignment) { int sizeOfinArray = inArray.Length * Unsafe.SizeOf<UInt16>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<UInt16>(); if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle = GCHandle.Alloc(this.inArray, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArrayPtr), ref Unsafe.As<UInt16, byte>(ref inArray[0]), (uint)sizeOfinArray); } public void* inArrayPtr => Align((byte*)(inHandle.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector128<UInt16> _fld; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref testStruct._fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>()); return testStruct; } public void RunStructFldScenario(ImmUnaryOpTest__ShiftRightLogicalRounded_Vector128_UInt16_1 testClass) { var result = AdvSimd.ShiftRightLogicalRounded(_fld, 1); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr); } public void RunStructFldScenario_Load(ImmUnaryOpTest__ShiftRightLogicalRounded_Vector128_UInt16_1 testClass) { fixed (Vector128<UInt16>* pFld = &_fld) { var result = AdvSimd.ShiftRightLogicalRounded( AdvSimd.LoadVector128((UInt16*)(pFld)), 1 ); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld, testClass._dataTable.outArrayPtr); } } } private static readonly int LargestVectorSize = 16; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16); private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16); private static readonly byte Imm = 1; private static UInt16[] _data = new UInt16[Op1ElementCount]; private static Vector128<UInt16> _clsVar; private Vector128<UInt16> _fld; private DataTable _dataTable; static ImmUnaryOpTest__ShiftRightLogicalRounded_Vector128_UInt16_1() { for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>()); } public ImmUnaryOpTest__ShiftRightLogicalRounded_Vector128_UInt16_1() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld), ref Unsafe.As<UInt16, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>()); for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetUInt16(); } _dataTable = new DataTable(_data, new UInt16[RetElementCount], LargestVectorSize); } public bool IsSupported => AdvSimd.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = AdvSimd.ShiftRightLogicalRounded( Unsafe.Read<Vector128<UInt16>>(_dataTable.inArrayPtr), 1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr); } public void RunBasicScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load)); var result = AdvSimd.ShiftRightLogicalRounded( AdvSimd.LoadVector128((UInt16*)(_dataTable.inArrayPtr)), 1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.ShiftRightLogicalRounded), new Type[] { typeof(Vector128<UInt16>), typeof(byte) }) .Invoke(null, new object[] { Unsafe.Read<Vector128<UInt16>>(_dataTable.inArrayPtr), (byte)1 }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt16>)(result)); ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr); } public void RunReflectionScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load)); var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.ShiftRightLogicalRounded), new Type[] { typeof(Vector128<UInt16>), typeof(byte) }) .Invoke(null, new object[] { AdvSimd.LoadVector128((UInt16*)(_dataTable.inArrayPtr)), (byte)1 }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt16>)(result)); ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = AdvSimd.ShiftRightLogicalRounded( _clsVar, 1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar, _dataTable.outArrayPtr); } public void RunClsVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load)); fixed (Vector128<UInt16>* pClsVar = &_clsVar) { var result = AdvSimd.ShiftRightLogicalRounded( AdvSimd.LoadVector128((UInt16*)(pClsVar)), 1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar, _dataTable.outArrayPtr); } } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var firstOp = Unsafe.Read<Vector128<UInt16>>(_dataTable.inArrayPtr); var result = AdvSimd.ShiftRightLogicalRounded(firstOp, 1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(firstOp, _dataTable.outArrayPtr); } public void RunLclVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load)); var firstOp = AdvSimd.LoadVector128((UInt16*)(_dataTable.inArrayPtr)); var result = AdvSimd.ShiftRightLogicalRounded(firstOp, 1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(firstOp, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new ImmUnaryOpTest__ShiftRightLogicalRounded_Vector128_UInt16_1(); var result = AdvSimd.ShiftRightLogicalRounded(test._fld, 1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld, _dataTable.outArrayPtr); } public void RunClassLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load)); var test = new ImmUnaryOpTest__ShiftRightLogicalRounded_Vector128_UInt16_1(); fixed (Vector128<UInt16>* pFld = &test._fld) { var result = AdvSimd.ShiftRightLogicalRounded( AdvSimd.LoadVector128((UInt16*)(pFld)), 1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld, _dataTable.outArrayPtr); } } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = AdvSimd.ShiftRightLogicalRounded(_fld, 1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld, _dataTable.outArrayPtr); } public void RunClassFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load)); fixed (Vector128<UInt16>* pFld = &_fld) { var result = AdvSimd.ShiftRightLogicalRounded( AdvSimd.LoadVector128((UInt16*)(pFld)), 1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld, _dataTable.outArrayPtr); } } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = AdvSimd.ShiftRightLogicalRounded(test._fld, 1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld, _dataTable.outArrayPtr); } public void RunStructLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load)); var test = TestStruct.Create(); var result = AdvSimd.ShiftRightLogicalRounded( AdvSimd.LoadVector128((UInt16*)(&test._fld)), 1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } public void RunStructFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load)); var test = TestStruct.Create(); test.RunStructFldScenario_Load(this); } public void RunUnsupportedScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario)); bool succeeded = false; try { RunBasicScenario_UnsafeRead(); } catch (PlatformNotSupportedException) { succeeded = true; } if (!succeeded) { Succeeded = false; } } private void ValidateResult(Vector128<UInt16> firstOp, void* result, [CallerMemberName] string method = "") { UInt16[] inArray = new UInt16[Op1ElementCount]; UInt16[] outArray = new UInt16[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), firstOp); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>()); ValidateResult(inArray, outArray, method); } private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "") { UInt16[] inArray = new UInt16[Op1ElementCount]; UInt16[] outArray = new UInt16[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector128<UInt16>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt16>>()); ValidateResult(inArray, outArray, method); } private void ValidateResult(UInt16[] firstOp, UInt16[] result, [CallerMemberName] string method = "") { bool succeeded = true; for (var i = 0; i < RetElementCount; i++) { if (Helpers.ShiftRightLogicalRounded(firstOp[i], Imm) != result[i]) { succeeded = false; break; } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd)}.{nameof(AdvSimd.ShiftRightLogicalRounded)}<UInt16>(Vector128<UInt16>, 1): {method} failed:"); TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/tests/JIT/HardwareIntrinsics/Arm/AdvSimd/AddPairwiseWideningAndAdd.Vector128.UInt16.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics.Arm\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.Arm; namespace JIT.HardwareIntrinsics.Arm { public static partial class Program { private static void AddPairwiseWideningAndAdd_Vector128_UInt16() { var test = new SimpleBinaryOpTest__AddPairwiseWideningAndAdd_Vector128_UInt16(); if (test.IsSupported) { // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates basic functionality works, using Load test.RunBasicScenario_Load(); } // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates calling via reflection works, using Load test.RunReflectionScenario_Load(); } // Validates passing a static member works test.RunClsVarScenario(); if (AdvSimd.IsSupported) { // Validates passing a static member works, using pinning and Load test.RunClsVarScenario_Load(); } // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates passing a local works, using Load test.RunLclVarScenario_Load(); } // Validates passing the field of a local class works test.RunClassLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local class works, using pinning and Load test.RunClassLclFldScenario_Load(); } // Validates passing an instance member of a class works test.RunClassFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a class works, using pinning and Load test.RunClassFldScenario_Load(); } // Validates passing the field of a local struct works test.RunStructLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local struct works, using pinning and Load test.RunStructLclFldScenario_Load(); } // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a struct works, using pinning and Load test.RunStructFldScenario_Load(); } } else { // Validates we throw on unsupported hardware test.RunUnsupportedScenario(); } if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class SimpleBinaryOpTest__AddPairwiseWideningAndAdd_Vector128_UInt16 { private struct DataTable { private byte[] inArray1; private byte[] inArray2; private byte[] outArray; private GCHandle inHandle1; private GCHandle inHandle2; private GCHandle outHandle; private ulong alignment; public DataTable(UInt32[] inArray1, UInt16[] inArray2, UInt32[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<UInt32>(); int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<UInt16>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<UInt32>(); if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfinArray2 || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray1 = new byte[alignment * 2]; this.inArray2 = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned); this.inHandle2 = GCHandle.Alloc(this.inArray2, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<UInt32, byte>(ref inArray1[0]), (uint)sizeOfinArray1); Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<UInt16, byte>(ref inArray2[0]), (uint)sizeOfinArray2); } public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment); public void* inArray2Ptr => Align((byte*)(inHandle2.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle1.Free(); inHandle2.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector128<UInt32> _fld1; public Vector128<UInt16> _fld2; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref testStruct._fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref testStruct._fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>()); return testStruct; } public void RunStructFldScenario(SimpleBinaryOpTest__AddPairwiseWideningAndAdd_Vector128_UInt16 testClass) { var result = AdvSimd.AddPairwiseWideningAndAdd(_fld1, _fld2); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } public void RunStructFldScenario_Load(SimpleBinaryOpTest__AddPairwiseWideningAndAdd_Vector128_UInt16 testClass) { fixed (Vector128<UInt32>* pFld1 = &_fld1) fixed (Vector128<UInt16>* pFld2 = &_fld2) { var result = AdvSimd.AddPairwiseWideningAndAdd( AdvSimd.LoadVector128((UInt32*)(pFld1)), AdvSimd.LoadVector128((UInt16*)(pFld2)) ); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } } } private static readonly int LargestVectorSize = 16; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16); private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32); private static UInt32[] _data1 = new UInt32[Op1ElementCount]; private static UInt16[] _data2 = new UInt16[Op2ElementCount]; private static Vector128<UInt32> _clsVar1; private static Vector128<UInt16> _clsVar2; private Vector128<UInt32> _fld1; private Vector128<UInt16> _fld2; private DataTable _dataTable; static SimpleBinaryOpTest__AddPairwiseWideningAndAdd_Vector128_UInt16() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>()); } public SimpleBinaryOpTest__AddPairwiseWideningAndAdd_Vector128_UInt16() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt16(); } _dataTable = new DataTable(_data1, _data2, new UInt32[RetElementCount], LargestVectorSize); } public bool IsSupported => AdvSimd.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = AdvSimd.AddPairwiseWideningAndAdd( Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<UInt16>>(_dataTable.inArray2Ptr) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunBasicScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load)); var result = AdvSimd.AddPairwiseWideningAndAdd( AdvSimd.LoadVector128((UInt32*)(_dataTable.inArray1Ptr)), AdvSimd.LoadVector128((UInt16*)(_dataTable.inArray2Ptr)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.AddPairwiseWideningAndAdd), new Type[] { typeof(Vector128<UInt32>), typeof(Vector128<UInt16>) }) .Invoke(null, new object[] { Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<UInt16>>(_dataTable.inArray2Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt32>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load)); var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.AddPairwiseWideningAndAdd), new Type[] { typeof(Vector128<UInt32>), typeof(Vector128<UInt16>) }) .Invoke(null, new object[] { AdvSimd.LoadVector128((UInt32*)(_dataTable.inArray1Ptr)), AdvSimd.LoadVector128((UInt16*)(_dataTable.inArray2Ptr)) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt32>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = AdvSimd.AddPairwiseWideningAndAdd( _clsVar1, _clsVar2 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } public void RunClsVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load)); fixed (Vector128<UInt32>* pClsVar1 = &_clsVar1) fixed (Vector128<UInt16>* pClsVar2 = &_clsVar2) { var result = AdvSimd.AddPairwiseWideningAndAdd( AdvSimd.LoadVector128((UInt32*)(pClsVar1)), AdvSimd.LoadVector128((UInt16*)(pClsVar2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector128<UInt16>>(_dataTable.inArray2Ptr); var result = AdvSimd.AddPairwiseWideningAndAdd(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunLclVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load)); var op1 = AdvSimd.LoadVector128((UInt32*)(_dataTable.inArray1Ptr)); var op2 = AdvSimd.LoadVector128((UInt16*)(_dataTable.inArray2Ptr)); var result = AdvSimd.AddPairwiseWideningAndAdd(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new SimpleBinaryOpTest__AddPairwiseWideningAndAdd_Vector128_UInt16(); var result = AdvSimd.AddPairwiseWideningAndAdd(test._fld1, test._fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunClassLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load)); var test = new SimpleBinaryOpTest__AddPairwiseWideningAndAdd_Vector128_UInt16(); fixed (Vector128<UInt32>* pFld1 = &test._fld1) fixed (Vector128<UInt16>* pFld2 = &test._fld2) { var result = AdvSimd.AddPairwiseWideningAndAdd( AdvSimd.LoadVector128((UInt32*)(pFld1)), AdvSimd.LoadVector128((UInt16*)(pFld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = AdvSimd.AddPairwiseWideningAndAdd(_fld1, _fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } public void RunClassFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load)); fixed (Vector128<UInt32>* pFld1 = &_fld1) fixed (Vector128<UInt16>* pFld2 = &_fld2) { var result = AdvSimd.AddPairwiseWideningAndAdd( AdvSimd.LoadVector128((UInt32*)(pFld1)), AdvSimd.LoadVector128((UInt16*)(pFld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = AdvSimd.AddPairwiseWideningAndAdd(test._fld1, test._fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunStructLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load)); var test = TestStruct.Create(); var result = AdvSimd.AddPairwiseWideningAndAdd( AdvSimd.LoadVector128((UInt32*)(&test._fld1)), AdvSimd.LoadVector128((UInt16*)(&test._fld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } public void RunStructFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load)); var test = TestStruct.Create(); test.RunStructFldScenario_Load(this); } public void RunUnsupportedScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario)); bool succeeded = false; try { RunBasicScenario_UnsafeRead(); } catch (PlatformNotSupportedException) { succeeded = true; } if (!succeeded) { Succeeded = false; } } private void ValidateResult(Vector128<UInt32> op1, Vector128<UInt16> op2, void* result, [CallerMemberName] string method = "") { UInt32[] inArray1 = new UInt32[Op1ElementCount]; UInt16[] inArray2 = new UInt16[Op2ElementCount]; UInt32[] outArray = new UInt32[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), op1); Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), op2); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(void* op1, void* op2, void* result, [CallerMemberName] string method = "") { UInt32[] inArray1 = new UInt32[Op1ElementCount]; UInt16[] inArray2 = new UInt16[Op2ElementCount]; UInt32[] outArray = new UInt32[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector128<UInt16>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(UInt32[] left, UInt16[] right, UInt32[] result, [CallerMemberName] string method = "") { bool succeeded = true; for (var i = 0; i < RetElementCount; i++) { if (Helpers.AddPairwiseWideningAndAdd(left, right, i) != result[i]) { succeeded = false; break; } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd)}.{nameof(AdvSimd.AddPairwiseWideningAndAdd)}<UInt32>(Vector128<UInt32>, Vector128<UInt16>): {method} failed:"); TestLibrary.TestFramework.LogInformation($" left: ({string.Join(", ", left)})"); TestLibrary.TestFramework.LogInformation($" right: ({string.Join(", ", right)})"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics.Arm\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.Arm; namespace JIT.HardwareIntrinsics.Arm { public static partial class Program { private static void AddPairwiseWideningAndAdd_Vector128_UInt16() { var test = new SimpleBinaryOpTest__AddPairwiseWideningAndAdd_Vector128_UInt16(); if (test.IsSupported) { // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates basic functionality works, using Load test.RunBasicScenario_Load(); } // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates calling via reflection works, using Load test.RunReflectionScenario_Load(); } // Validates passing a static member works test.RunClsVarScenario(); if (AdvSimd.IsSupported) { // Validates passing a static member works, using pinning and Load test.RunClsVarScenario_Load(); } // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates passing a local works, using Load test.RunLclVarScenario_Load(); } // Validates passing the field of a local class works test.RunClassLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local class works, using pinning and Load test.RunClassLclFldScenario_Load(); } // Validates passing an instance member of a class works test.RunClassFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a class works, using pinning and Load test.RunClassFldScenario_Load(); } // Validates passing the field of a local struct works test.RunStructLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local struct works, using pinning and Load test.RunStructLclFldScenario_Load(); } // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a struct works, using pinning and Load test.RunStructFldScenario_Load(); } } else { // Validates we throw on unsupported hardware test.RunUnsupportedScenario(); } if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class SimpleBinaryOpTest__AddPairwiseWideningAndAdd_Vector128_UInt16 { private struct DataTable { private byte[] inArray1; private byte[] inArray2; private byte[] outArray; private GCHandle inHandle1; private GCHandle inHandle2; private GCHandle outHandle; private ulong alignment; public DataTable(UInt32[] inArray1, UInt16[] inArray2, UInt32[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<UInt32>(); int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<UInt16>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<UInt32>(); if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfinArray2 || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray1 = new byte[alignment * 2]; this.inArray2 = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned); this.inHandle2 = GCHandle.Alloc(this.inArray2, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<UInt32, byte>(ref inArray1[0]), (uint)sizeOfinArray1); Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<UInt16, byte>(ref inArray2[0]), (uint)sizeOfinArray2); } public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment); public void* inArray2Ptr => Align((byte*)(inHandle2.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle1.Free(); inHandle2.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector128<UInt32> _fld1; public Vector128<UInt16> _fld2; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref testStruct._fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref testStruct._fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>()); return testStruct; } public void RunStructFldScenario(SimpleBinaryOpTest__AddPairwiseWideningAndAdd_Vector128_UInt16 testClass) { var result = AdvSimd.AddPairwiseWideningAndAdd(_fld1, _fld2); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } public void RunStructFldScenario_Load(SimpleBinaryOpTest__AddPairwiseWideningAndAdd_Vector128_UInt16 testClass) { fixed (Vector128<UInt32>* pFld1 = &_fld1) fixed (Vector128<UInt16>* pFld2 = &_fld2) { var result = AdvSimd.AddPairwiseWideningAndAdd( AdvSimd.LoadVector128((UInt32*)(pFld1)), AdvSimd.LoadVector128((UInt16*)(pFld2)) ); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } } } private static readonly int LargestVectorSize = 16; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt16>>() / sizeof(UInt16); private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32); private static UInt32[] _data1 = new UInt32[Op1ElementCount]; private static UInt16[] _data2 = new UInt16[Op2ElementCount]; private static Vector128<UInt32> _clsVar1; private static Vector128<UInt16> _clsVar2; private Vector128<UInt32> _fld1; private Vector128<UInt16> _fld2; private DataTable _dataTable; static SimpleBinaryOpTest__AddPairwiseWideningAndAdd_Vector128_UInt16() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _clsVar2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>()); } public SimpleBinaryOpTest__AddPairwiseWideningAndAdd_Vector128_UInt16() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt16>, byte>(ref _fld2), ref Unsafe.As<UInt16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt16>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt16(); } _dataTable = new DataTable(_data1, _data2, new UInt32[RetElementCount], LargestVectorSize); } public bool IsSupported => AdvSimd.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = AdvSimd.AddPairwiseWideningAndAdd( Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<UInt16>>(_dataTable.inArray2Ptr) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunBasicScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load)); var result = AdvSimd.AddPairwiseWideningAndAdd( AdvSimd.LoadVector128((UInt32*)(_dataTable.inArray1Ptr)), AdvSimd.LoadVector128((UInt16*)(_dataTable.inArray2Ptr)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.AddPairwiseWideningAndAdd), new Type[] { typeof(Vector128<UInt32>), typeof(Vector128<UInt16>) }) .Invoke(null, new object[] { Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<UInt16>>(_dataTable.inArray2Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt32>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load)); var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.AddPairwiseWideningAndAdd), new Type[] { typeof(Vector128<UInt32>), typeof(Vector128<UInt16>) }) .Invoke(null, new object[] { AdvSimd.LoadVector128((UInt32*)(_dataTable.inArray1Ptr)), AdvSimd.LoadVector128((UInt16*)(_dataTable.inArray2Ptr)) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt32>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = AdvSimd.AddPairwiseWideningAndAdd( _clsVar1, _clsVar2 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } public void RunClsVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load)); fixed (Vector128<UInt32>* pClsVar1 = &_clsVar1) fixed (Vector128<UInt16>* pClsVar2 = &_clsVar2) { var result = AdvSimd.AddPairwiseWideningAndAdd( AdvSimd.LoadVector128((UInt32*)(pClsVar1)), AdvSimd.LoadVector128((UInt16*)(pClsVar2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector128<UInt16>>(_dataTable.inArray2Ptr); var result = AdvSimd.AddPairwiseWideningAndAdd(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunLclVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load)); var op1 = AdvSimd.LoadVector128((UInt32*)(_dataTable.inArray1Ptr)); var op2 = AdvSimd.LoadVector128((UInt16*)(_dataTable.inArray2Ptr)); var result = AdvSimd.AddPairwiseWideningAndAdd(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new SimpleBinaryOpTest__AddPairwiseWideningAndAdd_Vector128_UInt16(); var result = AdvSimd.AddPairwiseWideningAndAdd(test._fld1, test._fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunClassLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load)); var test = new SimpleBinaryOpTest__AddPairwiseWideningAndAdd_Vector128_UInt16(); fixed (Vector128<UInt32>* pFld1 = &test._fld1) fixed (Vector128<UInt16>* pFld2 = &test._fld2) { var result = AdvSimd.AddPairwiseWideningAndAdd( AdvSimd.LoadVector128((UInt32*)(pFld1)), AdvSimd.LoadVector128((UInt16*)(pFld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = AdvSimd.AddPairwiseWideningAndAdd(_fld1, _fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } public void RunClassFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load)); fixed (Vector128<UInt32>* pFld1 = &_fld1) fixed (Vector128<UInt16>* pFld2 = &_fld2) { var result = AdvSimd.AddPairwiseWideningAndAdd( AdvSimd.LoadVector128((UInt32*)(pFld1)), AdvSimd.LoadVector128((UInt16*)(pFld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = AdvSimd.AddPairwiseWideningAndAdd(test._fld1, test._fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunStructLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load)); var test = TestStruct.Create(); var result = AdvSimd.AddPairwiseWideningAndAdd( AdvSimd.LoadVector128((UInt32*)(&test._fld1)), AdvSimd.LoadVector128((UInt16*)(&test._fld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } public void RunStructFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load)); var test = TestStruct.Create(); test.RunStructFldScenario_Load(this); } public void RunUnsupportedScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario)); bool succeeded = false; try { RunBasicScenario_UnsafeRead(); } catch (PlatformNotSupportedException) { succeeded = true; } if (!succeeded) { Succeeded = false; } } private void ValidateResult(Vector128<UInt32> op1, Vector128<UInt16> op2, void* result, [CallerMemberName] string method = "") { UInt32[] inArray1 = new UInt32[Op1ElementCount]; UInt16[] inArray2 = new UInt16[Op2ElementCount]; UInt32[] outArray = new UInt32[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), op1); Unsafe.WriteUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), op2); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(void* op1, void* op2, void* result, [CallerMemberName] string method = "") { UInt32[] inArray1 = new UInt32[Op1ElementCount]; UInt16[] inArray2 = new UInt16[Op2ElementCount]; UInt32[] outArray = new UInt32[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector128<UInt16>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(UInt32[] left, UInt16[] right, UInt32[] result, [CallerMemberName] string method = "") { bool succeeded = true; for (var i = 0; i < RetElementCount; i++) { if (Helpers.AddPairwiseWideningAndAdd(left, right, i) != result[i]) { succeeded = false; break; } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd)}.{nameof(AdvSimd.AddPairwiseWideningAndAdd)}<UInt32>(Vector128<UInt32>, Vector128<UInt16>): {method} failed:"); TestLibrary.TestFramework.LogInformation($" left: ({string.Join(", ", left)})"); TestLibrary.TestFramework.LogInformation($" right: ({string.Join(", ", right)})"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/libraries/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/ExportMetadataAttributeTests.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using Xunit; namespace System.ComponentModel.Composition { public class ExportMetadataAttributeTests { [Fact] public void Constructor_NullAsNameArgument_ShouldSetNamePropertyToEmptyString() { var attribute = new ExportMetadataAttribute((string)null, "Value"); Assert.Equal(string.Empty, attribute.Name); } [Fact] public void Constructor_ShouldSetIsMultiplePropertyToFalse() { var attribute = new ExportMetadataAttribute("Name", "Value"); Assert.False(attribute.IsMultiple); } [Fact] public void Constructor_ValueAsNameArgument_ShouldSetNameProperty() { var expectations = Expectations.GetMetadataNames(); foreach (var e in expectations) { var attribute = new ExportMetadataAttribute(e, "Value"); Assert.Equal(e, attribute.Name); } } [Fact] public void Constructor_ValueAsValueArgument_ShouldSetValueProperty() { var expectations = Expectations.GetMetadataValues(); foreach (var e in expectations) { var attribute = new ExportMetadataAttribute("Name", e); Assert.Equal(e, attribute.Value); } } [Fact] public void IsMultiple_ValueAsValueArgument_ShouldSetPropert() { var expectations = Expectations.GetBooleans(); var attribute = new ExportMetadataAttribute("Name", "Value"); foreach (var e in expectations) { attribute.IsMultiple = e; Assert.Equal(e, attribute.IsMultiple); } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using Xunit; namespace System.ComponentModel.Composition { public class ExportMetadataAttributeTests { [Fact] public void Constructor_NullAsNameArgument_ShouldSetNamePropertyToEmptyString() { var attribute = new ExportMetadataAttribute((string)null, "Value"); Assert.Equal(string.Empty, attribute.Name); } [Fact] public void Constructor_ShouldSetIsMultiplePropertyToFalse() { var attribute = new ExportMetadataAttribute("Name", "Value"); Assert.False(attribute.IsMultiple); } [Fact] public void Constructor_ValueAsNameArgument_ShouldSetNameProperty() { var expectations = Expectations.GetMetadataNames(); foreach (var e in expectations) { var attribute = new ExportMetadataAttribute(e, "Value"); Assert.Equal(e, attribute.Name); } } [Fact] public void Constructor_ValueAsValueArgument_ShouldSetValueProperty() { var expectations = Expectations.GetMetadataValues(); foreach (var e in expectations) { var attribute = new ExportMetadataAttribute("Name", e); Assert.Equal(e, attribute.Value); } } [Fact] public void IsMultiple_ValueAsValueArgument_ShouldSetPropert() { var expectations = Expectations.GetBooleans(); var attribute = new ExportMetadataAttribute("Name", "Value"); foreach (var e in expectations) { attribute.IsMultiple = e; Assert.Equal(e, attribute.IsMultiple); } } } }
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/libraries/System.Net.Http/src/System/Net/Http/Headers/KnownHeader.cs
// 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.Text; namespace System.Net.Http.Headers { internal sealed partial class KnownHeader { public KnownHeader(string name, int? http2StaticTableIndex = null, int? http3StaticTableIndex = null) : this(name, HttpHeaderType.Custom, parser: null, knownValues: null, http2StaticTableIndex, http3StaticTableIndex) { Debug.Assert(!string.IsNullOrEmpty(name)); Debug.Assert(name[0] == ':' || HttpRuleParser.GetTokenLength(name, 0) == name.Length); } public KnownHeader(string name, HttpHeaderType headerType, HttpHeaderParser? parser, string[]? knownValues = null, int? http2StaticTableIndex = null, int? http3StaticTableIndex = null) { Debug.Assert(!string.IsNullOrEmpty(name)); Debug.Assert(name[0] == ':' || HttpRuleParser.GetTokenLength(name, 0) == name.Length); Name = name; HeaderType = headerType; Parser = parser; KnownValues = knownValues; Initialize(http2StaticTableIndex, http3StaticTableIndex); var asciiBytesWithColonSpace = new byte[name.Length + 2]; // + 2 for ':' and ' ' int asciiBytes = Encoding.ASCII.GetBytes(name, asciiBytesWithColonSpace); Debug.Assert(asciiBytes == name.Length); asciiBytesWithColonSpace[asciiBytesWithColonSpace.Length - 2] = (byte)':'; asciiBytesWithColonSpace[asciiBytesWithColonSpace.Length - 1] = (byte)' '; AsciiBytesWithColonSpace = asciiBytesWithColonSpace; } partial void Initialize(int? http2StaticTableIndex, int? http3StaticTableIndex); public string Name { get; } public HttpHeaderParser? Parser { get; } public HttpHeaderType HeaderType { get; } /// <summary> /// If a raw string is a known value, this instance will be returned rather than allocating a new string. /// </summary> public string[]? KnownValues { get; } public byte[] AsciiBytesWithColonSpace { get; } public HeaderDescriptor Descriptor => new HeaderDescriptor(this); } }
// 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.Text; namespace System.Net.Http.Headers { internal sealed partial class KnownHeader { public KnownHeader(string name, int? http2StaticTableIndex = null, int? http3StaticTableIndex = null) : this(name, HttpHeaderType.Custom, parser: null, knownValues: null, http2StaticTableIndex, http3StaticTableIndex) { Debug.Assert(!string.IsNullOrEmpty(name)); Debug.Assert(name[0] == ':' || HttpRuleParser.GetTokenLength(name, 0) == name.Length); } public KnownHeader(string name, HttpHeaderType headerType, HttpHeaderParser? parser, string[]? knownValues = null, int? http2StaticTableIndex = null, int? http3StaticTableIndex = null) { Debug.Assert(!string.IsNullOrEmpty(name)); Debug.Assert(name[0] == ':' || HttpRuleParser.GetTokenLength(name, 0) == name.Length); Name = name; HeaderType = headerType; Parser = parser; KnownValues = knownValues; Initialize(http2StaticTableIndex, http3StaticTableIndex); var asciiBytesWithColonSpace = new byte[name.Length + 2]; // + 2 for ':' and ' ' int asciiBytes = Encoding.ASCII.GetBytes(name, asciiBytesWithColonSpace); Debug.Assert(asciiBytes == name.Length); asciiBytesWithColonSpace[asciiBytesWithColonSpace.Length - 2] = (byte)':'; asciiBytesWithColonSpace[asciiBytesWithColonSpace.Length - 1] = (byte)' '; AsciiBytesWithColonSpace = asciiBytesWithColonSpace; } partial void Initialize(int? http2StaticTableIndex, int? http3StaticTableIndex); public string Name { get; } public HttpHeaderParser? Parser { get; } public HttpHeaderType HeaderType { get; } /// <summary> /// If a raw string is a known value, this instance will be returned rather than allocating a new string. /// </summary> public string[]? KnownValues { get; } public byte[] AsciiBytesWithColonSpace { get; } public HeaderDescriptor Descriptor => new HeaderDescriptor(this); } }
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/tests/JIT/HardwareIntrinsics/Arm/AdvSimd.Arm64/AddSaturateScalar.Vector64.Byte.Vector64.Byte.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics.Arm\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.Arm; namespace JIT.HardwareIntrinsics.Arm { public static partial class Program { private static void AddSaturateScalar_Vector64_Byte_Vector64_Byte() { var test = new SimpleBinaryOpTest__AddSaturateScalar_Vector64_Byte_Vector64_Byte(); if (test.IsSupported) { // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates basic functionality works, using Load test.RunBasicScenario_Load(); } // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates calling via reflection works, using Load test.RunReflectionScenario_Load(); } // Validates passing a static member works test.RunClsVarScenario(); if (AdvSimd.IsSupported) { // Validates passing a static member works, using pinning and Load test.RunClsVarScenario_Load(); } // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates passing a local works, using Load test.RunLclVarScenario_Load(); } // Validates passing the field of a local class works test.RunClassLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local class works, using pinning and Load test.RunClassLclFldScenario_Load(); } // Validates passing an instance member of a class works test.RunClassFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a class works, using pinning and Load test.RunClassFldScenario_Load(); } // Validates passing the field of a local struct works test.RunStructLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local struct works, using pinning and Load test.RunStructLclFldScenario_Load(); } // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a struct works, using pinning and Load test.RunStructFldScenario_Load(); } } else { // Validates we throw on unsupported hardware test.RunUnsupportedScenario(); } if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class SimpleBinaryOpTest__AddSaturateScalar_Vector64_Byte_Vector64_Byte { private struct DataTable { private byte[] inArray1; private byte[] inArray2; private byte[] outArray; private GCHandle inHandle1; private GCHandle inHandle2; private GCHandle outHandle; private ulong alignment; public DataTable(Byte[] inArray1, Byte[] inArray2, Byte[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Byte>(); int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<Byte>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<Byte>(); if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfinArray2 || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray1 = new byte[alignment * 2]; this.inArray2 = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned); this.inHandle2 = GCHandle.Alloc(this.inArray2, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<Byte, byte>(ref inArray1[0]), (uint)sizeOfinArray1); Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<Byte, byte>(ref inArray2[0]), (uint)sizeOfinArray2); } public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment); public void* inArray2Ptr => Align((byte*)(inHandle2.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle1.Free(); inHandle2.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector64<Byte> _fld1; public Vector64<Byte> _fld2; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Byte>, byte>(ref testStruct._fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Byte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Byte>, byte>(ref testStruct._fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<Byte>>()); return testStruct; } public void RunStructFldScenario(SimpleBinaryOpTest__AddSaturateScalar_Vector64_Byte_Vector64_Byte testClass) { var result = AdvSimd.Arm64.AddSaturateScalar(_fld1, _fld2); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } public void RunStructFldScenario_Load(SimpleBinaryOpTest__AddSaturateScalar_Vector64_Byte_Vector64_Byte testClass) { fixed (Vector64<Byte>* pFld1 = &_fld1) fixed (Vector64<Byte>* pFld2 = &_fld2) { var result = AdvSimd.Arm64.AddSaturateScalar( AdvSimd.LoadVector64((Byte*)(pFld1)), AdvSimd.LoadVector64((Byte*)(pFld2)) ); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } } } private static readonly int LargestVectorSize = 8; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector64<Byte>>() / sizeof(Byte); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector64<Byte>>() / sizeof(Byte); private static readonly int RetElementCount = Unsafe.SizeOf<Vector64<Byte>>() / sizeof(Byte); private static Byte[] _data1 = new Byte[Op1ElementCount]; private static Byte[] _data2 = new Byte[Op2ElementCount]; private static Vector64<Byte> _clsVar1; private static Vector64<Byte> _clsVar2; private Vector64<Byte> _fld1; private Vector64<Byte> _fld2; private DataTable _dataTable; static SimpleBinaryOpTest__AddSaturateScalar_Vector64_Byte_Vector64_Byte() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Byte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<Byte>>()); } public SimpleBinaryOpTest__AddSaturateScalar_Vector64_Byte_Vector64_Byte() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Byte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<Byte>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetByte(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetByte(); } _dataTable = new DataTable(_data1, _data2, new Byte[RetElementCount], LargestVectorSize); } public bool IsSupported => AdvSimd.Arm64.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = AdvSimd.Arm64.AddSaturateScalar( Unsafe.Read<Vector64<Byte>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector64<Byte>>(_dataTable.inArray2Ptr) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunBasicScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load)); var result = AdvSimd.Arm64.AddSaturateScalar( AdvSimd.LoadVector64((Byte*)(_dataTable.inArray1Ptr)), AdvSimd.LoadVector64((Byte*)(_dataTable.inArray2Ptr)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var result = typeof(AdvSimd.Arm64).GetMethod(nameof(AdvSimd.Arm64.AddSaturateScalar), new Type[] { typeof(Vector64<Byte>), typeof(Vector64<Byte>) }) .Invoke(null, new object[] { Unsafe.Read<Vector64<Byte>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector64<Byte>>(_dataTable.inArray2Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector64<Byte>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load)); var result = typeof(AdvSimd.Arm64).GetMethod(nameof(AdvSimd.Arm64.AddSaturateScalar), new Type[] { typeof(Vector64<Byte>), typeof(Vector64<Byte>) }) .Invoke(null, new object[] { AdvSimd.LoadVector64((Byte*)(_dataTable.inArray1Ptr)), AdvSimd.LoadVector64((Byte*)(_dataTable.inArray2Ptr)) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector64<Byte>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = AdvSimd.Arm64.AddSaturateScalar( _clsVar1, _clsVar2 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } public void RunClsVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load)); fixed (Vector64<Byte>* pClsVar1 = &_clsVar1) fixed (Vector64<Byte>* pClsVar2 = &_clsVar2) { var result = AdvSimd.Arm64.AddSaturateScalar( AdvSimd.LoadVector64((Byte*)(pClsVar1)), AdvSimd.LoadVector64((Byte*)(pClsVar2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector64<Byte>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector64<Byte>>(_dataTable.inArray2Ptr); var result = AdvSimd.Arm64.AddSaturateScalar(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunLclVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load)); var op1 = AdvSimd.LoadVector64((Byte*)(_dataTable.inArray1Ptr)); var op2 = AdvSimd.LoadVector64((Byte*)(_dataTable.inArray2Ptr)); var result = AdvSimd.Arm64.AddSaturateScalar(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new SimpleBinaryOpTest__AddSaturateScalar_Vector64_Byte_Vector64_Byte(); var result = AdvSimd.Arm64.AddSaturateScalar(test._fld1, test._fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunClassLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load)); var test = new SimpleBinaryOpTest__AddSaturateScalar_Vector64_Byte_Vector64_Byte(); fixed (Vector64<Byte>* pFld1 = &test._fld1) fixed (Vector64<Byte>* pFld2 = &test._fld2) { var result = AdvSimd.Arm64.AddSaturateScalar( AdvSimd.LoadVector64((Byte*)(pFld1)), AdvSimd.LoadVector64((Byte*)(pFld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = AdvSimd.Arm64.AddSaturateScalar(_fld1, _fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } public void RunClassFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load)); fixed (Vector64<Byte>* pFld1 = &_fld1) fixed (Vector64<Byte>* pFld2 = &_fld2) { var result = AdvSimd.Arm64.AddSaturateScalar( AdvSimd.LoadVector64((Byte*)(pFld1)), AdvSimd.LoadVector64((Byte*)(pFld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = AdvSimd.Arm64.AddSaturateScalar(test._fld1, test._fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunStructLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load)); var test = TestStruct.Create(); var result = AdvSimd.Arm64.AddSaturateScalar( AdvSimd.LoadVector64((Byte*)(&test._fld1)), AdvSimd.LoadVector64((Byte*)(&test._fld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } public void RunStructFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load)); var test = TestStruct.Create(); test.RunStructFldScenario_Load(this); } public void RunUnsupportedScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario)); bool succeeded = false; try { RunBasicScenario_UnsafeRead(); } catch (PlatformNotSupportedException) { succeeded = true; } if (!succeeded) { Succeeded = false; } } private void ValidateResult(Vector64<Byte> op1, Vector64<Byte> op2, void* result, [CallerMemberName] string method = "") { Byte[] inArray1 = new Byte[Op1ElementCount]; Byte[] inArray2 = new Byte[Op2ElementCount]; Byte[] outArray = new Byte[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), op1); Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), op2); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<Byte>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(void* op1, void* op2, void* result, [CallerMemberName] string method = "") { Byte[] inArray1 = new Byte[Op1ElementCount]; Byte[] inArray2 = new Byte[Op2ElementCount]; Byte[] outArray = new Byte[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector64<Byte>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector64<Byte>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<Byte>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(Byte[] left, Byte[] right, Byte[] result, [CallerMemberName] string method = "") { bool succeeded = true; if (Helpers.AddSaturate(left[0], right[0]) != result[0]) { succeeded = false; } else { for (var i = 1; i < RetElementCount; i++) { if (result[i] != 0) { succeeded = false; break; } } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd.Arm64)}.{nameof(AdvSimd.Arm64.AddSaturateScalar)}<Byte>(Vector64<Byte>, Vector64<Byte>): {method} failed:"); TestLibrary.TestFramework.LogInformation($" left: ({string.Join(", ", left)})"); TestLibrary.TestFramework.LogInformation($" right: ({string.Join(", ", right)})"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics.Arm\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.Arm; namespace JIT.HardwareIntrinsics.Arm { public static partial class Program { private static void AddSaturateScalar_Vector64_Byte_Vector64_Byte() { var test = new SimpleBinaryOpTest__AddSaturateScalar_Vector64_Byte_Vector64_Byte(); if (test.IsSupported) { // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates basic functionality works, using Load test.RunBasicScenario_Load(); } // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates calling via reflection works, using Load test.RunReflectionScenario_Load(); } // Validates passing a static member works test.RunClsVarScenario(); if (AdvSimd.IsSupported) { // Validates passing a static member works, using pinning and Load test.RunClsVarScenario_Load(); } // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates passing a local works, using Load test.RunLclVarScenario_Load(); } // Validates passing the field of a local class works test.RunClassLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local class works, using pinning and Load test.RunClassLclFldScenario_Load(); } // Validates passing an instance member of a class works test.RunClassFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a class works, using pinning and Load test.RunClassFldScenario_Load(); } // Validates passing the field of a local struct works test.RunStructLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local struct works, using pinning and Load test.RunStructLclFldScenario_Load(); } // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a struct works, using pinning and Load test.RunStructFldScenario_Load(); } } else { // Validates we throw on unsupported hardware test.RunUnsupportedScenario(); } if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class SimpleBinaryOpTest__AddSaturateScalar_Vector64_Byte_Vector64_Byte { private struct DataTable { private byte[] inArray1; private byte[] inArray2; private byte[] outArray; private GCHandle inHandle1; private GCHandle inHandle2; private GCHandle outHandle; private ulong alignment; public DataTable(Byte[] inArray1, Byte[] inArray2, Byte[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Byte>(); int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<Byte>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<Byte>(); if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfinArray2 || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray1 = new byte[alignment * 2]; this.inArray2 = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned); this.inHandle2 = GCHandle.Alloc(this.inArray2, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<Byte, byte>(ref inArray1[0]), (uint)sizeOfinArray1); Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<Byte, byte>(ref inArray2[0]), (uint)sizeOfinArray2); } public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment); public void* inArray2Ptr => Align((byte*)(inHandle2.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle1.Free(); inHandle2.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector64<Byte> _fld1; public Vector64<Byte> _fld2; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Byte>, byte>(ref testStruct._fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Byte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Byte>, byte>(ref testStruct._fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<Byte>>()); return testStruct; } public void RunStructFldScenario(SimpleBinaryOpTest__AddSaturateScalar_Vector64_Byte_Vector64_Byte testClass) { var result = AdvSimd.Arm64.AddSaturateScalar(_fld1, _fld2); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } public void RunStructFldScenario_Load(SimpleBinaryOpTest__AddSaturateScalar_Vector64_Byte_Vector64_Byte testClass) { fixed (Vector64<Byte>* pFld1 = &_fld1) fixed (Vector64<Byte>* pFld2 = &_fld2) { var result = AdvSimd.Arm64.AddSaturateScalar( AdvSimd.LoadVector64((Byte*)(pFld1)), AdvSimd.LoadVector64((Byte*)(pFld2)) ); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } } } private static readonly int LargestVectorSize = 8; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector64<Byte>>() / sizeof(Byte); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector64<Byte>>() / sizeof(Byte); private static readonly int RetElementCount = Unsafe.SizeOf<Vector64<Byte>>() / sizeof(Byte); private static Byte[] _data1 = new Byte[Op1ElementCount]; private static Byte[] _data2 = new Byte[Op2ElementCount]; private static Vector64<Byte> _clsVar1; private static Vector64<Byte> _clsVar2; private Vector64<Byte> _fld1; private Vector64<Byte> _fld2; private DataTable _dataTable; static SimpleBinaryOpTest__AddSaturateScalar_Vector64_Byte_Vector64_Byte() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Byte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<Byte>>()); } public SimpleBinaryOpTest__AddSaturateScalar_Vector64_Byte_Vector64_Byte() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Byte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<Byte>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetByte(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetByte(); } _dataTable = new DataTable(_data1, _data2, new Byte[RetElementCount], LargestVectorSize); } public bool IsSupported => AdvSimd.Arm64.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = AdvSimd.Arm64.AddSaturateScalar( Unsafe.Read<Vector64<Byte>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector64<Byte>>(_dataTable.inArray2Ptr) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunBasicScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load)); var result = AdvSimd.Arm64.AddSaturateScalar( AdvSimd.LoadVector64((Byte*)(_dataTable.inArray1Ptr)), AdvSimd.LoadVector64((Byte*)(_dataTable.inArray2Ptr)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var result = typeof(AdvSimd.Arm64).GetMethod(nameof(AdvSimd.Arm64.AddSaturateScalar), new Type[] { typeof(Vector64<Byte>), typeof(Vector64<Byte>) }) .Invoke(null, new object[] { Unsafe.Read<Vector64<Byte>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector64<Byte>>(_dataTable.inArray2Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector64<Byte>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load)); var result = typeof(AdvSimd.Arm64).GetMethod(nameof(AdvSimd.Arm64.AddSaturateScalar), new Type[] { typeof(Vector64<Byte>), typeof(Vector64<Byte>) }) .Invoke(null, new object[] { AdvSimd.LoadVector64((Byte*)(_dataTable.inArray1Ptr)), AdvSimd.LoadVector64((Byte*)(_dataTable.inArray2Ptr)) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector64<Byte>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = AdvSimd.Arm64.AddSaturateScalar( _clsVar1, _clsVar2 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } public void RunClsVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load)); fixed (Vector64<Byte>* pClsVar1 = &_clsVar1) fixed (Vector64<Byte>* pClsVar2 = &_clsVar2) { var result = AdvSimd.Arm64.AddSaturateScalar( AdvSimd.LoadVector64((Byte*)(pClsVar1)), AdvSimd.LoadVector64((Byte*)(pClsVar2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector64<Byte>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector64<Byte>>(_dataTable.inArray2Ptr); var result = AdvSimd.Arm64.AddSaturateScalar(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunLclVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load)); var op1 = AdvSimd.LoadVector64((Byte*)(_dataTable.inArray1Ptr)); var op2 = AdvSimd.LoadVector64((Byte*)(_dataTable.inArray2Ptr)); var result = AdvSimd.Arm64.AddSaturateScalar(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new SimpleBinaryOpTest__AddSaturateScalar_Vector64_Byte_Vector64_Byte(); var result = AdvSimd.Arm64.AddSaturateScalar(test._fld1, test._fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunClassLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load)); var test = new SimpleBinaryOpTest__AddSaturateScalar_Vector64_Byte_Vector64_Byte(); fixed (Vector64<Byte>* pFld1 = &test._fld1) fixed (Vector64<Byte>* pFld2 = &test._fld2) { var result = AdvSimd.Arm64.AddSaturateScalar( AdvSimd.LoadVector64((Byte*)(pFld1)), AdvSimd.LoadVector64((Byte*)(pFld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = AdvSimd.Arm64.AddSaturateScalar(_fld1, _fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } public void RunClassFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load)); fixed (Vector64<Byte>* pFld1 = &_fld1) fixed (Vector64<Byte>* pFld2 = &_fld2) { var result = AdvSimd.Arm64.AddSaturateScalar( AdvSimd.LoadVector64((Byte*)(pFld1)), AdvSimd.LoadVector64((Byte*)(pFld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = AdvSimd.Arm64.AddSaturateScalar(test._fld1, test._fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunStructLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load)); var test = TestStruct.Create(); var result = AdvSimd.Arm64.AddSaturateScalar( AdvSimd.LoadVector64((Byte*)(&test._fld1)), AdvSimd.LoadVector64((Byte*)(&test._fld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } public void RunStructFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load)); var test = TestStruct.Create(); test.RunStructFldScenario_Load(this); } public void RunUnsupportedScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario)); bool succeeded = false; try { RunBasicScenario_UnsafeRead(); } catch (PlatformNotSupportedException) { succeeded = true; } if (!succeeded) { Succeeded = false; } } private void ValidateResult(Vector64<Byte> op1, Vector64<Byte> op2, void* result, [CallerMemberName] string method = "") { Byte[] inArray1 = new Byte[Op1ElementCount]; Byte[] inArray2 = new Byte[Op2ElementCount]; Byte[] outArray = new Byte[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), op1); Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), op2); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<Byte>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(void* op1, void* op2, void* result, [CallerMemberName] string method = "") { Byte[] inArray1 = new Byte[Op1ElementCount]; Byte[] inArray2 = new Byte[Op2ElementCount]; Byte[] outArray = new Byte[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector64<Byte>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector64<Byte>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<Byte>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(Byte[] left, Byte[] right, Byte[] result, [CallerMemberName] string method = "") { bool succeeded = true; if (Helpers.AddSaturate(left[0], right[0]) != result[0]) { succeeded = false; } else { for (var i = 1; i < RetElementCount; i++) { if (result[i] != 0) { succeeded = false; break; } } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd.Arm64)}.{nameof(AdvSimd.Arm64.AddSaturateScalar)}<Byte>(Vector64<Byte>, Vector64<Byte>): {method} failed:"); TestLibrary.TestFramework.LogInformation($" left: ({string.Join(", ", left)})"); TestLibrary.TestFramework.LogInformation($" right: ({string.Join(", ", right)})"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/tests/JIT/HardwareIntrinsics/General/Vector128/Max.SByte.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; namespace JIT.HardwareIntrinsics.General { public static partial class Program { private static void MaxSByte() { var test = new VectorBinaryOpTest__MaxSByte(); // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); // Validates passing a static member works test.RunClsVarScenario(); // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); // Validates passing the field of a local class works test.RunClassLclFldScenario(); // Validates passing an instance member of a class works test.RunClassFldScenario(); // Validates passing the field of a local struct works test.RunStructLclFldScenario(); // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class VectorBinaryOpTest__MaxSByte { private struct DataTable { private byte[] inArray1; private byte[] inArray2; private byte[] outArray; private GCHandle inHandle1; private GCHandle inHandle2; private GCHandle outHandle; private ulong alignment; public DataTable(SByte[] inArray1, SByte[] inArray2, SByte[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<SByte>(); int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<SByte>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<SByte>(); if ((alignment != 32 && alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfinArray2 || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray1 = new byte[alignment * 2]; this.inArray2 = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned); this.inHandle2 = GCHandle.Alloc(this.inArray2, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<SByte, byte>(ref inArray1[0]), (uint)sizeOfinArray1); Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<SByte, byte>(ref inArray2[0]), (uint)sizeOfinArray2); } public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment); public void* inArray2Ptr => Align((byte*)(inHandle2.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle1.Free(); inHandle2.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector128<SByte> _fld1; public Vector128<SByte> _fld2; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref testStruct._fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref testStruct._fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>()); return testStruct; } public void RunStructFldScenario(VectorBinaryOpTest__MaxSByte testClass) { var result = Vector128.Max(_fld1, _fld2); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } } private static readonly int LargestVectorSize = 16; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte); private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte); private static SByte[] _data1 = new SByte[Op1ElementCount]; private static SByte[] _data2 = new SByte[Op2ElementCount]; private static Vector128<SByte> _clsVar1; private static Vector128<SByte> _clsVar2; private Vector128<SByte> _fld1; private Vector128<SByte> _fld2; private DataTable _dataTable; static VectorBinaryOpTest__MaxSByte() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>()); } public VectorBinaryOpTest__MaxSByte() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSByte(); } _dataTable = new DataTable(_data1, _data2, new SByte[RetElementCount], LargestVectorSize); } public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = Vector128.Max( Unsafe.Read<Vector128<SByte>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<SByte>>(_dataTable.inArray2Ptr) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var method = typeof(Vector128).GetMethod(nameof(Vector128.Max), new Type[] { typeof(Vector128<SByte>), typeof(Vector128<SByte>) }); if (method is null) { method = typeof(Vector128).GetMethod(nameof(Vector128.Max), 1, new Type[] { typeof(Vector128<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), typeof(Vector128<>).MakeGenericType(Type.MakeGenericMethodParameter(0)) }); } if (method.IsGenericMethodDefinition) { method = method.MakeGenericMethod(typeof(SByte)); } var result = method.Invoke(null, new object[] { Unsafe.Read<Vector128<SByte>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<SByte>>(_dataTable.inArray2Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<SByte>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = Vector128.Max( _clsVar1, _clsVar2 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector128<SByte>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector128<SByte>>(_dataTable.inArray2Ptr); var result = Vector128.Max(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new VectorBinaryOpTest__MaxSByte(); var result = Vector128.Max(test._fld1, test._fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = Vector128.Max(_fld1, _fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = Vector128.Max(test._fld1, test._fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } private void ValidateResult(Vector128<SByte> op1, Vector128<SByte> op2, void* result, [CallerMemberName] string method = "") { SByte[] inArray1 = new SByte[Op1ElementCount]; SByte[] inArray2 = new SByte[Op2ElementCount]; SByte[] outArray = new SByte[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), op1); Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), op2); Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(void* op1, void* op2, void* result, [CallerMemberName] string method = "") { SByte[] inArray1 = new SByte[Op1ElementCount]; SByte[] inArray2 = new SByte[Op2ElementCount]; SByte[] outArray = new SByte[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector128<SByte>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector128<SByte>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(SByte[] left, SByte[] right, SByte[] result, [CallerMemberName] string method = "") { bool succeeded = true; if (result[0] != ((left[0] > right[0]) ? left[0] : right[0])) { succeeded = false; } else { for (var i = 1; i < RetElementCount; i++) { if (result[i] != ((left[i] > right[i]) ? left[i] : right[i])) { succeeded = false; break; } } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(Vector128)}.{nameof(Vector128.Max)}<SByte>(Vector128<SByte>, Vector128<SByte>): {method} failed:"); TestLibrary.TestFramework.LogInformation($" left: ({string.Join(", ", left)})"); TestLibrary.TestFramework.LogInformation($" right: ({string.Join(", ", right)})"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; namespace JIT.HardwareIntrinsics.General { public static partial class Program { private static void MaxSByte() { var test = new VectorBinaryOpTest__MaxSByte(); // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); // Validates passing a static member works test.RunClsVarScenario(); // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); // Validates passing the field of a local class works test.RunClassLclFldScenario(); // Validates passing an instance member of a class works test.RunClassFldScenario(); // Validates passing the field of a local struct works test.RunStructLclFldScenario(); // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class VectorBinaryOpTest__MaxSByte { private struct DataTable { private byte[] inArray1; private byte[] inArray2; private byte[] outArray; private GCHandle inHandle1; private GCHandle inHandle2; private GCHandle outHandle; private ulong alignment; public DataTable(SByte[] inArray1, SByte[] inArray2, SByte[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<SByte>(); int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<SByte>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<SByte>(); if ((alignment != 32 && alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfinArray2 || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray1 = new byte[alignment * 2]; this.inArray2 = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned); this.inHandle2 = GCHandle.Alloc(this.inArray2, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<SByte, byte>(ref inArray1[0]), (uint)sizeOfinArray1); Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<SByte, byte>(ref inArray2[0]), (uint)sizeOfinArray2); } public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment); public void* inArray2Ptr => Align((byte*)(inHandle2.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle1.Free(); inHandle2.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector128<SByte> _fld1; public Vector128<SByte> _fld2; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref testStruct._fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref testStruct._fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>()); return testStruct; } public void RunStructFldScenario(VectorBinaryOpTest__MaxSByte testClass) { var result = Vector128.Max(_fld1, _fld2); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } } private static readonly int LargestVectorSize = 16; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte); private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte); private static SByte[] _data1 = new SByte[Op1ElementCount]; private static SByte[] _data2 = new SByte[Op2ElementCount]; private static Vector128<SByte> _clsVar1; private static Vector128<SByte> _clsVar2; private Vector128<SByte> _fld1; private Vector128<SByte> _fld2; private DataTable _dataTable; static VectorBinaryOpTest__MaxSByte() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>()); } public VectorBinaryOpTest__MaxSByte() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<SByte>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSByte(); } _dataTable = new DataTable(_data1, _data2, new SByte[RetElementCount], LargestVectorSize); } public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = Vector128.Max( Unsafe.Read<Vector128<SByte>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<SByte>>(_dataTable.inArray2Ptr) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var method = typeof(Vector128).GetMethod(nameof(Vector128.Max), new Type[] { typeof(Vector128<SByte>), typeof(Vector128<SByte>) }); if (method is null) { method = typeof(Vector128).GetMethod(nameof(Vector128.Max), 1, new Type[] { typeof(Vector128<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), typeof(Vector128<>).MakeGenericType(Type.MakeGenericMethodParameter(0)) }); } if (method.IsGenericMethodDefinition) { method = method.MakeGenericMethod(typeof(SByte)); } var result = method.Invoke(null, new object[] { Unsafe.Read<Vector128<SByte>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<SByte>>(_dataTable.inArray2Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<SByte>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = Vector128.Max( _clsVar1, _clsVar2 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector128<SByte>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector128<SByte>>(_dataTable.inArray2Ptr); var result = Vector128.Max(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new VectorBinaryOpTest__MaxSByte(); var result = Vector128.Max(test._fld1, test._fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = Vector128.Max(_fld1, _fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = Vector128.Max(test._fld1, test._fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } private void ValidateResult(Vector128<SByte> op1, Vector128<SByte> op2, void* result, [CallerMemberName] string method = "") { SByte[] inArray1 = new SByte[Op1ElementCount]; SByte[] inArray2 = new SByte[Op2ElementCount]; SByte[] outArray = new SByte[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), op1); Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), op2); Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(void* op1, void* op2, void* result, [CallerMemberName] string method = "") { SByte[] inArray1 = new SByte[Op1ElementCount]; SByte[] inArray2 = new SByte[Op2ElementCount]; SByte[] outArray = new SByte[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector128<SByte>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector128<SByte>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<SByte>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(SByte[] left, SByte[] right, SByte[] result, [CallerMemberName] string method = "") { bool succeeded = true; if (result[0] != ((left[0] > right[0]) ? left[0] : right[0])) { succeeded = false; } else { for (var i = 1; i < RetElementCount; i++) { if (result[i] != ((left[i] > right[i]) ? left[i] : right[i])) { succeeded = false; break; } } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(Vector128)}.{nameof(Vector128.Max)}<SByte>(Vector128<SByte>, Vector128<SByte>): {method} failed:"); TestLibrary.TestFramework.LogInformation($" left: ({string.Join(", ", left)})"); TestLibrary.TestFramework.LogInformation($" right: ({string.Join(", ", right)})"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcMetaDataColumnNames.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. namespace System.Data.Odbc { public static class OdbcMetaDataColumnNames { public static readonly string BooleanFalseLiteral = "BooleanFalseLiteral"; public static readonly string BooleanTrueLiteral = "BooleanTrueLiteral"; public static readonly string SQLType = "SQLType"; } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. namespace System.Data.Odbc { public static class OdbcMetaDataColumnNames { public static readonly string BooleanFalseLiteral = "BooleanFalseLiteral"; public static readonly string BooleanTrueLiteral = "BooleanTrueLiteral"; public static readonly string SQLType = "SQLType"; } }
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/tests/baseservices/exceptions/generics/genericexceptions07.cs
// 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.Globalization; using System.IO; class MyException : Exception { } public class Help { public static Exception s_exceptionToThrow; public static bool s_matchingException; public static Object s_object = new object(); } public struct Struct<T> where T: Exception { public void StructInstanceFunctionWithFewArgs() { try { throw Help.s_exceptionToThrow; } catch (T match) { if (!Help.s_matchingException) throw new Exception("This should not have been caught here", match); Console.WriteLine("Caught matching " + match.GetType()); } catch (Exception mismatch) { if (Help.s_matchingException) throw new Exception("Should have been caught above", mismatch); Console.WriteLine("Expected mismatch " + mismatch.GetType()); } } } public class GenericExceptions { public static void StructInstanceFunctionWithFewArgs() { Help.s_matchingException = true; Help.s_exceptionToThrow = new MyException(); (new Struct<Exception>()).StructInstanceFunctionWithFewArgs(); (new Struct<MyException>()).StructInstanceFunctionWithFewArgs(); Help.s_matchingException = false; Help.s_exceptionToThrow = new Exception(); (new Struct<MyException>()).StructInstanceFunctionWithFewArgs(); } [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)] public static int Main() { try { Console.WriteLine("This test checks that we can catch generic exceptions."); Console.WriteLine("All exceptions should be handled by the test itself"); StructInstanceFunctionWithFewArgs(); } catch (Exception) { Console.WriteLine("Test Failed"); return -1; } Console.WriteLine("Test Passed"); return 100; } }
// 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.Globalization; using System.IO; class MyException : Exception { } public class Help { public static Exception s_exceptionToThrow; public static bool s_matchingException; public static Object s_object = new object(); } public struct Struct<T> where T: Exception { public void StructInstanceFunctionWithFewArgs() { try { throw Help.s_exceptionToThrow; } catch (T match) { if (!Help.s_matchingException) throw new Exception("This should not have been caught here", match); Console.WriteLine("Caught matching " + match.GetType()); } catch (Exception mismatch) { if (Help.s_matchingException) throw new Exception("Should have been caught above", mismatch); Console.WriteLine("Expected mismatch " + mismatch.GetType()); } } } public class GenericExceptions { public static void StructInstanceFunctionWithFewArgs() { Help.s_matchingException = true; Help.s_exceptionToThrow = new MyException(); (new Struct<Exception>()).StructInstanceFunctionWithFewArgs(); (new Struct<MyException>()).StructInstanceFunctionWithFewArgs(); Help.s_matchingException = false; Help.s_exceptionToThrow = new Exception(); (new Struct<MyException>()).StructInstanceFunctionWithFewArgs(); } [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)] public static int Main() { try { Console.WriteLine("This test checks that we can catch generic exceptions."); Console.WriteLine("All exceptions should be handled by the test itself"); StructInstanceFunctionWithFewArgs(); } catch (Exception) { Console.WriteLine("Test Failed"); return -1; } Console.WriteLine("Test Passed"); return 100; } }
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/tests/JIT/HardwareIntrinsics/Arm/AdvSimd/LoadVector64.Int16.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics\Arm\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.Arm; namespace JIT.HardwareIntrinsics.Arm { public static partial class Program { private static void LoadVector64_Int16() { var test = new LoadUnaryOpTest__LoadVector64_Int16(); if (test.IsSupported) { // Validates basic functionality works test.RunBasicScenario_Load(); // Validates calling via reflection works test.RunReflectionScenario_Load(); } else { // Validates we throw on unsupported hardware test.RunUnsupportedScenario(); } if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class LoadUnaryOpTest__LoadVector64_Int16 { private struct DataTable { private byte[] inArray1; private byte[] outArray; private GCHandle inHandle1; private GCHandle outHandle; private ulong alignment; public DataTable(Int16[] inArray1, Int16[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Int16>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<Int16>(); if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray1 = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<Int16, byte>(ref inArray1[0]), (uint)sizeOfinArray1); } public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle1.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private static readonly int LargestVectorSize = 8; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector64<Int16>>() / sizeof(Int16); private static readonly int RetElementCount = Unsafe.SizeOf<Vector64<Int16>>() / sizeof(Int16); private static Int16[] _data = new Int16[Op1ElementCount]; private DataTable _dataTable; public LoadUnaryOpTest__LoadVector64_Int16() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt16(); } _dataTable = new DataTable(_data, new Int16[RetElementCount], LargestVectorSize); } public bool IsSupported => AdvSimd.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load)); var result = AdvSimd.LoadVector64( (Int16*)(_dataTable.inArray1Ptr) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load)); var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.LoadVector64), new Type[] { typeof(Int16*) }) .Invoke(null, new object[] { Pointer.Box(_dataTable.inArray1Ptr, typeof(Int16*)) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector64<Int16>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunUnsupportedScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario)); Succeeded = false; try { RunBasicScenario_Load(); } catch (PlatformNotSupportedException) { Succeeded = true; } } private void ValidateResult(Vector64<Int16> firstOp, void* result, [CallerMemberName] string method = "") { Int16[] inArray = new Int16[Op1ElementCount]; Int16[] outArray = new Int16[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), firstOp); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<Int16>>()); ValidateResult(inArray, outArray, method); } private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "") { Int16[] inArray = new Int16[Op1ElementCount]; Int16[] outArray = new Int16[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector64<Int16>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<Int16>>()); ValidateResult(inArray, outArray, method); } private void ValidateResult(Int16[] firstOp, Int16[] result, [CallerMemberName] string method = "") { bool succeeded = true; for (var i = 0; i < RetElementCount; i++) { if (firstOp[i] != result[i]) { succeeded = false; break; } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd)}.{nameof(AdvSimd.LoadVector64)}<Int16>(Vector64<Int16>): {method} failed:"); TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics\Arm\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.Arm; namespace JIT.HardwareIntrinsics.Arm { public static partial class Program { private static void LoadVector64_Int16() { var test = new LoadUnaryOpTest__LoadVector64_Int16(); if (test.IsSupported) { // Validates basic functionality works test.RunBasicScenario_Load(); // Validates calling via reflection works test.RunReflectionScenario_Load(); } else { // Validates we throw on unsupported hardware test.RunUnsupportedScenario(); } if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class LoadUnaryOpTest__LoadVector64_Int16 { private struct DataTable { private byte[] inArray1; private byte[] outArray; private GCHandle inHandle1; private GCHandle outHandle; private ulong alignment; public DataTable(Int16[] inArray1, Int16[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Int16>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<Int16>(); if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray1 = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<Int16, byte>(ref inArray1[0]), (uint)sizeOfinArray1); } public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle1.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private static readonly int LargestVectorSize = 8; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector64<Int16>>() / sizeof(Int16); private static readonly int RetElementCount = Unsafe.SizeOf<Vector64<Int16>>() / sizeof(Int16); private static Int16[] _data = new Int16[Op1ElementCount]; private DataTable _dataTable; public LoadUnaryOpTest__LoadVector64_Int16() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt16(); } _dataTable = new DataTable(_data, new Int16[RetElementCount], LargestVectorSize); } public bool IsSupported => AdvSimd.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load)); var result = AdvSimd.LoadVector64( (Int16*)(_dataTable.inArray1Ptr) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load)); var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.LoadVector64), new Type[] { typeof(Int16*) }) .Invoke(null, new object[] { Pointer.Box(_dataTable.inArray1Ptr, typeof(Int16*)) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector64<Int16>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunUnsupportedScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario)); Succeeded = false; try { RunBasicScenario_Load(); } catch (PlatformNotSupportedException) { Succeeded = true; } } private void ValidateResult(Vector64<Int16> firstOp, void* result, [CallerMemberName] string method = "") { Int16[] inArray = new Int16[Op1ElementCount]; Int16[] outArray = new Int16[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), firstOp); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<Int16>>()); ValidateResult(inArray, outArray, method); } private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "") { Int16[] inArray = new Int16[Op1ElementCount]; Int16[] outArray = new Int16[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (uint)Unsafe.SizeOf<Vector64<Int16>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<Int16>>()); ValidateResult(inArray, outArray, method); } private void ValidateResult(Int16[] firstOp, Int16[] result, [CallerMemberName] string method = "") { bool succeeded = true; for (var i = 0; i < RetElementCount; i++) { if (firstOp[i] != result[i]) { succeeded = false; break; } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd)}.{nameof(AdvSimd.LoadVector64)}<Int16>(Vector64<Int16>): {method} failed:"); TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/libraries/System.Linq.Expressions/src/System/Linq/Expressions/MemberListBinding.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Dynamic.Utils; using System.Reflection; namespace System.Linq.Expressions { /// <summary> /// Represents initializing the elements of a collection member of a newly created object. /// </summary> public sealed class MemberListBinding : MemberBinding { internal MemberListBinding(MemberInfo member, ReadOnlyCollection<ElementInit> initializers) #pragma warning disable 618 : base(MemberBindingType.ListBinding, member) { #pragma warning restore 618 Initializers = initializers; } /// <summary> /// Gets the element initializers for initializing a collection member of a newly created object. /// </summary> public ReadOnlyCollection<ElementInit> Initializers { get; } /// <summary> /// Creates a new expression that is like this one, but using the /// supplied children. If all of the children are the same, it will /// return this expression. /// </summary> /// <param name="initializers">The <see cref="Initializers"/> property of the result.</param> /// <returns>This expression if no children changed, or an expression with the updated children.</returns> public MemberListBinding Update(IEnumerable<ElementInit> initializers) { if (initializers != null) { if (ExpressionUtils.SameElements(ref initializers!, Initializers)) { return this; } } return Expression.ListBind(Member, initializers!); } internal override void ValidateAsDefinedHere(int index) { } } public partial class Expression { /// <summary>Creates a <see cref="MemberListBinding"/> where the member is a field or property.</summary> /// <returns>A <see cref="MemberListBinding"/> that has the <see cref="MemberBinding.BindingType"/> property equal to <see cref="MemberBindingType.ListBinding"/> and the <see cref="MemberBinding.Member"/> and <see cref="MemberListBinding.Initializers"/> properties set to the specified values.</returns> /// <param name="member">A <see cref="MemberInfo"/> that represents a field or property to set the <see cref="MemberBinding.Member"/> property equal to.</param> /// <param name="initializers">An array of <see cref="System.Linq.Expressions.ElementInit"/> objects to use to populate the <see cref="MemberListBinding.Initializers"/> collection.</param> /// <exception cref="ArgumentNullException"> /// <paramref name="member"/> is null. -or-One or more elements of <paramref name="initializers"/> is null.</exception> /// <exception cref="ArgumentException"> /// <paramref name="member"/> does not represent a field or property.-or-The <see cref="FieldInfo.FieldType"/> or <see cref="PropertyInfo.PropertyType"/> of the field or property that <paramref name="member"/> represents does not implement <see cref="Collections.IEnumerable"/>.</exception> public static MemberListBinding ListBind(MemberInfo member, params ElementInit[] initializers) { return ListBind(member, (IEnumerable<ElementInit>)initializers); } /// <summary>Creates a <see cref="MemberListBinding"/> where the member is a field or property.</summary> /// <returns>A <see cref="MemberListBinding"/> that has the <see cref="MemberBinding.BindingType"/> property equal to <see cref="MemberBindingType.ListBinding"/> and the <see cref="MemberBinding.Member"/> and <see cref="MemberListBinding.Initializers"/> properties set to the specified values.</returns> /// <param name="member">A <see cref="MemberInfo"/> that represents a field or property to set the <see cref="MemberBinding.Member"/> property equal to.</param> /// <param name="initializers">An <see cref="IEnumerable{T}"/> that contains <see cref="System.Linq.Expressions.ElementInit"/> objects to use to populate the <see cref="MemberListBinding.Initializers"/> collection.</param> /// <exception cref="ArgumentNullException"> /// <paramref name="member"/> is null. -or-One or more elements of <paramref name="initializers"/> is null.</exception> /// <exception cref="ArgumentException"> /// <paramref name="member"/> does not represent a field or property.-or-The <see cref="FieldInfo.FieldType"/> or <see cref="PropertyInfo.PropertyType"/> of the field or property that <paramref name="member"/> represents does not implement <see cref="Collections.IEnumerable"/>.</exception> public static MemberListBinding ListBind(MemberInfo member, IEnumerable<ElementInit> initializers) { ContractUtils.RequiresNotNull(member, nameof(member)); ContractUtils.RequiresNotNull(initializers, nameof(initializers)); Type memberType; ValidateGettableFieldOrPropertyMember(member, out memberType); ReadOnlyCollection<ElementInit> initList = initializers.ToReadOnly(); ValidateListInitArgs(memberType, initList, nameof(member)); return new MemberListBinding(member, initList); } /// <summary>Creates a <see cref="MemberListBinding"/> object based on a specified property accessor method.</summary> /// <returns>A <see cref="MemberListBinding"/> that has the <see cref="MemberBinding.BindingType"/> property equal to <see cref="MemberBindingType.ListBinding"/>, the <see cref="MemberBinding.Member"/> property set to the <see cref="MemberInfo"/> that represents the property accessed in <paramref name="propertyAccessor"/>, and <see cref="MemberListBinding.Initializers"/> populated with the elements of <paramref name="initializers"/>.</returns> /// <param name="propertyAccessor">A <see cref="MethodInfo"/> that represents a property accessor method.</param> /// <param name="initializers">An array of <see cref="Expressions.ElementInit"/> objects to use to populate the <see cref="MemberListBinding.Initializers"/> collection.</param> /// <exception cref="ArgumentNullException"> /// <paramref name="propertyAccessor"/> is null. -or-One or more elements of <paramref name="initializers"/> is null.</exception> /// <exception cref="ArgumentException"> /// <paramref name="propertyAccessor"/> does not represent a property accessor method.-or-The <see cref="PropertyInfo.PropertyType"/> of the property that the method represented by <paramref name="propertyAccessor"/> accesses does not implement <see cref="IEnumerable"/>.</exception> [RequiresUnreferencedCode(PropertyFromAccessorRequiresUnreferencedCode)] public static MemberListBinding ListBind(MethodInfo propertyAccessor, params ElementInit[] initializers) { return ListBind(propertyAccessor, (IEnumerable<ElementInit>)initializers); } /// <summary>Creates a <see cref="MemberListBinding"/> based on a specified property accessor method.</summary> /// <returns>A <see cref="MemberListBinding"/> that has the <see cref="MemberBinding.BindingType"/> property equal to <see cref="MemberBindingType.ListBinding"/>, the <see cref="MemberBinding.Member"/> property set to the <see cref="MemberInfo"/> that represents the property accessed in <paramref name="propertyAccessor"/>, and <see cref="MemberListBinding.Initializers"/> populated with the elements of <paramref name="initializers"/>.</returns> /// <param name="propertyAccessor">A <see cref="MethodInfo"/> that represents a property accessor method.</param> /// <param name="initializers">An <see cref="IEnumerable{T}"/> that contains <see cref="Expressions.ElementInit"/> objects to use to populate the <see cref="MemberListBinding.Initializers"/> collection.</param> /// <exception cref="ArgumentNullException"> /// <paramref name="propertyAccessor"/> is null. -or-One or more elements of <paramref name="initializers"/> are null.</exception> /// <exception cref="ArgumentException"> /// <paramref name="propertyAccessor"/> does not represent a property accessor method.-or-The <see cref="PropertyInfo.PropertyType"/> of the property that the method represented by <paramref name="propertyAccessor"/> accesses does not implement <see cref="IEnumerable"/>.</exception> [RequiresUnreferencedCode(PropertyFromAccessorRequiresUnreferencedCode)] public static MemberListBinding ListBind(MethodInfo propertyAccessor, IEnumerable<ElementInit> initializers) { ContractUtils.RequiresNotNull(propertyAccessor, nameof(propertyAccessor)); ContractUtils.RequiresNotNull(initializers, nameof(initializers)); return ListBind(GetProperty(propertyAccessor, nameof(propertyAccessor)), initializers); } private static void ValidateListInitArgs(Type listType, ReadOnlyCollection<ElementInit> initializers, string listTypeParamName) { if (!typeof(IEnumerable).IsAssignableFrom(listType)) { throw Error.TypeNotIEnumerable(listType, listTypeParamName); } for (int i = 0, n = initializers.Count; i < n; i++) { ElementInit element = initializers[i]; ContractUtils.RequiresNotNull(element, nameof(initializers), i); ValidateCallInstanceType(listType, element.AddMethod); } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Dynamic.Utils; using System.Reflection; namespace System.Linq.Expressions { /// <summary> /// Represents initializing the elements of a collection member of a newly created object. /// </summary> public sealed class MemberListBinding : MemberBinding { internal MemberListBinding(MemberInfo member, ReadOnlyCollection<ElementInit> initializers) #pragma warning disable 618 : base(MemberBindingType.ListBinding, member) { #pragma warning restore 618 Initializers = initializers; } /// <summary> /// Gets the element initializers for initializing a collection member of a newly created object. /// </summary> public ReadOnlyCollection<ElementInit> Initializers { get; } /// <summary> /// Creates a new expression that is like this one, but using the /// supplied children. If all of the children are the same, it will /// return this expression. /// </summary> /// <param name="initializers">The <see cref="Initializers"/> property of the result.</param> /// <returns>This expression if no children changed, or an expression with the updated children.</returns> public MemberListBinding Update(IEnumerable<ElementInit> initializers) { if (initializers != null) { if (ExpressionUtils.SameElements(ref initializers!, Initializers)) { return this; } } return Expression.ListBind(Member, initializers!); } internal override void ValidateAsDefinedHere(int index) { } } public partial class Expression { /// <summary>Creates a <see cref="MemberListBinding"/> where the member is a field or property.</summary> /// <returns>A <see cref="MemberListBinding"/> that has the <see cref="MemberBinding.BindingType"/> property equal to <see cref="MemberBindingType.ListBinding"/> and the <see cref="MemberBinding.Member"/> and <see cref="MemberListBinding.Initializers"/> properties set to the specified values.</returns> /// <param name="member">A <see cref="MemberInfo"/> that represents a field or property to set the <see cref="MemberBinding.Member"/> property equal to.</param> /// <param name="initializers">An array of <see cref="System.Linq.Expressions.ElementInit"/> objects to use to populate the <see cref="MemberListBinding.Initializers"/> collection.</param> /// <exception cref="ArgumentNullException"> /// <paramref name="member"/> is null. -or-One or more elements of <paramref name="initializers"/> is null.</exception> /// <exception cref="ArgumentException"> /// <paramref name="member"/> does not represent a field or property.-or-The <see cref="FieldInfo.FieldType"/> or <see cref="PropertyInfo.PropertyType"/> of the field or property that <paramref name="member"/> represents does not implement <see cref="Collections.IEnumerable"/>.</exception> public static MemberListBinding ListBind(MemberInfo member, params ElementInit[] initializers) { return ListBind(member, (IEnumerable<ElementInit>)initializers); } /// <summary>Creates a <see cref="MemberListBinding"/> where the member is a field or property.</summary> /// <returns>A <see cref="MemberListBinding"/> that has the <see cref="MemberBinding.BindingType"/> property equal to <see cref="MemberBindingType.ListBinding"/> and the <see cref="MemberBinding.Member"/> and <see cref="MemberListBinding.Initializers"/> properties set to the specified values.</returns> /// <param name="member">A <see cref="MemberInfo"/> that represents a field or property to set the <see cref="MemberBinding.Member"/> property equal to.</param> /// <param name="initializers">An <see cref="IEnumerable{T}"/> that contains <see cref="System.Linq.Expressions.ElementInit"/> objects to use to populate the <see cref="MemberListBinding.Initializers"/> collection.</param> /// <exception cref="ArgumentNullException"> /// <paramref name="member"/> is null. -or-One or more elements of <paramref name="initializers"/> is null.</exception> /// <exception cref="ArgumentException"> /// <paramref name="member"/> does not represent a field or property.-or-The <see cref="FieldInfo.FieldType"/> or <see cref="PropertyInfo.PropertyType"/> of the field or property that <paramref name="member"/> represents does not implement <see cref="Collections.IEnumerable"/>.</exception> public static MemberListBinding ListBind(MemberInfo member, IEnumerable<ElementInit> initializers) { ContractUtils.RequiresNotNull(member, nameof(member)); ContractUtils.RequiresNotNull(initializers, nameof(initializers)); Type memberType; ValidateGettableFieldOrPropertyMember(member, out memberType); ReadOnlyCollection<ElementInit> initList = initializers.ToReadOnly(); ValidateListInitArgs(memberType, initList, nameof(member)); return new MemberListBinding(member, initList); } /// <summary>Creates a <see cref="MemberListBinding"/> object based on a specified property accessor method.</summary> /// <returns>A <see cref="MemberListBinding"/> that has the <see cref="MemberBinding.BindingType"/> property equal to <see cref="MemberBindingType.ListBinding"/>, the <see cref="MemberBinding.Member"/> property set to the <see cref="MemberInfo"/> that represents the property accessed in <paramref name="propertyAccessor"/>, and <see cref="MemberListBinding.Initializers"/> populated with the elements of <paramref name="initializers"/>.</returns> /// <param name="propertyAccessor">A <see cref="MethodInfo"/> that represents a property accessor method.</param> /// <param name="initializers">An array of <see cref="Expressions.ElementInit"/> objects to use to populate the <see cref="MemberListBinding.Initializers"/> collection.</param> /// <exception cref="ArgumentNullException"> /// <paramref name="propertyAccessor"/> is null. -or-One or more elements of <paramref name="initializers"/> is null.</exception> /// <exception cref="ArgumentException"> /// <paramref name="propertyAccessor"/> does not represent a property accessor method.-or-The <see cref="PropertyInfo.PropertyType"/> of the property that the method represented by <paramref name="propertyAccessor"/> accesses does not implement <see cref="IEnumerable"/>.</exception> [RequiresUnreferencedCode(PropertyFromAccessorRequiresUnreferencedCode)] public static MemberListBinding ListBind(MethodInfo propertyAccessor, params ElementInit[] initializers) { return ListBind(propertyAccessor, (IEnumerable<ElementInit>)initializers); } /// <summary>Creates a <see cref="MemberListBinding"/> based on a specified property accessor method.</summary> /// <returns>A <see cref="MemberListBinding"/> that has the <see cref="MemberBinding.BindingType"/> property equal to <see cref="MemberBindingType.ListBinding"/>, the <see cref="MemberBinding.Member"/> property set to the <see cref="MemberInfo"/> that represents the property accessed in <paramref name="propertyAccessor"/>, and <see cref="MemberListBinding.Initializers"/> populated with the elements of <paramref name="initializers"/>.</returns> /// <param name="propertyAccessor">A <see cref="MethodInfo"/> that represents a property accessor method.</param> /// <param name="initializers">An <see cref="IEnumerable{T}"/> that contains <see cref="Expressions.ElementInit"/> objects to use to populate the <see cref="MemberListBinding.Initializers"/> collection.</param> /// <exception cref="ArgumentNullException"> /// <paramref name="propertyAccessor"/> is null. -or-One or more elements of <paramref name="initializers"/> are null.</exception> /// <exception cref="ArgumentException"> /// <paramref name="propertyAccessor"/> does not represent a property accessor method.-or-The <see cref="PropertyInfo.PropertyType"/> of the property that the method represented by <paramref name="propertyAccessor"/> accesses does not implement <see cref="IEnumerable"/>.</exception> [RequiresUnreferencedCode(PropertyFromAccessorRequiresUnreferencedCode)] public static MemberListBinding ListBind(MethodInfo propertyAccessor, IEnumerable<ElementInit> initializers) { ContractUtils.RequiresNotNull(propertyAccessor, nameof(propertyAccessor)); ContractUtils.RequiresNotNull(initializers, nameof(initializers)); return ListBind(GetProperty(propertyAccessor, nameof(propertyAccessor)), initializers); } private static void ValidateListInitArgs(Type listType, ReadOnlyCollection<ElementInit> initializers, string listTypeParamName) { if (!typeof(IEnumerable).IsAssignableFrom(listType)) { throw Error.TypeNotIEnumerable(listType, listTypeParamName); } for (int i = 0, n = initializers.Count; i < n; i++) { ElementInit element = initializers[i]; ContractUtils.RequiresNotNull(element, nameof(initializers), i); ValidateCallInstanceType(listType, element.AddMethod); } } } }
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/libraries/Microsoft.VisualBasic.Core/src/Microsoft/VisualBasic/CompilerServices/VB6BinaryFile.vb
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. Imports System Imports Microsoft.VisualBasic.CompilerServices.ExceptionUtils Imports Microsoft.VisualBasic.CompilerServices.Utils Imports System.Runtime.Versioning Imports System.Diagnostics.CodeAnalysis Namespace Microsoft.VisualBasic.CompilerServices <System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)> Friend NotInheritable Class VB6BinaryFile '============================================================================ ' Declarations '============================================================================ Inherits VB6RandomFile '============================================================================ ' Constructor '============================================================================ Public Sub New(ByVal FileName As String, ByVal access As OpenAccess, ByVal share As OpenShare) MyBase.New(FileName, access, share, -1) End Sub ' the implementation of Lock in base class VB6RandomFile does not handle m_lRecordLen=-1 <UnsupportedOSPlatform("ios")> <UnsupportedOSPlatform("macos")> <UnsupportedOSPlatform("tvos")> Friend Overloads Overrides Sub Lock(ByVal lStart As Long, ByVal lEnd As Long) If lStart > lEnd Then Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Start")) End If Dim absRecordLength As Long Dim lStartByte As Long Dim lLength As Long If m_lRecordLen = -1 Then ' if record len is -1, then using absolute bytes absRecordLength = 1 Else absRecordLength = m_lRecordLen End If lStartByte = (lStart - 1) * absRecordLength lLength = (lEnd - lStart + 1) * absRecordLength m_file.Lock(lStartByte, lLength) End Sub ' see Lock description <UnsupportedOSPlatform("ios")> <UnsupportedOSPlatform("macos")> <UnsupportedOSPlatform("tvos")> Friend Overloads Overrides Sub Unlock(ByVal lStart As Long, ByVal lEnd As Long) If lStart > lEnd Then Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Start")) End If Dim absRecordLength As Long Dim lStartByte As Long Dim lLength As Long If m_lRecordLen = -1 Then ' if record len is -1, then using absolute bytes absRecordLength = 1 Else absRecordLength = m_lRecordLen End If lStartByte = (lStart - 1) * absRecordLength lLength = (lEnd - lStart + 1) * absRecordLength m_file.Unlock(lStartByte, lLength) End Sub Public Overrides Function GetMode() As OpenMode Return OpenMode.Binary End Function Friend Overloads Overrides Function Seek() As Long 'm_file.position is the last read byte as a zero based offset 'Seek returns the position of the next byte to read Return (m_position + 1) End Function Friend Overloads Overrides Sub Seek(ByVal BaseOnePosition As Long) If BaseOnePosition <= 0 Then Throw VbMakeException(vbErrors.BadRecordNum) End If Dim BaseZeroPosition As Long = BaseOnePosition - 1 m_file.Position = BaseZeroPosition m_position = BaseZeroPosition If Not m_sr Is Nothing Then m_sr.DiscardBufferedData() End If End Sub Friend Overrides Function LOC() As Long Return m_position End Function Friend Overrides Function CanInput() As Boolean Return True End Function Friend Overrides Function CanWrite() As Boolean Return True End Function <RequiresUnreferencedCode("Implementation of Vb6InputFile is unsafe.")> Friend Overloads Overrides Sub Input(ByRef Value As Object) Value = InputStr() End Sub Friend Overloads Overrides Sub Input(ByRef Value As String) Value = InputStr() End Sub Friend Overloads Overrides Sub Input(ByRef Value As Char) Dim s As String = InputStr() If s.Length > 0 Then Value = s.Chars(0) Else Value = ControlChars.NullChar End If End Sub Friend Overloads Overrides Sub Input(ByRef Value As Boolean) Value = BooleanType.FromString(InputStr()) End Sub Friend Overloads Overrides Sub Input(ByRef Value As Byte) Value = ByteType.FromObject(InputNum(VariantType.Byte)) End Sub Friend Overloads Overrides Sub Input(ByRef Value As Short) Value = ShortType.FromObject(InputNum(VariantType.Short)) End Sub Friend Overloads Overrides Sub Input(ByRef Value As Integer) Value = IntegerType.FromObject(InputNum(VariantType.Integer)) End Sub Friend Overloads Overrides Sub Input(ByRef Value As Long) Value = LongType.FromObject(InputNum(VariantType.Long)) End Sub Friend Overloads Overrides Sub Input(ByRef Value As Single) Value = SingleType.FromObject(InputNum(VariantType.Single)) End Sub Friend Overloads Overrides Sub Input(ByRef Value As Double) Value = DoubleType.FromObject(InputNum(VariantType.Double)) End Sub Friend Overloads Overrides Sub Input(ByRef Value As Decimal) Value = DecimalType.FromObject(InputNum(VariantType.Decimal)) End Sub Friend Overloads Overrides Sub Input(ByRef Value As Date) Value = DateType.FromString(InputStr(), GetCultureInfo()) End Sub Friend Overloads Overrides Sub Put(ByVal Value As String, Optional ByVal RecordNumber As Long = 0, Optional ByVal StringIsFixedLength As Boolean = False) ValidateWriteable() PutString(RecordNumber, Value) End Sub Friend Overloads Overrides Sub [Get](ByRef Value As String, Optional ByVal RecordNumber As Long = 0, Optional ByVal StringIsFixedLength As Boolean = False) ValidateReadable() Dim ByteLength As Integer If Value Is Nothing Then ByteLength = 0 Else Diagnostics.Debug.Assert(Not m_Encoding Is Nothing) ByteLength = m_Encoding.GetByteCount(Value) End If Value = GetFixedLengthString(RecordNumber, ByteLength) End Sub Protected Overrides Function InputStr() As String Dim lChar As Integer ' The NullReferenceException is for compatibility with VB6 which threw a NullReferenceException when ' reading from a file that was write-only. The inner exception was added to provide more context. If (m_access <> OpenAccess.ReadWrite) AndAlso (m_access <> OpenAccess.Read) Then Dim JustNeedTheMessage As New NullReferenceException ' We don't have access to the localized resources for this string. Throw New NullReferenceException(JustNeedTheMessage.Message, New IO.IOException(SR.FileOpenedNoRead)) End If ' read past any leading spaces or tabs 'Skip over leading whitespace lChar = SkipWhiteSpaceEOF() If lChar = lchDoubleQuote Then lChar = m_sr.Read() m_position += 1 InputStr = ReadInField(FIN_QSTRING) Else InputStr = ReadInField(FIN_STRING) End If SkipTrailingWhiteSpace() End Function End Class End Namespace
' Licensed to the .NET Foundation under one or more agreements. ' The .NET Foundation licenses this file to you under the MIT license. Imports System Imports Microsoft.VisualBasic.CompilerServices.ExceptionUtils Imports Microsoft.VisualBasic.CompilerServices.Utils Imports System.Runtime.Versioning Imports System.Diagnostics.CodeAnalysis Namespace Microsoft.VisualBasic.CompilerServices <System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)> Friend NotInheritable Class VB6BinaryFile '============================================================================ ' Declarations '============================================================================ Inherits VB6RandomFile '============================================================================ ' Constructor '============================================================================ Public Sub New(ByVal FileName As String, ByVal access As OpenAccess, ByVal share As OpenShare) MyBase.New(FileName, access, share, -1) End Sub ' the implementation of Lock in base class VB6RandomFile does not handle m_lRecordLen=-1 <UnsupportedOSPlatform("ios")> <UnsupportedOSPlatform("macos")> <UnsupportedOSPlatform("tvos")> Friend Overloads Overrides Sub Lock(ByVal lStart As Long, ByVal lEnd As Long) If lStart > lEnd Then Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Start")) End If Dim absRecordLength As Long Dim lStartByte As Long Dim lLength As Long If m_lRecordLen = -1 Then ' if record len is -1, then using absolute bytes absRecordLength = 1 Else absRecordLength = m_lRecordLen End If lStartByte = (lStart - 1) * absRecordLength lLength = (lEnd - lStart + 1) * absRecordLength m_file.Lock(lStartByte, lLength) End Sub ' see Lock description <UnsupportedOSPlatform("ios")> <UnsupportedOSPlatform("macos")> <UnsupportedOSPlatform("tvos")> Friend Overloads Overrides Sub Unlock(ByVal lStart As Long, ByVal lEnd As Long) If lStart > lEnd Then Throw New ArgumentException(SR.Format(SR.Argument_InvalidValue1, "Start")) End If Dim absRecordLength As Long Dim lStartByte As Long Dim lLength As Long If m_lRecordLen = -1 Then ' if record len is -1, then using absolute bytes absRecordLength = 1 Else absRecordLength = m_lRecordLen End If lStartByte = (lStart - 1) * absRecordLength lLength = (lEnd - lStart + 1) * absRecordLength m_file.Unlock(lStartByte, lLength) End Sub Public Overrides Function GetMode() As OpenMode Return OpenMode.Binary End Function Friend Overloads Overrides Function Seek() As Long 'm_file.position is the last read byte as a zero based offset 'Seek returns the position of the next byte to read Return (m_position + 1) End Function Friend Overloads Overrides Sub Seek(ByVal BaseOnePosition As Long) If BaseOnePosition <= 0 Then Throw VbMakeException(vbErrors.BadRecordNum) End If Dim BaseZeroPosition As Long = BaseOnePosition - 1 m_file.Position = BaseZeroPosition m_position = BaseZeroPosition If Not m_sr Is Nothing Then m_sr.DiscardBufferedData() End If End Sub Friend Overrides Function LOC() As Long Return m_position End Function Friend Overrides Function CanInput() As Boolean Return True End Function Friend Overrides Function CanWrite() As Boolean Return True End Function <RequiresUnreferencedCode("Implementation of Vb6InputFile is unsafe.")> Friend Overloads Overrides Sub Input(ByRef Value As Object) Value = InputStr() End Sub Friend Overloads Overrides Sub Input(ByRef Value As String) Value = InputStr() End Sub Friend Overloads Overrides Sub Input(ByRef Value As Char) Dim s As String = InputStr() If s.Length > 0 Then Value = s.Chars(0) Else Value = ControlChars.NullChar End If End Sub Friend Overloads Overrides Sub Input(ByRef Value As Boolean) Value = BooleanType.FromString(InputStr()) End Sub Friend Overloads Overrides Sub Input(ByRef Value As Byte) Value = ByteType.FromObject(InputNum(VariantType.Byte)) End Sub Friend Overloads Overrides Sub Input(ByRef Value As Short) Value = ShortType.FromObject(InputNum(VariantType.Short)) End Sub Friend Overloads Overrides Sub Input(ByRef Value As Integer) Value = IntegerType.FromObject(InputNum(VariantType.Integer)) End Sub Friend Overloads Overrides Sub Input(ByRef Value As Long) Value = LongType.FromObject(InputNum(VariantType.Long)) End Sub Friend Overloads Overrides Sub Input(ByRef Value As Single) Value = SingleType.FromObject(InputNum(VariantType.Single)) End Sub Friend Overloads Overrides Sub Input(ByRef Value As Double) Value = DoubleType.FromObject(InputNum(VariantType.Double)) End Sub Friend Overloads Overrides Sub Input(ByRef Value As Decimal) Value = DecimalType.FromObject(InputNum(VariantType.Decimal)) End Sub Friend Overloads Overrides Sub Input(ByRef Value As Date) Value = DateType.FromString(InputStr(), GetCultureInfo()) End Sub Friend Overloads Overrides Sub Put(ByVal Value As String, Optional ByVal RecordNumber As Long = 0, Optional ByVal StringIsFixedLength As Boolean = False) ValidateWriteable() PutString(RecordNumber, Value) End Sub Friend Overloads Overrides Sub [Get](ByRef Value As String, Optional ByVal RecordNumber As Long = 0, Optional ByVal StringIsFixedLength As Boolean = False) ValidateReadable() Dim ByteLength As Integer If Value Is Nothing Then ByteLength = 0 Else Diagnostics.Debug.Assert(Not m_Encoding Is Nothing) ByteLength = m_Encoding.GetByteCount(Value) End If Value = GetFixedLengthString(RecordNumber, ByteLength) End Sub Protected Overrides Function InputStr() As String Dim lChar As Integer ' The NullReferenceException is for compatibility with VB6 which threw a NullReferenceException when ' reading from a file that was write-only. The inner exception was added to provide more context. If (m_access <> OpenAccess.ReadWrite) AndAlso (m_access <> OpenAccess.Read) Then Dim JustNeedTheMessage As New NullReferenceException ' We don't have access to the localized resources for this string. Throw New NullReferenceException(JustNeedTheMessage.Message, New IO.IOException(SR.FileOpenedNoRead)) End If ' read past any leading spaces or tabs 'Skip over leading whitespace lChar = SkipWhiteSpaceEOF() If lChar = lchDoubleQuote Then lChar = m_sr.Read() m_position += 1 InputStr = ReadInField(FIN_QSTRING) Else InputStr = ReadInField(FIN_STRING) End If SkipTrailingWhiteSpace() End Function End Class End Namespace
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/tests/JIT/Methodical/eh/basics/throwinfinallyintryfilter3_il_d.ilproj
<Project Sdk="Microsoft.NET.Sdk.IL"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>Full</DebugType> </PropertyGroup> <ItemGroup> <Compile Include="throwinfinallyintryfilter3.il" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\..\..\common\eh_common.csproj" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk.IL"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>Full</DebugType> </PropertyGroup> <ItemGroup> <Compile Include="throwinfinallyintryfilter3.il" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\..\..\common\eh_common.csproj" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/tests/JIT/Methodical/Arrays/lcs/lcs2_do.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> </PropertyGroup> <PropertyGroup> <DebugType>Full</DebugType> <Optimize>True</Optimize> <GCStressIncompatible>true</GCStressIncompatible> </PropertyGroup> <ItemGroup> <Compile Include="lcs2.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> </PropertyGroup> <PropertyGroup> <DebugType>Full</DebugType> <Optimize>True</Optimize> <GCStressIncompatible>true</GCStressIncompatible> </PropertyGroup> <ItemGroup> <Compile Include="lcs2.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/coreclr/inc/mpl/type_list
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // // Used in template metaprogramming, type lists consist of a series of // Scheme-like nodes that contain a Head type and a Tail type. The head // type is usually a non-list type, but compound lists are possible. // // Type lists are always terminated with a tail type of mpl::null_type. // #ifndef __type_list__ #define __type_list__ namespace mpl // 'mpl' => 'meta-programming library' { // Used as terminator in type_lists. class null_type {}; // The core type. See file comment for details. template <class T, class U> struct type_list { typedef T head; typedef U tail; }; template <class TList, size_t IDX> struct type_at; template <class head, class tail, size_t IDX> struct type_at<type_list<head, tail>, IDX> { typedef typename type_at<tail, IDX-1>::type type; }; template <class head, class tail> struct type_at<type_list<head, tail>, 0> { typedef head type; }; // Helper struct to create a type_list chain from a list of arguments. template < typename T1 = null_type, typename T2 = null_type, typename T3 = null_type, typename T4 = null_type, typename T5 = null_type, typename T6 = null_type, typename T7 = null_type, typename T8 = null_type, typename T9 = null_type, typename T10 = null_type, typename T11 = null_type, typename T12 = null_type, typename T13 = null_type, typename T14 = null_type, typename T15 = null_type, typename T16 = null_type, typename T17 = null_type, typename T18 = null_type > struct make_type_list { private: // recurse on the tail elements typedef typename make_type_list<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18>::type tail; public: // combine head with computed tail typedef type_list<T1, tail> type; }; template<> struct make_type_list < null_type, null_type, null_type, null_type, null_type, null_type, null_type, null_type, null_type, null_type, null_type, null_type, null_type, null_type, null_type, null_type, null_type, null_type > { public: typedef null_type type; }; } #endif // __type_list__
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // // Used in template metaprogramming, type lists consist of a series of // Scheme-like nodes that contain a Head type and a Tail type. The head // type is usually a non-list type, but compound lists are possible. // // Type lists are always terminated with a tail type of mpl::null_type. // #ifndef __type_list__ #define __type_list__ namespace mpl // 'mpl' => 'meta-programming library' { // Used as terminator in type_lists. class null_type {}; // The core type. See file comment for details. template <class T, class U> struct type_list { typedef T head; typedef U tail; }; template <class TList, size_t IDX> struct type_at; template <class head, class tail, size_t IDX> struct type_at<type_list<head, tail>, IDX> { typedef typename type_at<tail, IDX-1>::type type; }; template <class head, class tail> struct type_at<type_list<head, tail>, 0> { typedef head type; }; // Helper struct to create a type_list chain from a list of arguments. template < typename T1 = null_type, typename T2 = null_type, typename T3 = null_type, typename T4 = null_type, typename T5 = null_type, typename T6 = null_type, typename T7 = null_type, typename T8 = null_type, typename T9 = null_type, typename T10 = null_type, typename T11 = null_type, typename T12 = null_type, typename T13 = null_type, typename T14 = null_type, typename T15 = null_type, typename T16 = null_type, typename T17 = null_type, typename T18 = null_type > struct make_type_list { private: // recurse on the tail elements typedef typename make_type_list<T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18>::type tail; public: // combine head with computed tail typedef type_list<T1, tail> type; }; template<> struct make_type_list < null_type, null_type, null_type, null_type, null_type, null_type, null_type, null_type, null_type, null_type, null_type, null_type, null_type, null_type, null_type, null_type, null_type, null_type > { public: typedef null_type type; }; } #endif // __type_list__
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/tests/GC/Stress/Tests/LeakGenThrd.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Threading; using System; using System.IO; // Licensed under the MIT license. See LICENSE file in the project root for full license information. // namespace LGen { public class LeakGenThrd { internal int myObj; internal int Cv_iCounter = 0; internal int Cv_iRep; public static int Main(string[] args) { int iRep = 2; int iObj = 15; //the number of MB memory will be allocted in MakeLeak() switch (args.Length) { case 1: if (!Int32.TryParse(args[0], out iRep)) { iRep = 2; } break; case 2: if (!Int32.TryParse(args[0], out iRep)) { iRep = 2; } if (!Int32.TryParse(args[1], out iObj)) { iObj = 15; } break; default: iRep = 2; iObj = 15; break; } LeakGenThrd Mv_Leak = new LeakGenThrd(); if (Mv_Leak.runTest(iRep, iObj)) { Console.WriteLine("Test Passed"); return 100; } else { Console.WriteLine("Test Failed"); return 1; } } public bool runTest(int iRep, int iObj) { Cv_iRep = iRep; myObj = iObj; Thread Mv_Thread = new Thread(new ThreadStart(this.ThreadStart)); Mv_Thread.Start(); for (int i = 0; i < iRep; i++) { MakeLeak(iObj); } return true; } public void ThreadStart() { if (Cv_iCounter < Cv_iRep) { LeakObject[] Mv_Obj = new LeakObject[myObj]; for (int i = 0; i < myObj; i++) { Mv_Obj[i] = new LeakObject(i); } Cv_iCounter += 1; Thread Mv_Thread = new Thread(new ThreadStart(this.ThreadStart)); Mv_Thread.Start(); } } public void MakeLeak(int iObj) { LeakObject[] Mv_Obj = new LeakObject[iObj]; for (int i = 0; i < iObj; i++) { Mv_Obj[i] = new LeakObject(i); } } } public class LeakObject { internal int[] mem; public static int icFinal = 0; public LeakObject(int num) { mem = new int[1024 * 250]; //nearly 1MB memory, larger than this will get assert failure. mem[0] = num; mem[mem.Length - 1] = num; } ~LeakObject() { LeakObject.icFinal++; } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Threading; using System; using System.IO; // Licensed under the MIT license. See LICENSE file in the project root for full license information. // namespace LGen { public class LeakGenThrd { internal int myObj; internal int Cv_iCounter = 0; internal int Cv_iRep; public static int Main(string[] args) { int iRep = 2; int iObj = 15; //the number of MB memory will be allocted in MakeLeak() switch (args.Length) { case 1: if (!Int32.TryParse(args[0], out iRep)) { iRep = 2; } break; case 2: if (!Int32.TryParse(args[0], out iRep)) { iRep = 2; } if (!Int32.TryParse(args[1], out iObj)) { iObj = 15; } break; default: iRep = 2; iObj = 15; break; } LeakGenThrd Mv_Leak = new LeakGenThrd(); if (Mv_Leak.runTest(iRep, iObj)) { Console.WriteLine("Test Passed"); return 100; } else { Console.WriteLine("Test Failed"); return 1; } } public bool runTest(int iRep, int iObj) { Cv_iRep = iRep; myObj = iObj; Thread Mv_Thread = new Thread(new ThreadStart(this.ThreadStart)); Mv_Thread.Start(); for (int i = 0; i < iRep; i++) { MakeLeak(iObj); } return true; } public void ThreadStart() { if (Cv_iCounter < Cv_iRep) { LeakObject[] Mv_Obj = new LeakObject[myObj]; for (int i = 0; i < myObj; i++) { Mv_Obj[i] = new LeakObject(i); } Cv_iCounter += 1; Thread Mv_Thread = new Thread(new ThreadStart(this.ThreadStart)); Mv_Thread.Start(); } } public void MakeLeak(int iObj) { LeakObject[] Mv_Obj = new LeakObject[iObj]; for (int i = 0; i < iObj; i++) { Mv_Obj[i] = new LeakObject(i); } } } public class LeakObject { internal int[] mem; public static int icFinal = 0; public LeakObject(int num) { mem = new int[1024 * 250]; //nearly 1MB memory, larger than this will get assert failure. mem[0] = num; mem[mem.Length - 1] = num; } ~LeakObject() { LeakObject.icFinal++; } } }
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/libraries/System.Transactions.Local/tests/AsyncTest.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Threading; using Xunit; namespace System.Transactions.Tests { // Ported from Mono public class AsyncTest : IDisposable { public AsyncTest() { s_delayedException = null; s_called = false; s_mr.Reset(); s_state = 0; Transaction.Current = null; } public void Dispose() { Transaction.Current = null; } [Fact] public void AsyncFail1() { Assert.Throws<InvalidOperationException>(() => { IntResourceManager irm = new IntResourceManager(1); CommittableTransaction ct = new CommittableTransaction(); /* Set ambient Tx */ Transaction.Current = ct; /* Enlist */ irm.Value = 2; IAsyncResult ar = ct.BeginCommit(null, null); IAsyncResult ar2 = ct.BeginCommit(null, null); }); } [Fact] public void AsyncFail2() { Assert.Throws<TransactionAbortedException>(() => { IntResourceManager irm = new IntResourceManager(1); CommittableTransaction ct = new CommittableTransaction(); /* Set ambient Tx */ Transaction.Current = ct; /* Enlist */ irm.Value = 2; irm.FailPrepare = true; IAsyncResult ar = ct.BeginCommit(null, null); ct.EndCommit(ar); }); } private AsyncCallback _callback = null; private static int s_state = 0; /* Callback called ? */ private static bool s_called = false; private static ManualResetEvent s_mr = new ManualResetEvent(false); private static Exception s_delayedException; private static void CommitCallback(IAsyncResult ar) { s_called = true; CommittableTransaction ct = ar as CommittableTransaction; try { s_state = (int)ar.AsyncState; ct.EndCommit(ar); } catch (Exception e) { s_delayedException = e; } finally { s_mr.Set(); } } [Fact] public void AsyncFail3() { s_delayedException = null; IntResourceManager irm = new IntResourceManager(1); CommittableTransaction ct = new CommittableTransaction(); /* Set ambient Tx */ Transaction.Current = ct; /* Enlist */ irm.Value = 2; irm.FailPrepare = true; _callback = new AsyncCallback(CommitCallback); IAsyncResult ar = ct.BeginCommit(_callback, 5); s_mr.WaitOne(new TimeSpan(0, 0, 60)); Assert.True(s_called, "callback not called"); Assert.Equal(5, s_state); Assert.IsType<TransactionAbortedException>(s_delayedException); } [Fact] public void Async1() { IntResourceManager irm = new IntResourceManager(1); CommittableTransaction ct = new CommittableTransaction(); /* Set ambient Tx */ Transaction.Current = ct; /* Enlist */ irm.Value = 2; _callback = new AsyncCallback(CommitCallback); IAsyncResult ar = ct.BeginCommit(_callback, 5); s_mr.WaitOne(new TimeSpan(0, 2, 0)); Assert.True(s_called, "callback not called"); Assert.Equal(5, s_state); if (s_delayedException != null) throw new Exception("", s_delayedException); } [Fact] public void Async2() { IntResourceManager irm = new IntResourceManager(1); CommittableTransaction ct = new CommittableTransaction(); using (TransactionScope scope = new TransactionScope(ct)) { irm.Value = 2; //scope.Complete (); IAsyncResult ar = ct.BeginCommit(null, null); Assert.Throws<TransactionAbortedException>(() => ct.EndCommit(ar)); irm.Check(0, 0, 1, 0, "irm"); } } [Fact] public void Async3() { IntResourceManager irm = new IntResourceManager(1); CommittableTransaction ct = new CommittableTransaction(); /* Set ambient Tx */ Transaction.Current = ct; /* Enlist */ irm.Value = 2; IAsyncResult ar = ct.BeginCommit(null, null); ct.EndCommit(ar); irm.Check(1, 1, 0, 0, "irm"); } [Fact] public void Async4() { IntResourceManager irm = new IntResourceManager(1); CommittableTransaction ct = new CommittableTransaction(); /* Set ambient Tx */ Transaction.Current = ct; /* Enlist */ irm.Value = 2; IAsyncResult ar = ct.BeginCommit(null, null); ar.AsyncWaitHandle.WaitOne(); Assert.True(ar.IsCompleted); irm.Check(1, 1, 0, 0, "irm"); } [Fact] public void Async5() { IntResourceManager irm = new IntResourceManager(1); CommittableTransaction ct = new CommittableTransaction(); /* Set ambient Tx */ Transaction.Current = ct; /* Enlist */ irm.Value = 2; irm.FailPrepare = true; IAsyncResult ar = ct.BeginCommit(null, null); ar.AsyncWaitHandle.WaitOne(); Assert.True(ar.IsCompleted); CommittableTransaction ctx = ar as CommittableTransaction; Assert.Throws<TransactionAbortedException>(() => ctx.EndCommit(ar)); irm.Check(1, 0, 0, 0, "irm"); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Threading; using Xunit; namespace System.Transactions.Tests { // Ported from Mono public class AsyncTest : IDisposable { public AsyncTest() { s_delayedException = null; s_called = false; s_mr.Reset(); s_state = 0; Transaction.Current = null; } public void Dispose() { Transaction.Current = null; } [Fact] public void AsyncFail1() { Assert.Throws<InvalidOperationException>(() => { IntResourceManager irm = new IntResourceManager(1); CommittableTransaction ct = new CommittableTransaction(); /* Set ambient Tx */ Transaction.Current = ct; /* Enlist */ irm.Value = 2; IAsyncResult ar = ct.BeginCommit(null, null); IAsyncResult ar2 = ct.BeginCommit(null, null); }); } [Fact] public void AsyncFail2() { Assert.Throws<TransactionAbortedException>(() => { IntResourceManager irm = new IntResourceManager(1); CommittableTransaction ct = new CommittableTransaction(); /* Set ambient Tx */ Transaction.Current = ct; /* Enlist */ irm.Value = 2; irm.FailPrepare = true; IAsyncResult ar = ct.BeginCommit(null, null); ct.EndCommit(ar); }); } private AsyncCallback _callback = null; private static int s_state = 0; /* Callback called ? */ private static bool s_called = false; private static ManualResetEvent s_mr = new ManualResetEvent(false); private static Exception s_delayedException; private static void CommitCallback(IAsyncResult ar) { s_called = true; CommittableTransaction ct = ar as CommittableTransaction; try { s_state = (int)ar.AsyncState; ct.EndCommit(ar); } catch (Exception e) { s_delayedException = e; } finally { s_mr.Set(); } } [Fact] public void AsyncFail3() { s_delayedException = null; IntResourceManager irm = new IntResourceManager(1); CommittableTransaction ct = new CommittableTransaction(); /* Set ambient Tx */ Transaction.Current = ct; /* Enlist */ irm.Value = 2; irm.FailPrepare = true; _callback = new AsyncCallback(CommitCallback); IAsyncResult ar = ct.BeginCommit(_callback, 5); s_mr.WaitOne(new TimeSpan(0, 0, 60)); Assert.True(s_called, "callback not called"); Assert.Equal(5, s_state); Assert.IsType<TransactionAbortedException>(s_delayedException); } [Fact] public void Async1() { IntResourceManager irm = new IntResourceManager(1); CommittableTransaction ct = new CommittableTransaction(); /* Set ambient Tx */ Transaction.Current = ct; /* Enlist */ irm.Value = 2; _callback = new AsyncCallback(CommitCallback); IAsyncResult ar = ct.BeginCommit(_callback, 5); s_mr.WaitOne(new TimeSpan(0, 2, 0)); Assert.True(s_called, "callback not called"); Assert.Equal(5, s_state); if (s_delayedException != null) throw new Exception("", s_delayedException); } [Fact] public void Async2() { IntResourceManager irm = new IntResourceManager(1); CommittableTransaction ct = new CommittableTransaction(); using (TransactionScope scope = new TransactionScope(ct)) { irm.Value = 2; //scope.Complete (); IAsyncResult ar = ct.BeginCommit(null, null); Assert.Throws<TransactionAbortedException>(() => ct.EndCommit(ar)); irm.Check(0, 0, 1, 0, "irm"); } } [Fact] public void Async3() { IntResourceManager irm = new IntResourceManager(1); CommittableTransaction ct = new CommittableTransaction(); /* Set ambient Tx */ Transaction.Current = ct; /* Enlist */ irm.Value = 2; IAsyncResult ar = ct.BeginCommit(null, null); ct.EndCommit(ar); irm.Check(1, 1, 0, 0, "irm"); } [Fact] public void Async4() { IntResourceManager irm = new IntResourceManager(1); CommittableTransaction ct = new CommittableTransaction(); /* Set ambient Tx */ Transaction.Current = ct; /* Enlist */ irm.Value = 2; IAsyncResult ar = ct.BeginCommit(null, null); ar.AsyncWaitHandle.WaitOne(); Assert.True(ar.IsCompleted); irm.Check(1, 1, 0, 0, "irm"); } [Fact] public void Async5() { IntResourceManager irm = new IntResourceManager(1); CommittableTransaction ct = new CommittableTransaction(); /* Set ambient Tx */ Transaction.Current = ct; /* Enlist */ irm.Value = 2; irm.FailPrepare = true; IAsyncResult ar = ct.BeginCommit(null, null); ar.AsyncWaitHandle.WaitOne(); Assert.True(ar.IsCompleted); CommittableTransaction ctx = ar as CommittableTransaction; Assert.Throws<TransactionAbortedException>(() => ctx.EndCommit(ar)); irm.Check(1, 0, 0, 0, "irm"); } } }
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/tests/Loader/classloader/InterfaceFolding/TestCase4_Nested_I_Nested_J.ilproj
<Project Sdk="Microsoft.NET.Sdk.IL"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <ItemGroup> <Compile Include="Nested_I_Nested_J\TestCase4.il" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk.IL"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <ItemGroup> <Compile Include="Nested_I_Nested_J\TestCase4.il" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/libraries/System.Reflection.Metadata/tests/Metadata/Ecma335/MetadataBuilderTests.cs
// 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.Collections.Immutable; using System.Reflection.Metadata.Tests; using Xunit; namespace System.Reflection.Metadata.Ecma335.Tests { public class MetadataBuilderTests { [Fact] public void Ctor_Errors() { Assert.Throws<ArgumentOutOfRangeException>(() => new MetadataBuilder(-1)); Assert.Throws<ArgumentOutOfRangeException>(() => new MetadataBuilder(0, -1)); Assert.Throws<ArgumentOutOfRangeException>(() => new MetadataBuilder(0, 0, -1)); Assert.Throws<ArgumentOutOfRangeException>(() => new MetadataBuilder(0, 0, 0, -1)); AssertExtensions.Throws<ArgumentException>("guidHeapStartOffset", () => new MetadataBuilder(0, 0, 0, 1)); new MetadataBuilder(userStringHeapStartOffset: 0x00fffffe); Assert.Throws<ImageFormatLimitationException>(() => new MetadataBuilder(userStringHeapStartOffset: 0x00ffffff)); } [Fact] public void Add() { var builder = new MetadataBuilder(); builder.AddModule(default(int), default(StringHandle), default(GuidHandle), default(GuidHandle), default(GuidHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.Module)); builder.AddAssembly(default(StringHandle), new Version(0, 0, 0, 0), default(StringHandle), default(BlobHandle), default(AssemblyFlags), default(AssemblyHashAlgorithm)); Assert.Equal(1, builder.GetRowCount(TableIndex.Assembly)); var assemblyReference = builder.AddAssemblyReference(default(StringHandle), new Version(0, 0, 0, 0), default(StringHandle), default(BlobHandle), default(AssemblyFlags), default(BlobHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.AssemblyRef)); Assert.Equal(1, MetadataTokens.GetRowNumber(assemblyReference)); var typeDefinition = builder.AddTypeDefinition(default(TypeAttributes), default(StringHandle), default(StringHandle), default(EntityHandle), default(FieldDefinitionHandle), default(MethodDefinitionHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.TypeDef)); Assert.Equal(1, MetadataTokens.GetRowNumber(typeDefinition)); builder.AddTypeLayout(default(TypeDefinitionHandle), default(ushort), default(uint)); Assert.Equal(1, builder.GetRowCount(TableIndex.ClassLayout)); builder.AddInterfaceImplementation(MetadataTokens.TypeDefinitionHandle(1), MetadataTokens.TypeDefinitionHandle(1)); Assert.Equal(1, builder.GetRowCount(TableIndex.InterfaceImpl)); builder.AddNestedType(default(TypeDefinitionHandle), default(TypeDefinitionHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.NestedClass)); var typeReference = builder.AddTypeReference(EntityHandle.ModuleDefinition, default(StringHandle), default(StringHandle)); Assert.Equal(1, MetadataTokens.GetRowNumber(typeReference)); Assert.Equal(1, builder.GetRowCount(TableIndex.TypeRef)); builder.AddTypeSpecification(default(BlobHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.TypeSpec)); builder.AddStandaloneSignature(default(BlobHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.StandAloneSig)); builder.AddProperty(default(PropertyAttributes), default(StringHandle), default(BlobHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.Property)); builder.AddPropertyMap(default(TypeDefinitionHandle), default(PropertyDefinitionHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.PropertyMap)); builder.AddEvent(default(EventAttributes), default(StringHandle), MetadataTokens.TypeDefinitionHandle(1)); Assert.Equal(1, builder.GetRowCount(TableIndex.Event)); builder.AddEventMap(default(TypeDefinitionHandle), default(EventDefinitionHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.EventMap)); builder.AddConstant(MetadataTokens.FieldDefinitionHandle(1), default(object)); Assert.Equal(1, builder.GetRowCount(TableIndex.Constant)); builder.AddMethodSemantics(MetadataTokens.EventDefinitionHandle(1), default(ushort), default(MethodDefinitionHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.MethodSemantics)); builder.AddCustomAttribute(MetadataTokens.TypeDefinitionHandle(1), MetadataTokens.MethodDefinitionHandle(1), default(BlobHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.CustomAttribute)); builder.AddMethodSpecification(MetadataTokens.MethodDefinitionHandle(1), default(BlobHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.MethodSpec)); builder.AddModuleReference(default(StringHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.ModuleRef)); builder.AddParameter(default(ParameterAttributes), default(StringHandle), default(int)); Assert.Equal(1, builder.GetRowCount(TableIndex.Param)); var genericParameter = builder.AddGenericParameter(MetadataTokens.MethodDefinitionHandle(1), default(GenericParameterAttributes), default(StringHandle), default(int)); Assert.Equal(1, builder.GetRowCount(TableIndex.GenericParam)); Assert.Equal(1, MetadataTokens.GetRowNumber(genericParameter)); builder.AddGenericParameterConstraint(default(GenericParameterHandle), MetadataTokens.TypeDefinitionHandle(1)); Assert.Equal(1, builder.GetRowCount(TableIndex.GenericParamConstraint)); builder.AddFieldDefinition(default(FieldAttributes), default(StringHandle), default(BlobHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.Field)); builder.AddFieldLayout(default(FieldDefinitionHandle), default(int)); Assert.Equal(1, builder.GetRowCount(TableIndex.FieldLayout)); builder.AddMarshallingDescriptor(MetadataTokens.FieldDefinitionHandle(1), default(BlobHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.FieldMarshal)); builder.AddFieldRelativeVirtualAddress(default(FieldDefinitionHandle), default(int)); Assert.Equal(1, builder.GetRowCount(TableIndex.FieldRva)); var methodDefinition = builder.AddMethodDefinition(default(MethodAttributes), default(MethodImplAttributes), default(StringHandle), default(BlobHandle), default(int), default(ParameterHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.MethodDef)); Assert.Equal(1, MetadataTokens.GetRowNumber(methodDefinition)); builder.AddMethodImport(MetadataTokens.MethodDefinitionHandle(1), default(MethodImportAttributes), default(StringHandle), default(ModuleReferenceHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.ImplMap)); builder.AddMethodImplementation(default(TypeDefinitionHandle), MetadataTokens.MethodDefinitionHandle(1), MetadataTokens.MethodDefinitionHandle(1)); Assert.Equal(1, builder.GetRowCount(TableIndex.MethodImpl)); var memberReference = builder.AddMemberReference(MetadataTokens.TypeDefinitionHandle(1), default(StringHandle), default(BlobHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.MemberRef)); Assert.Equal(1, MetadataTokens.GetRowNumber(memberReference)); builder.AddManifestResource(default(ManifestResourceAttributes), default(StringHandle), MetadataTokens.AssemblyFileHandle(1), default(uint)); Assert.Equal(1, builder.GetRowCount(TableIndex.ManifestResource)); builder.AddAssemblyFile(default(StringHandle), default(BlobHandle), default(bool)); Assert.Equal(1, builder.GetRowCount(TableIndex.File)); builder.AddExportedType(default(TypeAttributes), default(StringHandle), default(StringHandle), MetadataTokens.AssemblyFileHandle(1), default(int)); Assert.Equal(1, builder.GetRowCount(TableIndex.ExportedType)); builder.AddDeclarativeSecurityAttribute(MetadataTokens.TypeDefinitionHandle(1), default(DeclarativeSecurityAction), default(BlobHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.DeclSecurity)); builder.AddEncLogEntry(MetadataTokens.TypeDefinitionHandle(1), default(EditAndContinueOperation)); Assert.Equal(1, builder.GetRowCount(TableIndex.EncLog)); builder.AddEncMapEntry(MetadataTokens.TypeDefinitionHandle(1)); Assert.Equal(1, builder.GetRowCount(TableIndex.EncMap)); var document = builder.AddDocument(default(BlobHandle), default(GuidHandle), default(BlobHandle), default(GuidHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.Document)); Assert.Equal(1, MetadataTokens.GetRowNumber(document)); builder.AddMethodDebugInformation(default(DocumentHandle), default(BlobHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.MethodDebugInformation)); var localScope = builder.AddLocalScope(default(MethodDefinitionHandle), default(ImportScopeHandle), default(LocalVariableHandle), default(LocalConstantHandle), default(int), default(int)); Assert.Equal(1, builder.GetRowCount(TableIndex.LocalScope)); Assert.Equal(1, MetadataTokens.GetRowNumber(localScope)); var localVariable = builder.AddLocalVariable(default(LocalVariableAttributes), default(int), default(StringHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.LocalVariable)); Assert.Equal(1, MetadataTokens.GetRowNumber(localVariable)); var localConstant = builder.AddLocalConstant(default(StringHandle), default(BlobHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.LocalConstant)); Assert.Equal(1, MetadataTokens.GetRowNumber(localConstant)); var importScope = builder.AddImportScope(default(ImportScopeHandle), default(BlobHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.ImportScope)); Assert.Equal(1, MetadataTokens.GetRowNumber(importScope)); builder.AddStateMachineMethod(default(MethodDefinitionHandle), default(MethodDefinitionHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.StateMachineMethod)); builder.AddCustomDebugInformation(default(EntityHandle), default(GuidHandle), default(BlobHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.CustomDebugInformation)); Assert.Equal(0, builder.GetRowCount(TableIndex.AssemblyOS)); Assert.Equal(0, builder.GetRowCount(TableIndex.AssemblyProcessor)); Assert.Equal(0, builder.GetRowCount(TableIndex.AssemblyRefOS)); Assert.Equal(0, builder.GetRowCount(TableIndex.AssemblyRefProcessor)); Assert.Equal(0, builder.GetRowCount(TableIndex.EventPtr)); Assert.Equal(0, builder.GetRowCount(TableIndex.FieldPtr)); Assert.Equal(0, builder.GetRowCount(TableIndex.MethodPtr)); Assert.Equal(0, builder.GetRowCount(TableIndex.ParamPtr)); Assert.Equal(0, builder.GetRowCount(TableIndex.PropertyPtr)); var rowCounts = builder.GetRowCounts(); Assert.Equal(MetadataTokens.TableCount, rowCounts.Length); foreach (TableIndex tableIndex in Enum.GetValues(typeof(TableIndex))) { Assert.Equal(builder.GetRowCount(tableIndex), rowCounts[(int)tableIndex]); } } [Fact] public void GetRowCount_Errors() { var builder = new MetadataBuilder(); Assert.Throws<ArgumentOutOfRangeException>(() => builder.GetRowCount((TableIndex)0x2D)); Assert.Throws<ArgumentOutOfRangeException>(() => builder.GetRowCount((TableIndex)0x2E)); Assert.Throws<ArgumentOutOfRangeException>(() => builder.GetRowCount((TableIndex)0x2F)); Assert.Throws<ArgumentOutOfRangeException>(() => builder.GetRowCount((TableIndex)0x38)); Assert.Throws<ArgumentOutOfRangeException>(() => builder.GetRowCount((TableIndex)0x39)); Assert.Throws<ArgumentOutOfRangeException>(() => builder.GetRowCount((TableIndex)255)); } /// <summary> /// Add methods do minimal validation to avoid overhead. /// </summary> [Fact] public void Add_ArgumentErrors() { var builder = new MetadataBuilder(); var badHandleKind = CustomAttributeHandle.FromRowId(1); Assert.Throws<ArgumentNullException>(() => builder.AddAssembly(default(StringHandle), null, default(StringHandle), default(BlobHandle), 0, 0)); Assert.Throws<ArgumentNullException>(() => builder.AddAssemblyReference(default(StringHandle), null, default(StringHandle), default(BlobHandle), 0, default(BlobHandle))); AssertExtensions.Throws<ArgumentException>(null, () => builder.AddTypeDefinition(0, default(StringHandle), default(StringHandle), badHandleKind, default(FieldDefinitionHandle), default(MethodDefinitionHandle))); AssertExtensions.Throws<ArgumentException>(null, () => builder.AddInterfaceImplementation(default(TypeDefinitionHandle), badHandleKind)); AssertExtensions.Throws<ArgumentException>(null, () => builder.AddTypeReference(badHandleKind, default(StringHandle), default(StringHandle))); AssertExtensions.Throws<ArgumentException>(null, () => builder.AddEvent(0, default(StringHandle), badHandleKind)); AssertExtensions.Throws<ArgumentException>(null, () => builder.AddConstant(badHandleKind, 0)); AssertExtensions.Throws<ArgumentException>(null, () => builder.AddMethodSemantics(badHandleKind, 0, default(MethodDefinitionHandle))); AssertExtensions.Throws<ArgumentException>(null, () => builder.AddCustomAttribute(badHandleKind, default(MethodDefinitionHandle), default(BlobHandle))); AssertExtensions.Throws<ArgumentException>(null, () => builder.AddCustomAttribute(default(TypeDefinitionHandle), badHandleKind, default(BlobHandle))); AssertExtensions.Throws<ArgumentException>(null, () => builder.AddMethodSpecification(badHandleKind, default(BlobHandle))); AssertExtensions.Throws<ArgumentException>(null, () => builder.AddGenericParameter(badHandleKind, 0, default(StringHandle), 0)); AssertExtensions.Throws<ArgumentException>(null, () => builder.AddGenericParameterConstraint(default(GenericParameterHandle), badHandleKind)); AssertExtensions.Throws<ArgumentException>(null, () => builder.AddMarshallingDescriptor(badHandleKind, default(BlobHandle))); AssertExtensions.Throws<ArgumentException>(null, () => builder.AddMethodImplementation(default(TypeDefinitionHandle), badHandleKind, default(MethodDefinitionHandle))); AssertExtensions.Throws<ArgumentException>(null, () => builder.AddMethodImplementation(default(TypeDefinitionHandle), default(MethodDefinitionHandle), badHandleKind)); AssertExtensions.Throws<ArgumentException>(null, () => builder.AddMemberReference(badHandleKind, default(StringHandle), default(BlobHandle))); AssertExtensions.Throws<ArgumentException>(null, () => builder.AddManifestResource(0, default(StringHandle), badHandleKind, 0)); AssertExtensions.Throws<ArgumentException>(null, () => builder.AddExportedType(0, default(StringHandle), default(StringHandle), badHandleKind, 0)); AssertExtensions.Throws<ArgumentException>(null, () => builder.AddDeclarativeSecurityAttribute(badHandleKind, 0, default(BlobHandle))); AssertExtensions.Throws<ArgumentException>(null, () => builder.AddCustomDebugInformation(badHandleKind, default(GuidHandle), default(BlobHandle))); Assert.Throws<ArgumentOutOfRangeException>(() => builder.AddModule(-1, default(StringHandle), default(GuidHandle), default(GuidHandle), default(GuidHandle))); Assert.Throws<ArgumentOutOfRangeException>(() => builder.AddModule(ushort.MaxValue + 1, default(StringHandle), default(GuidHandle), default(GuidHandle), default(GuidHandle))); Assert.Throws<ArgumentOutOfRangeException>(() => builder.AddParameter(0, default(StringHandle), -1)); Assert.Throws<ArgumentOutOfRangeException>(() => builder.AddGenericParameter(default(TypeDefinitionHandle), 0, default(StringHandle), -1)); Assert.Throws<ArgumentOutOfRangeException>(() => builder.AddFieldRelativeVirtualAddress(default(FieldDefinitionHandle), -1)); Assert.Throws<ArgumentOutOfRangeException>(() => builder.AddMethodDefinition(0, 0, default(StringHandle), default(BlobHandle), -2, default(ParameterHandle))); Assert.Throws<ArgumentOutOfRangeException>(() => builder.AddLocalVariable(0, -1, default(StringHandle))); } [Fact] public void MultipleModuleAssemblyEntries() { var builder = new MetadataBuilder(); builder.AddAssembly(default(StringHandle), new Version(0, 0, 0, 0), default(StringHandle), default(BlobHandle), 0, 0); builder.AddModule(0, default(StringHandle), default(GuidHandle), default(GuidHandle), default(GuidHandle)); Assert.Throws<InvalidOperationException>(() => builder.AddAssembly(default(StringHandle), new Version(0, 0, 0, 0), default(StringHandle), default(BlobHandle), 0, 0)); Assert.Throws<InvalidOperationException>(() => builder.AddModule(0, default(StringHandle), default(GuidHandle), default(GuidHandle), default(GuidHandle))); } [Fact] public void Add_BadValues() { var builder = new MetadataBuilder(); builder.AddAssembly(default(StringHandle), new Version(0, 0, 0, 0), default(StringHandle), default(BlobHandle), (AssemblyFlags)(-1), (AssemblyHashAlgorithm)(-1)); builder.AddAssemblyReference(default(StringHandle), new Version(0, 0, 0, 0), default(StringHandle), default(BlobHandle), (AssemblyFlags)(-1), default(BlobHandle)); builder.AddTypeDefinition((TypeAttributes)(-1), default(StringHandle), default(StringHandle), default(TypeDefinitionHandle), default(FieldDefinitionHandle), default(MethodDefinitionHandle)); builder.AddProperty((PropertyAttributes)(-1), default(StringHandle), default(BlobHandle)); builder.AddEvent((EventAttributes)(-1), default(StringHandle), default(TypeDefinitionHandle)); builder.AddMethodSemantics(default(EventDefinitionHandle), (MethodSemanticsAttributes)(-1), default(MethodDefinitionHandle)); builder.AddParameter((ParameterAttributes)(-1), default(StringHandle), 0); builder.AddGenericParameter(default(TypeDefinitionHandle), (GenericParameterAttributes)(-1), default(StringHandle), 0); builder.AddFieldDefinition((FieldAttributes)(-1), default(StringHandle), default(BlobHandle)); builder.AddMethodDefinition((MethodAttributes)(-1), (MethodImplAttributes)(-1), default(StringHandle), default(BlobHandle), -1, default(ParameterHandle)); builder.AddMethodImport(default(MethodDefinitionHandle), (MethodImportAttributes)(-1), default(StringHandle), default(ModuleReferenceHandle)); builder.AddManifestResource((ManifestResourceAttributes)(-1), default(StringHandle), default(AssemblyFileHandle), 0); builder.AddExportedType((TypeAttributes)(-1), default(StringHandle), default(StringHandle), default(AssemblyFileHandle), 0); builder.AddDeclarativeSecurityAttribute(default(TypeDefinitionHandle), (DeclarativeSecurityAction)(-1), default(BlobHandle)); builder.AddEncLogEntry(default(TypeDefinitionHandle), (EditAndContinueOperation)(-1)); builder.AddLocalVariable((LocalVariableAttributes)(-1), 0, default(StringHandle)); } [Fact] public void GetOrAddErrors() { var mdBuilder = new MetadataBuilder(); AssertExtensions.Throws<ArgumentNullException>("value", () => mdBuilder.GetOrAddBlob((BlobBuilder)null)); AssertExtensions.Throws<ArgumentNullException>("value", () => mdBuilder.GetOrAddBlob((byte[])null)); AssertExtensions.Throws<ArgumentNullException>("value", () => mdBuilder.GetOrAddBlob(default(ImmutableArray<byte>))); AssertExtensions.Throws<ArgumentNullException>("value", () => mdBuilder.GetOrAddBlobUTF8(null)); AssertExtensions.Throws<ArgumentNullException>("value", () => mdBuilder.GetOrAddBlobUTF16(null)); AssertExtensions.Throws<ArgumentNullException>("value", () => mdBuilder.GetOrAddDocumentName(null)); AssertExtensions.Throws<ArgumentNullException>("value", () => mdBuilder.GetOrAddString(null)); } [Fact] public void Heaps_Empty() { var mdBuilder = new MetadataBuilder(); var serialized = mdBuilder.GetSerializedMetadata(MetadataRootBuilder.EmptyRowCounts, 12, isStandaloneDebugMetadata: false); var builder = new BlobBuilder(); mdBuilder.WriteHeapsTo(builder, serialized.StringHeap); AssertEx.Equal(new byte[] { 0x00, 0x00, 0x00, 0x00, // #String 0x00, 0x00, 0x00, 0x00, // #US // #Guid 0x00, 0x00, 0x00, 0x00 // #Blob }, builder.ToArray()); } [Fact] public void Heaps() { var mdBuilder = new MetadataBuilder(); var g0 = mdBuilder.GetOrAddGuid(default(Guid)); Assert.True(g0.IsNil); Assert.Equal(0, g0.Index); var g1 = mdBuilder.GetOrAddGuid(new Guid("D39F3559-476A-4D1E-B6D2-88E66395230B")); Assert.Equal(1, g1.Index); var s0 = mdBuilder.GetOrAddString(""); Assert.False(s0.IsVirtual); Assert.Equal(0, s0.GetWriterVirtualIndex()); var s1 = mdBuilder.GetOrAddString("foo"); Assert.True(s1.IsVirtual); Assert.Equal(1, s1.GetWriterVirtualIndex()); var us0 = mdBuilder.GetOrAddUserString(""); Assert.Equal(1, us0.GetHeapOffset()); var us1 = mdBuilder.GetOrAddUserString("bar"); Assert.Equal(3, us1.GetHeapOffset()); var b0 = mdBuilder.GetOrAddBlob(new byte[0]); Assert.Equal(0, b0.GetHeapOffset()); var b1 = mdBuilder.GetOrAddBlob(new byte[] { 1, 2 }); Assert.Equal(1, b1.GetHeapOffset()); var serialized = mdBuilder.GetSerializedMetadata(MetadataRootBuilder.EmptyRowCounts, 12, isStandaloneDebugMetadata: false); Assert.Equal(0, mdBuilder.SerializeHandle(g0)); Assert.Equal(1, mdBuilder.SerializeHandle(g1)); Assert.Equal(0, mdBuilder.SerializeHandle(serialized.StringMap, s0)); Assert.Equal(1, mdBuilder.SerializeHandle(serialized.StringMap, s1)); Assert.Equal(1, mdBuilder.SerializeHandle(us0)); Assert.Equal(3, mdBuilder.SerializeHandle(us1)); Assert.Equal(0, mdBuilder.SerializeHandle(b0)); Assert.Equal(1, mdBuilder.SerializeHandle(b1)); var heaps = new BlobBuilder(); mdBuilder.WriteHeapsTo(heaps, serialized.StringHeap); AssertEx.Equal(new byte[] { // #String 0x00, 0x66, 0x6F, 0x6F, 0x00, 0x00, 0x00, 0x00, // #US 0x00, 0x01, 0x00, 0x07, 0x62, 0x00, 0x61, 0x00, 0x72, 0x00, 0x00, 0x00, // #Guid 0x59, 0x35, 0x9F, 0xD3, 0x6A, 0x47, 0x1E, 0x4D, 0xB6, 0xD2, 0x88, 0xE6, 0x63, 0x95, 0x23, 0x0B, // #Blob 0x00, 0x02, 0x01, 0x02 }, heaps.ToArray()); } [Fact] public void GetOrAddDocumentName1() { var mdBuilder = new MetadataBuilder(); mdBuilder.GetOrAddDocumentName(""); mdBuilder.GetOrAddDocumentName("/a/b/c"); mdBuilder.GetOrAddDocumentName(@"\a\b\cc"); mdBuilder.GetOrAddDocumentName(@"/a/b\c"); mdBuilder.GetOrAddDocumentName(@"/\a/\b\\//c"); mdBuilder.GetOrAddDocumentName(@"a/"); mdBuilder.GetOrAddDocumentName(@"/"); mdBuilder.GetOrAddDocumentName(@"\\"); mdBuilder.GetOrAddDocumentName("\ud800"); // unpaired surrogate mdBuilder.GetOrAddDocumentName("\0"); var serialized = mdBuilder.GetSerializedMetadata(MetadataRootBuilder.EmptyRowCounts, 12, isStandaloneDebugMetadata: false); var heaps = new BlobBuilder(); mdBuilder.WriteHeapsTo(heaps, serialized.StringHeap); AssertEx.Equal(new byte[] { // #String 0x00, 0x00, 0x00, 0x00, // #US 0x00, 0x00, 0x00, 0x00, 0x00, // 0x00 // "" 0x02, (byte)'/', 0x00, 0x01, (byte)'a', // 0x04 0x01, (byte)'b', // 0x06 0x01, (byte)'c', // 0x08 // "/a/b/c" 0x05, (byte)'/', 0x00, 0x04, 0x06, 0x08, // 0x10 0x02, (byte)'c', (byte)'c', // @"\a\b\cc" 0x05, (byte)'\\', 0x00, 0x04, 0x06, 0x10, // 0x19 0x03, (byte)'b', (byte)'\\', (byte)'c', // @"/a/b\c" 0x04, (byte)'/', 0x00, 0x04, 0x19, // 0x22 0x02, (byte)'\\', (byte)'a', // 0x25 0x04, (byte)'\\', (byte)'b', (byte)'\\', (byte)'\\', // @"/\a/\b\\//c" 0x06, (byte)'/', 0x00, 0x22, 0x25, 0x00, 0x08, // @"a/" 0x03, (byte)'/', 0x04, 0x00, // @"/" 0x03, (byte)'/', 0x00, 0x00, // @"\\" 0x04, (byte)'\\', 0x00, 0x00, 0x00, // 0x3E 0x03, 0xED, 0xA0, 0x80, // "\ud800" 0x02, (byte)'/', 0x3E, // 0x45 0x01, 0x00, // "\0" 0x02, (byte)'/', 0x45, // heap padding 0x00, 0x00 }, heaps.ToArray()); } [Fact] public void GetOrAddDocumentName2() { var mdBuilder = new MetadataBuilder(); mdBuilder.AddModule(0, default(StringHandle), default(GuidHandle), default(GuidHandle), default(GuidHandle)); var n1 = mdBuilder.GetOrAddDocumentName(""); var n2 = mdBuilder.GetOrAddDocumentName("/a/b/c"); var n3 = mdBuilder.GetOrAddDocumentName(@"\a\b\cc"); var n4 = mdBuilder.GetOrAddDocumentName(@"/a/b\c"); var n5 = mdBuilder.GetOrAddDocumentName(@"/\a/\b\\//c"); var n6 = mdBuilder.GetOrAddDocumentName(@"a/"); var n7 = mdBuilder.GetOrAddDocumentName(@"/"); var n8 = mdBuilder.GetOrAddDocumentName(@"\\"); var n9 = mdBuilder.GetOrAddDocumentName("\ud800"); // unpaired surrogate var n10 = mdBuilder.GetOrAddDocumentName("\0"); var root = new MetadataRootBuilder(mdBuilder); var rootBuilder = new BlobBuilder(); root.Serialize(rootBuilder, 0, 0); var mdImage = rootBuilder.ToImmutableArray(); using (var provider = MetadataReaderProvider.FromMetadataImage(mdImage)) { var mdReader = provider.GetMetadataReader(); Assert.Equal("", mdReader.GetString(MetadataTokens.DocumentNameBlobHandle(MetadataTokens.GetHeapOffset(n1)))); Assert.Equal("/a/b/c", mdReader.GetString(MetadataTokens.DocumentNameBlobHandle(MetadataTokens.GetHeapOffset(n2)))); Assert.Equal(@"\a\b\cc", mdReader.GetString(MetadataTokens.DocumentNameBlobHandle(MetadataTokens.GetHeapOffset(n3)))); Assert.Equal(@"/a/b\c", mdReader.GetString(MetadataTokens.DocumentNameBlobHandle(MetadataTokens.GetHeapOffset(n4)))); Assert.Equal(@"/\a/\b\\//c", mdReader.GetString(MetadataTokens.DocumentNameBlobHandle(MetadataTokens.GetHeapOffset(n5)))); Assert.Equal(@"a/", mdReader.GetString(MetadataTokens.DocumentNameBlobHandle(MetadataTokens.GetHeapOffset(n6)))); Assert.Equal(@"/", mdReader.GetString(MetadataTokens.DocumentNameBlobHandle(MetadataTokens.GetHeapOffset(n7)))); Assert.Equal(@"\\", mdReader.GetString(MetadataTokens.DocumentNameBlobHandle(MetadataTokens.GetHeapOffset(n8)))); if (PlatformDetection.IsNetCore) { Assert.Equal("\uFFFD\uFFFD\uFFFD", mdReader.GetString(MetadataTokens.DocumentNameBlobHandle(MetadataTokens.GetHeapOffset(n9)))); } else { // Versions of .NET prior to Core 3.0 didn't follow Unicode recommendations for U+FFFD substitution, // so they sometimes emitted too few replacement chars. Assert.Equal("\uFFFD\uFFFD", mdReader.GetString(MetadataTokens.DocumentNameBlobHandle(MetadataTokens.GetHeapOffset(n9)))); } Assert.Equal("\0", mdReader.GetString(MetadataTokens.DocumentNameBlobHandle(MetadataTokens.GetHeapOffset(n10)))); } } [Fact] public void Heaps_StartOffsets() { var mdBuilder = new MetadataBuilder( userStringHeapStartOffset: 0x10, stringHeapStartOffset: 0x20, blobHeapStartOffset: 0x30, guidHeapStartOffset: 0x40); var g = mdBuilder.GetOrAddGuid(new Guid("D39F3559-476A-4D1E-B6D2-88E66395230B")); Assert.Equal(5, g.Index); var s0 = mdBuilder.GetOrAddString(""); Assert.False(s0.IsVirtual); Assert.Equal(0, s0.GetWriterVirtualIndex()); var s1 = mdBuilder.GetOrAddString("foo"); Assert.True(s1.IsVirtual); Assert.Equal(1, s1.GetWriterVirtualIndex()); var us0 = mdBuilder.GetOrAddUserString(""); Assert.Equal(0x11, us0.GetHeapOffset()); var us1 = mdBuilder.GetOrAddUserString("bar"); Assert.Equal(0x13, us1.GetHeapOffset()); var b0 = mdBuilder.GetOrAddBlob(new byte[0]); Assert.Equal(0, b0.GetHeapOffset()); var b1 = mdBuilder.GetOrAddBlob(new byte[] { 1, 2 }); Assert.Equal(0x31, b1.GetHeapOffset()); var serialized = mdBuilder.GetSerializedMetadata(MetadataRootBuilder.EmptyRowCounts, 12, isStandaloneDebugMetadata: false); Assert.Equal(5, mdBuilder.SerializeHandle(g)); Assert.Equal(0, mdBuilder.SerializeHandle(serialized.StringMap, s0)); Assert.Equal(0x21, mdBuilder.SerializeHandle(serialized.StringMap, s1)); Assert.Equal(0x11, mdBuilder.SerializeHandle(us0)); Assert.Equal(0x13, mdBuilder.SerializeHandle(us1)); Assert.Equal(0, mdBuilder.SerializeHandle(b0)); Assert.Equal(0x31, mdBuilder.SerializeHandle(b1)); var heaps = new BlobBuilder(); mdBuilder.WriteHeapsTo(heaps, serialized.StringHeap); AssertEx.Equal(new byte[] { // #String 0x00, 0x66, 0x6F, 0x6F, 0x00, 0x00, 0x00, 0x00, // #US 0x00, 0x01, 0x00, 0x07, 0x62, 0x00, 0x61, 0x00, 0x72, 0x00, 0x00, 0x00, // #Guid 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x59, 0x35, 0x9F, 0xD3, 0x6A, 0x47, 0x1E, 0x4D, 0xB6, 0xD2, 0x88, 0xE6, 0x63, 0x95, 0x23, 0x0B, // #Blob 0x00, 0x02, 0x01, 0x02 }, heaps.ToArray()); Assert.Throws<ArgumentNullException>(() => mdBuilder.GetOrAddString(null)); } [Fact] public void Heaps_Reserve() { var mdBuilder = new MetadataBuilder(); var guid = mdBuilder.ReserveGuid(); var us = mdBuilder.ReserveUserString(3); Assert.Equal(MetadataTokens.GuidHandle(1), guid.Handle); Assert.Equal(MetadataTokens.UserStringHandle(1), us.Handle); var serialized = mdBuilder.GetSerializedMetadata(MetadataRootBuilder.EmptyRowCounts, 12, isStandaloneDebugMetadata: false); var builder = new BlobBuilder(); mdBuilder.WriteHeapsTo(builder, serialized.StringHeap); AssertEx.Equal(new byte[] { // #String 0x00, 0x00, 0x00, 0x00, // #US 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // #Guid 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // #Blob 0x00, 0x00, 0x00, 0x00 }, builder.ToArray()); guid.CreateWriter().WriteGuid(new Guid("D39F3559-476A-4D1E-B6D2-88E66395230B")); us.CreateWriter().WriteUserString("bar"); AssertEx.Equal(new byte[] { // #String 0x00, 0x00, 0x00, 0x00, // #US 0x00, 0x07, 0x62, 0x00, 0x61, 0x00, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, // #Guid 0x59, 0x35, 0x9F, 0xD3, 0x6A, 0x47, 0x1E, 0x4D, 0xB6, 0xD2, 0x88, 0xE6, 0x63, 0x95, 0x23, 0x0B, // #Blob 0x00, 0x00, 0x00, 0x00 }, builder.ToArray()); } [Fact, ActiveIssue("https://github.com/dotnet/roslyn/issues/9852")] public void HeapOverflow_UserString() { string veryLargeString = new string('x', 0x00fffff0 / 2); var builder1 = new MetadataBuilder(); Assert.Equal(0x70000001, MetadataTokens.GetToken(builder1.GetOrAddUserString(veryLargeString))); // TODO: https://github.com/dotnet/roslyn/issues/9852 // Should throw: Assert.Throws<ImageFormatLimitationException>(() => builder1.GetOrAddUserString("123")); // Assert.Equal(0x70fffff6, MetadataTokens.GetToken(builder1.GetOrAddUserString("12"))); // Assert.Equal(0x70fffff6, MetadataTokens.GetToken(builder1.GetOrAddUserString("12"))); Assert.Equal(0x70fffff6, MetadataTokens.GetToken(builder1.GetOrAddUserString(veryLargeString + "z"))); Assert.Throws<ImageFormatLimitationException>(() => builder1.GetOrAddUserString("12")); var builder2 = new MetadataBuilder(); Assert.Equal(0x70000001, MetadataTokens.GetToken(builder2.GetOrAddUserString("123"))); Assert.Equal(0x70000009, MetadataTokens.GetToken(builder2.GetOrAddUserString(veryLargeString))); Assert.Equal(0x70fffffe, MetadataTokens.GetToken(builder2.GetOrAddUserString("4"))); // TODO: should throw https://github.com/dotnet/roslyn/issues/9852 var builder3 = new MetadataBuilder(userStringHeapStartOffset: 0x00fffffe); Assert.Equal(0x70ffffff, MetadataTokens.GetToken(builder3.GetOrAddUserString("1"))); // TODO: should throw https://github.com/dotnet/roslyn/issues/9852 var builder4 = new MetadataBuilder(userStringHeapStartOffset: 0x00fffff7); Assert.Equal(0x70fffff8, MetadataTokens.GetToken(builder4.GetOrAddUserString("1"))); // 4B Assert.Equal(0x70fffffc, MetadataTokens.GetToken(builder4.GetOrAddUserString("2"))); // 4B Assert.Throws<ImageFormatLimitationException>(() => builder4.GetOrAddUserString("3")); // hits the limit exactly var builder5 = new MetadataBuilder(userStringHeapStartOffset: 0x00fffff8); Assert.Equal(0x70fffff9, MetadataTokens.GetToken(builder5.GetOrAddUserString("1"))); // 4B Assert.Equal(0x70fffffd, MetadataTokens.GetToken(builder5.GetOrAddUserString("2"))); // 4B // TODO: should throw https://github.com/dotnet/roslyn/issues/9852 } // TODO: test overflow of other heaps, tables [Fact] public void SetCapacity() { var builder = new MetadataBuilder(); builder.GetOrAddString("11111"); builder.GetOrAddGuid(Guid.NewGuid()); builder.GetOrAddBlobUTF8("2222"); builder.GetOrAddUserString("3333"); builder.AddMethodDefinition(0, 0, default(StringHandle), default(BlobHandle), 0, default(ParameterHandle)); builder.AddMethodDefinition(0, 0, default(StringHandle), default(BlobHandle), 0, default(ParameterHandle)); builder.AddMethodDefinition(0, 0, default(StringHandle), default(BlobHandle), 0, default(ParameterHandle)); builder.SetCapacity(TableIndex.MethodDef, 0); builder.SetCapacity(TableIndex.MethodDef, 1); builder.SetCapacity(TableIndex.MethodDef, 1000); Assert.Throws<ArgumentOutOfRangeException>(() => builder.SetCapacity(TableIndex.MethodDef, -1)); Assert.Throws<ArgumentOutOfRangeException>(() => builder.SetCapacity((TableIndex)0xff, 10)); builder.SetCapacity(HeapIndex.String, 3); builder.SetCapacity(HeapIndex.String, 1000); builder.SetCapacity(HeapIndex.Blob, 3); builder.SetCapacity(HeapIndex.Blob, 1000); builder.SetCapacity(HeapIndex.Guid, 3); builder.SetCapacity(HeapIndex.Guid, 1000); builder.SetCapacity(HeapIndex.UserString, 3); builder.SetCapacity(HeapIndex.UserString, 1000); builder.SetCapacity(HeapIndex.String, 0); Assert.Throws<ArgumentOutOfRangeException>(() => builder.SetCapacity(HeapIndex.String, -1)); Assert.Throws<ArgumentOutOfRangeException>(() => builder.SetCapacity((HeapIndex)0xff, 10)); } [Fact] public void ValidateClassLayoutTable() { var builder = new MetadataBuilder(); builder.AddTypeLayout(MetadataTokens.TypeDefinitionHandle(2), 1, 1); builder.AddTypeLayout(MetadataTokens.TypeDefinitionHandle(1), 1, 1); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); builder = new MetadataBuilder(); builder.AddTypeLayout(MetadataTokens.TypeDefinitionHandle(1), 1, 1); builder.AddTypeLayout(MetadataTokens.TypeDefinitionHandle(1), 1, 1); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); } [Fact] public void ValidateFieldLayoutTable() { var builder = new MetadataBuilder(); builder.AddFieldLayout(MetadataTokens.FieldDefinitionHandle(2), 1); builder.AddFieldLayout(MetadataTokens.FieldDefinitionHandle(1), 1); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); builder = new MetadataBuilder(); builder.AddFieldLayout(MetadataTokens.FieldDefinitionHandle(1), 1); builder.AddFieldLayout(MetadataTokens.FieldDefinitionHandle(1), 1); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); } [Fact] public void ValidateFieldRvaTable() { var builder = new MetadataBuilder(); builder.AddFieldRelativeVirtualAddress(MetadataTokens.FieldDefinitionHandle(2), 1); builder.AddFieldRelativeVirtualAddress(MetadataTokens.FieldDefinitionHandle(1), 1); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); builder = new MetadataBuilder(); builder.AddFieldRelativeVirtualAddress(MetadataTokens.FieldDefinitionHandle(1), 1); builder.AddFieldRelativeVirtualAddress(MetadataTokens.FieldDefinitionHandle(1), 1); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); } [Fact] public void ValidateGenericParamTable() { var builder = new MetadataBuilder(); builder.AddGenericParameter(MetadataTokens.TypeDefinitionHandle(2), default(GenericParameterAttributes), default(StringHandle), index: 0); builder.AddGenericParameter(MetadataTokens.TypeDefinitionHandle(1), default(GenericParameterAttributes), default(StringHandle), index: 0); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); builder = new MetadataBuilder(); builder.AddGenericParameter(MetadataTokens.MethodDefinitionHandle(2), default(GenericParameterAttributes), default(StringHandle), index: 0); builder.AddGenericParameter(MetadataTokens.MethodDefinitionHandle(1), default(GenericParameterAttributes), default(StringHandle), index: 0); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); builder = new MetadataBuilder(); builder.AddGenericParameter(MetadataTokens.MethodDefinitionHandle(2), default(GenericParameterAttributes), default(StringHandle), index: 0); builder.AddGenericParameter(MetadataTokens.TypeDefinitionHandle(1), default(GenericParameterAttributes), default(StringHandle), index: 0); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); builder = new MetadataBuilder(); builder.AddGenericParameter(MetadataTokens.TypeDefinitionHandle(2), default(GenericParameterAttributes), default(StringHandle), index: 0); builder.AddGenericParameter(MetadataTokens.MethodDefinitionHandle(1), default(GenericParameterAttributes), default(StringHandle), index: 0); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); builder = new MetadataBuilder(); builder.AddGenericParameter(MetadataTokens.TypeDefinitionHandle(1), default(GenericParameterAttributes), default(StringHandle), index: 0); builder.AddGenericParameter(MetadataTokens.TypeDefinitionHandle(1), default(GenericParameterAttributes), default(StringHandle), index: 0); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); builder = new MetadataBuilder(); builder.AddGenericParameter(MetadataTokens.TypeDefinitionHandle(1), default(GenericParameterAttributes), default(StringHandle), index: 1); builder.AddGenericParameter(MetadataTokens.TypeDefinitionHandle(1), default(GenericParameterAttributes), default(StringHandle), index: 0); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); builder = new MetadataBuilder(); builder.AddGenericParameter(MetadataTokens.MethodDefinitionHandle(1), default(GenericParameterAttributes), default(StringHandle), index: 0); builder.AddGenericParameter(MetadataTokens.TypeDefinitionHandle(1), default(GenericParameterAttributes), default(StringHandle), index: 0); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); } [Fact] public void ValidateGenericParamConstaintTable() { var builder = new MetadataBuilder(); builder.AddGenericParameterConstraint(MetadataTokens.GenericParameterHandle(2), default(TypeDefinitionHandle)); builder.AddGenericParameterConstraint(MetadataTokens.GenericParameterHandle(1), default(TypeDefinitionHandle)); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); builder = new MetadataBuilder(); builder.AddGenericParameterConstraint(MetadataTokens.GenericParameterHandle(1), default(TypeDefinitionHandle)); builder.AddGenericParameterConstraint(MetadataTokens.GenericParameterHandle(1), default(TypeDefinitionHandle)); builder.ValidateOrder(); // ok } [Fact] public void ValidateImplMapTable() { var builder = new MetadataBuilder(); builder.AddMethodImport(MetadataTokens.MethodDefinitionHandle(2), default(MethodImportAttributes), default(StringHandle), default(ModuleReferenceHandle)); builder.AddMethodImport(MetadataTokens.MethodDefinitionHandle(1), default(MethodImportAttributes), default(StringHandle), default(ModuleReferenceHandle)); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); builder = new MetadataBuilder(); builder.AddMethodImport(MetadataTokens.MethodDefinitionHandle(1), default(MethodImportAttributes), default(StringHandle), default(ModuleReferenceHandle)); builder.AddMethodImport(MetadataTokens.MethodDefinitionHandle(1), default(MethodImportAttributes), default(StringHandle), default(ModuleReferenceHandle)); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); } [Fact] public void ValidateInterfaceImplTable() { var builder = new MetadataBuilder(); builder.AddInterfaceImplementation(MetadataTokens.TypeDefinitionHandle(2), MetadataTokens.TypeDefinitionHandle(1)); builder.AddInterfaceImplementation(MetadataTokens.TypeDefinitionHandle(1), MetadataTokens.TypeDefinitionHandle(1)); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); builder = new MetadataBuilder(); builder.AddInterfaceImplementation(MetadataTokens.TypeDefinitionHandle(1), MetadataTokens.TypeDefinitionHandle(2)); builder.AddInterfaceImplementation(MetadataTokens.TypeDefinitionHandle(1), MetadataTokens.TypeDefinitionHandle(1)); builder.ValidateOrder(); // ok } [Fact] public void ValidateMethodImplTable() { var builder = new MetadataBuilder(); builder.AddMethodImplementation(MetadataTokens.TypeDefinitionHandle(2), default(MethodDefinitionHandle), default(MethodDefinitionHandle)); builder.AddMethodImplementation(MetadataTokens.TypeDefinitionHandle(1), default(MethodDefinitionHandle), default(MethodDefinitionHandle)); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); builder = new MetadataBuilder(); builder.AddMethodImplementation(MetadataTokens.TypeDefinitionHandle(1), default(MethodDefinitionHandle), default(MethodDefinitionHandle)); builder.AddMethodImplementation(MetadataTokens.TypeDefinitionHandle(1), default(MethodDefinitionHandle), default(MethodDefinitionHandle)); builder.ValidateOrder(); // ok } [Fact] public void ValidateNestedClassTable() { var builder = new MetadataBuilder(); builder.AddNestedType(MetadataTokens.TypeDefinitionHandle(2), default(TypeDefinitionHandle)); builder.AddNestedType(MetadataTokens.TypeDefinitionHandle(1), default(TypeDefinitionHandle)); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); builder = new MetadataBuilder(); builder.AddNestedType(MetadataTokens.TypeDefinitionHandle(1), default(TypeDefinitionHandle)); builder.AddNestedType(MetadataTokens.TypeDefinitionHandle(1), default(TypeDefinitionHandle)); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); } [Fact] public void ValidateLocalScopeTable() { var builder = new MetadataBuilder(); builder.AddLocalScope(MetadataTokens.MethodDefinitionHandle(2), default(ImportScopeHandle), default(LocalVariableHandle), default(LocalConstantHandle), startOffset: 0, length: 1); builder.AddLocalScope(MetadataTokens.MethodDefinitionHandle(1), default(ImportScopeHandle), default(LocalVariableHandle), default(LocalConstantHandle), startOffset: 0, length: 1); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); builder = new MetadataBuilder(); builder.AddLocalScope(MetadataTokens.MethodDefinitionHandle(1), default(ImportScopeHandle), default(LocalVariableHandle), default(LocalConstantHandle), startOffset: 1, length: 1); builder.AddLocalScope(MetadataTokens.MethodDefinitionHandle(1), default(ImportScopeHandle), default(LocalVariableHandle), default(LocalConstantHandle), startOffset: 0, length: 1); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); builder = new MetadataBuilder(); builder.AddLocalScope(MetadataTokens.MethodDefinitionHandle(1), default(ImportScopeHandle), default(LocalVariableHandle), default(LocalConstantHandle), startOffset: 0, length: 1); builder.AddLocalScope(MetadataTokens.MethodDefinitionHandle(1), default(ImportScopeHandle), default(LocalVariableHandle), default(LocalConstantHandle), startOffset: 0, length: 2); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); builder = new MetadataBuilder(); builder.AddLocalScope(MetadataTokens.MethodDefinitionHandle(1), default(ImportScopeHandle), default(LocalVariableHandle), default(LocalConstantHandle), startOffset: 0, length: 1); builder.AddLocalScope(MetadataTokens.MethodDefinitionHandle(1), default(ImportScopeHandle), default(LocalVariableHandle), default(LocalConstantHandle), startOffset: 0, length: 1); builder.ValidateOrder(); // ok } [Fact] public void ValidateStateMachineMethodTable() { var builder = new MetadataBuilder(); builder.AddStateMachineMethod(MetadataTokens.MethodDefinitionHandle(2), default(MethodDefinitionHandle)); builder.AddStateMachineMethod(MetadataTokens.MethodDefinitionHandle(1), default(MethodDefinitionHandle)); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); builder = new MetadataBuilder(); builder.AddStateMachineMethod(MetadataTokens.MethodDefinitionHandle(1), default(MethodDefinitionHandle)); builder.AddStateMachineMethod(MetadataTokens.MethodDefinitionHandle(1), default(MethodDefinitionHandle)); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); } } }
// 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.Collections.Immutable; using System.Reflection.Metadata.Tests; using Xunit; namespace System.Reflection.Metadata.Ecma335.Tests { public class MetadataBuilderTests { [Fact] public void Ctor_Errors() { Assert.Throws<ArgumentOutOfRangeException>(() => new MetadataBuilder(-1)); Assert.Throws<ArgumentOutOfRangeException>(() => new MetadataBuilder(0, -1)); Assert.Throws<ArgumentOutOfRangeException>(() => new MetadataBuilder(0, 0, -1)); Assert.Throws<ArgumentOutOfRangeException>(() => new MetadataBuilder(0, 0, 0, -1)); AssertExtensions.Throws<ArgumentException>("guidHeapStartOffset", () => new MetadataBuilder(0, 0, 0, 1)); new MetadataBuilder(userStringHeapStartOffset: 0x00fffffe); Assert.Throws<ImageFormatLimitationException>(() => new MetadataBuilder(userStringHeapStartOffset: 0x00ffffff)); } [Fact] public void Add() { var builder = new MetadataBuilder(); builder.AddModule(default(int), default(StringHandle), default(GuidHandle), default(GuidHandle), default(GuidHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.Module)); builder.AddAssembly(default(StringHandle), new Version(0, 0, 0, 0), default(StringHandle), default(BlobHandle), default(AssemblyFlags), default(AssemblyHashAlgorithm)); Assert.Equal(1, builder.GetRowCount(TableIndex.Assembly)); var assemblyReference = builder.AddAssemblyReference(default(StringHandle), new Version(0, 0, 0, 0), default(StringHandle), default(BlobHandle), default(AssemblyFlags), default(BlobHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.AssemblyRef)); Assert.Equal(1, MetadataTokens.GetRowNumber(assemblyReference)); var typeDefinition = builder.AddTypeDefinition(default(TypeAttributes), default(StringHandle), default(StringHandle), default(EntityHandle), default(FieldDefinitionHandle), default(MethodDefinitionHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.TypeDef)); Assert.Equal(1, MetadataTokens.GetRowNumber(typeDefinition)); builder.AddTypeLayout(default(TypeDefinitionHandle), default(ushort), default(uint)); Assert.Equal(1, builder.GetRowCount(TableIndex.ClassLayout)); builder.AddInterfaceImplementation(MetadataTokens.TypeDefinitionHandle(1), MetadataTokens.TypeDefinitionHandle(1)); Assert.Equal(1, builder.GetRowCount(TableIndex.InterfaceImpl)); builder.AddNestedType(default(TypeDefinitionHandle), default(TypeDefinitionHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.NestedClass)); var typeReference = builder.AddTypeReference(EntityHandle.ModuleDefinition, default(StringHandle), default(StringHandle)); Assert.Equal(1, MetadataTokens.GetRowNumber(typeReference)); Assert.Equal(1, builder.GetRowCount(TableIndex.TypeRef)); builder.AddTypeSpecification(default(BlobHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.TypeSpec)); builder.AddStandaloneSignature(default(BlobHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.StandAloneSig)); builder.AddProperty(default(PropertyAttributes), default(StringHandle), default(BlobHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.Property)); builder.AddPropertyMap(default(TypeDefinitionHandle), default(PropertyDefinitionHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.PropertyMap)); builder.AddEvent(default(EventAttributes), default(StringHandle), MetadataTokens.TypeDefinitionHandle(1)); Assert.Equal(1, builder.GetRowCount(TableIndex.Event)); builder.AddEventMap(default(TypeDefinitionHandle), default(EventDefinitionHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.EventMap)); builder.AddConstant(MetadataTokens.FieldDefinitionHandle(1), default(object)); Assert.Equal(1, builder.GetRowCount(TableIndex.Constant)); builder.AddMethodSemantics(MetadataTokens.EventDefinitionHandle(1), default(ushort), default(MethodDefinitionHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.MethodSemantics)); builder.AddCustomAttribute(MetadataTokens.TypeDefinitionHandle(1), MetadataTokens.MethodDefinitionHandle(1), default(BlobHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.CustomAttribute)); builder.AddMethodSpecification(MetadataTokens.MethodDefinitionHandle(1), default(BlobHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.MethodSpec)); builder.AddModuleReference(default(StringHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.ModuleRef)); builder.AddParameter(default(ParameterAttributes), default(StringHandle), default(int)); Assert.Equal(1, builder.GetRowCount(TableIndex.Param)); var genericParameter = builder.AddGenericParameter(MetadataTokens.MethodDefinitionHandle(1), default(GenericParameterAttributes), default(StringHandle), default(int)); Assert.Equal(1, builder.GetRowCount(TableIndex.GenericParam)); Assert.Equal(1, MetadataTokens.GetRowNumber(genericParameter)); builder.AddGenericParameterConstraint(default(GenericParameterHandle), MetadataTokens.TypeDefinitionHandle(1)); Assert.Equal(1, builder.GetRowCount(TableIndex.GenericParamConstraint)); builder.AddFieldDefinition(default(FieldAttributes), default(StringHandle), default(BlobHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.Field)); builder.AddFieldLayout(default(FieldDefinitionHandle), default(int)); Assert.Equal(1, builder.GetRowCount(TableIndex.FieldLayout)); builder.AddMarshallingDescriptor(MetadataTokens.FieldDefinitionHandle(1), default(BlobHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.FieldMarshal)); builder.AddFieldRelativeVirtualAddress(default(FieldDefinitionHandle), default(int)); Assert.Equal(1, builder.GetRowCount(TableIndex.FieldRva)); var methodDefinition = builder.AddMethodDefinition(default(MethodAttributes), default(MethodImplAttributes), default(StringHandle), default(BlobHandle), default(int), default(ParameterHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.MethodDef)); Assert.Equal(1, MetadataTokens.GetRowNumber(methodDefinition)); builder.AddMethodImport(MetadataTokens.MethodDefinitionHandle(1), default(MethodImportAttributes), default(StringHandle), default(ModuleReferenceHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.ImplMap)); builder.AddMethodImplementation(default(TypeDefinitionHandle), MetadataTokens.MethodDefinitionHandle(1), MetadataTokens.MethodDefinitionHandle(1)); Assert.Equal(1, builder.GetRowCount(TableIndex.MethodImpl)); var memberReference = builder.AddMemberReference(MetadataTokens.TypeDefinitionHandle(1), default(StringHandle), default(BlobHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.MemberRef)); Assert.Equal(1, MetadataTokens.GetRowNumber(memberReference)); builder.AddManifestResource(default(ManifestResourceAttributes), default(StringHandle), MetadataTokens.AssemblyFileHandle(1), default(uint)); Assert.Equal(1, builder.GetRowCount(TableIndex.ManifestResource)); builder.AddAssemblyFile(default(StringHandle), default(BlobHandle), default(bool)); Assert.Equal(1, builder.GetRowCount(TableIndex.File)); builder.AddExportedType(default(TypeAttributes), default(StringHandle), default(StringHandle), MetadataTokens.AssemblyFileHandle(1), default(int)); Assert.Equal(1, builder.GetRowCount(TableIndex.ExportedType)); builder.AddDeclarativeSecurityAttribute(MetadataTokens.TypeDefinitionHandle(1), default(DeclarativeSecurityAction), default(BlobHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.DeclSecurity)); builder.AddEncLogEntry(MetadataTokens.TypeDefinitionHandle(1), default(EditAndContinueOperation)); Assert.Equal(1, builder.GetRowCount(TableIndex.EncLog)); builder.AddEncMapEntry(MetadataTokens.TypeDefinitionHandle(1)); Assert.Equal(1, builder.GetRowCount(TableIndex.EncMap)); var document = builder.AddDocument(default(BlobHandle), default(GuidHandle), default(BlobHandle), default(GuidHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.Document)); Assert.Equal(1, MetadataTokens.GetRowNumber(document)); builder.AddMethodDebugInformation(default(DocumentHandle), default(BlobHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.MethodDebugInformation)); var localScope = builder.AddLocalScope(default(MethodDefinitionHandle), default(ImportScopeHandle), default(LocalVariableHandle), default(LocalConstantHandle), default(int), default(int)); Assert.Equal(1, builder.GetRowCount(TableIndex.LocalScope)); Assert.Equal(1, MetadataTokens.GetRowNumber(localScope)); var localVariable = builder.AddLocalVariable(default(LocalVariableAttributes), default(int), default(StringHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.LocalVariable)); Assert.Equal(1, MetadataTokens.GetRowNumber(localVariable)); var localConstant = builder.AddLocalConstant(default(StringHandle), default(BlobHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.LocalConstant)); Assert.Equal(1, MetadataTokens.GetRowNumber(localConstant)); var importScope = builder.AddImportScope(default(ImportScopeHandle), default(BlobHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.ImportScope)); Assert.Equal(1, MetadataTokens.GetRowNumber(importScope)); builder.AddStateMachineMethod(default(MethodDefinitionHandle), default(MethodDefinitionHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.StateMachineMethod)); builder.AddCustomDebugInformation(default(EntityHandle), default(GuidHandle), default(BlobHandle)); Assert.Equal(1, builder.GetRowCount(TableIndex.CustomDebugInformation)); Assert.Equal(0, builder.GetRowCount(TableIndex.AssemblyOS)); Assert.Equal(0, builder.GetRowCount(TableIndex.AssemblyProcessor)); Assert.Equal(0, builder.GetRowCount(TableIndex.AssemblyRefOS)); Assert.Equal(0, builder.GetRowCount(TableIndex.AssemblyRefProcessor)); Assert.Equal(0, builder.GetRowCount(TableIndex.EventPtr)); Assert.Equal(0, builder.GetRowCount(TableIndex.FieldPtr)); Assert.Equal(0, builder.GetRowCount(TableIndex.MethodPtr)); Assert.Equal(0, builder.GetRowCount(TableIndex.ParamPtr)); Assert.Equal(0, builder.GetRowCount(TableIndex.PropertyPtr)); var rowCounts = builder.GetRowCounts(); Assert.Equal(MetadataTokens.TableCount, rowCounts.Length); foreach (TableIndex tableIndex in Enum.GetValues(typeof(TableIndex))) { Assert.Equal(builder.GetRowCount(tableIndex), rowCounts[(int)tableIndex]); } } [Fact] public void GetRowCount_Errors() { var builder = new MetadataBuilder(); Assert.Throws<ArgumentOutOfRangeException>(() => builder.GetRowCount((TableIndex)0x2D)); Assert.Throws<ArgumentOutOfRangeException>(() => builder.GetRowCount((TableIndex)0x2E)); Assert.Throws<ArgumentOutOfRangeException>(() => builder.GetRowCount((TableIndex)0x2F)); Assert.Throws<ArgumentOutOfRangeException>(() => builder.GetRowCount((TableIndex)0x38)); Assert.Throws<ArgumentOutOfRangeException>(() => builder.GetRowCount((TableIndex)0x39)); Assert.Throws<ArgumentOutOfRangeException>(() => builder.GetRowCount((TableIndex)255)); } /// <summary> /// Add methods do minimal validation to avoid overhead. /// </summary> [Fact] public void Add_ArgumentErrors() { var builder = new MetadataBuilder(); var badHandleKind = CustomAttributeHandle.FromRowId(1); Assert.Throws<ArgumentNullException>(() => builder.AddAssembly(default(StringHandle), null, default(StringHandle), default(BlobHandle), 0, 0)); Assert.Throws<ArgumentNullException>(() => builder.AddAssemblyReference(default(StringHandle), null, default(StringHandle), default(BlobHandle), 0, default(BlobHandle))); AssertExtensions.Throws<ArgumentException>(null, () => builder.AddTypeDefinition(0, default(StringHandle), default(StringHandle), badHandleKind, default(FieldDefinitionHandle), default(MethodDefinitionHandle))); AssertExtensions.Throws<ArgumentException>(null, () => builder.AddInterfaceImplementation(default(TypeDefinitionHandle), badHandleKind)); AssertExtensions.Throws<ArgumentException>(null, () => builder.AddTypeReference(badHandleKind, default(StringHandle), default(StringHandle))); AssertExtensions.Throws<ArgumentException>(null, () => builder.AddEvent(0, default(StringHandle), badHandleKind)); AssertExtensions.Throws<ArgumentException>(null, () => builder.AddConstant(badHandleKind, 0)); AssertExtensions.Throws<ArgumentException>(null, () => builder.AddMethodSemantics(badHandleKind, 0, default(MethodDefinitionHandle))); AssertExtensions.Throws<ArgumentException>(null, () => builder.AddCustomAttribute(badHandleKind, default(MethodDefinitionHandle), default(BlobHandle))); AssertExtensions.Throws<ArgumentException>(null, () => builder.AddCustomAttribute(default(TypeDefinitionHandle), badHandleKind, default(BlobHandle))); AssertExtensions.Throws<ArgumentException>(null, () => builder.AddMethodSpecification(badHandleKind, default(BlobHandle))); AssertExtensions.Throws<ArgumentException>(null, () => builder.AddGenericParameter(badHandleKind, 0, default(StringHandle), 0)); AssertExtensions.Throws<ArgumentException>(null, () => builder.AddGenericParameterConstraint(default(GenericParameterHandle), badHandleKind)); AssertExtensions.Throws<ArgumentException>(null, () => builder.AddMarshallingDescriptor(badHandleKind, default(BlobHandle))); AssertExtensions.Throws<ArgumentException>(null, () => builder.AddMethodImplementation(default(TypeDefinitionHandle), badHandleKind, default(MethodDefinitionHandle))); AssertExtensions.Throws<ArgumentException>(null, () => builder.AddMethodImplementation(default(TypeDefinitionHandle), default(MethodDefinitionHandle), badHandleKind)); AssertExtensions.Throws<ArgumentException>(null, () => builder.AddMemberReference(badHandleKind, default(StringHandle), default(BlobHandle))); AssertExtensions.Throws<ArgumentException>(null, () => builder.AddManifestResource(0, default(StringHandle), badHandleKind, 0)); AssertExtensions.Throws<ArgumentException>(null, () => builder.AddExportedType(0, default(StringHandle), default(StringHandle), badHandleKind, 0)); AssertExtensions.Throws<ArgumentException>(null, () => builder.AddDeclarativeSecurityAttribute(badHandleKind, 0, default(BlobHandle))); AssertExtensions.Throws<ArgumentException>(null, () => builder.AddCustomDebugInformation(badHandleKind, default(GuidHandle), default(BlobHandle))); Assert.Throws<ArgumentOutOfRangeException>(() => builder.AddModule(-1, default(StringHandle), default(GuidHandle), default(GuidHandle), default(GuidHandle))); Assert.Throws<ArgumentOutOfRangeException>(() => builder.AddModule(ushort.MaxValue + 1, default(StringHandle), default(GuidHandle), default(GuidHandle), default(GuidHandle))); Assert.Throws<ArgumentOutOfRangeException>(() => builder.AddParameter(0, default(StringHandle), -1)); Assert.Throws<ArgumentOutOfRangeException>(() => builder.AddGenericParameter(default(TypeDefinitionHandle), 0, default(StringHandle), -1)); Assert.Throws<ArgumentOutOfRangeException>(() => builder.AddFieldRelativeVirtualAddress(default(FieldDefinitionHandle), -1)); Assert.Throws<ArgumentOutOfRangeException>(() => builder.AddMethodDefinition(0, 0, default(StringHandle), default(BlobHandle), -2, default(ParameterHandle))); Assert.Throws<ArgumentOutOfRangeException>(() => builder.AddLocalVariable(0, -1, default(StringHandle))); } [Fact] public void MultipleModuleAssemblyEntries() { var builder = new MetadataBuilder(); builder.AddAssembly(default(StringHandle), new Version(0, 0, 0, 0), default(StringHandle), default(BlobHandle), 0, 0); builder.AddModule(0, default(StringHandle), default(GuidHandle), default(GuidHandle), default(GuidHandle)); Assert.Throws<InvalidOperationException>(() => builder.AddAssembly(default(StringHandle), new Version(0, 0, 0, 0), default(StringHandle), default(BlobHandle), 0, 0)); Assert.Throws<InvalidOperationException>(() => builder.AddModule(0, default(StringHandle), default(GuidHandle), default(GuidHandle), default(GuidHandle))); } [Fact] public void Add_BadValues() { var builder = new MetadataBuilder(); builder.AddAssembly(default(StringHandle), new Version(0, 0, 0, 0), default(StringHandle), default(BlobHandle), (AssemblyFlags)(-1), (AssemblyHashAlgorithm)(-1)); builder.AddAssemblyReference(default(StringHandle), new Version(0, 0, 0, 0), default(StringHandle), default(BlobHandle), (AssemblyFlags)(-1), default(BlobHandle)); builder.AddTypeDefinition((TypeAttributes)(-1), default(StringHandle), default(StringHandle), default(TypeDefinitionHandle), default(FieldDefinitionHandle), default(MethodDefinitionHandle)); builder.AddProperty((PropertyAttributes)(-1), default(StringHandle), default(BlobHandle)); builder.AddEvent((EventAttributes)(-1), default(StringHandle), default(TypeDefinitionHandle)); builder.AddMethodSemantics(default(EventDefinitionHandle), (MethodSemanticsAttributes)(-1), default(MethodDefinitionHandle)); builder.AddParameter((ParameterAttributes)(-1), default(StringHandle), 0); builder.AddGenericParameter(default(TypeDefinitionHandle), (GenericParameterAttributes)(-1), default(StringHandle), 0); builder.AddFieldDefinition((FieldAttributes)(-1), default(StringHandle), default(BlobHandle)); builder.AddMethodDefinition((MethodAttributes)(-1), (MethodImplAttributes)(-1), default(StringHandle), default(BlobHandle), -1, default(ParameterHandle)); builder.AddMethodImport(default(MethodDefinitionHandle), (MethodImportAttributes)(-1), default(StringHandle), default(ModuleReferenceHandle)); builder.AddManifestResource((ManifestResourceAttributes)(-1), default(StringHandle), default(AssemblyFileHandle), 0); builder.AddExportedType((TypeAttributes)(-1), default(StringHandle), default(StringHandle), default(AssemblyFileHandle), 0); builder.AddDeclarativeSecurityAttribute(default(TypeDefinitionHandle), (DeclarativeSecurityAction)(-1), default(BlobHandle)); builder.AddEncLogEntry(default(TypeDefinitionHandle), (EditAndContinueOperation)(-1)); builder.AddLocalVariable((LocalVariableAttributes)(-1), 0, default(StringHandle)); } [Fact] public void GetOrAddErrors() { var mdBuilder = new MetadataBuilder(); AssertExtensions.Throws<ArgumentNullException>("value", () => mdBuilder.GetOrAddBlob((BlobBuilder)null)); AssertExtensions.Throws<ArgumentNullException>("value", () => mdBuilder.GetOrAddBlob((byte[])null)); AssertExtensions.Throws<ArgumentNullException>("value", () => mdBuilder.GetOrAddBlob(default(ImmutableArray<byte>))); AssertExtensions.Throws<ArgumentNullException>("value", () => mdBuilder.GetOrAddBlobUTF8(null)); AssertExtensions.Throws<ArgumentNullException>("value", () => mdBuilder.GetOrAddBlobUTF16(null)); AssertExtensions.Throws<ArgumentNullException>("value", () => mdBuilder.GetOrAddDocumentName(null)); AssertExtensions.Throws<ArgumentNullException>("value", () => mdBuilder.GetOrAddString(null)); } [Fact] public void Heaps_Empty() { var mdBuilder = new MetadataBuilder(); var serialized = mdBuilder.GetSerializedMetadata(MetadataRootBuilder.EmptyRowCounts, 12, isStandaloneDebugMetadata: false); var builder = new BlobBuilder(); mdBuilder.WriteHeapsTo(builder, serialized.StringHeap); AssertEx.Equal(new byte[] { 0x00, 0x00, 0x00, 0x00, // #String 0x00, 0x00, 0x00, 0x00, // #US // #Guid 0x00, 0x00, 0x00, 0x00 // #Blob }, builder.ToArray()); } [Fact] public void Heaps() { var mdBuilder = new MetadataBuilder(); var g0 = mdBuilder.GetOrAddGuid(default(Guid)); Assert.True(g0.IsNil); Assert.Equal(0, g0.Index); var g1 = mdBuilder.GetOrAddGuid(new Guid("D39F3559-476A-4D1E-B6D2-88E66395230B")); Assert.Equal(1, g1.Index); var s0 = mdBuilder.GetOrAddString(""); Assert.False(s0.IsVirtual); Assert.Equal(0, s0.GetWriterVirtualIndex()); var s1 = mdBuilder.GetOrAddString("foo"); Assert.True(s1.IsVirtual); Assert.Equal(1, s1.GetWriterVirtualIndex()); var us0 = mdBuilder.GetOrAddUserString(""); Assert.Equal(1, us0.GetHeapOffset()); var us1 = mdBuilder.GetOrAddUserString("bar"); Assert.Equal(3, us1.GetHeapOffset()); var b0 = mdBuilder.GetOrAddBlob(new byte[0]); Assert.Equal(0, b0.GetHeapOffset()); var b1 = mdBuilder.GetOrAddBlob(new byte[] { 1, 2 }); Assert.Equal(1, b1.GetHeapOffset()); var serialized = mdBuilder.GetSerializedMetadata(MetadataRootBuilder.EmptyRowCounts, 12, isStandaloneDebugMetadata: false); Assert.Equal(0, mdBuilder.SerializeHandle(g0)); Assert.Equal(1, mdBuilder.SerializeHandle(g1)); Assert.Equal(0, mdBuilder.SerializeHandle(serialized.StringMap, s0)); Assert.Equal(1, mdBuilder.SerializeHandle(serialized.StringMap, s1)); Assert.Equal(1, mdBuilder.SerializeHandle(us0)); Assert.Equal(3, mdBuilder.SerializeHandle(us1)); Assert.Equal(0, mdBuilder.SerializeHandle(b0)); Assert.Equal(1, mdBuilder.SerializeHandle(b1)); var heaps = new BlobBuilder(); mdBuilder.WriteHeapsTo(heaps, serialized.StringHeap); AssertEx.Equal(new byte[] { // #String 0x00, 0x66, 0x6F, 0x6F, 0x00, 0x00, 0x00, 0x00, // #US 0x00, 0x01, 0x00, 0x07, 0x62, 0x00, 0x61, 0x00, 0x72, 0x00, 0x00, 0x00, // #Guid 0x59, 0x35, 0x9F, 0xD3, 0x6A, 0x47, 0x1E, 0x4D, 0xB6, 0xD2, 0x88, 0xE6, 0x63, 0x95, 0x23, 0x0B, // #Blob 0x00, 0x02, 0x01, 0x02 }, heaps.ToArray()); } [Fact] public void GetOrAddDocumentName1() { var mdBuilder = new MetadataBuilder(); mdBuilder.GetOrAddDocumentName(""); mdBuilder.GetOrAddDocumentName("/a/b/c"); mdBuilder.GetOrAddDocumentName(@"\a\b\cc"); mdBuilder.GetOrAddDocumentName(@"/a/b\c"); mdBuilder.GetOrAddDocumentName(@"/\a/\b\\//c"); mdBuilder.GetOrAddDocumentName(@"a/"); mdBuilder.GetOrAddDocumentName(@"/"); mdBuilder.GetOrAddDocumentName(@"\\"); mdBuilder.GetOrAddDocumentName("\ud800"); // unpaired surrogate mdBuilder.GetOrAddDocumentName("\0"); var serialized = mdBuilder.GetSerializedMetadata(MetadataRootBuilder.EmptyRowCounts, 12, isStandaloneDebugMetadata: false); var heaps = new BlobBuilder(); mdBuilder.WriteHeapsTo(heaps, serialized.StringHeap); AssertEx.Equal(new byte[] { // #String 0x00, 0x00, 0x00, 0x00, // #US 0x00, 0x00, 0x00, 0x00, 0x00, // 0x00 // "" 0x02, (byte)'/', 0x00, 0x01, (byte)'a', // 0x04 0x01, (byte)'b', // 0x06 0x01, (byte)'c', // 0x08 // "/a/b/c" 0x05, (byte)'/', 0x00, 0x04, 0x06, 0x08, // 0x10 0x02, (byte)'c', (byte)'c', // @"\a\b\cc" 0x05, (byte)'\\', 0x00, 0x04, 0x06, 0x10, // 0x19 0x03, (byte)'b', (byte)'\\', (byte)'c', // @"/a/b\c" 0x04, (byte)'/', 0x00, 0x04, 0x19, // 0x22 0x02, (byte)'\\', (byte)'a', // 0x25 0x04, (byte)'\\', (byte)'b', (byte)'\\', (byte)'\\', // @"/\a/\b\\//c" 0x06, (byte)'/', 0x00, 0x22, 0x25, 0x00, 0x08, // @"a/" 0x03, (byte)'/', 0x04, 0x00, // @"/" 0x03, (byte)'/', 0x00, 0x00, // @"\\" 0x04, (byte)'\\', 0x00, 0x00, 0x00, // 0x3E 0x03, 0xED, 0xA0, 0x80, // "\ud800" 0x02, (byte)'/', 0x3E, // 0x45 0x01, 0x00, // "\0" 0x02, (byte)'/', 0x45, // heap padding 0x00, 0x00 }, heaps.ToArray()); } [Fact] public void GetOrAddDocumentName2() { var mdBuilder = new MetadataBuilder(); mdBuilder.AddModule(0, default(StringHandle), default(GuidHandle), default(GuidHandle), default(GuidHandle)); var n1 = mdBuilder.GetOrAddDocumentName(""); var n2 = mdBuilder.GetOrAddDocumentName("/a/b/c"); var n3 = mdBuilder.GetOrAddDocumentName(@"\a\b\cc"); var n4 = mdBuilder.GetOrAddDocumentName(@"/a/b\c"); var n5 = mdBuilder.GetOrAddDocumentName(@"/\a/\b\\//c"); var n6 = mdBuilder.GetOrAddDocumentName(@"a/"); var n7 = mdBuilder.GetOrAddDocumentName(@"/"); var n8 = mdBuilder.GetOrAddDocumentName(@"\\"); var n9 = mdBuilder.GetOrAddDocumentName("\ud800"); // unpaired surrogate var n10 = mdBuilder.GetOrAddDocumentName("\0"); var root = new MetadataRootBuilder(mdBuilder); var rootBuilder = new BlobBuilder(); root.Serialize(rootBuilder, 0, 0); var mdImage = rootBuilder.ToImmutableArray(); using (var provider = MetadataReaderProvider.FromMetadataImage(mdImage)) { var mdReader = provider.GetMetadataReader(); Assert.Equal("", mdReader.GetString(MetadataTokens.DocumentNameBlobHandle(MetadataTokens.GetHeapOffset(n1)))); Assert.Equal("/a/b/c", mdReader.GetString(MetadataTokens.DocumentNameBlobHandle(MetadataTokens.GetHeapOffset(n2)))); Assert.Equal(@"\a\b\cc", mdReader.GetString(MetadataTokens.DocumentNameBlobHandle(MetadataTokens.GetHeapOffset(n3)))); Assert.Equal(@"/a/b\c", mdReader.GetString(MetadataTokens.DocumentNameBlobHandle(MetadataTokens.GetHeapOffset(n4)))); Assert.Equal(@"/\a/\b\\//c", mdReader.GetString(MetadataTokens.DocumentNameBlobHandle(MetadataTokens.GetHeapOffset(n5)))); Assert.Equal(@"a/", mdReader.GetString(MetadataTokens.DocumentNameBlobHandle(MetadataTokens.GetHeapOffset(n6)))); Assert.Equal(@"/", mdReader.GetString(MetadataTokens.DocumentNameBlobHandle(MetadataTokens.GetHeapOffset(n7)))); Assert.Equal(@"\\", mdReader.GetString(MetadataTokens.DocumentNameBlobHandle(MetadataTokens.GetHeapOffset(n8)))); if (PlatformDetection.IsNetCore) { Assert.Equal("\uFFFD\uFFFD\uFFFD", mdReader.GetString(MetadataTokens.DocumentNameBlobHandle(MetadataTokens.GetHeapOffset(n9)))); } else { // Versions of .NET prior to Core 3.0 didn't follow Unicode recommendations for U+FFFD substitution, // so they sometimes emitted too few replacement chars. Assert.Equal("\uFFFD\uFFFD", mdReader.GetString(MetadataTokens.DocumentNameBlobHandle(MetadataTokens.GetHeapOffset(n9)))); } Assert.Equal("\0", mdReader.GetString(MetadataTokens.DocumentNameBlobHandle(MetadataTokens.GetHeapOffset(n10)))); } } [Fact] public void Heaps_StartOffsets() { var mdBuilder = new MetadataBuilder( userStringHeapStartOffset: 0x10, stringHeapStartOffset: 0x20, blobHeapStartOffset: 0x30, guidHeapStartOffset: 0x40); var g = mdBuilder.GetOrAddGuid(new Guid("D39F3559-476A-4D1E-B6D2-88E66395230B")); Assert.Equal(5, g.Index); var s0 = mdBuilder.GetOrAddString(""); Assert.False(s0.IsVirtual); Assert.Equal(0, s0.GetWriterVirtualIndex()); var s1 = mdBuilder.GetOrAddString("foo"); Assert.True(s1.IsVirtual); Assert.Equal(1, s1.GetWriterVirtualIndex()); var us0 = mdBuilder.GetOrAddUserString(""); Assert.Equal(0x11, us0.GetHeapOffset()); var us1 = mdBuilder.GetOrAddUserString("bar"); Assert.Equal(0x13, us1.GetHeapOffset()); var b0 = mdBuilder.GetOrAddBlob(new byte[0]); Assert.Equal(0, b0.GetHeapOffset()); var b1 = mdBuilder.GetOrAddBlob(new byte[] { 1, 2 }); Assert.Equal(0x31, b1.GetHeapOffset()); var serialized = mdBuilder.GetSerializedMetadata(MetadataRootBuilder.EmptyRowCounts, 12, isStandaloneDebugMetadata: false); Assert.Equal(5, mdBuilder.SerializeHandle(g)); Assert.Equal(0, mdBuilder.SerializeHandle(serialized.StringMap, s0)); Assert.Equal(0x21, mdBuilder.SerializeHandle(serialized.StringMap, s1)); Assert.Equal(0x11, mdBuilder.SerializeHandle(us0)); Assert.Equal(0x13, mdBuilder.SerializeHandle(us1)); Assert.Equal(0, mdBuilder.SerializeHandle(b0)); Assert.Equal(0x31, mdBuilder.SerializeHandle(b1)); var heaps = new BlobBuilder(); mdBuilder.WriteHeapsTo(heaps, serialized.StringHeap); AssertEx.Equal(new byte[] { // #String 0x00, 0x66, 0x6F, 0x6F, 0x00, 0x00, 0x00, 0x00, // #US 0x00, 0x01, 0x00, 0x07, 0x62, 0x00, 0x61, 0x00, 0x72, 0x00, 0x00, 0x00, // #Guid 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x59, 0x35, 0x9F, 0xD3, 0x6A, 0x47, 0x1E, 0x4D, 0xB6, 0xD2, 0x88, 0xE6, 0x63, 0x95, 0x23, 0x0B, // #Blob 0x00, 0x02, 0x01, 0x02 }, heaps.ToArray()); Assert.Throws<ArgumentNullException>(() => mdBuilder.GetOrAddString(null)); } [Fact] public void Heaps_Reserve() { var mdBuilder = new MetadataBuilder(); var guid = mdBuilder.ReserveGuid(); var us = mdBuilder.ReserveUserString(3); Assert.Equal(MetadataTokens.GuidHandle(1), guid.Handle); Assert.Equal(MetadataTokens.UserStringHandle(1), us.Handle); var serialized = mdBuilder.GetSerializedMetadata(MetadataRootBuilder.EmptyRowCounts, 12, isStandaloneDebugMetadata: false); var builder = new BlobBuilder(); mdBuilder.WriteHeapsTo(builder, serialized.StringHeap); AssertEx.Equal(new byte[] { // #String 0x00, 0x00, 0x00, 0x00, // #US 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // #Guid 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // #Blob 0x00, 0x00, 0x00, 0x00 }, builder.ToArray()); guid.CreateWriter().WriteGuid(new Guid("D39F3559-476A-4D1E-B6D2-88E66395230B")); us.CreateWriter().WriteUserString("bar"); AssertEx.Equal(new byte[] { // #String 0x00, 0x00, 0x00, 0x00, // #US 0x00, 0x07, 0x62, 0x00, 0x61, 0x00, 0x72, 0x00, 0x00, 0x00, 0x00, 0x00, // #Guid 0x59, 0x35, 0x9F, 0xD3, 0x6A, 0x47, 0x1E, 0x4D, 0xB6, 0xD2, 0x88, 0xE6, 0x63, 0x95, 0x23, 0x0B, // #Blob 0x00, 0x00, 0x00, 0x00 }, builder.ToArray()); } [Fact, ActiveIssue("https://github.com/dotnet/roslyn/issues/9852")] public void HeapOverflow_UserString() { string veryLargeString = new string('x', 0x00fffff0 / 2); var builder1 = new MetadataBuilder(); Assert.Equal(0x70000001, MetadataTokens.GetToken(builder1.GetOrAddUserString(veryLargeString))); // TODO: https://github.com/dotnet/roslyn/issues/9852 // Should throw: Assert.Throws<ImageFormatLimitationException>(() => builder1.GetOrAddUserString("123")); // Assert.Equal(0x70fffff6, MetadataTokens.GetToken(builder1.GetOrAddUserString("12"))); // Assert.Equal(0x70fffff6, MetadataTokens.GetToken(builder1.GetOrAddUserString("12"))); Assert.Equal(0x70fffff6, MetadataTokens.GetToken(builder1.GetOrAddUserString(veryLargeString + "z"))); Assert.Throws<ImageFormatLimitationException>(() => builder1.GetOrAddUserString("12")); var builder2 = new MetadataBuilder(); Assert.Equal(0x70000001, MetadataTokens.GetToken(builder2.GetOrAddUserString("123"))); Assert.Equal(0x70000009, MetadataTokens.GetToken(builder2.GetOrAddUserString(veryLargeString))); Assert.Equal(0x70fffffe, MetadataTokens.GetToken(builder2.GetOrAddUserString("4"))); // TODO: should throw https://github.com/dotnet/roslyn/issues/9852 var builder3 = new MetadataBuilder(userStringHeapStartOffset: 0x00fffffe); Assert.Equal(0x70ffffff, MetadataTokens.GetToken(builder3.GetOrAddUserString("1"))); // TODO: should throw https://github.com/dotnet/roslyn/issues/9852 var builder4 = new MetadataBuilder(userStringHeapStartOffset: 0x00fffff7); Assert.Equal(0x70fffff8, MetadataTokens.GetToken(builder4.GetOrAddUserString("1"))); // 4B Assert.Equal(0x70fffffc, MetadataTokens.GetToken(builder4.GetOrAddUserString("2"))); // 4B Assert.Throws<ImageFormatLimitationException>(() => builder4.GetOrAddUserString("3")); // hits the limit exactly var builder5 = new MetadataBuilder(userStringHeapStartOffset: 0x00fffff8); Assert.Equal(0x70fffff9, MetadataTokens.GetToken(builder5.GetOrAddUserString("1"))); // 4B Assert.Equal(0x70fffffd, MetadataTokens.GetToken(builder5.GetOrAddUserString("2"))); // 4B // TODO: should throw https://github.com/dotnet/roslyn/issues/9852 } // TODO: test overflow of other heaps, tables [Fact] public void SetCapacity() { var builder = new MetadataBuilder(); builder.GetOrAddString("11111"); builder.GetOrAddGuid(Guid.NewGuid()); builder.GetOrAddBlobUTF8("2222"); builder.GetOrAddUserString("3333"); builder.AddMethodDefinition(0, 0, default(StringHandle), default(BlobHandle), 0, default(ParameterHandle)); builder.AddMethodDefinition(0, 0, default(StringHandle), default(BlobHandle), 0, default(ParameterHandle)); builder.AddMethodDefinition(0, 0, default(StringHandle), default(BlobHandle), 0, default(ParameterHandle)); builder.SetCapacity(TableIndex.MethodDef, 0); builder.SetCapacity(TableIndex.MethodDef, 1); builder.SetCapacity(TableIndex.MethodDef, 1000); Assert.Throws<ArgumentOutOfRangeException>(() => builder.SetCapacity(TableIndex.MethodDef, -1)); Assert.Throws<ArgumentOutOfRangeException>(() => builder.SetCapacity((TableIndex)0xff, 10)); builder.SetCapacity(HeapIndex.String, 3); builder.SetCapacity(HeapIndex.String, 1000); builder.SetCapacity(HeapIndex.Blob, 3); builder.SetCapacity(HeapIndex.Blob, 1000); builder.SetCapacity(HeapIndex.Guid, 3); builder.SetCapacity(HeapIndex.Guid, 1000); builder.SetCapacity(HeapIndex.UserString, 3); builder.SetCapacity(HeapIndex.UserString, 1000); builder.SetCapacity(HeapIndex.String, 0); Assert.Throws<ArgumentOutOfRangeException>(() => builder.SetCapacity(HeapIndex.String, -1)); Assert.Throws<ArgumentOutOfRangeException>(() => builder.SetCapacity((HeapIndex)0xff, 10)); } [Fact] public void ValidateClassLayoutTable() { var builder = new MetadataBuilder(); builder.AddTypeLayout(MetadataTokens.TypeDefinitionHandle(2), 1, 1); builder.AddTypeLayout(MetadataTokens.TypeDefinitionHandle(1), 1, 1); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); builder = new MetadataBuilder(); builder.AddTypeLayout(MetadataTokens.TypeDefinitionHandle(1), 1, 1); builder.AddTypeLayout(MetadataTokens.TypeDefinitionHandle(1), 1, 1); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); } [Fact] public void ValidateFieldLayoutTable() { var builder = new MetadataBuilder(); builder.AddFieldLayout(MetadataTokens.FieldDefinitionHandle(2), 1); builder.AddFieldLayout(MetadataTokens.FieldDefinitionHandle(1), 1); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); builder = new MetadataBuilder(); builder.AddFieldLayout(MetadataTokens.FieldDefinitionHandle(1), 1); builder.AddFieldLayout(MetadataTokens.FieldDefinitionHandle(1), 1); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); } [Fact] public void ValidateFieldRvaTable() { var builder = new MetadataBuilder(); builder.AddFieldRelativeVirtualAddress(MetadataTokens.FieldDefinitionHandle(2), 1); builder.AddFieldRelativeVirtualAddress(MetadataTokens.FieldDefinitionHandle(1), 1); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); builder = new MetadataBuilder(); builder.AddFieldRelativeVirtualAddress(MetadataTokens.FieldDefinitionHandle(1), 1); builder.AddFieldRelativeVirtualAddress(MetadataTokens.FieldDefinitionHandle(1), 1); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); } [Fact] public void ValidateGenericParamTable() { var builder = new MetadataBuilder(); builder.AddGenericParameter(MetadataTokens.TypeDefinitionHandle(2), default(GenericParameterAttributes), default(StringHandle), index: 0); builder.AddGenericParameter(MetadataTokens.TypeDefinitionHandle(1), default(GenericParameterAttributes), default(StringHandle), index: 0); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); builder = new MetadataBuilder(); builder.AddGenericParameter(MetadataTokens.MethodDefinitionHandle(2), default(GenericParameterAttributes), default(StringHandle), index: 0); builder.AddGenericParameter(MetadataTokens.MethodDefinitionHandle(1), default(GenericParameterAttributes), default(StringHandle), index: 0); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); builder = new MetadataBuilder(); builder.AddGenericParameter(MetadataTokens.MethodDefinitionHandle(2), default(GenericParameterAttributes), default(StringHandle), index: 0); builder.AddGenericParameter(MetadataTokens.TypeDefinitionHandle(1), default(GenericParameterAttributes), default(StringHandle), index: 0); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); builder = new MetadataBuilder(); builder.AddGenericParameter(MetadataTokens.TypeDefinitionHandle(2), default(GenericParameterAttributes), default(StringHandle), index: 0); builder.AddGenericParameter(MetadataTokens.MethodDefinitionHandle(1), default(GenericParameterAttributes), default(StringHandle), index: 0); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); builder = new MetadataBuilder(); builder.AddGenericParameter(MetadataTokens.TypeDefinitionHandle(1), default(GenericParameterAttributes), default(StringHandle), index: 0); builder.AddGenericParameter(MetadataTokens.TypeDefinitionHandle(1), default(GenericParameterAttributes), default(StringHandle), index: 0); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); builder = new MetadataBuilder(); builder.AddGenericParameter(MetadataTokens.TypeDefinitionHandle(1), default(GenericParameterAttributes), default(StringHandle), index: 1); builder.AddGenericParameter(MetadataTokens.TypeDefinitionHandle(1), default(GenericParameterAttributes), default(StringHandle), index: 0); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); builder = new MetadataBuilder(); builder.AddGenericParameter(MetadataTokens.MethodDefinitionHandle(1), default(GenericParameterAttributes), default(StringHandle), index: 0); builder.AddGenericParameter(MetadataTokens.TypeDefinitionHandle(1), default(GenericParameterAttributes), default(StringHandle), index: 0); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); } [Fact] public void ValidateGenericParamConstaintTable() { var builder = new MetadataBuilder(); builder.AddGenericParameterConstraint(MetadataTokens.GenericParameterHandle(2), default(TypeDefinitionHandle)); builder.AddGenericParameterConstraint(MetadataTokens.GenericParameterHandle(1), default(TypeDefinitionHandle)); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); builder = new MetadataBuilder(); builder.AddGenericParameterConstraint(MetadataTokens.GenericParameterHandle(1), default(TypeDefinitionHandle)); builder.AddGenericParameterConstraint(MetadataTokens.GenericParameterHandle(1), default(TypeDefinitionHandle)); builder.ValidateOrder(); // ok } [Fact] public void ValidateImplMapTable() { var builder = new MetadataBuilder(); builder.AddMethodImport(MetadataTokens.MethodDefinitionHandle(2), default(MethodImportAttributes), default(StringHandle), default(ModuleReferenceHandle)); builder.AddMethodImport(MetadataTokens.MethodDefinitionHandle(1), default(MethodImportAttributes), default(StringHandle), default(ModuleReferenceHandle)); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); builder = new MetadataBuilder(); builder.AddMethodImport(MetadataTokens.MethodDefinitionHandle(1), default(MethodImportAttributes), default(StringHandle), default(ModuleReferenceHandle)); builder.AddMethodImport(MetadataTokens.MethodDefinitionHandle(1), default(MethodImportAttributes), default(StringHandle), default(ModuleReferenceHandle)); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); } [Fact] public void ValidateInterfaceImplTable() { var builder = new MetadataBuilder(); builder.AddInterfaceImplementation(MetadataTokens.TypeDefinitionHandle(2), MetadataTokens.TypeDefinitionHandle(1)); builder.AddInterfaceImplementation(MetadataTokens.TypeDefinitionHandle(1), MetadataTokens.TypeDefinitionHandle(1)); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); builder = new MetadataBuilder(); builder.AddInterfaceImplementation(MetadataTokens.TypeDefinitionHandle(1), MetadataTokens.TypeDefinitionHandle(2)); builder.AddInterfaceImplementation(MetadataTokens.TypeDefinitionHandle(1), MetadataTokens.TypeDefinitionHandle(1)); builder.ValidateOrder(); // ok } [Fact] public void ValidateMethodImplTable() { var builder = new MetadataBuilder(); builder.AddMethodImplementation(MetadataTokens.TypeDefinitionHandle(2), default(MethodDefinitionHandle), default(MethodDefinitionHandle)); builder.AddMethodImplementation(MetadataTokens.TypeDefinitionHandle(1), default(MethodDefinitionHandle), default(MethodDefinitionHandle)); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); builder = new MetadataBuilder(); builder.AddMethodImplementation(MetadataTokens.TypeDefinitionHandle(1), default(MethodDefinitionHandle), default(MethodDefinitionHandle)); builder.AddMethodImplementation(MetadataTokens.TypeDefinitionHandle(1), default(MethodDefinitionHandle), default(MethodDefinitionHandle)); builder.ValidateOrder(); // ok } [Fact] public void ValidateNestedClassTable() { var builder = new MetadataBuilder(); builder.AddNestedType(MetadataTokens.TypeDefinitionHandle(2), default(TypeDefinitionHandle)); builder.AddNestedType(MetadataTokens.TypeDefinitionHandle(1), default(TypeDefinitionHandle)); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); builder = new MetadataBuilder(); builder.AddNestedType(MetadataTokens.TypeDefinitionHandle(1), default(TypeDefinitionHandle)); builder.AddNestedType(MetadataTokens.TypeDefinitionHandle(1), default(TypeDefinitionHandle)); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); } [Fact] public void ValidateLocalScopeTable() { var builder = new MetadataBuilder(); builder.AddLocalScope(MetadataTokens.MethodDefinitionHandle(2), default(ImportScopeHandle), default(LocalVariableHandle), default(LocalConstantHandle), startOffset: 0, length: 1); builder.AddLocalScope(MetadataTokens.MethodDefinitionHandle(1), default(ImportScopeHandle), default(LocalVariableHandle), default(LocalConstantHandle), startOffset: 0, length: 1); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); builder = new MetadataBuilder(); builder.AddLocalScope(MetadataTokens.MethodDefinitionHandle(1), default(ImportScopeHandle), default(LocalVariableHandle), default(LocalConstantHandle), startOffset: 1, length: 1); builder.AddLocalScope(MetadataTokens.MethodDefinitionHandle(1), default(ImportScopeHandle), default(LocalVariableHandle), default(LocalConstantHandle), startOffset: 0, length: 1); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); builder = new MetadataBuilder(); builder.AddLocalScope(MetadataTokens.MethodDefinitionHandle(1), default(ImportScopeHandle), default(LocalVariableHandle), default(LocalConstantHandle), startOffset: 0, length: 1); builder.AddLocalScope(MetadataTokens.MethodDefinitionHandle(1), default(ImportScopeHandle), default(LocalVariableHandle), default(LocalConstantHandle), startOffset: 0, length: 2); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); builder = new MetadataBuilder(); builder.AddLocalScope(MetadataTokens.MethodDefinitionHandle(1), default(ImportScopeHandle), default(LocalVariableHandle), default(LocalConstantHandle), startOffset: 0, length: 1); builder.AddLocalScope(MetadataTokens.MethodDefinitionHandle(1), default(ImportScopeHandle), default(LocalVariableHandle), default(LocalConstantHandle), startOffset: 0, length: 1); builder.ValidateOrder(); // ok } [Fact] public void ValidateStateMachineMethodTable() { var builder = new MetadataBuilder(); builder.AddStateMachineMethod(MetadataTokens.MethodDefinitionHandle(2), default(MethodDefinitionHandle)); builder.AddStateMachineMethod(MetadataTokens.MethodDefinitionHandle(1), default(MethodDefinitionHandle)); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); builder = new MetadataBuilder(); builder.AddStateMachineMethod(MetadataTokens.MethodDefinitionHandle(1), default(MethodDefinitionHandle)); builder.AddStateMachineMethod(MetadataTokens.MethodDefinitionHandle(1), default(MethodDefinitionHandle)); Assert.Throws<InvalidOperationException>(() => builder.ValidateOrder()); } } }
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/mono/mono/mini/mini-codegen.c
/** * \file * Arch independent code generation functionality * * (C) 2003 Ximian, Inc. */ #include "config.h" #include <string.h> #include <math.h> #ifdef HAVE_UNISTD_H #include <unistd.h> #endif #include <mono/metadata/appdomain.h> #include <mono/metadata/debug-helpers.h> #include <mono/metadata/threads.h> #include <mono/metadata/profiler-private.h> #include <mono/metadata/mempool-internals.h> #include <mono/utils/mono-math.h> #include "mini.h" #include "mini-runtime.h" #include "trace.h" #include "mini-arch.h" #ifndef DISABLE_JIT #ifndef MONO_MAX_XREGS #define MONO_MAX_XREGS 0 #define MONO_ARCH_CALLEE_SAVED_XREGS 0 #define MONO_ARCH_CALLEE_XREGS 0 #endif #define MONO_ARCH_BANK_MIRRORED -2 #ifdef MONO_ARCH_USE_SHARED_FP_SIMD_BANK #ifndef MONO_ARCH_NEED_SIMD_BANK #error "MONO_ARCH_USE_SHARED_FP_SIMD_BANK needs MONO_ARCH_NEED_SIMD_BANK to work" #endif #define get_mirrored_bank(bank) (((bank) == MONO_REG_SIMD ) ? MONO_REG_DOUBLE : (((bank) == MONO_REG_DOUBLE ) ? MONO_REG_SIMD : -1)) #define is_hreg_mirrored(rs, bank, hreg) ((rs)->symbolic [(bank)] [(hreg)] == MONO_ARCH_BANK_MIRRORED) #else #define get_mirrored_bank(bank) (-1) #define is_hreg_mirrored(rs, bank, hreg) (0) #endif #if _MSC_VER #pragma warning(disable:4293) // FIXME negative shift is undefined #endif /* If the bank is mirrored return the true logical bank that the register in the * physical register bank is allocated to. */ static int translate_bank (MonoRegState *rs, int bank, int hreg) { return is_hreg_mirrored (rs, bank, hreg) ? get_mirrored_bank (bank) : bank; } /* * Every hardware register belongs to a register type or register bank. bank 0 * contains the int registers, bank 1 contains the fp registers. * int registers are used 99% of the time, so they are special cased in a lot of * places. */ static const int regbank_size [] = { MONO_MAX_IREGS, MONO_MAX_FREGS, MONO_MAX_IREGS, MONO_MAX_IREGS, MONO_MAX_XREGS }; static const int regbank_load_ops [] = { OP_LOADR_MEMBASE, OP_LOADR8_MEMBASE, OP_LOADR_MEMBASE, OP_LOADR_MEMBASE, OP_LOADX_MEMBASE }; static const int regbank_store_ops [] = { OP_STORER_MEMBASE_REG, OP_STORER8_MEMBASE_REG, OP_STORER_MEMBASE_REG, OP_STORER_MEMBASE_REG, OP_STOREX_MEMBASE }; static const int regbank_move_ops [] = { OP_MOVE, OP_FMOVE, OP_MOVE, OP_MOVE, OP_XMOVE }; #define regmask(reg) (((regmask_t)1) << (reg)) #ifdef MONO_ARCH_USE_SHARED_FP_SIMD_BANK static const regmask_t regbank_callee_saved_regs [] = { MONO_ARCH_CALLEE_SAVED_REGS, MONO_ARCH_CALLEE_SAVED_FREGS, MONO_ARCH_CALLEE_SAVED_REGS, MONO_ARCH_CALLEE_SAVED_REGS, MONO_ARCH_CALLEE_SAVED_XREGS, }; #endif static const regmask_t regbank_callee_regs [] = { MONO_ARCH_CALLEE_REGS, MONO_ARCH_CALLEE_FREGS, MONO_ARCH_CALLEE_REGS, MONO_ARCH_CALLEE_REGS, MONO_ARCH_CALLEE_XREGS, }; static const int regbank_spill_var_size[] = { sizeof (target_mgreg_t), sizeof (double), sizeof (target_mgreg_t), sizeof (target_mgreg_t), 16 /*FIXME make this a constant. Maybe MONO_ARCH_SIMD_VECTOR_SIZE? */ }; #define DEBUG(a) MINI_DEBUG(cfg->verbose_level, 3, a;) static void mono_regstate_assign (MonoRegState *rs) { #ifdef MONO_ARCH_USE_SHARED_FP_SIMD_BANK /* The regalloc may fail if fp and simd logical regbanks share the same physical reg bank and * if the values here are not the same. */ g_assert(regbank_callee_regs [MONO_REG_SIMD] == regbank_callee_regs [MONO_REG_DOUBLE]); g_assert(regbank_callee_saved_regs [MONO_REG_SIMD] == regbank_callee_saved_regs [MONO_REG_DOUBLE]); g_assert(regbank_size [MONO_REG_SIMD] == regbank_size [MONO_REG_DOUBLE]); #endif if (rs->next_vreg > rs->vassign_size) { g_free (rs->vassign); rs->vassign_size = MAX (rs->next_vreg, 256); rs->vassign = (gint32 *)g_malloc (rs->vassign_size * sizeof (gint32)); } memset (rs->isymbolic, 0, MONO_MAX_IREGS * sizeof (rs->isymbolic [0])); memset (rs->fsymbolic, 0, MONO_MAX_FREGS * sizeof (rs->fsymbolic [0])); rs->symbolic [MONO_REG_INT] = rs->isymbolic; rs->symbolic [MONO_REG_DOUBLE] = rs->fsymbolic; #ifdef MONO_ARCH_NEED_SIMD_BANK memset (rs->xsymbolic, 0, MONO_MAX_XREGS * sizeof (rs->xsymbolic [0])); rs->symbolic [MONO_REG_SIMD] = rs->xsymbolic; #endif } static int mono_regstate_alloc_int (MonoRegState *rs, regmask_t allow) { regmask_t mask = allow & rs->ifree_mask; #if defined(__x86_64__) && defined(__GNUC__) { guint64 i; if (mask == 0) return -1; __asm__("bsfq %1,%0\n\t" : "=r" (i) : "rm" (mask)); rs->ifree_mask &= ~ ((regmask_t)1 << i); return i; } #else int i; for (i = 0; i < MONO_MAX_IREGS; ++i) { if (mask & ((regmask_t)1 << i)) { rs->ifree_mask &= ~ ((regmask_t)1 << i); return i; } } return -1; #endif } static void mono_regstate_free_int (MonoRegState *rs, int reg) { if (reg >= 0) { rs->ifree_mask |= (regmask_t)1 << reg; rs->isymbolic [reg] = 0; } } static int mono_regstate_alloc_general (MonoRegState *rs, regmask_t allow, int bank) { int i; int mirrored_bank; regmask_t mask = allow & rs->free_mask [bank]; for (i = 0; i < regbank_size [bank]; ++i) { if (mask & ((regmask_t)1 << i)) { rs->free_mask [bank] &= ~ ((regmask_t)1 << i); mirrored_bank = get_mirrored_bank (bank); if (mirrored_bank == -1) return i; rs->free_mask [mirrored_bank] = rs->free_mask [bank]; return i; } } return -1; } static void mono_regstate_free_general (MonoRegState *rs, int reg, int bank) { int mirrored_bank; if (reg >= 0) { rs->free_mask [bank] |= (regmask_t)1 << reg; rs->symbolic [bank][reg] = 0; mirrored_bank = get_mirrored_bank (bank); if (mirrored_bank == -1) return; rs->free_mask [mirrored_bank] = rs->free_mask [bank]; rs->symbolic [mirrored_bank][reg] = 0; } } const char* mono_regname_full (int reg, int bank) { if (G_UNLIKELY (bank)) { #if MONO_ARCH_NEED_SIMD_BANK if (bank == MONO_REG_SIMD) return mono_arch_xregname (reg); #endif if (bank == MONO_REG_INT_REF || bank == MONO_REG_INT_MP) return mono_arch_regname (reg); g_assert (bank == MONO_REG_DOUBLE); return mono_arch_fregname (reg); } else { return mono_arch_regname (reg); } } void mono_call_inst_add_outarg_reg (MonoCompile *cfg, MonoCallInst *call, int vreg, int hreg, int bank) { guint32 regpair; regpair = (((guint32)hreg) << 24) + vreg; if (G_UNLIKELY (bank)) { g_assert (vreg >= regbank_size [bank]); g_assert (hreg < regbank_size [bank]); call->used_fregs |= (regmask_t)1 << hreg; call->out_freg_args = g_slist_append_mempool (cfg->mempool, call->out_freg_args, (gpointer)(gssize)(regpair)); } else { g_assert (vreg >= MONO_MAX_IREGS); g_assert (hreg < MONO_MAX_IREGS); call->used_iregs |= (regmask_t)1 << hreg; call->out_ireg_args = g_slist_append_mempool (cfg->mempool, call->out_ireg_args, (gpointer)(gssize)(regpair)); } } /* * mono_call_inst_add_outarg_vt: * * Register OUTARG_VT as belonging to CALL. */ void mono_call_inst_add_outarg_vt (MonoCompile *cfg, MonoCallInst *call, MonoInst *outarg_vt) { call->outarg_vts = g_slist_append_mempool (cfg->mempool, call->outarg_vts, outarg_vt); } static void resize_spill_info (MonoCompile *cfg, int bank) { MonoSpillInfo *orig_info = cfg->spill_info [bank]; int orig_len = cfg->spill_info_len [bank]; int new_len = orig_len ? orig_len * 2 : 16; MonoSpillInfo *new_info; int i; g_assert (bank < MONO_NUM_REGBANKS); new_info = (MonoSpillInfo *)mono_mempool_alloc0 (cfg->mempool, sizeof (MonoSpillInfo) * new_len); if (orig_info) memcpy (new_info, orig_info, sizeof (MonoSpillInfo) * orig_len); for (i = orig_len; i < new_len; ++i) new_info [i].offset = -1; cfg->spill_info [bank] = new_info; cfg->spill_info_len [bank] = new_len; } /* * returns the offset used by spillvar. It allocates a new * spill variable if necessary. */ static int mono_spillvar_offset (MonoCompile *cfg, int spillvar, int bank) { MonoSpillInfo *info; int size; if (G_UNLIKELY (spillvar >= (cfg->spill_info_len [bank]))) { while (spillvar >= cfg->spill_info_len [bank]) resize_spill_info (cfg, bank); } /* * Allocate separate spill slots for fp/non-fp variables since most processors prefer it. */ info = &cfg->spill_info [bank][spillvar]; if (info->offset == -1) { cfg->stack_offset += sizeof (target_mgreg_t) - 1; cfg->stack_offset &= ~(sizeof (target_mgreg_t) - 1); g_assert (bank < MONO_NUM_REGBANKS); if (G_UNLIKELY (bank)) size = regbank_spill_var_size [bank]; else size = sizeof (target_mgreg_t); if (cfg->flags & MONO_CFG_HAS_SPILLUP) { cfg->stack_offset += size - 1; cfg->stack_offset &= ~(size - 1); info->offset = cfg->stack_offset; cfg->stack_offset += size; } else { cfg->stack_offset += size - 1; cfg->stack_offset &= ~(size - 1); cfg->stack_offset += size; info->offset = - cfg->stack_offset; } } return info->offset; } #define is_hard_ireg(r) ((r) >= 0 && (r) < MONO_MAX_IREGS) #define is_hard_freg(r) ((r) >= 0 && (r) < MONO_MAX_FREGS) #define is_global_ireg(r) (is_hard_ireg ((r)) && (MONO_ARCH_CALLEE_SAVED_REGS & (regmask (r)))) #define is_local_ireg(r) (is_hard_ireg ((r)) && (MONO_ARCH_CALLEE_REGS & (regmask (r)))) #define is_global_freg(r) (is_hard_freg ((r)) && (MONO_ARCH_CALLEE_SAVED_FREGS & (regmask (r)))) #define is_local_freg(r) (is_hard_freg ((r)) && (MONO_ARCH_CALLEE_FREGS & (regmask (r)))) #define is_hard_reg(r,bank) (G_UNLIKELY (bank) ? ((r) >= 0 && (r) < regbank_size [bank]) : ((r) < MONO_MAX_IREGS)) #define is_soft_reg(r,bank) (!is_hard_reg((r),(bank))) #define is_global_reg(r,bank) (G_UNLIKELY (bank) ? (is_hard_reg ((r), (bank)) && (regbank_callee_saved_regs [bank] & regmask (r))) : is_global_ireg (r)) #define is_local_reg(r,bank) (G_UNLIKELY (bank) ? (is_hard_reg ((r), (bank)) && (regbank_callee_regs [bank] & regmask (r))) : is_local_ireg (r)) #define reg_is_freeable(r,bank) (G_UNLIKELY (bank) ? is_local_reg ((r), (bank)) : is_local_ireg ((r))) #ifndef MONO_ARCH_INST_IS_FLOAT #define MONO_ARCH_INST_IS_FLOAT(desc) ((desc) == 'f') #endif #define reg_is_fp(desc) (MONO_ARCH_INST_IS_FLOAT (desc)) #define dreg_is_fp(spec) (MONO_ARCH_INST_IS_FLOAT (spec [MONO_INST_DEST])) #define sreg_is_fp(n,spec) (MONO_ARCH_INST_IS_FLOAT (spec [MONO_INST_SRC1+(n)])) #define sreg1_is_fp(spec) sreg_is_fp (0,(spec)) #define sreg2_is_fp(spec) sreg_is_fp (1,(spec)) #define reg_is_simd(desc) ((desc) == 'x') #ifdef MONO_ARCH_NEED_SIMD_BANK #define reg_bank(desc) (G_UNLIKELY (reg_is_fp (desc)) ? MONO_REG_DOUBLE : G_UNLIKELY (reg_is_simd(desc)) ? MONO_REG_SIMD : MONO_REG_INT) #else #define reg_bank(desc) reg_is_fp ((desc)) #endif #define sreg_bank(n,spec) reg_bank ((spec)[MONO_INST_SRC1+(n)]) #define sreg1_bank(spec) sreg_bank (0, (spec)) #define sreg2_bank(spec) sreg_bank (1, (spec)) #define dreg_bank(spec) reg_bank ((spec)[MONO_INST_DEST]) #define sreg_bank_ins(n,ins) sreg_bank ((n), ins_get_spec ((ins)->opcode)) #define sreg1_bank_ins(ins) sreg_bank_ins (0, (ins)) #define sreg2_bank_ins(ins) sreg_bank_ins (1, (ins)) #define dreg_bank_ins(ins) dreg_bank (ins_get_spec ((ins)->opcode)) #define regpair_reg2_mask(desc,hreg1) ((MONO_ARCH_INST_REGPAIR_REG2 (desc,hreg1) != -1) ? (regmask (MONO_ARCH_INST_REGPAIR_REG2 (desc,hreg1))) : MONO_ARCH_CALLEE_REGS) #ifdef MONO_ARCH_IS_GLOBAL_IREG #undef is_global_ireg #define is_global_ireg(reg) MONO_ARCH_IS_GLOBAL_IREG ((reg)) #endif typedef struct { int born_in; int killed_in; /* Not (yet) used */ //int last_use; //int prev_use; regmask_t preferred_mask; /* the hreg where the register should be allocated, or 0 */ } RegTrack; #if !defined(DISABLE_LOGGING) void mono_print_ins_index (int i, MonoInst *ins) { GString *buf = mono_print_ins_index_strbuf (i, ins); printf ("%s\n", buf->str); g_string_free (buf, TRUE); } GString * mono_print_ins_index_strbuf (int i, MonoInst *ins) { const char *spec = ins_get_spec (ins->opcode); GString *sbuf = g_string_new (NULL); int num_sregs, j; int sregs [MONO_MAX_SRC_REGS]; if (i != -1) g_string_append_printf (sbuf, "\t%-2d %s", i, mono_inst_name (ins->opcode)); else g_string_append_printf (sbuf, " %s", mono_inst_name (ins->opcode)); if (spec == (gpointer)/*FIXME*/MONO_ARCH_CPU_SPEC) { gboolean dest_base = FALSE; switch (ins->opcode) { case OP_STOREV_MEMBASE: dest_base = TRUE; break; default: break; } /* This is a lowered opcode */ if (ins->dreg != -1) { if (dest_base) g_string_append_printf (sbuf, " [R%d + 0x%lx] <-", ins->dreg, (long)ins->inst_offset); else g_string_append_printf (sbuf, " R%d <-", ins->dreg); } if (ins->sreg1 != -1) g_string_append_printf (sbuf, " R%d", ins->sreg1); if (ins->sreg2 != -1) g_string_append_printf (sbuf, " R%d", ins->sreg2); if (ins->sreg3 != -1) g_string_append_printf (sbuf, " R%d", ins->sreg3); switch (ins->opcode) { case OP_LBNE_UN: case OP_LBEQ: case OP_LBLT: case OP_LBLT_UN: case OP_LBGT: case OP_LBGT_UN: case OP_LBGE: case OP_LBGE_UN: case OP_LBLE: case OP_LBLE_UN: if (!ins->inst_false_bb) g_string_append_printf (sbuf, " [B%d]", ins->inst_true_bb->block_num); else g_string_append_printf (sbuf, " [B%dB%d]", ins->inst_true_bb->block_num, ins->inst_false_bb->block_num); break; case OP_PHI: case OP_VPHI: case OP_XPHI: case OP_FPHI: { int i; g_string_append_printf (sbuf, " [%d (", (int)ins->inst_c0); for (i = 0; i < ins->inst_phi_args [0]; i++) { if (i) g_string_append_printf (sbuf, ", "); g_string_append_printf (sbuf, "R%d", ins->inst_phi_args [i + 1]); } g_string_append_printf (sbuf, ")]"); break; } case OP_LDADDR: case OP_OUTARG_VTRETADDR: g_string_append_printf (sbuf, " R%d", ((MonoInst*)ins->inst_p0)->dreg); break; case OP_REGOFFSET: case OP_GSHAREDVT_ARG_REGOFFSET: g_string_append_printf (sbuf, " + 0x%lx", (long)ins->inst_offset); break; case OP_ISINST: case OP_CASTCLASS: g_string_append_printf (sbuf, " %s", m_class_get_name (ins->klass)); break; default: break; } //g_error ("Unknown opcode: %s\n", mono_inst_name (ins->opcode)); return sbuf; } if (spec [MONO_INST_DEST]) { int bank = dreg_bank (spec); if (is_soft_reg (ins->dreg, bank)) { if (spec [MONO_INST_DEST] == 'b') { if (ins->inst_offset == 0) g_string_append_printf (sbuf, " [R%d] <-", ins->dreg); else g_string_append_printf (sbuf, " [R%d + 0x%lx] <-", ins->dreg, (long)ins->inst_offset); } else g_string_append_printf (sbuf, " R%d <-", ins->dreg); } else if (spec [MONO_INST_DEST] == 'b') { if (ins->inst_offset == 0) g_string_append_printf (sbuf, " [%s] <-", mono_arch_regname (ins->dreg)); else g_string_append_printf (sbuf, " [%s + 0x%lx] <-", mono_arch_regname (ins->dreg), (long)ins->inst_offset); } else g_string_append_printf (sbuf, " %s <-", mono_regname_full (ins->dreg, bank)); } if (spec [MONO_INST_SRC1]) { int bank = sreg1_bank (spec); if (is_soft_reg (ins->sreg1, bank)) { if (spec [MONO_INST_SRC1] == 'b') g_string_append_printf (sbuf, " [R%d + 0x%lx]", ins->sreg1, (long)ins->inst_offset); else g_string_append_printf (sbuf, " R%d", ins->sreg1); } else if (spec [MONO_INST_SRC1] == 'b') g_string_append_printf (sbuf, " [%s + 0x%lx]", mono_arch_regname (ins->sreg1), (long)ins->inst_offset); else g_string_append_printf (sbuf, " %s", mono_regname_full (ins->sreg1, bank)); } num_sregs = mono_inst_get_src_registers (ins, sregs); for (j = 1; j < num_sregs; ++j) { int bank = sreg_bank (j, spec); if (is_soft_reg (sregs [j], bank)) g_string_append_printf (sbuf, " R%d", sregs [j]); else g_string_append_printf (sbuf, " %s", mono_regname_full (sregs [j], bank)); } switch (ins->opcode) { case OP_ICONST: g_string_append_printf (sbuf, " [%d]", (int)ins->inst_c0); break; #if defined(TARGET_X86) || defined(TARGET_AMD64) case OP_X86_PUSH_IMM: #endif case OP_ICOMPARE_IMM: case OP_COMPARE_IMM: case OP_IADD_IMM: case OP_ISUB_IMM: case OP_IAND_IMM: case OP_IOR_IMM: case OP_IXOR_IMM: case OP_SUB_IMM: case OP_MUL_IMM: case OP_STORE_MEMBASE_IMM: g_string_append_printf (sbuf, " [%d]", (int)ins->inst_imm); break; case OP_ADD_IMM: case OP_LADD_IMM: g_string_append_printf (sbuf, " [%d]", (int)(gssize)ins->inst_p1); break; case OP_I8CONST: g_string_append_printf (sbuf, " [%" PRId64 "]", (gint64)ins->inst_l); break; case OP_R8CONST: g_string_append_printf (sbuf, " [%f]", *(double*)ins->inst_p0); break; case OP_R4CONST: g_string_append_printf (sbuf, " [%f]", *(float*)ins->inst_p0); break; case OP_CALL: case OP_CALL_MEMBASE: case OP_CALL_REG: case OP_FCALL: case OP_LCALL: case OP_VCALL: case OP_VCALL_REG: case OP_VCALL_MEMBASE: case OP_VCALL2: case OP_VCALL2_REG: case OP_VCALL2_MEMBASE: case OP_VOIDCALL: case OP_VOIDCALL_MEMBASE: case OP_TAILCALL: case OP_TAILCALL_MEMBASE: case OP_RCALL: case OP_RCALL_REG: case OP_RCALL_MEMBASE: { MonoCallInst *call = (MonoCallInst*)ins; GSList *list; MonoJitICallId jit_icall_id; MonoMethod *method; if (ins->opcode == OP_VCALL || ins->opcode == OP_VCALL_REG || ins->opcode == OP_VCALL_MEMBASE) { /* * These are lowered opcodes, but they are in the .md files since the old * JIT passes them to backends. */ if (ins->dreg != -1) g_string_append_printf (sbuf, " R%d <-", ins->dreg); } if ((method = call->method)) { char *full_name = mono_method_get_full_name (method); g_string_append_printf (sbuf, " [%s]", full_name); g_free (full_name); } else if (call->fptr_is_patch) { MonoJumpInfo *ji = (MonoJumpInfo*)call->fptr; g_string_append_printf (sbuf, " "); mono_print_ji (ji); } else if ((jit_icall_id = call->jit_icall_id)) { g_string_append_printf (sbuf, " [%s]", mono_find_jit_icall_info (jit_icall_id)->name); } list = call->out_ireg_args; while (list) { guint32 regpair; int reg, hreg; regpair = (guint32)(gssize)(list->data); hreg = regpair >> 24; reg = regpair & 0xffffff; g_string_append_printf (sbuf, " [%s <- R%d]", mono_arch_regname (hreg), reg); list = g_slist_next (list); } list = call->out_freg_args; while (list) { guint32 regpair; int reg, hreg; regpair = (guint32)(gssize)(list->data); hreg = regpair >> 24; reg = regpair & 0xffffff; g_string_append_printf (sbuf, " [%s <- R%d]", mono_arch_fregname (hreg), reg); list = g_slist_next (list); } break; } case OP_BR: case OP_CALL_HANDLER: g_string_append_printf (sbuf, " [B%d]", ins->inst_target_bb->block_num); break; case OP_IBNE_UN: case OP_IBEQ: case OP_IBLT: case OP_IBLT_UN: case OP_IBGT: case OP_IBGT_UN: case OP_IBGE: case OP_IBGE_UN: case OP_IBLE: case OP_IBLE_UN: case OP_LBNE_UN: case OP_LBEQ: case OP_LBLT: case OP_LBLT_UN: case OP_LBGT: case OP_LBGT_UN: case OP_LBGE: case OP_LBGE_UN: case OP_LBLE: case OP_LBLE_UN: if (!ins->inst_false_bb) g_string_append_printf (sbuf, " [B%d]", ins->inst_true_bb->block_num); else g_string_append_printf (sbuf, " [B%dB%d]", ins->inst_true_bb->block_num, ins->inst_false_bb->block_num); break; case OP_LIVERANGE_START: case OP_LIVERANGE_END: case OP_GC_LIVENESS_DEF: case OP_GC_LIVENESS_USE: g_string_append_printf (sbuf, " R%d", (int)ins->inst_c1); break; case OP_IL_SEQ_POINT: case OP_SEQ_POINT: g_string_append_printf (sbuf, "%s il: 0x%x%s", (ins->flags & MONO_INST_SINGLE_STEP_LOC) ? " intr" : "", (int)ins->inst_imm, ins->flags & MONO_INST_NONEMPTY_STACK ? ", nonempty-stack" : ""); break; case OP_COND_EXC_EQ: case OP_COND_EXC_GE: case OP_COND_EXC_GT: case OP_COND_EXC_LE: case OP_COND_EXC_LT: case OP_COND_EXC_NE_UN: case OP_COND_EXC_GE_UN: case OP_COND_EXC_GT_UN: case OP_COND_EXC_LE_UN: case OP_COND_EXC_LT_UN: case OP_COND_EXC_OV: case OP_COND_EXC_NO: case OP_COND_EXC_C: case OP_COND_EXC_NC: case OP_COND_EXC_IEQ: case OP_COND_EXC_IGE: case OP_COND_EXC_IGT: case OP_COND_EXC_ILE: case OP_COND_EXC_ILT: case OP_COND_EXC_INE_UN: case OP_COND_EXC_IGE_UN: case OP_COND_EXC_IGT_UN: case OP_COND_EXC_ILE_UN: case OP_COND_EXC_ILT_UN: case OP_COND_EXC_IOV: case OP_COND_EXC_INO: case OP_COND_EXC_IC: case OP_COND_EXC_INC: g_string_append_printf (sbuf, " %s", (const char*)ins->inst_p1); break; default: break; } if (spec [MONO_INST_CLOB]) g_string_append_printf (sbuf, " clobbers: %c", spec [MONO_INST_CLOB]); return sbuf; } static void print_regtrack (RegTrack *t, int num) { int i; char buf [32]; const char *r; for (i = 0; i < num; ++i) { if (!t [i].born_in) continue; if (i >= MONO_MAX_IREGS) { g_snprintf (buf, sizeof (buf), "R%d", i); r = buf; } else r = mono_arch_regname (i); printf ("liveness: %s [%d - %d]\n", r, t [i].born_in, t[i].killed_in); } } #else void mono_print_ins_index (int i, MonoInst *ins) { } #endif /* !defined(DISABLE_LOGGING) */ void mono_print_ins (MonoInst *ins) { mono_print_ins_index (-1, ins); } static void insert_before_ins (MonoBasicBlock *bb, MonoInst *ins, MonoInst* to_insert) { /* * If this function is called multiple times, the new instructions are inserted * in the proper order. */ mono_bblock_insert_before_ins (bb, ins, to_insert); } static void insert_after_ins (MonoBasicBlock *bb, MonoInst *ins, MonoInst **last, MonoInst* to_insert) { /* * If this function is called multiple times, the new instructions are inserted in * proper order. */ mono_bblock_insert_after_ins (bb, *last, to_insert); *last = to_insert; } static int get_vreg_bank (MonoCompile *cfg, int reg, int bank) { if (vreg_is_ref (cfg, reg)) return MONO_REG_INT_REF; else if (vreg_is_mp (cfg, reg)) return MONO_REG_INT_MP; else return bank; } /* * Force the spilling of the variable in the symbolic register 'reg', and free * the hreg it was assigned to. */ static void spill_vreg (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst **last, MonoInst *ins, int reg, int bank) { MonoInst *load; int i, sel, spill; MonoRegState *rs = cfg->rs; sel = rs->vassign [reg]; /* the vreg we need to spill lives in another logical reg bank */ bank = translate_bank (cfg->rs, bank, sel); /*i = rs->isymbolic [sel]; g_assert (i == reg);*/ i = reg; spill = ++cfg->spill_count; rs->vassign [i] = -spill - 1; if (G_UNLIKELY (bank)) mono_regstate_free_general (rs, sel, bank); else mono_regstate_free_int (rs, sel); /* we need to create a spill var and insert a load to sel after the current instruction */ MONO_INST_NEW (cfg, load, regbank_load_ops [bank]); load->dreg = sel; load->inst_basereg = cfg->frame_reg; load->inst_offset = mono_spillvar_offset (cfg, spill, get_vreg_bank (cfg, reg, bank)); insert_after_ins (bb, ins, last, load); DEBUG (printf ("SPILLED LOAD (%d at 0x%08lx(%%ebp)) R%d (freed %s)\n", spill, (long)load->inst_offset, i, mono_regname_full (sel, bank))); if (G_UNLIKELY (bank)) i = mono_regstate_alloc_general (rs, regmask (sel), bank); else i = mono_regstate_alloc_int (rs, regmask (sel)); g_assert (i == sel); if (G_UNLIKELY (bank)) mono_regstate_free_general (rs, sel, bank); else mono_regstate_free_int (rs, sel); } static int get_register_spilling (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst **last, MonoInst *ins, regmask_t regmask, int reg, int bank) { MonoInst *load; int i, sel, spill, num_sregs; int sregs [MONO_MAX_SRC_REGS]; MonoRegState *rs = cfg->rs; g_assert (bank < MONO_NUM_REGBANKS); DEBUG (printf ("\tstart regmask to assign R%d: 0x%08" PRIu64 " (R%d <- R%d R%d R%d)\n", reg, (guint64)regmask, ins->dreg, ins->sreg1, ins->sreg2, ins->sreg3)); /* exclude the registers in the current instruction */ num_sregs = mono_inst_get_src_registers (ins, sregs); for (i = 0; i < num_sregs; ++i) { if ((sreg_bank_ins (i, ins) == bank) && (reg != sregs [i]) && (reg_is_freeable (sregs [i], bank) || (is_soft_reg (sregs [i], bank) && rs->vassign [sregs [i]] >= 0))) { if (is_soft_reg (sregs [i], bank)) regmask &= ~ (regmask (rs->vassign [sregs [i]])); else regmask &= ~ (regmask (sregs [i])); DEBUG (printf ("\t\texcluding sreg%d %s %d\n", i + 1, mono_regname_full (sregs [i], bank), sregs [i])); } } if ((dreg_bank_ins (ins) == bank) && (reg != ins->dreg) && reg_is_freeable (ins->dreg, bank)) { regmask &= ~ (regmask (ins->dreg)); DEBUG (printf ("\t\texcluding dreg %s\n", mono_regname_full (ins->dreg, bank))); } DEBUG (printf ("\t\tavailable regmask: 0x%08" PRIu64 "\n", (guint64)regmask)); g_assert (regmask); /* need at least a register we can free */ sel = 0; /* we should track prev_use and spill the register that's farther */ if (G_UNLIKELY (bank)) { for (i = 0; i < regbank_size [bank]; ++i) { if (regmask & (regmask (i))) { sel = i; /* the vreg we need to load lives in another logical bank */ bank = translate_bank (cfg->rs, bank, sel); DEBUG (printf ("\t\tselected register %s has assignment %d\n", mono_regname_full (sel, bank), rs->symbolic [bank] [sel])); break; } } i = rs->symbolic [bank] [sel]; spill = ++cfg->spill_count; rs->vassign [i] = -spill - 1; mono_regstate_free_general (rs, sel, bank); } else { for (i = 0; i < MONO_MAX_IREGS; ++i) { if (regmask & (regmask (i))) { sel = i; DEBUG (printf ("\t\tselected register %s has assignment %d\n", mono_arch_regname (sel), rs->isymbolic [sel])); break; } } i = rs->isymbolic [sel]; spill = ++cfg->spill_count; rs->vassign [i] = -spill - 1; mono_regstate_free_int (rs, sel); } /* we need to create a spill var and insert a load to sel after the current instruction */ MONO_INST_NEW (cfg, load, regbank_load_ops [bank]); load->dreg = sel; load->inst_basereg = cfg->frame_reg; load->inst_offset = mono_spillvar_offset (cfg, spill, get_vreg_bank (cfg, i, bank)); insert_after_ins (bb, ins, last, load); DEBUG (printf ("\tSPILLED LOAD (%d at 0x%08lx(%%ebp)) R%d (freed %s)\n", spill, (long)load->inst_offset, i, mono_regname_full (sel, bank))); if (G_UNLIKELY (bank)) i = mono_regstate_alloc_general (rs, regmask (sel), bank); else i = mono_regstate_alloc_int (rs, regmask (sel)); g_assert (i == sel); return sel; } /* * free_up_hreg: * * Free up the hreg HREG by spilling the vreg allocated to it. */ static void free_up_hreg (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst **last, MonoInst *ins, int hreg, int bank) { if (G_UNLIKELY (bank)) { if (!(cfg->rs->free_mask [bank] & (regmask (hreg)))) { bank = translate_bank (cfg->rs, bank, hreg); DEBUG (printf ("\tforced spill of R%d\n", cfg->rs->symbolic [bank] [hreg])); spill_vreg (cfg, bb, last, ins, cfg->rs->symbolic [bank] [hreg], bank); } } else { if (!(cfg->rs->ifree_mask & (regmask (hreg)))) { DEBUG (printf ("\tforced spill of R%d\n", cfg->rs->isymbolic [hreg])); spill_vreg (cfg, bb, last, ins, cfg->rs->isymbolic [hreg], bank); } } } static MonoInst* create_copy_ins (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst **last, int dest, int src, MonoInst *ins, const unsigned char *ip, int bank) { MonoInst *copy; MONO_INST_NEW (cfg, copy, regbank_move_ops [bank]); copy->dreg = dest; copy->sreg1 = src; copy->cil_code = ip; if (ins) { mono_bblock_insert_after_ins (bb, ins, copy); *last = copy; } DEBUG (printf ("\tforced copy from %s to %s\n", mono_regname_full (src, bank), mono_regname_full (dest, bank))); return copy; } static const char* regbank_to_string (int bank) { if (bank == MONO_REG_INT_REF) return "REF "; else if (bank == MONO_REG_INT_MP) return "MP "; else return ""; } static void create_spilled_store (MonoCompile *cfg, MonoBasicBlock *bb, int spill, int reg, int prev_reg, MonoInst **last, MonoInst *ins, MonoInst *insert_before, int bank) { MonoInst *store, *def; bank = get_vreg_bank (cfg, prev_reg, bank); MONO_INST_NEW (cfg, store, regbank_store_ops [bank]); store->sreg1 = reg; store->inst_destbasereg = cfg->frame_reg; store->inst_offset = mono_spillvar_offset (cfg, spill, bank); if (ins) { mono_bblock_insert_after_ins (bb, ins, store); *last = store; } else if (insert_before) { insert_before_ins (bb, insert_before, store); } else { g_assert_not_reached (); } DEBUG (printf ("\t%sSPILLED STORE (%d at 0x%08lx(%%ebp)) R%d (from %s)\n", regbank_to_string (bank), spill, (long)store->inst_offset, prev_reg, mono_regname_full (reg, bank))); if (((bank == MONO_REG_INT_REF) || (bank == MONO_REG_INT_MP)) && cfg->compute_gc_maps) { g_assert (prev_reg != -1); MONO_INST_NEW (cfg, def, OP_GC_SPILL_SLOT_LIVENESS_DEF); def->inst_c0 = spill; def->inst_c1 = bank; mono_bblock_insert_after_ins (bb, store, def); } } /* flags used in reginfo->flags */ enum { MONO_FP_NEEDS_LOAD_SPILL = regmask (0), MONO_FP_NEEDS_SPILL = regmask (1), MONO_FP_NEEDS_LOAD = regmask (2) }; static int alloc_int_reg (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst **last, MonoInst *ins, regmask_t dest_mask, int sym_reg, RegTrack *info) { int val; if (info && info->preferred_mask) { val = mono_regstate_alloc_int (cfg->rs, info->preferred_mask & dest_mask); if (val >= 0) { DEBUG (printf ("\tallocated preferred reg R%d to %s\n", sym_reg, mono_arch_regname (val))); return val; } } val = mono_regstate_alloc_int (cfg->rs, dest_mask); if (val < 0) val = get_register_spilling (cfg, bb, last, ins, dest_mask, sym_reg, 0); return val; } static int alloc_general_reg (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst **last, MonoInst *ins, regmask_t dest_mask, int sym_reg, int bank) { int val; val = mono_regstate_alloc_general (cfg->rs, dest_mask, bank); if (val < 0) val = get_register_spilling (cfg, bb, last, ins, dest_mask, sym_reg, bank); #ifdef MONO_ARCH_HAVE_TRACK_FPREGS cfg->arch.used_fp_regs |= 1 << val; #endif return val; } static int alloc_reg (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst **last, MonoInst *ins, regmask_t dest_mask, int sym_reg, RegTrack *info, int bank) { if (G_UNLIKELY (bank)) return alloc_general_reg (cfg, bb, last, ins, dest_mask, sym_reg, bank); else return alloc_int_reg (cfg, bb, last, ins, dest_mask, sym_reg, info); } static void assign_reg (MonoCompile *cfg, MonoRegState *rs, int reg, int hreg, int bank) { if (G_UNLIKELY (bank)) { int mirrored_bank; g_assert (reg >= regbank_size [bank]); g_assert (hreg < regbank_size [bank]); g_assert (! is_global_freg (hreg)); rs->vassign [reg] = hreg; rs->symbolic [bank] [hreg] = reg; rs->free_mask [bank] &= ~ (regmask (hreg)); mirrored_bank = get_mirrored_bank (bank); if (mirrored_bank == -1) return; /* Make sure the other logical reg bank that this bank shares * a single hard reg bank knows that this hard reg is not free. */ rs->free_mask [mirrored_bank] = rs->free_mask [bank]; /* Mark the other logical bank that the this bank shares * a single hard reg bank with as mirrored. */ rs->symbolic [mirrored_bank] [hreg] = MONO_ARCH_BANK_MIRRORED; } else { g_assert (reg >= MONO_MAX_IREGS); g_assert (hreg < MONO_MAX_IREGS); #if !defined(TARGET_ARM) && !defined(TARGET_ARM64) /* this seems to trigger a gcc compilation bug sometime (hreg is 0) */ /* On arm64, rgctx_reg is a global hreg, and it is used to pass an argument */ g_assert (! is_global_ireg (hreg)); #endif rs->vassign [reg] = hreg; rs->isymbolic [hreg] = reg; rs->ifree_mask &= ~ (regmask (hreg)); } } static regmask_t get_callee_mask (const char spec) { if (G_UNLIKELY (reg_bank (spec))) return regbank_callee_regs [reg_bank (spec)]; return MONO_ARCH_CALLEE_REGS; } static gint8 desc_to_fixed_reg [256]; static gboolean desc_to_fixed_reg_inited = FALSE; /* * Local register allocation. * We first scan the list of instructions and we save the liveness info of * each register (when the register is first used, when it's value is set etc.). * We also reverse the list of instructions because assigning registers backwards allows * for more tricks to be used. */ void mono_local_regalloc (MonoCompile *cfg, MonoBasicBlock *bb) { MonoInst *ins, *prev, *last; MonoInst **tmp; MonoRegState *rs = cfg->rs; int i, j, val, max; RegTrack *reginfo; const char *spec; unsigned char spec_src1, spec_dest; int bank = 0; #if MONO_ARCH_USE_FPSTACK gboolean has_fp = FALSE; int fpstack [8]; int sp = 0; #endif int num_sregs = 0; int sregs [MONO_MAX_SRC_REGS]; if (!bb->code) return; if (!desc_to_fixed_reg_inited) { for (i = 0; i < 256; ++i) desc_to_fixed_reg [i] = MONO_ARCH_INST_FIXED_REG (i); desc_to_fixed_reg_inited = TRUE; /* Validate the cpu description against the info in mini-ops.h */ #if defined(TARGET_AMD64) || defined(TARGET_X86) || defined(TARGET_ARM) || defined(TARGET_ARM64) || defined (TARGET_RISCV) /* Check that the table size is correct */ g_assert (MONO_ARCH_CPU_SPEC_IDX(MONO_ARCH_CPU_SPEC)[OP_LAST - OP_LOAD] == 0xffff); for (i = OP_LOAD; i < OP_LAST; ++i) { const char *ispec; spec = ins_get_spec (i); ispec = INS_INFO (i); if ((spec [MONO_INST_DEST] && (ispec [MONO_INST_DEST] == ' '))) g_error ("Instruction metadata for %s inconsistent.\n", mono_inst_name (i)); if ((spec [MONO_INST_SRC1] && (ispec [MONO_INST_SRC1] == ' '))) g_error ("Instruction metadata for %s inconsistent.\n", mono_inst_name (i)); if ((spec [MONO_INST_SRC2] && (ispec [MONO_INST_SRC2] == ' '))) g_error ("Instruction metadata for %s inconsistent.\n", mono_inst_name (i)); } #endif } rs->next_vreg = bb->max_vreg; mono_regstate_assign (rs); rs->ifree_mask = MONO_ARCH_CALLEE_REGS; for (i = 0; i < MONO_NUM_REGBANKS; ++i) rs->free_mask [i] = regbank_callee_regs [i]; max = rs->next_vreg; if (cfg->reginfo && cfg->reginfo_len < max) cfg->reginfo = NULL; reginfo = (RegTrack *)cfg->reginfo; if (!reginfo) { cfg->reginfo_len = MAX (1024, max * 2); reginfo = (RegTrack *)mono_mempool_alloc (cfg->mempool, sizeof (RegTrack) * cfg->reginfo_len); cfg->reginfo = reginfo; } else g_assert (cfg->reginfo_len >= rs->next_vreg); if (cfg->verbose_level > 1) { /* print_regtrack reads the info of all variables */ memset (cfg->reginfo, 0, cfg->reginfo_len * sizeof (RegTrack)); } /* * For large methods, next_vreg can be very large, so g_malloc0 time can * be prohibitive. So we manually init the reginfo entries used by the * bblock. */ for (ins = bb->code; ins; ins = ins->next) { gboolean modify = FALSE; spec = ins_get_spec (ins->opcode); if ((ins->dreg != -1) && (ins->dreg < max)) { memset (&reginfo [ins->dreg], 0, sizeof (RegTrack)); #if SIZEOF_REGISTER == 4 if (MONO_ARCH_INST_IS_REGPAIR (spec [MONO_INST_DEST])) { /** * In the new IR, the two vregs of the regpair do not alias the * original long vreg. shift the vreg here so the rest of the * allocator doesn't have to care about it. */ ins->dreg ++; memset (&reginfo [ins->dreg + 1], 0, sizeof (RegTrack)); } #endif } num_sregs = mono_inst_get_src_registers (ins, sregs); for (j = 0; j < num_sregs; ++j) { g_assert (sregs [j] != -1); if (sregs [j] < max) { memset (&reginfo [sregs [j]], 0, sizeof (RegTrack)); #if SIZEOF_REGISTER == 4 if (MONO_ARCH_INST_IS_REGPAIR (spec [MONO_INST_SRC1 + j])) { sregs [j]++; modify = TRUE; memset (&reginfo [sregs [j] + 1], 0, sizeof (RegTrack)); } #endif } } if (modify) mono_inst_set_src_registers (ins, sregs); } /*if (cfg->opt & MONO_OPT_COPYPROP) local_copy_prop (cfg, ins);*/ i = 1; DEBUG (printf ("\nLOCAL REGALLOC BLOCK %d:\n", bb->block_num)); /* forward pass on the instructions to collect register liveness info */ MONO_BB_FOR_EACH_INS (bb, ins) { spec = ins_get_spec (ins->opcode); spec_dest = spec [MONO_INST_DEST]; if (G_UNLIKELY (spec == (gpointer)/*FIXME*/MONO_ARCH_CPU_SPEC)) { g_error ("Opcode '%s' missing from machine description file.", mono_inst_name (ins->opcode)); } DEBUG (mono_print_ins_index (i, ins)); num_sregs = mono_inst_get_src_registers (ins, sregs); #if MONO_ARCH_USE_FPSTACK if (dreg_is_fp (spec)) { has_fp = TRUE; } else { for (j = 0; j < num_sregs; ++j) { if (sreg_is_fp (j, spec)) has_fp = TRUE; } } #endif for (j = 0; j < num_sregs; ++j) { int sreg = sregs [j]; int sreg_spec = spec [MONO_INST_SRC1 + j]; if (sreg_spec) { bank = sreg_bank (j, spec); g_assert (sreg != -1); if (is_soft_reg (sreg, bank)) /* This means the vreg is not local to this bb */ g_assert (reginfo [sreg].born_in > 0); rs->vassign [sreg] = -1; //reginfo [ins->sreg2].prev_use = reginfo [ins->sreg2].last_use; //reginfo [ins->sreg2].last_use = i; if (MONO_ARCH_INST_IS_REGPAIR (sreg_spec)) { /* The virtual register is allocated sequentially */ rs->vassign [sreg + 1] = -1; //reginfo [ins->sreg2 + 1].prev_use = reginfo [ins->sreg2 + 1].last_use; //reginfo [ins->sreg2 + 1].last_use = i; if (reginfo [sreg + 1].born_in == 0 || reginfo [sreg + 1].born_in > i) reginfo [sreg + 1].born_in = i; } } else { sregs [j] = -1; } } mono_inst_set_src_registers (ins, sregs); if (spec_dest) { int dest_dreg; bank = dreg_bank (spec); if (spec_dest != 'b') /* it's not just a base register */ reginfo [ins->dreg].killed_in = i; g_assert (ins->dreg != -1); rs->vassign [ins->dreg] = -1; //reginfo [ins->dreg].prev_use = reginfo [ins->dreg].last_use; //reginfo [ins->dreg].last_use = i; if (reginfo [ins->dreg].born_in == 0 || reginfo [ins->dreg].born_in > i) reginfo [ins->dreg].born_in = i; dest_dreg = desc_to_fixed_reg [spec_dest]; if (dest_dreg != -1) reginfo [ins->dreg].preferred_mask = (regmask (dest_dreg)); #ifdef MONO_ARCH_INST_FIXED_MASK reginfo [ins->dreg].preferred_mask |= MONO_ARCH_INST_FIXED_MASK (spec_dest); #endif if (MONO_ARCH_INST_IS_REGPAIR (spec_dest)) { /* The virtual register is allocated sequentially */ rs->vassign [ins->dreg + 1] = -1; //reginfo [ins->dreg + 1].prev_use = reginfo [ins->dreg + 1].last_use; //reginfo [ins->dreg + 1].last_use = i; if (reginfo [ins->dreg + 1].born_in == 0 || reginfo [ins->dreg + 1].born_in > i) reginfo [ins->dreg + 1].born_in = i; if (MONO_ARCH_INST_REGPAIR_REG2 (spec_dest, -1) != -1) reginfo [ins->dreg + 1].preferred_mask = regpair_reg2_mask (spec_dest, -1); } } else { ins->dreg = -1; } ++i; } tmp = &last; DEBUG (print_regtrack (reginfo, rs->next_vreg)); MONO_BB_FOR_EACH_INS_REVERSE_SAFE (bb, prev, ins) { int prev_dreg; int dest_dreg, clob_reg; int dest_sregs [MONO_MAX_SRC_REGS], prev_sregs [MONO_MAX_SRC_REGS]; int dreg_high, sreg1_high; regmask_t dreg_mask, mask; regmask_t sreg_masks [MONO_MAX_SRC_REGS], sreg_fixed_masks [MONO_MAX_SRC_REGS]; regmask_t dreg_fixed_mask; const unsigned char *ip; --i; spec = ins_get_spec (ins->opcode); spec_src1 = spec [MONO_INST_SRC1]; spec_dest = spec [MONO_INST_DEST]; prev_dreg = -1; clob_reg = -1; dest_dreg = -1; dreg_high = -1; sreg1_high = -1; dreg_mask = get_callee_mask (spec_dest); for (j = 0; j < MONO_MAX_SRC_REGS; ++j) { prev_sregs [j] = -1; sreg_masks [j] = get_callee_mask (spec [MONO_INST_SRC1 + j]); dest_sregs [j] = desc_to_fixed_reg [(int)spec [MONO_INST_SRC1 + j]]; #ifdef MONO_ARCH_INST_FIXED_MASK sreg_fixed_masks [j] = MONO_ARCH_INST_FIXED_MASK (spec [MONO_INST_SRC1 + j]); #else sreg_fixed_masks [j] = 0; #endif } DEBUG (printf ("processing:")); DEBUG (mono_print_ins_index (i, ins)); ip = ins->cil_code; last = ins; /* * FIXED REGS */ dest_dreg = desc_to_fixed_reg [spec_dest]; clob_reg = desc_to_fixed_reg [(int)spec [MONO_INST_CLOB]]; sreg_masks [1] &= ~ (MONO_ARCH_INST_SREG2_MASK (spec)); #ifdef MONO_ARCH_INST_FIXED_MASK dreg_fixed_mask = MONO_ARCH_INST_FIXED_MASK (spec_dest); #else dreg_fixed_mask = 0; #endif num_sregs = mono_inst_get_src_registers (ins, sregs); /* * TRACK FIXED SREG2, 3, ... */ for (j = 1; j < num_sregs; ++j) { int sreg = sregs [j]; int dest_sreg = dest_sregs [j]; if (dest_sreg == -1) continue; if (j == 2) { int k; /* * CAS. * We need to special case this, since on x86, there are only 3 * free registers, and the code below assigns one of them to * sreg, so we can run out of registers when trying to assign * dreg. Instead, we just set up the register masks, and let the * normal sreg2 assignment code handle this. It would be nice to * do this for all the fixed reg cases too, but there is too much * risk of breakage. */ /* Make sure sreg will be assigned to dest_sreg, and the other sregs won't */ sreg_masks [j] = regmask (dest_sreg); for (k = 0; k < num_sregs; ++k) { if (k != j) sreg_masks [k] &= ~ (regmask (dest_sreg)); } /* * Spill sreg1/2 if they are assigned to dest_sreg. */ for (k = 0; k < num_sregs; ++k) { if (k != j && is_soft_reg (sregs [k], 0) && rs->vassign [sregs [k]] == dest_sreg) free_up_hreg (cfg, bb, tmp, ins, dest_sreg, 0); } /* * We can also run out of registers while processing sreg2 if sreg3 is * assigned to another hreg, so spill sreg3 now. */ if (is_soft_reg (sreg, 0) && rs->vassign [sreg] >= 0 && rs->vassign [sreg] != dest_sreg) { spill_vreg (cfg, bb, tmp, ins, sreg, 0); } continue; } gboolean need_assign = FALSE; if (rs->ifree_mask & (regmask (dest_sreg))) { if (is_global_ireg (sreg)) { int k; /* Argument already in hard reg, need to copy */ MonoInst *copy = create_copy_ins (cfg, bb, tmp, dest_sreg, sreg, NULL, ip, 0); insert_before_ins (bb, ins, copy); for (k = 0; k < num_sregs; ++k) { if (k != j) sreg_masks [k] &= ~ (regmask (dest_sreg)); } /* See below */ dreg_mask &= ~ (regmask (dest_sreg)); } else { val = rs->vassign [sreg]; if (val == -1) { DEBUG (printf ("\tshortcut assignment of R%d to %s\n", sreg, mono_arch_regname (dest_sreg))); assign_reg (cfg, rs, sreg, dest_sreg, 0); } else if (val < -1) { /* sreg is spilled, it can be assigned to dest_sreg */ need_assign = TRUE; } else { /* Argument already in hard reg, need to copy */ MonoInst *copy = create_copy_ins (cfg, bb, tmp, dest_sreg, val, NULL, ip, 0); int k; insert_before_ins (bb, ins, copy); for (k = 0; k < num_sregs; ++k) { if (k != j) sreg_masks [k] &= ~ (regmask (dest_sreg)); } /* * Prevent the dreg from being allocated to dest_sreg * too, since it could force sreg1 to be allocated to * the same reg on x86. */ dreg_mask &= ~ (regmask (dest_sreg)); } } } else { gboolean need_spill = TRUE; int k; need_assign = TRUE; dreg_mask &= ~ (regmask (dest_sreg)); for (k = 0; k < num_sregs; ++k) { if (k != j) sreg_masks [k] &= ~ (regmask (dest_sreg)); } /* * First check if dreg is assigned to dest_sreg2, since we * can't spill a dreg. */ if (spec [MONO_INST_DEST]) val = rs->vassign [ins->dreg]; else val = -1; if (val == dest_sreg && ins->dreg != sreg) { /* * the destination register is already assigned to * dest_sreg2: we need to allocate another register for it * and then copy from this to dest_sreg2. */ int new_dest; new_dest = alloc_int_reg (cfg, bb, tmp, ins, dreg_mask, ins->dreg, &reginfo [ins->dreg]); g_assert (new_dest >= 0); DEBUG (printf ("\tchanging dreg R%d to %s from %s\n", ins->dreg, mono_arch_regname (new_dest), mono_arch_regname (dest_sreg))); prev_dreg = ins->dreg; assign_reg (cfg, rs, ins->dreg, new_dest, 0); create_copy_ins (cfg, bb, tmp, dest_sreg, new_dest, ins, ip, 0); mono_regstate_free_int (rs, dest_sreg); need_spill = FALSE; } if (is_global_ireg (sreg)) { MonoInst *copy = create_copy_ins (cfg, bb, tmp, dest_sreg, sreg, NULL, ip, 0); insert_before_ins (bb, ins, copy); need_assign = FALSE; } else { val = rs->vassign [sreg]; if (val == dest_sreg) { /* sreg2 is already assigned to the correct register */ need_spill = FALSE; } else if (val < -1) { /* sreg2 is spilled, it can be assigned to dest_sreg2 */ } else if (val >= 0) { /* sreg2 already assigned to another register */ /* * We couldn't emit a copy from val to dest_sreg2, because * val might be spilled later while processing this * instruction. So we spill sreg2 so it can be allocated to * dest_sreg2. */ free_up_hreg (cfg, bb, tmp, ins, val, 0); } } if (need_spill) { free_up_hreg (cfg, bb, tmp, ins, dest_sreg, 0); } } if (need_assign) { if (rs->vassign [sreg] < -1) { int spill; /* Need to emit a spill store */ spill = - rs->vassign [sreg] - 1; create_spilled_store (cfg, bb, spill, dest_sreg, sreg, tmp, NULL, ins, bank); } /* force-set sreg */ assign_reg (cfg, rs, sregs [j], dest_sreg, 0); } sregs [j] = dest_sreg; } mono_inst_set_src_registers (ins, sregs); /* * TRACK DREG */ bank = dreg_bank (spec); if (spec_dest && is_soft_reg (ins->dreg, bank)) { prev_dreg = ins->dreg; } if (spec_dest == 'b') { /* * The dest reg is read by the instruction, not written, so * avoid allocating sreg1/sreg2 to the same reg. */ if (dest_sregs [0] != -1) dreg_mask &= ~ (regmask (dest_sregs [0])); for (j = 1; j < num_sregs; ++j) { if (dest_sregs [j] != -1) dreg_mask &= ~ (regmask (dest_sregs [j])); } val = rs->vassign [ins->dreg]; if (is_soft_reg (ins->dreg, bank) && (val >= 0) && (!(regmask (val) & dreg_mask))) { /* DREG is already allocated to a register needed for sreg1 */ spill_vreg (cfg, bb, tmp, ins, ins->dreg, 0); } } /* * If dreg is a fixed regpair, free up both of the needed hregs to avoid * various complex situations. */ if (MONO_ARCH_INST_IS_REGPAIR (spec_dest)) { guint32 dreg2, dest_dreg2; g_assert (is_soft_reg (ins->dreg, bank)); if (dest_dreg != -1) { if (rs->vassign [ins->dreg] != dest_dreg) free_up_hreg (cfg, bb, tmp, ins, dest_dreg, 0); dreg2 = ins->dreg + 1; dest_dreg2 = MONO_ARCH_INST_REGPAIR_REG2 (spec_dest, dest_dreg); if (dest_dreg2 != -1) { if (rs->vassign [dreg2] != dest_dreg2) free_up_hreg (cfg, bb, tmp, ins, dest_dreg2, 0); } } } if (dreg_fixed_mask) { g_assert (!bank); if (is_global_ireg (ins->dreg)) { /* * The argument is already in a hard reg, but that reg is * not usable by this instruction, so allocate a new one. */ val = mono_regstate_alloc_int (rs, dreg_fixed_mask); if (val < 0) val = get_register_spilling (cfg, bb, tmp, ins, dreg_fixed_mask, -1, bank); mono_regstate_free_int (rs, val); dest_dreg = val; /* Fall through */ } else dreg_mask &= dreg_fixed_mask; } if (is_soft_reg (ins->dreg, bank)) { val = rs->vassign [ins->dreg]; if (val < 0) { int spill = 0; if (val < -1) { /* the register gets spilled after this inst */ spill = -val -1; } val = alloc_reg (cfg, bb, tmp, ins, dreg_mask, ins->dreg, &reginfo [ins->dreg], bank); assign_reg (cfg, rs, ins->dreg, val, bank); if (spill) create_spilled_store (cfg, bb, spill, val, prev_dreg, tmp, ins, NULL, bank); } DEBUG (printf ("\tassigned dreg %s to dest R%d\n", mono_regname_full (val, bank), ins->dreg)); ins->dreg = val; } /* Handle regpairs */ if (MONO_ARCH_INST_IS_REGPAIR (spec_dest)) { int reg2 = prev_dreg + 1; g_assert (!bank); g_assert (prev_dreg > -1); g_assert (!is_global_ireg (rs->vassign [prev_dreg])); mask = regpair_reg2_mask (spec_dest, rs->vassign [prev_dreg]); #ifdef TARGET_X86 /* bug #80489 */ mask &= ~regmask (X86_ECX); #endif val = rs->vassign [reg2]; if (val < 0) { int spill = 0; if (val < -1) { /* the register gets spilled after this inst */ spill = -val -1; } val = mono_regstate_alloc_int (rs, mask); if (val < 0) val = get_register_spilling (cfg, bb, tmp, ins, mask, reg2, bank); if (spill) create_spilled_store (cfg, bb, spill, val, reg2, tmp, ins, NULL, bank); } else { if (! (mask & (regmask (val)))) { val = mono_regstate_alloc_int (rs, mask); if (val < 0) val = get_register_spilling (cfg, bb, tmp, ins, mask, reg2, bank); /* Reallocate hreg to the correct register */ create_copy_ins (cfg, bb, tmp, rs->vassign [reg2], val, ins, ip, bank); mono_regstate_free_int (rs, rs->vassign [reg2]); } } DEBUG (printf ("\tassigned dreg-high %s to dest R%d\n", mono_arch_regname (val), reg2)); assign_reg (cfg, rs, reg2, val, bank); dreg_high = val; ins->backend.reg3 = val; if (reg_is_freeable (val, bank) && reg2 >= 0 && (reginfo [reg2].born_in >= i)) { DEBUG (printf ("\tfreeable %s (R%d)\n", mono_arch_regname (val), reg2)); mono_regstate_free_int (rs, val); } } if (prev_dreg >= 0 && is_soft_reg (prev_dreg, bank) && (spec_dest != 'b')) { /* * In theory, we could free up the hreg even if the vreg is alive, * but branches inside bblocks force us to assign the same hreg * to a vreg every time it is encountered. */ int dreg = rs->vassign [prev_dreg]; g_assert (dreg >= 0); DEBUG (printf ("\tfreeable %s (R%d) (born in %d)\n", mono_regname_full (dreg, bank), prev_dreg, reginfo [prev_dreg].born_in)); if (G_UNLIKELY (bank)) mono_regstate_free_general (rs, dreg, bank); else mono_regstate_free_int (rs, dreg); rs->vassign [prev_dreg] = -1; } if ((dest_dreg != -1) && (ins->dreg != dest_dreg)) { /* this instruction only outputs to dest_dreg, need to copy */ create_copy_ins (cfg, bb, tmp, ins->dreg, dest_dreg, ins, ip, bank); ins->dreg = dest_dreg; if (G_UNLIKELY (bank)) { /* the register we need to free up may be used in another logical regbank * so do a translate just in case. */ int translated_bank = translate_bank (cfg->rs, bank, dest_dreg); if (rs->symbolic [translated_bank] [dest_dreg] >= regbank_size [translated_bank]) free_up_hreg (cfg, bb, tmp, ins, dest_dreg, translated_bank); } else { if (rs->isymbolic [dest_dreg] >= MONO_MAX_IREGS) free_up_hreg (cfg, bb, tmp, ins, dest_dreg, bank); } } if (spec_dest == 'b') { /* * The dest reg is read by the instruction, not written, so * avoid allocating sreg1/sreg2 to the same reg. */ for (j = 0; j < num_sregs; ++j) if (!sreg_bank (j, spec)) sreg_masks [j] &= ~ (regmask (ins->dreg)); } /* * TRACK CLOBBERING */ if ((clob_reg != -1) && (!(rs->ifree_mask & (regmask (clob_reg))))) { DEBUG (printf ("\tforced spill of clobbered reg R%d\n", rs->isymbolic [clob_reg])); free_up_hreg (cfg, bb, tmp, ins, clob_reg, 0); } if (spec [MONO_INST_CLOB] == 'c') { int j, dreg, dreg2, cur_bank; regmask_t s; guint64 clob_mask; clob_mask = MONO_ARCH_CALLEE_REGS; if (rs->ifree_mask != MONO_ARCH_CALLEE_REGS) { /* * Need to avoid spilling the dreg since the dreg is not really * clobbered by the call. */ if ((prev_dreg != -1) && !reg_bank (spec_dest)) dreg = rs->vassign [prev_dreg]; else dreg = -1; if (MONO_ARCH_INST_IS_REGPAIR (spec_dest)) dreg2 = rs->vassign [prev_dreg + 1]; else dreg2 = -1; for (j = 0; j < MONO_MAX_IREGS; ++j) { s = regmask (j); if ((clob_mask & s) && !(rs->ifree_mask & s) && (j != ins->sreg1)) { if ((j != dreg) && (j != dreg2)) free_up_hreg (cfg, bb, tmp, ins, j, 0); else if (rs->isymbolic [j]) /* The hreg is assigned to the dreg of this instruction */ rs->vassign [rs->isymbolic [j]] = -1; mono_regstate_free_int (rs, j); } } } for (cur_bank = 1; cur_bank < MONO_NUM_REGBANKS; ++ cur_bank) { if (rs->free_mask [cur_bank] != regbank_callee_regs [cur_bank]) { clob_mask = regbank_callee_regs [cur_bank]; if ((prev_dreg != -1) && reg_bank (spec_dest)) dreg = rs->vassign [prev_dreg]; else dreg = -1; for (j = 0; j < regbank_size [cur_bank]; ++j) { /* we are looping though the banks in the outer loop * so, we don't need to deal with mirrored hregs * because we will get them in one of the other bank passes. */ if (is_hreg_mirrored (rs, cur_bank, j)) continue; s = regmask (j); if ((clob_mask & s) && !(rs->free_mask [cur_bank] & s)) { if (j != dreg) free_up_hreg (cfg, bb, tmp, ins, j, cur_bank); else if (rs->symbolic [cur_bank] [j]) /* The hreg is assigned to the dreg of this instruction */ rs->vassign [rs->symbolic [cur_bank] [j]] = -1; mono_regstate_free_general (rs, j, cur_bank); } } } } } /* * TRACK ARGUMENT REGS */ if (spec [MONO_INST_CLOB] == 'c' && MONO_IS_CALL (ins)) { MonoCallInst *call = (MonoCallInst*)ins; GSList *list; /* * This needs to be done before assigning sreg1, so sreg1 will * not be assigned one of the argument regs. */ /* * Assign all registers in call->out_reg_args to the proper * argument registers. */ list = call->out_ireg_args; if (list) { while (list) { guint32 regpair; int reg, hreg; regpair = (guint32)(gssize)(list->data); hreg = regpair >> 24; reg = regpair & 0xffffff; assign_reg (cfg, rs, reg, hreg, 0); sreg_masks [0] &= ~(regmask (hreg)); DEBUG (printf ("\tassigned arg reg %s to R%d\n", mono_arch_regname (hreg), reg)); list = g_slist_next (list); } } list = call->out_freg_args; if (list) { while (list) { guint32 regpair; int reg, hreg; regpair = (guint32)(gssize)(list->data); hreg = regpair >> 24; reg = regpair & 0xffffff; assign_reg (cfg, rs, reg, hreg, 1); DEBUG (printf ("\tassigned arg reg %s to R%d\n", mono_regname_full (hreg, 1), reg)); list = g_slist_next (list); } } } /* * TRACK SREG1 */ bank = sreg1_bank (spec); if (MONO_ARCH_INST_IS_REGPAIR (spec_dest) && (spec [MONO_INST_CLOB] == '1')) { int sreg1 = sregs [0]; int dest_sreg1 = dest_sregs [0]; g_assert (is_soft_reg (sreg1, bank)); /* To simplify things, we allocate the same regpair to sreg1 and dreg */ if (dest_sreg1 != -1) g_assert (dest_sreg1 == ins->dreg); val = mono_regstate_alloc_int (rs, regmask (ins->dreg)); g_assert (val >= 0); if (rs->vassign [sreg1] >= 0 && rs->vassign [sreg1] != val) // FIXME: g_assert_not_reached (); assign_reg (cfg, rs, sreg1, val, bank); DEBUG (printf ("\tassigned sreg1-low %s to R%d\n", mono_regname_full (val, bank), sreg1)); g_assert ((regmask (dreg_high)) & regpair_reg2_mask (spec_src1, ins->dreg)); val = mono_regstate_alloc_int (rs, regmask (dreg_high)); g_assert (val >= 0); if (rs->vassign [sreg1 + 1] >= 0 && rs->vassign [sreg1 + 1] != val) // FIXME: g_assert_not_reached (); assign_reg (cfg, rs, sreg1 + 1, val, bank); DEBUG (printf ("\tassigned sreg1-high %s to R%d\n", mono_regname_full (val, bank), sreg1 + 1)); /* Skip rest of this section */ dest_sregs [0] = -1; } if (sreg_fixed_masks [0]) { g_assert (!bank); if (is_global_ireg (sregs [0])) { /* * The argument is already in a hard reg, but that reg is * not usable by this instruction, so allocate a new one. */ val = mono_regstate_alloc_int (rs, sreg_fixed_masks [0]); if (val < 0) val = get_register_spilling (cfg, bb, tmp, ins, sreg_fixed_masks [0], -1, bank); mono_regstate_free_int (rs, val); dest_sregs [0] = val; /* Fall through to the dest_sreg1 != -1 case */ } else sreg_masks [0] &= sreg_fixed_masks [0]; } if (dest_sregs [0] != -1) { sreg_masks [0] = regmask (dest_sregs [0]); if ((rs->vassign [sregs [0]] != dest_sregs [0]) && !(rs->ifree_mask & (regmask (dest_sregs [0])))) { free_up_hreg (cfg, bb, tmp, ins, dest_sregs [0], 0); } if (is_global_ireg (sregs [0])) { /* The argument is already in a hard reg, need to copy */ MonoInst *copy = create_copy_ins (cfg, bb, tmp, dest_sregs [0], sregs [0], NULL, ip, 0); insert_before_ins (bb, ins, copy); sregs [0] = dest_sregs [0]; } } if (is_soft_reg (sregs [0], bank)) { val = rs->vassign [sregs [0]]; prev_sregs [0] = sregs [0]; if (val < 0) { int spill = 0; if (val < -1) { /* the register gets spilled after this inst */ spill = -val -1; } if ((ins->opcode == OP_MOVE) && !spill && !bank && is_local_ireg (ins->dreg) && (rs->ifree_mask & (regmask (ins->dreg)))) { /* * Allocate the same hreg to sreg1 as well so the * peephole can get rid of the move. */ sreg_masks [0] = regmask (ins->dreg); } if (spec [MONO_INST_CLOB] == '1' && !dreg_bank (spec) && (rs->ifree_mask & (regmask (ins->dreg)))) /* Allocate the same reg to sreg1 to avoid a copy later */ sreg_masks [0] = regmask (ins->dreg); val = alloc_reg (cfg, bb, tmp, ins, sreg_masks [0], sregs [0], &reginfo [sregs [0]], bank); assign_reg (cfg, rs, sregs [0], val, bank); DEBUG (printf ("\tassigned sreg1 %s to R%d\n", mono_regname_full (val, bank), sregs [0])); if (spill) { /* * Need to insert before the instruction since it can * overwrite sreg1. */ create_spilled_store (cfg, bb, spill, val, prev_sregs [0], tmp, NULL, ins, bank); } } else if ((dest_sregs [0] != -1) && (dest_sregs [0] != val)) { MonoInst *copy = create_copy_ins (cfg, bb, tmp, dest_sregs [0], val, NULL, ip, bank); insert_before_ins (bb, ins, copy); for (j = 1; j < num_sregs; ++j) sreg_masks [j] &= ~(regmask (dest_sregs [0])); val = dest_sregs [0]; } sregs [0] = val; } else { prev_sregs [0] = -1; } mono_inst_set_src_registers (ins, sregs); for (j = 1; j < num_sregs; ++j) sreg_masks [j] &= ~(regmask (sregs [0])); /* Handle the case when sreg1 is a regpair but dreg is not */ if (MONO_ARCH_INST_IS_REGPAIR (spec_src1) && (spec [MONO_INST_CLOB] != '1')) { int reg2 = prev_sregs [0] + 1; g_assert (!bank); g_assert (prev_sregs [0] > -1); g_assert (!is_global_ireg (rs->vassign [prev_sregs [0]])); mask = regpair_reg2_mask (spec_src1, rs->vassign [prev_sregs [0]]); val = rs->vassign [reg2]; if (val < 0) { int spill = 0; if (val < -1) { /* the register gets spilled after this inst */ spill = -val -1; } val = mono_regstate_alloc_int (rs, mask); if (val < 0) val = get_register_spilling (cfg, bb, tmp, ins, mask, reg2, bank); if (spill) g_assert_not_reached (); } else { if (! (mask & (regmask (val)))) { /* The vreg is already allocated to a wrong hreg */ /* FIXME: */ g_assert_not_reached (); #if 0 val = mono_regstate_alloc_int (rs, mask); if (val < 0) val = get_register_spilling (cfg, bb, tmp, ins, mask, reg2, bank); /* Reallocate hreg to the correct register */ create_copy_ins (cfg, bb, tmp, rs->vassign [reg2], val, ins, ip, bank); mono_regstate_free_int (rs, rs->vassign [reg2]); #endif } } sreg1_high = val; DEBUG (printf ("\tassigned sreg1 hreg %s to dest R%d\n", mono_arch_regname (val), reg2)); assign_reg (cfg, rs, reg2, val, bank); } /* Handle dreg==sreg1 */ if (((dreg_is_fp (spec) && sreg1_is_fp (spec)) || spec [MONO_INST_CLOB] == '1') && ins->dreg != sregs [0]) { MonoInst *sreg2_copy = NULL; MonoInst *copy; int bank = reg_bank (spec_src1); if (ins->dreg == sregs [1]) { /* * copying sreg1 to dreg could clobber sreg2, so allocate a new * register for it. */ int reg2 = alloc_reg (cfg, bb, tmp, ins, dreg_mask, sregs [1], NULL, bank); DEBUG (printf ("\tneed to copy sreg2 %s to reg %s\n", mono_regname_full (sregs [1], bank), mono_regname_full (reg2, bank))); sreg2_copy = create_copy_ins (cfg, bb, tmp, reg2, sregs [1], NULL, ip, bank); prev_sregs [1] = sregs [1] = reg2; if (G_UNLIKELY (bank)) mono_regstate_free_general (rs, reg2, bank); else mono_regstate_free_int (rs, reg2); } if (MONO_ARCH_INST_IS_REGPAIR (spec_src1)) { /* Copying sreg1_high to dreg could also clobber sreg2 */ if (rs->vassign [prev_sregs [0] + 1] == sregs [1]) /* FIXME: */ g_assert_not_reached (); /* * sreg1 and dest are already allocated to the same regpair by the * SREG1 allocation code. */ g_assert (sregs [0] == ins->dreg); g_assert (dreg_high == sreg1_high); } DEBUG (printf ("\tneed to copy sreg1 %s to dreg %s\n", mono_regname_full (sregs [0], bank), mono_regname_full (ins->dreg, bank))); copy = create_copy_ins (cfg, bb, tmp, ins->dreg, sregs [0], NULL, ip, bank); insert_before_ins (bb, ins, copy); if (sreg2_copy) insert_before_ins (bb, copy, sreg2_copy); /* * Need to prevent sreg2 to be allocated to sreg1, since that * would screw up the previous copy. */ sreg_masks [1] &= ~ (regmask (sregs [0])); /* we set sreg1 to dest as well */ prev_sregs [0] = sregs [0] = ins->dreg; sreg_masks [1] &= ~ (regmask (ins->dreg)); } mono_inst_set_src_registers (ins, sregs); /* * TRACK SREG2, 3, ... */ for (j = 1; j < num_sregs; ++j) { int k; bank = sreg_bank (j, spec); if (MONO_ARCH_INST_IS_REGPAIR (spec [MONO_INST_SRC1 + j])) g_assert_not_reached (); if (dest_sregs [j] != -1 && is_global_ireg (sregs [j])) { /* * Argument already in a global hard reg, copy it to the fixed reg, without * allocating it to the fixed reg. */ MonoInst *copy = create_copy_ins (cfg, bb, tmp, dest_sregs [j], sregs [j], NULL, ip, 0); insert_before_ins (bb, ins, copy); sregs [j] = dest_sregs [j]; } else if (is_soft_reg (sregs [j], bank)) { val = rs->vassign [sregs [j]]; if (dest_sregs [j] != -1 && val >= 0 && dest_sregs [j] != val) { /* * The sreg is already allocated to a hreg, but not to the fixed * reg required by the instruction. Spill the sreg, so it can be * allocated to the fixed reg by the code below. */ /* Currently, this code should only be hit for CAS */ spill_vreg (cfg, bb, tmp, ins, sregs [j], 0); val = rs->vassign [sregs [j]]; } if (val < 0) { int spill = 0; if (val < -1) { /* the register gets spilled after this inst */ spill = -val -1; } val = alloc_reg (cfg, bb, tmp, ins, sreg_masks [j], sregs [j], &reginfo [sregs [j]], bank); assign_reg (cfg, rs, sregs [j], val, bank); DEBUG (printf ("\tassigned sreg%d %s to R%d\n", j + 1, mono_regname_full (val, bank), sregs [j])); if (spill) { /* * Need to insert before the instruction since it can * overwrite sreg2. */ create_spilled_store (cfg, bb, spill, val, sregs [j], tmp, NULL, ins, bank); } } sregs [j] = val; for (k = j + 1; k < num_sregs; ++k) sreg_masks [k] &= ~ (regmask (sregs [j])); } else { prev_sregs [j] = -1; } } mono_inst_set_src_registers (ins, sregs); /* Sanity check */ /* Do this only for CAS for now */ for (j = 1; j < num_sregs; ++j) { int sreg = sregs [j]; int dest_sreg = dest_sregs [j]; if (j == 2 && dest_sreg != -1) { int k; g_assert (sreg == dest_sreg); for (k = 0; k < num_sregs; ++k) { if (k != j) g_assert (sregs [k] != dest_sreg); } } } /*if (reg_is_freeable (ins->sreg1) && prev_sreg1 >= 0 && reginfo [prev_sreg1].born_in >= i) { DEBUG (printf ("freeable %s\n", mono_arch_regname (ins->sreg1))); mono_regstate_free_int (rs, ins->sreg1); } if (reg_is_freeable (ins->sreg2) && prev_sreg2 >= 0 && reginfo [prev_sreg2].born_in >= i) { DEBUG (printf ("freeable %s\n", mono_arch_regname (ins->sreg2))); mono_regstate_free_int (rs, ins->sreg2); }*/ DEBUG (mono_print_ins_index (i, ins)); } // FIXME: Set MAX_FREGS to 8 // FIXME: Optimize generated code #if MONO_ARCH_USE_FPSTACK /* * Make a forward pass over the code, simulating the fp stack, making sure the * arguments required by the fp opcodes are at the top of the stack. */ if (has_fp) { MonoInst *prev = NULL; MonoInst *fxch; int tmp; g_assert (num_sregs <= 2); for (ins = bb->code; ins; ins = ins->next) { spec = ins_get_spec (ins->opcode); DEBUG (printf ("processing:")); DEBUG (mono_print_ins_index (0, ins)); if (ins->opcode == OP_FMOVE) { /* Do it by renaming the source to the destination on the stack */ // FIXME: Is this correct ? for (i = 0; i < sp; ++i) if (fpstack [i] == ins->sreg1) fpstack [i] = ins->dreg; prev = ins; continue; } if (sreg1_is_fp (spec) && sreg2_is_fp (spec) && (fpstack [sp - 2] != ins->sreg1)) { /* Arg1 must be in %st(1) */ g_assert (prev); i = 0; while ((i < sp) && (fpstack [i] != ins->sreg1)) i ++; g_assert (i < sp); if (sp - 1 - i > 0) { /* First move it to %st(0) */ DEBUG (printf ("\tswap %%st(0) and %%st(%d)\n", sp - 1 - i)); MONO_INST_NEW (cfg, fxch, OP_X86_FXCH); fxch->inst_imm = sp - 1 - i; mono_bblock_insert_after_ins (bb, prev, fxch); prev = fxch; tmp = fpstack [sp - 1]; fpstack [sp - 1] = fpstack [i]; fpstack [i] = tmp; } /* Then move it to %st(1) */ DEBUG (printf ("\tswap %%st(0) and %%st(1)\n")); MONO_INST_NEW (cfg, fxch, OP_X86_FXCH); fxch->inst_imm = 1; mono_bblock_insert_after_ins (bb, prev, fxch); prev = fxch; tmp = fpstack [sp - 1]; fpstack [sp - 1] = fpstack [sp - 2]; fpstack [sp - 2] = tmp; } if (sreg2_is_fp (spec)) { g_assert (sp > 0); if (fpstack [sp - 1] != ins->sreg2) { g_assert (prev); i = 0; while ((i < sp) && (fpstack [i] != ins->sreg2)) i ++; g_assert (i < sp); DEBUG (printf ("\tswap %%st(0) and %%st(%d)\n", sp - 1 - i)); MONO_INST_NEW (cfg, fxch, OP_X86_FXCH); fxch->inst_imm = sp - 1 - i; mono_bblock_insert_after_ins (bb, prev, fxch); prev = fxch; tmp = fpstack [sp - 1]; fpstack [sp - 1] = fpstack [i]; fpstack [i] = tmp; } sp --; } if (sreg1_is_fp (spec)) { g_assert (sp > 0); if (fpstack [sp - 1] != ins->sreg1) { g_assert (prev); i = 0; while ((i < sp) && (fpstack [i] != ins->sreg1)) i ++; g_assert (i < sp); DEBUG (printf ("\tswap %%st(0) and %%st(%d)\n", sp - 1 - i)); MONO_INST_NEW (cfg, fxch, OP_X86_FXCH); fxch->inst_imm = sp - 1 - i; mono_bblock_insert_after_ins (bb, prev, fxch); prev = fxch; tmp = fpstack [sp - 1]; fpstack [sp - 1] = fpstack [i]; fpstack [i] = tmp; } sp --; } if (dreg_is_fp (spec)) { g_assert (sp < 8); fpstack [sp ++] = ins->dreg; } if (G_UNLIKELY (cfg->verbose_level >= 2)) { printf ("\t["); for (i = 0; i < sp; ++i) printf ("%s%%fr%d", (i > 0) ? ", " : "", fpstack [i]); printf ("]\n"); } prev = ins; } if (sp && bb != cfg->bb_exit && !(bb->out_count == 1 && bb->out_bb [0] == cfg->bb_exit)) { /* Remove remaining items from the fp stack */ /* * These can remain for example as a result of a dead fmove like in * System.Collections.Generic.EqualityComparer<double>.Equals (). */ while (sp) { MONO_INST_NEW (cfg, ins, OP_X86_FPOP); mono_add_ins_to_end (bb, ins); sp --; } } } #endif } CompRelation mono_opcode_to_cond (int opcode) { switch (opcode) { case OP_CEQ: case OP_IBEQ: case OP_ICEQ: case OP_LBEQ: case OP_LCEQ: case OP_FBEQ: case OP_FCEQ: case OP_RBEQ: case OP_RCEQ: case OP_COND_EXC_EQ: case OP_COND_EXC_IEQ: case OP_CMOV_IEQ: case OP_CMOV_LEQ: return CMP_EQ; case OP_FCNEQ: case OP_RCNEQ: case OP_ICNEQ: case OP_IBNE_UN: case OP_LBNE_UN: case OP_FBNE_UN: case OP_COND_EXC_NE_UN: case OP_COND_EXC_INE_UN: case OP_CMOV_INE_UN: case OP_CMOV_LNE_UN: return CMP_NE; case OP_FCLE: case OP_ICLE: case OP_IBLE: case OP_LBLE: case OP_FBLE: case OP_CMOV_ILE: case OP_CMOV_LLE: return CMP_LE; case OP_FCGE: case OP_ICGE: case OP_IBGE: case OP_LBGE: case OP_FBGE: case OP_CMOV_IGE: case OP_CMOV_LGE: return CMP_GE; case OP_CLT: case OP_IBLT: case OP_ICLT: case OP_LBLT: case OP_LCLT: case OP_FBLT: case OP_FCLT: case OP_RBLT: case OP_RCLT: case OP_COND_EXC_LT: case OP_COND_EXC_ILT: case OP_CMOV_ILT: case OP_CMOV_LLT: return CMP_LT; case OP_CGT: case OP_IBGT: case OP_ICGT: case OP_LBGT: case OP_LCGT: case OP_FBGT: case OP_FCGT: case OP_RBGT: case OP_RCGT: case OP_COND_EXC_GT: case OP_COND_EXC_IGT: case OP_CMOV_IGT: case OP_CMOV_LGT: return CMP_GT; case OP_ICLE_UN: case OP_IBLE_UN: case OP_LBLE_UN: case OP_FBLE_UN: case OP_COND_EXC_LE_UN: case OP_COND_EXC_ILE_UN: case OP_CMOV_ILE_UN: case OP_CMOV_LLE_UN: return CMP_LE_UN; case OP_ICGE_UN: case OP_IBGE_UN: case OP_LBGE_UN: case OP_FBGE_UN: case OP_COND_EXC_GE_UN: case OP_CMOV_IGE_UN: case OP_CMOV_LGE_UN: return CMP_GE_UN; case OP_CLT_UN: case OP_IBLT_UN: case OP_ICLT_UN: case OP_LBLT_UN: case OP_LCLT_UN: case OP_FBLT_UN: case OP_FCLT_UN: case OP_RBLT_UN: case OP_RCLT_UN: case OP_COND_EXC_LT_UN: case OP_COND_EXC_ILT_UN: case OP_CMOV_ILT_UN: case OP_CMOV_LLT_UN: return CMP_LT_UN; case OP_CGT_UN: case OP_IBGT_UN: case OP_ICGT_UN: case OP_LBGT_UN: case OP_LCGT_UN: case OP_FCGT_UN: case OP_FBGT_UN: case OP_RCGT_UN: case OP_RBGT_UN: case OP_COND_EXC_GT_UN: case OP_COND_EXC_IGT_UN: case OP_CMOV_IGT_UN: case OP_CMOV_LGT_UN: return CMP_GT_UN; default: printf ("%s\n", mono_inst_name (opcode)); g_assert_not_reached (); return (CompRelation)0; } } CompRelation mono_negate_cond (CompRelation cond) { switch (cond) { case CMP_EQ: return CMP_NE; case CMP_NE: return CMP_EQ; case CMP_LE: return CMP_GT; case CMP_GE: return CMP_LT; case CMP_LT: return CMP_GE; case CMP_GT: return CMP_LE; case CMP_LE_UN: return CMP_GT_UN; case CMP_GE_UN: return CMP_LT_UN; case CMP_LT_UN: return CMP_GE_UN; case CMP_GT_UN: return CMP_LE_UN; default: g_assert_not_reached (); } } CompType mono_opcode_to_type (int opcode, int cmp_opcode) { if ((opcode >= OP_CEQ) && (opcode <= OP_CLT_UN)) return CMP_TYPE_L; else if ((opcode >= OP_IBEQ) && (opcode <= OP_IBLT_UN)) return CMP_TYPE_I; else if ((opcode >= OP_ICEQ) && (opcode <= OP_ICLT_UN)) return CMP_TYPE_I; else if ((opcode >= OP_LBEQ) && (opcode <= OP_LBLT_UN)) return CMP_TYPE_L; else if ((opcode >= OP_LCEQ) && (opcode <= OP_LCLT_UN)) return CMP_TYPE_L; else if ((opcode >= OP_FBEQ) && (opcode <= OP_FBLT_UN)) return CMP_TYPE_F; else if ((opcode >= OP_FCEQ) && (opcode <= OP_FCLT_UN)) return CMP_TYPE_F; else if ((opcode >= OP_COND_EXC_IEQ) && (opcode <= OP_COND_EXC_ILT_UN)) return CMP_TYPE_I; else if ((opcode >= OP_COND_EXC_EQ) && (opcode <= OP_COND_EXC_LT_UN)) { switch (cmp_opcode) { case OP_ICOMPARE: case OP_ICOMPARE_IMM: return CMP_TYPE_I; default: return CMP_TYPE_L; } } else { g_error ("Unknown opcode '%s' in opcode_to_type", mono_inst_name (opcode)); return (CompType)0; } } /* * mono_peephole_ins: * * Perform some architecture independent peephole optimizations. */ void mono_peephole_ins (MonoBasicBlock *bb, MonoInst *ins) { int filter = FILTER_IL_SEQ_POINT; MonoInst *last_ins = mono_inst_prev (ins, filter); switch (ins->opcode) { case OP_MUL_IMM: /* remove unnecessary multiplication with 1 */ if (ins->inst_imm == 1) { if (ins->dreg != ins->sreg1) ins->opcode = OP_MOVE; else MONO_DELETE_INS (bb, ins); } break; case OP_LOAD_MEMBASE: case OP_LOADI4_MEMBASE: /* * Note: if reg1 = reg2 the load op is removed * * OP_STORE_MEMBASE_REG reg1, offset(basereg) * OP_LOAD_MEMBASE offset(basereg), reg2 * --> * OP_STORE_MEMBASE_REG reg1, offset(basereg) * OP_MOVE reg1, reg2 */ if (last_ins && last_ins->opcode == OP_GC_LIVENESS_DEF) last_ins = mono_inst_prev (ins, filter); if (last_ins && (((ins->opcode == OP_LOADI4_MEMBASE) && (last_ins->opcode == OP_STOREI4_MEMBASE_REG)) || ((ins->opcode == OP_LOAD_MEMBASE) && (last_ins->opcode == OP_STORE_MEMBASE_REG))) && ins->inst_basereg == last_ins->inst_destbasereg && ins->inst_offset == last_ins->inst_offset) { if (ins->dreg == last_ins->sreg1) { MONO_DELETE_INS (bb, ins); break; } else { ins->opcode = OP_MOVE; ins->sreg1 = last_ins->sreg1; } /* * Note: reg1 must be different from the basereg in the second load * Note: if reg1 = reg2 is equal then second load is removed * * OP_LOAD_MEMBASE offset(basereg), reg1 * OP_LOAD_MEMBASE offset(basereg), reg2 * --> * OP_LOAD_MEMBASE offset(basereg), reg1 * OP_MOVE reg1, reg2 */ } if (last_ins && (last_ins->opcode == OP_LOADI4_MEMBASE || last_ins->opcode == OP_LOAD_MEMBASE) && ins->inst_basereg != last_ins->dreg && ins->inst_basereg == last_ins->inst_basereg && ins->inst_offset == last_ins->inst_offset) { if (ins->dreg == last_ins->dreg) { MONO_DELETE_INS (bb, ins); } else { ins->opcode = OP_MOVE; ins->sreg1 = last_ins->dreg; } //g_assert_not_reached (); #if 0 /* * OP_STORE_MEMBASE_IMM imm, offset(basereg) * OP_LOAD_MEMBASE offset(basereg), reg * --> * OP_STORE_MEMBASE_IMM imm, offset(basereg) * OP_ICONST reg, imm */ } else if (last_ins && (last_ins->opcode == OP_STOREI4_MEMBASE_IMM || last_ins->opcode == OP_STORE_MEMBASE_IMM) && ins->inst_basereg == last_ins->inst_destbasereg && ins->inst_offset == last_ins->inst_offset) { ins->opcode = OP_ICONST; ins->inst_c0 = last_ins->inst_imm; g_assert_not_reached (); // check this rule #endif } break; case OP_LOADI1_MEMBASE: case OP_LOADU1_MEMBASE: /* * Note: if reg1 = reg2 the load op is removed * * OP_STORE_MEMBASE_REG reg1, offset(basereg) * OP_LOAD_MEMBASE offset(basereg), reg2 * --> * OP_STORE_MEMBASE_REG reg1, offset(basereg) * OP_MOVE reg1, reg2 */ if (last_ins && (last_ins->opcode == OP_STOREI1_MEMBASE_REG) && ins->inst_basereg == last_ins->inst_destbasereg && ins->inst_offset == last_ins->inst_offset) { ins->opcode = (ins->opcode == OP_LOADI1_MEMBASE) ? OP_PCONV_TO_I1 : OP_PCONV_TO_U1; ins->sreg1 = last_ins->sreg1; } break; case OP_LOADI2_MEMBASE: case OP_LOADU2_MEMBASE: /* * Note: if reg1 = reg2 the load op is removed * * OP_STORE_MEMBASE_REG reg1, offset(basereg) * OP_LOAD_MEMBASE offset(basereg), reg2 * --> * OP_STORE_MEMBASE_REG reg1, offset(basereg) * OP_MOVE reg1, reg2 */ if (last_ins && (last_ins->opcode == OP_STOREI2_MEMBASE_REG) && ins->inst_basereg == last_ins->inst_destbasereg && ins->inst_offset == last_ins->inst_offset) { #if SIZEOF_REGISTER == 8 ins->opcode = (ins->opcode == OP_LOADI2_MEMBASE) ? OP_PCONV_TO_I2 : OP_PCONV_TO_U2; #else /* The definition of OP_PCONV_TO_U2 is wrong */ ins->opcode = (ins->opcode == OP_LOADI2_MEMBASE) ? OP_PCONV_TO_I2 : OP_ICONV_TO_U2; #endif ins->sreg1 = last_ins->sreg1; } break; case OP_LOADX_MEMBASE: if (last_ins && last_ins->opcode == OP_STOREX_MEMBASE && ins->inst_basereg == last_ins->inst_destbasereg && ins->inst_offset == last_ins->inst_offset) { if (ins->dreg == last_ins->sreg1) { MONO_DELETE_INS (bb, ins); break; } else { ins->opcode = OP_XMOVE; ins->sreg1 = last_ins->sreg1; } } break; case OP_MOVE: case OP_FMOVE: /* * Removes: * * OP_MOVE reg, reg */ if (ins->dreg == ins->sreg1) { MONO_DELETE_INS (bb, ins); break; } /* * Removes: * * OP_MOVE sreg, dreg * OP_MOVE dreg, sreg */ if (last_ins && last_ins->opcode == ins->opcode && ins->sreg1 == last_ins->dreg && ins->dreg == last_ins->sreg1) { MONO_DELETE_INS (bb, ins); } break; case OP_NOP: MONO_DELETE_INS (bb, ins); break; } } int mini_exception_id_by_name (const char *name) { if (strcmp (name, "NullReferenceException") == 0) return MONO_EXC_NULL_REF; if (strcmp (name, "IndexOutOfRangeException") == 0) return MONO_EXC_INDEX_OUT_OF_RANGE; if (strcmp (name, "OverflowException") == 0) return MONO_EXC_OVERFLOW; if (strcmp (name, "ArithmeticException") == 0) return MONO_EXC_ARITHMETIC; if (strcmp (name, "DivideByZeroException") == 0) return MONO_EXC_DIVIDE_BY_ZERO; if (strcmp (name, "InvalidCastException") == 0) return MONO_EXC_INVALID_CAST; if (strcmp (name, "ArrayTypeMismatchException") == 0) return MONO_EXC_ARRAY_TYPE_MISMATCH; if (strcmp (name, "ArgumentException") == 0) return MONO_EXC_ARGUMENT; if (strcmp (name, "ArgumentOutOfRangeException") == 0) return MONO_EXC_ARGUMENT_OUT_OF_RANGE; if (strcmp (name, "OutOfMemoryException") == 0) return MONO_EXC_ARGUMENT_OUT_OF_MEMORY; g_error ("Unknown intrinsic exception %s\n", name); return -1; } gboolean mini_type_is_hfa (MonoType *t, int *out_nfields, int *out_esize) { MonoClass *klass; gpointer iter; MonoClassField *field; MonoType *ftype, *prev_ftype = NULL; int nfields = 0; klass = mono_class_from_mono_type_internal (t); iter = NULL; while ((field = mono_class_get_fields_internal (klass, &iter))) { if (field->type->attrs & FIELD_ATTRIBUTE_STATIC) continue; ftype = mono_field_get_type_internal (field); if (MONO_TYPE_ISSTRUCT (ftype)) { int nested_nfields, nested_esize; if (!mini_type_is_hfa (ftype, &nested_nfields, &nested_esize)) return FALSE; if (nested_esize == 4) ftype = m_class_get_byval_arg (mono_defaults.single_class); else ftype = m_class_get_byval_arg (mono_defaults.double_class); if (prev_ftype && prev_ftype->type != ftype->type) return FALSE; prev_ftype = ftype; nfields += nested_nfields; } else { if (!(!m_type_is_byref (ftype) && (ftype->type == MONO_TYPE_R4 || ftype->type == MONO_TYPE_R8))) return FALSE; if (prev_ftype && prev_ftype->type != ftype->type) return FALSE; prev_ftype = ftype; nfields ++; } } if (nfields == 0) return FALSE; *out_esize = prev_ftype->type == MONO_TYPE_R4 ? 4 : 8; *out_nfields = mono_class_value_size (klass, NULL) / *out_esize; return TRUE; } MonoRegState* mono_regstate_new (void) { MonoRegState* rs = g_new0 (MonoRegState, 1); rs->next_vreg = MAX (MONO_MAX_IREGS, MONO_MAX_FREGS); #ifdef MONO_ARCH_NEED_SIMD_BANK rs->next_vreg = MAX (rs->next_vreg, MONO_MAX_XREGS); #endif return rs; } void mono_regstate_free (MonoRegState *rs) { g_free (rs->vassign); g_free (rs); } #endif /* DISABLE_JIT */ gboolean mono_is_regsize_var (MonoType *t) { t = mini_get_underlying_type (t); switch (t->type) { case MONO_TYPE_I1: case MONO_TYPE_U1: case MONO_TYPE_I2: case MONO_TYPE_U2: case MONO_TYPE_I4: case MONO_TYPE_U4: case MONO_TYPE_I: case MONO_TYPE_U: case MONO_TYPE_PTR: case MONO_TYPE_FNPTR: #if SIZEOF_REGISTER == 8 case MONO_TYPE_I8: case MONO_TYPE_U8: #endif return TRUE; case MONO_TYPE_OBJECT: case MONO_TYPE_STRING: case MONO_TYPE_CLASS: case MONO_TYPE_SZARRAY: case MONO_TYPE_ARRAY: return TRUE; case MONO_TYPE_GENERICINST: if (!mono_type_generic_inst_is_valuetype (t)) return TRUE; return FALSE; case MONO_TYPE_VALUETYPE: return FALSE; default: return FALSE; } }
/** * \file * Arch independent code generation functionality * * (C) 2003 Ximian, Inc. */ #include "config.h" #include <string.h> #include <math.h> #ifdef HAVE_UNISTD_H #include <unistd.h> #endif #include <mono/metadata/appdomain.h> #include <mono/metadata/debug-helpers.h> #include <mono/metadata/threads.h> #include <mono/metadata/profiler-private.h> #include <mono/metadata/mempool-internals.h> #include <mono/utils/mono-math.h> #include "mini.h" #include "mini-runtime.h" #include "trace.h" #include "mini-arch.h" #ifndef DISABLE_JIT #ifndef MONO_MAX_XREGS #define MONO_MAX_XREGS 0 #define MONO_ARCH_CALLEE_SAVED_XREGS 0 #define MONO_ARCH_CALLEE_XREGS 0 #endif #define MONO_ARCH_BANK_MIRRORED -2 #ifdef MONO_ARCH_USE_SHARED_FP_SIMD_BANK #ifndef MONO_ARCH_NEED_SIMD_BANK #error "MONO_ARCH_USE_SHARED_FP_SIMD_BANK needs MONO_ARCH_NEED_SIMD_BANK to work" #endif #define get_mirrored_bank(bank) (((bank) == MONO_REG_SIMD ) ? MONO_REG_DOUBLE : (((bank) == MONO_REG_DOUBLE ) ? MONO_REG_SIMD : -1)) #define is_hreg_mirrored(rs, bank, hreg) ((rs)->symbolic [(bank)] [(hreg)] == MONO_ARCH_BANK_MIRRORED) #else #define get_mirrored_bank(bank) (-1) #define is_hreg_mirrored(rs, bank, hreg) (0) #endif #if _MSC_VER #pragma warning(disable:4293) // FIXME negative shift is undefined #endif /* If the bank is mirrored return the true logical bank that the register in the * physical register bank is allocated to. */ static int translate_bank (MonoRegState *rs, int bank, int hreg) { return is_hreg_mirrored (rs, bank, hreg) ? get_mirrored_bank (bank) : bank; } /* * Every hardware register belongs to a register type or register bank. bank 0 * contains the int registers, bank 1 contains the fp registers. * int registers are used 99% of the time, so they are special cased in a lot of * places. */ static const int regbank_size [] = { MONO_MAX_IREGS, MONO_MAX_FREGS, MONO_MAX_IREGS, MONO_MAX_IREGS, MONO_MAX_XREGS }; static const int regbank_load_ops [] = { OP_LOADR_MEMBASE, OP_LOADR8_MEMBASE, OP_LOADR_MEMBASE, OP_LOADR_MEMBASE, OP_LOADX_MEMBASE }; static const int regbank_store_ops [] = { OP_STORER_MEMBASE_REG, OP_STORER8_MEMBASE_REG, OP_STORER_MEMBASE_REG, OP_STORER_MEMBASE_REG, OP_STOREX_MEMBASE }; static const int regbank_move_ops [] = { OP_MOVE, OP_FMOVE, OP_MOVE, OP_MOVE, OP_XMOVE }; #define regmask(reg) (((regmask_t)1) << (reg)) #ifdef MONO_ARCH_USE_SHARED_FP_SIMD_BANK static const regmask_t regbank_callee_saved_regs [] = { MONO_ARCH_CALLEE_SAVED_REGS, MONO_ARCH_CALLEE_SAVED_FREGS, MONO_ARCH_CALLEE_SAVED_REGS, MONO_ARCH_CALLEE_SAVED_REGS, MONO_ARCH_CALLEE_SAVED_XREGS, }; #endif static const regmask_t regbank_callee_regs [] = { MONO_ARCH_CALLEE_REGS, MONO_ARCH_CALLEE_FREGS, MONO_ARCH_CALLEE_REGS, MONO_ARCH_CALLEE_REGS, MONO_ARCH_CALLEE_XREGS, }; static const int regbank_spill_var_size[] = { sizeof (target_mgreg_t), sizeof (double), sizeof (target_mgreg_t), sizeof (target_mgreg_t), 16 /*FIXME make this a constant. Maybe MONO_ARCH_SIMD_VECTOR_SIZE? */ }; #define DEBUG(a) MINI_DEBUG(cfg->verbose_level, 3, a;) static void mono_regstate_assign (MonoRegState *rs) { #ifdef MONO_ARCH_USE_SHARED_FP_SIMD_BANK /* The regalloc may fail if fp and simd logical regbanks share the same physical reg bank and * if the values here are not the same. */ g_assert(regbank_callee_regs [MONO_REG_SIMD] == regbank_callee_regs [MONO_REG_DOUBLE]); g_assert(regbank_callee_saved_regs [MONO_REG_SIMD] == regbank_callee_saved_regs [MONO_REG_DOUBLE]); g_assert(regbank_size [MONO_REG_SIMD] == regbank_size [MONO_REG_DOUBLE]); #endif if (rs->next_vreg > rs->vassign_size) { g_free (rs->vassign); rs->vassign_size = MAX (rs->next_vreg, 256); rs->vassign = (gint32 *)g_malloc (rs->vassign_size * sizeof (gint32)); } memset (rs->isymbolic, 0, MONO_MAX_IREGS * sizeof (rs->isymbolic [0])); memset (rs->fsymbolic, 0, MONO_MAX_FREGS * sizeof (rs->fsymbolic [0])); rs->symbolic [MONO_REG_INT] = rs->isymbolic; rs->symbolic [MONO_REG_DOUBLE] = rs->fsymbolic; #ifdef MONO_ARCH_NEED_SIMD_BANK memset (rs->xsymbolic, 0, MONO_MAX_XREGS * sizeof (rs->xsymbolic [0])); rs->symbolic [MONO_REG_SIMD] = rs->xsymbolic; #endif } static int mono_regstate_alloc_int (MonoRegState *rs, regmask_t allow) { regmask_t mask = allow & rs->ifree_mask; #if defined(__x86_64__) && defined(__GNUC__) { guint64 i; if (mask == 0) return -1; __asm__("bsfq %1,%0\n\t" : "=r" (i) : "rm" (mask)); rs->ifree_mask &= ~ ((regmask_t)1 << i); return i; } #else int i; for (i = 0; i < MONO_MAX_IREGS; ++i) { if (mask & ((regmask_t)1 << i)) { rs->ifree_mask &= ~ ((regmask_t)1 << i); return i; } } return -1; #endif } static void mono_regstate_free_int (MonoRegState *rs, int reg) { if (reg >= 0) { rs->ifree_mask |= (regmask_t)1 << reg; rs->isymbolic [reg] = 0; } } static int mono_regstate_alloc_general (MonoRegState *rs, regmask_t allow, int bank) { int i; int mirrored_bank; regmask_t mask = allow & rs->free_mask [bank]; for (i = 0; i < regbank_size [bank]; ++i) { if (mask & ((regmask_t)1 << i)) { rs->free_mask [bank] &= ~ ((regmask_t)1 << i); mirrored_bank = get_mirrored_bank (bank); if (mirrored_bank == -1) return i; rs->free_mask [mirrored_bank] = rs->free_mask [bank]; return i; } } return -1; } static void mono_regstate_free_general (MonoRegState *rs, int reg, int bank) { int mirrored_bank; if (reg >= 0) { rs->free_mask [bank] |= (regmask_t)1 << reg; rs->symbolic [bank][reg] = 0; mirrored_bank = get_mirrored_bank (bank); if (mirrored_bank == -1) return; rs->free_mask [mirrored_bank] = rs->free_mask [bank]; rs->symbolic [mirrored_bank][reg] = 0; } } const char* mono_regname_full (int reg, int bank) { if (G_UNLIKELY (bank)) { #if MONO_ARCH_NEED_SIMD_BANK if (bank == MONO_REG_SIMD) return mono_arch_xregname (reg); #endif if (bank == MONO_REG_INT_REF || bank == MONO_REG_INT_MP) return mono_arch_regname (reg); g_assert (bank == MONO_REG_DOUBLE); return mono_arch_fregname (reg); } else { return mono_arch_regname (reg); } } void mono_call_inst_add_outarg_reg (MonoCompile *cfg, MonoCallInst *call, int vreg, int hreg, int bank) { guint32 regpair; regpair = (((guint32)hreg) << 24) + vreg; if (G_UNLIKELY (bank)) { g_assert (vreg >= regbank_size [bank]); g_assert (hreg < regbank_size [bank]); call->used_fregs |= (regmask_t)1 << hreg; call->out_freg_args = g_slist_append_mempool (cfg->mempool, call->out_freg_args, (gpointer)(gssize)(regpair)); } else { g_assert (vreg >= MONO_MAX_IREGS); g_assert (hreg < MONO_MAX_IREGS); call->used_iregs |= (regmask_t)1 << hreg; call->out_ireg_args = g_slist_append_mempool (cfg->mempool, call->out_ireg_args, (gpointer)(gssize)(regpair)); } } /* * mono_call_inst_add_outarg_vt: * * Register OUTARG_VT as belonging to CALL. */ void mono_call_inst_add_outarg_vt (MonoCompile *cfg, MonoCallInst *call, MonoInst *outarg_vt) { call->outarg_vts = g_slist_append_mempool (cfg->mempool, call->outarg_vts, outarg_vt); } static void resize_spill_info (MonoCompile *cfg, int bank) { MonoSpillInfo *orig_info = cfg->spill_info [bank]; int orig_len = cfg->spill_info_len [bank]; int new_len = orig_len ? orig_len * 2 : 16; MonoSpillInfo *new_info; int i; g_assert (bank < MONO_NUM_REGBANKS); new_info = (MonoSpillInfo *)mono_mempool_alloc0 (cfg->mempool, sizeof (MonoSpillInfo) * new_len); if (orig_info) memcpy (new_info, orig_info, sizeof (MonoSpillInfo) * orig_len); for (i = orig_len; i < new_len; ++i) new_info [i].offset = -1; cfg->spill_info [bank] = new_info; cfg->spill_info_len [bank] = new_len; } /* * returns the offset used by spillvar. It allocates a new * spill variable if necessary. */ static int mono_spillvar_offset (MonoCompile *cfg, int spillvar, int bank) { MonoSpillInfo *info; int size; if (G_UNLIKELY (spillvar >= (cfg->spill_info_len [bank]))) { while (spillvar >= cfg->spill_info_len [bank]) resize_spill_info (cfg, bank); } /* * Allocate separate spill slots for fp/non-fp variables since most processors prefer it. */ info = &cfg->spill_info [bank][spillvar]; if (info->offset == -1) { cfg->stack_offset += sizeof (target_mgreg_t) - 1; cfg->stack_offset &= ~(sizeof (target_mgreg_t) - 1); g_assert (bank < MONO_NUM_REGBANKS); if (G_UNLIKELY (bank)) size = regbank_spill_var_size [bank]; else size = sizeof (target_mgreg_t); if (cfg->flags & MONO_CFG_HAS_SPILLUP) { cfg->stack_offset += size - 1; cfg->stack_offset &= ~(size - 1); info->offset = cfg->stack_offset; cfg->stack_offset += size; } else { cfg->stack_offset += size - 1; cfg->stack_offset &= ~(size - 1); cfg->stack_offset += size; info->offset = - cfg->stack_offset; } } return info->offset; } #define is_hard_ireg(r) ((r) >= 0 && (r) < MONO_MAX_IREGS) #define is_hard_freg(r) ((r) >= 0 && (r) < MONO_MAX_FREGS) #define is_global_ireg(r) (is_hard_ireg ((r)) && (MONO_ARCH_CALLEE_SAVED_REGS & (regmask (r)))) #define is_local_ireg(r) (is_hard_ireg ((r)) && (MONO_ARCH_CALLEE_REGS & (regmask (r)))) #define is_global_freg(r) (is_hard_freg ((r)) && (MONO_ARCH_CALLEE_SAVED_FREGS & (regmask (r)))) #define is_local_freg(r) (is_hard_freg ((r)) && (MONO_ARCH_CALLEE_FREGS & (regmask (r)))) #define is_hard_reg(r,bank) (G_UNLIKELY (bank) ? ((r) >= 0 && (r) < regbank_size [bank]) : ((r) < MONO_MAX_IREGS)) #define is_soft_reg(r,bank) (!is_hard_reg((r),(bank))) #define is_global_reg(r,bank) (G_UNLIKELY (bank) ? (is_hard_reg ((r), (bank)) && (regbank_callee_saved_regs [bank] & regmask (r))) : is_global_ireg (r)) #define is_local_reg(r,bank) (G_UNLIKELY (bank) ? (is_hard_reg ((r), (bank)) && (regbank_callee_regs [bank] & regmask (r))) : is_local_ireg (r)) #define reg_is_freeable(r,bank) (G_UNLIKELY (bank) ? is_local_reg ((r), (bank)) : is_local_ireg ((r))) #ifndef MONO_ARCH_INST_IS_FLOAT #define MONO_ARCH_INST_IS_FLOAT(desc) ((desc) == 'f') #endif #define reg_is_fp(desc) (MONO_ARCH_INST_IS_FLOAT (desc)) #define dreg_is_fp(spec) (MONO_ARCH_INST_IS_FLOAT (spec [MONO_INST_DEST])) #define sreg_is_fp(n,spec) (MONO_ARCH_INST_IS_FLOAT (spec [MONO_INST_SRC1+(n)])) #define sreg1_is_fp(spec) sreg_is_fp (0,(spec)) #define sreg2_is_fp(spec) sreg_is_fp (1,(spec)) #define reg_is_simd(desc) ((desc) == 'x') #ifdef MONO_ARCH_NEED_SIMD_BANK #define reg_bank(desc) (G_UNLIKELY (reg_is_fp (desc)) ? MONO_REG_DOUBLE : G_UNLIKELY (reg_is_simd(desc)) ? MONO_REG_SIMD : MONO_REG_INT) #else #define reg_bank(desc) reg_is_fp ((desc)) #endif #define sreg_bank(n,spec) reg_bank ((spec)[MONO_INST_SRC1+(n)]) #define sreg1_bank(spec) sreg_bank (0, (spec)) #define sreg2_bank(spec) sreg_bank (1, (spec)) #define dreg_bank(spec) reg_bank ((spec)[MONO_INST_DEST]) #define sreg_bank_ins(n,ins) sreg_bank ((n), ins_get_spec ((ins)->opcode)) #define sreg1_bank_ins(ins) sreg_bank_ins (0, (ins)) #define sreg2_bank_ins(ins) sreg_bank_ins (1, (ins)) #define dreg_bank_ins(ins) dreg_bank (ins_get_spec ((ins)->opcode)) #define regpair_reg2_mask(desc,hreg1) ((MONO_ARCH_INST_REGPAIR_REG2 (desc,hreg1) != -1) ? (regmask (MONO_ARCH_INST_REGPAIR_REG2 (desc,hreg1))) : MONO_ARCH_CALLEE_REGS) #ifdef MONO_ARCH_IS_GLOBAL_IREG #undef is_global_ireg #define is_global_ireg(reg) MONO_ARCH_IS_GLOBAL_IREG ((reg)) #endif typedef struct { int born_in; int killed_in; /* Not (yet) used */ //int last_use; //int prev_use; regmask_t preferred_mask; /* the hreg where the register should be allocated, or 0 */ } RegTrack; #if !defined(DISABLE_LOGGING) void mono_print_ins_index (int i, MonoInst *ins) { GString *buf = mono_print_ins_index_strbuf (i, ins); printf ("%s\n", buf->str); g_string_free (buf, TRUE); } GString * mono_print_ins_index_strbuf (int i, MonoInst *ins) { const char *spec = ins_get_spec (ins->opcode); GString *sbuf = g_string_new (NULL); int num_sregs, j; int sregs [MONO_MAX_SRC_REGS]; if (i != -1) g_string_append_printf (sbuf, "\t%-2d %s", i, mono_inst_name (ins->opcode)); else g_string_append_printf (sbuf, " %s", mono_inst_name (ins->opcode)); if (spec == (gpointer)/*FIXME*/MONO_ARCH_CPU_SPEC) { gboolean dest_base = FALSE; switch (ins->opcode) { case OP_STOREV_MEMBASE: dest_base = TRUE; break; default: break; } /* This is a lowered opcode */ if (ins->dreg != -1) { if (dest_base) g_string_append_printf (sbuf, " [R%d + 0x%lx] <-", ins->dreg, (long)ins->inst_offset); else g_string_append_printf (sbuf, " R%d <-", ins->dreg); } if (ins->sreg1 != -1) g_string_append_printf (sbuf, " R%d", ins->sreg1); if (ins->sreg2 != -1) g_string_append_printf (sbuf, " R%d", ins->sreg2); if (ins->sreg3 != -1) g_string_append_printf (sbuf, " R%d", ins->sreg3); switch (ins->opcode) { case OP_LBNE_UN: case OP_LBEQ: case OP_LBLT: case OP_LBLT_UN: case OP_LBGT: case OP_LBGT_UN: case OP_LBGE: case OP_LBGE_UN: case OP_LBLE: case OP_LBLE_UN: if (!ins->inst_false_bb) g_string_append_printf (sbuf, " [B%d]", ins->inst_true_bb->block_num); else g_string_append_printf (sbuf, " [B%dB%d]", ins->inst_true_bb->block_num, ins->inst_false_bb->block_num); break; case OP_PHI: case OP_VPHI: case OP_XPHI: case OP_FPHI: { int i; g_string_append_printf (sbuf, " [%d (", (int)ins->inst_c0); for (i = 0; i < ins->inst_phi_args [0]; i++) { if (i) g_string_append_printf (sbuf, ", "); g_string_append_printf (sbuf, "R%d", ins->inst_phi_args [i + 1]); } g_string_append_printf (sbuf, ")]"); break; } case OP_LDADDR: case OP_OUTARG_VTRETADDR: g_string_append_printf (sbuf, " R%d", ((MonoInst*)ins->inst_p0)->dreg); break; case OP_REGOFFSET: case OP_GSHAREDVT_ARG_REGOFFSET: g_string_append_printf (sbuf, " + 0x%lx", (long)ins->inst_offset); break; case OP_ISINST: case OP_CASTCLASS: g_string_append_printf (sbuf, " %s", m_class_get_name (ins->klass)); break; default: break; } //g_error ("Unknown opcode: %s\n", mono_inst_name (ins->opcode)); return sbuf; } if (spec [MONO_INST_DEST]) { int bank = dreg_bank (spec); if (is_soft_reg (ins->dreg, bank)) { if (spec [MONO_INST_DEST] == 'b') { if (ins->inst_offset == 0) g_string_append_printf (sbuf, " [R%d] <-", ins->dreg); else g_string_append_printf (sbuf, " [R%d + 0x%lx] <-", ins->dreg, (long)ins->inst_offset); } else g_string_append_printf (sbuf, " R%d <-", ins->dreg); } else if (spec [MONO_INST_DEST] == 'b') { if (ins->inst_offset == 0) g_string_append_printf (sbuf, " [%s] <-", mono_arch_regname (ins->dreg)); else g_string_append_printf (sbuf, " [%s + 0x%lx] <-", mono_arch_regname (ins->dreg), (long)ins->inst_offset); } else g_string_append_printf (sbuf, " %s <-", mono_regname_full (ins->dreg, bank)); } if (spec [MONO_INST_SRC1]) { int bank = sreg1_bank (spec); if (is_soft_reg (ins->sreg1, bank)) { if (spec [MONO_INST_SRC1] == 'b') g_string_append_printf (sbuf, " [R%d + 0x%lx]", ins->sreg1, (long)ins->inst_offset); else g_string_append_printf (sbuf, " R%d", ins->sreg1); } else if (spec [MONO_INST_SRC1] == 'b') g_string_append_printf (sbuf, " [%s + 0x%lx]", mono_arch_regname (ins->sreg1), (long)ins->inst_offset); else g_string_append_printf (sbuf, " %s", mono_regname_full (ins->sreg1, bank)); } num_sregs = mono_inst_get_src_registers (ins, sregs); for (j = 1; j < num_sregs; ++j) { int bank = sreg_bank (j, spec); if (is_soft_reg (sregs [j], bank)) g_string_append_printf (sbuf, " R%d", sregs [j]); else g_string_append_printf (sbuf, " %s", mono_regname_full (sregs [j], bank)); } switch (ins->opcode) { case OP_ICONST: g_string_append_printf (sbuf, " [%d]", (int)ins->inst_c0); break; #if defined(TARGET_X86) || defined(TARGET_AMD64) case OP_X86_PUSH_IMM: #endif case OP_ICOMPARE_IMM: case OP_COMPARE_IMM: case OP_IADD_IMM: case OP_ISUB_IMM: case OP_IAND_IMM: case OP_IOR_IMM: case OP_IXOR_IMM: case OP_SUB_IMM: case OP_MUL_IMM: case OP_STORE_MEMBASE_IMM: g_string_append_printf (sbuf, " [%d]", (int)ins->inst_imm); break; case OP_ADD_IMM: case OP_LADD_IMM: g_string_append_printf (sbuf, " [%d]", (int)(gssize)ins->inst_p1); break; case OP_I8CONST: g_string_append_printf (sbuf, " [%" PRId64 "]", (gint64)ins->inst_l); break; case OP_R8CONST: g_string_append_printf (sbuf, " [%f]", *(double*)ins->inst_p0); break; case OP_R4CONST: g_string_append_printf (sbuf, " [%f]", *(float*)ins->inst_p0); break; case OP_CALL: case OP_CALL_MEMBASE: case OP_CALL_REG: case OP_FCALL: case OP_LCALL: case OP_VCALL: case OP_VCALL_REG: case OP_VCALL_MEMBASE: case OP_VCALL2: case OP_VCALL2_REG: case OP_VCALL2_MEMBASE: case OP_VOIDCALL: case OP_VOIDCALL_MEMBASE: case OP_TAILCALL: case OP_TAILCALL_MEMBASE: case OP_RCALL: case OP_RCALL_REG: case OP_RCALL_MEMBASE: { MonoCallInst *call = (MonoCallInst*)ins; GSList *list; MonoJitICallId jit_icall_id; MonoMethod *method; if (ins->opcode == OP_VCALL || ins->opcode == OP_VCALL_REG || ins->opcode == OP_VCALL_MEMBASE) { /* * These are lowered opcodes, but they are in the .md files since the old * JIT passes them to backends. */ if (ins->dreg != -1) g_string_append_printf (sbuf, " R%d <-", ins->dreg); } if ((method = call->method)) { char *full_name = mono_method_get_full_name (method); g_string_append_printf (sbuf, " [%s]", full_name); g_free (full_name); } else if (call->fptr_is_patch) { MonoJumpInfo *ji = (MonoJumpInfo*)call->fptr; g_string_append_printf (sbuf, " "); mono_print_ji (ji); } else if ((jit_icall_id = call->jit_icall_id)) { g_string_append_printf (sbuf, " [%s]", mono_find_jit_icall_info (jit_icall_id)->name); } list = call->out_ireg_args; while (list) { guint32 regpair; int reg, hreg; regpair = (guint32)(gssize)(list->data); hreg = regpair >> 24; reg = regpair & 0xffffff; g_string_append_printf (sbuf, " [%s <- R%d]", mono_arch_regname (hreg), reg); list = g_slist_next (list); } list = call->out_freg_args; while (list) { guint32 regpair; int reg, hreg; regpair = (guint32)(gssize)(list->data); hreg = regpair >> 24; reg = regpair & 0xffffff; g_string_append_printf (sbuf, " [%s <- R%d]", mono_arch_fregname (hreg), reg); list = g_slist_next (list); } break; } case OP_BR: case OP_CALL_HANDLER: g_string_append_printf (sbuf, " [B%d]", ins->inst_target_bb->block_num); break; case OP_IBNE_UN: case OP_IBEQ: case OP_IBLT: case OP_IBLT_UN: case OP_IBGT: case OP_IBGT_UN: case OP_IBGE: case OP_IBGE_UN: case OP_IBLE: case OP_IBLE_UN: case OP_LBNE_UN: case OP_LBEQ: case OP_LBLT: case OP_LBLT_UN: case OP_LBGT: case OP_LBGT_UN: case OP_LBGE: case OP_LBGE_UN: case OP_LBLE: case OP_LBLE_UN: if (!ins->inst_false_bb) g_string_append_printf (sbuf, " [B%d]", ins->inst_true_bb->block_num); else g_string_append_printf (sbuf, " [B%dB%d]", ins->inst_true_bb->block_num, ins->inst_false_bb->block_num); break; case OP_LIVERANGE_START: case OP_LIVERANGE_END: case OP_GC_LIVENESS_DEF: case OP_GC_LIVENESS_USE: g_string_append_printf (sbuf, " R%d", (int)ins->inst_c1); break; case OP_IL_SEQ_POINT: case OP_SEQ_POINT: g_string_append_printf (sbuf, "%s il: 0x%x%s", (ins->flags & MONO_INST_SINGLE_STEP_LOC) ? " intr" : "", (int)ins->inst_imm, ins->flags & MONO_INST_NONEMPTY_STACK ? ", nonempty-stack" : ""); break; case OP_COND_EXC_EQ: case OP_COND_EXC_GE: case OP_COND_EXC_GT: case OP_COND_EXC_LE: case OP_COND_EXC_LT: case OP_COND_EXC_NE_UN: case OP_COND_EXC_GE_UN: case OP_COND_EXC_GT_UN: case OP_COND_EXC_LE_UN: case OP_COND_EXC_LT_UN: case OP_COND_EXC_OV: case OP_COND_EXC_NO: case OP_COND_EXC_C: case OP_COND_EXC_NC: case OP_COND_EXC_IEQ: case OP_COND_EXC_IGE: case OP_COND_EXC_IGT: case OP_COND_EXC_ILE: case OP_COND_EXC_ILT: case OP_COND_EXC_INE_UN: case OP_COND_EXC_IGE_UN: case OP_COND_EXC_IGT_UN: case OP_COND_EXC_ILE_UN: case OP_COND_EXC_ILT_UN: case OP_COND_EXC_IOV: case OP_COND_EXC_INO: case OP_COND_EXC_IC: case OP_COND_EXC_INC: g_string_append_printf (sbuf, " %s", (const char*)ins->inst_p1); break; default: break; } if (spec [MONO_INST_CLOB]) g_string_append_printf (sbuf, " clobbers: %c", spec [MONO_INST_CLOB]); return sbuf; } static void print_regtrack (RegTrack *t, int num) { int i; char buf [32]; const char *r; for (i = 0; i < num; ++i) { if (!t [i].born_in) continue; if (i >= MONO_MAX_IREGS) { g_snprintf (buf, sizeof (buf), "R%d", i); r = buf; } else r = mono_arch_regname (i); printf ("liveness: %s [%d - %d]\n", r, t [i].born_in, t[i].killed_in); } } #else void mono_print_ins_index (int i, MonoInst *ins) { } #endif /* !defined(DISABLE_LOGGING) */ void mono_print_ins (MonoInst *ins) { mono_print_ins_index (-1, ins); } static void insert_before_ins (MonoBasicBlock *bb, MonoInst *ins, MonoInst* to_insert) { /* * If this function is called multiple times, the new instructions are inserted * in the proper order. */ mono_bblock_insert_before_ins (bb, ins, to_insert); } static void insert_after_ins (MonoBasicBlock *bb, MonoInst *ins, MonoInst **last, MonoInst* to_insert) { /* * If this function is called multiple times, the new instructions are inserted in * proper order. */ mono_bblock_insert_after_ins (bb, *last, to_insert); *last = to_insert; } static int get_vreg_bank (MonoCompile *cfg, int reg, int bank) { if (vreg_is_ref (cfg, reg)) return MONO_REG_INT_REF; else if (vreg_is_mp (cfg, reg)) return MONO_REG_INT_MP; else return bank; } /* * Force the spilling of the variable in the symbolic register 'reg', and free * the hreg it was assigned to. */ static void spill_vreg (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst **last, MonoInst *ins, int reg, int bank) { MonoInst *load; int i, sel, spill; MonoRegState *rs = cfg->rs; sel = rs->vassign [reg]; /* the vreg we need to spill lives in another logical reg bank */ bank = translate_bank (cfg->rs, bank, sel); /*i = rs->isymbolic [sel]; g_assert (i == reg);*/ i = reg; spill = ++cfg->spill_count; rs->vassign [i] = -spill - 1; if (G_UNLIKELY (bank)) mono_regstate_free_general (rs, sel, bank); else mono_regstate_free_int (rs, sel); /* we need to create a spill var and insert a load to sel after the current instruction */ MONO_INST_NEW (cfg, load, regbank_load_ops [bank]); load->dreg = sel; load->inst_basereg = cfg->frame_reg; load->inst_offset = mono_spillvar_offset (cfg, spill, get_vreg_bank (cfg, reg, bank)); insert_after_ins (bb, ins, last, load); DEBUG (printf ("SPILLED LOAD (%d at 0x%08lx(%%ebp)) R%d (freed %s)\n", spill, (long)load->inst_offset, i, mono_regname_full (sel, bank))); if (G_UNLIKELY (bank)) i = mono_regstate_alloc_general (rs, regmask (sel), bank); else i = mono_regstate_alloc_int (rs, regmask (sel)); g_assert (i == sel); if (G_UNLIKELY (bank)) mono_regstate_free_general (rs, sel, bank); else mono_regstate_free_int (rs, sel); } static int get_register_spilling (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst **last, MonoInst *ins, regmask_t regmask, int reg, int bank) { MonoInst *load; int i, sel, spill, num_sregs; int sregs [MONO_MAX_SRC_REGS]; MonoRegState *rs = cfg->rs; g_assert (bank < MONO_NUM_REGBANKS); DEBUG (printf ("\tstart regmask to assign R%d: 0x%08" PRIu64 " (R%d <- R%d R%d R%d)\n", reg, (guint64)regmask, ins->dreg, ins->sreg1, ins->sreg2, ins->sreg3)); /* exclude the registers in the current instruction */ num_sregs = mono_inst_get_src_registers (ins, sregs); for (i = 0; i < num_sregs; ++i) { if ((sreg_bank_ins (i, ins) == bank) && (reg != sregs [i]) && (reg_is_freeable (sregs [i], bank) || (is_soft_reg (sregs [i], bank) && rs->vassign [sregs [i]] >= 0))) { if (is_soft_reg (sregs [i], bank)) regmask &= ~ (regmask (rs->vassign [sregs [i]])); else regmask &= ~ (regmask (sregs [i])); DEBUG (printf ("\t\texcluding sreg%d %s %d\n", i + 1, mono_regname_full (sregs [i], bank), sregs [i])); } } if ((dreg_bank_ins (ins) == bank) && (reg != ins->dreg) && reg_is_freeable (ins->dreg, bank)) { regmask &= ~ (regmask (ins->dreg)); DEBUG (printf ("\t\texcluding dreg %s\n", mono_regname_full (ins->dreg, bank))); } DEBUG (printf ("\t\tavailable regmask: 0x%08" PRIu64 "\n", (guint64)regmask)); g_assert (regmask); /* need at least a register we can free */ sel = 0; /* we should track prev_use and spill the register that's farther */ if (G_UNLIKELY (bank)) { for (i = 0; i < regbank_size [bank]; ++i) { if (regmask & (regmask (i))) { sel = i; /* the vreg we need to load lives in another logical bank */ bank = translate_bank (cfg->rs, bank, sel); DEBUG (printf ("\t\tselected register %s has assignment %d\n", mono_regname_full (sel, bank), rs->symbolic [bank] [sel])); break; } } i = rs->symbolic [bank] [sel]; spill = ++cfg->spill_count; rs->vassign [i] = -spill - 1; mono_regstate_free_general (rs, sel, bank); } else { for (i = 0; i < MONO_MAX_IREGS; ++i) { if (regmask & (regmask (i))) { sel = i; DEBUG (printf ("\t\tselected register %s has assignment %d\n", mono_arch_regname (sel), rs->isymbolic [sel])); break; } } i = rs->isymbolic [sel]; spill = ++cfg->spill_count; rs->vassign [i] = -spill - 1; mono_regstate_free_int (rs, sel); } /* we need to create a spill var and insert a load to sel after the current instruction */ MONO_INST_NEW (cfg, load, regbank_load_ops [bank]); load->dreg = sel; load->inst_basereg = cfg->frame_reg; load->inst_offset = mono_spillvar_offset (cfg, spill, get_vreg_bank (cfg, i, bank)); insert_after_ins (bb, ins, last, load); DEBUG (printf ("\tSPILLED LOAD (%d at 0x%08lx(%%ebp)) R%d (freed %s)\n", spill, (long)load->inst_offset, i, mono_regname_full (sel, bank))); if (G_UNLIKELY (bank)) i = mono_regstate_alloc_general (rs, regmask (sel), bank); else i = mono_regstate_alloc_int (rs, regmask (sel)); g_assert (i == sel); return sel; } /* * free_up_hreg: * * Free up the hreg HREG by spilling the vreg allocated to it. */ static void free_up_hreg (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst **last, MonoInst *ins, int hreg, int bank) { if (G_UNLIKELY (bank)) { if (!(cfg->rs->free_mask [bank] & (regmask (hreg)))) { bank = translate_bank (cfg->rs, bank, hreg); DEBUG (printf ("\tforced spill of R%d\n", cfg->rs->symbolic [bank] [hreg])); spill_vreg (cfg, bb, last, ins, cfg->rs->symbolic [bank] [hreg], bank); } } else { if (!(cfg->rs->ifree_mask & (regmask (hreg)))) { DEBUG (printf ("\tforced spill of R%d\n", cfg->rs->isymbolic [hreg])); spill_vreg (cfg, bb, last, ins, cfg->rs->isymbolic [hreg], bank); } } } static MonoInst* create_copy_ins (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst **last, int dest, int src, MonoInst *ins, const unsigned char *ip, int bank) { MonoInst *copy; MONO_INST_NEW (cfg, copy, regbank_move_ops [bank]); copy->dreg = dest; copy->sreg1 = src; copy->cil_code = ip; if (ins) { mono_bblock_insert_after_ins (bb, ins, copy); *last = copy; } DEBUG (printf ("\tforced copy from %s to %s\n", mono_regname_full (src, bank), mono_regname_full (dest, bank))); return copy; } static const char* regbank_to_string (int bank) { if (bank == MONO_REG_INT_REF) return "REF "; else if (bank == MONO_REG_INT_MP) return "MP "; else return ""; } static void create_spilled_store (MonoCompile *cfg, MonoBasicBlock *bb, int spill, int reg, int prev_reg, MonoInst **last, MonoInst *ins, MonoInst *insert_before, int bank) { MonoInst *store, *def; bank = get_vreg_bank (cfg, prev_reg, bank); MONO_INST_NEW (cfg, store, regbank_store_ops [bank]); store->sreg1 = reg; store->inst_destbasereg = cfg->frame_reg; store->inst_offset = mono_spillvar_offset (cfg, spill, bank); if (ins) { mono_bblock_insert_after_ins (bb, ins, store); *last = store; } else if (insert_before) { insert_before_ins (bb, insert_before, store); } else { g_assert_not_reached (); } DEBUG (printf ("\t%sSPILLED STORE (%d at 0x%08lx(%%ebp)) R%d (from %s)\n", regbank_to_string (bank), spill, (long)store->inst_offset, prev_reg, mono_regname_full (reg, bank))); if (((bank == MONO_REG_INT_REF) || (bank == MONO_REG_INT_MP)) && cfg->compute_gc_maps) { g_assert (prev_reg != -1); MONO_INST_NEW (cfg, def, OP_GC_SPILL_SLOT_LIVENESS_DEF); def->inst_c0 = spill; def->inst_c1 = bank; mono_bblock_insert_after_ins (bb, store, def); } } /* flags used in reginfo->flags */ enum { MONO_FP_NEEDS_LOAD_SPILL = regmask (0), MONO_FP_NEEDS_SPILL = regmask (1), MONO_FP_NEEDS_LOAD = regmask (2) }; static int alloc_int_reg (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst **last, MonoInst *ins, regmask_t dest_mask, int sym_reg, RegTrack *info) { int val; if (info && info->preferred_mask) { val = mono_regstate_alloc_int (cfg->rs, info->preferred_mask & dest_mask); if (val >= 0) { DEBUG (printf ("\tallocated preferred reg R%d to %s\n", sym_reg, mono_arch_regname (val))); return val; } } val = mono_regstate_alloc_int (cfg->rs, dest_mask); if (val < 0) val = get_register_spilling (cfg, bb, last, ins, dest_mask, sym_reg, 0); return val; } static int alloc_general_reg (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst **last, MonoInst *ins, regmask_t dest_mask, int sym_reg, int bank) { int val; val = mono_regstate_alloc_general (cfg->rs, dest_mask, bank); if (val < 0) val = get_register_spilling (cfg, bb, last, ins, dest_mask, sym_reg, bank); #ifdef MONO_ARCH_HAVE_TRACK_FPREGS cfg->arch.used_fp_regs |= 1 << val; #endif return val; } static int alloc_reg (MonoCompile *cfg, MonoBasicBlock *bb, MonoInst **last, MonoInst *ins, regmask_t dest_mask, int sym_reg, RegTrack *info, int bank) { if (G_UNLIKELY (bank)) return alloc_general_reg (cfg, bb, last, ins, dest_mask, sym_reg, bank); else return alloc_int_reg (cfg, bb, last, ins, dest_mask, sym_reg, info); } static void assign_reg (MonoCompile *cfg, MonoRegState *rs, int reg, int hreg, int bank) { if (G_UNLIKELY (bank)) { int mirrored_bank; g_assert (reg >= regbank_size [bank]); g_assert (hreg < regbank_size [bank]); g_assert (! is_global_freg (hreg)); rs->vassign [reg] = hreg; rs->symbolic [bank] [hreg] = reg; rs->free_mask [bank] &= ~ (regmask (hreg)); mirrored_bank = get_mirrored_bank (bank); if (mirrored_bank == -1) return; /* Make sure the other logical reg bank that this bank shares * a single hard reg bank knows that this hard reg is not free. */ rs->free_mask [mirrored_bank] = rs->free_mask [bank]; /* Mark the other logical bank that the this bank shares * a single hard reg bank with as mirrored. */ rs->symbolic [mirrored_bank] [hreg] = MONO_ARCH_BANK_MIRRORED; } else { g_assert (reg >= MONO_MAX_IREGS); g_assert (hreg < MONO_MAX_IREGS); #if !defined(TARGET_ARM) && !defined(TARGET_ARM64) /* this seems to trigger a gcc compilation bug sometime (hreg is 0) */ /* On arm64, rgctx_reg is a global hreg, and it is used to pass an argument */ g_assert (! is_global_ireg (hreg)); #endif rs->vassign [reg] = hreg; rs->isymbolic [hreg] = reg; rs->ifree_mask &= ~ (regmask (hreg)); } } static regmask_t get_callee_mask (const char spec) { if (G_UNLIKELY (reg_bank (spec))) return regbank_callee_regs [reg_bank (spec)]; return MONO_ARCH_CALLEE_REGS; } static gint8 desc_to_fixed_reg [256]; static gboolean desc_to_fixed_reg_inited = FALSE; /* * Local register allocation. * We first scan the list of instructions and we save the liveness info of * each register (when the register is first used, when it's value is set etc.). * We also reverse the list of instructions because assigning registers backwards allows * for more tricks to be used. */ void mono_local_regalloc (MonoCompile *cfg, MonoBasicBlock *bb) { MonoInst *ins, *prev, *last; MonoInst **tmp; MonoRegState *rs = cfg->rs; int i, j, val, max; RegTrack *reginfo; const char *spec; unsigned char spec_src1, spec_dest; int bank = 0; #if MONO_ARCH_USE_FPSTACK gboolean has_fp = FALSE; int fpstack [8]; int sp = 0; #endif int num_sregs = 0; int sregs [MONO_MAX_SRC_REGS]; if (!bb->code) return; if (!desc_to_fixed_reg_inited) { for (i = 0; i < 256; ++i) desc_to_fixed_reg [i] = MONO_ARCH_INST_FIXED_REG (i); desc_to_fixed_reg_inited = TRUE; /* Validate the cpu description against the info in mini-ops.h */ #if defined(TARGET_AMD64) || defined(TARGET_X86) || defined(TARGET_ARM) || defined(TARGET_ARM64) || defined (TARGET_RISCV) /* Check that the table size is correct */ g_assert (MONO_ARCH_CPU_SPEC_IDX(MONO_ARCH_CPU_SPEC)[OP_LAST - OP_LOAD] == 0xffff); for (i = OP_LOAD; i < OP_LAST; ++i) { const char *ispec; spec = ins_get_spec (i); ispec = INS_INFO (i); if ((spec [MONO_INST_DEST] && (ispec [MONO_INST_DEST] == ' '))) g_error ("Instruction metadata for %s inconsistent.\n", mono_inst_name (i)); if ((spec [MONO_INST_SRC1] && (ispec [MONO_INST_SRC1] == ' '))) g_error ("Instruction metadata for %s inconsistent.\n", mono_inst_name (i)); if ((spec [MONO_INST_SRC2] && (ispec [MONO_INST_SRC2] == ' '))) g_error ("Instruction metadata for %s inconsistent.\n", mono_inst_name (i)); } #endif } rs->next_vreg = bb->max_vreg; mono_regstate_assign (rs); rs->ifree_mask = MONO_ARCH_CALLEE_REGS; for (i = 0; i < MONO_NUM_REGBANKS; ++i) rs->free_mask [i] = regbank_callee_regs [i]; max = rs->next_vreg; if (cfg->reginfo && cfg->reginfo_len < max) cfg->reginfo = NULL; reginfo = (RegTrack *)cfg->reginfo; if (!reginfo) { cfg->reginfo_len = MAX (1024, max * 2); reginfo = (RegTrack *)mono_mempool_alloc (cfg->mempool, sizeof (RegTrack) * cfg->reginfo_len); cfg->reginfo = reginfo; } else g_assert (cfg->reginfo_len >= rs->next_vreg); if (cfg->verbose_level > 1) { /* print_regtrack reads the info of all variables */ memset (cfg->reginfo, 0, cfg->reginfo_len * sizeof (RegTrack)); } /* * For large methods, next_vreg can be very large, so g_malloc0 time can * be prohibitive. So we manually init the reginfo entries used by the * bblock. */ for (ins = bb->code; ins; ins = ins->next) { gboolean modify = FALSE; spec = ins_get_spec (ins->opcode); if ((ins->dreg != -1) && (ins->dreg < max)) { memset (&reginfo [ins->dreg], 0, sizeof (RegTrack)); #if SIZEOF_REGISTER == 4 if (MONO_ARCH_INST_IS_REGPAIR (spec [MONO_INST_DEST])) { /** * In the new IR, the two vregs of the regpair do not alias the * original long vreg. shift the vreg here so the rest of the * allocator doesn't have to care about it. */ ins->dreg ++; memset (&reginfo [ins->dreg + 1], 0, sizeof (RegTrack)); } #endif } num_sregs = mono_inst_get_src_registers (ins, sregs); for (j = 0; j < num_sregs; ++j) { g_assert (sregs [j] != -1); if (sregs [j] < max) { memset (&reginfo [sregs [j]], 0, sizeof (RegTrack)); #if SIZEOF_REGISTER == 4 if (MONO_ARCH_INST_IS_REGPAIR (spec [MONO_INST_SRC1 + j])) { sregs [j]++; modify = TRUE; memset (&reginfo [sregs [j] + 1], 0, sizeof (RegTrack)); } #endif } } if (modify) mono_inst_set_src_registers (ins, sregs); } /*if (cfg->opt & MONO_OPT_COPYPROP) local_copy_prop (cfg, ins);*/ i = 1; DEBUG (printf ("\nLOCAL REGALLOC BLOCK %d:\n", bb->block_num)); /* forward pass on the instructions to collect register liveness info */ MONO_BB_FOR_EACH_INS (bb, ins) { spec = ins_get_spec (ins->opcode); spec_dest = spec [MONO_INST_DEST]; if (G_UNLIKELY (spec == (gpointer)/*FIXME*/MONO_ARCH_CPU_SPEC)) { g_error ("Opcode '%s' missing from machine description file.", mono_inst_name (ins->opcode)); } DEBUG (mono_print_ins_index (i, ins)); num_sregs = mono_inst_get_src_registers (ins, sregs); #if MONO_ARCH_USE_FPSTACK if (dreg_is_fp (spec)) { has_fp = TRUE; } else { for (j = 0; j < num_sregs; ++j) { if (sreg_is_fp (j, spec)) has_fp = TRUE; } } #endif for (j = 0; j < num_sregs; ++j) { int sreg = sregs [j]; int sreg_spec = spec [MONO_INST_SRC1 + j]; if (sreg_spec) { bank = sreg_bank (j, spec); g_assert (sreg != -1); if (is_soft_reg (sreg, bank)) /* This means the vreg is not local to this bb */ g_assert (reginfo [sreg].born_in > 0); rs->vassign [sreg] = -1; //reginfo [ins->sreg2].prev_use = reginfo [ins->sreg2].last_use; //reginfo [ins->sreg2].last_use = i; if (MONO_ARCH_INST_IS_REGPAIR (sreg_spec)) { /* The virtual register is allocated sequentially */ rs->vassign [sreg + 1] = -1; //reginfo [ins->sreg2 + 1].prev_use = reginfo [ins->sreg2 + 1].last_use; //reginfo [ins->sreg2 + 1].last_use = i; if (reginfo [sreg + 1].born_in == 0 || reginfo [sreg + 1].born_in > i) reginfo [sreg + 1].born_in = i; } } else { sregs [j] = -1; } } mono_inst_set_src_registers (ins, sregs); if (spec_dest) { int dest_dreg; bank = dreg_bank (spec); if (spec_dest != 'b') /* it's not just a base register */ reginfo [ins->dreg].killed_in = i; g_assert (ins->dreg != -1); rs->vassign [ins->dreg] = -1; //reginfo [ins->dreg].prev_use = reginfo [ins->dreg].last_use; //reginfo [ins->dreg].last_use = i; if (reginfo [ins->dreg].born_in == 0 || reginfo [ins->dreg].born_in > i) reginfo [ins->dreg].born_in = i; dest_dreg = desc_to_fixed_reg [spec_dest]; if (dest_dreg != -1) reginfo [ins->dreg].preferred_mask = (regmask (dest_dreg)); #ifdef MONO_ARCH_INST_FIXED_MASK reginfo [ins->dreg].preferred_mask |= MONO_ARCH_INST_FIXED_MASK (spec_dest); #endif if (MONO_ARCH_INST_IS_REGPAIR (spec_dest)) { /* The virtual register is allocated sequentially */ rs->vassign [ins->dreg + 1] = -1; //reginfo [ins->dreg + 1].prev_use = reginfo [ins->dreg + 1].last_use; //reginfo [ins->dreg + 1].last_use = i; if (reginfo [ins->dreg + 1].born_in == 0 || reginfo [ins->dreg + 1].born_in > i) reginfo [ins->dreg + 1].born_in = i; if (MONO_ARCH_INST_REGPAIR_REG2 (spec_dest, -1) != -1) reginfo [ins->dreg + 1].preferred_mask = regpair_reg2_mask (spec_dest, -1); } } else { ins->dreg = -1; } ++i; } tmp = &last; DEBUG (print_regtrack (reginfo, rs->next_vreg)); MONO_BB_FOR_EACH_INS_REVERSE_SAFE (bb, prev, ins) { int prev_dreg; int dest_dreg, clob_reg; int dest_sregs [MONO_MAX_SRC_REGS], prev_sregs [MONO_MAX_SRC_REGS]; int dreg_high, sreg1_high; regmask_t dreg_mask, mask; regmask_t sreg_masks [MONO_MAX_SRC_REGS], sreg_fixed_masks [MONO_MAX_SRC_REGS]; regmask_t dreg_fixed_mask; const unsigned char *ip; --i; spec = ins_get_spec (ins->opcode); spec_src1 = spec [MONO_INST_SRC1]; spec_dest = spec [MONO_INST_DEST]; prev_dreg = -1; clob_reg = -1; dest_dreg = -1; dreg_high = -1; sreg1_high = -1; dreg_mask = get_callee_mask (spec_dest); for (j = 0; j < MONO_MAX_SRC_REGS; ++j) { prev_sregs [j] = -1; sreg_masks [j] = get_callee_mask (spec [MONO_INST_SRC1 + j]); dest_sregs [j] = desc_to_fixed_reg [(int)spec [MONO_INST_SRC1 + j]]; #ifdef MONO_ARCH_INST_FIXED_MASK sreg_fixed_masks [j] = MONO_ARCH_INST_FIXED_MASK (spec [MONO_INST_SRC1 + j]); #else sreg_fixed_masks [j] = 0; #endif } DEBUG (printf ("processing:")); DEBUG (mono_print_ins_index (i, ins)); ip = ins->cil_code; last = ins; /* * FIXED REGS */ dest_dreg = desc_to_fixed_reg [spec_dest]; clob_reg = desc_to_fixed_reg [(int)spec [MONO_INST_CLOB]]; sreg_masks [1] &= ~ (MONO_ARCH_INST_SREG2_MASK (spec)); #ifdef MONO_ARCH_INST_FIXED_MASK dreg_fixed_mask = MONO_ARCH_INST_FIXED_MASK (spec_dest); #else dreg_fixed_mask = 0; #endif num_sregs = mono_inst_get_src_registers (ins, sregs); /* * TRACK FIXED SREG2, 3, ... */ for (j = 1; j < num_sregs; ++j) { int sreg = sregs [j]; int dest_sreg = dest_sregs [j]; if (dest_sreg == -1) continue; if (j == 2) { int k; /* * CAS. * We need to special case this, since on x86, there are only 3 * free registers, and the code below assigns one of them to * sreg, so we can run out of registers when trying to assign * dreg. Instead, we just set up the register masks, and let the * normal sreg2 assignment code handle this. It would be nice to * do this for all the fixed reg cases too, but there is too much * risk of breakage. */ /* Make sure sreg will be assigned to dest_sreg, and the other sregs won't */ sreg_masks [j] = regmask (dest_sreg); for (k = 0; k < num_sregs; ++k) { if (k != j) sreg_masks [k] &= ~ (regmask (dest_sreg)); } /* * Spill sreg1/2 if they are assigned to dest_sreg. */ for (k = 0; k < num_sregs; ++k) { if (k != j && is_soft_reg (sregs [k], 0) && rs->vassign [sregs [k]] == dest_sreg) free_up_hreg (cfg, bb, tmp, ins, dest_sreg, 0); } /* * We can also run out of registers while processing sreg2 if sreg3 is * assigned to another hreg, so spill sreg3 now. */ if (is_soft_reg (sreg, 0) && rs->vassign [sreg] >= 0 && rs->vassign [sreg] != dest_sreg) { spill_vreg (cfg, bb, tmp, ins, sreg, 0); } continue; } gboolean need_assign = FALSE; if (rs->ifree_mask & (regmask (dest_sreg))) { if (is_global_ireg (sreg)) { int k; /* Argument already in hard reg, need to copy */ MonoInst *copy = create_copy_ins (cfg, bb, tmp, dest_sreg, sreg, NULL, ip, 0); insert_before_ins (bb, ins, copy); for (k = 0; k < num_sregs; ++k) { if (k != j) sreg_masks [k] &= ~ (regmask (dest_sreg)); } /* See below */ dreg_mask &= ~ (regmask (dest_sreg)); } else { val = rs->vassign [sreg]; if (val == -1) { DEBUG (printf ("\tshortcut assignment of R%d to %s\n", sreg, mono_arch_regname (dest_sreg))); assign_reg (cfg, rs, sreg, dest_sreg, 0); } else if (val < -1) { /* sreg is spilled, it can be assigned to dest_sreg */ need_assign = TRUE; } else { /* Argument already in hard reg, need to copy */ MonoInst *copy = create_copy_ins (cfg, bb, tmp, dest_sreg, val, NULL, ip, 0); int k; insert_before_ins (bb, ins, copy); for (k = 0; k < num_sregs; ++k) { if (k != j) sreg_masks [k] &= ~ (regmask (dest_sreg)); } /* * Prevent the dreg from being allocated to dest_sreg * too, since it could force sreg1 to be allocated to * the same reg on x86. */ dreg_mask &= ~ (regmask (dest_sreg)); } } } else { gboolean need_spill = TRUE; int k; need_assign = TRUE; dreg_mask &= ~ (regmask (dest_sreg)); for (k = 0; k < num_sregs; ++k) { if (k != j) sreg_masks [k] &= ~ (regmask (dest_sreg)); } /* * First check if dreg is assigned to dest_sreg2, since we * can't spill a dreg. */ if (spec [MONO_INST_DEST]) val = rs->vassign [ins->dreg]; else val = -1; if (val == dest_sreg && ins->dreg != sreg) { /* * the destination register is already assigned to * dest_sreg2: we need to allocate another register for it * and then copy from this to dest_sreg2. */ int new_dest; new_dest = alloc_int_reg (cfg, bb, tmp, ins, dreg_mask, ins->dreg, &reginfo [ins->dreg]); g_assert (new_dest >= 0); DEBUG (printf ("\tchanging dreg R%d to %s from %s\n", ins->dreg, mono_arch_regname (new_dest), mono_arch_regname (dest_sreg))); prev_dreg = ins->dreg; assign_reg (cfg, rs, ins->dreg, new_dest, 0); create_copy_ins (cfg, bb, tmp, dest_sreg, new_dest, ins, ip, 0); mono_regstate_free_int (rs, dest_sreg); need_spill = FALSE; } if (is_global_ireg (sreg)) { MonoInst *copy = create_copy_ins (cfg, bb, tmp, dest_sreg, sreg, NULL, ip, 0); insert_before_ins (bb, ins, copy); need_assign = FALSE; } else { val = rs->vassign [sreg]; if (val == dest_sreg) { /* sreg2 is already assigned to the correct register */ need_spill = FALSE; } else if (val < -1) { /* sreg2 is spilled, it can be assigned to dest_sreg2 */ } else if (val >= 0) { /* sreg2 already assigned to another register */ /* * We couldn't emit a copy from val to dest_sreg2, because * val might be spilled later while processing this * instruction. So we spill sreg2 so it can be allocated to * dest_sreg2. */ free_up_hreg (cfg, bb, tmp, ins, val, 0); } } if (need_spill) { free_up_hreg (cfg, bb, tmp, ins, dest_sreg, 0); } } if (need_assign) { if (rs->vassign [sreg] < -1) { int spill; /* Need to emit a spill store */ spill = - rs->vassign [sreg] - 1; create_spilled_store (cfg, bb, spill, dest_sreg, sreg, tmp, NULL, ins, bank); } /* force-set sreg */ assign_reg (cfg, rs, sregs [j], dest_sreg, 0); } sregs [j] = dest_sreg; } mono_inst_set_src_registers (ins, sregs); /* * TRACK DREG */ bank = dreg_bank (spec); if (spec_dest && is_soft_reg (ins->dreg, bank)) { prev_dreg = ins->dreg; } if (spec_dest == 'b') { /* * The dest reg is read by the instruction, not written, so * avoid allocating sreg1/sreg2 to the same reg. */ if (dest_sregs [0] != -1) dreg_mask &= ~ (regmask (dest_sregs [0])); for (j = 1; j < num_sregs; ++j) { if (dest_sregs [j] != -1) dreg_mask &= ~ (regmask (dest_sregs [j])); } val = rs->vassign [ins->dreg]; if (is_soft_reg (ins->dreg, bank) && (val >= 0) && (!(regmask (val) & dreg_mask))) { /* DREG is already allocated to a register needed for sreg1 */ spill_vreg (cfg, bb, tmp, ins, ins->dreg, 0); } } /* * If dreg is a fixed regpair, free up both of the needed hregs to avoid * various complex situations. */ if (MONO_ARCH_INST_IS_REGPAIR (spec_dest)) { guint32 dreg2, dest_dreg2; g_assert (is_soft_reg (ins->dreg, bank)); if (dest_dreg != -1) { if (rs->vassign [ins->dreg] != dest_dreg) free_up_hreg (cfg, bb, tmp, ins, dest_dreg, 0); dreg2 = ins->dreg + 1; dest_dreg2 = MONO_ARCH_INST_REGPAIR_REG2 (spec_dest, dest_dreg); if (dest_dreg2 != -1) { if (rs->vassign [dreg2] != dest_dreg2) free_up_hreg (cfg, bb, tmp, ins, dest_dreg2, 0); } } } if (dreg_fixed_mask) { g_assert (!bank); if (is_global_ireg (ins->dreg)) { /* * The argument is already in a hard reg, but that reg is * not usable by this instruction, so allocate a new one. */ val = mono_regstate_alloc_int (rs, dreg_fixed_mask); if (val < 0) val = get_register_spilling (cfg, bb, tmp, ins, dreg_fixed_mask, -1, bank); mono_regstate_free_int (rs, val); dest_dreg = val; /* Fall through */ } else dreg_mask &= dreg_fixed_mask; } if (is_soft_reg (ins->dreg, bank)) { val = rs->vassign [ins->dreg]; if (val < 0) { int spill = 0; if (val < -1) { /* the register gets spilled after this inst */ spill = -val -1; } val = alloc_reg (cfg, bb, tmp, ins, dreg_mask, ins->dreg, &reginfo [ins->dreg], bank); assign_reg (cfg, rs, ins->dreg, val, bank); if (spill) create_spilled_store (cfg, bb, spill, val, prev_dreg, tmp, ins, NULL, bank); } DEBUG (printf ("\tassigned dreg %s to dest R%d\n", mono_regname_full (val, bank), ins->dreg)); ins->dreg = val; } /* Handle regpairs */ if (MONO_ARCH_INST_IS_REGPAIR (spec_dest)) { int reg2 = prev_dreg + 1; g_assert (!bank); g_assert (prev_dreg > -1); g_assert (!is_global_ireg (rs->vassign [prev_dreg])); mask = regpair_reg2_mask (spec_dest, rs->vassign [prev_dreg]); #ifdef TARGET_X86 /* bug #80489 */ mask &= ~regmask (X86_ECX); #endif val = rs->vassign [reg2]; if (val < 0) { int spill = 0; if (val < -1) { /* the register gets spilled after this inst */ spill = -val -1; } val = mono_regstate_alloc_int (rs, mask); if (val < 0) val = get_register_spilling (cfg, bb, tmp, ins, mask, reg2, bank); if (spill) create_spilled_store (cfg, bb, spill, val, reg2, tmp, ins, NULL, bank); } else { if (! (mask & (regmask (val)))) { val = mono_regstate_alloc_int (rs, mask); if (val < 0) val = get_register_spilling (cfg, bb, tmp, ins, mask, reg2, bank); /* Reallocate hreg to the correct register */ create_copy_ins (cfg, bb, tmp, rs->vassign [reg2], val, ins, ip, bank); mono_regstate_free_int (rs, rs->vassign [reg2]); } } DEBUG (printf ("\tassigned dreg-high %s to dest R%d\n", mono_arch_regname (val), reg2)); assign_reg (cfg, rs, reg2, val, bank); dreg_high = val; ins->backend.reg3 = val; if (reg_is_freeable (val, bank) && reg2 >= 0 && (reginfo [reg2].born_in >= i)) { DEBUG (printf ("\tfreeable %s (R%d)\n", mono_arch_regname (val), reg2)); mono_regstate_free_int (rs, val); } } if (prev_dreg >= 0 && is_soft_reg (prev_dreg, bank) && (spec_dest != 'b')) { /* * In theory, we could free up the hreg even if the vreg is alive, * but branches inside bblocks force us to assign the same hreg * to a vreg every time it is encountered. */ int dreg = rs->vassign [prev_dreg]; g_assert (dreg >= 0); DEBUG (printf ("\tfreeable %s (R%d) (born in %d)\n", mono_regname_full (dreg, bank), prev_dreg, reginfo [prev_dreg].born_in)); if (G_UNLIKELY (bank)) mono_regstate_free_general (rs, dreg, bank); else mono_regstate_free_int (rs, dreg); rs->vassign [prev_dreg] = -1; } if ((dest_dreg != -1) && (ins->dreg != dest_dreg)) { /* this instruction only outputs to dest_dreg, need to copy */ create_copy_ins (cfg, bb, tmp, ins->dreg, dest_dreg, ins, ip, bank); ins->dreg = dest_dreg; if (G_UNLIKELY (bank)) { /* the register we need to free up may be used in another logical regbank * so do a translate just in case. */ int translated_bank = translate_bank (cfg->rs, bank, dest_dreg); if (rs->symbolic [translated_bank] [dest_dreg] >= regbank_size [translated_bank]) free_up_hreg (cfg, bb, tmp, ins, dest_dreg, translated_bank); } else { if (rs->isymbolic [dest_dreg] >= MONO_MAX_IREGS) free_up_hreg (cfg, bb, tmp, ins, dest_dreg, bank); } } if (spec_dest == 'b') { /* * The dest reg is read by the instruction, not written, so * avoid allocating sreg1/sreg2 to the same reg. */ for (j = 0; j < num_sregs; ++j) if (!sreg_bank (j, spec)) sreg_masks [j] &= ~ (regmask (ins->dreg)); } /* * TRACK CLOBBERING */ if ((clob_reg != -1) && (!(rs->ifree_mask & (regmask (clob_reg))))) { DEBUG (printf ("\tforced spill of clobbered reg R%d\n", rs->isymbolic [clob_reg])); free_up_hreg (cfg, bb, tmp, ins, clob_reg, 0); } if (spec [MONO_INST_CLOB] == 'c') { int j, dreg, dreg2, cur_bank; regmask_t s; guint64 clob_mask; clob_mask = MONO_ARCH_CALLEE_REGS; if (rs->ifree_mask != MONO_ARCH_CALLEE_REGS) { /* * Need to avoid spilling the dreg since the dreg is not really * clobbered by the call. */ if ((prev_dreg != -1) && !reg_bank (spec_dest)) dreg = rs->vassign [prev_dreg]; else dreg = -1; if (MONO_ARCH_INST_IS_REGPAIR (spec_dest)) dreg2 = rs->vassign [prev_dreg + 1]; else dreg2 = -1; for (j = 0; j < MONO_MAX_IREGS; ++j) { s = regmask (j); if ((clob_mask & s) && !(rs->ifree_mask & s) && (j != ins->sreg1)) { if ((j != dreg) && (j != dreg2)) free_up_hreg (cfg, bb, tmp, ins, j, 0); else if (rs->isymbolic [j]) /* The hreg is assigned to the dreg of this instruction */ rs->vassign [rs->isymbolic [j]] = -1; mono_regstate_free_int (rs, j); } } } for (cur_bank = 1; cur_bank < MONO_NUM_REGBANKS; ++ cur_bank) { if (rs->free_mask [cur_bank] != regbank_callee_regs [cur_bank]) { clob_mask = regbank_callee_regs [cur_bank]; if ((prev_dreg != -1) && reg_bank (spec_dest)) dreg = rs->vassign [prev_dreg]; else dreg = -1; for (j = 0; j < regbank_size [cur_bank]; ++j) { /* we are looping though the banks in the outer loop * so, we don't need to deal with mirrored hregs * because we will get them in one of the other bank passes. */ if (is_hreg_mirrored (rs, cur_bank, j)) continue; s = regmask (j); if ((clob_mask & s) && !(rs->free_mask [cur_bank] & s)) { if (j != dreg) free_up_hreg (cfg, bb, tmp, ins, j, cur_bank); else if (rs->symbolic [cur_bank] [j]) /* The hreg is assigned to the dreg of this instruction */ rs->vassign [rs->symbolic [cur_bank] [j]] = -1; mono_regstate_free_general (rs, j, cur_bank); } } } } } /* * TRACK ARGUMENT REGS */ if (spec [MONO_INST_CLOB] == 'c' && MONO_IS_CALL (ins)) { MonoCallInst *call = (MonoCallInst*)ins; GSList *list; /* * This needs to be done before assigning sreg1, so sreg1 will * not be assigned one of the argument regs. */ /* * Assign all registers in call->out_reg_args to the proper * argument registers. */ list = call->out_ireg_args; if (list) { while (list) { guint32 regpair; int reg, hreg; regpair = (guint32)(gssize)(list->data); hreg = regpair >> 24; reg = regpair & 0xffffff; assign_reg (cfg, rs, reg, hreg, 0); sreg_masks [0] &= ~(regmask (hreg)); DEBUG (printf ("\tassigned arg reg %s to R%d\n", mono_arch_regname (hreg), reg)); list = g_slist_next (list); } } list = call->out_freg_args; if (list) { while (list) { guint32 regpair; int reg, hreg; regpair = (guint32)(gssize)(list->data); hreg = regpair >> 24; reg = regpair & 0xffffff; assign_reg (cfg, rs, reg, hreg, 1); DEBUG (printf ("\tassigned arg reg %s to R%d\n", mono_regname_full (hreg, 1), reg)); list = g_slist_next (list); } } } /* * TRACK SREG1 */ bank = sreg1_bank (spec); if (MONO_ARCH_INST_IS_REGPAIR (spec_dest) && (spec [MONO_INST_CLOB] == '1')) { int sreg1 = sregs [0]; int dest_sreg1 = dest_sregs [0]; g_assert (is_soft_reg (sreg1, bank)); /* To simplify things, we allocate the same regpair to sreg1 and dreg */ if (dest_sreg1 != -1) g_assert (dest_sreg1 == ins->dreg); val = mono_regstate_alloc_int (rs, regmask (ins->dreg)); g_assert (val >= 0); if (rs->vassign [sreg1] >= 0 && rs->vassign [sreg1] != val) // FIXME: g_assert_not_reached (); assign_reg (cfg, rs, sreg1, val, bank); DEBUG (printf ("\tassigned sreg1-low %s to R%d\n", mono_regname_full (val, bank), sreg1)); g_assert ((regmask (dreg_high)) & regpair_reg2_mask (spec_src1, ins->dreg)); val = mono_regstate_alloc_int (rs, regmask (dreg_high)); g_assert (val >= 0); if (rs->vassign [sreg1 + 1] >= 0 && rs->vassign [sreg1 + 1] != val) // FIXME: g_assert_not_reached (); assign_reg (cfg, rs, sreg1 + 1, val, bank); DEBUG (printf ("\tassigned sreg1-high %s to R%d\n", mono_regname_full (val, bank), sreg1 + 1)); /* Skip rest of this section */ dest_sregs [0] = -1; } if (sreg_fixed_masks [0]) { g_assert (!bank); if (is_global_ireg (sregs [0])) { /* * The argument is already in a hard reg, but that reg is * not usable by this instruction, so allocate a new one. */ val = mono_regstate_alloc_int (rs, sreg_fixed_masks [0]); if (val < 0) val = get_register_spilling (cfg, bb, tmp, ins, sreg_fixed_masks [0], -1, bank); mono_regstate_free_int (rs, val); dest_sregs [0] = val; /* Fall through to the dest_sreg1 != -1 case */ } else sreg_masks [0] &= sreg_fixed_masks [0]; } if (dest_sregs [0] != -1) { sreg_masks [0] = regmask (dest_sregs [0]); if ((rs->vassign [sregs [0]] != dest_sregs [0]) && !(rs->ifree_mask & (regmask (dest_sregs [0])))) { free_up_hreg (cfg, bb, tmp, ins, dest_sregs [0], 0); } if (is_global_ireg (sregs [0])) { /* The argument is already in a hard reg, need to copy */ MonoInst *copy = create_copy_ins (cfg, bb, tmp, dest_sregs [0], sregs [0], NULL, ip, 0); insert_before_ins (bb, ins, copy); sregs [0] = dest_sregs [0]; } } if (is_soft_reg (sregs [0], bank)) { val = rs->vassign [sregs [0]]; prev_sregs [0] = sregs [0]; if (val < 0) { int spill = 0; if (val < -1) { /* the register gets spilled after this inst */ spill = -val -1; } if ((ins->opcode == OP_MOVE) && !spill && !bank && is_local_ireg (ins->dreg) && (rs->ifree_mask & (regmask (ins->dreg)))) { /* * Allocate the same hreg to sreg1 as well so the * peephole can get rid of the move. */ sreg_masks [0] = regmask (ins->dreg); } if (spec [MONO_INST_CLOB] == '1' && !dreg_bank (spec) && (rs->ifree_mask & (regmask (ins->dreg)))) /* Allocate the same reg to sreg1 to avoid a copy later */ sreg_masks [0] = regmask (ins->dreg); val = alloc_reg (cfg, bb, tmp, ins, sreg_masks [0], sregs [0], &reginfo [sregs [0]], bank); assign_reg (cfg, rs, sregs [0], val, bank); DEBUG (printf ("\tassigned sreg1 %s to R%d\n", mono_regname_full (val, bank), sregs [0])); if (spill) { /* * Need to insert before the instruction since it can * overwrite sreg1. */ create_spilled_store (cfg, bb, spill, val, prev_sregs [0], tmp, NULL, ins, bank); } } else if ((dest_sregs [0] != -1) && (dest_sregs [0] != val)) { MonoInst *copy = create_copy_ins (cfg, bb, tmp, dest_sregs [0], val, NULL, ip, bank); insert_before_ins (bb, ins, copy); for (j = 1; j < num_sregs; ++j) sreg_masks [j] &= ~(regmask (dest_sregs [0])); val = dest_sregs [0]; } sregs [0] = val; } else { prev_sregs [0] = -1; } mono_inst_set_src_registers (ins, sregs); for (j = 1; j < num_sregs; ++j) sreg_masks [j] &= ~(regmask (sregs [0])); /* Handle the case when sreg1 is a regpair but dreg is not */ if (MONO_ARCH_INST_IS_REGPAIR (spec_src1) && (spec [MONO_INST_CLOB] != '1')) { int reg2 = prev_sregs [0] + 1; g_assert (!bank); g_assert (prev_sregs [0] > -1); g_assert (!is_global_ireg (rs->vassign [prev_sregs [0]])); mask = regpair_reg2_mask (spec_src1, rs->vassign [prev_sregs [0]]); val = rs->vassign [reg2]; if (val < 0) { int spill = 0; if (val < -1) { /* the register gets spilled after this inst */ spill = -val -1; } val = mono_regstate_alloc_int (rs, mask); if (val < 0) val = get_register_spilling (cfg, bb, tmp, ins, mask, reg2, bank); if (spill) g_assert_not_reached (); } else { if (! (mask & (regmask (val)))) { /* The vreg is already allocated to a wrong hreg */ /* FIXME: */ g_assert_not_reached (); #if 0 val = mono_regstate_alloc_int (rs, mask); if (val < 0) val = get_register_spilling (cfg, bb, tmp, ins, mask, reg2, bank); /* Reallocate hreg to the correct register */ create_copy_ins (cfg, bb, tmp, rs->vassign [reg2], val, ins, ip, bank); mono_regstate_free_int (rs, rs->vassign [reg2]); #endif } } sreg1_high = val; DEBUG (printf ("\tassigned sreg1 hreg %s to dest R%d\n", mono_arch_regname (val), reg2)); assign_reg (cfg, rs, reg2, val, bank); } /* Handle dreg==sreg1 */ if (((dreg_is_fp (spec) && sreg1_is_fp (spec)) || spec [MONO_INST_CLOB] == '1') && ins->dreg != sregs [0]) { MonoInst *sreg2_copy = NULL; MonoInst *copy; int bank = reg_bank (spec_src1); if (ins->dreg == sregs [1]) { /* * copying sreg1 to dreg could clobber sreg2, so allocate a new * register for it. */ int reg2 = alloc_reg (cfg, bb, tmp, ins, dreg_mask, sregs [1], NULL, bank); DEBUG (printf ("\tneed to copy sreg2 %s to reg %s\n", mono_regname_full (sregs [1], bank), mono_regname_full (reg2, bank))); sreg2_copy = create_copy_ins (cfg, bb, tmp, reg2, sregs [1], NULL, ip, bank); prev_sregs [1] = sregs [1] = reg2; if (G_UNLIKELY (bank)) mono_regstate_free_general (rs, reg2, bank); else mono_regstate_free_int (rs, reg2); } if (MONO_ARCH_INST_IS_REGPAIR (spec_src1)) { /* Copying sreg1_high to dreg could also clobber sreg2 */ if (rs->vassign [prev_sregs [0] + 1] == sregs [1]) /* FIXME: */ g_assert_not_reached (); /* * sreg1 and dest are already allocated to the same regpair by the * SREG1 allocation code. */ g_assert (sregs [0] == ins->dreg); g_assert (dreg_high == sreg1_high); } DEBUG (printf ("\tneed to copy sreg1 %s to dreg %s\n", mono_regname_full (sregs [0], bank), mono_regname_full (ins->dreg, bank))); copy = create_copy_ins (cfg, bb, tmp, ins->dreg, sregs [0], NULL, ip, bank); insert_before_ins (bb, ins, copy); if (sreg2_copy) insert_before_ins (bb, copy, sreg2_copy); /* * Need to prevent sreg2 to be allocated to sreg1, since that * would screw up the previous copy. */ sreg_masks [1] &= ~ (regmask (sregs [0])); /* we set sreg1 to dest as well */ prev_sregs [0] = sregs [0] = ins->dreg; sreg_masks [1] &= ~ (regmask (ins->dreg)); } mono_inst_set_src_registers (ins, sregs); /* * TRACK SREG2, 3, ... */ for (j = 1; j < num_sregs; ++j) { int k; bank = sreg_bank (j, spec); if (MONO_ARCH_INST_IS_REGPAIR (spec [MONO_INST_SRC1 + j])) g_assert_not_reached (); if (dest_sregs [j] != -1 && is_global_ireg (sregs [j])) { /* * Argument already in a global hard reg, copy it to the fixed reg, without * allocating it to the fixed reg. */ MonoInst *copy = create_copy_ins (cfg, bb, tmp, dest_sregs [j], sregs [j], NULL, ip, 0); insert_before_ins (bb, ins, copy); sregs [j] = dest_sregs [j]; } else if (is_soft_reg (sregs [j], bank)) { val = rs->vassign [sregs [j]]; if (dest_sregs [j] != -1 && val >= 0 && dest_sregs [j] != val) { /* * The sreg is already allocated to a hreg, but not to the fixed * reg required by the instruction. Spill the sreg, so it can be * allocated to the fixed reg by the code below. */ /* Currently, this code should only be hit for CAS */ spill_vreg (cfg, bb, tmp, ins, sregs [j], 0); val = rs->vassign [sregs [j]]; } if (val < 0) { int spill = 0; if (val < -1) { /* the register gets spilled after this inst */ spill = -val -1; } val = alloc_reg (cfg, bb, tmp, ins, sreg_masks [j], sregs [j], &reginfo [sregs [j]], bank); assign_reg (cfg, rs, sregs [j], val, bank); DEBUG (printf ("\tassigned sreg%d %s to R%d\n", j + 1, mono_regname_full (val, bank), sregs [j])); if (spill) { /* * Need to insert before the instruction since it can * overwrite sreg2. */ create_spilled_store (cfg, bb, spill, val, sregs [j], tmp, NULL, ins, bank); } } sregs [j] = val; for (k = j + 1; k < num_sregs; ++k) sreg_masks [k] &= ~ (regmask (sregs [j])); } else { prev_sregs [j] = -1; } } mono_inst_set_src_registers (ins, sregs); /* Sanity check */ /* Do this only for CAS for now */ for (j = 1; j < num_sregs; ++j) { int sreg = sregs [j]; int dest_sreg = dest_sregs [j]; if (j == 2 && dest_sreg != -1) { int k; g_assert (sreg == dest_sreg); for (k = 0; k < num_sregs; ++k) { if (k != j) g_assert (sregs [k] != dest_sreg); } } } /*if (reg_is_freeable (ins->sreg1) && prev_sreg1 >= 0 && reginfo [prev_sreg1].born_in >= i) { DEBUG (printf ("freeable %s\n", mono_arch_regname (ins->sreg1))); mono_regstate_free_int (rs, ins->sreg1); } if (reg_is_freeable (ins->sreg2) && prev_sreg2 >= 0 && reginfo [prev_sreg2].born_in >= i) { DEBUG (printf ("freeable %s\n", mono_arch_regname (ins->sreg2))); mono_regstate_free_int (rs, ins->sreg2); }*/ DEBUG (mono_print_ins_index (i, ins)); } // FIXME: Set MAX_FREGS to 8 // FIXME: Optimize generated code #if MONO_ARCH_USE_FPSTACK /* * Make a forward pass over the code, simulating the fp stack, making sure the * arguments required by the fp opcodes are at the top of the stack. */ if (has_fp) { MonoInst *prev = NULL; MonoInst *fxch; int tmp; g_assert (num_sregs <= 2); for (ins = bb->code; ins; ins = ins->next) { spec = ins_get_spec (ins->opcode); DEBUG (printf ("processing:")); DEBUG (mono_print_ins_index (0, ins)); if (ins->opcode == OP_FMOVE) { /* Do it by renaming the source to the destination on the stack */ // FIXME: Is this correct ? for (i = 0; i < sp; ++i) if (fpstack [i] == ins->sreg1) fpstack [i] = ins->dreg; prev = ins; continue; } if (sreg1_is_fp (spec) && sreg2_is_fp (spec) && (fpstack [sp - 2] != ins->sreg1)) { /* Arg1 must be in %st(1) */ g_assert (prev); i = 0; while ((i < sp) && (fpstack [i] != ins->sreg1)) i ++; g_assert (i < sp); if (sp - 1 - i > 0) { /* First move it to %st(0) */ DEBUG (printf ("\tswap %%st(0) and %%st(%d)\n", sp - 1 - i)); MONO_INST_NEW (cfg, fxch, OP_X86_FXCH); fxch->inst_imm = sp - 1 - i; mono_bblock_insert_after_ins (bb, prev, fxch); prev = fxch; tmp = fpstack [sp - 1]; fpstack [sp - 1] = fpstack [i]; fpstack [i] = tmp; } /* Then move it to %st(1) */ DEBUG (printf ("\tswap %%st(0) and %%st(1)\n")); MONO_INST_NEW (cfg, fxch, OP_X86_FXCH); fxch->inst_imm = 1; mono_bblock_insert_after_ins (bb, prev, fxch); prev = fxch; tmp = fpstack [sp - 1]; fpstack [sp - 1] = fpstack [sp - 2]; fpstack [sp - 2] = tmp; } if (sreg2_is_fp (spec)) { g_assert (sp > 0); if (fpstack [sp - 1] != ins->sreg2) { g_assert (prev); i = 0; while ((i < sp) && (fpstack [i] != ins->sreg2)) i ++; g_assert (i < sp); DEBUG (printf ("\tswap %%st(0) and %%st(%d)\n", sp - 1 - i)); MONO_INST_NEW (cfg, fxch, OP_X86_FXCH); fxch->inst_imm = sp - 1 - i; mono_bblock_insert_after_ins (bb, prev, fxch); prev = fxch; tmp = fpstack [sp - 1]; fpstack [sp - 1] = fpstack [i]; fpstack [i] = tmp; } sp --; } if (sreg1_is_fp (spec)) { g_assert (sp > 0); if (fpstack [sp - 1] != ins->sreg1) { g_assert (prev); i = 0; while ((i < sp) && (fpstack [i] != ins->sreg1)) i ++; g_assert (i < sp); DEBUG (printf ("\tswap %%st(0) and %%st(%d)\n", sp - 1 - i)); MONO_INST_NEW (cfg, fxch, OP_X86_FXCH); fxch->inst_imm = sp - 1 - i; mono_bblock_insert_after_ins (bb, prev, fxch); prev = fxch; tmp = fpstack [sp - 1]; fpstack [sp - 1] = fpstack [i]; fpstack [i] = tmp; } sp --; } if (dreg_is_fp (spec)) { g_assert (sp < 8); fpstack [sp ++] = ins->dreg; } if (G_UNLIKELY (cfg->verbose_level >= 2)) { printf ("\t["); for (i = 0; i < sp; ++i) printf ("%s%%fr%d", (i > 0) ? ", " : "", fpstack [i]); printf ("]\n"); } prev = ins; } if (sp && bb != cfg->bb_exit && !(bb->out_count == 1 && bb->out_bb [0] == cfg->bb_exit)) { /* Remove remaining items from the fp stack */ /* * These can remain for example as a result of a dead fmove like in * System.Collections.Generic.EqualityComparer<double>.Equals (). */ while (sp) { MONO_INST_NEW (cfg, ins, OP_X86_FPOP); mono_add_ins_to_end (bb, ins); sp --; } } } #endif } CompRelation mono_opcode_to_cond (int opcode) { switch (opcode) { case OP_CEQ: case OP_IBEQ: case OP_ICEQ: case OP_LBEQ: case OP_LCEQ: case OP_FBEQ: case OP_FCEQ: case OP_RBEQ: case OP_RCEQ: case OP_COND_EXC_EQ: case OP_COND_EXC_IEQ: case OP_CMOV_IEQ: case OP_CMOV_LEQ: return CMP_EQ; case OP_FCNEQ: case OP_RCNEQ: case OP_ICNEQ: case OP_IBNE_UN: case OP_LBNE_UN: case OP_FBNE_UN: case OP_COND_EXC_NE_UN: case OP_COND_EXC_INE_UN: case OP_CMOV_INE_UN: case OP_CMOV_LNE_UN: return CMP_NE; case OP_FCLE: case OP_ICLE: case OP_IBLE: case OP_LBLE: case OP_FBLE: case OP_CMOV_ILE: case OP_CMOV_LLE: return CMP_LE; case OP_FCGE: case OP_ICGE: case OP_IBGE: case OP_LBGE: case OP_FBGE: case OP_CMOV_IGE: case OP_CMOV_LGE: return CMP_GE; case OP_CLT: case OP_IBLT: case OP_ICLT: case OP_LBLT: case OP_LCLT: case OP_FBLT: case OP_FCLT: case OP_RBLT: case OP_RCLT: case OP_COND_EXC_LT: case OP_COND_EXC_ILT: case OP_CMOV_ILT: case OP_CMOV_LLT: return CMP_LT; case OP_CGT: case OP_IBGT: case OP_ICGT: case OP_LBGT: case OP_LCGT: case OP_FBGT: case OP_FCGT: case OP_RBGT: case OP_RCGT: case OP_COND_EXC_GT: case OP_COND_EXC_IGT: case OP_CMOV_IGT: case OP_CMOV_LGT: return CMP_GT; case OP_ICLE_UN: case OP_IBLE_UN: case OP_LBLE_UN: case OP_FBLE_UN: case OP_COND_EXC_LE_UN: case OP_COND_EXC_ILE_UN: case OP_CMOV_ILE_UN: case OP_CMOV_LLE_UN: return CMP_LE_UN; case OP_ICGE_UN: case OP_IBGE_UN: case OP_LBGE_UN: case OP_FBGE_UN: case OP_COND_EXC_GE_UN: case OP_CMOV_IGE_UN: case OP_CMOV_LGE_UN: return CMP_GE_UN; case OP_CLT_UN: case OP_IBLT_UN: case OP_ICLT_UN: case OP_LBLT_UN: case OP_LCLT_UN: case OP_FBLT_UN: case OP_FCLT_UN: case OP_RBLT_UN: case OP_RCLT_UN: case OP_COND_EXC_LT_UN: case OP_COND_EXC_ILT_UN: case OP_CMOV_ILT_UN: case OP_CMOV_LLT_UN: return CMP_LT_UN; case OP_CGT_UN: case OP_IBGT_UN: case OP_ICGT_UN: case OP_LBGT_UN: case OP_LCGT_UN: case OP_FCGT_UN: case OP_FBGT_UN: case OP_RCGT_UN: case OP_RBGT_UN: case OP_COND_EXC_GT_UN: case OP_COND_EXC_IGT_UN: case OP_CMOV_IGT_UN: case OP_CMOV_LGT_UN: return CMP_GT_UN; default: printf ("%s\n", mono_inst_name (opcode)); g_assert_not_reached (); return (CompRelation)0; } } CompRelation mono_negate_cond (CompRelation cond) { switch (cond) { case CMP_EQ: return CMP_NE; case CMP_NE: return CMP_EQ; case CMP_LE: return CMP_GT; case CMP_GE: return CMP_LT; case CMP_LT: return CMP_GE; case CMP_GT: return CMP_LE; case CMP_LE_UN: return CMP_GT_UN; case CMP_GE_UN: return CMP_LT_UN; case CMP_LT_UN: return CMP_GE_UN; case CMP_GT_UN: return CMP_LE_UN; default: g_assert_not_reached (); } } CompType mono_opcode_to_type (int opcode, int cmp_opcode) { if ((opcode >= OP_CEQ) && (opcode <= OP_CLT_UN)) return CMP_TYPE_L; else if ((opcode >= OP_IBEQ) && (opcode <= OP_IBLT_UN)) return CMP_TYPE_I; else if ((opcode >= OP_ICEQ) && (opcode <= OP_ICLT_UN)) return CMP_TYPE_I; else if ((opcode >= OP_LBEQ) && (opcode <= OP_LBLT_UN)) return CMP_TYPE_L; else if ((opcode >= OP_LCEQ) && (opcode <= OP_LCLT_UN)) return CMP_TYPE_L; else if ((opcode >= OP_FBEQ) && (opcode <= OP_FBLT_UN)) return CMP_TYPE_F; else if ((opcode >= OP_FCEQ) && (opcode <= OP_FCLT_UN)) return CMP_TYPE_F; else if ((opcode >= OP_COND_EXC_IEQ) && (opcode <= OP_COND_EXC_ILT_UN)) return CMP_TYPE_I; else if ((opcode >= OP_COND_EXC_EQ) && (opcode <= OP_COND_EXC_LT_UN)) { switch (cmp_opcode) { case OP_ICOMPARE: case OP_ICOMPARE_IMM: return CMP_TYPE_I; default: return CMP_TYPE_L; } } else { g_error ("Unknown opcode '%s' in opcode_to_type", mono_inst_name (opcode)); return (CompType)0; } } /* * mono_peephole_ins: * * Perform some architecture independent peephole optimizations. */ void mono_peephole_ins (MonoBasicBlock *bb, MonoInst *ins) { int filter = FILTER_IL_SEQ_POINT; MonoInst *last_ins = mono_inst_prev (ins, filter); switch (ins->opcode) { case OP_MUL_IMM: /* remove unnecessary multiplication with 1 */ if (ins->inst_imm == 1) { if (ins->dreg != ins->sreg1) ins->opcode = OP_MOVE; else MONO_DELETE_INS (bb, ins); } break; case OP_LOAD_MEMBASE: case OP_LOADI4_MEMBASE: /* * Note: if reg1 = reg2 the load op is removed * * OP_STORE_MEMBASE_REG reg1, offset(basereg) * OP_LOAD_MEMBASE offset(basereg), reg2 * --> * OP_STORE_MEMBASE_REG reg1, offset(basereg) * OP_MOVE reg1, reg2 */ if (last_ins && last_ins->opcode == OP_GC_LIVENESS_DEF) last_ins = mono_inst_prev (ins, filter); if (last_ins && (((ins->opcode == OP_LOADI4_MEMBASE) && (last_ins->opcode == OP_STOREI4_MEMBASE_REG)) || ((ins->opcode == OP_LOAD_MEMBASE) && (last_ins->opcode == OP_STORE_MEMBASE_REG))) && ins->inst_basereg == last_ins->inst_destbasereg && ins->inst_offset == last_ins->inst_offset) { if (ins->dreg == last_ins->sreg1) { MONO_DELETE_INS (bb, ins); break; } else { ins->opcode = OP_MOVE; ins->sreg1 = last_ins->sreg1; } /* * Note: reg1 must be different from the basereg in the second load * Note: if reg1 = reg2 is equal then second load is removed * * OP_LOAD_MEMBASE offset(basereg), reg1 * OP_LOAD_MEMBASE offset(basereg), reg2 * --> * OP_LOAD_MEMBASE offset(basereg), reg1 * OP_MOVE reg1, reg2 */ } if (last_ins && (last_ins->opcode == OP_LOADI4_MEMBASE || last_ins->opcode == OP_LOAD_MEMBASE) && ins->inst_basereg != last_ins->dreg && ins->inst_basereg == last_ins->inst_basereg && ins->inst_offset == last_ins->inst_offset) { if (ins->dreg == last_ins->dreg) { MONO_DELETE_INS (bb, ins); } else { ins->opcode = OP_MOVE; ins->sreg1 = last_ins->dreg; } //g_assert_not_reached (); #if 0 /* * OP_STORE_MEMBASE_IMM imm, offset(basereg) * OP_LOAD_MEMBASE offset(basereg), reg * --> * OP_STORE_MEMBASE_IMM imm, offset(basereg) * OP_ICONST reg, imm */ } else if (last_ins && (last_ins->opcode == OP_STOREI4_MEMBASE_IMM || last_ins->opcode == OP_STORE_MEMBASE_IMM) && ins->inst_basereg == last_ins->inst_destbasereg && ins->inst_offset == last_ins->inst_offset) { ins->opcode = OP_ICONST; ins->inst_c0 = last_ins->inst_imm; g_assert_not_reached (); // check this rule #endif } break; case OP_LOADI1_MEMBASE: case OP_LOADU1_MEMBASE: /* * Note: if reg1 = reg2 the load op is removed * * OP_STORE_MEMBASE_REG reg1, offset(basereg) * OP_LOAD_MEMBASE offset(basereg), reg2 * --> * OP_STORE_MEMBASE_REG reg1, offset(basereg) * OP_MOVE reg1, reg2 */ if (last_ins && (last_ins->opcode == OP_STOREI1_MEMBASE_REG) && ins->inst_basereg == last_ins->inst_destbasereg && ins->inst_offset == last_ins->inst_offset) { ins->opcode = (ins->opcode == OP_LOADI1_MEMBASE) ? OP_PCONV_TO_I1 : OP_PCONV_TO_U1; ins->sreg1 = last_ins->sreg1; } break; case OP_LOADI2_MEMBASE: case OP_LOADU2_MEMBASE: /* * Note: if reg1 = reg2 the load op is removed * * OP_STORE_MEMBASE_REG reg1, offset(basereg) * OP_LOAD_MEMBASE offset(basereg), reg2 * --> * OP_STORE_MEMBASE_REG reg1, offset(basereg) * OP_MOVE reg1, reg2 */ if (last_ins && (last_ins->opcode == OP_STOREI2_MEMBASE_REG) && ins->inst_basereg == last_ins->inst_destbasereg && ins->inst_offset == last_ins->inst_offset) { #if SIZEOF_REGISTER == 8 ins->opcode = (ins->opcode == OP_LOADI2_MEMBASE) ? OP_PCONV_TO_I2 : OP_PCONV_TO_U2; #else /* The definition of OP_PCONV_TO_U2 is wrong */ ins->opcode = (ins->opcode == OP_LOADI2_MEMBASE) ? OP_PCONV_TO_I2 : OP_ICONV_TO_U2; #endif ins->sreg1 = last_ins->sreg1; } break; case OP_LOADX_MEMBASE: if (last_ins && last_ins->opcode == OP_STOREX_MEMBASE && ins->inst_basereg == last_ins->inst_destbasereg && ins->inst_offset == last_ins->inst_offset) { if (ins->dreg == last_ins->sreg1) { MONO_DELETE_INS (bb, ins); break; } else { ins->opcode = OP_XMOVE; ins->sreg1 = last_ins->sreg1; } } break; case OP_MOVE: case OP_FMOVE: /* * Removes: * * OP_MOVE reg, reg */ if (ins->dreg == ins->sreg1) { MONO_DELETE_INS (bb, ins); break; } /* * Removes: * * OP_MOVE sreg, dreg * OP_MOVE dreg, sreg */ if (last_ins && last_ins->opcode == ins->opcode && ins->sreg1 == last_ins->dreg && ins->dreg == last_ins->sreg1) { MONO_DELETE_INS (bb, ins); } break; case OP_NOP: MONO_DELETE_INS (bb, ins); break; } } int mini_exception_id_by_name (const char *name) { if (strcmp (name, "NullReferenceException") == 0) return MONO_EXC_NULL_REF; if (strcmp (name, "IndexOutOfRangeException") == 0) return MONO_EXC_INDEX_OUT_OF_RANGE; if (strcmp (name, "OverflowException") == 0) return MONO_EXC_OVERFLOW; if (strcmp (name, "ArithmeticException") == 0) return MONO_EXC_ARITHMETIC; if (strcmp (name, "DivideByZeroException") == 0) return MONO_EXC_DIVIDE_BY_ZERO; if (strcmp (name, "InvalidCastException") == 0) return MONO_EXC_INVALID_CAST; if (strcmp (name, "ArrayTypeMismatchException") == 0) return MONO_EXC_ARRAY_TYPE_MISMATCH; if (strcmp (name, "ArgumentException") == 0) return MONO_EXC_ARGUMENT; if (strcmp (name, "ArgumentOutOfRangeException") == 0) return MONO_EXC_ARGUMENT_OUT_OF_RANGE; if (strcmp (name, "OutOfMemoryException") == 0) return MONO_EXC_ARGUMENT_OUT_OF_MEMORY; g_error ("Unknown intrinsic exception %s\n", name); return -1; } gboolean mini_type_is_hfa (MonoType *t, int *out_nfields, int *out_esize) { MonoClass *klass; gpointer iter; MonoClassField *field; MonoType *ftype, *prev_ftype = NULL; int nfields = 0; klass = mono_class_from_mono_type_internal (t); iter = NULL; while ((field = mono_class_get_fields_internal (klass, &iter))) { if (field->type->attrs & FIELD_ATTRIBUTE_STATIC) continue; ftype = mono_field_get_type_internal (field); if (MONO_TYPE_ISSTRUCT (ftype)) { int nested_nfields, nested_esize; if (!mini_type_is_hfa (ftype, &nested_nfields, &nested_esize)) return FALSE; if (nested_esize == 4) ftype = m_class_get_byval_arg (mono_defaults.single_class); else ftype = m_class_get_byval_arg (mono_defaults.double_class); if (prev_ftype && prev_ftype->type != ftype->type) return FALSE; prev_ftype = ftype; nfields += nested_nfields; } else { if (!(!m_type_is_byref (ftype) && (ftype->type == MONO_TYPE_R4 || ftype->type == MONO_TYPE_R8))) return FALSE; if (prev_ftype && prev_ftype->type != ftype->type) return FALSE; prev_ftype = ftype; nfields ++; } } if (nfields == 0) return FALSE; *out_esize = prev_ftype->type == MONO_TYPE_R4 ? 4 : 8; *out_nfields = mono_class_value_size (klass, NULL) / *out_esize; return TRUE; } MonoRegState* mono_regstate_new (void) { MonoRegState* rs = g_new0 (MonoRegState, 1); rs->next_vreg = MAX (MONO_MAX_IREGS, MONO_MAX_FREGS); #ifdef MONO_ARCH_NEED_SIMD_BANK rs->next_vreg = MAX (rs->next_vreg, MONO_MAX_XREGS); #endif return rs; } void mono_regstate_free (MonoRegState *rs) { g_free (rs->vassign); g_free (rs); } #endif /* DISABLE_JIT */ gboolean mono_is_regsize_var (MonoType *t) { t = mini_get_underlying_type (t); switch (t->type) { case MONO_TYPE_I1: case MONO_TYPE_U1: case MONO_TYPE_I2: case MONO_TYPE_U2: case MONO_TYPE_I4: case MONO_TYPE_U4: case MONO_TYPE_I: case MONO_TYPE_U: case MONO_TYPE_PTR: case MONO_TYPE_FNPTR: #if SIZEOF_REGISTER == 8 case MONO_TYPE_I8: case MONO_TYPE_U8: #endif return TRUE; case MONO_TYPE_OBJECT: case MONO_TYPE_STRING: case MONO_TYPE_CLASS: case MONO_TYPE_SZARRAY: case MONO_TYPE_ARRAY: return TRUE; case MONO_TYPE_GENERICINST: if (!mono_type_generic_inst_is_valuetype (t)) return TRUE; return FALSE; case MONO_TYPE_VALUETYPE: return FALSE; default: return FALSE; } }
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/tests/JIT/Regression/JitBlue/GitHub_11733/GitHub_11733.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType /> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="$(MSBuildProjectName).cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType /> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="$(MSBuildProjectName).cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/tests/JIT/IL_Conformance/Old/Conformance_Base/call.ilproj
<Project Sdk="Microsoft.NET.Sdk.IL"> <PropertyGroup> <OutputType>Exe</OutputType> <RestorePackages>true</RestorePackages> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>PdbOnly</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="call.il" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk.IL"> <PropertyGroup> <OutputType>Exe</OutputType> <RestorePackages>true</RestorePackages> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>PdbOnly</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="call.il" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/tests/Loader/classloader/TypeGeneratorTests/TypeGeneratorTest942/Generated942.il
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. .assembly extern mscorlib { .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) .ver 4:0:0:0 } .assembly extern TestFramework { .publickeytoken = ( B0 3F 5F 7F 11 D5 0A 3A ) } //TYPES IN FORWARDER ASSEMBLIES: //TEST ASSEMBLY: .assembly Generated942 { .hash algorithm 0x00008004 } .assembly extern xunit.core {} .class public BaseClass0 { .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void [mscorlib]System.Object::.ctor() ret } } .class public BaseClass1 extends BaseClass0 { .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void BaseClass0::.ctor() ret } } .class public G3_C1414`1<T0> extends class G2_C437`2<class BaseClass1,class BaseClass1> implements class IBase1`1<!T0> { .method public hidebysig newslot virtual instance string Method4() cil managed noinlining { ldstr "G3_C1414::Method4.16055()" ret } .method public hidebysig virtual instance string Method5() cil managed noinlining { ldstr "G3_C1414::Method5.16056()" ret } .method public hidebysig newslot virtual instance string 'IBase1<T0>.Method5'() cil managed noinlining { .override method instance string class IBase1`1<!T0>::Method5() ldstr "G3_C1414::Method5.MI.16057()" ret } .method public hidebysig virtual instance string Method6<M0>() cil managed noinlining { ldstr "G3_C1414::Method6.16058<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig newslot virtual instance string 'IBase1<T0>.Method6'<M0>() cil managed noinlining { .override method instance string class IBase1`1<!T0>::Method6<[1]>() ldstr "G3_C1414::Method6.MI.16059<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig newslot virtual instance string ClassMethod4223() cil managed noinlining { ldstr "G3_C1414::ClassMethod4223.16060()" ret } .method public hidebysig newslot virtual instance string ClassMethod4224<M0>() cil managed noinlining { ldstr "G3_C1414::ClassMethod4224.16061<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig newslot virtual instance string ClassMethod4225<M0>() cil managed noinlining { ldstr "G3_C1414::ClassMethod4225.16062<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void class G2_C437`2<class BaseClass1,class BaseClass1>::.ctor() ret } } .class public abstract G2_C437`2<T0, T1> extends class G1_C8`2<!T0,class BaseClass0> implements class IBase2`2<class BaseClass1,!T1>, class IBase1`1<class BaseClass0> { .method public hidebysig virtual instance string Method7<M0>() cil managed noinlining { ldstr "G2_C437::Method7.8939<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig newslot virtual instance string 'IBase2<class BaseClass1,T1>.Method7'<M0>() cil managed noinlining { .override method instance string class IBase2`2<class BaseClass1,!T1>::Method7<[1]>() ldstr "G2_C437::Method7.MI.8940<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig virtual instance string Method4() cil managed noinlining { ldstr "G2_C437::Method4.8941()" ret } .method public hidebysig newslot virtual instance string 'IBase1<class BaseClass0>.Method4'() cil managed noinlining { .override method instance string class IBase1`1<class BaseClass0>::Method4() ldstr "G2_C437::Method4.MI.8942()" ret } .method public hidebysig newslot virtual instance string Method5() cil managed noinlining { ldstr "G2_C437::Method5.8943()" ret } .method public hidebysig virtual instance string Method6<M0>() cil managed noinlining { ldstr "G2_C437::Method6.8944<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig newslot virtual instance string 'IBase1<class BaseClass0>.Method6'<M0>() cil managed noinlining { .override method instance string class IBase1`1<class BaseClass0>::Method6<[1]>() ldstr "G2_C437::Method6.MI.8945<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig newslot virtual instance string 'G1_C8<T0,class BaseClass0>.ClassMethod1333'() cil managed noinlining { .override method instance string class G1_C8`2<!T0,class BaseClass0>::ClassMethod1333() ldstr "G2_C437::ClassMethod1333.MI.8946()" ret } .method public hidebysig newslot virtual instance string 'G1_C8<T0,class BaseClass0>.ClassMethod1335'<M0>() cil managed noinlining { .override method instance string class G1_C8`2<!T0,class BaseClass0>::ClassMethod1335<[1]>() ldstr "G2_C437::ClassMethod1335.MI.8947<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void class G1_C8`2<!T0,class BaseClass0>::.ctor() ret } } .class interface public abstract IBase1`1<+T0> { .method public hidebysig newslot abstract virtual instance string Method4() cil managed { } .method public hidebysig newslot abstract virtual instance string Method5() cil managed { } .method public hidebysig newslot abstract virtual instance string Method6<M0>() cil managed { } } .class public G1_C8`2<T0, T1> implements class IBase2`2<!T0,!T1>, IBase0 { .method public hidebysig virtual instance string Method7<M0>() cil managed noinlining { ldstr "G1_C8::Method7.4821<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig newslot virtual instance string 'IBase2<T0,T1>.Method7'<M0>() cil managed noinlining { .override method instance string class IBase2`2<!T0,!T1>::Method7<[1]>() ldstr "G1_C8::Method7.MI.4822<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig newslot virtual instance string Method0() cil managed noinlining { ldstr "G1_C8::Method0.4823()" ret } .method public hidebysig newslot virtual instance string 'IBase0.Method0'() cil managed noinlining { .override method instance string IBase0::Method0() ldstr "G1_C8::Method0.MI.4824()" ret } .method public hidebysig virtual instance string Method1() cil managed noinlining { ldstr "G1_C8::Method1.4825()" ret } .method public hidebysig newslot virtual instance string Method2<M0>() cil managed noinlining { ldstr "G1_C8::Method2.4826<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig newslot virtual instance string 'IBase0.Method2'<M0>() cil managed noinlining { .override method instance string IBase0::Method2<[1]>() ldstr "G1_C8::Method2.MI.4827<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig newslot virtual instance string Method3<M0>() cil managed noinlining { ldstr "G1_C8::Method3.4828<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig newslot virtual instance string ClassMethod1332() cil managed noinlining { ldstr "G1_C8::ClassMethod1332.4829()" ret } .method public hidebysig newslot virtual instance string ClassMethod1333() cil managed noinlining { ldstr "G1_C8::ClassMethod1333.4830()" ret } .method public hidebysig newslot virtual instance string ClassMethod1334<M0>() cil managed noinlining { ldstr "G1_C8::ClassMethod1334.4831<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig newslot virtual instance string ClassMethod1335<M0>() cil managed noinlining { ldstr "G1_C8::ClassMethod1335.4832<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void [mscorlib]System.Object::.ctor() ret } } .class interface public abstract IBase2`2<+T0, -T1> { .method public hidebysig newslot abstract virtual instance string Method7<M0>() cil managed { } } .class interface public abstract IBase0 { .method public hidebysig newslot abstract virtual instance string Method0() cil managed { } .method public hidebysig newslot abstract virtual instance string Method1() cil managed { } .method public hidebysig newslot abstract virtual instance string Method2<M0>() cil managed { } .method public hidebysig newslot abstract virtual instance string Method3<M0>() cil managed { } } .class public auto ansi beforefieldinit Generated942 { .method static void M.BaseClass0<(BaseClass0)W>(!!W inst, string exp) cil managed { .maxstack 5 .locals init (string[] actualResults) ldc.i4.s 0 newarr string stloc.s actualResults ldarg.1 ldstr "M.BaseClass0<(BaseClass0)W>(!!W inst, string exp)" ldc.i4.s 0 ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.BaseClass1<(BaseClass1)W>(!!W inst, string exp) cil managed { .maxstack 5 .locals init (string[] actualResults) ldc.i4.s 0 newarr string stloc.s actualResults ldarg.1 ldstr "M.BaseClass1<(BaseClass1)W>(!!W inst, string exp)" ldc.i4.s 0 ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.G3_C1414.T<T0,(class G3_C1414`1<!!T0>)W>(!!W 'inst', string exp) cil managed { .maxstack 20 .locals init (string[] actualResults) ldc.i4.s 15 newarr string stloc.s actualResults ldarg.1 ldstr "M.G3_C1414.T<T0,(class G3_C1414`1<!!T0>)W>(!!W 'inst', string exp)" ldc.i4.s 15 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<!!T0>::ClassMethod1332() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<!!T0>::ClassMethod1333() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<!!T0>::ClassMethod1334<object>() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<!!T0>::ClassMethod1335<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<!!T0>::ClassMethod4223() stelem.ref ldloc.s actualResults ldc.i4.s 5 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<!!T0>::ClassMethod4224<object>() stelem.ref ldloc.s actualResults ldc.i4.s 6 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<!!T0>::ClassMethod4225<object>() stelem.ref ldloc.s actualResults ldc.i4.s 7 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<!!T0>::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 8 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<!!T0>::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 9 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<!!T0>::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 10 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<!!T0>::Method3<object>() stelem.ref ldloc.s actualResults ldc.i4.s 11 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<!!T0>::Method4() stelem.ref ldloc.s actualResults ldc.i4.s 12 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<!!T0>::Method5() stelem.ref ldloc.s actualResults ldc.i4.s 13 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<!!T0>::Method6<object>() stelem.ref ldloc.s actualResults ldc.i4.s 14 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<!!T0>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.G3_C1414.A<(class G3_C1414`1<class BaseClass0>)W>(!!W 'inst', string exp) cil managed { .maxstack 20 .locals init (string[] actualResults) ldc.i4.s 15 newarr string stloc.s actualResults ldarg.1 ldstr "M.G3_C1414.A<(class G3_C1414`1<class BaseClass0>)W>(!!W 'inst', string exp)" ldc.i4.s 15 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass0>::ClassMethod1332() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass0>::ClassMethod1333() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass0>::ClassMethod1334<object>() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass0>::ClassMethod1335<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass0>::ClassMethod4223() stelem.ref ldloc.s actualResults ldc.i4.s 5 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass0>::ClassMethod4224<object>() stelem.ref ldloc.s actualResults ldc.i4.s 6 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass0>::ClassMethod4225<object>() stelem.ref ldloc.s actualResults ldc.i4.s 7 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass0>::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 8 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass0>::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 9 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass0>::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 10 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass0>::Method3<object>() stelem.ref ldloc.s actualResults ldc.i4.s 11 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass0>::Method4() stelem.ref ldloc.s actualResults ldc.i4.s 12 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass0>::Method5() stelem.ref ldloc.s actualResults ldc.i4.s 13 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass0>::Method6<object>() stelem.ref ldloc.s actualResults ldc.i4.s 14 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass0>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.G3_C1414.B<(class G3_C1414`1<class BaseClass1>)W>(!!W 'inst', string exp) cil managed { .maxstack 20 .locals init (string[] actualResults) ldc.i4.s 15 newarr string stloc.s actualResults ldarg.1 ldstr "M.G3_C1414.B<(class G3_C1414`1<class BaseClass1>)W>(!!W 'inst', string exp)" ldc.i4.s 15 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass1>::ClassMethod1332() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass1>::ClassMethod1333() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass1>::ClassMethod1334<object>() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass1>::ClassMethod1335<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass1>::ClassMethod4223() stelem.ref ldloc.s actualResults ldc.i4.s 5 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass1>::ClassMethod4224<object>() stelem.ref ldloc.s actualResults ldc.i4.s 6 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass1>::ClassMethod4225<object>() stelem.ref ldloc.s actualResults ldc.i4.s 7 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass1>::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 8 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass1>::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 9 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass1>::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 10 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass1>::Method3<object>() stelem.ref ldloc.s actualResults ldc.i4.s 11 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass1>::Method4() stelem.ref ldloc.s actualResults ldc.i4.s 12 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass1>::Method5() stelem.ref ldloc.s actualResults ldc.i4.s 13 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass1>::Method6<object>() stelem.ref ldloc.s actualResults ldc.i4.s 14 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.G2_C437.T.T<T0,T1,(class G2_C437`2<!!T0,!!T1>)W>(!!W 'inst', string exp) cil managed { .maxstack 17 .locals init (string[] actualResults) ldc.i4.s 12 newarr string stloc.s actualResults ldarg.1 ldstr "M.G2_C437.T.T<T0,T1,(class G2_C437`2<!!T0,!!T1>)W>(!!W 'inst', string exp)" ldc.i4.s 12 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<!!T0,!!T1>::ClassMethod1332() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<!!T0,!!T1>::ClassMethod1333() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<!!T0,!!T1>::ClassMethod1334<object>() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<!!T0,!!T1>::ClassMethod1335<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<!!T0,!!T1>::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 5 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<!!T0,!!T1>::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 6 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<!!T0,!!T1>::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 7 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<!!T0,!!T1>::Method3<object>() stelem.ref ldloc.s actualResults ldc.i4.s 8 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<!!T0,!!T1>::Method4() stelem.ref ldloc.s actualResults ldc.i4.s 9 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<!!T0,!!T1>::Method5() stelem.ref ldloc.s actualResults ldc.i4.s 10 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<!!T0,!!T1>::Method6<object>() stelem.ref ldloc.s actualResults ldc.i4.s 11 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<!!T0,!!T1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.G2_C437.A.T<T1,(class G2_C437`2<class BaseClass0,!!T1>)W>(!!W 'inst', string exp) cil managed { .maxstack 17 .locals init (string[] actualResults) ldc.i4.s 12 newarr string stloc.s actualResults ldarg.1 ldstr "M.G2_C437.A.T<T1,(class G2_C437`2<class BaseClass0,!!T1>)W>(!!W 'inst', string exp)" ldc.i4.s 12 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,!!T1>::ClassMethod1332() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,!!T1>::ClassMethod1333() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,!!T1>::ClassMethod1334<object>() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,!!T1>::ClassMethod1335<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,!!T1>::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 5 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,!!T1>::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 6 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,!!T1>::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 7 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,!!T1>::Method3<object>() stelem.ref ldloc.s actualResults ldc.i4.s 8 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,!!T1>::Method4() stelem.ref ldloc.s actualResults ldc.i4.s 9 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,!!T1>::Method5() stelem.ref ldloc.s actualResults ldc.i4.s 10 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,!!T1>::Method6<object>() stelem.ref ldloc.s actualResults ldc.i4.s 11 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,!!T1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.G2_C437.A.A<(class G2_C437`2<class BaseClass0,class BaseClass0>)W>(!!W 'inst', string exp) cil managed { .maxstack 17 .locals init (string[] actualResults) ldc.i4.s 12 newarr string stloc.s actualResults ldarg.1 ldstr "M.G2_C437.A.A<(class G2_C437`2<class BaseClass0,class BaseClass0>)W>(!!W 'inst', string exp)" ldc.i4.s 12 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass0>::ClassMethod1332() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass0>::ClassMethod1333() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass0>::ClassMethod1334<object>() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass0>::ClassMethod1335<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass0>::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 5 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass0>::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 6 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass0>::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 7 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass0>::Method3<object>() stelem.ref ldloc.s actualResults ldc.i4.s 8 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass0>::Method4() stelem.ref ldloc.s actualResults ldc.i4.s 9 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass0>::Method5() stelem.ref ldloc.s actualResults ldc.i4.s 10 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass0>::Method6<object>() stelem.ref ldloc.s actualResults ldc.i4.s 11 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass0>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.G2_C437.A.B<(class G2_C437`2<class BaseClass0,class BaseClass1>)W>(!!W 'inst', string exp) cil managed { .maxstack 17 .locals init (string[] actualResults) ldc.i4.s 12 newarr string stloc.s actualResults ldarg.1 ldstr "M.G2_C437.A.B<(class G2_C437`2<class BaseClass0,class BaseClass1>)W>(!!W 'inst', string exp)" ldc.i4.s 12 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass1>::ClassMethod1332() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass1>::ClassMethod1333() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass1>::ClassMethod1334<object>() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass1>::ClassMethod1335<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass1>::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 5 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass1>::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 6 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass1>::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 7 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass1>::Method3<object>() stelem.ref ldloc.s actualResults ldc.i4.s 8 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass1>::Method4() stelem.ref ldloc.s actualResults ldc.i4.s 9 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass1>::Method5() stelem.ref ldloc.s actualResults ldc.i4.s 10 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass1>::Method6<object>() stelem.ref ldloc.s actualResults ldc.i4.s 11 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.G2_C437.B.T<T1,(class G2_C437`2<class BaseClass1,!!T1>)W>(!!W 'inst', string exp) cil managed { .maxstack 17 .locals init (string[] actualResults) ldc.i4.s 12 newarr string stloc.s actualResults ldarg.1 ldstr "M.G2_C437.B.T<T1,(class G2_C437`2<class BaseClass1,!!T1>)W>(!!W 'inst', string exp)" ldc.i4.s 12 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,!!T1>::ClassMethod1332() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,!!T1>::ClassMethod1333() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,!!T1>::ClassMethod1334<object>() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,!!T1>::ClassMethod1335<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,!!T1>::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 5 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,!!T1>::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 6 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,!!T1>::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 7 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,!!T1>::Method3<object>() stelem.ref ldloc.s actualResults ldc.i4.s 8 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,!!T1>::Method4() stelem.ref ldloc.s actualResults ldc.i4.s 9 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,!!T1>::Method5() stelem.ref ldloc.s actualResults ldc.i4.s 10 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,!!T1>::Method6<object>() stelem.ref ldloc.s actualResults ldc.i4.s 11 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,!!T1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.G2_C437.B.A<(class G2_C437`2<class BaseClass1,class BaseClass0>)W>(!!W 'inst', string exp) cil managed { .maxstack 17 .locals init (string[] actualResults) ldc.i4.s 12 newarr string stloc.s actualResults ldarg.1 ldstr "M.G2_C437.B.A<(class G2_C437`2<class BaseClass1,class BaseClass0>)W>(!!W 'inst', string exp)" ldc.i4.s 12 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass0>::ClassMethod1332() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass0>::ClassMethod1333() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass0>::ClassMethod1334<object>() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass0>::ClassMethod1335<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass0>::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 5 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass0>::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 6 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass0>::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 7 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass0>::Method3<object>() stelem.ref ldloc.s actualResults ldc.i4.s 8 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass0>::Method4() stelem.ref ldloc.s actualResults ldc.i4.s 9 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass0>::Method5() stelem.ref ldloc.s actualResults ldc.i4.s 10 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass0>::Method6<object>() stelem.ref ldloc.s actualResults ldc.i4.s 11 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass0>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.G2_C437.B.B<(class G2_C437`2<class BaseClass1,class BaseClass1>)W>(!!W 'inst', string exp) cil managed { .maxstack 17 .locals init (string[] actualResults) ldc.i4.s 12 newarr string stloc.s actualResults ldarg.1 ldstr "M.G2_C437.B.B<(class G2_C437`2<class BaseClass1,class BaseClass1>)W>(!!W 'inst', string exp)" ldc.i4.s 12 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::ClassMethod1332() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::ClassMethod1333() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::ClassMethod1334<object>() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::ClassMethod1335<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 5 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 6 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 7 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method3<object>() stelem.ref ldloc.s actualResults ldc.i4.s 8 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method4() stelem.ref ldloc.s actualResults ldc.i4.s 9 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method5() stelem.ref ldloc.s actualResults ldc.i4.s 10 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method6<object>() stelem.ref ldloc.s actualResults ldc.i4.s 11 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase1.T<T0,(class IBase1`1<!!T0>)W>(!!W 'inst', string exp) cil managed { .maxstack 8 .locals init (string[] actualResults) ldc.i4.s 3 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase1.T<T0,(class IBase1`1<!!T0>)W>(!!W 'inst', string exp)" ldc.i4.s 3 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase1`1<!!T0>::Method4() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. !!W callvirt instance string class IBase1`1<!!T0>::Method5() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. !!W callvirt instance string class IBase1`1<!!T0>::Method6<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase1.A<(class IBase1`1<class BaseClass0>)W>(!!W 'inst', string exp) cil managed { .maxstack 8 .locals init (string[] actualResults) ldc.i4.s 3 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase1.A<(class IBase1`1<class BaseClass0>)W>(!!W 'inst', string exp)" ldc.i4.s 3 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase1`1<class BaseClass0>::Method4() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. !!W callvirt instance string class IBase1`1<class BaseClass0>::Method5() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. !!W callvirt instance string class IBase1`1<class BaseClass0>::Method6<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase1.B<(class IBase1`1<class BaseClass1>)W>(!!W 'inst', string exp) cil managed { .maxstack 8 .locals init (string[] actualResults) ldc.i4.s 3 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase1.B<(class IBase1`1<class BaseClass1>)W>(!!W 'inst', string exp)" ldc.i4.s 3 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase1`1<class BaseClass1>::Method4() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. !!W callvirt instance string class IBase1`1<class BaseClass1>::Method5() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. !!W callvirt instance string class IBase1`1<class BaseClass1>::Method6<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.G1_C8.T.T<T0,T1,(class G1_C8`2<!!T0,!!T1>)W>(!!W 'inst', string exp) cil managed { .maxstack 14 .locals init (string[] actualResults) ldc.i4.s 9 newarr string stloc.s actualResults ldarg.1 ldstr "M.G1_C8.T.T<T0,T1,(class G1_C8`2<!!T0,!!T1>)W>(!!W 'inst', string exp)" ldc.i4.s 9 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<!!T0,!!T1>::ClassMethod1332() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<!!T0,!!T1>::ClassMethod1333() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<!!T0,!!T1>::ClassMethod1334<object>() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<!!T0,!!T1>::ClassMethod1335<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<!!T0,!!T1>::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 5 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<!!T0,!!T1>::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 6 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<!!T0,!!T1>::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 7 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<!!T0,!!T1>::Method3<object>() stelem.ref ldloc.s actualResults ldc.i4.s 8 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<!!T0,!!T1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.G1_C8.A.T<T1,(class G1_C8`2<class BaseClass0,!!T1>)W>(!!W 'inst', string exp) cil managed { .maxstack 14 .locals init (string[] actualResults) ldc.i4.s 9 newarr string stloc.s actualResults ldarg.1 ldstr "M.G1_C8.A.T<T1,(class G1_C8`2<class BaseClass0,!!T1>)W>(!!W 'inst', string exp)" ldc.i4.s 9 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,!!T1>::ClassMethod1332() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,!!T1>::ClassMethod1333() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,!!T1>::ClassMethod1334<object>() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,!!T1>::ClassMethod1335<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,!!T1>::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 5 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,!!T1>::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 6 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,!!T1>::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 7 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,!!T1>::Method3<object>() stelem.ref ldloc.s actualResults ldc.i4.s 8 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,!!T1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.G1_C8.A.A<(class G1_C8`2<class BaseClass0,class BaseClass0>)W>(!!W 'inst', string exp) cil managed { .maxstack 14 .locals init (string[] actualResults) ldc.i4.s 9 newarr string stloc.s actualResults ldarg.1 ldstr "M.G1_C8.A.A<(class G1_C8`2<class BaseClass0,class BaseClass0>)W>(!!W 'inst', string exp)" ldc.i4.s 9 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass0>::ClassMethod1332() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass0>::ClassMethod1333() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass0>::ClassMethod1334<object>() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass0>::ClassMethod1335<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass0>::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 5 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass0>::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 6 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass0>::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 7 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass0>::Method3<object>() stelem.ref ldloc.s actualResults ldc.i4.s 8 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass0>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.G1_C8.A.B<(class G1_C8`2<class BaseClass0,class BaseClass1>)W>(!!W 'inst', string exp) cil managed { .maxstack 14 .locals init (string[] actualResults) ldc.i4.s 9 newarr string stloc.s actualResults ldarg.1 ldstr "M.G1_C8.A.B<(class G1_C8`2<class BaseClass0,class BaseClass1>)W>(!!W 'inst', string exp)" ldc.i4.s 9 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass1>::ClassMethod1332() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass1>::ClassMethod1333() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass1>::ClassMethod1334<object>() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass1>::ClassMethod1335<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass1>::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 5 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass1>::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 6 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass1>::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 7 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass1>::Method3<object>() stelem.ref ldloc.s actualResults ldc.i4.s 8 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.G1_C8.B.T<T1,(class G1_C8`2<class BaseClass1,!!T1>)W>(!!W 'inst', string exp) cil managed { .maxstack 14 .locals init (string[] actualResults) ldc.i4.s 9 newarr string stloc.s actualResults ldarg.1 ldstr "M.G1_C8.B.T<T1,(class G1_C8`2<class BaseClass1,!!T1>)W>(!!W 'inst', string exp)" ldc.i4.s 9 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,!!T1>::ClassMethod1332() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,!!T1>::ClassMethod1333() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,!!T1>::ClassMethod1334<object>() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,!!T1>::ClassMethod1335<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,!!T1>::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 5 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,!!T1>::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 6 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,!!T1>::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 7 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,!!T1>::Method3<object>() stelem.ref ldloc.s actualResults ldc.i4.s 8 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,!!T1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.G1_C8.B.A<(class G1_C8`2<class BaseClass1,class BaseClass0>)W>(!!W 'inst', string exp) cil managed { .maxstack 14 .locals init (string[] actualResults) ldc.i4.s 9 newarr string stloc.s actualResults ldarg.1 ldstr "M.G1_C8.B.A<(class G1_C8`2<class BaseClass1,class BaseClass0>)W>(!!W 'inst', string exp)" ldc.i4.s 9 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1332() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1333() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1334<object>() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1335<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 5 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 6 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 7 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method3<object>() stelem.ref ldloc.s actualResults ldc.i4.s 8 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.G1_C8.B.B<(class G1_C8`2<class BaseClass1,class BaseClass1>)W>(!!W 'inst', string exp) cil managed { .maxstack 14 .locals init (string[] actualResults) ldc.i4.s 9 newarr string stloc.s actualResults ldarg.1 ldstr "M.G1_C8.B.B<(class G1_C8`2<class BaseClass1,class BaseClass1>)W>(!!W 'inst', string exp)" ldc.i4.s 9 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass1>::ClassMethod1332() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass1>::ClassMethod1333() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass1>::ClassMethod1334<object>() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass1>::ClassMethod1335<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass1>::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 5 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass1>::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 6 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass1>::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 7 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass1>::Method3<object>() stelem.ref ldloc.s actualResults ldc.i4.s 8 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase2.T.T<T0,T1,(class IBase2`2<!!T0,!!T1>)W>(!!W 'inst', string exp) cil managed { .maxstack 6 .locals init (string[] actualResults) ldc.i4.s 1 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase2.T.T<T0,T1,(class IBase2`2<!!T0,!!T1>)W>(!!W 'inst', string exp)" ldc.i4.s 1 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase2`2<!!T0,!!T1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase2.A.T<T1,(class IBase2`2<class BaseClass0,!!T1>)W>(!!W 'inst', string exp) cil managed { .maxstack 6 .locals init (string[] actualResults) ldc.i4.s 1 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase2.A.T<T1,(class IBase2`2<class BaseClass0,!!T1>)W>(!!W 'inst', string exp)" ldc.i4.s 1 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase2`2<class BaseClass0,!!T1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase2.A.A<(class IBase2`2<class BaseClass0,class BaseClass0>)W>(!!W 'inst', string exp) cil managed { .maxstack 6 .locals init (string[] actualResults) ldc.i4.s 1 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase2.A.A<(class IBase2`2<class BaseClass0,class BaseClass0>)W>(!!W 'inst', string exp)" ldc.i4.s 1 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase2.A.B<(class IBase2`2<class BaseClass0,class BaseClass1>)W>(!!W 'inst', string exp) cil managed { .maxstack 6 .locals init (string[] actualResults) ldc.i4.s 1 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase2.A.B<(class IBase2`2<class BaseClass0,class BaseClass1>)W>(!!W 'inst', string exp)" ldc.i4.s 1 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase2.B.T<T1,(class IBase2`2<class BaseClass1,!!T1>)W>(!!W 'inst', string exp) cil managed { .maxstack 6 .locals init (string[] actualResults) ldc.i4.s 1 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase2.B.T<T1,(class IBase2`2<class BaseClass1,!!T1>)W>(!!W 'inst', string exp)" ldc.i4.s 1 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase2`2<class BaseClass1,!!T1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase2.B.A<(class IBase2`2<class BaseClass1,class BaseClass0>)W>(!!W 'inst', string exp) cil managed { .maxstack 6 .locals init (string[] actualResults) ldc.i4.s 1 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase2.B.A<(class IBase2`2<class BaseClass1,class BaseClass0>)W>(!!W 'inst', string exp)" ldc.i4.s 1 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase2.B.B<(class IBase2`2<class BaseClass1,class BaseClass1>)W>(!!W 'inst', string exp) cil managed { .maxstack 6 .locals init (string[] actualResults) ldc.i4.s 1 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase2.B.B<(class IBase2`2<class BaseClass1,class BaseClass1>)W>(!!W 'inst', string exp)" ldc.i4.s 1 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase0<(IBase0)W>(!!W inst, string exp) cil managed { .maxstack 9 .locals init (string[] actualResults) ldc.i4.s 4 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase0<(IBase0)W>(!!W inst, string exp)" ldc.i4.s 4 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string IBase0::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. !!W callvirt instance string IBase0::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. !!W callvirt instance string IBase0::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. !!W callvirt instance string IBase0::Method3<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method public hidebysig static void MethodCallingTest() cil managed { .maxstack 10 .locals init (object V_0) ldstr "========================== Method Calling Test ==========================" call void [mscorlib]System.Console::WriteLine(string) newobj instance void class G3_C1414`1<class BaseClass0>::.ctor() stloc.0 ldloc.0 dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1335<object>() ldstr "G2_C437::ClassMethod1335.MI.8947<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1334<object>() ldstr "G1_C8::ClassMethod1334.4831<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1333() ldstr "G2_C437::ClassMethod1333.MI.8946()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1332() ldstr "G1_C8::ClassMethod1332.4829()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method3<object>() ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method2<object>() ldstr "G1_C8::Method2.4826<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method1() ldstr "G1_C8::Method1.4825()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method0() ldstr "G1_C8::Method0.4823()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method7<object>() ldstr "G2_C437::Method7.8939<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>() ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string IBase0::Method0() ldstr "G1_C8::Method0.MI.4824()" ldstr "IBase0 on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method1() ldstr "G1_C8::Method1.4825()" ldstr "IBase0 on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method2<object>() ldstr "G1_C8::Method2.MI.4827<System.Object>()" ldstr "IBase0 on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method3<object>() ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "IBase0 on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() ldstr "G2_C437::Method7.MI.8940<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() ldstr "G2_C437::Method7.MI.8940<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method6<object>() ldstr "G3_C1414::Method6.16058<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method5() ldstr "G3_C1414::Method5.16056()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method4() ldstr "G2_C437::Method4.8941()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method7<object>() ldstr "G2_C437::Method7.8939<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::ClassMethod1335<object>() ldstr "G2_C437::ClassMethod1335.MI.8947<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::ClassMethod1334<object>() ldstr "G1_C8::ClassMethod1334.4831<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::ClassMethod1333() ldstr "G2_C437::ClassMethod1333.MI.8946()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::ClassMethod1332() ldstr "G1_C8::ClassMethod1332.4829()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method3<object>() ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method2<object>() ldstr "G1_C8::Method2.4826<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method1() ldstr "G1_C8::Method1.4825()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method0() ldstr "G1_C8::Method0.4823()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string class IBase1`1<class BaseClass0>::Method4() ldstr "G3_C1414::Method4.16055()" ldstr "class IBase1`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string class IBase1`1<class BaseClass0>::Method5() ldstr "G3_C1414::Method5.MI.16057()" ldstr "class IBase1`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string class IBase1`1<class BaseClass0>::Method6<object>() ldstr "G3_C1414::Method6.MI.16059<System.Object>()" ldstr "class IBase1`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup castclass class G3_C1414`1<class BaseClass0> callvirt instance string class G3_C1414`1<class BaseClass0>::ClassMethod4225<object>() ldstr "G3_C1414::ClassMethod4225.16062<System.Object>()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass0> callvirt instance string class G3_C1414`1<class BaseClass0>::ClassMethod4224<object>() ldstr "G3_C1414::ClassMethod4224.16061<System.Object>()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass0> callvirt instance string class G3_C1414`1<class BaseClass0>::ClassMethod4223() ldstr "G3_C1414::ClassMethod4223.16060()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass0> callvirt instance string class G3_C1414`1<class BaseClass0>::Method6<object>() ldstr "G3_C1414::Method6.16058<System.Object>()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass0> callvirt instance string class G3_C1414`1<class BaseClass0>::Method5() ldstr "G3_C1414::Method5.16056()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass0> callvirt instance string class G3_C1414`1<class BaseClass0>::Method4() ldstr "G3_C1414::Method4.16055()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass0> callvirt instance string class G3_C1414`1<class BaseClass0>::Method7<object>() ldstr "G2_C437::Method7.8939<System.Object>()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass0> callvirt instance string class G3_C1414`1<class BaseClass0>::ClassMethod1335<object>() ldstr "G2_C437::ClassMethod1335.MI.8947<System.Object>()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass0> callvirt instance string class G3_C1414`1<class BaseClass0>::ClassMethod1334<object>() ldstr "G1_C8::ClassMethod1334.4831<System.Object>()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass0> callvirt instance string class G3_C1414`1<class BaseClass0>::ClassMethod1333() ldstr "G2_C437::ClassMethod1333.MI.8946()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass0> callvirt instance string class G3_C1414`1<class BaseClass0>::ClassMethod1332() ldstr "G1_C8::ClassMethod1332.4829()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass0> callvirt instance string class G3_C1414`1<class BaseClass0>::Method3<object>() ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass0> callvirt instance string class G3_C1414`1<class BaseClass0>::Method2<object>() ldstr "G1_C8::Method2.4826<System.Object>()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass0> callvirt instance string class G3_C1414`1<class BaseClass0>::Method1() ldstr "G1_C8::Method1.4825()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass0> callvirt instance string class G3_C1414`1<class BaseClass0>::Method0() ldstr "G1_C8::Method0.4823()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop newobj instance void class G3_C1414`1<class BaseClass1>::.ctor() stloc.0 ldloc.0 dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1335<object>() ldstr "G2_C437::ClassMethod1335.MI.8947<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1334<object>() ldstr "G1_C8::ClassMethod1334.4831<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1333() ldstr "G2_C437::ClassMethod1333.MI.8946()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1332() ldstr "G1_C8::ClassMethod1332.4829()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method3<object>() ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method2<object>() ldstr "G1_C8::Method2.4826<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method1() ldstr "G1_C8::Method1.4825()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method0() ldstr "G1_C8::Method0.4823()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method7<object>() ldstr "G2_C437::Method7.8939<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>() ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string IBase0::Method0() ldstr "G1_C8::Method0.MI.4824()" ldstr "IBase0 on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method1() ldstr "G1_C8::Method1.4825()" ldstr "IBase0 on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method2<object>() ldstr "G1_C8::Method2.MI.4827<System.Object>()" ldstr "IBase0 on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method3<object>() ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "IBase0 on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() ldstr "G2_C437::Method7.MI.8940<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() ldstr "G2_C437::Method7.MI.8940<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method6<object>() ldstr "G3_C1414::Method6.16058<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method5() ldstr "G3_C1414::Method5.16056()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method4() ldstr "G2_C437::Method4.8941()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method7<object>() ldstr "G2_C437::Method7.8939<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::ClassMethod1335<object>() ldstr "G2_C437::ClassMethod1335.MI.8947<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::ClassMethod1334<object>() ldstr "G1_C8::ClassMethod1334.4831<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::ClassMethod1333() ldstr "G2_C437::ClassMethod1333.MI.8946()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::ClassMethod1332() ldstr "G1_C8::ClassMethod1332.4829()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method3<object>() ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method2<object>() ldstr "G1_C8::Method2.4826<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method1() ldstr "G1_C8::Method1.4825()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method0() ldstr "G1_C8::Method0.4823()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string class IBase1`1<class BaseClass0>::Method4() ldstr "G3_C1414::Method4.16055()" ldstr "class IBase1`1<class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string class IBase1`1<class BaseClass0>::Method5() ldstr "G3_C1414::Method5.MI.16057()" ldstr "class IBase1`1<class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string class IBase1`1<class BaseClass0>::Method6<object>() ldstr "G3_C1414::Method6.MI.16059<System.Object>()" ldstr "class IBase1`1<class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup castclass class G3_C1414`1<class BaseClass1> callvirt instance string class G3_C1414`1<class BaseClass1>::ClassMethod4225<object>() ldstr "G3_C1414::ClassMethod4225.16062<System.Object>()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass1> callvirt instance string class G3_C1414`1<class BaseClass1>::ClassMethod4224<object>() ldstr "G3_C1414::ClassMethod4224.16061<System.Object>()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass1> callvirt instance string class G3_C1414`1<class BaseClass1>::ClassMethod4223() ldstr "G3_C1414::ClassMethod4223.16060()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass1> callvirt instance string class G3_C1414`1<class BaseClass1>::Method6<object>() ldstr "G3_C1414::Method6.16058<System.Object>()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass1> callvirt instance string class G3_C1414`1<class BaseClass1>::Method5() ldstr "G3_C1414::Method5.16056()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass1> callvirt instance string class G3_C1414`1<class BaseClass1>::Method4() ldstr "G3_C1414::Method4.16055()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass1> callvirt instance string class G3_C1414`1<class BaseClass1>::Method7<object>() ldstr "G2_C437::Method7.8939<System.Object>()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass1> callvirt instance string class G3_C1414`1<class BaseClass1>::ClassMethod1335<object>() ldstr "G2_C437::ClassMethod1335.MI.8947<System.Object>()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass1> callvirt instance string class G3_C1414`1<class BaseClass1>::ClassMethod1334<object>() ldstr "G1_C8::ClassMethod1334.4831<System.Object>()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass1> callvirt instance string class G3_C1414`1<class BaseClass1>::ClassMethod1333() ldstr "G2_C437::ClassMethod1333.MI.8946()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass1> callvirt instance string class G3_C1414`1<class BaseClass1>::ClassMethod1332() ldstr "G1_C8::ClassMethod1332.4829()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass1> callvirt instance string class G3_C1414`1<class BaseClass1>::Method3<object>() ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass1> callvirt instance string class G3_C1414`1<class BaseClass1>::Method2<object>() ldstr "G1_C8::Method2.4826<System.Object>()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass1> callvirt instance string class G3_C1414`1<class BaseClass1>::Method1() ldstr "G1_C8::Method1.4825()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass1> callvirt instance string class G3_C1414`1<class BaseClass1>::Method0() ldstr "G1_C8::Method0.4823()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string class IBase1`1<class BaseClass1>::Method4() ldstr "G3_C1414::Method4.16055()" ldstr "class IBase1`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string class IBase1`1<class BaseClass1>::Method5() ldstr "G3_C1414::Method5.MI.16057()" ldstr "class IBase1`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string class IBase1`1<class BaseClass1>::Method6<object>() ldstr "G3_C1414::Method6.MI.16059<System.Object>()" ldstr "class IBase1`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop newobj instance void class G1_C8`2<class BaseClass0,class BaseClass0>::.ctor() stloc.0 ldloc.0 dup castclass class G1_C8`2<class BaseClass0,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass0>::ClassMethod1335<object>() ldstr "G1_C8::ClassMethod1335.4832<System.Object>()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass0> on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass0,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass0>::ClassMethod1334<object>() ldstr "G1_C8::ClassMethod1334.4831<System.Object>()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass0> on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass0,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass0>::ClassMethod1333() ldstr "G1_C8::ClassMethod1333.4830()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass0> on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass0,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass0>::ClassMethod1332() ldstr "G1_C8::ClassMethod1332.4829()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass0> on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass0,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass0>::Method3<object>() ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass0> on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass0,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass0>::Method2<object>() ldstr "G1_C8::Method2.4826<System.Object>()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass0> on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass0,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass0>::Method1() ldstr "G1_C8::Method1.4825()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass0> on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass0,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass0>::Method0() ldstr "G1_C8::Method0.4823()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass0> on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass0,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass0>::Method7<object>() ldstr "G1_C8::Method7.4821<System.Object>()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass0> on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string IBase0::Method0() ldstr "G1_C8::Method0.MI.4824()" ldstr "IBase0 on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method1() ldstr "G1_C8::Method1.4825()" ldstr "IBase0 on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method2<object>() ldstr "G1_C8::Method2.MI.4827<System.Object>()" ldstr "IBase0 on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method3<object>() ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "IBase0 on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop newobj instance void class G1_C8`2<class BaseClass0,class BaseClass1>::.ctor() stloc.0 ldloc.0 dup castclass class G1_C8`2<class BaseClass0,class BaseClass1> callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass1>::ClassMethod1335<object>() ldstr "G1_C8::ClassMethod1335.4832<System.Object>()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass0,class BaseClass1> callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass1>::ClassMethod1334<object>() ldstr "G1_C8::ClassMethod1334.4831<System.Object>()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass0,class BaseClass1> callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass1>::ClassMethod1333() ldstr "G1_C8::ClassMethod1333.4830()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass0,class BaseClass1> callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass1>::ClassMethod1332() ldstr "G1_C8::ClassMethod1332.4829()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass0,class BaseClass1> callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass1>::Method3<object>() ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass0,class BaseClass1> callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass1>::Method2<object>() ldstr "G1_C8::Method2.4826<System.Object>()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass0,class BaseClass1> callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass1>::Method1() ldstr "G1_C8::Method1.4825()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass0,class BaseClass1> callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass1>::Method0() ldstr "G1_C8::Method0.4823()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass0,class BaseClass1> callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass1>::Method7<object>() ldstr "G1_C8::Method7.4821<System.Object>()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string IBase0::Method0() ldstr "G1_C8::Method0.MI.4824()" ldstr "IBase0 on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method1() ldstr "G1_C8::Method1.4825()" ldstr "IBase0 on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method2<object>() ldstr "G1_C8::Method2.MI.4827<System.Object>()" ldstr "IBase0 on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method3<object>() ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "IBase0 on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop newobj instance void class G1_C8`2<class BaseClass1,class BaseClass0>::.ctor() stloc.0 ldloc.0 dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1335<object>() ldstr "G1_C8::ClassMethod1335.4832<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1334<object>() ldstr "G1_C8::ClassMethod1334.4831<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1333() ldstr "G1_C8::ClassMethod1333.4830()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1332() ldstr "G1_C8::ClassMethod1332.4829()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method3<object>() ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method2<object>() ldstr "G1_C8::Method2.4826<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method1() ldstr "G1_C8::Method1.4825()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method0() ldstr "G1_C8::Method0.4823()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method7<object>() ldstr "G1_C8::Method7.4821<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>() ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass0> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string IBase0::Method0() ldstr "G1_C8::Method0.MI.4824()" ldstr "IBase0 on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method1() ldstr "G1_C8::Method1.4825()" ldstr "IBase0 on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method2<object>() ldstr "G1_C8::Method2.MI.4827<System.Object>()" ldstr "IBase0 on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method3<object>() ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "IBase0 on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop newobj instance void class G1_C8`2<class BaseClass1,class BaseClass1>::.ctor() stloc.0 ldloc.0 dup castclass class G1_C8`2<class BaseClass1,class BaseClass1> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass1>::ClassMethod1335<object>() ldstr "G1_C8::ClassMethod1335.4832<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass1> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass1>::ClassMethod1334<object>() ldstr "G1_C8::ClassMethod1334.4831<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass1> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass1>::ClassMethod1333() ldstr "G1_C8::ClassMethod1333.4830()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass1> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass1>::ClassMethod1332() ldstr "G1_C8::ClassMethod1332.4829()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass1> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass1>::Method3<object>() ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass1> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass1>::Method2<object>() ldstr "G1_C8::Method2.4826<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass1> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass1>::Method1() ldstr "G1_C8::Method1.4825()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass1> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass1>::Method0() ldstr "G1_C8::Method0.4823()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass1> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass1>::Method7<object>() ldstr "G1_C8::Method7.4821<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string IBase0::Method0() ldstr "G1_C8::Method0.MI.4824()" ldstr "IBase0 on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method1() ldstr "G1_C8::Method1.4825()" ldstr "IBase0 on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method2<object>() ldstr "G1_C8::Method2.MI.4827<System.Object>()" ldstr "IBase0 on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method3<object>() ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "IBase0 on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldstr "========================================================================\n\n" call void [mscorlib]System.Console::WriteLine(string) ret } .method public hidebysig static void ConstrainedCallsTest() cil managed { .maxstack 10 .locals init (object V_0) ldstr "========================== Constrained Calls Test ==========================" call void [mscorlib]System.Console::WriteLine(string) newobj instance void class G3_C1414`1<class BaseClass0>::.ctor() stloc.0 ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G2_C437::ClassMethod1333.MI.8946()#G1_C8::ClassMethod1334.4831<System.Object>()#G2_C437::ClassMethod1335.MI.8947<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G2_C437::Method7.8939<System.Object>()#" call void Generated942::M.G1_C8.T.T<class BaseClass1,class BaseClass0,class G3_C1414`1<class BaseClass0>>(!!2,string) ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G2_C437::ClassMethod1333.MI.8946()#G1_C8::ClassMethod1334.4831<System.Object>()#G2_C437::ClassMethod1335.MI.8947<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G2_C437::Method7.8939<System.Object>()#" call void Generated942::M.G1_C8.B.T<class BaseClass0,class G3_C1414`1<class BaseClass0>>(!!1,string) ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G2_C437::ClassMethod1333.MI.8946()#G1_C8::ClassMethod1334.4831<System.Object>()#G2_C437::ClassMethod1335.MI.8947<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G2_C437::Method7.8939<System.Object>()#" call void Generated942::M.G1_C8.B.A<class G3_C1414`1<class BaseClass0>>(!!0,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.T.T<class BaseClass1,class BaseClass0,class G3_C1414`1<class BaseClass0>>(!!2,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.B.T<class BaseClass0,class G3_C1414`1<class BaseClass0>>(!!1,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.B.A<class G3_C1414`1<class BaseClass0>>(!!0,string) ldloc.0 ldstr "G1_C8::Method0.MI.4824()#G1_C8::Method1.4825()#G1_C8::Method2.MI.4827<System.Object>()#G1_C8::Method3.4828<System.Object>()#" call void Generated942::M.IBase0<class G3_C1414`1<class BaseClass0>>(!!0,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.T.T<class BaseClass0,class BaseClass0,class G3_C1414`1<class BaseClass0>>(!!2,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.A.T<class BaseClass0,class G3_C1414`1<class BaseClass0>>(!!1,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.A.A<class G3_C1414`1<class BaseClass0>>(!!0,string) ldloc.0 ldstr "G2_C437::Method7.MI.8940<System.Object>()#" call void Generated942::M.IBase2.T.T<class BaseClass0,class BaseClass1,class G3_C1414`1<class BaseClass0>>(!!2,string) ldloc.0 ldstr "G2_C437::Method7.MI.8940<System.Object>()#" call void Generated942::M.IBase2.A.T<class BaseClass1,class G3_C1414`1<class BaseClass0>>(!!1,string) ldloc.0 ldstr "G2_C437::Method7.MI.8940<System.Object>()#" call void Generated942::M.IBase2.A.B<class G3_C1414`1<class BaseClass0>>(!!0,string) ldloc.0 ldstr "G2_C437::Method7.MI.8940<System.Object>()#" call void Generated942::M.IBase2.T.T<class BaseClass1,class BaseClass1,class G3_C1414`1<class BaseClass0>>(!!2,string) ldloc.0 ldstr "G2_C437::Method7.MI.8940<System.Object>()#" call void Generated942::M.IBase2.B.T<class BaseClass1,class G3_C1414`1<class BaseClass0>>(!!1,string) ldloc.0 ldstr "G2_C437::Method7.MI.8940<System.Object>()#" call void Generated942::M.IBase2.B.B<class G3_C1414`1<class BaseClass0>>(!!0,string) ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G2_C437::ClassMethod1333.MI.8946()#G1_C8::ClassMethod1334.4831<System.Object>()#G2_C437::ClassMethod1335.MI.8947<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G2_C437::Method4.8941()#G3_C1414::Method5.16056()#G3_C1414::Method6.16058<System.Object>()#G2_C437::Method7.8939<System.Object>()#" call void Generated942::M.G2_C437.T.T<class BaseClass1,class BaseClass1,class G3_C1414`1<class BaseClass0>>(!!2,string) ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G2_C437::ClassMethod1333.MI.8946()#G1_C8::ClassMethod1334.4831<System.Object>()#G2_C437::ClassMethod1335.MI.8947<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G2_C437::Method4.8941()#G3_C1414::Method5.16056()#G3_C1414::Method6.16058<System.Object>()#G2_C437::Method7.8939<System.Object>()#" call void Generated942::M.G2_C437.B.T<class BaseClass1,class G3_C1414`1<class BaseClass0>>(!!1,string) ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G2_C437::ClassMethod1333.MI.8946()#G1_C8::ClassMethod1334.4831<System.Object>()#G2_C437::ClassMethod1335.MI.8947<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G2_C437::Method4.8941()#G3_C1414::Method5.16056()#G3_C1414::Method6.16058<System.Object>()#G2_C437::Method7.8939<System.Object>()#" call void Generated942::M.G2_C437.B.B<class G3_C1414`1<class BaseClass0>>(!!0,string) ldloc.0 ldstr "G3_C1414::Method4.16055()#G3_C1414::Method5.MI.16057()#G3_C1414::Method6.MI.16059<System.Object>()#" call void Generated942::M.IBase1.T<class BaseClass0,class G3_C1414`1<class BaseClass0>>(!!1,string) ldloc.0 ldstr "G3_C1414::Method4.16055()#G3_C1414::Method5.MI.16057()#G3_C1414::Method6.MI.16059<System.Object>()#" call void Generated942::M.IBase1.A<class G3_C1414`1<class BaseClass0>>(!!0,string) ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G2_C437::ClassMethod1333.MI.8946()#G1_C8::ClassMethod1334.4831<System.Object>()#G2_C437::ClassMethod1335.MI.8947<System.Object>()#G3_C1414::ClassMethod4223.16060()#G3_C1414::ClassMethod4224.16061<System.Object>()#G3_C1414::ClassMethod4225.16062<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G3_C1414::Method4.16055()#G3_C1414::Method5.16056()#G3_C1414::Method6.16058<System.Object>()#G2_C437::Method7.8939<System.Object>()#" call void Generated942::M.G3_C1414.T<class BaseClass0,class G3_C1414`1<class BaseClass0>>(!!1,string) ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G2_C437::ClassMethod1333.MI.8946()#G1_C8::ClassMethod1334.4831<System.Object>()#G2_C437::ClassMethod1335.MI.8947<System.Object>()#G3_C1414::ClassMethod4223.16060()#G3_C1414::ClassMethod4224.16061<System.Object>()#G3_C1414::ClassMethod4225.16062<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G3_C1414::Method4.16055()#G3_C1414::Method5.16056()#G3_C1414::Method6.16058<System.Object>()#G2_C437::Method7.8939<System.Object>()#" call void Generated942::M.G3_C1414.A<class G3_C1414`1<class BaseClass0>>(!!0,string) newobj instance void class G3_C1414`1<class BaseClass1>::.ctor() stloc.0 ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G2_C437::ClassMethod1333.MI.8946()#G1_C8::ClassMethod1334.4831<System.Object>()#G2_C437::ClassMethod1335.MI.8947<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G2_C437::Method7.8939<System.Object>()#" call void Generated942::M.G1_C8.T.T<class BaseClass1,class BaseClass0,class G3_C1414`1<class BaseClass1>>(!!2,string) ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G2_C437::ClassMethod1333.MI.8946()#G1_C8::ClassMethod1334.4831<System.Object>()#G2_C437::ClassMethod1335.MI.8947<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G2_C437::Method7.8939<System.Object>()#" call void Generated942::M.G1_C8.B.T<class BaseClass0,class G3_C1414`1<class BaseClass1>>(!!1,string) ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G2_C437::ClassMethod1333.MI.8946()#G1_C8::ClassMethod1334.4831<System.Object>()#G2_C437::ClassMethod1335.MI.8947<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G2_C437::Method7.8939<System.Object>()#" call void Generated942::M.G1_C8.B.A<class G3_C1414`1<class BaseClass1>>(!!0,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.T.T<class BaseClass1,class BaseClass0,class G3_C1414`1<class BaseClass1>>(!!2,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.B.T<class BaseClass0,class G3_C1414`1<class BaseClass1>>(!!1,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.B.A<class G3_C1414`1<class BaseClass1>>(!!0,string) ldloc.0 ldstr "G1_C8::Method0.MI.4824()#G1_C8::Method1.4825()#G1_C8::Method2.MI.4827<System.Object>()#G1_C8::Method3.4828<System.Object>()#" call void Generated942::M.IBase0<class G3_C1414`1<class BaseClass1>>(!!0,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.T.T<class BaseClass0,class BaseClass0,class G3_C1414`1<class BaseClass1>>(!!2,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.A.T<class BaseClass0,class G3_C1414`1<class BaseClass1>>(!!1,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.A.A<class G3_C1414`1<class BaseClass1>>(!!0,string) ldloc.0 ldstr "G2_C437::Method7.MI.8940<System.Object>()#" call void Generated942::M.IBase2.T.T<class BaseClass0,class BaseClass1,class G3_C1414`1<class BaseClass1>>(!!2,string) ldloc.0 ldstr "G2_C437::Method7.MI.8940<System.Object>()#" call void Generated942::M.IBase2.A.T<class BaseClass1,class G3_C1414`1<class BaseClass1>>(!!1,string) ldloc.0 ldstr "G2_C437::Method7.MI.8940<System.Object>()#" call void Generated942::M.IBase2.A.B<class G3_C1414`1<class BaseClass1>>(!!0,string) ldloc.0 ldstr "G2_C437::Method7.MI.8940<System.Object>()#" call void Generated942::M.IBase2.T.T<class BaseClass1,class BaseClass1,class G3_C1414`1<class BaseClass1>>(!!2,string) ldloc.0 ldstr "G2_C437::Method7.MI.8940<System.Object>()#" call void Generated942::M.IBase2.B.T<class BaseClass1,class G3_C1414`1<class BaseClass1>>(!!1,string) ldloc.0 ldstr "G2_C437::Method7.MI.8940<System.Object>()#" call void Generated942::M.IBase2.B.B<class G3_C1414`1<class BaseClass1>>(!!0,string) ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G2_C437::ClassMethod1333.MI.8946()#G1_C8::ClassMethod1334.4831<System.Object>()#G2_C437::ClassMethod1335.MI.8947<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G2_C437::Method4.8941()#G3_C1414::Method5.16056()#G3_C1414::Method6.16058<System.Object>()#G2_C437::Method7.8939<System.Object>()#" call void Generated942::M.G2_C437.T.T<class BaseClass1,class BaseClass1,class G3_C1414`1<class BaseClass1>>(!!2,string) ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G2_C437::ClassMethod1333.MI.8946()#G1_C8::ClassMethod1334.4831<System.Object>()#G2_C437::ClassMethod1335.MI.8947<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G2_C437::Method4.8941()#G3_C1414::Method5.16056()#G3_C1414::Method6.16058<System.Object>()#G2_C437::Method7.8939<System.Object>()#" call void Generated942::M.G2_C437.B.T<class BaseClass1,class G3_C1414`1<class BaseClass1>>(!!1,string) ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G2_C437::ClassMethod1333.MI.8946()#G1_C8::ClassMethod1334.4831<System.Object>()#G2_C437::ClassMethod1335.MI.8947<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G2_C437::Method4.8941()#G3_C1414::Method5.16056()#G3_C1414::Method6.16058<System.Object>()#G2_C437::Method7.8939<System.Object>()#" call void Generated942::M.G2_C437.B.B<class G3_C1414`1<class BaseClass1>>(!!0,string) ldloc.0 ldstr "G3_C1414::Method4.16055()#G3_C1414::Method5.MI.16057()#G3_C1414::Method6.MI.16059<System.Object>()#" call void Generated942::M.IBase1.T<class BaseClass0,class G3_C1414`1<class BaseClass1>>(!!1,string) ldloc.0 ldstr "G3_C1414::Method4.16055()#G3_C1414::Method5.MI.16057()#G3_C1414::Method6.MI.16059<System.Object>()#" call void Generated942::M.IBase1.A<class G3_C1414`1<class BaseClass1>>(!!0,string) ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G2_C437::ClassMethod1333.MI.8946()#G1_C8::ClassMethod1334.4831<System.Object>()#G2_C437::ClassMethod1335.MI.8947<System.Object>()#G3_C1414::ClassMethod4223.16060()#G3_C1414::ClassMethod4224.16061<System.Object>()#G3_C1414::ClassMethod4225.16062<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G3_C1414::Method4.16055()#G3_C1414::Method5.16056()#G3_C1414::Method6.16058<System.Object>()#G2_C437::Method7.8939<System.Object>()#" call void Generated942::M.G3_C1414.T<class BaseClass1,class G3_C1414`1<class BaseClass1>>(!!1,string) ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G2_C437::ClassMethod1333.MI.8946()#G1_C8::ClassMethod1334.4831<System.Object>()#G2_C437::ClassMethod1335.MI.8947<System.Object>()#G3_C1414::ClassMethod4223.16060()#G3_C1414::ClassMethod4224.16061<System.Object>()#G3_C1414::ClassMethod4225.16062<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G3_C1414::Method4.16055()#G3_C1414::Method5.16056()#G3_C1414::Method6.16058<System.Object>()#G2_C437::Method7.8939<System.Object>()#" call void Generated942::M.G3_C1414.B<class G3_C1414`1<class BaseClass1>>(!!0,string) ldloc.0 ldstr "G3_C1414::Method4.16055()#G3_C1414::Method5.MI.16057()#G3_C1414::Method6.MI.16059<System.Object>()#" call void Generated942::M.IBase1.T<class BaseClass1,class G3_C1414`1<class BaseClass1>>(!!1,string) ldloc.0 ldstr "G3_C1414::Method4.16055()#G3_C1414::Method5.MI.16057()#G3_C1414::Method6.MI.16059<System.Object>()#" call void Generated942::M.IBase1.B<class G3_C1414`1<class BaseClass1>>(!!0,string) newobj instance void class G1_C8`2<class BaseClass0,class BaseClass0>::.ctor() stloc.0 ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G1_C8::ClassMethod1333.4830()#G1_C8::ClassMethod1334.4831<System.Object>()#G1_C8::ClassMethod1335.4832<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G1_C8::Method7.4821<System.Object>()#" call void Generated942::M.G1_C8.T.T<class BaseClass0,class BaseClass0,class G1_C8`2<class BaseClass0,class BaseClass0>>(!!2,string) ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G1_C8::ClassMethod1333.4830()#G1_C8::ClassMethod1334.4831<System.Object>()#G1_C8::ClassMethod1335.4832<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G1_C8::Method7.4821<System.Object>()#" call void Generated942::M.G1_C8.A.T<class BaseClass0,class G1_C8`2<class BaseClass0,class BaseClass0>>(!!1,string) ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G1_C8::ClassMethod1333.4830()#G1_C8::ClassMethod1334.4831<System.Object>()#G1_C8::ClassMethod1335.4832<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G1_C8::Method7.4821<System.Object>()#" call void Generated942::M.G1_C8.A.A<class G1_C8`2<class BaseClass0,class BaseClass0>>(!!0,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.T.T<class BaseClass0,class BaseClass0,class G1_C8`2<class BaseClass0,class BaseClass0>>(!!2,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.A.T<class BaseClass0,class G1_C8`2<class BaseClass0,class BaseClass0>>(!!1,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.A.A<class G1_C8`2<class BaseClass0,class BaseClass0>>(!!0,string) ldloc.0 ldstr "G1_C8::Method0.MI.4824()#G1_C8::Method1.4825()#G1_C8::Method2.MI.4827<System.Object>()#G1_C8::Method3.4828<System.Object>()#" call void Generated942::M.IBase0<class G1_C8`2<class BaseClass0,class BaseClass0>>(!!0,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.T.T<class BaseClass0,class BaseClass1,class G1_C8`2<class BaseClass0,class BaseClass0>>(!!2,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.A.T<class BaseClass1,class G1_C8`2<class BaseClass0,class BaseClass0>>(!!1,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.A.B<class G1_C8`2<class BaseClass0,class BaseClass0>>(!!0,string) newobj instance void class G1_C8`2<class BaseClass0,class BaseClass1>::.ctor() stloc.0 ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G1_C8::ClassMethod1333.4830()#G1_C8::ClassMethod1334.4831<System.Object>()#G1_C8::ClassMethod1335.4832<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G1_C8::Method7.4821<System.Object>()#" call void Generated942::M.G1_C8.T.T<class BaseClass0,class BaseClass1,class G1_C8`2<class BaseClass0,class BaseClass1>>(!!2,string) ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G1_C8::ClassMethod1333.4830()#G1_C8::ClassMethod1334.4831<System.Object>()#G1_C8::ClassMethod1335.4832<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G1_C8::Method7.4821<System.Object>()#" call void Generated942::M.G1_C8.A.T<class BaseClass1,class G1_C8`2<class BaseClass0,class BaseClass1>>(!!1,string) ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G1_C8::ClassMethod1333.4830()#G1_C8::ClassMethod1334.4831<System.Object>()#G1_C8::ClassMethod1335.4832<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G1_C8::Method7.4821<System.Object>()#" call void Generated942::M.G1_C8.A.B<class G1_C8`2<class BaseClass0,class BaseClass1>>(!!0,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.T.T<class BaseClass0,class BaseClass1,class G1_C8`2<class BaseClass0,class BaseClass1>>(!!2,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.A.T<class BaseClass1,class G1_C8`2<class BaseClass0,class BaseClass1>>(!!1,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.A.B<class G1_C8`2<class BaseClass0,class BaseClass1>>(!!0,string) ldloc.0 ldstr "G1_C8::Method0.MI.4824()#G1_C8::Method1.4825()#G1_C8::Method2.MI.4827<System.Object>()#G1_C8::Method3.4828<System.Object>()#" call void Generated942::M.IBase0<class G1_C8`2<class BaseClass0,class BaseClass1>>(!!0,string) newobj instance void class G1_C8`2<class BaseClass1,class BaseClass0>::.ctor() stloc.0 ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G1_C8::ClassMethod1333.4830()#G1_C8::ClassMethod1334.4831<System.Object>()#G1_C8::ClassMethod1335.4832<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G1_C8::Method7.4821<System.Object>()#" call void Generated942::M.G1_C8.T.T<class BaseClass1,class BaseClass0,class G1_C8`2<class BaseClass1,class BaseClass0>>(!!2,string) ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G1_C8::ClassMethod1333.4830()#G1_C8::ClassMethod1334.4831<System.Object>()#G1_C8::ClassMethod1335.4832<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G1_C8::Method7.4821<System.Object>()#" call void Generated942::M.G1_C8.B.T<class BaseClass0,class G1_C8`2<class BaseClass1,class BaseClass0>>(!!1,string) ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G1_C8::ClassMethod1333.4830()#G1_C8::ClassMethod1334.4831<System.Object>()#G1_C8::ClassMethod1335.4832<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G1_C8::Method7.4821<System.Object>()#" call void Generated942::M.G1_C8.B.A<class G1_C8`2<class BaseClass1,class BaseClass0>>(!!0,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.T.T<class BaseClass1,class BaseClass0,class G1_C8`2<class BaseClass1,class BaseClass0>>(!!2,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.B.T<class BaseClass0,class G1_C8`2<class BaseClass1,class BaseClass0>>(!!1,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.B.A<class G1_C8`2<class BaseClass1,class BaseClass0>>(!!0,string) ldloc.0 ldstr "G1_C8::Method0.MI.4824()#G1_C8::Method1.4825()#G1_C8::Method2.MI.4827<System.Object>()#G1_C8::Method3.4828<System.Object>()#" call void Generated942::M.IBase0<class G1_C8`2<class BaseClass1,class BaseClass0>>(!!0,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.T.T<class BaseClass0,class BaseClass0,class G1_C8`2<class BaseClass1,class BaseClass0>>(!!2,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.A.T<class BaseClass0,class G1_C8`2<class BaseClass1,class BaseClass0>>(!!1,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.A.A<class G1_C8`2<class BaseClass1,class BaseClass0>>(!!0,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.T.T<class BaseClass0,class BaseClass1,class G1_C8`2<class BaseClass1,class BaseClass0>>(!!2,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.A.T<class BaseClass1,class G1_C8`2<class BaseClass1,class BaseClass0>>(!!1,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.A.B<class G1_C8`2<class BaseClass1,class BaseClass0>>(!!0,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.T.T<class BaseClass1,class BaseClass1,class G1_C8`2<class BaseClass1,class BaseClass0>>(!!2,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.B.T<class BaseClass1,class G1_C8`2<class BaseClass1,class BaseClass0>>(!!1,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.B.B<class G1_C8`2<class BaseClass1,class BaseClass0>>(!!0,string) newobj instance void class G1_C8`2<class BaseClass1,class BaseClass1>::.ctor() stloc.0 ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G1_C8::ClassMethod1333.4830()#G1_C8::ClassMethod1334.4831<System.Object>()#G1_C8::ClassMethod1335.4832<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G1_C8::Method7.4821<System.Object>()#" call void Generated942::M.G1_C8.T.T<class BaseClass1,class BaseClass1,class G1_C8`2<class BaseClass1,class BaseClass1>>(!!2,string) ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G1_C8::ClassMethod1333.4830()#G1_C8::ClassMethod1334.4831<System.Object>()#G1_C8::ClassMethod1335.4832<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G1_C8::Method7.4821<System.Object>()#" call void Generated942::M.G1_C8.B.T<class BaseClass1,class G1_C8`2<class BaseClass1,class BaseClass1>>(!!1,string) ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G1_C8::ClassMethod1333.4830()#G1_C8::ClassMethod1334.4831<System.Object>()#G1_C8::ClassMethod1335.4832<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G1_C8::Method7.4821<System.Object>()#" call void Generated942::M.G1_C8.B.B<class G1_C8`2<class BaseClass1,class BaseClass1>>(!!0,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.T.T<class BaseClass1,class BaseClass1,class G1_C8`2<class BaseClass1,class BaseClass1>>(!!2,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.B.T<class BaseClass1,class G1_C8`2<class BaseClass1,class BaseClass1>>(!!1,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.B.B<class G1_C8`2<class BaseClass1,class BaseClass1>>(!!0,string) ldloc.0 ldstr "G1_C8::Method0.MI.4824()#G1_C8::Method1.4825()#G1_C8::Method2.MI.4827<System.Object>()#G1_C8::Method3.4828<System.Object>()#" call void Generated942::M.IBase0<class G1_C8`2<class BaseClass1,class BaseClass1>>(!!0,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.T.T<class BaseClass0,class BaseClass1,class G1_C8`2<class BaseClass1,class BaseClass1>>(!!2,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.A.T<class BaseClass1,class G1_C8`2<class BaseClass1,class BaseClass1>>(!!1,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.A.B<class G1_C8`2<class BaseClass1,class BaseClass1>>(!!0,string) ldstr "========================================================================\n\n" call void [mscorlib]System.Console::WriteLine(string) ret } .method public hidebysig static void StructConstrainedInterfaceCallsTest() cil managed { .maxstack 10 ldstr "===================== Struct Constrained Interface Calls Test =====================" call void [mscorlib]System.Console::WriteLine(string) ldstr "========================================================================\n\n" call void [mscorlib]System.Console::WriteLine(string) ret } .method public hidebysig static void CalliTest() cil managed { .maxstack 10 .locals init (object V_0) ldstr "========================== Method Calli Test ==========================" call void [mscorlib]System.Console::WriteLine(string) newobj instance void class G3_C1414`1<class BaseClass0>::.ctor() stloc.0 ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1335<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G2_C437::ClassMethod1335.MI.8947<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1334<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::ClassMethod1334.4831<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1333() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G2_C437::ClassMethod1333.MI.8946()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1332() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::ClassMethod1332.4829()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method3<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method2<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::Method2.4826<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method1() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::Method1.4825()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method0() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::Method0.4823()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method7<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G2_C437::Method7.8939<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method0() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::Method0.MI.4824()" ldstr "IBase0 on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method1() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::Method1.4825()" ldstr "IBase0 on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method2<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::Method2.MI.4827<System.Object>()" ldstr "IBase0 on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method3<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "IBase0 on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G2_C437::Method7.MI.8940<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G2_C437::Method7.MI.8940<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method6<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G3_C1414::Method6.16058<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method5() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G3_C1414::Method5.16056()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method4() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G2_C437::Method4.8941()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method7<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G2_C437::Method7.8939<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::ClassMethod1335<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G2_C437::ClassMethod1335.MI.8947<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::ClassMethod1334<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::ClassMethod1334.4831<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::ClassMethod1333() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G2_C437::ClassMethod1333.MI.8946()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::ClassMethod1332() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::ClassMethod1332.4829()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method3<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method2<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::Method2.4826<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method1() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::Method1.4825()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method0() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::Method0.4823()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase1`1<class BaseClass0>::Method4() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G3_C1414::Method4.16055()" ldstr "class IBase1`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase1`1<class BaseClass0>::Method5() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G3_C1414::Method5.MI.16057()" ldstr "class IBase1`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase1`1<class BaseClass0>::Method6<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G3_C1414::Method6.MI.16059<System.Object>()" ldstr "class IBase1`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass0> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass0>::ClassMethod4225<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G3_C1414::ClassMethod4225.16062<System.Object>()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass0> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass0>::ClassMethod4224<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G3_C1414::ClassMethod4224.16061<System.Object>()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass0> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass0>::ClassMethod4223() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G3_C1414::ClassMethod4223.16060()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass0> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass0>::Method6<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G3_C1414::Method6.16058<System.Object>()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass0> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass0>::Method5() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G3_C1414::Method5.16056()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass0> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass0>::Method4() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G3_C1414::Method4.16055()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass0> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass0>::Method7<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G2_C437::Method7.8939<System.Object>()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass0> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass0>::ClassMethod1335<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G2_C437::ClassMethod1335.MI.8947<System.Object>()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass0> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass0>::ClassMethod1334<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::ClassMethod1334.4831<System.Object>()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass0> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass0>::ClassMethod1333() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G2_C437::ClassMethod1333.MI.8946()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass0> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass0>::ClassMethod1332() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::ClassMethod1332.4829()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass0> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass0>::Method3<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass0> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass0>::Method2<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::Method2.4826<System.Object>()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass0> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass0>::Method1() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::Method1.4825()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass0> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass0>::Method0() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::Method0.4823()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) newobj instance void class G3_C1414`1<class BaseClass1>::.ctor() stloc.0 ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1335<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G2_C437::ClassMethod1335.MI.8947<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1334<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::ClassMethod1334.4831<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1333() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G2_C437::ClassMethod1333.MI.8946()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1332() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::ClassMethod1332.4829()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method3<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method2<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::Method2.4826<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method1() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::Method1.4825()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method0() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::Method0.4823()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method7<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G2_C437::Method7.8939<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method0() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::Method0.MI.4824()" ldstr "IBase0 on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method1() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::Method1.4825()" ldstr "IBase0 on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method2<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::Method2.MI.4827<System.Object>()" ldstr "IBase0 on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method3<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "IBase0 on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G2_C437::Method7.MI.8940<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G2_C437::Method7.MI.8940<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method6<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G3_C1414::Method6.16058<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method5() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G3_C1414::Method5.16056()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method4() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G2_C437::Method4.8941()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method7<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G2_C437::Method7.8939<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::ClassMethod1335<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G2_C437::ClassMethod1335.MI.8947<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::ClassMethod1334<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::ClassMethod1334.4831<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::ClassMethod1333() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G2_C437::ClassMethod1333.MI.8946()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::ClassMethod1332() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::ClassMethod1332.4829()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method3<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method2<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::Method2.4826<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method1() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::Method1.4825()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method0() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::Method0.4823()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase1`1<class BaseClass0>::Method4() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G3_C1414::Method4.16055()" ldstr "class IBase1`1<class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase1`1<class BaseClass0>::Method5() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G3_C1414::Method5.MI.16057()" ldstr "class IBase1`1<class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase1`1<class BaseClass0>::Method6<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G3_C1414::Method6.MI.16059<System.Object>()" ldstr "class IBase1`1<class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass1> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass1>::ClassMethod4225<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G3_C1414::ClassMethod4225.16062<System.Object>()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass1> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass1>::ClassMethod4224<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G3_C1414::ClassMethod4224.16061<System.Object>()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass1> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass1>::ClassMethod4223() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G3_C1414::ClassMethod4223.16060()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass1> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass1>::Method6<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G3_C1414::Method6.16058<System.Object>()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass1> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass1>::Method5() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G3_C1414::Method5.16056()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass1> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass1>::Method4() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G3_C1414::Method4.16055()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass1> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass1>::Method7<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G2_C437::Method7.8939<System.Object>()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass1> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass1>::ClassMethod1335<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G2_C437::ClassMethod1335.MI.8947<System.Object>()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass1> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass1>::ClassMethod1334<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::ClassMethod1334.4831<System.Object>()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass1> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass1>::ClassMethod1333() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G2_C437::ClassMethod1333.MI.8946()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass1> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass1>::ClassMethod1332() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::ClassMethod1332.4829()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass1> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass1>::Method3<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass1> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass1>::Method2<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::Method2.4826<System.Object>()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass1> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass1>::Method1() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::Method1.4825()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass1> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass1>::Method0() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::Method0.4823()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase1`1<class BaseClass1>::Method4() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G3_C1414::Method4.16055()" ldstr "class IBase1`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase1`1<class BaseClass1>::Method5() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G3_C1414::Method5.MI.16057()" ldstr "class IBase1`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase1`1<class BaseClass1>::Method6<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G3_C1414::Method6.MI.16059<System.Object>()" ldstr "class IBase1`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) newobj instance void class G1_C8`2<class BaseClass0,class BaseClass0>::.ctor() stloc.0 ldloc.0 castclass class G1_C8`2<class BaseClass0,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass0,class BaseClass0>::ClassMethod1335<object>() calli default string(class G1_C8`2<class BaseClass0,class BaseClass0>) ldstr "G1_C8::ClassMethod1335.4832<System.Object>()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass0> on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass0,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass0,class BaseClass0>::ClassMethod1334<object>() calli default string(class G1_C8`2<class BaseClass0,class BaseClass0>) ldstr "G1_C8::ClassMethod1334.4831<System.Object>()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass0> on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass0,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass0,class BaseClass0>::ClassMethod1333() calli default string(class G1_C8`2<class BaseClass0,class BaseClass0>) ldstr "G1_C8::ClassMethod1333.4830()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass0> on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass0,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass0,class BaseClass0>::ClassMethod1332() calli default string(class G1_C8`2<class BaseClass0,class BaseClass0>) ldstr "G1_C8::ClassMethod1332.4829()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass0> on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass0,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass0,class BaseClass0>::Method3<object>() calli default string(class G1_C8`2<class BaseClass0,class BaseClass0>) ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass0> on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass0,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass0,class BaseClass0>::Method2<object>() calli default string(class G1_C8`2<class BaseClass0,class BaseClass0>) ldstr "G1_C8::Method2.4826<System.Object>()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass0> on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass0,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass0,class BaseClass0>::Method1() calli default string(class G1_C8`2<class BaseClass0,class BaseClass0>) ldstr "G1_C8::Method1.4825()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass0> on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass0,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass0,class BaseClass0>::Method0() calli default string(class G1_C8`2<class BaseClass0,class BaseClass0>) ldstr "G1_C8::Method0.4823()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass0> on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass0,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass0,class BaseClass0>::Method7<object>() calli default string(class G1_C8`2<class BaseClass0,class BaseClass0>) ldstr "G1_C8::Method7.4821<System.Object>()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass0> on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() calli default string(class G1_C8`2<class BaseClass0,class BaseClass0>) ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method0() calli default string(class G1_C8`2<class BaseClass0,class BaseClass0>) ldstr "G1_C8::Method0.MI.4824()" ldstr "IBase0 on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method1() calli default string(class G1_C8`2<class BaseClass0,class BaseClass0>) ldstr "G1_C8::Method1.4825()" ldstr "IBase0 on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method2<object>() calli default string(class G1_C8`2<class BaseClass0,class BaseClass0>) ldstr "G1_C8::Method2.MI.4827<System.Object>()" ldstr "IBase0 on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method3<object>() calli default string(class G1_C8`2<class BaseClass0,class BaseClass0>) ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "IBase0 on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() calli default string(class G1_C8`2<class BaseClass0,class BaseClass0>) ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) newobj instance void class G1_C8`2<class BaseClass0,class BaseClass1>::.ctor() stloc.0 ldloc.0 castclass class G1_C8`2<class BaseClass0,class BaseClass1> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass0,class BaseClass1>::ClassMethod1335<object>() calli default string(class G1_C8`2<class BaseClass0,class BaseClass1>) ldstr "G1_C8::ClassMethod1335.4832<System.Object>()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass0,class BaseClass1> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass0,class BaseClass1>::ClassMethod1334<object>() calli default string(class G1_C8`2<class BaseClass0,class BaseClass1>) ldstr "G1_C8::ClassMethod1334.4831<System.Object>()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass0,class BaseClass1> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass0,class BaseClass1>::ClassMethod1333() calli default string(class G1_C8`2<class BaseClass0,class BaseClass1>) ldstr "G1_C8::ClassMethod1333.4830()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass0,class BaseClass1> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass0,class BaseClass1>::ClassMethod1332() calli default string(class G1_C8`2<class BaseClass0,class BaseClass1>) ldstr "G1_C8::ClassMethod1332.4829()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass0,class BaseClass1> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass0,class BaseClass1>::Method3<object>() calli default string(class G1_C8`2<class BaseClass0,class BaseClass1>) ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass0,class BaseClass1> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass0,class BaseClass1>::Method2<object>() calli default string(class G1_C8`2<class BaseClass0,class BaseClass1>) ldstr "G1_C8::Method2.4826<System.Object>()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass0,class BaseClass1> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass0,class BaseClass1>::Method1() calli default string(class G1_C8`2<class BaseClass0,class BaseClass1>) ldstr "G1_C8::Method1.4825()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass0,class BaseClass1> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass0,class BaseClass1>::Method0() calli default string(class G1_C8`2<class BaseClass0,class BaseClass1>) ldstr "G1_C8::Method0.4823()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass0,class BaseClass1> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass0,class BaseClass1>::Method7<object>() calli default string(class G1_C8`2<class BaseClass0,class BaseClass1>) ldstr "G1_C8::Method7.4821<System.Object>()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() calli default string(class G1_C8`2<class BaseClass0,class BaseClass1>) ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method0() calli default string(class G1_C8`2<class BaseClass0,class BaseClass1>) ldstr "G1_C8::Method0.MI.4824()" ldstr "IBase0 on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method1() calli default string(class G1_C8`2<class BaseClass0,class BaseClass1>) ldstr "G1_C8::Method1.4825()" ldstr "IBase0 on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method2<object>() calli default string(class G1_C8`2<class BaseClass0,class BaseClass1>) ldstr "G1_C8::Method2.MI.4827<System.Object>()" ldstr "IBase0 on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method3<object>() calli default string(class G1_C8`2<class BaseClass0,class BaseClass1>) ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "IBase0 on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) newobj instance void class G1_C8`2<class BaseClass1,class BaseClass0>::.ctor() stloc.0 ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1335<object>() calli default string(class G1_C8`2<class BaseClass1,class BaseClass0>) ldstr "G1_C8::ClassMethod1335.4832<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1334<object>() calli default string(class G1_C8`2<class BaseClass1,class BaseClass0>) ldstr "G1_C8::ClassMethod1334.4831<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1333() calli default string(class G1_C8`2<class BaseClass1,class BaseClass0>) ldstr "G1_C8::ClassMethod1333.4830()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1332() calli default string(class G1_C8`2<class BaseClass1,class BaseClass0>) ldstr "G1_C8::ClassMethod1332.4829()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method3<object>() calli default string(class G1_C8`2<class BaseClass1,class BaseClass0>) ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method2<object>() calli default string(class G1_C8`2<class BaseClass1,class BaseClass0>) ldstr "G1_C8::Method2.4826<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method1() calli default string(class G1_C8`2<class BaseClass1,class BaseClass0>) ldstr "G1_C8::Method1.4825()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method0() calli default string(class G1_C8`2<class BaseClass1,class BaseClass0>) ldstr "G1_C8::Method0.4823()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method7<object>() calli default string(class G1_C8`2<class BaseClass1,class BaseClass0>) ldstr "G1_C8::Method7.4821<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>() calli default string(class G1_C8`2<class BaseClass1,class BaseClass0>) ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass0> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method0() calli default string(class G1_C8`2<class BaseClass1,class BaseClass0>) ldstr "G1_C8::Method0.MI.4824()" ldstr "IBase0 on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method1() calli default string(class G1_C8`2<class BaseClass1,class BaseClass0>) ldstr "G1_C8::Method1.4825()" ldstr "IBase0 on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method2<object>() calli default string(class G1_C8`2<class BaseClass1,class BaseClass0>) ldstr "G1_C8::Method2.MI.4827<System.Object>()" ldstr "IBase0 on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method3<object>() calli default string(class G1_C8`2<class BaseClass1,class BaseClass0>) ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "IBase0 on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() calli default string(class G1_C8`2<class BaseClass1,class BaseClass0>) ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() calli default string(class G1_C8`2<class BaseClass1,class BaseClass0>) ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() calli default string(class G1_C8`2<class BaseClass1,class BaseClass0>) ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) newobj instance void class G1_C8`2<class BaseClass1,class BaseClass1>::.ctor() stloc.0 ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass1>::ClassMethod1335<object>() calli default string(class G1_C8`2<class BaseClass1,class BaseClass1>) ldstr "G1_C8::ClassMethod1335.4832<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass1>::ClassMethod1334<object>() calli default string(class G1_C8`2<class BaseClass1,class BaseClass1>) ldstr "G1_C8::ClassMethod1334.4831<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass1>::ClassMethod1333() calli default string(class G1_C8`2<class BaseClass1,class BaseClass1>) ldstr "G1_C8::ClassMethod1333.4830()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass1>::ClassMethod1332() calli default string(class G1_C8`2<class BaseClass1,class BaseClass1>) ldstr "G1_C8::ClassMethod1332.4829()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass1>::Method3<object>() calli default string(class G1_C8`2<class BaseClass1,class BaseClass1>) ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass1>::Method2<object>() calli default string(class G1_C8`2<class BaseClass1,class BaseClass1>) ldstr "G1_C8::Method2.4826<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass1>::Method1() calli default string(class G1_C8`2<class BaseClass1,class BaseClass1>) ldstr "G1_C8::Method1.4825()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass1>::Method0() calli default string(class G1_C8`2<class BaseClass1,class BaseClass1>) ldstr "G1_C8::Method0.4823()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass1>::Method7<object>() calli default string(class G1_C8`2<class BaseClass1,class BaseClass1>) ldstr "G1_C8::Method7.4821<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() calli default string(class G1_C8`2<class BaseClass1,class BaseClass1>) ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method0() calli default string(class G1_C8`2<class BaseClass1,class BaseClass1>) ldstr "G1_C8::Method0.MI.4824()" ldstr "IBase0 on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method1() calli default string(class G1_C8`2<class BaseClass1,class BaseClass1>) ldstr "G1_C8::Method1.4825()" ldstr "IBase0 on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method2<object>() calli default string(class G1_C8`2<class BaseClass1,class BaseClass1>) ldstr "G1_C8::Method2.MI.4827<System.Object>()" ldstr "IBase0 on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method3<object>() calli default string(class G1_C8`2<class BaseClass1,class BaseClass1>) ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "IBase0 on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() calli default string(class G1_C8`2<class BaseClass1,class BaseClass1>) ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldstr "========================================================================\n\n" call void [mscorlib]System.Console::WriteLine(string) ret } .method public hidebysig static int32 Main() cil managed { .custom instance void [xunit.core]Xunit.FactAttribute::.ctor() = ( 01 00 00 00 ) .entrypoint .maxstack 10 call void Generated942::MethodCallingTest() call void Generated942::ConstrainedCallsTest() call void Generated942::StructConstrainedInterfaceCallsTest() call void Generated942::CalliTest() ldc.i4 100 ret } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. .assembly extern mscorlib { .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) .ver 4:0:0:0 } .assembly extern TestFramework { .publickeytoken = ( B0 3F 5F 7F 11 D5 0A 3A ) } //TYPES IN FORWARDER ASSEMBLIES: //TEST ASSEMBLY: .assembly Generated942 { .hash algorithm 0x00008004 } .assembly extern xunit.core {} .class public BaseClass0 { .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void [mscorlib]System.Object::.ctor() ret } } .class public BaseClass1 extends BaseClass0 { .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void BaseClass0::.ctor() ret } } .class public G3_C1414`1<T0> extends class G2_C437`2<class BaseClass1,class BaseClass1> implements class IBase1`1<!T0> { .method public hidebysig newslot virtual instance string Method4() cil managed noinlining { ldstr "G3_C1414::Method4.16055()" ret } .method public hidebysig virtual instance string Method5() cil managed noinlining { ldstr "G3_C1414::Method5.16056()" ret } .method public hidebysig newslot virtual instance string 'IBase1<T0>.Method5'() cil managed noinlining { .override method instance string class IBase1`1<!T0>::Method5() ldstr "G3_C1414::Method5.MI.16057()" ret } .method public hidebysig virtual instance string Method6<M0>() cil managed noinlining { ldstr "G3_C1414::Method6.16058<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig newslot virtual instance string 'IBase1<T0>.Method6'<M0>() cil managed noinlining { .override method instance string class IBase1`1<!T0>::Method6<[1]>() ldstr "G3_C1414::Method6.MI.16059<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig newslot virtual instance string ClassMethod4223() cil managed noinlining { ldstr "G3_C1414::ClassMethod4223.16060()" ret } .method public hidebysig newslot virtual instance string ClassMethod4224<M0>() cil managed noinlining { ldstr "G3_C1414::ClassMethod4224.16061<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig newslot virtual instance string ClassMethod4225<M0>() cil managed noinlining { ldstr "G3_C1414::ClassMethod4225.16062<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void class G2_C437`2<class BaseClass1,class BaseClass1>::.ctor() ret } } .class public abstract G2_C437`2<T0, T1> extends class G1_C8`2<!T0,class BaseClass0> implements class IBase2`2<class BaseClass1,!T1>, class IBase1`1<class BaseClass0> { .method public hidebysig virtual instance string Method7<M0>() cil managed noinlining { ldstr "G2_C437::Method7.8939<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig newslot virtual instance string 'IBase2<class BaseClass1,T1>.Method7'<M0>() cil managed noinlining { .override method instance string class IBase2`2<class BaseClass1,!T1>::Method7<[1]>() ldstr "G2_C437::Method7.MI.8940<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig virtual instance string Method4() cil managed noinlining { ldstr "G2_C437::Method4.8941()" ret } .method public hidebysig newslot virtual instance string 'IBase1<class BaseClass0>.Method4'() cil managed noinlining { .override method instance string class IBase1`1<class BaseClass0>::Method4() ldstr "G2_C437::Method4.MI.8942()" ret } .method public hidebysig newslot virtual instance string Method5() cil managed noinlining { ldstr "G2_C437::Method5.8943()" ret } .method public hidebysig virtual instance string Method6<M0>() cil managed noinlining { ldstr "G2_C437::Method6.8944<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig newslot virtual instance string 'IBase1<class BaseClass0>.Method6'<M0>() cil managed noinlining { .override method instance string class IBase1`1<class BaseClass0>::Method6<[1]>() ldstr "G2_C437::Method6.MI.8945<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig newslot virtual instance string 'G1_C8<T0,class BaseClass0>.ClassMethod1333'() cil managed noinlining { .override method instance string class G1_C8`2<!T0,class BaseClass0>::ClassMethod1333() ldstr "G2_C437::ClassMethod1333.MI.8946()" ret } .method public hidebysig newslot virtual instance string 'G1_C8<T0,class BaseClass0>.ClassMethod1335'<M0>() cil managed noinlining { .override method instance string class G1_C8`2<!T0,class BaseClass0>::ClassMethod1335<[1]>() ldstr "G2_C437::ClassMethod1335.MI.8947<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void class G1_C8`2<!T0,class BaseClass0>::.ctor() ret } } .class interface public abstract IBase1`1<+T0> { .method public hidebysig newslot abstract virtual instance string Method4() cil managed { } .method public hidebysig newslot abstract virtual instance string Method5() cil managed { } .method public hidebysig newslot abstract virtual instance string Method6<M0>() cil managed { } } .class public G1_C8`2<T0, T1> implements class IBase2`2<!T0,!T1>, IBase0 { .method public hidebysig virtual instance string Method7<M0>() cil managed noinlining { ldstr "G1_C8::Method7.4821<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig newslot virtual instance string 'IBase2<T0,T1>.Method7'<M0>() cil managed noinlining { .override method instance string class IBase2`2<!T0,!T1>::Method7<[1]>() ldstr "G1_C8::Method7.MI.4822<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig newslot virtual instance string Method0() cil managed noinlining { ldstr "G1_C8::Method0.4823()" ret } .method public hidebysig newslot virtual instance string 'IBase0.Method0'() cil managed noinlining { .override method instance string IBase0::Method0() ldstr "G1_C8::Method0.MI.4824()" ret } .method public hidebysig virtual instance string Method1() cil managed noinlining { ldstr "G1_C8::Method1.4825()" ret } .method public hidebysig newslot virtual instance string Method2<M0>() cil managed noinlining { ldstr "G1_C8::Method2.4826<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig newslot virtual instance string 'IBase0.Method2'<M0>() cil managed noinlining { .override method instance string IBase0::Method2<[1]>() ldstr "G1_C8::Method2.MI.4827<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig newslot virtual instance string Method3<M0>() cil managed noinlining { ldstr "G1_C8::Method3.4828<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig newslot virtual instance string ClassMethod1332() cil managed noinlining { ldstr "G1_C8::ClassMethod1332.4829()" ret } .method public hidebysig newslot virtual instance string ClassMethod1333() cil managed noinlining { ldstr "G1_C8::ClassMethod1333.4830()" ret } .method public hidebysig newslot virtual instance string ClassMethod1334<M0>() cil managed noinlining { ldstr "G1_C8::ClassMethod1334.4831<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig newslot virtual instance string ClassMethod1335<M0>() cil managed noinlining { ldstr "G1_C8::ClassMethod1335.4832<" ldtoken !!M0 call class [mscorlib]System.Type [mscorlib]System.Type::GetTypeFromHandle(valuetype [mscorlib]System.RuntimeTypeHandle) call string [mscorlib]System.String::Concat(object,object) ldstr ">()" call string [mscorlib]System.String::Concat(object,object) ret } .method public hidebysig specialname rtspecialname instance void .ctor() cil managed { ldarg.0 call instance void [mscorlib]System.Object::.ctor() ret } } .class interface public abstract IBase2`2<+T0, -T1> { .method public hidebysig newslot abstract virtual instance string Method7<M0>() cil managed { } } .class interface public abstract IBase0 { .method public hidebysig newslot abstract virtual instance string Method0() cil managed { } .method public hidebysig newslot abstract virtual instance string Method1() cil managed { } .method public hidebysig newslot abstract virtual instance string Method2<M0>() cil managed { } .method public hidebysig newslot abstract virtual instance string Method3<M0>() cil managed { } } .class public auto ansi beforefieldinit Generated942 { .method static void M.BaseClass0<(BaseClass0)W>(!!W inst, string exp) cil managed { .maxstack 5 .locals init (string[] actualResults) ldc.i4.s 0 newarr string stloc.s actualResults ldarg.1 ldstr "M.BaseClass0<(BaseClass0)W>(!!W inst, string exp)" ldc.i4.s 0 ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.BaseClass1<(BaseClass1)W>(!!W inst, string exp) cil managed { .maxstack 5 .locals init (string[] actualResults) ldc.i4.s 0 newarr string stloc.s actualResults ldarg.1 ldstr "M.BaseClass1<(BaseClass1)W>(!!W inst, string exp)" ldc.i4.s 0 ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.G3_C1414.T<T0,(class G3_C1414`1<!!T0>)W>(!!W 'inst', string exp) cil managed { .maxstack 20 .locals init (string[] actualResults) ldc.i4.s 15 newarr string stloc.s actualResults ldarg.1 ldstr "M.G3_C1414.T<T0,(class G3_C1414`1<!!T0>)W>(!!W 'inst', string exp)" ldc.i4.s 15 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<!!T0>::ClassMethod1332() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<!!T0>::ClassMethod1333() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<!!T0>::ClassMethod1334<object>() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<!!T0>::ClassMethod1335<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<!!T0>::ClassMethod4223() stelem.ref ldloc.s actualResults ldc.i4.s 5 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<!!T0>::ClassMethod4224<object>() stelem.ref ldloc.s actualResults ldc.i4.s 6 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<!!T0>::ClassMethod4225<object>() stelem.ref ldloc.s actualResults ldc.i4.s 7 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<!!T0>::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 8 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<!!T0>::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 9 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<!!T0>::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 10 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<!!T0>::Method3<object>() stelem.ref ldloc.s actualResults ldc.i4.s 11 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<!!T0>::Method4() stelem.ref ldloc.s actualResults ldc.i4.s 12 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<!!T0>::Method5() stelem.ref ldloc.s actualResults ldc.i4.s 13 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<!!T0>::Method6<object>() stelem.ref ldloc.s actualResults ldc.i4.s 14 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<!!T0>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.G3_C1414.A<(class G3_C1414`1<class BaseClass0>)W>(!!W 'inst', string exp) cil managed { .maxstack 20 .locals init (string[] actualResults) ldc.i4.s 15 newarr string stloc.s actualResults ldarg.1 ldstr "M.G3_C1414.A<(class G3_C1414`1<class BaseClass0>)W>(!!W 'inst', string exp)" ldc.i4.s 15 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass0>::ClassMethod1332() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass0>::ClassMethod1333() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass0>::ClassMethod1334<object>() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass0>::ClassMethod1335<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass0>::ClassMethod4223() stelem.ref ldloc.s actualResults ldc.i4.s 5 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass0>::ClassMethod4224<object>() stelem.ref ldloc.s actualResults ldc.i4.s 6 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass0>::ClassMethod4225<object>() stelem.ref ldloc.s actualResults ldc.i4.s 7 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass0>::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 8 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass0>::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 9 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass0>::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 10 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass0>::Method3<object>() stelem.ref ldloc.s actualResults ldc.i4.s 11 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass0>::Method4() stelem.ref ldloc.s actualResults ldc.i4.s 12 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass0>::Method5() stelem.ref ldloc.s actualResults ldc.i4.s 13 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass0>::Method6<object>() stelem.ref ldloc.s actualResults ldc.i4.s 14 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass0>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.G3_C1414.B<(class G3_C1414`1<class BaseClass1>)W>(!!W 'inst', string exp) cil managed { .maxstack 20 .locals init (string[] actualResults) ldc.i4.s 15 newarr string stloc.s actualResults ldarg.1 ldstr "M.G3_C1414.B<(class G3_C1414`1<class BaseClass1>)W>(!!W 'inst', string exp)" ldc.i4.s 15 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass1>::ClassMethod1332() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass1>::ClassMethod1333() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass1>::ClassMethod1334<object>() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass1>::ClassMethod1335<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass1>::ClassMethod4223() stelem.ref ldloc.s actualResults ldc.i4.s 5 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass1>::ClassMethod4224<object>() stelem.ref ldloc.s actualResults ldc.i4.s 6 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass1>::ClassMethod4225<object>() stelem.ref ldloc.s actualResults ldc.i4.s 7 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass1>::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 8 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass1>::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 9 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass1>::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 10 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass1>::Method3<object>() stelem.ref ldloc.s actualResults ldc.i4.s 11 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass1>::Method4() stelem.ref ldloc.s actualResults ldc.i4.s 12 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass1>::Method5() stelem.ref ldloc.s actualResults ldc.i4.s 13 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass1>::Method6<object>() stelem.ref ldloc.s actualResults ldc.i4.s 14 ldarga.s 0 constrained. !!W callvirt instance string class G3_C1414`1<class BaseClass1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.G2_C437.T.T<T0,T1,(class G2_C437`2<!!T0,!!T1>)W>(!!W 'inst', string exp) cil managed { .maxstack 17 .locals init (string[] actualResults) ldc.i4.s 12 newarr string stloc.s actualResults ldarg.1 ldstr "M.G2_C437.T.T<T0,T1,(class G2_C437`2<!!T0,!!T1>)W>(!!W 'inst', string exp)" ldc.i4.s 12 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<!!T0,!!T1>::ClassMethod1332() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<!!T0,!!T1>::ClassMethod1333() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<!!T0,!!T1>::ClassMethod1334<object>() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<!!T0,!!T1>::ClassMethod1335<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<!!T0,!!T1>::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 5 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<!!T0,!!T1>::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 6 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<!!T0,!!T1>::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 7 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<!!T0,!!T1>::Method3<object>() stelem.ref ldloc.s actualResults ldc.i4.s 8 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<!!T0,!!T1>::Method4() stelem.ref ldloc.s actualResults ldc.i4.s 9 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<!!T0,!!T1>::Method5() stelem.ref ldloc.s actualResults ldc.i4.s 10 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<!!T0,!!T1>::Method6<object>() stelem.ref ldloc.s actualResults ldc.i4.s 11 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<!!T0,!!T1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.G2_C437.A.T<T1,(class G2_C437`2<class BaseClass0,!!T1>)W>(!!W 'inst', string exp) cil managed { .maxstack 17 .locals init (string[] actualResults) ldc.i4.s 12 newarr string stloc.s actualResults ldarg.1 ldstr "M.G2_C437.A.T<T1,(class G2_C437`2<class BaseClass0,!!T1>)W>(!!W 'inst', string exp)" ldc.i4.s 12 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,!!T1>::ClassMethod1332() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,!!T1>::ClassMethod1333() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,!!T1>::ClassMethod1334<object>() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,!!T1>::ClassMethod1335<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,!!T1>::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 5 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,!!T1>::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 6 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,!!T1>::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 7 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,!!T1>::Method3<object>() stelem.ref ldloc.s actualResults ldc.i4.s 8 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,!!T1>::Method4() stelem.ref ldloc.s actualResults ldc.i4.s 9 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,!!T1>::Method5() stelem.ref ldloc.s actualResults ldc.i4.s 10 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,!!T1>::Method6<object>() stelem.ref ldloc.s actualResults ldc.i4.s 11 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,!!T1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.G2_C437.A.A<(class G2_C437`2<class BaseClass0,class BaseClass0>)W>(!!W 'inst', string exp) cil managed { .maxstack 17 .locals init (string[] actualResults) ldc.i4.s 12 newarr string stloc.s actualResults ldarg.1 ldstr "M.G2_C437.A.A<(class G2_C437`2<class BaseClass0,class BaseClass0>)W>(!!W 'inst', string exp)" ldc.i4.s 12 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass0>::ClassMethod1332() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass0>::ClassMethod1333() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass0>::ClassMethod1334<object>() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass0>::ClassMethod1335<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass0>::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 5 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass0>::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 6 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass0>::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 7 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass0>::Method3<object>() stelem.ref ldloc.s actualResults ldc.i4.s 8 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass0>::Method4() stelem.ref ldloc.s actualResults ldc.i4.s 9 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass0>::Method5() stelem.ref ldloc.s actualResults ldc.i4.s 10 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass0>::Method6<object>() stelem.ref ldloc.s actualResults ldc.i4.s 11 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass0>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.G2_C437.A.B<(class G2_C437`2<class BaseClass0,class BaseClass1>)W>(!!W 'inst', string exp) cil managed { .maxstack 17 .locals init (string[] actualResults) ldc.i4.s 12 newarr string stloc.s actualResults ldarg.1 ldstr "M.G2_C437.A.B<(class G2_C437`2<class BaseClass0,class BaseClass1>)W>(!!W 'inst', string exp)" ldc.i4.s 12 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass1>::ClassMethod1332() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass1>::ClassMethod1333() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass1>::ClassMethod1334<object>() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass1>::ClassMethod1335<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass1>::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 5 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass1>::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 6 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass1>::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 7 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass1>::Method3<object>() stelem.ref ldloc.s actualResults ldc.i4.s 8 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass1>::Method4() stelem.ref ldloc.s actualResults ldc.i4.s 9 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass1>::Method5() stelem.ref ldloc.s actualResults ldc.i4.s 10 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass1>::Method6<object>() stelem.ref ldloc.s actualResults ldc.i4.s 11 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass0,class BaseClass1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.G2_C437.B.T<T1,(class G2_C437`2<class BaseClass1,!!T1>)W>(!!W 'inst', string exp) cil managed { .maxstack 17 .locals init (string[] actualResults) ldc.i4.s 12 newarr string stloc.s actualResults ldarg.1 ldstr "M.G2_C437.B.T<T1,(class G2_C437`2<class BaseClass1,!!T1>)W>(!!W 'inst', string exp)" ldc.i4.s 12 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,!!T1>::ClassMethod1332() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,!!T1>::ClassMethod1333() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,!!T1>::ClassMethod1334<object>() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,!!T1>::ClassMethod1335<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,!!T1>::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 5 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,!!T1>::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 6 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,!!T1>::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 7 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,!!T1>::Method3<object>() stelem.ref ldloc.s actualResults ldc.i4.s 8 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,!!T1>::Method4() stelem.ref ldloc.s actualResults ldc.i4.s 9 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,!!T1>::Method5() stelem.ref ldloc.s actualResults ldc.i4.s 10 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,!!T1>::Method6<object>() stelem.ref ldloc.s actualResults ldc.i4.s 11 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,!!T1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.G2_C437.B.A<(class G2_C437`2<class BaseClass1,class BaseClass0>)W>(!!W 'inst', string exp) cil managed { .maxstack 17 .locals init (string[] actualResults) ldc.i4.s 12 newarr string stloc.s actualResults ldarg.1 ldstr "M.G2_C437.B.A<(class G2_C437`2<class BaseClass1,class BaseClass0>)W>(!!W 'inst', string exp)" ldc.i4.s 12 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass0>::ClassMethod1332() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass0>::ClassMethod1333() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass0>::ClassMethod1334<object>() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass0>::ClassMethod1335<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass0>::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 5 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass0>::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 6 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass0>::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 7 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass0>::Method3<object>() stelem.ref ldloc.s actualResults ldc.i4.s 8 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass0>::Method4() stelem.ref ldloc.s actualResults ldc.i4.s 9 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass0>::Method5() stelem.ref ldloc.s actualResults ldc.i4.s 10 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass0>::Method6<object>() stelem.ref ldloc.s actualResults ldc.i4.s 11 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass0>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.G2_C437.B.B<(class G2_C437`2<class BaseClass1,class BaseClass1>)W>(!!W 'inst', string exp) cil managed { .maxstack 17 .locals init (string[] actualResults) ldc.i4.s 12 newarr string stloc.s actualResults ldarg.1 ldstr "M.G2_C437.B.B<(class G2_C437`2<class BaseClass1,class BaseClass1>)W>(!!W 'inst', string exp)" ldc.i4.s 12 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::ClassMethod1332() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::ClassMethod1333() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::ClassMethod1334<object>() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::ClassMethod1335<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 5 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 6 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 7 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method3<object>() stelem.ref ldloc.s actualResults ldc.i4.s 8 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method4() stelem.ref ldloc.s actualResults ldc.i4.s 9 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method5() stelem.ref ldloc.s actualResults ldc.i4.s 10 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method6<object>() stelem.ref ldloc.s actualResults ldc.i4.s 11 ldarga.s 0 constrained. !!W callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase1.T<T0,(class IBase1`1<!!T0>)W>(!!W 'inst', string exp) cil managed { .maxstack 8 .locals init (string[] actualResults) ldc.i4.s 3 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase1.T<T0,(class IBase1`1<!!T0>)W>(!!W 'inst', string exp)" ldc.i4.s 3 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase1`1<!!T0>::Method4() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. !!W callvirt instance string class IBase1`1<!!T0>::Method5() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. !!W callvirt instance string class IBase1`1<!!T0>::Method6<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase1.A<(class IBase1`1<class BaseClass0>)W>(!!W 'inst', string exp) cil managed { .maxstack 8 .locals init (string[] actualResults) ldc.i4.s 3 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase1.A<(class IBase1`1<class BaseClass0>)W>(!!W 'inst', string exp)" ldc.i4.s 3 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase1`1<class BaseClass0>::Method4() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. !!W callvirt instance string class IBase1`1<class BaseClass0>::Method5() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. !!W callvirt instance string class IBase1`1<class BaseClass0>::Method6<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase1.B<(class IBase1`1<class BaseClass1>)W>(!!W 'inst', string exp) cil managed { .maxstack 8 .locals init (string[] actualResults) ldc.i4.s 3 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase1.B<(class IBase1`1<class BaseClass1>)W>(!!W 'inst', string exp)" ldc.i4.s 3 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase1`1<class BaseClass1>::Method4() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. !!W callvirt instance string class IBase1`1<class BaseClass1>::Method5() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. !!W callvirt instance string class IBase1`1<class BaseClass1>::Method6<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.G1_C8.T.T<T0,T1,(class G1_C8`2<!!T0,!!T1>)W>(!!W 'inst', string exp) cil managed { .maxstack 14 .locals init (string[] actualResults) ldc.i4.s 9 newarr string stloc.s actualResults ldarg.1 ldstr "M.G1_C8.T.T<T0,T1,(class G1_C8`2<!!T0,!!T1>)W>(!!W 'inst', string exp)" ldc.i4.s 9 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<!!T0,!!T1>::ClassMethod1332() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<!!T0,!!T1>::ClassMethod1333() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<!!T0,!!T1>::ClassMethod1334<object>() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<!!T0,!!T1>::ClassMethod1335<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<!!T0,!!T1>::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 5 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<!!T0,!!T1>::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 6 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<!!T0,!!T1>::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 7 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<!!T0,!!T1>::Method3<object>() stelem.ref ldloc.s actualResults ldc.i4.s 8 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<!!T0,!!T1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.G1_C8.A.T<T1,(class G1_C8`2<class BaseClass0,!!T1>)W>(!!W 'inst', string exp) cil managed { .maxstack 14 .locals init (string[] actualResults) ldc.i4.s 9 newarr string stloc.s actualResults ldarg.1 ldstr "M.G1_C8.A.T<T1,(class G1_C8`2<class BaseClass0,!!T1>)W>(!!W 'inst', string exp)" ldc.i4.s 9 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,!!T1>::ClassMethod1332() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,!!T1>::ClassMethod1333() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,!!T1>::ClassMethod1334<object>() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,!!T1>::ClassMethod1335<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,!!T1>::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 5 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,!!T1>::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 6 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,!!T1>::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 7 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,!!T1>::Method3<object>() stelem.ref ldloc.s actualResults ldc.i4.s 8 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,!!T1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.G1_C8.A.A<(class G1_C8`2<class BaseClass0,class BaseClass0>)W>(!!W 'inst', string exp) cil managed { .maxstack 14 .locals init (string[] actualResults) ldc.i4.s 9 newarr string stloc.s actualResults ldarg.1 ldstr "M.G1_C8.A.A<(class G1_C8`2<class BaseClass0,class BaseClass0>)W>(!!W 'inst', string exp)" ldc.i4.s 9 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass0>::ClassMethod1332() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass0>::ClassMethod1333() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass0>::ClassMethod1334<object>() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass0>::ClassMethod1335<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass0>::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 5 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass0>::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 6 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass0>::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 7 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass0>::Method3<object>() stelem.ref ldloc.s actualResults ldc.i4.s 8 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass0>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.G1_C8.A.B<(class G1_C8`2<class BaseClass0,class BaseClass1>)W>(!!W 'inst', string exp) cil managed { .maxstack 14 .locals init (string[] actualResults) ldc.i4.s 9 newarr string stloc.s actualResults ldarg.1 ldstr "M.G1_C8.A.B<(class G1_C8`2<class BaseClass0,class BaseClass1>)W>(!!W 'inst', string exp)" ldc.i4.s 9 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass1>::ClassMethod1332() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass1>::ClassMethod1333() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass1>::ClassMethod1334<object>() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass1>::ClassMethod1335<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass1>::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 5 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass1>::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 6 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass1>::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 7 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass1>::Method3<object>() stelem.ref ldloc.s actualResults ldc.i4.s 8 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.G1_C8.B.T<T1,(class G1_C8`2<class BaseClass1,!!T1>)W>(!!W 'inst', string exp) cil managed { .maxstack 14 .locals init (string[] actualResults) ldc.i4.s 9 newarr string stloc.s actualResults ldarg.1 ldstr "M.G1_C8.B.T<T1,(class G1_C8`2<class BaseClass1,!!T1>)W>(!!W 'inst', string exp)" ldc.i4.s 9 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,!!T1>::ClassMethod1332() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,!!T1>::ClassMethod1333() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,!!T1>::ClassMethod1334<object>() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,!!T1>::ClassMethod1335<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,!!T1>::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 5 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,!!T1>::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 6 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,!!T1>::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 7 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,!!T1>::Method3<object>() stelem.ref ldloc.s actualResults ldc.i4.s 8 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,!!T1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.G1_C8.B.A<(class G1_C8`2<class BaseClass1,class BaseClass0>)W>(!!W 'inst', string exp) cil managed { .maxstack 14 .locals init (string[] actualResults) ldc.i4.s 9 newarr string stloc.s actualResults ldarg.1 ldstr "M.G1_C8.B.A<(class G1_C8`2<class BaseClass1,class BaseClass0>)W>(!!W 'inst', string exp)" ldc.i4.s 9 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1332() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1333() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1334<object>() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1335<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 5 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 6 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 7 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method3<object>() stelem.ref ldloc.s actualResults ldc.i4.s 8 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.G1_C8.B.B<(class G1_C8`2<class BaseClass1,class BaseClass1>)W>(!!W 'inst', string exp) cil managed { .maxstack 14 .locals init (string[] actualResults) ldc.i4.s 9 newarr string stloc.s actualResults ldarg.1 ldstr "M.G1_C8.B.B<(class G1_C8`2<class BaseClass1,class BaseClass1>)W>(!!W 'inst', string exp)" ldc.i4.s 9 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass1>::ClassMethod1332() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass1>::ClassMethod1333() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass1>::ClassMethod1334<object>() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass1>::ClassMethod1335<object>() stelem.ref ldloc.s actualResults ldc.i4.s 4 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass1>::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 5 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass1>::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 6 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass1>::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 7 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass1>::Method3<object>() stelem.ref ldloc.s actualResults ldc.i4.s 8 ldarga.s 0 constrained. !!W callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase2.T.T<T0,T1,(class IBase2`2<!!T0,!!T1>)W>(!!W 'inst', string exp) cil managed { .maxstack 6 .locals init (string[] actualResults) ldc.i4.s 1 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase2.T.T<T0,T1,(class IBase2`2<!!T0,!!T1>)W>(!!W 'inst', string exp)" ldc.i4.s 1 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase2`2<!!T0,!!T1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase2.A.T<T1,(class IBase2`2<class BaseClass0,!!T1>)W>(!!W 'inst', string exp) cil managed { .maxstack 6 .locals init (string[] actualResults) ldc.i4.s 1 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase2.A.T<T1,(class IBase2`2<class BaseClass0,!!T1>)W>(!!W 'inst', string exp)" ldc.i4.s 1 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase2`2<class BaseClass0,!!T1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase2.A.A<(class IBase2`2<class BaseClass0,class BaseClass0>)W>(!!W 'inst', string exp) cil managed { .maxstack 6 .locals init (string[] actualResults) ldc.i4.s 1 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase2.A.A<(class IBase2`2<class BaseClass0,class BaseClass0>)W>(!!W 'inst', string exp)" ldc.i4.s 1 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase2.A.B<(class IBase2`2<class BaseClass0,class BaseClass1>)W>(!!W 'inst', string exp) cil managed { .maxstack 6 .locals init (string[] actualResults) ldc.i4.s 1 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase2.A.B<(class IBase2`2<class BaseClass0,class BaseClass1>)W>(!!W 'inst', string exp)" ldc.i4.s 1 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase2.B.T<T1,(class IBase2`2<class BaseClass1,!!T1>)W>(!!W 'inst', string exp) cil managed { .maxstack 6 .locals init (string[] actualResults) ldc.i4.s 1 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase2.B.T<T1,(class IBase2`2<class BaseClass1,!!T1>)W>(!!W 'inst', string exp)" ldc.i4.s 1 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase2`2<class BaseClass1,!!T1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase2.B.A<(class IBase2`2<class BaseClass1,class BaseClass0>)W>(!!W 'inst', string exp) cil managed { .maxstack 6 .locals init (string[] actualResults) ldc.i4.s 1 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase2.B.A<(class IBase2`2<class BaseClass1,class BaseClass0>)W>(!!W 'inst', string exp)" ldc.i4.s 1 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase2.B.B<(class IBase2`2<class BaseClass1,class BaseClass1>)W>(!!W 'inst', string exp) cil managed { .maxstack 6 .locals init (string[] actualResults) ldc.i4.s 1 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase2.B.B<(class IBase2`2<class BaseClass1,class BaseClass1>)W>(!!W 'inst', string exp)" ldc.i4.s 1 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method static void M.IBase0<(IBase0)W>(!!W inst, string exp) cil managed { .maxstack 9 .locals init (string[] actualResults) ldc.i4.s 4 newarr string stloc.s actualResults ldarg.1 ldstr "M.IBase0<(IBase0)W>(!!W inst, string exp)" ldc.i4.s 4 ldloc.s actualResults ldc.i4.s 0 ldarga.s 0 constrained. !!W callvirt instance string IBase0::Method0() stelem.ref ldloc.s actualResults ldc.i4.s 1 ldarga.s 0 constrained. !!W callvirt instance string IBase0::Method1() stelem.ref ldloc.s actualResults ldc.i4.s 2 ldarga.s 0 constrained. !!W callvirt instance string IBase0::Method2<object>() stelem.ref ldloc.s actualResults ldc.i4.s 3 ldarga.s 0 constrained. !!W callvirt instance string IBase0::Method3<object>() stelem.ref ldloc.s actualResults call void [TestFramework]TestFramework::MethodCallTest(string,string,int32,string[]) ret } .method public hidebysig static void MethodCallingTest() cil managed { .maxstack 10 .locals init (object V_0) ldstr "========================== Method Calling Test ==========================" call void [mscorlib]System.Console::WriteLine(string) newobj instance void class G3_C1414`1<class BaseClass0>::.ctor() stloc.0 ldloc.0 dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1335<object>() ldstr "G2_C437::ClassMethod1335.MI.8947<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1334<object>() ldstr "G1_C8::ClassMethod1334.4831<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1333() ldstr "G2_C437::ClassMethod1333.MI.8946()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1332() ldstr "G1_C8::ClassMethod1332.4829()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method3<object>() ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method2<object>() ldstr "G1_C8::Method2.4826<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method1() ldstr "G1_C8::Method1.4825()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method0() ldstr "G1_C8::Method0.4823()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method7<object>() ldstr "G2_C437::Method7.8939<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>() ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string IBase0::Method0() ldstr "G1_C8::Method0.MI.4824()" ldstr "IBase0 on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method1() ldstr "G1_C8::Method1.4825()" ldstr "IBase0 on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method2<object>() ldstr "G1_C8::Method2.MI.4827<System.Object>()" ldstr "IBase0 on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method3<object>() ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "IBase0 on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() ldstr "G2_C437::Method7.MI.8940<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() ldstr "G2_C437::Method7.MI.8940<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method6<object>() ldstr "G3_C1414::Method6.16058<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method5() ldstr "G3_C1414::Method5.16056()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method4() ldstr "G2_C437::Method4.8941()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method7<object>() ldstr "G2_C437::Method7.8939<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::ClassMethod1335<object>() ldstr "G2_C437::ClassMethod1335.MI.8947<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::ClassMethod1334<object>() ldstr "G1_C8::ClassMethod1334.4831<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::ClassMethod1333() ldstr "G2_C437::ClassMethod1333.MI.8946()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::ClassMethod1332() ldstr "G1_C8::ClassMethod1332.4829()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method3<object>() ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method2<object>() ldstr "G1_C8::Method2.4826<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method1() ldstr "G1_C8::Method1.4825()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method0() ldstr "G1_C8::Method0.4823()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string class IBase1`1<class BaseClass0>::Method4() ldstr "G3_C1414::Method4.16055()" ldstr "class IBase1`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string class IBase1`1<class BaseClass0>::Method5() ldstr "G3_C1414::Method5.MI.16057()" ldstr "class IBase1`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string class IBase1`1<class BaseClass0>::Method6<object>() ldstr "G3_C1414::Method6.MI.16059<System.Object>()" ldstr "class IBase1`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup castclass class G3_C1414`1<class BaseClass0> callvirt instance string class G3_C1414`1<class BaseClass0>::ClassMethod4225<object>() ldstr "G3_C1414::ClassMethod4225.16062<System.Object>()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass0> callvirt instance string class G3_C1414`1<class BaseClass0>::ClassMethod4224<object>() ldstr "G3_C1414::ClassMethod4224.16061<System.Object>()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass0> callvirt instance string class G3_C1414`1<class BaseClass0>::ClassMethod4223() ldstr "G3_C1414::ClassMethod4223.16060()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass0> callvirt instance string class G3_C1414`1<class BaseClass0>::Method6<object>() ldstr "G3_C1414::Method6.16058<System.Object>()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass0> callvirt instance string class G3_C1414`1<class BaseClass0>::Method5() ldstr "G3_C1414::Method5.16056()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass0> callvirt instance string class G3_C1414`1<class BaseClass0>::Method4() ldstr "G3_C1414::Method4.16055()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass0> callvirt instance string class G3_C1414`1<class BaseClass0>::Method7<object>() ldstr "G2_C437::Method7.8939<System.Object>()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass0> callvirt instance string class G3_C1414`1<class BaseClass0>::ClassMethod1335<object>() ldstr "G2_C437::ClassMethod1335.MI.8947<System.Object>()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass0> callvirt instance string class G3_C1414`1<class BaseClass0>::ClassMethod1334<object>() ldstr "G1_C8::ClassMethod1334.4831<System.Object>()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass0> callvirt instance string class G3_C1414`1<class BaseClass0>::ClassMethod1333() ldstr "G2_C437::ClassMethod1333.MI.8946()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass0> callvirt instance string class G3_C1414`1<class BaseClass0>::ClassMethod1332() ldstr "G1_C8::ClassMethod1332.4829()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass0> callvirt instance string class G3_C1414`1<class BaseClass0>::Method3<object>() ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass0> callvirt instance string class G3_C1414`1<class BaseClass0>::Method2<object>() ldstr "G1_C8::Method2.4826<System.Object>()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass0> callvirt instance string class G3_C1414`1<class BaseClass0>::Method1() ldstr "G1_C8::Method1.4825()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass0> callvirt instance string class G3_C1414`1<class BaseClass0>::Method0() ldstr "G1_C8::Method0.4823()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop newobj instance void class G3_C1414`1<class BaseClass1>::.ctor() stloc.0 ldloc.0 dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1335<object>() ldstr "G2_C437::ClassMethod1335.MI.8947<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1334<object>() ldstr "G1_C8::ClassMethod1334.4831<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1333() ldstr "G2_C437::ClassMethod1333.MI.8946()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1332() ldstr "G1_C8::ClassMethod1332.4829()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method3<object>() ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method2<object>() ldstr "G1_C8::Method2.4826<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method1() ldstr "G1_C8::Method1.4825()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method0() ldstr "G1_C8::Method0.4823()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method7<object>() ldstr "G2_C437::Method7.8939<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>() ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string IBase0::Method0() ldstr "G1_C8::Method0.MI.4824()" ldstr "IBase0 on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method1() ldstr "G1_C8::Method1.4825()" ldstr "IBase0 on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method2<object>() ldstr "G1_C8::Method2.MI.4827<System.Object>()" ldstr "IBase0 on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method3<object>() ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "IBase0 on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() ldstr "G2_C437::Method7.MI.8940<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() ldstr "G2_C437::Method7.MI.8940<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method6<object>() ldstr "G3_C1414::Method6.16058<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method5() ldstr "G3_C1414::Method5.16056()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method4() ldstr "G2_C437::Method4.8941()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method7<object>() ldstr "G2_C437::Method7.8939<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::ClassMethod1335<object>() ldstr "G2_C437::ClassMethod1335.MI.8947<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::ClassMethod1334<object>() ldstr "G1_C8::ClassMethod1334.4831<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::ClassMethod1333() ldstr "G2_C437::ClassMethod1333.MI.8946()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::ClassMethod1332() ldstr "G1_C8::ClassMethod1332.4829()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method3<object>() ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method2<object>() ldstr "G1_C8::Method2.4826<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method1() ldstr "G1_C8::Method1.4825()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G2_C437`2<class BaseClass1,class BaseClass1> callvirt instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method0() ldstr "G1_C8::Method0.4823()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string class IBase1`1<class BaseClass0>::Method4() ldstr "G3_C1414::Method4.16055()" ldstr "class IBase1`1<class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string class IBase1`1<class BaseClass0>::Method5() ldstr "G3_C1414::Method5.MI.16057()" ldstr "class IBase1`1<class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string class IBase1`1<class BaseClass0>::Method6<object>() ldstr "G3_C1414::Method6.MI.16059<System.Object>()" ldstr "class IBase1`1<class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup castclass class G3_C1414`1<class BaseClass1> callvirt instance string class G3_C1414`1<class BaseClass1>::ClassMethod4225<object>() ldstr "G3_C1414::ClassMethod4225.16062<System.Object>()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass1> callvirt instance string class G3_C1414`1<class BaseClass1>::ClassMethod4224<object>() ldstr "G3_C1414::ClassMethod4224.16061<System.Object>()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass1> callvirt instance string class G3_C1414`1<class BaseClass1>::ClassMethod4223() ldstr "G3_C1414::ClassMethod4223.16060()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass1> callvirt instance string class G3_C1414`1<class BaseClass1>::Method6<object>() ldstr "G3_C1414::Method6.16058<System.Object>()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass1> callvirt instance string class G3_C1414`1<class BaseClass1>::Method5() ldstr "G3_C1414::Method5.16056()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass1> callvirt instance string class G3_C1414`1<class BaseClass1>::Method4() ldstr "G3_C1414::Method4.16055()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass1> callvirt instance string class G3_C1414`1<class BaseClass1>::Method7<object>() ldstr "G2_C437::Method7.8939<System.Object>()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass1> callvirt instance string class G3_C1414`1<class BaseClass1>::ClassMethod1335<object>() ldstr "G2_C437::ClassMethod1335.MI.8947<System.Object>()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass1> callvirt instance string class G3_C1414`1<class BaseClass1>::ClassMethod1334<object>() ldstr "G1_C8::ClassMethod1334.4831<System.Object>()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass1> callvirt instance string class G3_C1414`1<class BaseClass1>::ClassMethod1333() ldstr "G2_C437::ClassMethod1333.MI.8946()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass1> callvirt instance string class G3_C1414`1<class BaseClass1>::ClassMethod1332() ldstr "G1_C8::ClassMethod1332.4829()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass1> callvirt instance string class G3_C1414`1<class BaseClass1>::Method3<object>() ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass1> callvirt instance string class G3_C1414`1<class BaseClass1>::Method2<object>() ldstr "G1_C8::Method2.4826<System.Object>()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass1> callvirt instance string class G3_C1414`1<class BaseClass1>::Method1() ldstr "G1_C8::Method1.4825()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G3_C1414`1<class BaseClass1> callvirt instance string class G3_C1414`1<class BaseClass1>::Method0() ldstr "G1_C8::Method0.4823()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string class IBase1`1<class BaseClass1>::Method4() ldstr "G3_C1414::Method4.16055()" ldstr "class IBase1`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string class IBase1`1<class BaseClass1>::Method5() ldstr "G3_C1414::Method5.MI.16057()" ldstr "class IBase1`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string class IBase1`1<class BaseClass1>::Method6<object>() ldstr "G3_C1414::Method6.MI.16059<System.Object>()" ldstr "class IBase1`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop newobj instance void class G1_C8`2<class BaseClass0,class BaseClass0>::.ctor() stloc.0 ldloc.0 dup castclass class G1_C8`2<class BaseClass0,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass0>::ClassMethod1335<object>() ldstr "G1_C8::ClassMethod1335.4832<System.Object>()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass0> on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass0,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass0>::ClassMethod1334<object>() ldstr "G1_C8::ClassMethod1334.4831<System.Object>()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass0> on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass0,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass0>::ClassMethod1333() ldstr "G1_C8::ClassMethod1333.4830()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass0> on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass0,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass0>::ClassMethod1332() ldstr "G1_C8::ClassMethod1332.4829()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass0> on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass0,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass0>::Method3<object>() ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass0> on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass0,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass0>::Method2<object>() ldstr "G1_C8::Method2.4826<System.Object>()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass0> on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass0,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass0>::Method1() ldstr "G1_C8::Method1.4825()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass0> on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass0,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass0>::Method0() ldstr "G1_C8::Method0.4823()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass0> on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass0,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass0>::Method7<object>() ldstr "G1_C8::Method7.4821<System.Object>()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass0> on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string IBase0::Method0() ldstr "G1_C8::Method0.MI.4824()" ldstr "IBase0 on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method1() ldstr "G1_C8::Method1.4825()" ldstr "IBase0 on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method2<object>() ldstr "G1_C8::Method2.MI.4827<System.Object>()" ldstr "IBase0 on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method3<object>() ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "IBase0 on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop newobj instance void class G1_C8`2<class BaseClass0,class BaseClass1>::.ctor() stloc.0 ldloc.0 dup castclass class G1_C8`2<class BaseClass0,class BaseClass1> callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass1>::ClassMethod1335<object>() ldstr "G1_C8::ClassMethod1335.4832<System.Object>()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass0,class BaseClass1> callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass1>::ClassMethod1334<object>() ldstr "G1_C8::ClassMethod1334.4831<System.Object>()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass0,class BaseClass1> callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass1>::ClassMethod1333() ldstr "G1_C8::ClassMethod1333.4830()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass0,class BaseClass1> callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass1>::ClassMethod1332() ldstr "G1_C8::ClassMethod1332.4829()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass0,class BaseClass1> callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass1>::Method3<object>() ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass0,class BaseClass1> callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass1>::Method2<object>() ldstr "G1_C8::Method2.4826<System.Object>()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass0,class BaseClass1> callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass1>::Method1() ldstr "G1_C8::Method1.4825()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass0,class BaseClass1> callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass1>::Method0() ldstr "G1_C8::Method0.4823()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass0,class BaseClass1> callvirt instance string class G1_C8`2<class BaseClass0,class BaseClass1>::Method7<object>() ldstr "G1_C8::Method7.4821<System.Object>()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string IBase0::Method0() ldstr "G1_C8::Method0.MI.4824()" ldstr "IBase0 on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method1() ldstr "G1_C8::Method1.4825()" ldstr "IBase0 on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method2<object>() ldstr "G1_C8::Method2.MI.4827<System.Object>()" ldstr "IBase0 on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method3<object>() ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "IBase0 on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop newobj instance void class G1_C8`2<class BaseClass1,class BaseClass0>::.ctor() stloc.0 ldloc.0 dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1335<object>() ldstr "G1_C8::ClassMethod1335.4832<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1334<object>() ldstr "G1_C8::ClassMethod1334.4831<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1333() ldstr "G1_C8::ClassMethod1333.4830()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1332() ldstr "G1_C8::ClassMethod1332.4829()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method3<object>() ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method2<object>() ldstr "G1_C8::Method2.4826<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method1() ldstr "G1_C8::Method1.4825()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method0() ldstr "G1_C8::Method0.4823()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass0> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method7<object>() ldstr "G1_C8::Method7.4821<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>() ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass0> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string IBase0::Method0() ldstr "G1_C8::Method0.MI.4824()" ldstr "IBase0 on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method1() ldstr "G1_C8::Method1.4825()" ldstr "IBase0 on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method2<object>() ldstr "G1_C8::Method2.MI.4827<System.Object>()" ldstr "IBase0 on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method3<object>() ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "IBase0 on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop newobj instance void class G1_C8`2<class BaseClass1,class BaseClass1>::.ctor() stloc.0 ldloc.0 dup castclass class G1_C8`2<class BaseClass1,class BaseClass1> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass1>::ClassMethod1335<object>() ldstr "G1_C8::ClassMethod1335.4832<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass1> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass1>::ClassMethod1334<object>() ldstr "G1_C8::ClassMethod1334.4831<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass1> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass1>::ClassMethod1333() ldstr "G1_C8::ClassMethod1333.4830()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass1> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass1>::ClassMethod1332() ldstr "G1_C8::ClassMethod1332.4829()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass1> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass1>::Method3<object>() ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass1> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass1>::Method2<object>() ldstr "G1_C8::Method2.4826<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass1> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass1>::Method1() ldstr "G1_C8::Method1.4825()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass1> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass1>::Method0() ldstr "G1_C8::Method0.4823()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup castclass class G1_C8`2<class BaseClass1,class BaseClass1> callvirt instance string class G1_C8`2<class BaseClass1,class BaseClass1>::Method7<object>() ldstr "G1_C8::Method7.4821<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string IBase0::Method0() ldstr "G1_C8::Method0.MI.4824()" ldstr "IBase0 on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method1() ldstr "G1_C8::Method1.4825()" ldstr "IBase0 on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method2<object>() ldstr "G1_C8::Method2.MI.4827<System.Object>()" ldstr "IBase0 on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) dup callvirt instance string IBase0::Method3<object>() ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "IBase0 on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldloc.0 dup callvirt instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) pop ldstr "========================================================================\n\n" call void [mscorlib]System.Console::WriteLine(string) ret } .method public hidebysig static void ConstrainedCallsTest() cil managed { .maxstack 10 .locals init (object V_0) ldstr "========================== Constrained Calls Test ==========================" call void [mscorlib]System.Console::WriteLine(string) newobj instance void class G3_C1414`1<class BaseClass0>::.ctor() stloc.0 ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G2_C437::ClassMethod1333.MI.8946()#G1_C8::ClassMethod1334.4831<System.Object>()#G2_C437::ClassMethod1335.MI.8947<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G2_C437::Method7.8939<System.Object>()#" call void Generated942::M.G1_C8.T.T<class BaseClass1,class BaseClass0,class G3_C1414`1<class BaseClass0>>(!!2,string) ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G2_C437::ClassMethod1333.MI.8946()#G1_C8::ClassMethod1334.4831<System.Object>()#G2_C437::ClassMethod1335.MI.8947<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G2_C437::Method7.8939<System.Object>()#" call void Generated942::M.G1_C8.B.T<class BaseClass0,class G3_C1414`1<class BaseClass0>>(!!1,string) ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G2_C437::ClassMethod1333.MI.8946()#G1_C8::ClassMethod1334.4831<System.Object>()#G2_C437::ClassMethod1335.MI.8947<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G2_C437::Method7.8939<System.Object>()#" call void Generated942::M.G1_C8.B.A<class G3_C1414`1<class BaseClass0>>(!!0,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.T.T<class BaseClass1,class BaseClass0,class G3_C1414`1<class BaseClass0>>(!!2,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.B.T<class BaseClass0,class G3_C1414`1<class BaseClass0>>(!!1,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.B.A<class G3_C1414`1<class BaseClass0>>(!!0,string) ldloc.0 ldstr "G1_C8::Method0.MI.4824()#G1_C8::Method1.4825()#G1_C8::Method2.MI.4827<System.Object>()#G1_C8::Method3.4828<System.Object>()#" call void Generated942::M.IBase0<class G3_C1414`1<class BaseClass0>>(!!0,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.T.T<class BaseClass0,class BaseClass0,class G3_C1414`1<class BaseClass0>>(!!2,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.A.T<class BaseClass0,class G3_C1414`1<class BaseClass0>>(!!1,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.A.A<class G3_C1414`1<class BaseClass0>>(!!0,string) ldloc.0 ldstr "G2_C437::Method7.MI.8940<System.Object>()#" call void Generated942::M.IBase2.T.T<class BaseClass0,class BaseClass1,class G3_C1414`1<class BaseClass0>>(!!2,string) ldloc.0 ldstr "G2_C437::Method7.MI.8940<System.Object>()#" call void Generated942::M.IBase2.A.T<class BaseClass1,class G3_C1414`1<class BaseClass0>>(!!1,string) ldloc.0 ldstr "G2_C437::Method7.MI.8940<System.Object>()#" call void Generated942::M.IBase2.A.B<class G3_C1414`1<class BaseClass0>>(!!0,string) ldloc.0 ldstr "G2_C437::Method7.MI.8940<System.Object>()#" call void Generated942::M.IBase2.T.T<class BaseClass1,class BaseClass1,class G3_C1414`1<class BaseClass0>>(!!2,string) ldloc.0 ldstr "G2_C437::Method7.MI.8940<System.Object>()#" call void Generated942::M.IBase2.B.T<class BaseClass1,class G3_C1414`1<class BaseClass0>>(!!1,string) ldloc.0 ldstr "G2_C437::Method7.MI.8940<System.Object>()#" call void Generated942::M.IBase2.B.B<class G3_C1414`1<class BaseClass0>>(!!0,string) ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G2_C437::ClassMethod1333.MI.8946()#G1_C8::ClassMethod1334.4831<System.Object>()#G2_C437::ClassMethod1335.MI.8947<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G2_C437::Method4.8941()#G3_C1414::Method5.16056()#G3_C1414::Method6.16058<System.Object>()#G2_C437::Method7.8939<System.Object>()#" call void Generated942::M.G2_C437.T.T<class BaseClass1,class BaseClass1,class G3_C1414`1<class BaseClass0>>(!!2,string) ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G2_C437::ClassMethod1333.MI.8946()#G1_C8::ClassMethod1334.4831<System.Object>()#G2_C437::ClassMethod1335.MI.8947<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G2_C437::Method4.8941()#G3_C1414::Method5.16056()#G3_C1414::Method6.16058<System.Object>()#G2_C437::Method7.8939<System.Object>()#" call void Generated942::M.G2_C437.B.T<class BaseClass1,class G3_C1414`1<class BaseClass0>>(!!1,string) ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G2_C437::ClassMethod1333.MI.8946()#G1_C8::ClassMethod1334.4831<System.Object>()#G2_C437::ClassMethod1335.MI.8947<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G2_C437::Method4.8941()#G3_C1414::Method5.16056()#G3_C1414::Method6.16058<System.Object>()#G2_C437::Method7.8939<System.Object>()#" call void Generated942::M.G2_C437.B.B<class G3_C1414`1<class BaseClass0>>(!!0,string) ldloc.0 ldstr "G3_C1414::Method4.16055()#G3_C1414::Method5.MI.16057()#G3_C1414::Method6.MI.16059<System.Object>()#" call void Generated942::M.IBase1.T<class BaseClass0,class G3_C1414`1<class BaseClass0>>(!!1,string) ldloc.0 ldstr "G3_C1414::Method4.16055()#G3_C1414::Method5.MI.16057()#G3_C1414::Method6.MI.16059<System.Object>()#" call void Generated942::M.IBase1.A<class G3_C1414`1<class BaseClass0>>(!!0,string) ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G2_C437::ClassMethod1333.MI.8946()#G1_C8::ClassMethod1334.4831<System.Object>()#G2_C437::ClassMethod1335.MI.8947<System.Object>()#G3_C1414::ClassMethod4223.16060()#G3_C1414::ClassMethod4224.16061<System.Object>()#G3_C1414::ClassMethod4225.16062<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G3_C1414::Method4.16055()#G3_C1414::Method5.16056()#G3_C1414::Method6.16058<System.Object>()#G2_C437::Method7.8939<System.Object>()#" call void Generated942::M.G3_C1414.T<class BaseClass0,class G3_C1414`1<class BaseClass0>>(!!1,string) ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G2_C437::ClassMethod1333.MI.8946()#G1_C8::ClassMethod1334.4831<System.Object>()#G2_C437::ClassMethod1335.MI.8947<System.Object>()#G3_C1414::ClassMethod4223.16060()#G3_C1414::ClassMethod4224.16061<System.Object>()#G3_C1414::ClassMethod4225.16062<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G3_C1414::Method4.16055()#G3_C1414::Method5.16056()#G3_C1414::Method6.16058<System.Object>()#G2_C437::Method7.8939<System.Object>()#" call void Generated942::M.G3_C1414.A<class G3_C1414`1<class BaseClass0>>(!!0,string) newobj instance void class G3_C1414`1<class BaseClass1>::.ctor() stloc.0 ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G2_C437::ClassMethod1333.MI.8946()#G1_C8::ClassMethod1334.4831<System.Object>()#G2_C437::ClassMethod1335.MI.8947<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G2_C437::Method7.8939<System.Object>()#" call void Generated942::M.G1_C8.T.T<class BaseClass1,class BaseClass0,class G3_C1414`1<class BaseClass1>>(!!2,string) ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G2_C437::ClassMethod1333.MI.8946()#G1_C8::ClassMethod1334.4831<System.Object>()#G2_C437::ClassMethod1335.MI.8947<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G2_C437::Method7.8939<System.Object>()#" call void Generated942::M.G1_C8.B.T<class BaseClass0,class G3_C1414`1<class BaseClass1>>(!!1,string) ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G2_C437::ClassMethod1333.MI.8946()#G1_C8::ClassMethod1334.4831<System.Object>()#G2_C437::ClassMethod1335.MI.8947<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G2_C437::Method7.8939<System.Object>()#" call void Generated942::M.G1_C8.B.A<class G3_C1414`1<class BaseClass1>>(!!0,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.T.T<class BaseClass1,class BaseClass0,class G3_C1414`1<class BaseClass1>>(!!2,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.B.T<class BaseClass0,class G3_C1414`1<class BaseClass1>>(!!1,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.B.A<class G3_C1414`1<class BaseClass1>>(!!0,string) ldloc.0 ldstr "G1_C8::Method0.MI.4824()#G1_C8::Method1.4825()#G1_C8::Method2.MI.4827<System.Object>()#G1_C8::Method3.4828<System.Object>()#" call void Generated942::M.IBase0<class G3_C1414`1<class BaseClass1>>(!!0,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.T.T<class BaseClass0,class BaseClass0,class G3_C1414`1<class BaseClass1>>(!!2,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.A.T<class BaseClass0,class G3_C1414`1<class BaseClass1>>(!!1,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.A.A<class G3_C1414`1<class BaseClass1>>(!!0,string) ldloc.0 ldstr "G2_C437::Method7.MI.8940<System.Object>()#" call void Generated942::M.IBase2.T.T<class BaseClass0,class BaseClass1,class G3_C1414`1<class BaseClass1>>(!!2,string) ldloc.0 ldstr "G2_C437::Method7.MI.8940<System.Object>()#" call void Generated942::M.IBase2.A.T<class BaseClass1,class G3_C1414`1<class BaseClass1>>(!!1,string) ldloc.0 ldstr "G2_C437::Method7.MI.8940<System.Object>()#" call void Generated942::M.IBase2.A.B<class G3_C1414`1<class BaseClass1>>(!!0,string) ldloc.0 ldstr "G2_C437::Method7.MI.8940<System.Object>()#" call void Generated942::M.IBase2.T.T<class BaseClass1,class BaseClass1,class G3_C1414`1<class BaseClass1>>(!!2,string) ldloc.0 ldstr "G2_C437::Method7.MI.8940<System.Object>()#" call void Generated942::M.IBase2.B.T<class BaseClass1,class G3_C1414`1<class BaseClass1>>(!!1,string) ldloc.0 ldstr "G2_C437::Method7.MI.8940<System.Object>()#" call void Generated942::M.IBase2.B.B<class G3_C1414`1<class BaseClass1>>(!!0,string) ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G2_C437::ClassMethod1333.MI.8946()#G1_C8::ClassMethod1334.4831<System.Object>()#G2_C437::ClassMethod1335.MI.8947<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G2_C437::Method4.8941()#G3_C1414::Method5.16056()#G3_C1414::Method6.16058<System.Object>()#G2_C437::Method7.8939<System.Object>()#" call void Generated942::M.G2_C437.T.T<class BaseClass1,class BaseClass1,class G3_C1414`1<class BaseClass1>>(!!2,string) ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G2_C437::ClassMethod1333.MI.8946()#G1_C8::ClassMethod1334.4831<System.Object>()#G2_C437::ClassMethod1335.MI.8947<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G2_C437::Method4.8941()#G3_C1414::Method5.16056()#G3_C1414::Method6.16058<System.Object>()#G2_C437::Method7.8939<System.Object>()#" call void Generated942::M.G2_C437.B.T<class BaseClass1,class G3_C1414`1<class BaseClass1>>(!!1,string) ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G2_C437::ClassMethod1333.MI.8946()#G1_C8::ClassMethod1334.4831<System.Object>()#G2_C437::ClassMethod1335.MI.8947<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G2_C437::Method4.8941()#G3_C1414::Method5.16056()#G3_C1414::Method6.16058<System.Object>()#G2_C437::Method7.8939<System.Object>()#" call void Generated942::M.G2_C437.B.B<class G3_C1414`1<class BaseClass1>>(!!0,string) ldloc.0 ldstr "G3_C1414::Method4.16055()#G3_C1414::Method5.MI.16057()#G3_C1414::Method6.MI.16059<System.Object>()#" call void Generated942::M.IBase1.T<class BaseClass0,class G3_C1414`1<class BaseClass1>>(!!1,string) ldloc.0 ldstr "G3_C1414::Method4.16055()#G3_C1414::Method5.MI.16057()#G3_C1414::Method6.MI.16059<System.Object>()#" call void Generated942::M.IBase1.A<class G3_C1414`1<class BaseClass1>>(!!0,string) ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G2_C437::ClassMethod1333.MI.8946()#G1_C8::ClassMethod1334.4831<System.Object>()#G2_C437::ClassMethod1335.MI.8947<System.Object>()#G3_C1414::ClassMethod4223.16060()#G3_C1414::ClassMethod4224.16061<System.Object>()#G3_C1414::ClassMethod4225.16062<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G3_C1414::Method4.16055()#G3_C1414::Method5.16056()#G3_C1414::Method6.16058<System.Object>()#G2_C437::Method7.8939<System.Object>()#" call void Generated942::M.G3_C1414.T<class BaseClass1,class G3_C1414`1<class BaseClass1>>(!!1,string) ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G2_C437::ClassMethod1333.MI.8946()#G1_C8::ClassMethod1334.4831<System.Object>()#G2_C437::ClassMethod1335.MI.8947<System.Object>()#G3_C1414::ClassMethod4223.16060()#G3_C1414::ClassMethod4224.16061<System.Object>()#G3_C1414::ClassMethod4225.16062<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G3_C1414::Method4.16055()#G3_C1414::Method5.16056()#G3_C1414::Method6.16058<System.Object>()#G2_C437::Method7.8939<System.Object>()#" call void Generated942::M.G3_C1414.B<class G3_C1414`1<class BaseClass1>>(!!0,string) ldloc.0 ldstr "G3_C1414::Method4.16055()#G3_C1414::Method5.MI.16057()#G3_C1414::Method6.MI.16059<System.Object>()#" call void Generated942::M.IBase1.T<class BaseClass1,class G3_C1414`1<class BaseClass1>>(!!1,string) ldloc.0 ldstr "G3_C1414::Method4.16055()#G3_C1414::Method5.MI.16057()#G3_C1414::Method6.MI.16059<System.Object>()#" call void Generated942::M.IBase1.B<class G3_C1414`1<class BaseClass1>>(!!0,string) newobj instance void class G1_C8`2<class BaseClass0,class BaseClass0>::.ctor() stloc.0 ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G1_C8::ClassMethod1333.4830()#G1_C8::ClassMethod1334.4831<System.Object>()#G1_C8::ClassMethod1335.4832<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G1_C8::Method7.4821<System.Object>()#" call void Generated942::M.G1_C8.T.T<class BaseClass0,class BaseClass0,class G1_C8`2<class BaseClass0,class BaseClass0>>(!!2,string) ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G1_C8::ClassMethod1333.4830()#G1_C8::ClassMethod1334.4831<System.Object>()#G1_C8::ClassMethod1335.4832<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G1_C8::Method7.4821<System.Object>()#" call void Generated942::M.G1_C8.A.T<class BaseClass0,class G1_C8`2<class BaseClass0,class BaseClass0>>(!!1,string) ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G1_C8::ClassMethod1333.4830()#G1_C8::ClassMethod1334.4831<System.Object>()#G1_C8::ClassMethod1335.4832<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G1_C8::Method7.4821<System.Object>()#" call void Generated942::M.G1_C8.A.A<class G1_C8`2<class BaseClass0,class BaseClass0>>(!!0,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.T.T<class BaseClass0,class BaseClass0,class G1_C8`2<class BaseClass0,class BaseClass0>>(!!2,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.A.T<class BaseClass0,class G1_C8`2<class BaseClass0,class BaseClass0>>(!!1,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.A.A<class G1_C8`2<class BaseClass0,class BaseClass0>>(!!0,string) ldloc.0 ldstr "G1_C8::Method0.MI.4824()#G1_C8::Method1.4825()#G1_C8::Method2.MI.4827<System.Object>()#G1_C8::Method3.4828<System.Object>()#" call void Generated942::M.IBase0<class G1_C8`2<class BaseClass0,class BaseClass0>>(!!0,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.T.T<class BaseClass0,class BaseClass1,class G1_C8`2<class BaseClass0,class BaseClass0>>(!!2,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.A.T<class BaseClass1,class G1_C8`2<class BaseClass0,class BaseClass0>>(!!1,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.A.B<class G1_C8`2<class BaseClass0,class BaseClass0>>(!!0,string) newobj instance void class G1_C8`2<class BaseClass0,class BaseClass1>::.ctor() stloc.0 ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G1_C8::ClassMethod1333.4830()#G1_C8::ClassMethod1334.4831<System.Object>()#G1_C8::ClassMethod1335.4832<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G1_C8::Method7.4821<System.Object>()#" call void Generated942::M.G1_C8.T.T<class BaseClass0,class BaseClass1,class G1_C8`2<class BaseClass0,class BaseClass1>>(!!2,string) ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G1_C8::ClassMethod1333.4830()#G1_C8::ClassMethod1334.4831<System.Object>()#G1_C8::ClassMethod1335.4832<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G1_C8::Method7.4821<System.Object>()#" call void Generated942::M.G1_C8.A.T<class BaseClass1,class G1_C8`2<class BaseClass0,class BaseClass1>>(!!1,string) ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G1_C8::ClassMethod1333.4830()#G1_C8::ClassMethod1334.4831<System.Object>()#G1_C8::ClassMethod1335.4832<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G1_C8::Method7.4821<System.Object>()#" call void Generated942::M.G1_C8.A.B<class G1_C8`2<class BaseClass0,class BaseClass1>>(!!0,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.T.T<class BaseClass0,class BaseClass1,class G1_C8`2<class BaseClass0,class BaseClass1>>(!!2,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.A.T<class BaseClass1,class G1_C8`2<class BaseClass0,class BaseClass1>>(!!1,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.A.B<class G1_C8`2<class BaseClass0,class BaseClass1>>(!!0,string) ldloc.0 ldstr "G1_C8::Method0.MI.4824()#G1_C8::Method1.4825()#G1_C8::Method2.MI.4827<System.Object>()#G1_C8::Method3.4828<System.Object>()#" call void Generated942::M.IBase0<class G1_C8`2<class BaseClass0,class BaseClass1>>(!!0,string) newobj instance void class G1_C8`2<class BaseClass1,class BaseClass0>::.ctor() stloc.0 ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G1_C8::ClassMethod1333.4830()#G1_C8::ClassMethod1334.4831<System.Object>()#G1_C8::ClassMethod1335.4832<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G1_C8::Method7.4821<System.Object>()#" call void Generated942::M.G1_C8.T.T<class BaseClass1,class BaseClass0,class G1_C8`2<class BaseClass1,class BaseClass0>>(!!2,string) ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G1_C8::ClassMethod1333.4830()#G1_C8::ClassMethod1334.4831<System.Object>()#G1_C8::ClassMethod1335.4832<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G1_C8::Method7.4821<System.Object>()#" call void Generated942::M.G1_C8.B.T<class BaseClass0,class G1_C8`2<class BaseClass1,class BaseClass0>>(!!1,string) ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G1_C8::ClassMethod1333.4830()#G1_C8::ClassMethod1334.4831<System.Object>()#G1_C8::ClassMethod1335.4832<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G1_C8::Method7.4821<System.Object>()#" call void Generated942::M.G1_C8.B.A<class G1_C8`2<class BaseClass1,class BaseClass0>>(!!0,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.T.T<class BaseClass1,class BaseClass0,class G1_C8`2<class BaseClass1,class BaseClass0>>(!!2,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.B.T<class BaseClass0,class G1_C8`2<class BaseClass1,class BaseClass0>>(!!1,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.B.A<class G1_C8`2<class BaseClass1,class BaseClass0>>(!!0,string) ldloc.0 ldstr "G1_C8::Method0.MI.4824()#G1_C8::Method1.4825()#G1_C8::Method2.MI.4827<System.Object>()#G1_C8::Method3.4828<System.Object>()#" call void Generated942::M.IBase0<class G1_C8`2<class BaseClass1,class BaseClass0>>(!!0,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.T.T<class BaseClass0,class BaseClass0,class G1_C8`2<class BaseClass1,class BaseClass0>>(!!2,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.A.T<class BaseClass0,class G1_C8`2<class BaseClass1,class BaseClass0>>(!!1,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.A.A<class G1_C8`2<class BaseClass1,class BaseClass0>>(!!0,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.T.T<class BaseClass0,class BaseClass1,class G1_C8`2<class BaseClass1,class BaseClass0>>(!!2,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.A.T<class BaseClass1,class G1_C8`2<class BaseClass1,class BaseClass0>>(!!1,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.A.B<class G1_C8`2<class BaseClass1,class BaseClass0>>(!!0,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.T.T<class BaseClass1,class BaseClass1,class G1_C8`2<class BaseClass1,class BaseClass0>>(!!2,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.B.T<class BaseClass1,class G1_C8`2<class BaseClass1,class BaseClass0>>(!!1,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.B.B<class G1_C8`2<class BaseClass1,class BaseClass0>>(!!0,string) newobj instance void class G1_C8`2<class BaseClass1,class BaseClass1>::.ctor() stloc.0 ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G1_C8::ClassMethod1333.4830()#G1_C8::ClassMethod1334.4831<System.Object>()#G1_C8::ClassMethod1335.4832<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G1_C8::Method7.4821<System.Object>()#" call void Generated942::M.G1_C8.T.T<class BaseClass1,class BaseClass1,class G1_C8`2<class BaseClass1,class BaseClass1>>(!!2,string) ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G1_C8::ClassMethod1333.4830()#G1_C8::ClassMethod1334.4831<System.Object>()#G1_C8::ClassMethod1335.4832<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G1_C8::Method7.4821<System.Object>()#" call void Generated942::M.G1_C8.B.T<class BaseClass1,class G1_C8`2<class BaseClass1,class BaseClass1>>(!!1,string) ldloc.0 ldstr "G1_C8::ClassMethod1332.4829()#G1_C8::ClassMethod1333.4830()#G1_C8::ClassMethod1334.4831<System.Object>()#G1_C8::ClassMethod1335.4832<System.Object>()#G1_C8::Method0.4823()#G1_C8::Method1.4825()#G1_C8::Method2.4826<System.Object>()#G1_C8::Method3.4828<System.Object>()#G1_C8::Method7.4821<System.Object>()#" call void Generated942::M.G1_C8.B.B<class G1_C8`2<class BaseClass1,class BaseClass1>>(!!0,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.T.T<class BaseClass1,class BaseClass1,class G1_C8`2<class BaseClass1,class BaseClass1>>(!!2,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.B.T<class BaseClass1,class G1_C8`2<class BaseClass1,class BaseClass1>>(!!1,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.B.B<class G1_C8`2<class BaseClass1,class BaseClass1>>(!!0,string) ldloc.0 ldstr "G1_C8::Method0.MI.4824()#G1_C8::Method1.4825()#G1_C8::Method2.MI.4827<System.Object>()#G1_C8::Method3.4828<System.Object>()#" call void Generated942::M.IBase0<class G1_C8`2<class BaseClass1,class BaseClass1>>(!!0,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.T.T<class BaseClass0,class BaseClass1,class G1_C8`2<class BaseClass1,class BaseClass1>>(!!2,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.A.T<class BaseClass1,class G1_C8`2<class BaseClass1,class BaseClass1>>(!!1,string) ldloc.0 ldstr "G1_C8::Method7.MI.4822<System.Object>()#" call void Generated942::M.IBase2.A.B<class G1_C8`2<class BaseClass1,class BaseClass1>>(!!0,string) ldstr "========================================================================\n\n" call void [mscorlib]System.Console::WriteLine(string) ret } .method public hidebysig static void StructConstrainedInterfaceCallsTest() cil managed { .maxstack 10 ldstr "===================== Struct Constrained Interface Calls Test =====================" call void [mscorlib]System.Console::WriteLine(string) ldstr "========================================================================\n\n" call void [mscorlib]System.Console::WriteLine(string) ret } .method public hidebysig static void CalliTest() cil managed { .maxstack 10 .locals init (object V_0) ldstr "========================== Method Calli Test ==========================" call void [mscorlib]System.Console::WriteLine(string) newobj instance void class G3_C1414`1<class BaseClass0>::.ctor() stloc.0 ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1335<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G2_C437::ClassMethod1335.MI.8947<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1334<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::ClassMethod1334.4831<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1333() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G2_C437::ClassMethod1333.MI.8946()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1332() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::ClassMethod1332.4829()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method3<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method2<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::Method2.4826<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method1() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::Method1.4825()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method0() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::Method0.4823()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method7<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G2_C437::Method7.8939<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method0() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::Method0.MI.4824()" ldstr "IBase0 on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method1() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::Method1.4825()" ldstr "IBase0 on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method2<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::Method2.MI.4827<System.Object>()" ldstr "IBase0 on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method3<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "IBase0 on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G2_C437::Method7.MI.8940<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G2_C437::Method7.MI.8940<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method6<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G3_C1414::Method6.16058<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method5() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G3_C1414::Method5.16056()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method4() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G2_C437::Method4.8941()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method7<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G2_C437::Method7.8939<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::ClassMethod1335<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G2_C437::ClassMethod1335.MI.8947<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::ClassMethod1334<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::ClassMethod1334.4831<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::ClassMethod1333() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G2_C437::ClassMethod1333.MI.8946()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::ClassMethod1332() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::ClassMethod1332.4829()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method3<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method2<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::Method2.4826<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method1() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::Method1.4825()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method0() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::Method0.4823()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase1`1<class BaseClass0>::Method4() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G3_C1414::Method4.16055()" ldstr "class IBase1`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase1`1<class BaseClass0>::Method5() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G3_C1414::Method5.MI.16057()" ldstr "class IBase1`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase1`1<class BaseClass0>::Method6<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G3_C1414::Method6.MI.16059<System.Object>()" ldstr "class IBase1`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass0> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass0>::ClassMethod4225<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G3_C1414::ClassMethod4225.16062<System.Object>()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass0> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass0>::ClassMethod4224<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G3_C1414::ClassMethod4224.16061<System.Object>()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass0> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass0>::ClassMethod4223() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G3_C1414::ClassMethod4223.16060()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass0> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass0>::Method6<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G3_C1414::Method6.16058<System.Object>()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass0> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass0>::Method5() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G3_C1414::Method5.16056()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass0> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass0>::Method4() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G3_C1414::Method4.16055()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass0> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass0>::Method7<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G2_C437::Method7.8939<System.Object>()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass0> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass0>::ClassMethod1335<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G2_C437::ClassMethod1335.MI.8947<System.Object>()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass0> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass0>::ClassMethod1334<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::ClassMethod1334.4831<System.Object>()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass0> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass0>::ClassMethod1333() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G2_C437::ClassMethod1333.MI.8946()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass0> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass0>::ClassMethod1332() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::ClassMethod1332.4829()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass0> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass0>::Method3<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass0> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass0>::Method2<object>() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::Method2.4826<System.Object>()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass0> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass0>::Method1() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::Method1.4825()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass0> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass0>::Method0() calli default string(class G3_C1414`1<class BaseClass0>) ldstr "G1_C8::Method0.4823()" ldstr "class G3_C1414`1<class BaseClass0> on type class G3_C1414`1<class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) newobj instance void class G3_C1414`1<class BaseClass1>::.ctor() stloc.0 ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1335<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G2_C437::ClassMethod1335.MI.8947<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1334<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::ClassMethod1334.4831<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1333() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G2_C437::ClassMethod1333.MI.8946()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1332() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::ClassMethod1332.4829()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method3<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method2<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::Method2.4826<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method1() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::Method1.4825()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method0() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::Method0.4823()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method7<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G2_C437::Method7.8939<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method0() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::Method0.MI.4824()" ldstr "IBase0 on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method1() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::Method1.4825()" ldstr "IBase0 on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method2<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::Method2.MI.4827<System.Object>()" ldstr "IBase0 on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method3<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "IBase0 on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G2_C437::Method7.MI.8940<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G2_C437::Method7.MI.8940<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method6<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G3_C1414::Method6.16058<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method5() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G3_C1414::Method5.16056()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method4() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G2_C437::Method4.8941()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method7<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G2_C437::Method7.8939<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::ClassMethod1335<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G2_C437::ClassMethod1335.MI.8947<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::ClassMethod1334<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::ClassMethod1334.4831<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::ClassMethod1333() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G2_C437::ClassMethod1333.MI.8946()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::ClassMethod1332() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::ClassMethod1332.4829()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method3<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method2<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::Method2.4826<System.Object>()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method1() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::Method1.4825()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G2_C437`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G2_C437`2<class BaseClass1,class BaseClass1>::Method0() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::Method0.4823()" ldstr "class G2_C437`2<class BaseClass1,class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase1`1<class BaseClass0>::Method4() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G3_C1414::Method4.16055()" ldstr "class IBase1`1<class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase1`1<class BaseClass0>::Method5() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G3_C1414::Method5.MI.16057()" ldstr "class IBase1`1<class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase1`1<class BaseClass0>::Method6<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G3_C1414::Method6.MI.16059<System.Object>()" ldstr "class IBase1`1<class BaseClass0> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass1> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass1>::ClassMethod4225<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G3_C1414::ClassMethod4225.16062<System.Object>()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass1> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass1>::ClassMethod4224<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G3_C1414::ClassMethod4224.16061<System.Object>()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass1> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass1>::ClassMethod4223() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G3_C1414::ClassMethod4223.16060()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass1> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass1>::Method6<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G3_C1414::Method6.16058<System.Object>()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass1> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass1>::Method5() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G3_C1414::Method5.16056()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass1> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass1>::Method4() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G3_C1414::Method4.16055()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass1> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass1>::Method7<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G2_C437::Method7.8939<System.Object>()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass1> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass1>::ClassMethod1335<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G2_C437::ClassMethod1335.MI.8947<System.Object>()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass1> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass1>::ClassMethod1334<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::ClassMethod1334.4831<System.Object>()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass1> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass1>::ClassMethod1333() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G2_C437::ClassMethod1333.MI.8946()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass1> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass1>::ClassMethod1332() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::ClassMethod1332.4829()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass1> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass1>::Method3<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass1> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass1>::Method2<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::Method2.4826<System.Object>()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass1> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass1>::Method1() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::Method1.4825()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G3_C1414`1<class BaseClass1> ldloc.0 ldvirtftn instance string class G3_C1414`1<class BaseClass1>::Method0() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G1_C8::Method0.4823()" ldstr "class G3_C1414`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase1`1<class BaseClass1>::Method4() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G3_C1414::Method4.16055()" ldstr "class IBase1`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase1`1<class BaseClass1>::Method5() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G3_C1414::Method5.MI.16057()" ldstr "class IBase1`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase1`1<class BaseClass1>::Method6<object>() calli default string(class G3_C1414`1<class BaseClass1>) ldstr "G3_C1414::Method6.MI.16059<System.Object>()" ldstr "class IBase1`1<class BaseClass1> on type class G3_C1414`1<class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) newobj instance void class G1_C8`2<class BaseClass0,class BaseClass0>::.ctor() stloc.0 ldloc.0 castclass class G1_C8`2<class BaseClass0,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass0,class BaseClass0>::ClassMethod1335<object>() calli default string(class G1_C8`2<class BaseClass0,class BaseClass0>) ldstr "G1_C8::ClassMethod1335.4832<System.Object>()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass0> on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass0,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass0,class BaseClass0>::ClassMethod1334<object>() calli default string(class G1_C8`2<class BaseClass0,class BaseClass0>) ldstr "G1_C8::ClassMethod1334.4831<System.Object>()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass0> on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass0,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass0,class BaseClass0>::ClassMethod1333() calli default string(class G1_C8`2<class BaseClass0,class BaseClass0>) ldstr "G1_C8::ClassMethod1333.4830()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass0> on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass0,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass0,class BaseClass0>::ClassMethod1332() calli default string(class G1_C8`2<class BaseClass0,class BaseClass0>) ldstr "G1_C8::ClassMethod1332.4829()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass0> on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass0,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass0,class BaseClass0>::Method3<object>() calli default string(class G1_C8`2<class BaseClass0,class BaseClass0>) ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass0> on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass0,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass0,class BaseClass0>::Method2<object>() calli default string(class G1_C8`2<class BaseClass0,class BaseClass0>) ldstr "G1_C8::Method2.4826<System.Object>()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass0> on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass0,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass0,class BaseClass0>::Method1() calli default string(class G1_C8`2<class BaseClass0,class BaseClass0>) ldstr "G1_C8::Method1.4825()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass0> on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass0,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass0,class BaseClass0>::Method0() calli default string(class G1_C8`2<class BaseClass0,class BaseClass0>) ldstr "G1_C8::Method0.4823()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass0> on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass0,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass0,class BaseClass0>::Method7<object>() calli default string(class G1_C8`2<class BaseClass0,class BaseClass0>) ldstr "G1_C8::Method7.4821<System.Object>()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass0> on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() calli default string(class G1_C8`2<class BaseClass0,class BaseClass0>) ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method0() calli default string(class G1_C8`2<class BaseClass0,class BaseClass0>) ldstr "G1_C8::Method0.MI.4824()" ldstr "IBase0 on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method1() calli default string(class G1_C8`2<class BaseClass0,class BaseClass0>) ldstr "G1_C8::Method1.4825()" ldstr "IBase0 on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method2<object>() calli default string(class G1_C8`2<class BaseClass0,class BaseClass0>) ldstr "G1_C8::Method2.MI.4827<System.Object>()" ldstr "IBase0 on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method3<object>() calli default string(class G1_C8`2<class BaseClass0,class BaseClass0>) ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "IBase0 on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() calli default string(class G1_C8`2<class BaseClass0,class BaseClass0>) ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass0,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) newobj instance void class G1_C8`2<class BaseClass0,class BaseClass1>::.ctor() stloc.0 ldloc.0 castclass class G1_C8`2<class BaseClass0,class BaseClass1> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass0,class BaseClass1>::ClassMethod1335<object>() calli default string(class G1_C8`2<class BaseClass0,class BaseClass1>) ldstr "G1_C8::ClassMethod1335.4832<System.Object>()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass0,class BaseClass1> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass0,class BaseClass1>::ClassMethod1334<object>() calli default string(class G1_C8`2<class BaseClass0,class BaseClass1>) ldstr "G1_C8::ClassMethod1334.4831<System.Object>()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass0,class BaseClass1> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass0,class BaseClass1>::ClassMethod1333() calli default string(class G1_C8`2<class BaseClass0,class BaseClass1>) ldstr "G1_C8::ClassMethod1333.4830()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass0,class BaseClass1> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass0,class BaseClass1>::ClassMethod1332() calli default string(class G1_C8`2<class BaseClass0,class BaseClass1>) ldstr "G1_C8::ClassMethod1332.4829()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass0,class BaseClass1> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass0,class BaseClass1>::Method3<object>() calli default string(class G1_C8`2<class BaseClass0,class BaseClass1>) ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass0,class BaseClass1> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass0,class BaseClass1>::Method2<object>() calli default string(class G1_C8`2<class BaseClass0,class BaseClass1>) ldstr "G1_C8::Method2.4826<System.Object>()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass0,class BaseClass1> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass0,class BaseClass1>::Method1() calli default string(class G1_C8`2<class BaseClass0,class BaseClass1>) ldstr "G1_C8::Method1.4825()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass0,class BaseClass1> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass0,class BaseClass1>::Method0() calli default string(class G1_C8`2<class BaseClass0,class BaseClass1>) ldstr "G1_C8::Method0.4823()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass0,class BaseClass1> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass0,class BaseClass1>::Method7<object>() calli default string(class G1_C8`2<class BaseClass0,class BaseClass1>) ldstr "G1_C8::Method7.4821<System.Object>()" ldstr "class G1_C8`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() calli default string(class G1_C8`2<class BaseClass0,class BaseClass1>) ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method0() calli default string(class G1_C8`2<class BaseClass0,class BaseClass1>) ldstr "G1_C8::Method0.MI.4824()" ldstr "IBase0 on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method1() calli default string(class G1_C8`2<class BaseClass0,class BaseClass1>) ldstr "G1_C8::Method1.4825()" ldstr "IBase0 on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method2<object>() calli default string(class G1_C8`2<class BaseClass0,class BaseClass1>) ldstr "G1_C8::Method2.MI.4827<System.Object>()" ldstr "IBase0 on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method3<object>() calli default string(class G1_C8`2<class BaseClass0,class BaseClass1>) ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "IBase0 on type class G1_C8`2<class BaseClass0,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) newobj instance void class G1_C8`2<class BaseClass1,class BaseClass0>::.ctor() stloc.0 ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1335<object>() calli default string(class G1_C8`2<class BaseClass1,class BaseClass0>) ldstr "G1_C8::ClassMethod1335.4832<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1334<object>() calli default string(class G1_C8`2<class BaseClass1,class BaseClass0>) ldstr "G1_C8::ClassMethod1334.4831<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1333() calli default string(class G1_C8`2<class BaseClass1,class BaseClass0>) ldstr "G1_C8::ClassMethod1333.4830()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::ClassMethod1332() calli default string(class G1_C8`2<class BaseClass1,class BaseClass0>) ldstr "G1_C8::ClassMethod1332.4829()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method3<object>() calli default string(class G1_C8`2<class BaseClass1,class BaseClass0>) ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method2<object>() calli default string(class G1_C8`2<class BaseClass1,class BaseClass0>) ldstr "G1_C8::Method2.4826<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method1() calli default string(class G1_C8`2<class BaseClass1,class BaseClass0>) ldstr "G1_C8::Method1.4825()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method0() calli default string(class G1_C8`2<class BaseClass1,class BaseClass0>) ldstr "G1_C8::Method0.4823()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass0> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass0>::Method7<object>() calli default string(class G1_C8`2<class BaseClass1,class BaseClass0>) ldstr "G1_C8::Method7.4821<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass0> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass0>::Method7<object>() calli default string(class G1_C8`2<class BaseClass1,class BaseClass0>) ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass0> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method0() calli default string(class G1_C8`2<class BaseClass1,class BaseClass0>) ldstr "G1_C8::Method0.MI.4824()" ldstr "IBase0 on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method1() calli default string(class G1_C8`2<class BaseClass1,class BaseClass0>) ldstr "G1_C8::Method1.4825()" ldstr "IBase0 on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method2<object>() calli default string(class G1_C8`2<class BaseClass1,class BaseClass0>) ldstr "G1_C8::Method2.MI.4827<System.Object>()" ldstr "IBase0 on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method3<object>() calli default string(class G1_C8`2<class BaseClass1,class BaseClass0>) ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "IBase0 on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass0>::Method7<object>() calli default string(class G1_C8`2<class BaseClass1,class BaseClass0>) ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass0> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() calli default string(class G1_C8`2<class BaseClass1,class BaseClass0>) ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() calli default string(class G1_C8`2<class BaseClass1,class BaseClass0>) ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass0>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) newobj instance void class G1_C8`2<class BaseClass1,class BaseClass1>::.ctor() stloc.0 ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass1>::ClassMethod1335<object>() calli default string(class G1_C8`2<class BaseClass1,class BaseClass1>) ldstr "G1_C8::ClassMethod1335.4832<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass1>::ClassMethod1334<object>() calli default string(class G1_C8`2<class BaseClass1,class BaseClass1>) ldstr "G1_C8::ClassMethod1334.4831<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass1>::ClassMethod1333() calli default string(class G1_C8`2<class BaseClass1,class BaseClass1>) ldstr "G1_C8::ClassMethod1333.4830()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass1>::ClassMethod1332() calli default string(class G1_C8`2<class BaseClass1,class BaseClass1>) ldstr "G1_C8::ClassMethod1332.4829()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass1>::Method3<object>() calli default string(class G1_C8`2<class BaseClass1,class BaseClass1>) ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass1>::Method2<object>() calli default string(class G1_C8`2<class BaseClass1,class BaseClass1>) ldstr "G1_C8::Method2.4826<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass1>::Method1() calli default string(class G1_C8`2<class BaseClass1,class BaseClass1>) ldstr "G1_C8::Method1.4825()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass1>::Method0() calli default string(class G1_C8`2<class BaseClass1,class BaseClass1>) ldstr "G1_C8::Method0.4823()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 castclass class G1_C8`2<class BaseClass1,class BaseClass1> ldloc.0 ldvirtftn instance string class G1_C8`2<class BaseClass1,class BaseClass1>::Method7<object>() calli default string(class G1_C8`2<class BaseClass1,class BaseClass1>) ldstr "G1_C8::Method7.4821<System.Object>()" ldstr "class G1_C8`2<class BaseClass1,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase2`2<class BaseClass1,class BaseClass1>::Method7<object>() calli default string(class G1_C8`2<class BaseClass1,class BaseClass1>) ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass1,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method0() calli default string(class G1_C8`2<class BaseClass1,class BaseClass1>) ldstr "G1_C8::Method0.MI.4824()" ldstr "IBase0 on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method1() calli default string(class G1_C8`2<class BaseClass1,class BaseClass1>) ldstr "G1_C8::Method1.4825()" ldstr "IBase0 on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method2<object>() calli default string(class G1_C8`2<class BaseClass1,class BaseClass1>) ldstr "G1_C8::Method2.MI.4827<System.Object>()" ldstr "IBase0 on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string IBase0::Method3<object>() calli default string(class G1_C8`2<class BaseClass1,class BaseClass1>) ldstr "G1_C8::Method3.4828<System.Object>()" ldstr "IBase0 on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldloc.0 ldloc.0 ldvirtftn instance string class IBase2`2<class BaseClass0,class BaseClass1>::Method7<object>() calli default string(class G1_C8`2<class BaseClass1,class BaseClass1>) ldstr "G1_C8::Method7.MI.4822<System.Object>()" ldstr "class IBase2`2<class BaseClass0,class BaseClass1> on type class G1_C8`2<class BaseClass1,class BaseClass1>" call void [TestFramework]TestFramework::MethodCallTest(string,string,string) ldstr "========================================================================\n\n" call void [mscorlib]System.Console::WriteLine(string) ret } .method public hidebysig static int32 Main() cil managed { .custom instance void [xunit.core]Xunit.FactAttribute::.ctor() = ( 01 00 00 00 ) .entrypoint .maxstack 10 call void Generated942::MethodCallingTest() call void Generated942::ConstrainedCallsTest() call void Generated942::StructConstrainedInterfaceCallsTest() call void Generated942::CalliTest() ldc.i4 100 ret } }
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/tasks/AndroidAppBuilder/Templates/MainActivity.java
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. package net.dot; import android.app.Activity; import android.os.Bundle; import android.os.Handler; import android.os.Looper; import android.widget.RelativeLayout; import android.widget.TextView; import android.graphics.Color; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final String entryPointLibName = "%EntryPointLibName%"; final TextView textView = new TextView(this); textView.setTextSize(20); RelativeLayout rootLayout = new RelativeLayout(this); RelativeLayout.LayoutParams tvLayout = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); tvLayout.addRule(RelativeLayout.CENTER_HORIZONTAL); tvLayout.addRule(RelativeLayout.CENTER_VERTICAL); rootLayout.addView(textView, tvLayout); setContentView(rootLayout); if (entryPointLibName == "" || entryPointLibName.startsWith("%")) { textView.setText("ERROR: EntryPointLibName was not set."); return; } else { textView.setText("Running " + entryPointLibName + "..."); } final Activity ctx = this; new Handler(Looper.getMainLooper()).postDelayed(new Runnable() { @Override public void run() { int retcode = MonoRunner.initialize(entryPointLibName, new String[0], ctx); textView.setText("Mono Runtime returned: " + retcode); } }, 1000); } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. package net.dot; import android.app.Activity; import android.os.Bundle; import android.os.Handler; import android.os.Looper; import android.widget.RelativeLayout; import android.widget.TextView; import android.graphics.Color; public class MainActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); final String entryPointLibName = "%EntryPointLibName%"; final TextView textView = new TextView(this); textView.setTextSize(20); RelativeLayout rootLayout = new RelativeLayout(this); RelativeLayout.LayoutParams tvLayout = new RelativeLayout.LayoutParams( RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT); tvLayout.addRule(RelativeLayout.CENTER_HORIZONTAL); tvLayout.addRule(RelativeLayout.CENTER_VERTICAL); rootLayout.addView(textView, tvLayout); setContentView(rootLayout); if (entryPointLibName == "" || entryPointLibName.startsWith("%")) { textView.setText("ERROR: EntryPointLibName was not set."); return; } else { textView.setText("Running " + entryPointLibName + "..."); } final Activity ctx = this; new Handler(Looper.getMainLooper()).postDelayed(new Runnable() { @Override public void run() { int retcode = MonoRunner.initialize(entryPointLibName, new String[0], ctx); textView.setText("Mono Runtime returned: " + retcode); } }, 1000); } }
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/tests/Interop/COM/NativeClients/DefaultInterfaces.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> </PropertyGroup> <ItemGroup> <ProjectReference Include="DefaultInterfaces/CMakeLists.txt" /> <ProjectReference Include="../NETServer/NETServer.DefaultInterfaces.ilproj" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> </PropertyGroup> <ItemGroup> <ProjectReference Include="DefaultInterfaces/CMakeLists.txt" /> <ProjectReference Include="../NETServer/NETServer.DefaultInterfaces.ilproj" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/libraries/System.Web.HttpUtility/ref/System.Web.HttpUtility.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <Nullable>enable</Nullable> <TargetFramework>$(NetCoreAppCurrent)</TargetFramework> </PropertyGroup> <ItemGroup> <Compile Include="System.Web.HttpUtility.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\..\System.Collections.Specialized\ref\System.Collections.Specialized.csproj" /> <ProjectReference Include="..\..\System.Runtime\ref\System.Runtime.csproj" /> <ProjectReference Include="..\..\System.Runtime.Extensions\ref\System.Runtime.Extensions.csproj" /> <ProjectReference Include="..\..\System.Text.Encoding\ref\System.Text.Encoding.csproj" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <Nullable>enable</Nullable> <TargetFramework>$(NetCoreAppCurrent)</TargetFramework> </PropertyGroup> <ItemGroup> <Compile Include="System.Web.HttpUtility.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\..\System.Collections.Specialized\ref\System.Collections.Specialized.csproj" /> <ProjectReference Include="..\..\System.Runtime\ref\System.Runtime.csproj" /> <ProjectReference Include="..\..\System.Runtime.Extensions\ref\System.Runtime.Extensions.csproj" /> <ProjectReference Include="..\..\System.Text.Encoding\ref\System.Text.Encoding.csproj" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/tests/JIT/SIMD/AbsGeneric.cs
// 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.Collections.Generic; using System.Numerics; namespace VectorMathTests { class Program { const float EPS = Single.Epsilon * 5; static short[] GenerateArray(int size, short value) { short[] arr = new short[size]; for (int i = 0; i < size; ++i) { arr[i] = value; } return arr; } static int Main(string[] args) { short[] arr = GenerateArray(60, 5); var a = new System.Numerics.Vector<short>(arr); a = System.Numerics.Vector.Abs(a); if (a[0] != 5) { return 0; } var b = System.Numerics.Vector<int>.One; b = System.Numerics.Vector.Abs(b); if (b[3] != 1) { return 0; } var c = new System.Numerics.Vector<long>(-11); c = System.Numerics.Vector.Abs(c); if (c[1] != 11) { return 0; } var d = new System.Numerics.Vector<double>(-100.0); d = System.Numerics.Vector.Abs(d); if (d[0] != 100) { return 0; } var e = new System.Numerics.Vector<float>(-22); e = System.Numerics.Vector.Abs(e); if (e[3] != 22) { return 0; } var f = new System.Numerics.Vector<ushort>(21); f = System.Numerics.Vector.Abs(f); if (f[7] != 21) { return 0; } var g = new System.Numerics.Vector<ulong>(21); g = System.Numerics.Vector.Abs(g); if (g[1] != 21) { return 0; } return 100; } } }
// 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.Collections.Generic; using System.Numerics; namespace VectorMathTests { class Program { const float EPS = Single.Epsilon * 5; static short[] GenerateArray(int size, short value) { short[] arr = new short[size]; for (int i = 0; i < size; ++i) { arr[i] = value; } return arr; } static int Main(string[] args) { short[] arr = GenerateArray(60, 5); var a = new System.Numerics.Vector<short>(arr); a = System.Numerics.Vector.Abs(a); if (a[0] != 5) { return 0; } var b = System.Numerics.Vector<int>.One; b = System.Numerics.Vector.Abs(b); if (b[3] != 1) { return 0; } var c = new System.Numerics.Vector<long>(-11); c = System.Numerics.Vector.Abs(c); if (c[1] != 11) { return 0; } var d = new System.Numerics.Vector<double>(-100.0); d = System.Numerics.Vector.Abs(d); if (d[0] != 100) { return 0; } var e = new System.Numerics.Vector<float>(-22); e = System.Numerics.Vector.Abs(e); if (e[3] != 22) { return 0; } var f = new System.Numerics.Vector<ushort>(21); f = System.Numerics.Vector.Abs(f); if (f[7] != 21) { return 0; } var g = new System.Numerics.Vector<ulong>(21); g = System.Numerics.Vector.Abs(g); if (g[1] != 21) { return 0; } return 100; } } }
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./docs/design/features/code-versioning-profiler-breaking-changes.md
# Code Versioning Profiler Breaking Changes # The runtime changes done as part of the code versioning feature will cause some (hopefully minor) breaking changes to be visible via the profiler API. My goal is to advertise these coming changes and solicit feedback about what will be easiest for profiler writers to absorb. Currently this feature is only under development in the .NET Core version of the runtime. If you solely support a profiler on full .NET Framework this change doesn't affect you. ## Underlying issue ## Code versioning, and in particular its use for tiered compilation means that the runtime will be invoking the JIT more than it did in the past. Historically there was a 1:1 relationship between a FunctionID and a single JITCompilationFinished event. For those profilers using ReJIT APIs the 1:1 relationship was between a (FunctionID,ReJITID) pair and a single [Re]JITCompilationFinished event. [Re]JitCompilationStarted events were usually 1:1 as well, but not guaranteed in all cases. Tiered compilation will break these invariants by invoking the JIT potentially multiple times per method. ## Likely ways you will see behavior change ## 1. There will be more JITCompilation events, and potentially more ReJIT compilation events than there were before. 2. These JIT events may originate from a background worker thread that may be different from the thread which ultimately runs the jitted code. 3. Calls to ICorProfilerInfo4::GetCodeInfo3 will only return information about the first jitted code body for a given FunctionID,rejitID pair. We'll need to create a new API to handle code bodies after the first. 4. Calls to ICorProfilerInfo4::GetILToNativeMapping2 will only return information about the first jitted code body for a given FunctionID,rejitID pair. We'll need to create a new API to handle code bodies after the first. 5. IL supplied during the JITCompilationStarted callback is now verified the same as if you had provided it during ModuleLoadFinished. ## Obscure ways you might see behavior change ## 1. If tiered compilation fails to publish an updated code body on a method that has already been instrumented with RequestReJIT and jitted, the profiler could receive a rejit error callback reporting the problem. This should only occur on OOM or process memory corruption. 2. The timing of ReJITCompilationFinished has been adjusted to be slightly earlier (after the new code body is generated, but prior to updating the previous jitted code to modify control flow). This raises a slim possibility for a ReJIT error to be reported after ReJITCompilationFinished in the case of OOM or process memory corruption. There are likely some other variations of the changed behavior I haven't thought of yet, but if further testing, code review, or discussion brings it to the surface I'll add it here. Feel free to get in touch on github (@noahfalk), or if you have anything you want to discuss in private you can email me at noahfalk AT microsoft.com
# Code Versioning Profiler Breaking Changes # The runtime changes done as part of the code versioning feature will cause some (hopefully minor) breaking changes to be visible via the profiler API. My goal is to advertise these coming changes and solicit feedback about what will be easiest for profiler writers to absorb. Currently this feature is only under development in the .NET Core version of the runtime. If you solely support a profiler on full .NET Framework this change doesn't affect you. ## Underlying issue ## Code versioning, and in particular its use for tiered compilation means that the runtime will be invoking the JIT more than it did in the past. Historically there was a 1:1 relationship between a FunctionID and a single JITCompilationFinished event. For those profilers using ReJIT APIs the 1:1 relationship was between a (FunctionID,ReJITID) pair and a single [Re]JITCompilationFinished event. [Re]JitCompilationStarted events were usually 1:1 as well, but not guaranteed in all cases. Tiered compilation will break these invariants by invoking the JIT potentially multiple times per method. ## Likely ways you will see behavior change ## 1. There will be more JITCompilation events, and potentially more ReJIT compilation events than there were before. 2. These JIT events may originate from a background worker thread that may be different from the thread which ultimately runs the jitted code. 3. Calls to ICorProfilerInfo4::GetCodeInfo3 will only return information about the first jitted code body for a given FunctionID,rejitID pair. We'll need to create a new API to handle code bodies after the first. 4. Calls to ICorProfilerInfo4::GetILToNativeMapping2 will only return information about the first jitted code body for a given FunctionID,rejitID pair. We'll need to create a new API to handle code bodies after the first. 5. IL supplied during the JITCompilationStarted callback is now verified the same as if you had provided it during ModuleLoadFinished. ## Obscure ways you might see behavior change ## 1. If tiered compilation fails to publish an updated code body on a method that has already been instrumented with RequestReJIT and jitted, the profiler could receive a rejit error callback reporting the problem. This should only occur on OOM or process memory corruption. 2. The timing of ReJITCompilationFinished has been adjusted to be slightly earlier (after the new code body is generated, but prior to updating the previous jitted code to modify control flow). This raises a slim possibility for a ReJIT error to be reported after ReJITCompilationFinished in the case of OOM or process memory corruption. There are likely some other variations of the changed behavior I haven't thought of yet, but if further testing, code review, or discussion brings it to the surface I'll add it here. Feel free to get in touch on github (@noahfalk), or if you have anything you want to discuss in private you can email me at noahfalk AT microsoft.com
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/tests/JIT/Regression/CLR-x86-JIT/V1-M09/b14057/b14057.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // using System; public class test { static byte by = 13; public static int Main(string[] args) { byte by1 = (byte)(by >> 1); byte by2 = (byte)(by >> 1); Console.WriteLine(by1); Console.WriteLine(by2); return 100; } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // using System; public class test { static byte by = 13; public static int Main(string[] args) { byte by1 = (byte)(by >> 1); byte by2 = (byte)(by >> 1); Console.WriteLine(by1); Console.WriteLine(by2); return 100; } }
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/tests/JIT/jit64/hfa/main/testC/hfa_testC.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; namespace HFATest { public class TestCase { #pragma warning disable 0414 const sbyte CONST_INT8 = (sbyte)77; const short CONST_INT16 = (short)77; const int CONST_INT32 = (int)77; const long CONST_INT64 = (long)77; const float CONST_FLOAT32 = (float)77.0; const double CONST_FLOAT64 = (double)77.0; #pragma warning restore 0414 static int Main() { HFA01 hfa01; HFA02 hfa02; HFA03 hfa03; HFA05 hfa05; HFA08 hfa08; HFA11 hfa11; HFA19 hfa19; TestMan.Init_HFA01(out hfa01); TestMan.Init_HFA02(out hfa02); TestMan.Init_HFA03(out hfa03); TestMan.Init_HFA05(out hfa05); TestMan.Init_HFA08(out hfa08); TestMan.Init_HFA11(out hfa11); TestMan.Init_HFA19(out hfa19); int nFailures = 0; nFailures += Common.CheckResult("Average HFA 01", TestMan.Average_HFA01(hfa01), TestMan.EXPECTED_SUM_HFA01 / 1) ? 0 : 1; nFailures += Common.CheckResult("Average HFA 02", TestMan.Average_HFA02(hfa02), TestMan.EXPECTED_SUM_HFA02 / 2) ? 0 : 1; nFailures += Common.CheckResult("Average HFA 03", TestMan.Average_HFA03(hfa03), TestMan.EXPECTED_SUM_HFA03 / 3) ? 0 : 1; nFailures += Common.CheckResult("Average HFA 05", TestMan.Average_HFA05(hfa05), TestMan.EXPECTED_SUM_HFA05 / 5) ? 0 : 1; nFailures += Common.CheckResult("Average HFA 08", TestMan.Average_HFA08(hfa08), TestMan.EXPECTED_SUM_HFA08 / 8) ? 0 : 1; nFailures += Common.CheckResult("Average HFA 11", TestMan.Average_HFA11(hfa11), TestMan.EXPECTED_SUM_HFA11 / 11) ? 0 : 1; nFailures += Common.CheckResult("Average HFA 19", TestMan.Average_HFA19(hfa19), TestMan.EXPECTED_SUM_HFA19 / 19) ? 0 : 1; nFailures += Common.CheckResult("Average3 HFA 01", TestMan.Average3_HFA01(hfa01, hfa01, hfa01), TestMan.EXPECTED_SUM_HFA01 / 1) ? 0 : 1; nFailures += Common.CheckResult("Average3 HFA 02", TestMan.Average3_HFA02(hfa02, hfa02, hfa02), TestMan.EXPECTED_SUM_HFA02 / 2) ? 0 : 1; nFailures += Common.CheckResult("Average3 HFA 03", TestMan.Average3_HFA03(hfa03, hfa03, hfa03), TestMan.EXPECTED_SUM_HFA03 / 3) ? 0 : 1; nFailures += Common.CheckResult("Average3 HFA 05", TestMan.Average3_HFA05(hfa05, hfa05, hfa05), TestMan.EXPECTED_SUM_HFA05 / 5) ? 0 : 1; nFailures += Common.CheckResult("Average3 HFA 08", TestMan.Average3_HFA08(hfa08, hfa08, hfa08), TestMan.EXPECTED_SUM_HFA08 / 8) ? 0 : 1; nFailures += Common.CheckResult("Average3 HFA 11", TestMan.Average3_HFA11(hfa11, hfa11, hfa11), TestMan.EXPECTED_SUM_HFA11 / 11) ? 0 : 1; nFailures += Common.CheckResult("Average3 HFA 19", TestMan.Average3_HFA19(hfa19, hfa19, hfa19), TestMan.EXPECTED_SUM_HFA19 / 19) ? 0 : 1; nFailures += Common.CheckResult("Average5 HFA 01", TestMan.Average5_HFA01(hfa01, hfa01, hfa01, hfa01, hfa01), TestMan.EXPECTED_SUM_HFA01 / 1) ? 0 : 1; nFailures += Common.CheckResult("Average5 HFA 02", TestMan.Average5_HFA02(hfa02, hfa02, hfa02, hfa02, hfa02), TestMan.EXPECTED_SUM_HFA02 / 2) ? 0 : 1; nFailures += Common.CheckResult("Average5 HFA 03", TestMan.Average5_HFA03(hfa03, hfa03, hfa03, hfa03, hfa03), TestMan.EXPECTED_SUM_HFA03 / 3) ? 0 : 1; nFailures += Common.CheckResult("Average5 HFA 05", TestMan.Average5_HFA05(hfa05, hfa05, hfa05, hfa05, hfa05), TestMan.EXPECTED_SUM_HFA05 / 5) ? 0 : 1; nFailures += Common.CheckResult("Average5 HFA 08", TestMan.Average5_HFA08(hfa08, hfa08, hfa08, hfa08, hfa08), TestMan.EXPECTED_SUM_HFA08 / 8) ? 0 : 1; nFailures += Common.CheckResult("Average5 HFA 11", TestMan.Average5_HFA11(hfa11, hfa11, hfa11, hfa11, hfa11), TestMan.EXPECTED_SUM_HFA11 / 11) ? 0 : 1; nFailures += Common.CheckResult("Average5 HFA 19", TestMan.Average5_HFA19(hfa19, hfa19, hfa19, hfa19, hfa19), TestMan.EXPECTED_SUM_HFA19 / 19) ? 0 : 1; nFailures += Common.CheckResult("Average8 HFA 01", TestMan.Average8_HFA01(hfa01, hfa01, hfa01, hfa01, hfa01, hfa01, hfa01, hfa01), TestMan.EXPECTED_SUM_HFA01 / 1) ? 0 : 1; nFailures += Common.CheckResult("Average8 HFA 02", TestMan.Average8_HFA02(hfa02, hfa02, hfa02, hfa02, hfa02, hfa02, hfa02, hfa02), TestMan.EXPECTED_SUM_HFA02 / 2) ? 0 : 1; nFailures += Common.CheckResult("Average8 HFA 03", TestMan.Average8_HFA03(hfa03, hfa03, hfa03, hfa03, hfa03, hfa03, hfa03, hfa03), TestMan.EXPECTED_SUM_HFA03 / 3) ? 0 : 1; nFailures += Common.CheckResult("Average8 HFA 05", TestMan.Average8_HFA05(hfa05, hfa05, hfa05, hfa05, hfa05, hfa05, hfa05, hfa05), TestMan.EXPECTED_SUM_HFA05 / 5) ? 0 : 1; nFailures += Common.CheckResult("Average8 HFA 08", TestMan.Average8_HFA08(hfa08, hfa08, hfa08, hfa08, hfa08, hfa08, hfa08, hfa08), TestMan.EXPECTED_SUM_HFA08 / 8) ? 0 : 1; nFailures += Common.CheckResult("Average8 HFA 11", TestMan.Average8_HFA11(hfa11, hfa11, hfa11, hfa11, hfa11, hfa11, hfa11, hfa11), TestMan.EXPECTED_SUM_HFA11 / 11) ? 0 : 1; nFailures += Common.CheckResult("Average8 HFA 19", TestMan.Average8_HFA19(hfa19, hfa19, hfa19, hfa19, hfa19, hfa19, hfa19, hfa19), TestMan.EXPECTED_SUM_HFA19 / 19) ? 0 : 1; nFailures += Common.CheckResult("Average11 HFA 01", TestMan.Average11_HFA01(hfa01, hfa01, hfa01, hfa01, hfa01, hfa01, hfa01, hfa01, hfa01, hfa01, hfa01), TestMan.EXPECTED_SUM_HFA01 / 1) ? 0 : 1; nFailures += Common.CheckResult("Average11 HFA 02", TestMan.Average11_HFA02(hfa02, hfa02, hfa02, hfa02, hfa02, hfa02, hfa02, hfa02, hfa02, hfa02, hfa02), TestMan.EXPECTED_SUM_HFA02 / 2) ? 0 : 1; nFailures += Common.CheckResult("Average11 HFA 03", TestMan.Average11_HFA03(hfa03, hfa03, hfa03, hfa03, hfa03, hfa03, hfa03, hfa03, hfa03, hfa03, hfa03), TestMan.EXPECTED_SUM_HFA03 / 3) ? 0 : 1; nFailures += Common.CheckResult("Average11 HFA 05", TestMan.Average11_HFA05(hfa05, hfa05, hfa05, hfa05, hfa05, hfa05, hfa05, hfa05, hfa05, hfa05, hfa05), TestMan.EXPECTED_SUM_HFA05 / 5) ? 0 : 1; nFailures += Common.CheckResult("Average11 HFA 08", TestMan.Average11_HFA08(hfa08, hfa08, hfa08, hfa08, hfa08, hfa08, hfa08, hfa08, hfa08, hfa08, hfa08), TestMan.EXPECTED_SUM_HFA08 / 8) ? 0 : 1; nFailures += Common.CheckResult("Average11 HFA 11", TestMan.Average11_HFA11(hfa11, hfa11, hfa11, hfa11, hfa11, hfa11, hfa11, hfa11, hfa11, hfa11, hfa11), TestMan.EXPECTED_SUM_HFA11 / 11) ? 0 : 1; nFailures += Common.CheckResult("Average11 HFA 19", TestMan.Average11_HFA19(hfa19, hfa19, hfa19, hfa19, hfa19, hfa19, hfa19, hfa19, hfa19, hfa19, hfa19), TestMan.EXPECTED_SUM_HFA19 / 19) ? 0 : 1; nFailures += Common.CheckResult("Average19 HFA 01", TestMan.Average19_HFA01(hfa01, hfa01, hfa01, hfa01, hfa01, hfa01, hfa01, hfa01, hfa01, hfa01, hfa01, hfa01, hfa01, hfa01, hfa01, hfa01, hfa01, hfa01, hfa01), TestMan.EXPECTED_SUM_HFA01 / 1) ? 0 : 1; nFailures += Common.CheckResult("Average19 HFA 02", TestMan.Average19_HFA02(hfa02, hfa02, hfa02, hfa02, hfa02, hfa02, hfa02, hfa02, hfa02, hfa02, hfa02, hfa02, hfa02, hfa02, hfa02, hfa02, hfa02, hfa02, hfa02), TestMan.EXPECTED_SUM_HFA02 / 2) ? 0 : 1; nFailures += Common.CheckResult("Average19 HFA 03", TestMan.Average19_HFA03(hfa03, hfa03, hfa03, hfa03, hfa03, hfa03, hfa03, hfa03, hfa03, hfa03, hfa03, hfa03, hfa03, hfa03, hfa03, hfa03, hfa03, hfa03, hfa03), TestMan.EXPECTED_SUM_HFA03 / 3) ? 0 : 1; nFailures += Common.CheckResult("Average19 HFA 05", TestMan.Average19_HFA05(hfa05, hfa05, hfa05, hfa05, hfa05, hfa05, hfa05, hfa05, hfa05, hfa05, hfa05, hfa05, hfa05, hfa05, hfa05, hfa05, hfa05, hfa05, hfa05), TestMan.EXPECTED_SUM_HFA05 / 5) ? 0 : 1; nFailures += Common.CheckResult("Average19 HFA 08", TestMan.Average19_HFA08(hfa08, hfa08, hfa08, hfa08, hfa08, hfa08, hfa08, hfa08, hfa08, hfa08, hfa08, hfa08, hfa08, hfa08, hfa08, hfa08, hfa08, hfa08, hfa08), TestMan.EXPECTED_SUM_HFA08 / 8) ? 0 : 1; nFailures += Common.CheckResult("Average19 HFA 11", TestMan.Average19_HFA11(hfa11, hfa11, hfa11, hfa11, hfa11, hfa11, hfa11, hfa11, hfa11, hfa11, hfa11, hfa11, hfa11, hfa11, hfa11, hfa11, hfa11, hfa11, hfa11), TestMan.EXPECTED_SUM_HFA11 / 11) ? 0 : 1; nFailures += Common.CheckResult("Average19 HFA 19", TestMan.Average19_HFA19(hfa19, hfa19, hfa19, hfa19, hfa19, hfa19, hfa19, hfa19, hfa19, hfa19, hfa19, hfa19, hfa19, hfa19, hfa19, hfa19, hfa19, hfa19, hfa19), TestMan.EXPECTED_SUM_HFA19 / 19) ? 0 : 1; return nFailures == 0 ? Common.SUCC_RET_CODE : Common.FAIL_RET_CODE; } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System; namespace HFATest { public class TestCase { #pragma warning disable 0414 const sbyte CONST_INT8 = (sbyte)77; const short CONST_INT16 = (short)77; const int CONST_INT32 = (int)77; const long CONST_INT64 = (long)77; const float CONST_FLOAT32 = (float)77.0; const double CONST_FLOAT64 = (double)77.0; #pragma warning restore 0414 static int Main() { HFA01 hfa01; HFA02 hfa02; HFA03 hfa03; HFA05 hfa05; HFA08 hfa08; HFA11 hfa11; HFA19 hfa19; TestMan.Init_HFA01(out hfa01); TestMan.Init_HFA02(out hfa02); TestMan.Init_HFA03(out hfa03); TestMan.Init_HFA05(out hfa05); TestMan.Init_HFA08(out hfa08); TestMan.Init_HFA11(out hfa11); TestMan.Init_HFA19(out hfa19); int nFailures = 0; nFailures += Common.CheckResult("Average HFA 01", TestMan.Average_HFA01(hfa01), TestMan.EXPECTED_SUM_HFA01 / 1) ? 0 : 1; nFailures += Common.CheckResult("Average HFA 02", TestMan.Average_HFA02(hfa02), TestMan.EXPECTED_SUM_HFA02 / 2) ? 0 : 1; nFailures += Common.CheckResult("Average HFA 03", TestMan.Average_HFA03(hfa03), TestMan.EXPECTED_SUM_HFA03 / 3) ? 0 : 1; nFailures += Common.CheckResult("Average HFA 05", TestMan.Average_HFA05(hfa05), TestMan.EXPECTED_SUM_HFA05 / 5) ? 0 : 1; nFailures += Common.CheckResult("Average HFA 08", TestMan.Average_HFA08(hfa08), TestMan.EXPECTED_SUM_HFA08 / 8) ? 0 : 1; nFailures += Common.CheckResult("Average HFA 11", TestMan.Average_HFA11(hfa11), TestMan.EXPECTED_SUM_HFA11 / 11) ? 0 : 1; nFailures += Common.CheckResult("Average HFA 19", TestMan.Average_HFA19(hfa19), TestMan.EXPECTED_SUM_HFA19 / 19) ? 0 : 1; nFailures += Common.CheckResult("Average3 HFA 01", TestMan.Average3_HFA01(hfa01, hfa01, hfa01), TestMan.EXPECTED_SUM_HFA01 / 1) ? 0 : 1; nFailures += Common.CheckResult("Average3 HFA 02", TestMan.Average3_HFA02(hfa02, hfa02, hfa02), TestMan.EXPECTED_SUM_HFA02 / 2) ? 0 : 1; nFailures += Common.CheckResult("Average3 HFA 03", TestMan.Average3_HFA03(hfa03, hfa03, hfa03), TestMan.EXPECTED_SUM_HFA03 / 3) ? 0 : 1; nFailures += Common.CheckResult("Average3 HFA 05", TestMan.Average3_HFA05(hfa05, hfa05, hfa05), TestMan.EXPECTED_SUM_HFA05 / 5) ? 0 : 1; nFailures += Common.CheckResult("Average3 HFA 08", TestMan.Average3_HFA08(hfa08, hfa08, hfa08), TestMan.EXPECTED_SUM_HFA08 / 8) ? 0 : 1; nFailures += Common.CheckResult("Average3 HFA 11", TestMan.Average3_HFA11(hfa11, hfa11, hfa11), TestMan.EXPECTED_SUM_HFA11 / 11) ? 0 : 1; nFailures += Common.CheckResult("Average3 HFA 19", TestMan.Average3_HFA19(hfa19, hfa19, hfa19), TestMan.EXPECTED_SUM_HFA19 / 19) ? 0 : 1; nFailures += Common.CheckResult("Average5 HFA 01", TestMan.Average5_HFA01(hfa01, hfa01, hfa01, hfa01, hfa01), TestMan.EXPECTED_SUM_HFA01 / 1) ? 0 : 1; nFailures += Common.CheckResult("Average5 HFA 02", TestMan.Average5_HFA02(hfa02, hfa02, hfa02, hfa02, hfa02), TestMan.EXPECTED_SUM_HFA02 / 2) ? 0 : 1; nFailures += Common.CheckResult("Average5 HFA 03", TestMan.Average5_HFA03(hfa03, hfa03, hfa03, hfa03, hfa03), TestMan.EXPECTED_SUM_HFA03 / 3) ? 0 : 1; nFailures += Common.CheckResult("Average5 HFA 05", TestMan.Average5_HFA05(hfa05, hfa05, hfa05, hfa05, hfa05), TestMan.EXPECTED_SUM_HFA05 / 5) ? 0 : 1; nFailures += Common.CheckResult("Average5 HFA 08", TestMan.Average5_HFA08(hfa08, hfa08, hfa08, hfa08, hfa08), TestMan.EXPECTED_SUM_HFA08 / 8) ? 0 : 1; nFailures += Common.CheckResult("Average5 HFA 11", TestMan.Average5_HFA11(hfa11, hfa11, hfa11, hfa11, hfa11), TestMan.EXPECTED_SUM_HFA11 / 11) ? 0 : 1; nFailures += Common.CheckResult("Average5 HFA 19", TestMan.Average5_HFA19(hfa19, hfa19, hfa19, hfa19, hfa19), TestMan.EXPECTED_SUM_HFA19 / 19) ? 0 : 1; nFailures += Common.CheckResult("Average8 HFA 01", TestMan.Average8_HFA01(hfa01, hfa01, hfa01, hfa01, hfa01, hfa01, hfa01, hfa01), TestMan.EXPECTED_SUM_HFA01 / 1) ? 0 : 1; nFailures += Common.CheckResult("Average8 HFA 02", TestMan.Average8_HFA02(hfa02, hfa02, hfa02, hfa02, hfa02, hfa02, hfa02, hfa02), TestMan.EXPECTED_SUM_HFA02 / 2) ? 0 : 1; nFailures += Common.CheckResult("Average8 HFA 03", TestMan.Average8_HFA03(hfa03, hfa03, hfa03, hfa03, hfa03, hfa03, hfa03, hfa03), TestMan.EXPECTED_SUM_HFA03 / 3) ? 0 : 1; nFailures += Common.CheckResult("Average8 HFA 05", TestMan.Average8_HFA05(hfa05, hfa05, hfa05, hfa05, hfa05, hfa05, hfa05, hfa05), TestMan.EXPECTED_SUM_HFA05 / 5) ? 0 : 1; nFailures += Common.CheckResult("Average8 HFA 08", TestMan.Average8_HFA08(hfa08, hfa08, hfa08, hfa08, hfa08, hfa08, hfa08, hfa08), TestMan.EXPECTED_SUM_HFA08 / 8) ? 0 : 1; nFailures += Common.CheckResult("Average8 HFA 11", TestMan.Average8_HFA11(hfa11, hfa11, hfa11, hfa11, hfa11, hfa11, hfa11, hfa11), TestMan.EXPECTED_SUM_HFA11 / 11) ? 0 : 1; nFailures += Common.CheckResult("Average8 HFA 19", TestMan.Average8_HFA19(hfa19, hfa19, hfa19, hfa19, hfa19, hfa19, hfa19, hfa19), TestMan.EXPECTED_SUM_HFA19 / 19) ? 0 : 1; nFailures += Common.CheckResult("Average11 HFA 01", TestMan.Average11_HFA01(hfa01, hfa01, hfa01, hfa01, hfa01, hfa01, hfa01, hfa01, hfa01, hfa01, hfa01), TestMan.EXPECTED_SUM_HFA01 / 1) ? 0 : 1; nFailures += Common.CheckResult("Average11 HFA 02", TestMan.Average11_HFA02(hfa02, hfa02, hfa02, hfa02, hfa02, hfa02, hfa02, hfa02, hfa02, hfa02, hfa02), TestMan.EXPECTED_SUM_HFA02 / 2) ? 0 : 1; nFailures += Common.CheckResult("Average11 HFA 03", TestMan.Average11_HFA03(hfa03, hfa03, hfa03, hfa03, hfa03, hfa03, hfa03, hfa03, hfa03, hfa03, hfa03), TestMan.EXPECTED_SUM_HFA03 / 3) ? 0 : 1; nFailures += Common.CheckResult("Average11 HFA 05", TestMan.Average11_HFA05(hfa05, hfa05, hfa05, hfa05, hfa05, hfa05, hfa05, hfa05, hfa05, hfa05, hfa05), TestMan.EXPECTED_SUM_HFA05 / 5) ? 0 : 1; nFailures += Common.CheckResult("Average11 HFA 08", TestMan.Average11_HFA08(hfa08, hfa08, hfa08, hfa08, hfa08, hfa08, hfa08, hfa08, hfa08, hfa08, hfa08), TestMan.EXPECTED_SUM_HFA08 / 8) ? 0 : 1; nFailures += Common.CheckResult("Average11 HFA 11", TestMan.Average11_HFA11(hfa11, hfa11, hfa11, hfa11, hfa11, hfa11, hfa11, hfa11, hfa11, hfa11, hfa11), TestMan.EXPECTED_SUM_HFA11 / 11) ? 0 : 1; nFailures += Common.CheckResult("Average11 HFA 19", TestMan.Average11_HFA19(hfa19, hfa19, hfa19, hfa19, hfa19, hfa19, hfa19, hfa19, hfa19, hfa19, hfa19), TestMan.EXPECTED_SUM_HFA19 / 19) ? 0 : 1; nFailures += Common.CheckResult("Average19 HFA 01", TestMan.Average19_HFA01(hfa01, hfa01, hfa01, hfa01, hfa01, hfa01, hfa01, hfa01, hfa01, hfa01, hfa01, hfa01, hfa01, hfa01, hfa01, hfa01, hfa01, hfa01, hfa01), TestMan.EXPECTED_SUM_HFA01 / 1) ? 0 : 1; nFailures += Common.CheckResult("Average19 HFA 02", TestMan.Average19_HFA02(hfa02, hfa02, hfa02, hfa02, hfa02, hfa02, hfa02, hfa02, hfa02, hfa02, hfa02, hfa02, hfa02, hfa02, hfa02, hfa02, hfa02, hfa02, hfa02), TestMan.EXPECTED_SUM_HFA02 / 2) ? 0 : 1; nFailures += Common.CheckResult("Average19 HFA 03", TestMan.Average19_HFA03(hfa03, hfa03, hfa03, hfa03, hfa03, hfa03, hfa03, hfa03, hfa03, hfa03, hfa03, hfa03, hfa03, hfa03, hfa03, hfa03, hfa03, hfa03, hfa03), TestMan.EXPECTED_SUM_HFA03 / 3) ? 0 : 1; nFailures += Common.CheckResult("Average19 HFA 05", TestMan.Average19_HFA05(hfa05, hfa05, hfa05, hfa05, hfa05, hfa05, hfa05, hfa05, hfa05, hfa05, hfa05, hfa05, hfa05, hfa05, hfa05, hfa05, hfa05, hfa05, hfa05), TestMan.EXPECTED_SUM_HFA05 / 5) ? 0 : 1; nFailures += Common.CheckResult("Average19 HFA 08", TestMan.Average19_HFA08(hfa08, hfa08, hfa08, hfa08, hfa08, hfa08, hfa08, hfa08, hfa08, hfa08, hfa08, hfa08, hfa08, hfa08, hfa08, hfa08, hfa08, hfa08, hfa08), TestMan.EXPECTED_SUM_HFA08 / 8) ? 0 : 1; nFailures += Common.CheckResult("Average19 HFA 11", TestMan.Average19_HFA11(hfa11, hfa11, hfa11, hfa11, hfa11, hfa11, hfa11, hfa11, hfa11, hfa11, hfa11, hfa11, hfa11, hfa11, hfa11, hfa11, hfa11, hfa11, hfa11), TestMan.EXPECTED_SUM_HFA11 / 11) ? 0 : 1; nFailures += Common.CheckResult("Average19 HFA 19", TestMan.Average19_HFA19(hfa19, hfa19, hfa19, hfa19, hfa19, hfa19, hfa19, hfa19, hfa19, hfa19, hfa19, hfa19, hfa19, hfa19, hfa19, hfa19, hfa19, hfa19, hfa19), TestMan.EXPECTED_SUM_HFA19 / 19) ? 0 : 1; return nFailures == 0 ? Common.SUCC_RET_CODE : Common.FAIL_RET_CODE; } } }
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/tests/Loader/classloader/v1/Beta1/Layout/Matrix/cs/L-1-6-3D.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. #pragma warning disable 414 using System; public class A{ ////////////////////////////// // Instance Fields public int FldPubInst; private int FldPrivInst; protected int FldFamInst; //Translates to "family" internal int FldAsmInst; //Translates to "assembly" protected internal int FldFoaInst; //Translates to "famorassem" ////////////////////////////// // Static Fields public static int FldPubStat; private static int FldPrivStat; protected static int FldFamStat; //family internal static int FldAsmStat; //assembly protected internal static int FldFoaStat; //famorassem ////////////////////////////////////// // Instance fields for nested classes public Cls ClsPubInst = new Cls(); private Cls ClsPrivInst = new Cls(); protected Cls ClsFamInst = new Cls(); internal Cls ClsAsmInst = new Cls(); protected internal Cls ClsFoaInst = new Cls(); ///////////////////////////////////// // Static fields of nested classes public static Cls ClsPubStat = new Cls(); private static Cls ClsPrivStat = new Cls(); ////////////////////////////// // Instance Methods public int MethPubInst(){ Console.WriteLine("A::MethPubInst()"); return 100; } private int MethPrivInst(){ Console.WriteLine("A::MethPrivInst()"); return 100; } protected int MethFamInst(){ Console.WriteLine("A::MethFamInst()"); return 100; } internal int MethAsmInst(){ Console.WriteLine("A::MethAsmInst()"); return 100; } protected internal int MethFoaInst(){ Console.WriteLine("A::MethFoaInst()"); return 100; } ////////////////////////////// // Static Methods public static int MethPubStat(){ Console.WriteLine("A::MethPubStat()"); return 100; } private static int MethPrivStat(){ Console.WriteLine("A::MethPrivStat()"); return 100; } protected static int MethFamStat(){ Console.WriteLine("A::MethFamStat()"); return 100; } internal static int MethAsmStat(){ Console.WriteLine("A::MethAsmStat()"); return 100; } protected internal static int MethFoaStat(){ Console.WriteLine("A::MethFoaStat()"); return 100; } ////////////////////////////// // Virtual Instance Methods public virtual int MethPubVirt(){ Console.WriteLine("A::MethPubVirt()"); return 100; } //@csharp - Note that C# won't compile an illegal private virtual function //So there is no negative testing MethPrivVirt() here. protected virtual int MethFamVirt(){ Console.WriteLine("A::MethFamVirt()"); return 100; } internal virtual int MethAsmVirt(){ Console.WriteLine("A::MethAsmVirt()"); return 100; } protected internal virtual int MethFoaVirt(){ Console.WriteLine("A::MethFoaVirt()"); return 100; } public class Cls{ ////////////////////////////// // Instance Fields public int NestFldPubInst; private int NestFldPrivInst; protected int NestFldFamInst; //Translates to "family" internal int NestFldAsmInst; //Translates to "assembly" protected internal int NestFldFoaInst; //Translates to "famorassem" ////////////////////////////// // Static Fields public static int NestFldPubStat; private static int NestFldPrivStat; protected static int NestFldFamStat; //family internal static int NestFldAsmStat; //assembly protected internal static int NestFldFoaStat; //famorassem ////////////////////////////////////// // Instance fields for nested classes public Cls2 Cls2PubInst = new Cls2(); private Cls2 Cls2PrivInst = new Cls2(); protected Cls2 Cls2FamInst = new Cls2(); internal Cls2 Cls2AsmInst = new Cls2(); protected internal Cls2 Cls2FoaInst = new Cls2(); ///////////////////////////////////// // Static fields of nested classes public static Cls ClsPubStat = new Cls(); private static Cls ClsPrivStat = new Cls(); ////////////////////////////// // Instance NestMethods public int NestMethPubInst(){ Console.WriteLine("A::NestMethPubInst()"); return 100; } private int NestMethPrivInst(){ Console.WriteLine("A::NestMethPrivInst()"); return 100; } protected int NestMethFamInst(){ Console.WriteLine("A::NestMethFamInst()"); return 100; } internal int NestMethAsmInst(){ Console.WriteLine("A::NestMethAsmInst()"); return 100; } protected internal int NestMethFoaInst(){ Console.WriteLine("A::NestMethFoaInst()"); return 100; } ////////////////////////////// // Static NestMethods public static int NestMethPubStat(){ Console.WriteLine("A::NestMethPubStat()"); return 100; } private static int NestMethPrivStat(){ Console.WriteLine("A::NestMethPrivStat()"); return 100; } protected static int NestMethFamStat(){ Console.WriteLine("A::NestMethFamStat()"); return 100; } internal static int NestMethAsmStat(){ Console.WriteLine("A::NestMethAsmStat()"); return 100; } protected internal static int NestMethFoaStat(){ Console.WriteLine("A::NestMethFoaStat()"); return 100; } ////////////////////////////// // Virtual Instance NestMethods public virtual int NestMethPubVirt(){ Console.WriteLine("A::NestMethPubVirt()"); return 100; } //@csharp - Note that C# won't compile an illegal private virtual function //So there is no negative testing NestMethPrivVirt() here. protected virtual int NestMethFamVirt(){ Console.WriteLine("A::NestMethFamVirt()"); return 100; } internal virtual int NestMethAsmVirt(){ Console.WriteLine("A::NestMethAsmVirt()"); return 100; } protected internal virtual int NestMethFoaVirt(){ Console.WriteLine("A::NestMethFoaVirt()"); return 100; } public class Cls2{ public int Test(){ int mi_RetCode = 100; ///////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////// // ACCESS ENCLOSING FIELDS/MEMBERS ///////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////// //@csharp - C# will not allow nested classes to access non-static members of their enclosing classes ///////////////////////////////// // Test static field access FldPubStat = 100; if(FldPubStat != 100) mi_RetCode = 0; FldFamStat = 100; if(FldFamStat != 100) mi_RetCode = 0; FldAsmStat = 100; if(FldAsmStat != 100) mi_RetCode = 0; FldFoaStat = 100; if(FldFoaStat != 100) mi_RetCode = 0; ///////////////////////////////// // Test static method access if(MethPubStat() != 100) mi_RetCode = 0; if(MethFamStat() != 100) mi_RetCode = 0; if(MethAsmStat() != 100) mi_RetCode = 0; if(MethFoaStat() != 100) mi_RetCode = 0; //////////////////////////////////////////// // Test access from within the nested class //@todo - Look at testing accessing one nested class from another, @bugug - NEED TO ADD SUCH TESTING, access the public nested class fields from here, etc... ///////////////////////////////// // Test static field access NestFldPubStat = 100; if(NestFldPubStat != 100) mi_RetCode = 0; NestFldFamStat = 100; if(NestFldFamStat != 100) mi_RetCode = 0; NestFldAsmStat = 100; if(NestFldAsmStat != 100) mi_RetCode = 0; NestFldFoaStat = 100; if(NestFldFoaStat != 100) mi_RetCode = 0; ///////////////////////////////// // Test static method access if(NestMethPubStat() != 100) mi_RetCode = 0; if(NestMethFamStat() != 100) mi_RetCode = 0; if(NestMethAsmStat() != 100) mi_RetCode = 0; if(NestMethFoaStat() != 100) mi_RetCode = 0; return mi_RetCode; } ////////////////////////////// // Instance Fields public int Nest2FldPubInst; private int Nest2FldPrivInst; protected int Nest2FldFamInst; //Translates to "family" internal int Nest2FldAsmInst; //Translates to "assembly" protected internal int Nest2FldFoaInst; //Translates to "famorassem" ////////////////////////////// // Static Fields public static int Nest2FldPubStat; private static int Nest2FldPrivStat; protected static int Nest2FldFamStat; //family internal static int Nest2FldAsmStat; //assembly protected internal static int Nest2FldFoaStat; //famorassem ////////////////////////////// // Instance Nest2Methods public int Nest2MethPubInst(){ Console.WriteLine("A::Nest2MethPubInst()"); return 100; } private int Nest2MethPrivInst(){ Console.WriteLine("A::Nest2MethPrivInst()"); return 100; } protected int Nest2MethFamInst(){ Console.WriteLine("A::Nest2MethFamInst()"); return 100; } internal int Nest2MethAsmInst(){ Console.WriteLine("A::Nest2MethAsmInst()"); return 100; } protected internal int Nest2MethFoaInst(){ Console.WriteLine("A::Nest2MethFoaInst()"); return 100; } ////////////////////////////// // Static Nest2Methods public static int Nest2MethPubStat(){ Console.WriteLine("A::Nest2MethPubStat()"); return 100; } private static int Nest2MethPrivStat(){ Console.WriteLine("A::Nest2MethPrivStat()"); return 100; } protected static int Nest2MethFamStat(){ Console.WriteLine("A::Nest2MethFamStat()"); return 100; } internal static int Nest2MethAsmStat(){ Console.WriteLine("A::Nest2MethAsmStat()"); return 100; } protected internal static int Nest2MethFoaStat(){ Console.WriteLine("A::Nest2MethFoaStat()"); return 100; } ////////////////////////////// // Virtual Instance Nest2Methods public virtual int Nest2MethPubVirt(){ Console.WriteLine("A::Nest2MethPubVirt()"); return 100; } //@csharp - Note that C# won't compile an illegal private virtual function //So there is no negative testing Nest2MethPrivVirt() here. protected virtual int Nest2MethFamVirt(){ Console.WriteLine("A::Nest2MethFamVirt()"); return 100; } internal virtual int Nest2MethAsmVirt(){ Console.WriteLine("A::Nest2MethAsmVirt()"); return 100; } protected internal virtual int Nest2MethFoaVirt(){ Console.WriteLine("A::Nest2MethFoaVirt()"); return 100; } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. #pragma warning disable 414 using System; public class A{ ////////////////////////////// // Instance Fields public int FldPubInst; private int FldPrivInst; protected int FldFamInst; //Translates to "family" internal int FldAsmInst; //Translates to "assembly" protected internal int FldFoaInst; //Translates to "famorassem" ////////////////////////////// // Static Fields public static int FldPubStat; private static int FldPrivStat; protected static int FldFamStat; //family internal static int FldAsmStat; //assembly protected internal static int FldFoaStat; //famorassem ////////////////////////////////////// // Instance fields for nested classes public Cls ClsPubInst = new Cls(); private Cls ClsPrivInst = new Cls(); protected Cls ClsFamInst = new Cls(); internal Cls ClsAsmInst = new Cls(); protected internal Cls ClsFoaInst = new Cls(); ///////////////////////////////////// // Static fields of nested classes public static Cls ClsPubStat = new Cls(); private static Cls ClsPrivStat = new Cls(); ////////////////////////////// // Instance Methods public int MethPubInst(){ Console.WriteLine("A::MethPubInst()"); return 100; } private int MethPrivInst(){ Console.WriteLine("A::MethPrivInst()"); return 100; } protected int MethFamInst(){ Console.WriteLine("A::MethFamInst()"); return 100; } internal int MethAsmInst(){ Console.WriteLine("A::MethAsmInst()"); return 100; } protected internal int MethFoaInst(){ Console.WriteLine("A::MethFoaInst()"); return 100; } ////////////////////////////// // Static Methods public static int MethPubStat(){ Console.WriteLine("A::MethPubStat()"); return 100; } private static int MethPrivStat(){ Console.WriteLine("A::MethPrivStat()"); return 100; } protected static int MethFamStat(){ Console.WriteLine("A::MethFamStat()"); return 100; } internal static int MethAsmStat(){ Console.WriteLine("A::MethAsmStat()"); return 100; } protected internal static int MethFoaStat(){ Console.WriteLine("A::MethFoaStat()"); return 100; } ////////////////////////////// // Virtual Instance Methods public virtual int MethPubVirt(){ Console.WriteLine("A::MethPubVirt()"); return 100; } //@csharp - Note that C# won't compile an illegal private virtual function //So there is no negative testing MethPrivVirt() here. protected virtual int MethFamVirt(){ Console.WriteLine("A::MethFamVirt()"); return 100; } internal virtual int MethAsmVirt(){ Console.WriteLine("A::MethAsmVirt()"); return 100; } protected internal virtual int MethFoaVirt(){ Console.WriteLine("A::MethFoaVirt()"); return 100; } public class Cls{ ////////////////////////////// // Instance Fields public int NestFldPubInst; private int NestFldPrivInst; protected int NestFldFamInst; //Translates to "family" internal int NestFldAsmInst; //Translates to "assembly" protected internal int NestFldFoaInst; //Translates to "famorassem" ////////////////////////////// // Static Fields public static int NestFldPubStat; private static int NestFldPrivStat; protected static int NestFldFamStat; //family internal static int NestFldAsmStat; //assembly protected internal static int NestFldFoaStat; //famorassem ////////////////////////////////////// // Instance fields for nested classes public Cls2 Cls2PubInst = new Cls2(); private Cls2 Cls2PrivInst = new Cls2(); protected Cls2 Cls2FamInst = new Cls2(); internal Cls2 Cls2AsmInst = new Cls2(); protected internal Cls2 Cls2FoaInst = new Cls2(); ///////////////////////////////////// // Static fields of nested classes public static Cls ClsPubStat = new Cls(); private static Cls ClsPrivStat = new Cls(); ////////////////////////////// // Instance NestMethods public int NestMethPubInst(){ Console.WriteLine("A::NestMethPubInst()"); return 100; } private int NestMethPrivInst(){ Console.WriteLine("A::NestMethPrivInst()"); return 100; } protected int NestMethFamInst(){ Console.WriteLine("A::NestMethFamInst()"); return 100; } internal int NestMethAsmInst(){ Console.WriteLine("A::NestMethAsmInst()"); return 100; } protected internal int NestMethFoaInst(){ Console.WriteLine("A::NestMethFoaInst()"); return 100; } ////////////////////////////// // Static NestMethods public static int NestMethPubStat(){ Console.WriteLine("A::NestMethPubStat()"); return 100; } private static int NestMethPrivStat(){ Console.WriteLine("A::NestMethPrivStat()"); return 100; } protected static int NestMethFamStat(){ Console.WriteLine("A::NestMethFamStat()"); return 100; } internal static int NestMethAsmStat(){ Console.WriteLine("A::NestMethAsmStat()"); return 100; } protected internal static int NestMethFoaStat(){ Console.WriteLine("A::NestMethFoaStat()"); return 100; } ////////////////////////////// // Virtual Instance NestMethods public virtual int NestMethPubVirt(){ Console.WriteLine("A::NestMethPubVirt()"); return 100; } //@csharp - Note that C# won't compile an illegal private virtual function //So there is no negative testing NestMethPrivVirt() here. protected virtual int NestMethFamVirt(){ Console.WriteLine("A::NestMethFamVirt()"); return 100; } internal virtual int NestMethAsmVirt(){ Console.WriteLine("A::NestMethAsmVirt()"); return 100; } protected internal virtual int NestMethFoaVirt(){ Console.WriteLine("A::NestMethFoaVirt()"); return 100; } public class Cls2{ public int Test(){ int mi_RetCode = 100; ///////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////// // ACCESS ENCLOSING FIELDS/MEMBERS ///////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////// //@csharp - C# will not allow nested classes to access non-static members of their enclosing classes ///////////////////////////////// // Test static field access FldPubStat = 100; if(FldPubStat != 100) mi_RetCode = 0; FldFamStat = 100; if(FldFamStat != 100) mi_RetCode = 0; FldAsmStat = 100; if(FldAsmStat != 100) mi_RetCode = 0; FldFoaStat = 100; if(FldFoaStat != 100) mi_RetCode = 0; ///////////////////////////////// // Test static method access if(MethPubStat() != 100) mi_RetCode = 0; if(MethFamStat() != 100) mi_RetCode = 0; if(MethAsmStat() != 100) mi_RetCode = 0; if(MethFoaStat() != 100) mi_RetCode = 0; //////////////////////////////////////////// // Test access from within the nested class //@todo - Look at testing accessing one nested class from another, @bugug - NEED TO ADD SUCH TESTING, access the public nested class fields from here, etc... ///////////////////////////////// // Test static field access NestFldPubStat = 100; if(NestFldPubStat != 100) mi_RetCode = 0; NestFldFamStat = 100; if(NestFldFamStat != 100) mi_RetCode = 0; NestFldAsmStat = 100; if(NestFldAsmStat != 100) mi_RetCode = 0; NestFldFoaStat = 100; if(NestFldFoaStat != 100) mi_RetCode = 0; ///////////////////////////////// // Test static method access if(NestMethPubStat() != 100) mi_RetCode = 0; if(NestMethFamStat() != 100) mi_RetCode = 0; if(NestMethAsmStat() != 100) mi_RetCode = 0; if(NestMethFoaStat() != 100) mi_RetCode = 0; return mi_RetCode; } ////////////////////////////// // Instance Fields public int Nest2FldPubInst; private int Nest2FldPrivInst; protected int Nest2FldFamInst; //Translates to "family" internal int Nest2FldAsmInst; //Translates to "assembly" protected internal int Nest2FldFoaInst; //Translates to "famorassem" ////////////////////////////// // Static Fields public static int Nest2FldPubStat; private static int Nest2FldPrivStat; protected static int Nest2FldFamStat; //family internal static int Nest2FldAsmStat; //assembly protected internal static int Nest2FldFoaStat; //famorassem ////////////////////////////// // Instance Nest2Methods public int Nest2MethPubInst(){ Console.WriteLine("A::Nest2MethPubInst()"); return 100; } private int Nest2MethPrivInst(){ Console.WriteLine("A::Nest2MethPrivInst()"); return 100; } protected int Nest2MethFamInst(){ Console.WriteLine("A::Nest2MethFamInst()"); return 100; } internal int Nest2MethAsmInst(){ Console.WriteLine("A::Nest2MethAsmInst()"); return 100; } protected internal int Nest2MethFoaInst(){ Console.WriteLine("A::Nest2MethFoaInst()"); return 100; } ////////////////////////////// // Static Nest2Methods public static int Nest2MethPubStat(){ Console.WriteLine("A::Nest2MethPubStat()"); return 100; } private static int Nest2MethPrivStat(){ Console.WriteLine("A::Nest2MethPrivStat()"); return 100; } protected static int Nest2MethFamStat(){ Console.WriteLine("A::Nest2MethFamStat()"); return 100; } internal static int Nest2MethAsmStat(){ Console.WriteLine("A::Nest2MethAsmStat()"); return 100; } protected internal static int Nest2MethFoaStat(){ Console.WriteLine("A::Nest2MethFoaStat()"); return 100; } ////////////////////////////// // Virtual Instance Nest2Methods public virtual int Nest2MethPubVirt(){ Console.WriteLine("A::Nest2MethPubVirt()"); return 100; } //@csharp - Note that C# won't compile an illegal private virtual function //So there is no negative testing Nest2MethPrivVirt() here. protected virtual int Nest2MethFamVirt(){ Console.WriteLine("A::Nest2MethFamVirt()"); return 100; } internal virtual int Nest2MethAsmVirt(){ Console.WriteLine("A::Nest2MethAsmVirt()"); return 100; } protected internal virtual int Nest2MethFoaVirt(){ Console.WriteLine("A::Nest2MethFoaVirt()"); return 100; } } } }
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/libraries/System.Security.Cryptography.Pkcs/tests/Oids.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. namespace System.Security.Cryptography.Pkcs.Tests { internal static class Oids { // Symmetric encryption algorithms public const string Rc2 = "1.2.840.113549.3.2"; //RC2 public const string Rc4 = "1.2.840.113549.3.4"; //RC4 public const string Des = "1.3.14.3.2.7"; //DES public const string TripleDesCbc = "1.2.840.113549.3.7"; //3DES-CBC public const string Aes128 = "2.16.840.1.101.3.4.1.2"; //AES128 public const string Aes192 = "2.16.840.1.101.3.4.1.22"; //AES192 public const string Aes256 = "2.16.840.1.101.3.4.1.42"; //AES256 // Asymmetric encryption algorithms public const string Rsa = "1.2.840.113549.1.1.1"; public const string RsaOaep = "1.2.840.113549.1.1.7"; public const string RsaPkcs1Md5 = "1.2.840.113549.1.1.4"; public const string RsaPkcs1Sha1 = "1.2.840.113549.1.1.5"; public const string RsaPkcs1Sha256 = "1.2.840.113549.1.1.11"; public const string RsaPkcs1Sha384 = "1.2.840.113549.1.1.12"; public const string RsaPkcs1Sha512 = "1.2.840.113549.1.1.13"; public const string RsaPss = "1.2.840.113549.1.1.10"; public const string Esdh = "1.2.840.113549.1.9.16.3.5"; public const string Dh = "1.2.840.10046.2.1"; public const string EcdsaSha256 = "1.2.840.10045.4.3.2"; // Cryptographic Attribute Types public const string SigningTime = "1.2.840.113549.1.9.5"; public const string ContentType = "1.2.840.113549.1.9.3"; public const string DocumentDescription = "1.3.6.1.4.1.311.88.2.2"; public const string MessageDigest = "1.2.840.113549.1.9.4"; public const string DocumentName = "1.3.6.1.4.1.311.88.2.1"; public const string CounterSigner = "1.2.840.113549.1.9.6"; public const string FriendlyName = "1.2.840.113549.1.9.20"; public const string LocalKeyId = "1.2.840.113549.1.9.21"; // Key wrap algorithms public const string CmsRc2Wrap = "1.2.840.113549.1.9.16.3.7"; public const string Cms3DesWrap = "1.2.840.113549.1.9.16.3.6"; // PKCS7 Content Types. public const string Pkcs7Data = "1.2.840.113549.1.7.1"; public const string Pkcs7Signed = "1.2.840.113549.1.7.2"; public const string Pkcs7Enveloped = "1.2.840.113549.1.7.3"; public const string Pkcs7SignedEnveloped = "1.2.840.113549.1.7.4"; public const string Pkcs7Hashed = "1.2.840.113549.1.7.5"; public const string Pkcs7Encrypted = "1.2.840.113549.1.7.6"; // PKCS12 bag types public const string CertBag = "1.2.840.113549.1.12.10.1.3"; // X509 extensions public const string SubjectKeyIdentifier = "2.5.29.14"; public const string BasicConstraints2 = "2.5.29.19"; // Hash algorithms public const string Md5 = "1.2.840.113549.2.5"; public const string Sha1 = "1.3.14.3.2.26"; public const string Sha256 = "2.16.840.1.101.3.4.2.1"; public const string Sha384 = "2.16.840.1.101.3.4.2.2"; public const string Sha512 = "2.16.840.1.101.3.4.2.3"; // RFC3161 Timestamping public const string TstInfo = "1.2.840.113549.1.9.16.1.4"; public const string TimeStampingPurpose = "1.3.6.1.5.5.7.3.8"; } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. namespace System.Security.Cryptography.Pkcs.Tests { internal static class Oids { // Symmetric encryption algorithms public const string Rc2 = "1.2.840.113549.3.2"; //RC2 public const string Rc4 = "1.2.840.113549.3.4"; //RC4 public const string Des = "1.3.14.3.2.7"; //DES public const string TripleDesCbc = "1.2.840.113549.3.7"; //3DES-CBC public const string Aes128 = "2.16.840.1.101.3.4.1.2"; //AES128 public const string Aes192 = "2.16.840.1.101.3.4.1.22"; //AES192 public const string Aes256 = "2.16.840.1.101.3.4.1.42"; //AES256 // Asymmetric encryption algorithms public const string Rsa = "1.2.840.113549.1.1.1"; public const string RsaOaep = "1.2.840.113549.1.1.7"; public const string RsaPkcs1Md5 = "1.2.840.113549.1.1.4"; public const string RsaPkcs1Sha1 = "1.2.840.113549.1.1.5"; public const string RsaPkcs1Sha256 = "1.2.840.113549.1.1.11"; public const string RsaPkcs1Sha384 = "1.2.840.113549.1.1.12"; public const string RsaPkcs1Sha512 = "1.2.840.113549.1.1.13"; public const string RsaPss = "1.2.840.113549.1.1.10"; public const string Esdh = "1.2.840.113549.1.9.16.3.5"; public const string Dh = "1.2.840.10046.2.1"; public const string EcdsaSha256 = "1.2.840.10045.4.3.2"; // Cryptographic Attribute Types public const string SigningTime = "1.2.840.113549.1.9.5"; public const string ContentType = "1.2.840.113549.1.9.3"; public const string DocumentDescription = "1.3.6.1.4.1.311.88.2.2"; public const string MessageDigest = "1.2.840.113549.1.9.4"; public const string DocumentName = "1.3.6.1.4.1.311.88.2.1"; public const string CounterSigner = "1.2.840.113549.1.9.6"; public const string FriendlyName = "1.2.840.113549.1.9.20"; public const string LocalKeyId = "1.2.840.113549.1.9.21"; // Key wrap algorithms public const string CmsRc2Wrap = "1.2.840.113549.1.9.16.3.7"; public const string Cms3DesWrap = "1.2.840.113549.1.9.16.3.6"; // PKCS7 Content Types. public const string Pkcs7Data = "1.2.840.113549.1.7.1"; public const string Pkcs7Signed = "1.2.840.113549.1.7.2"; public const string Pkcs7Enveloped = "1.2.840.113549.1.7.3"; public const string Pkcs7SignedEnveloped = "1.2.840.113549.1.7.4"; public const string Pkcs7Hashed = "1.2.840.113549.1.7.5"; public const string Pkcs7Encrypted = "1.2.840.113549.1.7.6"; // PKCS12 bag types public const string CertBag = "1.2.840.113549.1.12.10.1.3"; // X509 extensions public const string SubjectKeyIdentifier = "2.5.29.14"; public const string BasicConstraints2 = "2.5.29.19"; // Hash algorithms public const string Md5 = "1.2.840.113549.2.5"; public const string Sha1 = "1.3.14.3.2.26"; public const string Sha256 = "2.16.840.1.101.3.4.2.1"; public const string Sha384 = "2.16.840.1.101.3.4.2.2"; public const string Sha512 = "2.16.840.1.101.3.4.2.3"; // RFC3161 Timestamping public const string TstInfo = "1.2.840.113549.1.9.16.1.4"; public const string TimeStampingPurpose = "1.3.6.1.5.5.7.3.8"; } }
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/UnmanagedFunctionPointerAttributeTests.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using Xunit; namespace System.Runtime.InteropServices.Tests { public class UnmanagedFunctionPointerAttributeTests { [Theory] [InlineData((CallingConvention)(-1))] [InlineData(CallingConvention.Cdecl)] [InlineData((CallingConvention)int.MaxValue)] public void Ctor_CallingConvention(CallingConvention callingConvention) { var attribute = new UnmanagedFunctionPointerAttribute(callingConvention); Assert.Equal(callingConvention, attribute.CallingConvention); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using Xunit; namespace System.Runtime.InteropServices.Tests { public class UnmanagedFunctionPointerAttributeTests { [Theory] [InlineData((CallingConvention)(-1))] [InlineData(CallingConvention.Cdecl)] [InlineData((CallingConvention)int.MaxValue)] public void Ctor_CallingConvention(CallingConvention callingConvention) { var attribute = new UnmanagedFunctionPointerAttribute(callingConvention); Assert.Equal(callingConvention, attribute.CallingConvention); } } }
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/tests/JIT/jit64/opt/cse/HugeField1.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <GCStressIncompatible>true</GCStressIncompatible> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>Full</DebugType> <Optimize>False</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="HugeField1.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <GCStressIncompatible>true</GCStressIncompatible> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>Full</DebugType> <Optimize>False</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="HugeField1.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,169
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's
Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
eiriktsarpalis
2022-03-03T22:59:21Z
2022-03-04T16:48:09Z
11b79618faf1023ba4ea26b4037f495f81070d79
1d82d48e8c8150bfb549f095d6dafb599ff9f229
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's. Simplifies the derivation logic for the `ReadStack.JsonTypeInfo` property, making it consistent with `WriteStack.JsonTypeInfo`. Backported change from the polymorphism prototype.
./src/tests/JIT/Methodical/AsgOp/r8/r8_cs_do.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>Full</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="r8.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>Full</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="r8.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,160
Update files to remove imhameed
SamMonoRT
2022-03-03T20:37:43Z
2022-03-04T17:15:58Z
1d82d48e8c8150bfb549f095d6dafb599ff9f229
611d45f73e65076ebff2f8b71c668cf56114deae
Update files to remove imhameed.
./.github/CODEOWNERS
# Users referenced in this file will automatically be requested as reviewers for PRs that modify the given paths. # See https://help.github.com/articles/about-code-owners/ /src/libraries/Common/src/Interop/ @dotnet/platform-deps-team /src/libraries/Common/src/System/Net/Http/aspnetcore/ @dotnet/http /src/libraries/Common/tests/Tests/System/Net/aspnetcore/ @dotnet/http # CoreCLR Code Owners /src/coreclr/inc/corinfo.h @dotnet/jit-contrib /src/coreclr/inc/corjit.h @dotnet/jit-contrib /src/coreclr/jit/ @dotnet/jit-contrib /src/coreclr/nativeaot @MichalStrehovsky /src/coreclr/tools/Common @dotnet/crossgen-contrib @MichalStrehovsky /src/coreclr/tools/aot @dotnet/crossgen-contrib /src/coreclr/tools/aot/ILCompiler.Compiler @MichalStrehovsky /src/coreclr/tools/aot/ILCompiler.RyuJit @MichalStrehovsky /src/coreclr/tools/aot/ILCompiler.MetadataTransform @MichalStrehovsky # Mono Code Owners /src/mono @marek-safar /src/mono/llvm @vargaz @SamMonoRT @imhameed @EgorBo /src/mono/mono/arch @vargaz /src/mono/mono/eglib @vargaz @lambdageek /src/mono/mono/metadata @vargaz @lambdageek @thaystg /src/mono/mono/metadata/*-win* @lateralusX @lambdageek /src/mono/mono/metadata/handle* @lambdageek @vargaz /src/mono/mono/metadata/monitor* @brzvlad @vargaz /src/mono/mono/metadata/sgen* @brzvlad @vargaz @naricc /src/mono/mono/metadata/thread* @lateralusX @lambdageek /src/mono/mono/metadata/w32* @lateralusX @lambdageek /src/mono/mono/mini @vargaz @lambdageek @SamMonoRT @imhameed /src/mono/mono/mini/*cfgdump* @vargaz /src/mono/mono/mini/*exceptions* @vargaz @BrzVlad @imhameed /src/mono/mono/mini/*llvm* @vargaz @imhameed @EgorBo /src/mono/mono/mini/*ppc* @vargaz /src/mono/mono/mini/*profiler* @BrzVlad @lambdageek /src/mono/mono/mini/*riscv* @alexrp /src/mono/mono/mini/*type-check* @lambdageek /src/mono/mono/mini/debugger-agent.c @vargaz @thaystg @lambdageek /src/mono/mono/mini/interp/* @BrzVlad @vargaz /src/mono/mono/profiler @BrzVlad @lambdageek /src/mono/mono/sgen @BrzVlad @lambdageek @naricc /src/mono/mono/utils @vargaz @lambdageek /src/mono/mono/utils/*-win* @lateralusX @lambdageek /src/mono/mono/utils/atomic* @vargaz /src/mono/mono/utils/mono-hwcap* @vargaz /src/mono/mono/utils/mono-mem* @vargaz /src/mono/mono/utils/mono-merp* @lambdageek @naricc @imhameed /src/mono/mono/utils/mono-state* @lambdageek /src/mono/mono/utils/mono-threads* @lambdageek @vargaz /src/mono/dlls @thaystg @lambdageek /src/native/public/mono @marek-safar @lambdageek # Obsoletions / Custom Diagnostics /docs/project/list-of-diagnostics.md @jeffhandley /src/libraries/Common/src/System/Obsoletions.cs @jeffhandley
# Users referenced in this file will automatically be requested as reviewers for PRs that modify the given paths. # See https://help.github.com/articles/about-code-owners/ /src/libraries/Common/src/Interop/ @dotnet/platform-deps-team /src/libraries/Common/src/System/Net/Http/aspnetcore/ @dotnet/http /src/libraries/Common/tests/Tests/System/Net/aspnetcore/ @dotnet/http # CoreCLR Code Owners /src/coreclr/inc/corinfo.h @dotnet/jit-contrib /src/coreclr/inc/corjit.h @dotnet/jit-contrib /src/coreclr/jit/ @dotnet/jit-contrib /src/coreclr/nativeaot @MichalStrehovsky /src/coreclr/tools/Common @dotnet/crossgen-contrib @MichalStrehovsky /src/coreclr/tools/aot @dotnet/crossgen-contrib /src/coreclr/tools/aot/ILCompiler.Compiler @MichalStrehovsky /src/coreclr/tools/aot/ILCompiler.RyuJit @MichalStrehovsky /src/coreclr/tools/aot/ILCompiler.MetadataTransform @MichalStrehovsky # Mono Code Owners /src/mono @marek-safar /src/mono/llvm @vargaz @SamMonoRT /src/mono/mono/arch @vargaz /src/mono/mono/eglib @vargaz @lambdageek /src/mono/mono/metadata @vargaz @lambdageek @thaystg /src/mono/mono/metadata/*-win* @lateralusX @lambdageek /src/mono/mono/metadata/handle* @lambdageek @vargaz /src/mono/mono/metadata/monitor* @brzvlad @vargaz /src/mono/mono/metadata/sgen* @brzvlad @vargaz @naricc /src/mono/mono/metadata/thread* @lateralusX @lambdageek /src/mono/mono/metadata/w32* @lateralusX @lambdageek /src/mono/mono/mini @vargaz @lambdageek @SamMonoRT /src/mono/mono/mini/*cfgdump* @vargaz /src/mono/mono/mini/*exceptions* @vargaz @BrzVlad /src/mono/mono/mini/*llvm* @vargaz /src/mono/mono/mini/*ppc* @vargaz /src/mono/mono/mini/*profiler* @BrzVlad @lambdageek /src/mono/mono/mini/*riscv* @vargaz @lambdageek /src/mono/mono/mini/*type-check* @lambdageek /src/mono/mono/mini/debugger-agent.c @vargaz @thaystg @lambdageek /src/mono/mono/mini/interp/* @BrzVlad @vargaz /src/mono/mono/profiler @BrzVlad @lambdageek /src/mono/mono/sgen @BrzVlad @lambdageek @naricc /src/mono/mono/utils @vargaz @lambdageek /src/mono/mono/utils/*-win* @lateralusX @lambdageek /src/mono/mono/utils/atomic* @vargaz /src/mono/mono/utils/mono-hwcap* @vargaz /src/mono/mono/utils/mono-mem* @vargaz /src/mono/mono/utils/mono-threads* @lambdageek @vargaz /src/mono/dlls @thaystg @lambdageek /src/native/public/mono @marek-safar @lambdageek # Obsoletions / Custom Diagnostics /docs/project/list-of-diagnostics.md @jeffhandley /src/libraries/Common/src/System/Obsoletions.cs @jeffhandley
1
dotnet/runtime
66,160
Update files to remove imhameed
SamMonoRT
2022-03-03T20:37:43Z
2022-03-04T17:15:58Z
1d82d48e8c8150bfb549f095d6dafb599ff9f229
611d45f73e65076ebff2f8b71c668cf56114deae
Update files to remove imhameed.
./.github/fabricbot.json
[ { "taskType": "scheduledAndTrigger", "capabilityId": "IssueRouting", "subCapability": "@Mention", "version": "1.0", "config": { "taskName": "Area-owners", "labelsAndMentions": [ { "labels": [ "area-System.Security" ], "mentionees": [ "dotnet/area-system-security", "vcsjones" ] }, { "labels": [ "area-System.Diagnostics.Tracing" ], "mentionees": [ "tarekgh", "tommcdon", "pjanotti" ] }, { "labels": [ "area-System.Linq.Parallel" ], "mentionees": [ "dotnet/area-system-linq-parallel" ] }, { "labels": [ "area-System.Text.Encoding" ], "mentionees": [ "dotnet/area-system-text-encoding" ] }, { "labels": [ "area-System.Text.Encodings.Web" ], "mentionees": [ "dotnet/area-system-text-encodings-web" ] }, { "labels": [ "area-System.Threading.Channels" ], "mentionees": [ "dotnet/area-system-threading-channels" ] }, { "labels": [ "area-System.Threading.Tasks" ], "mentionees": [ "dotnet/area-system-threading-tasks" ] }, { "labels": [ "area-System.Text.RegularExpressions" ], "mentionees": [ "dotnet/area-system-text-regularexpressions" ] }, { "labels": [ "area-GC-mono" ], "mentionees": [ "brzvlad" ] }, { "labels": [ "area-Codegen-Interpreter-mono" ], "mentionees": [ "brzvlad" ] }, { "labels": [ "area-Infrastructure-mono" ], "mentionees": [ "directhex" ] }, { "labels": [ "area-AssemblyLoader-mono" ], "mentionees": [] }, { "labels": [ "area-Debugger-mono" ], "mentionees": [ "thaystg" ] }, { "labels": [ "area-System.Collections" ], "mentionees": [ "dotnet/area-system-collections" ] }, { "labels": [ "area-System.Linq" ], "mentionees": [ "dotnet/area-system-linq" ] }, { "labels": [ "area-System.Numerics.Tensors" ], "mentionees": [ "dotnet/area-system-numerics-tensors" ] }, { "labels": [ "area-Host" ], "mentionees": [ "vitek-karas", "agocke", "vsadov" ] }, { "labels": [ "area-HostModel" ], "mentionees": [ "vitek-karas", "agocke" ] }, { "labels": [ "area-Single-File" ], "mentionees": [ "agocke", "vitek-karas", "vsadov" ] }, { "labels": [ "area-System.Buffers" ], "mentionees": [ "dotnet/area-system-buffers" ] }, { "labels": [ "area-System.Numerics" ], "mentionees": [ "dotnet/area-system-numerics" ] }, { "labels": [ "area-System.Runtime.Intrinsics" ], "mentionees": [ "dotnet/area-system-runtime-intrinsics" ] }, { "labels": [ "area-System.Runtime.InteropServices" ], "mentionees": [ "dotnet/interop-contrib" ] }, { "labels": [ "area-System.CodeDom" ], "mentionees": [ "dotnet/area-system-codedom" ] }, { "labels": [ "area-System.Xml" ], "mentionees": [ "dotnet/area-system-xml" ] }, { "labels": [ "area-AssemblyLoader-coreclr" ], "mentionees": [ "vitek-karas", "agocke", "vsadov" ] }, { "labels": [ "area-System.Dynamic.Runtime" ], "mentionees": [ "cston" ] }, { "labels": [ "area-System.Linq.Expressions" ], "mentionees": [ "cston" ] }, { "labels": [ "area-Microsoft.CSharp" ], "mentionees": [ "cston" ] }, { "labels": [ "area-Microsoft.VisualBasic" ], "mentionees": [ "cston" ] }, { "labels": [ "area-Infrastructure-libraries" ], "mentionees": [ "dotnet/area-infrastructure-libraries" ] }, { "labels": [ "area-Infrastructure" ], "mentionees": [ "dotnet/runtime-infrastructure" ] }, { "labels": [ "area-GC-coreclr" ], "mentionees": [ "dotnet/gc" ] }, { "labels": [ "area-System.Net" ], "mentionees": [ "dotnet/ncl" ] }, { "labels": [ "area-System.Net.Http" ], "mentionees": [ "dotnet/ncl" ] }, { "labels": [ "area-System.Net.Security" ], "mentionees": [ "dotnet/ncl", "vcsjones" ] }, { "labels": [ "area-System.Net.Sockets" ], "mentionees": [ "dotnet/ncl" ] }, { "labels": [ "area-Diagnostics-coreclr" ], "mentionees": [ "tommcdon" ] }, { "labels": [ "area-System.Diagnostics" ], "mentionees": [ "tommcdon" ] }, { "labels": [ "area-System.Data" ], "mentionees": [ "roji", "ajcvickers" ] }, { "labels": [ "area-System.Data.OleDB" ], "mentionees": [ "roji", "ajcvickers" ] }, { "labels": [ "area-System.Data.Odbc" ], "mentionees": [ "roji", "ajcvickers" ] }, { "labels": [ "area-System.Data.SqlClient" ], "mentionees": [ "cheenamalhotra", "david-engel" ] }, { "labels": [ "area-System.ComponentModel.DataAnnotations" ], "mentionees": [ "ajcvickers", "bricelam", "roji" ] }, { "labels": [ "area-Extensions-FileSystem" ], "mentionees": [ "dotnet/area-extensions-filesystem" ] }, { "labels": [ "area-Extensions-HttpClientFactory" ], "mentionees": [ "dotnet/ncl" ] }, { "labels": [ "area-System.Net.Quic" ], "mentionees": [ "dotnet/ncl" ] }, { "labels": [ "area-System.Formats.Cbor" ], "mentionees": [ "dotnet/area-system-formats-cbor" ] }, { "labels": [ "area-System.Formats.Asn1" ], "mentionees": [ "dotnet/area-system-formats-asn1" ] }, { "labels": [ "area-Codegen-JIT-Mono" ], "mentionees": [ "SamMonoRT", "vargaz" ] }, { "labels": [ "area-CodeGen-LLVM-Mono" ], "mentionees": [ "SamMonoRT", "vargaz", "imhameed" ] }, { "labels": [ "area-CodeGen-meta-Mono" ], "mentionees": [ "SamMonoRT", "vargaz", "lambdageek" ] }, { "labels": [ "area-System.Text.Json" ], "mentionees": [ "dotnet/area-system-text-json" ] }, { "labels": [ "area-System.Memory" ], "mentionees": [ "dotnet/area-system-memory" ] }, { "labels": [ "area-Infrastructure-coreclr" ], "mentionees": [ "hoyosjs" ] }, { "labels": [ "area-System.IO" ], "mentionees": [ "dotnet/area-system-io" ] }, { "labels": [ "area-System.IO.Compression" ], "mentionees": [ "dotnet/area-system-io-compression" ] }, { "labels": [ "area-System.Diagnostics.Process" ], "mentionees": [ "dotnet/area-system-diagnostics-process" ] }, { "labels": [ "area-System.Console" ], "mentionees": [ "dotnet/area-system-console" ] }, { "labels": [ "area-System.Runtime" ], "mentionees": [ "dotnet/area-system-runtime" ] }, { "labels": [ "area-System.Threading" ], "mentionees": [ "mangod9" ] }, { "labels": [ "area-vm-coreclr" ], "mentionees": [ "mangod9" ] }, { "labels": [ "area-CodeGen-coreclr" ], "mentionees": [ "JulieLeeMSFT" ] }, { "labels": [ "area-ILTools-coreclr" ], "mentionees": [ "JulieLeeMSFT" ] }, { "labels": [ "area-ILVerification" ], "mentionees": [ "JulieLeeMSFT" ] }, { "labels": [ "area-System.DirectoryServices" ], "mentionees": [ "dotnet/area-system-directoryservices", "jay98014" ] }, { "labels": [ "area-System.Speech" ], "mentionees": [ "danmoseley" ] }, { "labels": [ "area-Meta" ], "mentionees": [ "dotnet/area-meta" ] }, { "labels": [ "area-DependencyModel" ], "mentionees": [ "dotnet/area-dependencymodel" ] }, { "labels": [ "area-Extensions-Caching" ], "mentionees": [ "dotnet/area-extensions-caching" ] }, { "labels": [ "area-Extensions-Configuration" ], "mentionees": [ "dotnet/area-extensions-configuration" ] }, { "labels": [ "area-Extensions-DependencyInjection" ], "mentionees": [ "dotnet/area-extensions-dependencyinjection" ] }, { "labels": [ "area-Extensions-Hosting" ], "mentionees": [ "dotnet/area-extensions-hosting" ] }, { "labels": [ "area-Extensions-Logging" ], "mentionees": [ "dotnet/area-extensions-logging" ] }, { "labels": [ "area-Extensions-Options" ], "mentionees": [ "dotnet/area-extensions-options" ] }, { "labels": [ "area-Extensions-Primitives" ], "mentionees": [ "dotnet/area-extensions-primitives" ] }, { "labels": [ "area-Microsoft.Extensions" ], "mentionees": [ "dotnet/area-microsoft-extensions" ] }, { "labels": [ "area-System.ComponentModel" ], "mentionees": [ "dotnet/area-system-componentmodel" ] }, { "labels": [ "area-System.ComponentModel.Composition" ], "mentionees": [ "dotnet/area-system-componentmodel-composition" ] }, { "labels": [ "area-System.Composition" ], "mentionees": [ "dotnet/area-system-composition" ] }, { "labels": [ "area-System.Diagnostics.Activity" ], "mentionees": [ "dotnet/area-system-diagnostics-activity" ] }, { "labels": [ "area-System.Globalization" ], "mentionees": [ "dotnet/area-system-globalization" ] }, { "labels": [ "area-Microsoft.Win32" ], "mentionees": [ "dotnet/area-microsoft-win32" ] }, { "labels": [ "area-System.Diagnostics.EventLog" ], "mentionees": [ "dotnet/area-system-diagnostics-eventlog" ] }, { "labels": [ "area-System.Diagnostics.PerformanceCounter" ], "mentionees": [ "dotnet/area-system-diagnostics-performancecounter" ] }, { "labels": [ "area-System.Diagnostics.TraceSource" ], "mentionees": [ "dotnet/area-system-diagnostics-tracesource" ] }, { "labels": [ "area-System.Drawing" ], "mentionees": [ "dotnet/area-system-drawing" ] }, { "labels": [ "area-System.Management" ], "mentionees": [ "dotnet/area-system-management" ] }, { "labels": [ "area-System.ServiceProcess" ], "mentionees": [ "dotnet/area-system-serviceprocess" ] }, { "labels": [ "area-System.Configuration" ], "mentionees": [ "dotnet/area-system-configuration" ] }, { "labels": [ "area-System.Reflection" ], "mentionees": [ "dotnet/area-system-reflection" ] }, { "labels": [ "area-System.Reflection.Emit" ], "mentionees": [ "dotnet/area-system-reflection-emit" ] }, { "labels": [ "area-System.Reflection.Metadata" ], "mentionees": [ "dotnet/area-system-reflection-metadata" ] }, { "labels": [ "area-System.Resources" ], "mentionees": [ "dotnet/area-system-resources" ] }, { "labels": [ "area-System.Runtime.CompilerServices" ], "mentionees": [ "dotnet/area-system-runtime-compilerservices" ] } ], "replyTemplate": "Tagging subscribers to this area: ${mentionees}\nSee info in [area-owners.md](https://github.com/dotnet/runtime/blob/main/docs/area-owners.md) if you want to be subscribed.", "enableForPullRequests": true }, "disabled": false }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "labelAdded", "parameters": { "label": "breaking-change" } }, { "operator": "and", "operands": [ { "name": "", "parameters": {} } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "actions": [ { "name": "addLabel", "parameters": { "label": "needs-breaking-change-doc-created" } }, { "name": "addReply", "parameters": { "comment": "Added `needs-breaking-change-doc-created` label because this issue has the `breaking-change` label. \n\n1. [ ] Create and link to this issue a matching issue in the dotnet/docs repo using the [breaking change documentation template](https://github.com/dotnet/docs/issues/new?assignees=gewarren&labels=breaking-change%2CPri1%2Cdoc-idea&template=breaking-change.yml&title=%5BBreaking+change%5D%3A+), then remove this `needs-breaking-change-doc-created` label.\n\nTagging @dotnet/compat for awareness of the breaking change." } } ], "taskName": "Add breaking change doc label to issue" }, "disabled": false }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "labelAdded", "parameters": { "label": "breaking-change" } } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "actions": [ { "name": "addLabel", "parameters": { "label": "needs-breaking-change-doc-created" } }, { "name": "addReply", "parameters": { "comment": "Added `needs-breaking-change-doc-created` label because this PR has the `breaking-change` label. \n\nWhen you commit this breaking change:\n\n1. [ ] Create and link to this PR and the issue a matching issue in the dotnet/docs repo using the [breaking change documentation template](https://github.com/dotnet/docs/issues/new?assignees=gewarren&labels=breaking-change%2CPri1%2Cdoc-idea&template=breaking-change.yml&title=%5BBreaking+change%5D%3A+), then remove this `needs-breaking-change-doc-created` label.\n2. [ ] Ask a committer to mail the `.NET Breaking Change Notification` DL.\n\nTagging @dotnet/compat for awareness of the breaking change." } } ], "taskName": "Add breaking change doc label to PR" }, "disabled": false }, { "taskType": "scheduled", "capabilityId": "ScheduledSearch", "subCapability": "ScheduledSearch", "version": "1.1", "config": { "frequency": [ { "weekDay": 0, "hours": [ 1, 7, 13, 19 ], "timezoneOffset": 0 }, { "weekDay": 1, "hours": [ 1, 7, 13, 19 ], "timezoneOffset": 0 }, { "weekDay": 2, "hours": [ 1, 7, 13, 19 ], "timezoneOffset": 0 }, { "weekDay": 3, "hours": [ 1, 7, 13, 19 ], "timezoneOffset": 0 }, { "weekDay": 4, "hours": [ 1, 7, 13, 19 ], "timezoneOffset": 0 }, { "weekDay": 5, "hours": [ 1, 7, 13, 19 ], "timezoneOffset": 0 }, { "weekDay": 6, "hours": [ 1, 7, 13, 19 ], "timezoneOffset": 0 } ], "searchTerms": [ { "name": "isClosed", "parameters": {} }, { "name": "noActivitySince", "parameters": { "days": 30 } }, { "name": "isUnlocked", "parameters": {} } ], "actions": [ { "name": "lockIssue", "parameters": { "reason": "resolved", "label": "will_lock_this" } } ], "taskName": "Lock stale issues and PR's" } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssueCommentResponder", "version": "1.0", "config": { "taskName": "Replace `needs-author-action` label with `needs-further-triage` label when the author comments on an issue", "conditions": { "operator": "and", "operands": [ { "name": "isAction", "parameters": { "action": "created" } }, { "name": "isActivitySender", "parameters": { "user": { "type": "author" } } }, { "name": "hasLabel", "parameters": { "label": "needs-author-action" } }, { "name": "isOpen", "parameters": {} } ] }, "actions": [ { "name": "addLabel", "parameters": { "label": "needs-further-triage" } }, { "name": "removeLabel", "parameters": { "label": "needs-author-action" } } ], "eventType": "issue", "eventNames": [ "issue_comment" ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "taskName": "Remove `no-recent-activity` label from issues when issue is modified", "conditions": { "operator": "and", "operands": [ { "operator": "not", "operands": [ { "name": "isAction", "parameters": { "action": "closed" } } ] }, { "name": "hasLabel", "parameters": { "label": "no-recent-activity" } }, { "operator": "not", "operands": [ { "name": "labelAdded", "parameters": { "label": "no-recent-activity" } } ] } ] }, "actions": [ { "name": "removeLabel", "parameters": { "label": "no-recent-activity" } } ], "eventType": "issue", "eventNames": [ "issues", "project_card" ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssueCommentResponder", "version": "1.0", "config": { "taskName": "Remove `no-recent-activity` label when an issue is commented on", "conditions": { "operator": "and", "operands": [ { "name": "hasLabel", "parameters": { "label": "no-recent-activity" } } ] }, "actions": [ { "name": "removeLabel", "parameters": { "label": "no-recent-activity" } } ], "eventType": "issue", "eventNames": [ "issue_comment" ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isOpen", "parameters": {} }, { "name": "hasLabel", "parameters": { "label": "no-recent-activity" } }, { "operator": "not", "operands": [ { "name": "labelAdded", "parameters": { "label": "no-recent-activity" } } ] } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "Remove `no-recent-activity` label from PRs when modified", "actions": [ { "name": "removeLabel", "parameters": { "label": "no-recent-activity" } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestCommentResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "hasLabel", "parameters": { "label": "no-recent-activity" } }, { "name": "isOpen", "parameters": {} } ] }, "eventType": "pull_request", "eventNames": [ "issue_comment" ], "taskName": "Remove `no-recent-activity` label from PRs when commented on", "actions": [ { "name": "removeLabel", "parameters": { "label": "no-recent-activity" } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestReviewResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "hasLabel", "parameters": { "label": "no-recent-activity" } }, { "name": "isOpen", "parameters": {} } ] }, "eventType": "pull_request", "eventNames": [ "pull_request_review" ], "taskName": "Remove `no-recent-activity` label from PRs when new review is added", "actions": [ { "name": "removeLabel", "parameters": { "label": "no-recent-activity" } } ] } }, { "taskType": "scheduled", "capabilityId": "ScheduledSearch", "subCapability": "ScheduledSearch", "version": "1.1", "config": { "taskName": "Close issues with no recent activity", "frequency": [ { "weekDay": 0, "hours": [ 0, 6, 12, 18 ], "timezoneOffset": 0 }, { "weekDay": 1, "hours": [ 0, 6, 12, 18 ], "timezoneOffset": 0 }, { "weekDay": 2, "hours": [ 0, 6, 12, 18 ], "timezoneOffset": 0 }, { "weekDay": 3, "hours": [ 0, 6, 12, 18 ], "timezoneOffset": 0 }, { "weekDay": 4, "hours": [ 0, 6, 12, 18 ], "timezoneOffset": 0 }, { "weekDay": 5, "hours": [ 0, 6, 12, 18 ], "timezoneOffset": 0 }, { "weekDay": 6, "hours": [ 0, 6, 12, 18 ], "timezoneOffset": 0 } ], "searchTerms": [ { "name": "isIssue", "parameters": {} }, { "name": "isOpen", "parameters": {} }, { "name": "hasLabel", "parameters": { "label": "no-recent-activity" } }, { "name": "noActivitySince", "parameters": { "days": 14 } } ], "actions": [ { "name": "addReply", "parameters": { "comment": "This issue will now be closed since it had been marked `no-recent-activity` but received no further activity in the past 14 days. It is still possible to reopen or comment on the issue, but please note that the issue will be locked if it remains inactive for another 30 days." } }, { "name": "closeIssue", "parameters": {} } ] } }, { "taskType": "scheduled", "capabilityId": "ScheduledSearch", "subCapability": "ScheduledSearch", "version": "1.1", "config": { "taskName": "Close PRs with no-recent-activity", "frequency": [ { "weekDay": 0, "hours": [ 0, 6, 12, 18 ], "timezoneOffset": 0 }, { "weekDay": 1, "hours": [ 0, 6, 12, 18 ], "timezoneOffset": 0 }, { "weekDay": 2, "hours": [ 0, 6, 12, 18 ], "timezoneOffset": 0 }, { "weekDay": 3, "hours": [ 0, 6, 12, 18 ], "timezoneOffset": 0 }, { "weekDay": 4, "hours": [ 0, 6, 12, 18 ], "timezoneOffset": 0 }, { "weekDay": 5, "hours": [ 0, 6, 12, 18 ], "timezoneOffset": 0 }, { "weekDay": 6, "hours": [ 0, 6, 12, 18 ], "timezoneOffset": 0 } ], "searchTerms": [ { "name": "isPr", "parameters": {} }, { "name": "isOpen", "parameters": {} }, { "name": "hasLabel", "parameters": { "label": "no-recent-activity" } }, { "name": "noActivitySince", "parameters": { "days": 14 } } ], "actions": [ { "name": "addReply", "parameters": { "comment": "This pull request will now be closed since it had been marked `no-recent-activity` but received no further activity in the past 14 days. It is still possible to reopen or comment on the pull request, but please note that it will be locked if it remains inactive for another 30 days." } }, { "name": "closeIssue", "parameters": {} } ] } }, { "taskType": "scheduled", "capabilityId": "ScheduledSearch", "subCapability": "ScheduledSearch", "version": "1.1", "config": { "taskName": "Add no-recent-activity label to issues", "frequency": [ { "weekDay": 0, "hours": [ 4, 10, 16, 22 ], "timezoneOffset": 1 }, { "weekDay": 1, "hours": [ 4, 10, 16, 22 ], "timezoneOffset": 1 }, { "weekDay": 2, "hours": [ 4, 10, 16, 22 ], "timezoneOffset": 1 }, { "weekDay": 3, "hours": [ 4, 10, 16, 22 ], "timezoneOffset": 1 }, { "weekDay": 4, "hours": [ 4, 10, 16, 22 ], "timezoneOffset": 1 }, { "weekDay": 5, "hours": [ 4, 10, 16, 22 ], "timezoneOffset": 1 }, { "weekDay": 6, "hours": [ 4, 10, 16, 22 ], "timezoneOffset": 1 } ], "searchTerms": [ { "name": "isIssue", "parameters": {} }, { "name": "isOpen", "parameters": {} }, { "name": "hasLabel", "parameters": { "label": "needs-author-action" } }, { "name": "noActivitySince", "parameters": { "days": 14 } }, { "name": "noLabel", "parameters": { "label": "no-recent-activity" } } ], "actions": [ { "name": "addLabel", "parameters": { "label": "no-recent-activity" } }, { "name": "addReply", "parameters": { "comment": "This issue has been automatically marked `no-recent-activity` because it has not had any activity for 14 days. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will remove `no-recent-activity`." } } ] }, "disabled": false }, { "taskType": "scheduled", "capabilityId": "ScheduledSearch", "subCapability": "ScheduledSearch", "version": "1.1", "config": { "taskName": "Add no-recent-activity label to PRs", "frequency": [ { "weekDay": 0, "hours": [ 4, 10, 16, 22 ], "timezoneOffset": 1 }, { "weekDay": 1, "hours": [ 4, 10, 16, 22 ], "timezoneOffset": 1 }, { "weekDay": 2, "hours": [ 4, 10, 16, 22 ], "timezoneOffset": 1 }, { "weekDay": 3, "hours": [ 4, 10, 16, 22 ], "timezoneOffset": 1 }, { "weekDay": 4, "hours": [ 4, 10, 16, 22 ], "timezoneOffset": 1 }, { "weekDay": 5, "hours": [ 4, 10, 16, 22 ], "timezoneOffset": 1 }, { "weekDay": 6, "hours": [ 4, 10, 16, 22 ], "timezoneOffset": 1 } ], "searchTerms": [ { "name": "isPr", "parameters": {} }, { "name": "isOpen", "parameters": {} }, { "name": "hasLabel", "parameters": { "label": "needs-author-action" } }, { "name": "noActivitySince", "parameters": { "days": 14 } }, { "name": "noLabel", "parameters": { "label": "no-recent-activity" } } ], "actions": [ { "name": "addLabel", "parameters": { "label": "no-recent-activity" } }, { "name": "addReply", "parameters": { "comment": "This pull request has been automatically marked `no-recent-activity` because it has not had any activity for 14 days. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will remove `no-recent-activity`." } } ] }, "disabled": false }, { "taskType": "trigger", "capabilityId": "InPrLabel", "subCapability": "InPrLabel", "version": "1.0", "config": { "taskName": "Add 'In-PR' label on issue when an open pull request is targeting it", "inPrLabelText": "Status: In PR", "fixedLabelText": "Status: Fixed", "fixedLabelEnabled": false, "label_inPr": "in-pr" } }, { "taskType": "scheduledAndTrigger", "capabilityId": "IssueRouting", "subCapability": "@Mention", "version": "1.0", "config": { "taskName": "@Mention for linkable-framework", "labelsAndMentions": [ { "labels": [ "linkable-framework" ], "mentionees": [ "eerhardt", "vitek-karas", "LakshanF", "sbomer", "joperezr" ] } ], "replyTemplate": "Tagging subscribers to 'linkable-framework': ${mentionees}\nSee info in area-owners.md if you want to be subscribed.", "enableForPullRequests": true } }, { "taskType": "scheduledAndTrigger", "capabilityId": "IssueRouting", "subCapability": "@Mention", "version": "1.0", "config": { "taskName": "@Mention for size-reduction", "replyTemplate": "Tagging subscribers to 'size-reduction': ${mentionees}\nSee info in area-owners.md if you want to be subscribed.", "labelsAndMentions": [ { "labels": [ "size-reduction" ], "mentionees": [ "eerhardt", "SamMonoRT", "marek-safar" ] } ], "enableForPullRequests": true } }, { "taskType": "scheduledAndTrigger", "capabilityId": "IssueRouting", "subCapability": "@Mention", "version": "1.0", "config": { "taskName": "@Mention for wasm", "labelsAndMentions": [ { "labels": [ "arch-wasm" ], "mentionees": [ "lewing" ] } ], "replyTemplate": "Tagging subscribers to 'arch-wasm': ${mentionees}\nSee info in area-owners.md if you want to be subscribed.", "enableForPullRequests": true } }, { "taskType": "scheduledAndTrigger", "capabilityId": "IssueRouting", "subCapability": "@Mention", "version": "1.0", "config": { "taskName": "@Mention for ios", "labelsAndMentions": [ { "labels": [ "os-ios" ], "mentionees": [ "steveisok", "akoeplinger" ] } ], "enableForPullRequests": true, "replyTemplate": "Tagging subscribers to 'os-ios': ${mentionees}\nSee info in area-owners.md if you want to be subscribed." } }, { "taskType": "scheduledAndTrigger", "capabilityId": "IssueRouting", "subCapability": "@Mention", "version": "1.0", "config": { "taskName": "@Mention for android", "labelsAndMentions": [ { "labels": [ "os-android" ], "mentionees": [ "steveisok", "akoeplinger" ] } ], "enableForPullRequests": true, "replyTemplate": "Tagging subscribers to 'arch-android': ${mentionees}\nSee info in area-owners.md if you want to be subscribed." } }, { "taskType": "scheduled", "capabilityId": "ScheduledSearch", "subCapability": "ScheduledSearch", "version": "1.1", "config": { "frequency": [ { "weekDay": 0, "hours": [ 5, 11, 17, 23 ], "timezoneOffset": 0 }, { "weekDay": 1, "hours": [ 5, 11, 17, 23 ], "timezoneOffset": 0 }, { "weekDay": 2, "hours": [ 5, 11, 17, 23 ], "timezoneOffset": 0 }, { "weekDay": 3, "hours": [ 5, 11, 17, 23 ], "timezoneOffset": 0 }, { "weekDay": 4, "hours": [ 5, 11, 17, 23 ], "timezoneOffset": 0 }, { "weekDay": 5, "hours": [ 5, 11, 17, 23 ], "timezoneOffset": 0 }, { "weekDay": 6, "hours": [ 5, 11, 17, 23 ], "timezoneOffset": 0 } ], "searchTerms": [ { "name": "isDraftPr", "parameters": { "value": "true" } }, { "name": "isOpen", "parameters": {} }, { "name": "noActivitySince", "parameters": { "days": 30 } } ], "taskName": "Close inactive Draft PRs", "actions": [ { "name": "closeIssue", "parameters": {} }, { "name": "addReply", "parameters": { "comment": "Draft Pull Request was automatically closed for inactivity. Please [let us know](https://github.com/dotnet/runtime/blob/main/docs/area-owners.md) if you'd like to reopen it." } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "prMatchesPattern", "parameters": { "matchRegex": ".*ILLink.*" } }, { "name": "prMatchesPattern", "parameters": { "matchRegex": ".*illink.*" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "linkable-framework" } } ] }, { "name": "isOpen", "parameters": {} } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "[Linkable-framework workgroup] Add linkable-framework label to new Prs that touch files with *ILLink* that not have it already", "actions": [ { "name": "addLabel", "parameters": { "label": "linkable-framework" } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "prMatchesPattern", "parameters": { "matchRegex": ".*ILLink.*" } }, { "name": "prMatchesPattern", "parameters": { "matchRegex": ".*illink.*" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "linkable-framework" } } ] }, { "name": "isOpen", "parameters": {} }, { "name": "isAction", "parameters": { "action": "synchronize" } } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "[Linkable-framework workgroup] Add linkable-framework label to Prs that get changes pushed where they touch *ILLInk* files", "actions": [ { "name": "addLabel", "parameters": { "label": "linkable-framework" } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isActivitySender", "parameters": { "user": "dotnet-maestro[bot]" } }, { "name": "isAction", "parameters": { "action": "opened" } }, { "name": "titleContains", "parameters": { "titlePattern": "dotnet-optimization" } } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "Auto-approve maestro PRs", "actions": [ { "name": "approvePullRequest", "parameters": { "comment": "Auto-approve dotnet-optimization PR" } } ] }, "disabled": true }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isAction", "parameters": { "action": "opened" } }, { "operator": "and", "operands": [ { "operator": "not", "operands": [ { "name": "activitySenderHasPermissions", "parameters": { "association": "OWNER", "permissions": "admin" } } ] }, { "operator": "not", "operands": [ { "name": "activitySenderHasPermissions", "parameters": { "association": "MEMBER", "permissions": "write" } } ] }, { "operator": "not", "operands": [ { "name": "isActivitySender", "parameters": { "user": "github-actions[bot]" } } ] }, { "operator": "not", "operands": [ { "name": "isActivitySender", "parameters": { "user": "dotnet-maestro[bot]" } } ] }, { "operator": "not", "operands": [ { "name": "isActivitySender", "parameters": { "user": "dotnet-maestro-bot[bot]" } } ] }, { "operator": "not", "operands": [ { "name": "isActivitySender", "parameters": { "user": "dotnet-maestro-bot" } } ] }, { "operator": "not", "operands": [ { "name": "isActivitySender", "parameters": { "user": "dotnet-maestro" } } ] }, { "operator": "not", "operands": [ { "name": "isActivitySender", "parameters": { "user": "github-actions" } } ] } ] } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "Label community PRs", "actions": [ { "name": "addLabel", "parameters": { "label": "community-contribution" } } ] }, "disabled": false }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isAction", "parameters": { "action": "opened" } }, { "operator": "or", "operands": [ { "name": "activitySenderHasPermissions", "parameters": { "association": "OWNER", "permissions": "admin" } }, { "name": "activitySenderHasPermissions", "parameters": { "association": "MEMBER", "permissions": "write" } } ] } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "Assign Team PRs to author", "actions": [ { "name": "assignToUser", "parameters": { "label": "community-contribution", "user": { "type": "prAuthor" } } } ] }, "disabled": false }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": ".NET Core Diagnostics ", "isOrgProject": true } } ] }, { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics" } }, { "name": "hasLabel", "parameters": { "label": "area-Diagnostics-coreclr" } }, { "name": "hasLabel", "parameters": { "label": "area-Tracing-coreclr" } } ] }, { "name": "isInMilestone", "parameters": { "milestoneName": "6.0.0" } }, { "operator": "and", "operands": [ { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "User Story" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "enhancement" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "feature request" } } ] } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[hoyosjs/tommcdon] Add diagnostics 6.0 issues to project", "actions": [ { "name": "addToProject", "parameters": { "projectName": ".NET Core Diagnostics", "columnName": "6.0.0", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "labelAdded", "parameters": { "label": "backlog-cleanup-candidate" } } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "Manual Issue Cleanup", "actions": [ { "name": "addReply", "parameters": { "comment": "Due to lack of recent activity, this issue has been marked as a candidate for backlog cleanup. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will undo this process.\n\nThis process is part of the experimental [issue cleanup initiative](https://github.com/dotnet/runtime/issues/60288) we are currently trialing. Please share any feedback you might have in the linked issue." } }, { "name": "addLabel", "parameters": { "label": "no-recent-activity" } } ] } }, { "taskType": "scheduled", "capabilityId": "ScheduledSearch", "subCapability": "ScheduledSearch", "version": "1.1", "config": { "frequency": [ { "weekDay": 0, "hours": [ 0, 6, 12, 18 ], "timezoneOffset": 0 }, { "weekDay": 1, "hours": [ 0, 6, 12, 18 ], "timezoneOffset": 0 }, { "weekDay": 2, "hours": [ 0, 6, 12, 18 ], "timezoneOffset": 0 }, { "weekDay": 3, "hours": [ 0, 6, 12, 18 ], "timezoneOffset": 0 }, { "weekDay": 4, "hours": [ 0, 6, 12, 18 ], "timezoneOffset": 0 }, { "weekDay": 5, "hours": [ 0, 6, 12, 18 ], "timezoneOffset": 0 }, { "weekDay": 6, "hours": [ 0, 6, 12, 18 ], "timezoneOffset": 0 } ], "searchTerms": [ { "name": "noActivitySince", "parameters": { "days": 1827 } }, { "name": "isIssue", "parameters": {} }, { "name": "isOpen", "parameters": {} }, { "name": "noLabel", "parameters": { "label": "backlog-cleanup-candidate" } } ], "taskName": "Automated Issue cleanup", "actions": [ { "name": "addLabel", "parameters": { "label": "backlog-cleanup-candidate" } }, { "name": "addReply", "parameters": { "comment": "Due to lack of recent activity, this issue has been marked as a candidate for backlog cleanup. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will undo this process.\n\nThis process is part of the experimental [issue cleanup initiative](https://github.com/dotnet/runtime/issues/60288) we are currently trialing. Please share any feedback you might have in the linked issue." } }, { "name": "addLabel", "parameters": { "label": "no-recent-activity" } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "labelAdded", "parameters": { "label": "needs-author-action" } } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "Needs-author-action notification", "actions": [ { "name": "addReply", "parameters": { "comment": "This issue has been marked `needs-author-action` since it may be missing important information. Please refer to our [contribution guidelines](https://github.com/dotnet/runtime/blob/main/CONTRIBUTING.md#writing-a-good-bug-report) for tips on how to report issues effectively." } } ] } }, { "taskType": "scheduledAndTrigger", "capabilityId": "IssueRouting", "subCapability": "@Mention", "version": "1.0", "config": { "taskName": "@Mention for tvos", "labelsAndMentions": [ { "labels": [ "os-tvos" ], "mentionees": [ "steveisok", "akoeplinger" ] } ], "enableForPullRequests": true, "replyTemplate": "Tagging subscribers to 'os-tvos': ${mentionees}\nSee info in area-owners.md if you want to be subscribed." } }, { "taskType": "scheduledAndTrigger", "capabilityId": "IssueRouting", "subCapability": "@Mention", "version": "1.0", "config": { "labelsAndMentions": [ { "labels": [ "os-maccatalyst" ], "mentionees": [ "steveisok", "akoeplinger" ] } ], "replyTemplate": "Tagging subscribers to 'os-maccatalyst': ${mentionees}\nSee info in area-owners.md if you want to be subscribed.", "enableForPullRequests": true, "taskName": "@Mention for maccatalyst" } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestReviewResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "activitySenderHasPermissions", "parameters": { "state": "changes_requested", "permissions": "write" } }, { "name": "isAction", "parameters": { "action": "submitted" } }, { "name": "isReviewState", "parameters": { "state": "changes_requested" } } ] }, "eventType": "pull_request", "eventNames": [ "pull_request_review" ], "taskName": "PR reviews with \"changes requested\" applies the needs-author-action label", "actions": [ { "name": "addLabel", "parameters": { "label": "needs-author-action" } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isAction", "parameters": { "action": "synchronize" } }, { "name": "hasLabel", "parameters": { "label": "needs-author-action" } } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "Pushing changes to PR branch removes the needs-author-action label", "actions": [ { "name": "removeLabel", "parameters": { "label": "needs-author-action" } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestCommentResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isActivitySender", "parameters": { "user": { "type": "author" } } }, { "name": "isAction", "parameters": { "action": "created" } }, { "name": "hasLabel", "parameters": { "label": "needs-author-action" } }, { "name": "isOpen", "parameters": {} } ] }, "eventType": "pull_request", "eventNames": [ "issue_comment" ], "taskName": "Author commenting in PR removes the needs-author-action label", "actions": [ { "name": "removeLabel", "parameters": { "label": "needs-author-action" } } ] }, "disabled": false }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestReviewResponder", "version": "1.0", "config": { "taskName": "Author responding to a pull request review comment removes the needs-author-action label", "conditions": { "operator": "and", "operands": [ { "name": "isActivitySender", "parameters": { "user": { "type": "author" } } }, { "name": "hasLabel", "parameters": { "label": "needs-author-action" } }, { "name": "isAction", "parameters": { "action": "submitted" } }, { "name": "isOpen", "parameters": {} } ] }, "actions": [ { "name": "removeLabel", "parameters": { "label": "needs-author-action" } } ], "eventType": "pull_request", "eventNames": [ "pull_request_review" ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Meta" } } ] }, { "operator": "or", "operands": [ { "name": "isAction", "parameters": { "action": "reopened" } }, { "operator": "not", "operands": [ { "name": "isInMilestone", "parameters": {} } ] } ] } ] }, { "operator": "or", "operands": [ { "name": "labelAdded", "parameters": { "label": "area-Meta" } } ] } ] }, { "name": "isOpen", "parameters": {} }, { "operator": "or", "operands": [ { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Eric / Jeff - Issue Triage", "isOrgProject": true } } ] }, { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Eric / Jeff - Issue Triage", "isOrgProject": true, "columnName": "Triaged" } } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Eric / Jeff - Issue Triage] Add new issue to Board", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Eric / Jeff - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssueCommentResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Meta" } } ] }, { "operator": "not", "operands": [ { "name": "isCloseAndComment", "parameters": {} } ] }, { "operator": "not", "operands": [ { "name": "activitySenderHasPermissions", "parameters": { "permissions": "write" } } ] }, { "operator": "or", "operands": [ { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Eric / Jeff - Issue Triage", "isOrgProject": true } } ] }, { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Eric / Jeff - Issue Triage", "columnName": "Triaged", "isOrgProject": true } } ] } ] }, "eventType": "issue", "eventNames": [ "issue_comment" ], "taskName": "[Area Pod: Eric / Jeff - Issue Triage] Needs Further Triage", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Eric / Jeff - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Eric / Jeff - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } }, { "operator": "and", "operands": [ { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Meta" } } ] } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Eric / Jeff - Issue Triage] Remove relabeled issues", "actions": [ { "name": "removeFromProject", "parameters": { "projectName": "Area Pod: Eric / Jeff - Issue Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Eric / Jeff - Issue Triage", "isOrgProject": true } }, { "operator": "not", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Eric / Jeff - Issue Triage", "columnName": "Triaged" } } ] }, { "operator": "or", "operands": [ { "name": "addedToMilestone", "parameters": {} }, { "name": "labelAdded", "parameters": { "label": "needs-author-action" } }, { "name": "labelAdded", "parameters": { "label": "api-ready-for-review" } }, { "name": "isAction", "parameters": { "action": "closed" } } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Eric / Jeff - Issue Triage] Move to Triaged Column", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Eric / Jeff - Issue Triage", "columnName": "Triaged", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Meta" } } ] }, { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Eric / Jeff - PRs", "isOrgProject": true } } ] } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "[Area Pod: Eric / Jeff - PRs] Add new PR to Board", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Eric / Jeff - PRs", "columnName": "Needs Champion", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Eric / Jeff - PRs", "columnName": "Needs Champion", "isOrgProject": true } }, { "operator": "and", "operands": [ { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Meta" } } ] } ] } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "[Area Pod: Eric / Jeff - PRs] Remove relabeled PRs", "actions": [ { "name": "removeFromProject", "parameters": { "projectName": "Area Pod: Eric / Jeff - PRs", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.CodeDom" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Configuration" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Reflection" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Reflection.Emit" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Reflection.Metadata" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Resources" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Runtime.CompilerServices" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Text.RegularExpressions" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Threading.Channels" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Threading.Tasks" } }, { "name": "hasLabel", "parameters": { "label": "area-System.DirectoryServices" } } ] }, { "operator": "or", "operands": [ { "name": "isAction", "parameters": { "action": "reopened" } }, { "operator": "not", "operands": [ { "name": "isInMilestone", "parameters": {} } ] } ] } ] }, { "operator": "or", "operands": [ { "name": "labelAdded", "parameters": { "label": "area-System.CodeDom" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Configuration" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Reflection" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Reflection.Emit" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Reflection.Metadata" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Resources" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Runtime.CompilerServices" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Text.RegularExpressions" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Threading.Channels" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Threading.Tasks" } }, { "name": "labelAdded", "parameters": { "label": "area-System.DirectoryServices" } } ] } ] }, { "name": "isOpen", "parameters": {} }, { "operator": "or", "operands": [ { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Buyaa / Jose / Steve - Issue Triage", "isOrgProject": true } } ] }, { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Buyaa / Jose / Steve - Issue Triage", "isOrgProject": true, "columnName": "Triaged" } } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Buyaa / Jose / Steve - Issue Triage] Add new issue to Board", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Buyaa / Jose / Steve - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssueCommentResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.CodeDom" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Configuration" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Reflection" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Reflection.Emit" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Reflection.Metadata" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Resources" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Runtime.CompilerServices" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Text.RegularExpressions" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Threading.Channels" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Threading.Tasks" } }, { "name": "hasLabel", "parameters": { "label": "area-System.DirectoryServices" } } ] }, { "operator": "not", "operands": [ { "name": "isCloseAndComment", "parameters": {} } ] }, { "operator": "not", "operands": [ { "name": "activitySenderHasPermissions", "parameters": { "permissions": "write" } } ] }, { "operator": "or", "operands": [ { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Buyaa / Jose / Steve - Issue Triage", "isOrgProject": true } } ] }, { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Buyaa / Jose / Steve - Issue Triage", "columnName": "Triaged", "isOrgProject": true } } ] } ] }, "eventType": "issue", "eventNames": [ "issue_comment" ], "taskName": "[Area Pod: Buyaa / Jose / Steve - Issue Triage] Needs Further Triage", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Buyaa / Jose / Steve - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Buyaa / Jose / Steve - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } }, { "operator": "and", "operands": [ { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.CodeDom" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Configuration" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Reflection" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Reflection.Emit" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Reflection.Metadata" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Resources" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Runtime.CompilerServices" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Text.RegularExpressions" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Threading.Channels" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Threading.Tasks" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.DirectoryServices" } } ] } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Buyaa / Jose / Steve - Issue Triage] Remove relabeled issues", "actions": [ { "name": "removeFromProject", "parameters": { "projectName": "Area Pod: Buyaa / Jose / Steve - Issue Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Buyaa / Jose / Steve - Issue Triage", "isOrgProject": true } }, { "operator": "not", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Buyaa / Jose / Steve - Issue Triage", "columnName": "Triaged" } } ] }, { "operator": "or", "operands": [ { "name": "addedToMilestone", "parameters": {} }, { "name": "labelAdded", "parameters": { "label": "needs-author-action" } }, { "name": "labelAdded", "parameters": { "label": "api-ready-for-review" } }, { "name": "isAction", "parameters": { "action": "closed" } } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Buyaa / Jose / Steve - Issue Triage] Move to Triaged Column", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Buyaa / Jose / Steve - Issue Triage", "columnName": "Triaged", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.CodeDom" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Configuration" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Reflection" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Reflection.Emit" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Reflection.Metadata" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Resources" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Runtime.CompilerServices" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Text.RegularExpressions" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Threading.Channels" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Threading.Tasks" } }, { "name": "hasLabel", "parameters": { "label": "area-System.DirectoryServices" } } ] }, { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Buyaa / Jose / Steve - PRs", "isOrgProject": true } } ] } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "[Area Pod: Buyaa / Jose / Steve - PRs] Add new PR to Board", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Buyaa / Jose / Steve - PRs", "columnName": "Needs Champion", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Buyaa / Jose / Steve - PRs", "columnName": "Needs Champion", "isOrgProject": true } }, { "operator": "and", "operands": [ { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.CodeDom" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Configuration" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Reflection" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Reflection.Emit" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Reflection.Metadata" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Resources" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Runtime.CompilerServices" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Text.RegularExpressions" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Threading.Channels" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Threading.Tasks" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.DirectoryServices" } } ] } ] } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "[Area Pod: Buyaa / Jose / Steve - PRs] Remove relabeled PRs", "actions": [ { "name": "removeFromProject", "parameters": { "projectName": "Area Pod: Buyaa / Jose / Steve - PRs", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Collections" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Linq" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Text.Json" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Xml" } } ] }, { "operator": "or", "operands": [ { "name": "isAction", "parameters": { "action": "reopened" } }, { "operator": "not", "operands": [ { "name": "isInMilestone", "parameters": {} } ] } ] } ] }, { "operator": "or", "operands": [ { "name": "labelAdded", "parameters": { "label": "area-System.Collections" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Linq" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Text.Json" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Xml" } } ] } ] }, { "name": "isOpen", "parameters": {} }, { "operator": "or", "operands": [ { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Eirik / Krzysztof / Layomi - Issue Triage", "isOrgProject": true } } ] }, { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Eirik / Krzysztof / Layomi - Issue Triage", "isOrgProject": true, "columnName": "Triaged" } } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Eirik / Krzysztof / Layomi - Issue Triage] Add new issue to Board", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Eirik / Krzysztof / Layomi - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssueCommentResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Collections" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Linq" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Text.Json" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Xml" } } ] }, { "operator": "not", "operands": [ { "name": "isCloseAndComment", "parameters": {} } ] }, { "operator": "not", "operands": [ { "name": "activitySenderHasPermissions", "parameters": { "permissions": "write" } } ] }, { "operator": "or", "operands": [ { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Eirik / Krzysztof / Layomi - Issue Triage", "isOrgProject": true } } ] }, { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Eirik / Krzysztof / Layomi - Issue Triage", "columnName": "Triaged", "isOrgProject": true } } ] } ] }, "eventType": "issue", "eventNames": [ "issue_comment" ], "taskName": "[Area Pod: Eirik / Krzysztof / Layomi - Issue Triage] Needs Further Triage", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Eirik / Krzysztof / Layomi - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Eirik / Krzysztof / Layomi - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } }, { "operator": "and", "operands": [ { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Collections" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Linq" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Text.Json" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Xml" } } ] } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Eirik / Krzysztof / Layomi - Issue Triage] Remove relabeled issues", "actions": [ { "name": "removeFromProject", "parameters": { "projectName": "Area Pod: Eirik / Krzysztof / Layomi - Issue Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Eirik / Krzysztof / Layomi - Issue Triage", "isOrgProject": true } }, { "operator": "not", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Eirik / Krzysztof / Layomi - Issue Triage", "columnName": "Triaged" } } ] }, { "operator": "or", "operands": [ { "name": "addedToMilestone", "parameters": {} }, { "name": "labelAdded", "parameters": { "label": "needs-author-action" } }, { "name": "labelAdded", "parameters": { "label": "api-ready-for-review" } }, { "name": "isAction", "parameters": { "action": "closed" } } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Eirik / Krzysztof / Layomi - Issue Triage] Move to Triaged Column", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Eirik / Krzysztof / Layomi - Issue Triage", "columnName": "Triaged", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Collections" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Linq" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Text.Json" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Xml" } } ] }, { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Eirik / Krzysztof / Layomi - PRs", "isOrgProject": true } } ] } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "[Area Pod: Eirik / Krzysztof / Layomi - PRs] Add new PR to Board", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Eirik / Krzysztof / Layomi - PRs", "columnName": "Needs Champion", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Eirik / Krzysztof / Layomi - PRs", "columnName": "Needs Champion", "isOrgProject": true } }, { "operator": "and", "operands": [ { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Collections" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Linq" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Text.Json" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Xml" } } ] } ] } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "[Area Pod: Eirik / Krzysztof / Layomi - PRs] Remove relabeled PRs", "actions": [ { "name": "removeFromProject", "parameters": { "projectName": "Area Pod: Eirik / Krzysztof / Layomi - PRs", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-DependencyModel" } }, { "name": "hasLabel", "parameters": { "label": "area-Extensions-Caching" } }, { "name": "hasLabel", "parameters": { "label": "area-Extensions-Configuration" } }, { "name": "hasLabel", "parameters": { "label": "area-Extensions-DependencyInjection" } }, { "name": "hasLabel", "parameters": { "label": "area-Extensions-Hosting" } }, { "name": "hasLabel", "parameters": { "label": "area-Extensions-Logging" } }, { "name": "hasLabel", "parameters": { "label": "area-Extensions-Options" } }, { "name": "hasLabel", "parameters": { "label": "area-Extensions-Primitives" } }, { "name": "hasLabel", "parameters": { "label": "area-System.ComponentModel" } }, { "name": "hasLabel", "parameters": { "label": "area-System.ComponentModel.Composition" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Composition" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.Activity" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Globalization" } } ] }, { "operator": "or", "operands": [ { "name": "isAction", "parameters": { "action": "reopened" } }, { "operator": "not", "operands": [ { "name": "isInMilestone", "parameters": {} } ] } ] } ] }, { "operator": "or", "operands": [ { "name": "labelAdded", "parameters": { "label": "area-DependencyModel" } }, { "name": "labelAdded", "parameters": { "label": "area-Extensions-Caching" } }, { "name": "labelAdded", "parameters": { "label": "area-Extensions-Configuration" } }, { "name": "labelAdded", "parameters": { "label": "area-Extensions-DependencyInjection" } }, { "name": "labelAdded", "parameters": { "label": "area-Extensions-Hosting" } }, { "name": "labelAdded", "parameters": { "label": "area-Extensions-Logging" } }, { "name": "labelAdded", "parameters": { "label": "area-Extensions-Options" } }, { "name": "labelAdded", "parameters": { "label": "area-Extensions-Primitives" } }, { "name": "labelAdded", "parameters": { "label": "area-System.ComponentModel" } }, { "name": "labelAdded", "parameters": { "label": "area-System.ComponentModel.Composition" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Composition" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Diagnostics.Activity" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Globalization" } } ] } ] }, { "name": "isOpen", "parameters": {} }, { "operator": "or", "operands": [ { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Eric / Maryam / Tarek - Issue Triage", "isOrgProject": true } } ] }, { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Eric / Maryam / Tarek - Issue Triage", "isOrgProject": true, "columnName": "Triaged" } } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Eric / Maryam / Tarek - Issue Triage] Add new issue to Board", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Eric / Maryam / Tarek - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssueCommentResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-DependencyModel" } }, { "name": "hasLabel", "parameters": { "label": "area-Extensions-Caching" } }, { "name": "hasLabel", "parameters": { "label": "area-Extensions-Configuration" } }, { "name": "hasLabel", "parameters": { "label": "area-Extensions-DependencyInjection" } }, { "name": "hasLabel", "parameters": { "label": "area-Extensions-Hosting" } }, { "name": "hasLabel", "parameters": { "label": "area-Extensions-Logging" } }, { "name": "hasLabel", "parameters": { "label": "area-Extensions-Options" } }, { "name": "hasLabel", "parameters": { "label": "area-Extensions-Primitives" } }, { "name": "hasLabel", "parameters": { "label": "area-System.ComponentModel" } }, { "name": "hasLabel", "parameters": { "label": "area-System.ComponentModel.Composition" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Composition" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.Activity" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Globalization" } } ] }, { "operator": "not", "operands": [ { "name": "isCloseAndComment", "parameters": {} } ] }, { "operator": "not", "operands": [ { "name": "activitySenderHasPermissions", "parameters": { "permissions": "write" } } ] }, { "operator": "or", "operands": [ { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Eric / Maryam / Tarek - Issue Triage", "isOrgProject": true } } ] }, { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Eric / Maryam / Tarek - Issue Triage", "columnName": "Triaged", "isOrgProject": true } } ] } ] }, "eventType": "issue", "eventNames": [ "issue_comment" ], "taskName": "[Area Pod: Eric / Maryam / Tarek - Issue Triage] Needs Further Triage", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Eric / Maryam / Tarek - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Eric / Maryam / Tarek - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } }, { "operator": "and", "operands": [ { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-DependencyModel" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Extensions-Caching" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Extensions-Configuration" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Extensions-DependencyInjection" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Extensions-Hosting" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Extensions-Logging" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Extensions-Options" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Extensions-Primitives" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.ComponentModel" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.ComponentModel.Composition" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Composition" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.Activity" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Globalization" } } ] } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Eric / Maryam / Tarek - Issue Triage] Remove relabeled issues", "actions": [ { "name": "removeFromProject", "parameters": { "projectName": "Area Pod: Eric / Maryam / Tarek - Issue Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Eric / Maryam / Tarek - Issue Triage", "isOrgProject": true } }, { "operator": "not", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Eric / Maryam / Tarek - Issue Triage", "columnName": "Triaged" } } ] }, { "operator": "or", "operands": [ { "name": "addedToMilestone", "parameters": {} }, { "name": "labelAdded", "parameters": { "label": "needs-author-action" } }, { "name": "labelAdded", "parameters": { "label": "api-ready-for-review" } }, { "name": "isAction", "parameters": { "action": "closed" } } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Eric / Maryam / Tarek - Issue Triage] Move to Triaged Column", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Eric / Maryam / Tarek - Issue Triage", "columnName": "Triaged", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-DependencyModel" } }, { "name": "hasLabel", "parameters": { "label": "area-Extensions-Caching" } }, { "name": "hasLabel", "parameters": { "label": "area-Extensions-Configuration" } }, { "name": "hasLabel", "parameters": { "label": "area-Extensions-DependencyInjection" } }, { "name": "hasLabel", "parameters": { "label": "area-Extensions-Hosting" } }, { "name": "hasLabel", "parameters": { "label": "area-Extensions-Logging" } }, { "name": "hasLabel", "parameters": { "label": "area-Extensions-Options" } }, { "name": "hasLabel", "parameters": { "label": "area-Extensions-Primitives" } }, { "name": "hasLabel", "parameters": { "label": "area-System.ComponentModel" } }, { "name": "hasLabel", "parameters": { "label": "area-System.ComponentModel.Composition" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Composition" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.Activity" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Globalization" } } ] }, { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Eric / Maryam / Tarek - PRs", "isOrgProject": true } } ] } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "[Area Pod: Eric / Maryam / Tarek - PRs] Add new PR to Board", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Eric / Maryam / Tarek - PRs", "columnName": "Needs Champion", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Eric / Maryam / Tarek - PRs", "columnName": "Needs Champion", "isOrgProject": true } }, { "operator": "and", "operands": [ { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-DependencyModel" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Extensions-Caching" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Extensions-Configuration" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Extensions-DependencyInjection" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Extensions-Hosting" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Extensions-Logging" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Extensions-Options" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Extensions-Primitives" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.ComponentModel" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.ComponentModel.Composition" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Composition" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.Activity" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Globalization" } } ] } ] } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "[Area Pod: Eric / Maryam / Tarek - PRs] Remove relabeled PRs", "actions": [ { "name": "removeFromProject", "parameters": { "projectName": "Area Pod: Eric / Maryam / Tarek - PRs", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Infrastructure-libraries" } }, { "name": "hasLabel", "parameters": { "label": "area-Microsoft.Win32" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.EventLog" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.PerformanceCounter" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.TraceSource" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Drawing" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Management" } }, { "name": "hasLabel", "parameters": { "label": "area-System.ServiceProcess" } } ] }, { "operator": "or", "operands": [ { "name": "isAction", "parameters": { "action": "reopened" } }, { "operator": "not", "operands": [ { "name": "isInMilestone", "parameters": {} } ] } ] } ] }, { "operator": "or", "operands": [ { "name": "labelAdded", "parameters": { "label": "area-Infrastructure-libraries" } }, { "name": "labelAdded", "parameters": { "label": "area-Microsoft.Win32" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Diagnostics.EventLog" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Diagnostics.PerformanceCounter" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Diagnostics.TraceSource" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Drawing" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Management" } }, { "name": "labelAdded", "parameters": { "label": "area-System.ServiceProcess" } } ] } ] }, { "name": "isOpen", "parameters": {} }, { "operator": "or", "operands": [ { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Carlos / Jeremy - Issue Triage", "isOrgProject": true } } ] }, { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Carlos / Jeremy - Issue Triage", "isOrgProject": true, "columnName": "Triaged" } } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Carlos / Jeremy - Issue Triage] Add new issue to Board", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Carlos / Jeremy - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssueCommentResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Infrastructure-libraries" } }, { "name": "hasLabel", "parameters": { "label": "area-Microsoft.Win32" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.EventLog" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.PerformanceCounter" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.TraceSource" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Drawing" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Management" } }, { "name": "hasLabel", "parameters": { "label": "area-System.ServiceProcess" } } ] }, { "operator": "not", "operands": [ { "name": "isCloseAndComment", "parameters": {} } ] }, { "operator": "not", "operands": [ { "name": "activitySenderHasPermissions", "parameters": { "permissions": "write" } } ] }, { "operator": "or", "operands": [ { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Carlos / Jeremy - Issue Triage", "isOrgProject": true } } ] }, { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Carlos / Jeremy - Issue Triage", "columnName": "Triaged", "isOrgProject": true } } ] } ] }, "eventType": "issue", "eventNames": [ "issue_comment" ], "taskName": "[Area Pod: Carlos / Jeremy - Issue Triage] Needs Further Triage", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Carlos / Jeremy - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Carlos / Jeremy - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } }, { "operator": "and", "operands": [ { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Infrastructure-libraries" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Microsoft.Win32" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.EventLog" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.PerformanceCounter" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.TraceSource" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Drawing" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Management" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.ServiceProcess" } } ] } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Carlos / Jeremy - Issue Triage] Remove relabeled issues", "actions": [ { "name": "removeFromProject", "parameters": { "projectName": "Area Pod: Carlos / Jeremy - Issue Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Carlos / Jeremy - Issue Triage", "isOrgProject": true } }, { "operator": "not", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Carlos / Jeremy - Issue Triage", "columnName": "Triaged" } } ] }, { "operator": "or", "operands": [ { "name": "addedToMilestone", "parameters": {} }, { "name": "labelAdded", "parameters": { "label": "needs-author-action" } }, { "name": "labelAdded", "parameters": { "label": "api-ready-for-review" } }, { "name": "isAction", "parameters": { "action": "closed" } } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Carlos / Jeremy - Issue Triage] Move to Triaged Column", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Carlos / Jeremy - Issue Triage", "columnName": "Triaged", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Infrastructure-libraries" } }, { "name": "hasLabel", "parameters": { "label": "area-Microsoft.Win32" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.EventLog" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.PerformanceCounter" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.TraceSource" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Drawing" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Management" } }, { "name": "hasLabel", "parameters": { "label": "area-System.ServiceProcess" } } ] }, { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Carlos / Jeremy - PRs", "isOrgProject": true } } ] } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "[Area Pod: Carlos / Jeremy - PRs] Add new PR to Board", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Carlos / Jeremy - PRs", "columnName": "Needs Champion", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Carlos / Jeremy - PRs", "columnName": "Needs Champion", "isOrgProject": true } }, { "operator": "and", "operands": [ { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Infrastructure-libraries" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Microsoft.Win32" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.EventLog" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.PerformanceCounter" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.TraceSource" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Drawing" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Management" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.ServiceProcess" } } ] } ] } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "[Area Pod: Carlos / Jeremy - PRs] Remove relabeled PRs", "actions": [ { "name": "removeFromProject", "parameters": { "projectName": "Area Pod: Carlos / Jeremy - PRs", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Extensions-FileSystem" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Console" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.Process" } }, { "name": "hasLabel", "parameters": { "label": "area-System.IO" } }, { "name": "hasLabel", "parameters": { "label": "area-System.IO.Compression" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Linq.Parallel" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Memory" } } ] }, { "operator": "or", "operands": [ { "name": "isAction", "parameters": { "action": "reopened" } }, { "operator": "not", "operands": [ { "name": "isInMilestone", "parameters": {} } ] } ] } ] }, { "operator": "or", "operands": [ { "name": "labelAdded", "parameters": { "label": "area-Extensions-FileSystem" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Console" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Diagnostics.Process" } }, { "name": "labelAdded", "parameters": { "label": "area-System.IO" } }, { "name": "labelAdded", "parameters": { "label": "area-System.IO.Compression" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Linq.Parallel" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Memory" } } ] } ] }, { "name": "isOpen", "parameters": {} }, { "operator": "or", "operands": [ { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Adam / David - Issue Triage", "isOrgProject": true } } ] }, { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Adam / David - Issue Triage", "isOrgProject": true, "columnName": "Triaged" } } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Adam / David - Issue Triage] Add new issue to Board", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Adam / David - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssueCommentResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Extensions-FileSystem" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Console" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.Process" } }, { "name": "hasLabel", "parameters": { "label": "area-System.IO" } }, { "name": "hasLabel", "parameters": { "label": "area-System.IO.Compression" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Linq.Parallel" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Memory" } } ] }, { "operator": "not", "operands": [ { "name": "isCloseAndComment", "parameters": {} } ] }, { "operator": "not", "operands": [ { "name": "activitySenderHasPermissions", "parameters": { "permissions": "write" } } ] }, { "operator": "or", "operands": [ { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Adam / David - Issue Triage", "isOrgProject": true } } ] }, { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Adam / David - Issue Triage", "columnName": "Triaged", "isOrgProject": true } } ] } ] }, "eventType": "issue", "eventNames": [ "issue_comment" ], "taskName": "[Area Pod: Adam / David - Issue Triage] Needs Further Triage", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Adam / David - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Adam / David - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } }, { "operator": "and", "operands": [ { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Extensions-FileSystem" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Console" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.Process" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.IO" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.IO.Compression" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Linq.Parallel" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Memory" } } ] } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Adam / David - Issue Triage] Remove relabeled issues", "actions": [ { "name": "removeFromProject", "parameters": { "projectName": "Area Pod: Adam / David - Issue Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Adam / David - Issue Triage", "isOrgProject": true } }, { "operator": "not", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Adam / David - Issue Triage", "columnName": "Triaged" } } ] }, { "operator": "or", "operands": [ { "name": "addedToMilestone", "parameters": {} }, { "name": "labelAdded", "parameters": { "label": "needs-author-action" } }, { "name": "labelAdded", "parameters": { "label": "api-ready-for-review" } }, { "name": "isAction", "parameters": { "action": "closed" } } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Adam / David - Issue Triage] Move to Triaged Column", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Adam / David - Issue Triage", "columnName": "Triaged", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Extensions-FileSystem" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Console" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.Process" } }, { "name": "hasLabel", "parameters": { "label": "area-System.IO" } }, { "name": "hasLabel", "parameters": { "label": "area-System.IO.Compression" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Linq.Parallel" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Memory" } } ] }, { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Adam / David - PRs", "isOrgProject": true } } ] } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "[Area Pod: Adam / David - PRs] Add new PR to Board", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Adam / David - PRs", "columnName": "Needs Champion", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Adam / David - PRs", "columnName": "Needs Champion", "isOrgProject": true } }, { "operator": "and", "operands": [ { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Extensions-FileSystem" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Console" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.Process" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.IO" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.IO.Compression" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Linq.Parallel" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Memory" } } ] } ] } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "[Area Pod: Adam / David - PRs] Remove relabeled PRs", "actions": [ { "name": "removeFromProject", "parameters": { "projectName": "Area Pod: Adam / David - PRs", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Buffers" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Numerics" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Numerics.Tensors" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Runtime" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Runtime.Intrinsics" } } ] }, { "operator": "or", "operands": [ { "name": "isAction", "parameters": { "action": "reopened" } }, { "operator": "not", "operands": [ { "name": "isInMilestone", "parameters": {} } ] } ] } ] }, { "operator": "or", "operands": [ { "name": "labelAdded", "parameters": { "label": "area-System.Buffers" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Numerics" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Numerics.Tensors" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Runtime" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Runtime.Intrinsics" } } ] } ] }, { "name": "isOpen", "parameters": {} }, { "operator": "or", "operands": [ { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Michael / Tanner - Issue Triage", "isOrgProject": true } } ] }, { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Michael / Tanner - Issue Triage", "isOrgProject": true, "columnName": "Triaged" } } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Michael / Tanner - Issue Triage] Add new issue to Board", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Michael / Tanner - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssueCommentResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Buffers" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Numerics" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Numerics.Tensors" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Runtime" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Runtime.Intrinsics" } } ] }, { "operator": "not", "operands": [ { "name": "isCloseAndComment", "parameters": {} } ] }, { "operator": "not", "operands": [ { "name": "activitySenderHasPermissions", "parameters": { "permissions": "write" } } ] }, { "operator": "or", "operands": [ { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Michael / Tanner - Issue Triage", "isOrgProject": true } } ] }, { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Michael / Tanner - Issue Triage", "columnName": "Triaged", "isOrgProject": true } } ] } ] }, "eventType": "issue", "eventNames": [ "issue_comment" ], "taskName": "[Area Pod: Michael / Tanner - Issue Triage] Needs Further Triage", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Michael / Tanner - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Michael / Tanner - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } }, { "operator": "and", "operands": [ { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Buffers" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Numerics" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Numerics.Tensors" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Runtime" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Runtime.Intrinsics" } } ] } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Michael / Tanner - Issue Triage] Remove relabeled issues", "actions": [ { "name": "removeFromProject", "parameters": { "projectName": "Area Pod: Michael / Tanner - Issue Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Michael / Tanner - Issue Triage", "isOrgProject": true } }, { "operator": "not", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Michael / Tanner - Issue Triage", "columnName": "Triaged" } } ] }, { "operator": "or", "operands": [ { "name": "addedToMilestone", "parameters": {} }, { "name": "labelAdded", "parameters": { "label": "needs-author-action" } }, { "name": "labelAdded", "parameters": { "label": "api-ready-for-review" } }, { "name": "isAction", "parameters": { "action": "closed" } } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Michael / Tanner - Issue Triage] Move to Triaged Column", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Michael / Tanner - Issue Triage", "columnName": "Triaged", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Buffers" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Numerics" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Numerics.Tensors" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Runtime" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Runtime.Intrinsics" } } ] }, { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Michael / Tanner - PRs", "isOrgProject": true } } ] } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "[Area Pod: Michael / Tanner - PRs] Add new PR to Board", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Michael / Tanner - PRs", "columnName": "Needs Champion", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Michael / Tanner - PRs", "columnName": "Needs Champion", "isOrgProject": true } }, { "operator": "and", "operands": [ { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Buffers" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Numerics" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Numerics.Tensors" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Runtime" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Runtime.Intrinsics" } } ] } ] } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "[Area Pod: Michael / Tanner - PRs] Remove relabeled PRs", "actions": [ { "name": "removeFromProject", "parameters": { "projectName": "Area Pod: Michael / Tanner - PRs", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Formats.Asn1" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Formats.Cbor" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Security" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Text.Encoding" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Text.Encodings.Web" } } ] }, { "operator": "or", "operands": [ { "name": "isAction", "parameters": { "action": "reopened" } }, { "operator": "not", "operands": [ { "name": "isInMilestone", "parameters": {} } ] } ] } ] }, { "operator": "or", "operands": [ { "name": "labelAdded", "parameters": { "label": "area-System.Formats.Asn1" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Formats.Cbor" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Security" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Text.Encoding" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Text.Encodings.Web" } } ] } ] }, { "name": "isOpen", "parameters": {} }, { "operator": "or", "operands": [ { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Jeremy / Levi - Issue Triage", "isOrgProject": true } } ] }, { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Jeremy / Levi - Issue Triage", "isOrgProject": true, "columnName": "Triaged" } } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Jeremy / Levi - Issue Triage] Add new issue to Board", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Jeremy / Levi - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssueCommentResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Formats.Asn1" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Formats.Cbor" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Security" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Text.Encoding" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Text.Encodings.Web" } } ] }, { "operator": "not", "operands": [ { "name": "isCloseAndComment", "parameters": {} } ] }, { "operator": "not", "operands": [ { "name": "activitySenderHasPermissions", "parameters": { "permissions": "write" } } ] }, { "operator": "or", "operands": [ { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Jeremy / Levi - Issue Triage", "isOrgProject": true } } ] }, { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Jeremy / Levi - Issue Triage", "columnName": "Triaged", "isOrgProject": true } } ] } ] }, "eventType": "issue", "eventNames": [ "issue_comment" ], "taskName": "[Area Pod: Jeremy / Levi - Issue Triage] Needs Further Triage", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Jeremy / Levi - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Jeremy / Levi - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } }, { "operator": "and", "operands": [ { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Formats.Asn1" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Formats.Cbor" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Security" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Text.Encoding" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Text.Encodings.Web" } } ] } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Jeremy / Levi - Issue Triage] Remove relabeled issues", "actions": [ { "name": "removeFromProject", "parameters": { "projectName": "Area Pod: Jeremy / Levi - Issue Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Jeremy / Levi - Issue Triage", "isOrgProject": true } }, { "operator": "not", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Jeremy / Levi - Issue Triage", "columnName": "Triaged" } } ] }, { "operator": "or", "operands": [ { "name": "addedToMilestone", "parameters": {} }, { "name": "labelAdded", "parameters": { "label": "needs-author-action" } }, { "name": "labelAdded", "parameters": { "label": "api-ready-for-review" } }, { "name": "isAction", "parameters": { "action": "closed" } } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Jeremy / Levi - Issue Triage] Move to Triaged Column", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Jeremy / Levi - Issue Triage", "columnName": "Triaged", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Formats.Asn1" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Formats.Cbor" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Security" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Text.Encoding" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Text.Encodings.Web" } } ] }, { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Jeremy / Levi - PRs", "isOrgProject": true } } ] } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "[Area Pod: Jeremy / Levi - PRs] Add new PR to Board", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Jeremy / Levi - PRs", "columnName": "Needs Champion", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Jeremy / Levi - PRs", "columnName": "Needs Champion", "isOrgProject": true } }, { "operator": "and", "operands": [ { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Formats.Asn1" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Formats.Cbor" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Security" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Text.Encoding" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Text.Encodings.Web" } } ] } ] } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "[Area Pod: Jeremy / Levi - PRs] Remove relabeled PRs", "actions": [ { "name": "removeFromProject", "parameters": { "projectName": "Area Pod: Jeremy / Levi - PRs", "isOrgProject": true } } ] } } ]
[ { "taskType": "scheduledAndTrigger", "capabilityId": "IssueRouting", "subCapability": "@Mention", "version": "1.0", "config": { "taskName": "Area-owners", "labelsAndMentions": [ { "labels": [ "area-System.Security" ], "mentionees": [ "dotnet/area-system-security", "vcsjones" ] }, { "labels": [ "area-System.Diagnostics.Tracing" ], "mentionees": [ "tarekgh", "tommcdon", "pjanotti" ] }, { "labels": [ "area-System.Linq.Parallel" ], "mentionees": [ "dotnet/area-system-linq-parallel" ] }, { "labels": [ "area-System.Text.Encoding" ], "mentionees": [ "dotnet/area-system-text-encoding" ] }, { "labels": [ "area-System.Text.Encodings.Web" ], "mentionees": [ "dotnet/area-system-text-encodings-web" ] }, { "labels": [ "area-System.Threading.Channels" ], "mentionees": [ "dotnet/area-system-threading-channels" ] }, { "labels": [ "area-System.Threading.Tasks" ], "mentionees": [ "dotnet/area-system-threading-tasks" ] }, { "labels": [ "area-System.Text.RegularExpressions" ], "mentionees": [ "dotnet/area-system-text-regularexpressions" ] }, { "labels": [ "area-GC-mono" ], "mentionees": [ "brzvlad" ] }, { "labels": [ "area-Codegen-Interpreter-mono" ], "mentionees": [ "brzvlad" ] }, { "labels": [ "area-Infrastructure-mono" ], "mentionees": [ "directhex" ] }, { "labels": [ "area-AssemblyLoader-mono" ], "mentionees": [] }, { "labels": [ "area-Debugger-mono" ], "mentionees": [ "thaystg" ] }, { "labels": [ "area-System.Collections" ], "mentionees": [ "dotnet/area-system-collections" ] }, { "labels": [ "area-System.Linq" ], "mentionees": [ "dotnet/area-system-linq" ] }, { "labels": [ "area-System.Numerics.Tensors" ], "mentionees": [ "dotnet/area-system-numerics-tensors" ] }, { "labels": [ "area-Host" ], "mentionees": [ "vitek-karas", "agocke", "vsadov" ] }, { "labels": [ "area-HostModel" ], "mentionees": [ "vitek-karas", "agocke" ] }, { "labels": [ "area-Single-File" ], "mentionees": [ "agocke", "vitek-karas", "vsadov" ] }, { "labels": [ "area-System.Buffers" ], "mentionees": [ "dotnet/area-system-buffers" ] }, { "labels": [ "area-System.Numerics" ], "mentionees": [ "dotnet/area-system-numerics" ] }, { "labels": [ "area-System.Runtime.Intrinsics" ], "mentionees": [ "dotnet/area-system-runtime-intrinsics" ] }, { "labels": [ "area-System.Runtime.InteropServices" ], "mentionees": [ "dotnet/interop-contrib" ] }, { "labels": [ "area-System.CodeDom" ], "mentionees": [ "dotnet/area-system-codedom" ] }, { "labels": [ "area-System.Xml" ], "mentionees": [ "dotnet/area-system-xml" ] }, { "labels": [ "area-AssemblyLoader-coreclr" ], "mentionees": [ "vitek-karas", "agocke", "vsadov" ] }, { "labels": [ "area-System.Dynamic.Runtime" ], "mentionees": [ "cston" ] }, { "labels": [ "area-System.Linq.Expressions" ], "mentionees": [ "cston" ] }, { "labels": [ "area-Microsoft.CSharp" ], "mentionees": [ "cston" ] }, { "labels": [ "area-Microsoft.VisualBasic" ], "mentionees": [ "cston" ] }, { "labels": [ "area-Infrastructure-libraries" ], "mentionees": [ "dotnet/area-infrastructure-libraries" ] }, { "labels": [ "area-Infrastructure" ], "mentionees": [ "dotnet/runtime-infrastructure" ] }, { "labels": [ "area-GC-coreclr" ], "mentionees": [ "dotnet/gc" ] }, { "labels": [ "area-System.Net" ], "mentionees": [ "dotnet/ncl" ] }, { "labels": [ "area-System.Net.Http" ], "mentionees": [ "dotnet/ncl" ] }, { "labels": [ "area-System.Net.Security" ], "mentionees": [ "dotnet/ncl", "vcsjones" ] }, { "labels": [ "area-System.Net.Sockets" ], "mentionees": [ "dotnet/ncl" ] }, { "labels": [ "area-Diagnostics-coreclr" ], "mentionees": [ "tommcdon" ] }, { "labels": [ "area-System.Diagnostics" ], "mentionees": [ "tommcdon" ] }, { "labels": [ "area-System.Data" ], "mentionees": [ "roji", "ajcvickers" ] }, { "labels": [ "area-System.Data.OleDB" ], "mentionees": [ "roji", "ajcvickers" ] }, { "labels": [ "area-System.Data.Odbc" ], "mentionees": [ "roji", "ajcvickers" ] }, { "labels": [ "area-System.Data.SqlClient" ], "mentionees": [ "cheenamalhotra", "david-engel" ] }, { "labels": [ "area-System.ComponentModel.DataAnnotations" ], "mentionees": [ "ajcvickers", "bricelam", "roji" ] }, { "labels": [ "area-Extensions-FileSystem" ], "mentionees": [ "dotnet/area-extensions-filesystem" ] }, { "labels": [ "area-Extensions-HttpClientFactory" ], "mentionees": [ "dotnet/ncl" ] }, { "labels": [ "area-System.Net.Quic" ], "mentionees": [ "dotnet/ncl" ] }, { "labels": [ "area-System.Formats.Cbor" ], "mentionees": [ "dotnet/area-system-formats-cbor" ] }, { "labels": [ "area-System.Formats.Asn1" ], "mentionees": [ "dotnet/area-system-formats-asn1" ] }, { "labels": [ "area-Codegen-JIT-Mono" ], "mentionees": [ "SamMonoRT", "vargaz" ] }, { "labels": [ "area-CodeGen-LLVM-Mono" ], "mentionees": [ "SamMonoRT", "vargaz" ] }, { "labels": [ "area-CodeGen-meta-Mono" ], "mentionees": [ "SamMonoRT", "vargaz", "lambdageek" ] }, { "labels": [ "area-System.Text.Json" ], "mentionees": [ "dotnet/area-system-text-json" ] }, { "labels": [ "area-System.Memory" ], "mentionees": [ "dotnet/area-system-memory" ] }, { "labels": [ "area-Infrastructure-coreclr" ], "mentionees": [ "hoyosjs" ] }, { "labels": [ "area-System.IO" ], "mentionees": [ "dotnet/area-system-io" ] }, { "labels": [ "area-System.IO.Compression" ], "mentionees": [ "dotnet/area-system-io-compression" ] }, { "labels": [ "area-System.Diagnostics.Process" ], "mentionees": [ "dotnet/area-system-diagnostics-process" ] }, { "labels": [ "area-System.Console" ], "mentionees": [ "dotnet/area-system-console" ] }, { "labels": [ "area-System.Runtime" ], "mentionees": [ "dotnet/area-system-runtime" ] }, { "labels": [ "area-System.Threading" ], "mentionees": [ "mangod9" ] }, { "labels": [ "area-vm-coreclr" ], "mentionees": [ "mangod9" ] }, { "labels": [ "area-CodeGen-coreclr" ], "mentionees": [ "JulieLeeMSFT" ] }, { "labels": [ "area-ILTools-coreclr" ], "mentionees": [ "JulieLeeMSFT" ] }, { "labels": [ "area-ILVerification" ], "mentionees": [ "JulieLeeMSFT" ] }, { "labels": [ "area-System.DirectoryServices" ], "mentionees": [ "dotnet/area-system-directoryservices", "jay98014" ] }, { "labels": [ "area-System.Speech" ], "mentionees": [ "danmoseley" ] }, { "labels": [ "area-Meta" ], "mentionees": [ "dotnet/area-meta" ] }, { "labels": [ "area-DependencyModel" ], "mentionees": [ "dotnet/area-dependencymodel" ] }, { "labels": [ "area-Extensions-Caching" ], "mentionees": [ "dotnet/area-extensions-caching" ] }, { "labels": [ "area-Extensions-Configuration" ], "mentionees": [ "dotnet/area-extensions-configuration" ] }, { "labels": [ "area-Extensions-DependencyInjection" ], "mentionees": [ "dotnet/area-extensions-dependencyinjection" ] }, { "labels": [ "area-Extensions-Hosting" ], "mentionees": [ "dotnet/area-extensions-hosting" ] }, { "labels": [ "area-Extensions-Logging" ], "mentionees": [ "dotnet/area-extensions-logging" ] }, { "labels": [ "area-Extensions-Options" ], "mentionees": [ "dotnet/area-extensions-options" ] }, { "labels": [ "area-Extensions-Primitives" ], "mentionees": [ "dotnet/area-extensions-primitives" ] }, { "labels": [ "area-Microsoft.Extensions" ], "mentionees": [ "dotnet/area-microsoft-extensions" ] }, { "labels": [ "area-System.ComponentModel" ], "mentionees": [ "dotnet/area-system-componentmodel" ] }, { "labels": [ "area-System.ComponentModel.Composition" ], "mentionees": [ "dotnet/area-system-componentmodel-composition" ] }, { "labels": [ "area-System.Composition" ], "mentionees": [ "dotnet/area-system-composition" ] }, { "labels": [ "area-System.Diagnostics.Activity" ], "mentionees": [ "dotnet/area-system-diagnostics-activity" ] }, { "labels": [ "area-System.Globalization" ], "mentionees": [ "dotnet/area-system-globalization" ] }, { "labels": [ "area-Microsoft.Win32" ], "mentionees": [ "dotnet/area-microsoft-win32" ] }, { "labels": [ "area-System.Diagnostics.EventLog" ], "mentionees": [ "dotnet/area-system-diagnostics-eventlog" ] }, { "labels": [ "area-System.Diagnostics.PerformanceCounter" ], "mentionees": [ "dotnet/area-system-diagnostics-performancecounter" ] }, { "labels": [ "area-System.Diagnostics.TraceSource" ], "mentionees": [ "dotnet/area-system-diagnostics-tracesource" ] }, { "labels": [ "area-System.Drawing" ], "mentionees": [ "dotnet/area-system-drawing" ] }, { "labels": [ "area-System.Management" ], "mentionees": [ "dotnet/area-system-management" ] }, { "labels": [ "area-System.ServiceProcess" ], "mentionees": [ "dotnet/area-system-serviceprocess" ] }, { "labels": [ "area-System.Configuration" ], "mentionees": [ "dotnet/area-system-configuration" ] }, { "labels": [ "area-System.Reflection" ], "mentionees": [ "dotnet/area-system-reflection" ] }, { "labels": [ "area-System.Reflection.Emit" ], "mentionees": [ "dotnet/area-system-reflection-emit" ] }, { "labels": [ "area-System.Reflection.Metadata" ], "mentionees": [ "dotnet/area-system-reflection-metadata" ] }, { "labels": [ "area-System.Resources" ], "mentionees": [ "dotnet/area-system-resources" ] }, { "labels": [ "area-System.Runtime.CompilerServices" ], "mentionees": [ "dotnet/area-system-runtime-compilerservices" ] } ], "replyTemplate": "Tagging subscribers to this area: ${mentionees}\nSee info in [area-owners.md](https://github.com/dotnet/runtime/blob/main/docs/area-owners.md) if you want to be subscribed.", "enableForPullRequests": true }, "disabled": false }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "labelAdded", "parameters": { "label": "breaking-change" } }, { "operator": "and", "operands": [ { "name": "", "parameters": {} } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "actions": [ { "name": "addLabel", "parameters": { "label": "needs-breaking-change-doc-created" } }, { "name": "addReply", "parameters": { "comment": "Added `needs-breaking-change-doc-created` label because this issue has the `breaking-change` label. \n\n1. [ ] Create and link to this issue a matching issue in the dotnet/docs repo using the [breaking change documentation template](https://github.com/dotnet/docs/issues/new?assignees=gewarren&labels=breaking-change%2CPri1%2Cdoc-idea&template=breaking-change.yml&title=%5BBreaking+change%5D%3A+), then remove this `needs-breaking-change-doc-created` label.\n\nTagging @dotnet/compat for awareness of the breaking change." } } ], "taskName": "Add breaking change doc label to issue" }, "disabled": false }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "labelAdded", "parameters": { "label": "breaking-change" } } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "actions": [ { "name": "addLabel", "parameters": { "label": "needs-breaking-change-doc-created" } }, { "name": "addReply", "parameters": { "comment": "Added `needs-breaking-change-doc-created` label because this PR has the `breaking-change` label. \n\nWhen you commit this breaking change:\n\n1. [ ] Create and link to this PR and the issue a matching issue in the dotnet/docs repo using the [breaking change documentation template](https://github.com/dotnet/docs/issues/new?assignees=gewarren&labels=breaking-change%2CPri1%2Cdoc-idea&template=breaking-change.yml&title=%5BBreaking+change%5D%3A+), then remove this `needs-breaking-change-doc-created` label.\n2. [ ] Ask a committer to mail the `.NET Breaking Change Notification` DL.\n\nTagging @dotnet/compat for awareness of the breaking change." } } ], "taskName": "Add breaking change doc label to PR" }, "disabled": false }, { "taskType": "scheduled", "capabilityId": "ScheduledSearch", "subCapability": "ScheduledSearch", "version": "1.1", "config": { "frequency": [ { "weekDay": 0, "hours": [ 1, 7, 13, 19 ], "timezoneOffset": 0 }, { "weekDay": 1, "hours": [ 1, 7, 13, 19 ], "timezoneOffset": 0 }, { "weekDay": 2, "hours": [ 1, 7, 13, 19 ], "timezoneOffset": 0 }, { "weekDay": 3, "hours": [ 1, 7, 13, 19 ], "timezoneOffset": 0 }, { "weekDay": 4, "hours": [ 1, 7, 13, 19 ], "timezoneOffset": 0 }, { "weekDay": 5, "hours": [ 1, 7, 13, 19 ], "timezoneOffset": 0 }, { "weekDay": 6, "hours": [ 1, 7, 13, 19 ], "timezoneOffset": 0 } ], "searchTerms": [ { "name": "isClosed", "parameters": {} }, { "name": "noActivitySince", "parameters": { "days": 30 } }, { "name": "isUnlocked", "parameters": {} } ], "actions": [ { "name": "lockIssue", "parameters": { "reason": "resolved", "label": "will_lock_this" } } ], "taskName": "Lock stale issues and PR's" } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssueCommentResponder", "version": "1.0", "config": { "taskName": "Replace `needs-author-action` label with `needs-further-triage` label when the author comments on an issue", "conditions": { "operator": "and", "operands": [ { "name": "isAction", "parameters": { "action": "created" } }, { "name": "isActivitySender", "parameters": { "user": { "type": "author" } } }, { "name": "hasLabel", "parameters": { "label": "needs-author-action" } }, { "name": "isOpen", "parameters": {} } ] }, "actions": [ { "name": "addLabel", "parameters": { "label": "needs-further-triage" } }, { "name": "removeLabel", "parameters": { "label": "needs-author-action" } } ], "eventType": "issue", "eventNames": [ "issue_comment" ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "taskName": "Remove `no-recent-activity` label from issues when issue is modified", "conditions": { "operator": "and", "operands": [ { "operator": "not", "operands": [ { "name": "isAction", "parameters": { "action": "closed" } } ] }, { "name": "hasLabel", "parameters": { "label": "no-recent-activity" } }, { "operator": "not", "operands": [ { "name": "labelAdded", "parameters": { "label": "no-recent-activity" } } ] } ] }, "actions": [ { "name": "removeLabel", "parameters": { "label": "no-recent-activity" } } ], "eventType": "issue", "eventNames": [ "issues", "project_card" ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssueCommentResponder", "version": "1.0", "config": { "taskName": "Remove `no-recent-activity` label when an issue is commented on", "conditions": { "operator": "and", "operands": [ { "name": "hasLabel", "parameters": { "label": "no-recent-activity" } } ] }, "actions": [ { "name": "removeLabel", "parameters": { "label": "no-recent-activity" } } ], "eventType": "issue", "eventNames": [ "issue_comment" ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isOpen", "parameters": {} }, { "name": "hasLabel", "parameters": { "label": "no-recent-activity" } }, { "operator": "not", "operands": [ { "name": "labelAdded", "parameters": { "label": "no-recent-activity" } } ] } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "Remove `no-recent-activity` label from PRs when modified", "actions": [ { "name": "removeLabel", "parameters": { "label": "no-recent-activity" } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestCommentResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "hasLabel", "parameters": { "label": "no-recent-activity" } }, { "name": "isOpen", "parameters": {} } ] }, "eventType": "pull_request", "eventNames": [ "issue_comment" ], "taskName": "Remove `no-recent-activity` label from PRs when commented on", "actions": [ { "name": "removeLabel", "parameters": { "label": "no-recent-activity" } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestReviewResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "hasLabel", "parameters": { "label": "no-recent-activity" } }, { "name": "isOpen", "parameters": {} } ] }, "eventType": "pull_request", "eventNames": [ "pull_request_review" ], "taskName": "Remove `no-recent-activity` label from PRs when new review is added", "actions": [ { "name": "removeLabel", "parameters": { "label": "no-recent-activity" } } ] } }, { "taskType": "scheduled", "capabilityId": "ScheduledSearch", "subCapability": "ScheduledSearch", "version": "1.1", "config": { "taskName": "Close issues with no recent activity", "frequency": [ { "weekDay": 0, "hours": [ 0, 6, 12, 18 ], "timezoneOffset": 0 }, { "weekDay": 1, "hours": [ 0, 6, 12, 18 ], "timezoneOffset": 0 }, { "weekDay": 2, "hours": [ 0, 6, 12, 18 ], "timezoneOffset": 0 }, { "weekDay": 3, "hours": [ 0, 6, 12, 18 ], "timezoneOffset": 0 }, { "weekDay": 4, "hours": [ 0, 6, 12, 18 ], "timezoneOffset": 0 }, { "weekDay": 5, "hours": [ 0, 6, 12, 18 ], "timezoneOffset": 0 }, { "weekDay": 6, "hours": [ 0, 6, 12, 18 ], "timezoneOffset": 0 } ], "searchTerms": [ { "name": "isIssue", "parameters": {} }, { "name": "isOpen", "parameters": {} }, { "name": "hasLabel", "parameters": { "label": "no-recent-activity" } }, { "name": "noActivitySince", "parameters": { "days": 14 } } ], "actions": [ { "name": "addReply", "parameters": { "comment": "This issue will now be closed since it had been marked `no-recent-activity` but received no further activity in the past 14 days. It is still possible to reopen or comment on the issue, but please note that the issue will be locked if it remains inactive for another 30 days." } }, { "name": "closeIssue", "parameters": {} } ] } }, { "taskType": "scheduled", "capabilityId": "ScheduledSearch", "subCapability": "ScheduledSearch", "version": "1.1", "config": { "taskName": "Close PRs with no-recent-activity", "frequency": [ { "weekDay": 0, "hours": [ 0, 6, 12, 18 ], "timezoneOffset": 0 }, { "weekDay": 1, "hours": [ 0, 6, 12, 18 ], "timezoneOffset": 0 }, { "weekDay": 2, "hours": [ 0, 6, 12, 18 ], "timezoneOffset": 0 }, { "weekDay": 3, "hours": [ 0, 6, 12, 18 ], "timezoneOffset": 0 }, { "weekDay": 4, "hours": [ 0, 6, 12, 18 ], "timezoneOffset": 0 }, { "weekDay": 5, "hours": [ 0, 6, 12, 18 ], "timezoneOffset": 0 }, { "weekDay": 6, "hours": [ 0, 6, 12, 18 ], "timezoneOffset": 0 } ], "searchTerms": [ { "name": "isPr", "parameters": {} }, { "name": "isOpen", "parameters": {} }, { "name": "hasLabel", "parameters": { "label": "no-recent-activity" } }, { "name": "noActivitySince", "parameters": { "days": 14 } } ], "actions": [ { "name": "addReply", "parameters": { "comment": "This pull request will now be closed since it had been marked `no-recent-activity` but received no further activity in the past 14 days. It is still possible to reopen or comment on the pull request, but please note that it will be locked if it remains inactive for another 30 days." } }, { "name": "closeIssue", "parameters": {} } ] } }, { "taskType": "scheduled", "capabilityId": "ScheduledSearch", "subCapability": "ScheduledSearch", "version": "1.1", "config": { "taskName": "Add no-recent-activity label to issues", "frequency": [ { "weekDay": 0, "hours": [ 4, 10, 16, 22 ], "timezoneOffset": 1 }, { "weekDay": 1, "hours": [ 4, 10, 16, 22 ], "timezoneOffset": 1 }, { "weekDay": 2, "hours": [ 4, 10, 16, 22 ], "timezoneOffset": 1 }, { "weekDay": 3, "hours": [ 4, 10, 16, 22 ], "timezoneOffset": 1 }, { "weekDay": 4, "hours": [ 4, 10, 16, 22 ], "timezoneOffset": 1 }, { "weekDay": 5, "hours": [ 4, 10, 16, 22 ], "timezoneOffset": 1 }, { "weekDay": 6, "hours": [ 4, 10, 16, 22 ], "timezoneOffset": 1 } ], "searchTerms": [ { "name": "isIssue", "parameters": {} }, { "name": "isOpen", "parameters": {} }, { "name": "hasLabel", "parameters": { "label": "needs-author-action" } }, { "name": "noActivitySince", "parameters": { "days": 14 } }, { "name": "noLabel", "parameters": { "label": "no-recent-activity" } } ], "actions": [ { "name": "addLabel", "parameters": { "label": "no-recent-activity" } }, { "name": "addReply", "parameters": { "comment": "This issue has been automatically marked `no-recent-activity` because it has not had any activity for 14 days. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will remove `no-recent-activity`." } } ] }, "disabled": false }, { "taskType": "scheduled", "capabilityId": "ScheduledSearch", "subCapability": "ScheduledSearch", "version": "1.1", "config": { "taskName": "Add no-recent-activity label to PRs", "frequency": [ { "weekDay": 0, "hours": [ 4, 10, 16, 22 ], "timezoneOffset": 1 }, { "weekDay": 1, "hours": [ 4, 10, 16, 22 ], "timezoneOffset": 1 }, { "weekDay": 2, "hours": [ 4, 10, 16, 22 ], "timezoneOffset": 1 }, { "weekDay": 3, "hours": [ 4, 10, 16, 22 ], "timezoneOffset": 1 }, { "weekDay": 4, "hours": [ 4, 10, 16, 22 ], "timezoneOffset": 1 }, { "weekDay": 5, "hours": [ 4, 10, 16, 22 ], "timezoneOffset": 1 }, { "weekDay": 6, "hours": [ 4, 10, 16, 22 ], "timezoneOffset": 1 } ], "searchTerms": [ { "name": "isPr", "parameters": {} }, { "name": "isOpen", "parameters": {} }, { "name": "hasLabel", "parameters": { "label": "needs-author-action" } }, { "name": "noActivitySince", "parameters": { "days": 14 } }, { "name": "noLabel", "parameters": { "label": "no-recent-activity" } } ], "actions": [ { "name": "addLabel", "parameters": { "label": "no-recent-activity" } }, { "name": "addReply", "parameters": { "comment": "This pull request has been automatically marked `no-recent-activity` because it has not had any activity for 14 days. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will remove `no-recent-activity`." } } ] }, "disabled": false }, { "taskType": "trigger", "capabilityId": "InPrLabel", "subCapability": "InPrLabel", "version": "1.0", "config": { "taskName": "Add 'In-PR' label on issue when an open pull request is targeting it", "inPrLabelText": "Status: In PR", "fixedLabelText": "Status: Fixed", "fixedLabelEnabled": false, "label_inPr": "in-pr" } }, { "taskType": "scheduledAndTrigger", "capabilityId": "IssueRouting", "subCapability": "@Mention", "version": "1.0", "config": { "taskName": "@Mention for linkable-framework", "labelsAndMentions": [ { "labels": [ "linkable-framework" ], "mentionees": [ "eerhardt", "vitek-karas", "LakshanF", "sbomer", "joperezr" ] } ], "replyTemplate": "Tagging subscribers to 'linkable-framework': ${mentionees}\nSee info in area-owners.md if you want to be subscribed.", "enableForPullRequests": true } }, { "taskType": "scheduledAndTrigger", "capabilityId": "IssueRouting", "subCapability": "@Mention", "version": "1.0", "config": { "taskName": "@Mention for size-reduction", "replyTemplate": "Tagging subscribers to 'size-reduction': ${mentionees}\nSee info in area-owners.md if you want to be subscribed.", "labelsAndMentions": [ { "labels": [ "size-reduction" ], "mentionees": [ "eerhardt", "SamMonoRT", "marek-safar" ] } ], "enableForPullRequests": true } }, { "taskType": "scheduledAndTrigger", "capabilityId": "IssueRouting", "subCapability": "@Mention", "version": "1.0", "config": { "taskName": "@Mention for wasm", "labelsAndMentions": [ { "labels": [ "arch-wasm" ], "mentionees": [ "lewing" ] } ], "replyTemplate": "Tagging subscribers to 'arch-wasm': ${mentionees}\nSee info in area-owners.md if you want to be subscribed.", "enableForPullRequests": true } }, { "taskType": "scheduledAndTrigger", "capabilityId": "IssueRouting", "subCapability": "@Mention", "version": "1.0", "config": { "taskName": "@Mention for ios", "labelsAndMentions": [ { "labels": [ "os-ios" ], "mentionees": [ "steveisok", "akoeplinger" ] } ], "enableForPullRequests": true, "replyTemplate": "Tagging subscribers to 'os-ios': ${mentionees}\nSee info in area-owners.md if you want to be subscribed." } }, { "taskType": "scheduledAndTrigger", "capabilityId": "IssueRouting", "subCapability": "@Mention", "version": "1.0", "config": { "taskName": "@Mention for android", "labelsAndMentions": [ { "labels": [ "os-android" ], "mentionees": [ "steveisok", "akoeplinger" ] } ], "enableForPullRequests": true, "replyTemplate": "Tagging subscribers to 'arch-android': ${mentionees}\nSee info in area-owners.md if you want to be subscribed." } }, { "taskType": "scheduled", "capabilityId": "ScheduledSearch", "subCapability": "ScheduledSearch", "version": "1.1", "config": { "frequency": [ { "weekDay": 0, "hours": [ 5, 11, 17, 23 ], "timezoneOffset": 0 }, { "weekDay": 1, "hours": [ 5, 11, 17, 23 ], "timezoneOffset": 0 }, { "weekDay": 2, "hours": [ 5, 11, 17, 23 ], "timezoneOffset": 0 }, { "weekDay": 3, "hours": [ 5, 11, 17, 23 ], "timezoneOffset": 0 }, { "weekDay": 4, "hours": [ 5, 11, 17, 23 ], "timezoneOffset": 0 }, { "weekDay": 5, "hours": [ 5, 11, 17, 23 ], "timezoneOffset": 0 }, { "weekDay": 6, "hours": [ 5, 11, 17, 23 ], "timezoneOffset": 0 } ], "searchTerms": [ { "name": "isDraftPr", "parameters": { "value": "true" } }, { "name": "isOpen", "parameters": {} }, { "name": "noActivitySince", "parameters": { "days": 30 } } ], "taskName": "Close inactive Draft PRs", "actions": [ { "name": "closeIssue", "parameters": {} }, { "name": "addReply", "parameters": { "comment": "Draft Pull Request was automatically closed for inactivity. Please [let us know](https://github.com/dotnet/runtime/blob/main/docs/area-owners.md) if you'd like to reopen it." } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "prMatchesPattern", "parameters": { "matchRegex": ".*ILLink.*" } }, { "name": "prMatchesPattern", "parameters": { "matchRegex": ".*illink.*" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "linkable-framework" } } ] }, { "name": "isOpen", "parameters": {} } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "[Linkable-framework workgroup] Add linkable-framework label to new Prs that touch files with *ILLink* that not have it already", "actions": [ { "name": "addLabel", "parameters": { "label": "linkable-framework" } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "prMatchesPattern", "parameters": { "matchRegex": ".*ILLink.*" } }, { "name": "prMatchesPattern", "parameters": { "matchRegex": ".*illink.*" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "linkable-framework" } } ] }, { "name": "isOpen", "parameters": {} }, { "name": "isAction", "parameters": { "action": "synchronize" } } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "[Linkable-framework workgroup] Add linkable-framework label to Prs that get changes pushed where they touch *ILLInk* files", "actions": [ { "name": "addLabel", "parameters": { "label": "linkable-framework" } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isActivitySender", "parameters": { "user": "dotnet-maestro[bot]" } }, { "name": "isAction", "parameters": { "action": "opened" } }, { "name": "titleContains", "parameters": { "titlePattern": "dotnet-optimization" } } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "Auto-approve maestro PRs", "actions": [ { "name": "approvePullRequest", "parameters": { "comment": "Auto-approve dotnet-optimization PR" } } ] }, "disabled": true }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isAction", "parameters": { "action": "opened" } }, { "operator": "and", "operands": [ { "operator": "not", "operands": [ { "name": "activitySenderHasPermissions", "parameters": { "association": "OWNER", "permissions": "admin" } } ] }, { "operator": "not", "operands": [ { "name": "activitySenderHasPermissions", "parameters": { "association": "MEMBER", "permissions": "write" } } ] }, { "operator": "not", "operands": [ { "name": "isActivitySender", "parameters": { "user": "github-actions[bot]" } } ] }, { "operator": "not", "operands": [ { "name": "isActivitySender", "parameters": { "user": "dotnet-maestro[bot]" } } ] }, { "operator": "not", "operands": [ { "name": "isActivitySender", "parameters": { "user": "dotnet-maestro-bot[bot]" } } ] }, { "operator": "not", "operands": [ { "name": "isActivitySender", "parameters": { "user": "dotnet-maestro-bot" } } ] }, { "operator": "not", "operands": [ { "name": "isActivitySender", "parameters": { "user": "dotnet-maestro" } } ] }, { "operator": "not", "operands": [ { "name": "isActivitySender", "parameters": { "user": "github-actions" } } ] } ] } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "Label community PRs", "actions": [ { "name": "addLabel", "parameters": { "label": "community-contribution" } } ] }, "disabled": false }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isAction", "parameters": { "action": "opened" } }, { "operator": "or", "operands": [ { "name": "activitySenderHasPermissions", "parameters": { "association": "OWNER", "permissions": "admin" } }, { "name": "activitySenderHasPermissions", "parameters": { "association": "MEMBER", "permissions": "write" } } ] } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "Assign Team PRs to author", "actions": [ { "name": "assignToUser", "parameters": { "label": "community-contribution", "user": { "type": "prAuthor" } } } ] }, "disabled": false }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": ".NET Core Diagnostics ", "isOrgProject": true } } ] }, { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics" } }, { "name": "hasLabel", "parameters": { "label": "area-Diagnostics-coreclr" } }, { "name": "hasLabel", "parameters": { "label": "area-Tracing-coreclr" } } ] }, { "name": "isInMilestone", "parameters": { "milestoneName": "6.0.0" } }, { "operator": "and", "operands": [ { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "User Story" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "enhancement" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "feature request" } } ] } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[hoyosjs/tommcdon] Add diagnostics 6.0 issues to project", "actions": [ { "name": "addToProject", "parameters": { "projectName": ".NET Core Diagnostics", "columnName": "6.0.0", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "labelAdded", "parameters": { "label": "backlog-cleanup-candidate" } } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "Manual Issue Cleanup", "actions": [ { "name": "addReply", "parameters": { "comment": "Due to lack of recent activity, this issue has been marked as a candidate for backlog cleanup. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will undo this process.\n\nThis process is part of the experimental [issue cleanup initiative](https://github.com/dotnet/runtime/issues/60288) we are currently trialing. Please share any feedback you might have in the linked issue." } }, { "name": "addLabel", "parameters": { "label": "no-recent-activity" } } ] } }, { "taskType": "scheduled", "capabilityId": "ScheduledSearch", "subCapability": "ScheduledSearch", "version": "1.1", "config": { "frequency": [ { "weekDay": 0, "hours": [ 0, 6, 12, 18 ], "timezoneOffset": 0 }, { "weekDay": 1, "hours": [ 0, 6, 12, 18 ], "timezoneOffset": 0 }, { "weekDay": 2, "hours": [ 0, 6, 12, 18 ], "timezoneOffset": 0 }, { "weekDay": 3, "hours": [ 0, 6, 12, 18 ], "timezoneOffset": 0 }, { "weekDay": 4, "hours": [ 0, 6, 12, 18 ], "timezoneOffset": 0 }, { "weekDay": 5, "hours": [ 0, 6, 12, 18 ], "timezoneOffset": 0 }, { "weekDay": 6, "hours": [ 0, 6, 12, 18 ], "timezoneOffset": 0 } ], "searchTerms": [ { "name": "noActivitySince", "parameters": { "days": 1827 } }, { "name": "isIssue", "parameters": {} }, { "name": "isOpen", "parameters": {} }, { "name": "noLabel", "parameters": { "label": "backlog-cleanup-candidate" } } ], "taskName": "Automated Issue cleanup", "actions": [ { "name": "addLabel", "parameters": { "label": "backlog-cleanup-candidate" } }, { "name": "addReply", "parameters": { "comment": "Due to lack of recent activity, this issue has been marked as a candidate for backlog cleanup. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will undo this process.\n\nThis process is part of the experimental [issue cleanup initiative](https://github.com/dotnet/runtime/issues/60288) we are currently trialing. Please share any feedback you might have in the linked issue." } }, { "name": "addLabel", "parameters": { "label": "no-recent-activity" } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "labelAdded", "parameters": { "label": "needs-author-action" } } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "Needs-author-action notification", "actions": [ { "name": "addReply", "parameters": { "comment": "This issue has been marked `needs-author-action` since it may be missing important information. Please refer to our [contribution guidelines](https://github.com/dotnet/runtime/blob/main/CONTRIBUTING.md#writing-a-good-bug-report) for tips on how to report issues effectively." } } ] } }, { "taskType": "scheduledAndTrigger", "capabilityId": "IssueRouting", "subCapability": "@Mention", "version": "1.0", "config": { "taskName": "@Mention for tvos", "labelsAndMentions": [ { "labels": [ "os-tvos" ], "mentionees": [ "steveisok", "akoeplinger" ] } ], "enableForPullRequests": true, "replyTemplate": "Tagging subscribers to 'os-tvos': ${mentionees}\nSee info in area-owners.md if you want to be subscribed." } }, { "taskType": "scheduledAndTrigger", "capabilityId": "IssueRouting", "subCapability": "@Mention", "version": "1.0", "config": { "labelsAndMentions": [ { "labels": [ "os-maccatalyst" ], "mentionees": [ "steveisok", "akoeplinger" ] } ], "replyTemplate": "Tagging subscribers to 'os-maccatalyst': ${mentionees}\nSee info in area-owners.md if you want to be subscribed.", "enableForPullRequests": true, "taskName": "@Mention for maccatalyst" } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestReviewResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "activitySenderHasPermissions", "parameters": { "state": "changes_requested", "permissions": "write" } }, { "name": "isAction", "parameters": { "action": "submitted" } }, { "name": "isReviewState", "parameters": { "state": "changes_requested" } } ] }, "eventType": "pull_request", "eventNames": [ "pull_request_review" ], "taskName": "PR reviews with \"changes requested\" applies the needs-author-action label", "actions": [ { "name": "addLabel", "parameters": { "label": "needs-author-action" } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isAction", "parameters": { "action": "synchronize" } }, { "name": "hasLabel", "parameters": { "label": "needs-author-action" } } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "Pushing changes to PR branch removes the needs-author-action label", "actions": [ { "name": "removeLabel", "parameters": { "label": "needs-author-action" } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestCommentResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isActivitySender", "parameters": { "user": { "type": "author" } } }, { "name": "isAction", "parameters": { "action": "created" } }, { "name": "hasLabel", "parameters": { "label": "needs-author-action" } }, { "name": "isOpen", "parameters": {} } ] }, "eventType": "pull_request", "eventNames": [ "issue_comment" ], "taskName": "Author commenting in PR removes the needs-author-action label", "actions": [ { "name": "removeLabel", "parameters": { "label": "needs-author-action" } } ] }, "disabled": false }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestReviewResponder", "version": "1.0", "config": { "taskName": "Author responding to a pull request review comment removes the needs-author-action label", "conditions": { "operator": "and", "operands": [ { "name": "isActivitySender", "parameters": { "user": { "type": "author" } } }, { "name": "hasLabel", "parameters": { "label": "needs-author-action" } }, { "name": "isAction", "parameters": { "action": "submitted" } }, { "name": "isOpen", "parameters": {} } ] }, "actions": [ { "name": "removeLabel", "parameters": { "label": "needs-author-action" } } ], "eventType": "pull_request", "eventNames": [ "pull_request_review" ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Meta" } } ] }, { "operator": "or", "operands": [ { "name": "isAction", "parameters": { "action": "reopened" } }, { "operator": "not", "operands": [ { "name": "isInMilestone", "parameters": {} } ] } ] } ] }, { "operator": "or", "operands": [ { "name": "labelAdded", "parameters": { "label": "area-Meta" } } ] } ] }, { "name": "isOpen", "parameters": {} }, { "operator": "or", "operands": [ { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Eric / Jeff - Issue Triage", "isOrgProject": true } } ] }, { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Eric / Jeff - Issue Triage", "isOrgProject": true, "columnName": "Triaged" } } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Eric / Jeff - Issue Triage] Add new issue to Board", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Eric / Jeff - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssueCommentResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Meta" } } ] }, { "operator": "not", "operands": [ { "name": "isCloseAndComment", "parameters": {} } ] }, { "operator": "not", "operands": [ { "name": "activitySenderHasPermissions", "parameters": { "permissions": "write" } } ] }, { "operator": "or", "operands": [ { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Eric / Jeff - Issue Triage", "isOrgProject": true } } ] }, { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Eric / Jeff - Issue Triage", "columnName": "Triaged", "isOrgProject": true } } ] } ] }, "eventType": "issue", "eventNames": [ "issue_comment" ], "taskName": "[Area Pod: Eric / Jeff - Issue Triage] Needs Further Triage", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Eric / Jeff - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Eric / Jeff - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } }, { "operator": "and", "operands": [ { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Meta" } } ] } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Eric / Jeff - Issue Triage] Remove relabeled issues", "actions": [ { "name": "removeFromProject", "parameters": { "projectName": "Area Pod: Eric / Jeff - Issue Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Eric / Jeff - Issue Triage", "isOrgProject": true } }, { "operator": "not", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Eric / Jeff - Issue Triage", "columnName": "Triaged" } } ] }, { "operator": "or", "operands": [ { "name": "addedToMilestone", "parameters": {} }, { "name": "labelAdded", "parameters": { "label": "needs-author-action" } }, { "name": "labelAdded", "parameters": { "label": "api-ready-for-review" } }, { "name": "isAction", "parameters": { "action": "closed" } } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Eric / Jeff - Issue Triage] Move to Triaged Column", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Eric / Jeff - Issue Triage", "columnName": "Triaged", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Meta" } } ] }, { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Eric / Jeff - PRs", "isOrgProject": true } } ] } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "[Area Pod: Eric / Jeff - PRs] Add new PR to Board", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Eric / Jeff - PRs", "columnName": "Needs Champion", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Eric / Jeff - PRs", "columnName": "Needs Champion", "isOrgProject": true } }, { "operator": "and", "operands": [ { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Meta" } } ] } ] } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "[Area Pod: Eric / Jeff - PRs] Remove relabeled PRs", "actions": [ { "name": "removeFromProject", "parameters": { "projectName": "Area Pod: Eric / Jeff - PRs", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.CodeDom" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Configuration" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Reflection" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Reflection.Emit" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Reflection.Metadata" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Resources" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Runtime.CompilerServices" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Text.RegularExpressions" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Threading.Channels" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Threading.Tasks" } }, { "name": "hasLabel", "parameters": { "label": "area-System.DirectoryServices" } } ] }, { "operator": "or", "operands": [ { "name": "isAction", "parameters": { "action": "reopened" } }, { "operator": "not", "operands": [ { "name": "isInMilestone", "parameters": {} } ] } ] } ] }, { "operator": "or", "operands": [ { "name": "labelAdded", "parameters": { "label": "area-System.CodeDom" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Configuration" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Reflection" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Reflection.Emit" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Reflection.Metadata" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Resources" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Runtime.CompilerServices" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Text.RegularExpressions" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Threading.Channels" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Threading.Tasks" } }, { "name": "labelAdded", "parameters": { "label": "area-System.DirectoryServices" } } ] } ] }, { "name": "isOpen", "parameters": {} }, { "operator": "or", "operands": [ { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Buyaa / Jose / Steve - Issue Triage", "isOrgProject": true } } ] }, { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Buyaa / Jose / Steve - Issue Triage", "isOrgProject": true, "columnName": "Triaged" } } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Buyaa / Jose / Steve - Issue Triage] Add new issue to Board", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Buyaa / Jose / Steve - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssueCommentResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.CodeDom" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Configuration" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Reflection" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Reflection.Emit" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Reflection.Metadata" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Resources" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Runtime.CompilerServices" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Text.RegularExpressions" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Threading.Channels" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Threading.Tasks" } }, { "name": "hasLabel", "parameters": { "label": "area-System.DirectoryServices" } } ] }, { "operator": "not", "operands": [ { "name": "isCloseAndComment", "parameters": {} } ] }, { "operator": "not", "operands": [ { "name": "activitySenderHasPermissions", "parameters": { "permissions": "write" } } ] }, { "operator": "or", "operands": [ { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Buyaa / Jose / Steve - Issue Triage", "isOrgProject": true } } ] }, { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Buyaa / Jose / Steve - Issue Triage", "columnName": "Triaged", "isOrgProject": true } } ] } ] }, "eventType": "issue", "eventNames": [ "issue_comment" ], "taskName": "[Area Pod: Buyaa / Jose / Steve - Issue Triage] Needs Further Triage", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Buyaa / Jose / Steve - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Buyaa / Jose / Steve - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } }, { "operator": "and", "operands": [ { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.CodeDom" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Configuration" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Reflection" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Reflection.Emit" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Reflection.Metadata" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Resources" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Runtime.CompilerServices" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Text.RegularExpressions" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Threading.Channels" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Threading.Tasks" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.DirectoryServices" } } ] } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Buyaa / Jose / Steve - Issue Triage] Remove relabeled issues", "actions": [ { "name": "removeFromProject", "parameters": { "projectName": "Area Pod: Buyaa / Jose / Steve - Issue Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Buyaa / Jose / Steve - Issue Triage", "isOrgProject": true } }, { "operator": "not", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Buyaa / Jose / Steve - Issue Triage", "columnName": "Triaged" } } ] }, { "operator": "or", "operands": [ { "name": "addedToMilestone", "parameters": {} }, { "name": "labelAdded", "parameters": { "label": "needs-author-action" } }, { "name": "labelAdded", "parameters": { "label": "api-ready-for-review" } }, { "name": "isAction", "parameters": { "action": "closed" } } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Buyaa / Jose / Steve - Issue Triage] Move to Triaged Column", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Buyaa / Jose / Steve - Issue Triage", "columnName": "Triaged", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.CodeDom" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Configuration" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Reflection" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Reflection.Emit" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Reflection.Metadata" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Resources" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Runtime.CompilerServices" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Text.RegularExpressions" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Threading.Channels" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Threading.Tasks" } }, { "name": "hasLabel", "parameters": { "label": "area-System.DirectoryServices" } } ] }, { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Buyaa / Jose / Steve - PRs", "isOrgProject": true } } ] } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "[Area Pod: Buyaa / Jose / Steve - PRs] Add new PR to Board", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Buyaa / Jose / Steve - PRs", "columnName": "Needs Champion", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Buyaa / Jose / Steve - PRs", "columnName": "Needs Champion", "isOrgProject": true } }, { "operator": "and", "operands": [ { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.CodeDom" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Configuration" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Reflection" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Reflection.Emit" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Reflection.Metadata" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Resources" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Runtime.CompilerServices" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Text.RegularExpressions" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Threading.Channels" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Threading.Tasks" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.DirectoryServices" } } ] } ] } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "[Area Pod: Buyaa / Jose / Steve - PRs] Remove relabeled PRs", "actions": [ { "name": "removeFromProject", "parameters": { "projectName": "Area Pod: Buyaa / Jose / Steve - PRs", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Collections" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Linq" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Text.Json" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Xml" } } ] }, { "operator": "or", "operands": [ { "name": "isAction", "parameters": { "action": "reopened" } }, { "operator": "not", "operands": [ { "name": "isInMilestone", "parameters": {} } ] } ] } ] }, { "operator": "or", "operands": [ { "name": "labelAdded", "parameters": { "label": "area-System.Collections" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Linq" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Text.Json" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Xml" } } ] } ] }, { "name": "isOpen", "parameters": {} }, { "operator": "or", "operands": [ { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Eirik / Krzysztof / Layomi - Issue Triage", "isOrgProject": true } } ] }, { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Eirik / Krzysztof / Layomi - Issue Triage", "isOrgProject": true, "columnName": "Triaged" } } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Eirik / Krzysztof / Layomi - Issue Triage] Add new issue to Board", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Eirik / Krzysztof / Layomi - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssueCommentResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Collections" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Linq" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Text.Json" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Xml" } } ] }, { "operator": "not", "operands": [ { "name": "isCloseAndComment", "parameters": {} } ] }, { "operator": "not", "operands": [ { "name": "activitySenderHasPermissions", "parameters": { "permissions": "write" } } ] }, { "operator": "or", "operands": [ { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Eirik / Krzysztof / Layomi - Issue Triage", "isOrgProject": true } } ] }, { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Eirik / Krzysztof / Layomi - Issue Triage", "columnName": "Triaged", "isOrgProject": true } } ] } ] }, "eventType": "issue", "eventNames": [ "issue_comment" ], "taskName": "[Area Pod: Eirik / Krzysztof / Layomi - Issue Triage] Needs Further Triage", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Eirik / Krzysztof / Layomi - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Eirik / Krzysztof / Layomi - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } }, { "operator": "and", "operands": [ { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Collections" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Linq" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Text.Json" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Xml" } } ] } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Eirik / Krzysztof / Layomi - Issue Triage] Remove relabeled issues", "actions": [ { "name": "removeFromProject", "parameters": { "projectName": "Area Pod: Eirik / Krzysztof / Layomi - Issue Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Eirik / Krzysztof / Layomi - Issue Triage", "isOrgProject": true } }, { "operator": "not", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Eirik / Krzysztof / Layomi - Issue Triage", "columnName": "Triaged" } } ] }, { "operator": "or", "operands": [ { "name": "addedToMilestone", "parameters": {} }, { "name": "labelAdded", "parameters": { "label": "needs-author-action" } }, { "name": "labelAdded", "parameters": { "label": "api-ready-for-review" } }, { "name": "isAction", "parameters": { "action": "closed" } } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Eirik / Krzysztof / Layomi - Issue Triage] Move to Triaged Column", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Eirik / Krzysztof / Layomi - Issue Triage", "columnName": "Triaged", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Collections" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Linq" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Text.Json" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Xml" } } ] }, { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Eirik / Krzysztof / Layomi - PRs", "isOrgProject": true } } ] } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "[Area Pod: Eirik / Krzysztof / Layomi - PRs] Add new PR to Board", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Eirik / Krzysztof / Layomi - PRs", "columnName": "Needs Champion", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Eirik / Krzysztof / Layomi - PRs", "columnName": "Needs Champion", "isOrgProject": true } }, { "operator": "and", "operands": [ { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Collections" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Linq" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Text.Json" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Xml" } } ] } ] } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "[Area Pod: Eirik / Krzysztof / Layomi - PRs] Remove relabeled PRs", "actions": [ { "name": "removeFromProject", "parameters": { "projectName": "Area Pod: Eirik / Krzysztof / Layomi - PRs", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-DependencyModel" } }, { "name": "hasLabel", "parameters": { "label": "area-Extensions-Caching" } }, { "name": "hasLabel", "parameters": { "label": "area-Extensions-Configuration" } }, { "name": "hasLabel", "parameters": { "label": "area-Extensions-DependencyInjection" } }, { "name": "hasLabel", "parameters": { "label": "area-Extensions-Hosting" } }, { "name": "hasLabel", "parameters": { "label": "area-Extensions-Logging" } }, { "name": "hasLabel", "parameters": { "label": "area-Extensions-Options" } }, { "name": "hasLabel", "parameters": { "label": "area-Extensions-Primitives" } }, { "name": "hasLabel", "parameters": { "label": "area-System.ComponentModel" } }, { "name": "hasLabel", "parameters": { "label": "area-System.ComponentModel.Composition" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Composition" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.Activity" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Globalization" } } ] }, { "operator": "or", "operands": [ { "name": "isAction", "parameters": { "action": "reopened" } }, { "operator": "not", "operands": [ { "name": "isInMilestone", "parameters": {} } ] } ] } ] }, { "operator": "or", "operands": [ { "name": "labelAdded", "parameters": { "label": "area-DependencyModel" } }, { "name": "labelAdded", "parameters": { "label": "area-Extensions-Caching" } }, { "name": "labelAdded", "parameters": { "label": "area-Extensions-Configuration" } }, { "name": "labelAdded", "parameters": { "label": "area-Extensions-DependencyInjection" } }, { "name": "labelAdded", "parameters": { "label": "area-Extensions-Hosting" } }, { "name": "labelAdded", "parameters": { "label": "area-Extensions-Logging" } }, { "name": "labelAdded", "parameters": { "label": "area-Extensions-Options" } }, { "name": "labelAdded", "parameters": { "label": "area-Extensions-Primitives" } }, { "name": "labelAdded", "parameters": { "label": "area-System.ComponentModel" } }, { "name": "labelAdded", "parameters": { "label": "area-System.ComponentModel.Composition" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Composition" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Diagnostics.Activity" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Globalization" } } ] } ] }, { "name": "isOpen", "parameters": {} }, { "operator": "or", "operands": [ { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Eric / Maryam / Tarek - Issue Triage", "isOrgProject": true } } ] }, { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Eric / Maryam / Tarek - Issue Triage", "isOrgProject": true, "columnName": "Triaged" } } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Eric / Maryam / Tarek - Issue Triage] Add new issue to Board", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Eric / Maryam / Tarek - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssueCommentResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-DependencyModel" } }, { "name": "hasLabel", "parameters": { "label": "area-Extensions-Caching" } }, { "name": "hasLabel", "parameters": { "label": "area-Extensions-Configuration" } }, { "name": "hasLabel", "parameters": { "label": "area-Extensions-DependencyInjection" } }, { "name": "hasLabel", "parameters": { "label": "area-Extensions-Hosting" } }, { "name": "hasLabel", "parameters": { "label": "area-Extensions-Logging" } }, { "name": "hasLabel", "parameters": { "label": "area-Extensions-Options" } }, { "name": "hasLabel", "parameters": { "label": "area-Extensions-Primitives" } }, { "name": "hasLabel", "parameters": { "label": "area-System.ComponentModel" } }, { "name": "hasLabel", "parameters": { "label": "area-System.ComponentModel.Composition" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Composition" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.Activity" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Globalization" } } ] }, { "operator": "not", "operands": [ { "name": "isCloseAndComment", "parameters": {} } ] }, { "operator": "not", "operands": [ { "name": "activitySenderHasPermissions", "parameters": { "permissions": "write" } } ] }, { "operator": "or", "operands": [ { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Eric / Maryam / Tarek - Issue Triage", "isOrgProject": true } } ] }, { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Eric / Maryam / Tarek - Issue Triage", "columnName": "Triaged", "isOrgProject": true } } ] } ] }, "eventType": "issue", "eventNames": [ "issue_comment" ], "taskName": "[Area Pod: Eric / Maryam / Tarek - Issue Triage] Needs Further Triage", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Eric / Maryam / Tarek - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Eric / Maryam / Tarek - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } }, { "operator": "and", "operands": [ { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-DependencyModel" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Extensions-Caching" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Extensions-Configuration" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Extensions-DependencyInjection" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Extensions-Hosting" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Extensions-Logging" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Extensions-Options" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Extensions-Primitives" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.ComponentModel" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.ComponentModel.Composition" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Composition" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.Activity" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Globalization" } } ] } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Eric / Maryam / Tarek - Issue Triage] Remove relabeled issues", "actions": [ { "name": "removeFromProject", "parameters": { "projectName": "Area Pod: Eric / Maryam / Tarek - Issue Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Eric / Maryam / Tarek - Issue Triage", "isOrgProject": true } }, { "operator": "not", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Eric / Maryam / Tarek - Issue Triage", "columnName": "Triaged" } } ] }, { "operator": "or", "operands": [ { "name": "addedToMilestone", "parameters": {} }, { "name": "labelAdded", "parameters": { "label": "needs-author-action" } }, { "name": "labelAdded", "parameters": { "label": "api-ready-for-review" } }, { "name": "isAction", "parameters": { "action": "closed" } } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Eric / Maryam / Tarek - Issue Triage] Move to Triaged Column", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Eric / Maryam / Tarek - Issue Triage", "columnName": "Triaged", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-DependencyModel" } }, { "name": "hasLabel", "parameters": { "label": "area-Extensions-Caching" } }, { "name": "hasLabel", "parameters": { "label": "area-Extensions-Configuration" } }, { "name": "hasLabel", "parameters": { "label": "area-Extensions-DependencyInjection" } }, { "name": "hasLabel", "parameters": { "label": "area-Extensions-Hosting" } }, { "name": "hasLabel", "parameters": { "label": "area-Extensions-Logging" } }, { "name": "hasLabel", "parameters": { "label": "area-Extensions-Options" } }, { "name": "hasLabel", "parameters": { "label": "area-Extensions-Primitives" } }, { "name": "hasLabel", "parameters": { "label": "area-System.ComponentModel" } }, { "name": "hasLabel", "parameters": { "label": "area-System.ComponentModel.Composition" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Composition" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.Activity" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Globalization" } } ] }, { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Eric / Maryam / Tarek - PRs", "isOrgProject": true } } ] } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "[Area Pod: Eric / Maryam / Tarek - PRs] Add new PR to Board", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Eric / Maryam / Tarek - PRs", "columnName": "Needs Champion", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Eric / Maryam / Tarek - PRs", "columnName": "Needs Champion", "isOrgProject": true } }, { "operator": "and", "operands": [ { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-DependencyModel" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Extensions-Caching" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Extensions-Configuration" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Extensions-DependencyInjection" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Extensions-Hosting" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Extensions-Logging" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Extensions-Options" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Extensions-Primitives" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.ComponentModel" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.ComponentModel.Composition" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Composition" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.Activity" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Globalization" } } ] } ] } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "[Area Pod: Eric / Maryam / Tarek - PRs] Remove relabeled PRs", "actions": [ { "name": "removeFromProject", "parameters": { "projectName": "Area Pod: Eric / Maryam / Tarek - PRs", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Infrastructure-libraries" } }, { "name": "hasLabel", "parameters": { "label": "area-Microsoft.Win32" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.EventLog" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.PerformanceCounter" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.TraceSource" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Drawing" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Management" } }, { "name": "hasLabel", "parameters": { "label": "area-System.ServiceProcess" } } ] }, { "operator": "or", "operands": [ { "name": "isAction", "parameters": { "action": "reopened" } }, { "operator": "not", "operands": [ { "name": "isInMilestone", "parameters": {} } ] } ] } ] }, { "operator": "or", "operands": [ { "name": "labelAdded", "parameters": { "label": "area-Infrastructure-libraries" } }, { "name": "labelAdded", "parameters": { "label": "area-Microsoft.Win32" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Diagnostics.EventLog" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Diagnostics.PerformanceCounter" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Diagnostics.TraceSource" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Drawing" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Management" } }, { "name": "labelAdded", "parameters": { "label": "area-System.ServiceProcess" } } ] } ] }, { "name": "isOpen", "parameters": {} }, { "operator": "or", "operands": [ { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Carlos / Jeremy - Issue Triage", "isOrgProject": true } } ] }, { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Carlos / Jeremy - Issue Triage", "isOrgProject": true, "columnName": "Triaged" } } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Carlos / Jeremy - Issue Triage] Add new issue to Board", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Carlos / Jeremy - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssueCommentResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Infrastructure-libraries" } }, { "name": "hasLabel", "parameters": { "label": "area-Microsoft.Win32" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.EventLog" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.PerformanceCounter" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.TraceSource" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Drawing" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Management" } }, { "name": "hasLabel", "parameters": { "label": "area-System.ServiceProcess" } } ] }, { "operator": "not", "operands": [ { "name": "isCloseAndComment", "parameters": {} } ] }, { "operator": "not", "operands": [ { "name": "activitySenderHasPermissions", "parameters": { "permissions": "write" } } ] }, { "operator": "or", "operands": [ { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Carlos / Jeremy - Issue Triage", "isOrgProject": true } } ] }, { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Carlos / Jeremy - Issue Triage", "columnName": "Triaged", "isOrgProject": true } } ] } ] }, "eventType": "issue", "eventNames": [ "issue_comment" ], "taskName": "[Area Pod: Carlos / Jeremy - Issue Triage] Needs Further Triage", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Carlos / Jeremy - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Carlos / Jeremy - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } }, { "operator": "and", "operands": [ { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Infrastructure-libraries" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Microsoft.Win32" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.EventLog" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.PerformanceCounter" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.TraceSource" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Drawing" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Management" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.ServiceProcess" } } ] } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Carlos / Jeremy - Issue Triage] Remove relabeled issues", "actions": [ { "name": "removeFromProject", "parameters": { "projectName": "Area Pod: Carlos / Jeremy - Issue Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Carlos / Jeremy - Issue Triage", "isOrgProject": true } }, { "operator": "not", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Carlos / Jeremy - Issue Triage", "columnName": "Triaged" } } ] }, { "operator": "or", "operands": [ { "name": "addedToMilestone", "parameters": {} }, { "name": "labelAdded", "parameters": { "label": "needs-author-action" } }, { "name": "labelAdded", "parameters": { "label": "api-ready-for-review" } }, { "name": "isAction", "parameters": { "action": "closed" } } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Carlos / Jeremy - Issue Triage] Move to Triaged Column", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Carlos / Jeremy - Issue Triage", "columnName": "Triaged", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Infrastructure-libraries" } }, { "name": "hasLabel", "parameters": { "label": "area-Microsoft.Win32" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.EventLog" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.PerformanceCounter" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.TraceSource" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Drawing" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Management" } }, { "name": "hasLabel", "parameters": { "label": "area-System.ServiceProcess" } } ] }, { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Carlos / Jeremy - PRs", "isOrgProject": true } } ] } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "[Area Pod: Carlos / Jeremy - PRs] Add new PR to Board", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Carlos / Jeremy - PRs", "columnName": "Needs Champion", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Carlos / Jeremy - PRs", "columnName": "Needs Champion", "isOrgProject": true } }, { "operator": "and", "operands": [ { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Infrastructure-libraries" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Microsoft.Win32" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.EventLog" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.PerformanceCounter" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.TraceSource" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Drawing" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Management" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.ServiceProcess" } } ] } ] } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "[Area Pod: Carlos / Jeremy - PRs] Remove relabeled PRs", "actions": [ { "name": "removeFromProject", "parameters": { "projectName": "Area Pod: Carlos / Jeremy - PRs", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Extensions-FileSystem" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Console" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.Process" } }, { "name": "hasLabel", "parameters": { "label": "area-System.IO" } }, { "name": "hasLabel", "parameters": { "label": "area-System.IO.Compression" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Linq.Parallel" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Memory" } } ] }, { "operator": "or", "operands": [ { "name": "isAction", "parameters": { "action": "reopened" } }, { "operator": "not", "operands": [ { "name": "isInMilestone", "parameters": {} } ] } ] } ] }, { "operator": "or", "operands": [ { "name": "labelAdded", "parameters": { "label": "area-Extensions-FileSystem" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Console" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Diagnostics.Process" } }, { "name": "labelAdded", "parameters": { "label": "area-System.IO" } }, { "name": "labelAdded", "parameters": { "label": "area-System.IO.Compression" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Linq.Parallel" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Memory" } } ] } ] }, { "name": "isOpen", "parameters": {} }, { "operator": "or", "operands": [ { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Adam / David - Issue Triage", "isOrgProject": true } } ] }, { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Adam / David - Issue Triage", "isOrgProject": true, "columnName": "Triaged" } } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Adam / David - Issue Triage] Add new issue to Board", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Adam / David - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssueCommentResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Extensions-FileSystem" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Console" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.Process" } }, { "name": "hasLabel", "parameters": { "label": "area-System.IO" } }, { "name": "hasLabel", "parameters": { "label": "area-System.IO.Compression" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Linq.Parallel" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Memory" } } ] }, { "operator": "not", "operands": [ { "name": "isCloseAndComment", "parameters": {} } ] }, { "operator": "not", "operands": [ { "name": "activitySenderHasPermissions", "parameters": { "permissions": "write" } } ] }, { "operator": "or", "operands": [ { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Adam / David - Issue Triage", "isOrgProject": true } } ] }, { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Adam / David - Issue Triage", "columnName": "Triaged", "isOrgProject": true } } ] } ] }, "eventType": "issue", "eventNames": [ "issue_comment" ], "taskName": "[Area Pod: Adam / David - Issue Triage] Needs Further Triage", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Adam / David - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Adam / David - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } }, { "operator": "and", "operands": [ { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Extensions-FileSystem" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Console" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.Process" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.IO" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.IO.Compression" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Linq.Parallel" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Memory" } } ] } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Adam / David - Issue Triage] Remove relabeled issues", "actions": [ { "name": "removeFromProject", "parameters": { "projectName": "Area Pod: Adam / David - Issue Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Adam / David - Issue Triage", "isOrgProject": true } }, { "operator": "not", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Adam / David - Issue Triage", "columnName": "Triaged" } } ] }, { "operator": "or", "operands": [ { "name": "addedToMilestone", "parameters": {} }, { "name": "labelAdded", "parameters": { "label": "needs-author-action" } }, { "name": "labelAdded", "parameters": { "label": "api-ready-for-review" } }, { "name": "isAction", "parameters": { "action": "closed" } } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Adam / David - Issue Triage] Move to Triaged Column", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Adam / David - Issue Triage", "columnName": "Triaged", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Extensions-FileSystem" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Console" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.Process" } }, { "name": "hasLabel", "parameters": { "label": "area-System.IO" } }, { "name": "hasLabel", "parameters": { "label": "area-System.IO.Compression" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Linq.Parallel" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Memory" } } ] }, { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Adam / David - PRs", "isOrgProject": true } } ] } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "[Area Pod: Adam / David - PRs] Add new PR to Board", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Adam / David - PRs", "columnName": "Needs Champion", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Adam / David - PRs", "columnName": "Needs Champion", "isOrgProject": true } }, { "operator": "and", "operands": [ { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-Extensions-FileSystem" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Console" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Diagnostics.Process" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.IO" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.IO.Compression" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Linq.Parallel" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Memory" } } ] } ] } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "[Area Pod: Adam / David - PRs] Remove relabeled PRs", "actions": [ { "name": "removeFromProject", "parameters": { "projectName": "Area Pod: Adam / David - PRs", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Buffers" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Numerics" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Numerics.Tensors" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Runtime" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Runtime.Intrinsics" } } ] }, { "operator": "or", "operands": [ { "name": "isAction", "parameters": { "action": "reopened" } }, { "operator": "not", "operands": [ { "name": "isInMilestone", "parameters": {} } ] } ] } ] }, { "operator": "or", "operands": [ { "name": "labelAdded", "parameters": { "label": "area-System.Buffers" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Numerics" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Numerics.Tensors" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Runtime" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Runtime.Intrinsics" } } ] } ] }, { "name": "isOpen", "parameters": {} }, { "operator": "or", "operands": [ { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Michael / Tanner - Issue Triage", "isOrgProject": true } } ] }, { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Michael / Tanner - Issue Triage", "isOrgProject": true, "columnName": "Triaged" } } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Michael / Tanner - Issue Triage] Add new issue to Board", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Michael / Tanner - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssueCommentResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Buffers" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Numerics" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Numerics.Tensors" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Runtime" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Runtime.Intrinsics" } } ] }, { "operator": "not", "operands": [ { "name": "isCloseAndComment", "parameters": {} } ] }, { "operator": "not", "operands": [ { "name": "activitySenderHasPermissions", "parameters": { "permissions": "write" } } ] }, { "operator": "or", "operands": [ { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Michael / Tanner - Issue Triage", "isOrgProject": true } } ] }, { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Michael / Tanner - Issue Triage", "columnName": "Triaged", "isOrgProject": true } } ] } ] }, "eventType": "issue", "eventNames": [ "issue_comment" ], "taskName": "[Area Pod: Michael / Tanner - Issue Triage] Needs Further Triage", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Michael / Tanner - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Michael / Tanner - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } }, { "operator": "and", "operands": [ { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Buffers" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Numerics" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Numerics.Tensors" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Runtime" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Runtime.Intrinsics" } } ] } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Michael / Tanner - Issue Triage] Remove relabeled issues", "actions": [ { "name": "removeFromProject", "parameters": { "projectName": "Area Pod: Michael / Tanner - Issue Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Michael / Tanner - Issue Triage", "isOrgProject": true } }, { "operator": "not", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Michael / Tanner - Issue Triage", "columnName": "Triaged" } } ] }, { "operator": "or", "operands": [ { "name": "addedToMilestone", "parameters": {} }, { "name": "labelAdded", "parameters": { "label": "needs-author-action" } }, { "name": "labelAdded", "parameters": { "label": "api-ready-for-review" } }, { "name": "isAction", "parameters": { "action": "closed" } } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Michael / Tanner - Issue Triage] Move to Triaged Column", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Michael / Tanner - Issue Triage", "columnName": "Triaged", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Buffers" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Numerics" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Numerics.Tensors" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Runtime" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Runtime.Intrinsics" } } ] }, { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Michael / Tanner - PRs", "isOrgProject": true } } ] } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "[Area Pod: Michael / Tanner - PRs] Add new PR to Board", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Michael / Tanner - PRs", "columnName": "Needs Champion", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Michael / Tanner - PRs", "columnName": "Needs Champion", "isOrgProject": true } }, { "operator": "and", "operands": [ { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Buffers" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Numerics" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Numerics.Tensors" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Runtime" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Runtime.Intrinsics" } } ] } ] } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "[Area Pod: Michael / Tanner - PRs] Remove relabeled PRs", "actions": [ { "name": "removeFromProject", "parameters": { "projectName": "Area Pod: Michael / Tanner - PRs", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Formats.Asn1" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Formats.Cbor" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Security" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Text.Encoding" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Text.Encodings.Web" } } ] }, { "operator": "or", "operands": [ { "name": "isAction", "parameters": { "action": "reopened" } }, { "operator": "not", "operands": [ { "name": "isInMilestone", "parameters": {} } ] } ] } ] }, { "operator": "or", "operands": [ { "name": "labelAdded", "parameters": { "label": "area-System.Formats.Asn1" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Formats.Cbor" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Security" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Text.Encoding" } }, { "name": "labelAdded", "parameters": { "label": "area-System.Text.Encodings.Web" } } ] } ] }, { "name": "isOpen", "parameters": {} }, { "operator": "or", "operands": [ { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Jeremy / Levi - Issue Triage", "isOrgProject": true } } ] }, { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Jeremy / Levi - Issue Triage", "isOrgProject": true, "columnName": "Triaged" } } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Jeremy / Levi - Issue Triage] Add new issue to Board", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Jeremy / Levi - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssueCommentResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Formats.Asn1" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Formats.Cbor" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Security" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Text.Encoding" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Text.Encodings.Web" } } ] }, { "operator": "not", "operands": [ { "name": "isCloseAndComment", "parameters": {} } ] }, { "operator": "not", "operands": [ { "name": "activitySenderHasPermissions", "parameters": { "permissions": "write" } } ] }, { "operator": "or", "operands": [ { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Jeremy / Levi - Issue Triage", "isOrgProject": true } } ] }, { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Jeremy / Levi - Issue Triage", "columnName": "Triaged", "isOrgProject": true } } ] } ] }, "eventType": "issue", "eventNames": [ "issue_comment" ], "taskName": "[Area Pod: Jeremy / Levi - Issue Triage] Needs Further Triage", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Jeremy / Levi - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Jeremy / Levi - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } }, { "operator": "and", "operands": [ { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Formats.Asn1" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Formats.Cbor" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Security" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Text.Encoding" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Text.Encodings.Web" } } ] } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Jeremy / Levi - Issue Triage] Remove relabeled issues", "actions": [ { "name": "removeFromProject", "parameters": { "projectName": "Area Pod: Jeremy / Levi - Issue Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Jeremy / Levi - Issue Triage", "isOrgProject": true } }, { "operator": "not", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Jeremy / Levi - Issue Triage", "columnName": "Triaged" } } ] }, { "operator": "or", "operands": [ { "name": "addedToMilestone", "parameters": {} }, { "name": "labelAdded", "parameters": { "label": "needs-author-action" } }, { "name": "labelAdded", "parameters": { "label": "api-ready-for-review" } }, { "name": "isAction", "parameters": { "action": "closed" } } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Jeremy / Levi - Issue Triage] Move to Triaged Column", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Jeremy / Levi - Issue Triage", "columnName": "Triaged", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Formats.Asn1" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Formats.Cbor" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Security" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Text.Encoding" } }, { "name": "hasLabel", "parameters": { "label": "area-System.Text.Encodings.Web" } } ] }, { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Jeremy / Levi - PRs", "isOrgProject": true } } ] } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "[Area Pod: Jeremy / Levi - PRs] Add new PR to Board", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Jeremy / Levi - PRs", "columnName": "Needs Champion", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Jeremy / Levi - PRs", "columnName": "Needs Champion", "isOrgProject": true } }, { "operator": "and", "operands": [ { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Formats.Asn1" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Formats.Cbor" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Security" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Text.Encoding" } } ] }, { "operator": "not", "operands": [ { "name": "hasLabel", "parameters": { "label": "area-System.Text.Encodings.Web" } } ] } ] } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "[Area Pod: Jeremy / Levi - PRs] Remove relabeled PRs", "actions": [ { "name": "removeFromProject", "parameters": { "projectName": "Area Pod: Jeremy / Levi - PRs", "isOrgProject": true } } ] } } ]
1
dotnet/runtime
66,160
Update files to remove imhameed
SamMonoRT
2022-03-03T20:37:43Z
2022-03-04T17:15:58Z
1d82d48e8c8150bfb549f095d6dafb599ff9f229
611d45f73e65076ebff2f8b71c668cf56114deae
Update files to remove imhameed.
./docs/area-owners.md
# Pull Requests Tagging If you need to tag folks on an issue or PR, you will generally want to tag the owners (not the lead) for [area](#areas) to which the change or issue is closest to. For areas which are large and can be operating system or architecture specific it's better to tag owners of [OS](#operating-systems) or [Architecture](#architectures). ## Areas Note: Editing this file doesn't update the mapping used by `@msftbot` for area-specific issue/PR notifications. That configuration is part of the [`fabricbot.json`](../.github/fabricbot.json) file, and many areas use GitHub teams for those notifications. If you're a community member interested in receiving area-specific issue/PR notifications, you won't appear in this table or be added to those GitHub teams, but you can create a PR that updates `fabricbot.json` to add yourself to those notifications. See [automation.md](infra/automation.md) for more information on the schema and tools used by FabricBot. | Area | Lead | Owners (area experts to tag in PR's and issues) | Notes | |------------------------------------------------|---------------|-----------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | area-AssemblyLoader-coreclr | @agocke | @agocke @vitek-karas @vsadov | | | area-AssemblyLoader-mono | @SamMonoRT | @lambdageek | | | area-Build-mono | @steveisok | @akoeplinger | | | area-Codeflow | @dotnet/dnr-codeflow | @dotnet/dnr-codeflow | Used for automated PR's that ingest code from other repos | | area-Codegen-AOT-mono | @SamMonoRT | @vargaz | | | area-CodeGen-coreclr | @JulieLeeMSFT | @BruceForstall @dotnet/jit-contrib | | | area-Codegen-Interpreter-mono | @SamMonoRT | @BrzVlad | | | area-Codegen-JIT-mono | @SamMonoRT | @vargaz | | | area-Codegen-LLVM-mono | @SamMonoRT | @imhameed | | | area-Codegen-meta-mono | @SamMonoRT | @vargaz | | | area-CoreLib-mono | @steveisok | @vargaz | | | area-CrossGen/NGEN-coreclr | @mangod9 | @dotnet/crossgen-contrib | | | area-crossgen2-coreclr | @mangod9 | @trylek @dotnet/crossgen-contrib | | | area-Debugger-mono | @lewing | @thaystg @radical | | | area-DependencyModel | @ericstj | @dotnet/area-dependencymodel | <ul><li>Microsoft.Extensions.DependencyModel</li></ul> | | area-Diagnostics-coreclr | @tommcdon | @tommcdon | | | area-EnC-mono | @marek-safar | @lambdageek | Hot Reload on WebAssembly, Android, iOS, etc | | area-ExceptionHandling-coreclr | @mangod9 | @janvorli | | | area-Extensions-Caching | @ericstj | @dotnet/area-extensions-caching | | | area-Extensions-Configuration | @ericstj | @dotnet/area-extensions-configuration | | | area-Extensions-DependencyInjection | @ericstj | @dotnet/area-extensions-dependencyinjection | | | area-Extensions-FileSystem | @jeffhandley | @dotnet/area-extensions-filesystem | | | area-Extensions-Hosting | @ericstj | @dotnet/area-extensions-hosting | | | area-Extensions-HttpClientFactory | @karelz | @dotnet/ncl | | | area-Extensions-Logging | @ericstj | @dotnet/area-extensions-logging | | | area-Extensions-Options | @ericstj | @dotnet/area-extensions-options | | | area-Extensions-Primitives | @ericstj | @dotnet/area-extensions-primitives | | | area-GC-coreclr | @mangod9 | @Maoni0 | | | area-GC-mono | @SamMonoRT | @BrzVlad | | | area-Host | @agocke | @jeffschwMSFT @vitek-karas @vsadov | Issues with dotnet.exe including bootstrapping, framework detection, hostfxr.dll and hostpolicy.dll | | area-HostModel | @agocke | @vitek-karas | | | area-ILTools-coreclr | @JulieLeeMSFT | @BruceForstall @dotnet/jit-contrib | | | area-ILVerification | @JulieLeeMSFT | @BruceForstall @dotnet/jit-contrib | | | area-Infrastructure | @agocke | @jeffschwMSFT @dleeapho | | | area-Infrastructure-coreclr | @agocke | @jeffschwMSFT @trylek | | | area-Infrastructure-installer | @dleeapho | @dleeapho @NikolaMilosavljevic | | | area-Infrastructure-libraries | @ericstj | @dotnet/area-infrastructure-libraries | Covers:<ul><li>Packaging</li><li>Build and test infra for libraries in dotnet/runtime repo</li><li>VS integration</li></ul><br/> | | area-Infrastructure-mono | @steveisok | @directhex | | | area-Interop-coreclr | @jeffschwMSFT | @jeffschwMSFT @AaronRobinsonMSFT | | | area-Interop-mono | @marek-safar | @lambdageek | | | area-Meta | @danmoseley | @dotnet/area-meta | Cross-cutting concerns that span many or all areas, including project-wide code/test patterns and documentation. | | area-Microsoft.CSharp | @jaredpar | @cston @333fred | Archived component - limited churn/contributions (see [#27790](https://github.com/dotnet/runtime/issues/27790)) | | area-Microsoft.Extensions | @ericstj | @dotnet/area-microsoft-extensions | | | area-Microsoft.VisualBasic | @jaredpar | @cston @333fred | Archived component - limited churn/contributions (see [#27790](https://github.com/dotnet/runtime/issues/27790)) | | area-Microsoft.Win32 | @ericstj | @dotnet/area-microsoft-win32 | Including System.Windows.Extensions | | area-NativeAOT-coreclr | @agocke | @MichalStrehovsky @jkotas | | | area-PAL-coreclr | @mangod9 | @janvorli | | | area-Performance-mono | @SamMonoRT | @SamMonoRT | | | area-R2RDump-coreclr | @mangod9 | @trylek | | | area-ReadyToRun-coreclr | @mangod9 | @trylek | | | area-Serialization | @HongGit | @StephenMolloy @HongGit | Packages:<ul><li>System.Runtime.Serialization.Xml</li><li>System.Runtime.Serialization.Json</li><li>System.Private.DataContractSerialization</li><li>System.Xml.XmlSerializer</li></ul> Excluded:<ul><li>System.Runtime.Serialization.Formatters</li></ul> | | area-Setup | @dleeapho | @NikolaMilosavljevic @dleeapho | Distro-specific (Linux, Mac and Windows) setup packages and msi files | | area-Single-File | @agocke | @vitek-karas @vsadov | | | area-Snap | @dleeapho | @dleeapho @leecow @MichaelSimons | | | area-System.Buffers | @jeffhandley | @dotnet/area-system-buffers | | | area-System.CodeDom | @ericstj | @dotnet/area-system-codedom | | | area-System.Collections | @jeffhandley | @dotnet/area-system-collections | Excluded:<ul><li>System.Array -> System.Runtime</li></ul> | | area-System.ComponentModel | @ericstj | @dotnet/area-system-componentmodel | | | area-System.ComponentModel.Composition | @ericstj | @dotnet/area-system-componentmodel-composition | | | area-System.ComponentModel.DataAnnotations | @ajcvickers | @lajones @ajcvickers | Included:<ul><li>System.ComponentModel.Annotations</li></ul> | | area-System.Composition | @ericstj | @dotnet/area-system-composition | | | area-System.Configuration | @ericstj | @dotnet/area-system-configuration | | | area-System.Console | @jeffhandley | @dotnet/area-system-console | | | area-System.Data | @ajcvickers | @ajcvickers @davoudeshtehari @david-engel | <ul><li>Odbc, OleDb - @saurabh500</li></ul> | | area-System.Data.Odbc | @ajcvickers | @ajcvickers | | | area-System.Data.OleDB | @ajcvickers | @ajcvickers | | | area-System.Data.SqlClient | @David-Engel | @davoudeshtehari @david-engel @jrahnama | Archived component - limited churn/contributions (see https://devblogs.microsoft.com/dotnet/introducing-the-new-microsoftdatasqlclient/) | | area-System.Diagnostics | @tommcdon | @tommcdon | | | area-System.Diagnostics-coreclr | @tommcdon | @tommcdon | | | area-System.Diagnostics-mono | @lewing | @thaystg @radical | | | area-System.Diagnostics.Activity | @tommcdon | @eerhardt @maryamariyan @tarekgh | | | area-System.Diagnostics.EventLog | @ericstj | @dotnet/area-system-diagnostics-eventlog | | | area-System.Diagnostics.Metric | @tommcdon | @noahfalk | | | area-System.Diagnostics.PerformanceCounter | @ericstj | @dotnet/area-system-diagnostics-performancecounter | | | area-System.Diagnostics.Process | @jeffhandley | @dotnet/area-system-diagnostics-process | | | area-System.Diagnostics.Tracing | @tommcdon | @noahfalk @tommcdon @tarekgh | Included: <ul><li>System.Diagnostics.DiagnosticSource</li><li>System.Diagnostics.TraceSource</li></ul> | | area-System.Diagnostics.TraceSource | @ericstj | @dotnet/area-system-diagnostics-tracesource | | | area-System.DirectoryServices | @ericstj | @dotnet/area-system-directoryservices | Consultants: @BRDPM @grubioe @jay98014 | | area-System.Drawing | @ericstj | @dotnet/area-system-drawing | | | area-System.Dynamic.Runtime | @jaredpar | @cston @333fred | Archived component - limited churn/contributions (see [#27790](https://github.com/dotnet/runtime/issues/27790)) | | area-System.Formats.Asn1 | @jeffhandley | @dotnet/area-system-formats-asn1 | | | area-System.Formats.Cbor | @jeffhandley | @dotnet/area-system-formats-cbor | | | area-System.Globalization | @ericstj | @dotnet/area-system-globalization | | | area-System.IO | @jeffhandley | @dotnet/area-system-io | | | area-System.IO.Compression | @jeffhandley | @dotnet/area-system-io-compression | <ul><li>Also includes System.IO.Packaging</li></ul> | | area-System.IO.Pipelines | @kevinpi | @davidfowl @halter73 @jkotalik | | | area-System.Linq | @jeffhandley | @dotnet/area-system-linq | | | area-System.Linq.Expressions | @jaredpar | @cston @333fred | Archived component - limited churn/contributions (see [#27790](https://github.com/dotnet/runtime/issues/27790)) | | area-System.Linq.Parallel | @jeffhandley | @dotnet/area-system-linq-parallel | Consultants: @stephentoub @kouvel | | area-System.Management | @ericstj | @dotnet/area-system-management | WMI | | area-System.Memory | @jeffhandley | @dotnet/area-system-memory | | | area-System.Net | @karelz | @dotnet/ncl | Included:<ul><li>System.Uri</li></ul> | | area-System.Net.Http | @karelz | @dotnet/ncl | | | area-System.Net.Quic | @karelz | @dotnet/ncl | | | area-System.Net.Security | @karelz | @dotnet/ncl | | | area-System.Net.Sockets | @karelz | @dotnet/ncl | | | area-System.Numerics | @jeffhandley | @dotnet/area-system-numerics | | | area-System.Numerics.Tensors | @jeffhandley | @dotnet/area-system-numerics-tensors | | | area-System.Reflection | @ericstj | @dotnet/area-system-reflection | | | area-System.Reflection-mono | @SamMonoRT | @lambdageek | MonoVM-specific reflection and reflection-emit issues | | area-System.Reflection.Emit | @ericstj | @dotnet/area-system-reflection-emit | | | area-System.Reflection.Metadata | @ericstj | @dotnet/area-system-reflection-metadata | Consultants: @tmat | | area-System.Resources | @ericstj | @dotnet/area-system-resources | | | area-System.Runtime | @jeffhandley | @dotnet/area-system-runtime | Included:<ul><li>System.Runtime.Serialization.Formatters</li><li>System.Runtime.InteropServices.RuntimeInfo</li><li>System.Array</li></ul>Excluded:<ul><li>Path -> System.IO</li><li>StopWatch -> System.Diagnostics</li><li>Uri -> System.Net</li><li>WebUtility -> System.Net</li></ul> | | area-System.Runtime.Caching | @HongGit | @StephenMolloy @HongGit | | | area-System.Runtime.CompilerServices | @ericstj | @dotnet/area-system-runtime-compilerservices | | | area-System.Runtime.InteropServices | @jeffschwMSFT | @AaronRobinsonMSFT @jkoritzinsky | Excluded:<ul><li>System.Runtime.InteropServices.RuntimeInfo</li></ul> | | area-System.Runtime.InteropServices.JavaScript | @lewing | @kjpou1 | | | area-System.Runtime.Intrinsics | @jeffhandley | @dotnet/area-system-runtime-intrinsics | Consultants: @echesakovMSFT @kunalspathak | | area-System.Security | @jeffhandley | @dotnet/area-system-security | | | area-System.ServiceModel | @HongGit | @HongGit @mconnew | Repo: https://github.com/dotnet/WCF<br>Packages:<ul><li>System.ServiceModel.Primitives</li><li>System.ServiceModel.Http</li><li>System.ServiceModel.NetTcp</li><li>System.ServiceModel.Duplex</li><li>System.ServiceModel.Security</li></ul> | | area-System.ServiceModel.Syndication | @HongGit | @StephenMolloy @HongGit | | | area-System.ServiceProcess | @ericstj | @dotnet/area-system-serviceprocess | | | area-System.Speech | @danmoseley | @danmoseley | | | area-System.Text.Encoding | @jeffhandley | @dotnet/area-system-text-encoding | | | area-System.Text.Encodings.Web | @jeffhandley | @dotnet/area-system-text-encodings-web | | | area-System.Text.Json | @jeffhandley | @dotnet/area-system-text-json | | | area-System.Text.RegularExpressions | @ericstj | @dotnet/area-system-text-regularexpressions | Consultants: @stephentoub | | area-System.Threading | @mangod9 | @kouvel | | | area-System.Threading.Channels | @ericstj | @dotnet/area-system-threading-channels | Consultants: @stephentoub | | area-System.Threading.RateLimiting | @rafikiassumani-msft | @BrennanConroy @halter73 | Consultants: @eerhardt | | area-System.Threading.Tasks | @ericstj | @dotnet/area-system-threading-tasks | Consultants: @stephentoub | | area-System.Transactions | @HongGit | @HongGit | | | area-System.Xml | @jeffhandley | @dotnet/area-system-xml | | | area-Threading-mono | @SamMonoRT | @lambdageek | | | area-TieredCompilation-coreclr | @mangod9 | @kouvel | | | area-Tracing-coreclr | @tommcdon | @sywhang @josalem | | | area-Tracing-mono | @steveisok | @lateralusX | | | area-TypeSystem-coreclr | @mangod9 | @davidwrighton @MichalStrehovsky @janvorli @mangod9 | | | area-UWP | @tommcdon | @jashook | UWP-specific issues including Microsoft.NETCore.UniversalWindowsPlatform and Microsoft.Net.UWPCoreRuntimeSdk | | area-VM-coreclr | @mangod9 | @mangod9 | | | area-VM-meta-mono | @SamMonoRT | @lambdageek | | ## Operating Systems | Operating System | Lead | Owners (area experts to tag in PR's and issues) | Description | |------------------|---------------|-----------------------------------------------------|--------------| | os-alpine | | | | | os-android | @steveisok | @akoeplinger | | | os-freebsd | | | | | os-mac-os-x | | | | | os-maccatalyst | @steveisok | | | | os-ios | @steveisok | @vargaz | | | os-tvos | @steveisok | @vargaz | | ## Architectures | Architecture | Lead | Owners (area experts to tag in PR's and issues) | Description | |------------------|---------------|-----------------------------------------------------|--------------| | arch-wasm | @lewing | @lewing @BrzVlad | | ## Community Triagers The repo has a number of community members carrying the triager role. While not necessarily associated with a specific area, they may assist with labeling issues and pull requests. Currently, the following community members are triagers: * @huoyaoyuan * @SingleAccretion * @teo-tsirpanis * @tmds * @vcsjones
# Pull Requests Tagging If you need to tag folks on an issue or PR, you will generally want to tag the owners (not the lead) for [area](#areas) to which the change or issue is closest to. For areas which are large and can be operating system or architecture specific it's better to tag owners of [OS](#operating-systems) or [Architecture](#architectures). ## Areas Note: Editing this file doesn't update the mapping used by `@msftbot` for area-specific issue/PR notifications. That configuration is part of the [`fabricbot.json`](../.github/fabricbot.json) file, and many areas use GitHub teams for those notifications. If you're a community member interested in receiving area-specific issue/PR notifications, you won't appear in this table or be added to those GitHub teams, but you can create a PR that updates `fabricbot.json` to add yourself to those notifications. See [automation.md](infra/automation.md) for more information on the schema and tools used by FabricBot. | Area | Lead | Owners (area experts to tag in PR's and issues) | Notes | |------------------------------------------------|---------------|-----------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | area-AssemblyLoader-coreclr | @agocke | @agocke @vitek-karas @vsadov | | | area-AssemblyLoader-mono | @SamMonoRT | @lambdageek | | | area-Build-mono | @steveisok | @akoeplinger | | | area-Codeflow | @dotnet/dnr-codeflow | @dotnet/dnr-codeflow | Used for automated PR's that ingest code from other repos | | area-Codegen-AOT-mono | @SamMonoRT | @vargaz | | | area-CodeGen-coreclr | @JulieLeeMSFT | @BruceForstall @dotnet/jit-contrib | | | area-Codegen-Interpreter-mono | @SamMonoRT | @BrzVlad | | | area-Codegen-JIT-mono | @SamMonoRT | @vargaz | | | area-Codegen-LLVM-mono | @SamMonoRT | @vargaz | | | area-Codegen-meta-mono | @SamMonoRT | @vargaz | | | area-CoreLib-mono | @steveisok | @vargaz | | | area-CrossGen/NGEN-coreclr | @mangod9 | @dotnet/crossgen-contrib | | | area-crossgen2-coreclr | @mangod9 | @trylek @dotnet/crossgen-contrib | | | area-Debugger-mono | @lewing | @thaystg @radical | | | area-DependencyModel | @ericstj | @dotnet/area-dependencymodel | <ul><li>Microsoft.Extensions.DependencyModel</li></ul> | | area-Diagnostics-coreclr | @tommcdon | @tommcdon | | | area-EnC-mono | @marek-safar | @lambdageek | Hot Reload on WebAssembly, Android, iOS, etc | | area-ExceptionHandling-coreclr | @mangod9 | @janvorli | | | area-Extensions-Caching | @ericstj | @dotnet/area-extensions-caching | | | area-Extensions-Configuration | @ericstj | @dotnet/area-extensions-configuration | | | area-Extensions-DependencyInjection | @ericstj | @dotnet/area-extensions-dependencyinjection | | | area-Extensions-FileSystem | @jeffhandley | @dotnet/area-extensions-filesystem | | | area-Extensions-Hosting | @ericstj | @dotnet/area-extensions-hosting | | | area-Extensions-HttpClientFactory | @karelz | @dotnet/ncl | | | area-Extensions-Logging | @ericstj | @dotnet/area-extensions-logging | | | area-Extensions-Options | @ericstj | @dotnet/area-extensions-options | | | area-Extensions-Primitives | @ericstj | @dotnet/area-extensions-primitives | | | area-GC-coreclr | @mangod9 | @Maoni0 | | | area-GC-mono | @SamMonoRT | @BrzVlad | | | area-Host | @agocke | @jeffschwMSFT @vitek-karas @vsadov | Issues with dotnet.exe including bootstrapping, framework detection, hostfxr.dll and hostpolicy.dll | | area-HostModel | @agocke | @vitek-karas | | | area-ILTools-coreclr | @JulieLeeMSFT | @BruceForstall @dotnet/jit-contrib | | | area-ILVerification | @JulieLeeMSFT | @BruceForstall @dotnet/jit-contrib | | | area-Infrastructure | @agocke | @jeffschwMSFT @dleeapho | | | area-Infrastructure-coreclr | @agocke | @jeffschwMSFT @trylek | | | area-Infrastructure-installer | @dleeapho | @dleeapho @NikolaMilosavljevic | | | area-Infrastructure-libraries | @ericstj | @dotnet/area-infrastructure-libraries | Covers:<ul><li>Packaging</li><li>Build and test infra for libraries in dotnet/runtime repo</li><li>VS integration</li></ul><br/> | | area-Infrastructure-mono | @steveisok | @directhex | | | area-Interop-coreclr | @jeffschwMSFT | @jeffschwMSFT @AaronRobinsonMSFT | | | area-Interop-mono | @marek-safar | @lambdageek | | | area-Meta | @danmoseley | @dotnet/area-meta | Cross-cutting concerns that span many or all areas, including project-wide code/test patterns and documentation. | | area-Microsoft.CSharp | @jaredpar | @cston @333fred | Archived component - limited churn/contributions (see [#27790](https://github.com/dotnet/runtime/issues/27790)) | | area-Microsoft.Extensions | @ericstj | @dotnet/area-microsoft-extensions | | | area-Microsoft.VisualBasic | @jaredpar | @cston @333fred | Archived component - limited churn/contributions (see [#27790](https://github.com/dotnet/runtime/issues/27790)) | | area-Microsoft.Win32 | @ericstj | @dotnet/area-microsoft-win32 | Including System.Windows.Extensions | | area-NativeAOT-coreclr | @agocke | @MichalStrehovsky @jkotas | | | area-PAL-coreclr | @mangod9 | @janvorli | | | area-Performance-mono | @SamMonoRT | @SamMonoRT | | | area-R2RDump-coreclr | @mangod9 | @trylek | | | area-ReadyToRun-coreclr | @mangod9 | @trylek | | | area-Serialization | @HongGit | @StephenMolloy @HongGit | Packages:<ul><li>System.Runtime.Serialization.Xml</li><li>System.Runtime.Serialization.Json</li><li>System.Private.DataContractSerialization</li><li>System.Xml.XmlSerializer</li></ul> Excluded:<ul><li>System.Runtime.Serialization.Formatters</li></ul> | | area-Setup | @dleeapho | @NikolaMilosavljevic @dleeapho | Distro-specific (Linux, Mac and Windows) setup packages and msi files | | area-Single-File | @agocke | @vitek-karas @vsadov | | | area-Snap | @dleeapho | @dleeapho @leecow @MichaelSimons | | | area-System.Buffers | @jeffhandley | @dotnet/area-system-buffers | | | area-System.CodeDom | @ericstj | @dotnet/area-system-codedom | | | area-System.Collections | @jeffhandley | @dotnet/area-system-collections | Excluded:<ul><li>System.Array -> System.Runtime</li></ul> | | area-System.ComponentModel | @ericstj | @dotnet/area-system-componentmodel | | | area-System.ComponentModel.Composition | @ericstj | @dotnet/area-system-componentmodel-composition | | | area-System.ComponentModel.DataAnnotations | @ajcvickers | @lajones @ajcvickers | Included:<ul><li>System.ComponentModel.Annotations</li></ul> | | area-System.Composition | @ericstj | @dotnet/area-system-composition | | | area-System.Configuration | @ericstj | @dotnet/area-system-configuration | | | area-System.Console | @jeffhandley | @dotnet/area-system-console | | | area-System.Data | @ajcvickers | @ajcvickers @davoudeshtehari @david-engel | <ul><li>Odbc, OleDb - @saurabh500</li></ul> | | area-System.Data.Odbc | @ajcvickers | @ajcvickers | | | area-System.Data.OleDB | @ajcvickers | @ajcvickers | | | area-System.Data.SqlClient | @David-Engel | @davoudeshtehari @david-engel @jrahnama | Archived component - limited churn/contributions (see https://devblogs.microsoft.com/dotnet/introducing-the-new-microsoftdatasqlclient/) | | area-System.Diagnostics | @tommcdon | @tommcdon | | | area-System.Diagnostics-coreclr | @tommcdon | @tommcdon | | | area-System.Diagnostics-mono | @lewing | @thaystg @radical | | | area-System.Diagnostics.Activity | @tommcdon | @eerhardt @maryamariyan @tarekgh | | | area-System.Diagnostics.EventLog | @ericstj | @dotnet/area-system-diagnostics-eventlog | | | area-System.Diagnostics.Metric | @tommcdon | @noahfalk | | | area-System.Diagnostics.PerformanceCounter | @ericstj | @dotnet/area-system-diagnostics-performancecounter | | | area-System.Diagnostics.Process | @jeffhandley | @dotnet/area-system-diagnostics-process | | | area-System.Diagnostics.Tracing | @tommcdon | @noahfalk @tommcdon @tarekgh | Included: <ul><li>System.Diagnostics.DiagnosticSource</li><li>System.Diagnostics.TraceSource</li></ul> | | area-System.Diagnostics.TraceSource | @ericstj | @dotnet/area-system-diagnostics-tracesource | | | area-System.DirectoryServices | @ericstj | @dotnet/area-system-directoryservices | Consultants: @BRDPM @grubioe @jay98014 | | area-System.Drawing | @ericstj | @dotnet/area-system-drawing | | | area-System.Dynamic.Runtime | @jaredpar | @cston @333fred | Archived component - limited churn/contributions (see [#27790](https://github.com/dotnet/runtime/issues/27790)) | | area-System.Formats.Asn1 | @jeffhandley | @dotnet/area-system-formats-asn1 | | | area-System.Formats.Cbor | @jeffhandley | @dotnet/area-system-formats-cbor | | | area-System.Globalization | @ericstj | @dotnet/area-system-globalization | | | area-System.IO | @jeffhandley | @dotnet/area-system-io | | | area-System.IO.Compression | @jeffhandley | @dotnet/area-system-io-compression | <ul><li>Also includes System.IO.Packaging</li></ul> | | area-System.IO.Pipelines | @kevinpi | @davidfowl @halter73 @jkotalik | | | area-System.Linq | @jeffhandley | @dotnet/area-system-linq | | | area-System.Linq.Expressions | @jaredpar | @cston @333fred | Archived component - limited churn/contributions (see [#27790](https://github.com/dotnet/runtime/issues/27790)) | | area-System.Linq.Parallel | @jeffhandley | @dotnet/area-system-linq-parallel | Consultants: @stephentoub @kouvel | | area-System.Management | @ericstj | @dotnet/area-system-management | WMI | | area-System.Memory | @jeffhandley | @dotnet/area-system-memory | | | area-System.Net | @karelz | @dotnet/ncl | Included:<ul><li>System.Uri</li></ul> | | area-System.Net.Http | @karelz | @dotnet/ncl | | | area-System.Net.Quic | @karelz | @dotnet/ncl | | | area-System.Net.Security | @karelz | @dotnet/ncl | | | area-System.Net.Sockets | @karelz | @dotnet/ncl | | | area-System.Numerics | @jeffhandley | @dotnet/area-system-numerics | | | area-System.Numerics.Tensors | @jeffhandley | @dotnet/area-system-numerics-tensors | | | area-System.Reflection | @ericstj | @dotnet/area-system-reflection | | | area-System.Reflection-mono | @SamMonoRT | @lambdageek | MonoVM-specific reflection and reflection-emit issues | | area-System.Reflection.Emit | @ericstj | @dotnet/area-system-reflection-emit | | | area-System.Reflection.Metadata | @ericstj | @dotnet/area-system-reflection-metadata | Consultants: @tmat | | area-System.Resources | @ericstj | @dotnet/area-system-resources | | | area-System.Runtime | @jeffhandley | @dotnet/area-system-runtime | Included:<ul><li>System.Runtime.Serialization.Formatters</li><li>System.Runtime.InteropServices.RuntimeInfo</li><li>System.Array</li></ul>Excluded:<ul><li>Path -> System.IO</li><li>StopWatch -> System.Diagnostics</li><li>Uri -> System.Net</li><li>WebUtility -> System.Net</li></ul> | | area-System.Runtime.Caching | @HongGit | @StephenMolloy @HongGit | | | area-System.Runtime.CompilerServices | @ericstj | @dotnet/area-system-runtime-compilerservices | | | area-System.Runtime.InteropServices | @jeffschwMSFT | @AaronRobinsonMSFT @jkoritzinsky | Excluded:<ul><li>System.Runtime.InteropServices.RuntimeInfo</li></ul> | | area-System.Runtime.InteropServices.JavaScript | @lewing | @kjpou1 | | | area-System.Runtime.Intrinsics | @jeffhandley | @dotnet/area-system-runtime-intrinsics | Consultants: @echesakovMSFT @kunalspathak | | area-System.Security | @jeffhandley | @dotnet/area-system-security | | | area-System.ServiceModel | @HongGit | @HongGit @mconnew | Repo: https://github.com/dotnet/WCF<br>Packages:<ul><li>System.ServiceModel.Primitives</li><li>System.ServiceModel.Http</li><li>System.ServiceModel.NetTcp</li><li>System.ServiceModel.Duplex</li><li>System.ServiceModel.Security</li></ul> | | area-System.ServiceModel.Syndication | @HongGit | @StephenMolloy @HongGit | | | area-System.ServiceProcess | @ericstj | @dotnet/area-system-serviceprocess | | | area-System.Speech | @danmoseley | @danmoseley | | | area-System.Text.Encoding | @jeffhandley | @dotnet/area-system-text-encoding | | | area-System.Text.Encodings.Web | @jeffhandley | @dotnet/area-system-text-encodings-web | | | area-System.Text.Json | @jeffhandley | @dotnet/area-system-text-json | | | area-System.Text.RegularExpressions | @ericstj | @dotnet/area-system-text-regularexpressions | Consultants: @stephentoub | | area-System.Threading | @mangod9 | @kouvel | | | area-System.Threading.Channels | @ericstj | @dotnet/area-system-threading-channels | Consultants: @stephentoub | | area-System.Threading.RateLimiting | @rafikiassumani-msft | @BrennanConroy @halter73 | Consultants: @eerhardt | | area-System.Threading.Tasks | @ericstj | @dotnet/area-system-threading-tasks | Consultants: @stephentoub | | area-System.Transactions | @HongGit | @HongGit | | | area-System.Xml | @jeffhandley | @dotnet/area-system-xml | | | area-Threading-mono | @SamMonoRT | @lambdageek | | | area-TieredCompilation-coreclr | @mangod9 | @kouvel | | | area-Tracing-coreclr | @tommcdon | @sywhang @josalem | | | area-Tracing-mono | @steveisok | @lateralusX | | | area-TypeSystem-coreclr | @mangod9 | @davidwrighton @MichalStrehovsky @janvorli @mangod9 | | | area-UWP | @tommcdon | @jashook | UWP-specific issues including Microsoft.NETCore.UniversalWindowsPlatform and Microsoft.Net.UWPCoreRuntimeSdk | | area-VM-coreclr | @mangod9 | @mangod9 | | | area-VM-meta-mono | @SamMonoRT | @lambdageek | | ## Operating Systems | Operating System | Lead | Owners (area experts to tag in PR's and issues) | Description | |------------------|---------------|-----------------------------------------------------|--------------| | os-alpine | | | | | os-android | @steveisok | @akoeplinger | | | os-freebsd | | | | | os-mac-os-x | | | | | os-maccatalyst | @steveisok | | | | os-ios | @steveisok | @vargaz | | | os-tvos | @steveisok | @vargaz | | ## Architectures | Architecture | Lead | Owners (area experts to tag in PR's and issues) | Description | |------------------|---------------|-----------------------------------------------------|--------------| | arch-wasm | @lewing | @lewing @BrzVlad | | ## Community Triagers The repo has a number of community members carrying the triager role. While not necessarily associated with a specific area, they may assist with labeling issues and pull requests. Currently, the following community members are triagers: * @huoyaoyuan * @SingleAccretion * @teo-tsirpanis * @tmds * @vcsjones
1
dotnet/runtime
66,160
Update files to remove imhameed
SamMonoRT
2022-03-03T20:37:43Z
2022-03-04T17:15:58Z
1d82d48e8c8150bfb549f095d6dafb599ff9f229
611d45f73e65076ebff2f8b71c668cf56114deae
Update files to remove imhameed.
./src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/localize/WorkloadManifest.de.json
{ "workloads/wasm-tools/description": ".NET WebAssembly-Buildtools" }
{ "workloads/wasm-tools/description": ".NET WebAssembly-Buildtools" }
-1
dotnet/runtime
66,160
Update files to remove imhameed
SamMonoRT
2022-03-03T20:37:43Z
2022-03-04T17:15:58Z
1d82d48e8c8150bfb549f095d6dafb599ff9f229
611d45f73e65076ebff2f8b71c668cf56114deae
Update files to remove imhameed.
./.github/workflows/markdownlint-problem-matcher.json
{ "problemMatcher": [ { "owner": "markdownlint", "pattern": [ { "regexp": "^([^:]*):(\\d+):?(\\d+)?\\s([\\w-\\/]*)\\s(.*)$", "file": 1, "line": 2, "column": 3, "code": 4, "message": 5 } ] } ] }
{ "problemMatcher": [ { "owner": "markdownlint", "pattern": [ { "regexp": "^([^:]*):(\\d+):?(\\d+)?\\s([\\w-\\/]*)\\s(.*)$", "file": 1, "line": 2, "column": 3, "code": 4, "message": 5 } ] } ] }
-1
dotnet/runtime
66,160
Update files to remove imhameed
SamMonoRT
2022-03-03T20:37:43Z
2022-03-04T17:15:58Z
1d82d48e8c8150bfb549f095d6dafb599ff9f229
611d45f73e65076ebff2f8b71c668cf56114deae
Update files to remove imhameed.
./docs/design/features/source-generator-pinvokes.md
# Source Generator P/Invokes ## Purpose The CLR possesses a rich built-in marshaling mechanism for interoperability with native code that is handled at runtime. This system was designed to free .NET developers from having to author complex and potentially ABI sensitive [type conversion code][typemarshal_link] from a managed to an unmanaged environment. The built-in system works with both [P/Invoke][pinvoke_link] (i.e. `DllImportAttribute`) and [COM interop](https://docs.microsoft.com/dotnet/standard/native-interop/cominterop). The generated portion is typically called an ["IL Stub"][il_stub_link] since the stub is generated by inserting IL instructions into a stream and then passing that stream to the JIT for compilation. A consequence of this approach is that marshaling code is not immediately available post-link for AOT scenarios (e.g. [`crossgen`](../../workflow/building/coreclr/crossgen.md) and [`crossgen2`](crossgen2-compilation-structure-enhancements.md)). The immediate unavailability of this code has been mitigated by a complex mechanism to have marshalling code generated by during AOT compilation. The [IL Linker][ilinker_link] is another tool that struggles with runtime generated code since it is unable to understand all potential used types without seeing what is generated. The user experience of the built-in generation initially appears ideal, but there are several negative consequences that make the system costly in the long term: * Bug fixes in the marshaling system require an update to the entire runtime. * New types require enhancements to the marshaling system for efficient marshal behavior. * [`ICustomMarshaler`](https://docs.microsoft.com/dotnet/api/system.runtime.interopservices.icustommarshaler) incurs a substantial performance penalty. * Once a marshaling bug becomes expected behavior the bug is difficult to fix. This is due to user reliance on shipped behavior and since the marshaling system is built into the runtime there aren't ways to select previous or new behavior. * Example involving COM marshaling: https://github.com/dotnet/coreclr/pull/23974. * Debugging the auto-generated marshaling IL Stub is difficult for runtime developers and close to impossible for consumers of P/Invokes. This is not to say the P/Invoke system should be completely redesigned. The current system is heavily used and its simplicity for consuming native assets is a benefit. Rather this new mechanism is designed to provide a way for marshaling code to be generated by an external tool but work with existing `DllImportAttribute` practices in a way that isn't onerous on current .NET developers. The [Roslyn Compiler](https://github.com/dotnet/roslyn) team is working on a [Source Generator feature][source_gen_link] that will allow the generation of additional source files that can be added to an assembly during the compilation process - the runtime generation IL Stubs is an in-memory version of this scenario. **Note** This proposal is targeted at addressing P/Invoke improvements but could be adapted to work with COM interop utilizing the new [`ComWrappers`][comwrappers_link] API. ### Requirements * [Source Generators][source_gen_link] * Branch: https://github.com/dotnet/roslyn/tree/features/source-generators * Support for non-`void` return types in [`partial`](https://docs.microsoft.com/dotnet/csharp/language-reference/keywords/partial-method) methods. * https://github.com/dotnet/csharplang/issues/3301 ## Design Using Source Generators is focused on integrating with existing `DllImportAttribute` practices from an invocation point of view (i.e. callsites should not need to be updated). The idea behind Source Generators is that code for some scenarios can be precomputed using user declared types, metadata, and logic thus avoiding the need to generate code at runtime. **Goals** * Allow P/Invoke interop evolution independently of runtime. * High performance: No reflection at runtime, compatible in an AOT scenario. **Non-Goals** * 100 % parity with existing P/Invoke marshaling rules. * Zero code change for the developers. ### P/Invoke Walkthrough The P/Invoke algorithm is presented below using a simple example. ``` CSharp /* A */ [DllImportAttribute("Kernel32.dll")] /* B */ extern static bool QueryPerformanceCounter(out long lpPerformanceCount); ... long count; /* C */ QueryPerformanceCounter(out count); ``` At (A) in the above code snippet, the runtime is told to look for an export name `QueryPerformanceCounter` (B) in the `Kernel32.dll` binary. There are many additional attributes on the `DllImportAttribute` that help with export discovery and can influence the semantics of the generated IL Stub. Point (C) represents an invocation of the P/Invoke. Most of the work occurs at (C) at runtime, since (A) and (B) are merely declarations the compiler uses to embed the relevant details into assembly metadata that is read at runtime. 1) During invocation, the function declaration is determined to be an external call requiring marshaling. Given the defined properties in the `DllImportAttribute` instance as well as the metadata of the user-defined signature an IL Stub is generated. 2) The runtime attempts to find a binary with the name supplied in `DllImportAttribute`. * Discovery of the target binary is complicated and can be influenced by the [`AssemblyLoadContext`](https://docs.microsoft.com/dotnet/api/system.runtime.loader.assemblyloadcontext) and [`NativeLibrary`](https://docs.microsoft.com/dotnet/api/system.runtime.interopservices.nativelibrary) classes. 3) Once the binary is found and loaded into the runtime, it is queried for the expected export name. The name of the attributed function is used by default but this is configurable by the [`DllImportAttribute.EntryPoint`](https://docs.microsoft.com/dotnet/api/system.runtime.interopservices.dllimportattribute.entrypoint) property. * This process is also influenced by additional `DllImportAttribute` properties as well as by the underlying platform. For example, the [Win32 API ANSI/UNICODE convention](https://docs.microsoft.com/windows/win32/intl/conventions-for-function-prototypes) on Windows is respected and a(n) `A`/`W` suffix may be appended to the function name if it is not immediately found. 4) The IL Stub is called like any other .NET method. 5) The IL Stub marshals arguments as appropriate and invokes the export via the `calli` instruction. 6) Once the export returns control to the IL Stub the marshaling logic cleans up and ensures any returned data is marshaled back out to the calling function. ### Source Generator Integration An example of how the previous P/Invoke snippet could be transformed is below. This example is using the proposed API in this document. The Source Generator has a restriction of no user code modification so that is reflected in the design and mitigations for easing code adoption is presented later. `Program.cs` (User written code) ``` CSharp /* A */ [GeneratedDllImportAttribute("Kernel32.dll")] /* B */ partial static bool QueryPerformanceCounter(out long lpPerformanceCount); ... long count; /* C*/ QueryPerformanceCounter(out count); ``` Observe point (A), the new attribute. This attribute provides an indication to a Source Generator that the following declaration represents a native export that will be called via a generated stub. During the source generation process the metadata in the `GeneratedDllImportAttribute` (A) would be used to generate a stub and invoke the desired native export. Also note that the method declaration is marked `partial`. The Source Generator would then generate the source for this partial method. The invocation (C) remains unchanged to that of usage involving `DllImportAttribute`. `Stubs.g.cs` (Source Generator code) ``` CSharp /* D */ partial static bool QueryPerformanceCounter(out long lpPerformanceCount) { unsafe { long result = 0; bool success = QueryPerformanceCounter(&result) != 0; lpPerformanceCount = result; return success; } } [DllImportAttribute("Kernel32.dll")] /* E */ private static extern int QueryPerformanceCounter(long* lpPerformanceCount); ``` The Source Generator would generate the implementation of the partial method (D) in a separate translation unit (`Stubs.g.cs`). At point (E) a `DllImportAttribute` declaration is created based on the user's original declaration (A) for a private P/Invoke specifically for the generated code. The P/Invoke signature from the original declaration would be modified to contain only [blittable types][blittable_link] to ensure the JIT could inline the invocation. Finally note that the user's original function signature would remain in to avoid impacting existing callsites. In this system it is not defined how marshaling of specific types would be performed. The built-in runtime has complex rules for some types, and it is these rules that once shipped become the de facto standard - often times regardless if the behavior is a bug or not. The design here is not concerned with how the arguments go from a managed to unmanaged environment. With the IL Stub generation extracted from the runtime new type marshaling (e.g. [`Span<T>`](https://docs.microsoft.com/dotnet/api/system.span-1)) could be introduced without requiring an corresponding update to the runtime itself. The `Span<T>` type is good example of a type that at present has no support for marshaling, but with this proposal users could update to the latest generator and have support without changing the runtime. ### Adoption of Source Generator In the current Source Generator design modification of any user written code is not permitted. This includes modification of any non-functional metadata (e.g. Attributes). The above design therefore introduces a new attribute and signature for consumption of a native export. In order to consume Source Generators, users would need to update their source and adoption could be stunted by this requirement. As a mitigation it would be possible to create a [Roslyn Analyzer and Code fix](https://github.com/dotnet/roslyn/blob/master/docs/wiki/Getting-Started-Writing-a-Custom-Analyzer-&-Code-Fix.md) to aid the developer in converting `DllImportAttribute` marked functions to use `GeneratedDllImportAttribute`. Additionally, the function signature would need to be updated to remove the `extern` keyword and add the `partial` keyword to the function and potentially the enclosing class. ## Proposed API Given the Source Generator restrictions and potential confusion about overloaded attribute usage, the new `GeneratedDllImportAttribute` attribute mirrors the existing `DllImportAttribute`. ``` CSharp namespace System.Runtime.InteropServices { /// <summary> /// Attribute used to indicate a Source Generator should create a function for marshaling /// arguments instead of relying on the CLR to generate an IL Stub at runtime. /// </summary> [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] public sealed class GeneratedDllImportAttribute : Attribute { /// <summary> /// Enables or disables best-fit mapping behavior when converting Unicode characters /// to ANSI characters. /// </summary> /// <see cref="System.Runtime.InteropServices.DllImportAttribute.BestFitMapping"/> public bool BestFitMapping; /// <summary> /// Indicates the calling convention of an entry point. /// </summary> /// <see cref="System.Runtime.InteropServices.DllImportAttribute.CallingConvention"/> public CallingConvention CallingConvention; /// <summary> /// Indicates how to marshal string parameters to the method and controls name mangling. /// </summary> /// <see cref="System.Runtime.InteropServices.DllImportAttribute.CharSet"/> public CharSet CharSet; /// <summary> /// Indicates the name or ordinal of the DLL entry point to be called. /// </summary> /// <see cref="System.Runtime.InteropServices.DllImportAttribute.EntryPoint"/> public string? EntryPoint; /// <summary> /// Controls whether the System.Runtime.InteropServices.DllImportAttribute.CharSet /// field causes the common language runtime to search an unmanaged DLL for entry-point /// names other than the one specified. /// </summary> /// <see cref="System.Runtime.InteropServices.DllImportAttribute.ExactSpelling"/> public bool ExactSpelling; /// <summary> /// Indicates whether unmanaged methods that have HRESULT or retval return values /// are directly translated or whether HRESULT or retval return values are automatically /// converted to exceptions. /// </summary> /// <see cref="System.Runtime.InteropServices.DllImportAttribute.PreserveSig"/> public bool PreserveSig; /// <summary> /// Indicates whether the callee calls the SetLastError Windows API function before /// returning from the attributed method. /// </summary> /// <see cref="System.Runtime.InteropServices.DllImportAttribute.SetLastError"/> public bool SetLastError; /// <summary> /// Enables or disables the throwing of an exception on an unmappable Unicode character /// that is converted to an ANSI "?" character. /// </summary> /// <see cref="System.Runtime.InteropServices.DllImportAttribute.ThrowOnUnmappableChar"/> public bool ThrowOnUnmappableChar; } } ``` ## FAQs * Can the above API be used to provide a reverse P/Invoke stub? * No. Reverse P/Invoke invocation is performed via a delegate and integrating this proposal would prove difficult. Alternative approach is to leverage the [`NativeCallableAttribute`](https://github.com/dotnet/runtime/issues/32462) feature. * How will users get error messages during source generator? * The Source Generator API will be permitted to provide warnings and errors through the [Roslyn SDK](https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/). * Will it be possible to completely replicate the marshaling rules in the current built-in system using existing .NET APIs? * No. There are rules and semantics that would be difficult to replicate with the current .NET API surface. Additional .NET APIs will likely need to be added in order to allow a Source Generator implementation to provide identical semantics with the built-in system (e.g. Respecting the semantics of [`DllImportAttribute.SetLastError`](https://docs.microsoft.com/dotnet/api/system.runtime.interopservices.dllimportattribute.setlasterror)). ## References [P/Invoke][pinvoke_link] [Type Marshaling][typemarshal_link] [IL Stubs description][il_stub_link] <!-- Common links --> [typemarshal_link]: https://docs.microsoft.com/dotnet/standard/native-interop/type-marshaling [pinvoke_link]: https://docs.microsoft.com/dotnet/standard/native-interop/pinvoke [comwrappers_link]: https://github.com/dotnet/runtime/issues/1845 [il_stub_link]: https://mattwarren.org/2019/09/26/Stubs-in-the-.NET-Runtime/ [source_gen_link]: https://github.com/dotnet/roslyn/blob/features/source-generators/docs/features/source-generators.md [blittable_link]: https://docs.microsoft.com/dotnet/framework/interop/blittable-and-non-blittable-types [ilinker_link]: https://github.com/mono/linker
# Source Generator P/Invokes ## Purpose The CLR possesses a rich built-in marshaling mechanism for interoperability with native code that is handled at runtime. This system was designed to free .NET developers from having to author complex and potentially ABI sensitive [type conversion code][typemarshal_link] from a managed to an unmanaged environment. The built-in system works with both [P/Invoke][pinvoke_link] (i.e. `DllImportAttribute`) and [COM interop](https://docs.microsoft.com/dotnet/standard/native-interop/cominterop). The generated portion is typically called an ["IL Stub"][il_stub_link] since the stub is generated by inserting IL instructions into a stream and then passing that stream to the JIT for compilation. A consequence of this approach is that marshaling code is not immediately available post-link for AOT scenarios (e.g. [`crossgen`](../../workflow/building/coreclr/crossgen.md) and [`crossgen2`](crossgen2-compilation-structure-enhancements.md)). The immediate unavailability of this code has been mitigated by a complex mechanism to have marshalling code generated by during AOT compilation. The [IL Linker][ilinker_link] is another tool that struggles with runtime generated code since it is unable to understand all potential used types without seeing what is generated. The user experience of the built-in generation initially appears ideal, but there are several negative consequences that make the system costly in the long term: * Bug fixes in the marshaling system require an update to the entire runtime. * New types require enhancements to the marshaling system for efficient marshal behavior. * [`ICustomMarshaler`](https://docs.microsoft.com/dotnet/api/system.runtime.interopservices.icustommarshaler) incurs a substantial performance penalty. * Once a marshaling bug becomes expected behavior the bug is difficult to fix. This is due to user reliance on shipped behavior and since the marshaling system is built into the runtime there aren't ways to select previous or new behavior. * Example involving COM marshaling: https://github.com/dotnet/coreclr/pull/23974. * Debugging the auto-generated marshaling IL Stub is difficult for runtime developers and close to impossible for consumers of P/Invokes. This is not to say the P/Invoke system should be completely redesigned. The current system is heavily used and its simplicity for consuming native assets is a benefit. Rather this new mechanism is designed to provide a way for marshaling code to be generated by an external tool but work with existing `DllImportAttribute` practices in a way that isn't onerous on current .NET developers. The [Roslyn Compiler](https://github.com/dotnet/roslyn) team is working on a [Source Generator feature][source_gen_link] that will allow the generation of additional source files that can be added to an assembly during the compilation process - the runtime generation IL Stubs is an in-memory version of this scenario. **Note** This proposal is targeted at addressing P/Invoke improvements but could be adapted to work with COM interop utilizing the new [`ComWrappers`][comwrappers_link] API. ### Requirements * [Source Generators][source_gen_link] * Branch: https://github.com/dotnet/roslyn/tree/features/source-generators * Support for non-`void` return types in [`partial`](https://docs.microsoft.com/dotnet/csharp/language-reference/keywords/partial-method) methods. * https://github.com/dotnet/csharplang/issues/3301 ## Design Using Source Generators is focused on integrating with existing `DllImportAttribute` practices from an invocation point of view (i.e. callsites should not need to be updated). The idea behind Source Generators is that code for some scenarios can be precomputed using user declared types, metadata, and logic thus avoiding the need to generate code at runtime. **Goals** * Allow P/Invoke interop evolution independently of runtime. * High performance: No reflection at runtime, compatible in an AOT scenario. **Non-Goals** * 100 % parity with existing P/Invoke marshaling rules. * Zero code change for the developers. ### P/Invoke Walkthrough The P/Invoke algorithm is presented below using a simple example. ``` CSharp /* A */ [DllImportAttribute("Kernel32.dll")] /* B */ extern static bool QueryPerformanceCounter(out long lpPerformanceCount); ... long count; /* C */ QueryPerformanceCounter(out count); ``` At (A) in the above code snippet, the runtime is told to look for an export name `QueryPerformanceCounter` (B) in the `Kernel32.dll` binary. There are many additional attributes on the `DllImportAttribute` that help with export discovery and can influence the semantics of the generated IL Stub. Point (C) represents an invocation of the P/Invoke. Most of the work occurs at (C) at runtime, since (A) and (B) are merely declarations the compiler uses to embed the relevant details into assembly metadata that is read at runtime. 1) During invocation, the function declaration is determined to be an external call requiring marshaling. Given the defined properties in the `DllImportAttribute` instance as well as the metadata of the user-defined signature an IL Stub is generated. 2) The runtime attempts to find a binary with the name supplied in `DllImportAttribute`. * Discovery of the target binary is complicated and can be influenced by the [`AssemblyLoadContext`](https://docs.microsoft.com/dotnet/api/system.runtime.loader.assemblyloadcontext) and [`NativeLibrary`](https://docs.microsoft.com/dotnet/api/system.runtime.interopservices.nativelibrary) classes. 3) Once the binary is found and loaded into the runtime, it is queried for the expected export name. The name of the attributed function is used by default but this is configurable by the [`DllImportAttribute.EntryPoint`](https://docs.microsoft.com/dotnet/api/system.runtime.interopservices.dllimportattribute.entrypoint) property. * This process is also influenced by additional `DllImportAttribute` properties as well as by the underlying platform. For example, the [Win32 API ANSI/UNICODE convention](https://docs.microsoft.com/windows/win32/intl/conventions-for-function-prototypes) on Windows is respected and a(n) `A`/`W` suffix may be appended to the function name if it is not immediately found. 4) The IL Stub is called like any other .NET method. 5) The IL Stub marshals arguments as appropriate and invokes the export via the `calli` instruction. 6) Once the export returns control to the IL Stub the marshaling logic cleans up and ensures any returned data is marshaled back out to the calling function. ### Source Generator Integration An example of how the previous P/Invoke snippet could be transformed is below. This example is using the proposed API in this document. The Source Generator has a restriction of no user code modification so that is reflected in the design and mitigations for easing code adoption is presented later. `Program.cs` (User written code) ``` CSharp /* A */ [GeneratedDllImportAttribute("Kernel32.dll")] /* B */ partial static bool QueryPerformanceCounter(out long lpPerformanceCount); ... long count; /* C*/ QueryPerformanceCounter(out count); ``` Observe point (A), the new attribute. This attribute provides an indication to a Source Generator that the following declaration represents a native export that will be called via a generated stub. During the source generation process the metadata in the `GeneratedDllImportAttribute` (A) would be used to generate a stub and invoke the desired native export. Also note that the method declaration is marked `partial`. The Source Generator would then generate the source for this partial method. The invocation (C) remains unchanged to that of usage involving `DllImportAttribute`. `Stubs.g.cs` (Source Generator code) ``` CSharp /* D */ partial static bool QueryPerformanceCounter(out long lpPerformanceCount) { unsafe { long result = 0; bool success = QueryPerformanceCounter(&result) != 0; lpPerformanceCount = result; return success; } } [DllImportAttribute("Kernel32.dll")] /* E */ private static extern int QueryPerformanceCounter(long* lpPerformanceCount); ``` The Source Generator would generate the implementation of the partial method (D) in a separate translation unit (`Stubs.g.cs`). At point (E) a `DllImportAttribute` declaration is created based on the user's original declaration (A) for a private P/Invoke specifically for the generated code. The P/Invoke signature from the original declaration would be modified to contain only [blittable types][blittable_link] to ensure the JIT could inline the invocation. Finally note that the user's original function signature would remain in to avoid impacting existing callsites. In this system it is not defined how marshaling of specific types would be performed. The built-in runtime has complex rules for some types, and it is these rules that once shipped become the de facto standard - often times regardless if the behavior is a bug or not. The design here is not concerned with how the arguments go from a managed to unmanaged environment. With the IL Stub generation extracted from the runtime new type marshaling (e.g. [`Span<T>`](https://docs.microsoft.com/dotnet/api/system.span-1)) could be introduced without requiring an corresponding update to the runtime itself. The `Span<T>` type is good example of a type that at present has no support for marshaling, but with this proposal users could update to the latest generator and have support without changing the runtime. ### Adoption of Source Generator In the current Source Generator design modification of any user written code is not permitted. This includes modification of any non-functional metadata (e.g. Attributes). The above design therefore introduces a new attribute and signature for consumption of a native export. In order to consume Source Generators, users would need to update their source and adoption could be stunted by this requirement. As a mitigation it would be possible to create a [Roslyn Analyzer and Code fix](https://github.com/dotnet/roslyn/blob/master/docs/wiki/Getting-Started-Writing-a-Custom-Analyzer-&-Code-Fix.md) to aid the developer in converting `DllImportAttribute` marked functions to use `GeneratedDllImportAttribute`. Additionally, the function signature would need to be updated to remove the `extern` keyword and add the `partial` keyword to the function and potentially the enclosing class. ## Proposed API Given the Source Generator restrictions and potential confusion about overloaded attribute usage, the new `GeneratedDllImportAttribute` attribute mirrors the existing `DllImportAttribute`. ``` CSharp namespace System.Runtime.InteropServices { /// <summary> /// Attribute used to indicate a Source Generator should create a function for marshaling /// arguments instead of relying on the CLR to generate an IL Stub at runtime. /// </summary> [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = false)] public sealed class GeneratedDllImportAttribute : Attribute { /// <summary> /// Enables or disables best-fit mapping behavior when converting Unicode characters /// to ANSI characters. /// </summary> /// <see cref="System.Runtime.InteropServices.DllImportAttribute.BestFitMapping"/> public bool BestFitMapping; /// <summary> /// Indicates the calling convention of an entry point. /// </summary> /// <see cref="System.Runtime.InteropServices.DllImportAttribute.CallingConvention"/> public CallingConvention CallingConvention; /// <summary> /// Indicates how to marshal string parameters to the method and controls name mangling. /// </summary> /// <see cref="System.Runtime.InteropServices.DllImportAttribute.CharSet"/> public CharSet CharSet; /// <summary> /// Indicates the name or ordinal of the DLL entry point to be called. /// </summary> /// <see cref="System.Runtime.InteropServices.DllImportAttribute.EntryPoint"/> public string? EntryPoint; /// <summary> /// Controls whether the System.Runtime.InteropServices.DllImportAttribute.CharSet /// field causes the common language runtime to search an unmanaged DLL for entry-point /// names other than the one specified. /// </summary> /// <see cref="System.Runtime.InteropServices.DllImportAttribute.ExactSpelling"/> public bool ExactSpelling; /// <summary> /// Indicates whether unmanaged methods that have HRESULT or retval return values /// are directly translated or whether HRESULT or retval return values are automatically /// converted to exceptions. /// </summary> /// <see cref="System.Runtime.InteropServices.DllImportAttribute.PreserveSig"/> public bool PreserveSig; /// <summary> /// Indicates whether the callee calls the SetLastError Windows API function before /// returning from the attributed method. /// </summary> /// <see cref="System.Runtime.InteropServices.DllImportAttribute.SetLastError"/> public bool SetLastError; /// <summary> /// Enables or disables the throwing of an exception on an unmappable Unicode character /// that is converted to an ANSI "?" character. /// </summary> /// <see cref="System.Runtime.InteropServices.DllImportAttribute.ThrowOnUnmappableChar"/> public bool ThrowOnUnmappableChar; } } ``` ## FAQs * Can the above API be used to provide a reverse P/Invoke stub? * No. Reverse P/Invoke invocation is performed via a delegate and integrating this proposal would prove difficult. Alternative approach is to leverage the [`NativeCallableAttribute`](https://github.com/dotnet/runtime/issues/32462) feature. * How will users get error messages during source generator? * The Source Generator API will be permitted to provide warnings and errors through the [Roslyn SDK](https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/). * Will it be possible to completely replicate the marshaling rules in the current built-in system using existing .NET APIs? * No. There are rules and semantics that would be difficult to replicate with the current .NET API surface. Additional .NET APIs will likely need to be added in order to allow a Source Generator implementation to provide identical semantics with the built-in system (e.g. Respecting the semantics of [`DllImportAttribute.SetLastError`](https://docs.microsoft.com/dotnet/api/system.runtime.interopservices.dllimportattribute.setlasterror)). ## References [P/Invoke][pinvoke_link] [Type Marshaling][typemarshal_link] [IL Stubs description][il_stub_link] <!-- Common links --> [typemarshal_link]: https://docs.microsoft.com/dotnet/standard/native-interop/type-marshaling [pinvoke_link]: https://docs.microsoft.com/dotnet/standard/native-interop/pinvoke [comwrappers_link]: https://github.com/dotnet/runtime/issues/1845 [il_stub_link]: https://mattwarren.org/2019/09/26/Stubs-in-the-.NET-Runtime/ [source_gen_link]: https://github.com/dotnet/roslyn/blob/features/source-generators/docs/features/source-generators.md [blittable_link]: https://docs.microsoft.com/dotnet/framework/interop/blittable-and-non-blittable-types [ilinker_link]: https://github.com/mono/linker
-1
dotnet/runtime
66,160
Update files to remove imhameed
SamMonoRT
2022-03-03T20:37:43Z
2022-03-04T17:15:58Z
1d82d48e8c8150bfb549f095d6dafb599ff9f229
611d45f73e65076ebff2f8b71c668cf56114deae
Update files to remove imhameed.
./.github/fabricbot/generated/areapods-machinelearning.json
[ { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "isAction", "parameters": { "action": "reopened" } }, { "operator": "not", "operands": [ { "name": "isInMilestone", "parameters": {} } ] } ] } ] } ] }, { "name": "isOpen", "parameters": {} }, { "operator": "or", "operands": [ { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Michael / Tanner - Issue Triage", "isOrgProject": true } } ] }, { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Michael / Tanner - Issue Triage", "isOrgProject": true, "columnName": "Triaged" } } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Michael / Tanner - Issue Triage] Add new issue to Board", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Michael / Tanner - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssueCommentResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "not", "operands": [ { "name": "isCloseAndComment", "parameters": {} } ] }, { "operator": "not", "operands": [ { "name": "activitySenderHasPermissions", "parameters": { "permissions": "write" } } ] }, { "operator": "or", "operands": [ { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Michael / Tanner - Issue Triage", "isOrgProject": true } } ] }, { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Michael / Tanner - Issue Triage", "columnName": "Triaged", "isOrgProject": true } } ] } ] }, "eventType": "issue", "eventNames": [ "issue_comment" ], "taskName": "[Area Pod: Michael / Tanner - Issue Triage] Needs Further Triage", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Michael / Tanner - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Michael / Tanner - Issue Triage", "isOrgProject": true } }, { "operator": "not", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Michael / Tanner - Issue Triage", "columnName": "Triaged" } } ] }, { "operator": "or", "operands": [ { "name": "addedToMilestone", "parameters": {} }, { "name": "labelAdded", "parameters": { "label": "needs-author-action" } }, { "name": "labelAdded", "parameters": { "label": "api-ready-for-review" } }, { "name": "isAction", "parameters": { "action": "closed" } } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Michael / Tanner - Issue Triage] Move to Triaged Column", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Michael / Tanner - Issue Triage", "columnName": "Triaged", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Michael / Tanner - PRs", "isOrgProject": true } } ] } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "[Area Pod: Michael / Tanner - PRs] Add new PR to Board", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Michael / Tanner - PRs", "columnName": "Needs Champion", "isOrgProject": true } } ] } } ]
[ { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "operator": "and", "operands": [ { "operator": "or", "operands": [ { "name": "isAction", "parameters": { "action": "reopened" } }, { "operator": "not", "operands": [ { "name": "isInMilestone", "parameters": {} } ] } ] } ] } ] }, { "name": "isOpen", "parameters": {} }, { "operator": "or", "operands": [ { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Michael / Tanner - Issue Triage", "isOrgProject": true } } ] }, { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Michael / Tanner - Issue Triage", "isOrgProject": true, "columnName": "Triaged" } } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Michael / Tanner - Issue Triage] Add new issue to Board", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Michael / Tanner - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssueCommentResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "not", "operands": [ { "name": "isCloseAndComment", "parameters": {} } ] }, { "operator": "not", "operands": [ { "name": "activitySenderHasPermissions", "parameters": { "permissions": "write" } } ] }, { "operator": "or", "operands": [ { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Michael / Tanner - Issue Triage", "isOrgProject": true } } ] }, { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Michael / Tanner - Issue Triage", "columnName": "Triaged", "isOrgProject": true } } ] } ] }, "eventType": "issue", "eventNames": [ "issue_comment" ], "taskName": "[Area Pod: Michael / Tanner - Issue Triage] Needs Further Triage", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Michael / Tanner - Issue Triage", "columnName": "Needs Triage", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "IssuesOnlyResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Michael / Tanner - Issue Triage", "isOrgProject": true } }, { "operator": "not", "operands": [ { "name": "isInProjectColumn", "parameters": { "projectName": "Area Pod: Michael / Tanner - Issue Triage", "columnName": "Triaged" } } ] }, { "operator": "or", "operands": [ { "name": "addedToMilestone", "parameters": {} }, { "name": "labelAdded", "parameters": { "label": "needs-author-action" } }, { "name": "labelAdded", "parameters": { "label": "api-ready-for-review" } }, { "name": "isAction", "parameters": { "action": "closed" } } ] } ] }, "eventType": "issue", "eventNames": [ "issues", "project_card" ], "taskName": "[Area Pod: Michael / Tanner - Issue Triage] Move to Triaged Column", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Michael / Tanner - Issue Triage", "columnName": "Triaged", "isOrgProject": true } } ] } }, { "taskType": "trigger", "capabilityId": "IssueResponder", "subCapability": "PullRequestResponder", "version": "1.0", "config": { "conditions": { "operator": "and", "operands": [ { "operator": "not", "operands": [ { "name": "isInProject", "parameters": { "projectName": "Area Pod: Michael / Tanner - PRs", "isOrgProject": true } } ] } ] }, "eventType": "pull_request", "eventNames": [ "pull_request", "issues", "project_card" ], "taskName": "[Area Pod: Michael / Tanner - PRs] Add new PR to Board", "actions": [ { "name": "addToProject", "parameters": { "projectName": "Area Pod: Michael / Tanner - PRs", "columnName": "Needs Champion", "isOrgProject": true } } ] } } ]
-1
dotnet/runtime
66,160
Update files to remove imhameed
SamMonoRT
2022-03-03T20:37:43Z
2022-03-04T17:15:58Z
1d82d48e8c8150bfb549f095d6dafb599ff9f229
611d45f73e65076ebff2f8b71c668cf56114deae
Update files to remove imhameed.
./src/tests/FunctionalTests/Android/Device_Emulator/RuntimeConfig/runtimeconfig.template.json
{ "configProperties": { "abc": "4", "test_runtimeconfig_json": "25" } }
{ "configProperties": { "abc": "4", "test_runtimeconfig_json": "25" } }
-1
dotnet/runtime
66,160
Update files to remove imhameed
SamMonoRT
2022-03-03T20:37:43Z
2022-03-04T17:15:58Z
1d82d48e8c8150bfb549f095d6dafb599ff9f229
611d45f73e65076ebff2f8b71c668cf56114deae
Update files to remove imhameed.
./docs/design/coreclr/profiling/davbr-blog-archive/GC Heap and Alignment Padding.md
*This blog post originally appeared on David Broman's blog on 12/29/2011* The docs for [GetObjectSize](http://msdn.microsoft.com/en-US/library/ms231885(v=VS.100).aspx) have recently been updated with this info, but I wanted to mention it here, too, to ensure you were aware of this information. Some profilers manually advance through objects on the heap, inspecting their field values, by starting at an ObjectID and moving forward by its size to the next ObjectID, repeating this process, for all the reported generation ranges (via GetGenerationBounds or MovedReferences/SurvivingReferences). If your profiler doesn’t do this, then this blog entry will be of no interest to you, and you can skip it. But if your profiler does do this, you need to be aware of the alignment rules that the CLR employs as it allocates and moves objects around on the GC heap. - **On x86** : All objects are 4-byte aligned, except for objects on the large-object-heap, which are always 8-byte aligned. - **On x64** : All objects are always 8-byte aligned, in all generations. And the important point to note is that GetObjectSize does NOT include alignment padding in the size that it reports. Thus, as your profiler manually skips from object to object by using GetObjectSize() to determine how far to skip, your profiler must manually add in any alignment padding necessary to achieve the alignment rules listed above.
*This blog post originally appeared on David Broman's blog on 12/29/2011* The docs for [GetObjectSize](http://msdn.microsoft.com/en-US/library/ms231885(v=VS.100).aspx) have recently been updated with this info, but I wanted to mention it here, too, to ensure you were aware of this information. Some profilers manually advance through objects on the heap, inspecting their field values, by starting at an ObjectID and moving forward by its size to the next ObjectID, repeating this process, for all the reported generation ranges (via GetGenerationBounds or MovedReferences/SurvivingReferences). If your profiler doesn’t do this, then this blog entry will be of no interest to you, and you can skip it. But if your profiler does do this, you need to be aware of the alignment rules that the CLR employs as it allocates and moves objects around on the GC heap. - **On x86** : All objects are 4-byte aligned, except for objects on the large-object-heap, which are always 8-byte aligned. - **On x64** : All objects are always 8-byte aligned, in all generations. And the important point to note is that GetObjectSize does NOT include alignment padding in the size that it reports. Thus, as your profiler manually skips from object to object by using GetObjectSize() to determine how far to skip, your profiler must manually add in any alignment padding necessary to achieve the alignment rules listed above.
-1
dotnet/runtime
66,160
Update files to remove imhameed
SamMonoRT
2022-03-03T20:37:43Z
2022-03-04T17:15:58Z
1d82d48e8c8150bfb549f095d6dafb599ff9f229
611d45f73e65076ebff2f8b71c668cf56114deae
Update files to remove imhameed.
./src/mono/mono/tests/metadata-verifier/cli-header-tests.md
cli-header-basic { assembly simple-assembly.exe #the section dir must point to a valid rva invalid offset pe-optional-header + 208 set-uint 0x88888 #the cli header must be there invalid offset pe-optional-header + 208 set-uint 0 #the cli header size must be == 72 invalid offset pe-optional-header + 212 set-uint 71 #the cli header size must be == 72 (again, but now on the header itself) invalid offset cli-header set-uint 71 #Framework version is irrelevant #Metadata RVA and size #no metadata invalid offset cli-header + 8 set-uint 0 #invalid invalid offset cli-header + 8 set-uint 0x777777 #empty metadata invalid offset cli-header + 12 set-uint 0 #not bounds checking invalid offset cli-header + 12 set-uint 0x12345678 #Flags valid mask: 0x0001000B invalid offset cli-header + 16 set-uint 0x0011000B #TODO verify entry point token #Resources invalid offset cli-header + 24 set-uint 0x777777 invalid offset cli-header + 24 set-uint 0x2000 , offset cli-header + 28 set-uint 0x999999 #Strong Name invalid offset cli-header + 32 set-uint 0x777777 invalid offset cli-header + 32 set-uint 0x2000 , offset cli-header + 36 set-uint 0x999999 #Code Manager Table invalid offset cli-header + 40 set-uint 0x777777 invalid offset cli-header + 40 set-uint 0x2000 , offset cli-header + 44 set-uint 0x999999 #VTable fixups invalid offset cli-header + 48 set-uint 0x777777 invalid offset cli-header + 48 set-uint 0x2000 , offset cli-header + 52 set-uint 0x999999 #Export Address Table invalid offset cli-header + 56 set-uint 0x777777 invalid offset cli-header + 56 set-uint 0x2000 , offset cli-header + 60 set-uint 0x999999 #Managed native header invalid offset cli-header + 64 set-uint 0x777777 invalid offset cli-header + 64 set-uint 0x2000 , offset cli-header + 68 set-uint 0x999999 }
cli-header-basic { assembly simple-assembly.exe #the section dir must point to a valid rva invalid offset pe-optional-header + 208 set-uint 0x88888 #the cli header must be there invalid offset pe-optional-header + 208 set-uint 0 #the cli header size must be == 72 invalid offset pe-optional-header + 212 set-uint 71 #the cli header size must be == 72 (again, but now on the header itself) invalid offset cli-header set-uint 71 #Framework version is irrelevant #Metadata RVA and size #no metadata invalid offset cli-header + 8 set-uint 0 #invalid invalid offset cli-header + 8 set-uint 0x777777 #empty metadata invalid offset cli-header + 12 set-uint 0 #not bounds checking invalid offset cli-header + 12 set-uint 0x12345678 #Flags valid mask: 0x0001000B invalid offset cli-header + 16 set-uint 0x0011000B #TODO verify entry point token #Resources invalid offset cli-header + 24 set-uint 0x777777 invalid offset cli-header + 24 set-uint 0x2000 , offset cli-header + 28 set-uint 0x999999 #Strong Name invalid offset cli-header + 32 set-uint 0x777777 invalid offset cli-header + 32 set-uint 0x2000 , offset cli-header + 36 set-uint 0x999999 #Code Manager Table invalid offset cli-header + 40 set-uint 0x777777 invalid offset cli-header + 40 set-uint 0x2000 , offset cli-header + 44 set-uint 0x999999 #VTable fixups invalid offset cli-header + 48 set-uint 0x777777 invalid offset cli-header + 48 set-uint 0x2000 , offset cli-header + 52 set-uint 0x999999 #Export Address Table invalid offset cli-header + 56 set-uint 0x777777 invalid offset cli-header + 56 set-uint 0x2000 , offset cli-header + 60 set-uint 0x999999 #Managed native header invalid offset cli-header + 64 set-uint 0x777777 invalid offset cli-header + 64 set-uint 0x2000 , offset cli-header + 68 set-uint 0x999999 }
-1
dotnet/runtime
66,160
Update files to remove imhameed
SamMonoRT
2022-03-03T20:37:43Z
2022-03-04T17:15:58Z
1d82d48e8c8150bfb549f095d6dafb599ff9f229
611d45f73e65076ebff2f8b71c668cf56114deae
Update files to remove imhameed.
./docs/workflow/testing/using-your-build.md
# Using your .NET Runtime Build We assume that you have successfully built the repository and thus have files of the form ``` ~/runtime/artifacts/bin/coreclr/<OS>.<arch>.<flavor>/ ``` To run your newly built .NET Runtime in addition to the application itself, you will need a 'host' program that will load the Runtime as well as all the other .NET libraries code that your application needs. The easiest way to get all this other stuff is to simply use the standard 'dotnet' host that installs with .NET SDK. The released version of 'dotnet' tool may not be compatible with the live repository. The following steps assume use of a dogfood build of the .NET SDK. ## Acquire the latest nightly .NET SDK - [Win 64-bit Latest](https://aka.ms/dotnet/6.0/daily/dotnet-sdk-win-x64.zip) - [macOS 64-bit Latest](https://aka.ms/dotnet/6.0/daily/dotnet-sdk-osx-x64.tar.gz) - [Others](https://github.com/dotnet/installer#installers-and-binaries) To setup the SDK download the zip and extract it somewhere and add the root folder to your [path](../requirements/windows-requirements.md#adding-to-the-default-path-variable) or always fully qualify the path to dotnet in the root of this folder for all the instructions in this document. After setting up dotnet you can verify you are using the newer version by: `dotnet --info` -- the version should be greater than 3.0.0-* For another small walkthrough see [Dogfooding .NET SDK](https://github.com/dotnet/runtime/blob/main/docs/project/dogfooding.md). ## Create sample self-contained application At this point, you can create a new 'Hello World' program in the standard way. ```cmd mkdir HelloWorld cd HelloWorld dotnet new console ``` ### Change project to be self-contained In order to update with your local changes, the application needs to be self-contained, as opposed to running on the shared framework. In order to do that you will need to add a `RuntimeIdentifier` to your project. ```xml <PropertyGroup> ... <RuntimeIdentifier>win-x64</RuntimeIdentifier> </PropertyGroup> ``` For Windows you will want `win-x64`, for macOS `osx-x64` and `linux-x64` for Linux. ### Publish Now is the time to publish. The publish step will trigger restore and build. You can iterate on build by calling `dotnet build` as needed. ```cmd dotnet publish ``` **Note:** If publish fails to restore runtime packages you need to configure custom NuGet feeds. This is because you are using a dogfood .NET SDK: its dependencies are not yet on the regular NuGet feed. To do so you have to: 1. run `dotnet new nugetconfig` 2. go to the `NuGet.Config` file and replace the content with: ```xml <?xml version="1.0" encoding="utf-8"?> <configuration> <packageSources> <!--To inherit the global NuGet package sources remove the <clear/> line below --> <clear /> <add key="nuget" value="https://api.nuget.org/v3/index.json" /> <add key="dotnet6" value="https://dnceng.pkgs.visualstudio.com/public/_packaging/dotnet6/nuget/v3/index.json" /> </packageSources> </configuration> ``` After you publish you will find you all the binaries needed to run your application under `bin\Debug\netcoreapp3.0\win-x64\publish\`. ``` .\bin\Debug\netcoreapp3.0\win-x64\publish\HelloWorld.exe ``` **But we are not done yet, you need to replace the published runtime files with the files from your local build!** ## Update CoreCLR from raw binary output Updating CoreCLR from raw binary output is easier for quick one-off testing which is what this set of instructions outline but for consuming in a real .NET application you should use the nuget package instructions below. The 'dotnet publish' step above creates a directory that has all the files necessary to run your app including the CoreCLR and the parts of CoreFX that were needed. You can use this fact to skip some steps if you wish to update the DLLs. For example typically when you update CoreCLR you end up updating one of two DLLs * coreclr.dll - Most modifications (with the exception of the JIT compiler and tools) that are C++ code update this DLL. * System.Private.CoreLib.dll - If you modified C# it will end up here. Thus after making a change and building, you can simply copy the updated binary from the `artifacts\bin\coreclr\<OS>.<arch>.<flavor>` directory to your publication directory (e.g. `helloWorld\bin\Debug\netcoreapp3.0\win-x64\publish`) to quickly deploy your new bits. In a lot of cases it is easiest to just copy everything from here to your publication directory. You can build just the .NET Library part of the build by doing (debug, for release add 'release' qualifier) (on Linux / OSX us ./build.sh) ```cmd .\build skiptests skipnative ``` Which builds System.Private.CoreLib.dll if you modify C# code. If you wish to only compile the coreclr.dll you can do ```cmd .\build skiptests skipmscorlib ``` Note that this technique does not work on .NET Apps that have not been published (that is you have not created a directory with all DLLs needed to run the all) That is because the runtime is either fetched from the system-wide location that dotnet.exe installed, OR it is fetched from the local nuget package cache (which is where your build was put when you did a 'dotnet restore' and had a dependency on your particular runtime). In theory you could update these locations in place, but that is not recommended since they are shared more widely. ## (Optional) Confirm that the app used your new runtime Congratulations, you have successfully used your newly built runtime. As a hint you could add some code like: ``` var coreAssemblyInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(typeof(object).Assembly.Location); Console.WriteLine($"Hello World from Core {coreAssemblyInfo.ProductVersion}"); Console.WriteLine($"The location is {typeof(object).Assembly.Location}"); ``` That should tell you the version and which user and machine build the assembly as well as the commit hash of the code at the time of building: ``` Hello World from Core 4.6.26210.0 @BuiltBy: adsitnik-MININT-O513E3V @SrcCode: https://github.com/dotnet/runtime/tree/3d6da797d1f7dc47d5934189787a4e8006ab3a04 The location is C:\coreclr\helloWorld\bin\Debug\netcoreapp3.0\win-x64\publish\System.Private.CoreLib.dll ``` ### If it's not using your copied binary Make sure you are running the exe directly. If you use `dotnet run` it will overwrite your custom binaries before executing the app: ``` .\bin\Debug\netcoreapp3.0\win-x64\publish\HelloWorld.exe ``` ### If you get a consistency check assertion failure Something like this happens if you copied coreclr.dll but not System.Private.Corelib.dll as well. ``` Assert failure(PID 13452 [0x0000348c], Thread: 10784 [0x2a20]): Consistency check failed: AV in clr at this callstack: ``` ## Using .NET SDK to run your .NET Application If you don't like the idea of copying files manually you can follow [these instructions](../using-dotnet-cli.md) to use dotnet cli to do this for you. However the steps described here are the simplest and most commonly used by runtime developers for ad-hoc testing. ## Using CoreRun to run your .NET Application Generally using dotnet.exe tool to run your .NET application is the preferred mechanism to run .NET Apps. However there is a simpler 'host' for .NET applications called 'CoreRun' that can also be used. The value of this host is that it is simpler (in particular it knows nothing about NuGet), but precisely because of this it can be harder to use (since you are responsible for insuring all the dependencies you need are gather together) See [Using CoreRun To Run .NET Application](using-corerun.md) for more.
# Using your .NET Runtime Build We assume that you have successfully built the repository and thus have files of the form ``` ~/runtime/artifacts/bin/coreclr/<OS>.<arch>.<flavor>/ ``` To run your newly built .NET Runtime in addition to the application itself, you will need a 'host' program that will load the Runtime as well as all the other .NET libraries code that your application needs. The easiest way to get all this other stuff is to simply use the standard 'dotnet' host that installs with .NET SDK. The released version of 'dotnet' tool may not be compatible with the live repository. The following steps assume use of a dogfood build of the .NET SDK. ## Acquire the latest nightly .NET SDK - [Win 64-bit Latest](https://aka.ms/dotnet/6.0/daily/dotnet-sdk-win-x64.zip) - [macOS 64-bit Latest](https://aka.ms/dotnet/6.0/daily/dotnet-sdk-osx-x64.tar.gz) - [Others](https://github.com/dotnet/installer#installers-and-binaries) To setup the SDK download the zip and extract it somewhere and add the root folder to your [path](../requirements/windows-requirements.md#adding-to-the-default-path-variable) or always fully qualify the path to dotnet in the root of this folder for all the instructions in this document. After setting up dotnet you can verify you are using the newer version by: `dotnet --info` -- the version should be greater than 3.0.0-* For another small walkthrough see [Dogfooding .NET SDK](https://github.com/dotnet/runtime/blob/main/docs/project/dogfooding.md). ## Create sample self-contained application At this point, you can create a new 'Hello World' program in the standard way. ```cmd mkdir HelloWorld cd HelloWorld dotnet new console ``` ### Change project to be self-contained In order to update with your local changes, the application needs to be self-contained, as opposed to running on the shared framework. In order to do that you will need to add a `RuntimeIdentifier` to your project. ```xml <PropertyGroup> ... <RuntimeIdentifier>win-x64</RuntimeIdentifier> </PropertyGroup> ``` For Windows you will want `win-x64`, for macOS `osx-x64` and `linux-x64` for Linux. ### Publish Now is the time to publish. The publish step will trigger restore and build. You can iterate on build by calling `dotnet build` as needed. ```cmd dotnet publish ``` **Note:** If publish fails to restore runtime packages you need to configure custom NuGet feeds. This is because you are using a dogfood .NET SDK: its dependencies are not yet on the regular NuGet feed. To do so you have to: 1. run `dotnet new nugetconfig` 2. go to the `NuGet.Config` file and replace the content with: ```xml <?xml version="1.0" encoding="utf-8"?> <configuration> <packageSources> <!--To inherit the global NuGet package sources remove the <clear/> line below --> <clear /> <add key="nuget" value="https://api.nuget.org/v3/index.json" /> <add key="dotnet6" value="https://dnceng.pkgs.visualstudio.com/public/_packaging/dotnet6/nuget/v3/index.json" /> </packageSources> </configuration> ``` After you publish you will find you all the binaries needed to run your application under `bin\Debug\netcoreapp3.0\win-x64\publish\`. ``` .\bin\Debug\netcoreapp3.0\win-x64\publish\HelloWorld.exe ``` **But we are not done yet, you need to replace the published runtime files with the files from your local build!** ## Update CoreCLR from raw binary output Updating CoreCLR from raw binary output is easier for quick one-off testing which is what this set of instructions outline but for consuming in a real .NET application you should use the nuget package instructions below. The 'dotnet publish' step above creates a directory that has all the files necessary to run your app including the CoreCLR and the parts of CoreFX that were needed. You can use this fact to skip some steps if you wish to update the DLLs. For example typically when you update CoreCLR you end up updating one of two DLLs * coreclr.dll - Most modifications (with the exception of the JIT compiler and tools) that are C++ code update this DLL. * System.Private.CoreLib.dll - If you modified C# it will end up here. Thus after making a change and building, you can simply copy the updated binary from the `artifacts\bin\coreclr\<OS>.<arch>.<flavor>` directory to your publication directory (e.g. `helloWorld\bin\Debug\netcoreapp3.0\win-x64\publish`) to quickly deploy your new bits. In a lot of cases it is easiest to just copy everything from here to your publication directory. You can build just the .NET Library part of the build by doing (debug, for release add 'release' qualifier) (on Linux / OSX us ./build.sh) ```cmd .\build skiptests skipnative ``` Which builds System.Private.CoreLib.dll if you modify C# code. If you wish to only compile the coreclr.dll you can do ```cmd .\build skiptests skipmscorlib ``` Note that this technique does not work on .NET Apps that have not been published (that is you have not created a directory with all DLLs needed to run the all) That is because the runtime is either fetched from the system-wide location that dotnet.exe installed, OR it is fetched from the local nuget package cache (which is where your build was put when you did a 'dotnet restore' and had a dependency on your particular runtime). In theory you could update these locations in place, but that is not recommended since they are shared more widely. ## (Optional) Confirm that the app used your new runtime Congratulations, you have successfully used your newly built runtime. As a hint you could add some code like: ``` var coreAssemblyInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(typeof(object).Assembly.Location); Console.WriteLine($"Hello World from Core {coreAssemblyInfo.ProductVersion}"); Console.WriteLine($"The location is {typeof(object).Assembly.Location}"); ``` That should tell you the version and which user and machine build the assembly as well as the commit hash of the code at the time of building: ``` Hello World from Core 4.6.26210.0 @BuiltBy: adsitnik-MININT-O513E3V @SrcCode: https://github.com/dotnet/runtime/tree/3d6da797d1f7dc47d5934189787a4e8006ab3a04 The location is C:\coreclr\helloWorld\bin\Debug\netcoreapp3.0\win-x64\publish\System.Private.CoreLib.dll ``` ### If it's not using your copied binary Make sure you are running the exe directly. If you use `dotnet run` it will overwrite your custom binaries before executing the app: ``` .\bin\Debug\netcoreapp3.0\win-x64\publish\HelloWorld.exe ``` ### If you get a consistency check assertion failure Something like this happens if you copied coreclr.dll but not System.Private.Corelib.dll as well. ``` Assert failure(PID 13452 [0x0000348c], Thread: 10784 [0x2a20]): Consistency check failed: AV in clr at this callstack: ``` ## Using .NET SDK to run your .NET Application If you don't like the idea of copying files manually you can follow [these instructions](../using-dotnet-cli.md) to use dotnet cli to do this for you. However the steps described here are the simplest and most commonly used by runtime developers for ad-hoc testing. ## Using CoreRun to run your .NET Application Generally using dotnet.exe tool to run your .NET application is the preferred mechanism to run .NET Apps. However there is a simpler 'host' for .NET applications called 'CoreRun' that can also be used. The value of this host is that it is simpler (in particular it knows nothing about NuGet), but precisely because of this it can be harder to use (since you are responsible for insuring all the dependencies you need are gather together) See [Using CoreRun To Run .NET Application](using-corerun.md) for more.
-1
dotnet/runtime
66,160
Update files to remove imhameed
SamMonoRT
2022-03-03T20:37:43Z
2022-03-04T17:15:58Z
1d82d48e8c8150bfb549f095d6dafb599ff9f229
611d45f73e65076ebff2f8b71c668cf56114deae
Update files to remove imhameed.
./docs/workflow/testing/libraries/testing-apple.md
# Testing Libraries on iOS, tvOS, and MacCatalyst ## Prerequisites - XCode 11.3 or higher - a certificate and provisioning profile if using a device - a simulator with a proper device type and OS version. Go `XCode > Window > Devices and Simulators` to revise the list of the available simulators and then `"+" button on bottom left > OS Version dropdown selection > Download more simulator runtimes` in case you need to download more simulators. ## Building Libs and Tests You can build and run the library tests: - on a simulator; - on a device. Run the following command in a terminal: ``` ./build.sh mono+libs -os <TARGET_OS> -arch <TARGET_ARCHITECTURE> ``` where `<TARGET_OS>` is one of the following: - iOSSimulator - tvOSSimulator - MacCatalyst - iOS - tvOS and `<TARGET_ARCHITECTURE>` is one of the following: - x64 - arm64 (for device) e.g., to build for an iOS simulator, run: ``` ./build.sh mono+libs -os iOSSimulator -arch x64 ``` Run tests one by one for each test suite on a simulator: ``` ./build.sh libs.tests -os iOSSimulator -arch x64 -test ``` ### Building for a device In order to run the tests on a device: - Set the `-os` parameter to a device-related value (see above) - Specify `DevTeamProvisioning` (see [developer.apple.com/account/#/membership](https://developer.apple.com/account/#/membership), scroll down to `Team ID`). For example: ``` ./build.sh libs.tests -os iOS -arch x64 -test /p:DevTeamProvisioning=H1A2B3C4D5 ``` Other possible options are: - to sign with an adhoc key by setting `/p:DevTeamProvisioning=adhoc` - to skip signing all together by setting `/p:DevTeamProvisioning=-` . [AppleAppBuilder](https://github.com/dotnet/runtime/blob/main/src/tasks/AppleAppBuilder/AppleAppBuilder.cs) generates temp Xcode projects you can manually open and resolve provisioning issues there using native UI and deploy to your devices. ### Running individual test suites - The following shows how to run tests for a specific library: ``` ./dotnet.sh build src/libraries/System.Numerics.Vectors/tests /t:Test /p:TargetOS=iOS /p:TargetArchitecture=x64 ``` Also you can run the built test app through Xcode by opening the corresponding `.xcodeproj` and setting up the right scheme, app, and even signing if using a local device. There's also an option to run a `.app` through `xcrun`, which is simulator specific. Consider the following shell script: ``` xcrun simctl shutdown <IOSSIMULATOR_NAME> xcrun simctl boot <IOSSIMULATOR_NAME> open -a Simulator xcrun simctl install <IOSSIMULATOR_NAME> <APP_BUNDLE_PATH> xcrun simctl launch --console booted <IOS_APP_NAME> ``` where `<IOSSIMULATOR_NAME>` is a name of the simulator to start, e.g. `"iPhone 11"`, `<APP_BUNDLE_PATH>` is a path to the iOS test app bundle, `<IOS_APP_NAME>` is a name of the iOS test app ### Running the functional tests There are [functional tests](https://github.com/dotnet/runtime/tree/main/src/tests/FunctionalTests/) which aim to test some specific features/configurations/modes on a target mobile platform. A functional test can be run the same way as any library test suite, e.g.: ``` ./dotnet.sh build /t:Test -c Release /p:TargetOS=iOSSimulator /p:TargetArchitecture=x64 src/tests/FunctionalTests/iOS/Simulator/PInvoke/iOS.Simulator.PInvoke.Test.csproj ``` Currently functional tests are expected to return `42` as a success code so please be careful when adding a new one. ### Viewing logs - see the logs generated by the XHarness tool - use the `Console` app on macOS: `Command + Space`, type in `Console`, search the appropriate process (System.Buffers.Tests for example). ### Testing various configurations It's possible to test various configurations by setting a combination of additional MSBuild properties such as `RunAOTCompilation`,`MonoEnableInterpreter`, and some more. 1. Interpreter Only This configuration is necessary for hot reload scenarios. To enable the interpreter, add `/p:RunAOTCompilation=true /p:MonoEnableInterpreter=true` to a build command. 2. AOT only To build for AOT only mode, add `/p:RunAOTCompilation=true /p:MonoEnableInterpreter=false` to a build command. 3. AOT-LLVM To build for AOT-LLVM mode, add `/p:RunAOTCompilation=true /p:MonoEnableInterpreter=false /p:MonoEnableLLVM=true` to a build command. 4. App Sandbox To build the test app bundle with the App Sandbox entitlement, add `/p:EnableAppSandbox=true` to a build command. ### Test App Design iOS/tvOS `*.app` (or `*.ipa`) is basically a simple [ObjC app](https://github.com/dotnet/runtime/blob/main/src/tasks/AppleAppBuilder/Templates/main-console.m) that inits the Mono Runtime. This Mono Runtime starts a simple xunit test runner called XHarness.TestRunner (see https://github.com/dotnet/xharness) which runs tests for all `*.Tests.dll` libs in the bundle. There is also XHarness.CLI tool to deploy `*.app` and `*.ipa` to a target (device or simulator) and listens for logs via network sockets. ### Existing Limitations - Simulator uses JIT mode only at the moment (to be extended with FullAOT and Interpreter) - Interpreter is not enabled yet.
# Testing Libraries on iOS, tvOS, and MacCatalyst ## Prerequisites - XCode 11.3 or higher - a certificate and provisioning profile if using a device - a simulator with a proper device type and OS version. Go `XCode > Window > Devices and Simulators` to revise the list of the available simulators and then `"+" button on bottom left > OS Version dropdown selection > Download more simulator runtimes` in case you need to download more simulators. ## Building Libs and Tests You can build and run the library tests: - on a simulator; - on a device. Run the following command in a terminal: ``` ./build.sh mono+libs -os <TARGET_OS> -arch <TARGET_ARCHITECTURE> ``` where `<TARGET_OS>` is one of the following: - iOSSimulator - tvOSSimulator - MacCatalyst - iOS - tvOS and `<TARGET_ARCHITECTURE>` is one of the following: - x64 - arm64 (for device) e.g., to build for an iOS simulator, run: ``` ./build.sh mono+libs -os iOSSimulator -arch x64 ``` Run tests one by one for each test suite on a simulator: ``` ./build.sh libs.tests -os iOSSimulator -arch x64 -test ``` ### Building for a device In order to run the tests on a device: - Set the `-os` parameter to a device-related value (see above) - Specify `DevTeamProvisioning` (see [developer.apple.com/account/#/membership](https://developer.apple.com/account/#/membership), scroll down to `Team ID`). For example: ``` ./build.sh libs.tests -os iOS -arch x64 -test /p:DevTeamProvisioning=H1A2B3C4D5 ``` Other possible options are: - to sign with an adhoc key by setting `/p:DevTeamProvisioning=adhoc` - to skip signing all together by setting `/p:DevTeamProvisioning=-` . [AppleAppBuilder](https://github.com/dotnet/runtime/blob/main/src/tasks/AppleAppBuilder/AppleAppBuilder.cs) generates temp Xcode projects you can manually open and resolve provisioning issues there using native UI and deploy to your devices. ### Running individual test suites - The following shows how to run tests for a specific library: ``` ./dotnet.sh build src/libraries/System.Numerics.Vectors/tests /t:Test /p:TargetOS=iOS /p:TargetArchitecture=x64 ``` Also you can run the built test app through Xcode by opening the corresponding `.xcodeproj` and setting up the right scheme, app, and even signing if using a local device. There's also an option to run a `.app` through `xcrun`, which is simulator specific. Consider the following shell script: ``` xcrun simctl shutdown <IOSSIMULATOR_NAME> xcrun simctl boot <IOSSIMULATOR_NAME> open -a Simulator xcrun simctl install <IOSSIMULATOR_NAME> <APP_BUNDLE_PATH> xcrun simctl launch --console booted <IOS_APP_NAME> ``` where `<IOSSIMULATOR_NAME>` is a name of the simulator to start, e.g. `"iPhone 11"`, `<APP_BUNDLE_PATH>` is a path to the iOS test app bundle, `<IOS_APP_NAME>` is a name of the iOS test app ### Running the functional tests There are [functional tests](https://github.com/dotnet/runtime/tree/main/src/tests/FunctionalTests/) which aim to test some specific features/configurations/modes on a target mobile platform. A functional test can be run the same way as any library test suite, e.g.: ``` ./dotnet.sh build /t:Test -c Release /p:TargetOS=iOSSimulator /p:TargetArchitecture=x64 src/tests/FunctionalTests/iOS/Simulator/PInvoke/iOS.Simulator.PInvoke.Test.csproj ``` Currently functional tests are expected to return `42` as a success code so please be careful when adding a new one. ### Viewing logs - see the logs generated by the XHarness tool - use the `Console` app on macOS: `Command + Space`, type in `Console`, search the appropriate process (System.Buffers.Tests for example). ### Testing various configurations It's possible to test various configurations by setting a combination of additional MSBuild properties such as `RunAOTCompilation`,`MonoEnableInterpreter`, and some more. 1. Interpreter Only This configuration is necessary for hot reload scenarios. To enable the interpreter, add `/p:RunAOTCompilation=true /p:MonoEnableInterpreter=true` to a build command. 2. AOT only To build for AOT only mode, add `/p:RunAOTCompilation=true /p:MonoEnableInterpreter=false` to a build command. 3. AOT-LLVM To build for AOT-LLVM mode, add `/p:RunAOTCompilation=true /p:MonoEnableInterpreter=false /p:MonoEnableLLVM=true` to a build command. 4. App Sandbox To build the test app bundle with the App Sandbox entitlement, add `/p:EnableAppSandbox=true` to a build command. ### Test App Design iOS/tvOS `*.app` (or `*.ipa`) is basically a simple [ObjC app](https://github.com/dotnet/runtime/blob/main/src/tasks/AppleAppBuilder/Templates/main-console.m) that inits the Mono Runtime. This Mono Runtime starts a simple xunit test runner called XHarness.TestRunner (see https://github.com/dotnet/xharness) which runs tests for all `*.Tests.dll` libs in the bundle. There is also XHarness.CLI tool to deploy `*.app` and `*.ipa` to a target (device or simulator) and listens for logs via network sockets. ### Existing Limitations - Simulator uses JIT mode only at the moment (to be extended with FullAOT and Interpreter) - Interpreter is not enabled yet.
-1
dotnet/runtime
66,160
Update files to remove imhameed
SamMonoRT
2022-03-03T20:37:43Z
2022-03-04T17:15:58Z
1d82d48e8c8150bfb549f095d6dafb599ff9f229
611d45f73e65076ebff2f8b71c668cf56114deae
Update files to remove imhameed.
./src/libraries/System.Net.WebSockets.Client/tests/package-lock.json
{ "name": "system.net.websockets.client.tests", "version": "1.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "system.net.websockets.client.tests", "version": "1.0.0", "license": "ISC", "dependencies": { "ws": "^8.4.0" } }, "node_modules/ws": { "version": "8.4.0", "resolved": "https://registry.npmjs.org/ws/-/ws-8.4.0.tgz", "integrity": "sha512-IHVsKe2pjajSUIl4KYMQOdlyliovpEPquKkqbwswulszzI7r0SfQrxnXdWAEqOlDCLrVSJzo+O1hAwdog2sKSQ==", "engines": { "node": ">=10.0.0" }, "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": "^5.0.2" }, "peerDependenciesMeta": { "bufferutil": { "optional": true }, "utf-8-validate": { "optional": true } } } }, "dependencies": { "ws": { "version": "8.4.0", "resolved": "https://registry.npmjs.org/ws/-/ws-8.4.0.tgz", "integrity": "sha512-IHVsKe2pjajSUIl4KYMQOdlyliovpEPquKkqbwswulszzI7r0SfQrxnXdWAEqOlDCLrVSJzo+O1hAwdog2sKSQ==", "requires": {} } } }
{ "name": "system.net.websockets.client.tests", "version": "1.0.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "system.net.websockets.client.tests", "version": "1.0.0", "license": "ISC", "dependencies": { "ws": "^8.4.0" } }, "node_modules/ws": { "version": "8.4.0", "resolved": "https://registry.npmjs.org/ws/-/ws-8.4.0.tgz", "integrity": "sha512-IHVsKe2pjajSUIl4KYMQOdlyliovpEPquKkqbwswulszzI7r0SfQrxnXdWAEqOlDCLrVSJzo+O1hAwdog2sKSQ==", "engines": { "node": ">=10.0.0" }, "peerDependencies": { "bufferutil": "^4.0.1", "utf-8-validate": "^5.0.2" }, "peerDependenciesMeta": { "bufferutil": { "optional": true }, "utf-8-validate": { "optional": true } } } }, "dependencies": { "ws": { "version": "8.4.0", "resolved": "https://registry.npmjs.org/ws/-/ws-8.4.0.tgz", "integrity": "sha512-IHVsKe2pjajSUIl4KYMQOdlyliovpEPquKkqbwswulszzI7r0SfQrxnXdWAEqOlDCLrVSJzo+O1hAwdog2sKSQ==", "requires": {} } } }
-1
dotnet/runtime
66,160
Update files to remove imhameed
SamMonoRT
2022-03-03T20:37:43Z
2022-03-04T17:15:58Z
1d82d48e8c8150bfb549f095d6dafb599ff9f229
611d45f73e65076ebff2f8b71c668cf56114deae
Update files to remove imhameed.
./docs/coding-guidelines/breaking-change-rules.md
Breaking Change Rules ===================== * [Behavioral Changes](#behavioral-changes) * [Property, Field, Parameter and Return Values](#property-field-parameter-and-return-values) * [Exceptions](#exceptions) * [Platform Support](#platform-support) * [Code](#code) * [Source and Binary Compatibility Changes](#source-and-binary-compatibility-changes) * [Assemblies](#assemblies) * [Types](#types) * [Members](#members) * [Signatures](#signatures) * [Attributes](#attributes) ## Behavioral Changes ### Property, Field, Parameter and Return Values &#10003; **Allowed** * Increasing the range of accepted values for a property or parameter if the member _is not_ `virtual` Note that the range can only increase to the extent that it does not impact the static type. e.g. it is OK to remove `if (x > 10) throw new ArgumentOutOfRangeException("x")`, but it is not OK to change the type of `x` from `int` to `long` or `int?`. * Returning a value of a more derived type for a property, field, return or `out` value Note, again, that the static type cannot change. e.g. it is OK to return a `string` instance where an `object` was returned previously, but it is not OK to change the return type from `object` to `string`. &#10007; **Disallowed** * Increasing the range of accepted values for a property or parameter if the member _is_ `virtual` This is breaking because any existing overridden members will now not function correctly for the extended range of values. * Decreasing the range of accepted values for a property or parameter, such as a change in parsing of input and throwing new errors (even if parsing behavior is not specified in the docs) * Increasing the range of returned values for a property, field, return or `out` value * Changing the returned values for a property, field, return or 'out' value, such as the value returned from `ToString` If you had an API which returned a value from 0-10, but actually intended to divide the value by two and forgot (return only 0-5) then changing the return to now give the correct value is a breaking. * Changing the default value for a property, field or parameter (either via an overload or default value) * Changing the value of an enum member * Changing the precision of a numerical return value ### Exceptions &#10003; **Allowed** * Throwing a more derived exception than an existing exception For example, `CultureInfo.GetCultureInfo(String)` used to throw `ArgumentException` in .NET Framework 3.5. In .NET Framework 4.0, this was changed to throw `CultureNotFoundException` which derives from `ArgumentException`, and therefore is an acceptable change. * Throwing a more specific exception than `NotSupportedException`, `NotImplementedException`, `NullReferenceException` or an exception that is considered unrecoverable Unrecoverable exceptions should not be getting caught and will be dealt with on a broad level by a high-level catch-all handler. Therefore, users are not expected to have code that catches these explicit exceptions. The unrecoverable exceptions are: * `StackOverflowException` * `SEHException` * `ExecutionEngineException` * `AccessViolationException` * Throwing a new exception that only applies to a code-path which can only be observed with new parameter values, or state (that couldn't hit by existing code targeting the previous version) * Removing an exception that was being thrown when the API allows more robust behavior or enables new scenarios For example, a Divide method which only worked on positive values, but threw an exception otherwise, can be changed to support all values and the exception is no longer thrown. &#10007; **Disallowed** * Throwing a new exception in any other case not listed above * Removing an exception in any other case not listed above ### Platform Support &#10003; **Allowed** * An operation previously not supported on a specific platform, is now supported &#10007; **Disallowed** * An operation previously supported on a specific platform is no longer supported, or now requires a specific service-pack ### Code &#10003; **Allowed** * A change which is directly intended to increase performance of an operation The ability to modify the performance of an operation is essential in order to ensure we stay competitive, and we continue to give users operational benefits. This can break anything which relies upon the current speed of an operation, sometimes visible in badly built code relying upon asynchronous operations. Note that the performance change should have no affect on other behavior of the API in question, otherwise the change will be breaking. * A change which indirectly, and often adversely, affects performance Assuming the change in question is not categorized as breaking for some other reason, this is acceptable. Often, actions need to be taken which may include extra operation calls, or new functionality. This will almost always affect performance, but may be essential to make the API in question function as expected. * Changing the text of an error message Not only should users not rely on these text messages, but they change anyways based on culture * Calling a brand new event that wasn't previously defined. &#10007; **Disallowed** * Adding the `checked` keyword to a code-block This may cause code in a block to begin to throwing exceptions, an unacceptable change. * Changing the order in which events are fired Developers can reasonably expect events to fire in the same order. * Removing the raising of an event on a given action * Changing a synchronous API to asynchronous (and vice versa) * Firing an existing event when it was never fired before * Changing the number of times given events are called ## Source and Binary Compatibility Changes ### Assemblies &#10003; **Allowed** * Making an assembly portable when the same platforms are still supported &#10007; **Disallowed** * Changing the name of an assembly * Changing the public key of an assembly ### Types &#10003; **Allowed** * Adding the `sealed` or `abstract` keyword to a type when there are _no accessible_ (public or protected) constructors * Increasing the visibility of a type * Introducing a new base class So long as it does not introduce any new abstract members or change the semantics or behavior of existing members, a type can be introduced into a hierarchy between two existing types. For example, between .NET Framework 1.1 and .NET Framework 2.0, we introduced `DbConnection` as a new base class for `SqlConnection` which previously derived from `Component`. * Adding an interface implementation to a type This is acceptable because it will not adversely affect existing clients. Any changes which could be made to the type being changed in this situation, will have to work within the boundaries of acceptable changes defined here, in order for the new implementation to remain acceptable. Extreme caution is urged when adding interfaces that directly affect the ability of the designer or serializer to generate code or data, that cannot be consumed down-level. An example is the `ISerializable` interface. Care should be taken when the interface (or one of the interfaces that this interface requires) has default interface implementations for other interface methods. The default implementation could conflict with other default implementations in a derived class. * Removing an interface implementation from a type when the interface is already implemented lower in the hierarchy * Moving a type from one assembly into another assembly The old assembly must be marked with `TypeForwardedToAttribute` pointing to the new location * Changing a `struct` type to a `readonly struct` type &#10007; **Disallowed** * Adding the `sealed` or `abstract` keyword to a type when there _are accessible_ (public or protected) constructors * Decreasing the visibility of a type * Removing the implementation of an interface on a type It is not breaking when you added the implementation of an interface which derives from the removed interface. For example, you removed `IDisposable`, but implemented `IComponent`, which derives from `IDisposable`. * Removing one or more base classes for a type, including changing `struct` to `class` and vice versa * Changing the namespace or name of a type * Changing a `readonly struct` type to a `struct` type * Changing a `struct` type to a `ref struct` type and vice versa * Changing the underlying type of an enum This is a compile-time and behavioral breaking change as well as a binary breaking change which can make attribute arguments unparsable. ### Members &#10003; **Allowed** * Adding an abstract member to a public type when there are _no accessible_ (`public` or `protected`) constructors, or the type is `sealed` * Moving a method onto a class higher in the hierarchy tree of the type from which it was removed * Increasing the visibility of a member that is not `virtual` * Decreasing the visibility of a `protected` member when there are _no accessible_ (`public` or `protected`) constructors or the type is `sealed` * Changing a member from `abstract` to `virtual` * Introducing or removing an override Make note, that introducing an override might cause previous consumers to skip over the override when calling `base`. * Change from `ref readonly` return to `ref` return (except for virtual methods or interfaces) * Adding an interface method with a default implementation to an interface Note that care must be taken when adding a default implementation that has "update" semantic (e.g. adding `void AddAll(IEnumerable<T> items)` to `ICollection<T>`). If the interface is implemented by a struct, the default implementation is always executed on a boxed `this`: if the struct is not boxed, the runtime boxes it on users behalf. Changes done by the default interface method would be lost in that case. An example where this implicit boxing would happen are constrained calls (`void CallMethod<T, U>(ref T x) where T : struct, ICollection<U> { x.AddAll(...); }` &#10007; **Disallowed** * Adding an abstract method to an interface * Adding a default implementation of an _existing interface method_ (`IA.Foo`) on an _existing_ interface type (`IB`) User code could already be providing a default interface method implementation for `IA.Foo` in another interface (`IU`). If a user type implements both `IU` and `IB`, this would result in the "diamond problem" and runtime/compiler would not be able to disambiguate the target of the interface call. Note that this rule also applies to providing a default implementation for public interface methods on _non-public_ interfaces that are implemented by unsealed public types. * Adding an abstract member to a type when there _are accessible_ (`public` or `protected`) constructors and the type is not `sealed` * Adding a constructor to a class which previously had no constructor, without also adding the default constructor * Adding an overload that precludes an existing overload, and defines different behavior This will break existing clients that were bound to the previous overload. For example, if you have a class that has a single version of a method that accepts a `uint`, an existing consumer will successfully bind to that overload, if simply passing an `int` value. However, if you add an overload that accepts an `int`, recompiling or via late-binding the application will now bind to the new overload. If different behavior results, then this is a breaking change. * Moving an exposed field onto a class higher in the hierarchy tree of the type from which it was removed * Removing or renaming a member, including a getter or setter from a property or enum members * Decreasing the visibility of a `protected` member when there _are accessible_ (`public` or `protected`) constructors and the type is not `sealed` * Adding or removing `abstract` from a member * Removing the `virtual` keyword from a member * Adding `virtual` to a member While this change would often work without breaking too many scenarios because C# compiler tends to emit `callvirt` IL instructions to call non-virtual methods (`callvirt` performs a null check, while a normal `call` won't), we can't rely on it. C# is not the only language we target and the C# compiler increasingly tries to optimize `callvirt` to a normal `call` whenever the target method is non-virtual and the `this` is provably not null (such as a method accessed through the `?.` null propagation operator). Making a method virtual would mean that consumer code would often end up calling it non-virtually. * Change from `ref` return to `ref readonly` return * Change from `ref readonly` return to `ref` return on a virtual method or interface * Adding or removing `static` keyword from a member * Adding a field to a struct that previously had no state Definite assignment rules allow use of uninitialized variables so long as the variable type is a stateless struct. If the struct is made stateful, code could now end up with uninitialized data. This is both potentially a source breaking and binary breaking change. ### Signatures &#10003; **Allowed** * Adding `params` to a parameter * Removing `readonly` from a field, unless the static type of the field is a mutable value type &#10007; **Disallowed** * Adding `readonly` to a field * Adding the `FlagsAttribute` to an enum * Changing the type of a property, field, parameter or return value * Adding, removing or changing the order of parameters * Removing `params` from a parameter * Adding or removing `in`, `out`, or `ref` keywords from a parameter * Renaming a parameter (including case) This is considered breaking for two reasons: * It breaks late-bound scenarios, such as Visual Basic's late-binding feature and C#'s `dynamic` * It breaks source compatibility when developers use [named parameters](http://msdn.microsoft.com/en-us/library/dd264739.aspx). * Changing a parameter modifier from `ref` to `out`, or vice versa ### Attributes &#10003; **Allowed** * Changing the value of an attribute that is _not observable_ &#10007; **Disallowed** * Removing an attribute Although this item can be addressed on a case to case basis, removing an attribute will often be breaking. For example, `NonSerializedAttribute` * Changing values of an attribute that _is observable_
Breaking Change Rules ===================== * [Behavioral Changes](#behavioral-changes) * [Property, Field, Parameter and Return Values](#property-field-parameter-and-return-values) * [Exceptions](#exceptions) * [Platform Support](#platform-support) * [Code](#code) * [Source and Binary Compatibility Changes](#source-and-binary-compatibility-changes) * [Assemblies](#assemblies) * [Types](#types) * [Members](#members) * [Signatures](#signatures) * [Attributes](#attributes) ## Behavioral Changes ### Property, Field, Parameter and Return Values &#10003; **Allowed** * Increasing the range of accepted values for a property or parameter if the member _is not_ `virtual` Note that the range can only increase to the extent that it does not impact the static type. e.g. it is OK to remove `if (x > 10) throw new ArgumentOutOfRangeException("x")`, but it is not OK to change the type of `x` from `int` to `long` or `int?`. * Returning a value of a more derived type for a property, field, return or `out` value Note, again, that the static type cannot change. e.g. it is OK to return a `string` instance where an `object` was returned previously, but it is not OK to change the return type from `object` to `string`. &#10007; **Disallowed** * Increasing the range of accepted values for a property or parameter if the member _is_ `virtual` This is breaking because any existing overridden members will now not function correctly for the extended range of values. * Decreasing the range of accepted values for a property or parameter, such as a change in parsing of input and throwing new errors (even if parsing behavior is not specified in the docs) * Increasing the range of returned values for a property, field, return or `out` value * Changing the returned values for a property, field, return or 'out' value, such as the value returned from `ToString` If you had an API which returned a value from 0-10, but actually intended to divide the value by two and forgot (return only 0-5) then changing the return to now give the correct value is a breaking. * Changing the default value for a property, field or parameter (either via an overload or default value) * Changing the value of an enum member * Changing the precision of a numerical return value ### Exceptions &#10003; **Allowed** * Throwing a more derived exception than an existing exception For example, `CultureInfo.GetCultureInfo(String)` used to throw `ArgumentException` in .NET Framework 3.5. In .NET Framework 4.0, this was changed to throw `CultureNotFoundException` which derives from `ArgumentException`, and therefore is an acceptable change. * Throwing a more specific exception than `NotSupportedException`, `NotImplementedException`, `NullReferenceException` or an exception that is considered unrecoverable Unrecoverable exceptions should not be getting caught and will be dealt with on a broad level by a high-level catch-all handler. Therefore, users are not expected to have code that catches these explicit exceptions. The unrecoverable exceptions are: * `StackOverflowException` * `SEHException` * `ExecutionEngineException` * `AccessViolationException` * Throwing a new exception that only applies to a code-path which can only be observed with new parameter values, or state (that couldn't hit by existing code targeting the previous version) * Removing an exception that was being thrown when the API allows more robust behavior or enables new scenarios For example, a Divide method which only worked on positive values, but threw an exception otherwise, can be changed to support all values and the exception is no longer thrown. &#10007; **Disallowed** * Throwing a new exception in any other case not listed above * Removing an exception in any other case not listed above ### Platform Support &#10003; **Allowed** * An operation previously not supported on a specific platform, is now supported &#10007; **Disallowed** * An operation previously supported on a specific platform is no longer supported, or now requires a specific service-pack ### Code &#10003; **Allowed** * A change which is directly intended to increase performance of an operation The ability to modify the performance of an operation is essential in order to ensure we stay competitive, and we continue to give users operational benefits. This can break anything which relies upon the current speed of an operation, sometimes visible in badly built code relying upon asynchronous operations. Note that the performance change should have no affect on other behavior of the API in question, otherwise the change will be breaking. * A change which indirectly, and often adversely, affects performance Assuming the change in question is not categorized as breaking for some other reason, this is acceptable. Often, actions need to be taken which may include extra operation calls, or new functionality. This will almost always affect performance, but may be essential to make the API in question function as expected. * Changing the text of an error message Not only should users not rely on these text messages, but they change anyways based on culture * Calling a brand new event that wasn't previously defined. &#10007; **Disallowed** * Adding the `checked` keyword to a code-block This may cause code in a block to begin to throwing exceptions, an unacceptable change. * Changing the order in which events are fired Developers can reasonably expect events to fire in the same order. * Removing the raising of an event on a given action * Changing a synchronous API to asynchronous (and vice versa) * Firing an existing event when it was never fired before * Changing the number of times given events are called ## Source and Binary Compatibility Changes ### Assemblies &#10003; **Allowed** * Making an assembly portable when the same platforms are still supported &#10007; **Disallowed** * Changing the name of an assembly * Changing the public key of an assembly ### Types &#10003; **Allowed** * Adding the `sealed` or `abstract` keyword to a type when there are _no accessible_ (public or protected) constructors * Increasing the visibility of a type * Introducing a new base class So long as it does not introduce any new abstract members or change the semantics or behavior of existing members, a type can be introduced into a hierarchy between two existing types. For example, between .NET Framework 1.1 and .NET Framework 2.0, we introduced `DbConnection` as a new base class for `SqlConnection` which previously derived from `Component`. * Adding an interface implementation to a type This is acceptable because it will not adversely affect existing clients. Any changes which could be made to the type being changed in this situation, will have to work within the boundaries of acceptable changes defined here, in order for the new implementation to remain acceptable. Extreme caution is urged when adding interfaces that directly affect the ability of the designer or serializer to generate code or data, that cannot be consumed down-level. An example is the `ISerializable` interface. Care should be taken when the interface (or one of the interfaces that this interface requires) has default interface implementations for other interface methods. The default implementation could conflict with other default implementations in a derived class. * Removing an interface implementation from a type when the interface is already implemented lower in the hierarchy * Moving a type from one assembly into another assembly The old assembly must be marked with `TypeForwardedToAttribute` pointing to the new location * Changing a `struct` type to a `readonly struct` type &#10007; **Disallowed** * Adding the `sealed` or `abstract` keyword to a type when there _are accessible_ (public or protected) constructors * Decreasing the visibility of a type * Removing the implementation of an interface on a type It is not breaking when you added the implementation of an interface which derives from the removed interface. For example, you removed `IDisposable`, but implemented `IComponent`, which derives from `IDisposable`. * Removing one or more base classes for a type, including changing `struct` to `class` and vice versa * Changing the namespace or name of a type * Changing a `readonly struct` type to a `struct` type * Changing a `struct` type to a `ref struct` type and vice versa * Changing the underlying type of an enum This is a compile-time and behavioral breaking change as well as a binary breaking change which can make attribute arguments unparsable. ### Members &#10003; **Allowed** * Adding an abstract member to a public type when there are _no accessible_ (`public` or `protected`) constructors, or the type is `sealed` * Moving a method onto a class higher in the hierarchy tree of the type from which it was removed * Increasing the visibility of a member that is not `virtual` * Decreasing the visibility of a `protected` member when there are _no accessible_ (`public` or `protected`) constructors or the type is `sealed` * Changing a member from `abstract` to `virtual` * Introducing or removing an override Make note, that introducing an override might cause previous consumers to skip over the override when calling `base`. * Change from `ref readonly` return to `ref` return (except for virtual methods or interfaces) * Adding an interface method with a default implementation to an interface Note that care must be taken when adding a default implementation that has "update" semantic (e.g. adding `void AddAll(IEnumerable<T> items)` to `ICollection<T>`). If the interface is implemented by a struct, the default implementation is always executed on a boxed `this`: if the struct is not boxed, the runtime boxes it on users behalf. Changes done by the default interface method would be lost in that case. An example where this implicit boxing would happen are constrained calls (`void CallMethod<T, U>(ref T x) where T : struct, ICollection<U> { x.AddAll(...); }` &#10007; **Disallowed** * Adding an abstract method to an interface * Adding a default implementation of an _existing interface method_ (`IA.Foo`) on an _existing_ interface type (`IB`) User code could already be providing a default interface method implementation for `IA.Foo` in another interface (`IU`). If a user type implements both `IU` and `IB`, this would result in the "diamond problem" and runtime/compiler would not be able to disambiguate the target of the interface call. Note that this rule also applies to providing a default implementation for public interface methods on _non-public_ interfaces that are implemented by unsealed public types. * Adding an abstract member to a type when there _are accessible_ (`public` or `protected`) constructors and the type is not `sealed` * Adding a constructor to a class which previously had no constructor, without also adding the default constructor * Adding an overload that precludes an existing overload, and defines different behavior This will break existing clients that were bound to the previous overload. For example, if you have a class that has a single version of a method that accepts a `uint`, an existing consumer will successfully bind to that overload, if simply passing an `int` value. However, if you add an overload that accepts an `int`, recompiling or via late-binding the application will now bind to the new overload. If different behavior results, then this is a breaking change. * Moving an exposed field onto a class higher in the hierarchy tree of the type from which it was removed * Removing or renaming a member, including a getter or setter from a property or enum members * Decreasing the visibility of a `protected` member when there _are accessible_ (`public` or `protected`) constructors and the type is not `sealed` * Adding or removing `abstract` from a member * Removing the `virtual` keyword from a member * Adding `virtual` to a member While this change would often work without breaking too many scenarios because C# compiler tends to emit `callvirt` IL instructions to call non-virtual methods (`callvirt` performs a null check, while a normal `call` won't), we can't rely on it. C# is not the only language we target and the C# compiler increasingly tries to optimize `callvirt` to a normal `call` whenever the target method is non-virtual and the `this` is provably not null (such as a method accessed through the `?.` null propagation operator). Making a method virtual would mean that consumer code would often end up calling it non-virtually. * Change from `ref` return to `ref readonly` return * Change from `ref readonly` return to `ref` return on a virtual method or interface * Adding or removing `static` keyword from a member * Adding a field to a struct that previously had no state Definite assignment rules allow use of uninitialized variables so long as the variable type is a stateless struct. If the struct is made stateful, code could now end up with uninitialized data. This is both potentially a source breaking and binary breaking change. ### Signatures &#10003; **Allowed** * Adding `params` to a parameter * Removing `readonly` from a field, unless the static type of the field is a mutable value type &#10007; **Disallowed** * Adding `readonly` to a field * Adding the `FlagsAttribute` to an enum * Changing the type of a property, field, parameter or return value * Adding, removing or changing the order of parameters * Removing `params` from a parameter * Adding or removing `in`, `out`, or `ref` keywords from a parameter * Renaming a parameter (including case) This is considered breaking for two reasons: * It breaks late-bound scenarios, such as Visual Basic's late-binding feature and C#'s `dynamic` * It breaks source compatibility when developers use [named parameters](http://msdn.microsoft.com/en-us/library/dd264739.aspx). * Changing a parameter modifier from `ref` to `out`, or vice versa ### Attributes &#10003; **Allowed** * Changing the value of an attribute that is _not observable_ &#10007; **Disallowed** * Removing an attribute Although this item can be addressed on a case to case basis, removing an attribute will often be breaking. For example, `NonSerializedAttribute` * Changing values of an attribute that _is observable_
-1
dotnet/runtime
66,160
Update files to remove imhameed
SamMonoRT
2022-03-03T20:37:43Z
2022-03-04T17:15:58Z
1d82d48e8c8150bfb549f095d6dafb599ff9f229
611d45f73e65076ebff2f8b71c668cf56114deae
Update files to remove imhameed.
./docs/design/coreclr/jit/finally-optimizations.md
Finally Optimizations ===================== In MSIL, a try-finally is a construct where a block of code (the finally) is guaranteed to be executed after control leaves a protected region of code (the try) either normally or via an exception. In RyuJit a try-finally is currently implemented by transforming the finally into a local function that is invoked via jitted code at normal exits from the try block and is invoked via the runtime for exceptional exits from the try block. For x86 the local function is simply a part of the method and shares the same stack frame with the method. For other architectures the local function is promoted to a potentially separable "funclet" which is almost like a regular function with a prolog and epilog. A custom calling convention gives the funclet access to the parent stack frame. In this proposal we outline three optimizations for finallys: removing empty trys, removing empty finallys and finally cloning. Empty Finally Removal --------------------- An empty finally is one that has no observable effect. These often arise from `foreach` or `using` constructs (which induce a try-finally) where the cleanup method called in the finally does nothing. Often, after inlining, the empty finally is readily apparent. For example, this snippet of C# code ```C# static int Sum(List<int> x) { int sum = 0; foreach(int i in x) { sum += i; } return sum; } ``` produces the following jitted code: ```asm ; Successfully inlined Enumerator[Int32][System.Int32]:Dispose():this ; (1 IL bytes) (depth 1) [below ALWAYS_INLINE size] G_M60484_IG01: 55 push rbp 57 push rdi 56 push rsi 4883EC50 sub rsp, 80 488D6C2460 lea rbp, [rsp+60H] 488BF1 mov rsi, rcx 488D7DD0 lea rdi, [rbp-30H] B906000000 mov ecx, 6 33C0 xor rax, rax F3AB rep stosd 488BCE mov rcx, rsi 488965C0 mov qword ptr [rbp-40H], rsp G_M60484_IG02: 33C0 xor eax, eax 8945EC mov dword ptr [rbp-14H], eax 8B01 mov eax, dword ptr [rcx] 8B411C mov eax, dword ptr [rcx+28] 33D2 xor edx, edx 48894DD0 mov gword ptr [rbp-30H], rcx 8955D8 mov dword ptr [rbp-28H], edx 8945DC mov dword ptr [rbp-24H], eax 8955E0 mov dword ptr [rbp-20H], edx G_M60484_IG03: 488D4DD0 lea rcx, bword ptr [rbp-30H] E89B35665B call Enumerator[Int32][System.Int32]:MoveNext():bool:this 85C0 test eax, eax 7418 je SHORT G_M60484_IG05 ; Body of foreach loop G_M60484_IG04: 8B4DE0 mov ecx, dword ptr [rbp-20H] 8B45EC mov eax, dword ptr [rbp-14H] 03C1 add eax, ecx 8945EC mov dword ptr [rbp-14H], eax 488D4DD0 lea rcx, bword ptr [rbp-30H] E88335665B call Enumerator[Int32][System.Int32]:MoveNext():bool:this 85C0 test eax, eax 75E8 jne SHORT G_M60484_IG04 ; Normal exit from the implicit try region created by `foreach` ; Calls the finally to dispose of the iterator G_M60484_IG05: 488BCC mov rcx, rsp E80C000000 call G_M60484_IG09 // call to finally G_M60484_IG06: 90 nop G_M60484_IG07: 8B45EC mov eax, dword ptr [rbp-14H] G_M60484_IG08: 488D65F0 lea rsp, [rbp-10H] 5E pop rsi 5F pop rdi 5D pop rbp C3 ret ; Finally funclet. Note it simply sets up and then tears down a stack ; frame. The dispose method was inlined and is empty. G_M60484_IG09: 55 push rbp 57 push rdi 56 push rsi 4883EC30 sub rsp, 48 488B6920 mov rbp, qword ptr [rcx+32] 48896C2420 mov qword ptr [rsp+20H], rbp 488D6D60 lea rbp, [rbp+60H] G_M60484_IG10: 4883C430 add rsp, 48 5E pop rsi 5F pop rdi 5D pop rbp C3 ret ``` In such cases the try-finally can be removed, leading to code like the following: ```asm G_M60484_IG01: 57 push rdi 56 push rsi 4883EC38 sub rsp, 56 488BF1 mov rsi, rcx 488D7C2420 lea rdi, [rsp+20H] B906000000 mov ecx, 6 33C0 xor rax, rax F3AB rep stosd 488BCE mov rcx, rsi G_M60484_IG02: 33F6 xor esi, esi 8B01 mov eax, dword ptr [rcx] 8B411C mov eax, dword ptr [rcx+28] 48894C2420 mov gword ptr [rsp+20H], rcx 89742428 mov dword ptr [rsp+28H], esi 8944242C mov dword ptr [rsp+2CH], eax 89742430 mov dword ptr [rsp+30H], esi G_M60484_IG03: 488D4C2420 lea rcx, bword ptr [rsp+20H] E8A435685B call Enumerator[Int32][System.Int32]:MoveNext():bool:this 85C0 test eax, eax 7414 je SHORT G_M60484_IG05 G_M60484_IG04: 8B4C2430 mov ecx, dword ptr [rsp+30H] 03F1 add esi, ecx 488D4C2420 lea rcx, bword ptr [rsp+20H] E89035685B call Enumerator[Int32][System.Int32]:MoveNext():bool:this 85C0 test eax, eax 75EC jne SHORT G_M60484_IG04 G_M60484_IG05: 8BC6 mov eax, esi G_M60484_IG06: 4883C438 add rsp, 56 5E pop rsi 5F pop rdi C3 ret ``` Empty finally removal is unconditionally profitable: it should always reduce code size and improve code speed. Empty Try Removal --------------------- If the try region of a try-finally is empty, and the jitted code will execute on a runtime that does not protect finally execution from thread abort, then the try-finally can be replaced with just the content of the finally. Empty trys with non-empty finallys often exist in code that must run under both thread-abort aware and non-thread-abort aware runtimes. In the former case the placement of cleanup code in the finally ensures that the cleanup code will execute fully. But if thread abort is not possible, the extra protection offered by the finally is not needed. Empty try removal looks for try-finallys where the try region does nothing except invoke the finally. There are currently two different EH implementation models, so the try screening has two cases: * callfinally thunks (x64/arm64): the try must be a single empty basic block that always jumps to a callfinally that is the first half of a callfinally/always pair; * non-callfinally thunks (x86/arm32): the try must be a callfinally/always pair where the first block is an empty callfinally. The screening then verifies that the callfinally identified above is the only callfinally for the try. No other callfinallys are expected because this try cannot have multiple leaves and its handler cannot be reached by nested exit paths. When the empty try is identified, the jit modifies the callfinally/always pair to branch to the handler, modifies the handler's return to branch directly to the continuation (the branch target of the second half of the callfinally/always pair), updates various status flags on the blocks, and then removes the try-finally region. Finally Cloning --------------- Finally cloning is an optimization where the jit duplicates the code in the finally for one or more of the normal exit paths from the try, and has those exit points branch to the duplicated code directly, rather than calling the finally. This transformation allows for improved performance and optimization of the common case where the try completes without an exception. Finally cloning also allows hot/cold splitting of finally bodies: the cloned finally code covers the normal try exit paths (the hot cases) and can be placed in the main method region, and the original finally, now used largely or exclusively for exceptional cases (the cold cases) spilt off into the cold code region. Without cloning, RyuJit would always treat the finally as cold code. Finally cloning will increase code size, though often the size increase is mitigated somewhat by more compact code generation in the try body and streamlined invocation of the cloned finallys. Try-finally regions may have multiple normal exit points. For example the following `try` has two: one at the `return 3` and one at the try region end: ```C# try { if (p) return 3; ... } finally { ... } return 4; ``` Here the finally must be executed no matter how the try exits. So there are to two normal exit paths from the try, both of which pass through the finally but which then diverge. The fact that some try regions can have multiple exits opens the potential for substantial code growth from finally cloning, and so leads to a choice point in the implementation: * Share the clone along all exit paths * Share the clone along some exit paths * Clone along all exit paths * Clone along some exit paths * Only clone along one exit path * Only clone when there is one exit path The shared clone option must essentially recreate or simulate the local call mechanism for the finally, though likely somewhat more efficiently. Each exit point must designate where control should resume once the shared finally has finished. For instance the jit could introduce a new local per try-finally to determine where the cloned finally should resume, and enumerate the possibilities using a small integer. The end of the cloned finally would then use a switch to determine what code to execute next. This has the downside of introducing unrealizable paths into the control flow graph. Cloning along all exit paths can potentially lead to large amounts of code growth. Cloning along some paths or only one path implies that some normal exit paths won't be as well optimized. Nonetheless cloning along one path was the choice made by JIT64 and the one we recommend for implementation. In particular we suggest only cloning along the end of try region exit path, so that any early exit will continue to invoke the funclet for finally cleanup (unless that exit happens to have the same post-finally continuation as the end try region exit, in which case it can simply jump to the cloned finally). One can imagine adaptive strategies. The size of the finally can be roughly estimated and the number of clones needed for full cloning readily computed. Selective cloning can be based on profile feedback or other similar mechanisms for choosing the profitable cases. The current implementation will clone the finally and retarget the last (largest IL offset) leave in the try region to the clone. Any other leave that ultimately transfers control to the same post-finally offset will also be modified to jump to the clone. Empirical studies have shown that most finallys are small. Thus to avoid excessive code growth, a crude size estimate is formed by counting the number of statements in the blocks that make up the finally. Any finally larger that 15 statements is not cloned. In our study this disqualifed about 0.5% of all finallys from cloning. ### EH Nesting Considerations Finally cloning is also more complicated when the finally encloses other EH regions, since the clone will introduce copies of all these regions. While it is possible to implement cloning in such cases we propose to defer for now. Finally cloning is also a bit more complicated if the finally is enclosed by another finally region, so we likewise propose deferring support for this. (Seems like a rare enough thing but maybe not too hard to handle -- though possibly not worth it if we're not going to support the enclosing case). ### Control-Flow and Other Considerations If the try never exits normally, then the finally can only be invoked in exceptional cases. There is no benefit to cloning since the cloned finally would be unreachable. We can detect a subset of such cases because there will be no call finally blocks. JIT64 does not clone finallys that contained switch. We propose to do likewise. (Initially I did not include this restriction but hit a failing test case where the finally contained a switch. Might be worth a deeper look, though such cases are presumably rare.) If the finally never exits normally, then we presume it is cold code, and so will not clone. If the finally is marked as run rarely, we will not clone. Implementation Proposal ----------------------- We propose that empty finally removal and finally cloning be run back to back, spliced into the phase list just after fgInline and fgAddInternal, and just before implicit by-ref and struct promotion. We want to run these early before a lot of structural invariants regarding EH are put in place, and before most other optimization, but run them after inlining (so empty finallys can be more readily identified) and after the addition of implicit try-finallys created by the jit. Empty finallys may arise later because of optimization, but this seems relatively uncommon. We will remove empty finallys first, then clone. Neither optimization will run when the jit is generating debuggable code or operating in min opts mode. ### Empty Finally Removal (Sketch) Skip over methods that have no EH, are compiled with min opts, or where the jit is generating debuggable code. Walk the handler table, looking for try-finally (we could also look for and remove try-faults with empty faults, but those are presumably rare). If the finally is a single block and contains only a `retfilter` statement, then: * Retarget the callfinally(s) to jump always to the continuation blocks. * Remove the paired jump always block(s) (note we expect all finally calls to be paired since the empty finally returns). * For funclet EH models with finally target bits, clear the finally target from the continuations. * For non-funclet EH models only, clear out the GT_END_LFIN statement in the finally continuations. * Remove the handler block. * Reparent all directly contained try blocks to the enclosing try region or to the method region if there is no enclosing try. * Remove the try-finally from the EH table via `fgRemoveEHTableEntry`. After the walk, if any empty finallys were removed, revalidate the integrity of the handler table. ### Finally Cloning (Sketch) Skip over all methods, if the runtime suports thread abort. More on this below. Skip over methods that have no EH, are compiled with min opts, or where the jit is generating debuggable code. Walk the handler table, looking for try-finally. If the finally is enclosed in a handler or encloses another handler, skip. Walk the finally body blocks. If any is BBJ_SWITCH, or if none is BBJ_EHFINALLYRET, skip cloning. If all blocks are RunRarely skip cloning. If the finally has more that 15 statements, skip cloning. Walk the try region from back to front (from largest to smallest IL offset). Find the last block in the try that invokes the finally. That will be the path that will invoke the clone. If the EH model requires callfinally thunks, and there are multiple thunks that invoke the finally, and the callfinally thunk along the clone path is not the first, move it to the front (this helps avoid extra jumps). Set the insertion point to just after the callfinally in the path (for thunk models) or the end of the try (for non-thunk models). Set up a block map. Clone the finally body using `fgNewBBinRegion` and `fgNewBBafter` to make the first and subsequent blocks, and `CloneBlockState` to fill in the block contents. Clear the handler region on the cloned blocks. Bail out if cloning fails. Mark the first and last cloned blocks with appropriate BBF flags. Patch up inter-clone branches and convert the returns into jumps to the continuation. Walk the callfinallys, retargeting the ones that return to the continuation so that they invoke the clone. Remove the paired always blocks. Clear the finally target bit and any GT_END_LFIN from the continuation. If all call finallys are converted, modify the region to be try/fault (interally EH_HANDLER_FAULT_WAS_FINALLY, so we can distinguish it later from "organic" try/faults). Otherwise leave it as a try/finally. Clear the catch type on the clone entry. ### Thread Abort For runtimes that support thread abort (desktop), more work is required: * The cloned finally must be reported to the runtime. Likely this can trigger off of the BBF_CLONED_FINALLY_BEGIN/END flags. * The jit must maintain the integrity of the clone by not losing track of the blocks involved, and not allowing code to move in our out of the cloned region Code Size Impact ---------------- Code size impact from finally cloning was measured for CoreCLR on Windows x64. ``` Total bytes of diff: 16158 (0.12 % of base) diff is a regression. Total byte diff includes 0 bytes from reconciling methods Base had 0 unique methods, 0 unique bytes Diff had 0 unique methods, 0 unique bytes Top file regressions by size (bytes): 3518 : Microsoft.CodeAnalysis.CSharp.dasm (0.16 % of base) 1895 : System.Linq.Expressions.dasm (0.32 % of base) 1626 : Microsoft.CodeAnalysis.VisualBasic.dasm (0.07 % of base) 1428 : System.Threading.Tasks.Parallel.dasm (4.66 % of base) 1248 : System.Linq.Parallel.dasm (0.20 % of base) Top file improvements by size (bytes): -4529 : System.Private.CoreLib.dasm (-0.14 % of base) -975 : System.Reflection.Metadata.dasm (-0.28 % of base) -239 : System.Private.Uri.dasm (-0.27 % of base) -104 : System.Runtime.InteropServices.RuntimeInformation.dasm (-3.36 % of base) -99 : System.Security.Cryptography.Encoding.dasm (-0.61 % of base) 57 total files with size differences. Top method regessions by size (bytes): 645 : System.Diagnostics.Process.dasm - System.Diagnostics.Process:StartCore(ref):bool:this 454 : Microsoft.CSharp.dasm - Microsoft.CSharp.RuntimeBinder.Semantics.ExpressionBinder:AdjustCallArgumentsForParams(ref,ref,ref,ref,ref,byref):this 447 : System.Threading.Tasks.Dataflow.dasm - System.Threading.Tasks.Dataflow.Internal.SpscTargetCore`1[__Canon][System.__Canon]:ProcessMessagesLoopCore():this 421 : Microsoft.CodeAnalysis.VisualBasic.dasm - Microsoft.CodeAnalysis.VisualBasic.Symbols.ImplementsHelper:FindExplicitlyImplementedMember(ref,ref,ref,ref,ref,ref,byref):ref 358 : System.Private.CoreLib.dasm - System.Threading.TimerQueueTimer:Change(int,int):bool:this Top method improvements by size (bytes): -2512 : System.Private.CoreLib.dasm - DomainNeutralILStubClass:IL_STUB_CLRtoWinRT():ref:this (68 methods) -824 : Microsoft.CodeAnalysis.dasm - Microsoft.Cci.PeWriter:WriteHeaders(ref,ref,ref,ref,byref):this -663 : System.Private.CoreLib.dasm - DomainNeutralILStubClass:IL_STUB_CLRtoWinRT(ref):int:this (17 methods) -627 : System.Private.CoreLib.dasm - System.Diagnostics.Tracing.ManifestBuilder:CreateManifestString():ref:this -546 : System.Private.CoreLib.dasm - DomainNeutralILStubClass:IL_STUB_WinRTtoCLR(long):int:this (67 methods) 3014 total methods with size differences. ``` The largest growth is seen in `Process:StartCore`, which has 4 try-finally constructs. Diffs generally show improved codegen in the try bodies with cloned finallys. However some of this improvement comes from more aggressive use of callee save registers, and this causes size inflation in the funclets (note finally cloning does not alter the number of funclets). So if funclet save/restore could be contained to registers used in the funclet, the size impact would be slightly smaller. There are also some instances where cloning relatively small finallys leads to large code size increases. xxx is one example.
Finally Optimizations ===================== In MSIL, a try-finally is a construct where a block of code (the finally) is guaranteed to be executed after control leaves a protected region of code (the try) either normally or via an exception. In RyuJit a try-finally is currently implemented by transforming the finally into a local function that is invoked via jitted code at normal exits from the try block and is invoked via the runtime for exceptional exits from the try block. For x86 the local function is simply a part of the method and shares the same stack frame with the method. For other architectures the local function is promoted to a potentially separable "funclet" which is almost like a regular function with a prolog and epilog. A custom calling convention gives the funclet access to the parent stack frame. In this proposal we outline three optimizations for finallys: removing empty trys, removing empty finallys and finally cloning. Empty Finally Removal --------------------- An empty finally is one that has no observable effect. These often arise from `foreach` or `using` constructs (which induce a try-finally) where the cleanup method called in the finally does nothing. Often, after inlining, the empty finally is readily apparent. For example, this snippet of C# code ```C# static int Sum(List<int> x) { int sum = 0; foreach(int i in x) { sum += i; } return sum; } ``` produces the following jitted code: ```asm ; Successfully inlined Enumerator[Int32][System.Int32]:Dispose():this ; (1 IL bytes) (depth 1) [below ALWAYS_INLINE size] G_M60484_IG01: 55 push rbp 57 push rdi 56 push rsi 4883EC50 sub rsp, 80 488D6C2460 lea rbp, [rsp+60H] 488BF1 mov rsi, rcx 488D7DD0 lea rdi, [rbp-30H] B906000000 mov ecx, 6 33C0 xor rax, rax F3AB rep stosd 488BCE mov rcx, rsi 488965C0 mov qword ptr [rbp-40H], rsp G_M60484_IG02: 33C0 xor eax, eax 8945EC mov dword ptr [rbp-14H], eax 8B01 mov eax, dword ptr [rcx] 8B411C mov eax, dword ptr [rcx+28] 33D2 xor edx, edx 48894DD0 mov gword ptr [rbp-30H], rcx 8955D8 mov dword ptr [rbp-28H], edx 8945DC mov dword ptr [rbp-24H], eax 8955E0 mov dword ptr [rbp-20H], edx G_M60484_IG03: 488D4DD0 lea rcx, bword ptr [rbp-30H] E89B35665B call Enumerator[Int32][System.Int32]:MoveNext():bool:this 85C0 test eax, eax 7418 je SHORT G_M60484_IG05 ; Body of foreach loop G_M60484_IG04: 8B4DE0 mov ecx, dword ptr [rbp-20H] 8B45EC mov eax, dword ptr [rbp-14H] 03C1 add eax, ecx 8945EC mov dword ptr [rbp-14H], eax 488D4DD0 lea rcx, bword ptr [rbp-30H] E88335665B call Enumerator[Int32][System.Int32]:MoveNext():bool:this 85C0 test eax, eax 75E8 jne SHORT G_M60484_IG04 ; Normal exit from the implicit try region created by `foreach` ; Calls the finally to dispose of the iterator G_M60484_IG05: 488BCC mov rcx, rsp E80C000000 call G_M60484_IG09 // call to finally G_M60484_IG06: 90 nop G_M60484_IG07: 8B45EC mov eax, dword ptr [rbp-14H] G_M60484_IG08: 488D65F0 lea rsp, [rbp-10H] 5E pop rsi 5F pop rdi 5D pop rbp C3 ret ; Finally funclet. Note it simply sets up and then tears down a stack ; frame. The dispose method was inlined and is empty. G_M60484_IG09: 55 push rbp 57 push rdi 56 push rsi 4883EC30 sub rsp, 48 488B6920 mov rbp, qword ptr [rcx+32] 48896C2420 mov qword ptr [rsp+20H], rbp 488D6D60 lea rbp, [rbp+60H] G_M60484_IG10: 4883C430 add rsp, 48 5E pop rsi 5F pop rdi 5D pop rbp C3 ret ``` In such cases the try-finally can be removed, leading to code like the following: ```asm G_M60484_IG01: 57 push rdi 56 push rsi 4883EC38 sub rsp, 56 488BF1 mov rsi, rcx 488D7C2420 lea rdi, [rsp+20H] B906000000 mov ecx, 6 33C0 xor rax, rax F3AB rep stosd 488BCE mov rcx, rsi G_M60484_IG02: 33F6 xor esi, esi 8B01 mov eax, dword ptr [rcx] 8B411C mov eax, dword ptr [rcx+28] 48894C2420 mov gword ptr [rsp+20H], rcx 89742428 mov dword ptr [rsp+28H], esi 8944242C mov dword ptr [rsp+2CH], eax 89742430 mov dword ptr [rsp+30H], esi G_M60484_IG03: 488D4C2420 lea rcx, bword ptr [rsp+20H] E8A435685B call Enumerator[Int32][System.Int32]:MoveNext():bool:this 85C0 test eax, eax 7414 je SHORT G_M60484_IG05 G_M60484_IG04: 8B4C2430 mov ecx, dword ptr [rsp+30H] 03F1 add esi, ecx 488D4C2420 lea rcx, bword ptr [rsp+20H] E89035685B call Enumerator[Int32][System.Int32]:MoveNext():bool:this 85C0 test eax, eax 75EC jne SHORT G_M60484_IG04 G_M60484_IG05: 8BC6 mov eax, esi G_M60484_IG06: 4883C438 add rsp, 56 5E pop rsi 5F pop rdi C3 ret ``` Empty finally removal is unconditionally profitable: it should always reduce code size and improve code speed. Empty Try Removal --------------------- If the try region of a try-finally is empty, and the jitted code will execute on a runtime that does not protect finally execution from thread abort, then the try-finally can be replaced with just the content of the finally. Empty trys with non-empty finallys often exist in code that must run under both thread-abort aware and non-thread-abort aware runtimes. In the former case the placement of cleanup code in the finally ensures that the cleanup code will execute fully. But if thread abort is not possible, the extra protection offered by the finally is not needed. Empty try removal looks for try-finallys where the try region does nothing except invoke the finally. There are currently two different EH implementation models, so the try screening has two cases: * callfinally thunks (x64/arm64): the try must be a single empty basic block that always jumps to a callfinally that is the first half of a callfinally/always pair; * non-callfinally thunks (x86/arm32): the try must be a callfinally/always pair where the first block is an empty callfinally. The screening then verifies that the callfinally identified above is the only callfinally for the try. No other callfinallys are expected because this try cannot have multiple leaves and its handler cannot be reached by nested exit paths. When the empty try is identified, the jit modifies the callfinally/always pair to branch to the handler, modifies the handler's return to branch directly to the continuation (the branch target of the second half of the callfinally/always pair), updates various status flags on the blocks, and then removes the try-finally region. Finally Cloning --------------- Finally cloning is an optimization where the jit duplicates the code in the finally for one or more of the normal exit paths from the try, and has those exit points branch to the duplicated code directly, rather than calling the finally. This transformation allows for improved performance and optimization of the common case where the try completes without an exception. Finally cloning also allows hot/cold splitting of finally bodies: the cloned finally code covers the normal try exit paths (the hot cases) and can be placed in the main method region, and the original finally, now used largely or exclusively for exceptional cases (the cold cases) spilt off into the cold code region. Without cloning, RyuJit would always treat the finally as cold code. Finally cloning will increase code size, though often the size increase is mitigated somewhat by more compact code generation in the try body and streamlined invocation of the cloned finallys. Try-finally regions may have multiple normal exit points. For example the following `try` has two: one at the `return 3` and one at the try region end: ```C# try { if (p) return 3; ... } finally { ... } return 4; ``` Here the finally must be executed no matter how the try exits. So there are to two normal exit paths from the try, both of which pass through the finally but which then diverge. The fact that some try regions can have multiple exits opens the potential for substantial code growth from finally cloning, and so leads to a choice point in the implementation: * Share the clone along all exit paths * Share the clone along some exit paths * Clone along all exit paths * Clone along some exit paths * Only clone along one exit path * Only clone when there is one exit path The shared clone option must essentially recreate or simulate the local call mechanism for the finally, though likely somewhat more efficiently. Each exit point must designate where control should resume once the shared finally has finished. For instance the jit could introduce a new local per try-finally to determine where the cloned finally should resume, and enumerate the possibilities using a small integer. The end of the cloned finally would then use a switch to determine what code to execute next. This has the downside of introducing unrealizable paths into the control flow graph. Cloning along all exit paths can potentially lead to large amounts of code growth. Cloning along some paths or only one path implies that some normal exit paths won't be as well optimized. Nonetheless cloning along one path was the choice made by JIT64 and the one we recommend for implementation. In particular we suggest only cloning along the end of try region exit path, so that any early exit will continue to invoke the funclet for finally cleanup (unless that exit happens to have the same post-finally continuation as the end try region exit, in which case it can simply jump to the cloned finally). One can imagine adaptive strategies. The size of the finally can be roughly estimated and the number of clones needed for full cloning readily computed. Selective cloning can be based on profile feedback or other similar mechanisms for choosing the profitable cases. The current implementation will clone the finally and retarget the last (largest IL offset) leave in the try region to the clone. Any other leave that ultimately transfers control to the same post-finally offset will also be modified to jump to the clone. Empirical studies have shown that most finallys are small. Thus to avoid excessive code growth, a crude size estimate is formed by counting the number of statements in the blocks that make up the finally. Any finally larger that 15 statements is not cloned. In our study this disqualifed about 0.5% of all finallys from cloning. ### EH Nesting Considerations Finally cloning is also more complicated when the finally encloses other EH regions, since the clone will introduce copies of all these regions. While it is possible to implement cloning in such cases we propose to defer for now. Finally cloning is also a bit more complicated if the finally is enclosed by another finally region, so we likewise propose deferring support for this. (Seems like a rare enough thing but maybe not too hard to handle -- though possibly not worth it if we're not going to support the enclosing case). ### Control-Flow and Other Considerations If the try never exits normally, then the finally can only be invoked in exceptional cases. There is no benefit to cloning since the cloned finally would be unreachable. We can detect a subset of such cases because there will be no call finally blocks. JIT64 does not clone finallys that contained switch. We propose to do likewise. (Initially I did not include this restriction but hit a failing test case where the finally contained a switch. Might be worth a deeper look, though such cases are presumably rare.) If the finally never exits normally, then we presume it is cold code, and so will not clone. If the finally is marked as run rarely, we will not clone. Implementation Proposal ----------------------- We propose that empty finally removal and finally cloning be run back to back, spliced into the phase list just after fgInline and fgAddInternal, and just before implicit by-ref and struct promotion. We want to run these early before a lot of structural invariants regarding EH are put in place, and before most other optimization, but run them after inlining (so empty finallys can be more readily identified) and after the addition of implicit try-finallys created by the jit. Empty finallys may arise later because of optimization, but this seems relatively uncommon. We will remove empty finallys first, then clone. Neither optimization will run when the jit is generating debuggable code or operating in min opts mode. ### Empty Finally Removal (Sketch) Skip over methods that have no EH, are compiled with min opts, or where the jit is generating debuggable code. Walk the handler table, looking for try-finally (we could also look for and remove try-faults with empty faults, but those are presumably rare). If the finally is a single block and contains only a `retfilter` statement, then: * Retarget the callfinally(s) to jump always to the continuation blocks. * Remove the paired jump always block(s) (note we expect all finally calls to be paired since the empty finally returns). * For funclet EH models with finally target bits, clear the finally target from the continuations. * For non-funclet EH models only, clear out the GT_END_LFIN statement in the finally continuations. * Remove the handler block. * Reparent all directly contained try blocks to the enclosing try region or to the method region if there is no enclosing try. * Remove the try-finally from the EH table via `fgRemoveEHTableEntry`. After the walk, if any empty finallys were removed, revalidate the integrity of the handler table. ### Finally Cloning (Sketch) Skip over all methods, if the runtime suports thread abort. More on this below. Skip over methods that have no EH, are compiled with min opts, or where the jit is generating debuggable code. Walk the handler table, looking for try-finally. If the finally is enclosed in a handler or encloses another handler, skip. Walk the finally body blocks. If any is BBJ_SWITCH, or if none is BBJ_EHFINALLYRET, skip cloning. If all blocks are RunRarely skip cloning. If the finally has more that 15 statements, skip cloning. Walk the try region from back to front (from largest to smallest IL offset). Find the last block in the try that invokes the finally. That will be the path that will invoke the clone. If the EH model requires callfinally thunks, and there are multiple thunks that invoke the finally, and the callfinally thunk along the clone path is not the first, move it to the front (this helps avoid extra jumps). Set the insertion point to just after the callfinally in the path (for thunk models) or the end of the try (for non-thunk models). Set up a block map. Clone the finally body using `fgNewBBinRegion` and `fgNewBBafter` to make the first and subsequent blocks, and `CloneBlockState` to fill in the block contents. Clear the handler region on the cloned blocks. Bail out if cloning fails. Mark the first and last cloned blocks with appropriate BBF flags. Patch up inter-clone branches and convert the returns into jumps to the continuation. Walk the callfinallys, retargeting the ones that return to the continuation so that they invoke the clone. Remove the paired always blocks. Clear the finally target bit and any GT_END_LFIN from the continuation. If all call finallys are converted, modify the region to be try/fault (interally EH_HANDLER_FAULT_WAS_FINALLY, so we can distinguish it later from "organic" try/faults). Otherwise leave it as a try/finally. Clear the catch type on the clone entry. ### Thread Abort For runtimes that support thread abort (desktop), more work is required: * The cloned finally must be reported to the runtime. Likely this can trigger off of the BBF_CLONED_FINALLY_BEGIN/END flags. * The jit must maintain the integrity of the clone by not losing track of the blocks involved, and not allowing code to move in our out of the cloned region Code Size Impact ---------------- Code size impact from finally cloning was measured for CoreCLR on Windows x64. ``` Total bytes of diff: 16158 (0.12 % of base) diff is a regression. Total byte diff includes 0 bytes from reconciling methods Base had 0 unique methods, 0 unique bytes Diff had 0 unique methods, 0 unique bytes Top file regressions by size (bytes): 3518 : Microsoft.CodeAnalysis.CSharp.dasm (0.16 % of base) 1895 : System.Linq.Expressions.dasm (0.32 % of base) 1626 : Microsoft.CodeAnalysis.VisualBasic.dasm (0.07 % of base) 1428 : System.Threading.Tasks.Parallel.dasm (4.66 % of base) 1248 : System.Linq.Parallel.dasm (0.20 % of base) Top file improvements by size (bytes): -4529 : System.Private.CoreLib.dasm (-0.14 % of base) -975 : System.Reflection.Metadata.dasm (-0.28 % of base) -239 : System.Private.Uri.dasm (-0.27 % of base) -104 : System.Runtime.InteropServices.RuntimeInformation.dasm (-3.36 % of base) -99 : System.Security.Cryptography.Encoding.dasm (-0.61 % of base) 57 total files with size differences. Top method regessions by size (bytes): 645 : System.Diagnostics.Process.dasm - System.Diagnostics.Process:StartCore(ref):bool:this 454 : Microsoft.CSharp.dasm - Microsoft.CSharp.RuntimeBinder.Semantics.ExpressionBinder:AdjustCallArgumentsForParams(ref,ref,ref,ref,ref,byref):this 447 : System.Threading.Tasks.Dataflow.dasm - System.Threading.Tasks.Dataflow.Internal.SpscTargetCore`1[__Canon][System.__Canon]:ProcessMessagesLoopCore():this 421 : Microsoft.CodeAnalysis.VisualBasic.dasm - Microsoft.CodeAnalysis.VisualBasic.Symbols.ImplementsHelper:FindExplicitlyImplementedMember(ref,ref,ref,ref,ref,ref,byref):ref 358 : System.Private.CoreLib.dasm - System.Threading.TimerQueueTimer:Change(int,int):bool:this Top method improvements by size (bytes): -2512 : System.Private.CoreLib.dasm - DomainNeutralILStubClass:IL_STUB_CLRtoWinRT():ref:this (68 methods) -824 : Microsoft.CodeAnalysis.dasm - Microsoft.Cci.PeWriter:WriteHeaders(ref,ref,ref,ref,byref):this -663 : System.Private.CoreLib.dasm - DomainNeutralILStubClass:IL_STUB_CLRtoWinRT(ref):int:this (17 methods) -627 : System.Private.CoreLib.dasm - System.Diagnostics.Tracing.ManifestBuilder:CreateManifestString():ref:this -546 : System.Private.CoreLib.dasm - DomainNeutralILStubClass:IL_STUB_WinRTtoCLR(long):int:this (67 methods) 3014 total methods with size differences. ``` The largest growth is seen in `Process:StartCore`, which has 4 try-finally constructs. Diffs generally show improved codegen in the try bodies with cloned finallys. However some of this improvement comes from more aggressive use of callee save registers, and this causes size inflation in the funclets (note finally cloning does not alter the number of funclets). So if funclet save/restore could be contained to registers used in the funclet, the size impact would be slightly smaller. There are also some instances where cloning relatively small finallys leads to large code size increases. xxx is one example.
-1
dotnet/runtime
66,160
Update files to remove imhameed
SamMonoRT
2022-03-03T20:37:43Z
2022-03-04T17:15:58Z
1d82d48e8c8150bfb549f095d6dafb599ff9f229
611d45f73e65076ebff2f8b71c668cf56114deae
Update files to remove imhameed.
./docs/design/coreclr/jit/porting-ryujit.md
# RyuJIT: Porting to different platforms First, understand the JIT architecture by reading [RyuJIT overview](ryujit-overview.md). # What is a Platform? * Target instruction set * Target pointer size * Target operating system * Target calling convention and ABI (Application Binary Interface) * Runtime data structures (not really covered here) * GC encoding * All targets use the same GC encoding scheme and APIs, except for Windows x86, which uses JIT32_GCENCODER. * Debug information (mostly the same for all targets) * EH (exception handling) information (not really covered here) One advantage of the CLR is that the VM (mostly) hides the (non-ABI) OS differences. # The Very High Level View The following components need to be updated, or target-specific versions created, for a new platform. * The basics * target.h * Instruction set architecture: * registerXXX.h * emitXXX.h, emitfmtXXX.h * instrsXXX.h, emitXXX.cpp and targetXXX.cpp * lowerXXX.cpp * lsraXXX.cpp * codegenXXX.cpp and simdcodegenXXX.cpp * unwindXXX.cpp * Calling Convention and ABI: all over the place * 32 vs. 64 bits * Also all over the place. Some pointer size-specific data is centralized in target.h, but probably not 100%. # Porting stages and steps There are several steps to follow to port the JIT (some of which can be be done in parallel), described below. ## Initial bring-up * Create the new platform-specific files * Create the platform-specific build instructions (in CMakeLists.txt). This probably will require new platform-specific build instructions at the root level, as well as the JIT level of the source tree. * Focus on MinOpts; disable the optimization phases, or always test with `COMPlus_JITMinOpts=1`. * Disable optional features, such as: * `FEATURE_EH` -- if 0, all exception handling blocks are removed. Of course, tests with exception handling that depend on exceptions being thrown and caught won't run correctly. * `FEATURE_STRUCTPROMOTE` * `FEATURE_FASTTAILCALL` * `FEATURE_TAILCALL_OPT` * `FEATURE_SIMD` * Build the new JIT as an altjit. In this mode, a "base" JIT is invoked to compile all functions except the one(s) specified by the `COMPlus_AltJit` variable. For example, setting `COMPlus_AltJit=Add` and running a test will use the "base" JIT (say, the Windows x64 targeting JIT) to compile all functions *except* `Add`, which will be first compiled by the new altjit, and if it fails, fall back to the "base" JIT. In this way, only very limited JIT functionality need to work, as the "base" JIT takes care of most functions. * Implement the basic instruction encodings. Test them using a method like `CodeGen::genArm64EmitterUnitTests()`. * Implement the bare minimum to get the compiler building and generating code for very simple operations, like addition. * Focus on the CodeGenBringUpTests (src\tests\JIT\CodeGenBringUpTests), starting with the simple ones. These are designed such that for a test `XXX.cs`, there is a single interesting function named `XXX` to compile (that is, the name of the source file is the same as the name of the interesting function. This was done to make the scripts to invoke these tests very simple.). Set `COMPlus_AltJit=XXX` so the new JIT only attempts to compile that one function. * Use `COMPlus_JitDisasm` to see the generated code for functions, even if the code isn't run. ## Expand test coverage * Get more and more tests to run successfully: * Run more of the `JIT` directory of tests * Run all of the Pri-0 "innerloop" tests * Run all of the Pri-1 "outerloop" tests * It is helpful to collect data on asserts generated by the JIT across the entire test base, and fix the asserts in order of frequency. That is, fix the most frequently occurring asserts first. * Track the number of asserts, and number of tests with/without asserts, to help determine progress. ## Bring the optimizer phases on-line * Run tests with and without `COMPlus_JITMinOpts=1`. * It probably makes sense to set `COMPlus_TieredCompilation=0` (or disable it for the platform entirely) until much later. ## Improve quality * When the tests pass with the basic modes, start running with `JitStress` and `JitStressRegs` stress modes. * Bring `GCStress` on-line. This also requires VM work. * Work on `COMPlus_GCStress=4` quality. When crossgen/ngen is brought on-line, test with `COMPlus_GCStress=8` and `COMPlus_GCStress=C` as well. ## Work on performance * Determine a strategy for measuring and improving performance, both throughput (compile time) and generated code quality (CQ). ## Work on platform parity * Implement features that were intentionally disabled, or for which implementation was delayed. * Implement SIMD (`Vector<T>`) and hardware intrinsics support. # Front-end changes * Calling Convention * Struct args and returns seem to be the most complex differences * Importer and morph are highly aware of these * E.g. `fgMorphArgs()`, `fgFixupStructReturn()`, `fgMorphCall()`, `fgPromoteStructs()` and the various struct assignment morphing methods * HFAs on ARM * Tail calls are target-dependent, but probably should be less so * Intrinsics: each platform recognizes different methods as intrinsics (e.g. `Sin` only for x86, `Round` everywhere BUT amd64) * Target-specific morphs such as for mul, mod and div # Backend Changes * Lowering: fully expose control flow and register requirements * Code Generation: traverse blocks in layout order, generating code (InstrDescs) based on register assignments on nodes * Then, generate prolog & epilog, as well as GC, EH and scope tables * ABI changes: * Calling convention register requirements * Lowering of calls and returns * Code sequences for prologs & epilogs * Allocation & layout of frame # Target ISA "Configuration" * Conditional compilation (set in jit.h, based on incoming define, e.g. #ifdef X86) ```C++ _TARGET_64_BIT_ (32 bit target is just ! _TARGET_64BIT_) _TARGET_XARCH_, _TARGET_ARMARCH_ _TARGET_AMD64_, _TARGET_X86_, _TARGET_ARM64_, _TARGET_ARM_ ``` * Target.h * InstrsXXX.h # Instruction Encoding * The `insGroup` and `instrDesc` data structures are used for encoding * `instrDesc` is initialized with the opcode bits, and has fields for immediates and register numbers. * `instrDesc`s are collected into `insGroup` groups * A label may only occur at the beginning of a group * The emitter is called to: * Create new instructions (`instrDesc`s), during CodeGen * Emit the bits from the `instrDesc`s after CodeGen is complete * Update Gcinfo (live GC vars & safe points) # Adding Encodings * The instruction encodings are captured in instrsXXX.h. These are the opcode bits for each instruction * The structure of each instruction set's encoding is target-dependent * An "instruction" is just the representation of the opcode * An instance of `instrDesc` represents the instruction to be emitted * For each "type" of instruction, emit methods need to be implemented. These follow a pattern but a target may have unique ones, e.g. ```C++ emitter::emitInsMov(instruction ins, emitAttr attr, GenTree* node) emitter::emitIns_R_I(instruction ins, emitAttr attr, regNumber reg, ssize_t val) emitter::emitInsTernary(instruction ins, emitAttr attr, GenTree* dst, GenTree* src1, GenTree* src2) (currently Arm64 only) ``` # Lowering * Lowering ensures that all register requirements are exposed for the register allocator * Use count, def count, "internal" reg count, and any special register requirements * Does half the work of code generation, since all computation is made explicit * But it is NOT necessarily a 1:1 mapping from lowered tree nodes to target instructions * Its first pass does a tree walk, transforming the instructions. Some of this is target-independent. Notable exceptions: * Calls and arguments * Switch lowering * LEA transformation * Its second pass walks the nodes in execution order * Sets register requirements * sometimes changes the register requirements children (which have already been traversed) * Sets the block order and node locations for LSRA * `LinearScan::startBlockSequence()` and `LinearScan::moveToNextBlock()` # Register Allocation * Register allocation is largely target-independent * The second phase of Lowering does nearly all the target-dependent work * Register candidates are determined in the front-end * Local variables or temps, or fields of local variables or temps * Not address-taken, plus a few other restrictions * Sorted by `lvaSortByRefCount()`, and determined by `lvIsRegCandidate()` # Addressing Modes * The code to find and capture addressing modes is particularly poorly abstracted * `genCreateAddrMode()`, in CodeGenCommon.cpp traverses the tree looking for an addressing mode, then captures its constituent elements (base, index, scale & offset) in "out parameters" * It never generates code, and is only used by `gtSetEvalOrder`, and by Lowering # Code Generation * For the most part, the code generation method structure is the same for all architectures * Most code generation methods start with "gen" * Theoretically, CodeGenCommon.cpp contains code "mostly" common to all targets (this factoring is imperfect) * Method prolog, epilog, * `genCodeForBBList()` * Walks the trees in execution order, calling `genCodeForTreeNode()`, which needs to handle all nodes that are not "contained" * Generates control flow code (branches, EH) for the block
# RyuJIT: Porting to different platforms First, understand the JIT architecture by reading [RyuJIT overview](ryujit-overview.md). # What is a Platform? * Target instruction set * Target pointer size * Target operating system * Target calling convention and ABI (Application Binary Interface) * Runtime data structures (not really covered here) * GC encoding * All targets use the same GC encoding scheme and APIs, except for Windows x86, which uses JIT32_GCENCODER. * Debug information (mostly the same for all targets) * EH (exception handling) information (not really covered here) One advantage of the CLR is that the VM (mostly) hides the (non-ABI) OS differences. # The Very High Level View The following components need to be updated, or target-specific versions created, for a new platform. * The basics * target.h * Instruction set architecture: * registerXXX.h * emitXXX.h, emitfmtXXX.h * instrsXXX.h, emitXXX.cpp and targetXXX.cpp * lowerXXX.cpp * lsraXXX.cpp * codegenXXX.cpp and simdcodegenXXX.cpp * unwindXXX.cpp * Calling Convention and ABI: all over the place * 32 vs. 64 bits * Also all over the place. Some pointer size-specific data is centralized in target.h, but probably not 100%. # Porting stages and steps There are several steps to follow to port the JIT (some of which can be be done in parallel), described below. ## Initial bring-up * Create the new platform-specific files * Create the platform-specific build instructions (in CMakeLists.txt). This probably will require new platform-specific build instructions at the root level, as well as the JIT level of the source tree. * Focus on MinOpts; disable the optimization phases, or always test with `COMPlus_JITMinOpts=1`. * Disable optional features, such as: * `FEATURE_EH` -- if 0, all exception handling blocks are removed. Of course, tests with exception handling that depend on exceptions being thrown and caught won't run correctly. * `FEATURE_STRUCTPROMOTE` * `FEATURE_FASTTAILCALL` * `FEATURE_TAILCALL_OPT` * `FEATURE_SIMD` * Build the new JIT as an altjit. In this mode, a "base" JIT is invoked to compile all functions except the one(s) specified by the `COMPlus_AltJit` variable. For example, setting `COMPlus_AltJit=Add` and running a test will use the "base" JIT (say, the Windows x64 targeting JIT) to compile all functions *except* `Add`, which will be first compiled by the new altjit, and if it fails, fall back to the "base" JIT. In this way, only very limited JIT functionality need to work, as the "base" JIT takes care of most functions. * Implement the basic instruction encodings. Test them using a method like `CodeGen::genArm64EmitterUnitTests()`. * Implement the bare minimum to get the compiler building and generating code for very simple operations, like addition. * Focus on the CodeGenBringUpTests (src\tests\JIT\CodeGenBringUpTests), starting with the simple ones. These are designed such that for a test `XXX.cs`, there is a single interesting function named `XXX` to compile (that is, the name of the source file is the same as the name of the interesting function. This was done to make the scripts to invoke these tests very simple.). Set `COMPlus_AltJit=XXX` so the new JIT only attempts to compile that one function. * Use `COMPlus_JitDisasm` to see the generated code for functions, even if the code isn't run. ## Expand test coverage * Get more and more tests to run successfully: * Run more of the `JIT` directory of tests * Run all of the Pri-0 "innerloop" tests * Run all of the Pri-1 "outerloop" tests * It is helpful to collect data on asserts generated by the JIT across the entire test base, and fix the asserts in order of frequency. That is, fix the most frequently occurring asserts first. * Track the number of asserts, and number of tests with/without asserts, to help determine progress. ## Bring the optimizer phases on-line * Run tests with and without `COMPlus_JITMinOpts=1`. * It probably makes sense to set `COMPlus_TieredCompilation=0` (or disable it for the platform entirely) until much later. ## Improve quality * When the tests pass with the basic modes, start running with `JitStress` and `JitStressRegs` stress modes. * Bring `GCStress` on-line. This also requires VM work. * Work on `COMPlus_GCStress=4` quality. When crossgen/ngen is brought on-line, test with `COMPlus_GCStress=8` and `COMPlus_GCStress=C` as well. ## Work on performance * Determine a strategy for measuring and improving performance, both throughput (compile time) and generated code quality (CQ). ## Work on platform parity * Implement features that were intentionally disabled, or for which implementation was delayed. * Implement SIMD (`Vector<T>`) and hardware intrinsics support. # Front-end changes * Calling Convention * Struct args and returns seem to be the most complex differences * Importer and morph are highly aware of these * E.g. `fgMorphArgs()`, `fgFixupStructReturn()`, `fgMorphCall()`, `fgPromoteStructs()` and the various struct assignment morphing methods * HFAs on ARM * Tail calls are target-dependent, but probably should be less so * Intrinsics: each platform recognizes different methods as intrinsics (e.g. `Sin` only for x86, `Round` everywhere BUT amd64) * Target-specific morphs such as for mul, mod and div # Backend Changes * Lowering: fully expose control flow and register requirements * Code Generation: traverse blocks in layout order, generating code (InstrDescs) based on register assignments on nodes * Then, generate prolog & epilog, as well as GC, EH and scope tables * ABI changes: * Calling convention register requirements * Lowering of calls and returns * Code sequences for prologs & epilogs * Allocation & layout of frame # Target ISA "Configuration" * Conditional compilation (set in jit.h, based on incoming define, e.g. #ifdef X86) ```C++ _TARGET_64_BIT_ (32 bit target is just ! _TARGET_64BIT_) _TARGET_XARCH_, _TARGET_ARMARCH_ _TARGET_AMD64_, _TARGET_X86_, _TARGET_ARM64_, _TARGET_ARM_ ``` * Target.h * InstrsXXX.h # Instruction Encoding * The `insGroup` and `instrDesc` data structures are used for encoding * `instrDesc` is initialized with the opcode bits, and has fields for immediates and register numbers. * `instrDesc`s are collected into `insGroup` groups * A label may only occur at the beginning of a group * The emitter is called to: * Create new instructions (`instrDesc`s), during CodeGen * Emit the bits from the `instrDesc`s after CodeGen is complete * Update Gcinfo (live GC vars & safe points) # Adding Encodings * The instruction encodings are captured in instrsXXX.h. These are the opcode bits for each instruction * The structure of each instruction set's encoding is target-dependent * An "instruction" is just the representation of the opcode * An instance of `instrDesc` represents the instruction to be emitted * For each "type" of instruction, emit methods need to be implemented. These follow a pattern but a target may have unique ones, e.g. ```C++ emitter::emitInsMov(instruction ins, emitAttr attr, GenTree* node) emitter::emitIns_R_I(instruction ins, emitAttr attr, regNumber reg, ssize_t val) emitter::emitInsTernary(instruction ins, emitAttr attr, GenTree* dst, GenTree* src1, GenTree* src2) (currently Arm64 only) ``` # Lowering * Lowering ensures that all register requirements are exposed for the register allocator * Use count, def count, "internal" reg count, and any special register requirements * Does half the work of code generation, since all computation is made explicit * But it is NOT necessarily a 1:1 mapping from lowered tree nodes to target instructions * Its first pass does a tree walk, transforming the instructions. Some of this is target-independent. Notable exceptions: * Calls and arguments * Switch lowering * LEA transformation * Its second pass walks the nodes in execution order * Sets register requirements * sometimes changes the register requirements children (which have already been traversed) * Sets the block order and node locations for LSRA * `LinearScan::startBlockSequence()` and `LinearScan::moveToNextBlock()` # Register Allocation * Register allocation is largely target-independent * The second phase of Lowering does nearly all the target-dependent work * Register candidates are determined in the front-end * Local variables or temps, or fields of local variables or temps * Not address-taken, plus a few other restrictions * Sorted by `lvaSortByRefCount()`, and determined by `lvIsRegCandidate()` # Addressing Modes * The code to find and capture addressing modes is particularly poorly abstracted * `genCreateAddrMode()`, in CodeGenCommon.cpp traverses the tree looking for an addressing mode, then captures its constituent elements (base, index, scale & offset) in "out parameters" * It never generates code, and is only used by `gtSetEvalOrder`, and by Lowering # Code Generation * For the most part, the code generation method structure is the same for all architectures * Most code generation methods start with "gen" * Theoretically, CodeGenCommon.cpp contains code "mostly" common to all targets (this factoring is imperfect) * Method prolog, epilog, * `genCodeForBBList()` * Walks the trees in execution order, calling `genCodeForTreeNode()`, which needs to handle all nodes that are not "contained" * Generates control flow code (branches, EH) for the block
-1
dotnet/runtime
66,160
Update files to remove imhameed
SamMonoRT
2022-03-03T20:37:43Z
2022-03-04T17:15:58Z
1d82d48e8c8150bfb549f095d6dafb599ff9f229
611d45f73e65076ebff2f8b71c668cf56114deae
Update files to remove imhameed.
./src/libraries/System.Runtime.Loader/tests/ApplyUpdate/System.Reflection.Metadata.ApplyUpdate.Test.AddStaticLambda/deltascript.json
{ "changes": [ {"document": "AddStaticLambda.cs", "update": "AddStaticLambda_v1.cs"}, ] }
{ "changes": [ {"document": "AddStaticLambda.cs", "update": "AddStaticLambda_v1.cs"}, ] }
-1
dotnet/runtime
66,160
Update files to remove imhameed
SamMonoRT
2022-03-03T20:37:43Z
2022-03-04T17:15:58Z
1d82d48e8c8150bfb549f095d6dafb599ff9f229
611d45f73e65076ebff2f8b71c668cf56114deae
Update files to remove imhameed.
./src/mono/nuget/Microsoft.NET.Workload.Mono.Toolchain.Manifest/localize/WorkloadManifest.zh-Hans.json
{ "workloads/wasm-tools/description": ".NET WebAssembly 生成工具" }
{ "workloads/wasm-tools/description": ".NET WebAssembly 生成工具" }
-1
dotnet/runtime
66,160
Update files to remove imhameed
SamMonoRT
2022-03-03T20:37:43Z
2022-03-04T17:15:58Z
1d82d48e8c8150bfb549f095d6dafb599ff9f229
611d45f73e65076ebff2f8b71c668cf56114deae
Update files to remove imhameed.
./src/installer/tests/Assets/TestUtils/SDKLookup/SingleDigit-global.json
{ "sdk": { "version": "9999.3.4-global-dummy" } }
{ "sdk": { "version": "9999.3.4-global-dummy" } }
-1
dotnet/runtime
66,160
Update files to remove imhameed
SamMonoRT
2022-03-03T20:37:43Z
2022-03-04T17:15:58Z
1d82d48e8c8150bfb549f095d6dafb599ff9f229
611d45f73e65076ebff2f8b71c668cf56114deae
Update files to remove imhameed.
./docs/project/performance-guidelines.md
Performance Requirements ======================== The .NET runtime supports a wide variety of high performance applications. As such, performance is a key design element for every change. This guidance is designed to share how we collect data and analyze the performance of the runtime. You may also want to read about [performance coding guidelines](../coding-guidelines/performance-guidelines.md). # Design Phase # Make sure to address performance during the design phase of any change. It is much easier to tweak a design to fit performance goals and requirements before implementation has started. Here are some guidelines about how to think about performance during design: - **DO** consider the performance of your change across a **wide variety of scenarios**. While one scenario may benefit, others may not or may even regress. Performance changes that penalize many scenarios for the benefit of one scenario are likely to be rejected unless the scenario is sufficiently important. - **DO** ensure that any additional complexity, such as caches or tricky logic have a compelling reason for inclusion. - **DO** ensure that performance fixes are **pay for play**. This means that in general, whoever pays the cost of the fix also gets the benefit. If scenarios or APIs pay for something that they never use or don't get benefit from, then this is essentially a performance regression. - **DO** share your justification for any performance fixes in your pull request so that reviewers understand the trade-off that is being made. # Cache Considerations # A few guidelines to consider if you're planning to add a cache. In addition to their upsides, they also come with downsides: - Caches are generally additional complexity. Thus there needs to be a **compelling** scenario when adding one. - Caches need to be **pay for play**. If there are scenarios that pay the cost but don't benefit, then the cache likely belongs at a different level of abstraction. - Prior to adding a cache, analysis of size and lifetime needs to be completed. Things to consider are whether the cache is unbounded in one or more scenarios, whether the lifetime of the cache is much longer than the times when it is useful and whether or not the cache needs any hints in order to be efficient. If any of these considerations are true, likely the cache should be at a different level of abstraction. # Prototyping # If you need to convince yourself that the performance characteristics of a design are acceptable, consider writing a prototype. The prototype should be just enough to be able to run a scenario that meets the scale requirements. You can then capture a performance trace and analyze the results. # Creating a Microbenchmark # A microbenchmark is an application that executes a specific codepath multiple times with the intention of monitoring that codepath's performance. The application usually runs many iterations of the code in question using a fine granularity timer, and then divides the total execution time by the number of iterations to determine the average execution time. You may find times where you'd like to understand the performance of a small piece of code, and in some cases a microbenchmark is the right way to do this. - **DO** use a microbenchmark when you have an isolated piece of code whose performance you want to analyze. - **DO NOT** use a microbenchmark for code that has non-deterministic dependences (e.g. network calls, file I/O etc.) - **DO** run all performance testing against retail optimized builds. - **DO** run many iterations of the code in question to filter out noise. - **DO** minimize the effects of other applications on the performance of the microbenchmark by closing as many unnecessary applications as possible. The microbenchmarks used to test the performance of all .NET Runtimes live in [dotnet/performance repository](https://github.com/dotnet/performance/tree/master/src/benchmarks/micro). The benchmarking workflow is described [here](https://github.com/dotnet/performance/blob/master/docs/benchmarking-workflow-dotnet-runtime.md). # Profiling and Performance Tracing # Measuring performance is an important part of ensuring that changes do not regress the performance of a feature or scenario. Using a profiler allows you to run an existing workload without adding tracing statements or otherwise modifying it, and at the same time, get rich information on how the workload performs. The profiling workflow is described [here](https://github.com/dotnet/performance/blob/master/docs/profiling-workflow-dotnet-runtime.md). # Additional Help # If you have questions, run into any issues, or would like help with any performance related topics, please feel free to post a question. Someone from the .NET performance team will be happy to help.
Performance Requirements ======================== The .NET runtime supports a wide variety of high performance applications. As such, performance is a key design element for every change. This guidance is designed to share how we collect data and analyze the performance of the runtime. You may also want to read about [performance coding guidelines](../coding-guidelines/performance-guidelines.md). # Design Phase # Make sure to address performance during the design phase of any change. It is much easier to tweak a design to fit performance goals and requirements before implementation has started. Here are some guidelines about how to think about performance during design: - **DO** consider the performance of your change across a **wide variety of scenarios**. While one scenario may benefit, others may not or may even regress. Performance changes that penalize many scenarios for the benefit of one scenario are likely to be rejected unless the scenario is sufficiently important. - **DO** ensure that any additional complexity, such as caches or tricky logic have a compelling reason for inclusion. - **DO** ensure that performance fixes are **pay for play**. This means that in general, whoever pays the cost of the fix also gets the benefit. If scenarios or APIs pay for something that they never use or don't get benefit from, then this is essentially a performance regression. - **DO** share your justification for any performance fixes in your pull request so that reviewers understand the trade-off that is being made. # Cache Considerations # A few guidelines to consider if you're planning to add a cache. In addition to their upsides, they also come with downsides: - Caches are generally additional complexity. Thus there needs to be a **compelling** scenario when adding one. - Caches need to be **pay for play**. If there are scenarios that pay the cost but don't benefit, then the cache likely belongs at a different level of abstraction. - Prior to adding a cache, analysis of size and lifetime needs to be completed. Things to consider are whether the cache is unbounded in one or more scenarios, whether the lifetime of the cache is much longer than the times when it is useful and whether or not the cache needs any hints in order to be efficient. If any of these considerations are true, likely the cache should be at a different level of abstraction. # Prototyping # If you need to convince yourself that the performance characteristics of a design are acceptable, consider writing a prototype. The prototype should be just enough to be able to run a scenario that meets the scale requirements. You can then capture a performance trace and analyze the results. # Creating a Microbenchmark # A microbenchmark is an application that executes a specific codepath multiple times with the intention of monitoring that codepath's performance. The application usually runs many iterations of the code in question using a fine granularity timer, and then divides the total execution time by the number of iterations to determine the average execution time. You may find times where you'd like to understand the performance of a small piece of code, and in some cases a microbenchmark is the right way to do this. - **DO** use a microbenchmark when you have an isolated piece of code whose performance you want to analyze. - **DO NOT** use a microbenchmark for code that has non-deterministic dependences (e.g. network calls, file I/O etc.) - **DO** run all performance testing against retail optimized builds. - **DO** run many iterations of the code in question to filter out noise. - **DO** minimize the effects of other applications on the performance of the microbenchmark by closing as many unnecessary applications as possible. The microbenchmarks used to test the performance of all .NET Runtimes live in [dotnet/performance repository](https://github.com/dotnet/performance/tree/master/src/benchmarks/micro). The benchmarking workflow is described [here](https://github.com/dotnet/performance/blob/master/docs/benchmarking-workflow-dotnet-runtime.md). # Profiling and Performance Tracing # Measuring performance is an important part of ensuring that changes do not regress the performance of a feature or scenario. Using a profiler allows you to run an existing workload without adding tracing statements or otherwise modifying it, and at the same time, get rich information on how the workload performs. The profiling workflow is described [here](https://github.com/dotnet/performance/blob/master/docs/profiling-workflow-dotnet-runtime.md). # Additional Help # If you have questions, run into any issues, or would like help with any performance related topics, please feel free to post a question. Someone from the .NET performance team will be happy to help.
-1
dotnet/runtime
66,160
Update files to remove imhameed
SamMonoRT
2022-03-03T20:37:43Z
2022-03-04T17:15:58Z
1d82d48e8c8150bfb549f095d6dafb599ff9f229
611d45f73e65076ebff2f8b71c668cf56114deae
Update files to remove imhameed.
./docs/design/coreclr/botr/README.md
# The Book of the Runtime Welcome to the Book of the Runtime (BOTR) for the .NET Runtime. This contains a collection of articles about the non-trivial internals of the .NET Runtime. Its intended audience are people actually modifying the code or simply wishing to have a deep understanding of the runtime. Below is a table of contents. - [Book of the Runtime FAQ](botr-faq.md) - [Introduction to the Common Language Runtime](intro-to-clr.md) - [Garbage Collection Design](garbage-collection.md) - [Threading](threading.md) - [RyuJIT Overview](../jit/ryujit-overview.md) - [Porting RyuJIT to other platforms](../jit/porting-ryujit.md) - [Type System](type-system.md) - [Type Loader](type-loader.md) - [Method Descriptor](method-descriptor.md) - [Virtual Stub Dispatch](virtual-stub-dispatch.md) - [Stack Walking](stackwalking.md) - [`System.Private.CoreLib` and calling into the runtime](corelib.md) - [Data Access Component (DAC) Notes](dac-notes.md) - [Profiling](profiling.md) - [Implementing Profilability](profilability.md) - [What Every Dev needs to Know About Exceptions in the Runtime](exceptions.md) - [ReadyToRun Overview](readytorun-overview.md) - [CLR ABI](clr-abi.md) - [Cross-platform Minidumps](xplat-minidump-generation.md) - [Mixed Mode Assemblies](mixed-mode.md) - [Guide For Porting](guide-for-porting.md) - [Vectors and Intrinsics](vectors-and-intrinsics.md) It may be possible that this table is not complete. You can get a complete list by looking at the directory where all the chapters are stored: * [All Book of the Runtime (BOTR) chapters on GitHub](../botr)
# The Book of the Runtime Welcome to the Book of the Runtime (BOTR) for the .NET Runtime. This contains a collection of articles about the non-trivial internals of the .NET Runtime. Its intended audience are people actually modifying the code or simply wishing to have a deep understanding of the runtime. Below is a table of contents. - [Book of the Runtime FAQ](botr-faq.md) - [Introduction to the Common Language Runtime](intro-to-clr.md) - [Garbage Collection Design](garbage-collection.md) - [Threading](threading.md) - [RyuJIT Overview](../jit/ryujit-overview.md) - [Porting RyuJIT to other platforms](../jit/porting-ryujit.md) - [Type System](type-system.md) - [Type Loader](type-loader.md) - [Method Descriptor](method-descriptor.md) - [Virtual Stub Dispatch](virtual-stub-dispatch.md) - [Stack Walking](stackwalking.md) - [`System.Private.CoreLib` and calling into the runtime](corelib.md) - [Data Access Component (DAC) Notes](dac-notes.md) - [Profiling](profiling.md) - [Implementing Profilability](profilability.md) - [What Every Dev needs to Know About Exceptions in the Runtime](exceptions.md) - [ReadyToRun Overview](readytorun-overview.md) - [CLR ABI](clr-abi.md) - [Cross-platform Minidumps](xplat-minidump-generation.md) - [Mixed Mode Assemblies](mixed-mode.md) - [Guide For Porting](guide-for-porting.md) - [Vectors and Intrinsics](vectors-and-intrinsics.md) It may be possible that this table is not complete. You can get a complete list by looking at the directory where all the chapters are stored: * [All Book of the Runtime (BOTR) chapters on GitHub](../botr)
-1
dotnet/runtime
66,160
Update files to remove imhameed
SamMonoRT
2022-03-03T20:37:43Z
2022-03-04T17:15:58Z
1d82d48e8c8150bfb549f095d6dafb599ff9f229
611d45f73e65076ebff2f8b71c668cf56114deae
Update files to remove imhameed.
./src/tests/JIT/HardwareIntrinsics/Arm/AdvSimd/Insert.Vector64.UInt32.1.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics.Arm\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.Arm; namespace JIT.HardwareIntrinsics.Arm { public static partial class Program { private static void Insert_Vector64_UInt32_1() { var test = new InsertTest__Insert_Vector64_UInt32_1(); if (test.IsSupported) { // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates basic functionality works, using Load test.RunBasicScenario_Load(); } // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates calling via reflection works, using Load test.RunReflectionScenario_Load(); } // Validates passing a static member works test.RunClsVarScenario(); if (AdvSimd.IsSupported) { // Validates passing a static member works, using pinning and Load test.RunClsVarScenario_Load(); } // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates passing a local works, using Load test.RunLclVarScenario_Load(); } // Validates passing the field of a local class works test.RunClassLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local class works, using pinning and Load test.RunClassLclFldScenario_Load(); } // Validates passing an instance member of a class works test.RunClassFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a class works, using pinning and Load test.RunClassFldScenario_Load(); } // Validates passing the field of a local struct works test.RunStructLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local struct works, using pinning and Load test.RunStructLclFldScenario_Load(); } // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a struct works, using pinning and Load test.RunStructFldScenario_Load(); } } else { // Validates we throw on unsupported hardware test.RunUnsupportedScenario(); } if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class InsertTest__Insert_Vector64_UInt32_1 { private struct DataTable { private byte[] inArray1; private byte[] outArray; private GCHandle inHandle1; private GCHandle outHandle; private ulong alignment; public DataTable(UInt32[] inArray1, UInt32[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<UInt32>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<UInt32>(); if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray1 = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<UInt32, byte>(ref inArray1[0]), (uint)sizeOfinArray1); } public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle1.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector64<UInt32> _fld1; public UInt32 _fld3; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt32>, byte>(ref testStruct._fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<UInt32>>()); testStruct._fld3 = TestLibrary.Generator.GetUInt32(); return testStruct; } public void RunStructFldScenario(InsertTest__Insert_Vector64_UInt32_1 testClass) { var result = AdvSimd.Insert(_fld1, ElementIndex, _fld3); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld3, testClass._dataTable.outArrayPtr); } public void RunStructFldScenario_Load(InsertTest__Insert_Vector64_UInt32_1 testClass) { fixed (Vector64<UInt32>* pFld1 = &_fld1) fixed (UInt32* pFld3 = &_fld3) { var result = AdvSimd.Insert( AdvSimd.LoadVector64((UInt32*)pFld1), ElementIndex, *pFld3 ); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld3, testClass._dataTable.outArrayPtr); } } } private static readonly int LargestVectorSize = 8; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector64<UInt32>>() / sizeof(UInt32); private static readonly int RetElementCount = Unsafe.SizeOf<Vector64<UInt32>>() / sizeof(UInt32); private static readonly byte ElementIndex = 1; private static UInt32[] _data1 = new UInt32[Op1ElementCount]; private static Vector64<UInt32> _clsVar1; private static UInt32 _clsVar3; private Vector64<UInt32> _fld1; private UInt32 _fld3; private DataTable _dataTable; static InsertTest__Insert_Vector64_UInt32_1() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<UInt32>>()); _clsVar3 = TestLibrary.Generator.GetUInt32(); } public InsertTest__Insert_Vector64_UInt32_1() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<UInt32>>()); _fld3 = TestLibrary.Generator.GetUInt32(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } _dataTable = new DataTable(_data1, new UInt32[RetElementCount], LargestVectorSize); } public bool IsSupported => AdvSimd.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = AdvSimd.Insert( Unsafe.Read<Vector64<UInt32>>(_dataTable.inArray1Ptr), ElementIndex, _fld3 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _fld3, _dataTable.outArrayPtr); } public void RunBasicScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load)); var result = AdvSimd.Insert( AdvSimd.LoadVector64((UInt32*)(_dataTable.inArray1Ptr)), ElementIndex, _fld3 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _fld3, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); UInt32 op3 = TestLibrary.Generator.GetUInt32(); var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.Insert), new Type[] { typeof(Vector64<UInt32>), typeof(byte), typeof(UInt32) }) .Invoke(null, new object[] { Unsafe.Read<Vector64<UInt32>>(_dataTable.inArray1Ptr), ElementIndex, op3 }); Unsafe.Write(_dataTable.outArrayPtr, (Vector64<UInt32>)(result)); ValidateResult(_dataTable.inArray1Ptr, op3, _dataTable.outArrayPtr); } public void RunReflectionScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load)); UInt32 op3 = TestLibrary.Generator.GetUInt32(); var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.Insert), new Type[] { typeof(Vector64<UInt32>), typeof(byte), typeof(UInt32) }) .Invoke(null, new object[] { AdvSimd.LoadVector64((UInt32*)(_dataTable.inArray1Ptr)), ElementIndex, op3 }); Unsafe.Write(_dataTable.outArrayPtr, (Vector64<UInt32>)(result)); ValidateResult(_dataTable.inArray1Ptr, op3, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = AdvSimd.Insert( _clsVar1, ElementIndex, _clsVar3 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar3, _dataTable.outArrayPtr); } public void RunClsVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load)); fixed (Vector64<UInt32>* pClsVar1 = &_clsVar1) fixed (UInt32* pClsVar3 = &_clsVar3) { var result = AdvSimd.Insert( AdvSimd.LoadVector64((UInt32*)pClsVar1), ElementIndex, *pClsVar3 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar3, _dataTable.outArrayPtr); } } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector64<UInt32>>(_dataTable.inArray1Ptr); var op3 = TestLibrary.Generator.GetUInt32(); var result = AdvSimd.Insert(op1, ElementIndex, op3); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op3, _dataTable.outArrayPtr); } public void RunLclVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load)); var op1 = AdvSimd.LoadVector64((UInt32*)(_dataTable.inArray1Ptr)); var op3 = TestLibrary.Generator.GetUInt32(); var result = AdvSimd.Insert(op1, ElementIndex, op3); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op3, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new InsertTest__Insert_Vector64_UInt32_1(); var result = AdvSimd.Insert(test._fld1, ElementIndex, test._fld3); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld3, _dataTable.outArrayPtr); } public void RunClassLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load)); var test = new InsertTest__Insert_Vector64_UInt32_1(); fixed (Vector64<UInt32>* pFld1 = &test._fld1) fixed (UInt32* pFld3 = &test._fld3) { var result = AdvSimd.Insert( AdvSimd.LoadVector64((UInt32*)pFld1), ElementIndex, *pFld3 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld3, _dataTable.outArrayPtr); } } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = AdvSimd.Insert(_fld1, ElementIndex, _fld3); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld3, _dataTable.outArrayPtr); } public void RunClassFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load)); fixed (Vector64<UInt32>* pFld1 = &_fld1) fixed (UInt32* pFld3 = &_fld3) { var result = AdvSimd.Insert( AdvSimd.LoadVector64((UInt32*)pFld1), ElementIndex, *pFld3 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld3, _dataTable.outArrayPtr); } } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = AdvSimd.Insert(test._fld1, ElementIndex, test._fld3); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld3, _dataTable.outArrayPtr); } public void RunStructLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load)); var test = TestStruct.Create(); var result = AdvSimd.Insert( AdvSimd.LoadVector64((UInt32*)(&test._fld1)), ElementIndex, test._fld3 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld3, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } public void RunStructFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load)); var test = TestStruct.Create(); test.RunStructFldScenario_Load(this); } public void RunUnsupportedScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario)); bool succeeded = false; try { RunBasicScenario_UnsafeRead(); } catch (PlatformNotSupportedException) { succeeded = true; } if (!succeeded) { Succeeded = false; } } private void ValidateResult(Vector64<UInt32> op1, UInt32 op3, void* result, [CallerMemberName] string method = "") { UInt32[] inArray1 = new UInt32[Op1ElementCount]; UInt32[] outArray = new UInt32[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), op1); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<UInt32>>()); ValidateResult(inArray1, op3, outArray, method); } private void ValidateResult(void* op1, UInt32 op3, void* result, [CallerMemberName] string method = "") { UInt32[] inArray1 = new UInt32[Op1ElementCount]; UInt32[] outArray = new UInt32[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector64<UInt32>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<UInt32>>()); ValidateResult(inArray1, op3, outArray, method); } private void ValidateResult(UInt32[] firstOp, UInt32 thirdOp, UInt32[] result, [CallerMemberName] string method = "") { bool succeeded = true; for (var i = 0; i < RetElementCount; i++) { if (Helpers.Insert(firstOp, ElementIndex, thirdOp, i) != result[i]) { succeeded = false; break; } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd)}.{nameof(AdvSimd.Insert)}<UInt32>(Vector64<UInt32>, 1, UInt32): {method} failed:"); TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})"); TestLibrary.TestFramework.LogInformation($" thirdOp: {thirdOp}"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics.Arm\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.Arm; namespace JIT.HardwareIntrinsics.Arm { public static partial class Program { private static void Insert_Vector64_UInt32_1() { var test = new InsertTest__Insert_Vector64_UInt32_1(); if (test.IsSupported) { // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates basic functionality works, using Load test.RunBasicScenario_Load(); } // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates calling via reflection works, using Load test.RunReflectionScenario_Load(); } // Validates passing a static member works test.RunClsVarScenario(); if (AdvSimd.IsSupported) { // Validates passing a static member works, using pinning and Load test.RunClsVarScenario_Load(); } // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); if (AdvSimd.IsSupported) { // Validates passing a local works, using Load test.RunLclVarScenario_Load(); } // Validates passing the field of a local class works test.RunClassLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local class works, using pinning and Load test.RunClassLclFldScenario_Load(); } // Validates passing an instance member of a class works test.RunClassFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a class works, using pinning and Load test.RunClassFldScenario_Load(); } // Validates passing the field of a local struct works test.RunStructLclFldScenario(); if (AdvSimd.IsSupported) { // Validates passing the field of a local struct works, using pinning and Load test.RunStructLclFldScenario_Load(); } // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (AdvSimd.IsSupported) { // Validates passing an instance member of a struct works, using pinning and Load test.RunStructFldScenario_Load(); } } else { // Validates we throw on unsupported hardware test.RunUnsupportedScenario(); } if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class InsertTest__Insert_Vector64_UInt32_1 { private struct DataTable { private byte[] inArray1; private byte[] outArray; private GCHandle inHandle1; private GCHandle outHandle; private ulong alignment; public DataTable(UInt32[] inArray1, UInt32[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<UInt32>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<UInt32>(); if ((alignment != 16 && alignment != 8) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray1 = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<UInt32, byte>(ref inArray1[0]), (uint)sizeOfinArray1); } public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle1.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector64<UInt32> _fld1; public UInt32 _fld3; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt32>, byte>(ref testStruct._fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<UInt32>>()); testStruct._fld3 = TestLibrary.Generator.GetUInt32(); return testStruct; } public void RunStructFldScenario(InsertTest__Insert_Vector64_UInt32_1 testClass) { var result = AdvSimd.Insert(_fld1, ElementIndex, _fld3); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld3, testClass._dataTable.outArrayPtr); } public void RunStructFldScenario_Load(InsertTest__Insert_Vector64_UInt32_1 testClass) { fixed (Vector64<UInt32>* pFld1 = &_fld1) fixed (UInt32* pFld3 = &_fld3) { var result = AdvSimd.Insert( AdvSimd.LoadVector64((UInt32*)pFld1), ElementIndex, *pFld3 ); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld3, testClass._dataTable.outArrayPtr); } } } private static readonly int LargestVectorSize = 8; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector64<UInt32>>() / sizeof(UInt32); private static readonly int RetElementCount = Unsafe.SizeOf<Vector64<UInt32>>() / sizeof(UInt32); private static readonly byte ElementIndex = 1; private static UInt32[] _data1 = new UInt32[Op1ElementCount]; private static Vector64<UInt32> _clsVar1; private static UInt32 _clsVar3; private Vector64<UInt32> _fld1; private UInt32 _fld3; private DataTable _dataTable; static InsertTest__Insert_Vector64_UInt32_1() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt32>, byte>(ref _clsVar1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<UInt32>>()); _clsVar3 = TestLibrary.Generator.GetUInt32(); } public InsertTest__Insert_Vector64_UInt32_1() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt32>, byte>(ref _fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<UInt32>>()); _fld3 = TestLibrary.Generator.GetUInt32(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } _dataTable = new DataTable(_data1, new UInt32[RetElementCount], LargestVectorSize); } public bool IsSupported => AdvSimd.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = AdvSimd.Insert( Unsafe.Read<Vector64<UInt32>>(_dataTable.inArray1Ptr), ElementIndex, _fld3 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _fld3, _dataTable.outArrayPtr); } public void RunBasicScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load)); var result = AdvSimd.Insert( AdvSimd.LoadVector64((UInt32*)(_dataTable.inArray1Ptr)), ElementIndex, _fld3 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _fld3, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); UInt32 op3 = TestLibrary.Generator.GetUInt32(); var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.Insert), new Type[] { typeof(Vector64<UInt32>), typeof(byte), typeof(UInt32) }) .Invoke(null, new object[] { Unsafe.Read<Vector64<UInt32>>(_dataTable.inArray1Ptr), ElementIndex, op3 }); Unsafe.Write(_dataTable.outArrayPtr, (Vector64<UInt32>)(result)); ValidateResult(_dataTable.inArray1Ptr, op3, _dataTable.outArrayPtr); } public void RunReflectionScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load)); UInt32 op3 = TestLibrary.Generator.GetUInt32(); var result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.Insert), new Type[] { typeof(Vector64<UInt32>), typeof(byte), typeof(UInt32) }) .Invoke(null, new object[] { AdvSimd.LoadVector64((UInt32*)(_dataTable.inArray1Ptr)), ElementIndex, op3 }); Unsafe.Write(_dataTable.outArrayPtr, (Vector64<UInt32>)(result)); ValidateResult(_dataTable.inArray1Ptr, op3, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = AdvSimd.Insert( _clsVar1, ElementIndex, _clsVar3 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar3, _dataTable.outArrayPtr); } public void RunClsVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load)); fixed (Vector64<UInt32>* pClsVar1 = &_clsVar1) fixed (UInt32* pClsVar3 = &_clsVar3) { var result = AdvSimd.Insert( AdvSimd.LoadVector64((UInt32*)pClsVar1), ElementIndex, *pClsVar3 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar3, _dataTable.outArrayPtr); } } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector64<UInt32>>(_dataTable.inArray1Ptr); var op3 = TestLibrary.Generator.GetUInt32(); var result = AdvSimd.Insert(op1, ElementIndex, op3); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op3, _dataTable.outArrayPtr); } public void RunLclVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load)); var op1 = AdvSimd.LoadVector64((UInt32*)(_dataTable.inArray1Ptr)); var op3 = TestLibrary.Generator.GetUInt32(); var result = AdvSimd.Insert(op1, ElementIndex, op3); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op3, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new InsertTest__Insert_Vector64_UInt32_1(); var result = AdvSimd.Insert(test._fld1, ElementIndex, test._fld3); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld3, _dataTable.outArrayPtr); } public void RunClassLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load)); var test = new InsertTest__Insert_Vector64_UInt32_1(); fixed (Vector64<UInt32>* pFld1 = &test._fld1) fixed (UInt32* pFld3 = &test._fld3) { var result = AdvSimd.Insert( AdvSimd.LoadVector64((UInt32*)pFld1), ElementIndex, *pFld3 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld3, _dataTable.outArrayPtr); } } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = AdvSimd.Insert(_fld1, ElementIndex, _fld3); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld3, _dataTable.outArrayPtr); } public void RunClassFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load)); fixed (Vector64<UInt32>* pFld1 = &_fld1) fixed (UInt32* pFld3 = &_fld3) { var result = AdvSimd.Insert( AdvSimd.LoadVector64((UInt32*)pFld1), ElementIndex, *pFld3 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld3, _dataTable.outArrayPtr); } } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = AdvSimd.Insert(test._fld1, ElementIndex, test._fld3); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld3, _dataTable.outArrayPtr); } public void RunStructLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load)); var test = TestStruct.Create(); var result = AdvSimd.Insert( AdvSimd.LoadVector64((UInt32*)(&test._fld1)), ElementIndex, test._fld3 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld3, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } public void RunStructFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load)); var test = TestStruct.Create(); test.RunStructFldScenario_Load(this); } public void RunUnsupportedScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario)); bool succeeded = false; try { RunBasicScenario_UnsafeRead(); } catch (PlatformNotSupportedException) { succeeded = true; } if (!succeeded) { Succeeded = false; } } private void ValidateResult(Vector64<UInt32> op1, UInt32 op3, void* result, [CallerMemberName] string method = "") { UInt32[] inArray1 = new UInt32[Op1ElementCount]; UInt32[] outArray = new UInt32[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), op1); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<UInt32>>()); ValidateResult(inArray1, op3, outArray, method); } private void ValidateResult(void* op1, UInt32 op3, void* result, [CallerMemberName] string method = "") { UInt32[] inArray1 = new UInt32[Op1ElementCount]; UInt32[] outArray = new UInt32[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector64<UInt32>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<UInt32>>()); ValidateResult(inArray1, op3, outArray, method); } private void ValidateResult(UInt32[] firstOp, UInt32 thirdOp, UInt32[] result, [CallerMemberName] string method = "") { bool succeeded = true; for (var i = 0; i < RetElementCount; i++) { if (Helpers.Insert(firstOp, ElementIndex, thirdOp, i) != result[i]) { succeeded = false; break; } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd)}.{nameof(AdvSimd.Insert)}<UInt32>(Vector64<UInt32>, 1, UInt32): {method} failed:"); TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})"); TestLibrary.TestFramework.LogInformation($" thirdOp: {thirdOp}"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
-1
dotnet/runtime
66,160
Update files to remove imhameed
SamMonoRT
2022-03-03T20:37:43Z
2022-03-04T17:15:58Z
1d82d48e8c8150bfb549f095d6dafb599ff9f229
611d45f73e65076ebff2f8b71c668cf56114deae
Update files to remove imhameed.
./src/libraries/System.Text.Json/src/System/Text/Json/Document/JsonElement.ArrayEnumerator.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Collections; using System.Collections.Generic; using System.Diagnostics; namespace System.Text.Json { public partial struct JsonElement { /// <summary> /// An enumerable and enumerator for the contents of a JSON array. /// </summary> [DebuggerDisplay("{Current,nq}")] public struct ArrayEnumerator : IEnumerable<JsonElement>, IEnumerator<JsonElement> { private readonly JsonElement _target; private int _curIdx; private readonly int _endIdxOrVersion; internal ArrayEnumerator(JsonElement target) { _target = target; _curIdx = -1; Debug.Assert(target.TokenType == JsonTokenType.StartArray); _endIdxOrVersion = target._parent.GetEndIndex(_target._idx, includeEndElement: false); } /// <inheritdoc /> public JsonElement Current { get { if (_curIdx < 0) { return default; } return new JsonElement(_target._parent, _curIdx); } } /// <summary> /// Returns an enumerator that iterates through a collection. /// </summary> /// <returns> /// An <see cref="ArrayEnumerator"/> value that can be used to iterate /// through the array. /// </returns> public ArrayEnumerator GetEnumerator() { ArrayEnumerator ator = this; ator._curIdx = -1; return ator; } /// <inheritdoc /> IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); /// <inheritdoc /> IEnumerator<JsonElement> IEnumerable<JsonElement>.GetEnumerator() => GetEnumerator(); /// <inheritdoc /> public void Dispose() { _curIdx = _endIdxOrVersion; } /// <inheritdoc /> public void Reset() { _curIdx = -1; } /// <inheritdoc /> object IEnumerator.Current => Current; /// <inheritdoc /> public bool MoveNext() { if (_curIdx >= _endIdxOrVersion) { return false; } if (_curIdx < 0) { _curIdx = _target._idx + JsonDocument.DbRow.Size; } else { _curIdx = _target._parent.GetEndIndex(_curIdx, includeEndElement: true); } return _curIdx < _endIdxOrVersion; } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Collections; using System.Collections.Generic; using System.Diagnostics; namespace System.Text.Json { public partial struct JsonElement { /// <summary> /// An enumerable and enumerator for the contents of a JSON array. /// </summary> [DebuggerDisplay("{Current,nq}")] public struct ArrayEnumerator : IEnumerable<JsonElement>, IEnumerator<JsonElement> { private readonly JsonElement _target; private int _curIdx; private readonly int _endIdxOrVersion; internal ArrayEnumerator(JsonElement target) { _target = target; _curIdx = -1; Debug.Assert(target.TokenType == JsonTokenType.StartArray); _endIdxOrVersion = target._parent.GetEndIndex(_target._idx, includeEndElement: false); } /// <inheritdoc /> public JsonElement Current { get { if (_curIdx < 0) { return default; } return new JsonElement(_target._parent, _curIdx); } } /// <summary> /// Returns an enumerator that iterates through a collection. /// </summary> /// <returns> /// An <see cref="ArrayEnumerator"/> value that can be used to iterate /// through the array. /// </returns> public ArrayEnumerator GetEnumerator() { ArrayEnumerator ator = this; ator._curIdx = -1; return ator; } /// <inheritdoc /> IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); /// <inheritdoc /> IEnumerator<JsonElement> IEnumerable<JsonElement>.GetEnumerator() => GetEnumerator(); /// <inheritdoc /> public void Dispose() { _curIdx = _endIdxOrVersion; } /// <inheritdoc /> public void Reset() { _curIdx = -1; } /// <inheritdoc /> object IEnumerator.Current => Current; /// <inheritdoc /> public bool MoveNext() { if (_curIdx >= _endIdxOrVersion) { return false; } if (_curIdx < 0) { _curIdx = _target._idx + JsonDocument.DbRow.Size; } else { _curIdx = _target._parent.GetEndIndex(_curIdx, includeEndElement: true); } return _curIdx < _endIdxOrVersion; } } } }
-1
dotnet/runtime
66,160
Update files to remove imhameed
SamMonoRT
2022-03-03T20:37:43Z
2022-03-04T17:15:58Z
1d82d48e8c8150bfb549f095d6dafb599ff9f229
611d45f73e65076ebff2f8b71c668cf56114deae
Update files to remove imhameed.
./src/libraries/System.Data.Common/src/System/Data/DataReaderExtensions.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.ComponentModel; using System.Data.Common; using System.IO; using System.Threading; using System.Threading.Tasks; namespace System.Data { public static class DataReaderExtensions { public static bool GetBoolean(this DbDataReader reader!!, string name) { return reader.GetBoolean(reader.GetOrdinal(name)); } public static byte GetByte(this DbDataReader reader!!, string name) { return reader.GetByte(reader.GetOrdinal(name)); } public static long GetBytes(this DbDataReader reader!!, string name, long dataOffset, byte[] buffer, int bufferOffset, int length) { return reader.GetBytes(reader.GetOrdinal(name), dataOffset, buffer, bufferOffset, length); } public static char GetChar(this DbDataReader reader!!, string name) { return reader.GetChar(reader.GetOrdinal(name)); } public static long GetChars(this DbDataReader reader!!, string name, long dataOffset, char[] buffer, int bufferOffset, int length) { return reader.GetChars(reader.GetOrdinal(name), dataOffset, buffer, bufferOffset, length); } [EditorBrowsable(EditorBrowsableState.Never)] public static DbDataReader GetData(this DbDataReader reader!!, string name) { return reader.GetData(reader.GetOrdinal(name)); } public static string GetDataTypeName(this DbDataReader reader!!, string name) { return reader.GetDataTypeName(reader.GetOrdinal(name)); } public static DateTime GetDateTime(this DbDataReader reader!!, string name) { return reader.GetDateTime(reader.GetOrdinal(name)); } public static decimal GetDecimal(this DbDataReader reader!!, string name) { return reader.GetDecimal(reader.GetOrdinal(name)); } public static double GetDouble(this DbDataReader reader!!, string name) { return reader.GetDouble(reader.GetOrdinal(name)); } public static Type GetFieldType(this DbDataReader reader!!, string name) { return reader.GetFieldType(reader.GetOrdinal(name)); } public static T GetFieldValue<T>(this DbDataReader reader!!, string name) { return reader.GetFieldValue<T>(reader.GetOrdinal(name)); } public static Task<T> GetFieldValueAsync<T>(this DbDataReader reader!!, string name, CancellationToken cancellationToken = default(CancellationToken)) { return reader.GetFieldValueAsync<T>(reader.GetOrdinal(name), cancellationToken); } public static float GetFloat(this DbDataReader reader!!, string name) { return reader.GetFloat(reader.GetOrdinal(name)); } public static Guid GetGuid(this DbDataReader reader!!, string name) { return reader.GetGuid(reader.GetOrdinal(name)); } public static short GetInt16(this DbDataReader reader!!, string name) { return reader.GetInt16(reader.GetOrdinal(name)); } public static int GetInt32(this DbDataReader reader!!, string name) { return reader.GetInt32(reader.GetOrdinal(name)); } public static long GetInt64(this DbDataReader reader!!, string name) { return reader.GetInt64(reader.GetOrdinal(name)); } [EditorBrowsable(EditorBrowsableState.Never)] public static Type GetProviderSpecificFieldType(this DbDataReader reader!!, string name) { return reader.GetProviderSpecificFieldType(reader.GetOrdinal(name)); } [EditorBrowsable(EditorBrowsableState.Never)] public static object GetProviderSpecificValue(this DbDataReader reader!!, string name) { return reader.GetProviderSpecificValue(reader.GetOrdinal(name)); } public static Stream GetStream(this DbDataReader reader!!, string name) { return reader.GetStream(reader.GetOrdinal(name)); } public static string GetString(this DbDataReader reader!!, string name) { return reader.GetString(reader.GetOrdinal(name)); } public static TextReader GetTextReader(this DbDataReader reader!!, string name) { return reader.GetTextReader(reader.GetOrdinal(name)); } public static object GetValue(this DbDataReader reader!!, string name) { return reader.GetValue(reader.GetOrdinal(name)); } public static bool IsDBNull(this DbDataReader reader!!, string name) { return reader.IsDBNull(reader.GetOrdinal(name)); } public static Task<bool> IsDBNullAsync(this DbDataReader reader!!, string name, CancellationToken cancellationToken = default(CancellationToken)) { return reader.IsDBNullAsync(reader.GetOrdinal(name), cancellationToken); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.ComponentModel; using System.Data.Common; using System.IO; using System.Threading; using System.Threading.Tasks; namespace System.Data { public static class DataReaderExtensions { public static bool GetBoolean(this DbDataReader reader!!, string name) { return reader.GetBoolean(reader.GetOrdinal(name)); } public static byte GetByte(this DbDataReader reader!!, string name) { return reader.GetByte(reader.GetOrdinal(name)); } public static long GetBytes(this DbDataReader reader!!, string name, long dataOffset, byte[] buffer, int bufferOffset, int length) { return reader.GetBytes(reader.GetOrdinal(name), dataOffset, buffer, bufferOffset, length); } public static char GetChar(this DbDataReader reader!!, string name) { return reader.GetChar(reader.GetOrdinal(name)); } public static long GetChars(this DbDataReader reader!!, string name, long dataOffset, char[] buffer, int bufferOffset, int length) { return reader.GetChars(reader.GetOrdinal(name), dataOffset, buffer, bufferOffset, length); } [EditorBrowsable(EditorBrowsableState.Never)] public static DbDataReader GetData(this DbDataReader reader!!, string name) { return reader.GetData(reader.GetOrdinal(name)); } public static string GetDataTypeName(this DbDataReader reader!!, string name) { return reader.GetDataTypeName(reader.GetOrdinal(name)); } public static DateTime GetDateTime(this DbDataReader reader!!, string name) { return reader.GetDateTime(reader.GetOrdinal(name)); } public static decimal GetDecimal(this DbDataReader reader!!, string name) { return reader.GetDecimal(reader.GetOrdinal(name)); } public static double GetDouble(this DbDataReader reader!!, string name) { return reader.GetDouble(reader.GetOrdinal(name)); } public static Type GetFieldType(this DbDataReader reader!!, string name) { return reader.GetFieldType(reader.GetOrdinal(name)); } public static T GetFieldValue<T>(this DbDataReader reader!!, string name) { return reader.GetFieldValue<T>(reader.GetOrdinal(name)); } public static Task<T> GetFieldValueAsync<T>(this DbDataReader reader!!, string name, CancellationToken cancellationToken = default(CancellationToken)) { return reader.GetFieldValueAsync<T>(reader.GetOrdinal(name), cancellationToken); } public static float GetFloat(this DbDataReader reader!!, string name) { return reader.GetFloat(reader.GetOrdinal(name)); } public static Guid GetGuid(this DbDataReader reader!!, string name) { return reader.GetGuid(reader.GetOrdinal(name)); } public static short GetInt16(this DbDataReader reader!!, string name) { return reader.GetInt16(reader.GetOrdinal(name)); } public static int GetInt32(this DbDataReader reader!!, string name) { return reader.GetInt32(reader.GetOrdinal(name)); } public static long GetInt64(this DbDataReader reader!!, string name) { return reader.GetInt64(reader.GetOrdinal(name)); } [EditorBrowsable(EditorBrowsableState.Never)] public static Type GetProviderSpecificFieldType(this DbDataReader reader!!, string name) { return reader.GetProviderSpecificFieldType(reader.GetOrdinal(name)); } [EditorBrowsable(EditorBrowsableState.Never)] public static object GetProviderSpecificValue(this DbDataReader reader!!, string name) { return reader.GetProviderSpecificValue(reader.GetOrdinal(name)); } public static Stream GetStream(this DbDataReader reader!!, string name) { return reader.GetStream(reader.GetOrdinal(name)); } public static string GetString(this DbDataReader reader!!, string name) { return reader.GetString(reader.GetOrdinal(name)); } public static TextReader GetTextReader(this DbDataReader reader!!, string name) { return reader.GetTextReader(reader.GetOrdinal(name)); } public static object GetValue(this DbDataReader reader!!, string name) { return reader.GetValue(reader.GetOrdinal(name)); } public static bool IsDBNull(this DbDataReader reader!!, string name) { return reader.IsDBNull(reader.GetOrdinal(name)); } public static Task<bool> IsDBNullAsync(this DbDataReader reader!!, string name, CancellationToken cancellationToken = default(CancellationToken)) { return reader.IsDBNullAsync(reader.GetOrdinal(name), cancellationToken); } } }
-1
dotnet/runtime
66,160
Update files to remove imhameed
SamMonoRT
2022-03-03T20:37:43Z
2022-03-04T17:15:58Z
1d82d48e8c8150bfb549f095d6dafb599ff9f229
611d45f73e65076ebff2f8b71c668cf56114deae
Update files to remove imhameed.
./src/tests/JIT/Methodical/MDArray/GaussJordan/classarr.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. //Solving AX=B and the inverse of A with Gauss-Jordan algorithm using System; using Xunit; public class MatrixCls { public double[,] arr; public MatrixCls(int n, int m) { arr = new double[n, m]; } } public class classarr { private static double s_tolerance = 0.0000000000001; public static bool AreEqual(double left, double right) { return Math.Abs(left - right) < s_tolerance; } public static void swap(double a, double b) { double temp; temp = a; a = b; b = temp; } public static void gaussj(MatrixCls a, int n, MatrixCls b, int m) { int i, icol = 0, irow = 0, j, k, l, ll; double big = 0.0, dum = 0.0, pivinv = 0.0; int[] indxc = new int[3]; int[] indxr = new int[3]; int[] ipiv = new int[3]; for (j = 0; j < n; j++) ipiv[j] = 0; for (i = 0; i < n; i++) { big = 0.0; for (j = 0; j < n; j++) if (ipiv[j] != 1) for (k = 0; k < n; k++) { if (ipiv[k] == 0) { if (Math.Abs(a.arr[j, k]) >= big) { big = Math.Abs(a.arr[j, k]); irow = j; icol = k; } } else if (ipiv[k] > 1) Console.WriteLine("GAUSSJ: Singular matrix-1\n"); } ++(ipiv[icol]); if (irow != icol) { for (l = 0; l < n; l++) swap(a.arr[irow, l], a.arr[icol, l]); for (l = 0; l < m; l++) swap(b.arr[irow, l], b.arr[icol, l]); } indxr[i] = irow; indxc[i] = icol; if (a.arr[icol, icol] == 0.0) Console.WriteLine("GAUSSJ: Singular Matrix-2. icol is {0}\n", icol); pivinv = 1.0 / a.arr[icol, icol]; a.arr[icol, icol] = 1.0; for (l = 0; l < n; l++) a.arr[icol, l] *= pivinv; for (l = 0; l < m; l++) b.arr[icol, l] *= pivinv; for (ll = 0; ll < n; ll++) if (ll != icol) { dum = a.arr[ll, icol]; a.arr[ll, icol] = 0.0; for (l = 0; l < n; l++) a.arr[ll, l] -= a.arr[icol, l] * dum; for (l = 0; l < m; l++) b.arr[ll, l] -= b.arr[icol, l] * dum; } } for (l = n - 1; l >= 0; l--) { if (indxr[l] != indxc[l]) for (k = 0; k < n; k++) swap(a.arr[k, indxr[l]], a.arr[k, indxc[l]]); } } [Fact] public static int TestEntryPoint() { bool pass = false; Console.WriteLine("Solving AX=B and the inverse of A with Gauss-Jordan algorithm"); int n = 3; int m = 1; MatrixCls a = new MatrixCls(3, 3); MatrixCls b = new MatrixCls(3, 1); a.arr[0, 0] = 1; a.arr[0, 1] = 1; a.arr[0, 2] = 1; a.arr[1, 0] = 1; a.arr[1, 1] = 2; a.arr[1, 2] = 4; a.arr[2, 0] = 1; a.arr[2, 1] = 3; a.arr[2, 2] = 9; b.arr[0, 0] = -1; b.arr[1, 0] = 3; b.arr[2, 0] = 3; /* int i, j; Console.WriteLine("Matrix A is \n"); for (i=0; i<n; i++) { for (j=0; j<n; j++) Console.Write("{0}\t", a.arr[i,j]); Console.WriteLine(); } Console.WriteLine(); Console.WriteLine("Matrix B is:\n"); for (i=0; i<n; i++) { for (j=0; j<m; j++) Console.Write("{0}\t", b.arr[i,j]); Console.WriteLine(); } */ gaussj(a, n, b, m); /* Console.WriteLine(); Console.WriteLine("The inverse of matrix A is:\n"); for (i=0; i<n; i++) { for (j=0; j<n; j++) Console.Write("{0}\t", a.arr[i,j]); Console.WriteLine(); } Console.WriteLine(); Console.WriteLine("The solution X of AX=B is:\n"); for (i=0; i<n; i++) { for (j=0; j<m; j++) Console.Write("{0}\t", b.arr[i,j]); Console.WriteLine(); } */ if ( AreEqual(a.arr[0, 0], 3) && AreEqual(a.arr[1, 1], 4) && AreEqual(b.arr[0, 0], -9) && AreEqual(b.arr[1, 0], 10) ) pass = true; if (!pass) { Console.WriteLine("FAILED"); return 1; } else { Console.WriteLine("PASSED"); return 100; } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. //Solving AX=B and the inverse of A with Gauss-Jordan algorithm using System; using Xunit; public class MatrixCls { public double[,] arr; public MatrixCls(int n, int m) { arr = new double[n, m]; } } public class classarr { private static double s_tolerance = 0.0000000000001; public static bool AreEqual(double left, double right) { return Math.Abs(left - right) < s_tolerance; } public static void swap(double a, double b) { double temp; temp = a; a = b; b = temp; } public static void gaussj(MatrixCls a, int n, MatrixCls b, int m) { int i, icol = 0, irow = 0, j, k, l, ll; double big = 0.0, dum = 0.0, pivinv = 0.0; int[] indxc = new int[3]; int[] indxr = new int[3]; int[] ipiv = new int[3]; for (j = 0; j < n; j++) ipiv[j] = 0; for (i = 0; i < n; i++) { big = 0.0; for (j = 0; j < n; j++) if (ipiv[j] != 1) for (k = 0; k < n; k++) { if (ipiv[k] == 0) { if (Math.Abs(a.arr[j, k]) >= big) { big = Math.Abs(a.arr[j, k]); irow = j; icol = k; } } else if (ipiv[k] > 1) Console.WriteLine("GAUSSJ: Singular matrix-1\n"); } ++(ipiv[icol]); if (irow != icol) { for (l = 0; l < n; l++) swap(a.arr[irow, l], a.arr[icol, l]); for (l = 0; l < m; l++) swap(b.arr[irow, l], b.arr[icol, l]); } indxr[i] = irow; indxc[i] = icol; if (a.arr[icol, icol] == 0.0) Console.WriteLine("GAUSSJ: Singular Matrix-2. icol is {0}\n", icol); pivinv = 1.0 / a.arr[icol, icol]; a.arr[icol, icol] = 1.0; for (l = 0; l < n; l++) a.arr[icol, l] *= pivinv; for (l = 0; l < m; l++) b.arr[icol, l] *= pivinv; for (ll = 0; ll < n; ll++) if (ll != icol) { dum = a.arr[ll, icol]; a.arr[ll, icol] = 0.0; for (l = 0; l < n; l++) a.arr[ll, l] -= a.arr[icol, l] * dum; for (l = 0; l < m; l++) b.arr[ll, l] -= b.arr[icol, l] * dum; } } for (l = n - 1; l >= 0; l--) { if (indxr[l] != indxc[l]) for (k = 0; k < n; k++) swap(a.arr[k, indxr[l]], a.arr[k, indxc[l]]); } } [Fact] public static int TestEntryPoint() { bool pass = false; Console.WriteLine("Solving AX=B and the inverse of A with Gauss-Jordan algorithm"); int n = 3; int m = 1; MatrixCls a = new MatrixCls(3, 3); MatrixCls b = new MatrixCls(3, 1); a.arr[0, 0] = 1; a.arr[0, 1] = 1; a.arr[0, 2] = 1; a.arr[1, 0] = 1; a.arr[1, 1] = 2; a.arr[1, 2] = 4; a.arr[2, 0] = 1; a.arr[2, 1] = 3; a.arr[2, 2] = 9; b.arr[0, 0] = -1; b.arr[1, 0] = 3; b.arr[2, 0] = 3; /* int i, j; Console.WriteLine("Matrix A is \n"); for (i=0; i<n; i++) { for (j=0; j<n; j++) Console.Write("{0}\t", a.arr[i,j]); Console.WriteLine(); } Console.WriteLine(); Console.WriteLine("Matrix B is:\n"); for (i=0; i<n; i++) { for (j=0; j<m; j++) Console.Write("{0}\t", b.arr[i,j]); Console.WriteLine(); } */ gaussj(a, n, b, m); /* Console.WriteLine(); Console.WriteLine("The inverse of matrix A is:\n"); for (i=0; i<n; i++) { for (j=0; j<n; j++) Console.Write("{0}\t", a.arr[i,j]); Console.WriteLine(); } Console.WriteLine(); Console.WriteLine("The solution X of AX=B is:\n"); for (i=0; i<n; i++) { for (j=0; j<m; j++) Console.Write("{0}\t", b.arr[i,j]); Console.WriteLine(); } */ if ( AreEqual(a.arr[0, 0], 3) && AreEqual(a.arr[1, 1], 4) && AreEqual(b.arr[0, 0], -9) && AreEqual(b.arr[1, 0], 10) ) pass = true; if (!pass) { Console.WriteLine("FAILED"); return 1; } else { Console.WriteLine("PASSED"); return 100; } } }
-1
dotnet/runtime
66,160
Update files to remove imhameed
SamMonoRT
2022-03-03T20:37:43Z
2022-03-04T17:15:58Z
1d82d48e8c8150bfb549f095d6dafb599ff9f229
611d45f73e65076ebff2f8b71c668cf56114deae
Update files to remove imhameed.
./src/libraries/System.Private.Xml/src/System/Xml/BinHexDecoder.cs
// 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; namespace System.Xml { internal sealed class BinHexDecoder : IncrementalReadDecoder { // // Fields // private byte[]? _buffer; private int _startIndex; private int _curIndex; private int _endIndex; private bool _hasHalfByteCached; private byte _cachedHalfByte; // // IncrementalReadDecoder interface // internal override int DecodedCount { get { return _curIndex - _startIndex; } } internal override bool IsFull { get { return _curIndex == _endIndex; } } internal override int Decode(char[] chars!!, int startPos, int len) { if (len < 0) { throw new ArgumentOutOfRangeException(nameof(len)); } if (startPos < 0) { throw new ArgumentOutOfRangeException(nameof(startPos)); } if (chars.Length - startPos < len) { throw new ArgumentOutOfRangeException(nameof(len)); } if (len == 0) { return 0; } Decode(chars.AsSpan(startPos, len), _buffer.AsSpan(_curIndex, _endIndex - _curIndex), ref _hasHalfByteCached, ref _cachedHalfByte, out int charsDecoded, out int bytesDecoded); _curIndex += bytesDecoded; return charsDecoded; } internal override int Decode(string str!!, int startPos, int len) { if (len < 0) { throw new ArgumentOutOfRangeException(nameof(len)); } if (startPos < 0) { throw new ArgumentOutOfRangeException(nameof(startPos)); } if (str.Length - startPos < len) { throw new ArgumentOutOfRangeException(nameof(len)); } if (len == 0) { return 0; } Decode(str.AsSpan(startPos, len), _buffer.AsSpan(_curIndex, _endIndex - _curIndex), ref _hasHalfByteCached, ref _cachedHalfByte, out int charsDecoded, out int bytesDecoded); _curIndex += bytesDecoded; return charsDecoded; } internal override void Reset() { _hasHalfByteCached = false; _cachedHalfByte = 0; } internal override void SetNextOutputBuffer(Array buffer, int index, int count) { Debug.Assert(buffer != null); Debug.Assert(count >= 0); Debug.Assert(index >= 0); Debug.Assert(buffer.Length - index >= count); Debug.Assert((buffer as byte[]) != null); _buffer = (byte[])buffer; _startIndex = index; _curIndex = index; _endIndex = index + count; } // // Static methods // public static byte[] Decode(char[] chars!!, bool allowOddChars) { int len = chars.Length; if (len == 0) { return Array.Empty<byte>(); } byte[] bytes = new byte[(len + 1) / 2]; bool hasHalfByteCached = false; byte cachedHalfByte = 0; Decode(chars, bytes, ref hasHalfByteCached, ref cachedHalfByte, out _, out int bytesDecoded); if (hasHalfByteCached && !allowOddChars) { throw new XmlException(SR.Xml_InvalidBinHexValueOddCount, new string(chars)); } if (bytesDecoded < bytes.Length) { Array.Resize(ref bytes, bytesDecoded); } return bytes; } // // Private methods // private static void Decode(ReadOnlySpan<char> chars, Span<byte> bytes, ref bool hasHalfByteCached, ref byte cachedHalfByte, out int charsDecoded, out int bytesDecoded) { int iByte = 0; int iChar = 0; for (; iChar < chars.Length; iChar++) { if ((uint)iByte >= (uint)bytes.Length) { break; // ran out of space in the destination buffer } byte halfByte; char ch = chars[iChar]; int val = HexConverter.FromChar(ch); if (val != 0xFF) { halfByte = (byte)val; } else if (XmlCharType.IsWhiteSpace(ch)) { continue; } else { throw new XmlException(SR.Xml_InvalidBinHexValue, chars.ToString()); } if (hasHalfByteCached) { bytes[iByte++] = (byte)((cachedHalfByte << 4) + halfByte); hasHalfByteCached = false; } else { cachedHalfByte = halfByte; hasHalfByteCached = true; } } bytesDecoded = iByte; charsDecoded = iChar; } } }
// 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; namespace System.Xml { internal sealed class BinHexDecoder : IncrementalReadDecoder { // // Fields // private byte[]? _buffer; private int _startIndex; private int _curIndex; private int _endIndex; private bool _hasHalfByteCached; private byte _cachedHalfByte; // // IncrementalReadDecoder interface // internal override int DecodedCount { get { return _curIndex - _startIndex; } } internal override bool IsFull { get { return _curIndex == _endIndex; } } internal override int Decode(char[] chars!!, int startPos, int len) { if (len < 0) { throw new ArgumentOutOfRangeException(nameof(len)); } if (startPos < 0) { throw new ArgumentOutOfRangeException(nameof(startPos)); } if (chars.Length - startPos < len) { throw new ArgumentOutOfRangeException(nameof(len)); } if (len == 0) { return 0; } Decode(chars.AsSpan(startPos, len), _buffer.AsSpan(_curIndex, _endIndex - _curIndex), ref _hasHalfByteCached, ref _cachedHalfByte, out int charsDecoded, out int bytesDecoded); _curIndex += bytesDecoded; return charsDecoded; } internal override int Decode(string str!!, int startPos, int len) { if (len < 0) { throw new ArgumentOutOfRangeException(nameof(len)); } if (startPos < 0) { throw new ArgumentOutOfRangeException(nameof(startPos)); } if (str.Length - startPos < len) { throw new ArgumentOutOfRangeException(nameof(len)); } if (len == 0) { return 0; } Decode(str.AsSpan(startPos, len), _buffer.AsSpan(_curIndex, _endIndex - _curIndex), ref _hasHalfByteCached, ref _cachedHalfByte, out int charsDecoded, out int bytesDecoded); _curIndex += bytesDecoded; return charsDecoded; } internal override void Reset() { _hasHalfByteCached = false; _cachedHalfByte = 0; } internal override void SetNextOutputBuffer(Array buffer, int index, int count) { Debug.Assert(buffer != null); Debug.Assert(count >= 0); Debug.Assert(index >= 0); Debug.Assert(buffer.Length - index >= count); Debug.Assert((buffer as byte[]) != null); _buffer = (byte[])buffer; _startIndex = index; _curIndex = index; _endIndex = index + count; } // // Static methods // public static byte[] Decode(char[] chars!!, bool allowOddChars) { int len = chars.Length; if (len == 0) { return Array.Empty<byte>(); } byte[] bytes = new byte[(len + 1) / 2]; bool hasHalfByteCached = false; byte cachedHalfByte = 0; Decode(chars, bytes, ref hasHalfByteCached, ref cachedHalfByte, out _, out int bytesDecoded); if (hasHalfByteCached && !allowOddChars) { throw new XmlException(SR.Xml_InvalidBinHexValueOddCount, new string(chars)); } if (bytesDecoded < bytes.Length) { Array.Resize(ref bytes, bytesDecoded); } return bytes; } // // Private methods // private static void Decode(ReadOnlySpan<char> chars, Span<byte> bytes, ref bool hasHalfByteCached, ref byte cachedHalfByte, out int charsDecoded, out int bytesDecoded) { int iByte = 0; int iChar = 0; for (; iChar < chars.Length; iChar++) { if ((uint)iByte >= (uint)bytes.Length) { break; // ran out of space in the destination buffer } byte halfByte; char ch = chars[iChar]; int val = HexConverter.FromChar(ch); if (val != 0xFF) { halfByte = (byte)val; } else if (XmlCharType.IsWhiteSpace(ch)) { continue; } else { throw new XmlException(SR.Xml_InvalidBinHexValue, chars.ToString()); } if (hasHalfByteCached) { bytes[iByte++] = (byte)((cachedHalfByte << 4) + halfByte); hasHalfByteCached = false; } else { cachedHalfByte = halfByte; hasHalfByteCached = true; } } bytesDecoded = iByte; charsDecoded = iChar; } } }
-1
dotnet/runtime
66,160
Update files to remove imhameed
SamMonoRT
2022-03-03T20:37:43Z
2022-03-04T17:15:58Z
1d82d48e8c8150bfb549f095d6dafb599ff9f229
611d45f73e65076ebff2f8b71c668cf56114deae
Update files to remove imhameed.
./src/coreclr/pal/tests/palsuite/c_runtime/_vsnprintf_s/test16/test16.cpp
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /*===================================================================== ** ** Source: test16.c ** ** Purpose: Test #16 for the _vsnprintf function. ** ** **===================================================================*/ #include <palsuite.h> #include "../_vsnprintf_s.h" /* * Notes: memcmp is used, as is strlen. */ PALTEST(c_runtime__vsnprintf_s_test16_paltest_vsnprintf_test16, "c_runtime/_vsnprintf_s/test16/paltest_vsnprintf_test16") { double val = 2560.001; double neg = -2560.001; if (PAL_Initialize(argc, argv) != 0) { return(FAIL); } DoDoubleTest("foo %f", val, "foo 2560.001000", "foo 2560.001000"); DoDoubleTest("foo %lf", val, "foo 2560.001000", "foo 2560.001000"); DoDoubleTest("foo %hf", val, "foo 2560.001000", "foo 2560.001000"); DoDoubleTest("foo %Lf", val, "foo 2560.001000", "foo 2560.001000"); DoDoubleTest("foo %I64f", val, "foo 2560.001000", "foo 2560.001000"); DoDoubleTest("foo %12f", val, "foo 2560.001000", "foo 2560.001000"); DoDoubleTest("foo %-12f", val, "foo 2560.001000 ", "foo 2560.001000 "); DoDoubleTest("foo %.1f", val, "foo 2560.0", "foo 2560.0"); DoDoubleTest("foo %.8f", val, "foo 2560.00100000", "foo 2560.00100000"); DoDoubleTest("foo %012f", val, "foo 02560.001000", "foo 02560.001000"); DoDoubleTest("foo %#f", val, "foo 2560.001000", "foo 2560.001000"); DoDoubleTest("foo %+f", val, "foo +2560.001000", "foo +2560.001000"); DoDoubleTest("foo % f", val, "foo 2560.001000", "foo 2560.001000"); DoDoubleTest("foo %+f", neg, "foo -2560.001000", "foo -2560.001000"); DoDoubleTest("foo % f", neg, "foo -2560.001000", "foo -2560.001000"); PAL_Terminate(); return PASS; }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /*===================================================================== ** ** Source: test16.c ** ** Purpose: Test #16 for the _vsnprintf function. ** ** **===================================================================*/ #include <palsuite.h> #include "../_vsnprintf_s.h" /* * Notes: memcmp is used, as is strlen. */ PALTEST(c_runtime__vsnprintf_s_test16_paltest_vsnprintf_test16, "c_runtime/_vsnprintf_s/test16/paltest_vsnprintf_test16") { double val = 2560.001; double neg = -2560.001; if (PAL_Initialize(argc, argv) != 0) { return(FAIL); } DoDoubleTest("foo %f", val, "foo 2560.001000", "foo 2560.001000"); DoDoubleTest("foo %lf", val, "foo 2560.001000", "foo 2560.001000"); DoDoubleTest("foo %hf", val, "foo 2560.001000", "foo 2560.001000"); DoDoubleTest("foo %Lf", val, "foo 2560.001000", "foo 2560.001000"); DoDoubleTest("foo %I64f", val, "foo 2560.001000", "foo 2560.001000"); DoDoubleTest("foo %12f", val, "foo 2560.001000", "foo 2560.001000"); DoDoubleTest("foo %-12f", val, "foo 2560.001000 ", "foo 2560.001000 "); DoDoubleTest("foo %.1f", val, "foo 2560.0", "foo 2560.0"); DoDoubleTest("foo %.8f", val, "foo 2560.00100000", "foo 2560.00100000"); DoDoubleTest("foo %012f", val, "foo 02560.001000", "foo 02560.001000"); DoDoubleTest("foo %#f", val, "foo 2560.001000", "foo 2560.001000"); DoDoubleTest("foo %+f", val, "foo +2560.001000", "foo +2560.001000"); DoDoubleTest("foo % f", val, "foo 2560.001000", "foo 2560.001000"); DoDoubleTest("foo %+f", neg, "foo -2560.001000", "foo -2560.001000"); DoDoubleTest("foo % f", neg, "foo -2560.001000", "foo -2560.001000"); PAL_Terminate(); return PASS; }
-1
dotnet/runtime
66,160
Update files to remove imhameed
SamMonoRT
2022-03-03T20:37:43Z
2022-03-04T17:15:58Z
1d82d48e8c8150bfb549f095d6dafb599ff9f229
611d45f73e65076ebff2f8b71c668cf56114deae
Update files to remove imhameed.
./src/tests/JIT/HardwareIntrinsics/X86/Sse41/BlendVariable.Int32.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.X86; namespace JIT.HardwareIntrinsics.X86 { public static partial class Program { private static void BlendVariableInt32() { var test = new SimpleTernaryOpTest__BlendVariableInt32(); if (test.IsSupported) { // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); if (Sse2.IsSupported) { // Validates basic functionality works, using Load test.RunBasicScenario_Load(); // Validates basic functionality works, using LoadAligned test.RunBasicScenario_LoadAligned(); } // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); if (Sse2.IsSupported) { // Validates calling via reflection works, using Load test.RunReflectionScenario_Load(); // Validates calling via reflection works, using LoadAligned test.RunReflectionScenario_LoadAligned(); } // Validates passing a static member works test.RunClsVarScenario(); if (Sse2.IsSupported) { // Validates passing a static member works, using pinning and Load test.RunClsVarScenario_Load(); } // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); if (Sse2.IsSupported) { // Validates passing a local works, using Load test.RunLclVarScenario_Load(); // Validates passing a local works, using LoadAligned test.RunLclVarScenario_LoadAligned(); } // Validates passing the field of a local class works test.RunClassLclFldScenario(); if (Sse2.IsSupported) { // Validates passing the field of a local class works, using pinning and Load test.RunClassLclFldScenario_Load(); } // Validates passing an instance member of a class works test.RunClassFldScenario(); if (Sse2.IsSupported) { // Validates passing an instance member of a class works, using pinning and Load test.RunClassFldScenario_Load(); } // Validates passing the field of a local struct works test.RunStructLclFldScenario(); if (Sse2.IsSupported) { // Validates passing the field of a local struct works, using pinning and Load test.RunStructLclFldScenario_Load(); } // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (Sse2.IsSupported) { // Validates passing an instance member of a struct works, using pinning and Load test.RunStructFldScenario_Load(); } } else { // Validates we throw on unsupported hardware test.RunUnsupportedScenario(); } if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class SimpleTernaryOpTest__BlendVariableInt32 { private struct DataTable { private byte[] inArray1; private byte[] inArray2; private byte[] inArray3; private byte[] outArray; private GCHandle inHandle1; private GCHandle inHandle2; private GCHandle inHandle3; private GCHandle outHandle; private ulong alignment; public DataTable(Int32[] inArray1, Int32[] inArray2, Int32[] inArray3, Int32[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Int32>(); int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<Int32>(); int sizeOfinArray3 = inArray3.Length * Unsafe.SizeOf<Int32>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<Int32>(); if ((alignment != 32 && alignment != 16) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfinArray2 || (alignment * 2) < sizeOfinArray3 || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray1 = new byte[alignment * 2]; this.inArray2 = new byte[alignment * 2]; this.inArray3 = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned); this.inHandle2 = GCHandle.Alloc(this.inArray2, GCHandleType.Pinned); this.inHandle3 = GCHandle.Alloc(this.inArray3, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<Int32, byte>(ref inArray1[0]), (uint)sizeOfinArray1); Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<Int32, byte>(ref inArray2[0]), (uint)sizeOfinArray2); Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray3Ptr), ref Unsafe.As<Int32, byte>(ref inArray3[0]), (uint)sizeOfinArray3); } public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment); public void* inArray2Ptr => Align((byte*)(inHandle2.AddrOfPinnedObject().ToPointer()), alignment); public void* inArray3Ptr => Align((byte*)(inHandle3.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle1.Free(); inHandle2.Free(); inHandle3.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector128<Int32> _fld1; public Vector128<Int32> _fld2; public Vector128<Int32> _fld3; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref testStruct._fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref testStruct._fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>()); for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = (((i % 2) == 0) ? Convert.ToInt32("0xFFFFFFFF", 16) : (int)0); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref testStruct._fld3), ref Unsafe.As<Int32, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>()); return testStruct; } public void RunStructFldScenario(SimpleTernaryOpTest__BlendVariableInt32 testClass) { var result = Sse41.BlendVariable(_fld1, _fld2, _fld3); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, _fld3, testClass._dataTable.outArrayPtr); } public void RunStructFldScenario_Load(SimpleTernaryOpTest__BlendVariableInt32 testClass) { fixed (Vector128<Int32>* pFld1 = &_fld1) fixed (Vector128<Int32>* pFld2 = &_fld2) fixed (Vector128<Int32>* pFld3 = &_fld3) { var result = Sse41.BlendVariable( Sse2.LoadVector128((Int32*)(pFld1)), Sse2.LoadVector128((Int32*)(pFld2)), Sse2.LoadVector128((Int32*)(pFld3)) ); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, _fld3, testClass._dataTable.outArrayPtr); } } } private static readonly int LargestVectorSize = 16; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32); private static readonly int Op3ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32); private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32); private static Int32[] _data1 = new Int32[Op1ElementCount]; private static Int32[] _data2 = new Int32[Op2ElementCount]; private static Int32[] _data3 = new Int32[Op3ElementCount]; private static Vector128<Int32> _clsVar1; private static Vector128<Int32> _clsVar2; private static Vector128<Int32> _clsVar3; private Vector128<Int32> _fld1; private Vector128<Int32> _fld2; private Vector128<Int32> _fld3; private DataTable _dataTable; static SimpleTernaryOpTest__BlendVariableInt32() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>()); for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = (((i % 2) == 0) ? Convert.ToInt32("0xFFFFFFFF", 16) : (int)0); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar3), ref Unsafe.As<Int32, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>()); } public SimpleTernaryOpTest__BlendVariableInt32() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>()); for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = (((i % 2) == 0) ? Convert.ToInt32("0xFFFFFFFF", 16) : (int)0); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld3), ref Unsafe.As<Int32, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt32(); } for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = (((i % 2) == 0) ? Convert.ToInt32("0xFFFFFFFF", 16) : (int)0); } _dataTable = new DataTable(_data1, _data2, _data3, new Int32[RetElementCount], LargestVectorSize); } public bool IsSupported => Sse41.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = Sse41.BlendVariable( Unsafe.Read<Vector128<Int32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<Int32>>(_dataTable.inArray2Ptr), Unsafe.Read<Vector128<Int32>>(_dataTable.inArray3Ptr) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.inArray3Ptr, _dataTable.outArrayPtr); } public void RunBasicScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load)); var result = Sse41.BlendVariable( Sse2.LoadVector128((Int32*)(_dataTable.inArray1Ptr)), Sse2.LoadVector128((Int32*)(_dataTable.inArray2Ptr)), Sse2.LoadVector128((Int32*)(_dataTable.inArray3Ptr)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.inArray3Ptr, _dataTable.outArrayPtr); } public void RunBasicScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned)); var result = Sse41.BlendVariable( Sse2.LoadAlignedVector128((Int32*)(_dataTable.inArray1Ptr)), Sse2.LoadAlignedVector128((Int32*)(_dataTable.inArray2Ptr)), Sse2.LoadAlignedVector128((Int32*)(_dataTable.inArray3Ptr)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.inArray3Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var result = typeof(Sse41).GetMethod(nameof(Sse41.BlendVariable), new Type[] { typeof(Vector128<Int32>), typeof(Vector128<Int32>), typeof(Vector128<Int32>) }) .Invoke(null, new object[] { Unsafe.Read<Vector128<Int32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<Int32>>(_dataTable.inArray2Ptr), Unsafe.Read<Vector128<Int32>>(_dataTable.inArray3Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Int32>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.inArray3Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load)); var result = typeof(Sse41).GetMethod(nameof(Sse41.BlendVariable), new Type[] { typeof(Vector128<Int32>), typeof(Vector128<Int32>), typeof(Vector128<Int32>) }) .Invoke(null, new object[] { Sse2.LoadVector128((Int32*)(_dataTable.inArray1Ptr)), Sse2.LoadVector128((Int32*)(_dataTable.inArray2Ptr)), Sse2.LoadVector128((Int32*)(_dataTable.inArray3Ptr)) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Int32>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.inArray3Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned)); var result = typeof(Sse41).GetMethod(nameof(Sse41.BlendVariable), new Type[] { typeof(Vector128<Int32>), typeof(Vector128<Int32>), typeof(Vector128<Int32>) }) .Invoke(null, new object[] { Sse2.LoadAlignedVector128((Int32*)(_dataTable.inArray1Ptr)), Sse2.LoadAlignedVector128((Int32*)(_dataTable.inArray2Ptr)), Sse2.LoadAlignedVector128((Int32*)(_dataTable.inArray3Ptr)) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Int32>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.inArray3Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = Sse41.BlendVariable( _clsVar1, _clsVar2, _clsVar3 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _clsVar3, _dataTable.outArrayPtr); } public void RunClsVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load)); fixed (Vector128<Int32>* pClsVar1 = &_clsVar1) fixed (Vector128<Int32>* pClsVar2 = &_clsVar2) fixed (Vector128<Int32>* pClsVar3 = &_clsVar3) { var result = Sse41.BlendVariable( Sse2.LoadVector128((Int32*)(pClsVar1)), Sse2.LoadVector128((Int32*)(pClsVar2)), Sse2.LoadVector128((Int32*)(pClsVar3)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _clsVar3, _dataTable.outArrayPtr); } } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector128<Int32>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector128<Int32>>(_dataTable.inArray2Ptr); var op3 = Unsafe.Read<Vector128<Int32>>(_dataTable.inArray3Ptr); var result = Sse41.BlendVariable(op1, op2, op3); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, op3, _dataTable.outArrayPtr); } public void RunLclVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load)); var op1 = Sse2.LoadVector128((Int32*)(_dataTable.inArray1Ptr)); var op2 = Sse2.LoadVector128((Int32*)(_dataTable.inArray2Ptr)); var op3 = Sse2.LoadVector128((Int32*)(_dataTable.inArray3Ptr)); var result = Sse41.BlendVariable(op1, op2, op3); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, op3, _dataTable.outArrayPtr); } public void RunLclVarScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned)); var op1 = Sse2.LoadAlignedVector128((Int32*)(_dataTable.inArray1Ptr)); var op2 = Sse2.LoadAlignedVector128((Int32*)(_dataTable.inArray2Ptr)); var op3 = Sse2.LoadAlignedVector128((Int32*)(_dataTable.inArray3Ptr)); var result = Sse41.BlendVariable(op1, op2, op3); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, op3, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new SimpleTernaryOpTest__BlendVariableInt32(); var result = Sse41.BlendVariable(test._fld1, test._fld2, test._fld3); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, test._fld3, _dataTable.outArrayPtr); } public void RunClassLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load)); var test = new SimpleTernaryOpTest__BlendVariableInt32(); fixed (Vector128<Int32>* pFld1 = &test._fld1) fixed (Vector128<Int32>* pFld2 = &test._fld2) fixed (Vector128<Int32>* pFld3 = &test._fld3) { var result = Sse41.BlendVariable( Sse2.LoadVector128((Int32*)(pFld1)), Sse2.LoadVector128((Int32*)(pFld2)), Sse2.LoadVector128((Int32*)(pFld3)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, test._fld3, _dataTable.outArrayPtr); } } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = Sse41.BlendVariable(_fld1, _fld2, _fld3); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _fld3, _dataTable.outArrayPtr); } public void RunClassFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load)); fixed (Vector128<Int32>* pFld1 = &_fld1) fixed (Vector128<Int32>* pFld2 = &_fld2) fixed (Vector128<Int32>* pFld3 = &_fld3) { var result = Sse41.BlendVariable( Sse2.LoadVector128((Int32*)(pFld1)), Sse2.LoadVector128((Int32*)(pFld2)), Sse2.LoadVector128((Int32*)(pFld3)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _fld3, _dataTable.outArrayPtr); } } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = Sse41.BlendVariable(test._fld1, test._fld2, test._fld3); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, test._fld3, _dataTable.outArrayPtr); } public void RunStructLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load)); var test = TestStruct.Create(); var result = Sse41.BlendVariable( Sse2.LoadVector128((Int32*)(&test._fld1)), Sse2.LoadVector128((Int32*)(&test._fld2)), Sse2.LoadVector128((Int32*)(&test._fld3)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, test._fld3, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } public void RunStructFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load)); var test = TestStruct.Create(); test.RunStructFldScenario_Load(this); } public void RunUnsupportedScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario)); bool succeeded = false; try { RunBasicScenario_UnsafeRead(); } catch (PlatformNotSupportedException) { succeeded = true; } if (!succeeded) { Succeeded = false; } } private void ValidateResult(Vector128<Int32> op1, Vector128<Int32> op2, Vector128<Int32> op3, void* result, [CallerMemberName] string method = "") { Int32[] inArray1 = new Int32[Op1ElementCount]; Int32[] inArray2 = new Int32[Op2ElementCount]; Int32[] inArray3 = new Int32[Op3ElementCount]; Int32[] outArray = new Int32[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), op1); Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), op2); Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray3[0]), op3); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>()); ValidateResult(inArray1, inArray2, inArray3, outArray, method); } private void ValidateResult(void* op1, void* op2, void* op3, void* result, [CallerMemberName] string method = "") { Int32[] inArray1 = new Int32[Op1ElementCount]; Int32[] inArray2 = new Int32[Op2ElementCount]; Int32[] inArray3 = new Int32[Op3ElementCount]; Int32[] outArray = new Int32[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector128<Int32>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector128<Int32>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray3[0]), ref Unsafe.AsRef<byte>(op3), (uint)Unsafe.SizeOf<Vector128<Int32>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>()); ValidateResult(inArray1, inArray2, inArray3, outArray, method); } private void ValidateResult(Int32[] firstOp, Int32[] secondOp, Int32[] thirdOp, Int32[] result, [CallerMemberName] string method = "") { bool succeeded = true; if ((thirdOp[0] != 0) ? secondOp[0] != result[0] : firstOp[0] != result[0]) { succeeded = false; } else { for (var i = 1; i < RetElementCount; i++) { if ((thirdOp[i] != 0) ? secondOp[i] != result[i] : firstOp[i] != result[i]) { succeeded = false; break; } } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(Sse41)}.{nameof(Sse41.BlendVariable)}<Int32>(Vector128<Int32>, Vector128<Int32>, Vector128<Int32>): {method} failed:"); TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})"); TestLibrary.TestFramework.LogInformation($"secondOp: ({string.Join(", ", secondOp)})"); TestLibrary.TestFramework.LogInformation($" thirdOp: ({string.Join(", ", thirdOp)})"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /****************************************************************************** * This file is auto-generated from a template file by the GenerateTests.csx * * script in tests\src\JIT\HardwareIntrinsics\X86\Shared. In order to make * * changes, please update the corresponding template and run according to the * * directions listed in the file. * ******************************************************************************/ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.X86; namespace JIT.HardwareIntrinsics.X86 { public static partial class Program { private static void BlendVariableInt32() { var test = new SimpleTernaryOpTest__BlendVariableInt32(); if (test.IsSupported) { // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); if (Sse2.IsSupported) { // Validates basic functionality works, using Load test.RunBasicScenario_Load(); // Validates basic functionality works, using LoadAligned test.RunBasicScenario_LoadAligned(); } // Validates calling via reflection works, using Unsafe.Read test.RunReflectionScenario_UnsafeRead(); if (Sse2.IsSupported) { // Validates calling via reflection works, using Load test.RunReflectionScenario_Load(); // Validates calling via reflection works, using LoadAligned test.RunReflectionScenario_LoadAligned(); } // Validates passing a static member works test.RunClsVarScenario(); if (Sse2.IsSupported) { // Validates passing a static member works, using pinning and Load test.RunClsVarScenario_Load(); } // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); if (Sse2.IsSupported) { // Validates passing a local works, using Load test.RunLclVarScenario_Load(); // Validates passing a local works, using LoadAligned test.RunLclVarScenario_LoadAligned(); } // Validates passing the field of a local class works test.RunClassLclFldScenario(); if (Sse2.IsSupported) { // Validates passing the field of a local class works, using pinning and Load test.RunClassLclFldScenario_Load(); } // Validates passing an instance member of a class works test.RunClassFldScenario(); if (Sse2.IsSupported) { // Validates passing an instance member of a class works, using pinning and Load test.RunClassFldScenario_Load(); } // Validates passing the field of a local struct works test.RunStructLclFldScenario(); if (Sse2.IsSupported) { // Validates passing the field of a local struct works, using pinning and Load test.RunStructLclFldScenario_Load(); } // Validates passing an instance member of a struct works test.RunStructFldScenario(); if (Sse2.IsSupported) { // Validates passing an instance member of a struct works, using pinning and Load test.RunStructFldScenario_Load(); } } else { // Validates we throw on unsupported hardware test.RunUnsupportedScenario(); } if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class SimpleTernaryOpTest__BlendVariableInt32 { private struct DataTable { private byte[] inArray1; private byte[] inArray2; private byte[] inArray3; private byte[] outArray; private GCHandle inHandle1; private GCHandle inHandle2; private GCHandle inHandle3; private GCHandle outHandle; private ulong alignment; public DataTable(Int32[] inArray1, Int32[] inArray2, Int32[] inArray3, Int32[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Int32>(); int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<Int32>(); int sizeOfinArray3 = inArray3.Length * Unsafe.SizeOf<Int32>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<Int32>(); if ((alignment != 32 && alignment != 16) || (alignment * 2) < sizeOfinArray1 || (alignment * 2) < sizeOfinArray2 || (alignment * 2) < sizeOfinArray3 || (alignment * 2) < sizeOfoutArray) { throw new ArgumentException("Invalid value of alignment"); } this.inArray1 = new byte[alignment * 2]; this.inArray2 = new byte[alignment * 2]; this.inArray3 = new byte[alignment * 2]; this.outArray = new byte[alignment * 2]; this.inHandle1 = GCHandle.Alloc(this.inArray1, GCHandleType.Pinned); this.inHandle2 = GCHandle.Alloc(this.inArray2, GCHandleType.Pinned); this.inHandle3 = GCHandle.Alloc(this.inArray3, GCHandleType.Pinned); this.outHandle = GCHandle.Alloc(this.outArray, GCHandleType.Pinned); this.alignment = (ulong)alignment; Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray1Ptr), ref Unsafe.As<Int32, byte>(ref inArray1[0]), (uint)sizeOfinArray1); Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<Int32, byte>(ref inArray2[0]), (uint)sizeOfinArray2); Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray3Ptr), ref Unsafe.As<Int32, byte>(ref inArray3[0]), (uint)sizeOfinArray3); } public void* inArray1Ptr => Align((byte*)(inHandle1.AddrOfPinnedObject().ToPointer()), alignment); public void* inArray2Ptr => Align((byte*)(inHandle2.AddrOfPinnedObject().ToPointer()), alignment); public void* inArray3Ptr => Align((byte*)(inHandle3.AddrOfPinnedObject().ToPointer()), alignment); public void* outArrayPtr => Align((byte*)(outHandle.AddrOfPinnedObject().ToPointer()), alignment); public void Dispose() { inHandle1.Free(); inHandle2.Free(); inHandle3.Free(); outHandle.Free(); } private static unsafe void* Align(byte* buffer, ulong expectedAlignment) { return (void*)(((ulong)buffer + expectedAlignment - 1) & ~(expectedAlignment - 1)); } } private struct TestStruct { public Vector128<Int32> _fld1; public Vector128<Int32> _fld2; public Vector128<Int32> _fld3; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref testStruct._fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref testStruct._fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>()); for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = (((i % 2) == 0) ? Convert.ToInt32("0xFFFFFFFF", 16) : (int)0); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref testStruct._fld3), ref Unsafe.As<Int32, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>()); return testStruct; } public void RunStructFldScenario(SimpleTernaryOpTest__BlendVariableInt32 testClass) { var result = Sse41.BlendVariable(_fld1, _fld2, _fld3); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, _fld3, testClass._dataTable.outArrayPtr); } public void RunStructFldScenario_Load(SimpleTernaryOpTest__BlendVariableInt32 testClass) { fixed (Vector128<Int32>* pFld1 = &_fld1) fixed (Vector128<Int32>* pFld2 = &_fld2) fixed (Vector128<Int32>* pFld3 = &_fld3) { var result = Sse41.BlendVariable( Sse2.LoadVector128((Int32*)(pFld1)), Sse2.LoadVector128((Int32*)(pFld2)), Sse2.LoadVector128((Int32*)(pFld3)) ); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, _fld3, testClass._dataTable.outArrayPtr); } } } private static readonly int LargestVectorSize = 16; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32); private static readonly int Op3ElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32); private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32); private static Int32[] _data1 = new Int32[Op1ElementCount]; private static Int32[] _data2 = new Int32[Op2ElementCount]; private static Int32[] _data3 = new Int32[Op3ElementCount]; private static Vector128<Int32> _clsVar1; private static Vector128<Int32> _clsVar2; private static Vector128<Int32> _clsVar3; private Vector128<Int32> _fld1; private Vector128<Int32> _fld2; private Vector128<Int32> _fld3; private DataTable _dataTable; static SimpleTernaryOpTest__BlendVariableInt32() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>()); for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = (((i % 2) == 0) ? Convert.ToInt32("0xFFFFFFFF", 16) : (int)0); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar3), ref Unsafe.As<Int32, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>()); } public SimpleTernaryOpTest__BlendVariableInt32() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>()); for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = (((i % 2) == 0) ? Convert.ToInt32("0xFFFFFFFF", 16) : (int)0); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld3), ref Unsafe.As<Int32, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt32(); } for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = (((i % 2) == 0) ? Convert.ToInt32("0xFFFFFFFF", 16) : (int)0); } _dataTable = new DataTable(_data1, _data2, _data3, new Int32[RetElementCount], LargestVectorSize); } public bool IsSupported => Sse41.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = Sse41.BlendVariable( Unsafe.Read<Vector128<Int32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<Int32>>(_dataTable.inArray2Ptr), Unsafe.Read<Vector128<Int32>>(_dataTable.inArray3Ptr) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.inArray3Ptr, _dataTable.outArrayPtr); } public void RunBasicScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load)); var result = Sse41.BlendVariable( Sse2.LoadVector128((Int32*)(_dataTable.inArray1Ptr)), Sse2.LoadVector128((Int32*)(_dataTable.inArray2Ptr)), Sse2.LoadVector128((Int32*)(_dataTable.inArray3Ptr)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.inArray3Ptr, _dataTable.outArrayPtr); } public void RunBasicScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned)); var result = Sse41.BlendVariable( Sse2.LoadAlignedVector128((Int32*)(_dataTable.inArray1Ptr)), Sse2.LoadAlignedVector128((Int32*)(_dataTable.inArray2Ptr)), Sse2.LoadAlignedVector128((Int32*)(_dataTable.inArray3Ptr)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.inArray3Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var result = typeof(Sse41).GetMethod(nameof(Sse41.BlendVariable), new Type[] { typeof(Vector128<Int32>), typeof(Vector128<Int32>), typeof(Vector128<Int32>) }) .Invoke(null, new object[] { Unsafe.Read<Vector128<Int32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<Int32>>(_dataTable.inArray2Ptr), Unsafe.Read<Vector128<Int32>>(_dataTable.inArray3Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Int32>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.inArray3Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load)); var result = typeof(Sse41).GetMethod(nameof(Sse41.BlendVariable), new Type[] { typeof(Vector128<Int32>), typeof(Vector128<Int32>), typeof(Vector128<Int32>) }) .Invoke(null, new object[] { Sse2.LoadVector128((Int32*)(_dataTable.inArray1Ptr)), Sse2.LoadVector128((Int32*)(_dataTable.inArray2Ptr)), Sse2.LoadVector128((Int32*)(_dataTable.inArray3Ptr)) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Int32>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.inArray3Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned)); var result = typeof(Sse41).GetMethod(nameof(Sse41.BlendVariable), new Type[] { typeof(Vector128<Int32>), typeof(Vector128<Int32>), typeof(Vector128<Int32>) }) .Invoke(null, new object[] { Sse2.LoadAlignedVector128((Int32*)(_dataTable.inArray1Ptr)), Sse2.LoadAlignedVector128((Int32*)(_dataTable.inArray2Ptr)), Sse2.LoadAlignedVector128((Int32*)(_dataTable.inArray3Ptr)) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Int32>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.inArray3Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = Sse41.BlendVariable( _clsVar1, _clsVar2, _clsVar3 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _clsVar3, _dataTable.outArrayPtr); } public void RunClsVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load)); fixed (Vector128<Int32>* pClsVar1 = &_clsVar1) fixed (Vector128<Int32>* pClsVar2 = &_clsVar2) fixed (Vector128<Int32>* pClsVar3 = &_clsVar3) { var result = Sse41.BlendVariable( Sse2.LoadVector128((Int32*)(pClsVar1)), Sse2.LoadVector128((Int32*)(pClsVar2)), Sse2.LoadVector128((Int32*)(pClsVar3)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _clsVar3, _dataTable.outArrayPtr); } } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector128<Int32>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector128<Int32>>(_dataTable.inArray2Ptr); var op3 = Unsafe.Read<Vector128<Int32>>(_dataTable.inArray3Ptr); var result = Sse41.BlendVariable(op1, op2, op3); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, op3, _dataTable.outArrayPtr); } public void RunLclVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load)); var op1 = Sse2.LoadVector128((Int32*)(_dataTable.inArray1Ptr)); var op2 = Sse2.LoadVector128((Int32*)(_dataTable.inArray2Ptr)); var op3 = Sse2.LoadVector128((Int32*)(_dataTable.inArray3Ptr)); var result = Sse41.BlendVariable(op1, op2, op3); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, op3, _dataTable.outArrayPtr); } public void RunLclVarScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned)); var op1 = Sse2.LoadAlignedVector128((Int32*)(_dataTable.inArray1Ptr)); var op2 = Sse2.LoadAlignedVector128((Int32*)(_dataTable.inArray2Ptr)); var op3 = Sse2.LoadAlignedVector128((Int32*)(_dataTable.inArray3Ptr)); var result = Sse41.BlendVariable(op1, op2, op3); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, op3, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new SimpleTernaryOpTest__BlendVariableInt32(); var result = Sse41.BlendVariable(test._fld1, test._fld2, test._fld3); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, test._fld3, _dataTable.outArrayPtr); } public void RunClassLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario_Load)); var test = new SimpleTernaryOpTest__BlendVariableInt32(); fixed (Vector128<Int32>* pFld1 = &test._fld1) fixed (Vector128<Int32>* pFld2 = &test._fld2) fixed (Vector128<Int32>* pFld3 = &test._fld3) { var result = Sse41.BlendVariable( Sse2.LoadVector128((Int32*)(pFld1)), Sse2.LoadVector128((Int32*)(pFld2)), Sse2.LoadVector128((Int32*)(pFld3)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, test._fld3, _dataTable.outArrayPtr); } } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = Sse41.BlendVariable(_fld1, _fld2, _fld3); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _fld3, _dataTable.outArrayPtr); } public void RunClassFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load)); fixed (Vector128<Int32>* pFld1 = &_fld1) fixed (Vector128<Int32>* pFld2 = &_fld2) fixed (Vector128<Int32>* pFld3 = &_fld3) { var result = Sse41.BlendVariable( Sse2.LoadVector128((Int32*)(pFld1)), Sse2.LoadVector128((Int32*)(pFld2)), Sse2.LoadVector128((Int32*)(pFld3)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _fld3, _dataTable.outArrayPtr); } } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = Sse41.BlendVariable(test._fld1, test._fld2, test._fld3); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, test._fld3, _dataTable.outArrayPtr); } public void RunStructLclFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario_Load)); var test = TestStruct.Create(); var result = Sse41.BlendVariable( Sse2.LoadVector128((Int32*)(&test._fld1)), Sse2.LoadVector128((Int32*)(&test._fld2)), Sse2.LoadVector128((Int32*)(&test._fld3)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, test._fld3, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } public void RunStructFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario_Load)); var test = TestStruct.Create(); test.RunStructFldScenario_Load(this); } public void RunUnsupportedScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario)); bool succeeded = false; try { RunBasicScenario_UnsafeRead(); } catch (PlatformNotSupportedException) { succeeded = true; } if (!succeeded) { Succeeded = false; } } private void ValidateResult(Vector128<Int32> op1, Vector128<Int32> op2, Vector128<Int32> op3, void* result, [CallerMemberName] string method = "") { Int32[] inArray1 = new Int32[Op1ElementCount]; Int32[] inArray2 = new Int32[Op2ElementCount]; Int32[] inArray3 = new Int32[Op3ElementCount]; Int32[] outArray = new Int32[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), op1); Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), op2); Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray3[0]), op3); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>()); ValidateResult(inArray1, inArray2, inArray3, outArray, method); } private void ValidateResult(void* op1, void* op2, void* op3, void* result, [CallerMemberName] string method = "") { Int32[] inArray1 = new Int32[Op1ElementCount]; Int32[] inArray2 = new Int32[Op2ElementCount]; Int32[] inArray3 = new Int32[Op3ElementCount]; Int32[] outArray = new Int32[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector128<Int32>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector128<Int32>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray3[0]), ref Unsafe.AsRef<byte>(op3), (uint)Unsafe.SizeOf<Vector128<Int32>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>()); ValidateResult(inArray1, inArray2, inArray3, outArray, method); } private void ValidateResult(Int32[] firstOp, Int32[] secondOp, Int32[] thirdOp, Int32[] result, [CallerMemberName] string method = "") { bool succeeded = true; if ((thirdOp[0] != 0) ? secondOp[0] != result[0] : firstOp[0] != result[0]) { succeeded = false; } else { for (var i = 1; i < RetElementCount; i++) { if ((thirdOp[i] != 0) ? secondOp[i] != result[i] : firstOp[i] != result[i]) { succeeded = false; break; } } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(Sse41)}.{nameof(Sse41.BlendVariable)}<Int32>(Vector128<Int32>, Vector128<Int32>, Vector128<Int32>): {method} failed:"); TestLibrary.TestFramework.LogInformation($" firstOp: ({string.Join(", ", firstOp)})"); TestLibrary.TestFramework.LogInformation($"secondOp: ({string.Join(", ", secondOp)})"); TestLibrary.TestFramework.LogInformation($" thirdOp: ({string.Join(", ", thirdOp)})"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", result)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
-1
dotnet/runtime
66,160
Update files to remove imhameed
SamMonoRT
2022-03-03T20:37:43Z
2022-03-04T17:15:58Z
1d82d48e8c8150bfb549f095d6dafb599ff9f229
611d45f73e65076ebff2f8b71c668cf56114deae
Update files to remove imhameed.
./src/tests/JIT/HardwareIntrinsics/X86/Avx2/HorizontalAdd_r.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> </PropertyGroup> <PropertyGroup> <DebugType>Embedded</DebugType> <Optimize /> </PropertyGroup> <ItemGroup> <Compile Include="HorizontalAdd.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> </PropertyGroup> <PropertyGroup> <DebugType>Embedded</DebugType> <Optimize /> </PropertyGroup> <ItemGroup> <Compile Include="HorizontalAdd.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,160
Update files to remove imhameed
SamMonoRT
2022-03-03T20:37:43Z
2022-03-04T17:15:58Z
1d82d48e8c8150bfb549f095d6dafb599ff9f229
611d45f73e65076ebff2f8b71c668cf56114deae
Update files to remove imhameed.
./src/tests/JIT/Regression/JitBlue/Runtime_57061/Runtime_57061.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // Generated by Fuzzlyn v1.2 on 2021-08-07 03:24:16 // Run on .NET 6.0.0-dev on Arm Linux // Seed: 12756399625466979010 // Reduced from 798.7 KiB to 1.5 KiB in 03:42:20 // Crashes the runtime using System.Runtime.CompilerServices; struct S0 { public bool F0; public bool F1; public uint F2; public short F3; public ulong F4; public S0(bool f0, bool f1, uint f2, short f3, ulong f4): this() { F0 = f0; F1 = f1; F2 = f2; F3 = f3; F4 = f4; } } class C0 { public C0(S0 f7, S0 f8) { } } class C1 { public S0 F1; public ulong F5; } struct S2 { public S2(C0 f4): this() { } } struct S3 { public uint F0; } class C2 { public C1 F3; } public class Runtime_57061 { static C2 s_23; static C1 s_37; static sbyte s_56; static S3 s_60; public static int Main() { uint vr2 = default(uint); uint vr3; bool vr4 = true; if (!vr4) { try { System.Console.WriteLine(s_60.F0); } finally { var vr5 = new C0(new S0(false, true, 0, 0, 0), new S0(false, false, 0, 0, 0)); } s_37.F5 = s_23.F3.F1.F4++; } vr4 = vr4; for (int vr6 = 0; vr6 < Bound(); vr6++) { sbyte vr8 = s_56; try { var vr7 = new S2(new C0(new S0(true, false, 0, 0, 0), new S0(true, true, 0, 0, 0))); } finally { vr3 = vr2; } vr3 = vr3; } return 100; } [MethodImpl(MethodImplOptions.NoInlining)] private static int Bound() => 0; }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // Generated by Fuzzlyn v1.2 on 2021-08-07 03:24:16 // Run on .NET 6.0.0-dev on Arm Linux // Seed: 12756399625466979010 // Reduced from 798.7 KiB to 1.5 KiB in 03:42:20 // Crashes the runtime using System.Runtime.CompilerServices; struct S0 { public bool F0; public bool F1; public uint F2; public short F3; public ulong F4; public S0(bool f0, bool f1, uint f2, short f3, ulong f4): this() { F0 = f0; F1 = f1; F2 = f2; F3 = f3; F4 = f4; } } class C0 { public C0(S0 f7, S0 f8) { } } class C1 { public S0 F1; public ulong F5; } struct S2 { public S2(C0 f4): this() { } } struct S3 { public uint F0; } class C2 { public C1 F3; } public class Runtime_57061 { static C2 s_23; static C1 s_37; static sbyte s_56; static S3 s_60; public static int Main() { uint vr2 = default(uint); uint vr3; bool vr4 = true; if (!vr4) { try { System.Console.WriteLine(s_60.F0); } finally { var vr5 = new C0(new S0(false, true, 0, 0, 0), new S0(false, false, 0, 0, 0)); } s_37.F5 = s_23.F3.F1.F4++; } vr4 = vr4; for (int vr6 = 0; vr6 < Bound(); vr6++) { sbyte vr8 = s_56; try { var vr7 = new S2(new C0(new S0(true, false, 0, 0, 0), new S0(true, true, 0, 0, 0))); } finally { vr3 = vr2; } vr3 = vr3; } return 100; } [MethodImpl(MethodImplOptions.NoInlining)] private static int Bound() => 0; }
-1
dotnet/runtime
66,160
Update files to remove imhameed
SamMonoRT
2022-03-03T20:37:43Z
2022-03-04T17:15:58Z
1d82d48e8c8150bfb549f095d6dafb599ff9f229
611d45f73e65076ebff2f8b71c668cf56114deae
Update files to remove imhameed.
./src/libraries/System.Diagnostics.PerformanceCounter/ref/System.Diagnostics.PerformanceCounter.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFrameworks>$(NetCoreAppCurrent);$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum)</TargetFrameworks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> </PropertyGroup> <ItemGroup> <Compile Include="System.Diagnostics.PerformanceCounter.cs" Condition="'$(TargetFrameworkIdentifier)' != '.NETFramework'" /> <Compile Include="System.Diagnostics.PerformanceCounter.netframework.cs" Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'" /> <Compile Include="System.Diagnostics.PerformanceCounter.netcoreapp.cs" Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'" /> </ItemGroup> <ItemGroup Condition="'$(TargetFramework)' == '$(NetCoreAppCurrent)'"> <ProjectReference Include="$(LibrariesProjectRoot)System.Collections.NonGeneric\ref\System.Collections.NonGeneric.csproj" /> <ProjectReference Include="$(LibrariesProjectRoot)System.ComponentModel.Primitives\ref\System.ComponentModel.Primitives.csproj" /> <ProjectReference Include="$(LibrariesProjectRoot)System.Runtime.InteropServices\ref\System.Runtime.InteropServices.csproj" /> </ItemGroup> <ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp' and '$(TargetFramework)' != '$(NetCoreAppCurrent)'"> <Reference Include="System.Collections.NonGeneric" /> <Reference Include="System.ComponentModel.Primitives" /> <Reference Include="System.Runtime" /> <Reference Include="System.Runtime.InteropServices" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFrameworks>$(NetCoreAppCurrent);$(NetCoreAppMinimum);netstandard2.0;$(NetFrameworkMinimum)</TargetFrameworks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> </PropertyGroup> <ItemGroup> <Compile Include="System.Diagnostics.PerformanceCounter.cs" Condition="'$(TargetFrameworkIdentifier)' != '.NETFramework'" /> <Compile Include="System.Diagnostics.PerformanceCounter.netframework.cs" Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'" /> <Compile Include="System.Diagnostics.PerformanceCounter.netcoreapp.cs" Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'" /> </ItemGroup> <ItemGroup Condition="'$(TargetFramework)' == '$(NetCoreAppCurrent)'"> <ProjectReference Include="$(LibrariesProjectRoot)System.Collections.NonGeneric\ref\System.Collections.NonGeneric.csproj" /> <ProjectReference Include="$(LibrariesProjectRoot)System.ComponentModel.Primitives\ref\System.ComponentModel.Primitives.csproj" /> <ProjectReference Include="$(LibrariesProjectRoot)System.Runtime.InteropServices\ref\System.Runtime.InteropServices.csproj" /> </ItemGroup> <ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp' and '$(TargetFramework)' != '$(NetCoreAppCurrent)'"> <Reference Include="System.Collections.NonGeneric" /> <Reference Include="System.ComponentModel.Primitives" /> <Reference Include="System.Runtime" /> <Reference Include="System.Runtime.InteropServices" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,160
Update files to remove imhameed
SamMonoRT
2022-03-03T20:37:43Z
2022-03-04T17:15:58Z
1d82d48e8c8150bfb549f095d6dafb599ff9f229
611d45f73e65076ebff2f8b71c668cf56114deae
Update files to remove imhameed.
./src/libraries/System.Net.Mail/src/System/Net/Mail/SmtpClient.Browser.cs
// 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.ComponentModel; using System.Diagnostics.CodeAnalysis; using System.Runtime.Versioning; using System.Security.Cryptography.X509Certificates; using System.Threading; using System.Threading.Tasks; namespace System.Net.Mail { public delegate void SendCompletedEventHandler(object sender, AsyncCompletedEventArgs e); public enum SmtpDeliveryMethod { Network, SpecifiedPickupDirectory, PickupDirectoryFromIis } // EAI Settings public enum SmtpDeliveryFormat { SevenBit = 0, // Legacy International = 1, // SMTPUTF8 - Email Address Internationalization (EAI) } [UnsupportedOSPlatform("browser")] public class SmtpClient : IDisposable { #pragma warning disable CS0067 // Field is not used public event SendCompletedEventHandler? SendCompleted; #pragma warning restore CS0067 public SmtpClient() { Initialize(); } public SmtpClient(string? host) { Initialize(); } public SmtpClient(string? host, int port) { Initialize(); } private void Initialize() { throw new PlatformNotSupportedException(); } [DisallowNull] public string? Host { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } public int Port { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } public bool UseDefaultCredentials { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } public ICredentialsByHost? Credentials { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } public int Timeout { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } public ServicePoint ServicePoint { get => throw new PlatformNotSupportedException(); } public SmtpDeliveryMethod DeliveryMethod { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } public SmtpDeliveryFormat DeliveryFormat { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } public string? PickupDirectoryLocation { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } /// <summary> /// <para>Set to true if we need SSL</para> /// </summary> public bool EnableSsl { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } /// <summary> /// Certificates used by the client for establishing an SSL connection with the server. /// </summary> public X509CertificateCollection ClientCertificates => throw new PlatformNotSupportedException(); public string? TargetName { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } private bool ServerSupportsEai => throw new PlatformNotSupportedException(); public void Send(string from, string recipients, string? subject, string? body) => throw new PlatformNotSupportedException(); public void Send(MailMessage message) => throw new PlatformNotSupportedException(); public void SendAsync(string from, string recipients, string? subject, string? body, object? userToken) => throw new PlatformNotSupportedException(); public void SendAsync(MailMessage message, object? userToken) => throw new PlatformNotSupportedException(); public void SendAsyncCancel() => throw new PlatformNotSupportedException(); //************* Task-based async public methods ************************* public Task SendMailAsync(string from, string recipients, string? subject, string? body) => throw new PlatformNotSupportedException(); public Task SendMailAsync(MailMessage message) => throw new PlatformNotSupportedException(); public Task SendMailAsync(string from, string recipients, string? subject, string? body, CancellationToken cancellationToken) => throw new PlatformNotSupportedException(); public Task SendMailAsync(MailMessage message, CancellationToken cancellationToken) => throw new PlatformNotSupportedException(); protected void OnSendCompleted(AsyncCompletedEventArgs e) => throw new PlatformNotSupportedException(); public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } protected virtual void Dispose(bool disposing) { } } }
// 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.ComponentModel; using System.Diagnostics.CodeAnalysis; using System.Runtime.Versioning; using System.Security.Cryptography.X509Certificates; using System.Threading; using System.Threading.Tasks; namespace System.Net.Mail { public delegate void SendCompletedEventHandler(object sender, AsyncCompletedEventArgs e); public enum SmtpDeliveryMethod { Network, SpecifiedPickupDirectory, PickupDirectoryFromIis } // EAI Settings public enum SmtpDeliveryFormat { SevenBit = 0, // Legacy International = 1, // SMTPUTF8 - Email Address Internationalization (EAI) } [UnsupportedOSPlatform("browser")] public class SmtpClient : IDisposable { #pragma warning disable CS0067 // Field is not used public event SendCompletedEventHandler? SendCompleted; #pragma warning restore CS0067 public SmtpClient() { Initialize(); } public SmtpClient(string? host) { Initialize(); } public SmtpClient(string? host, int port) { Initialize(); } private void Initialize() { throw new PlatformNotSupportedException(); } [DisallowNull] public string? Host { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } public int Port { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } public bool UseDefaultCredentials { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } public ICredentialsByHost? Credentials { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } public int Timeout { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } public ServicePoint ServicePoint { get => throw new PlatformNotSupportedException(); } public SmtpDeliveryMethod DeliveryMethod { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } public SmtpDeliveryFormat DeliveryFormat { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } public string? PickupDirectoryLocation { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } /// <summary> /// <para>Set to true if we need SSL</para> /// </summary> public bool EnableSsl { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } /// <summary> /// Certificates used by the client for establishing an SSL connection with the server. /// </summary> public X509CertificateCollection ClientCertificates => throw new PlatformNotSupportedException(); public string? TargetName { get => throw new PlatformNotSupportedException(); set => throw new PlatformNotSupportedException(); } private bool ServerSupportsEai => throw new PlatformNotSupportedException(); public void Send(string from, string recipients, string? subject, string? body) => throw new PlatformNotSupportedException(); public void Send(MailMessage message) => throw new PlatformNotSupportedException(); public void SendAsync(string from, string recipients, string? subject, string? body, object? userToken) => throw new PlatformNotSupportedException(); public void SendAsync(MailMessage message, object? userToken) => throw new PlatformNotSupportedException(); public void SendAsyncCancel() => throw new PlatformNotSupportedException(); //************* Task-based async public methods ************************* public Task SendMailAsync(string from, string recipients, string? subject, string? body) => throw new PlatformNotSupportedException(); public Task SendMailAsync(MailMessage message) => throw new PlatformNotSupportedException(); public Task SendMailAsync(string from, string recipients, string? subject, string? body, CancellationToken cancellationToken) => throw new PlatformNotSupportedException(); public Task SendMailAsync(MailMessage message, CancellationToken cancellationToken) => throw new PlatformNotSupportedException(); protected void OnSendCompleted(AsyncCompletedEventArgs e) => throw new PlatformNotSupportedException(); public void Dispose() { Dispose(true); GC.SuppressFinalize(this); } protected virtual void Dispose(bool disposing) { } } }
-1
dotnet/runtime
66,160
Update files to remove imhameed
SamMonoRT
2022-03-03T20:37:43Z
2022-03-04T17:15:58Z
1d82d48e8c8150bfb549f095d6dafb599ff9f229
611d45f73e65076ebff2f8b71c668cf56114deae
Update files to remove imhameed.
./src/libraries/System.Private.Xml.Linq/tests/xNodeReader/ErrorConditions.cs
// 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.Collections.Generic; using System.Xml; using System.Xml.Linq; using Microsoft.Test.ModuleCore; namespace CoreXml.Test.XLinq { public partial class XNodeReaderFunctionalTests : TestModule { public partial class XNodeReaderTests : XLinqTestCase { public partial class ErrorConditions : BridgeHelpers { //[Variation(Desc = "IsStartElement")] public void Variation3() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { TestLog.Compare(r.IsStartElement(null, null), false, "Error"); TestLog.Compare(r.IsStartElement(null), false, "Error"); TestLog.Compare(r.IsStartElement("", ""), false, "Error"); TestLog.Compare(r.IsStartElement(""), false, "Error"); } } } //[Variation(Desc = "LookupNamespace")] public void Variation4() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { TestLog.Compare(r.LookupNamespace(""), null, "Error"); TestLog.Compare(r.LookupNamespace(null), null, "Error"); } } } //[Variation(Desc = "MoveToAttribute")] public void Variation5() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.MoveToAttribute(-100000); r.MoveToAttribute(-1); r.MoveToAttribute(0); r.MoveToAttribute(100000); TestLog.Compare(r.MoveToAttribute(null), false, "Error"); TestLog.Compare(r.MoveToAttribute(null, null), false, "Error"); TestLog.Compare(r.MoveToAttribute(""), false, "Error"); TestLog.Compare(r.MoveToAttribute("", ""), false, "Error"); } } } //[Variation(Desc = "Other APIs")] public void Variation6() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.MoveToContent(); TestLog.Compare(r.MoveToElement(), false, "Error"); TestLog.Compare(r.MoveToFirstAttribute(), false, "Error"); TestLog.Compare(r.MoveToNextAttribute(), false, "Error"); TestLog.Compare(r.ReadAttributeValue(), false, "Error"); r.Read(); TestLog.Compare(r.ReadInnerXml(), "", "Error"); r.ReadOuterXml(); r.ResolveEntity(); r.Skip(); } } } //[Variation(Desc = "ReadContentAs(null, null)")] public void Variation7() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.MoveToContent(); try { r.ReadContentAs(null, null); throw new TestException(TestResult.Failed, ""); } catch (ArgumentNullException) { try { r.ReadContentAs(null, null); throw new TestException(TestResult.Failed, ""); } catch (ArgumentNullException) { } catch (InvalidOperationException) { } } catch (InvalidOperationException) { try { r.ReadContentAs(null, null); throw new TestException(TestResult.Failed, ""); } catch (InvalidOperationException) { } } } } } //[Variation(Desc = "ReadContentAsBase64")] public void Variation8() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.MoveToContent(); try { r.ReadContentAsBase64(null, 0, 0); throw new TestException(TestResult.Failed, ""); } catch (NotSupportedException) { try { r.ReadContentAsBase64(null, 0, 0); throw new TestException(TestResult.Failed, ""); } catch (NotSupportedException) { } } } } } //[Variation(Desc = "ReadContentAsBinHex")] public void Variation9() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.MoveToContent(); try { r.ReadContentAsBinHex(null, 0, 0); throw new TestException(TestResult.Failed, ""); } catch (NotSupportedException) { try { r.ReadContentAsBinHex(null, 0, 0); throw new TestException(TestResult.Failed, ""); } catch (NotSupportedException) { } } } } } //[Variation(Desc = "ReadContentAsBoolean")] public void Variation10() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.MoveToContent(); try { r.ReadContentAsBoolean(); throw new TestException(TestResult.Failed, ""); } catch (XmlException) { try { r.ReadContentAsBoolean(); throw new TestException(TestResult.Failed, ""); } catch (XmlException) { } catch (InvalidOperationException) { } } catch (InvalidOperationException) { try { r.ReadContentAsBoolean(); throw new TestException(TestResult.Failed, ""); } catch (InvalidOperationException) { } } } } } //[Variation(Desc = "ReadContentAsDateTimeOffset")] public void Variation11b() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.MoveToContent(); try { r.ReadContentAsDateTimeOffset(); throw new TestException(TestResult.Failed, ""); } catch (XmlException) { try { r.ReadContentAsDateTimeOffset(); throw new TestException(TestResult.Failed, ""); } catch (XmlException) { } catch (InvalidOperationException) { } } catch (InvalidOperationException) { try { r.ReadContentAsDateTimeOffset(); throw new TestException(TestResult.Failed, ""); } catch (InvalidOperationException) { } } } } } //[Variation(Desc = "ReadContentAsDecimal")] public void Variation12() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.MoveToContent(); try { r.ReadContentAsDecimal(); throw new TestException(TestResult.Failed, ""); } catch (XmlException) { try { r.ReadContentAsDecimal(); throw new TestException(TestResult.Failed, ""); } catch (XmlException) { } catch (InvalidOperationException) { } } catch (InvalidOperationException) { try { r.ReadContentAsDecimal(); throw new TestException(TestResult.Failed, ""); } catch (InvalidOperationException) { } } } } } //[Variation(Desc = "ReadContentAsDouble")] public void Variation13() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.MoveToContent(); try { r.ReadContentAsDouble(); throw new TestException(TestResult.Failed, ""); } catch (XmlException) { try { r.ReadContentAsDouble(); throw new TestException(TestResult.Failed, ""); } catch (XmlException) { } catch (InvalidOperationException) { } } catch (InvalidOperationException) { try { r.ReadContentAsDouble(); throw new TestException(TestResult.Failed, ""); } catch (InvalidOperationException) { } } } } } //[Variation(Desc = "ReadContentAsFloat")] public void Variation14() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.MoveToContent(); try { r.ReadContentAsFloat(); throw new TestException(TestResult.Failed, ""); } catch (XmlException) { try { r.ReadContentAsFloat(); throw new TestException(TestResult.Failed, ""); } catch (XmlException) { } catch (InvalidOperationException) { } } catch (InvalidOperationException) { try { r.ReadContentAsFloat(); throw new TestException(TestResult.Failed, ""); } catch (InvalidOperationException) { } } } } } //[Variation(Desc = "ReadContentAsInt")] public void Variation15() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.MoveToContent(); try { r.ReadContentAsInt(); throw new TestException(TestResult.Failed, ""); } catch (XmlException) { try { r.ReadContentAsInt(); throw new TestException(TestResult.Failed, ""); } catch (XmlException) { } catch (InvalidOperationException) { } } catch (InvalidOperationException) { try { r.ReadContentAsInt(); throw new TestException(TestResult.Failed, ""); } catch (InvalidOperationException) { } } } } } //[Variation(Desc = "ReadContentAsLong")] public void Variation16() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.MoveToContent(); try { r.ReadContentAsLong(); throw new TestException(TestResult.Failed, ""); } catch (XmlException) { try { r.ReadContentAsLong(); throw new TestException(TestResult.Failed, ""); } catch (XmlException) { } catch (InvalidOperationException) { } } catch (InvalidOperationException) { try { r.ReadContentAsLong(); throw new TestException(TestResult.Failed, ""); } catch (InvalidOperationException) { } } } } } //[Variation(Desc = "ReadElementContentAs(null, null)")] public void Variation17() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.Read(); try { r.ReadElementContentAs(null, null); throw new TestException(TestResult.Failed, ""); } catch (ArgumentNullException) { try { r.ReadElementContentAs(null, null, null, null); throw new TestException(TestResult.Failed, ""); } catch (ArgumentNullException) { } } catch (InvalidOperationException) { try { r.ReadElementContentAs(null, null, null, null); throw new TestException(TestResult.Failed, ""); } catch (ArgumentNullException) { } } } } } //[Variation(Desc = "ReadElementContentAsBase64")] public void Variation18() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.Read(); try { r.ReadElementContentAsBase64(null, 0, 0); throw new TestException(TestResult.Failed, ""); } catch (NotSupportedException) { try { r.ReadElementContentAsBase64(null, 0, 0); throw new TestException(TestResult.Failed, ""); } catch (NotSupportedException) { } } } } } //[Variation(Desc = "ReadElementContentAsBinHex")] public void Variation19() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.Read(); try { r.ReadElementContentAsBinHex(null, 0, 0); throw new TestException(TestResult.Failed, ""); } catch (NotSupportedException) { try { r.ReadElementContentAsBinHex(null, 0, 0); throw new TestException(TestResult.Failed, ""); } catch (NotSupportedException) { } } } } } //[Variation(Desc = "ReadElementContentAsBoolean")] public void Variation20() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.Read(); try { r.ReadElementContentAsBoolean(null, null); throw new TestException(TestResult.Failed, ""); } catch (ArgumentNullException) { try { r.ReadElementContentAsBoolean(); throw new TestException(TestResult.Failed, ""); } catch (XmlException) { } catch (FormatException) { } catch (InvalidOperationException) { } } } } } //[Variation(Desc = "ReadElementContentAsDecimal")] public void Variation22() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.Read(); try { r.ReadElementContentAsDecimal(null, null); throw new TestException(TestResult.Failed, ""); } catch (ArgumentNullException) { try { r.ReadElementContentAsDecimal(); throw new TestException(TestResult.Failed, ""); } catch (XmlException) { } catch (FormatException) { } catch (InvalidOperationException) { } } } } } //[Variation(Desc = "ReadElementContentAsDouble")] public void Variation23() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.Read(); try { r.ReadElementContentAsDouble(null, null); throw new TestException(TestResult.Failed, ""); } catch (ArgumentNullException) { try { r.ReadElementContentAsDouble(); throw new TestException(TestResult.Failed, ""); } catch (XmlException) { } catch (FormatException) { } catch (InvalidOperationException) { } } } } } //[Variation(Desc = "ReadElementContentAsFloat")] public void Variation24() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.Read(); try { r.ReadElementContentAsFloat(null, null); throw new TestException(TestResult.Failed, ""); } catch (ArgumentNullException) { try { r.ReadElementContentAsFloat(); throw new TestException(TestResult.Failed, ""); } catch (XmlException) { } catch (FormatException) { } catch (InvalidOperationException) { } } } } } //[Variation(Desc = "ReadElementContentAsInt")] public void Variation25() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.Read(); try { r.ReadElementContentAsInt(null, null); throw new TestException(TestResult.Failed, ""); } catch (ArgumentNullException) { try { r.ReadElementContentAsInt(); throw new TestException(TestResult.Failed, ""); } catch (XmlException) { } catch (FormatException) { } catch (InvalidOperationException) { } } } } } //[Variation(Desc = "ReadElementContentAsLong")] public void Variation26() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.Read(); try { r.ReadElementContentAsLong(null, null); throw new TestException(TestResult.Failed, ""); } catch (ArgumentNullException) { try { r.ReadElementContentAsLong(); throw new TestException(TestResult.Failed, ""); } catch (XmlException) { } catch (FormatException) { } catch (InvalidOperationException) { } } } } } //[Variation(Desc = "ReadElementContentAsObject")] public void Variation27() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.Read(); try { r.ReadElementContentAsLong(null, null); throw new TestException(TestResult.Failed, ""); } catch (ArgumentNullException) { try { r.ReadElementContentAsLong(null, null); throw new TestException(TestResult.Failed, ""); } catch (ArgumentNullException) { } } } } } //[Variation(Desc = "ReadElementContentAsString")] public void Variation28() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.Read(); try { r.ReadElementContentAsString(null, null); throw new TestException(TestResult.Failed, ""); } catch (ArgumentNullException) { try { r.ReadElementContentAsString(null, null); throw new TestException(TestResult.Failed, ""); } catch (ArgumentNullException) { } } } } } //[Variation(Desc = "ReadStartElement")] public void Variation30() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.Read(); try { r.ReadStartElement(null, null); throw new TestException(TestResult.Failed, ""); } catch (XmlException) { try { r.ReadStartElement(null); throw new TestException(TestResult.Failed, ""); } catch (XmlException) { } } } } } //[Variation(Desc = "ReadToDescendant(null)")] public void Variation31() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.Read(); TestLog.Compare(r.ReadToDescendant(null, null), false, "Incorrect value returned"); } } } //[Variation(Desc = "ReadToDescendant(String.Empty)")] public void Variation32() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.Read(); TestLog.Compare(r.ReadToDescendant("", ""), false, "Incorrect value returned"); } } } //[Variation(Desc = "ReadToFollowing(null)")] public void Variation33() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.Read(); TestLog.Compare(r.ReadToFollowing(null, null), false, "Incorrect value returned"); } } } //[Variation(Desc = "ReadToFollowing(String.Empty)")] public void Variation34() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.Read(); TestLog.Compare(r.ReadToFollowing("", ""), false, "Incorrect value returned"); } } } //[Variation(Desc = "ReadToNextSibling(null)")] public void Variation35() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.Read(); TestLog.Compare(r.ReadToNextSibling(null, null), false, "Incorrect value returned"); } } } //[Variation(Desc = "ReadToNextSibling(String.Empty)")] public void Variation36() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.Read(); TestLog.Compare(r.ReadToNextSibling("", ""), false, "Incorrect value returned"); } } } //[Variation(Desc = "ReadValueChunk")] public void Variation37() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.Read(); try { r.ReadValueChunk(null, 0, 0); throw new TestException(TestResult.Failed, ""); } catch (NotSupportedException) { try { r.ReadValueChunk(null, 0, 0); throw new TestException(TestResult.Failed, ""); } catch (NotSupportedException) { } } } } } //[Variation(Desc = "ReadElementContentAsObject")] public void Variation38() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { while (r.Read()) ; try { r.ReadElementContentAsObject(); throw new TestException(TestResult.Failed, ""); } catch (InvalidOperationException) { try { r.ReadElementContentAsObject(); throw new TestException(TestResult.Failed, ""); } catch (InvalidOperationException) { } } } } } //[Variation(Desc = "ReadElementContentAsString")] public void Variation39() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { while (r.Read()) ; try { r.ReadElementContentAsString(); throw new TestException(TestResult.Failed, ""); } catch (InvalidOperationException) { try { r.ReadElementContentAsString(); throw new TestException(TestResult.Failed, ""); } catch (InvalidOperationException) { } } } } } //GetXNode List public List<XNode> GetXNodeR() { List<XNode> xNode = new List<XNode>(); xNode.Add(new XDocument(new XDocumentType("root", "", "", "<!ELEMENT root ANY>"), new XElement("root"))); xNode.Add(new XElement("elem1")); xNode.Add(new XText("text1")); xNode.Add(new XComment("comment1")); xNode.Add(new XProcessingInstruction("pi1", "pi1pi1pi1pi1pi1")); xNode.Add(new XCData("cdata cdata")); xNode.Add(new XDocumentType("dtd1", "dtd1dtd1dtd1", "dtd1dtd1", "dtd1dtd1dtd1dtd1")); return xNode; } } } } }
// 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.Collections.Generic; using System.Xml; using System.Xml.Linq; using Microsoft.Test.ModuleCore; namespace CoreXml.Test.XLinq { public partial class XNodeReaderFunctionalTests : TestModule { public partial class XNodeReaderTests : XLinqTestCase { public partial class ErrorConditions : BridgeHelpers { //[Variation(Desc = "IsStartElement")] public void Variation3() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { TestLog.Compare(r.IsStartElement(null, null), false, "Error"); TestLog.Compare(r.IsStartElement(null), false, "Error"); TestLog.Compare(r.IsStartElement("", ""), false, "Error"); TestLog.Compare(r.IsStartElement(""), false, "Error"); } } } //[Variation(Desc = "LookupNamespace")] public void Variation4() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { TestLog.Compare(r.LookupNamespace(""), null, "Error"); TestLog.Compare(r.LookupNamespace(null), null, "Error"); } } } //[Variation(Desc = "MoveToAttribute")] public void Variation5() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.MoveToAttribute(-100000); r.MoveToAttribute(-1); r.MoveToAttribute(0); r.MoveToAttribute(100000); TestLog.Compare(r.MoveToAttribute(null), false, "Error"); TestLog.Compare(r.MoveToAttribute(null, null), false, "Error"); TestLog.Compare(r.MoveToAttribute(""), false, "Error"); TestLog.Compare(r.MoveToAttribute("", ""), false, "Error"); } } } //[Variation(Desc = "Other APIs")] public void Variation6() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.MoveToContent(); TestLog.Compare(r.MoveToElement(), false, "Error"); TestLog.Compare(r.MoveToFirstAttribute(), false, "Error"); TestLog.Compare(r.MoveToNextAttribute(), false, "Error"); TestLog.Compare(r.ReadAttributeValue(), false, "Error"); r.Read(); TestLog.Compare(r.ReadInnerXml(), "", "Error"); r.ReadOuterXml(); r.ResolveEntity(); r.Skip(); } } } //[Variation(Desc = "ReadContentAs(null, null)")] public void Variation7() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.MoveToContent(); try { r.ReadContentAs(null, null); throw new TestException(TestResult.Failed, ""); } catch (ArgumentNullException) { try { r.ReadContentAs(null, null); throw new TestException(TestResult.Failed, ""); } catch (ArgumentNullException) { } catch (InvalidOperationException) { } } catch (InvalidOperationException) { try { r.ReadContentAs(null, null); throw new TestException(TestResult.Failed, ""); } catch (InvalidOperationException) { } } } } } //[Variation(Desc = "ReadContentAsBase64")] public void Variation8() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.MoveToContent(); try { r.ReadContentAsBase64(null, 0, 0); throw new TestException(TestResult.Failed, ""); } catch (NotSupportedException) { try { r.ReadContentAsBase64(null, 0, 0); throw new TestException(TestResult.Failed, ""); } catch (NotSupportedException) { } } } } } //[Variation(Desc = "ReadContentAsBinHex")] public void Variation9() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.MoveToContent(); try { r.ReadContentAsBinHex(null, 0, 0); throw new TestException(TestResult.Failed, ""); } catch (NotSupportedException) { try { r.ReadContentAsBinHex(null, 0, 0); throw new TestException(TestResult.Failed, ""); } catch (NotSupportedException) { } } } } } //[Variation(Desc = "ReadContentAsBoolean")] public void Variation10() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.MoveToContent(); try { r.ReadContentAsBoolean(); throw new TestException(TestResult.Failed, ""); } catch (XmlException) { try { r.ReadContentAsBoolean(); throw new TestException(TestResult.Failed, ""); } catch (XmlException) { } catch (InvalidOperationException) { } } catch (InvalidOperationException) { try { r.ReadContentAsBoolean(); throw new TestException(TestResult.Failed, ""); } catch (InvalidOperationException) { } } } } } //[Variation(Desc = "ReadContentAsDateTimeOffset")] public void Variation11b() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.MoveToContent(); try { r.ReadContentAsDateTimeOffset(); throw new TestException(TestResult.Failed, ""); } catch (XmlException) { try { r.ReadContentAsDateTimeOffset(); throw new TestException(TestResult.Failed, ""); } catch (XmlException) { } catch (InvalidOperationException) { } } catch (InvalidOperationException) { try { r.ReadContentAsDateTimeOffset(); throw new TestException(TestResult.Failed, ""); } catch (InvalidOperationException) { } } } } } //[Variation(Desc = "ReadContentAsDecimal")] public void Variation12() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.MoveToContent(); try { r.ReadContentAsDecimal(); throw new TestException(TestResult.Failed, ""); } catch (XmlException) { try { r.ReadContentAsDecimal(); throw new TestException(TestResult.Failed, ""); } catch (XmlException) { } catch (InvalidOperationException) { } } catch (InvalidOperationException) { try { r.ReadContentAsDecimal(); throw new TestException(TestResult.Failed, ""); } catch (InvalidOperationException) { } } } } } //[Variation(Desc = "ReadContentAsDouble")] public void Variation13() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.MoveToContent(); try { r.ReadContentAsDouble(); throw new TestException(TestResult.Failed, ""); } catch (XmlException) { try { r.ReadContentAsDouble(); throw new TestException(TestResult.Failed, ""); } catch (XmlException) { } catch (InvalidOperationException) { } } catch (InvalidOperationException) { try { r.ReadContentAsDouble(); throw new TestException(TestResult.Failed, ""); } catch (InvalidOperationException) { } } } } } //[Variation(Desc = "ReadContentAsFloat")] public void Variation14() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.MoveToContent(); try { r.ReadContentAsFloat(); throw new TestException(TestResult.Failed, ""); } catch (XmlException) { try { r.ReadContentAsFloat(); throw new TestException(TestResult.Failed, ""); } catch (XmlException) { } catch (InvalidOperationException) { } } catch (InvalidOperationException) { try { r.ReadContentAsFloat(); throw new TestException(TestResult.Failed, ""); } catch (InvalidOperationException) { } } } } } //[Variation(Desc = "ReadContentAsInt")] public void Variation15() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.MoveToContent(); try { r.ReadContentAsInt(); throw new TestException(TestResult.Failed, ""); } catch (XmlException) { try { r.ReadContentAsInt(); throw new TestException(TestResult.Failed, ""); } catch (XmlException) { } catch (InvalidOperationException) { } } catch (InvalidOperationException) { try { r.ReadContentAsInt(); throw new TestException(TestResult.Failed, ""); } catch (InvalidOperationException) { } } } } } //[Variation(Desc = "ReadContentAsLong")] public void Variation16() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.MoveToContent(); try { r.ReadContentAsLong(); throw new TestException(TestResult.Failed, ""); } catch (XmlException) { try { r.ReadContentAsLong(); throw new TestException(TestResult.Failed, ""); } catch (XmlException) { } catch (InvalidOperationException) { } } catch (InvalidOperationException) { try { r.ReadContentAsLong(); throw new TestException(TestResult.Failed, ""); } catch (InvalidOperationException) { } } } } } //[Variation(Desc = "ReadElementContentAs(null, null)")] public void Variation17() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.Read(); try { r.ReadElementContentAs(null, null); throw new TestException(TestResult.Failed, ""); } catch (ArgumentNullException) { try { r.ReadElementContentAs(null, null, null, null); throw new TestException(TestResult.Failed, ""); } catch (ArgumentNullException) { } } catch (InvalidOperationException) { try { r.ReadElementContentAs(null, null, null, null); throw new TestException(TestResult.Failed, ""); } catch (ArgumentNullException) { } } } } } //[Variation(Desc = "ReadElementContentAsBase64")] public void Variation18() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.Read(); try { r.ReadElementContentAsBase64(null, 0, 0); throw new TestException(TestResult.Failed, ""); } catch (NotSupportedException) { try { r.ReadElementContentAsBase64(null, 0, 0); throw new TestException(TestResult.Failed, ""); } catch (NotSupportedException) { } } } } } //[Variation(Desc = "ReadElementContentAsBinHex")] public void Variation19() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.Read(); try { r.ReadElementContentAsBinHex(null, 0, 0); throw new TestException(TestResult.Failed, ""); } catch (NotSupportedException) { try { r.ReadElementContentAsBinHex(null, 0, 0); throw new TestException(TestResult.Failed, ""); } catch (NotSupportedException) { } } } } } //[Variation(Desc = "ReadElementContentAsBoolean")] public void Variation20() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.Read(); try { r.ReadElementContentAsBoolean(null, null); throw new TestException(TestResult.Failed, ""); } catch (ArgumentNullException) { try { r.ReadElementContentAsBoolean(); throw new TestException(TestResult.Failed, ""); } catch (XmlException) { } catch (FormatException) { } catch (InvalidOperationException) { } } } } } //[Variation(Desc = "ReadElementContentAsDecimal")] public void Variation22() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.Read(); try { r.ReadElementContentAsDecimal(null, null); throw new TestException(TestResult.Failed, ""); } catch (ArgumentNullException) { try { r.ReadElementContentAsDecimal(); throw new TestException(TestResult.Failed, ""); } catch (XmlException) { } catch (FormatException) { } catch (InvalidOperationException) { } } } } } //[Variation(Desc = "ReadElementContentAsDouble")] public void Variation23() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.Read(); try { r.ReadElementContentAsDouble(null, null); throw new TestException(TestResult.Failed, ""); } catch (ArgumentNullException) { try { r.ReadElementContentAsDouble(); throw new TestException(TestResult.Failed, ""); } catch (XmlException) { } catch (FormatException) { } catch (InvalidOperationException) { } } } } } //[Variation(Desc = "ReadElementContentAsFloat")] public void Variation24() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.Read(); try { r.ReadElementContentAsFloat(null, null); throw new TestException(TestResult.Failed, ""); } catch (ArgumentNullException) { try { r.ReadElementContentAsFloat(); throw new TestException(TestResult.Failed, ""); } catch (XmlException) { } catch (FormatException) { } catch (InvalidOperationException) { } } } } } //[Variation(Desc = "ReadElementContentAsInt")] public void Variation25() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.Read(); try { r.ReadElementContentAsInt(null, null); throw new TestException(TestResult.Failed, ""); } catch (ArgumentNullException) { try { r.ReadElementContentAsInt(); throw new TestException(TestResult.Failed, ""); } catch (XmlException) { } catch (FormatException) { } catch (InvalidOperationException) { } } } } } //[Variation(Desc = "ReadElementContentAsLong")] public void Variation26() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.Read(); try { r.ReadElementContentAsLong(null, null); throw new TestException(TestResult.Failed, ""); } catch (ArgumentNullException) { try { r.ReadElementContentAsLong(); throw new TestException(TestResult.Failed, ""); } catch (XmlException) { } catch (FormatException) { } catch (InvalidOperationException) { } } } } } //[Variation(Desc = "ReadElementContentAsObject")] public void Variation27() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.Read(); try { r.ReadElementContentAsLong(null, null); throw new TestException(TestResult.Failed, ""); } catch (ArgumentNullException) { try { r.ReadElementContentAsLong(null, null); throw new TestException(TestResult.Failed, ""); } catch (ArgumentNullException) { } } } } } //[Variation(Desc = "ReadElementContentAsString")] public void Variation28() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.Read(); try { r.ReadElementContentAsString(null, null); throw new TestException(TestResult.Failed, ""); } catch (ArgumentNullException) { try { r.ReadElementContentAsString(null, null); throw new TestException(TestResult.Failed, ""); } catch (ArgumentNullException) { } } } } } //[Variation(Desc = "ReadStartElement")] public void Variation30() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.Read(); try { r.ReadStartElement(null, null); throw new TestException(TestResult.Failed, ""); } catch (XmlException) { try { r.ReadStartElement(null); throw new TestException(TestResult.Failed, ""); } catch (XmlException) { } } } } } //[Variation(Desc = "ReadToDescendant(null)")] public void Variation31() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.Read(); TestLog.Compare(r.ReadToDescendant(null, null), false, "Incorrect value returned"); } } } //[Variation(Desc = "ReadToDescendant(String.Empty)")] public void Variation32() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.Read(); TestLog.Compare(r.ReadToDescendant("", ""), false, "Incorrect value returned"); } } } //[Variation(Desc = "ReadToFollowing(null)")] public void Variation33() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.Read(); TestLog.Compare(r.ReadToFollowing(null, null), false, "Incorrect value returned"); } } } //[Variation(Desc = "ReadToFollowing(String.Empty)")] public void Variation34() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.Read(); TestLog.Compare(r.ReadToFollowing("", ""), false, "Incorrect value returned"); } } } //[Variation(Desc = "ReadToNextSibling(null)")] public void Variation35() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.Read(); TestLog.Compare(r.ReadToNextSibling(null, null), false, "Incorrect value returned"); } } } //[Variation(Desc = "ReadToNextSibling(String.Empty)")] public void Variation36() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.Read(); TestLog.Compare(r.ReadToNextSibling("", ""), false, "Incorrect value returned"); } } } //[Variation(Desc = "ReadValueChunk")] public void Variation37() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { r.Read(); try { r.ReadValueChunk(null, 0, 0); throw new TestException(TestResult.Failed, ""); } catch (NotSupportedException) { try { r.ReadValueChunk(null, 0, 0); throw new TestException(TestResult.Failed, ""); } catch (NotSupportedException) { } } } } } //[Variation(Desc = "ReadElementContentAsObject")] public void Variation38() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { while (r.Read()) ; try { r.ReadElementContentAsObject(); throw new TestException(TestResult.Failed, ""); } catch (InvalidOperationException) { try { r.ReadElementContentAsObject(); throw new TestException(TestResult.Failed, ""); } catch (InvalidOperationException) { } } } } } //[Variation(Desc = "ReadElementContentAsString")] public void Variation39() { foreach (XNode n in GetXNodeR()) { using (XmlReader r = n.CreateReader()) { while (r.Read()) ; try { r.ReadElementContentAsString(); throw new TestException(TestResult.Failed, ""); } catch (InvalidOperationException) { try { r.ReadElementContentAsString(); throw new TestException(TestResult.Failed, ""); } catch (InvalidOperationException) { } } } } } //GetXNode List public List<XNode> GetXNodeR() { List<XNode> xNode = new List<XNode>(); xNode.Add(new XDocument(new XDocumentType("root", "", "", "<!ELEMENT root ANY>"), new XElement("root"))); xNode.Add(new XElement("elem1")); xNode.Add(new XText("text1")); xNode.Add(new XComment("comment1")); xNode.Add(new XProcessingInstruction("pi1", "pi1pi1pi1pi1pi1")); xNode.Add(new XCData("cdata cdata")); xNode.Add(new XDocumentType("dtd1", "dtd1dtd1dtd1", "dtd1dtd1", "dtd1dtd1dtd1dtd1")); return xNode; } } } } }
-1
dotnet/runtime
66,145
Fix clash between tentative method optimizations
This pull request pretty much became a rollback of https://github.com/dotnet/runtimelab/pull/658 with a regression test to make sure if https://github.com/dotnet/runtimelab/pull/658 is reintroduced, we do it properly. ~~When we were in the situation of the newly added test, we would try to generate method body on the abstract class. Such method body is not actually reachable.~~ ~~Saves 500 bytes on a hello world. Fixes a compiler assert (that might be more serious sometimes).~~
MichalStrehovsky
2022-03-03T16:32:47Z
2022-03-07T16:49:51Z
154386d63b3ba55ce3251fa4caf3dfa89279d982
b0d1e89497bfa7a7b602a1d1af2faa97af96c88d
Fix clash between tentative method optimizations. This pull request pretty much became a rollback of https://github.com/dotnet/runtimelab/pull/658 with a regression test to make sure if https://github.com/dotnet/runtimelab/pull/658 is reintroduced, we do it properly. ~~When we were in the situation of the newly added test, we would try to generate method body on the abstract class. Such method body is not actually reachable.~~ ~~Saves 500 bytes on a hello world. Fixes a compiler assert (that might be more serious sometimes).~~
./src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/CompilationModuleGroup.Aot.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using Internal.TypeSystem; namespace ILCompiler { partial class CompilationModuleGroup : IInliningPolicy { /// <summary> /// If true, type dictionary of "type" is in the module to be compiled /// </summary> public abstract bool ContainsTypeDictionary(TypeDesc type); /// <summary> /// If true, the generic dictionary of "method" is in the set of input assemblies being compiled /// </summary> public abstract bool ContainsMethodDictionary(MethodDesc method); /// <summary> /// If true, "method" is imported from the set of reference assemblies /// </summary> public abstract bool ImportsMethod(MethodDesc method, bool unboxingStub); /// <summary> /// If true, all code is compiled into a single module /// </summary> public abstract bool IsSingleFileCompilation { get; } /// <summary> /// If true, the full type should be generated. This occurs in situations where the type is /// shared between modules (generics, parameterized types), or the type lives in a different module /// and therefore needs a full VTable /// </summary> public abstract bool ShouldProduceFullVTable(TypeDesc type); /// <summary> /// If true, the necessary type should be promoted to a full type should be generated. /// </summary> public abstract bool ShouldPromoteToFullType(TypeDesc type); /// <summary> /// If true, if a type is in the dependency graph, its non-generic methods that can be transformed /// into code must be. /// </summary> public abstract bool PresenceOfEETypeImpliesAllMethodsOnType(TypeDesc type); /// <summary> /// If true, the type will not be linked into the same module as the current compilation and therefore /// accessed through the target platform's import mechanism (ie, Import Address Table on Windows) /// </summary> public abstract bool ShouldReferenceThroughImportTable(TypeDesc type); /// <summary> /// If true, there may be type system constructs that will not be linked into the same module as the current compilation and therefore /// accessed through the target platform's import mechanism (ie, Import Address Table on Windows) /// </summary> public abstract bool CanHaveReferenceThroughImportTable { get; } /// <summary> /// If true, instance methods will only be generated once their owning type is created. /// </summary> public abstract bool AllowInstanceMethodOptimization(MethodDesc method); /// <summary> /// If true, virtual methods on abstract types will only be generated once a non-abstract derived /// type that doesn't override the virtual method is created. /// </summary> public abstract bool AllowVirtualMethodOnAbstractTypeOptimization(MethodDesc method); } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using Internal.TypeSystem; namespace ILCompiler { partial class CompilationModuleGroup : IInliningPolicy { /// <summary> /// If true, type dictionary of "type" is in the module to be compiled /// </summary> public abstract bool ContainsTypeDictionary(TypeDesc type); /// <summary> /// If true, the generic dictionary of "method" is in the set of input assemblies being compiled /// </summary> public abstract bool ContainsMethodDictionary(MethodDesc method); /// <summary> /// If true, "method" is imported from the set of reference assemblies /// </summary> public abstract bool ImportsMethod(MethodDesc method, bool unboxingStub); /// <summary> /// If true, all code is compiled into a single module /// </summary> public abstract bool IsSingleFileCompilation { get; } /// <summary> /// If true, the full type should be generated. This occurs in situations where the type is /// shared between modules (generics, parameterized types), or the type lives in a different module /// and therefore needs a full VTable /// </summary> public abstract bool ShouldProduceFullVTable(TypeDesc type); /// <summary> /// If true, the necessary type should be promoted to a full type should be generated. /// </summary> public abstract bool ShouldPromoteToFullType(TypeDesc type); /// <summary> /// If true, if a type is in the dependency graph, its non-generic methods that can be transformed /// into code must be. /// </summary> public abstract bool PresenceOfEETypeImpliesAllMethodsOnType(TypeDesc type); /// <summary> /// If true, the type will not be linked into the same module as the current compilation and therefore /// accessed through the target platform's import mechanism (ie, Import Address Table on Windows) /// </summary> public abstract bool ShouldReferenceThroughImportTable(TypeDesc type); /// <summary> /// If true, there may be type system constructs that will not be linked into the same module as the current compilation and therefore /// accessed through the target platform's import mechanism (ie, Import Address Table on Windows) /// </summary> public abstract bool CanHaveReferenceThroughImportTable { get; } /// <summary> /// If true, instance methods will only be generated once their owning type is created. /// </summary> public abstract bool AllowInstanceMethodOptimization(MethodDesc method); } }
1
dotnet/runtime
66,145
Fix clash between tentative method optimizations
This pull request pretty much became a rollback of https://github.com/dotnet/runtimelab/pull/658 with a regression test to make sure if https://github.com/dotnet/runtimelab/pull/658 is reintroduced, we do it properly. ~~When we were in the situation of the newly added test, we would try to generate method body on the abstract class. Such method body is not actually reachable.~~ ~~Saves 500 bytes on a hello world. Fixes a compiler assert (that might be more serious sometimes).~~
MichalStrehovsky
2022-03-03T16:32:47Z
2022-03-07T16:49:51Z
154386d63b3ba55ce3251fa4caf3dfa89279d982
b0d1e89497bfa7a7b602a1d1af2faa97af96c88d
Fix clash between tentative method optimizations. This pull request pretty much became a rollback of https://github.com/dotnet/runtimelab/pull/658 with a regression test to make sure if https://github.com/dotnet/runtimelab/pull/658 is reintroduced, we do it properly. ~~When we were in the situation of the newly added test, we would try to generate method body on the abstract class. Such method body is not actually reachable.~~ ~~Saves 500 bytes on a hello world. Fixes a compiler assert (that might be more serious sometimes).~~
./src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/EETypeNode.cs
// 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.Collections.Generic; using Internal.IL; using Internal.Runtime; using Internal.Text; using Internal.TypeSystem; using Debug = System.Diagnostics.Debug; using GenericVariance = Internal.Runtime.GenericVariance; namespace ILCompiler.DependencyAnalysis { /// <summary> /// Given a type, EETypeNode writes an MethodTable data structure in the format expected by the runtime. /// /// Format of an MethodTable: /// /// Field Size | Contents /// ----------------+----------------------------------- /// UInt16 | Component Size. For arrays this is the element type size, for strings it is 2 (.NET uses /// | UTF16 character encoding), for generic type definitions it is the number of generic parameters, /// | and 0 for all other types. /// | /// UInt16 | EETypeKind (Normal, Array, Pointer type). Flags for: IsValueType, IsCrossModule, HasPointers, /// | HasOptionalFields, IsInterface, IsGeneric. Top 5 bits are used for enum EETypeElementType to /// | record whether it's back by an Int32, Int16 etc /// | /// Uint32 | Base size. /// | /// [Pointer Size] | Related type. Base type for regular types. Element type for arrays / pointer types. /// | /// UInt16 | Number of VTable slots (X) /// | /// UInt16 | Number of interfaces implemented by type (Y) /// | /// UInt32 | Hash code /// | /// X * [Ptr Size] | VTable entries (optional) /// | /// Y * [Ptr Size] | Pointers to interface map data structures (optional) /// | /// [Relative ptr] | Pointer to containing TypeManager indirection cell /// | /// [Relative ptr] | Pointer to writable data /// | /// [Relative ptr] | Pointer to finalizer method (optional) /// | /// [Relative ptr] | Pointer to optional fields (optional) /// | /// [Relative ptr] | Pointer to the generic type definition MethodTable (optional) /// | /// [Relative ptr] | Pointer to the generic argument and variance info (optional) /// </summary> public partial class EETypeNode : ObjectNode, IEETypeNode, ISymbolDefinitionNode, ISymbolNodeWithLinkage { protected readonly TypeDesc _type; internal readonly EETypeOptionalFieldsBuilder _optionalFieldsBuilder = new EETypeOptionalFieldsBuilder(); internal readonly EETypeOptionalFieldsNode _optionalFieldsNode; protected bool? _mightHaveInterfaceDispatchMap; private bool _hasConditionalDependenciesFromMetadataManager; public EETypeNode(NodeFactory factory, TypeDesc type) { if (type.IsCanonicalDefinitionType(CanonicalFormKind.Any)) Debug.Assert(this is CanonicalDefinitionEETypeNode); else if (type.IsCanonicalSubtype(CanonicalFormKind.Any)) Debug.Assert((this is CanonicalEETypeNode) || (this is NecessaryCanonicalEETypeNode)); Debug.Assert(!type.IsRuntimeDeterminedSubtype); _type = type; _optionalFieldsNode = new EETypeOptionalFieldsNode(this); _hasConditionalDependenciesFromMetadataManager = factory.MetadataManager.HasConditionalDependenciesDueToEETypePresence(type); factory.TypeSystemContext.EnsureLoadableType(type); // We don't have a representation for function pointers right now if (WithoutParameterizeTypes(type).IsFunctionPointer) ThrowHelper.ThrowTypeLoadException(ExceptionStringID.ClassLoadGeneral, type); static TypeDesc WithoutParameterizeTypes(TypeDesc t) => t is ParameterizedType pt ? WithoutParameterizeTypes(pt.ParameterType) : t; } protected bool MightHaveInterfaceDispatchMap(NodeFactory factory) { if (!_mightHaveInterfaceDispatchMap.HasValue) { _mightHaveInterfaceDispatchMap = EmitVirtualSlotsAndInterfaces && InterfaceDispatchMapNode.MightHaveInterfaceDispatchMap(_type, factory); } return _mightHaveInterfaceDispatchMap.Value; } protected override string GetName(NodeFactory factory) => this.GetMangledName(factory.NameMangler); public override bool ShouldSkipEmittingObjectNode(NodeFactory factory) { // If there is a constructed version of this node in the graph, emit that instead if (ConstructedEETypeNode.CreationAllowed(_type)) return factory.ConstructedTypeSymbol(_type).Marked; return false; } public virtual ISymbolNode NodeForLinkage(NodeFactory factory) { return factory.NecessaryTypeSymbol(_type); } public TypeDesc Type => _type; public override ObjectNodeSection Section { get { if (_type.Context.Target.IsWindows) return ObjectNodeSection.ReadOnlyDataSection; else return ObjectNodeSection.DataSection; } } public int MinimumObjectSize => _type.Context.Target.PointerSize * 3; protected virtual bool EmitVirtualSlotsAndInterfaces => false; public override bool InterestingForDynamicDependencyAnalysis { get { if (!EmitVirtualSlotsAndInterfaces) return false; if (_type.IsInterface) return false; if (_type.IsDefType) { // First, check if this type has any GVM that overrides a GVM on a parent type. If that's the case, this makes // the current type interesting for GVM analysis (i.e. instantiate its overriding GVMs for existing GVMDependenciesNodes // of the instantiated GVM on the parent types). foreach (var method in _type.GetAllVirtualMethods()) { Debug.Assert(method.IsVirtual); if (method.HasInstantiation) { MethodDesc slotDecl = MetadataVirtualMethodAlgorithm.FindSlotDefiningMethodForVirtualMethod(method); if (slotDecl != method) return true; } } // Second, check if this type has any GVMs that implement any GVM on any of the implemented interfaces. This would // make the current type interesting for dynamic dependency analysis to that we can instantiate its GVMs. foreach (DefType interfaceImpl in _type.RuntimeInterfaces) { foreach (var method in interfaceImpl.GetAllVirtualMethods()) { Debug.Assert(method.IsVirtual); // Static interface methods don't participate in GVM analysis if (method.Signature.IsStatic) continue; if (method.HasInstantiation) { // We found a GVM on one of the implemented interfaces. Find if the type implements this method. // (Note, do this comparision against the generic definition of the method, not the specific method instantiation MethodDesc genericDefinition = method.GetMethodDefinition(); MethodDesc slotDecl = _type.ResolveInterfaceMethodTarget(genericDefinition); if (slotDecl != null) { // If the type doesn't introduce this interface method implementation (i.e. the same implementation // already exists in the base type), do not consider this type interesting for GVM analysis just yet. // // We need to limit the number of types that are interesting for GVM analysis at all costs since // these all will be looked at for every unique generic virtual method call in the program. // Having a long list of interesting types affects the compilation throughput heavily. if (slotDecl.OwningType == _type || _type.BaseType.ResolveInterfaceMethodTarget(genericDefinition) != slotDecl) { return true; } } else { // The method could be implemented by a default interface method var resolution = _type.ResolveInterfaceMethodToDefaultImplementationOnType(genericDefinition, out slotDecl); if (resolution == DefaultInterfaceMethodResolution.DefaultImplementation) { return true; } } } } } } return false; } } internal bool HasOptionalFields { get { return _optionalFieldsBuilder.IsAtLeastOneFieldUsed(); } } internal byte[] GetOptionalFieldsData() { return _optionalFieldsBuilder.GetBytes(); } public override bool StaticDependenciesAreComputed => true; public static string GetMangledName(TypeDesc type, NameMangler nameMangler) { return nameMangler.NodeMangler.MethodTable(type); } public virtual void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb) { sb.Append(nameMangler.NodeMangler.MethodTable(_type)); } int ISymbolNode.Offset => 0; int ISymbolDefinitionNode.Offset => GCDescSize; public override bool IsShareable => IsTypeNodeShareable(_type); private bool CanonFormTypeMayExist { get { if (!_type.HasInstantiation) return false; if (!_type.Context.SupportsCanon) return false; // If type is already in canon form, a canonically equivalent type cannot exist if (_type.IsCanonicalSubtype(CanonicalFormKind.Any)) return false; // If we reach here, a universal canon variant can exist (if universal canon is supported) if (_type.Context.SupportsUniversalCanon) return true; // Attempt to convert to canon. If the type changes, then the CanonForm exists return (_type.ConvertToCanonForm(CanonicalFormKind.Specific) != _type); } } public sealed override bool HasConditionalStaticDependencies { get { // If the type is can be converted to some interesting canon type, and this is the non-constructed variant of an MethodTable // we may need to trigger the fully constructed type to exist to make the behavior of the type consistent // in reflection and generic template expansion scenarios if (CanonFormTypeMayExist) { return true; } if (!EmitVirtualSlotsAndInterfaces) return false; // Since the vtable is dependency driven, generate conditional static dependencies for // all possible vtable entries. // // The conditional dependencies conditionally add the implementation of the virtual method // if the virtual method is used. // // We walk the inheritance chain because abstract bases would only add a "tentative" // method body of the implementation that can be trimmed away if no other type uses it. DefType currentType = _type.GetClosestDefType(); while (currentType != null) { if (currentType == _type || (currentType is MetadataType mdType && mdType.IsAbstract)) { foreach (var method in currentType.GetAllVirtualMethods()) { // Abstract methods don't have a body associated with it so there's no conditional // dependency to add. // Generic virtual methods are tracked by an orthogonal mechanism. if (!method.IsAbstract && !method.HasInstantiation) return true; } } currentType = currentType.BaseType; } // If the type implements at least one interface, calls against that interface could result in this type's // implementation being used. if (_type.RuntimeInterfaces.Length > 0) return true; return _hasConditionalDependenciesFromMetadataManager; } } public sealed override IEnumerable<CombinedDependencyListEntry> GetConditionalStaticDependencies(NodeFactory factory) { List<CombinedDependencyListEntry> result = new List<CombinedDependencyListEntry>(); IEETypeNode maximallyConstructableType = factory.MaximallyConstructableType(_type); if (maximallyConstructableType != this) { // MethodTable upgrading from necessary to constructed if some template instantation exists that matches up // This ensures we don't end up having two EETypes in the system (one is this necessary type, and another one // that was dynamically created at runtime). if (CanonFormTypeMayExist) { result.Add(new CombinedDependencyListEntry(maximallyConstructableType, factory.MaximallyConstructableType(_type.ConvertToCanonForm(CanonicalFormKind.Specific)), "Trigger full type generation if canonical form exists")); if (_type.Context.SupportsUniversalCanon) result.Add(new CombinedDependencyListEntry(maximallyConstructableType, factory.MaximallyConstructableType(_type.ConvertToCanonForm(CanonicalFormKind.Universal)), "Trigger full type generation if universal canonical form exists")); } return result; } if (!EmitVirtualSlotsAndInterfaces) return result; DefType defType = _type.GetClosestDefType(); // If we're producing a full vtable, none of the dependencies are conditional. if (!factory.VTable(defType).HasFixedSlots) { bool isNonInterfaceAbstractType = !defType.IsInterface && ((MetadataType)defType).IsAbstract; foreach (MethodDesc decl in defType.EnumAllVirtualSlots()) { // Generic virtual methods are tracked by an orthogonal mechanism. if (decl.HasInstantiation) continue; MethodDesc impl = defType.FindVirtualFunctionTargetMethodOnObjectType(decl); bool implOwnerIsAbstract = ((MetadataType)impl.OwningType).IsAbstract; // We add a conditional dependency in two situations: // 1. The implementation is on this type. This is pretty obvious. // 2. The implementation comes from an abstract base type. We do this // because abstract types only request a TentativeMethodEntrypoint of the implementation. // The actual method body of this entrypoint might still be trimmed away. // We don't need to do this for implementations from non-abstract bases since // non-abstract types will create a hard conditional reference to their virtual // method implementations. // // We also skip abstract methods since they don't have a body to refer to. if ((impl.OwningType == defType || implOwnerIsAbstract) && !impl.IsAbstract) { MethodDesc canonImpl = impl.GetCanonMethodTarget(CanonicalFormKind.Specific); // If this is an abstract type, only request a tentative entrypoint (whose body // might just be stubbed out). This lets us avoid generating method bodies for // virtual method on abstract types that are overriden in all their children. // // We don't do this if the method can be placed in the sealed vtable since // those can never be overriden by children anyway. bool canUseTentativeMethod = isNonInterfaceAbstractType && !decl.CanMethodBeInSealedVTable() && factory.CompilationModuleGroup.AllowVirtualMethodOnAbstractTypeOptimization(canonImpl); IMethodNode implNode = canUseTentativeMethod ? factory.TentativeMethodEntrypoint(canonImpl, impl.OwningType.IsValueType) : factory.MethodEntrypoint(canonImpl, impl.OwningType.IsValueType); result.Add(new CombinedDependencyListEntry(implNode, factory.VirtualMethodUse(decl), "Virtual method")); } if (impl.OwningType == defType) { factory.MetadataManager.NoteOverridingMethod(decl, impl); } } Debug.Assert( _type == defType || ((System.Collections.IStructuralEquatable)defType.RuntimeInterfaces).Equals(_type.RuntimeInterfaces, EqualityComparer<DefType>.Default)); // Add conditional dependencies for interface methods the type implements. For example, if the type T implements // interface IFoo which has a method M1, add a dependency on T.M1 dependent on IFoo.M1 being called, since it's // possible for any IFoo object to actually be an instance of T. DefType[] defTypeRuntimeInterfaces = defType.RuntimeInterfaces; for (int interfaceIndex = 0; interfaceIndex < defTypeRuntimeInterfaces.Length; interfaceIndex++) { DefType interfaceType = defTypeRuntimeInterfaces[interfaceIndex]; Debug.Assert(interfaceType.IsInterface); bool isVariantInterfaceImpl = VariantInterfaceMethodUseNode.IsVariantInterfaceImplementation(factory, _type, interfaceType); foreach (MethodDesc interfaceMethod in interfaceType.GetAllVirtualMethods()) { // Generic virtual methods are tracked by an orthogonal mechanism. if (interfaceMethod.HasInstantiation) continue; // Static virtual methods are resolved at compile time if (interfaceMethod.Signature.IsStatic) continue; MethodDesc implMethod = defType.ResolveInterfaceMethodToVirtualMethodOnType(interfaceMethod); if (implMethod != null) { result.Add(new CombinedDependencyListEntry(factory.VirtualMethodUse(implMethod), factory.VirtualMethodUse(interfaceMethod), "Interface method")); // If any of the implemented interfaces have variance, calls against compatible interface methods // could result in interface methods of this type being used (e.g. IEnumerable<object>.GetEnumerator() // can dispatch to an implementation of IEnumerable<string>.GetEnumerator()). if (isVariantInterfaceImpl) { MethodDesc typicalInterfaceMethod = interfaceMethod.GetTypicalMethodDefinition(); result.Add(new CombinedDependencyListEntry(factory.VirtualMethodUse(implMethod), factory.VariantInterfaceMethodUse(typicalInterfaceMethod), "Interface method")); result.Add(new CombinedDependencyListEntry(factory.VirtualMethodUse(interfaceMethod), factory.VariantInterfaceMethodUse(typicalInterfaceMethod), "Interface method")); } factory.MetadataManager.NoteOverridingMethod(interfaceMethod, implMethod); } else { // Is the implementation provided by a default interface method? // If so, add a dependency on the entrypoint directly since nobody else is going to do that // (interface types have an empty vtable, modulo their generic dictionary). TypeDesc interfaceOnDefinition = defType.GetTypeDefinition().RuntimeInterfaces[interfaceIndex]; MethodDesc interfaceMethodDefinition = interfaceMethod; if (!interfaceType.IsTypeDefinition) interfaceMethodDefinition = factory.TypeSystemContext.GetMethodForInstantiatedType(interfaceMethod.GetTypicalMethodDefinition(), (InstantiatedType)interfaceOnDefinition); var resolution = defType.GetTypeDefinition().ResolveInterfaceMethodToDefaultImplementationOnType(interfaceMethodDefinition, out implMethod); if (resolution == DefaultInterfaceMethodResolution.DefaultImplementation) { DefType providingInterfaceDefinitionType = (DefType)implMethod.OwningType; implMethod = implMethod.InstantiateSignature(defType.Instantiation, Instantiation.Empty); MethodDesc defaultIntfMethod = implMethod.GetCanonMethodTarget(CanonicalFormKind.Specific); if (defaultIntfMethod.IsCanonicalMethod(CanonicalFormKind.Any)) { defaultIntfMethod = factory.TypeSystemContext.GetDefaultInterfaceMethodImplementationThunk(defaultIntfMethod, _type.ConvertToCanonForm(CanonicalFormKind.Specific), providingInterfaceDefinitionType); } result.Add(new CombinedDependencyListEntry(factory.MethodEntrypoint(defaultIntfMethod), factory.VirtualMethodUse(interfaceMethod), "Interface method")); factory.MetadataManager.NoteOverridingMethod(interfaceMethod, implMethod); } } } } } factory.MetadataManager.GetConditionalDependenciesDueToEETypePresence(ref result, factory, _type); return result; } public static bool IsTypeNodeShareable(TypeDesc type) { return type.IsParameterizedType || type.IsFunctionPointer || type is InstantiatedType; } internal static bool MethodHasNonGenericILMethodBody(MethodDesc method) { // Generic methods have their own generic dictionaries if (method.HasInstantiation) return false; // Abstract methods don't have a body if (method.IsAbstract) return false; // PInvoke methods are not permitted on generic types, // but let's not crash the compilation because of that. if (method.IsPInvoke) return false; // CoreRT can generate method bodies for these no matter what (worst case // they'll be throwing). We don't want to take the "return false" code path on CoreRT because // delegate methods fall into the runtime implemented category on CoreRT, but we // just treat them like regular method bodies. return true; } protected override DependencyList ComputeNonRelocationBasedDependencies(NodeFactory factory) { DependencyList dependencies = new DependencyList(); // Include the optional fields by default. We don't know if optional fields will be needed until // all of the interface usage has been stabilized. If we end up not needing it, the MethodTable node will not // generate any relocs to it, and the optional fields node will instruct the object writer to skip // emitting it. dependencies.Add(new DependencyListEntry(_optionalFieldsNode, "Optional fields")); // TODO-SIZE: We probably don't need to add these for all EETypes StaticsInfoHashtableNode.AddStaticsInfoDependencies(ref dependencies, factory, _type); if (EmitVirtualSlotsAndInterfaces) { if (!_type.IsArrayTypeWithoutGenericInterfaces()) { // Sealed vtables have relative pointers, so to minimize size, we build sealed vtables for the canonical types dependencies.Add(new DependencyListEntry(factory.SealedVTable(_type.ConvertToCanonForm(CanonicalFormKind.Specific)), "Sealed Vtable")); } // Also add the un-normalized vtable slices of implemented interfaces. // This is important to do in the scanning phase so that the compilation phase can find // vtable information for things like IEnumerator<List<__Canon>>. foreach (TypeDesc intface in _type.RuntimeInterfaces) dependencies.Add(factory.VTable(intface), "Interface vtable slice"); // Generated type contains generic virtual methods that will get added to the GVM tables if (TypeGVMEntriesNode.TypeNeedsGVMTableEntries(_type)) { dependencies.Add(new DependencyListEntry(factory.TypeGVMEntries(_type.GetTypeDefinition()), "Type with generic virtual methods")); AddDependenciesForUniversalGVMSupport(factory, _type, ref dependencies); TypeDesc canonicalType = _type.ConvertToCanonForm(CanonicalFormKind.Specific); if (canonicalType != _type) dependencies.Add(factory.ConstructedTypeSymbol(canonicalType), "Type with generic virtual methods"); } } if (factory.CompilationModuleGroup.PresenceOfEETypeImpliesAllMethodsOnType(_type)) { if (_type.IsArray || _type.IsDefType) { // If the compilation group wants this type to be fully promoted, ensure that all non-generic methods of the // type are generated. // This may be done for several reasons: // - The MethodTable may be going to be COMDAT folded with other EETypes generated in a different object file // This means their generic dictionaries need to have identical contents. The only way to achieve that is // by generating the entries for all methods that contribute to the dictionary, and sorting the dictionaries. // - The generic type may be imported into another module, in which case the generic dictionary imported // must represent all of the methods, as the set of used methods cannot be known at compile time // - As a matter of policy, the type and its methods may be exported for use in another module. The policy // may wish to specify that if a type is to be placed into a shared module, all of the methods associated with // it should be also be exported. foreach (var method in _type.GetClosestDefType().ConvertToCanonForm(CanonicalFormKind.Specific).GetAllMethods()) { if (!MethodHasNonGenericILMethodBody(method)) continue; dependencies.Add(factory.MethodEntrypoint(method.GetCanonMethodTarget(CanonicalFormKind.Specific)), "Ensure all methods on type due to CompilationModuleGroup policy"); } } } if (!ConstructedEETypeNode.CreationAllowed(_type)) { // If necessary MethodTable is the highest load level for this type, ask the metadata manager // if we have any dependencies due to reflectability. factory.MetadataManager.GetDependenciesDueToReflectability(ref dependencies, factory, _type); // If necessary MethodTable is the highest load level, consider this a module use if (_type is MetadataType mdType && mdType.Module.GetGlobalModuleType().GetStaticConstructor() is MethodDesc moduleCctor) { dependencies.Add(factory.MethodEntrypoint(moduleCctor), "Type in a module with initializer"); } } return dependencies; } public override ObjectData GetData(NodeFactory factory, bool relocsOnly) { ObjectDataBuilder objData = new ObjectDataBuilder(factory, relocsOnly); objData.RequireInitialPointerAlignment(); objData.AddSymbol(this); ComputeOptionalEETypeFields(factory, relocsOnly); OutputGCDesc(ref objData); OutputComponentSize(ref objData); OutputFlags(factory, ref objData); objData.EmitInt(BaseSize); OutputRelatedType(factory, ref objData); // Number of vtable slots will be only known later. Reseve the bytes for it. var vtableSlotCountReservation = objData.ReserveShort(); // Number of interfaces will only be known later. Reserve the bytes for it. var interfaceCountReservation = objData.ReserveShort(); objData.EmitInt(_type.GetHashCode()); if (EmitVirtualSlotsAndInterfaces) { // Emit VTable Debug.Assert(objData.CountBytes - ((ISymbolDefinitionNode)this).Offset == GetVTableOffset(objData.TargetPointerSize)); SlotCounter virtualSlotCounter = SlotCounter.BeginCounting(ref /* readonly */ objData); OutputVirtualSlots(factory, ref objData, _type, _type, _type, relocsOnly); // Update slot count int numberOfVtableSlots = virtualSlotCounter.CountSlots(ref /* readonly */ objData); objData.EmitShort(vtableSlotCountReservation, checked((short)numberOfVtableSlots)); // Emit interface map SlotCounter interfaceSlotCounter = SlotCounter.BeginCounting(ref /* readonly */ objData); OutputInterfaceMap(factory, ref objData); // Update slot count int numberOfInterfaceSlots = interfaceSlotCounter.CountSlots(ref /* readonly */ objData); objData.EmitShort(interfaceCountReservation, checked((short)numberOfInterfaceSlots)); } else { // If we're not emitting any slots, the number of slots is zero. objData.EmitShort(vtableSlotCountReservation, 0); objData.EmitShort(interfaceCountReservation, 0); } OutputTypeManagerIndirection(factory, ref objData); OutputWritableData(factory, ref objData); OutputFinalizerMethod(factory, ref objData); OutputOptionalFields(factory, ref objData); OutputSealedVTable(factory, relocsOnly, ref objData); OutputGenericInstantiationDetails(factory, ref objData); return objData.ToObjectData(); } /// <summary> /// Returns the offset within an MethodTable of the beginning of VTable entries /// </summary> /// <param name="pointerSize">The size of a pointer in bytes in the target architecture</param> public static int GetVTableOffset(int pointerSize) { return 16 + pointerSize; } protected virtual int GCDescSize => 0; protected virtual void OutputGCDesc(ref ObjectDataBuilder builder) { // Non-constructed EETypeNodes get no GC Desc Debug.Assert(GCDescSize == 0); } private void OutputComponentSize(ref ObjectDataBuilder objData) { if (_type.IsArray) { TypeDesc elementType = ((ArrayType)_type).ElementType; if (elementType == elementType.Context.UniversalCanonType) { objData.EmitShort(0); } else { int elementSize = elementType.GetElementSize().AsInt; // We validated that this will fit the short when the node was constructed. No need for nice messages. objData.EmitShort((short)checked((ushort)elementSize)); } } else if (_type.IsString) { objData.EmitShort(StringComponentSize.Value); } else { objData.EmitShort(0); } } private void OutputFlags(NodeFactory factory, ref ObjectDataBuilder objData) { UInt16 flags = EETypeBuilderHelpers.ComputeFlags(_type); if (_type.GetTypeDefinition() == factory.ArrayOfTEnumeratorType) { // Generic array enumerators use special variance rules recognized by the runtime flags |= (UInt16)EETypeFlags.GenericVarianceFlag; } if (factory.TypeSystemContext.IsGenericArrayInterfaceType(_type)) { // Runtime casting logic relies on all interface types implemented on arrays // to have the variant flag set (even if all the arguments are non-variant). // This supports e.g. casting uint[] to ICollection<int> flags |= (UInt16)EETypeFlags.GenericVarianceFlag; } if (_type.IsIDynamicInterfaceCastable) { flags |= (UInt16)EETypeFlags.IDynamicInterfaceCastableFlag; } ISymbolNode relatedTypeNode = GetRelatedTypeNode(factory); // If the related type (base type / array element type / pointee type) is not part of this compilation group, and // the output binaries will be multi-file (not multiple object files linked together), indicate to the runtime // that it should indirect through the import address table if (relatedTypeNode != null && relatedTypeNode.RepresentsIndirectionCell) { flags |= (UInt16)EETypeFlags.RelatedTypeViaIATFlag; } if (HasOptionalFields) { flags |= (UInt16)EETypeFlags.OptionalFieldsFlag; } if (this is ClonedConstructedEETypeNode) { flags |= (UInt16)EETypeKind.ClonedEEType; } objData.EmitShort((short)flags); } protected virtual int BaseSize { get { int pointerSize = _type.Context.Target.PointerSize; int objectSize; if (_type.IsDefType) { LayoutInt instanceByteCount = ((DefType)_type).InstanceByteCount; if (instanceByteCount.IsIndeterminate) { // Some value must be put in, but the specific value doesn't matter as it // isn't used for specific instantiations, and the universal canon MethodTable // is never associated with an allocated object. objectSize = pointerSize; } else { objectSize = pointerSize + ((DefType)_type).InstanceByteCount.AsInt; // +pointerSize for SyncBlock } if (_type.IsValueType) objectSize += pointerSize; // + EETypePtr field inherited from System.Object } else if (_type.IsArray) { objectSize = 3 * pointerSize; // SyncBlock + EETypePtr + Length if (_type.IsMdArray) objectSize += 2 * sizeof(int) * ((ArrayType)_type).Rank; } else if (_type.IsPointer) { // These never get boxed and don't have a base size. Use a sentinel value recognized by the runtime. return ParameterizedTypeShapeConstants.Pointer; } else if (_type.IsByRef) { // These never get boxed and don't have a base size. Use a sentinel value recognized by the runtime. return ParameterizedTypeShapeConstants.ByRef; } else throw new NotImplementedException(); objectSize = AlignmentHelper.AlignUp(objectSize, pointerSize); objectSize = Math.Max(MinimumObjectSize, objectSize); if (_type.IsString) { // If this is a string, throw away objectSize we computed so far. Strings are special. // SyncBlock + EETypePtr + length + firstChar objectSize = 2 * pointerSize + sizeof(int) + StringComponentSize.Value; } return objectSize; } } protected virtual ISymbolNode GetBaseTypeNode(NodeFactory factory) { return _type.BaseType != null ? factory.NecessaryTypeSymbol(_type.BaseType) : null; } private ISymbolNode GetRelatedTypeNode(NodeFactory factory) { ISymbolNode relatedTypeNode = null; if (_type.IsArray || _type.IsPointer || _type.IsByRef) { var parameterType = ((ParameterizedType)_type).ParameterType; relatedTypeNode = factory.NecessaryTypeSymbol(parameterType); } else { TypeDesc baseType = _type.BaseType; if (baseType != null) { relatedTypeNode = GetBaseTypeNode(factory); } } return relatedTypeNode; } protected virtual void OutputRelatedType(NodeFactory factory, ref ObjectDataBuilder objData) { ISymbolNode relatedTypeNode = GetRelatedTypeNode(factory); if (relatedTypeNode != null) { objData.EmitPointerReloc(relatedTypeNode); } else { objData.EmitZeroPointer(); } } private void OutputVirtualSlots(NodeFactory factory, ref ObjectDataBuilder objData, TypeDesc implType, TypeDesc declType, TypeDesc templateType, bool relocsOnly) { Debug.Assert(EmitVirtualSlotsAndInterfaces); declType = declType.GetClosestDefType(); templateType = templateType.ConvertToCanonForm(CanonicalFormKind.Specific); var baseType = declType.BaseType; if (baseType != null) { Debug.Assert(templateType.BaseType != null); OutputVirtualSlots(factory, ref objData, implType, baseType, templateType.BaseType, relocsOnly); } // // In the universal canonical types case, we could have base types in the hierarchy that are partial universal canonical types. // The presence of these types could cause incorrect vtable layouts, so we need to fully canonicalize them and walk the // hierarchy of the template type of the original input type to detect these cases. // // Exmaple: we begin with Derived<__UniversalCanon> and walk the template hierarchy: // // class Derived<T> : Middle<T, MyStruct> { } // -> Template is Derived<__UniversalCanon> and needs a dictionary slot // // -> Basetype tempalte is Middle<__UniversalCanon, MyStruct>. It's a partial // Universal canonical type, so we need to fully canonicalize it. // // class Middle<T, U> : Base<U> { } // -> Template is Middle<__UniversalCanon, __UniversalCanon> and needs a dictionary slot // // -> Basetype template is Base<__UniversalCanon> // // class Base<T> { } // -> Template is Base<__UniversalCanon> and needs a dictionary slot. // // If we had not fully canonicalized the Middle class template, we would have ended up with Base<MyStruct>, which does not need // a dictionary slot, meaning we would have created a vtable layout that the runtime does not expect. // // The generic dictionary pointer occupies the first slot of each type vtable slice if (declType.HasGenericDictionarySlot() || templateType.HasGenericDictionarySlot()) { // All generic interface types have a dictionary slot, but only some of them have an actual dictionary. bool isInterfaceWithAnEmptySlot = declType.IsInterface && declType.ConvertToCanonForm(CanonicalFormKind.Specific) == declType; // Note: Canonical type instantiations always have a generic dictionary vtable slot, but it's empty // Note: If the current EETypeNode represents a universal canonical type, any dictionary slot must be empty if (declType.IsCanonicalSubtype(CanonicalFormKind.Any) || implType.IsCanonicalSubtype(CanonicalFormKind.Universal) || factory.LazyGenericsPolicy.UsesLazyGenerics(declType) || isInterfaceWithAnEmptySlot) objData.EmitZeroPointer(); else objData.EmitPointerReloc(factory.TypeGenericDictionary(declType)); } VTableSliceNode declVTable = factory.VTable(declType); // It's only okay to touch the actual list of slots if we're in the final emission phase // or the vtable is not built lazily. if (relocsOnly && !declVTable.HasFixedSlots) return; // Inteface types don't place anything else in their physical vtable. // Interfaces have logical slots for their methods but since they're all abstract, they would be zero. // We place default implementations of interface methods into the vtable of the interface-implementing // type, pretending there was an extra virtual slot. if (_type.IsInterface) return; // Actual vtable slots follow IReadOnlyList<MethodDesc> virtualSlots = declVTable.Slots; for (int i = 0; i < virtualSlots.Count; i++) { MethodDesc declMethod = virtualSlots[i]; // Object.Finalize shouldn't get a virtual slot. Finalizer is stored in an optional field // instead: most MethodTable don't have a finalizer, but all EETypes contain Object's vtable. // This lets us save a pointer (+reloc) on most EETypes. Debug.Assert(!declType.IsObject || declMethod.Name != "Finalize"); // No generic virtual methods can appear in the vtable! Debug.Assert(!declMethod.HasInstantiation); MethodDesc implMethod = implType.GetClosestDefType().FindVirtualFunctionTargetMethodOnObjectType(declMethod); // Final NewSlot methods cannot be overridden, and therefore can be placed in the sealed-vtable to reduce the size of the vtable // of this type and any type that inherits from it. if (declMethod.CanMethodBeInSealedVTable() && !declType.IsArrayTypeWithoutGenericInterfaces()) continue; if (!implMethod.IsAbstract) { MethodDesc canonImplMethod = implMethod.GetCanonMethodTarget(CanonicalFormKind.Specific); // If the type we're generating now is abstract, and the implementation comes from an abstract type, // only use a tentative method entrypoint that can have its body replaced by a throwing stub // if no "hard" reference to that entrypoint exists in the program. // This helps us to eliminate method bodies for virtual methods on abstract types that are fully overriden // in the children of that abstract type. bool canUseTentativeEntrypoint = implType is MetadataType mdImplType && mdImplType.IsAbstract && !mdImplType.IsInterface && implMethod.OwningType is MetadataType mdImplMethodType && mdImplMethodType.IsAbstract && factory.CompilationModuleGroup.AllowVirtualMethodOnAbstractTypeOptimization(canonImplMethod); IMethodNode implSymbol = canUseTentativeEntrypoint ? factory.TentativeMethodEntrypoint(canonImplMethod, implMethod.OwningType.IsValueType) : factory.MethodEntrypoint(canonImplMethod, implMethod.OwningType.IsValueType); objData.EmitPointerReloc(implSymbol); } else { objData.EmitZeroPointer(); } } } protected virtual IEETypeNode GetInterfaceTypeNode(NodeFactory factory, TypeDesc interfaceType) { return factory.NecessaryTypeSymbol(interfaceType); } protected virtual void OutputInterfaceMap(NodeFactory factory, ref ObjectDataBuilder objData) { Debug.Assert(EmitVirtualSlotsAndInterfaces); foreach (var itf in _type.RuntimeInterfaces) { objData.EmitPointerRelocOrIndirectionReference(GetInterfaceTypeNode(factory, itf)); } } private void OutputFinalizerMethod(NodeFactory factory, ref ObjectDataBuilder objData) { if (_type.HasFinalizer) { MethodDesc finalizerMethod = _type.GetFinalizer(); MethodDesc canonFinalizerMethod = finalizerMethod.GetCanonMethodTarget(CanonicalFormKind.Specific); if (factory.Target.SupportsRelativePointers) objData.EmitReloc(factory.MethodEntrypoint(canonFinalizerMethod), RelocType.IMAGE_REL_BASED_RELPTR32); else objData.EmitPointerReloc(factory.MethodEntrypoint(canonFinalizerMethod)); } } protected void OutputTypeManagerIndirection(NodeFactory factory, ref ObjectDataBuilder objData) { if (factory.Target.SupportsRelativePointers) objData.EmitReloc(factory.TypeManagerIndirection, RelocType.IMAGE_REL_BASED_RELPTR32); else objData.EmitPointerReloc(factory.TypeManagerIndirection); } protected void OutputWritableData(NodeFactory factory, ref ObjectDataBuilder objData) { if (factory.Target.SupportsRelativePointers) { Utf8StringBuilder writableDataBlobName = new Utf8StringBuilder(); writableDataBlobName.Append("__writableData"); writableDataBlobName.Append(factory.NameMangler.GetMangledTypeName(_type)); BlobNode blob = factory.UninitializedWritableDataBlob(writableDataBlobName.ToUtf8String(), WritableData.GetSize(factory.Target.PointerSize), WritableData.GetAlignment(factory.Target.PointerSize)); objData.EmitReloc(blob, RelocType.IMAGE_REL_BASED_RELPTR32); } } protected void OutputOptionalFields(NodeFactory factory, ref ObjectDataBuilder objData) { if (HasOptionalFields) { if (factory.Target.SupportsRelativePointers) objData.EmitReloc(_optionalFieldsNode, RelocType.IMAGE_REL_BASED_RELPTR32); else objData.EmitPointerReloc(_optionalFieldsNode); } } private void OutputSealedVTable(NodeFactory factory, bool relocsOnly, ref ObjectDataBuilder objData) { if (EmitVirtualSlotsAndInterfaces && !_type.IsArrayTypeWithoutGenericInterfaces()) { // Sealed vtables have relative pointers, so to minimize size, we build sealed vtables for the canonical types SealedVTableNode sealedVTable = factory.SealedVTable(_type.ConvertToCanonForm(CanonicalFormKind.Specific)); if (sealedVTable.BuildSealedVTableSlots(factory, relocsOnly) && sealedVTable.NumSealedVTableEntries > 0) { if (factory.Target.SupportsRelativePointers) objData.EmitReloc(sealedVTable, RelocType.IMAGE_REL_BASED_RELPTR32); else objData.EmitPointerReloc(sealedVTable); } } } private void OutputGenericInstantiationDetails(NodeFactory factory, ref ObjectDataBuilder objData) { if (_type.HasInstantiation && !_type.IsTypeDefinition) { IEETypeNode typeDefNode = factory.NecessaryTypeSymbol(_type.GetTypeDefinition()); if (factory.Target.SupportsRelativePointers) objData.EmitRelativeRelocOrIndirectionReference(typeDefNode); else objData.EmitPointerRelocOrIndirectionReference(typeDefNode); GenericCompositionDetails details; if (_type.GetTypeDefinition() == factory.ArrayOfTEnumeratorType) { // Generic array enumerators use special variance rules recognized by the runtime details = new GenericCompositionDetails(_type.Instantiation, new[] { GenericVariance.ArrayCovariant }); } else if (factory.TypeSystemContext.IsGenericArrayInterfaceType(_type)) { // Runtime casting logic relies on all interface types implemented on arrays // to have the variant flag set (even if all the arguments are non-variant). // This supports e.g. casting uint[] to ICollection<int> details = new GenericCompositionDetails(_type, forceVarianceInfo: true); } else details = new GenericCompositionDetails(_type); ISymbolNode compositionNode = factory.GenericComposition(details); if (factory.Target.SupportsRelativePointers) objData.EmitReloc(compositionNode, RelocType.IMAGE_REL_BASED_RELPTR32); else objData.EmitPointerReloc(compositionNode); } } /// <summary> /// Populate the OptionalFieldsRuntimeBuilder if any optional fields are required. /// </summary> protected internal virtual void ComputeOptionalEETypeFields(NodeFactory factory, bool relocsOnly) { if (!relocsOnly && MightHaveInterfaceDispatchMap(factory)) { _optionalFieldsBuilder.SetFieldValue(EETypeOptionalFieldTag.DispatchMap, checked((uint)factory.InterfaceDispatchMapIndirection(Type).IndexFromBeginningOfArray)); } ComputeRareFlags(factory, relocsOnly); ComputeNullableValueOffset(); ComputeValueTypeFieldPadding(); } void ComputeRareFlags(NodeFactory factory, bool relocsOnly) { uint flags = 0; MetadataType metadataType = _type as MetadataType; if (factory.PreinitializationManager.HasLazyStaticConstructor(_type)) { flags |= (uint)EETypeRareFlags.HasCctorFlag; } if (_type.RequiresAlign8()) { flags |= (uint)EETypeRareFlags.RequiresAlign8Flag; } TargetArchitecture targetArch = _type.Context.Target.Architecture; if (metadataType != null && (targetArch == TargetArchitecture.ARM || targetArch == TargetArchitecture.ARM64) && metadataType.IsHomogeneousAggregate) { flags |= (uint)EETypeRareFlags.IsHFAFlag; } if (metadataType != null && !_type.IsInterface && metadataType.IsAbstract) { flags |= (uint)EETypeRareFlags.IsAbstractClassFlag; } if (_type.IsByRefLike) { flags |= (uint)EETypeRareFlags.IsByRefLikeFlag; } if (EmitVirtualSlotsAndInterfaces && !_type.IsArrayTypeWithoutGenericInterfaces()) { SealedVTableNode sealedVTable = factory.SealedVTable(_type.ConvertToCanonForm(CanonicalFormKind.Specific)); if (sealedVTable.BuildSealedVTableSlots(factory, relocsOnly) && sealedVTable.NumSealedVTableEntries > 0) flags |= (uint)EETypeRareFlags.HasSealedVTableEntriesFlag; } if (flags != 0) { _optionalFieldsBuilder.SetFieldValue(EETypeOptionalFieldTag.RareFlags, flags); } } /// <summary> /// To support boxing / unboxing, the offset of the value field of a Nullable type is recorded on the MethodTable. /// This is variable according to the alignment requirements of the Nullable&lt;T&gt; type parameter. /// </summary> void ComputeNullableValueOffset() { if (!_type.IsNullable) return; if (!_type.Instantiation[0].IsCanonicalSubtype(CanonicalFormKind.Universal)) { var field = _type.GetKnownField("value"); // In the definition of Nullable<T>, the first field should be the boolean representing "hasValue" Debug.Assert(field.Offset.AsInt > 0); // The contract with the runtime states the Nullable value offset is stored with the boolean "hasValue" size subtracted // to get a small encoding size win. _optionalFieldsBuilder.SetFieldValue(EETypeOptionalFieldTag.NullableValueOffset, (uint)field.Offset.AsInt - 1); } } protected virtual void ComputeValueTypeFieldPadding() { // All objects that can have appreciable which can be derived from size compute ValueTypeFieldPadding. // Unfortunately, the name ValueTypeFieldPadding is now wrong to avoid integration conflicts. // Interfaces, sealed types, and non-DefTypes cannot be derived from if (_type.IsInterface || !_type.IsDefType || (_type.IsSealed() && !_type.IsValueType)) return; DefType defType = _type as DefType; Debug.Assert(defType != null); uint valueTypeFieldPaddingEncoded; if (defType.InstanceByteCount.IsIndeterminate) { valueTypeFieldPaddingEncoded = EETypeBuilderHelpers.ComputeValueTypeFieldPaddingFieldValue(0, 1, _type.Context.Target.PointerSize); } else { int numInstanceFieldBytes = defType.InstanceByteCountUnaligned.AsInt; // Check if we have a type derived from System.ValueType or System.Enum, but not System.Enum itself if (defType.IsValueType) { // Value types should have at least 1 byte of size Debug.Assert(numInstanceFieldBytes >= 1); // The size doesn't currently include the MethodTable pointer size. We need to add this so that // the number of instance field bytes consistently represents the boxed size. numInstanceFieldBytes += _type.Context.Target.PointerSize; } // For unboxing to work correctly and for supporting dynamic type loading for derived types we need // to record the actual size of the fields of a type without any padding for GC heap allocation (since // we can unbox into locals or arrays where this padding is not used, and because field layout for derived // types is effected by the unaligned base size). We don't want to store this information for all EETypes // since it's only relevant for value types, and derivable types so it's added as an optional field. It's // also enough to simply store the size of the padding (between 0 and 4 or 8 bytes for 32-bit and 0 and 8 or 16 bytes // for 64-bit) which cuts down our storage requirements. uint valueTypeFieldPadding = checked((uint)((BaseSize - _type.Context.Target.PointerSize) - numInstanceFieldBytes)); valueTypeFieldPaddingEncoded = EETypeBuilderHelpers.ComputeValueTypeFieldPaddingFieldValue(valueTypeFieldPadding, (uint)defType.InstanceFieldAlignment.AsInt, _type.Context.Target.PointerSize); } if (valueTypeFieldPaddingEncoded != 0) { _optionalFieldsBuilder.SetFieldValue(EETypeOptionalFieldTag.ValueTypeFieldPadding, valueTypeFieldPaddingEncoded); } } protected override void OnMarked(NodeFactory context) { if (!context.IsCppCodegenTemporaryWorkaround) { Debug.Assert(_type.IsTypeDefinition || !_type.HasSameTypeDefinition(context.ArrayOfTClass), "Asking for Array<T> MethodTable"); } } public static void AddDependenciesForStaticsNode(NodeFactory factory, TypeDesc type, ref DependencyList dependencies) { // To ensure that the behvior of FieldInfo.GetValue/SetValue remains correct, // if a type may be reflectable, and it is generic, if a canonical instantiation of reflection // can exist which can refer to the associated type of this static base, ensure that type // has an MethodTable. (Which will allow the static field lookup logic to find the right type) if (type.HasInstantiation && !factory.MetadataManager.IsReflectionBlocked(type)) { // TODO-SIZE: This current implementation is slightly generous, as it does not attempt to restrict // the created types to the maximum extent by investigating reflection data and such. Here we just // check if we support use of a canonically equivalent type to perform reflection. // We don't check to see if reflection is enabled on the type. if (factory.TypeSystemContext.SupportsUniversalCanon || (factory.TypeSystemContext.SupportsCanon && (type != type.ConvertToCanonForm(CanonicalFormKind.Specific)))) { if (dependencies == null) dependencies = new DependencyList(); dependencies.Add(factory.NecessaryTypeSymbol(type), "Static block owning type is necessary for canonically equivalent reflection"); } } } protected static void AddDependenciesForUniversalGVMSupport(NodeFactory factory, TypeDesc type, ref DependencyList dependencies) { if (factory.TypeSystemContext.SupportsUniversalCanon) { foreach (MethodDesc method in type.GetVirtualMethods()) { if (!method.HasInstantiation) continue; if (method.IsAbstract) continue; TypeDesc[] universalCanonArray = new TypeDesc[method.Instantiation.Length]; for (int i = 0; i < universalCanonArray.Length; i++) universalCanonArray[i] = factory.TypeSystemContext.UniversalCanonType; MethodDesc universalCanonMethodNonCanonicalized = method.MakeInstantiatedMethod(new Instantiation(universalCanonArray)); MethodDesc universalCanonGVMMethod = universalCanonMethodNonCanonicalized.GetCanonMethodTarget(CanonicalFormKind.Universal); if (dependencies == null) dependencies = new DependencyList(); dependencies.Add(new DependencyListEntry(factory.MethodEntrypoint(universalCanonGVMMethod), "USG GVM Method")); } } } public override int ClassCode => 1521789141; public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return comparer.Compare(_type, ((EETypeNode)other)._type); } public override string ToString() { return _type.ToString(); } private struct SlotCounter { private int _startBytes; public static SlotCounter BeginCounting(ref /* readonly */ ObjectDataBuilder builder) => new SlotCounter { _startBytes = builder.CountBytes }; public int CountSlots(ref /* readonly */ ObjectDataBuilder builder) { int bytesEmitted = builder.CountBytes - _startBytes; Debug.Assert(bytesEmitted % builder.TargetPointerSize == 0); return bytesEmitted / builder.TargetPointerSize; } } } }
// 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.Collections.Generic; using Internal.IL; using Internal.Runtime; using Internal.Text; using Internal.TypeSystem; using Debug = System.Diagnostics.Debug; using GenericVariance = Internal.Runtime.GenericVariance; namespace ILCompiler.DependencyAnalysis { /// <summary> /// Given a type, EETypeNode writes an MethodTable data structure in the format expected by the runtime. /// /// Format of an MethodTable: /// /// Field Size | Contents /// ----------------+----------------------------------- /// UInt16 | Component Size. For arrays this is the element type size, for strings it is 2 (.NET uses /// | UTF16 character encoding), for generic type definitions it is the number of generic parameters, /// | and 0 for all other types. /// | /// UInt16 | EETypeKind (Normal, Array, Pointer type). Flags for: IsValueType, IsCrossModule, HasPointers, /// | HasOptionalFields, IsInterface, IsGeneric. Top 5 bits are used for enum EETypeElementType to /// | record whether it's back by an Int32, Int16 etc /// | /// Uint32 | Base size. /// | /// [Pointer Size] | Related type. Base type for regular types. Element type for arrays / pointer types. /// | /// UInt16 | Number of VTable slots (X) /// | /// UInt16 | Number of interfaces implemented by type (Y) /// | /// UInt32 | Hash code /// | /// X * [Ptr Size] | VTable entries (optional) /// | /// Y * [Ptr Size] | Pointers to interface map data structures (optional) /// | /// [Relative ptr] | Pointer to containing TypeManager indirection cell /// | /// [Relative ptr] | Pointer to writable data /// | /// [Relative ptr] | Pointer to finalizer method (optional) /// | /// [Relative ptr] | Pointer to optional fields (optional) /// | /// [Relative ptr] | Pointer to the generic type definition MethodTable (optional) /// | /// [Relative ptr] | Pointer to the generic argument and variance info (optional) /// </summary> public partial class EETypeNode : ObjectNode, IEETypeNode, ISymbolDefinitionNode, ISymbolNodeWithLinkage { protected readonly TypeDesc _type; internal readonly EETypeOptionalFieldsBuilder _optionalFieldsBuilder = new EETypeOptionalFieldsBuilder(); internal readonly EETypeOptionalFieldsNode _optionalFieldsNode; protected bool? _mightHaveInterfaceDispatchMap; private bool _hasConditionalDependenciesFromMetadataManager; public EETypeNode(NodeFactory factory, TypeDesc type) { if (type.IsCanonicalDefinitionType(CanonicalFormKind.Any)) Debug.Assert(this is CanonicalDefinitionEETypeNode); else if (type.IsCanonicalSubtype(CanonicalFormKind.Any)) Debug.Assert((this is CanonicalEETypeNode) || (this is NecessaryCanonicalEETypeNode)); Debug.Assert(!type.IsRuntimeDeterminedSubtype); _type = type; _optionalFieldsNode = new EETypeOptionalFieldsNode(this); _hasConditionalDependenciesFromMetadataManager = factory.MetadataManager.HasConditionalDependenciesDueToEETypePresence(type); factory.TypeSystemContext.EnsureLoadableType(type); // We don't have a representation for function pointers right now if (WithoutParameterizeTypes(type).IsFunctionPointer) ThrowHelper.ThrowTypeLoadException(ExceptionStringID.ClassLoadGeneral, type); static TypeDesc WithoutParameterizeTypes(TypeDesc t) => t is ParameterizedType pt ? WithoutParameterizeTypes(pt.ParameterType) : t; } protected bool MightHaveInterfaceDispatchMap(NodeFactory factory) { if (!_mightHaveInterfaceDispatchMap.HasValue) { _mightHaveInterfaceDispatchMap = EmitVirtualSlotsAndInterfaces && InterfaceDispatchMapNode.MightHaveInterfaceDispatchMap(_type, factory); } return _mightHaveInterfaceDispatchMap.Value; } protected override string GetName(NodeFactory factory) => this.GetMangledName(factory.NameMangler); public override bool ShouldSkipEmittingObjectNode(NodeFactory factory) { // If there is a constructed version of this node in the graph, emit that instead if (ConstructedEETypeNode.CreationAllowed(_type)) return factory.ConstructedTypeSymbol(_type).Marked; return false; } public virtual ISymbolNode NodeForLinkage(NodeFactory factory) { return factory.NecessaryTypeSymbol(_type); } public TypeDesc Type => _type; public override ObjectNodeSection Section { get { if (_type.Context.Target.IsWindows) return ObjectNodeSection.ReadOnlyDataSection; else return ObjectNodeSection.DataSection; } } public int MinimumObjectSize => _type.Context.Target.PointerSize * 3; protected virtual bool EmitVirtualSlotsAndInterfaces => false; public override bool InterestingForDynamicDependencyAnalysis { get { if (!EmitVirtualSlotsAndInterfaces) return false; if (_type.IsInterface) return false; if (_type.IsDefType) { // First, check if this type has any GVM that overrides a GVM on a parent type. If that's the case, this makes // the current type interesting for GVM analysis (i.e. instantiate its overriding GVMs for existing GVMDependenciesNodes // of the instantiated GVM on the parent types). foreach (var method in _type.GetAllVirtualMethods()) { Debug.Assert(method.IsVirtual); if (method.HasInstantiation) { MethodDesc slotDecl = MetadataVirtualMethodAlgorithm.FindSlotDefiningMethodForVirtualMethod(method); if (slotDecl != method) return true; } } // Second, check if this type has any GVMs that implement any GVM on any of the implemented interfaces. This would // make the current type interesting for dynamic dependency analysis to that we can instantiate its GVMs. foreach (DefType interfaceImpl in _type.RuntimeInterfaces) { foreach (var method in interfaceImpl.GetAllVirtualMethods()) { Debug.Assert(method.IsVirtual); // Static interface methods don't participate in GVM analysis if (method.Signature.IsStatic) continue; if (method.HasInstantiation) { // We found a GVM on one of the implemented interfaces. Find if the type implements this method. // (Note, do this comparision against the generic definition of the method, not the specific method instantiation MethodDesc genericDefinition = method.GetMethodDefinition(); MethodDesc slotDecl = _type.ResolveInterfaceMethodTarget(genericDefinition); if (slotDecl != null) { // If the type doesn't introduce this interface method implementation (i.e. the same implementation // already exists in the base type), do not consider this type interesting for GVM analysis just yet. // // We need to limit the number of types that are interesting for GVM analysis at all costs since // these all will be looked at for every unique generic virtual method call in the program. // Having a long list of interesting types affects the compilation throughput heavily. if (slotDecl.OwningType == _type || _type.BaseType.ResolveInterfaceMethodTarget(genericDefinition) != slotDecl) { return true; } } else { // The method could be implemented by a default interface method var resolution = _type.ResolveInterfaceMethodToDefaultImplementationOnType(genericDefinition, out slotDecl); if (resolution == DefaultInterfaceMethodResolution.DefaultImplementation) { return true; } } } } } } return false; } } internal bool HasOptionalFields { get { return _optionalFieldsBuilder.IsAtLeastOneFieldUsed(); } } internal byte[] GetOptionalFieldsData() { return _optionalFieldsBuilder.GetBytes(); } public override bool StaticDependenciesAreComputed => true; public static string GetMangledName(TypeDesc type, NameMangler nameMangler) { return nameMangler.NodeMangler.MethodTable(type); } public virtual void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb) { sb.Append(nameMangler.NodeMangler.MethodTable(_type)); } int ISymbolNode.Offset => 0; int ISymbolDefinitionNode.Offset => GCDescSize; public override bool IsShareable => IsTypeNodeShareable(_type); private bool CanonFormTypeMayExist { get { if (!_type.HasInstantiation) return false; if (!_type.Context.SupportsCanon) return false; // If type is already in canon form, a canonically equivalent type cannot exist if (_type.IsCanonicalSubtype(CanonicalFormKind.Any)) return false; // If we reach here, a universal canon variant can exist (if universal canon is supported) if (_type.Context.SupportsUniversalCanon) return true; // Attempt to convert to canon. If the type changes, then the CanonForm exists return (_type.ConvertToCanonForm(CanonicalFormKind.Specific) != _type); } } public sealed override bool HasConditionalStaticDependencies { get { // If the type is can be converted to some interesting canon type, and this is the non-constructed variant of an MethodTable // we may need to trigger the fully constructed type to exist to make the behavior of the type consistent // in reflection and generic template expansion scenarios if (CanonFormTypeMayExist) { return true; } if (!EmitVirtualSlotsAndInterfaces) return false; // Since the vtable is dependency driven, generate conditional static dependencies for // all possible vtable entries. // // The conditional dependencies conditionally add the implementation of the virtual method // if the virtual method is used. foreach (var method in _type.GetClosestDefType().GetAllVirtualMethods()) { // Generic virtual methods are tracked by an orthogonal mechanism. if (!method.HasInstantiation) return true; } // If the type implements at least one interface, calls against that interface could result in this type's // implementation being used. if (_type.RuntimeInterfaces.Length > 0) return true; return _hasConditionalDependenciesFromMetadataManager; } } public sealed override IEnumerable<CombinedDependencyListEntry> GetConditionalStaticDependencies(NodeFactory factory) { List<CombinedDependencyListEntry> result = new List<CombinedDependencyListEntry>(); IEETypeNode maximallyConstructableType = factory.MaximallyConstructableType(_type); if (maximallyConstructableType != this) { // MethodTable upgrading from necessary to constructed if some template instantation exists that matches up // This ensures we don't end up having two EETypes in the system (one is this necessary type, and another one // that was dynamically created at runtime). if (CanonFormTypeMayExist) { result.Add(new CombinedDependencyListEntry(maximallyConstructableType, factory.MaximallyConstructableType(_type.ConvertToCanonForm(CanonicalFormKind.Specific)), "Trigger full type generation if canonical form exists")); if (_type.Context.SupportsUniversalCanon) result.Add(new CombinedDependencyListEntry(maximallyConstructableType, factory.MaximallyConstructableType(_type.ConvertToCanonForm(CanonicalFormKind.Universal)), "Trigger full type generation if universal canonical form exists")); } return result; } if (!EmitVirtualSlotsAndInterfaces) return result; DefType defType = _type.GetClosestDefType(); // If we're producing a full vtable, none of the dependencies are conditional. if (!factory.VTable(defType).HasFixedSlots) { foreach (MethodDesc decl in defType.EnumAllVirtualSlots()) { // Generic virtual methods are tracked by an orthogonal mechanism. if (decl.HasInstantiation) continue; MethodDesc impl = defType.FindVirtualFunctionTargetMethodOnObjectType(decl); if (impl.OwningType == defType && !impl.IsAbstract) { MethodDesc canonImpl = impl.GetCanonMethodTarget(CanonicalFormKind.Specific); IMethodNode implNode = factory.MethodEntrypoint(canonImpl, impl.OwningType.IsValueType); result.Add(new CombinedDependencyListEntry(implNode, factory.VirtualMethodUse(decl), "Virtual method")); } if (impl.OwningType == defType) { factory.MetadataManager.NoteOverridingMethod(decl, impl); } } Debug.Assert( _type == defType || ((System.Collections.IStructuralEquatable)defType.RuntimeInterfaces).Equals(_type.RuntimeInterfaces, EqualityComparer<DefType>.Default)); // Add conditional dependencies for interface methods the type implements. For example, if the type T implements // interface IFoo which has a method M1, add a dependency on T.M1 dependent on IFoo.M1 being called, since it's // possible for any IFoo object to actually be an instance of T. DefType[] defTypeRuntimeInterfaces = defType.RuntimeInterfaces; for (int interfaceIndex = 0; interfaceIndex < defTypeRuntimeInterfaces.Length; interfaceIndex++) { DefType interfaceType = defTypeRuntimeInterfaces[interfaceIndex]; Debug.Assert(interfaceType.IsInterface); bool isVariantInterfaceImpl = VariantInterfaceMethodUseNode.IsVariantInterfaceImplementation(factory, _type, interfaceType); foreach (MethodDesc interfaceMethod in interfaceType.GetAllVirtualMethods()) { // Generic virtual methods are tracked by an orthogonal mechanism. if (interfaceMethod.HasInstantiation) continue; // Static virtual methods are resolved at compile time if (interfaceMethod.Signature.IsStatic) continue; MethodDesc implMethod = defType.ResolveInterfaceMethodToVirtualMethodOnType(interfaceMethod); if (implMethod != null) { result.Add(new CombinedDependencyListEntry(factory.VirtualMethodUse(implMethod), factory.VirtualMethodUse(interfaceMethod), "Interface method")); // If any of the implemented interfaces have variance, calls against compatible interface methods // could result in interface methods of this type being used (e.g. IEnumerable<object>.GetEnumerator() // can dispatch to an implementation of IEnumerable<string>.GetEnumerator()). if (isVariantInterfaceImpl) { MethodDesc typicalInterfaceMethod = interfaceMethod.GetTypicalMethodDefinition(); result.Add(new CombinedDependencyListEntry(factory.VirtualMethodUse(implMethod), factory.VariantInterfaceMethodUse(typicalInterfaceMethod), "Interface method")); result.Add(new CombinedDependencyListEntry(factory.VirtualMethodUse(interfaceMethod), factory.VariantInterfaceMethodUse(typicalInterfaceMethod), "Interface method")); } factory.MetadataManager.NoteOverridingMethod(interfaceMethod, implMethod); } else { // Is the implementation provided by a default interface method? // If so, add a dependency on the entrypoint directly since nobody else is going to do that // (interface types have an empty vtable, modulo their generic dictionary). TypeDesc interfaceOnDefinition = defType.GetTypeDefinition().RuntimeInterfaces[interfaceIndex]; MethodDesc interfaceMethodDefinition = interfaceMethod; if (!interfaceType.IsTypeDefinition) interfaceMethodDefinition = factory.TypeSystemContext.GetMethodForInstantiatedType(interfaceMethod.GetTypicalMethodDefinition(), (InstantiatedType)interfaceOnDefinition); var resolution = defType.GetTypeDefinition().ResolveInterfaceMethodToDefaultImplementationOnType(interfaceMethodDefinition, out implMethod); if (resolution == DefaultInterfaceMethodResolution.DefaultImplementation) { DefType providingInterfaceDefinitionType = (DefType)implMethod.OwningType; implMethod = implMethod.InstantiateSignature(defType.Instantiation, Instantiation.Empty); MethodDesc defaultIntfMethod = implMethod.GetCanonMethodTarget(CanonicalFormKind.Specific); if (defaultIntfMethod.IsCanonicalMethod(CanonicalFormKind.Any)) { defaultIntfMethod = factory.TypeSystemContext.GetDefaultInterfaceMethodImplementationThunk(defaultIntfMethod, _type.ConvertToCanonForm(CanonicalFormKind.Specific), providingInterfaceDefinitionType); } result.Add(new CombinedDependencyListEntry(factory.MethodEntrypoint(defaultIntfMethod), factory.VirtualMethodUse(interfaceMethod), "Interface method")); factory.MetadataManager.NoteOverridingMethod(interfaceMethod, implMethod); } } } } } factory.MetadataManager.GetConditionalDependenciesDueToEETypePresence(ref result, factory, _type); return result; } public static bool IsTypeNodeShareable(TypeDesc type) { return type.IsParameterizedType || type.IsFunctionPointer || type is InstantiatedType; } internal static bool MethodHasNonGenericILMethodBody(MethodDesc method) { // Generic methods have their own generic dictionaries if (method.HasInstantiation) return false; // Abstract methods don't have a body if (method.IsAbstract) return false; // PInvoke methods are not permitted on generic types, // but let's not crash the compilation because of that. if (method.IsPInvoke) return false; // CoreRT can generate method bodies for these no matter what (worst case // they'll be throwing). We don't want to take the "return false" code path on CoreRT because // delegate methods fall into the runtime implemented category on CoreRT, but we // just treat them like regular method bodies. return true; } protected override DependencyList ComputeNonRelocationBasedDependencies(NodeFactory factory) { DependencyList dependencies = new DependencyList(); // Include the optional fields by default. We don't know if optional fields will be needed until // all of the interface usage has been stabilized. If we end up not needing it, the MethodTable node will not // generate any relocs to it, and the optional fields node will instruct the object writer to skip // emitting it. dependencies.Add(new DependencyListEntry(_optionalFieldsNode, "Optional fields")); // TODO-SIZE: We probably don't need to add these for all EETypes StaticsInfoHashtableNode.AddStaticsInfoDependencies(ref dependencies, factory, _type); if (EmitVirtualSlotsAndInterfaces) { if (!_type.IsArrayTypeWithoutGenericInterfaces()) { // Sealed vtables have relative pointers, so to minimize size, we build sealed vtables for the canonical types dependencies.Add(new DependencyListEntry(factory.SealedVTable(_type.ConvertToCanonForm(CanonicalFormKind.Specific)), "Sealed Vtable")); } // Also add the un-normalized vtable slices of implemented interfaces. // This is important to do in the scanning phase so that the compilation phase can find // vtable information for things like IEnumerator<List<__Canon>>. foreach (TypeDesc intface in _type.RuntimeInterfaces) dependencies.Add(factory.VTable(intface), "Interface vtable slice"); // Generated type contains generic virtual methods that will get added to the GVM tables if (TypeGVMEntriesNode.TypeNeedsGVMTableEntries(_type)) { dependencies.Add(new DependencyListEntry(factory.TypeGVMEntries(_type.GetTypeDefinition()), "Type with generic virtual methods")); AddDependenciesForUniversalGVMSupport(factory, _type, ref dependencies); TypeDesc canonicalType = _type.ConvertToCanonForm(CanonicalFormKind.Specific); if (canonicalType != _type) dependencies.Add(factory.ConstructedTypeSymbol(canonicalType), "Type with generic virtual methods"); } } if (factory.CompilationModuleGroup.PresenceOfEETypeImpliesAllMethodsOnType(_type)) { if (_type.IsArray || _type.IsDefType) { // If the compilation group wants this type to be fully promoted, ensure that all non-generic methods of the // type are generated. // This may be done for several reasons: // - The MethodTable may be going to be COMDAT folded with other EETypes generated in a different object file // This means their generic dictionaries need to have identical contents. The only way to achieve that is // by generating the entries for all methods that contribute to the dictionary, and sorting the dictionaries. // - The generic type may be imported into another module, in which case the generic dictionary imported // must represent all of the methods, as the set of used methods cannot be known at compile time // - As a matter of policy, the type and its methods may be exported for use in another module. The policy // may wish to specify that if a type is to be placed into a shared module, all of the methods associated with // it should be also be exported. foreach (var method in _type.GetClosestDefType().ConvertToCanonForm(CanonicalFormKind.Specific).GetAllMethods()) { if (!MethodHasNonGenericILMethodBody(method)) continue; dependencies.Add(factory.MethodEntrypoint(method.GetCanonMethodTarget(CanonicalFormKind.Specific)), "Ensure all methods on type due to CompilationModuleGroup policy"); } } } if (!ConstructedEETypeNode.CreationAllowed(_type)) { // If necessary MethodTable is the highest load level for this type, ask the metadata manager // if we have any dependencies due to reflectability. factory.MetadataManager.GetDependenciesDueToReflectability(ref dependencies, factory, _type); // If necessary MethodTable is the highest load level, consider this a module use if (_type is MetadataType mdType && mdType.Module.GetGlobalModuleType().GetStaticConstructor() is MethodDesc moduleCctor) { dependencies.Add(factory.MethodEntrypoint(moduleCctor), "Type in a module with initializer"); } } return dependencies; } public override ObjectData GetData(NodeFactory factory, bool relocsOnly) { ObjectDataBuilder objData = new ObjectDataBuilder(factory, relocsOnly); objData.RequireInitialPointerAlignment(); objData.AddSymbol(this); ComputeOptionalEETypeFields(factory, relocsOnly); OutputGCDesc(ref objData); OutputComponentSize(ref objData); OutputFlags(factory, ref objData); objData.EmitInt(BaseSize); OutputRelatedType(factory, ref objData); // Number of vtable slots will be only known later. Reseve the bytes for it. var vtableSlotCountReservation = objData.ReserveShort(); // Number of interfaces will only be known later. Reserve the bytes for it. var interfaceCountReservation = objData.ReserveShort(); objData.EmitInt(_type.GetHashCode()); if (EmitVirtualSlotsAndInterfaces) { // Emit VTable Debug.Assert(objData.CountBytes - ((ISymbolDefinitionNode)this).Offset == GetVTableOffset(objData.TargetPointerSize)); SlotCounter virtualSlotCounter = SlotCounter.BeginCounting(ref /* readonly */ objData); OutputVirtualSlots(factory, ref objData, _type, _type, _type, relocsOnly); // Update slot count int numberOfVtableSlots = virtualSlotCounter.CountSlots(ref /* readonly */ objData); objData.EmitShort(vtableSlotCountReservation, checked((short)numberOfVtableSlots)); // Emit interface map SlotCounter interfaceSlotCounter = SlotCounter.BeginCounting(ref /* readonly */ objData); OutputInterfaceMap(factory, ref objData); // Update slot count int numberOfInterfaceSlots = interfaceSlotCounter.CountSlots(ref /* readonly */ objData); objData.EmitShort(interfaceCountReservation, checked((short)numberOfInterfaceSlots)); } else { // If we're not emitting any slots, the number of slots is zero. objData.EmitShort(vtableSlotCountReservation, 0); objData.EmitShort(interfaceCountReservation, 0); } OutputTypeManagerIndirection(factory, ref objData); OutputWritableData(factory, ref objData); OutputFinalizerMethod(factory, ref objData); OutputOptionalFields(factory, ref objData); OutputSealedVTable(factory, relocsOnly, ref objData); OutputGenericInstantiationDetails(factory, ref objData); return objData.ToObjectData(); } /// <summary> /// Returns the offset within an MethodTable of the beginning of VTable entries /// </summary> /// <param name="pointerSize">The size of a pointer in bytes in the target architecture</param> public static int GetVTableOffset(int pointerSize) { return 16 + pointerSize; } protected virtual int GCDescSize => 0; protected virtual void OutputGCDesc(ref ObjectDataBuilder builder) { // Non-constructed EETypeNodes get no GC Desc Debug.Assert(GCDescSize == 0); } private void OutputComponentSize(ref ObjectDataBuilder objData) { if (_type.IsArray) { TypeDesc elementType = ((ArrayType)_type).ElementType; if (elementType == elementType.Context.UniversalCanonType) { objData.EmitShort(0); } else { int elementSize = elementType.GetElementSize().AsInt; // We validated that this will fit the short when the node was constructed. No need for nice messages. objData.EmitShort((short)checked((ushort)elementSize)); } } else if (_type.IsString) { objData.EmitShort(StringComponentSize.Value); } else { objData.EmitShort(0); } } private void OutputFlags(NodeFactory factory, ref ObjectDataBuilder objData) { UInt16 flags = EETypeBuilderHelpers.ComputeFlags(_type); if (_type.GetTypeDefinition() == factory.ArrayOfTEnumeratorType) { // Generic array enumerators use special variance rules recognized by the runtime flags |= (UInt16)EETypeFlags.GenericVarianceFlag; } if (factory.TypeSystemContext.IsGenericArrayInterfaceType(_type)) { // Runtime casting logic relies on all interface types implemented on arrays // to have the variant flag set (even if all the arguments are non-variant). // This supports e.g. casting uint[] to ICollection<int> flags |= (UInt16)EETypeFlags.GenericVarianceFlag; } if (_type.IsIDynamicInterfaceCastable) { flags |= (UInt16)EETypeFlags.IDynamicInterfaceCastableFlag; } ISymbolNode relatedTypeNode = GetRelatedTypeNode(factory); // If the related type (base type / array element type / pointee type) is not part of this compilation group, and // the output binaries will be multi-file (not multiple object files linked together), indicate to the runtime // that it should indirect through the import address table if (relatedTypeNode != null && relatedTypeNode.RepresentsIndirectionCell) { flags |= (UInt16)EETypeFlags.RelatedTypeViaIATFlag; } if (HasOptionalFields) { flags |= (UInt16)EETypeFlags.OptionalFieldsFlag; } if (this is ClonedConstructedEETypeNode) { flags |= (UInt16)EETypeKind.ClonedEEType; } objData.EmitShort((short)flags); } protected virtual int BaseSize { get { int pointerSize = _type.Context.Target.PointerSize; int objectSize; if (_type.IsDefType) { LayoutInt instanceByteCount = ((DefType)_type).InstanceByteCount; if (instanceByteCount.IsIndeterminate) { // Some value must be put in, but the specific value doesn't matter as it // isn't used for specific instantiations, and the universal canon MethodTable // is never associated with an allocated object. objectSize = pointerSize; } else { objectSize = pointerSize + ((DefType)_type).InstanceByteCount.AsInt; // +pointerSize for SyncBlock } if (_type.IsValueType) objectSize += pointerSize; // + EETypePtr field inherited from System.Object } else if (_type.IsArray) { objectSize = 3 * pointerSize; // SyncBlock + EETypePtr + Length if (_type.IsMdArray) objectSize += 2 * sizeof(int) * ((ArrayType)_type).Rank; } else if (_type.IsPointer) { // These never get boxed and don't have a base size. Use a sentinel value recognized by the runtime. return ParameterizedTypeShapeConstants.Pointer; } else if (_type.IsByRef) { // These never get boxed and don't have a base size. Use a sentinel value recognized by the runtime. return ParameterizedTypeShapeConstants.ByRef; } else throw new NotImplementedException(); objectSize = AlignmentHelper.AlignUp(objectSize, pointerSize); objectSize = Math.Max(MinimumObjectSize, objectSize); if (_type.IsString) { // If this is a string, throw away objectSize we computed so far. Strings are special. // SyncBlock + EETypePtr + length + firstChar objectSize = 2 * pointerSize + sizeof(int) + StringComponentSize.Value; } return objectSize; } } protected virtual ISymbolNode GetBaseTypeNode(NodeFactory factory) { return _type.BaseType != null ? factory.NecessaryTypeSymbol(_type.BaseType) : null; } private ISymbolNode GetRelatedTypeNode(NodeFactory factory) { ISymbolNode relatedTypeNode = null; if (_type.IsArray || _type.IsPointer || _type.IsByRef) { var parameterType = ((ParameterizedType)_type).ParameterType; relatedTypeNode = factory.NecessaryTypeSymbol(parameterType); } else { TypeDesc baseType = _type.BaseType; if (baseType != null) { relatedTypeNode = GetBaseTypeNode(factory); } } return relatedTypeNode; } protected virtual void OutputRelatedType(NodeFactory factory, ref ObjectDataBuilder objData) { ISymbolNode relatedTypeNode = GetRelatedTypeNode(factory); if (relatedTypeNode != null) { objData.EmitPointerReloc(relatedTypeNode); } else { objData.EmitZeroPointer(); } } private void OutputVirtualSlots(NodeFactory factory, ref ObjectDataBuilder objData, TypeDesc implType, TypeDesc declType, TypeDesc templateType, bool relocsOnly) { Debug.Assert(EmitVirtualSlotsAndInterfaces); declType = declType.GetClosestDefType(); templateType = templateType.ConvertToCanonForm(CanonicalFormKind.Specific); var baseType = declType.BaseType; if (baseType != null) { Debug.Assert(templateType.BaseType != null); OutputVirtualSlots(factory, ref objData, implType, baseType, templateType.BaseType, relocsOnly); } // // In the universal canonical types case, we could have base types in the hierarchy that are partial universal canonical types. // The presence of these types could cause incorrect vtable layouts, so we need to fully canonicalize them and walk the // hierarchy of the template type of the original input type to detect these cases. // // Exmaple: we begin with Derived<__UniversalCanon> and walk the template hierarchy: // // class Derived<T> : Middle<T, MyStruct> { } // -> Template is Derived<__UniversalCanon> and needs a dictionary slot // // -> Basetype tempalte is Middle<__UniversalCanon, MyStruct>. It's a partial // Universal canonical type, so we need to fully canonicalize it. // // class Middle<T, U> : Base<U> { } // -> Template is Middle<__UniversalCanon, __UniversalCanon> and needs a dictionary slot // // -> Basetype template is Base<__UniversalCanon> // // class Base<T> { } // -> Template is Base<__UniversalCanon> and needs a dictionary slot. // // If we had not fully canonicalized the Middle class template, we would have ended up with Base<MyStruct>, which does not need // a dictionary slot, meaning we would have created a vtable layout that the runtime does not expect. // // The generic dictionary pointer occupies the first slot of each type vtable slice if (declType.HasGenericDictionarySlot() || templateType.HasGenericDictionarySlot()) { // All generic interface types have a dictionary slot, but only some of them have an actual dictionary. bool isInterfaceWithAnEmptySlot = declType.IsInterface && declType.ConvertToCanonForm(CanonicalFormKind.Specific) == declType; // Note: Canonical type instantiations always have a generic dictionary vtable slot, but it's empty // Note: If the current EETypeNode represents a universal canonical type, any dictionary slot must be empty if (declType.IsCanonicalSubtype(CanonicalFormKind.Any) || implType.IsCanonicalSubtype(CanonicalFormKind.Universal) || factory.LazyGenericsPolicy.UsesLazyGenerics(declType) || isInterfaceWithAnEmptySlot) objData.EmitZeroPointer(); else objData.EmitPointerReloc(factory.TypeGenericDictionary(declType)); } VTableSliceNode declVTable = factory.VTable(declType); // It's only okay to touch the actual list of slots if we're in the final emission phase // or the vtable is not built lazily. if (relocsOnly && !declVTable.HasFixedSlots) return; // Inteface types don't place anything else in their physical vtable. // Interfaces have logical slots for their methods but since they're all abstract, they would be zero. // We place default implementations of interface methods into the vtable of the interface-implementing // type, pretending there was an extra virtual slot. if (_type.IsInterface) return; // Actual vtable slots follow IReadOnlyList<MethodDesc> virtualSlots = declVTable.Slots; for (int i = 0; i < virtualSlots.Count; i++) { MethodDesc declMethod = virtualSlots[i]; // Object.Finalize shouldn't get a virtual slot. Finalizer is stored in an optional field // instead: most MethodTable don't have a finalizer, but all EETypes contain Object's vtable. // This lets us save a pointer (+reloc) on most EETypes. Debug.Assert(!declType.IsObject || declMethod.Name != "Finalize"); // No generic virtual methods can appear in the vtable! Debug.Assert(!declMethod.HasInstantiation); MethodDesc implMethod = implType.GetClosestDefType().FindVirtualFunctionTargetMethodOnObjectType(declMethod); // Final NewSlot methods cannot be overridden, and therefore can be placed in the sealed-vtable to reduce the size of the vtable // of this type and any type that inherits from it. if (declMethod.CanMethodBeInSealedVTable() && !declType.IsArrayTypeWithoutGenericInterfaces()) continue; if (!implMethod.IsAbstract) { MethodDesc canonImplMethod = implMethod.GetCanonMethodTarget(CanonicalFormKind.Specific); objData.EmitPointerReloc(factory.MethodEntrypoint(canonImplMethod, implMethod.OwningType.IsValueType)); } else { objData.EmitZeroPointer(); } } } protected virtual IEETypeNode GetInterfaceTypeNode(NodeFactory factory, TypeDesc interfaceType) { return factory.NecessaryTypeSymbol(interfaceType); } protected virtual void OutputInterfaceMap(NodeFactory factory, ref ObjectDataBuilder objData) { Debug.Assert(EmitVirtualSlotsAndInterfaces); foreach (var itf in _type.RuntimeInterfaces) { objData.EmitPointerRelocOrIndirectionReference(GetInterfaceTypeNode(factory, itf)); } } private void OutputFinalizerMethod(NodeFactory factory, ref ObjectDataBuilder objData) { if (_type.HasFinalizer) { MethodDesc finalizerMethod = _type.GetFinalizer(); MethodDesc canonFinalizerMethod = finalizerMethod.GetCanonMethodTarget(CanonicalFormKind.Specific); if (factory.Target.SupportsRelativePointers) objData.EmitReloc(factory.MethodEntrypoint(canonFinalizerMethod), RelocType.IMAGE_REL_BASED_RELPTR32); else objData.EmitPointerReloc(factory.MethodEntrypoint(canonFinalizerMethod)); } } protected void OutputTypeManagerIndirection(NodeFactory factory, ref ObjectDataBuilder objData) { if (factory.Target.SupportsRelativePointers) objData.EmitReloc(factory.TypeManagerIndirection, RelocType.IMAGE_REL_BASED_RELPTR32); else objData.EmitPointerReloc(factory.TypeManagerIndirection); } protected void OutputWritableData(NodeFactory factory, ref ObjectDataBuilder objData) { if (factory.Target.SupportsRelativePointers) { Utf8StringBuilder writableDataBlobName = new Utf8StringBuilder(); writableDataBlobName.Append("__writableData"); writableDataBlobName.Append(factory.NameMangler.GetMangledTypeName(_type)); BlobNode blob = factory.UninitializedWritableDataBlob(writableDataBlobName.ToUtf8String(), WritableData.GetSize(factory.Target.PointerSize), WritableData.GetAlignment(factory.Target.PointerSize)); objData.EmitReloc(blob, RelocType.IMAGE_REL_BASED_RELPTR32); } } protected void OutputOptionalFields(NodeFactory factory, ref ObjectDataBuilder objData) { if (HasOptionalFields) { if (factory.Target.SupportsRelativePointers) objData.EmitReloc(_optionalFieldsNode, RelocType.IMAGE_REL_BASED_RELPTR32); else objData.EmitPointerReloc(_optionalFieldsNode); } } private void OutputSealedVTable(NodeFactory factory, bool relocsOnly, ref ObjectDataBuilder objData) { if (EmitVirtualSlotsAndInterfaces && !_type.IsArrayTypeWithoutGenericInterfaces()) { // Sealed vtables have relative pointers, so to minimize size, we build sealed vtables for the canonical types SealedVTableNode sealedVTable = factory.SealedVTable(_type.ConvertToCanonForm(CanonicalFormKind.Specific)); if (sealedVTable.BuildSealedVTableSlots(factory, relocsOnly) && sealedVTable.NumSealedVTableEntries > 0) { if (factory.Target.SupportsRelativePointers) objData.EmitReloc(sealedVTable, RelocType.IMAGE_REL_BASED_RELPTR32); else objData.EmitPointerReloc(sealedVTable); } } } private void OutputGenericInstantiationDetails(NodeFactory factory, ref ObjectDataBuilder objData) { if (_type.HasInstantiation && !_type.IsTypeDefinition) { IEETypeNode typeDefNode = factory.NecessaryTypeSymbol(_type.GetTypeDefinition()); if (factory.Target.SupportsRelativePointers) objData.EmitRelativeRelocOrIndirectionReference(typeDefNode); else objData.EmitPointerRelocOrIndirectionReference(typeDefNode); GenericCompositionDetails details; if (_type.GetTypeDefinition() == factory.ArrayOfTEnumeratorType) { // Generic array enumerators use special variance rules recognized by the runtime details = new GenericCompositionDetails(_type.Instantiation, new[] { GenericVariance.ArrayCovariant }); } else if (factory.TypeSystemContext.IsGenericArrayInterfaceType(_type)) { // Runtime casting logic relies on all interface types implemented on arrays // to have the variant flag set (even if all the arguments are non-variant). // This supports e.g. casting uint[] to ICollection<int> details = new GenericCompositionDetails(_type, forceVarianceInfo: true); } else details = new GenericCompositionDetails(_type); ISymbolNode compositionNode = factory.GenericComposition(details); if (factory.Target.SupportsRelativePointers) objData.EmitReloc(compositionNode, RelocType.IMAGE_REL_BASED_RELPTR32); else objData.EmitPointerReloc(compositionNode); } } /// <summary> /// Populate the OptionalFieldsRuntimeBuilder if any optional fields are required. /// </summary> protected internal virtual void ComputeOptionalEETypeFields(NodeFactory factory, bool relocsOnly) { if (!relocsOnly && MightHaveInterfaceDispatchMap(factory)) { _optionalFieldsBuilder.SetFieldValue(EETypeOptionalFieldTag.DispatchMap, checked((uint)factory.InterfaceDispatchMapIndirection(Type).IndexFromBeginningOfArray)); } ComputeRareFlags(factory, relocsOnly); ComputeNullableValueOffset(); ComputeValueTypeFieldPadding(); } void ComputeRareFlags(NodeFactory factory, bool relocsOnly) { uint flags = 0; MetadataType metadataType = _type as MetadataType; if (factory.PreinitializationManager.HasLazyStaticConstructor(_type)) { flags |= (uint)EETypeRareFlags.HasCctorFlag; } if (_type.RequiresAlign8()) { flags |= (uint)EETypeRareFlags.RequiresAlign8Flag; } TargetArchitecture targetArch = _type.Context.Target.Architecture; if (metadataType != null && (targetArch == TargetArchitecture.ARM || targetArch == TargetArchitecture.ARM64) && metadataType.IsHomogeneousAggregate) { flags |= (uint)EETypeRareFlags.IsHFAFlag; } if (metadataType != null && !_type.IsInterface && metadataType.IsAbstract) { flags |= (uint)EETypeRareFlags.IsAbstractClassFlag; } if (_type.IsByRefLike) { flags |= (uint)EETypeRareFlags.IsByRefLikeFlag; } if (EmitVirtualSlotsAndInterfaces && !_type.IsArrayTypeWithoutGenericInterfaces()) { SealedVTableNode sealedVTable = factory.SealedVTable(_type.ConvertToCanonForm(CanonicalFormKind.Specific)); if (sealedVTable.BuildSealedVTableSlots(factory, relocsOnly) && sealedVTable.NumSealedVTableEntries > 0) flags |= (uint)EETypeRareFlags.HasSealedVTableEntriesFlag; } if (flags != 0) { _optionalFieldsBuilder.SetFieldValue(EETypeOptionalFieldTag.RareFlags, flags); } } /// <summary> /// To support boxing / unboxing, the offset of the value field of a Nullable type is recorded on the MethodTable. /// This is variable according to the alignment requirements of the Nullable&lt;T&gt; type parameter. /// </summary> void ComputeNullableValueOffset() { if (!_type.IsNullable) return; if (!_type.Instantiation[0].IsCanonicalSubtype(CanonicalFormKind.Universal)) { var field = _type.GetKnownField("value"); // In the definition of Nullable<T>, the first field should be the boolean representing "hasValue" Debug.Assert(field.Offset.AsInt > 0); // The contract with the runtime states the Nullable value offset is stored with the boolean "hasValue" size subtracted // to get a small encoding size win. _optionalFieldsBuilder.SetFieldValue(EETypeOptionalFieldTag.NullableValueOffset, (uint)field.Offset.AsInt - 1); } } protected virtual void ComputeValueTypeFieldPadding() { // All objects that can have appreciable which can be derived from size compute ValueTypeFieldPadding. // Unfortunately, the name ValueTypeFieldPadding is now wrong to avoid integration conflicts. // Interfaces, sealed types, and non-DefTypes cannot be derived from if (_type.IsInterface || !_type.IsDefType || (_type.IsSealed() && !_type.IsValueType)) return; DefType defType = _type as DefType; Debug.Assert(defType != null); uint valueTypeFieldPaddingEncoded; if (defType.InstanceByteCount.IsIndeterminate) { valueTypeFieldPaddingEncoded = EETypeBuilderHelpers.ComputeValueTypeFieldPaddingFieldValue(0, 1, _type.Context.Target.PointerSize); } else { int numInstanceFieldBytes = defType.InstanceByteCountUnaligned.AsInt; // Check if we have a type derived from System.ValueType or System.Enum, but not System.Enum itself if (defType.IsValueType) { // Value types should have at least 1 byte of size Debug.Assert(numInstanceFieldBytes >= 1); // The size doesn't currently include the MethodTable pointer size. We need to add this so that // the number of instance field bytes consistently represents the boxed size. numInstanceFieldBytes += _type.Context.Target.PointerSize; } // For unboxing to work correctly and for supporting dynamic type loading for derived types we need // to record the actual size of the fields of a type without any padding for GC heap allocation (since // we can unbox into locals or arrays where this padding is not used, and because field layout for derived // types is effected by the unaligned base size). We don't want to store this information for all EETypes // since it's only relevant for value types, and derivable types so it's added as an optional field. It's // also enough to simply store the size of the padding (between 0 and 4 or 8 bytes for 32-bit and 0 and 8 or 16 bytes // for 64-bit) which cuts down our storage requirements. uint valueTypeFieldPadding = checked((uint)((BaseSize - _type.Context.Target.PointerSize) - numInstanceFieldBytes)); valueTypeFieldPaddingEncoded = EETypeBuilderHelpers.ComputeValueTypeFieldPaddingFieldValue(valueTypeFieldPadding, (uint)defType.InstanceFieldAlignment.AsInt, _type.Context.Target.PointerSize); } if (valueTypeFieldPaddingEncoded != 0) { _optionalFieldsBuilder.SetFieldValue(EETypeOptionalFieldTag.ValueTypeFieldPadding, valueTypeFieldPaddingEncoded); } } protected override void OnMarked(NodeFactory context) { if (!context.IsCppCodegenTemporaryWorkaround) { Debug.Assert(_type.IsTypeDefinition || !_type.HasSameTypeDefinition(context.ArrayOfTClass), "Asking for Array<T> MethodTable"); } } public static void AddDependenciesForStaticsNode(NodeFactory factory, TypeDesc type, ref DependencyList dependencies) { // To ensure that the behvior of FieldInfo.GetValue/SetValue remains correct, // if a type may be reflectable, and it is generic, if a canonical instantiation of reflection // can exist which can refer to the associated type of this static base, ensure that type // has an MethodTable. (Which will allow the static field lookup logic to find the right type) if (type.HasInstantiation && !factory.MetadataManager.IsReflectionBlocked(type)) { // TODO-SIZE: This current implementation is slightly generous, as it does not attempt to restrict // the created types to the maximum extent by investigating reflection data and such. Here we just // check if we support use of a canonically equivalent type to perform reflection. // We don't check to see if reflection is enabled on the type. if (factory.TypeSystemContext.SupportsUniversalCanon || (factory.TypeSystemContext.SupportsCanon && (type != type.ConvertToCanonForm(CanonicalFormKind.Specific)))) { if (dependencies == null) dependencies = new DependencyList(); dependencies.Add(factory.NecessaryTypeSymbol(type), "Static block owning type is necessary for canonically equivalent reflection"); } } } protected static void AddDependenciesForUniversalGVMSupport(NodeFactory factory, TypeDesc type, ref DependencyList dependencies) { if (factory.TypeSystemContext.SupportsUniversalCanon) { foreach (MethodDesc method in type.GetVirtualMethods()) { if (!method.HasInstantiation) continue; if (method.IsAbstract) continue; TypeDesc[] universalCanonArray = new TypeDesc[method.Instantiation.Length]; for (int i = 0; i < universalCanonArray.Length; i++) universalCanonArray[i] = factory.TypeSystemContext.UniversalCanonType; MethodDesc universalCanonMethodNonCanonicalized = method.MakeInstantiatedMethod(new Instantiation(universalCanonArray)); MethodDesc universalCanonGVMMethod = universalCanonMethodNonCanonicalized.GetCanonMethodTarget(CanonicalFormKind.Universal); if (dependencies == null) dependencies = new DependencyList(); dependencies.Add(new DependencyListEntry(factory.MethodEntrypoint(universalCanonGVMMethod), "USG GVM Method")); } } } public override int ClassCode => 1521789141; public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return comparer.Compare(_type, ((EETypeNode)other)._type); } public override string ToString() { return _type.ToString(); } private struct SlotCounter { private int _startBytes; public static SlotCounter BeginCounting(ref /* readonly */ ObjectDataBuilder builder) => new SlotCounter { _startBytes = builder.CountBytes }; public int CountSlots(ref /* readonly */ ObjectDataBuilder builder) { int bytesEmitted = builder.CountBytes - _startBytes; Debug.Assert(bytesEmitted % builder.TargetPointerSize == 0); return bytesEmitted / builder.TargetPointerSize; } } } }
1
dotnet/runtime
66,145
Fix clash between tentative method optimizations
This pull request pretty much became a rollback of https://github.com/dotnet/runtimelab/pull/658 with a regression test to make sure if https://github.com/dotnet/runtimelab/pull/658 is reintroduced, we do it properly. ~~When we were in the situation of the newly added test, we would try to generate method body on the abstract class. Such method body is not actually reachable.~~ ~~Saves 500 bytes on a hello world. Fixes a compiler assert (that might be more serious sometimes).~~
MichalStrehovsky
2022-03-03T16:32:47Z
2022-03-07T16:49:51Z
154386d63b3ba55ce3251fa4caf3dfa89279d982
b0d1e89497bfa7a7b602a1d1af2faa97af96c88d
Fix clash between tentative method optimizations. This pull request pretty much became a rollback of https://github.com/dotnet/runtimelab/pull/658 with a regression test to make sure if https://github.com/dotnet/runtimelab/pull/658 is reintroduced, we do it properly. ~~When we were in the situation of the newly added test, we would try to generate method body on the abstract class. Such method body is not actually reachable.~~ ~~Saves 500 bytes on a hello world. Fixes a compiler assert (that might be more serious sometimes).~~
./src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/FrozenStringNode.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Generic; using Internal.Text; using Internal.TypeSystem; namespace ILCompiler.DependencyAnalysis { public class FrozenStringNode : EmbeddedObjectNode, ISymbolDefinitionNode { private string _data; private int _syncBlockSize; public FrozenStringNode(string data, TargetDetails target) { _data = data; _syncBlockSize = target.PointerSize; } public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb) { sb.Append(nameMangler.CompilationUnitPrefix).Append("__Str_").Append(nameMangler.GetMangledStringName(_data)); } public override bool StaticDependenciesAreComputed => true; int ISymbolNode.Offset => 0; int ISymbolDefinitionNode.Offset { get { // The frozen string symbol points at the MethodTable portion of the object, skipping over the sync block return OffsetFromBeginningOfArray + _syncBlockSize; } } private static IEETypeNode GetEETypeNode(NodeFactory factory) { DefType systemStringType = factory.TypeSystemContext.GetWellKnownType(WellKnownType.String); // // The GC requires a direct reference to frozen objects' EETypes. If System.String will be compiled into a separate // binary, it must be cloned into this one. // IEETypeNode stringSymbol = factory.ConstructedTypeSymbol(systemStringType); if (stringSymbol.RepresentsIndirectionCell) { return factory.ConstructedClonedTypeSymbol(systemStringType); } else { return stringSymbol; } } public override void EncodeData(ref ObjectDataBuilder dataBuilder, NodeFactory factory, bool relocsOnly) { dataBuilder.EmitZeroPointer(); // Sync block dataBuilder.EmitPointerReloc(GetEETypeNode(factory)); dataBuilder.EmitInt(_data.Length); foreach (char c in _data) { dataBuilder.EmitShort((short)c); } // Null-terminate for friendliness with interop dataBuilder.EmitShort(0); } protected override string GetName(NodeFactory factory) => this.GetMangledName(factory.NameMangler); public override IEnumerable<DependencyListEntry> GetStaticDependencies(NodeFactory factory) { return new DependencyListEntry[] { new DependencyListEntry(GetEETypeNode(factory), "Frozen string literal MethodTable"), }; } protected override void OnMarked(NodeFactory factory) { factory.FrozenSegmentRegion.AddEmbeddedObject(this); } public override int ClassCode => -1733946122; public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return string.CompareOrdinal(_data, ((FrozenStringNode)other)._data); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Generic; using Internal.Text; using Internal.TypeSystem; namespace ILCompiler.DependencyAnalysis { public class FrozenStringNode : EmbeddedObjectNode, ISymbolDefinitionNode { private string _data; private int _syncBlockSize; public FrozenStringNode(string data, TargetDetails target) { _data = data; _syncBlockSize = target.PointerSize; } public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb) { sb.Append(nameMangler.CompilationUnitPrefix).Append("__Str_").Append(nameMangler.GetMangledStringName(_data)); } public override bool StaticDependenciesAreComputed => true; int ISymbolNode.Offset => 0; int ISymbolDefinitionNode.Offset { get { // The frozen string symbol points at the MethodTable portion of the object, skipping over the sync block return OffsetFromBeginningOfArray + _syncBlockSize; } } private static IEETypeNode GetEETypeNode(NodeFactory factory) { DefType systemStringType = factory.TypeSystemContext.GetWellKnownType(WellKnownType.String); // // The GC requires a direct reference to frozen objects' EETypes. If System.String will be compiled into a separate // binary, it must be cloned into this one. // IEETypeNode stringSymbol = factory.ConstructedTypeSymbol(systemStringType); if (stringSymbol.RepresentsIndirectionCell) { return factory.ConstructedClonedTypeSymbol(systemStringType); } else { return stringSymbol; } } public override void EncodeData(ref ObjectDataBuilder dataBuilder, NodeFactory factory, bool relocsOnly) { dataBuilder.EmitZeroPointer(); // Sync block dataBuilder.EmitPointerReloc(GetEETypeNode(factory)); dataBuilder.EmitInt(_data.Length); foreach (char c in _data) { dataBuilder.EmitShort((short)c); } // Null-terminate for friendliness with interop dataBuilder.EmitShort(0); } protected override string GetName(NodeFactory factory) => this.GetMangledName(factory.NameMangler); public override IEnumerable<DependencyListEntry> GetStaticDependencies(NodeFactory factory) { return new DependencyListEntry[] { new DependencyListEntry(GetEETypeNode(factory), "Frozen string literal MethodTable"), }; } protected override void OnMarked(NodeFactory factory) { factory.FrozenSegmentRegion.AddEmbeddedObject(this); } public override int ClassCode => -1733946122; public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return string.CompareOrdinal(_data, ((FrozenStringNode)other)._data); } public override string ToString() => $"\"{_data}\""; } }
1
dotnet/runtime
66,145
Fix clash between tentative method optimizations
This pull request pretty much became a rollback of https://github.com/dotnet/runtimelab/pull/658 with a regression test to make sure if https://github.com/dotnet/runtimelab/pull/658 is reintroduced, we do it properly. ~~When we were in the situation of the newly added test, we would try to generate method body on the abstract class. Such method body is not actually reachable.~~ ~~Saves 500 bytes on a hello world. Fixes a compiler assert (that might be more serious sometimes).~~
MichalStrehovsky
2022-03-03T16:32:47Z
2022-03-07T16:49:51Z
154386d63b3ba55ce3251fa4caf3dfa89279d982
b0d1e89497bfa7a7b602a1d1af2faa97af96c88d
Fix clash between tentative method optimizations. This pull request pretty much became a rollback of https://github.com/dotnet/runtimelab/pull/658 with a regression test to make sure if https://github.com/dotnet/runtimelab/pull/658 is reintroduced, we do it properly. ~~When we were in the situation of the newly added test, we would try to generate method body on the abstract class. Such method body is not actually reachable.~~ ~~Saves 500 bytes on a hello world. Fixes a compiler assert (that might be more serious sometimes).~~
./src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/NodeFactory.cs
// 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.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.Text; using ILCompiler.DependencyAnalysisFramework; using Internal.IL; using Internal.Runtime; using Internal.Text; using Internal.TypeSystem; namespace ILCompiler.DependencyAnalysis { public abstract partial class NodeFactory { private TargetDetails _target; private CompilerTypeSystemContext _context; private CompilationModuleGroup _compilationModuleGroup; private VTableSliceProvider _vtableSliceProvider; private DictionaryLayoutProvider _dictionaryLayoutProvider; protected readonly ImportedNodeProvider _importedNodeProvider; private bool _markingComplete; public NodeFactory( CompilerTypeSystemContext context, CompilationModuleGroup compilationModuleGroup, MetadataManager metadataManager, InteropStubManager interoptStubManager, NameMangler nameMangler, LazyGenericsPolicy lazyGenericsPolicy, VTableSliceProvider vtableSliceProvider, DictionaryLayoutProvider dictionaryLayoutProvider, ImportedNodeProvider importedNodeProvider, PreinitializationManager preinitializationManager) { _target = context.Target; _context = context; _compilationModuleGroup = compilationModuleGroup; _vtableSliceProvider = vtableSliceProvider; _dictionaryLayoutProvider = dictionaryLayoutProvider; NameMangler = nameMangler; InteropStubManager = interoptStubManager; CreateNodeCaches(); MetadataManager = metadataManager; LazyGenericsPolicy = lazyGenericsPolicy; _importedNodeProvider = importedNodeProvider; InterfaceDispatchCellSection = new InterfaceDispatchCellSectionNode(this); PreinitializationManager = preinitializationManager; } public void SetMarkingComplete() { _markingComplete = true; } public bool MarkingComplete => _markingComplete; public TargetDetails Target { get { return _target; } } public LazyGenericsPolicy LazyGenericsPolicy { get; } public CompilationModuleGroup CompilationModuleGroup { get { return _compilationModuleGroup; } } public CompilerTypeSystemContext TypeSystemContext { get { return _context; } } public MetadataManager MetadataManager { get; } public NameMangler NameMangler { get; } public PreinitializationManager PreinitializationManager { get; } public InteropStubManager InteropStubManager { get; } // Temporary workaround that is used to disable certain features from lighting up // in CppCodegen because they're not fully implemented yet. public virtual bool IsCppCodegenTemporaryWorkaround { get { return false; } } /// <summary> /// Return true if the type is not permitted by the rules of the runtime to have an MethodTable. /// The implementation here is not intended to be complete, but represents many conditions /// which make a type ineligible to be an MethodTable. (This function is intended for use in assertions only) /// </summary> private bool TypeCannotHaveEEType(TypeDesc type) { if (!IsCppCodegenTemporaryWorkaround && type.GetTypeDefinition() is INonEmittableType) return true; if (type.IsRuntimeDeterminedSubtype) return true; if (type.IsSignatureVariable) return true; if (type.IsGenericParameter) return true; return false; } protected struct NodeCache<TKey, TValue> { private Func<TKey, TValue> _creator; private ConcurrentDictionary<TKey, TValue> _cache; public NodeCache(Func<TKey, TValue> creator, IEqualityComparer<TKey> comparer) { _creator = creator; _cache = new ConcurrentDictionary<TKey, TValue>(comparer); } public NodeCache(Func<TKey, TValue> creator) { _creator = creator; _cache = new ConcurrentDictionary<TKey, TValue>(); } public TValue GetOrAdd(TKey key) { return _cache.GetOrAdd(key, _creator); } public TValue GetOrAdd(TKey key, Func<TKey, TValue> creator) { return _cache.GetOrAdd(key, creator); } } private void CreateNodeCaches() { _typeSymbols = new NodeCache<TypeDesc, IEETypeNode>(CreateNecessaryTypeNode); _constructedTypeSymbols = new NodeCache<TypeDesc, IEETypeNode>(CreateConstructedTypeNode); _clonedTypeSymbols = new NodeCache<TypeDesc, IEETypeNode>((TypeDesc type) => { // Only types that reside in other binaries should be cloned Debug.Assert(_compilationModuleGroup.ShouldReferenceThroughImportTable(type)); return new ClonedConstructedEETypeNode(this, type); }); _importedTypeSymbols = new NodeCache<TypeDesc, IEETypeNode>((TypeDesc type) => { Debug.Assert(_compilationModuleGroup.ShouldReferenceThroughImportTable(type)); return _importedNodeProvider.ImportedEETypeNode(this, type); }); _nonGCStatics = new NodeCache<MetadataType, ISortableSymbolNode>((MetadataType type) => { if (_compilationModuleGroup.ContainsType(type) && !_compilationModuleGroup.ShouldReferenceThroughImportTable(type)) { return new NonGCStaticsNode(type, PreinitializationManager); } else { return _importedNodeProvider.ImportedNonGCStaticNode(this, type); } }); _GCStatics = new NodeCache<MetadataType, ISortableSymbolNode>((MetadataType type) => { if (_compilationModuleGroup.ContainsType(type) && !_compilationModuleGroup.ShouldReferenceThroughImportTable(type)) { return new GCStaticsNode(type, PreinitializationManager); } else { return _importedNodeProvider.ImportedGCStaticNode(this, type); } }); _GCStaticsPreInitDataNodes = new NodeCache<MetadataType, GCStaticsPreInitDataNode>((MetadataType type) => { ISymbolNode gcStaticsNode = TypeGCStaticsSymbol(type); Debug.Assert(gcStaticsNode is GCStaticsNode); return ((GCStaticsNode)gcStaticsNode).NewPreInitDataNode(); }); _GCStaticIndirectionNodes = new NodeCache<MetadataType, EmbeddedObjectNode>((MetadataType type) => { ISymbolNode gcStaticsNode = TypeGCStaticsSymbol(type); Debug.Assert(gcStaticsNode is GCStaticsNode); return GCStaticsRegion.NewNode((GCStaticsNode)gcStaticsNode); }); _threadStatics = new NodeCache<MetadataType, ISymbolDefinitionNode>(CreateThreadStaticsNode); _typeThreadStaticIndices = new NodeCache<MetadataType, TypeThreadStaticIndexNode>(type => { return new TypeThreadStaticIndexNode(type); }); _GCStaticEETypes = new NodeCache<GCPointerMap, GCStaticEETypeNode>((GCPointerMap gcMap) => { return new GCStaticEETypeNode(Target, gcMap); }); _readOnlyDataBlobs = new NodeCache<ReadOnlyDataBlobKey, BlobNode>(key => { return new BlobNode(key.Name, ObjectNodeSection.ReadOnlyDataSection, key.Data, key.Alignment); }); _uninitializedWritableDataBlobs = new NodeCache<UninitializedWritableDataBlobKey, BlobNode>(key => { return new BlobNode(key.Name, ObjectNodeSection.BssSection, new byte[key.Size], key.Alignment); }); _externSymbols = new NodeCache<string, ExternSymbolNode>((string name) => { return new ExternSymbolNode(name); }); _externIndirectSymbols = new NodeCache<string, ExternSymbolNode>((string name) => { return new ExternSymbolNode(name, isIndirection: true); }); _pInvokeModuleFixups = new NodeCache<PInvokeModuleData, PInvokeModuleFixupNode>((PInvokeModuleData moduleData) => { return new PInvokeModuleFixupNode(moduleData); }); _pInvokeMethodFixups = new NodeCache<PInvokeMethodData, PInvokeMethodFixupNode>((PInvokeMethodData methodData) => { return new PInvokeMethodFixupNode(methodData); }); _methodEntrypoints = new NodeCache<MethodDesc, IMethodNode>(CreateMethodEntrypointNode); _tentativeMethodEntrypoints = new NodeCache<MethodDesc, IMethodNode>((MethodDesc method) => { IMethodNode entrypoint = MethodEntrypoint(method, unboxingStub: false); return new TentativeMethodNode(entrypoint is TentativeMethodNode tentative ? tentative.RealBody : (IMethodBodyNode)entrypoint); }); _unboxingStubs = new NodeCache<MethodDesc, IMethodNode>(CreateUnboxingStubNode); _methodAssociatedData = new NodeCache<IMethodNode, MethodAssociatedDataNode>(methodNode => { return new MethodAssociatedDataNode(methodNode); }); _fatFunctionPointers = new NodeCache<MethodKey, FatFunctionPointerNode>(method => { return new FatFunctionPointerNode(method.Method, method.IsUnboxingStub); }); _gvmDependenciesNode = new NodeCache<MethodDesc, GVMDependenciesNode>(method => { return new GVMDependenciesNode(method); }); _gvmTableEntries = new NodeCache<TypeDesc, TypeGVMEntriesNode>(type => { return new TypeGVMEntriesNode(type); }); _dynamicInvokeTemplates = new NodeCache<MethodDesc, DynamicInvokeTemplateNode>(method => { return new DynamicInvokeTemplateNode(method); }); _reflectableMethods = new NodeCache<MethodDesc, ReflectableMethodNode>(method => { return new ReflectableMethodNode(method); }); _objectGetTypeFlowDependencies = new NodeCache<MetadataType, ObjectGetTypeFlowDependenciesNode>(type => { return new ObjectGetTypeFlowDependenciesNode(type); }); _shadowConcreteMethods = new NodeCache<MethodKey, IMethodNode>(methodKey => { MethodDesc canonMethod = methodKey.Method.GetCanonMethodTarget(CanonicalFormKind.Specific); if (methodKey.IsUnboxingStub) { return new ShadowConcreteUnboxingThunkNode(methodKey.Method, MethodEntrypoint(canonMethod, true)); } else { return new ShadowConcreteMethodNode(methodKey.Method, MethodEntrypoint(canonMethod)); } }); _virtMethods = new NodeCache<MethodDesc, VirtualMethodUseNode>((MethodDesc method) => { // We don't need to track virtual method uses for types that have a vtable with a known layout. // It's a waste of CPU time and memory. Debug.Assert(!VTable(method.OwningType).HasFixedSlots); return new VirtualMethodUseNode(method); }); _variantMethods = new NodeCache<MethodDesc, VariantInterfaceMethodUseNode>((MethodDesc method) => { // We don't need to track virtual method uses for types that have a vtable with a known layout. // It's a waste of CPU time and memory. Debug.Assert(!VTable(method.OwningType).HasFixedSlots); return new VariantInterfaceMethodUseNode(method); }); _readyToRunHelpers = new NodeCache<ReadyToRunHelperKey, ISymbolNode>(CreateReadyToRunHelperNode); _genericReadyToRunHelpersFromDict = new NodeCache<ReadyToRunGenericHelperKey, ISymbolNode>(CreateGenericLookupFromDictionaryNode); _genericReadyToRunHelpersFromType = new NodeCache<ReadyToRunGenericHelperKey, ISymbolNode>(CreateGenericLookupFromTypeNode); _frozenStringNodes = new NodeCache<string, FrozenStringNode>((string data) => { return new FrozenStringNode(data, Target); }); _frozenObjectNodes = new NodeCache<SerializedFrozenObjectKey, FrozenObjectNode>(key => { return new FrozenObjectNode(key.Owner, key.SerializableObject); }); _interfaceDispatchCells = new NodeCache<DispatchCellKey, InterfaceDispatchCellNode>(callSiteCell => { return new InterfaceDispatchCellNode(callSiteCell.Target, callSiteCell.CallsiteId); }); _interfaceDispatchMaps = new NodeCache<TypeDesc, InterfaceDispatchMapNode>((TypeDesc type) => { return new InterfaceDispatchMapNode(this, type); }); _sealedVtableNodes = new NodeCache<TypeDesc, SealedVTableNode>((TypeDesc type) => { return new SealedVTableNode(type); }); _runtimeMethodHandles = new NodeCache<MethodDesc, RuntimeMethodHandleNode>((MethodDesc method) => { return new RuntimeMethodHandleNode(method); }); _runtimeFieldHandles = new NodeCache<FieldDesc, RuntimeFieldHandleNode>((FieldDesc field) => { return new RuntimeFieldHandleNode(field); }); _dataflowAnalyzedMethods = new NodeCache<MethodILKey, DataflowAnalyzedMethodNode>((MethodILKey il) => { return new DataflowAnalyzedMethodNode(il.MethodIL); }); _interfaceDispatchMapIndirectionNodes = new NodeCache<TypeDesc, EmbeddedObjectNode>((TypeDesc type) => { return DispatchMapTable.NewNodeWithSymbol(InterfaceDispatchMap(type)); }); _genericCompositions = new NodeCache<GenericCompositionDetails, GenericCompositionNode>((GenericCompositionDetails details) => { return new GenericCompositionNode(details); }); _eagerCctorIndirectionNodes = new NodeCache<MethodDesc, EmbeddedObjectNode>((MethodDesc method) => { Debug.Assert(method.IsStaticConstructor); Debug.Assert(PreinitializationManager.HasEagerStaticConstructor((MetadataType)method.OwningType)); return EagerCctorTable.NewNode(MethodEntrypoint(method)); }); _delegateMarshalingDataNodes = new NodeCache<DefType, DelegateMarshallingDataNode>(type => { return new DelegateMarshallingDataNode(type); }); _structMarshalingDataNodes = new NodeCache<DefType, StructMarshallingDataNode>(type => { return new StructMarshallingDataNode(type); }); _vTableNodes = new NodeCache<TypeDesc, VTableSliceNode>((TypeDesc type ) => { if (CompilationModuleGroup.ShouldProduceFullVTable(type)) return new EagerlyBuiltVTableSliceNode(type); else return _vtableSliceProvider.GetSlice(type); }); _methodGenericDictionaries = new NodeCache<MethodDesc, ISortableSymbolNode>(method => { if (CompilationModuleGroup.ContainsMethodDictionary(method)) { return new MethodGenericDictionaryNode(method, this); } else { return _importedNodeProvider.ImportedMethodDictionaryNode(this, method); } }); _typeGenericDictionaries = new NodeCache<TypeDesc, ISortableSymbolNode>(type => { if (CompilationModuleGroup.ContainsTypeDictionary(type)) { Debug.Assert(!this.LazyGenericsPolicy.UsesLazyGenerics(type)); return new TypeGenericDictionaryNode(type, this); } else { return _importedNodeProvider.ImportedTypeDictionaryNode(this, type); } }); _typesWithMetadata = new NodeCache<MetadataType, TypeMetadataNode>(type => { return new TypeMetadataNode(type); }); _methodsWithMetadata = new NodeCache<MethodDesc, MethodMetadataNode>(method => { return new MethodMetadataNode(method); }); _fieldsWithMetadata = new NodeCache<FieldDesc, FieldMetadataNode>(field => { return new FieldMetadataNode(field); }); _modulesWithMetadata = new NodeCache<ModuleDesc, ModuleMetadataNode>(module => { return new ModuleMetadataNode(module); }); _customAttributesWithMetadata = new NodeCache<ReflectableCustomAttribute, CustomAttributeMetadataNode>(ca => { return new CustomAttributeMetadataNode(ca); }); _genericDictionaryLayouts = new NodeCache<TypeSystemEntity, DictionaryLayoutNode>(_dictionaryLayoutProvider.GetLayout); _stringAllocators = new NodeCache<MethodDesc, IMethodNode>(constructor => { return new StringAllocatorMethodNode(constructor); }); NativeLayout = new NativeLayoutHelper(this); } protected virtual ISymbolNode CreateGenericLookupFromDictionaryNode(ReadyToRunGenericHelperKey helperKey) { return new ReadyToRunGenericLookupFromDictionaryNode(this, helperKey.HelperId, helperKey.Target, helperKey.DictionaryOwner); } protected virtual ISymbolNode CreateGenericLookupFromTypeNode(ReadyToRunGenericHelperKey helperKey) { return new ReadyToRunGenericLookupFromTypeNode(this, helperKey.HelperId, helperKey.Target, helperKey.DictionaryOwner); } protected virtual IEETypeNode CreateNecessaryTypeNode(TypeDesc type) { Debug.Assert(!_compilationModuleGroup.ShouldReferenceThroughImportTable(type)); if (_compilationModuleGroup.ContainsType(type)) { if (type.IsGenericDefinition) { return new GenericDefinitionEETypeNode(this, type); } else if (type.IsCanonicalDefinitionType(CanonicalFormKind.Any)) { return new CanonicalDefinitionEETypeNode(this, type); } else if (type.IsCanonicalSubtype(CanonicalFormKind.Any)) { return new NecessaryCanonicalEETypeNode(this, type); } else { return new EETypeNode(this, type); } } else { return new ExternEETypeSymbolNode(this, type); } } protected virtual IEETypeNode CreateConstructedTypeNode(TypeDesc type) { // Canonical definition types are *not* constructed types (call NecessaryTypeSymbol to get them) Debug.Assert(!type.IsCanonicalDefinitionType(CanonicalFormKind.Any)); Debug.Assert(!_compilationModuleGroup.ShouldReferenceThroughImportTable(type)); if (_compilationModuleGroup.ContainsType(type)) { if (type.IsCanonicalSubtype(CanonicalFormKind.Any)) { return new CanonicalEETypeNode(this, type); } else { return new ConstructedEETypeNode(this, type); } } else { return new ExternEETypeSymbolNode(this, type); } } protected abstract IMethodNode CreateMethodEntrypointNode(MethodDesc method); protected abstract IMethodNode CreateUnboxingStubNode(MethodDesc method); protected abstract ISymbolNode CreateReadyToRunHelperNode(ReadyToRunHelperKey helperCall); protected virtual ISymbolDefinitionNode CreateThreadStaticsNode(MetadataType type) { return new ThreadStaticsNode(type, this); } private NodeCache<TypeDesc, IEETypeNode> _typeSymbols; public IEETypeNode NecessaryTypeSymbol(TypeDesc type) { if (_compilationModuleGroup.ShouldReferenceThroughImportTable(type)) { return ImportedEETypeSymbol(type); } if (_compilationModuleGroup.ShouldPromoteToFullType(type)) { return ConstructedTypeSymbol(type); } Debug.Assert(!TypeCannotHaveEEType(type)); return _typeSymbols.GetOrAdd(type); } private NodeCache<TypeDesc, IEETypeNode> _constructedTypeSymbols; public IEETypeNode ConstructedTypeSymbol(TypeDesc type) { if (_compilationModuleGroup.ShouldReferenceThroughImportTable(type)) { return ImportedEETypeSymbol(type); } Debug.Assert(!TypeCannotHaveEEType(type)); return _constructedTypeSymbols.GetOrAdd(type); } private NodeCache<TypeDesc, IEETypeNode> _clonedTypeSymbols; public IEETypeNode MaximallyConstructableType(TypeDesc type) { if (ConstructedEETypeNode.CreationAllowed(type)) return ConstructedTypeSymbol(type); else return NecessaryTypeSymbol(type); } public IEETypeNode ConstructedClonedTypeSymbol(TypeDesc type) { Debug.Assert(!TypeCannotHaveEEType(type)); return _clonedTypeSymbols.GetOrAdd(type); } private NodeCache<TypeDesc, IEETypeNode> _importedTypeSymbols; private IEETypeNode ImportedEETypeSymbol(TypeDesc type) { Debug.Assert(_compilationModuleGroup.ShouldReferenceThroughImportTable(type)); return _importedTypeSymbols.GetOrAdd(type); } private NodeCache<MetadataType, ISortableSymbolNode> _nonGCStatics; public ISortableSymbolNode TypeNonGCStaticsSymbol(MetadataType type) { Debug.Assert(!TypeCannotHaveEEType(type)); return _nonGCStatics.GetOrAdd(type); } private NodeCache<MetadataType, ISortableSymbolNode> _GCStatics; public ISortableSymbolNode TypeGCStaticsSymbol(MetadataType type) { Debug.Assert(!TypeCannotHaveEEType(type)); return _GCStatics.GetOrAdd(type); } private NodeCache<MetadataType, GCStaticsPreInitDataNode> _GCStaticsPreInitDataNodes; public GCStaticsPreInitDataNode GCStaticsPreInitDataNode(MetadataType type) { return _GCStaticsPreInitDataNodes.GetOrAdd(type); } private NodeCache<MetadataType, EmbeddedObjectNode> _GCStaticIndirectionNodes; public EmbeddedObjectNode GCStaticIndirection(MetadataType type) { return _GCStaticIndirectionNodes.GetOrAdd(type); } private NodeCache<MetadataType, ISymbolDefinitionNode> _threadStatics; public ISymbolDefinitionNode TypeThreadStaticsSymbol(MetadataType type) { // This node is always used in the context of its index within the region. // We should never ask for this if the current compilation doesn't contain the // associated type. Debug.Assert(_compilationModuleGroup.ContainsType(type)); return _threadStatics.GetOrAdd(type); } private NodeCache<MetadataType, TypeThreadStaticIndexNode> _typeThreadStaticIndices; public ISortableSymbolNode TypeThreadStaticIndex(MetadataType type) { if (_compilationModuleGroup.ContainsType(type)) { return _typeThreadStaticIndices.GetOrAdd(type); } else { return ExternSymbol(NameMangler.NodeMangler.ThreadStaticsIndex(type)); } } private NodeCache<DispatchCellKey, InterfaceDispatchCellNode> _interfaceDispatchCells; public InterfaceDispatchCellNode InterfaceDispatchCell(MethodDesc method, string callSite = null) { return _interfaceDispatchCells.GetOrAdd(new DispatchCellKey(method, callSite)); } private NodeCache<MethodDesc, RuntimeMethodHandleNode> _runtimeMethodHandles; public RuntimeMethodHandleNode RuntimeMethodHandle(MethodDesc method) { return _runtimeMethodHandles.GetOrAdd(method); } private NodeCache<FieldDesc, RuntimeFieldHandleNode> _runtimeFieldHandles; public RuntimeFieldHandleNode RuntimeFieldHandle(FieldDesc field) { return _runtimeFieldHandles.GetOrAdd(field); } private NodeCache<MethodILKey, DataflowAnalyzedMethodNode> _dataflowAnalyzedMethods; public DataflowAnalyzedMethodNode DataflowAnalyzedMethod(MethodIL methodIL) { return _dataflowAnalyzedMethods.GetOrAdd(new MethodILKey(methodIL)); } private NodeCache<GCPointerMap, GCStaticEETypeNode> _GCStaticEETypes; public ISymbolNode GCStaticEEType(GCPointerMap gcMap) { return _GCStaticEETypes.GetOrAdd(gcMap); } private NodeCache<UninitializedWritableDataBlobKey, BlobNode> _uninitializedWritableDataBlobs; public BlobNode UninitializedWritableDataBlob(Utf8String name, int size, int alignment) { return _uninitializedWritableDataBlobs.GetOrAdd(new UninitializedWritableDataBlobKey(name, size, alignment)); } private NodeCache<ReadOnlyDataBlobKey, BlobNode> _readOnlyDataBlobs; public BlobNode ReadOnlyDataBlob(Utf8String name, byte[] blobData, int alignment) { return _readOnlyDataBlobs.GetOrAdd(new ReadOnlyDataBlobKey(name, blobData, alignment)); } private NodeCache<TypeDesc, SealedVTableNode> _sealedVtableNodes; internal SealedVTableNode SealedVTable(TypeDesc type) { return _sealedVtableNodes.GetOrAdd(type); } private NodeCache<TypeDesc, InterfaceDispatchMapNode> _interfaceDispatchMaps; internal InterfaceDispatchMapNode InterfaceDispatchMap(TypeDesc type) { return _interfaceDispatchMaps.GetOrAdd(type); } private NodeCache<TypeDesc, EmbeddedObjectNode> _interfaceDispatchMapIndirectionNodes; public EmbeddedObjectNode InterfaceDispatchMapIndirection(TypeDesc type) { return _interfaceDispatchMapIndirectionNodes.GetOrAdd(type); } private NodeCache<GenericCompositionDetails, GenericCompositionNode> _genericCompositions; internal ISymbolNode GenericComposition(GenericCompositionDetails details) { return _genericCompositions.GetOrAdd(details); } private NodeCache<string, ExternSymbolNode> _externSymbols; public ISortableSymbolNode ExternSymbol(string name) { return _externSymbols.GetOrAdd(name); } private NodeCache<string, ExternSymbolNode> _externIndirectSymbols; public ISortableSymbolNode ExternIndirectSymbol(string name) { return _externIndirectSymbols.GetOrAdd(name); } private NodeCache<PInvokeModuleData, PInvokeModuleFixupNode> _pInvokeModuleFixups; public ISymbolNode PInvokeModuleFixup(PInvokeModuleData moduleData) { return _pInvokeModuleFixups.GetOrAdd(moduleData); } private NodeCache<PInvokeMethodData, PInvokeMethodFixupNode> _pInvokeMethodFixups; public PInvokeMethodFixupNode PInvokeMethodFixup(PInvokeMethodData methodData) { return _pInvokeMethodFixups.GetOrAdd(methodData); } private NodeCache<TypeDesc, VTableSliceNode> _vTableNodes; public VTableSliceNode VTable(TypeDesc type) { return _vTableNodes.GetOrAdd(type); } private NodeCache<MethodDesc, ISortableSymbolNode> _methodGenericDictionaries; public ISortableSymbolNode MethodGenericDictionary(MethodDesc method) { return _methodGenericDictionaries.GetOrAdd(method); } private NodeCache<TypeDesc, ISortableSymbolNode> _typeGenericDictionaries; public ISortableSymbolNode TypeGenericDictionary(TypeDesc type) { return _typeGenericDictionaries.GetOrAdd(type); } private NodeCache<TypeSystemEntity, DictionaryLayoutNode> _genericDictionaryLayouts; public DictionaryLayoutNode GenericDictionaryLayout(TypeSystemEntity methodOrType) { return _genericDictionaryLayouts.GetOrAdd(methodOrType); } private NodeCache<MethodDesc, IMethodNode> _stringAllocators; public IMethodNode StringAllocator(MethodDesc stringConstructor) { return _stringAllocators.GetOrAdd(stringConstructor); } protected NodeCache<MethodDesc, IMethodNode> _methodEntrypoints; private NodeCache<MethodDesc, IMethodNode> _unboxingStubs; private NodeCache<IMethodNode, MethodAssociatedDataNode> _methodAssociatedData; public IMethodNode MethodEntrypoint(MethodDesc method, bool unboxingStub = false) { if (unboxingStub) { return _unboxingStubs.GetOrAdd(method); } return _methodEntrypoints.GetOrAdd(method); } protected NodeCache<MethodDesc, IMethodNode> _tentativeMethodEntrypoints; public IMethodNode TentativeMethodEntrypoint(MethodDesc method, bool unboxingStub = false) { // Didn't implement unboxing stubs for now. Would need to pass down the flag. Debug.Assert(!unboxingStub); return _tentativeMethodEntrypoints.GetOrAdd(method); } public MethodAssociatedDataNode MethodAssociatedData(IMethodNode methodNode) { return _methodAssociatedData.GetOrAdd(methodNode); } private NodeCache<MethodKey, FatFunctionPointerNode> _fatFunctionPointers; public IMethodNode FatFunctionPointer(MethodDesc method, bool isUnboxingStub = false) { return _fatFunctionPointers.GetOrAdd(new MethodKey(method, isUnboxingStub)); } public IMethodNode ExactCallableAddress(MethodDesc method, bool isUnboxingStub = false) { MethodDesc canonMethod = method.GetCanonMethodTarget(CanonicalFormKind.Specific); if (method != canonMethod) return FatFunctionPointer(method, isUnboxingStub); else return MethodEntrypoint(method, isUnboxingStub); } public IMethodNode CanonicalEntrypoint(MethodDesc method, bool isUnboxingStub = false) { MethodDesc canonMethod = method.GetCanonMethodTarget(CanonicalFormKind.Specific); if (method != canonMethod) return ShadowConcreteMethod(method, isUnboxingStub); else return MethodEntrypoint(method, isUnboxingStub); } private NodeCache<MethodDesc, GVMDependenciesNode> _gvmDependenciesNode; public GVMDependenciesNode GVMDependencies(MethodDesc method) { return _gvmDependenciesNode.GetOrAdd(method); } private NodeCache<TypeDesc, TypeGVMEntriesNode> _gvmTableEntries; internal TypeGVMEntriesNode TypeGVMEntries(TypeDesc type) { return _gvmTableEntries.GetOrAdd(type); } private NodeCache<MethodDesc, ReflectableMethodNode> _reflectableMethods; public ReflectableMethodNode ReflectableMethod(MethodDesc method) { return _reflectableMethods.GetOrAdd(method); } private NodeCache<MetadataType, ObjectGetTypeFlowDependenciesNode> _objectGetTypeFlowDependencies; internal ObjectGetTypeFlowDependenciesNode ObjectGetTypeFlowDependencies(MetadataType type) { return _objectGetTypeFlowDependencies.GetOrAdd(type); } private NodeCache<MethodDesc, DynamicInvokeTemplateNode> _dynamicInvokeTemplates; internal DynamicInvokeTemplateNode DynamicInvokeTemplate(MethodDesc method) { return _dynamicInvokeTemplates.GetOrAdd(method); } private NodeCache<MethodKey, IMethodNode> _shadowConcreteMethods; public IMethodNode ShadowConcreteMethod(MethodDesc method, bool isUnboxingStub = false) { return _shadowConcreteMethods.GetOrAdd(new MethodKey(method, isUnboxingStub)); } private static readonly string[][] s_helperEntrypointNames = new string[][] { new string[] { "System.Runtime.CompilerServices", "ClassConstructorRunner", "CheckStaticClassConstructionReturnGCStaticBase" }, new string[] { "System.Runtime.CompilerServices", "ClassConstructorRunner", "CheckStaticClassConstructionReturnNonGCStaticBase" }, new string[] { "System.Runtime.CompilerServices", "ClassConstructorRunner", "CheckStaticClassConstructionReturnThreadStaticBase" }, new string[] { "Internal.Runtime", "ThreadStatics", "GetThreadStaticBaseForType" } }; private ISymbolNode[] _helperEntrypointSymbols; public ISymbolNode HelperEntrypoint(HelperEntrypoint entrypoint) { if (_helperEntrypointSymbols == null) _helperEntrypointSymbols = new ISymbolNode[s_helperEntrypointNames.Length]; int index = (int)entrypoint; ISymbolNode symbol = _helperEntrypointSymbols[index]; if (symbol == null) { var entry = s_helperEntrypointNames[index]; var type = _context.SystemModule.GetKnownType(entry[0], entry[1]); var method = type.GetKnownMethod(entry[2], null); symbol = MethodEntrypoint(method); _helperEntrypointSymbols[index] = symbol; } return symbol; } private MetadataType _systemArrayOfTClass; public MetadataType ArrayOfTClass { get { if (_systemArrayOfTClass == null) { _systemArrayOfTClass = _context.SystemModule.GetKnownType("System", "Array`1"); } return _systemArrayOfTClass; } } private TypeDesc _systemArrayOfTEnumeratorType; public TypeDesc ArrayOfTEnumeratorType { get { if (_systemArrayOfTEnumeratorType == null) { _systemArrayOfTEnumeratorType = ArrayOfTClass.GetNestedType("ArrayEnumerator"); } return _systemArrayOfTEnumeratorType; } } private MethodDesc _instanceMethodRemovedHelper; public MethodDesc InstanceMethodRemovedHelper { get { if (_instanceMethodRemovedHelper == null) { // This helper is optional, but it's fine for this cache to be ineffective if that happens. // Those scenarios are rare and typically deal with small compilations. _instanceMethodRemovedHelper = TypeSystemContext.GetOptionalHelperEntryPoint("ThrowHelpers", "ThrowInstanceBodyRemoved"); } return _instanceMethodRemovedHelper; } } private NodeCache<MethodDesc, VirtualMethodUseNode> _virtMethods; public DependencyNodeCore<NodeFactory> VirtualMethodUse(MethodDesc decl) { return _virtMethods.GetOrAdd(decl); } private NodeCache<MethodDesc, VariantInterfaceMethodUseNode> _variantMethods; public DependencyNodeCore<NodeFactory> VariantInterfaceMethodUse(MethodDesc decl) { return _variantMethods.GetOrAdd(decl); } private NodeCache<ReadyToRunHelperKey, ISymbolNode> _readyToRunHelpers; public ISymbolNode ReadyToRunHelper(ReadyToRunHelperId id, Object target) { return _readyToRunHelpers.GetOrAdd(new ReadyToRunHelperKey(id, target)); } private NodeCache<ReadyToRunGenericHelperKey, ISymbolNode> _genericReadyToRunHelpersFromDict; public ISymbolNode ReadyToRunHelperFromDictionaryLookup(ReadyToRunHelperId id, Object target, TypeSystemEntity dictionaryOwner) { return _genericReadyToRunHelpersFromDict.GetOrAdd(new ReadyToRunGenericHelperKey(id, target, dictionaryOwner)); } private NodeCache<ReadyToRunGenericHelperKey, ISymbolNode> _genericReadyToRunHelpersFromType; public ISymbolNode ReadyToRunHelperFromTypeLookup(ReadyToRunHelperId id, Object target, TypeSystemEntity dictionaryOwner) { return _genericReadyToRunHelpersFromType.GetOrAdd(new ReadyToRunGenericHelperKey(id, target, dictionaryOwner)); } private NodeCache<MetadataType, TypeMetadataNode> _typesWithMetadata; internal TypeMetadataNode TypeMetadata(MetadataType type) { // These are only meaningful for UsageBasedMetadataManager. We should not have them // in the dependency graph otherwise. Debug.Assert(MetadataManager is UsageBasedMetadataManager); return _typesWithMetadata.GetOrAdd(type); } private NodeCache<MethodDesc, MethodMetadataNode> _methodsWithMetadata; internal MethodMetadataNode MethodMetadata(MethodDesc method) { // These are only meaningful for UsageBasedMetadataManager. We should not have them // in the dependency graph otherwise. Debug.Assert(MetadataManager is UsageBasedMetadataManager); return _methodsWithMetadata.GetOrAdd(method); } private NodeCache<FieldDesc, FieldMetadataNode> _fieldsWithMetadata; internal FieldMetadataNode FieldMetadata(FieldDesc field) { // These are only meaningful for UsageBasedMetadataManager. We should not have them // in the dependency graph otherwise. Debug.Assert(MetadataManager is UsageBasedMetadataManager); return _fieldsWithMetadata.GetOrAdd(field); } private NodeCache<ModuleDesc, ModuleMetadataNode> _modulesWithMetadata; internal ModuleMetadataNode ModuleMetadata(ModuleDesc module) { // These are only meaningful for UsageBasedMetadataManager. We should not have them // in the dependency graph otherwise. Debug.Assert(MetadataManager is UsageBasedMetadataManager); return _modulesWithMetadata.GetOrAdd(module); } private NodeCache<ReflectableCustomAttribute, CustomAttributeMetadataNode> _customAttributesWithMetadata; internal CustomAttributeMetadataNode CustomAttributeMetadata(ReflectableCustomAttribute ca) { // These are only meaningful for UsageBasedMetadataManager. We should not have them // in the dependency graph otherwise. Debug.Assert(MetadataManager is UsageBasedMetadataManager); return _customAttributesWithMetadata.GetOrAdd(ca); } private NodeCache<string, FrozenStringNode> _frozenStringNodes; public FrozenStringNode SerializedStringObject(string data) { return _frozenStringNodes.GetOrAdd(data); } private NodeCache<SerializedFrozenObjectKey, FrozenObjectNode> _frozenObjectNodes; public FrozenObjectNode SerializedFrozenObject(FieldDesc owningField, TypePreinit.ISerializableReference data) { return _frozenObjectNodes.GetOrAdd(new SerializedFrozenObjectKey(owningField, data)); } private NodeCache<MethodDesc, EmbeddedObjectNode> _eagerCctorIndirectionNodes; public EmbeddedObjectNode EagerCctorIndirection(MethodDesc cctorMethod) { return _eagerCctorIndirectionNodes.GetOrAdd(cctorMethod); } public ISymbolNode ConstantUtf8String(string str) { int stringBytesCount = Encoding.UTF8.GetByteCount(str); byte[] stringBytes = new byte[stringBytesCount + 1]; Encoding.UTF8.GetBytes(str, 0, str.Length, stringBytes, 0); string symbolName = "__utf8str_" + NameMangler.GetMangledStringName(str); return ReadOnlyDataBlob(symbolName, stringBytes, 1); } private NodeCache<DefType, DelegateMarshallingDataNode> _delegateMarshalingDataNodes; public DelegateMarshallingDataNode DelegateMarshallingData(DefType type) { return _delegateMarshalingDataNodes.GetOrAdd(type); } private NodeCache<DefType, StructMarshallingDataNode> _structMarshalingDataNodes; public StructMarshallingDataNode StructMarshallingData(DefType type) { return _structMarshalingDataNodes.GetOrAdd(type); } /// <summary> /// Returns alternative symbol name that object writer should produce for given symbols /// in addition to the regular one. /// </summary> public string GetSymbolAlternateName(ISymbolNode node) { string value; if (!NodeAliases.TryGetValue(node, out value)) return null; return value; } public ArrayOfEmbeddedPointersNode<GCStaticsNode> GCStaticsRegion = new ArrayOfEmbeddedPointersNode<GCStaticsNode>( "__GCStaticRegionStart", "__GCStaticRegionEnd", new SortableDependencyNode.ObjectNodeComparer(new CompilerComparer())); public ArrayOfEmbeddedDataNode<ThreadStaticsNode> ThreadStaticsRegion = new ArrayOfEmbeddedDataNode<ThreadStaticsNode>( "__ThreadStaticRegionStart", "__ThreadStaticRegionEnd", new SortableDependencyNode.EmbeddedObjectNodeComparer(new CompilerComparer())); public ArrayOfEmbeddedPointersNode<IMethodNode> EagerCctorTable = new ArrayOfEmbeddedPointersNode<IMethodNode>( "__EagerCctorStart", "__EagerCctorEnd", null); public ArrayOfEmbeddedPointersNode<InterfaceDispatchMapNode> DispatchMapTable = new ArrayOfEmbeddedPointersNode<InterfaceDispatchMapNode>( "__DispatchMapTableStart", "__DispatchMapTableEnd", new SortableDependencyNode.ObjectNodeComparer(new CompilerComparer())); public ArrayOfEmbeddedDataNode<EmbeddedObjectNode> FrozenSegmentRegion = new ArrayOfFrozenObjectsNode<EmbeddedObjectNode>( "__FrozenSegmentRegionStart", "__FrozenSegmentRegionEnd", new SortableDependencyNode.EmbeddedObjectNodeComparer(new CompilerComparer())); internal ModuleInitializerListNode ModuleInitializerList = new ModuleInitializerListNode(); public InterfaceDispatchCellSectionNode InterfaceDispatchCellSection { get; } public ReadyToRunHeaderNode ReadyToRunHeader; public Dictionary<ISymbolNode, string> NodeAliases = new Dictionary<ISymbolNode, string>(); protected internal TypeManagerIndirectionNode TypeManagerIndirection = new TypeManagerIndirectionNode(); public virtual void AttachToDependencyGraph(DependencyAnalyzerBase<NodeFactory> graph) { ReadyToRunHeader = new ReadyToRunHeaderNode(Target); graph.AddRoot(ReadyToRunHeader, "ReadyToRunHeader is always generated"); graph.AddRoot(new ModulesSectionNode(Target), "ModulesSection is always generated"); graph.AddRoot(GCStaticsRegion, "GC StaticsRegion is always generated"); graph.AddRoot(ThreadStaticsRegion, "ThreadStaticsRegion is always generated"); graph.AddRoot(EagerCctorTable, "EagerCctorTable is always generated"); graph.AddRoot(TypeManagerIndirection, "TypeManagerIndirection is always generated"); graph.AddRoot(DispatchMapTable, "DispatchMapTable is always generated"); graph.AddRoot(FrozenSegmentRegion, "FrozenSegmentRegion is always generated"); graph.AddRoot(InterfaceDispatchCellSection, "Interface dispatch cell section is always generated"); graph.AddRoot(ModuleInitializerList, "Module initializer list is always generated"); ReadyToRunHeader.Add(ReadyToRunSectionType.GCStaticRegion, GCStaticsRegion, GCStaticsRegion.StartSymbol, GCStaticsRegion.EndSymbol); ReadyToRunHeader.Add(ReadyToRunSectionType.ThreadStaticRegion, ThreadStaticsRegion, ThreadStaticsRegion.StartSymbol, ThreadStaticsRegion.EndSymbol); ReadyToRunHeader.Add(ReadyToRunSectionType.EagerCctor, EagerCctorTable, EagerCctorTable.StartSymbol, EagerCctorTable.EndSymbol); ReadyToRunHeader.Add(ReadyToRunSectionType.TypeManagerIndirection, TypeManagerIndirection, TypeManagerIndirection); ReadyToRunHeader.Add(ReadyToRunSectionType.InterfaceDispatchTable, DispatchMapTable, DispatchMapTable.StartSymbol); ReadyToRunHeader.Add(ReadyToRunSectionType.FrozenObjectRegion, FrozenSegmentRegion, FrozenSegmentRegion.StartSymbol, FrozenSegmentRegion.EndSymbol); ReadyToRunHeader.Add(ReadyToRunSectionType.ModuleInitializerList, ModuleInitializerList, ModuleInitializerList, ModuleInitializerList.EndSymbol); var commonFixupsTableNode = new ExternalReferencesTableNode("CommonFixupsTable", this); InteropStubManager.AddToReadyToRunHeader(ReadyToRunHeader, this, commonFixupsTableNode); MetadataManager.AddToReadyToRunHeader(ReadyToRunHeader, this, commonFixupsTableNode); MetadataManager.AttachToDependencyGraph(graph); ReadyToRunHeader.Add(MetadataManager.BlobIdToReadyToRunSection(ReflectionMapBlob.CommonFixupsTable), commonFixupsTableNode, commonFixupsTableNode, commonFixupsTableNode.EndSymbol); } protected struct MethodKey : IEquatable<MethodKey> { public readonly MethodDesc Method; public readonly bool IsUnboxingStub; public MethodKey(MethodDesc method, bool isUnboxingStub) { Method = method; IsUnboxingStub = isUnboxingStub; } public bool Equals(MethodKey other) => Method == other.Method && IsUnboxingStub == other.IsUnboxingStub; public override bool Equals(object obj) => obj is MethodKey && Equals((MethodKey)obj); public override int GetHashCode() => Method.GetHashCode(); } protected struct ReadyToRunHelperKey : IEquatable<ReadyToRunHelperKey> { public readonly object Target; public readonly ReadyToRunHelperId HelperId; public ReadyToRunHelperKey(ReadyToRunHelperId helperId, object target) { HelperId = helperId; Target = target; } public bool Equals(ReadyToRunHelperKey other) => HelperId == other.HelperId && Target.Equals(other.Target); public override bool Equals(object obj) => obj is ReadyToRunHelperKey && Equals((ReadyToRunHelperKey)obj); public override int GetHashCode() { int hashCode = (int)HelperId * 0x5498341 + 0x832424; hashCode = hashCode * 23 + Target.GetHashCode(); return hashCode; } } protected struct ReadyToRunGenericHelperKey : IEquatable<ReadyToRunGenericHelperKey> { public readonly object Target; public readonly TypeSystemEntity DictionaryOwner; public readonly ReadyToRunHelperId HelperId; public ReadyToRunGenericHelperKey(ReadyToRunHelperId helperId, object target, TypeSystemEntity dictionaryOwner) { HelperId = helperId; Target = target; DictionaryOwner = dictionaryOwner; } public bool Equals(ReadyToRunGenericHelperKey other) => HelperId == other.HelperId && DictionaryOwner == other.DictionaryOwner && Target.Equals(other.Target); public override bool Equals(object obj) => obj is ReadyToRunGenericHelperKey && Equals((ReadyToRunGenericHelperKey)obj); public override int GetHashCode() { int hashCode = (int)HelperId * 0x5498341 + 0x832424; hashCode = hashCode * 23 + Target.GetHashCode(); hashCode = hashCode * 23 + DictionaryOwner.GetHashCode(); return hashCode; } } protected struct DispatchCellKey : IEquatable<DispatchCellKey> { public readonly MethodDesc Target; public readonly string CallsiteId; public DispatchCellKey(MethodDesc target, string callsiteId) { Target = target; CallsiteId = callsiteId; } public bool Equals(DispatchCellKey other) => Target == other.Target && CallsiteId == other.CallsiteId; public override bool Equals(object obj) => obj is DispatchCellKey && Equals((DispatchCellKey)obj); public override int GetHashCode() { int hashCode = Target.GetHashCode(); if (CallsiteId != null) hashCode = hashCode * 23 + CallsiteId.GetHashCode(); return hashCode; } } protected struct ReadOnlyDataBlobKey : IEquatable<ReadOnlyDataBlobKey> { public readonly Utf8String Name; public readonly byte[] Data; public readonly int Alignment; public ReadOnlyDataBlobKey(Utf8String name, byte[] data, int alignment) { Name = name; Data = data; Alignment = alignment; } // The assumption here is that the name of the blob is unique. // We can't emit two blobs with the same name and different contents. // The name is part of the symbolic name and we don't do any mangling on it. public bool Equals(ReadOnlyDataBlobKey other) => Name.Equals(other.Name); public override bool Equals(object obj) => obj is ReadOnlyDataBlobKey && Equals((ReadOnlyDataBlobKey)obj); public override int GetHashCode() => Name.GetHashCode(); } protected struct UninitializedWritableDataBlobKey : IEquatable<UninitializedWritableDataBlobKey> { public readonly Utf8String Name; public readonly int Size; public readonly int Alignment; public UninitializedWritableDataBlobKey(Utf8String name, int size, int alignment) { Name = name; Size = size; Alignment = alignment; } // The assumption here is that the name of the blob is unique. // We can't emit two blobs with the same name and different contents. // The name is part of the symbolic name and we don't do any mangling on it. public bool Equals(UninitializedWritableDataBlobKey other) => Name.Equals(other.Name); public override bool Equals(object obj) => obj is UninitializedWritableDataBlobKey && Equals((UninitializedWritableDataBlobKey)obj); public override int GetHashCode() => Name.GetHashCode(); } protected struct SerializedFrozenObjectKey : IEquatable<SerializedFrozenObjectKey> { public readonly FieldDesc Owner; public readonly TypePreinit.ISerializableReference SerializableObject; public SerializedFrozenObjectKey(FieldDesc owner, TypePreinit.ISerializableReference obj) { Owner = owner; SerializableObject = obj; } public override bool Equals(object obj) => obj is SerializedFrozenObjectKey && Equals((SerializedFrozenObjectKey)obj); public bool Equals(SerializedFrozenObjectKey other) => Owner == other.Owner; public override int GetHashCode() => Owner.GetHashCode(); } private struct MethodILKey : IEquatable<MethodILKey> { public readonly MethodIL MethodIL; public MethodILKey(MethodIL methodIL) => MethodIL = methodIL; public override bool Equals(object obj) => obj is MethodILKey other && Equals(other); public bool Equals(MethodILKey other) => other.MethodIL.OwningMethod == this.MethodIL.OwningMethod; public override int GetHashCode() => MethodIL.OwningMethod.GetHashCode(); } } }
// 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.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.Text; using ILCompiler.DependencyAnalysisFramework; using Internal.IL; using Internal.Runtime; using Internal.Text; using Internal.TypeSystem; namespace ILCompiler.DependencyAnalysis { public abstract partial class NodeFactory { private TargetDetails _target; private CompilerTypeSystemContext _context; private CompilationModuleGroup _compilationModuleGroup; private VTableSliceProvider _vtableSliceProvider; private DictionaryLayoutProvider _dictionaryLayoutProvider; protected readonly ImportedNodeProvider _importedNodeProvider; private bool _markingComplete; public NodeFactory( CompilerTypeSystemContext context, CompilationModuleGroup compilationModuleGroup, MetadataManager metadataManager, InteropStubManager interoptStubManager, NameMangler nameMangler, LazyGenericsPolicy lazyGenericsPolicy, VTableSliceProvider vtableSliceProvider, DictionaryLayoutProvider dictionaryLayoutProvider, ImportedNodeProvider importedNodeProvider, PreinitializationManager preinitializationManager) { _target = context.Target; _context = context; _compilationModuleGroup = compilationModuleGroup; _vtableSliceProvider = vtableSliceProvider; _dictionaryLayoutProvider = dictionaryLayoutProvider; NameMangler = nameMangler; InteropStubManager = interoptStubManager; CreateNodeCaches(); MetadataManager = metadataManager; LazyGenericsPolicy = lazyGenericsPolicy; _importedNodeProvider = importedNodeProvider; InterfaceDispatchCellSection = new InterfaceDispatchCellSectionNode(this); PreinitializationManager = preinitializationManager; } public void SetMarkingComplete() { _markingComplete = true; } public bool MarkingComplete => _markingComplete; public TargetDetails Target { get { return _target; } } public LazyGenericsPolicy LazyGenericsPolicy { get; } public CompilationModuleGroup CompilationModuleGroup { get { return _compilationModuleGroup; } } public CompilerTypeSystemContext TypeSystemContext { get { return _context; } } public MetadataManager MetadataManager { get; } public NameMangler NameMangler { get; } public PreinitializationManager PreinitializationManager { get; } public InteropStubManager InteropStubManager { get; } // Temporary workaround that is used to disable certain features from lighting up // in CppCodegen because they're not fully implemented yet. public virtual bool IsCppCodegenTemporaryWorkaround { get { return false; } } /// <summary> /// Return true if the type is not permitted by the rules of the runtime to have an MethodTable. /// The implementation here is not intended to be complete, but represents many conditions /// which make a type ineligible to be an MethodTable. (This function is intended for use in assertions only) /// </summary> private bool TypeCannotHaveEEType(TypeDesc type) { if (!IsCppCodegenTemporaryWorkaround && type.GetTypeDefinition() is INonEmittableType) return true; if (type.IsRuntimeDeterminedSubtype) return true; if (type.IsSignatureVariable) return true; if (type.IsGenericParameter) return true; return false; } protected struct NodeCache<TKey, TValue> { private Func<TKey, TValue> _creator; private ConcurrentDictionary<TKey, TValue> _cache; public NodeCache(Func<TKey, TValue> creator, IEqualityComparer<TKey> comparer) { _creator = creator; _cache = new ConcurrentDictionary<TKey, TValue>(comparer); } public NodeCache(Func<TKey, TValue> creator) { _creator = creator; _cache = new ConcurrentDictionary<TKey, TValue>(); } public TValue GetOrAdd(TKey key) { return _cache.GetOrAdd(key, _creator); } public TValue GetOrAdd(TKey key, Func<TKey, TValue> creator) { return _cache.GetOrAdd(key, creator); } } private void CreateNodeCaches() { _typeSymbols = new NodeCache<TypeDesc, IEETypeNode>(CreateNecessaryTypeNode); _constructedTypeSymbols = new NodeCache<TypeDesc, IEETypeNode>(CreateConstructedTypeNode); _clonedTypeSymbols = new NodeCache<TypeDesc, IEETypeNode>((TypeDesc type) => { // Only types that reside in other binaries should be cloned Debug.Assert(_compilationModuleGroup.ShouldReferenceThroughImportTable(type)); return new ClonedConstructedEETypeNode(this, type); }); _importedTypeSymbols = new NodeCache<TypeDesc, IEETypeNode>((TypeDesc type) => { Debug.Assert(_compilationModuleGroup.ShouldReferenceThroughImportTable(type)); return _importedNodeProvider.ImportedEETypeNode(this, type); }); _nonGCStatics = new NodeCache<MetadataType, ISortableSymbolNode>((MetadataType type) => { if (_compilationModuleGroup.ContainsType(type) && !_compilationModuleGroup.ShouldReferenceThroughImportTable(type)) { return new NonGCStaticsNode(type, PreinitializationManager); } else { return _importedNodeProvider.ImportedNonGCStaticNode(this, type); } }); _GCStatics = new NodeCache<MetadataType, ISortableSymbolNode>((MetadataType type) => { if (_compilationModuleGroup.ContainsType(type) && !_compilationModuleGroup.ShouldReferenceThroughImportTable(type)) { return new GCStaticsNode(type, PreinitializationManager); } else { return _importedNodeProvider.ImportedGCStaticNode(this, type); } }); _GCStaticsPreInitDataNodes = new NodeCache<MetadataType, GCStaticsPreInitDataNode>((MetadataType type) => { ISymbolNode gcStaticsNode = TypeGCStaticsSymbol(type); Debug.Assert(gcStaticsNode is GCStaticsNode); return ((GCStaticsNode)gcStaticsNode).NewPreInitDataNode(); }); _GCStaticIndirectionNodes = new NodeCache<MetadataType, EmbeddedObjectNode>((MetadataType type) => { ISymbolNode gcStaticsNode = TypeGCStaticsSymbol(type); Debug.Assert(gcStaticsNode is GCStaticsNode); return GCStaticsRegion.NewNode((GCStaticsNode)gcStaticsNode); }); _threadStatics = new NodeCache<MetadataType, ISymbolDefinitionNode>(CreateThreadStaticsNode); _typeThreadStaticIndices = new NodeCache<MetadataType, TypeThreadStaticIndexNode>(type => { return new TypeThreadStaticIndexNode(type); }); _GCStaticEETypes = new NodeCache<GCPointerMap, GCStaticEETypeNode>((GCPointerMap gcMap) => { return new GCStaticEETypeNode(Target, gcMap); }); _readOnlyDataBlobs = new NodeCache<ReadOnlyDataBlobKey, BlobNode>(key => { return new BlobNode(key.Name, ObjectNodeSection.ReadOnlyDataSection, key.Data, key.Alignment); }); _uninitializedWritableDataBlobs = new NodeCache<UninitializedWritableDataBlobKey, BlobNode>(key => { return new BlobNode(key.Name, ObjectNodeSection.BssSection, new byte[key.Size], key.Alignment); }); _externSymbols = new NodeCache<string, ExternSymbolNode>((string name) => { return new ExternSymbolNode(name); }); _externIndirectSymbols = new NodeCache<string, ExternSymbolNode>((string name) => { return new ExternSymbolNode(name, isIndirection: true); }); _pInvokeModuleFixups = new NodeCache<PInvokeModuleData, PInvokeModuleFixupNode>((PInvokeModuleData moduleData) => { return new PInvokeModuleFixupNode(moduleData); }); _pInvokeMethodFixups = new NodeCache<PInvokeMethodData, PInvokeMethodFixupNode>((PInvokeMethodData methodData) => { return new PInvokeMethodFixupNode(methodData); }); _methodEntrypoints = new NodeCache<MethodDesc, IMethodNode>(CreateMethodEntrypointNode); _unboxingStubs = new NodeCache<MethodDesc, IMethodNode>(CreateUnboxingStubNode); _methodAssociatedData = new NodeCache<IMethodNode, MethodAssociatedDataNode>(methodNode => { return new MethodAssociatedDataNode(methodNode); }); _fatFunctionPointers = new NodeCache<MethodKey, FatFunctionPointerNode>(method => { return new FatFunctionPointerNode(method.Method, method.IsUnboxingStub); }); _gvmDependenciesNode = new NodeCache<MethodDesc, GVMDependenciesNode>(method => { return new GVMDependenciesNode(method); }); _gvmTableEntries = new NodeCache<TypeDesc, TypeGVMEntriesNode>(type => { return new TypeGVMEntriesNode(type); }); _dynamicInvokeTemplates = new NodeCache<MethodDesc, DynamicInvokeTemplateNode>(method => { return new DynamicInvokeTemplateNode(method); }); _reflectableMethods = new NodeCache<MethodDesc, ReflectableMethodNode>(method => { return new ReflectableMethodNode(method); }); _objectGetTypeFlowDependencies = new NodeCache<MetadataType, ObjectGetTypeFlowDependenciesNode>(type => { return new ObjectGetTypeFlowDependenciesNode(type); }); _shadowConcreteMethods = new NodeCache<MethodKey, IMethodNode>(methodKey => { MethodDesc canonMethod = methodKey.Method.GetCanonMethodTarget(CanonicalFormKind.Specific); if (methodKey.IsUnboxingStub) { return new ShadowConcreteUnboxingThunkNode(methodKey.Method, MethodEntrypoint(canonMethod, true)); } else { return new ShadowConcreteMethodNode(methodKey.Method, MethodEntrypoint(canonMethod)); } }); _virtMethods = new NodeCache<MethodDesc, VirtualMethodUseNode>((MethodDesc method) => { // We don't need to track virtual method uses for types that have a vtable with a known layout. // It's a waste of CPU time and memory. Debug.Assert(!VTable(method.OwningType).HasFixedSlots); return new VirtualMethodUseNode(method); }); _variantMethods = new NodeCache<MethodDesc, VariantInterfaceMethodUseNode>((MethodDesc method) => { // We don't need to track virtual method uses for types that have a vtable with a known layout. // It's a waste of CPU time and memory. Debug.Assert(!VTable(method.OwningType).HasFixedSlots); return new VariantInterfaceMethodUseNode(method); }); _readyToRunHelpers = new NodeCache<ReadyToRunHelperKey, ISymbolNode>(CreateReadyToRunHelperNode); _genericReadyToRunHelpersFromDict = new NodeCache<ReadyToRunGenericHelperKey, ISymbolNode>(CreateGenericLookupFromDictionaryNode); _genericReadyToRunHelpersFromType = new NodeCache<ReadyToRunGenericHelperKey, ISymbolNode>(CreateGenericLookupFromTypeNode); _frozenStringNodes = new NodeCache<string, FrozenStringNode>((string data) => { return new FrozenStringNode(data, Target); }); _frozenObjectNodes = new NodeCache<SerializedFrozenObjectKey, FrozenObjectNode>(key => { return new FrozenObjectNode(key.Owner, key.SerializableObject); }); _interfaceDispatchCells = new NodeCache<DispatchCellKey, InterfaceDispatchCellNode>(callSiteCell => { return new InterfaceDispatchCellNode(callSiteCell.Target, callSiteCell.CallsiteId); }); _interfaceDispatchMaps = new NodeCache<TypeDesc, InterfaceDispatchMapNode>((TypeDesc type) => { return new InterfaceDispatchMapNode(this, type); }); _sealedVtableNodes = new NodeCache<TypeDesc, SealedVTableNode>((TypeDesc type) => { return new SealedVTableNode(type); }); _runtimeMethodHandles = new NodeCache<MethodDesc, RuntimeMethodHandleNode>((MethodDesc method) => { return new RuntimeMethodHandleNode(method); }); _runtimeFieldHandles = new NodeCache<FieldDesc, RuntimeFieldHandleNode>((FieldDesc field) => { return new RuntimeFieldHandleNode(field); }); _dataflowAnalyzedMethods = new NodeCache<MethodILKey, DataflowAnalyzedMethodNode>((MethodILKey il) => { return new DataflowAnalyzedMethodNode(il.MethodIL); }); _interfaceDispatchMapIndirectionNodes = new NodeCache<TypeDesc, EmbeddedObjectNode>((TypeDesc type) => { return DispatchMapTable.NewNodeWithSymbol(InterfaceDispatchMap(type)); }); _genericCompositions = new NodeCache<GenericCompositionDetails, GenericCompositionNode>((GenericCompositionDetails details) => { return new GenericCompositionNode(details); }); _eagerCctorIndirectionNodes = new NodeCache<MethodDesc, EmbeddedObjectNode>((MethodDesc method) => { Debug.Assert(method.IsStaticConstructor); Debug.Assert(PreinitializationManager.HasEagerStaticConstructor((MetadataType)method.OwningType)); return EagerCctorTable.NewNode(MethodEntrypoint(method)); }); _delegateMarshalingDataNodes = new NodeCache<DefType, DelegateMarshallingDataNode>(type => { return new DelegateMarshallingDataNode(type); }); _structMarshalingDataNodes = new NodeCache<DefType, StructMarshallingDataNode>(type => { return new StructMarshallingDataNode(type); }); _vTableNodes = new NodeCache<TypeDesc, VTableSliceNode>((TypeDesc type ) => { if (CompilationModuleGroup.ShouldProduceFullVTable(type)) return new EagerlyBuiltVTableSliceNode(type); else return _vtableSliceProvider.GetSlice(type); }); _methodGenericDictionaries = new NodeCache<MethodDesc, ISortableSymbolNode>(method => { if (CompilationModuleGroup.ContainsMethodDictionary(method)) { return new MethodGenericDictionaryNode(method, this); } else { return _importedNodeProvider.ImportedMethodDictionaryNode(this, method); } }); _typeGenericDictionaries = new NodeCache<TypeDesc, ISortableSymbolNode>(type => { if (CompilationModuleGroup.ContainsTypeDictionary(type)) { Debug.Assert(!this.LazyGenericsPolicy.UsesLazyGenerics(type)); return new TypeGenericDictionaryNode(type, this); } else { return _importedNodeProvider.ImportedTypeDictionaryNode(this, type); } }); _typesWithMetadata = new NodeCache<MetadataType, TypeMetadataNode>(type => { return new TypeMetadataNode(type); }); _methodsWithMetadata = new NodeCache<MethodDesc, MethodMetadataNode>(method => { return new MethodMetadataNode(method); }); _fieldsWithMetadata = new NodeCache<FieldDesc, FieldMetadataNode>(field => { return new FieldMetadataNode(field); }); _modulesWithMetadata = new NodeCache<ModuleDesc, ModuleMetadataNode>(module => { return new ModuleMetadataNode(module); }); _customAttributesWithMetadata = new NodeCache<ReflectableCustomAttribute, CustomAttributeMetadataNode>(ca => { return new CustomAttributeMetadataNode(ca); }); _genericDictionaryLayouts = new NodeCache<TypeSystemEntity, DictionaryLayoutNode>(_dictionaryLayoutProvider.GetLayout); _stringAllocators = new NodeCache<MethodDesc, IMethodNode>(constructor => { return new StringAllocatorMethodNode(constructor); }); NativeLayout = new NativeLayoutHelper(this); } protected virtual ISymbolNode CreateGenericLookupFromDictionaryNode(ReadyToRunGenericHelperKey helperKey) { return new ReadyToRunGenericLookupFromDictionaryNode(this, helperKey.HelperId, helperKey.Target, helperKey.DictionaryOwner); } protected virtual ISymbolNode CreateGenericLookupFromTypeNode(ReadyToRunGenericHelperKey helperKey) { return new ReadyToRunGenericLookupFromTypeNode(this, helperKey.HelperId, helperKey.Target, helperKey.DictionaryOwner); } protected virtual IEETypeNode CreateNecessaryTypeNode(TypeDesc type) { Debug.Assert(!_compilationModuleGroup.ShouldReferenceThroughImportTable(type)); if (_compilationModuleGroup.ContainsType(type)) { if (type.IsGenericDefinition) { return new GenericDefinitionEETypeNode(this, type); } else if (type.IsCanonicalDefinitionType(CanonicalFormKind.Any)) { return new CanonicalDefinitionEETypeNode(this, type); } else if (type.IsCanonicalSubtype(CanonicalFormKind.Any)) { return new NecessaryCanonicalEETypeNode(this, type); } else { return new EETypeNode(this, type); } } else { return new ExternEETypeSymbolNode(this, type); } } protected virtual IEETypeNode CreateConstructedTypeNode(TypeDesc type) { // Canonical definition types are *not* constructed types (call NecessaryTypeSymbol to get them) Debug.Assert(!type.IsCanonicalDefinitionType(CanonicalFormKind.Any)); Debug.Assert(!_compilationModuleGroup.ShouldReferenceThroughImportTable(type)); if (_compilationModuleGroup.ContainsType(type)) { if (type.IsCanonicalSubtype(CanonicalFormKind.Any)) { return new CanonicalEETypeNode(this, type); } else { return new ConstructedEETypeNode(this, type); } } else { return new ExternEETypeSymbolNode(this, type); } } protected abstract IMethodNode CreateMethodEntrypointNode(MethodDesc method); protected abstract IMethodNode CreateUnboxingStubNode(MethodDesc method); protected abstract ISymbolNode CreateReadyToRunHelperNode(ReadyToRunHelperKey helperCall); protected virtual ISymbolDefinitionNode CreateThreadStaticsNode(MetadataType type) { return new ThreadStaticsNode(type, this); } private NodeCache<TypeDesc, IEETypeNode> _typeSymbols; public IEETypeNode NecessaryTypeSymbol(TypeDesc type) { if (_compilationModuleGroup.ShouldReferenceThroughImportTable(type)) { return ImportedEETypeSymbol(type); } if (_compilationModuleGroup.ShouldPromoteToFullType(type)) { return ConstructedTypeSymbol(type); } Debug.Assert(!TypeCannotHaveEEType(type)); return _typeSymbols.GetOrAdd(type); } private NodeCache<TypeDesc, IEETypeNode> _constructedTypeSymbols; public IEETypeNode ConstructedTypeSymbol(TypeDesc type) { if (_compilationModuleGroup.ShouldReferenceThroughImportTable(type)) { return ImportedEETypeSymbol(type); } Debug.Assert(!TypeCannotHaveEEType(type)); return _constructedTypeSymbols.GetOrAdd(type); } private NodeCache<TypeDesc, IEETypeNode> _clonedTypeSymbols; public IEETypeNode MaximallyConstructableType(TypeDesc type) { if (ConstructedEETypeNode.CreationAllowed(type)) return ConstructedTypeSymbol(type); else return NecessaryTypeSymbol(type); } public IEETypeNode ConstructedClonedTypeSymbol(TypeDesc type) { Debug.Assert(!TypeCannotHaveEEType(type)); return _clonedTypeSymbols.GetOrAdd(type); } private NodeCache<TypeDesc, IEETypeNode> _importedTypeSymbols; private IEETypeNode ImportedEETypeSymbol(TypeDesc type) { Debug.Assert(_compilationModuleGroup.ShouldReferenceThroughImportTable(type)); return _importedTypeSymbols.GetOrAdd(type); } private NodeCache<MetadataType, ISortableSymbolNode> _nonGCStatics; public ISortableSymbolNode TypeNonGCStaticsSymbol(MetadataType type) { Debug.Assert(!TypeCannotHaveEEType(type)); return _nonGCStatics.GetOrAdd(type); } private NodeCache<MetadataType, ISortableSymbolNode> _GCStatics; public ISortableSymbolNode TypeGCStaticsSymbol(MetadataType type) { Debug.Assert(!TypeCannotHaveEEType(type)); return _GCStatics.GetOrAdd(type); } private NodeCache<MetadataType, GCStaticsPreInitDataNode> _GCStaticsPreInitDataNodes; public GCStaticsPreInitDataNode GCStaticsPreInitDataNode(MetadataType type) { return _GCStaticsPreInitDataNodes.GetOrAdd(type); } private NodeCache<MetadataType, EmbeddedObjectNode> _GCStaticIndirectionNodes; public EmbeddedObjectNode GCStaticIndirection(MetadataType type) { return _GCStaticIndirectionNodes.GetOrAdd(type); } private NodeCache<MetadataType, ISymbolDefinitionNode> _threadStatics; public ISymbolDefinitionNode TypeThreadStaticsSymbol(MetadataType type) { // This node is always used in the context of its index within the region. // We should never ask for this if the current compilation doesn't contain the // associated type. Debug.Assert(_compilationModuleGroup.ContainsType(type)); return _threadStatics.GetOrAdd(type); } private NodeCache<MetadataType, TypeThreadStaticIndexNode> _typeThreadStaticIndices; public ISortableSymbolNode TypeThreadStaticIndex(MetadataType type) { if (_compilationModuleGroup.ContainsType(type)) { return _typeThreadStaticIndices.GetOrAdd(type); } else { return ExternSymbol(NameMangler.NodeMangler.ThreadStaticsIndex(type)); } } private NodeCache<DispatchCellKey, InterfaceDispatchCellNode> _interfaceDispatchCells; public InterfaceDispatchCellNode InterfaceDispatchCell(MethodDesc method, string callSite = null) { return _interfaceDispatchCells.GetOrAdd(new DispatchCellKey(method, callSite)); } private NodeCache<MethodDesc, RuntimeMethodHandleNode> _runtimeMethodHandles; public RuntimeMethodHandleNode RuntimeMethodHandle(MethodDesc method) { return _runtimeMethodHandles.GetOrAdd(method); } private NodeCache<FieldDesc, RuntimeFieldHandleNode> _runtimeFieldHandles; public RuntimeFieldHandleNode RuntimeFieldHandle(FieldDesc field) { return _runtimeFieldHandles.GetOrAdd(field); } private NodeCache<MethodILKey, DataflowAnalyzedMethodNode> _dataflowAnalyzedMethods; public DataflowAnalyzedMethodNode DataflowAnalyzedMethod(MethodIL methodIL) { return _dataflowAnalyzedMethods.GetOrAdd(new MethodILKey(methodIL)); } private NodeCache<GCPointerMap, GCStaticEETypeNode> _GCStaticEETypes; public ISymbolNode GCStaticEEType(GCPointerMap gcMap) { return _GCStaticEETypes.GetOrAdd(gcMap); } private NodeCache<UninitializedWritableDataBlobKey, BlobNode> _uninitializedWritableDataBlobs; public BlobNode UninitializedWritableDataBlob(Utf8String name, int size, int alignment) { return _uninitializedWritableDataBlobs.GetOrAdd(new UninitializedWritableDataBlobKey(name, size, alignment)); } private NodeCache<ReadOnlyDataBlobKey, BlobNode> _readOnlyDataBlobs; public BlobNode ReadOnlyDataBlob(Utf8String name, byte[] blobData, int alignment) { return _readOnlyDataBlobs.GetOrAdd(new ReadOnlyDataBlobKey(name, blobData, alignment)); } private NodeCache<TypeDesc, SealedVTableNode> _sealedVtableNodes; internal SealedVTableNode SealedVTable(TypeDesc type) { return _sealedVtableNodes.GetOrAdd(type); } private NodeCache<TypeDesc, InterfaceDispatchMapNode> _interfaceDispatchMaps; internal InterfaceDispatchMapNode InterfaceDispatchMap(TypeDesc type) { return _interfaceDispatchMaps.GetOrAdd(type); } private NodeCache<TypeDesc, EmbeddedObjectNode> _interfaceDispatchMapIndirectionNodes; public EmbeddedObjectNode InterfaceDispatchMapIndirection(TypeDesc type) { return _interfaceDispatchMapIndirectionNodes.GetOrAdd(type); } private NodeCache<GenericCompositionDetails, GenericCompositionNode> _genericCompositions; internal ISymbolNode GenericComposition(GenericCompositionDetails details) { return _genericCompositions.GetOrAdd(details); } private NodeCache<string, ExternSymbolNode> _externSymbols; public ISortableSymbolNode ExternSymbol(string name) { return _externSymbols.GetOrAdd(name); } private NodeCache<string, ExternSymbolNode> _externIndirectSymbols; public ISortableSymbolNode ExternIndirectSymbol(string name) { return _externIndirectSymbols.GetOrAdd(name); } private NodeCache<PInvokeModuleData, PInvokeModuleFixupNode> _pInvokeModuleFixups; public ISymbolNode PInvokeModuleFixup(PInvokeModuleData moduleData) { return _pInvokeModuleFixups.GetOrAdd(moduleData); } private NodeCache<PInvokeMethodData, PInvokeMethodFixupNode> _pInvokeMethodFixups; public PInvokeMethodFixupNode PInvokeMethodFixup(PInvokeMethodData methodData) { return _pInvokeMethodFixups.GetOrAdd(methodData); } private NodeCache<TypeDesc, VTableSliceNode> _vTableNodes; public VTableSliceNode VTable(TypeDesc type) { return _vTableNodes.GetOrAdd(type); } private NodeCache<MethodDesc, ISortableSymbolNode> _methodGenericDictionaries; public ISortableSymbolNode MethodGenericDictionary(MethodDesc method) { return _methodGenericDictionaries.GetOrAdd(method); } private NodeCache<TypeDesc, ISortableSymbolNode> _typeGenericDictionaries; public ISortableSymbolNode TypeGenericDictionary(TypeDesc type) { return _typeGenericDictionaries.GetOrAdd(type); } private NodeCache<TypeSystemEntity, DictionaryLayoutNode> _genericDictionaryLayouts; public DictionaryLayoutNode GenericDictionaryLayout(TypeSystemEntity methodOrType) { return _genericDictionaryLayouts.GetOrAdd(methodOrType); } private NodeCache<MethodDesc, IMethodNode> _stringAllocators; public IMethodNode StringAllocator(MethodDesc stringConstructor) { return _stringAllocators.GetOrAdd(stringConstructor); } protected NodeCache<MethodDesc, IMethodNode> _methodEntrypoints; private NodeCache<MethodDesc, IMethodNode> _unboxingStubs; private NodeCache<IMethodNode, MethodAssociatedDataNode> _methodAssociatedData; public IMethodNode MethodEntrypoint(MethodDesc method, bool unboxingStub = false) { if (unboxingStub) { return _unboxingStubs.GetOrAdd(method); } return _methodEntrypoints.GetOrAdd(method); } public MethodAssociatedDataNode MethodAssociatedData(IMethodNode methodNode) { return _methodAssociatedData.GetOrAdd(methodNode); } private NodeCache<MethodKey, FatFunctionPointerNode> _fatFunctionPointers; public IMethodNode FatFunctionPointer(MethodDesc method, bool isUnboxingStub = false) { return _fatFunctionPointers.GetOrAdd(new MethodKey(method, isUnboxingStub)); } public IMethodNode ExactCallableAddress(MethodDesc method, bool isUnboxingStub = false) { MethodDesc canonMethod = method.GetCanonMethodTarget(CanonicalFormKind.Specific); if (method != canonMethod) return FatFunctionPointer(method, isUnboxingStub); else return MethodEntrypoint(method, isUnboxingStub); } public IMethodNode CanonicalEntrypoint(MethodDesc method, bool isUnboxingStub = false) { MethodDesc canonMethod = method.GetCanonMethodTarget(CanonicalFormKind.Specific); if (method != canonMethod) return ShadowConcreteMethod(method, isUnboxingStub); else return MethodEntrypoint(method, isUnboxingStub); } private NodeCache<MethodDesc, GVMDependenciesNode> _gvmDependenciesNode; public GVMDependenciesNode GVMDependencies(MethodDesc method) { return _gvmDependenciesNode.GetOrAdd(method); } private NodeCache<TypeDesc, TypeGVMEntriesNode> _gvmTableEntries; internal TypeGVMEntriesNode TypeGVMEntries(TypeDesc type) { return _gvmTableEntries.GetOrAdd(type); } private NodeCache<MethodDesc, ReflectableMethodNode> _reflectableMethods; public ReflectableMethodNode ReflectableMethod(MethodDesc method) { return _reflectableMethods.GetOrAdd(method); } private NodeCache<MetadataType, ObjectGetTypeFlowDependenciesNode> _objectGetTypeFlowDependencies; internal ObjectGetTypeFlowDependenciesNode ObjectGetTypeFlowDependencies(MetadataType type) { return _objectGetTypeFlowDependencies.GetOrAdd(type); } private NodeCache<MethodDesc, DynamicInvokeTemplateNode> _dynamicInvokeTemplates; internal DynamicInvokeTemplateNode DynamicInvokeTemplate(MethodDesc method) { return _dynamicInvokeTemplates.GetOrAdd(method); } private NodeCache<MethodKey, IMethodNode> _shadowConcreteMethods; public IMethodNode ShadowConcreteMethod(MethodDesc method, bool isUnboxingStub = false) { return _shadowConcreteMethods.GetOrAdd(new MethodKey(method, isUnboxingStub)); } private static readonly string[][] s_helperEntrypointNames = new string[][] { new string[] { "System.Runtime.CompilerServices", "ClassConstructorRunner", "CheckStaticClassConstructionReturnGCStaticBase" }, new string[] { "System.Runtime.CompilerServices", "ClassConstructorRunner", "CheckStaticClassConstructionReturnNonGCStaticBase" }, new string[] { "System.Runtime.CompilerServices", "ClassConstructorRunner", "CheckStaticClassConstructionReturnThreadStaticBase" }, new string[] { "Internal.Runtime", "ThreadStatics", "GetThreadStaticBaseForType" } }; private ISymbolNode[] _helperEntrypointSymbols; public ISymbolNode HelperEntrypoint(HelperEntrypoint entrypoint) { if (_helperEntrypointSymbols == null) _helperEntrypointSymbols = new ISymbolNode[s_helperEntrypointNames.Length]; int index = (int)entrypoint; ISymbolNode symbol = _helperEntrypointSymbols[index]; if (symbol == null) { var entry = s_helperEntrypointNames[index]; var type = _context.SystemModule.GetKnownType(entry[0], entry[1]); var method = type.GetKnownMethod(entry[2], null); symbol = MethodEntrypoint(method); _helperEntrypointSymbols[index] = symbol; } return symbol; } private MetadataType _systemArrayOfTClass; public MetadataType ArrayOfTClass { get { if (_systemArrayOfTClass == null) { _systemArrayOfTClass = _context.SystemModule.GetKnownType("System", "Array`1"); } return _systemArrayOfTClass; } } private TypeDesc _systemArrayOfTEnumeratorType; public TypeDesc ArrayOfTEnumeratorType { get { if (_systemArrayOfTEnumeratorType == null) { _systemArrayOfTEnumeratorType = ArrayOfTClass.GetNestedType("ArrayEnumerator"); } return _systemArrayOfTEnumeratorType; } } private MethodDesc _instanceMethodRemovedHelper; public MethodDesc InstanceMethodRemovedHelper { get { if (_instanceMethodRemovedHelper == null) { // This helper is optional, but it's fine for this cache to be ineffective if that happens. // Those scenarios are rare and typically deal with small compilations. _instanceMethodRemovedHelper = TypeSystemContext.GetOptionalHelperEntryPoint("ThrowHelpers", "ThrowInstanceBodyRemoved"); } return _instanceMethodRemovedHelper; } } private NodeCache<MethodDesc, VirtualMethodUseNode> _virtMethods; public DependencyNodeCore<NodeFactory> VirtualMethodUse(MethodDesc decl) { return _virtMethods.GetOrAdd(decl); } private NodeCache<MethodDesc, VariantInterfaceMethodUseNode> _variantMethods; public DependencyNodeCore<NodeFactory> VariantInterfaceMethodUse(MethodDesc decl) { return _variantMethods.GetOrAdd(decl); } private NodeCache<ReadyToRunHelperKey, ISymbolNode> _readyToRunHelpers; public ISymbolNode ReadyToRunHelper(ReadyToRunHelperId id, Object target) { return _readyToRunHelpers.GetOrAdd(new ReadyToRunHelperKey(id, target)); } private NodeCache<ReadyToRunGenericHelperKey, ISymbolNode> _genericReadyToRunHelpersFromDict; public ISymbolNode ReadyToRunHelperFromDictionaryLookup(ReadyToRunHelperId id, Object target, TypeSystemEntity dictionaryOwner) { return _genericReadyToRunHelpersFromDict.GetOrAdd(new ReadyToRunGenericHelperKey(id, target, dictionaryOwner)); } private NodeCache<ReadyToRunGenericHelperKey, ISymbolNode> _genericReadyToRunHelpersFromType; public ISymbolNode ReadyToRunHelperFromTypeLookup(ReadyToRunHelperId id, Object target, TypeSystemEntity dictionaryOwner) { return _genericReadyToRunHelpersFromType.GetOrAdd(new ReadyToRunGenericHelperKey(id, target, dictionaryOwner)); } private NodeCache<MetadataType, TypeMetadataNode> _typesWithMetadata; internal TypeMetadataNode TypeMetadata(MetadataType type) { // These are only meaningful for UsageBasedMetadataManager. We should not have them // in the dependency graph otherwise. Debug.Assert(MetadataManager is UsageBasedMetadataManager); return _typesWithMetadata.GetOrAdd(type); } private NodeCache<MethodDesc, MethodMetadataNode> _methodsWithMetadata; internal MethodMetadataNode MethodMetadata(MethodDesc method) { // These are only meaningful for UsageBasedMetadataManager. We should not have them // in the dependency graph otherwise. Debug.Assert(MetadataManager is UsageBasedMetadataManager); return _methodsWithMetadata.GetOrAdd(method); } private NodeCache<FieldDesc, FieldMetadataNode> _fieldsWithMetadata; internal FieldMetadataNode FieldMetadata(FieldDesc field) { // These are only meaningful for UsageBasedMetadataManager. We should not have them // in the dependency graph otherwise. Debug.Assert(MetadataManager is UsageBasedMetadataManager); return _fieldsWithMetadata.GetOrAdd(field); } private NodeCache<ModuleDesc, ModuleMetadataNode> _modulesWithMetadata; internal ModuleMetadataNode ModuleMetadata(ModuleDesc module) { // These are only meaningful for UsageBasedMetadataManager. We should not have them // in the dependency graph otherwise. Debug.Assert(MetadataManager is UsageBasedMetadataManager); return _modulesWithMetadata.GetOrAdd(module); } private NodeCache<ReflectableCustomAttribute, CustomAttributeMetadataNode> _customAttributesWithMetadata; internal CustomAttributeMetadataNode CustomAttributeMetadata(ReflectableCustomAttribute ca) { // These are only meaningful for UsageBasedMetadataManager. We should not have them // in the dependency graph otherwise. Debug.Assert(MetadataManager is UsageBasedMetadataManager); return _customAttributesWithMetadata.GetOrAdd(ca); } private NodeCache<string, FrozenStringNode> _frozenStringNodes; public FrozenStringNode SerializedStringObject(string data) { return _frozenStringNodes.GetOrAdd(data); } private NodeCache<SerializedFrozenObjectKey, FrozenObjectNode> _frozenObjectNodes; public FrozenObjectNode SerializedFrozenObject(FieldDesc owningField, TypePreinit.ISerializableReference data) { return _frozenObjectNodes.GetOrAdd(new SerializedFrozenObjectKey(owningField, data)); } private NodeCache<MethodDesc, EmbeddedObjectNode> _eagerCctorIndirectionNodes; public EmbeddedObjectNode EagerCctorIndirection(MethodDesc cctorMethod) { return _eagerCctorIndirectionNodes.GetOrAdd(cctorMethod); } public ISymbolNode ConstantUtf8String(string str) { int stringBytesCount = Encoding.UTF8.GetByteCount(str); byte[] stringBytes = new byte[stringBytesCount + 1]; Encoding.UTF8.GetBytes(str, 0, str.Length, stringBytes, 0); string symbolName = "__utf8str_" + NameMangler.GetMangledStringName(str); return ReadOnlyDataBlob(symbolName, stringBytes, 1); } private NodeCache<DefType, DelegateMarshallingDataNode> _delegateMarshalingDataNodes; public DelegateMarshallingDataNode DelegateMarshallingData(DefType type) { return _delegateMarshalingDataNodes.GetOrAdd(type); } private NodeCache<DefType, StructMarshallingDataNode> _structMarshalingDataNodes; public StructMarshallingDataNode StructMarshallingData(DefType type) { return _structMarshalingDataNodes.GetOrAdd(type); } /// <summary> /// Returns alternative symbol name that object writer should produce for given symbols /// in addition to the regular one. /// </summary> public string GetSymbolAlternateName(ISymbolNode node) { string value; if (!NodeAliases.TryGetValue(node, out value)) return null; return value; } public ArrayOfEmbeddedPointersNode<GCStaticsNode> GCStaticsRegion = new ArrayOfEmbeddedPointersNode<GCStaticsNode>( "__GCStaticRegionStart", "__GCStaticRegionEnd", new SortableDependencyNode.ObjectNodeComparer(new CompilerComparer())); public ArrayOfEmbeddedDataNode<ThreadStaticsNode> ThreadStaticsRegion = new ArrayOfEmbeddedDataNode<ThreadStaticsNode>( "__ThreadStaticRegionStart", "__ThreadStaticRegionEnd", new SortableDependencyNode.EmbeddedObjectNodeComparer(new CompilerComparer())); public ArrayOfEmbeddedPointersNode<IMethodNode> EagerCctorTable = new ArrayOfEmbeddedPointersNode<IMethodNode>( "__EagerCctorStart", "__EagerCctorEnd", null); public ArrayOfEmbeddedPointersNode<InterfaceDispatchMapNode> DispatchMapTable = new ArrayOfEmbeddedPointersNode<InterfaceDispatchMapNode>( "__DispatchMapTableStart", "__DispatchMapTableEnd", new SortableDependencyNode.ObjectNodeComparer(new CompilerComparer())); public ArrayOfEmbeddedDataNode<EmbeddedObjectNode> FrozenSegmentRegion = new ArrayOfFrozenObjectsNode<EmbeddedObjectNode>( "__FrozenSegmentRegionStart", "__FrozenSegmentRegionEnd", new SortableDependencyNode.EmbeddedObjectNodeComparer(new CompilerComparer())); internal ModuleInitializerListNode ModuleInitializerList = new ModuleInitializerListNode(); public InterfaceDispatchCellSectionNode InterfaceDispatchCellSection { get; } public ReadyToRunHeaderNode ReadyToRunHeader; public Dictionary<ISymbolNode, string> NodeAliases = new Dictionary<ISymbolNode, string>(); protected internal TypeManagerIndirectionNode TypeManagerIndirection = new TypeManagerIndirectionNode(); public virtual void AttachToDependencyGraph(DependencyAnalyzerBase<NodeFactory> graph) { ReadyToRunHeader = new ReadyToRunHeaderNode(Target); graph.AddRoot(ReadyToRunHeader, "ReadyToRunHeader is always generated"); graph.AddRoot(new ModulesSectionNode(Target), "ModulesSection is always generated"); graph.AddRoot(GCStaticsRegion, "GC StaticsRegion is always generated"); graph.AddRoot(ThreadStaticsRegion, "ThreadStaticsRegion is always generated"); graph.AddRoot(EagerCctorTable, "EagerCctorTable is always generated"); graph.AddRoot(TypeManagerIndirection, "TypeManagerIndirection is always generated"); graph.AddRoot(DispatchMapTable, "DispatchMapTable is always generated"); graph.AddRoot(FrozenSegmentRegion, "FrozenSegmentRegion is always generated"); graph.AddRoot(InterfaceDispatchCellSection, "Interface dispatch cell section is always generated"); graph.AddRoot(ModuleInitializerList, "Module initializer list is always generated"); ReadyToRunHeader.Add(ReadyToRunSectionType.GCStaticRegion, GCStaticsRegion, GCStaticsRegion.StartSymbol, GCStaticsRegion.EndSymbol); ReadyToRunHeader.Add(ReadyToRunSectionType.ThreadStaticRegion, ThreadStaticsRegion, ThreadStaticsRegion.StartSymbol, ThreadStaticsRegion.EndSymbol); ReadyToRunHeader.Add(ReadyToRunSectionType.EagerCctor, EagerCctorTable, EagerCctorTable.StartSymbol, EagerCctorTable.EndSymbol); ReadyToRunHeader.Add(ReadyToRunSectionType.TypeManagerIndirection, TypeManagerIndirection, TypeManagerIndirection); ReadyToRunHeader.Add(ReadyToRunSectionType.InterfaceDispatchTable, DispatchMapTable, DispatchMapTable.StartSymbol); ReadyToRunHeader.Add(ReadyToRunSectionType.FrozenObjectRegion, FrozenSegmentRegion, FrozenSegmentRegion.StartSymbol, FrozenSegmentRegion.EndSymbol); ReadyToRunHeader.Add(ReadyToRunSectionType.ModuleInitializerList, ModuleInitializerList, ModuleInitializerList, ModuleInitializerList.EndSymbol); var commonFixupsTableNode = new ExternalReferencesTableNode("CommonFixupsTable", this); InteropStubManager.AddToReadyToRunHeader(ReadyToRunHeader, this, commonFixupsTableNode); MetadataManager.AddToReadyToRunHeader(ReadyToRunHeader, this, commonFixupsTableNode); MetadataManager.AttachToDependencyGraph(graph); ReadyToRunHeader.Add(MetadataManager.BlobIdToReadyToRunSection(ReflectionMapBlob.CommonFixupsTable), commonFixupsTableNode, commonFixupsTableNode, commonFixupsTableNode.EndSymbol); } protected struct MethodKey : IEquatable<MethodKey> { public readonly MethodDesc Method; public readonly bool IsUnboxingStub; public MethodKey(MethodDesc method, bool isUnboxingStub) { Method = method; IsUnboxingStub = isUnboxingStub; } public bool Equals(MethodKey other) => Method == other.Method && IsUnboxingStub == other.IsUnboxingStub; public override bool Equals(object obj) => obj is MethodKey && Equals((MethodKey)obj); public override int GetHashCode() => Method.GetHashCode(); } protected struct ReadyToRunHelperKey : IEquatable<ReadyToRunHelperKey> { public readonly object Target; public readonly ReadyToRunHelperId HelperId; public ReadyToRunHelperKey(ReadyToRunHelperId helperId, object target) { HelperId = helperId; Target = target; } public bool Equals(ReadyToRunHelperKey other) => HelperId == other.HelperId && Target.Equals(other.Target); public override bool Equals(object obj) => obj is ReadyToRunHelperKey && Equals((ReadyToRunHelperKey)obj); public override int GetHashCode() { int hashCode = (int)HelperId * 0x5498341 + 0x832424; hashCode = hashCode * 23 + Target.GetHashCode(); return hashCode; } } protected struct ReadyToRunGenericHelperKey : IEquatable<ReadyToRunGenericHelperKey> { public readonly object Target; public readonly TypeSystemEntity DictionaryOwner; public readonly ReadyToRunHelperId HelperId; public ReadyToRunGenericHelperKey(ReadyToRunHelperId helperId, object target, TypeSystemEntity dictionaryOwner) { HelperId = helperId; Target = target; DictionaryOwner = dictionaryOwner; } public bool Equals(ReadyToRunGenericHelperKey other) => HelperId == other.HelperId && DictionaryOwner == other.DictionaryOwner && Target.Equals(other.Target); public override bool Equals(object obj) => obj is ReadyToRunGenericHelperKey && Equals((ReadyToRunGenericHelperKey)obj); public override int GetHashCode() { int hashCode = (int)HelperId * 0x5498341 + 0x832424; hashCode = hashCode * 23 + Target.GetHashCode(); hashCode = hashCode * 23 + DictionaryOwner.GetHashCode(); return hashCode; } } protected struct DispatchCellKey : IEquatable<DispatchCellKey> { public readonly MethodDesc Target; public readonly string CallsiteId; public DispatchCellKey(MethodDesc target, string callsiteId) { Target = target; CallsiteId = callsiteId; } public bool Equals(DispatchCellKey other) => Target == other.Target && CallsiteId == other.CallsiteId; public override bool Equals(object obj) => obj is DispatchCellKey && Equals((DispatchCellKey)obj); public override int GetHashCode() { int hashCode = Target.GetHashCode(); if (CallsiteId != null) hashCode = hashCode * 23 + CallsiteId.GetHashCode(); return hashCode; } } protected struct ReadOnlyDataBlobKey : IEquatable<ReadOnlyDataBlobKey> { public readonly Utf8String Name; public readonly byte[] Data; public readonly int Alignment; public ReadOnlyDataBlobKey(Utf8String name, byte[] data, int alignment) { Name = name; Data = data; Alignment = alignment; } // The assumption here is that the name of the blob is unique. // We can't emit two blobs with the same name and different contents. // The name is part of the symbolic name and we don't do any mangling on it. public bool Equals(ReadOnlyDataBlobKey other) => Name.Equals(other.Name); public override bool Equals(object obj) => obj is ReadOnlyDataBlobKey && Equals((ReadOnlyDataBlobKey)obj); public override int GetHashCode() => Name.GetHashCode(); } protected struct UninitializedWritableDataBlobKey : IEquatable<UninitializedWritableDataBlobKey> { public readonly Utf8String Name; public readonly int Size; public readonly int Alignment; public UninitializedWritableDataBlobKey(Utf8String name, int size, int alignment) { Name = name; Size = size; Alignment = alignment; } // The assumption here is that the name of the blob is unique. // We can't emit two blobs with the same name and different contents. // The name is part of the symbolic name and we don't do any mangling on it. public bool Equals(UninitializedWritableDataBlobKey other) => Name.Equals(other.Name); public override bool Equals(object obj) => obj is UninitializedWritableDataBlobKey && Equals((UninitializedWritableDataBlobKey)obj); public override int GetHashCode() => Name.GetHashCode(); } protected struct SerializedFrozenObjectKey : IEquatable<SerializedFrozenObjectKey> { public readonly FieldDesc Owner; public readonly TypePreinit.ISerializableReference SerializableObject; public SerializedFrozenObjectKey(FieldDesc owner, TypePreinit.ISerializableReference obj) { Owner = owner; SerializableObject = obj; } public override bool Equals(object obj) => obj is SerializedFrozenObjectKey && Equals((SerializedFrozenObjectKey)obj); public bool Equals(SerializedFrozenObjectKey other) => Owner == other.Owner; public override int GetHashCode() => Owner.GetHashCode(); } private struct MethodILKey : IEquatable<MethodILKey> { public readonly MethodIL MethodIL; public MethodILKey(MethodIL methodIL) => MethodIL = methodIL; public override bool Equals(object obj) => obj is MethodILKey other && Equals(other); public bool Equals(MethodILKey other) => other.MethodIL.OwningMethod == this.MethodIL.OwningMethod; public override int GetHashCode() => MethodIL.OwningMethod.GetHashCode(); } } }
1
dotnet/runtime
66,145
Fix clash between tentative method optimizations
This pull request pretty much became a rollback of https://github.com/dotnet/runtimelab/pull/658 with a regression test to make sure if https://github.com/dotnet/runtimelab/pull/658 is reintroduced, we do it properly. ~~When we were in the situation of the newly added test, we would try to generate method body on the abstract class. Such method body is not actually reachable.~~ ~~Saves 500 bytes on a hello world. Fixes a compiler assert (that might be more serious sometimes).~~
MichalStrehovsky
2022-03-03T16:32:47Z
2022-03-07T16:49:51Z
154386d63b3ba55ce3251fa4caf3dfa89279d982
b0d1e89497bfa7a7b602a1d1af2faa97af96c88d
Fix clash between tentative method optimizations. This pull request pretty much became a rollback of https://github.com/dotnet/runtimelab/pull/658 with a regression test to make sure if https://github.com/dotnet/runtimelab/pull/658 is reintroduced, we do it properly. ~~When we were in the situation of the newly added test, we would try to generate method body on the abstract class. Such method body is not actually reachable.~~ ~~Saves 500 bytes on a hello world. Fixes a compiler assert (that might be more serious sometimes).~~
./src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/TentativeInstanceMethodNode.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Generic; using ILCompiler.DependencyAnalysisFramework; using Internal.IL; using Internal.Text; using Internal.TypeSystem; using Debug = System.Diagnostics.Debug; namespace ILCompiler.DependencyAnalysis { /// <summary> /// Represents a stand-in for a real method body that can turn into the real method /// body at object emission phase if the real method body was marked. /// It the real method body wasn't marked, this stub will tail-call into a throw helper. /// This node conditionally depends on the real method body - the real method body /// will be brough into compilation if the owning type was marked. /// This operates under the assumption that instance methods don't get called with /// a null `this`. While it's possible to call instance methods with a null `this`, /// there are many reasons why it's a bad idea (C# language assumes `this` can never be null; /// generically shared native code generated by this compiler assumes `this` is not null and /// we can get the generic dictionary out of it, etc.). public class TentativeInstanceMethodNode : TentativeMethodNode { public TentativeInstanceMethodNode(IMethodBodyNode methodNode) : base(methodNode) { Debug.Assert(!methodNode.Method.Signature.IsStatic); Debug.Assert(!methodNode.Method.OwningType.IsValueType); } public override bool HasConditionalStaticDependencies => true; protected override ISymbolNode GetTarget(NodeFactory factory) { // If the class library doesn't provide this helper, the optimization is disabled. MethodDesc helper = factory.InstanceMethodRemovedHelper; return helper == null ? RealBody: factory.MethodEntrypoint(helper); } public override IEnumerable<CombinedDependencyListEntry> GetConditionalStaticDependencies(NodeFactory factory) { // Convert methods on Array<T> into T[] TypeDesc owningType = Method.OwningType; if (owningType.HasSameTypeDefinition(factory.ArrayOfTClass)) { owningType = owningType.Instantiation[0].MakeArrayType(); } // If a constructed symbol for the owning type was included in the compilation, // include the real method body. return new CombinedDependencyListEntry[] { new CombinedDependencyListEntry( RealBody, factory.ConstructedTypeSymbol(owningType), "Instance method on a constructed type"), }; } protected override string GetName(NodeFactory factory) { return "Tentative instance method: " + RealBody.GetMangledName(factory.NameMangler); } public override int ClassCode => 0x8905207; } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Generic; using ILCompiler.DependencyAnalysisFramework; using Internal.IL; using Internal.Text; using Internal.TypeSystem; using Debug = System.Diagnostics.Debug; namespace ILCompiler.DependencyAnalysis { /// <summary> /// Represents a stand-in for a real method body that can turn into the real method /// body at object emission phase if the real method body was marked. /// It the real method body wasn't marked, this stub will tail-call into a throw helper. /// This node conditionally depends on the real method body - the real method body /// will be brough into compilation if the owning type was marked. /// This operates under the assumption that instance methods don't get called with /// a null `this`. While it's possible to call instance methods with a null `this`, /// there are many reasons why it's a bad idea (C# language assumes `this` can never be null; /// generically shared native code generated by this compiler assumes `this` is not null and /// we can get the generic dictionary out of it, etc.). public class TentativeInstanceMethodNode : TentativeMethodNode { public TentativeInstanceMethodNode(IMethodBodyNode methodNode) : base(methodNode) { Debug.Assert(!methodNode.Method.Signature.IsStatic); Debug.Assert(!methodNode.Method.OwningType.IsValueType); } public override bool HasConditionalStaticDependencies => true; protected override ISymbolNode GetTarget(NodeFactory factory) { // If the class library doesn't provide this helper, the optimization is disabled. MethodDesc helper = factory.InstanceMethodRemovedHelper; return helper == null ? RealBody: factory.MethodEntrypoint(helper); } public override IEnumerable<CombinedDependencyListEntry> GetConditionalStaticDependencies(NodeFactory factory) { // Convert methods on Array<T> into T[] TypeDesc owningType = Method.OwningType; if (owningType.HasSameTypeDefinition(factory.ArrayOfTClass)) { owningType = owningType.Instantiation[0].MakeArrayType(); } // If a constructed symbol for the owning type was included in the compilation, // include the real method body. return new CombinedDependencyListEntry[] { new CombinedDependencyListEntry( RealBody, factory.ConstructedTypeSymbol(owningType), "Instance method on a constructed type"), }; } protected override string GetName(NodeFactory factory) { return "Tentative instance method: " + RealBody.GetMangledName(factory.NameMangler); } public override int ClassCode => 0x8905207; public override string ToString() => Method.ToString(); } }
1
dotnet/runtime
66,145
Fix clash between tentative method optimizations
This pull request pretty much became a rollback of https://github.com/dotnet/runtimelab/pull/658 with a regression test to make sure if https://github.com/dotnet/runtimelab/pull/658 is reintroduced, we do it properly. ~~When we were in the situation of the newly added test, we would try to generate method body on the abstract class. Such method body is not actually reachable.~~ ~~Saves 500 bytes on a hello world. Fixes a compiler assert (that might be more serious sometimes).~~
MichalStrehovsky
2022-03-03T16:32:47Z
2022-03-07T16:49:51Z
154386d63b3ba55ce3251fa4caf3dfa89279d982
b0d1e89497bfa7a7b602a1d1af2faa97af96c88d
Fix clash between tentative method optimizations. This pull request pretty much became a rollback of https://github.com/dotnet/runtimelab/pull/658 with a regression test to make sure if https://github.com/dotnet/runtimelab/pull/658 is reintroduced, we do it properly. ~~When we were in the situation of the newly added test, we would try to generate method body on the abstract class. Such method body is not actually reachable.~~ ~~Saves 500 bytes on a hello world. Fixes a compiler assert (that might be more serious sometimes).~~
./src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/MultiFileCompilationModuleGroup.cs
// 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.Collections.Generic; using System.Diagnostics; using ILCompiler.DependencyAnalysis; using Internal.TypeSystem; using Internal.TypeSystem.Ecma; namespace ILCompiler { public abstract class MultiFileCompilationModuleGroup : CompilationModuleGroup { private HashSet<ModuleDesc> _compilationModuleSet; public MultiFileCompilationModuleGroup(CompilerTypeSystemContext context, IEnumerable<ModuleDesc> compilationModuleSet) { _compilationModuleSet = new HashSet<ModuleDesc>(compilationModuleSet); // The fake assembly that holds compiler generated types is part of the compilation. _compilationModuleSet.Add(context.GeneratedAssembly); } public sealed override bool ContainsType(TypeDesc type) { EcmaType ecmaType = type as EcmaType; if (ecmaType == null) return true; if (!IsModuleInCompilationGroup(ecmaType.EcmaModule)) { return false; } return true; } public sealed override bool ContainsTypeDictionary(TypeDesc type) { return ContainsType(type); } public sealed override bool ContainsMethodBody(MethodDesc method, bool unboxingStub) { if (method.HasInstantiation) return true; return ContainsType(method.OwningType); } public sealed override bool ContainsMethodDictionary(MethodDesc method) { Debug.Assert(method.GetCanonMethodTarget(CanonicalFormKind.Specific) != method); return ContainsMethodBody(method, false); } public sealed override bool ImportsMethod(MethodDesc method, bool unboxingStub) { return false; } private bool IsModuleInCompilationGroup(EcmaModule module) { return _compilationModuleSet.Contains(module); } public sealed override bool IsSingleFileCompilation { get { return false; } } public sealed override bool ShouldReferenceThroughImportTable(TypeDesc type) { return false; } public override bool CanHaveReferenceThroughImportTable { get { return false; } } } /// <summary> /// Represents a non-leaf multifile compilation group where types contained in the group are always fully expanded. /// </summary> public class MultiFileSharedCompilationModuleGroup : MultiFileCompilationModuleGroup { public MultiFileSharedCompilationModuleGroup(CompilerTypeSystemContext context, IEnumerable<ModuleDesc> compilationModuleSet) : base(context, compilationModuleSet) { } public override bool ShouldProduceFullVTable(TypeDesc type) { return ConstructedEETypeNode.CreationAllowed(type); } public override bool ShouldPromoteToFullType(TypeDesc type) { return ShouldProduceFullVTable(type); } public override bool PresenceOfEETypeImpliesAllMethodsOnType(TypeDesc type) { return (type.HasInstantiation || type.IsArray) && ShouldProduceFullVTable(type) && type.ConvertToCanonForm(CanonicalFormKind.Specific).IsCanonicalSubtype(CanonicalFormKind.Any); } public override bool AllowInstanceMethodOptimization(MethodDesc method) { // Both the instance methods and the owning type are homed in a single compilation group // so if we're able to generate the body, we would also generate the owning type here // and nowhere else. Debug.Assert(ContainsMethodBody(method, unboxingStub: false)); TypeDesc owningType = method.OwningType; return owningType.IsDefType && !owningType.HasInstantiation && !method.HasInstantiation; } public override bool AllowVirtualMethodOnAbstractTypeOptimization(MethodDesc method) { // Not really safe to do this since we need to assume IgnoreAccessChecks // and we wouldn't know all derived types when compiling methods on the type // that introduces this method. return false; } } }
// 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.Collections.Generic; using System.Diagnostics; using ILCompiler.DependencyAnalysis; using Internal.TypeSystem; using Internal.TypeSystem.Ecma; namespace ILCompiler { public abstract class MultiFileCompilationModuleGroup : CompilationModuleGroup { private HashSet<ModuleDesc> _compilationModuleSet; public MultiFileCompilationModuleGroup(CompilerTypeSystemContext context, IEnumerable<ModuleDesc> compilationModuleSet) { _compilationModuleSet = new HashSet<ModuleDesc>(compilationModuleSet); // The fake assembly that holds compiler generated types is part of the compilation. _compilationModuleSet.Add(context.GeneratedAssembly); } public sealed override bool ContainsType(TypeDesc type) { EcmaType ecmaType = type as EcmaType; if (ecmaType == null) return true; if (!IsModuleInCompilationGroup(ecmaType.EcmaModule)) { return false; } return true; } public sealed override bool ContainsTypeDictionary(TypeDesc type) { return ContainsType(type); } public sealed override bool ContainsMethodBody(MethodDesc method, bool unboxingStub) { if (method.HasInstantiation) return true; return ContainsType(method.OwningType); } public sealed override bool ContainsMethodDictionary(MethodDesc method) { Debug.Assert(method.GetCanonMethodTarget(CanonicalFormKind.Specific) != method); return ContainsMethodBody(method, false); } public sealed override bool ImportsMethod(MethodDesc method, bool unboxingStub) { return false; } private bool IsModuleInCompilationGroup(EcmaModule module) { return _compilationModuleSet.Contains(module); } public sealed override bool IsSingleFileCompilation { get { return false; } } public sealed override bool ShouldReferenceThroughImportTable(TypeDesc type) { return false; } public override bool CanHaveReferenceThroughImportTable { get { return false; } } } /// <summary> /// Represents a non-leaf multifile compilation group where types contained in the group are always fully expanded. /// </summary> public class MultiFileSharedCompilationModuleGroup : MultiFileCompilationModuleGroup { public MultiFileSharedCompilationModuleGroup(CompilerTypeSystemContext context, IEnumerable<ModuleDesc> compilationModuleSet) : base(context, compilationModuleSet) { } public override bool ShouldProduceFullVTable(TypeDesc type) { return ConstructedEETypeNode.CreationAllowed(type); } public override bool ShouldPromoteToFullType(TypeDesc type) { return ShouldProduceFullVTable(type); } public override bool PresenceOfEETypeImpliesAllMethodsOnType(TypeDesc type) { return (type.HasInstantiation || type.IsArray) && ShouldProduceFullVTable(type) && type.ConvertToCanonForm(CanonicalFormKind.Specific).IsCanonicalSubtype(CanonicalFormKind.Any); } public override bool AllowInstanceMethodOptimization(MethodDesc method) { // Both the instance methods and the owning type are homed in a single compilation group // so if we're able to generate the body, we would also generate the owning type here // and nowhere else. Debug.Assert(ContainsMethodBody(method, unboxingStub: false)); TypeDesc owningType = method.OwningType; return owningType.IsDefType && !owningType.HasInstantiation && !method.HasInstantiation; } } }
1
dotnet/runtime
66,145
Fix clash between tentative method optimizations
This pull request pretty much became a rollback of https://github.com/dotnet/runtimelab/pull/658 with a regression test to make sure if https://github.com/dotnet/runtimelab/pull/658 is reintroduced, we do it properly. ~~When we were in the situation of the newly added test, we would try to generate method body on the abstract class. Such method body is not actually reachable.~~ ~~Saves 500 bytes on a hello world. Fixes a compiler assert (that might be more serious sometimes).~~
MichalStrehovsky
2022-03-03T16:32:47Z
2022-03-07T16:49:51Z
154386d63b3ba55ce3251fa4caf3dfa89279d982
b0d1e89497bfa7a7b602a1d1af2faa97af96c88d
Fix clash between tentative method optimizations. This pull request pretty much became a rollback of https://github.com/dotnet/runtimelab/pull/658 with a regression test to make sure if https://github.com/dotnet/runtimelab/pull/658 is reintroduced, we do it properly. ~~When we were in the situation of the newly added test, we would try to generate method body on the abstract class. Such method body is not actually reachable.~~ ~~Saves 500 bytes on a hello world. Fixes a compiler assert (that might be more serious sometimes).~~
./src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/SingleFileCompilationModuleGroup.cs
// 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 Internal.TypeSystem; namespace ILCompiler { public class SingleFileCompilationModuleGroup : CompilationModuleGroup { public override bool ContainsType(TypeDesc type) { return true; } public override bool ContainsTypeDictionary(TypeDesc type) { return true; } public override bool ContainsMethodBody(MethodDesc method, bool unboxingStub) { return true; } public override bool ContainsMethodDictionary(MethodDesc method) { Debug.Assert(method.GetCanonMethodTarget(CanonicalFormKind.Specific) != method); return ContainsMethodBody(method, false); } public override bool ImportsMethod(MethodDesc method, bool unboxingStub) { return false; } public override bool IsSingleFileCompilation { get { return true; } } public override bool ShouldProduceFullVTable(TypeDesc type) { return false; } public override bool ShouldPromoteToFullType(TypeDesc type) { return false; } public override bool PresenceOfEETypeImpliesAllMethodsOnType(TypeDesc type) { return false; } public override bool ShouldReferenceThroughImportTable(TypeDesc type) { return false; } public override bool CanHaveReferenceThroughImportTable { get { return false; } } public override bool AllowInstanceMethodOptimization(MethodDesc method) { return true; } public override bool AllowVirtualMethodOnAbstractTypeOptimization(MethodDesc method) { return true; } } }
// 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 Internal.TypeSystem; namespace ILCompiler { public class SingleFileCompilationModuleGroup : CompilationModuleGroup { public override bool ContainsType(TypeDesc type) { return true; } public override bool ContainsTypeDictionary(TypeDesc type) { return true; } public override bool ContainsMethodBody(MethodDesc method, bool unboxingStub) { return true; } public override bool ContainsMethodDictionary(MethodDesc method) { Debug.Assert(method.GetCanonMethodTarget(CanonicalFormKind.Specific) != method); return ContainsMethodBody(method, false); } public override bool ImportsMethod(MethodDesc method, bool unboxingStub) { return false; } public override bool IsSingleFileCompilation { get { return true; } } public override bool ShouldProduceFullVTable(TypeDesc type) { return false; } public override bool ShouldPromoteToFullType(TypeDesc type) { return false; } public override bool PresenceOfEETypeImpliesAllMethodsOnType(TypeDesc type) { return false; } public override bool ShouldReferenceThroughImportTable(TypeDesc type) { return false; } public override bool CanHaveReferenceThroughImportTable { get { return false; } } public override bool AllowInstanceMethodOptimization(MethodDesc method) { return true; } } }
1
dotnet/runtime
66,145
Fix clash between tentative method optimizations
This pull request pretty much became a rollback of https://github.com/dotnet/runtimelab/pull/658 with a regression test to make sure if https://github.com/dotnet/runtimelab/pull/658 is reintroduced, we do it properly. ~~When we were in the situation of the newly added test, we would try to generate method body on the abstract class. Such method body is not actually reachable.~~ ~~Saves 500 bytes on a hello world. Fixes a compiler assert (that might be more serious sometimes).~~
MichalStrehovsky
2022-03-03T16:32:47Z
2022-03-07T16:49:51Z
154386d63b3ba55ce3251fa4caf3dfa89279d982
b0d1e89497bfa7a7b602a1d1af2faa97af96c88d
Fix clash between tentative method optimizations. This pull request pretty much became a rollback of https://github.com/dotnet/runtimelab/pull/658 with a regression test to make sure if https://github.com/dotnet/runtimelab/pull/658 is reintroduced, we do it properly. ~~When we were in the situation of the newly added test, we would try to generate method body on the abstract class. Such method body is not actually reachable.~~ ~~Saves 500 bytes on a hello world. Fixes a compiler assert (that might be more serious sometimes).~~
./src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/SingleMethodCompilationModuleGroup.cs
// 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 Internal.TypeSystem; namespace ILCompiler { /// <summary> /// A compilation group that only contains a single method. Useful for development purposes when investigating /// code generation issues. /// </summary> public class SingleMethodCompilationModuleGroup : CompilationModuleGroup { private MethodDesc _method; public SingleMethodCompilationModuleGroup(MethodDesc method) { _method = method; } public override bool IsSingleFileCompilation { get { return false; } } public override bool ContainsMethodBody(MethodDesc method, bool unboxingStub) { return method == _method; } public sealed override bool ContainsMethodDictionary(MethodDesc method) { Debug.Assert(method.GetCanonMethodTarget(CanonicalFormKind.Specific) != method); return true; } public override bool ContainsType(TypeDesc type) { return true; } public override bool ContainsTypeDictionary(TypeDesc type) { return true; } public override bool ImportsMethod(MethodDesc method, bool unboxingStub) { return false; } public override bool ShouldProduceFullVTable(TypeDesc type) { return false; } public override bool ShouldPromoteToFullType(TypeDesc type) { return false; } public override bool PresenceOfEETypeImpliesAllMethodsOnType(TypeDesc type) { return false; } public override bool ShouldReferenceThroughImportTable(TypeDesc type) { return false; } public override bool CanHaveReferenceThroughImportTable { get { return false; } } public override bool AllowInstanceMethodOptimization(MethodDesc method) { return false; } public override bool AllowVirtualMethodOnAbstractTypeOptimization(MethodDesc method) { return false; } } }
// 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 Internal.TypeSystem; namespace ILCompiler { /// <summary> /// A compilation group that only contains a single method. Useful for development purposes when investigating /// code generation issues. /// </summary> public class SingleMethodCompilationModuleGroup : CompilationModuleGroup { private MethodDesc _method; public SingleMethodCompilationModuleGroup(MethodDesc method) { _method = method; } public override bool IsSingleFileCompilation { get { return false; } } public override bool ContainsMethodBody(MethodDesc method, bool unboxingStub) { return method == _method; } public sealed override bool ContainsMethodDictionary(MethodDesc method) { Debug.Assert(method.GetCanonMethodTarget(CanonicalFormKind.Specific) != method); return true; } public override bool ContainsType(TypeDesc type) { return true; } public override bool ContainsTypeDictionary(TypeDesc type) { return true; } public override bool ImportsMethod(MethodDesc method, bool unboxingStub) { return false; } public override bool ShouldProduceFullVTable(TypeDesc type) { return false; } public override bool ShouldPromoteToFullType(TypeDesc type) { return false; } public override bool PresenceOfEETypeImpliesAllMethodsOnType(TypeDesc type) { return false; } public override bool ShouldReferenceThroughImportTable(TypeDesc type) { return false; } public override bool CanHaveReferenceThroughImportTable { get { return false; } } public override bool AllowInstanceMethodOptimization(MethodDesc method) { return false; } } }
1
dotnet/runtime
66,145
Fix clash between tentative method optimizations
This pull request pretty much became a rollback of https://github.com/dotnet/runtimelab/pull/658 with a regression test to make sure if https://github.com/dotnet/runtimelab/pull/658 is reintroduced, we do it properly. ~~When we were in the situation of the newly added test, we would try to generate method body on the abstract class. Such method body is not actually reachable.~~ ~~Saves 500 bytes on a hello world. Fixes a compiler assert (that might be more serious sometimes).~~
MichalStrehovsky
2022-03-03T16:32:47Z
2022-03-07T16:49:51Z
154386d63b3ba55ce3251fa4caf3dfa89279d982
b0d1e89497bfa7a7b602a1d1af2faa97af96c88d
Fix clash between tentative method optimizations. This pull request pretty much became a rollback of https://github.com/dotnet/runtimelab/pull/658 with a regression test to make sure if https://github.com/dotnet/runtimelab/pull/658 is reintroduced, we do it properly. ~~When we were in the situation of the newly added test, we would try to generate method body on the abstract class. Such method body is not actually reachable.~~ ~~Saves 500 bytes on a hello world. Fixes a compiler assert (that might be more serious sometimes).~~
./src/tests/nativeaot/SmokeTests/DeadCodeElimination/DeadCodeElimination.cs
// 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.CodeAnalysis; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; class Program { static int Main() { SanityTest.Run(); TestInstanceMethodOptimization.Run(); TestAbstractTypeVirtualsOptimization.Run(); TestAbstractTypeNeverDerivedVirtualsOptimization.Run(); return 100; } class SanityTest { class PresentType { } class NotPresentType { } public static void Run() { typeof(PresentType).ToString(); if (!IsTypePresent(typeof(SanityTest), nameof(PresentType))) throw new Exception(); ThrowIfPresent(typeof(SanityTest), nameof(NotPresentType)); } } class TestInstanceMethodOptimization { class UnreferencedType { } class NeverAllocatedType { public Type DoSomething() => typeof(UnreferencedType); } #if DEBUG static NeverAllocatedType s_instance = null; #else static object s_instance = new object[10]; #endif public static void Run() { Console.WriteLine("Testing instance methods on unallocated types"); #if DEBUG if (s_instance != null) s_instance.DoSomething(); #else // In release builds additionally test that the "is" check didn't introduce the constructed type if (s_instance is NeverAllocatedType never) never.DoSomething(); #endif ThrowIfPresent(typeof(TestInstanceMethodOptimization), nameof(UnreferencedType)); } } class TestAbstractTypeVirtualsOptimization { class UnreferencedType1 { } class UnreferencedType2 { } class ReferencedType1 { } abstract class Base { public virtual Type GetTheType() => typeof(UnreferencedType1); public virtual Type GetOtherType() => typeof(ReferencedType1); } abstract class Mid : Base { public override Type GetTheType() => typeof(UnreferencedType2); } class Derived : Mid { public override Type GetTheType() => null; } static Base s_instance = Activator.CreateInstance<Derived>(); public static void Run() { Console.WriteLine("Testing virtual methods on abstract types"); s_instance.GetTheType(); s_instance.GetOtherType(); ThrowIfPresent(typeof(TestAbstractTypeVirtualsOptimization), nameof(UnreferencedType1)); ThrowIfPresent(typeof(TestAbstractTypeVirtualsOptimization), nameof(UnreferencedType2)); } } class TestAbstractTypeNeverDerivedVirtualsOptimization { class UnreferencedType1 { } class TheBase { public virtual object Something() => new object(); } abstract class AbstractDerived : TheBase { // We expect "Something" to be generated as a throwing helper. [MethodImpl(MethodImplOptions.NoInlining)] public sealed override object Something() => new UnreferencedType1(); // We expect "callvirt Something" to get devirtualized here. [MethodImpl(MethodImplOptions.NoInlining)] public object TrySomething() => Something(); } abstract class AbstractDerivedAgain : AbstractDerived { } static TheBase s_b = new TheBase(); static AbstractDerived s_d = null; public static void Run() { Console.WriteLine("Testing virtual methods on never derived abstract types"); // Make sure Something is seen virtually used. s_b.Something(); // Force a constructed MethodTable for AbstractDerived and AbstractDerivedAgain into closure typeof(AbstractDerivedAgain).ToString(); if (s_d != null) { s_d.TrySomething(); } ThrowIfPresent(typeof(TestAbstractTypeNeverDerivedVirtualsOptimization), nameof(UnreferencedType1)); } } [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2070:UnrecognizedReflectionPattern", Justification = "That's the point")] private static bool IsTypePresent(Type testType, string typeName) => testType.GetNestedType(typeName, BindingFlags.NonPublic | BindingFlags.Public) != null; private static void ThrowIfPresent(Type testType, string typeName) { if (IsTypePresent(testType, typeName)) { throw new Exception(typeName); } } }
// 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.CodeAnalysis; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; class Program { static int Main() { SanityTest.Run(); TestInstanceMethodOptimization.Run(); TestAbstractTypeNeverDerivedVirtualsOptimization.Run(); TestAbstractNeverDerivedWithDevirtualizedCall.Run(); TestAbstractDerivedByUnrelatedTypeWithDevirtualizedCall.Run(); return 100; } class SanityTest { class PresentType { } class NotPresentType { } public static void Run() { typeof(PresentType).ToString(); if (!IsTypePresent(typeof(SanityTest), nameof(PresentType))) throw new Exception(); ThrowIfPresent(typeof(SanityTest), nameof(NotPresentType)); } } class TestInstanceMethodOptimization { class UnreferencedType { } class NeverAllocatedType { public Type DoSomething() => typeof(UnreferencedType); } #if DEBUG static NeverAllocatedType s_instance = null; #else static object s_instance = new object[10]; #endif public static void Run() { Console.WriteLine("Testing instance methods on unallocated types"); #if DEBUG if (s_instance != null) s_instance.DoSomething(); #else // In release builds additionally test that the "is" check didn't introduce the constructed type if (s_instance is NeverAllocatedType never) never.DoSomething(); #endif ThrowIfPresent(typeof(TestInstanceMethodOptimization), nameof(UnreferencedType)); } } class TestAbstractTypeNeverDerivedVirtualsOptimization { class UnreferencedType1 { } class TheBase { public virtual object Something() => new object(); } abstract class AbstractDerived : TheBase { // We expect "Something" to be generated as a throwing helper. [MethodImpl(MethodImplOptions.NoInlining)] public sealed override object Something() => new UnreferencedType1(); // We expect "callvirt Something" to get devirtualized here. [MethodImpl(MethodImplOptions.NoInlining)] public object TrySomething() => Something(); } abstract class AbstractDerivedAgain : AbstractDerived { } static TheBase s_b = new TheBase(); static AbstractDerived s_d = null; public static void Run() { Console.WriteLine("Testing virtual methods on never derived abstract types"); // Make sure Something is seen virtually used. s_b.Something(); // Force a constructed MethodTable for AbstractDerived and AbstractDerivedAgain into closure typeof(AbstractDerivedAgain).ToString(); if (s_d != null) { s_d.TrySomething(); } // This optimization got disabled, but if it ever gets re-enabled, this test // will ensure we don't reintroduce the old bugs (this was a compiler crash). //ThrowIfPresent(typeof(TestAbstractTypeNeverDerivedVirtualsOptimization), nameof(UnreferencedType1)); } } class TestAbstractNeverDerivedWithDevirtualizedCall { static void DoIt(Derived d) => d?.DoSomething(); abstract class Base { [MethodImpl(MethodImplOptions.NoInlining)] public virtual void DoSomething() => new UnreferencedType1().ToString(); } sealed class Derived : Base { } class UnreferencedType1 { } public static void Run() { Console.WriteLine("Testing abstract classes that might have methods reachable through devirtualization"); // Force a vtable for Base typeof(Base).ToString(); // Do a devirtualizable virtual call to something that was never allocated // and uses a virtual method implementation from Base. DoIt(null); // This optimization got disabled, but if it ever gets re-enabled, this test // will ensure we don't reintroduce the old bugs (this was a compiler crash). //ThrowIfPresent(typeof(TestAbstractNeverDerivedWithDevirtualizedCall), nameof(UnreferencedType1)); } } class TestAbstractDerivedByUnrelatedTypeWithDevirtualizedCall { static void DoIt(Derived1 d) => d?.DoSomething(); abstract class Base { [MethodImpl(MethodImplOptions.NoInlining)] public virtual void DoSomething() => new UnreferencedType1().ToString(); } sealed class Derived1 : Base { } sealed class Derived2 : Base { public override void DoSomething() { } } class UnreferencedType1 { } public static void Run() { Console.WriteLine("Testing more abstract classes that might have methods reachable through devirtualization"); // Force a vtable for Base typeof(Base).ToString(); // Do a devirtualizable virtual call to something that was never allocated // and uses a virtual method implementation from Base. DoIt(null); new Derived2().DoSomething(); // This optimization got disabled, but if it ever gets re-enabled, this test // will ensure we don't reintroduce the old bugs (this was a compiler crash). //ThrowIfPresent(typeof(TestAbstractDerivedByUnrelatedTypeWithDevirtualizedCall), nameof(UnreferencedType1)); } } [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2070:UnrecognizedReflectionPattern", Justification = "That's the point")] private static bool IsTypePresent(Type testType, string typeName) => testType.GetNestedType(typeName, BindingFlags.NonPublic | BindingFlags.Public) != null; private static void ThrowIfPresent(Type testType, string typeName) { if (IsTypePresent(testType, typeName)) { throw new Exception(typeName); } } }
1
dotnet/runtime
66,145
Fix clash between tentative method optimizations
This pull request pretty much became a rollback of https://github.com/dotnet/runtimelab/pull/658 with a regression test to make sure if https://github.com/dotnet/runtimelab/pull/658 is reintroduced, we do it properly. ~~When we were in the situation of the newly added test, we would try to generate method body on the abstract class. Such method body is not actually reachable.~~ ~~Saves 500 bytes on a hello world. Fixes a compiler assert (that might be more serious sometimes).~~
MichalStrehovsky
2022-03-03T16:32:47Z
2022-03-07T16:49:51Z
154386d63b3ba55ce3251fa4caf3dfa89279d982
b0d1e89497bfa7a7b602a1d1af2faa97af96c88d
Fix clash between tentative method optimizations. This pull request pretty much became a rollback of https://github.com/dotnet/runtimelab/pull/658 with a regression test to make sure if https://github.com/dotnet/runtimelab/pull/658 is reintroduced, we do it properly. ~~When we were in the situation of the newly added test, we would try to generate method body on the abstract class. Such method body is not actually reachable.~~ ~~Saves 500 bytes on a hello world. Fixes a compiler assert (that might be more serious sometimes).~~
./src/tests/tracing/eventpipe/processenvironment/processenvironment.cs
// 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.Collections.Generic; using System.Diagnostics.Tracing; using System.Diagnostics; using System.IO; using System.Linq; using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; using Microsoft.Diagnostics.Tools.RuntimeClient; using Microsoft.Diagnostics.Tracing; using Tracing.Tests.Common; using System.Reflection; namespace Tracing.Tests.ProcessEnvironmentValidation { public class ProcessEnvironmentValidation { public static int Main(string[] args) { if (args.Length >= 1) { Console.Out.WriteLine("Subprocess started! Waiting for input..."); var input = Console.In.ReadLine(); // will block until data is sent across stdin Console.Out.WriteLine($"Received '{input}'. Exiting..."); return 0; } var testEnvPairs = new Dictionary<string, string> { { "TESTKEY1", "TESTVAL1" }, { "TESTKEY2", "TESTVAL2" }, { "TESTKEY3", "__TEST__VAL=;--3" } }; Task<bool> subprocessTask = Utils.RunSubprocess( currentAssembly: Assembly.GetExecutingAssembly(), environment: testEnvPairs, duringExecution: (int pid) => { Logger.logger.Log($"Test PID: {pid}"); Stream stream = ConnectionHelper.GetStandardTransport(pid); // 0x04 = ProcessCommandSet, 0x02 = ProcessInfo var processInfoMessage = new IpcMessage(0x04, 0x02); Logger.logger.Log($"Wrote: {processInfoMessage}"); Stream continuationStream = IpcClient.SendMessage(stream, processInfoMessage, out IpcMessage response); Logger.logger.Log($"Received: {response}"); Utils.Assert(response.Header.CommandSet == 0xFF, $"Response must have Server command set. Expected: 0xFF, Received: 0x{response.Header.CommandSet:X2}"); // server Utils.Assert(response.Header.CommandId == 0x00, $"Response must have OK command id. Expected: 0x00, Received: 0x{response.Header.CommandId:X2}"); // OK UInt32 continuationSizeInBytes = BitConverter.ToUInt32(response.Payload[0..4]); Logger.logger.Log($"continuation size: {continuationSizeInBytes} bytes"); UInt16 future = BitConverter.ToUInt16(response.Payload[4..]); Logger.logger.Log($"future value: {future}"); using var memoryStream = new MemoryStream(); Logger.logger.Log($"Starting to copy continuation"); continuationStream.CopyTo(memoryStream); Logger.logger.Log($"Finished copying continuation"); byte[] envBlock = memoryStream.ToArray(); Logger.logger.Log($"Total bytes in continuation: {envBlock.Length}"); Utils.Assert(envBlock.Length == continuationSizeInBytes, $"Continuation size must equal the reported size in the payload response. Expected: {continuationSizeInBytes} bytes, Received: {envBlock.Length} bytes"); // VALIDATE ENV // env block is sent as Array<LPCWSTR> (length-prefixed array of length-prefixed wchar strings) int start = 0; int end = start + 4 /* sizeof(uint32_t) */; UInt32 envCount = BitConverter.ToUInt32(envBlock[start..end]); Logger.logger.Log($"envCount: {envCount}"); var env = new Dictionary<string,string>(); for (int i = 0; i < envCount; i++) { start = end; end = start + 4 /* sizeof(uint32_t) */; UInt32 pairLength = BitConverter.ToUInt32(envBlock[start..end]); start = end; end = start + ((int)pairLength * sizeof(char)); Utils.Assert(end <= envBlock.Length, $"String end can't exceed payload size. Expected: <{envBlock.Length}, Received: {end} (decoded length: {pairLength})"); string envPair = System.Text.Encoding.Unicode.GetString(envBlock[start..end]).TrimEnd('\0'); int equalsIndex = envPair.IndexOf('='); env[envPair[0..equalsIndex]] = envPair[(equalsIndex+1)..]; } Logger.logger.Log($"finished parsing env"); foreach (var (key, val) in testEnvPairs) Utils.Assert(env.ContainsKey(key) && env[key].Equals(val), $"Did not find test environment pair in the environment block: '{key}' = '{val}'"); Logger.logger.Log($"Saw test values in env"); Utils.Assert(end == envBlock.Length, $"Full payload should have been read. Expected: {envBlock.Length}, Received: {end}"); return Task.FromResult(true); } ); return subprocessTask.Result ? 100 : 0; } } }
// 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.Collections.Generic; using System.Diagnostics.Tracing; using System.Diagnostics; using System.IO; using System.Linq; using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; using Microsoft.Diagnostics.Tools.RuntimeClient; using Microsoft.Diagnostics.Tracing; using Tracing.Tests.Common; using System.Reflection; namespace Tracing.Tests.ProcessEnvironmentValidation { public class ProcessEnvironmentValidation { public static int Main(string[] args) { if (args.Length >= 1) { Console.Out.WriteLine("Subprocess started! Waiting for input..."); var input = Console.In.ReadLine(); // will block until data is sent across stdin Console.Out.WriteLine($"Received '{input}'. Exiting..."); return 0; } var testEnvPairs = new Dictionary<string, string> { { "TESTKEY1", "TESTVAL1" }, { "TESTKEY2", "TESTVAL2" }, { "TESTKEY3", "__TEST__VAL=;--3" } }; Task<bool> subprocessTask = Utils.RunSubprocess( currentAssembly: Assembly.GetExecutingAssembly(), environment: testEnvPairs, duringExecution: (int pid) => { Logger.logger.Log($"Test PID: {pid}"); Stream stream = ConnectionHelper.GetStandardTransport(pid); // 0x04 = ProcessCommandSet, 0x02 = ProcessInfo var processInfoMessage = new IpcMessage(0x04, 0x02); Logger.logger.Log($"Wrote: {processInfoMessage}"); Stream continuationStream = IpcClient.SendMessage(stream, processInfoMessage, out IpcMessage response); Logger.logger.Log($"Received: {response}"); Utils.Assert(response.Header.CommandSet == 0xFF, $"Response must have Server command set. Expected: 0xFF, Received: 0x{response.Header.CommandSet:X2}"); // server Utils.Assert(response.Header.CommandId == 0x00, $"Response must have OK command id. Expected: 0x00, Received: 0x{response.Header.CommandId:X2}"); // OK UInt32 continuationSizeInBytes = BitConverter.ToUInt32(response.Payload[0..4]); Logger.logger.Log($"continuation size: {continuationSizeInBytes} bytes"); UInt16 future = BitConverter.ToUInt16(response.Payload[4..]); Logger.logger.Log($"future value: {future}"); using var memoryStream = new MemoryStream(); Logger.logger.Log($"Starting to copy continuation"); continuationStream.CopyTo(memoryStream); Logger.logger.Log($"Finished copying continuation"); byte[] envBlock = memoryStream.ToArray(); Logger.logger.Log($"Total bytes in continuation: {envBlock.Length}"); Utils.Assert(envBlock.Length == continuationSizeInBytes, $"Continuation size must equal the reported size in the payload response. Expected: {continuationSizeInBytes} bytes, Received: {envBlock.Length} bytes"); // VALIDATE ENV // env block is sent as Array<LPCWSTR> (length-prefixed array of length-prefixed wchar strings) int start = 0; int end = start + 4 /* sizeof(uint32_t) */; UInt32 envCount = BitConverter.ToUInt32(envBlock[start..end]); Logger.logger.Log($"envCount: {envCount}"); var env = new Dictionary<string,string>(); for (int i = 0; i < envCount; i++) { start = end; end = start + 4 /* sizeof(uint32_t) */; UInt32 pairLength = BitConverter.ToUInt32(envBlock[start..end]); start = end; end = start + ((int)pairLength * sizeof(char)); Utils.Assert(end <= envBlock.Length, $"String end can't exceed payload size. Expected: <{envBlock.Length}, Received: {end} (decoded length: {pairLength})"); string envPair = System.Text.Encoding.Unicode.GetString(envBlock[start..end]).TrimEnd('\0'); int equalsIndex = envPair.IndexOf('='); env[envPair[0..equalsIndex]] = envPair[(equalsIndex+1)..]; } Logger.logger.Log($"finished parsing env"); foreach (var (key, val) in testEnvPairs) Utils.Assert(env.ContainsKey(key) && env[key].Equals(val), $"Did not find test environment pair in the environment block: '{key}' = '{val}'"); Logger.logger.Log($"Saw test values in env"); Utils.Assert(end == envBlock.Length, $"Full payload should have been read. Expected: {envBlock.Length}, Received: {end}"); return Task.FromResult(true); } ); return subprocessTask.Result ? 100 : 0; } } }
-1
dotnet/runtime
66,145
Fix clash between tentative method optimizations
This pull request pretty much became a rollback of https://github.com/dotnet/runtimelab/pull/658 with a regression test to make sure if https://github.com/dotnet/runtimelab/pull/658 is reintroduced, we do it properly. ~~When we were in the situation of the newly added test, we would try to generate method body on the abstract class. Such method body is not actually reachable.~~ ~~Saves 500 bytes on a hello world. Fixes a compiler assert (that might be more serious sometimes).~~
MichalStrehovsky
2022-03-03T16:32:47Z
2022-03-07T16:49:51Z
154386d63b3ba55ce3251fa4caf3dfa89279d982
b0d1e89497bfa7a7b602a1d1af2faa97af96c88d
Fix clash between tentative method optimizations. This pull request pretty much became a rollback of https://github.com/dotnet/runtimelab/pull/658 with a regression test to make sure if https://github.com/dotnet/runtimelab/pull/658 is reintroduced, we do it properly. ~~When we were in the situation of the newly added test, we would try to generate method body on the abstract class. Such method body is not actually reachable.~~ ~~Saves 500 bytes on a hello world. Fixes a compiler assert (that might be more serious sometimes).~~
./src/tests/JIT/HardwareIntrinsics/X86/Avx2/SubtractSaturate.cs
// 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.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics.X86; using System.Runtime.Intrinsics; namespace IntelHardwareIntrinsicTest { class Program { const int Pass = 100; const int Fail = 0; static unsafe int Main(string[] args) { int testResult = Pass; if (Avx2.IsSupported) { using (TestTable<byte, byte, byte> byteTable = new TestTable<byte, byte, byte>(new byte[32] { 1, 5, 100, 0, 1, 5, 100, 0, 1, 5, 100, 0, 1, 5, 100, 0, 1, 5, 100, 0, 1, 5, 100, 0, 1, 5, 100, 0, 1, 5, 100, 0 }, new byte[32] { 22, 1, 50, 0, 22, 1, 50, 0, 22, 1, 50, 0, 22, 1, 50, 0, 22, 1, 50, 0, 22, 1, 50, 0, 22, 1, 50, 0, 22, 1, 50, 0 }, new byte[32])) using (TestTable<sbyte, sbyte, sbyte> sbyteTable = new TestTable<sbyte, sbyte, sbyte>(new sbyte[32] { 1, -5, 100, 0, 1, -5, 100, 0, 1, -5, 100, 0, 1, -5, 100, 0, 1, -5, 100, 0, 1, -5, 100, 0, 1, -5, 100, 0, 1, -5, 100, 0 }, new sbyte[32] { 22, -1, -50, 0, 22, -1, -50, 0, 22, -1, -50, 0, 22, -1, -50, 0, 22, -1, -50, 0, 22, -1, -50, 0, 22, -1, -50, 0, 22, -1, -50, 0 }, new sbyte[32])) using (TestTable<short, short, short> shortTable = new TestTable<short, short, short>(new short[16] { 1, -5, 100, 0, 1, -5, 100, 0, 1, -5, 100, 0, 1, -5, 100, 0 }, new short[16] { 22, -1, -50, 0, 22, -1, -50, 0, 22, -1, -50, 0, 22, -1, -50, 0}, new short[16])) using (TestTable<ushort, ushort, ushort> ushortTable = new TestTable<ushort, ushort, ushort>(new ushort[16] { 1, 5, 100, 0, 1, 5, 100, 0, 1, 5, 100, 0, 1, 5, 100, 0 }, new ushort[16] { 22, 1, 50, 0, 22, 1, 50, 0, 22, 1, 50, 0, 22, 1, 50, 0 }, new ushort[16])) { var vb1 = Unsafe.Read<Vector256<byte>>(byteTable.inArray1Ptr); var vb2 = Unsafe.Read<Vector256<byte>>(byteTable.inArray2Ptr); var vb3 = Avx2.SubtractSaturate(vb1, vb2); Unsafe.Write(byteTable.outArrayPtr, vb3); var vsb1 = Unsafe.Read<Vector256<sbyte>>(sbyteTable.inArray1Ptr); var vsb2 = Unsafe.Read<Vector256<sbyte>>(sbyteTable.inArray2Ptr); var vsb3 = Avx2.SubtractSaturate(vsb1, vsb2); Unsafe.Write(sbyteTable.outArrayPtr, vsb3); var vs1 = Unsafe.Read<Vector256<short>>(shortTable.inArray1Ptr); var vs2 = Unsafe.Read<Vector256<short>>(shortTable.inArray2Ptr); var vs3 = Avx2.SubtractSaturate(vs1, vs2); Unsafe.Write(shortTable.outArrayPtr, vs3); var vus1 = Unsafe.Read<Vector256<ushort>>(ushortTable.inArray1Ptr); var vus2 = Unsafe.Read<Vector256<ushort>>(ushortTable.inArray2Ptr); var vus3 = Avx2.SubtractSaturate(vus1, vus2); Unsafe.Write(ushortTable.outArrayPtr, vus3); for (int i = 0; i < byteTable.outArray.Length; i++) { int value = byteTable.inArray1[i] - byteTable.inArray2[i]; value = Math.Max(value, 0); value = Math.Min(value, byte.MaxValue); if ((byte)value != byteTable.outArray[i]) { Console.WriteLine("AVX2 SubtractSaturate failed on byte:"); Console.WriteLine(); testResult = Fail; break; } } for (int i = 0; i < sbyteTable.outArray.Length; i++) { int value = sbyteTable.inArray1[i] - sbyteTable.inArray2[i]; value = Math.Max(value, sbyte.MinValue); value = Math.Min(value, sbyte.MaxValue); if ((sbyte)value != sbyteTable.outArray[i]) { Console.WriteLine("AVX2 SubtractSaturate failed on sbyte:"); Console.WriteLine(); testResult = Fail; break; } } for (int i = 0; i < shortTable.outArray.Length; i++) { int value = shortTable.inArray1[i] - shortTable.inArray2[i]; value = Math.Max(value, short.MinValue); value = Math.Min(value, short.MaxValue); if ((short)value != shortTable.outArray[i]) { Console.WriteLine("AVX2 SubtractSaturate failed on short:"); Console.WriteLine(); testResult = Fail; break; } } for (int i = 0; i < ushortTable.outArray.Length; i++) { int value = ushortTable.inArray1[i] - ushortTable.inArray2[i]; value = Math.Max(value, 0); value = Math.Min(value, ushort.MaxValue); if ((ushort)value != ushortTable.outArray[i]) { Console.WriteLine("AVX2 SubtractSaturate failed on ushort:"); Console.WriteLine(); testResult = Fail; break; } } } } return testResult; } public unsafe struct TestTable<T1, T2, T3> : IDisposable where T1 : struct where T2 : struct where T3 : struct { public T1[] inArray1; public T2[] inArray2; public T3[] outArray; public void* inArray1Ptr => inHandle1.AddrOfPinnedObject().ToPointer(); public void* inArray2Ptr => inHandle2.AddrOfPinnedObject().ToPointer(); public void* outArrayPtr => outHandle.AddrOfPinnedObject().ToPointer(); GCHandle inHandle1; GCHandle inHandle2; GCHandle outHandle; public TestTable(T1[] a, T2[] b, T3[] c) { this.inArray1 = a; this.inArray2 = b; this.outArray = c; inHandle1 = GCHandle.Alloc(inArray1, GCHandleType.Pinned); inHandle2 = GCHandle.Alloc(inArray2, GCHandleType.Pinned); outHandle = GCHandle.Alloc(outArray, GCHandleType.Pinned); } public bool CheckResult(Func<T1, T2, T3, bool> check) { for (int i = 0; i < inArray1.Length; i++) { if (!check(inArray1[i], inArray2[i], outArray[i])) { return false; } } return true; } public void Dispose() { inHandle1.Free(); inHandle2.Free(); outHandle.Free(); } } } }
// 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.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Intrinsics.X86; using System.Runtime.Intrinsics; namespace IntelHardwareIntrinsicTest { class Program { const int Pass = 100; const int Fail = 0; static unsafe int Main(string[] args) { int testResult = Pass; if (Avx2.IsSupported) { using (TestTable<byte, byte, byte> byteTable = new TestTable<byte, byte, byte>(new byte[32] { 1, 5, 100, 0, 1, 5, 100, 0, 1, 5, 100, 0, 1, 5, 100, 0, 1, 5, 100, 0, 1, 5, 100, 0, 1, 5, 100, 0, 1, 5, 100, 0 }, new byte[32] { 22, 1, 50, 0, 22, 1, 50, 0, 22, 1, 50, 0, 22, 1, 50, 0, 22, 1, 50, 0, 22, 1, 50, 0, 22, 1, 50, 0, 22, 1, 50, 0 }, new byte[32])) using (TestTable<sbyte, sbyte, sbyte> sbyteTable = new TestTable<sbyte, sbyte, sbyte>(new sbyte[32] { 1, -5, 100, 0, 1, -5, 100, 0, 1, -5, 100, 0, 1, -5, 100, 0, 1, -5, 100, 0, 1, -5, 100, 0, 1, -5, 100, 0, 1, -5, 100, 0 }, new sbyte[32] { 22, -1, -50, 0, 22, -1, -50, 0, 22, -1, -50, 0, 22, -1, -50, 0, 22, -1, -50, 0, 22, -1, -50, 0, 22, -1, -50, 0, 22, -1, -50, 0 }, new sbyte[32])) using (TestTable<short, short, short> shortTable = new TestTable<short, short, short>(new short[16] { 1, -5, 100, 0, 1, -5, 100, 0, 1, -5, 100, 0, 1, -5, 100, 0 }, new short[16] { 22, -1, -50, 0, 22, -1, -50, 0, 22, -1, -50, 0, 22, -1, -50, 0}, new short[16])) using (TestTable<ushort, ushort, ushort> ushortTable = new TestTable<ushort, ushort, ushort>(new ushort[16] { 1, 5, 100, 0, 1, 5, 100, 0, 1, 5, 100, 0, 1, 5, 100, 0 }, new ushort[16] { 22, 1, 50, 0, 22, 1, 50, 0, 22, 1, 50, 0, 22, 1, 50, 0 }, new ushort[16])) { var vb1 = Unsafe.Read<Vector256<byte>>(byteTable.inArray1Ptr); var vb2 = Unsafe.Read<Vector256<byte>>(byteTable.inArray2Ptr); var vb3 = Avx2.SubtractSaturate(vb1, vb2); Unsafe.Write(byteTable.outArrayPtr, vb3); var vsb1 = Unsafe.Read<Vector256<sbyte>>(sbyteTable.inArray1Ptr); var vsb2 = Unsafe.Read<Vector256<sbyte>>(sbyteTable.inArray2Ptr); var vsb3 = Avx2.SubtractSaturate(vsb1, vsb2); Unsafe.Write(sbyteTable.outArrayPtr, vsb3); var vs1 = Unsafe.Read<Vector256<short>>(shortTable.inArray1Ptr); var vs2 = Unsafe.Read<Vector256<short>>(shortTable.inArray2Ptr); var vs3 = Avx2.SubtractSaturate(vs1, vs2); Unsafe.Write(shortTable.outArrayPtr, vs3); var vus1 = Unsafe.Read<Vector256<ushort>>(ushortTable.inArray1Ptr); var vus2 = Unsafe.Read<Vector256<ushort>>(ushortTable.inArray2Ptr); var vus3 = Avx2.SubtractSaturate(vus1, vus2); Unsafe.Write(ushortTable.outArrayPtr, vus3); for (int i = 0; i < byteTable.outArray.Length; i++) { int value = byteTable.inArray1[i] - byteTable.inArray2[i]; value = Math.Max(value, 0); value = Math.Min(value, byte.MaxValue); if ((byte)value != byteTable.outArray[i]) { Console.WriteLine("AVX2 SubtractSaturate failed on byte:"); Console.WriteLine(); testResult = Fail; break; } } for (int i = 0; i < sbyteTable.outArray.Length; i++) { int value = sbyteTable.inArray1[i] - sbyteTable.inArray2[i]; value = Math.Max(value, sbyte.MinValue); value = Math.Min(value, sbyte.MaxValue); if ((sbyte)value != sbyteTable.outArray[i]) { Console.WriteLine("AVX2 SubtractSaturate failed on sbyte:"); Console.WriteLine(); testResult = Fail; break; } } for (int i = 0; i < shortTable.outArray.Length; i++) { int value = shortTable.inArray1[i] - shortTable.inArray2[i]; value = Math.Max(value, short.MinValue); value = Math.Min(value, short.MaxValue); if ((short)value != shortTable.outArray[i]) { Console.WriteLine("AVX2 SubtractSaturate failed on short:"); Console.WriteLine(); testResult = Fail; break; } } for (int i = 0; i < ushortTable.outArray.Length; i++) { int value = ushortTable.inArray1[i] - ushortTable.inArray2[i]; value = Math.Max(value, 0); value = Math.Min(value, ushort.MaxValue); if ((ushort)value != ushortTable.outArray[i]) { Console.WriteLine("AVX2 SubtractSaturate failed on ushort:"); Console.WriteLine(); testResult = Fail; break; } } } } return testResult; } public unsafe struct TestTable<T1, T2, T3> : IDisposable where T1 : struct where T2 : struct where T3 : struct { public T1[] inArray1; public T2[] inArray2; public T3[] outArray; public void* inArray1Ptr => inHandle1.AddrOfPinnedObject().ToPointer(); public void* inArray2Ptr => inHandle2.AddrOfPinnedObject().ToPointer(); public void* outArrayPtr => outHandle.AddrOfPinnedObject().ToPointer(); GCHandle inHandle1; GCHandle inHandle2; GCHandle outHandle; public TestTable(T1[] a, T2[] b, T3[] c) { this.inArray1 = a; this.inArray2 = b; this.outArray = c; inHandle1 = GCHandle.Alloc(inArray1, GCHandleType.Pinned); inHandle2 = GCHandle.Alloc(inArray2, GCHandleType.Pinned); outHandle = GCHandle.Alloc(outArray, GCHandleType.Pinned); } public bool CheckResult(Func<T1, T2, T3, bool> check) { for (int i = 0; i < inArray1.Length; i++) { if (!check(inArray1[i], inArray2[i], outArray[i])) { return false; } } return true; } public void Dispose() { inHandle1.Free(); inHandle2.Free(); outHandle.Free(); } } } }
-1
dotnet/runtime
66,145
Fix clash between tentative method optimizations
This pull request pretty much became a rollback of https://github.com/dotnet/runtimelab/pull/658 with a regression test to make sure if https://github.com/dotnet/runtimelab/pull/658 is reintroduced, we do it properly. ~~When we were in the situation of the newly added test, we would try to generate method body on the abstract class. Such method body is not actually reachable.~~ ~~Saves 500 bytes on a hello world. Fixes a compiler assert (that might be more serious sometimes).~~
MichalStrehovsky
2022-03-03T16:32:47Z
2022-03-07T16:49:51Z
154386d63b3ba55ce3251fa4caf3dfa89279d982
b0d1e89497bfa7a7b602a1d1af2faa97af96c88d
Fix clash between tentative method optimizations. This pull request pretty much became a rollback of https://github.com/dotnet/runtimelab/pull/658 with a regression test to make sure if https://github.com/dotnet/runtimelab/pull/658 is reintroduced, we do it properly. ~~When we were in the situation of the newly added test, we would try to generate method body on the abstract class. Such method body is not actually reachable.~~ ~~Saves 500 bytes on a hello world. Fixes a compiler assert (that might be more serious sometimes).~~
./src/libraries/System.Data.Common/tests/TrimmingTests/DbConnectionStringBuilder.cs
// 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.Data.Common; using System.ComponentModel; using System.Collections; namespace DbConnectionStringBuilderTrimmingTests { class Program { static int Main(string[] args) { DbConnectionStringBuilder2 dcsb2 = new(); ICustomTypeDescriptor td = dcsb2; if (td.GetClassName() != "DbConnectionStringBuilderTrimmingTests.DbConnectionStringBuilder2") { throw new Exception("Class name got trimmed"); } if (td.GetComponentName() != "Test Component Name") { throw new Exception("Component name got trimmed"); } bool foundAttr = false; foreach (Attribute attr in td.GetAttributes()) { if (attr.GetType().Name == "TestAttribute") { if (attr.ToString() != "Test Attribute Value") { throw new Exception("Test attribute value differs"); } if (foundAttr) { throw new Exception("More than one attribute found"); } foundAttr = true; } } if (!foundAttr) { throw new Exception("Attribute not found"); } bool foundEvent = false; bool foundEventWithDisplayName = false; foreach (EventDescriptor ev in td.GetEvents()) { if (ev.DisplayName == "TestEvent") { if (foundEvent) { throw new Exception("More than one event TestEvent found."); } foundEvent = true; } if (ev.DisplayName == "Event With DisplayName") { if (foundEventWithDisplayName) { throw new Exception("More than one event with display name found."); } foundEventWithDisplayName = true; } } if (!foundEvent) { throw new Exception("Event not found"); } if (!foundEventWithDisplayName) { throw new Exception("Event with DisplayName not found"); } bool propertyFound = false; foreach (DictionaryEntry kv in dcsb2.GetProperties2()) { PropertyDescriptor val = (PropertyDescriptor)kv.Value; if (val.Name == "TestProperty") { if (propertyFound) { throw new Exception("More than one property TestProperty found."); } propertyFound = true; } } if (!propertyFound) { throw new Exception("Property not found"); } return 100; } } [Test("Test Attribute Value")] class DbConnectionStringBuilder2 : DbConnectionStringBuilder, IComponent { #pragma warning disable CS0067 // The event is never used public event EventHandler Disposed; public event Action TestEvent; [DisplayName("Event With DisplayName")] public event Action TestEvent2; #pragma warning restore CS0067 public string TestProperty { get; set; } public ISite Site { get => new TestSite(); set => throw new NotImplementedException(); } public void Dispose() { } public Hashtable GetProperties2() { Hashtable propertyDescriptors = new Hashtable(); GetProperties(propertyDescriptors); return propertyDescriptors; } } class TestSite : INestedSite { public string FullName => null; public IComponent Component => throw new NotImplementedException(); public IContainer Container => null; public bool DesignMode => throw new NotImplementedException(); public string Name { get => "Test Component Name"; set => throw new NotImplementedException(); } public object GetService(Type serviceType) => null; } class TestAttribute : Attribute { public string Test { get; private set; } public TestAttribute(string test) { Test = test; } public override string ToString() { return Test; } } }
// 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.Data.Common; using System.ComponentModel; using System.Collections; namespace DbConnectionStringBuilderTrimmingTests { class Program { static int Main(string[] args) { DbConnectionStringBuilder2 dcsb2 = new(); ICustomTypeDescriptor td = dcsb2; if (td.GetClassName() != "DbConnectionStringBuilderTrimmingTests.DbConnectionStringBuilder2") { throw new Exception("Class name got trimmed"); } if (td.GetComponentName() != "Test Component Name") { throw new Exception("Component name got trimmed"); } bool foundAttr = false; foreach (Attribute attr in td.GetAttributes()) { if (attr.GetType().Name == "TestAttribute") { if (attr.ToString() != "Test Attribute Value") { throw new Exception("Test attribute value differs"); } if (foundAttr) { throw new Exception("More than one attribute found"); } foundAttr = true; } } if (!foundAttr) { throw new Exception("Attribute not found"); } bool foundEvent = false; bool foundEventWithDisplayName = false; foreach (EventDescriptor ev in td.GetEvents()) { if (ev.DisplayName == "TestEvent") { if (foundEvent) { throw new Exception("More than one event TestEvent found."); } foundEvent = true; } if (ev.DisplayName == "Event With DisplayName") { if (foundEventWithDisplayName) { throw new Exception("More than one event with display name found."); } foundEventWithDisplayName = true; } } if (!foundEvent) { throw new Exception("Event not found"); } if (!foundEventWithDisplayName) { throw new Exception("Event with DisplayName not found"); } bool propertyFound = false; foreach (DictionaryEntry kv in dcsb2.GetProperties2()) { PropertyDescriptor val = (PropertyDescriptor)kv.Value; if (val.Name == "TestProperty") { if (propertyFound) { throw new Exception("More than one property TestProperty found."); } propertyFound = true; } } if (!propertyFound) { throw new Exception("Property not found"); } return 100; } } [Test("Test Attribute Value")] class DbConnectionStringBuilder2 : DbConnectionStringBuilder, IComponent { #pragma warning disable CS0067 // The event is never used public event EventHandler Disposed; public event Action TestEvent; [DisplayName("Event With DisplayName")] public event Action TestEvent2; #pragma warning restore CS0067 public string TestProperty { get; set; } public ISite Site { get => new TestSite(); set => throw new NotImplementedException(); } public void Dispose() { } public Hashtable GetProperties2() { Hashtable propertyDescriptors = new Hashtable(); GetProperties(propertyDescriptors); return propertyDescriptors; } } class TestSite : INestedSite { public string FullName => null; public IComponent Component => throw new NotImplementedException(); public IContainer Container => null; public bool DesignMode => throw new NotImplementedException(); public string Name { get => "Test Component Name"; set => throw new NotImplementedException(); } public object GetService(Type serviceType) => null; } class TestAttribute : Attribute { public string Test { get; private set; } public TestAttribute(string test) { Test = test; } public override string ToString() { return Test; } } }
-1
dotnet/runtime
66,145
Fix clash between tentative method optimizations
This pull request pretty much became a rollback of https://github.com/dotnet/runtimelab/pull/658 with a regression test to make sure if https://github.com/dotnet/runtimelab/pull/658 is reintroduced, we do it properly. ~~When we were in the situation of the newly added test, we would try to generate method body on the abstract class. Such method body is not actually reachable.~~ ~~Saves 500 bytes on a hello world. Fixes a compiler assert (that might be more serious sometimes).~~
MichalStrehovsky
2022-03-03T16:32:47Z
2022-03-07T16:49:51Z
154386d63b3ba55ce3251fa4caf3dfa89279d982
b0d1e89497bfa7a7b602a1d1af2faa97af96c88d
Fix clash between tentative method optimizations. This pull request pretty much became a rollback of https://github.com/dotnet/runtimelab/pull/658 with a regression test to make sure if https://github.com/dotnet/runtimelab/pull/658 is reintroduced, we do it properly. ~~When we were in the situation of the newly added test, we would try to generate method body on the abstract class. Such method body is not actually reachable.~~ ~~Saves 500 bytes on a hello world. Fixes a compiler assert (that might be more serious sometimes).~~
./src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/GenericCompositionNode.cs
// 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 Internal.Text; using Internal.TypeSystem; using Debug = System.Diagnostics.Debug; using GenericVariance = Internal.Runtime.GenericVariance; namespace ILCompiler.DependencyAnalysis { /// <summary> /// Describes how a generic type instance is composed - the number of generic arguments, their types, /// and variance information. /// </summary> public class GenericCompositionNode : ObjectNode, ISymbolDefinitionNode { private GenericCompositionDetails _details; internal GenericCompositionNode(GenericCompositionDetails details) { _details = details; } public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb) { sb.Append("__GenericInstance"); for (int i = 0; i < _details.Instantiation.Length; i++) { sb.Append('_'); sb.Append(nameMangler.GetMangledTypeName(_details.Instantiation[i])); } if (_details.Variance != null) { sb.Append("__Variance__"); for (int i = 0; i < _details.Variance.Length; i++) { sb.Append('_'); sb.Append((checked((byte)_details.Variance[i])).ToStringInvariant()); } } } public int Offset { get { return 0; } } public override ObjectNodeSection Section { get { if (_details.Instantiation[0].Context.Target.IsWindows) return ObjectNodeSection.FoldableReadOnlyDataSection; else return ObjectNodeSection.DataSection; } } public override bool IsShareable => true; public override bool StaticDependenciesAreComputed => true; public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false) { bool hasVariance = _details.Variance != null; var builder = new ObjectDataBuilder(factory, relocsOnly); builder.AddSymbol(this); builder.RequireInitialPointerAlignment(); builder.EmitShort((short)checked((UInt16)_details.Instantiation.Length)); builder.EmitByte((byte)(hasVariance ? 1 : 0)); // TODO: general purpose padding builder.EmitByte(0); if (factory.Target.PointerSize == 8) builder.EmitInt(0); foreach (var typeArg in _details.Instantiation) builder.EmitPointerRelocOrIndirectionReference(factory.NecessaryTypeSymbol(typeArg)); if (hasVariance) { foreach (var argVariance in _details.Variance) builder.EmitByte(checked((byte)argVariance)); } return builder.ToObjectData(); } protected override string GetName(NodeFactory factory) => this.GetMangledName(factory.NameMangler); public override int ClassCode => -762680703; public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return _details.CompareToImpl(((GenericCompositionNode)other)._details, comparer); } } internal struct GenericCompositionDetails : IEquatable<GenericCompositionDetails> { public readonly Instantiation Instantiation; public readonly GenericVariance[] Variance; public GenericCompositionDetails(TypeDesc genericTypeInstance, bool forceVarianceInfo = false) { Debug.Assert(!genericTypeInstance.IsTypeDefinition); Instantiation = genericTypeInstance.Instantiation; bool emitVarianceInfo = forceVarianceInfo; if (!emitVarianceInfo) { foreach (GenericParameterDesc param in genericTypeInstance.GetTypeDefinition().Instantiation) { if (param.Variance != Internal.TypeSystem.GenericVariance.None) { emitVarianceInfo = true; break; } } } if (emitVarianceInfo) { Debug.Assert((byte)Internal.TypeSystem.GenericVariance.Contravariant == (byte)GenericVariance.Contravariant); Debug.Assert((byte)Internal.TypeSystem.GenericVariance.Covariant == (byte)GenericVariance.Covariant); Variance = new GenericVariance[Instantiation.Length]; int i = 0; foreach (GenericParameterDesc param in genericTypeInstance.GetTypeDefinition().Instantiation) { Variance[i++] = (GenericVariance)param.Variance; } } else { Variance = null; } } public GenericCompositionDetails(Instantiation instantiation, GenericVariance[] variance) { Debug.Assert(variance == null || instantiation.Length == variance.Length); Instantiation = instantiation; Variance = variance; } public bool Equals(GenericCompositionDetails other) { if (Instantiation.Length != other.Instantiation.Length) return false; if ((Variance == null) != (other.Variance == null)) return false; for (int i = 0; i < Instantiation.Length; i++) { if (Instantiation[i] != other.Instantiation[i]) return false; if (Variance != null) { if (Variance[i] != other.Variance[i]) return false; } } return true; } public int CompareToImpl(GenericCompositionDetails other, TypeSystemComparer comparer) { var compare = Instantiation.Length.CompareTo(other.Instantiation.Length); if (compare != 0) return compare; if (Variance == null && other.Variance != null) return -1; if (Variance != null && other.Variance == null) return 1; for (int i = 0; i < Instantiation.Length; i++) { compare = comparer.Compare(Instantiation[i], other.Instantiation[i]); if (compare != 0) return compare; if (Variance != null) { compare = Variance[i].CompareTo(other.Variance[i]); if (compare != 0) return compare; } } Debug.Assert(Equals(other)); return 0; } public override bool Equals(object obj) { return obj is GenericCompositionDetails && Equals((GenericCompositionDetails)obj); } public override int GetHashCode() { int hashCode = 13; if (Variance != null) { foreach (var element in Variance) { int value = (int)element * 0x5498341 + 0x832424; hashCode = hashCode * 31 + value; } } return Instantiation.ComputeGenericInstanceHashCode(hashCode); } } }
// 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 Internal.Text; using Internal.TypeSystem; using Debug = System.Diagnostics.Debug; using GenericVariance = Internal.Runtime.GenericVariance; namespace ILCompiler.DependencyAnalysis { /// <summary> /// Describes how a generic type instance is composed - the number of generic arguments, their types, /// and variance information. /// </summary> public class GenericCompositionNode : ObjectNode, ISymbolDefinitionNode { private GenericCompositionDetails _details; internal GenericCompositionNode(GenericCompositionDetails details) { _details = details; } public void AppendMangledName(NameMangler nameMangler, Utf8StringBuilder sb) { sb.Append("__GenericInstance"); for (int i = 0; i < _details.Instantiation.Length; i++) { sb.Append('_'); sb.Append(nameMangler.GetMangledTypeName(_details.Instantiation[i])); } if (_details.Variance != null) { sb.Append("__Variance__"); for (int i = 0; i < _details.Variance.Length; i++) { sb.Append('_'); sb.Append((checked((byte)_details.Variance[i])).ToStringInvariant()); } } } public int Offset { get { return 0; } } public override ObjectNodeSection Section { get { if (_details.Instantiation[0].Context.Target.IsWindows) return ObjectNodeSection.FoldableReadOnlyDataSection; else return ObjectNodeSection.DataSection; } } public override bool IsShareable => true; public override bool StaticDependenciesAreComputed => true; public override ObjectData GetData(NodeFactory factory, bool relocsOnly = false) { bool hasVariance = _details.Variance != null; var builder = new ObjectDataBuilder(factory, relocsOnly); builder.AddSymbol(this); builder.RequireInitialPointerAlignment(); builder.EmitShort((short)checked((UInt16)_details.Instantiation.Length)); builder.EmitByte((byte)(hasVariance ? 1 : 0)); // TODO: general purpose padding builder.EmitByte(0); if (factory.Target.PointerSize == 8) builder.EmitInt(0); foreach (var typeArg in _details.Instantiation) builder.EmitPointerRelocOrIndirectionReference(factory.NecessaryTypeSymbol(typeArg)); if (hasVariance) { foreach (var argVariance in _details.Variance) builder.EmitByte(checked((byte)argVariance)); } return builder.ToObjectData(); } protected override string GetName(NodeFactory factory) => this.GetMangledName(factory.NameMangler); public override int ClassCode => -762680703; public override int CompareToImpl(ISortableNode other, CompilerComparer comparer) { return _details.CompareToImpl(((GenericCompositionNode)other)._details, comparer); } } internal struct GenericCompositionDetails : IEquatable<GenericCompositionDetails> { public readonly Instantiation Instantiation; public readonly GenericVariance[] Variance; public GenericCompositionDetails(TypeDesc genericTypeInstance, bool forceVarianceInfo = false) { Debug.Assert(!genericTypeInstance.IsTypeDefinition); Instantiation = genericTypeInstance.Instantiation; bool emitVarianceInfo = forceVarianceInfo; if (!emitVarianceInfo) { foreach (GenericParameterDesc param in genericTypeInstance.GetTypeDefinition().Instantiation) { if (param.Variance != Internal.TypeSystem.GenericVariance.None) { emitVarianceInfo = true; break; } } } if (emitVarianceInfo) { Debug.Assert((byte)Internal.TypeSystem.GenericVariance.Contravariant == (byte)GenericVariance.Contravariant); Debug.Assert((byte)Internal.TypeSystem.GenericVariance.Covariant == (byte)GenericVariance.Covariant); Variance = new GenericVariance[Instantiation.Length]; int i = 0; foreach (GenericParameterDesc param in genericTypeInstance.GetTypeDefinition().Instantiation) { Variance[i++] = (GenericVariance)param.Variance; } } else { Variance = null; } } public GenericCompositionDetails(Instantiation instantiation, GenericVariance[] variance) { Debug.Assert(variance == null || instantiation.Length == variance.Length); Instantiation = instantiation; Variance = variance; } public bool Equals(GenericCompositionDetails other) { if (Instantiation.Length != other.Instantiation.Length) return false; if ((Variance == null) != (other.Variance == null)) return false; for (int i = 0; i < Instantiation.Length; i++) { if (Instantiation[i] != other.Instantiation[i]) return false; if (Variance != null) { if (Variance[i] != other.Variance[i]) return false; } } return true; } public int CompareToImpl(GenericCompositionDetails other, TypeSystemComparer comparer) { var compare = Instantiation.Length.CompareTo(other.Instantiation.Length); if (compare != 0) return compare; if (Variance == null && other.Variance != null) return -1; if (Variance != null && other.Variance == null) return 1; for (int i = 0; i < Instantiation.Length; i++) { compare = comparer.Compare(Instantiation[i], other.Instantiation[i]); if (compare != 0) return compare; if (Variance != null) { compare = Variance[i].CompareTo(other.Variance[i]); if (compare != 0) return compare; } } Debug.Assert(Equals(other)); return 0; } public override bool Equals(object obj) { return obj is GenericCompositionDetails && Equals((GenericCompositionDetails)obj); } public override int GetHashCode() { int hashCode = 13; if (Variance != null) { foreach (var element in Variance) { int value = (int)element * 0x5498341 + 0x832424; hashCode = hashCode * 31 + value; } } return Instantiation.ComputeGenericInstanceHashCode(hashCode); } } }
-1
dotnet/runtime
66,145
Fix clash between tentative method optimizations
This pull request pretty much became a rollback of https://github.com/dotnet/runtimelab/pull/658 with a regression test to make sure if https://github.com/dotnet/runtimelab/pull/658 is reintroduced, we do it properly. ~~When we were in the situation of the newly added test, we would try to generate method body on the abstract class. Such method body is not actually reachable.~~ ~~Saves 500 bytes on a hello world. Fixes a compiler assert (that might be more serious sometimes).~~
MichalStrehovsky
2022-03-03T16:32:47Z
2022-03-07T16:49:51Z
154386d63b3ba55ce3251fa4caf3dfa89279d982
b0d1e89497bfa7a7b602a1d1af2faa97af96c88d
Fix clash between tentative method optimizations. This pull request pretty much became a rollback of https://github.com/dotnet/runtimelab/pull/658 with a regression test to make sure if https://github.com/dotnet/runtimelab/pull/658 is reintroduced, we do it properly. ~~When we were in the situation of the newly added test, we would try to generate method body on the abstract class. Such method body is not actually reachable.~~ ~~Saves 500 bytes on a hello world. Fixes a compiler assert (that might be more serious sometimes).~~
./src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/EC/ECKeyFileTests.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Security.Cryptography.Encryption.RC2.Tests; using System.Text; using Test.Cryptography; using Xunit; namespace System.Security.Cryptography.Tests { [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] public abstract partial class ECKeyFileTests<T> where T : ECAlgorithm { protected abstract T CreateKey(); protected abstract void Exercise(T key); protected virtual Func<T, byte[]> PublicKeyWriteArrayFunc { get; } = null; protected virtual WriteKeyToSpanFunc PublicKeyWriteSpanFunc { get; } = null; // This would need to be virtualized if there was ever a platform that // allowed explicit in ECDH or ECDSA but not the other. public static bool SupportsExplicitCurves { get; } = EcDiffieHellman.Tests.ECDiffieHellmanFactory.ExplicitCurvesSupported; public static bool CanDeriveNewPublicKey { get; } = EcDiffieHellman.Tests.ECDiffieHellmanFactory.CanDeriveNewPublicKey; public static bool SupportsBrainpool { get; } = IsCurveSupported(ECCurve.NamedCurves.brainpoolP160r1.Oid); public static bool SupportsSect163k1 { get; } = IsCurveSupported(EccTestData.Sect163k1Key1.Curve.Oid); public static bool SupportsSect283k1 { get; } = IsCurveSupported(EccTestData.Sect283k1Key1.Curve.Oid); public static bool SupportsC2pnb163v1 { get; } = IsCurveSupported(EccTestData.C2pnb163v1Key1.Curve.Oid); // Some platforms support explicitly specifying these curves, but do not support specifying them by name. public static bool ExplicitNamedSameSupport { get; } = !PlatformDetection.IsAndroid; public static bool SupportsSect163k1Explicit { get; } = SupportsSect163k1 || (!ExplicitNamedSameSupport && SupportsExplicitCurves); public static bool SupportsC2pnb163v1Explicit { get; } = SupportsC2pnb163v1 || (!ExplicitNamedSameSupport && SupportsExplicitCurves); private static bool IsCurveSupported(Oid oid) { return EcDiffieHellman.Tests.ECDiffieHellmanFactory.IsCurveValid(oid); } [Theory] [InlineData(false)] [InlineData(true)] public void UseAfterDispose(bool importKey) { T key = CreateKey(); if (importKey) { key.ImportParameters(EccTestData.GetNistP256ReferenceKey()); } byte[] ecPrivate; byte[] pkcs8Private; byte[] pkcs8EncryptedPrivate; byte[] subjectPublicKeyInfo; string pwStr = "Hello"; // Because the PBE algorithm uses PBES2 the string->byte encoding is UTF-8. byte[] pwBytes = Encoding.UTF8.GetBytes(pwStr); PbeParameters pbeParameters = new PbeParameters( PbeEncryptionAlgorithm.Aes192Cbc, HashAlgorithmName.SHA256, 3072); // Ensure the key was loaded, then dispose it. // Also ensures all of the inputs are valid for the disposed tests. using (key) { ecPrivate = key.ExportECPrivateKey(); pkcs8Private = key.ExportPkcs8PrivateKey(); pkcs8EncryptedPrivate = key.ExportEncryptedPkcs8PrivateKey(pwStr, pbeParameters); subjectPublicKeyInfo = key.ExportSubjectPublicKeyInfo(); } Assert.Throws<ObjectDisposedException>(() => key.ImportECPrivateKey(ecPrivate, out _)); Assert.Throws<ObjectDisposedException>(() => key.ImportPkcs8PrivateKey(pkcs8Private, out _)); Assert.Throws<ObjectDisposedException>(() => key.ImportEncryptedPkcs8PrivateKey(pwStr, pkcs8EncryptedPrivate, out _)); Assert.Throws<ObjectDisposedException>(() => key.ImportEncryptedPkcs8PrivateKey(pwBytes, pkcs8EncryptedPrivate, out _)); Assert.Throws<ObjectDisposedException>(() => key.ImportSubjectPublicKeyInfo(subjectPublicKeyInfo, out _)); Assert.Throws<ObjectDisposedException>(() => key.ExportECPrivateKey()); Assert.Throws<ObjectDisposedException>(() => key.TryExportECPrivateKey(ecPrivate, out _)); Assert.Throws<ObjectDisposedException>(() => key.ExportPkcs8PrivateKey()); Assert.Throws<ObjectDisposedException>(() => key.TryExportPkcs8PrivateKey(pkcs8Private, out _)); Assert.Throws<ObjectDisposedException>(() => key.ExportEncryptedPkcs8PrivateKey(pwStr, pbeParameters)); Assert.Throws<ObjectDisposedException>(() => key.TryExportEncryptedPkcs8PrivateKey(pwStr, pbeParameters, pkcs8EncryptedPrivate, out _)); Assert.Throws<ObjectDisposedException>(() => key.ExportEncryptedPkcs8PrivateKey(pwBytes, pbeParameters)); Assert.Throws<ObjectDisposedException>(() => key.TryExportEncryptedPkcs8PrivateKey(pwBytes, pbeParameters, pkcs8EncryptedPrivate, out _)); Assert.Throws<ObjectDisposedException>(() => key.ExportSubjectPublicKeyInfo()); Assert.Throws<ObjectDisposedException>(() => key.TryExportSubjectPublicKeyInfo(subjectPublicKeyInfo, out _)); // Check encrypted import with the wrong password. // It shouldn't do enough work to realize it was wrong. pwBytes = Array.Empty<byte>(); Assert.Throws<ObjectDisposedException>(() => key.ImportEncryptedPkcs8PrivateKey("", pkcs8EncryptedPrivate, out _)); Assert.Throws<ObjectDisposedException>(() => key.ImportEncryptedPkcs8PrivateKey(pwBytes, pkcs8EncryptedPrivate, out _)); } [Fact] public void ReadWriteNistP521Pkcs8() { const string base64 = @" MIHuAgEAMBAGByqGSM49AgEGBSuBBAAjBIHWMIHTAgEBBEIBpV+HhaVzC67h1rPT AQaff9ZNiwTM6lfv1ZYeaPM/q0NUUWbKZVPNOP9xPRKJxpi9fQhrVeAbW9XtJ+Nj A3axFmahgYkDgYYABAB1HyYyTHPO9dReuzKTfjBg41GWCldZStA+scoMXqdHEhM2 a6mR0kQGcX+G/e/eCG4JuVSlfcD16UWXVtYMKq5t4AGo3bs/AsjCNSRyn1SLfiMy UjPvZ90wdSuSTyl0WePC4Sro2PT+RFTjhHwYslXKzvWXN7kY4d5A+V6f/k9Xt5FT oA=="; ReadWriteBase64Pkcs8(base64, EccTestData.GetNistP521Key2()); } [Fact] public void ReadWriteNistP521Pkcs8_ECDH() { const string base64 = @" MIHsAgEAMA4GBSuBBAEMBgUrgQQAIwSB1jCB0wIBAQRCAaVfh4Wlcwuu4daz0wEG n3/WTYsEzOpX79WWHmjzP6tDVFFmymVTzTj/cT0SicaYvX0Ia1XgG1vV7SfjYwN2 sRZmoYGJA4GGAAQAdR8mMkxzzvXUXrsyk34wYONRlgpXWUrQPrHKDF6nRxITNmup kdJEBnF/hv3v3ghuCblUpX3A9elFl1bWDCqubeABqN27PwLIwjUkcp9Ui34jMlIz 72fdMHUrkk8pdFnjwuEq6Nj0/kRU44R8GLJVys71lze5GOHeQPlen/5PV7eRU6A="; ReadWriteBase64Pkcs8( base64, EccTestData.GetNistP521Key2(), isSupported: false); } [Fact] public void ReadWriteNistP521SubjectPublicKeyInfo() { const string base64 = @" MIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQAdR8mMkxzzvXUXrsyk34wYONRlgpX WUrQPrHKDF6nRxITNmupkdJEBnF/hv3v3ghuCblUpX3A9elFl1bWDCqubeABqN27 PwLIwjUkcp9Ui34jMlIz72fdMHUrkk8pdFnjwuEq6Nj0/kRU44R8GLJVys71lze5 GOHeQPlen/5PV7eRU6A="; ReadWriteBase64SubjectPublicKeyInfo(base64, EccTestData.GetNistP521Key2()); } [Fact] public void ReadWriteNistP521SubjectPublicKeyInfo_ECDH() { const string base64 = @" MIGZMA4GBSuBBAEMBgUrgQQAIwOBhgAEAHUfJjJMc8711F67MpN+MGDjUZYKV1lK 0D6xygxep0cSEzZrqZHSRAZxf4b9794Ibgm5VKV9wPXpRZdW1gwqrm3gAajduz8C yMI1JHKfVIt+IzJSM+9n3TB1K5JPKXRZ48LhKujY9P5EVOOEfBiyVcrO9Zc3uRjh 3kD5Xp/+T1e3kVOg"; ReadWriteBase64SubjectPublicKeyInfo( base64, EccTestData.GetNistP521Key2(), isSupported: false); } [Fact] public void ReadNistP521EncryptedPkcs8_Pbes2_Aes128_Sha384() { // PBES2, PBKDF2 (SHA384), AES128 const string base64 = @" MIIBXTBXBgkqhkiG9w0BBQ0wSjApBgkqhkiG9w0BBQwwHAQI/JyXWyp/t3kCAggA MAwGCCqGSIb3DQIKBQAwHQYJYIZIAWUDBAECBBA3H8mbFK5afB5GzIemCCQkBIIB AKAz1z09ATUA8UfoDMwTyXiHUS8Mb/zkUCH+I7rav4orhAnSyYAyLKcHeGne+kUa 8ewQ5S7oMMLXE0HHQ8CpORlSgxTssqTAHigXEqdRb8nQ8hJJa2dFtNXyUeFtxZ7p x+aSLD6Y3J+mgzeVp1ICgROtuRjA9RYjUdd/3cy2BAlW+Atfs/300Jhkke3H0Gqc F71o65UNB+verEgN49rQK7FAFtoVI2oRjHLO1cGjxZkbWe2KLtgJWsgmexRq3/a+ Pfuapj3LAHALZtDNMZ+QCFN2ZXUSFNWiBSwnwCAtfFCn/EchPo3MFR3K0q/qXTua qtlbnispri1a/EghiaPQ0po="; ReadWriteBase64EncryptedPkcs8( base64, "qwerty", new PbeParameters( PbeEncryptionAlgorithm.TripleDes3KeyPkcs12, HashAlgorithmName.SHA1, 12321), EccTestData.GetNistP521Key2()); } [Fact] public void ReadNistP521EncryptedPkcs8_Pbes2_Aes128_Sha384_PasswordBytes() { // PBES2, PBKDF2 (SHA384), AES128 // [SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine", Justification="Suppression approved. Unit test key.")] const string base64 = @" MIIBXTBXBgkqhkiG9w0BBQ0wSjApBgkqhkiG9w0BBQwwHAQI/JyXWyp/t3kCAggA MAwGCCqGSIb3DQIKBQAwHQYJYIZIAWUDBAECBBA3H8mbFK5afB5GzIemCCQkBIIB AKAz1z09ATUA8UfoDMwTyXiHUS8Mb/zkUCH+I7rav4orhAnSyYAyLKcHeGne+kUa 8ewQ5S7oMMLXE0HHQ8CpORlSgxTssqTAHigXEqdRb8nQ8hJJa2dFtNXyUeFtxZ7p x+aSLD6Y3J+mgzeVp1ICgROtuRjA9RYjUdd/3cy2BAlW+Atfs/300Jhkke3H0Gqc F71o65UNB+verEgN49rQK7FAFtoVI2oRjHLO1cGjxZkbWe2KLtgJWsgmexRq3/a+ Pfuapj3LAHALZtDNMZ+QCFN2ZXUSFNWiBSwnwCAtfFCn/EchPo3MFR3K0q/qXTua qtlbnispri1a/EghiaPQ0po="; ReadWriteBase64EncryptedPkcs8( base64, Encoding.UTF8.GetBytes("qwerty"), new PbeParameters( PbeEncryptionAlgorithm.Aes256Cbc, HashAlgorithmName.SHA1, 12321), EccTestData.GetNistP521Key2()); } [ConditionalFact(typeof(RC2Factory), nameof(RC2Factory.IsSupported))] public void ReadNistP256EncryptedPkcs8_Pbes1_RC2_MD5() { const string base64 = @" MIGwMBsGCSqGSIb3DQEFBjAOBAiVk8SDhLdiNwICCAAEgZB2rI9tf7jjGdEwJNrS 8F/xNIo/0OSUSkQyg5n/ovRK1IodzPpWqipqM8TGfZk4sxn7h7RBmX2FlMkTLO4i mVannH3jd9cmCAz0aewDO0/LgmvDnzWiJ/CoDamzwC8bzDocq1Y/PsVYsYzSrJ7n m8STNpW+zSpHWlpHpWHgXGq4wrUKJifxOv6Rm5KTYcvUT38="; ReadWriteBase64EncryptedPkcs8( base64, "secp256r1", new PbeParameters( PbeEncryptionAlgorithm.TripleDes3KeyPkcs12, HashAlgorithmName.SHA1, 1024), EccTestData.GetNistP256ReferenceKey()); } [Fact] public void ReadWriteNistP256ECPrivateKey() { const string base64 = @" MHcCAQEEIHChLC2xaEXtVv9oz8IaRys/BNfWhRv2NJ8tfVs0UrOKoAoGCCqGSM49 AwEHoUQDQgAEgQHs5HRkpurXDPaabivT2IaRoyYtIsuk92Ner/JmgKjYoSumHVmS NfZ9nLTVjxeD08pD548KWrqmJAeZNsDDqQ=="; ReadWriteBase64ECPrivateKey( base64, EccTestData.GetNistP256ReferenceKey()); } [Fact] public void ReadWriteNistP256ExplicitECPrivateKey() { ReadWriteBase64ECPrivateKey( @" MIIBaAIBAQQgcKEsLbFoRe1W/2jPwhpHKz8E19aFG/Y0ny19WzRSs4qggfowgfcC AQEwLAYHKoZIzj0BAQIhAP////8AAAABAAAAAAAAAAAAAAAA//////////////// MFsEIP////8AAAABAAAAAAAAAAAAAAAA///////////////8BCBaxjXYqjqT57Pr vVV2mIa8ZR0GsMxTsPY7zjw+J9JgSwMVAMSdNgiG5wSTamZ44ROdJreBn36QBEEE axfR8uEsQkf4vOblY6RA8ncDfYEt6zOg9KE5RdiYwpZP40Li/hp/m47n60p8D54W K84zV2sxXs7LtkBoN79R9QIhAP////8AAAAA//////////+85vqtpxeehPO5ysL8 YyVRAgEBoUQDQgAEgQHs5HRkpurXDPaabivT2IaRoyYtIsuk92Ner/JmgKjYoSum HVmSNfZ9nLTVjxeD08pD548KWrqmJAeZNsDDqQ==", EccTestData.GetNistP256ReferenceKeyExplicit(), SupportsExplicitCurves); } [Fact] public void ReadWriteNistP256ExplicitPkcs8() { ReadWriteBase64Pkcs8( @" MIIBeQIBADCCAQMGByqGSM49AgEwgfcCAQEwLAYHKoZIzj0BAQIhAP////8AAAAB AAAAAAAAAAAAAAAA////////////////MFsEIP////8AAAABAAAAAAAAAAAAAAAA ///////////////8BCBaxjXYqjqT57PrvVV2mIa8ZR0GsMxTsPY7zjw+J9JgSwMV AMSdNgiG5wSTamZ44ROdJreBn36QBEEEaxfR8uEsQkf4vOblY6RA8ncDfYEt6zOg 9KE5RdiYwpZP40Li/hp/m47n60p8D54WK84zV2sxXs7LtkBoN79R9QIhAP////8A AAAA//////////+85vqtpxeehPO5ysL8YyVRAgEBBG0wawIBAQQgcKEsLbFoRe1W /2jPwhpHKz8E19aFG/Y0ny19WzRSs4qhRANCAASBAezkdGSm6tcM9ppuK9PYhpGj Ji0iy6T3Y16v8maAqNihK6YdWZI19n2ctNWPF4PTykPnjwpauqYkB5k2wMOp", EccTestData.GetNistP256ReferenceKeyExplicit(), SupportsExplicitCurves); } [Fact] public void ReadWriteNistP256ExplicitEncryptedPkcs8() { ReadWriteBase64EncryptedPkcs8( @" MIIBoTAbBgkqhkiG9w0BBQMwDgQIQqYZ3N87K0ICAggABIIBgOHAWa6wz144p0uT qZsQAbQcIpAFBQRC382dxiOHCV11OyZg264SmxS9iY1OEwIr/peACLu+Fk7zPKhv Ox1hYz/OeLoKKdtBMqrp65JmH73jG8qeAMuYNj83AIERY7Cckuc2fEC2GTEJcNWs olE+0p4H6yIvXI48NEQazj5w9zfOGvLmP6Kw6nX+SV3fzM9jHskU226LnDdokGVg an6/hV1r+2+n2MujhfNzQd/5vW5zx7PN/1aMVMz3wUv9t8scDppeMR5CNCMkxlRA cQ2lfx2vqFuY70EckgumDqm7AtKK2bLlA6XGTb8HuqKHA0l1zrul9AOBC1g33isD 5CJu1CCT34adV4E4G44uiRQUtf+K8m5Oeo8FI/gGBxdQyOh1k8TNsM+p32gTU8HH 89M5R+s1ayQI7jVPGHXm8Ch7lxvqo6FZAu6+vh23vTwVShUTpGYd0XguE6XKJjGx eWDIWFuFRj58uAQ65/viFausHWt1BdywcwcyVRb2eLI5MR7DWA==", "explicit", new PbeParameters( PbeEncryptionAlgorithm.Aes128Cbc, HashAlgorithmName.SHA256, 1234), EccTestData.GetNistP256ReferenceKeyExplicit(), SupportsExplicitCurves); } [Fact] public void ReadWriteNistP256ExplicitSubjectPublicKeyInfo() { ReadWriteBase64SubjectPublicKeyInfo( @" MIIBSzCCAQMGByqGSM49AgEwgfcCAQEwLAYHKoZIzj0BAQIhAP////8AAAABAAAA AAAAAAAAAAAA////////////////MFsEIP////8AAAABAAAAAAAAAAAAAAAA//// ///////////8BCBaxjXYqjqT57PrvVV2mIa8ZR0GsMxTsPY7zjw+J9JgSwMVAMSd NgiG5wSTamZ44ROdJreBn36QBEEEaxfR8uEsQkf4vOblY6RA8ncDfYEt6zOg9KE5 RdiYwpZP40Li/hp/m47n60p8D54WK84zV2sxXs7LtkBoN79R9QIhAP////8AAAAA //////////+85vqtpxeehPO5ysL8YyVRAgEBA0IABIEB7OR0ZKbq1wz2mm4r09iG kaMmLSLLpPdjXq/yZoCo2KErph1ZkjX2fZy01Y8Xg9PKQ+ePClq6piQHmTbAw6k=", EccTestData.GetNistP256ReferenceKeyExplicit(), SupportsExplicitCurves); } [Fact] public void ReadWriteBrainpoolKey1ECPrivateKey() { ReadWriteBase64ECPrivateKey( @" MFQCAQEEFMXZRFR94RXbJYjcb966O0c+nE2WoAsGCSskAwMCCAEBAaEsAyoABI5i jwk5x2KSdsrb/pnAHDZQk1TictLI7vH2zDIF0AV+ud5sqeMQUJY=", EccTestData.BrainpoolP160r1Key1, SupportsBrainpool); } [Fact] public void ReadWriteBrainpoolKey1Pkcs8() { ReadWriteBase64Pkcs8( @" MGQCAQAwFAYHKoZIzj0CAQYJKyQDAwIIAQEBBEkwRwIBAQQUxdlEVH3hFdsliNxv 3ro7Rz6cTZahLAMqAASOYo8JOcdiknbK2/6ZwBw2UJNU4nLSyO7x9swyBdAFfrne bKnjEFCW", EccTestData.BrainpoolP160r1Key1, SupportsBrainpool); } [Fact] public void ReadWriteBrainpoolKey1EncryptedPkcs8() { ReadWriteBase64EncryptedPkcs8( @" MIGHMBsGCSqGSIb3DQEFAzAOBAhSgCZvbsatLQICCAAEaKGDyoSVej1yNPCn7K6q ooI857+joe6NZjR+w1xuH4JfrQZGvelWZ2AWtQezuz4UzPLnL3Nyf6jjPPuKarpk HiDaMtpw7yT5+32Vkxv5C2jvqNPpicmEFpf2wJ8yVLQtMOKAF2sOwxN/", "12345", new PbeParameters( PbeEncryptionAlgorithm.Aes192Cbc, HashAlgorithmName.SHA384, 4096), EccTestData.BrainpoolP160r1Key1, SupportsBrainpool); } [Fact] public void ReadWriteBrainpoolKey1SubjectPublicKeyInfo() { ReadWriteBase64SubjectPublicKeyInfo( @" MEIwFAYHKoZIzj0CAQYJKyQDAwIIAQEBAyoABI5ijwk5x2KSdsrb/pnAHDZQk1Ti ctLI7vH2zDIF0AV+ud5sqeMQUJY=", EccTestData.BrainpoolP160r1Key1, SupportsBrainpool); } [Fact] public void ReadWriteSect163k1Key1ECPrivateKey() { ReadWriteBase64ECPrivateKey( @" MFMCAQEEFQPBmVrfrowFGNwT3+YwS7AQF+akEqAHBgUrgQQAAaEuAywABAYXnjcZ zIElQ1/mRYnV/KbcGIdVHQeI/rti/8kkjYs5iv4+C1w8ArP+Nw==", EccTestData.Sect163k1Key1, SupportsSect163k1); } [Fact] public void ReadWriteSect163k1Key1Pkcs8() { ReadWriteBase64Pkcs8( @" MGMCAQAwEAYHKoZIzj0CAQYFK4EEAAEETDBKAgEBBBUDwZla366MBRjcE9/mMEuw EBfmpBKhLgMsAAQGF543GcyBJUNf5kWJ1fym3BiHVR0HiP67Yv/JJI2LOYr+Pgtc PAKz/jc=", EccTestData.Sect163k1Key1, SupportsSect163k1); } [Fact] public void ReadWriteSect163k1Key1EncryptedPkcs8() { ReadWriteBase64EncryptedPkcs8( @" MIGHMBsGCSqGSIb3DQEFAzAOBAjLBuCZyPt15QICCAAEaPa9V9VJoB8G+RIgZaYv z4xl+rpvkDrDI0Xnh8oj1CLQldy2N77pdk3pOg9TwJo+r+eKfIJgBVezW2O615ww f+ESRyxDnBgKz6H2RKeenyrwVhxF98SyJzAdP637vR3QmDNAWWAgoUhg", "Koblitz", new PbeParameters( PbeEncryptionAlgorithm.Aes256Cbc, HashAlgorithmName.SHA256, 7), EccTestData.Sect163k1Key1, SupportsSect163k1); } [Fact] public void ReadWriteSect163k1Key1SubjectPublicKeyInfo() { ReadWriteBase64SubjectPublicKeyInfo( @" MEAwEAYHKoZIzj0CAQYFK4EEAAEDLAAEBheeNxnMgSVDX+ZFidX8ptwYh1UdB4j+ u2L/ySSNizmK/j4LXDwCs/43", EccTestData.Sect163k1Key1, SupportsSect163k1); } [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/64446", typeof(PlatformSupport), nameof(PlatformSupport.IsAndroidVersionAtLeast31))] public void ReadWriteSect163k1Key1ExplicitECPrivateKey() { ReadWriteBase64ECPrivateKey( @" MIHHAgEBBBUDwZla366MBRjcE9/mMEuwEBfmpBKgezB5AgEBMCUGByqGSM49AQIw GgICAKMGCSqGSM49AQIDAzAJAgEDAgEGAgEHMAYEAQEEAQEEKwQC/hPAU3u8Eayq B9eT3k5tXlyU7ugCiQcPsF04/1gyHy6ABTbVOMzao9kCFQQAAAAAAAAAAAACAQii 4MwNmfil7wIBAqEuAywABAYXnjcZzIElQ1/mRYnV/KbcGIdVHQeI/rti/8kkjYs5 iv4+C1w8ArP+Nw==", EccTestData.Sect163k1Key1Explicit, SupportsSect163k1Explicit); } [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/64446", typeof(PlatformSupport), nameof(PlatformSupport.IsAndroidVersionAtLeast31))] public void ReadWriteSect163k1Key1ExplicitPkcs8() { ReadWriteBase64Pkcs8( @" MIHYAgEAMIGEBgcqhkjOPQIBMHkCAQEwJQYHKoZIzj0BAjAaAgIAowYJKoZIzj0B AgMDMAkCAQMCAQYCAQcwBgQBAQQBAQQrBAL+E8BTe7wRrKoH15PeTm1eXJTu6AKJ Bw+wXTj/WDIfLoAFNtU4zNqj2QIVBAAAAAAAAAAAAAIBCKLgzA2Z+KXvAgECBEww SgIBAQQVA8GZWt+ujAUY3BPf5jBLsBAX5qQSoS4DLAAEBheeNxnMgSVDX+ZFidX8 ptwYh1UdB4j+u2L/ySSNizmK/j4LXDwCs/43", EccTestData.Sect163k1Key1Explicit, SupportsSect163k1Explicit); } [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/64446", typeof(PlatformSupport), nameof(PlatformSupport.IsAndroidVersionAtLeast31))] public void ReadWriteSect163k1Key1ExplicitEncryptedPkcs8() { ReadWriteBase64EncryptedPkcs8( @" MIIBADAbBgkqhkiG9w0BBQMwDgQICAkWq2tKYZUCAggABIHgjBfngwE9DbCEaznz +55MjSGbQH0NMgIRCJtQLbrI7888+KmTL6hWYPH6CQzTsi1unWrMAH2JKa7dkIe9 FWNXW7bmhcokVDh/OTXOV9QPZ3O4m19a9XOl0wNlbi47XQ3KUkcbzyFNYlDMSzFw HRfW8+aIkyYAvYCoA4buRfigBe0xy1VKyE5aUkX0EFjx4gqC3Q5mjDMFOxlKNjVV clSZg6tg9J7bTQsDAN0uYpBc1r8DiSQbKMxg+q13yBciXJzfmkQRtNVXQPsseiUm z2NFvWcpK0Fh9fCVGuXV9sjJ5qE=", "Koblitz", new PbeParameters( PbeEncryptionAlgorithm.Aes128Cbc, HashAlgorithmName.SHA256, 12), EccTestData.Sect163k1Key1Explicit, SupportsSect163k1Explicit); } [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/64446", typeof(PlatformSupport), nameof(PlatformSupport.IsAndroidVersionAtLeast31))] public void ReadWriteSect163k1Key1ExplicitSubjectPublicKeyInfo() { ReadWriteBase64SubjectPublicKeyInfo( @" MIG1MIGEBgcqhkjOPQIBMHkCAQEwJQYHKoZIzj0BAjAaAgIAowYJKoZIzj0BAgMD MAkCAQMCAQYCAQcwBgQBAQQBAQQrBAL+E8BTe7wRrKoH15PeTm1eXJTu6AKJBw+w XTj/WDIfLoAFNtU4zNqj2QIVBAAAAAAAAAAAAAIBCKLgzA2Z+KXvAgECAywABAYX njcZzIElQ1/mRYnV/KbcGIdVHQeI/rti/8kkjYs5iv4+C1w8ArP+Nw==", EccTestData.Sect163k1Key1Explicit, SupportsSect163k1Explicit); } [Fact] public void ReadWriteSect283k1Key1ECPrivateKey() { ReadWriteBase64ECPrivateKey( @" MIGAAgEBBCQAtPGuHn/c1LDoIFPAipCIUrJiMebAFnD8xsPqLF0/7UDt8DegBwYF K4EEABChTANKAAQHUncL0z5qbuIJbLaxIOdJe0e2wHehR8tX2vaTkJ2EBxbup6oE fbmZXDVgPF5rL4zf8Otx03rjQxughJ66sTpMkAPHlp9VzZA=", EccTestData.Sect283k1Key1, SupportsSect283k1); } [Fact] public void ReadWriteSect283k1Key1Pkcs8() { ReadWriteBase64Pkcs8( @" MIGQAgEAMBAGByqGSM49AgEGBSuBBAAQBHkwdwIBAQQkALTxrh5/3NSw6CBTwIqQ iFKyYjHmwBZw/MbD6ixdP+1A7fA3oUwDSgAEB1J3C9M+am7iCWy2sSDnSXtHtsB3 oUfLV9r2k5CdhAcW7qeqBH25mVw1YDxeay+M3/DrcdN640MboISeurE6TJADx5af Vc2Q", EccTestData.Sect283k1Key1, SupportsSect283k1); } [Fact] public void ReadWriteSect283k1Key1EncryptedPkcs8() { ReadWriteBase64EncryptedPkcs8( @" MIG4MBsGCSqGSIb3DQEFAzAOBAhf/Ix8WHVvxQICCAAEgZheT2iB2sBmNjV2qIgI DsNyPY+0rwbWR8MHZcRN0zAL9Q3kawaZyWeKe4j3m3Y39YWURVymYeLAm70syrEw 057W6kNVXxR/hEq4MlHJZxZdS+R6LGpEvWFEWiuN0wBtmhO24+KmqPMH8XhGszBv nTvuaAMG/xvXzKoigakX+1D60cmftPsC7t23SF+xMdzfZNlJGrxXFYX1Gg==", "12345", new PbeParameters( PbeEncryptionAlgorithm.Aes192Cbc, HashAlgorithmName.SHA384, 4096), EccTestData.Sect283k1Key1, SupportsSect283k1); } [Fact] public void ReadWriteSect283k1Key1SubjectPublicKeyInfo() { ReadWriteBase64SubjectPublicKeyInfo( @" MF4wEAYHKoZIzj0CAQYFK4EEABADSgAEB1J3C9M+am7iCWy2sSDnSXtHtsB3oUfL V9r2k5CdhAcW7qeqBH25mVw1YDxeay+M3/DrcdN640MboISeurE6TJADx5afVc2Q", EccTestData.Sect283k1Key1, SupportsSect283k1); } [Fact] public void ReadWriteC2pnb163v1ECPrivateKey() { ReadWriteBase64ECPrivateKey( @" MFYCAQEEFQD00koUBxIvRFlnvh2TwAk6ZTZ5hqAKBggqhkjOPQMAAaEuAywABAIR Jy8cVYJCaIjpG9aSV3SUIyJIqgQnCDD3oQCa1nCojekr1ZJIzIE7RQ==", EccTestData.C2pnb163v1Key1, SupportsC2pnb163v1); } [Fact] public void ReadWriteC2pnb163v1Pkcs8() { ReadWriteBase64Pkcs8( @" MGYCAQAwEwYHKoZIzj0CAQYIKoZIzj0DAAEETDBKAgEBBBUA9NJKFAcSL0RZZ74d k8AJOmU2eYahLgMsAAQCEScvHFWCQmiI6RvWkld0lCMiSKoEJwgw96EAmtZwqI3p K9WSSMyBO0U=", EccTestData.C2pnb163v1Key1, SupportsC2pnb163v1); } [Fact] public void ReadWriteC2pnb163v1EncryptedPkcs8() { ReadWriteBase64EncryptedPkcs8( @" MIGPMBsGCSqGSIb3DQEFAzAOBAjdV9IDq+L+5gICCAAEcI1e6RA8kMcYB+PvOcCU Jj65nXTIrMPmZ0DmFMF9WBg0J+yzxgDhBVynpT2uJntY4FuDlvdpcLRK1EGLZYKf qYc5zJMYkRZ178bE3DtfrP3UxD34YvbRl2aeu334+wJOm7ApXv81ugt4OoCiPhdg wiA=", "secret", new PbeParameters( PbeEncryptionAlgorithm.Aes192Cbc, HashAlgorithmName.SHA512, 1024), EccTestData.C2pnb163v1Key1, SupportsC2pnb163v1); } [Fact] public void ReadWriteC2pnb163v1SubjectPublicKeyInfo() { ReadWriteBase64SubjectPublicKeyInfo( @" MEMwEwYHKoZIzj0CAQYIKoZIzj0DAAEDLAAEAhEnLxxVgkJoiOkb1pJXdJQjIkiq BCcIMPehAJrWcKiN6SvVkkjMgTtF", EccTestData.C2pnb163v1Key1, SupportsC2pnb163v1); } [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/64446", typeof(PlatformSupport), nameof(PlatformSupport.IsAndroidVersionAtLeast31))] public void ReadWriteC2pnb163v1ExplicitECPrivateKey() { ReadWriteBase64ECPrivateKey( @" MIIBBwIBAQQVAPTSShQHEi9EWWe+HZPACTplNnmGoIG6MIG3AgEBMCUGByqGSM49 AQIwGgICAKMGCSqGSM49AQIDAzAJAgEBAgECAgEIMEQEFQclRrVDUjSkIuB4lnX0 MsiUNd5SQgQUyVF9BtUkDTz/OMdLILbNTW+d1NkDFQDSwPsVdghg3vHu9NaW5naH VhUXVAQrBAevaZiVRhA9eTKfzD10iA8zu+gDywHsIyEbWWat6h0/h/fqWEiu8LfK nwIVBAAAAAAAAAAAAAHmD8iCHMdNrq/BAgECoS4DLAAEAhEnLxxVgkJoiOkb1pJX dJQjIkiqBCcIMPehAJrWcKiN6SvVkkjMgTtF", EccTestData.C2pnb163v1Key1Explicit, SupportsC2pnb163v1Explicit); } [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/64446", typeof(PlatformSupport), nameof(PlatformSupport.IsAndroidVersionAtLeast31))] public void ReadWriteC2pnb163v1ExplicitPkcs8() { ReadWriteBase64Pkcs8( @" MIIBFwIBADCBwwYHKoZIzj0CATCBtwIBATAlBgcqhkjOPQECMBoCAgCjBgkqhkjO PQECAwMwCQIBAQIBAgIBCDBEBBUHJUa1Q1I0pCLgeJZ19DLIlDXeUkIEFMlRfQbV JA08/zjHSyC2zU1vndTZAxUA0sD7FXYIYN7x7vTWluZ2h1YVF1QEKwQHr2mYlUYQ PXkyn8w9dIgPM7voA8sB7CMhG1lmreodP4f36lhIrvC3yp8CFQQAAAAAAAAAAAAB 5g/IghzHTa6vwQIBAgRMMEoCAQEEFQD00koUBxIvRFlnvh2TwAk6ZTZ5hqEuAywA BAIRJy8cVYJCaIjpG9aSV3SUIyJIqgQnCDD3oQCa1nCojekr1ZJIzIE7RQ==", EccTestData.C2pnb163v1Key1Explicit, SupportsC2pnb163v1Explicit); } [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/64446", typeof(PlatformSupport), nameof(PlatformSupport.IsAndroidVersionAtLeast31))] public void ReadWriteC2pnb163v1ExplicitEncryptedPkcs8() { ReadWriteBase64EncryptedPkcs8( @" MIIBQTAbBgkqhkiG9w0BBQMwDgQI9+ZZnHaqxb0CAggABIIBIM+n6x/Q1hs5OW0F oOKZmQ0mKNRKb23SMqwo0bJlxseIOVdYzOV2LH1hSWeJb7FMxo6OJXb2CpYSPqv1 v3lhdLC5t/ViqAOhG70KF+Dy/vZr8rWXRFqy+OdqwxOes/lBsG+Ws9+uEk8+Gm2G xMHXJNKliSUePlT3wC7z8bCkEvLF7hkGjEAgcABry5Ohq3W2by6Dnd8YWJNgeiW/ Vu5rT1ThAus7w2TJjWrrEqBbIlQ9nm6/MMj9nYnVVfpPAOk/qX9Or7TmK+Sei88Q staXBhfJk9ec8laiPpNbhHJSZ2Ph3Snb6SA7MYi5nIMP4RPxOM2eUet4/ueV1O3U wxcZ+wOsnebIwy4ftKL+klh5EXv/9S5sCjC8g8J2cA6GmcZbiQ==", "secret", new PbeParameters( PbeEncryptionAlgorithm.Aes192Cbc, HashAlgorithmName.SHA512, 1024), EccTestData.C2pnb163v1Key1Explicit, SupportsC2pnb163v1Explicit); } [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/64446", typeof(PlatformSupport), nameof(PlatformSupport.IsAndroidVersionAtLeast31))] public void ReadWriteC2pnb163v1ExplicitSubjectPublicKeyInfo() { ReadWriteBase64SubjectPublicKeyInfo( @" MIH0MIHDBgcqhkjOPQIBMIG3AgEBMCUGByqGSM49AQIwGgICAKMGCSqGSM49AQID AzAJAgEBAgECAgEIMEQEFQclRrVDUjSkIuB4lnX0MsiUNd5SQgQUyVF9BtUkDTz/ OMdLILbNTW+d1NkDFQDSwPsVdghg3vHu9NaW5naHVhUXVAQrBAevaZiVRhA9eTKf zD10iA8zu+gDywHsIyEbWWat6h0/h/fqWEiu8LfKnwIVBAAAAAAAAAAAAAHmD8iC HMdNrq/BAgECAywABAIRJy8cVYJCaIjpG9aSV3SUIyJIqgQnCDD3oQCa1nCojekr 1ZJIzIE7RQ==", EccTestData.C2pnb163v1Key1Explicit, SupportsC2pnb163v1Explicit); } [Fact] public void NoFuzzySubjectPublicKeyInfo() { using (T key = CreateKey()) { int bytesRead = -1; byte[] ecPriv = key.ExportECPrivateKey(); Assert.ThrowsAny<CryptographicException>( () => key.ImportSubjectPublicKeyInfo(ecPriv, out bytesRead)); Assert.Equal(-1, bytesRead); byte[] pkcs8 = key.ExportPkcs8PrivateKey(); Assert.ThrowsAny<CryptographicException>( () => key.ImportSubjectPublicKeyInfo(pkcs8, out bytesRead)); Assert.Equal(-1, bytesRead); ReadOnlySpan<byte> passwordBytes = ecPriv.AsSpan(0, 15); byte[] encryptedPkcs8 = key.ExportEncryptedPkcs8PrivateKey( passwordBytes, new PbeParameters( PbeEncryptionAlgorithm.Aes256Cbc, HashAlgorithmName.SHA512, 123)); Assert.ThrowsAny<CryptographicException>( () => key.ImportSubjectPublicKeyInfo(encryptedPkcs8, out bytesRead)); Assert.Equal(-1, bytesRead); } } [Fact] public void NoFuzzyECPrivateKey() { using (T key = CreateKey()) { int bytesRead = -1; byte[] spki = key.ExportSubjectPublicKeyInfo(); Assert.ThrowsAny<CryptographicException>( () => key.ImportECPrivateKey(spki, out bytesRead)); Assert.Equal(-1, bytesRead); byte[] pkcs8 = key.ExportPkcs8PrivateKey(); Assert.ThrowsAny<CryptographicException>( () => key.ImportECPrivateKey(pkcs8, out bytesRead)); Assert.Equal(-1, bytesRead); ReadOnlySpan<byte> passwordBytes = spki.AsSpan(0, 15); byte[] encryptedPkcs8 = key.ExportEncryptedPkcs8PrivateKey( passwordBytes, new PbeParameters( PbeEncryptionAlgorithm.Aes256Cbc, HashAlgorithmName.SHA512, 123)); Assert.ThrowsAny<CryptographicException>( () => key.ImportECPrivateKey(encryptedPkcs8, out bytesRead)); Assert.Equal(-1, bytesRead); } } [Fact] public void NoFuzzyPkcs8() { using (T key = CreateKey()) { int bytesRead = -1; byte[] spki = key.ExportSubjectPublicKeyInfo(); Assert.ThrowsAny<CryptographicException>( () => key.ImportPkcs8PrivateKey(spki, out bytesRead)); Assert.Equal(-1, bytesRead); byte[] ecPriv = key.ExportECPrivateKey(); Assert.ThrowsAny<CryptographicException>( () => key.ImportPkcs8PrivateKey(ecPriv, out bytesRead)); Assert.Equal(-1, bytesRead); ReadOnlySpan<byte> passwordBytes = spki.AsSpan(0, 15); byte[] encryptedPkcs8 = key.ExportEncryptedPkcs8PrivateKey( passwordBytes, new PbeParameters( PbeEncryptionAlgorithm.Aes256Cbc, HashAlgorithmName.SHA512, 123)); Assert.ThrowsAny<CryptographicException>( () => key.ImportPkcs8PrivateKey(encryptedPkcs8, out bytesRead)); Assert.Equal(-1, bytesRead); } } [Fact] public void NoFuzzyEncryptedPkcs8() { using (T key = CreateKey()) { int bytesRead = -1; byte[] spki = key.ExportSubjectPublicKeyInfo(); byte[] empty = Array.Empty<byte>(); Assert.ThrowsAny<CryptographicException>( () => key.ImportEncryptedPkcs8PrivateKey(empty, spki, out bytesRead)); Assert.Equal(-1, bytesRead); byte[] ecPriv = key.ExportECPrivateKey(); Assert.ThrowsAny<CryptographicException>( () => key.ImportEncryptedPkcs8PrivateKey(empty, ecPriv, out bytesRead)); Assert.Equal(-1, bytesRead); byte[] pkcs8 = key.ExportPkcs8PrivateKey(); Assert.ThrowsAny<CryptographicException>( () => key.ImportEncryptedPkcs8PrivateKey(empty, pkcs8, out bytesRead)); Assert.Equal(-1, bytesRead); } } [Fact] public void NoPrivKeyFromPublicOnly() { using (T key = CreateKey()) { ECParameters parameters = EccTestData.GetNistP521Key2(); parameters.D = null; key.ImportParameters(parameters); Assert.ThrowsAny<CryptographicException>( () => key.ExportECPrivateKey()); Assert.ThrowsAny<CryptographicException>( () => key.TryExportECPrivateKey(Span<byte>.Empty, out _)); Assert.ThrowsAny<CryptographicException>( () => key.ExportPkcs8PrivateKey()); Assert.ThrowsAny<CryptographicException>( () => key.TryExportPkcs8PrivateKey(Span<byte>.Empty, out _)); Assert.ThrowsAny<CryptographicException>( () => key.ExportEncryptedPkcs8PrivateKey( ReadOnlySpan<byte>.Empty, new PbeParameters(PbeEncryptionAlgorithm.Aes192Cbc, HashAlgorithmName.SHA256, 72))); Assert.ThrowsAny<CryptographicException>( () => key.TryExportEncryptedPkcs8PrivateKey( ReadOnlySpan<byte>.Empty, new PbeParameters(PbeEncryptionAlgorithm.Aes192Cbc, HashAlgorithmName.SHA256, 72), Span<byte>.Empty, out _)); } } [Fact] public void BadPbeParameters() { using (T key = CreateKey()) { Assert.ThrowsAny<ArgumentNullException>( () => key.ExportEncryptedPkcs8PrivateKey( ReadOnlySpan<byte>.Empty, null)); Assert.ThrowsAny<ArgumentNullException>( () => key.ExportEncryptedPkcs8PrivateKey( ReadOnlySpan<char>.Empty, null)); Assert.ThrowsAny<ArgumentNullException>( () => key.TryExportEncryptedPkcs8PrivateKey( ReadOnlySpan<byte>.Empty, null, Span<byte>.Empty, out _)); Assert.ThrowsAny<ArgumentNullException>( () => key.TryExportEncryptedPkcs8PrivateKey( ReadOnlySpan<char>.Empty, null, Span<byte>.Empty, out _)); // PKCS12 requires SHA-1 Assert.ThrowsAny<CryptographicException>( () => key.ExportEncryptedPkcs8PrivateKey( ReadOnlySpan<byte>.Empty, new PbeParameters(PbeEncryptionAlgorithm.TripleDes3KeyPkcs12, HashAlgorithmName.SHA256, 72))); Assert.ThrowsAny<CryptographicException>( () => key.TryExportEncryptedPkcs8PrivateKey( ReadOnlySpan<byte>.Empty, new PbeParameters(PbeEncryptionAlgorithm.TripleDes3KeyPkcs12, HashAlgorithmName.SHA256, 72), Span<byte>.Empty, out _)); // PKCS12 requires SHA-1 Assert.ThrowsAny<CryptographicException>( () => key.ExportEncryptedPkcs8PrivateKey( ReadOnlySpan<byte>.Empty, new PbeParameters(PbeEncryptionAlgorithm.TripleDes3KeyPkcs12, HashAlgorithmName.MD5, 72))); Assert.ThrowsAny<CryptographicException>( () => key.TryExportEncryptedPkcs8PrivateKey( ReadOnlySpan<byte>.Empty, new PbeParameters(PbeEncryptionAlgorithm.TripleDes3KeyPkcs12, HashAlgorithmName.MD5, 72), Span<byte>.Empty, out _)); // PKCS12 requires a char-based password Assert.ThrowsAny<CryptographicException>( () => key.ExportEncryptedPkcs8PrivateKey( new byte[3], new PbeParameters(PbeEncryptionAlgorithm.TripleDes3KeyPkcs12, HashAlgorithmName.SHA1, 72))); Assert.ThrowsAny<CryptographicException>( () => key.TryExportEncryptedPkcs8PrivateKey( new byte[3], new PbeParameters(PbeEncryptionAlgorithm.TripleDes3KeyPkcs12, HashAlgorithmName.SHA1, 72), Span<byte>.Empty, out _)); // Unknown encryption algorithm Assert.ThrowsAny<CryptographicException>( () => key.ExportEncryptedPkcs8PrivateKey( new byte[3], new PbeParameters(0, HashAlgorithmName.SHA1, 72))); Assert.ThrowsAny<CryptographicException>( () => key.TryExportEncryptedPkcs8PrivateKey( new byte[3], new PbeParameters(0, HashAlgorithmName.SHA1, 72), Span<byte>.Empty, out _)); // Unknown encryption algorithm (negative enum value) Assert.ThrowsAny<CryptographicException>( () => key.ExportEncryptedPkcs8PrivateKey( new byte[3], new PbeParameters((PbeEncryptionAlgorithm)(-5), HashAlgorithmName.SHA1, 72))); Assert.ThrowsAny<CryptographicException>( () => key.TryExportEncryptedPkcs8PrivateKey( new byte[3], new PbeParameters((PbeEncryptionAlgorithm)(-5), HashAlgorithmName.SHA1, 72), Span<byte>.Empty, out _)); // Unknown encryption algorithm (overly-large enum value) Assert.ThrowsAny<CryptographicException>( () => key.ExportEncryptedPkcs8PrivateKey( new byte[3], new PbeParameters((PbeEncryptionAlgorithm)15, HashAlgorithmName.SHA1, 72))); Assert.ThrowsAny<CryptographicException>( () => key.TryExportEncryptedPkcs8PrivateKey( new byte[3], new PbeParameters((PbeEncryptionAlgorithm)15, HashAlgorithmName.SHA1, 72), Span<byte>.Empty, out _)); // Unknown hash algorithm Assert.ThrowsAny<CryptographicException>( () => key.ExportEncryptedPkcs8PrivateKey( new byte[3], new PbeParameters(PbeEncryptionAlgorithm.Aes192Cbc, new HashAlgorithmName("Potato"), 72))); Assert.ThrowsAny<CryptographicException>( () => key.TryExportEncryptedPkcs8PrivateKey( new byte[3], new PbeParameters(PbeEncryptionAlgorithm.Aes192Cbc, new HashAlgorithmName("Potato"), 72), Span<byte>.Empty, out _)); } } [Fact] public void DecryptPkcs12WithBytes() { using (T key = CreateKey()) { string charBased = "hello"; byte[] byteBased = Encoding.UTF8.GetBytes(charBased); byte[] encrypted = key.ExportEncryptedPkcs8PrivateKey( charBased, new PbeParameters( PbeEncryptionAlgorithm.TripleDes3KeyPkcs12, HashAlgorithmName.SHA1, 123)); Assert.ThrowsAny<CryptographicException>( () => key.ImportEncryptedPkcs8PrivateKey(byteBased, encrypted, out _)); } } [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/62547", TestPlatforms.Android)] public void DecryptPkcs12PbeTooManyIterations() { // pbeWithSHAAnd3-KeyTripleDES-CBC with 600,001 iterations byte[] high3DesIterationKey = Convert.FromBase64String(@" MIG6MCUGCiqGSIb3DQEMAQMwFwQQWOZyFrGwhyGTEd2nbKuLSQIDCSfBBIGQCgPLkx0OwmK3lJ9o VAdJAg/2nvOhboOHciu5I6oh5dRkxeDjUJixsadd3uhiZb5v7UgiohBQsFv+PWU12rmz6sgWR9rK V2UqV6Y5vrHJDlNJGI+CQKzOTF7LXyOT+EqaXHD+25TM2/kcZjZrOdigkgQBAFhbfn2/hV/t0TPe Tj/54rcY3i0gXT6da/r/o+qV"); using (T key = CreateKey()) { Assert.ThrowsAny<CryptographicException>( () => key.ImportEncryptedPkcs8PrivateKey("test", high3DesIterationKey, out _)); } } [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/62547", TestPlatforms.Android)] public void ReadWriteEc256EncryptedPkcs8_Pbes2HighIterations() { // pkcs5PBES2 hmacWithSHA256 aes128-CBC with 600,001 iterations ReadWriteBase64EncryptedPkcs8(@" MIH1MGAGCSqGSIb3DQEFDTBTMDIGCSqGSIb3DQEFDDAlBBA+rne0bUkwr614vLfQkwO4AgMJJ8Ew DAYIKoZIhvcNAgkFADAdBglghkgBZQMEAQIEEIm3c9r5igQ9Vlv1mKTZYp0EgZC8KZfmJtfYmsl4 Z0Dc85ugFvtFHVeRbcvfYmFns23WL3gpGQ0mj4BKxttX+WuDk9duAsCslNLvXFY7m3MQRkWA6QHT A8DiR3j0l5TGBkErbTUrjmB3ftvEmmF9mleRLj6qEYmmKdCV2Tfk1YBOZ2mpB9bpCPipUansyqWs xoMaz20Yx+2TSN5dSm2FcD+0YFI=", "test", new PbeParameters( PbeEncryptionAlgorithm.Aes128Cbc, HashAlgorithmName.SHA256, 600_001), EccTestData.GetNistP256ReferenceKey()); } private void ReadWriteBase64EncryptedPkcs8( string base64EncryptedPkcs8, string password, PbeParameters pbe, in ECParameters expected, bool isSupported=true) { if (isSupported) { ReadWriteKey( base64EncryptedPkcs8, expected, (T key, ReadOnlySpan<byte> source, out int read) => key.ImportEncryptedPkcs8PrivateKey(password, source, out read), key => key.ExportEncryptedPkcs8PrivateKey(password, pbe), (T key, Span<byte> destination, out int bytesWritten) => key.TryExportEncryptedPkcs8PrivateKey(password, pbe, destination, out bytesWritten), isEncrypted: true); } else { byte[] encrypted = Convert.FromBase64String(base64EncryptedPkcs8); using (T key = CreateKey()) { // Wrong password Assert.ThrowsAny<CryptographicException>( () => key.ImportEncryptedPkcs8PrivateKey(encrypted.AsSpan(1, 14), encrypted, out _)); Assert.ThrowsAny<CryptographicException>( () => key.ImportEncryptedPkcs8PrivateKey(password + password, encrypted, out _)); int bytesRead = -1; Exception e = Assert.ThrowsAny<Exception>( () => key.ImportEncryptedPkcs8PrivateKey(password, encrypted, out bytesRead)); Assert.True( e is PlatformNotSupportedException || e is CryptographicException, "e is PlatformNotSupportedException || e is CryptographicException"); Assert.Equal(-1, bytesRead); } } } private void ReadWriteBase64EncryptedPkcs8( string base64EncryptedPkcs8, byte[] passwordBytes, PbeParameters pbe, in ECParameters expected, bool isSupported=true) { if (isSupported) { ReadWriteKey( base64EncryptedPkcs8, expected, (T key, ReadOnlySpan<byte> source, out int read) => key.ImportEncryptedPkcs8PrivateKey(passwordBytes, source, out read), key => key.ExportEncryptedPkcs8PrivateKey(passwordBytes, pbe), (T key, Span<byte> destination, out int bytesWritten) => key.TryExportEncryptedPkcs8PrivateKey(passwordBytes, pbe, destination, out bytesWritten), isEncrypted: true); } else { byte[] encrypted = Convert.FromBase64String(base64EncryptedPkcs8); byte[] wrongPassword = new byte[passwordBytes.Length + 2]; RandomNumberGenerator.Fill(wrongPassword); using (T key = CreateKey()) { // Wrong password Assert.ThrowsAny<CryptographicException>( () => key.ImportEncryptedPkcs8PrivateKey(wrongPassword, encrypted, out _)); Assert.ThrowsAny<CryptographicException>( () => key.ImportEncryptedPkcs8PrivateKey("ThisBetterNotBeThePassword!", encrypted, out _)); int bytesRead = -1; Exception e = Assert.ThrowsAny<Exception>( () => key.ImportEncryptedPkcs8PrivateKey(passwordBytes, encrypted, out bytesRead)); Assert.True( e is PlatformNotSupportedException || e is CryptographicException, "e is PlatformNotSupportedException || e is CryptographicException"); Assert.Equal(-1, bytesRead); } } } private void ReadWriteBase64ECPrivateKey(string base64Pkcs8, in ECParameters expected, bool isSupported=true) { if (isSupported) { ReadWriteKey( base64Pkcs8, expected, (T key, ReadOnlySpan<byte> source, out int read) => key.ImportECPrivateKey(source, out read), key => key.ExportECPrivateKey(), (T key, Span<byte> destination, out int bytesWritten) => key.TryExportECPrivateKey(destination, out bytesWritten)); } else { using (T key = CreateKey()) { Exception e = Assert.ThrowsAny<Exception>( () => key.ImportECPrivateKey(Convert.FromBase64String(base64Pkcs8), out _)); Assert.True( e is PlatformNotSupportedException || e is CryptographicException, $"e should be PlatformNotSupportedException or CryptographicException.\n\te is {e.ToString()}"); } } } private void ReadWriteBase64Pkcs8(string base64Pkcs8, in ECParameters expected, bool isSupported=true) { if (isSupported) { ReadWriteKey( base64Pkcs8, expected, (T key, ReadOnlySpan<byte> source, out int read) => key.ImportPkcs8PrivateKey(source, out read), key => key.ExportPkcs8PrivateKey(), (T key, Span<byte> destination, out int bytesWritten) => key.TryExportPkcs8PrivateKey(destination, out bytesWritten)); } else { using (T key = CreateKey()) { Exception e = Assert.ThrowsAny<Exception>( () => key.ImportPkcs8PrivateKey(Convert.FromBase64String(base64Pkcs8), out _)); Assert.True( e is PlatformNotSupportedException || e is CryptographicException, "e is PlatformNotSupportedException || e is CryptographicException"); } } } private void ReadWriteBase64SubjectPublicKeyInfo( string base64SubjectPublicKeyInfo, in ECParameters expected, bool isSupported = true) { if (isSupported) { ECParameters expectedPublic = expected; expectedPublic.D = null; ReadWriteKey( base64SubjectPublicKeyInfo, expectedPublic, (T key, ReadOnlySpan<byte> source, out int read) => key.ImportSubjectPublicKeyInfo(source, out read), key => key.ExportSubjectPublicKeyInfo(), (T key, Span<byte> destination, out int written) => key.TryExportSubjectPublicKeyInfo(destination, out written), writePublicArrayFunc: PublicKeyWriteArrayFunc, writePublicSpanFunc: PublicKeyWriteSpanFunc); } else { using (T key = CreateKey()) { Exception e = Assert.ThrowsAny<Exception>( () => key.ImportSubjectPublicKeyInfo(Convert.FromBase64String(base64SubjectPublicKeyInfo), out _)); Assert.True( e is PlatformNotSupportedException || e is CryptographicException, "e is PlatformNotSupportedException || e is CryptographicException"); } } } private void ReadWriteKey( string base64, in ECParameters expected, ReadKeyAction readAction, Func<T, byte[]> writeArrayFunc, WriteKeyToSpanFunc writeSpanFunc, bool isEncrypted = false, Func<T, byte[]> writePublicArrayFunc = null, WriteKeyToSpanFunc writePublicSpanFunc = null) { bool isPrivateKey = expected.D != null; byte[] derBytes = Convert.FromBase64String(base64); byte[] arrayExport; byte[] tooBig; const int OverAllocate = 30; const int WriteShift = 6; using (T key = CreateKey()) { readAction(key, derBytes, out int bytesRead); Assert.Equal(derBytes.Length, bytesRead); arrayExport = writeArrayFunc(key); if (writePublicArrayFunc is not null) { byte[] publicArrayExport = writePublicArrayFunc(key); Assert.Equal(arrayExport, publicArrayExport); Assert.True(writePublicSpanFunc(key, publicArrayExport, out int publicExportWritten)); Assert.Equal(publicExportWritten, publicArrayExport.Length); Assert.Equal(arrayExport, publicArrayExport); } ECParameters ecParameters = key.ExportParameters(isPrivateKey); EccTestBase.AssertEqual(expected, ecParameters); } // It's not reasonable to assume that arrayExport and derBytes have the same // contents, because the SubjectPublicKeyInfo and PrivateKeyInfo formats both // have the curve identifier in the AlgorithmIdentifier.Parameters field, and // either the input or the output may have chosen to then not emit it in the // optional domainParameters field of the ECPrivateKey blob. // // Once we have exported the data to normalize it, though, we should see // consistency in the answer format. using (T key = CreateKey()) { Assert.ThrowsAny<CryptographicException>( () => readAction(key, arrayExport.AsSpan(1), out _)); Assert.ThrowsAny<CryptographicException>( () => readAction(key, arrayExport.AsSpan(0, arrayExport.Length - 1), out _)); readAction(key, arrayExport, out int bytesRead); Assert.Equal(arrayExport.Length, bytesRead); ECParameters ecParameters = key.ExportParameters(isPrivateKey); EccTestBase.AssertEqual(expected, ecParameters); Assert.False( writeSpanFunc(key, Span<byte>.Empty, out int bytesWritten), "Write to empty span"); Assert.Equal(0, bytesWritten); Assert.False( writeSpanFunc( key, derBytes.AsSpan(0, Math.Min(derBytes.Length, arrayExport.Length) - 1), out bytesWritten), "Write to too-small span"); Assert.Equal(0, bytesWritten); tooBig = new byte[arrayExport.Length + OverAllocate]; tooBig.AsSpan().Fill(0xC4); Assert.True(writeSpanFunc(key, tooBig.AsSpan(WriteShift), out bytesWritten)); Assert.Equal(arrayExport.Length, bytesWritten); Assert.Equal(0xC4, tooBig[WriteShift - 1]); Assert.Equal(0xC4, tooBig[WriteShift + bytesWritten + 1]); // If encrypted, the data should have had a random salt applied, so unstable. // Otherwise, we've normalized the data (even for private keys) so the output // should match what it output previously. if (isEncrypted) { Assert.NotEqual( arrayExport.ByteArrayToHex(), tooBig.AsSpan(WriteShift, bytesWritten).ByteArrayToHex()); } else { Assert.Equal( arrayExport.ByteArrayToHex(), tooBig.AsSpan(WriteShift, bytesWritten).ByteArrayToHex()); } } using (T key = CreateKey()) { readAction(key, tooBig.AsSpan(WriteShift), out int bytesRead); Assert.Equal(arrayExport.Length, bytesRead); arrayExport.AsSpan().Fill(0xCA); Assert.True( writeSpanFunc(key, arrayExport, out int bytesWritten), "Write to precisely allocated Span"); if (isEncrypted) { Assert.NotEqual( tooBig.AsSpan(WriteShift, bytesWritten).ByteArrayToHex(), arrayExport.ByteArrayToHex()); } else { Assert.Equal( tooBig.AsSpan(WriteShift, bytesWritten).ByteArrayToHex(), arrayExport.ByteArrayToHex()); } } } protected delegate void ReadKeyAction(T key, ReadOnlySpan<byte> source, out int bytesRead); protected delegate bool WriteKeyToSpanFunc(T key, Span<byte> destination, out int bytesWritten); } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Security.Cryptography.Encryption.RC2.Tests; using System.Text; using Test.Cryptography; using Xunit; namespace System.Security.Cryptography.Tests { [SkipOnPlatform(TestPlatforms.Browser, "Not supported on Browser")] public abstract partial class ECKeyFileTests<T> where T : ECAlgorithm { protected abstract T CreateKey(); protected abstract void Exercise(T key); protected virtual Func<T, byte[]> PublicKeyWriteArrayFunc { get; } = null; protected virtual WriteKeyToSpanFunc PublicKeyWriteSpanFunc { get; } = null; // This would need to be virtualized if there was ever a platform that // allowed explicit in ECDH or ECDSA but not the other. public static bool SupportsExplicitCurves { get; } = EcDiffieHellman.Tests.ECDiffieHellmanFactory.ExplicitCurvesSupported; public static bool CanDeriveNewPublicKey { get; } = EcDiffieHellman.Tests.ECDiffieHellmanFactory.CanDeriveNewPublicKey; public static bool SupportsBrainpool { get; } = IsCurveSupported(ECCurve.NamedCurves.brainpoolP160r1.Oid); public static bool SupportsSect163k1 { get; } = IsCurveSupported(EccTestData.Sect163k1Key1.Curve.Oid); public static bool SupportsSect283k1 { get; } = IsCurveSupported(EccTestData.Sect283k1Key1.Curve.Oid); public static bool SupportsC2pnb163v1 { get; } = IsCurveSupported(EccTestData.C2pnb163v1Key1.Curve.Oid); // Some platforms support explicitly specifying these curves, but do not support specifying them by name. public static bool ExplicitNamedSameSupport { get; } = !PlatformDetection.IsAndroid; public static bool SupportsSect163k1Explicit { get; } = SupportsSect163k1 || (!ExplicitNamedSameSupport && SupportsExplicitCurves); public static bool SupportsC2pnb163v1Explicit { get; } = SupportsC2pnb163v1 || (!ExplicitNamedSameSupport && SupportsExplicitCurves); private static bool IsCurveSupported(Oid oid) { return EcDiffieHellman.Tests.ECDiffieHellmanFactory.IsCurveValid(oid); } [Theory] [InlineData(false)] [InlineData(true)] public void UseAfterDispose(bool importKey) { T key = CreateKey(); if (importKey) { key.ImportParameters(EccTestData.GetNistP256ReferenceKey()); } byte[] ecPrivate; byte[] pkcs8Private; byte[] pkcs8EncryptedPrivate; byte[] subjectPublicKeyInfo; string pwStr = "Hello"; // Because the PBE algorithm uses PBES2 the string->byte encoding is UTF-8. byte[] pwBytes = Encoding.UTF8.GetBytes(pwStr); PbeParameters pbeParameters = new PbeParameters( PbeEncryptionAlgorithm.Aes192Cbc, HashAlgorithmName.SHA256, 3072); // Ensure the key was loaded, then dispose it. // Also ensures all of the inputs are valid for the disposed tests. using (key) { ecPrivate = key.ExportECPrivateKey(); pkcs8Private = key.ExportPkcs8PrivateKey(); pkcs8EncryptedPrivate = key.ExportEncryptedPkcs8PrivateKey(pwStr, pbeParameters); subjectPublicKeyInfo = key.ExportSubjectPublicKeyInfo(); } Assert.Throws<ObjectDisposedException>(() => key.ImportECPrivateKey(ecPrivate, out _)); Assert.Throws<ObjectDisposedException>(() => key.ImportPkcs8PrivateKey(pkcs8Private, out _)); Assert.Throws<ObjectDisposedException>(() => key.ImportEncryptedPkcs8PrivateKey(pwStr, pkcs8EncryptedPrivate, out _)); Assert.Throws<ObjectDisposedException>(() => key.ImportEncryptedPkcs8PrivateKey(pwBytes, pkcs8EncryptedPrivate, out _)); Assert.Throws<ObjectDisposedException>(() => key.ImportSubjectPublicKeyInfo(subjectPublicKeyInfo, out _)); Assert.Throws<ObjectDisposedException>(() => key.ExportECPrivateKey()); Assert.Throws<ObjectDisposedException>(() => key.TryExportECPrivateKey(ecPrivate, out _)); Assert.Throws<ObjectDisposedException>(() => key.ExportPkcs8PrivateKey()); Assert.Throws<ObjectDisposedException>(() => key.TryExportPkcs8PrivateKey(pkcs8Private, out _)); Assert.Throws<ObjectDisposedException>(() => key.ExportEncryptedPkcs8PrivateKey(pwStr, pbeParameters)); Assert.Throws<ObjectDisposedException>(() => key.TryExportEncryptedPkcs8PrivateKey(pwStr, pbeParameters, pkcs8EncryptedPrivate, out _)); Assert.Throws<ObjectDisposedException>(() => key.ExportEncryptedPkcs8PrivateKey(pwBytes, pbeParameters)); Assert.Throws<ObjectDisposedException>(() => key.TryExportEncryptedPkcs8PrivateKey(pwBytes, pbeParameters, pkcs8EncryptedPrivate, out _)); Assert.Throws<ObjectDisposedException>(() => key.ExportSubjectPublicKeyInfo()); Assert.Throws<ObjectDisposedException>(() => key.TryExportSubjectPublicKeyInfo(subjectPublicKeyInfo, out _)); // Check encrypted import with the wrong password. // It shouldn't do enough work to realize it was wrong. pwBytes = Array.Empty<byte>(); Assert.Throws<ObjectDisposedException>(() => key.ImportEncryptedPkcs8PrivateKey("", pkcs8EncryptedPrivate, out _)); Assert.Throws<ObjectDisposedException>(() => key.ImportEncryptedPkcs8PrivateKey(pwBytes, pkcs8EncryptedPrivate, out _)); } [Fact] public void ReadWriteNistP521Pkcs8() { const string base64 = @" MIHuAgEAMBAGByqGSM49AgEGBSuBBAAjBIHWMIHTAgEBBEIBpV+HhaVzC67h1rPT AQaff9ZNiwTM6lfv1ZYeaPM/q0NUUWbKZVPNOP9xPRKJxpi9fQhrVeAbW9XtJ+Nj A3axFmahgYkDgYYABAB1HyYyTHPO9dReuzKTfjBg41GWCldZStA+scoMXqdHEhM2 a6mR0kQGcX+G/e/eCG4JuVSlfcD16UWXVtYMKq5t4AGo3bs/AsjCNSRyn1SLfiMy UjPvZ90wdSuSTyl0WePC4Sro2PT+RFTjhHwYslXKzvWXN7kY4d5A+V6f/k9Xt5FT oA=="; ReadWriteBase64Pkcs8(base64, EccTestData.GetNistP521Key2()); } [Fact] public void ReadWriteNistP521Pkcs8_ECDH() { const string base64 = @" MIHsAgEAMA4GBSuBBAEMBgUrgQQAIwSB1jCB0wIBAQRCAaVfh4Wlcwuu4daz0wEG n3/WTYsEzOpX79WWHmjzP6tDVFFmymVTzTj/cT0SicaYvX0Ia1XgG1vV7SfjYwN2 sRZmoYGJA4GGAAQAdR8mMkxzzvXUXrsyk34wYONRlgpXWUrQPrHKDF6nRxITNmup kdJEBnF/hv3v3ghuCblUpX3A9elFl1bWDCqubeABqN27PwLIwjUkcp9Ui34jMlIz 72fdMHUrkk8pdFnjwuEq6Nj0/kRU44R8GLJVys71lze5GOHeQPlen/5PV7eRU6A="; ReadWriteBase64Pkcs8( base64, EccTestData.GetNistP521Key2(), isSupported: false); } [Fact] public void ReadWriteNistP521SubjectPublicKeyInfo() { const string base64 = @" MIGbMBAGByqGSM49AgEGBSuBBAAjA4GGAAQAdR8mMkxzzvXUXrsyk34wYONRlgpX WUrQPrHKDF6nRxITNmupkdJEBnF/hv3v3ghuCblUpX3A9elFl1bWDCqubeABqN27 PwLIwjUkcp9Ui34jMlIz72fdMHUrkk8pdFnjwuEq6Nj0/kRU44R8GLJVys71lze5 GOHeQPlen/5PV7eRU6A="; ReadWriteBase64SubjectPublicKeyInfo(base64, EccTestData.GetNistP521Key2()); } [Fact] public void ReadWriteNistP521SubjectPublicKeyInfo_ECDH() { const string base64 = @" MIGZMA4GBSuBBAEMBgUrgQQAIwOBhgAEAHUfJjJMc8711F67MpN+MGDjUZYKV1lK 0D6xygxep0cSEzZrqZHSRAZxf4b9794Ibgm5VKV9wPXpRZdW1gwqrm3gAajduz8C yMI1JHKfVIt+IzJSM+9n3TB1K5JPKXRZ48LhKujY9P5EVOOEfBiyVcrO9Zc3uRjh 3kD5Xp/+T1e3kVOg"; ReadWriteBase64SubjectPublicKeyInfo( base64, EccTestData.GetNistP521Key2(), isSupported: false); } [Fact] public void ReadNistP521EncryptedPkcs8_Pbes2_Aes128_Sha384() { // PBES2, PBKDF2 (SHA384), AES128 const string base64 = @" MIIBXTBXBgkqhkiG9w0BBQ0wSjApBgkqhkiG9w0BBQwwHAQI/JyXWyp/t3kCAggA MAwGCCqGSIb3DQIKBQAwHQYJYIZIAWUDBAECBBA3H8mbFK5afB5GzIemCCQkBIIB AKAz1z09ATUA8UfoDMwTyXiHUS8Mb/zkUCH+I7rav4orhAnSyYAyLKcHeGne+kUa 8ewQ5S7oMMLXE0HHQ8CpORlSgxTssqTAHigXEqdRb8nQ8hJJa2dFtNXyUeFtxZ7p x+aSLD6Y3J+mgzeVp1ICgROtuRjA9RYjUdd/3cy2BAlW+Atfs/300Jhkke3H0Gqc F71o65UNB+verEgN49rQK7FAFtoVI2oRjHLO1cGjxZkbWe2KLtgJWsgmexRq3/a+ Pfuapj3LAHALZtDNMZ+QCFN2ZXUSFNWiBSwnwCAtfFCn/EchPo3MFR3K0q/qXTua qtlbnispri1a/EghiaPQ0po="; ReadWriteBase64EncryptedPkcs8( base64, "qwerty", new PbeParameters( PbeEncryptionAlgorithm.TripleDes3KeyPkcs12, HashAlgorithmName.SHA1, 12321), EccTestData.GetNistP521Key2()); } [Fact] public void ReadNistP521EncryptedPkcs8_Pbes2_Aes128_Sha384_PasswordBytes() { // PBES2, PBKDF2 (SHA384), AES128 // [SuppressMessage("Microsoft.Security", "CS002:SecretInNextLine", Justification="Suppression approved. Unit test key.")] const string base64 = @" MIIBXTBXBgkqhkiG9w0BBQ0wSjApBgkqhkiG9w0BBQwwHAQI/JyXWyp/t3kCAggA MAwGCCqGSIb3DQIKBQAwHQYJYIZIAWUDBAECBBA3H8mbFK5afB5GzIemCCQkBIIB AKAz1z09ATUA8UfoDMwTyXiHUS8Mb/zkUCH+I7rav4orhAnSyYAyLKcHeGne+kUa 8ewQ5S7oMMLXE0HHQ8CpORlSgxTssqTAHigXEqdRb8nQ8hJJa2dFtNXyUeFtxZ7p x+aSLD6Y3J+mgzeVp1ICgROtuRjA9RYjUdd/3cy2BAlW+Atfs/300Jhkke3H0Gqc F71o65UNB+verEgN49rQK7FAFtoVI2oRjHLO1cGjxZkbWe2KLtgJWsgmexRq3/a+ Pfuapj3LAHALZtDNMZ+QCFN2ZXUSFNWiBSwnwCAtfFCn/EchPo3MFR3K0q/qXTua qtlbnispri1a/EghiaPQ0po="; ReadWriteBase64EncryptedPkcs8( base64, Encoding.UTF8.GetBytes("qwerty"), new PbeParameters( PbeEncryptionAlgorithm.Aes256Cbc, HashAlgorithmName.SHA1, 12321), EccTestData.GetNistP521Key2()); } [ConditionalFact(typeof(RC2Factory), nameof(RC2Factory.IsSupported))] public void ReadNistP256EncryptedPkcs8_Pbes1_RC2_MD5() { const string base64 = @" MIGwMBsGCSqGSIb3DQEFBjAOBAiVk8SDhLdiNwICCAAEgZB2rI9tf7jjGdEwJNrS 8F/xNIo/0OSUSkQyg5n/ovRK1IodzPpWqipqM8TGfZk4sxn7h7RBmX2FlMkTLO4i mVannH3jd9cmCAz0aewDO0/LgmvDnzWiJ/CoDamzwC8bzDocq1Y/PsVYsYzSrJ7n m8STNpW+zSpHWlpHpWHgXGq4wrUKJifxOv6Rm5KTYcvUT38="; ReadWriteBase64EncryptedPkcs8( base64, "secp256r1", new PbeParameters( PbeEncryptionAlgorithm.TripleDes3KeyPkcs12, HashAlgorithmName.SHA1, 1024), EccTestData.GetNistP256ReferenceKey()); } [Fact] public void ReadWriteNistP256ECPrivateKey() { const string base64 = @" MHcCAQEEIHChLC2xaEXtVv9oz8IaRys/BNfWhRv2NJ8tfVs0UrOKoAoGCCqGSM49 AwEHoUQDQgAEgQHs5HRkpurXDPaabivT2IaRoyYtIsuk92Ner/JmgKjYoSumHVmS NfZ9nLTVjxeD08pD548KWrqmJAeZNsDDqQ=="; ReadWriteBase64ECPrivateKey( base64, EccTestData.GetNistP256ReferenceKey()); } [Fact] public void ReadWriteNistP256ExplicitECPrivateKey() { ReadWriteBase64ECPrivateKey( @" MIIBaAIBAQQgcKEsLbFoRe1W/2jPwhpHKz8E19aFG/Y0ny19WzRSs4qggfowgfcC AQEwLAYHKoZIzj0BAQIhAP////8AAAABAAAAAAAAAAAAAAAA//////////////// MFsEIP////8AAAABAAAAAAAAAAAAAAAA///////////////8BCBaxjXYqjqT57Pr vVV2mIa8ZR0GsMxTsPY7zjw+J9JgSwMVAMSdNgiG5wSTamZ44ROdJreBn36QBEEE axfR8uEsQkf4vOblY6RA8ncDfYEt6zOg9KE5RdiYwpZP40Li/hp/m47n60p8D54W K84zV2sxXs7LtkBoN79R9QIhAP////8AAAAA//////////+85vqtpxeehPO5ysL8 YyVRAgEBoUQDQgAEgQHs5HRkpurXDPaabivT2IaRoyYtIsuk92Ner/JmgKjYoSum HVmSNfZ9nLTVjxeD08pD548KWrqmJAeZNsDDqQ==", EccTestData.GetNistP256ReferenceKeyExplicit(), SupportsExplicitCurves); } [Fact] public void ReadWriteNistP256ExplicitPkcs8() { ReadWriteBase64Pkcs8( @" MIIBeQIBADCCAQMGByqGSM49AgEwgfcCAQEwLAYHKoZIzj0BAQIhAP////8AAAAB AAAAAAAAAAAAAAAA////////////////MFsEIP////8AAAABAAAAAAAAAAAAAAAA ///////////////8BCBaxjXYqjqT57PrvVV2mIa8ZR0GsMxTsPY7zjw+J9JgSwMV AMSdNgiG5wSTamZ44ROdJreBn36QBEEEaxfR8uEsQkf4vOblY6RA8ncDfYEt6zOg 9KE5RdiYwpZP40Li/hp/m47n60p8D54WK84zV2sxXs7LtkBoN79R9QIhAP////8A AAAA//////////+85vqtpxeehPO5ysL8YyVRAgEBBG0wawIBAQQgcKEsLbFoRe1W /2jPwhpHKz8E19aFG/Y0ny19WzRSs4qhRANCAASBAezkdGSm6tcM9ppuK9PYhpGj Ji0iy6T3Y16v8maAqNihK6YdWZI19n2ctNWPF4PTykPnjwpauqYkB5k2wMOp", EccTestData.GetNistP256ReferenceKeyExplicit(), SupportsExplicitCurves); } [Fact] public void ReadWriteNistP256ExplicitEncryptedPkcs8() { ReadWriteBase64EncryptedPkcs8( @" MIIBoTAbBgkqhkiG9w0BBQMwDgQIQqYZ3N87K0ICAggABIIBgOHAWa6wz144p0uT qZsQAbQcIpAFBQRC382dxiOHCV11OyZg264SmxS9iY1OEwIr/peACLu+Fk7zPKhv Ox1hYz/OeLoKKdtBMqrp65JmH73jG8qeAMuYNj83AIERY7Cckuc2fEC2GTEJcNWs olE+0p4H6yIvXI48NEQazj5w9zfOGvLmP6Kw6nX+SV3fzM9jHskU226LnDdokGVg an6/hV1r+2+n2MujhfNzQd/5vW5zx7PN/1aMVMz3wUv9t8scDppeMR5CNCMkxlRA cQ2lfx2vqFuY70EckgumDqm7AtKK2bLlA6XGTb8HuqKHA0l1zrul9AOBC1g33isD 5CJu1CCT34adV4E4G44uiRQUtf+K8m5Oeo8FI/gGBxdQyOh1k8TNsM+p32gTU8HH 89M5R+s1ayQI7jVPGHXm8Ch7lxvqo6FZAu6+vh23vTwVShUTpGYd0XguE6XKJjGx eWDIWFuFRj58uAQ65/viFausHWt1BdywcwcyVRb2eLI5MR7DWA==", "explicit", new PbeParameters( PbeEncryptionAlgorithm.Aes128Cbc, HashAlgorithmName.SHA256, 1234), EccTestData.GetNistP256ReferenceKeyExplicit(), SupportsExplicitCurves); } [Fact] public void ReadWriteNistP256ExplicitSubjectPublicKeyInfo() { ReadWriteBase64SubjectPublicKeyInfo( @" MIIBSzCCAQMGByqGSM49AgEwgfcCAQEwLAYHKoZIzj0BAQIhAP////8AAAABAAAA AAAAAAAAAAAA////////////////MFsEIP////8AAAABAAAAAAAAAAAAAAAA//// ///////////8BCBaxjXYqjqT57PrvVV2mIa8ZR0GsMxTsPY7zjw+J9JgSwMVAMSd NgiG5wSTamZ44ROdJreBn36QBEEEaxfR8uEsQkf4vOblY6RA8ncDfYEt6zOg9KE5 RdiYwpZP40Li/hp/m47n60p8D54WK84zV2sxXs7LtkBoN79R9QIhAP////8AAAAA //////////+85vqtpxeehPO5ysL8YyVRAgEBA0IABIEB7OR0ZKbq1wz2mm4r09iG kaMmLSLLpPdjXq/yZoCo2KErph1ZkjX2fZy01Y8Xg9PKQ+ePClq6piQHmTbAw6k=", EccTestData.GetNistP256ReferenceKeyExplicit(), SupportsExplicitCurves); } [Fact] public void ReadWriteBrainpoolKey1ECPrivateKey() { ReadWriteBase64ECPrivateKey( @" MFQCAQEEFMXZRFR94RXbJYjcb966O0c+nE2WoAsGCSskAwMCCAEBAaEsAyoABI5i jwk5x2KSdsrb/pnAHDZQk1TictLI7vH2zDIF0AV+ud5sqeMQUJY=", EccTestData.BrainpoolP160r1Key1, SupportsBrainpool); } [Fact] public void ReadWriteBrainpoolKey1Pkcs8() { ReadWriteBase64Pkcs8( @" MGQCAQAwFAYHKoZIzj0CAQYJKyQDAwIIAQEBBEkwRwIBAQQUxdlEVH3hFdsliNxv 3ro7Rz6cTZahLAMqAASOYo8JOcdiknbK2/6ZwBw2UJNU4nLSyO7x9swyBdAFfrne bKnjEFCW", EccTestData.BrainpoolP160r1Key1, SupportsBrainpool); } [Fact] public void ReadWriteBrainpoolKey1EncryptedPkcs8() { ReadWriteBase64EncryptedPkcs8( @" MIGHMBsGCSqGSIb3DQEFAzAOBAhSgCZvbsatLQICCAAEaKGDyoSVej1yNPCn7K6q ooI857+joe6NZjR+w1xuH4JfrQZGvelWZ2AWtQezuz4UzPLnL3Nyf6jjPPuKarpk HiDaMtpw7yT5+32Vkxv5C2jvqNPpicmEFpf2wJ8yVLQtMOKAF2sOwxN/", "12345", new PbeParameters( PbeEncryptionAlgorithm.Aes192Cbc, HashAlgorithmName.SHA384, 4096), EccTestData.BrainpoolP160r1Key1, SupportsBrainpool); } [Fact] public void ReadWriteBrainpoolKey1SubjectPublicKeyInfo() { ReadWriteBase64SubjectPublicKeyInfo( @" MEIwFAYHKoZIzj0CAQYJKyQDAwIIAQEBAyoABI5ijwk5x2KSdsrb/pnAHDZQk1Ti ctLI7vH2zDIF0AV+ud5sqeMQUJY=", EccTestData.BrainpoolP160r1Key1, SupportsBrainpool); } [Fact] public void ReadWriteSect163k1Key1ECPrivateKey() { ReadWriteBase64ECPrivateKey( @" MFMCAQEEFQPBmVrfrowFGNwT3+YwS7AQF+akEqAHBgUrgQQAAaEuAywABAYXnjcZ zIElQ1/mRYnV/KbcGIdVHQeI/rti/8kkjYs5iv4+C1w8ArP+Nw==", EccTestData.Sect163k1Key1, SupportsSect163k1); } [Fact] public void ReadWriteSect163k1Key1Pkcs8() { ReadWriteBase64Pkcs8( @" MGMCAQAwEAYHKoZIzj0CAQYFK4EEAAEETDBKAgEBBBUDwZla366MBRjcE9/mMEuw EBfmpBKhLgMsAAQGF543GcyBJUNf5kWJ1fym3BiHVR0HiP67Yv/JJI2LOYr+Pgtc PAKz/jc=", EccTestData.Sect163k1Key1, SupportsSect163k1); } [Fact] public void ReadWriteSect163k1Key1EncryptedPkcs8() { ReadWriteBase64EncryptedPkcs8( @" MIGHMBsGCSqGSIb3DQEFAzAOBAjLBuCZyPt15QICCAAEaPa9V9VJoB8G+RIgZaYv z4xl+rpvkDrDI0Xnh8oj1CLQldy2N77pdk3pOg9TwJo+r+eKfIJgBVezW2O615ww f+ESRyxDnBgKz6H2RKeenyrwVhxF98SyJzAdP637vR3QmDNAWWAgoUhg", "Koblitz", new PbeParameters( PbeEncryptionAlgorithm.Aes256Cbc, HashAlgorithmName.SHA256, 7), EccTestData.Sect163k1Key1, SupportsSect163k1); } [Fact] public void ReadWriteSect163k1Key1SubjectPublicKeyInfo() { ReadWriteBase64SubjectPublicKeyInfo( @" MEAwEAYHKoZIzj0CAQYFK4EEAAEDLAAEBheeNxnMgSVDX+ZFidX8ptwYh1UdB4j+ u2L/ySSNizmK/j4LXDwCs/43", EccTestData.Sect163k1Key1, SupportsSect163k1); } [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/64446", typeof(PlatformSupport), nameof(PlatformSupport.IsAndroidVersionAtLeast31))] public void ReadWriteSect163k1Key1ExplicitECPrivateKey() { ReadWriteBase64ECPrivateKey( @" MIHHAgEBBBUDwZla366MBRjcE9/mMEuwEBfmpBKgezB5AgEBMCUGByqGSM49AQIw GgICAKMGCSqGSM49AQIDAzAJAgEDAgEGAgEHMAYEAQEEAQEEKwQC/hPAU3u8Eayq B9eT3k5tXlyU7ugCiQcPsF04/1gyHy6ABTbVOMzao9kCFQQAAAAAAAAAAAACAQii 4MwNmfil7wIBAqEuAywABAYXnjcZzIElQ1/mRYnV/KbcGIdVHQeI/rti/8kkjYs5 iv4+C1w8ArP+Nw==", EccTestData.Sect163k1Key1Explicit, SupportsSect163k1Explicit); } [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/64446", typeof(PlatformSupport), nameof(PlatformSupport.IsAndroidVersionAtLeast31))] public void ReadWriteSect163k1Key1ExplicitPkcs8() { ReadWriteBase64Pkcs8( @" MIHYAgEAMIGEBgcqhkjOPQIBMHkCAQEwJQYHKoZIzj0BAjAaAgIAowYJKoZIzj0B AgMDMAkCAQMCAQYCAQcwBgQBAQQBAQQrBAL+E8BTe7wRrKoH15PeTm1eXJTu6AKJ Bw+wXTj/WDIfLoAFNtU4zNqj2QIVBAAAAAAAAAAAAAIBCKLgzA2Z+KXvAgECBEww SgIBAQQVA8GZWt+ujAUY3BPf5jBLsBAX5qQSoS4DLAAEBheeNxnMgSVDX+ZFidX8 ptwYh1UdB4j+u2L/ySSNizmK/j4LXDwCs/43", EccTestData.Sect163k1Key1Explicit, SupportsSect163k1Explicit); } [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/64446", typeof(PlatformSupport), nameof(PlatformSupport.IsAndroidVersionAtLeast31))] public void ReadWriteSect163k1Key1ExplicitEncryptedPkcs8() { ReadWriteBase64EncryptedPkcs8( @" MIIBADAbBgkqhkiG9w0BBQMwDgQICAkWq2tKYZUCAggABIHgjBfngwE9DbCEaznz +55MjSGbQH0NMgIRCJtQLbrI7888+KmTL6hWYPH6CQzTsi1unWrMAH2JKa7dkIe9 FWNXW7bmhcokVDh/OTXOV9QPZ3O4m19a9XOl0wNlbi47XQ3KUkcbzyFNYlDMSzFw HRfW8+aIkyYAvYCoA4buRfigBe0xy1VKyE5aUkX0EFjx4gqC3Q5mjDMFOxlKNjVV clSZg6tg9J7bTQsDAN0uYpBc1r8DiSQbKMxg+q13yBciXJzfmkQRtNVXQPsseiUm z2NFvWcpK0Fh9fCVGuXV9sjJ5qE=", "Koblitz", new PbeParameters( PbeEncryptionAlgorithm.Aes128Cbc, HashAlgorithmName.SHA256, 12), EccTestData.Sect163k1Key1Explicit, SupportsSect163k1Explicit); } [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/64446", typeof(PlatformSupport), nameof(PlatformSupport.IsAndroidVersionAtLeast31))] public void ReadWriteSect163k1Key1ExplicitSubjectPublicKeyInfo() { ReadWriteBase64SubjectPublicKeyInfo( @" MIG1MIGEBgcqhkjOPQIBMHkCAQEwJQYHKoZIzj0BAjAaAgIAowYJKoZIzj0BAgMD MAkCAQMCAQYCAQcwBgQBAQQBAQQrBAL+E8BTe7wRrKoH15PeTm1eXJTu6AKJBw+w XTj/WDIfLoAFNtU4zNqj2QIVBAAAAAAAAAAAAAIBCKLgzA2Z+KXvAgECAywABAYX njcZzIElQ1/mRYnV/KbcGIdVHQeI/rti/8kkjYs5iv4+C1w8ArP+Nw==", EccTestData.Sect163k1Key1Explicit, SupportsSect163k1Explicit); } [Fact] public void ReadWriteSect283k1Key1ECPrivateKey() { ReadWriteBase64ECPrivateKey( @" MIGAAgEBBCQAtPGuHn/c1LDoIFPAipCIUrJiMebAFnD8xsPqLF0/7UDt8DegBwYF K4EEABChTANKAAQHUncL0z5qbuIJbLaxIOdJe0e2wHehR8tX2vaTkJ2EBxbup6oE fbmZXDVgPF5rL4zf8Otx03rjQxughJ66sTpMkAPHlp9VzZA=", EccTestData.Sect283k1Key1, SupportsSect283k1); } [Fact] public void ReadWriteSect283k1Key1Pkcs8() { ReadWriteBase64Pkcs8( @" MIGQAgEAMBAGByqGSM49AgEGBSuBBAAQBHkwdwIBAQQkALTxrh5/3NSw6CBTwIqQ iFKyYjHmwBZw/MbD6ixdP+1A7fA3oUwDSgAEB1J3C9M+am7iCWy2sSDnSXtHtsB3 oUfLV9r2k5CdhAcW7qeqBH25mVw1YDxeay+M3/DrcdN640MboISeurE6TJADx5af Vc2Q", EccTestData.Sect283k1Key1, SupportsSect283k1); } [Fact] public void ReadWriteSect283k1Key1EncryptedPkcs8() { ReadWriteBase64EncryptedPkcs8( @" MIG4MBsGCSqGSIb3DQEFAzAOBAhf/Ix8WHVvxQICCAAEgZheT2iB2sBmNjV2qIgI DsNyPY+0rwbWR8MHZcRN0zAL9Q3kawaZyWeKe4j3m3Y39YWURVymYeLAm70syrEw 057W6kNVXxR/hEq4MlHJZxZdS+R6LGpEvWFEWiuN0wBtmhO24+KmqPMH8XhGszBv nTvuaAMG/xvXzKoigakX+1D60cmftPsC7t23SF+xMdzfZNlJGrxXFYX1Gg==", "12345", new PbeParameters( PbeEncryptionAlgorithm.Aes192Cbc, HashAlgorithmName.SHA384, 4096), EccTestData.Sect283k1Key1, SupportsSect283k1); } [Fact] public void ReadWriteSect283k1Key1SubjectPublicKeyInfo() { ReadWriteBase64SubjectPublicKeyInfo( @" MF4wEAYHKoZIzj0CAQYFK4EEABADSgAEB1J3C9M+am7iCWy2sSDnSXtHtsB3oUfL V9r2k5CdhAcW7qeqBH25mVw1YDxeay+M3/DrcdN640MboISeurE6TJADx5afVc2Q", EccTestData.Sect283k1Key1, SupportsSect283k1); } [Fact] public void ReadWriteC2pnb163v1ECPrivateKey() { ReadWriteBase64ECPrivateKey( @" MFYCAQEEFQD00koUBxIvRFlnvh2TwAk6ZTZ5hqAKBggqhkjOPQMAAaEuAywABAIR Jy8cVYJCaIjpG9aSV3SUIyJIqgQnCDD3oQCa1nCojekr1ZJIzIE7RQ==", EccTestData.C2pnb163v1Key1, SupportsC2pnb163v1); } [Fact] public void ReadWriteC2pnb163v1Pkcs8() { ReadWriteBase64Pkcs8( @" MGYCAQAwEwYHKoZIzj0CAQYIKoZIzj0DAAEETDBKAgEBBBUA9NJKFAcSL0RZZ74d k8AJOmU2eYahLgMsAAQCEScvHFWCQmiI6RvWkld0lCMiSKoEJwgw96EAmtZwqI3p K9WSSMyBO0U=", EccTestData.C2pnb163v1Key1, SupportsC2pnb163v1); } [Fact] public void ReadWriteC2pnb163v1EncryptedPkcs8() { ReadWriteBase64EncryptedPkcs8( @" MIGPMBsGCSqGSIb3DQEFAzAOBAjdV9IDq+L+5gICCAAEcI1e6RA8kMcYB+PvOcCU Jj65nXTIrMPmZ0DmFMF9WBg0J+yzxgDhBVynpT2uJntY4FuDlvdpcLRK1EGLZYKf qYc5zJMYkRZ178bE3DtfrP3UxD34YvbRl2aeu334+wJOm7ApXv81ugt4OoCiPhdg wiA=", "secret", new PbeParameters( PbeEncryptionAlgorithm.Aes192Cbc, HashAlgorithmName.SHA512, 1024), EccTestData.C2pnb163v1Key1, SupportsC2pnb163v1); } [Fact] public void ReadWriteC2pnb163v1SubjectPublicKeyInfo() { ReadWriteBase64SubjectPublicKeyInfo( @" MEMwEwYHKoZIzj0CAQYIKoZIzj0DAAEDLAAEAhEnLxxVgkJoiOkb1pJXdJQjIkiq BCcIMPehAJrWcKiN6SvVkkjMgTtF", EccTestData.C2pnb163v1Key1, SupportsC2pnb163v1); } [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/64446", typeof(PlatformSupport), nameof(PlatformSupport.IsAndroidVersionAtLeast31))] public void ReadWriteC2pnb163v1ExplicitECPrivateKey() { ReadWriteBase64ECPrivateKey( @" MIIBBwIBAQQVAPTSShQHEi9EWWe+HZPACTplNnmGoIG6MIG3AgEBMCUGByqGSM49 AQIwGgICAKMGCSqGSM49AQIDAzAJAgEBAgECAgEIMEQEFQclRrVDUjSkIuB4lnX0 MsiUNd5SQgQUyVF9BtUkDTz/OMdLILbNTW+d1NkDFQDSwPsVdghg3vHu9NaW5naH VhUXVAQrBAevaZiVRhA9eTKfzD10iA8zu+gDywHsIyEbWWat6h0/h/fqWEiu8LfK nwIVBAAAAAAAAAAAAAHmD8iCHMdNrq/BAgECoS4DLAAEAhEnLxxVgkJoiOkb1pJX dJQjIkiqBCcIMPehAJrWcKiN6SvVkkjMgTtF", EccTestData.C2pnb163v1Key1Explicit, SupportsC2pnb163v1Explicit); } [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/64446", typeof(PlatformSupport), nameof(PlatformSupport.IsAndroidVersionAtLeast31))] public void ReadWriteC2pnb163v1ExplicitPkcs8() { ReadWriteBase64Pkcs8( @" MIIBFwIBADCBwwYHKoZIzj0CATCBtwIBATAlBgcqhkjOPQECMBoCAgCjBgkqhkjO PQECAwMwCQIBAQIBAgIBCDBEBBUHJUa1Q1I0pCLgeJZ19DLIlDXeUkIEFMlRfQbV JA08/zjHSyC2zU1vndTZAxUA0sD7FXYIYN7x7vTWluZ2h1YVF1QEKwQHr2mYlUYQ PXkyn8w9dIgPM7voA8sB7CMhG1lmreodP4f36lhIrvC3yp8CFQQAAAAAAAAAAAAB 5g/IghzHTa6vwQIBAgRMMEoCAQEEFQD00koUBxIvRFlnvh2TwAk6ZTZ5hqEuAywA BAIRJy8cVYJCaIjpG9aSV3SUIyJIqgQnCDD3oQCa1nCojekr1ZJIzIE7RQ==", EccTestData.C2pnb163v1Key1Explicit, SupportsC2pnb163v1Explicit); } [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/64446", typeof(PlatformSupport), nameof(PlatformSupport.IsAndroidVersionAtLeast31))] public void ReadWriteC2pnb163v1ExplicitEncryptedPkcs8() { ReadWriteBase64EncryptedPkcs8( @" MIIBQTAbBgkqhkiG9w0BBQMwDgQI9+ZZnHaqxb0CAggABIIBIM+n6x/Q1hs5OW0F oOKZmQ0mKNRKb23SMqwo0bJlxseIOVdYzOV2LH1hSWeJb7FMxo6OJXb2CpYSPqv1 v3lhdLC5t/ViqAOhG70KF+Dy/vZr8rWXRFqy+OdqwxOes/lBsG+Ws9+uEk8+Gm2G xMHXJNKliSUePlT3wC7z8bCkEvLF7hkGjEAgcABry5Ohq3W2by6Dnd8YWJNgeiW/ Vu5rT1ThAus7w2TJjWrrEqBbIlQ9nm6/MMj9nYnVVfpPAOk/qX9Or7TmK+Sei88Q staXBhfJk9ec8laiPpNbhHJSZ2Ph3Snb6SA7MYi5nIMP4RPxOM2eUet4/ueV1O3U wxcZ+wOsnebIwy4ftKL+klh5EXv/9S5sCjC8g8J2cA6GmcZbiQ==", "secret", new PbeParameters( PbeEncryptionAlgorithm.Aes192Cbc, HashAlgorithmName.SHA512, 1024), EccTestData.C2pnb163v1Key1Explicit, SupportsC2pnb163v1Explicit); } [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/64446", typeof(PlatformSupport), nameof(PlatformSupport.IsAndroidVersionAtLeast31))] public void ReadWriteC2pnb163v1ExplicitSubjectPublicKeyInfo() { ReadWriteBase64SubjectPublicKeyInfo( @" MIH0MIHDBgcqhkjOPQIBMIG3AgEBMCUGByqGSM49AQIwGgICAKMGCSqGSM49AQID AzAJAgEBAgECAgEIMEQEFQclRrVDUjSkIuB4lnX0MsiUNd5SQgQUyVF9BtUkDTz/ OMdLILbNTW+d1NkDFQDSwPsVdghg3vHu9NaW5naHVhUXVAQrBAevaZiVRhA9eTKf zD10iA8zu+gDywHsIyEbWWat6h0/h/fqWEiu8LfKnwIVBAAAAAAAAAAAAAHmD8iC HMdNrq/BAgECAywABAIRJy8cVYJCaIjpG9aSV3SUIyJIqgQnCDD3oQCa1nCojekr 1ZJIzIE7RQ==", EccTestData.C2pnb163v1Key1Explicit, SupportsC2pnb163v1Explicit); } [Fact] public void NoFuzzySubjectPublicKeyInfo() { using (T key = CreateKey()) { int bytesRead = -1; byte[] ecPriv = key.ExportECPrivateKey(); Assert.ThrowsAny<CryptographicException>( () => key.ImportSubjectPublicKeyInfo(ecPriv, out bytesRead)); Assert.Equal(-1, bytesRead); byte[] pkcs8 = key.ExportPkcs8PrivateKey(); Assert.ThrowsAny<CryptographicException>( () => key.ImportSubjectPublicKeyInfo(pkcs8, out bytesRead)); Assert.Equal(-1, bytesRead); ReadOnlySpan<byte> passwordBytes = ecPriv.AsSpan(0, 15); byte[] encryptedPkcs8 = key.ExportEncryptedPkcs8PrivateKey( passwordBytes, new PbeParameters( PbeEncryptionAlgorithm.Aes256Cbc, HashAlgorithmName.SHA512, 123)); Assert.ThrowsAny<CryptographicException>( () => key.ImportSubjectPublicKeyInfo(encryptedPkcs8, out bytesRead)); Assert.Equal(-1, bytesRead); } } [Fact] public void NoFuzzyECPrivateKey() { using (T key = CreateKey()) { int bytesRead = -1; byte[] spki = key.ExportSubjectPublicKeyInfo(); Assert.ThrowsAny<CryptographicException>( () => key.ImportECPrivateKey(spki, out bytesRead)); Assert.Equal(-1, bytesRead); byte[] pkcs8 = key.ExportPkcs8PrivateKey(); Assert.ThrowsAny<CryptographicException>( () => key.ImportECPrivateKey(pkcs8, out bytesRead)); Assert.Equal(-1, bytesRead); ReadOnlySpan<byte> passwordBytes = spki.AsSpan(0, 15); byte[] encryptedPkcs8 = key.ExportEncryptedPkcs8PrivateKey( passwordBytes, new PbeParameters( PbeEncryptionAlgorithm.Aes256Cbc, HashAlgorithmName.SHA512, 123)); Assert.ThrowsAny<CryptographicException>( () => key.ImportECPrivateKey(encryptedPkcs8, out bytesRead)); Assert.Equal(-1, bytesRead); } } [Fact] public void NoFuzzyPkcs8() { using (T key = CreateKey()) { int bytesRead = -1; byte[] spki = key.ExportSubjectPublicKeyInfo(); Assert.ThrowsAny<CryptographicException>( () => key.ImportPkcs8PrivateKey(spki, out bytesRead)); Assert.Equal(-1, bytesRead); byte[] ecPriv = key.ExportECPrivateKey(); Assert.ThrowsAny<CryptographicException>( () => key.ImportPkcs8PrivateKey(ecPriv, out bytesRead)); Assert.Equal(-1, bytesRead); ReadOnlySpan<byte> passwordBytes = spki.AsSpan(0, 15); byte[] encryptedPkcs8 = key.ExportEncryptedPkcs8PrivateKey( passwordBytes, new PbeParameters( PbeEncryptionAlgorithm.Aes256Cbc, HashAlgorithmName.SHA512, 123)); Assert.ThrowsAny<CryptographicException>( () => key.ImportPkcs8PrivateKey(encryptedPkcs8, out bytesRead)); Assert.Equal(-1, bytesRead); } } [Fact] public void NoFuzzyEncryptedPkcs8() { using (T key = CreateKey()) { int bytesRead = -1; byte[] spki = key.ExportSubjectPublicKeyInfo(); byte[] empty = Array.Empty<byte>(); Assert.ThrowsAny<CryptographicException>( () => key.ImportEncryptedPkcs8PrivateKey(empty, spki, out bytesRead)); Assert.Equal(-1, bytesRead); byte[] ecPriv = key.ExportECPrivateKey(); Assert.ThrowsAny<CryptographicException>( () => key.ImportEncryptedPkcs8PrivateKey(empty, ecPriv, out bytesRead)); Assert.Equal(-1, bytesRead); byte[] pkcs8 = key.ExportPkcs8PrivateKey(); Assert.ThrowsAny<CryptographicException>( () => key.ImportEncryptedPkcs8PrivateKey(empty, pkcs8, out bytesRead)); Assert.Equal(-1, bytesRead); } } [Fact] public void NoPrivKeyFromPublicOnly() { using (T key = CreateKey()) { ECParameters parameters = EccTestData.GetNistP521Key2(); parameters.D = null; key.ImportParameters(parameters); Assert.ThrowsAny<CryptographicException>( () => key.ExportECPrivateKey()); Assert.ThrowsAny<CryptographicException>( () => key.TryExportECPrivateKey(Span<byte>.Empty, out _)); Assert.ThrowsAny<CryptographicException>( () => key.ExportPkcs8PrivateKey()); Assert.ThrowsAny<CryptographicException>( () => key.TryExportPkcs8PrivateKey(Span<byte>.Empty, out _)); Assert.ThrowsAny<CryptographicException>( () => key.ExportEncryptedPkcs8PrivateKey( ReadOnlySpan<byte>.Empty, new PbeParameters(PbeEncryptionAlgorithm.Aes192Cbc, HashAlgorithmName.SHA256, 72))); Assert.ThrowsAny<CryptographicException>( () => key.TryExportEncryptedPkcs8PrivateKey( ReadOnlySpan<byte>.Empty, new PbeParameters(PbeEncryptionAlgorithm.Aes192Cbc, HashAlgorithmName.SHA256, 72), Span<byte>.Empty, out _)); } } [Fact] public void BadPbeParameters() { using (T key = CreateKey()) { Assert.ThrowsAny<ArgumentNullException>( () => key.ExportEncryptedPkcs8PrivateKey( ReadOnlySpan<byte>.Empty, null)); Assert.ThrowsAny<ArgumentNullException>( () => key.ExportEncryptedPkcs8PrivateKey( ReadOnlySpan<char>.Empty, null)); Assert.ThrowsAny<ArgumentNullException>( () => key.TryExportEncryptedPkcs8PrivateKey( ReadOnlySpan<byte>.Empty, null, Span<byte>.Empty, out _)); Assert.ThrowsAny<ArgumentNullException>( () => key.TryExportEncryptedPkcs8PrivateKey( ReadOnlySpan<char>.Empty, null, Span<byte>.Empty, out _)); // PKCS12 requires SHA-1 Assert.ThrowsAny<CryptographicException>( () => key.ExportEncryptedPkcs8PrivateKey( ReadOnlySpan<byte>.Empty, new PbeParameters(PbeEncryptionAlgorithm.TripleDes3KeyPkcs12, HashAlgorithmName.SHA256, 72))); Assert.ThrowsAny<CryptographicException>( () => key.TryExportEncryptedPkcs8PrivateKey( ReadOnlySpan<byte>.Empty, new PbeParameters(PbeEncryptionAlgorithm.TripleDes3KeyPkcs12, HashAlgorithmName.SHA256, 72), Span<byte>.Empty, out _)); // PKCS12 requires SHA-1 Assert.ThrowsAny<CryptographicException>( () => key.ExportEncryptedPkcs8PrivateKey( ReadOnlySpan<byte>.Empty, new PbeParameters(PbeEncryptionAlgorithm.TripleDes3KeyPkcs12, HashAlgorithmName.MD5, 72))); Assert.ThrowsAny<CryptographicException>( () => key.TryExportEncryptedPkcs8PrivateKey( ReadOnlySpan<byte>.Empty, new PbeParameters(PbeEncryptionAlgorithm.TripleDes3KeyPkcs12, HashAlgorithmName.MD5, 72), Span<byte>.Empty, out _)); // PKCS12 requires a char-based password Assert.ThrowsAny<CryptographicException>( () => key.ExportEncryptedPkcs8PrivateKey( new byte[3], new PbeParameters(PbeEncryptionAlgorithm.TripleDes3KeyPkcs12, HashAlgorithmName.SHA1, 72))); Assert.ThrowsAny<CryptographicException>( () => key.TryExportEncryptedPkcs8PrivateKey( new byte[3], new PbeParameters(PbeEncryptionAlgorithm.TripleDes3KeyPkcs12, HashAlgorithmName.SHA1, 72), Span<byte>.Empty, out _)); // Unknown encryption algorithm Assert.ThrowsAny<CryptographicException>( () => key.ExportEncryptedPkcs8PrivateKey( new byte[3], new PbeParameters(0, HashAlgorithmName.SHA1, 72))); Assert.ThrowsAny<CryptographicException>( () => key.TryExportEncryptedPkcs8PrivateKey( new byte[3], new PbeParameters(0, HashAlgorithmName.SHA1, 72), Span<byte>.Empty, out _)); // Unknown encryption algorithm (negative enum value) Assert.ThrowsAny<CryptographicException>( () => key.ExportEncryptedPkcs8PrivateKey( new byte[3], new PbeParameters((PbeEncryptionAlgorithm)(-5), HashAlgorithmName.SHA1, 72))); Assert.ThrowsAny<CryptographicException>( () => key.TryExportEncryptedPkcs8PrivateKey( new byte[3], new PbeParameters((PbeEncryptionAlgorithm)(-5), HashAlgorithmName.SHA1, 72), Span<byte>.Empty, out _)); // Unknown encryption algorithm (overly-large enum value) Assert.ThrowsAny<CryptographicException>( () => key.ExportEncryptedPkcs8PrivateKey( new byte[3], new PbeParameters((PbeEncryptionAlgorithm)15, HashAlgorithmName.SHA1, 72))); Assert.ThrowsAny<CryptographicException>( () => key.TryExportEncryptedPkcs8PrivateKey( new byte[3], new PbeParameters((PbeEncryptionAlgorithm)15, HashAlgorithmName.SHA1, 72), Span<byte>.Empty, out _)); // Unknown hash algorithm Assert.ThrowsAny<CryptographicException>( () => key.ExportEncryptedPkcs8PrivateKey( new byte[3], new PbeParameters(PbeEncryptionAlgorithm.Aes192Cbc, new HashAlgorithmName("Potato"), 72))); Assert.ThrowsAny<CryptographicException>( () => key.TryExportEncryptedPkcs8PrivateKey( new byte[3], new PbeParameters(PbeEncryptionAlgorithm.Aes192Cbc, new HashAlgorithmName("Potato"), 72), Span<byte>.Empty, out _)); } } [Fact] public void DecryptPkcs12WithBytes() { using (T key = CreateKey()) { string charBased = "hello"; byte[] byteBased = Encoding.UTF8.GetBytes(charBased); byte[] encrypted = key.ExportEncryptedPkcs8PrivateKey( charBased, new PbeParameters( PbeEncryptionAlgorithm.TripleDes3KeyPkcs12, HashAlgorithmName.SHA1, 123)); Assert.ThrowsAny<CryptographicException>( () => key.ImportEncryptedPkcs8PrivateKey(byteBased, encrypted, out _)); } } [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/62547", TestPlatforms.Android)] public void DecryptPkcs12PbeTooManyIterations() { // pbeWithSHAAnd3-KeyTripleDES-CBC with 600,001 iterations byte[] high3DesIterationKey = Convert.FromBase64String(@" MIG6MCUGCiqGSIb3DQEMAQMwFwQQWOZyFrGwhyGTEd2nbKuLSQIDCSfBBIGQCgPLkx0OwmK3lJ9o VAdJAg/2nvOhboOHciu5I6oh5dRkxeDjUJixsadd3uhiZb5v7UgiohBQsFv+PWU12rmz6sgWR9rK V2UqV6Y5vrHJDlNJGI+CQKzOTF7LXyOT+EqaXHD+25TM2/kcZjZrOdigkgQBAFhbfn2/hV/t0TPe Tj/54rcY3i0gXT6da/r/o+qV"); using (T key = CreateKey()) { Assert.ThrowsAny<CryptographicException>( () => key.ImportEncryptedPkcs8PrivateKey("test", high3DesIterationKey, out _)); } } [Fact] [ActiveIssue("https://github.com/dotnet/runtime/issues/62547", TestPlatforms.Android)] public void ReadWriteEc256EncryptedPkcs8_Pbes2HighIterations() { // pkcs5PBES2 hmacWithSHA256 aes128-CBC with 600,001 iterations ReadWriteBase64EncryptedPkcs8(@" MIH1MGAGCSqGSIb3DQEFDTBTMDIGCSqGSIb3DQEFDDAlBBA+rne0bUkwr614vLfQkwO4AgMJJ8Ew DAYIKoZIhvcNAgkFADAdBglghkgBZQMEAQIEEIm3c9r5igQ9Vlv1mKTZYp0EgZC8KZfmJtfYmsl4 Z0Dc85ugFvtFHVeRbcvfYmFns23WL3gpGQ0mj4BKxttX+WuDk9duAsCslNLvXFY7m3MQRkWA6QHT A8DiR3j0l5TGBkErbTUrjmB3ftvEmmF9mleRLj6qEYmmKdCV2Tfk1YBOZ2mpB9bpCPipUansyqWs xoMaz20Yx+2TSN5dSm2FcD+0YFI=", "test", new PbeParameters( PbeEncryptionAlgorithm.Aes128Cbc, HashAlgorithmName.SHA256, 600_001), EccTestData.GetNistP256ReferenceKey()); } private void ReadWriteBase64EncryptedPkcs8( string base64EncryptedPkcs8, string password, PbeParameters pbe, in ECParameters expected, bool isSupported=true) { if (isSupported) { ReadWriteKey( base64EncryptedPkcs8, expected, (T key, ReadOnlySpan<byte> source, out int read) => key.ImportEncryptedPkcs8PrivateKey(password, source, out read), key => key.ExportEncryptedPkcs8PrivateKey(password, pbe), (T key, Span<byte> destination, out int bytesWritten) => key.TryExportEncryptedPkcs8PrivateKey(password, pbe, destination, out bytesWritten), isEncrypted: true); } else { byte[] encrypted = Convert.FromBase64String(base64EncryptedPkcs8); using (T key = CreateKey()) { // Wrong password Assert.ThrowsAny<CryptographicException>( () => key.ImportEncryptedPkcs8PrivateKey(encrypted.AsSpan(1, 14), encrypted, out _)); Assert.ThrowsAny<CryptographicException>( () => key.ImportEncryptedPkcs8PrivateKey(password + password, encrypted, out _)); int bytesRead = -1; Exception e = Assert.ThrowsAny<Exception>( () => key.ImportEncryptedPkcs8PrivateKey(password, encrypted, out bytesRead)); Assert.True( e is PlatformNotSupportedException || e is CryptographicException, "e is PlatformNotSupportedException || e is CryptographicException"); Assert.Equal(-1, bytesRead); } } } private void ReadWriteBase64EncryptedPkcs8( string base64EncryptedPkcs8, byte[] passwordBytes, PbeParameters pbe, in ECParameters expected, bool isSupported=true) { if (isSupported) { ReadWriteKey( base64EncryptedPkcs8, expected, (T key, ReadOnlySpan<byte> source, out int read) => key.ImportEncryptedPkcs8PrivateKey(passwordBytes, source, out read), key => key.ExportEncryptedPkcs8PrivateKey(passwordBytes, pbe), (T key, Span<byte> destination, out int bytesWritten) => key.TryExportEncryptedPkcs8PrivateKey(passwordBytes, pbe, destination, out bytesWritten), isEncrypted: true); } else { byte[] encrypted = Convert.FromBase64String(base64EncryptedPkcs8); byte[] wrongPassword = new byte[passwordBytes.Length + 2]; RandomNumberGenerator.Fill(wrongPassword); using (T key = CreateKey()) { // Wrong password Assert.ThrowsAny<CryptographicException>( () => key.ImportEncryptedPkcs8PrivateKey(wrongPassword, encrypted, out _)); Assert.ThrowsAny<CryptographicException>( () => key.ImportEncryptedPkcs8PrivateKey("ThisBetterNotBeThePassword!", encrypted, out _)); int bytesRead = -1; Exception e = Assert.ThrowsAny<Exception>( () => key.ImportEncryptedPkcs8PrivateKey(passwordBytes, encrypted, out bytesRead)); Assert.True( e is PlatformNotSupportedException || e is CryptographicException, "e is PlatformNotSupportedException || e is CryptographicException"); Assert.Equal(-1, bytesRead); } } } private void ReadWriteBase64ECPrivateKey(string base64Pkcs8, in ECParameters expected, bool isSupported=true) { if (isSupported) { ReadWriteKey( base64Pkcs8, expected, (T key, ReadOnlySpan<byte> source, out int read) => key.ImportECPrivateKey(source, out read), key => key.ExportECPrivateKey(), (T key, Span<byte> destination, out int bytesWritten) => key.TryExportECPrivateKey(destination, out bytesWritten)); } else { using (T key = CreateKey()) { Exception e = Assert.ThrowsAny<Exception>( () => key.ImportECPrivateKey(Convert.FromBase64String(base64Pkcs8), out _)); Assert.True( e is PlatformNotSupportedException || e is CryptographicException, $"e should be PlatformNotSupportedException or CryptographicException.\n\te is {e.ToString()}"); } } } private void ReadWriteBase64Pkcs8(string base64Pkcs8, in ECParameters expected, bool isSupported=true) { if (isSupported) { ReadWriteKey( base64Pkcs8, expected, (T key, ReadOnlySpan<byte> source, out int read) => key.ImportPkcs8PrivateKey(source, out read), key => key.ExportPkcs8PrivateKey(), (T key, Span<byte> destination, out int bytesWritten) => key.TryExportPkcs8PrivateKey(destination, out bytesWritten)); } else { using (T key = CreateKey()) { Exception e = Assert.ThrowsAny<Exception>( () => key.ImportPkcs8PrivateKey(Convert.FromBase64String(base64Pkcs8), out _)); Assert.True( e is PlatformNotSupportedException || e is CryptographicException, "e is PlatformNotSupportedException || e is CryptographicException"); } } } private void ReadWriteBase64SubjectPublicKeyInfo( string base64SubjectPublicKeyInfo, in ECParameters expected, bool isSupported = true) { if (isSupported) { ECParameters expectedPublic = expected; expectedPublic.D = null; ReadWriteKey( base64SubjectPublicKeyInfo, expectedPublic, (T key, ReadOnlySpan<byte> source, out int read) => key.ImportSubjectPublicKeyInfo(source, out read), key => key.ExportSubjectPublicKeyInfo(), (T key, Span<byte> destination, out int written) => key.TryExportSubjectPublicKeyInfo(destination, out written), writePublicArrayFunc: PublicKeyWriteArrayFunc, writePublicSpanFunc: PublicKeyWriteSpanFunc); } else { using (T key = CreateKey()) { Exception e = Assert.ThrowsAny<Exception>( () => key.ImportSubjectPublicKeyInfo(Convert.FromBase64String(base64SubjectPublicKeyInfo), out _)); Assert.True( e is PlatformNotSupportedException || e is CryptographicException, "e is PlatformNotSupportedException || e is CryptographicException"); } } } private void ReadWriteKey( string base64, in ECParameters expected, ReadKeyAction readAction, Func<T, byte[]> writeArrayFunc, WriteKeyToSpanFunc writeSpanFunc, bool isEncrypted = false, Func<T, byte[]> writePublicArrayFunc = null, WriteKeyToSpanFunc writePublicSpanFunc = null) { bool isPrivateKey = expected.D != null; byte[] derBytes = Convert.FromBase64String(base64); byte[] arrayExport; byte[] tooBig; const int OverAllocate = 30; const int WriteShift = 6; using (T key = CreateKey()) { readAction(key, derBytes, out int bytesRead); Assert.Equal(derBytes.Length, bytesRead); arrayExport = writeArrayFunc(key); if (writePublicArrayFunc is not null) { byte[] publicArrayExport = writePublicArrayFunc(key); Assert.Equal(arrayExport, publicArrayExport); Assert.True(writePublicSpanFunc(key, publicArrayExport, out int publicExportWritten)); Assert.Equal(publicExportWritten, publicArrayExport.Length); Assert.Equal(arrayExport, publicArrayExport); } ECParameters ecParameters = key.ExportParameters(isPrivateKey); EccTestBase.AssertEqual(expected, ecParameters); } // It's not reasonable to assume that arrayExport and derBytes have the same // contents, because the SubjectPublicKeyInfo and PrivateKeyInfo formats both // have the curve identifier in the AlgorithmIdentifier.Parameters field, and // either the input or the output may have chosen to then not emit it in the // optional domainParameters field of the ECPrivateKey blob. // // Once we have exported the data to normalize it, though, we should see // consistency in the answer format. using (T key = CreateKey()) { Assert.ThrowsAny<CryptographicException>( () => readAction(key, arrayExport.AsSpan(1), out _)); Assert.ThrowsAny<CryptographicException>( () => readAction(key, arrayExport.AsSpan(0, arrayExport.Length - 1), out _)); readAction(key, arrayExport, out int bytesRead); Assert.Equal(arrayExport.Length, bytesRead); ECParameters ecParameters = key.ExportParameters(isPrivateKey); EccTestBase.AssertEqual(expected, ecParameters); Assert.False( writeSpanFunc(key, Span<byte>.Empty, out int bytesWritten), "Write to empty span"); Assert.Equal(0, bytesWritten); Assert.False( writeSpanFunc( key, derBytes.AsSpan(0, Math.Min(derBytes.Length, arrayExport.Length) - 1), out bytesWritten), "Write to too-small span"); Assert.Equal(0, bytesWritten); tooBig = new byte[arrayExport.Length + OverAllocate]; tooBig.AsSpan().Fill(0xC4); Assert.True(writeSpanFunc(key, tooBig.AsSpan(WriteShift), out bytesWritten)); Assert.Equal(arrayExport.Length, bytesWritten); Assert.Equal(0xC4, tooBig[WriteShift - 1]); Assert.Equal(0xC4, tooBig[WriteShift + bytesWritten + 1]); // If encrypted, the data should have had a random salt applied, so unstable. // Otherwise, we've normalized the data (even for private keys) so the output // should match what it output previously. if (isEncrypted) { Assert.NotEqual( arrayExport.ByteArrayToHex(), tooBig.AsSpan(WriteShift, bytesWritten).ByteArrayToHex()); } else { Assert.Equal( arrayExport.ByteArrayToHex(), tooBig.AsSpan(WriteShift, bytesWritten).ByteArrayToHex()); } } using (T key = CreateKey()) { readAction(key, tooBig.AsSpan(WriteShift), out int bytesRead); Assert.Equal(arrayExport.Length, bytesRead); arrayExport.AsSpan().Fill(0xCA); Assert.True( writeSpanFunc(key, arrayExport, out int bytesWritten), "Write to precisely allocated Span"); if (isEncrypted) { Assert.NotEqual( tooBig.AsSpan(WriteShift, bytesWritten).ByteArrayToHex(), arrayExport.ByteArrayToHex()); } else { Assert.Equal( tooBig.AsSpan(WriteShift, bytesWritten).ByteArrayToHex(), arrayExport.ByteArrayToHex()); } } } protected delegate void ReadKeyAction(T key, ReadOnlySpan<byte> source, out int bytesRead); protected delegate bool WriteKeyToSpanFunc(T key, Span<byte> destination, out int bytesWritten); } }
-1
dotnet/runtime
66,145
Fix clash between tentative method optimizations
This pull request pretty much became a rollback of https://github.com/dotnet/runtimelab/pull/658 with a regression test to make sure if https://github.com/dotnet/runtimelab/pull/658 is reintroduced, we do it properly. ~~When we were in the situation of the newly added test, we would try to generate method body on the abstract class. Such method body is not actually reachable.~~ ~~Saves 500 bytes on a hello world. Fixes a compiler assert (that might be more serious sometimes).~~
MichalStrehovsky
2022-03-03T16:32:47Z
2022-03-07T16:49:51Z
154386d63b3ba55ce3251fa4caf3dfa89279d982
b0d1e89497bfa7a7b602a1d1af2faa97af96c88d
Fix clash between tentative method optimizations. This pull request pretty much became a rollback of https://github.com/dotnet/runtimelab/pull/658 with a regression test to make sure if https://github.com/dotnet/runtimelab/pull/658 is reintroduced, we do it properly. ~~When we were in the situation of the newly added test, we would try to generate method body on the abstract class. Such method body is not actually reachable.~~ ~~Saves 500 bytes on a hello world. Fixes a compiler assert (that might be more serious sometimes).~~
./src/mono/mono/tests/assembly-load-dir2/Lib.cs
using System; public class LibClass { public LibClass () { Console.WriteLine ("dir2"); } public override string ToString () { return "LibClass from dir2"; } }
using System; public class LibClass { public LibClass () { Console.WriteLine ("dir2"); } public override string ToString () { return "LibClass from dir2"; } }
-1
dotnet/runtime
66,145
Fix clash between tentative method optimizations
This pull request pretty much became a rollback of https://github.com/dotnet/runtimelab/pull/658 with a regression test to make sure if https://github.com/dotnet/runtimelab/pull/658 is reintroduced, we do it properly. ~~When we were in the situation of the newly added test, we would try to generate method body on the abstract class. Such method body is not actually reachable.~~ ~~Saves 500 bytes on a hello world. Fixes a compiler assert (that might be more serious sometimes).~~
MichalStrehovsky
2022-03-03T16:32:47Z
2022-03-07T16:49:51Z
154386d63b3ba55ce3251fa4caf3dfa89279d982
b0d1e89497bfa7a7b602a1d1af2faa97af96c88d
Fix clash between tentative method optimizations. This pull request pretty much became a rollback of https://github.com/dotnet/runtimelab/pull/658 with a regression test to make sure if https://github.com/dotnet/runtimelab/pull/658 is reintroduced, we do it properly. ~~When we were in the situation of the newly added test, we would try to generate method body on the abstract class. Such method body is not actually reachable.~~ ~~Saves 500 bytes on a hello world. Fixes a compiler assert (that might be more serious sometimes).~~
./src/libraries/Common/src/Interop/Windows/Crypt32/Interop.CERT_INFO.cs
// 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.Runtime.InteropServices; internal static partial class Interop { internal static partial class Crypt32 { [StructLayout(LayoutKind.Sequential)] internal struct CERT_INFO { internal int dwVersion; internal DATA_BLOB SerialNumber; internal CRYPT_ALGORITHM_IDENTIFIER SignatureAlgorithm; internal DATA_BLOB Issuer; internal FILETIME NotBefore; internal FILETIME NotAfter; internal DATA_BLOB Subject; internal CERT_PUBLIC_KEY_INFO SubjectPublicKeyInfo; internal CRYPT_BIT_BLOB IssuerUniqueId; internal CRYPT_BIT_BLOB SubjectUniqueId; internal int cExtension; internal IntPtr rgExtension; } [StructLayout(LayoutKind.Sequential)] internal struct FILETIME { internal uint ftTimeLow; internal uint ftTimeHigh; internal DateTime ToDateTime() { long fileTime = (((long)ftTimeHigh) << 32) + ftTimeLow; return DateTime.FromFileTime(fileTime); } internal static FILETIME FromDateTime(DateTime dt) { long fileTime = dt.ToFileTime(); unchecked { return new FILETIME() { ftTimeLow = (uint)fileTime, ftTimeHigh = (uint)(fileTime >> 32), }; } } } } }
// 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.Runtime.InteropServices; internal static partial class Interop { internal static partial class Crypt32 { [StructLayout(LayoutKind.Sequential)] internal struct CERT_INFO { internal int dwVersion; internal DATA_BLOB SerialNumber; internal CRYPT_ALGORITHM_IDENTIFIER SignatureAlgorithm; internal DATA_BLOB Issuer; internal FILETIME NotBefore; internal FILETIME NotAfter; internal DATA_BLOB Subject; internal CERT_PUBLIC_KEY_INFO SubjectPublicKeyInfo; internal CRYPT_BIT_BLOB IssuerUniqueId; internal CRYPT_BIT_BLOB SubjectUniqueId; internal int cExtension; internal IntPtr rgExtension; } [StructLayout(LayoutKind.Sequential)] internal struct FILETIME { internal uint ftTimeLow; internal uint ftTimeHigh; internal DateTime ToDateTime() { long fileTime = (((long)ftTimeHigh) << 32) + ftTimeLow; return DateTime.FromFileTime(fileTime); } internal static FILETIME FromDateTime(DateTime dt) { long fileTime = dt.ToFileTime(); unchecked { return new FILETIME() { ftTimeLow = (uint)fileTime, ftTimeHigh = (uint)(fileTime >> 32), }; } } } } }
-1