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,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/libraries/System.Speech/src/Recognition/SrgsGrammar/SrgsOneOf.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.ObjectModel; using System.Diagnostics; using System.Speech.Internal; using System.Speech.Internal.SrgsParser; using System.Text; using System.Xml; namespace System.Speech.Recognition.SrgsGrammar { [Serializable] [DebuggerDisplay("{DebuggerDisplayString ()}")] [DebuggerTypeProxy(typeof(OneOfDebugDisplay))] public class SrgsOneOf : SrgsElement, IOneOf { #region Constructors public SrgsOneOf() { } public SrgsOneOf(params string[] items) : this() { Helpers.ThrowIfNull(items, nameof(items)); for (int i = 0; i < items.Length; i++) { if (items[i] == null) { throw new ArgumentNullException(nameof(items), SR.Get(SRID.ParamsEntryNullIllegal)); } _items.Add(new SrgsItem(items[i])); } } public SrgsOneOf(params SrgsItem[] items) : this() { Helpers.ThrowIfNull(items, nameof(items)); for (int i = 0; i < items.Length; i++) { SrgsItem item = items[i]; if (item == null) { throw new ArgumentNullException(nameof(items), SR.Get(SRID.ParamsEntryNullIllegal)); } _items.Add(item); } } #endregion #region public Method public void Add(SrgsItem item) { Helpers.ThrowIfNull(item, nameof(item)); Items.Add(item); } #endregion #region public Properties // ISSUE: Do we need more constructors? Take a look at RuleElementCollection.AddOneOf methods. [Bug# 37115] public Collection<SrgsItem> Items { get { return _items; } } #endregion #region internal Methods internal override void WriteSrgs(XmlWriter writer) { // Write <one-of>...</one-of> writer.WriteStartElement("one-of"); foreach (SrgsItem element in _items) { element.WriteSrgs(writer); } writer.WriteEndElement(); } internal override string DebuggerDisplayString() { StringBuilder sb = new("SrgsOneOf Count = "); sb.Append(_items.Count); return sb.ToString(); } #endregion #region Protected Properties /// <summary> /// Allows the Srgs Element base class to implement /// features requiring recursion in the elements tree. /// </summary> internal override SrgsElement[] Children { get { SrgsElement[] elements = new SrgsElement[_items.Count]; int i = 0; foreach (SrgsItem item in _items) { elements[i++] = item; } return elements; } } #endregion #region Private Fields private SrgsItemList _items = new(); #endregion #region Private Types // Used by the debugger display attribute internal class OneOfDebugDisplay { public OneOfDebugDisplay(SrgsOneOf oneOf) { _items = oneOf._items; } [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] public SrgsItem[] AKeys { get { SrgsItem[] items = new SrgsItem[_items.Count]; for (int i = 0; i < _items.Count; i++) { items[i] = _items[i]; } return items; } } private Collection<SrgsItem> _items; } #endregion } }
// 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.ObjectModel; using System.Diagnostics; using System.Speech.Internal; using System.Speech.Internal.SrgsParser; using System.Text; using System.Xml; namespace System.Speech.Recognition.SrgsGrammar { [Serializable] [DebuggerDisplay("{DebuggerDisplayString ()}")] [DebuggerTypeProxy(typeof(OneOfDebugDisplay))] public class SrgsOneOf : SrgsElement, IOneOf { #region Constructors public SrgsOneOf() { } public SrgsOneOf(params string[] items) : this() { Helpers.ThrowIfNull(items, nameof(items)); for (int i = 0; i < items.Length; i++) { if (items[i] == null) { throw new ArgumentNullException(nameof(items), SR.Get(SRID.ParamsEntryNullIllegal)); } _items.Add(new SrgsItem(items[i])); } } public SrgsOneOf(params SrgsItem[] items) : this() { Helpers.ThrowIfNull(items, nameof(items)); for (int i = 0; i < items.Length; i++) { SrgsItem item = items[i]; if (item == null) { throw new ArgumentNullException(nameof(items), SR.Get(SRID.ParamsEntryNullIllegal)); } _items.Add(item); } } #endregion #region public Method public void Add(SrgsItem item) { Helpers.ThrowIfNull(item, nameof(item)); Items.Add(item); } #endregion #region public Properties // ISSUE: Do we need more constructors? Take a look at RuleElementCollection.AddOneOf methods. [Bug# 37115] public Collection<SrgsItem> Items { get { return _items; } } #endregion #region internal Methods internal override void WriteSrgs(XmlWriter writer) { // Write <one-of>...</one-of> writer.WriteStartElement("one-of"); foreach (SrgsItem element in _items) { element.WriteSrgs(writer); } writer.WriteEndElement(); } internal override string DebuggerDisplayString() { StringBuilder sb = new("SrgsOneOf Count = "); sb.Append(_items.Count); return sb.ToString(); } #endregion #region Protected Properties /// <summary> /// Allows the Srgs Element base class to implement /// features requiring recursion in the elements tree. /// </summary> internal override SrgsElement[] Children { get { SrgsElement[] elements = new SrgsElement[_items.Count]; int i = 0; foreach (SrgsItem item in _items) { elements[i++] = item; } return elements; } } #endregion #region Private Fields private SrgsItemList _items = new(); #endregion #region Private Types // Used by the debugger display attribute internal class OneOfDebugDisplay { public OneOfDebugDisplay(SrgsOneOf oneOf) { _items = oneOf._items; } [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] public SrgsItem[] AKeys { get { SrgsItem[] items = new SrgsItem[_items.Count]; for (int i = 0; i < _items.Count; i++) { items[i] = _items[i]; } return items; } } private Collection<SrgsItem> _items; } #endregion } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/JIT/Regression/JitBlue/GitHub_27279/GitHub_27279.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; class GitHub_27279 { unsafe static int Main() { bool res = Unsafe.IsAddressLessThan(ref Unsafe.AsRef<byte>((void*)(-1)), ref Unsafe.AsRef<byte>((void*)(1))); Console.WriteLine(res.ToString()); if (res) { return 101; } 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.Runtime.CompilerServices; class GitHub_27279 { unsafe static int Main() { bool res = Unsafe.IsAddressLessThan(ref Unsafe.AsRef<byte>((void*)(-1)), ref Unsafe.AsRef<byte>((void*)(1))); Console.WriteLine(res.ToString()); if (res) { return 101; } return 100; } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/JIT/HardwareIntrinsics/X86/Avx2/InsertVector128.Int64.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.X86; using static System.Runtime.Intrinsics.X86.Sse; using static System.Runtime.Intrinsics.X86.Sse2; namespace JIT.HardwareIntrinsics.X86 { public static partial class Program { private static void InsertVector128Int641() { var test = new InsertVector128Test__InsertVector128Int641(); if (test.IsSupported) { // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); if (Avx.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 (Avx.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(); // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); if (Avx.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(); // 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(); } 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 InsertVector128Test__InsertVector128Int641 { private struct TestStruct { public Vector256<Int64> _fld1; public Vector128<Int64> _fld2; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt64(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref testStruct._fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt64(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref testStruct._fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>()); return testStruct; } public void RunStructFldScenario(InsertVector128Test__InsertVector128Int641 testClass) { var result = Avx2.InsertVector128(_fld1, _fld2, 1); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } } private static readonly int LargestVectorSize = 32; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64); private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64); private static Int64[] _data1 = new Int64[Op1ElementCount]; private static Int64[] _data2 = new Int64[Op2ElementCount]; private static Vector256<Int64> _clsVar1; private static Vector128<Int64> _clsVar2; private Vector256<Int64> _fld1; private Vector128<Int64> _fld2; private SimpleBinaryOpTest__DataTable<Int64, Int64, Int64> _dataTable; static InsertVector128Test__InsertVector128Int641() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt64(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt64(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>()); } public InsertVector128Test__InsertVector128Int641() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt64(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt64(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt64(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt64(); } _dataTable = new SimpleBinaryOpTest__DataTable<Int64, Int64, Int64>(_data1, _data2, new Int64[RetElementCount], LargestVectorSize); } public bool IsSupported => Avx2.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = Avx2.InsertVector128( Unsafe.Read<Vector256<Int64>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<Int64>>(_dataTable.inArray2Ptr), 1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunBasicScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load)); var result = Avx2.InsertVector128( Avx.LoadVector256((Int64*)(_dataTable.inArray1Ptr)), LoadVector128((Int64*)(_dataTable.inArray2Ptr)), 1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunBasicScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned)); var result = Avx2.InsertVector128( Avx.LoadAlignedVector256((Int64*)(_dataTable.inArray1Ptr)), LoadAlignedVector128((Int64*)(_dataTable.inArray2Ptr)), 1 ); 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(Avx2).GetMethod(nameof(Avx2.InsertVector128), new Type[] { typeof(Vector256<Int64>), typeof(Vector128<Int64>), typeof(byte) }) .Invoke(null, new object[] { Unsafe.Read<Vector256<Int64>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<Int64>>(_dataTable.inArray2Ptr), (byte)1 }); Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int64>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load)); var result = typeof(Avx2).GetMethod(nameof(Avx2.InsertVector128), new Type[] { typeof(Vector256<Int64>), typeof(Vector128<Int64>), typeof(byte) }) .Invoke(null, new object[] { Avx.LoadVector256((Int64*)(_dataTable.inArray1Ptr)), LoadVector128((Int64*)(_dataTable.inArray2Ptr)), (byte)1 }); Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int64>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned)); var result = typeof(Avx2).GetMethod(nameof(Avx2.InsertVector128), new Type[] { typeof(Vector256<Int64>), typeof(Vector128<Int64>), typeof(byte) }) .Invoke(null, new object[] { Avx.LoadAlignedVector256((Int64*)(_dataTable.inArray1Ptr)), LoadAlignedVector128((Int64*)(_dataTable.inArray2Ptr)), (byte)1 }); Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int64>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = Avx2.InsertVector128( _clsVar1, _clsVar2, 1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var left = Unsafe.Read<Vector256<Int64>>(_dataTable.inArray1Ptr); var right = Unsafe.Read<Vector128<Int64>>(_dataTable.inArray2Ptr); var result = Avx2.InsertVector128(left, right, 1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(left, right, _dataTable.outArrayPtr); } public void RunLclVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load)); var left = Avx.LoadVector256((Int64*)(_dataTable.inArray1Ptr)); var right = LoadVector128((Int64*)(_dataTable.inArray2Ptr)); var result = Avx2.InsertVector128(left, right, 1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(left, right, _dataTable.outArrayPtr); } public void RunLclVarScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned)); var left = Avx.LoadAlignedVector256((Int64*)(_dataTable.inArray1Ptr)); var right = LoadAlignedVector128((Int64*)(_dataTable.inArray2Ptr)); var result = Avx2.InsertVector128(left, right, 1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(left, right, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new InsertVector128Test__InsertVector128Int641(); var result = Avx2.InsertVector128(test._fld1, test._fld2, 1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = Avx2.InsertVector128(_fld1, _fld2, 1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = Avx2.InsertVector128(test._fld1, test._fld2, 1); 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 RunUnsupportedScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario)); bool succeeded = false; try { RunBasicScenario_UnsafeRead(); } catch (PlatformNotSupportedException) { succeeded = true; } if (!succeeded) { Succeeded = false; } } private void ValidateResult(Vector256<Int64> left, Vector128<Int64> right, void* result, [CallerMemberName] string method = "") { Int64[] inArray1 = new Int64[Op1ElementCount]; Int64[] inArray2 = new Int64[Op2ElementCount]; Int64[] outArray = new Int64[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), left); Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), right); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(void* left, void* right, void* result, [CallerMemberName] string method = "") { Int64[] inArray1 = new Int64[Op1ElementCount]; Int64[] inArray2 = new Int64[Op2ElementCount]; Int64[] outArray = new Int64[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int64>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int64>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(Int64[] left, Int64[] right, Int64[] result, [CallerMemberName] string method = "") { bool succeeded = true; if (result[0] != left[0]) { succeeded = false; } else { for (var i = 1; i < RetElementCount; i++) { if ((i > 1 ? result[i] != right[i - 2] : result[i] != left[i])) { succeeded = false; break; } } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(Avx2)}.{nameof(Avx2.InsertVector128)}<Int64>(Vector256<Int64>, Vector128<Int64>.1): {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; using System.Runtime.Intrinsics.X86; using static System.Runtime.Intrinsics.X86.Sse; using static System.Runtime.Intrinsics.X86.Sse2; namespace JIT.HardwareIntrinsics.X86 { public static partial class Program { private static void InsertVector128Int641() { var test = new InsertVector128Test__InsertVector128Int641(); if (test.IsSupported) { // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); if (Avx.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 (Avx.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(); // Validates passing a local works, using Unsafe.Read test.RunLclVarScenario_UnsafeRead(); if (Avx.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(); // 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(); } 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 InsertVector128Test__InsertVector128Int641 { private struct TestStruct { public Vector256<Int64> _fld1; public Vector128<Int64> _fld2; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt64(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref testStruct._fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt64(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref testStruct._fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>()); return testStruct; } public void RunStructFldScenario(InsertVector128Test__InsertVector128Int641 testClass) { var result = Avx2.InsertVector128(_fld1, _fld2, 1); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } } private static readonly int LargestVectorSize = 32; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int64>>() / sizeof(Int64); private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Int64>>() / sizeof(Int64); private static Int64[] _data1 = new Int64[Op1ElementCount]; private static Int64[] _data2 = new Int64[Op2ElementCount]; private static Vector256<Int64> _clsVar1; private static Vector128<Int64> _clsVar2; private Vector256<Int64> _fld1; private Vector128<Int64> _fld2; private SimpleBinaryOpTest__DataTable<Int64, Int64, Int64> _dataTable; static InsertVector128Test__InsertVector128Int641() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt64(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _clsVar1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt64(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _clsVar2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>()); } public InsertVector128Test__InsertVector128Int641() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt64(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Int64>, byte>(ref _fld1), ref Unsafe.As<Int64, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Int64>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt64(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int64>, byte>(ref _fld2), ref Unsafe.As<Int64, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int64>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt64(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt64(); } _dataTable = new SimpleBinaryOpTest__DataTable<Int64, Int64, Int64>(_data1, _data2, new Int64[RetElementCount], LargestVectorSize); } public bool IsSupported => Avx2.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = Avx2.InsertVector128( Unsafe.Read<Vector256<Int64>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<Int64>>(_dataTable.inArray2Ptr), 1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunBasicScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load)); var result = Avx2.InsertVector128( Avx.LoadVector256((Int64*)(_dataTable.inArray1Ptr)), LoadVector128((Int64*)(_dataTable.inArray2Ptr)), 1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunBasicScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned)); var result = Avx2.InsertVector128( Avx.LoadAlignedVector256((Int64*)(_dataTable.inArray1Ptr)), LoadAlignedVector128((Int64*)(_dataTable.inArray2Ptr)), 1 ); 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(Avx2).GetMethod(nameof(Avx2.InsertVector128), new Type[] { typeof(Vector256<Int64>), typeof(Vector128<Int64>), typeof(byte) }) .Invoke(null, new object[] { Unsafe.Read<Vector256<Int64>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<Int64>>(_dataTable.inArray2Ptr), (byte)1 }); Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int64>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load)); var result = typeof(Avx2).GetMethod(nameof(Avx2.InsertVector128), new Type[] { typeof(Vector256<Int64>), typeof(Vector128<Int64>), typeof(byte) }) .Invoke(null, new object[] { Avx.LoadVector256((Int64*)(_dataTable.inArray1Ptr)), LoadVector128((Int64*)(_dataTable.inArray2Ptr)), (byte)1 }); Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int64>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned)); var result = typeof(Avx2).GetMethod(nameof(Avx2.InsertVector128), new Type[] { typeof(Vector256<Int64>), typeof(Vector128<Int64>), typeof(byte) }) .Invoke(null, new object[] { Avx.LoadAlignedVector256((Int64*)(_dataTable.inArray1Ptr)), LoadAlignedVector128((Int64*)(_dataTable.inArray2Ptr)), (byte)1 }); Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Int64>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = Avx2.InsertVector128( _clsVar1, _clsVar2, 1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var left = Unsafe.Read<Vector256<Int64>>(_dataTable.inArray1Ptr); var right = Unsafe.Read<Vector128<Int64>>(_dataTable.inArray2Ptr); var result = Avx2.InsertVector128(left, right, 1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(left, right, _dataTable.outArrayPtr); } public void RunLclVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load)); var left = Avx.LoadVector256((Int64*)(_dataTable.inArray1Ptr)); var right = LoadVector128((Int64*)(_dataTable.inArray2Ptr)); var result = Avx2.InsertVector128(left, right, 1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(left, right, _dataTable.outArrayPtr); } public void RunLclVarScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned)); var left = Avx.LoadAlignedVector256((Int64*)(_dataTable.inArray1Ptr)); var right = LoadAlignedVector128((Int64*)(_dataTable.inArray2Ptr)); var result = Avx2.InsertVector128(left, right, 1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(left, right, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new InsertVector128Test__InsertVector128Int641(); var result = Avx2.InsertVector128(test._fld1, test._fld2, 1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = Avx2.InsertVector128(_fld1, _fld2, 1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = Avx2.InsertVector128(test._fld1, test._fld2, 1); 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 RunUnsupportedScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunUnsupportedScenario)); bool succeeded = false; try { RunBasicScenario_UnsafeRead(); } catch (PlatformNotSupportedException) { succeeded = true; } if (!succeeded) { Succeeded = false; } } private void ValidateResult(Vector256<Int64> left, Vector128<Int64> right, void* result, [CallerMemberName] string method = "") { Int64[] inArray1 = new Int64[Op1ElementCount]; Int64[] inArray2 = new Int64[Op2ElementCount]; Int64[] outArray = new Int64[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), left); Unsafe.WriteUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), right); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(void* left, void* right, void* result, [CallerMemberName] string method = "") { Int64[] inArray1 = new Int64[Op1ElementCount]; Int64[] inArray2 = new Int64[Op2ElementCount]; Int64[] outArray = new Int64[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector256<Int64>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<Int64>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Int64>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(Int64[] left, Int64[] right, Int64[] result, [CallerMemberName] string method = "") { bool succeeded = true; if (result[0] != left[0]) { succeeded = false; } else { for (var i = 1; i < RetElementCount; i++) { if ((i > 1 ? result[i] != right[i - 2] : result[i] != left[i])) { succeeded = false; break; } } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(Avx2)}.{nameof(Avx2.InsertVector128)}<Int64>(Vector256<Int64>, Vector128<Int64>.1): {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,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/libraries/System.IO.Packaging/src/System/IO/Packaging/PackagePartCollection.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; using System.Collections.Generic; using System.Diagnostics; namespace System.IO.Packaging { /// <summary> /// This class is used to get an enumerator for the Parts in a container. /// This is a part of the MMCF Packaging Layer APIs /// </summary> public class PackagePartCollection : IEnumerable<PackagePart> { #region Public Methods /// <summary> /// Returns an enumerator over all the Parts in the container /// </summary> /// <returns></returns> IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } /// <summary> /// Returns an enumerator over all the Parts in the container /// </summary> /// <returns></returns> IEnumerator<PackagePart> IEnumerable<PackagePart>.GetEnumerator() { return GetEnumerator(); } /// <summary> /// Returns an enumerator over all the Parts in the Container /// </summary> /// <returns></returns> public IEnumerator<PackagePart> GetEnumerator() { //The Dictionary.Values property always returns a collection, even if empty. It never returns a null. return _partList.Values.GetEnumerator(); } #endregion Public Methods #region Internal Constructor internal PackagePartCollection(SortedList<PackUriHelper.ValidatedPartUri, PackagePart> partList) { Debug.Assert(partList != null, "partDictionary parameter cannot be null"); _partList = partList; } #endregion Internal Constructor #region Private Members private readonly SortedList<PackUriHelper.ValidatedPartUri, PackagePart> _partList; #endregion Private Members } }
// 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; using System.Collections.Generic; using System.Diagnostics; namespace System.IO.Packaging { /// <summary> /// This class is used to get an enumerator for the Parts in a container. /// This is a part of the MMCF Packaging Layer APIs /// </summary> public class PackagePartCollection : IEnumerable<PackagePart> { #region Public Methods /// <summary> /// Returns an enumerator over all the Parts in the container /// </summary> /// <returns></returns> IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); } /// <summary> /// Returns an enumerator over all the Parts in the container /// </summary> /// <returns></returns> IEnumerator<PackagePart> IEnumerable<PackagePart>.GetEnumerator() { return GetEnumerator(); } /// <summary> /// Returns an enumerator over all the Parts in the Container /// </summary> /// <returns></returns> public IEnumerator<PackagePart> GetEnumerator() { //The Dictionary.Values property always returns a collection, even if empty. It never returns a null. return _partList.Values.GetEnumerator(); } #endregion Public Methods #region Internal Constructor internal PackagePartCollection(SortedList<PackUriHelper.ValidatedPartUri, PackagePart> partList) { Debug.Assert(partList != null, "partDictionary parameter cannot be null"); _partList = partList; } #endregion Internal Constructor #region Private Members private readonly SortedList<PackUriHelper.ValidatedPartUri, PackagePart> _partList; #endregion Private Members } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/coreclr/tools/Common/CommandLine/CommandLineException.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 Internal.CommandLine { internal class CommandLineException : Exception { public CommandLineException(string message) : base(message) { } } }
// 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 Internal.CommandLine { internal class CommandLineException : Exception { public CommandLineException(string message) : base(message) { } } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/libraries/System.Linq.Expressions/tests/ILReader/ILReader.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // Code adapted from https://blogs.msdn.microsoft.com/haibo_luo/2010/04/19/ilvisualizer-2010-solution using System.Collections; using System.Collections.Generic; using System.Reflection; using System.Reflection.Emit; namespace System.Linq.Expressions.Tests { public sealed class ILReader : IEnumerable<ILInstruction>, IEnumerable { private static readonly Type s_runtimeMethodInfoType = Type.GetType("System.Reflection.RuntimeMethodInfo"); private static readonly Type s_runtimeConstructorInfoType = Type.GetType("System.Reflection.RuntimeConstructorInfo"); private static readonly OpCode[] s_OneByteOpCodes; private static readonly OpCode[] s_TwoByteOpCodes; static ILReader() { s_OneByteOpCodes = new OpCode[0x100]; s_TwoByteOpCodes = new OpCode[0x100]; foreach (FieldInfo fi in typeof(OpCodes).GetFields(BindingFlags.Public | BindingFlags.Static)) { OpCode opCode = (OpCode)fi.GetValue(null); ushort value = unchecked((ushort)opCode.Value); if (value < 0x100) { s_OneByteOpCodes[value] = opCode; } else if ((value & 0xff00) == 0xfe00) { s_TwoByteOpCodes[value & 0xff] = opCode; } } } private int _position; private readonly byte[] _byteArray; public ILReader(IILProvider ilProvider, ITokenResolver tokenResolver) { if (ilProvider == null) { throw new ArgumentNullException(nameof(ilProvider)); } Resolver = tokenResolver; ILProvider = ilProvider; _byteArray = ILProvider.GetByteArray(); _position = 0; } public IILProvider ILProvider { get; } public ITokenResolver Resolver { get; } public IEnumerator<ILInstruction> GetEnumerator() { while (_position < _byteArray.Length) yield return Next(); _position = 0; yield break; } IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); private ILInstruction Next() { int offset = _position; OpCode opCode = OpCodes.Nop; int token = 0; // read first 1 or 2 bytes as opCode byte code = ReadByte(); if (code != 0xFE) { opCode = s_OneByteOpCodes[code]; } else { code = ReadByte(); opCode = s_TwoByteOpCodes[code]; } switch (opCode.OperandType) { case OperandType.InlineNone: return new InlineNoneInstruction(offset, opCode); //The operand is an 8-bit integer branch target. case OperandType.ShortInlineBrTarget: sbyte shortDelta = ReadSByte(); return new ShortInlineBrTargetInstruction(offset, opCode, shortDelta); //The operand is a 32-bit integer branch target. case OperandType.InlineBrTarget: int delta = ReadInt32(); return new InlineBrTargetInstruction(offset, opCode, delta); //The operand is an 8-bit integer: 001F ldc.i4.s, FE12 unaligned. case OperandType.ShortInlineI: sbyte int8 = ReadSByte(); return new ShortInlineIInstruction(offset, opCode, int8); //The operand is a 32-bit integer. case OperandType.InlineI: int int32 = ReadInt32(); return new InlineIInstruction(offset, opCode, int32); //The operand is a 64-bit integer. case OperandType.InlineI8: long int64 = ReadInt64(); return new InlineI8Instruction(offset, opCode, int64); //The operand is a 32-bit IEEE floating point number. case OperandType.ShortInlineR: float float32 = ReadSingle(); return new ShortInlineRInstruction(offset, opCode, float32); //The operand is a 64-bit IEEE floating point number. case OperandType.InlineR: double float64 = ReadDouble(); return new InlineRInstruction(offset, opCode, float64); //The operand is an 8-bit integer containing the ordinal of a local variable or an argument case OperandType.ShortInlineVar: byte index8 = ReadByte(); return new ShortInlineVarInstruction(offset, opCode, index8); //The operand is 16-bit integer containing the ordinal of a local variable or an argument. case OperandType.InlineVar: ushort index16 = ReadUInt16(); return new InlineVarInstruction(offset, opCode, index16); //The operand is a 32-bit metadata string token. case OperandType.InlineString: token = ReadInt32(); return new InlineStringInstruction(offset, opCode, token, Resolver); //The operand is a 32-bit metadata signature token. case OperandType.InlineSig: token = ReadInt32(); return new InlineSigInstruction(offset, opCode, token, Resolver); //The operand is a 32-bit metadata token. case OperandType.InlineMethod: token = ReadInt32(); return new InlineMethodInstruction(offset, opCode, token, Resolver); //The operand is a 32-bit metadata token. case OperandType.InlineField: token = ReadInt32(); return new InlineFieldInstruction(Resolver, offset, opCode, token); //The operand is a 32-bit metadata token. case OperandType.InlineType: token = ReadInt32(); return new InlineTypeInstruction(offset, opCode, token, Resolver); //The operand is a FieldRef, MethodRef, or TypeRef token. case OperandType.InlineTok: token = ReadInt32(); return new InlineTokInstruction(offset, opCode, token, Resolver); //The operand is the 32-bit integer argument to a switch instruction. case OperandType.InlineSwitch: int cases = ReadInt32(); int[] deltas = new int[cases]; for (int i = 0; i < cases; i++) deltas[i] = ReadInt32(); return new InlineSwitchInstruction(offset, opCode, deltas); default: throw new BadImageFormatException("unexpected OperandType " + opCode.OperandType); } } public void Accept(ILInstructionVisitor visitor) { if (visitor == null) throw new ArgumentNullException("argument 'visitor' can not be null"); foreach (ILInstruction instruction in this) { instruction.Accept(visitor); } } private byte ReadByte() => _byteArray[_position++]; private sbyte ReadSByte() => (sbyte)ReadByte(); private ushort ReadUInt16() { int pos = _position; _position += 2; return BitConverter.ToUInt16(_byteArray, pos); } private uint ReadUInt32() { int pos = _position; _position += 4; return BitConverter.ToUInt32(_byteArray, pos); } private ulong ReadUInt64() { int pos = _position; _position += 8; return BitConverter.ToUInt64(_byteArray, pos); } private int ReadInt32() { int pos = _position; _position += 4; return BitConverter.ToInt32(_byteArray, pos); } private long ReadInt64() { int pos = _position; _position += 8; return BitConverter.ToInt64(_byteArray, pos); } private float ReadSingle() { int pos = _position; _position += 4; return BitConverter.ToSingle(_byteArray, pos); } private double ReadDouble() { int pos = _position; _position += 8; return BitConverter.ToDouble(_byteArray, pos); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // Code adapted from https://blogs.msdn.microsoft.com/haibo_luo/2010/04/19/ilvisualizer-2010-solution using System.Collections; using System.Collections.Generic; using System.Reflection; using System.Reflection.Emit; namespace System.Linq.Expressions.Tests { public sealed class ILReader : IEnumerable<ILInstruction>, IEnumerable { private static readonly Type s_runtimeMethodInfoType = Type.GetType("System.Reflection.RuntimeMethodInfo"); private static readonly Type s_runtimeConstructorInfoType = Type.GetType("System.Reflection.RuntimeConstructorInfo"); private static readonly OpCode[] s_OneByteOpCodes; private static readonly OpCode[] s_TwoByteOpCodes; static ILReader() { s_OneByteOpCodes = new OpCode[0x100]; s_TwoByteOpCodes = new OpCode[0x100]; foreach (FieldInfo fi in typeof(OpCodes).GetFields(BindingFlags.Public | BindingFlags.Static)) { OpCode opCode = (OpCode)fi.GetValue(null); ushort value = unchecked((ushort)opCode.Value); if (value < 0x100) { s_OneByteOpCodes[value] = opCode; } else if ((value & 0xff00) == 0xfe00) { s_TwoByteOpCodes[value & 0xff] = opCode; } } } private int _position; private readonly byte[] _byteArray; public ILReader(IILProvider ilProvider, ITokenResolver tokenResolver) { if (ilProvider == null) { throw new ArgumentNullException(nameof(ilProvider)); } Resolver = tokenResolver; ILProvider = ilProvider; _byteArray = ILProvider.GetByteArray(); _position = 0; } public IILProvider ILProvider { get; } public ITokenResolver Resolver { get; } public IEnumerator<ILInstruction> GetEnumerator() { while (_position < _byteArray.Length) yield return Next(); _position = 0; yield break; } IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); private ILInstruction Next() { int offset = _position; OpCode opCode = OpCodes.Nop; int token = 0; // read first 1 or 2 bytes as opCode byte code = ReadByte(); if (code != 0xFE) { opCode = s_OneByteOpCodes[code]; } else { code = ReadByte(); opCode = s_TwoByteOpCodes[code]; } switch (opCode.OperandType) { case OperandType.InlineNone: return new InlineNoneInstruction(offset, opCode); //The operand is an 8-bit integer branch target. case OperandType.ShortInlineBrTarget: sbyte shortDelta = ReadSByte(); return new ShortInlineBrTargetInstruction(offset, opCode, shortDelta); //The operand is a 32-bit integer branch target. case OperandType.InlineBrTarget: int delta = ReadInt32(); return new InlineBrTargetInstruction(offset, opCode, delta); //The operand is an 8-bit integer: 001F ldc.i4.s, FE12 unaligned. case OperandType.ShortInlineI: sbyte int8 = ReadSByte(); return new ShortInlineIInstruction(offset, opCode, int8); //The operand is a 32-bit integer. case OperandType.InlineI: int int32 = ReadInt32(); return new InlineIInstruction(offset, opCode, int32); //The operand is a 64-bit integer. case OperandType.InlineI8: long int64 = ReadInt64(); return new InlineI8Instruction(offset, opCode, int64); //The operand is a 32-bit IEEE floating point number. case OperandType.ShortInlineR: float float32 = ReadSingle(); return new ShortInlineRInstruction(offset, opCode, float32); //The operand is a 64-bit IEEE floating point number. case OperandType.InlineR: double float64 = ReadDouble(); return new InlineRInstruction(offset, opCode, float64); //The operand is an 8-bit integer containing the ordinal of a local variable or an argument case OperandType.ShortInlineVar: byte index8 = ReadByte(); return new ShortInlineVarInstruction(offset, opCode, index8); //The operand is 16-bit integer containing the ordinal of a local variable or an argument. case OperandType.InlineVar: ushort index16 = ReadUInt16(); return new InlineVarInstruction(offset, opCode, index16); //The operand is a 32-bit metadata string token. case OperandType.InlineString: token = ReadInt32(); return new InlineStringInstruction(offset, opCode, token, Resolver); //The operand is a 32-bit metadata signature token. case OperandType.InlineSig: token = ReadInt32(); return new InlineSigInstruction(offset, opCode, token, Resolver); //The operand is a 32-bit metadata token. case OperandType.InlineMethod: token = ReadInt32(); return new InlineMethodInstruction(offset, opCode, token, Resolver); //The operand is a 32-bit metadata token. case OperandType.InlineField: token = ReadInt32(); return new InlineFieldInstruction(Resolver, offset, opCode, token); //The operand is a 32-bit metadata token. case OperandType.InlineType: token = ReadInt32(); return new InlineTypeInstruction(offset, opCode, token, Resolver); //The operand is a FieldRef, MethodRef, or TypeRef token. case OperandType.InlineTok: token = ReadInt32(); return new InlineTokInstruction(offset, opCode, token, Resolver); //The operand is the 32-bit integer argument to a switch instruction. case OperandType.InlineSwitch: int cases = ReadInt32(); int[] deltas = new int[cases]; for (int i = 0; i < cases; i++) deltas[i] = ReadInt32(); return new InlineSwitchInstruction(offset, opCode, deltas); default: throw new BadImageFormatException("unexpected OperandType " + opCode.OperandType); } } public void Accept(ILInstructionVisitor visitor) { if (visitor == null) throw new ArgumentNullException("argument 'visitor' can not be null"); foreach (ILInstruction instruction in this) { instruction.Accept(visitor); } } private byte ReadByte() => _byteArray[_position++]; private sbyte ReadSByte() => (sbyte)ReadByte(); private ushort ReadUInt16() { int pos = _position; _position += 2; return BitConverter.ToUInt16(_byteArray, pos); } private uint ReadUInt32() { int pos = _position; _position += 4; return BitConverter.ToUInt32(_byteArray, pos); } private ulong ReadUInt64() { int pos = _position; _position += 8; return BitConverter.ToUInt64(_byteArray, pos); } private int ReadInt32() { int pos = _position; _position += 4; return BitConverter.ToInt32(_byteArray, pos); } private long ReadInt64() { int pos = _position; _position += 8; return BitConverter.ToInt64(_byteArray, pos); } private float ReadSingle() { int pos = _position; _position += 4; return BitConverter.ToSingle(_byteArray, pos); } private double ReadDouble() { int pos = _position; _position += 8; return BitConverter.ToDouble(_byteArray, pos); } } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/JIT/jit64/valuetypes/nullable/box-unbox/enum/box-unbox-enum001.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>PdbOnly</DebugType> </PropertyGroup> <ItemGroup> <Compile Include="box-unbox-enum001.cs" /> <Compile Include="..\structdef.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>PdbOnly</DebugType> </PropertyGroup> <ItemGroup> <Compile Include="box-unbox-enum001.cs" /> <Compile Include="..\structdef.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/coreclr/nativeaot/Runtime.Base/src/System/Runtime/InteropServices/CallingConvention.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.InteropServices { // Used for the CallingConvention named argument to the DllImport and UnmanagedCallersOnly attribute public enum CallingConvention { Winapi = 1, Cdecl = 2, StdCall = 3, ThisCall = 4, FastCall = 5, } }
// 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.InteropServices { // Used for the CallingConvention named argument to the DllImport and UnmanagedCallersOnly attribute public enum CallingConvention { Winapi = 1, Cdecl = 2, StdCall = 3, ThisCall = 4, FastCall = 5, } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/JIT/HardwareIntrinsics/General/Vector64/ConditionalSelect.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; namespace JIT.HardwareIntrinsics.General { public static partial class Program { private static void ConditionalSelectInt32() { var test = new VectorTernaryOpTest__ConditionalSelectInt32(); // 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 VectorTernaryOpTest__ConditionalSelectInt32 { 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 != 8) || (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 Vector64<Int32> _fld1; public Vector64<Int32> _fld2; public Vector64<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<Vector64<Int32>, byte>(ref testStruct._fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref testStruct._fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>()); for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref testStruct._fld3), ref Unsafe.As<Int32, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>()); return testStruct; } public void RunStructFldScenario(VectorTernaryOpTest__ConditionalSelectInt32 testClass) { var result = Vector64.ConditionalSelect(_fld1, _fld2, _fld3); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, _fld3, testClass._dataTable.outArrayPtr); } } private static readonly int LargestVectorSize = 8; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector64<Int32>>() / sizeof(Int32); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector64<Int32>>() / sizeof(Int32); private static readonly int Op3ElementCount = Unsafe.SizeOf<Vector64<Int32>>() / sizeof(Int32); private static readonly int RetElementCount = Unsafe.SizeOf<Vector64<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 Vector64<Int32> _clsVar1; private static Vector64<Int32> _clsVar2; private static Vector64<Int32> _clsVar3; private Vector64<Int32> _fld1; private Vector64<Int32> _fld2; private Vector64<Int32> _fld3; private DataTable _dataTable; static VectorTernaryOpTest__ConditionalSelectInt32() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>()); for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref _clsVar3), ref Unsafe.As<Int32, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>()); } public VectorTernaryOpTest__ConditionalSelectInt32() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>()); for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref _fld3), ref Unsafe.As<Int32, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector64<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] = TestLibrary.Generator.GetInt32(); } _dataTable = new DataTable(_data1, _data2, _data3, new Int32[RetElementCount], LargestVectorSize); } public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = Vector64.ConditionalSelect( Unsafe.Read<Vector64<Int32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector64<Int32>>(_dataTable.inArray2Ptr), Unsafe.Read<Vector64<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 method = typeof(Vector64).GetMethod(nameof(Vector64.ConditionalSelect), new Type[] { typeof(Vector64<Int32>), typeof(Vector64<Int32>), typeof(Vector64<Int32>) }); if (method is null) { method = typeof(Vector64).GetMethod(nameof(Vector64.ConditionalSelect), 1, new Type[] { typeof(Vector64<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), typeof(Vector64<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), typeof(Vector64<>).MakeGenericType(Type.MakeGenericMethodParameter(0)) }); } if (method.IsGenericMethodDefinition) { method = method.MakeGenericMethod(typeof(Int32)); } var result = method.Invoke(null, new object[] { Unsafe.Read<Vector64<Int32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector64<Int32>>(_dataTable.inArray2Ptr), Unsafe.Read<Vector64<Int32>>(_dataTable.inArray3Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector64<Int32>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.inArray3Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = Vector64.ConditionalSelect( _clsVar1, _clsVar2, _clsVar3 ); 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<Vector64<Int32>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector64<Int32>>(_dataTable.inArray2Ptr); var op3 = Unsafe.Read<Vector64<Int32>>(_dataTable.inArray3Ptr); var result = Vector64.ConditionalSelect(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 VectorTernaryOpTest__ConditionalSelectInt32(); var result = Vector64.ConditionalSelect(test._fld1, test._fld2, test._fld3); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, test._fld3, _dataTable.outArrayPtr); } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = Vector64.ConditionalSelect(_fld1, _fld2, _fld3); 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 = Vector64.ConditionalSelect(test._fld1, test._fld2, 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); } private void ValidateResult(Vector64<Int32> op1, Vector64<Int32> op2, Vector64<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<Vector64<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<Vector64<Int32>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector64<Int32>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray3[0]), ref Unsafe.AsRef<byte>(op3), (uint)Unsafe.SizeOf<Vector64<Int32>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<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 (result[0] != (int)((secondOp[0] & firstOp[0]) | (thirdOp[0] & ~firstOp[0]))) { succeeded = false; } else { for (var i = 1; i < RetElementCount; i++) { if (result[i] != (int)((secondOp[i] & firstOp[i]) | (thirdOp[i] & ~firstOp[i]))) { succeeded = false; break; } } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(Vector64)}.{nameof(Vector64.ConditionalSelect)}<Int32>(Vector64<Int32>, Vector64<Int32>, Vector64<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; namespace JIT.HardwareIntrinsics.General { public static partial class Program { private static void ConditionalSelectInt32() { var test = new VectorTernaryOpTest__ConditionalSelectInt32(); // 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 VectorTernaryOpTest__ConditionalSelectInt32 { 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 != 8) || (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 Vector64<Int32> _fld1; public Vector64<Int32> _fld2; public Vector64<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<Vector64<Int32>, byte>(ref testStruct._fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref testStruct._fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>()); for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref testStruct._fld3), ref Unsafe.As<Int32, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>()); return testStruct; } public void RunStructFldScenario(VectorTernaryOpTest__ConditionalSelectInt32 testClass) { var result = Vector64.ConditionalSelect(_fld1, _fld2, _fld3); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, _fld3, testClass._dataTable.outArrayPtr); } } private static readonly int LargestVectorSize = 8; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector64<Int32>>() / sizeof(Int32); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector64<Int32>>() / sizeof(Int32); private static readonly int Op3ElementCount = Unsafe.SizeOf<Vector64<Int32>>() / sizeof(Int32); private static readonly int RetElementCount = Unsafe.SizeOf<Vector64<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 Vector64<Int32> _clsVar1; private static Vector64<Int32> _clsVar2; private static Vector64<Int32> _clsVar3; private Vector64<Int32> _fld1; private Vector64<Int32> _fld2; private Vector64<Int32> _fld3; private DataTable _dataTable; static VectorTernaryOpTest__ConditionalSelectInt32() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref _clsVar1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref _clsVar2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>()); for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref _clsVar3), ref Unsafe.As<Int32, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>()); } public VectorTernaryOpTest__ConditionalSelectInt32() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref _fld1), ref Unsafe.As<Int32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref _fld2), ref Unsafe.As<Int32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<Int32>>()); for (var i = 0; i < Op3ElementCount; i++) { _data3[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<Int32>, byte>(ref _fld3), ref Unsafe.As<Int32, byte>(ref _data3[0]), (uint)Unsafe.SizeOf<Vector64<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] = TestLibrary.Generator.GetInt32(); } _dataTable = new DataTable(_data1, _data2, _data3, new Int32[RetElementCount], LargestVectorSize); } public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = Vector64.ConditionalSelect( Unsafe.Read<Vector64<Int32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector64<Int32>>(_dataTable.inArray2Ptr), Unsafe.Read<Vector64<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 method = typeof(Vector64).GetMethod(nameof(Vector64.ConditionalSelect), new Type[] { typeof(Vector64<Int32>), typeof(Vector64<Int32>), typeof(Vector64<Int32>) }); if (method is null) { method = typeof(Vector64).GetMethod(nameof(Vector64.ConditionalSelect), 1, new Type[] { typeof(Vector64<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), typeof(Vector64<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), typeof(Vector64<>).MakeGenericType(Type.MakeGenericMethodParameter(0)) }); } if (method.IsGenericMethodDefinition) { method = method.MakeGenericMethod(typeof(Int32)); } var result = method.Invoke(null, new object[] { Unsafe.Read<Vector64<Int32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector64<Int32>>(_dataTable.inArray2Ptr), Unsafe.Read<Vector64<Int32>>(_dataTable.inArray3Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector64<Int32>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.inArray3Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = Vector64.ConditionalSelect( _clsVar1, _clsVar2, _clsVar3 ); 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<Vector64<Int32>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector64<Int32>>(_dataTable.inArray2Ptr); var op3 = Unsafe.Read<Vector64<Int32>>(_dataTable.inArray3Ptr); var result = Vector64.ConditionalSelect(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 VectorTernaryOpTest__ConditionalSelectInt32(); var result = Vector64.ConditionalSelect(test._fld1, test._fld2, test._fld3); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, test._fld3, _dataTable.outArrayPtr); } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = Vector64.ConditionalSelect(_fld1, _fld2, _fld3); 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 = Vector64.ConditionalSelect(test._fld1, test._fld2, 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); } private void ValidateResult(Vector64<Int32> op1, Vector64<Int32> op2, Vector64<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<Vector64<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<Vector64<Int32>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector64<Int32>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray3[0]), ref Unsafe.AsRef<byte>(op3), (uint)Unsafe.SizeOf<Vector64<Int32>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<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 (result[0] != (int)((secondOp[0] & firstOp[0]) | (thirdOp[0] & ~firstOp[0]))) { succeeded = false; } else { for (var i = 1; i < RetElementCount; i++) { if (result[i] != (int)((secondOp[i] & firstOp[i]) | (thirdOp[i] & ~firstOp[i]))) { succeeded = false; break; } } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(Vector64)}.{nameof(Vector64.ConditionalSelect)}<Int32>(Vector64<Int32>, Vector64<Int32>, Vector64<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,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/CollectionsMarshal.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; namespace System.Runtime.InteropServices { /// <summary> /// An unsafe class that provides a set of methods to access the underlying data representations of collections. /// </summary> public static class CollectionsMarshal { /// <summary> /// Get a <see cref="Span{T}"/> view over a <see cref="List{T}"/>'s data. /// Items should not be added or removed from the <see cref="List{T}"/> while the <see cref="Span{T}"/> is in use. /// </summary> /// <param name="list">The list to get the data view over.</param> public static Span<T> AsSpan<T>(List<T>? list) => list is null ? default : new Span<T>(list._items, 0, list._size); /// <summary> /// Gets either a ref to a <typeparamref name="TValue"/> in the <see cref="Dictionary{TKey, TValue}"/> or a ref null if it does not exist in the <paramref name="dictionary"/>. /// </summary> /// <param name="dictionary">The dictionary to get the ref to <typeparamref name="TValue"/> from.</param> /// <param name="key">The key used for lookup.</param> /// <remarks> /// Items should not be added or removed from the <see cref="Dictionary{TKey, TValue}"/> while the ref <typeparamref name="TValue"/> is in use. /// The ref null can be detected using System.Runtime.CompilerServices.Unsafe.IsNullRef /// </remarks> public static ref TValue GetValueRefOrNullRef<TKey, TValue>(Dictionary<TKey, TValue> dictionary, TKey key) where TKey : notnull => ref dictionary.FindValue(key); /// <summary> /// Gets a ref to a <typeparamref name="TValue"/> in the <see cref="Dictionary{TKey, TValue}"/>, adding a new entry with a default value if it does not exist in the <paramref name="dictionary"/>. /// </summary> /// <param name="dictionary">The dictionary to get the ref to <typeparamref name="TValue"/> from.</param> /// <param name="key">The key used for lookup.</param> /// <param name="exists">Whether or not a new entry for the given key was added to the dictionary.</param> /// <remarks>Items should not be added to or removed from the <see cref="Dictionary{TKey, TValue}"/> while the ref <typeparamref name="TValue"/> is in use.</remarks> public static ref TValue? GetValueRefOrAddDefault<TKey, TValue>(Dictionary<TKey, TValue> dictionary, TKey key, out bool exists) where TKey : notnull => ref Dictionary<TKey, TValue>.CollectionsMarshalHelper.GetValueRefOrAddDefault(dictionary, key, out exists); } }
// 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; namespace System.Runtime.InteropServices { /// <summary> /// An unsafe class that provides a set of methods to access the underlying data representations of collections. /// </summary> public static class CollectionsMarshal { /// <summary> /// Get a <see cref="Span{T}"/> view over a <see cref="List{T}"/>'s data. /// Items should not be added or removed from the <see cref="List{T}"/> while the <see cref="Span{T}"/> is in use. /// </summary> /// <param name="list">The list to get the data view over.</param> public static Span<T> AsSpan<T>(List<T>? list) => list is null ? default : new Span<T>(list._items, 0, list._size); /// <summary> /// Gets either a ref to a <typeparamref name="TValue"/> in the <see cref="Dictionary{TKey, TValue}"/> or a ref null if it does not exist in the <paramref name="dictionary"/>. /// </summary> /// <param name="dictionary">The dictionary to get the ref to <typeparamref name="TValue"/> from.</param> /// <param name="key">The key used for lookup.</param> /// <remarks> /// Items should not be added or removed from the <see cref="Dictionary{TKey, TValue}"/> while the ref <typeparamref name="TValue"/> is in use. /// The ref null can be detected using System.Runtime.CompilerServices.Unsafe.IsNullRef /// </remarks> public static ref TValue GetValueRefOrNullRef<TKey, TValue>(Dictionary<TKey, TValue> dictionary, TKey key) where TKey : notnull => ref dictionary.FindValue(key); /// <summary> /// Gets a ref to a <typeparamref name="TValue"/> in the <see cref="Dictionary{TKey, TValue}"/>, adding a new entry with a default value if it does not exist in the <paramref name="dictionary"/>. /// </summary> /// <param name="dictionary">The dictionary to get the ref to <typeparamref name="TValue"/> from.</param> /// <param name="key">The key used for lookup.</param> /// <param name="exists">Whether or not a new entry for the given key was added to the dictionary.</param> /// <remarks>Items should not be added to or removed from the <see cref="Dictionary{TKey, TValue}"/> while the ref <typeparamref name="TValue"/> is in use.</remarks> public static ref TValue? GetValueRefOrAddDefault<TKey, TValue>(Dictionary<TKey, TValue> dictionary, TKey key, out bool exists) where TKey : notnull => ref Dictionary<TKey, TValue>.CollectionsMarshalHelper.GetValueRefOrAddDefault(dictionary, key, out exists); } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/mono/mono/tests/threadpool-in-processexit.cs
using System; using System.Threading; class Program { static AutoResetEvent mre = new AutoResetEvent(false); static void Main () { AppDomain.CurrentDomain.ProcessExit += SomeEndOfProcessAction; } static void SomeEndOfProcessAction(object sender, EventArgs args) { ThreadPool.QueueUserWorkItem (new WaitCallback (ThreadPoolCallback)); if (mre.WaitOne(1000)) Console.WriteLine ("PASS"); else Console.WriteLine ("FAIL"); } static void ThreadPoolCallback (object state) { mre.Set (); } }
using System; using System.Threading; class Program { static AutoResetEvent mre = new AutoResetEvent(false); static void Main () { AppDomain.CurrentDomain.ProcessExit += SomeEndOfProcessAction; } static void SomeEndOfProcessAction(object sender, EventArgs args) { ThreadPool.QueueUserWorkItem (new WaitCallback (ThreadPoolCallback)); if (mre.WaitOne(1000)) Console.WriteLine ("PASS"); else Console.WriteLine ("FAIL"); } static void ThreadPoolCallback (object state) { mre.Set (); } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/Http2StreamWindowManager.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.Threading; using System.Threading.Tasks; namespace System.Net.Http { internal sealed partial class Http2Connection { // Maintains a dynamically-sized stream receive window, and sends WINDOW_UPDATE frames to the server. private struct Http2StreamWindowManager { private static readonly double StopWatchToTimesSpan = TimeSpan.TicksPerSecond / (double)Stopwatch.Frequency; private static double WindowScaleThresholdMultiplier => GlobalHttpSettings.SocketsHttpHandler.Http2StreamWindowScaleThresholdMultiplier; private static int MaxStreamWindowSize => GlobalHttpSettings.SocketsHttpHandler.MaxHttp2StreamWindowSize; private static bool WindowScalingEnabled => !GlobalHttpSettings.SocketsHttpHandler.DisableDynamicHttp2WindowSizing; private int _deliveredBytes; private int _streamWindowSize; private long _lastWindowUpdate; public Http2StreamWindowManager(Http2Connection connection, Http2Stream stream) { HttpConnectionSettings settings = connection._pool.Settings; _streamWindowSize = settings._initialHttp2StreamWindowSize; _deliveredBytes = 0; _lastWindowUpdate = default; if (NetEventSource.Log.IsEnabled()) stream.Trace($"[FlowControl] InitialClientStreamWindowSize: {StreamWindowSize}, StreamWindowThreshold: {StreamWindowThreshold}, WindowScaleThresholdMultiplier: {WindowScaleThresholdMultiplier}"); } // We hold off on sending WINDOW_UPDATE until we hit the minimum threshold. // This value is somewhat arbitrary; the intent is to ensure it is much smaller than // the window size itself, or we risk stalling the server because it runs out of window space. public const int StreamWindowUpdateRatio = 8; internal int StreamWindowThreshold => _streamWindowSize / StreamWindowUpdateRatio; internal int StreamWindowSize => _streamWindowSize; public void Start() { _lastWindowUpdate = Stopwatch.GetTimestamp(); } public void AdjustWindow(int bytesConsumed, Http2Stream stream) { Debug.Assert(_lastWindowUpdate != default); // Make sure Start() has been invoked, otherwise we should not be receiving DATA. Debug.Assert(bytesConsumed > 0); Debug.Assert(_deliveredBytes < StreamWindowThreshold); if (!stream.ExpectResponseData) { // We are not expecting any more data (because we've either completed or aborted). // So no need to send any more WINDOW_UPDATEs. return; } if (WindowScalingEnabled) { AdjustWindowDynamic(bytesConsumed, stream); } else { AjdustWindowStatic(bytesConsumed, stream); } } private void AjdustWindowStatic(int bytesConsumed, Http2Stream stream) { _deliveredBytes += bytesConsumed; if (_deliveredBytes < StreamWindowThreshold) { return; } int windowUpdateIncrement = _deliveredBytes; _deliveredBytes = 0; Http2Connection connection = stream.Connection; Task sendWindowUpdateTask = connection.SendWindowUpdateAsync(stream.StreamId, windowUpdateIncrement); connection.LogExceptions(sendWindowUpdateTask); } private void AdjustWindowDynamic(int bytesConsumed, Http2Stream stream) { _deliveredBytes += bytesConsumed; if (_deliveredBytes < StreamWindowThreshold) { return; } int windowUpdateIncrement = _deliveredBytes; long currentTime = Stopwatch.GetTimestamp(); Http2Connection connection = stream.Connection; TimeSpan rtt = connection._rttEstimator.MinRtt; if (rtt > TimeSpan.Zero && _streamWindowSize < MaxStreamWindowSize) { TimeSpan dt = StopwatchTicksToTimeSpan(currentTime - _lastWindowUpdate); // We are detecting bursts in the amount of data consumed within a single 'dt' window update period. // The value "_deliveredBytes / dt" correlates with the bandwidth of the connection. // We need to extend the window, if the bandwidth-delay product grows over the current window size. // To enable empirical fine tuning, we apply a configurable multiplier (_windowScaleThresholdMultiplier) to the window size, which defaults to 1.0 // // The condition to extend the window is: // (_deliveredBytes / dt) * rtt > _streamWindowSize * _windowScaleThresholdMultiplier // // Which is reordered into the form below, to avoid the division: if (_deliveredBytes * (double)rtt.Ticks > _streamWindowSize * dt.Ticks * WindowScaleThresholdMultiplier) { int extendedWindowSize = Math.Min(MaxStreamWindowSize, _streamWindowSize * 2); windowUpdateIncrement += extendedWindowSize - _streamWindowSize; _streamWindowSize = extendedWindowSize; if (NetEventSource.Log.IsEnabled()) stream.Trace($"[FlowControl] Updated Stream Window. StreamWindowSize: {StreamWindowSize}, StreamWindowThreshold: {StreamWindowThreshold}"); Debug.Assert(_streamWindowSize <= MaxStreamWindowSize); if (_streamWindowSize == MaxStreamWindowSize) { if (NetEventSource.Log.IsEnabled()) stream.Trace($"[FlowControl] StreamWindowSize reached the configured maximum of {MaxStreamWindowSize}."); } } } _deliveredBytes = 0; Task sendWindowUpdateTask = connection.SendWindowUpdateAsync(stream.StreamId, windowUpdateIncrement); connection.LogExceptions(sendWindowUpdateTask); _lastWindowUpdate = currentTime; } private static TimeSpan StopwatchTicksToTimeSpan(long stopwatchTicks) { long ticks = (long)(StopWatchToTimesSpan * stopwatchTicks); return new TimeSpan(ticks); } } // Estimates Round Trip Time between the client and the server by sending PING frames, and measuring the time interval until a PING ACK is received. // Assuming that the network characteristics of the connection wouldn't change much within its lifetime, we are maintaining a running minimum value. // The more PINGs we send, the more accurate is the estimation of MinRtt, however we should be careful not to send too many of them, // to avoid triggering the server's PING flood protection which may result in an unexpected GOAWAY. // With most servers we are fine to send PINGs, as long as we are reading their data, this rule is well formalized for gRPC: // https://github.com/grpc/proposal/blob/master/A8-client-side-keepalive.md // As a rule of thumb, we can send send a PING whenever we receive DATA or HEADERS, however, there are some servers which allow receiving only // a limited amount of PINGs within a given timeframe. // To deal with the conflicting requirements: // - We send an initial burst of 'InitialBurstCount' PINGs, to get a relatively good estimation fast // - Afterwards, we send PINGs with the maximum frequency of 'PingIntervalInSeconds' PINGs per second // // Threading: // OnInitialSettingsSent() is called during initialization, all other methods are triggered by HttpConnection.ProcessIncomingFramesAsync(), // therefore the assumption is that the invocation of RttEstimator's methods is sequential, and there is no race beetween them. // Http2StreamWindowManager is reading MinRtt from another concurrent thread, therefore its value has to be changed atomically. private struct RttEstimator { private enum State { Disabled, Init, Waiting, PingSent, TerminatingMayReceivePingAck } private const double PingIntervalInSeconds = 2; private const int InitialBurstCount = 4; private static readonly long PingIntervalInTicks = (long)(PingIntervalInSeconds * Stopwatch.Frequency); private State _state; private long _pingSentTimestamp; private long _pingCounter; private int _initialBurst; private long _minRtt; public TimeSpan MinRtt => new TimeSpan(_minRtt); public static RttEstimator Create() { RttEstimator e = default; e._state = GlobalHttpSettings.SocketsHttpHandler.DisableDynamicHttp2WindowSizing ? State.Disabled : State.Init; e._initialBurst = InitialBurstCount; return e; } internal void OnInitialSettingsSent() { if (_state == State.Disabled) return; _pingSentTimestamp = Stopwatch.GetTimestamp(); } internal void OnInitialSettingsAckReceived(Http2Connection connection) { if (_state == State.Disabled) return; RefreshRtt(connection); _state = State.Waiting; } internal void OnDataOrHeadersReceived(Http2Connection connection) { if (_state != State.Waiting) return; long now = Stopwatch.GetTimestamp(); bool initial = _initialBurst > 0; if (initial || now - _pingSentTimestamp > PingIntervalInTicks) { if (initial) _initialBurst--; // Send a PING _pingCounter--; if (NetEventSource.Log.IsEnabled()) connection.Trace($"[FlowControl] Sending RTT PING with payload {_pingCounter}"); connection.LogExceptions(connection.SendPingAsync(_pingCounter, isAck: false)); _pingSentTimestamp = now; _state = State.PingSent; } } internal void OnPingAckReceived(long payload, Http2Connection connection) { if (_state != State.PingSent && _state != State.TerminatingMayReceivePingAck) { if (NetEventSource.Log.IsEnabled()) connection.Trace($"[FlowControl] Unexpected PING ACK in state {_state}"); ThrowProtocolError(); } if (_state == State.TerminatingMayReceivePingAck) { _state = State.Disabled; return; } // RTT PINGs always carry negative payload, positive values indicate a response to KeepAlive PING. Debug.Assert(payload < 0); if (_pingCounter != payload) { if (NetEventSource.Log.IsEnabled()) connection.Trace($"[FlowControl] Unexpected RTT PING ACK payload {payload}, should be {_pingCounter}."); ThrowProtocolError(); } RefreshRtt(connection); _state = State.Waiting; } internal void OnGoAwayReceived() { if (_state == State.PingSent) { // We may still receive a PING ACK, but we should not send anymore PING: _state = State.TerminatingMayReceivePingAck; } else { _state = State.Disabled; } } private void RefreshRtt(Http2Connection connection) { long elapsedTicks = Stopwatch.GetTimestamp() - _pingSentTimestamp; long prevRtt = _minRtt == 0 ? long.MaxValue : _minRtt; TimeSpan currentRtt = TimeSpan.FromSeconds(elapsedTicks / (double)Stopwatch.Frequency); long minRtt = Math.Min(prevRtt, currentRtt.Ticks); Interlocked.Exchange(ref _minRtt, minRtt); // MinRtt is being queried from another thread if (NetEventSource.Log.IsEnabled()) connection.Trace($"[FlowControl] Updated MinRtt: {MinRtt.TotalMilliseconds} ms"); } } } }
// 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.Threading; using System.Threading.Tasks; namespace System.Net.Http { internal sealed partial class Http2Connection { // Maintains a dynamically-sized stream receive window, and sends WINDOW_UPDATE frames to the server. private struct Http2StreamWindowManager { private static readonly double StopWatchToTimesSpan = TimeSpan.TicksPerSecond / (double)Stopwatch.Frequency; private static double WindowScaleThresholdMultiplier => GlobalHttpSettings.SocketsHttpHandler.Http2StreamWindowScaleThresholdMultiplier; private static int MaxStreamWindowSize => GlobalHttpSettings.SocketsHttpHandler.MaxHttp2StreamWindowSize; private static bool WindowScalingEnabled => !GlobalHttpSettings.SocketsHttpHandler.DisableDynamicHttp2WindowSizing; private int _deliveredBytes; private int _streamWindowSize; private long _lastWindowUpdate; public Http2StreamWindowManager(Http2Connection connection, Http2Stream stream) { HttpConnectionSettings settings = connection._pool.Settings; _streamWindowSize = settings._initialHttp2StreamWindowSize; _deliveredBytes = 0; _lastWindowUpdate = default; if (NetEventSource.Log.IsEnabled()) stream.Trace($"[FlowControl] InitialClientStreamWindowSize: {StreamWindowSize}, StreamWindowThreshold: {StreamWindowThreshold}, WindowScaleThresholdMultiplier: {WindowScaleThresholdMultiplier}"); } // We hold off on sending WINDOW_UPDATE until we hit the minimum threshold. // This value is somewhat arbitrary; the intent is to ensure it is much smaller than // the window size itself, or we risk stalling the server because it runs out of window space. public const int StreamWindowUpdateRatio = 8; internal int StreamWindowThreshold => _streamWindowSize / StreamWindowUpdateRatio; internal int StreamWindowSize => _streamWindowSize; public void Start() { _lastWindowUpdate = Stopwatch.GetTimestamp(); } public void AdjustWindow(int bytesConsumed, Http2Stream stream) { Debug.Assert(_lastWindowUpdate != default); // Make sure Start() has been invoked, otherwise we should not be receiving DATA. Debug.Assert(bytesConsumed > 0); Debug.Assert(_deliveredBytes < StreamWindowThreshold); if (!stream.ExpectResponseData) { // We are not expecting any more data (because we've either completed or aborted). // So no need to send any more WINDOW_UPDATEs. return; } if (WindowScalingEnabled) { AdjustWindowDynamic(bytesConsumed, stream); } else { AjdustWindowStatic(bytesConsumed, stream); } } private void AjdustWindowStatic(int bytesConsumed, Http2Stream stream) { _deliveredBytes += bytesConsumed; if (_deliveredBytes < StreamWindowThreshold) { return; } int windowUpdateIncrement = _deliveredBytes; _deliveredBytes = 0; Http2Connection connection = stream.Connection; Task sendWindowUpdateTask = connection.SendWindowUpdateAsync(stream.StreamId, windowUpdateIncrement); connection.LogExceptions(sendWindowUpdateTask); } private void AdjustWindowDynamic(int bytesConsumed, Http2Stream stream) { _deliveredBytes += bytesConsumed; if (_deliveredBytes < StreamWindowThreshold) { return; } int windowUpdateIncrement = _deliveredBytes; long currentTime = Stopwatch.GetTimestamp(); Http2Connection connection = stream.Connection; TimeSpan rtt = connection._rttEstimator.MinRtt; if (rtt > TimeSpan.Zero && _streamWindowSize < MaxStreamWindowSize) { TimeSpan dt = StopwatchTicksToTimeSpan(currentTime - _lastWindowUpdate); // We are detecting bursts in the amount of data consumed within a single 'dt' window update period. // The value "_deliveredBytes / dt" correlates with the bandwidth of the connection. // We need to extend the window, if the bandwidth-delay product grows over the current window size. // To enable empirical fine tuning, we apply a configurable multiplier (_windowScaleThresholdMultiplier) to the window size, which defaults to 1.0 // // The condition to extend the window is: // (_deliveredBytes / dt) * rtt > _streamWindowSize * _windowScaleThresholdMultiplier // // Which is reordered into the form below, to avoid the division: if (_deliveredBytes * (double)rtt.Ticks > _streamWindowSize * dt.Ticks * WindowScaleThresholdMultiplier) { int extendedWindowSize = Math.Min(MaxStreamWindowSize, _streamWindowSize * 2); windowUpdateIncrement += extendedWindowSize - _streamWindowSize; _streamWindowSize = extendedWindowSize; if (NetEventSource.Log.IsEnabled()) stream.Trace($"[FlowControl] Updated Stream Window. StreamWindowSize: {StreamWindowSize}, StreamWindowThreshold: {StreamWindowThreshold}"); Debug.Assert(_streamWindowSize <= MaxStreamWindowSize); if (_streamWindowSize == MaxStreamWindowSize) { if (NetEventSource.Log.IsEnabled()) stream.Trace($"[FlowControl] StreamWindowSize reached the configured maximum of {MaxStreamWindowSize}."); } } } _deliveredBytes = 0; Task sendWindowUpdateTask = connection.SendWindowUpdateAsync(stream.StreamId, windowUpdateIncrement); connection.LogExceptions(sendWindowUpdateTask); _lastWindowUpdate = currentTime; } private static TimeSpan StopwatchTicksToTimeSpan(long stopwatchTicks) { long ticks = (long)(StopWatchToTimesSpan * stopwatchTicks); return new TimeSpan(ticks); } } // Estimates Round Trip Time between the client and the server by sending PING frames, and measuring the time interval until a PING ACK is received. // Assuming that the network characteristics of the connection wouldn't change much within its lifetime, we are maintaining a running minimum value. // The more PINGs we send, the more accurate is the estimation of MinRtt, however we should be careful not to send too many of them, // to avoid triggering the server's PING flood protection which may result in an unexpected GOAWAY. // With most servers we are fine to send PINGs, as long as we are reading their data, this rule is well formalized for gRPC: // https://github.com/grpc/proposal/blob/master/A8-client-side-keepalive.md // As a rule of thumb, we can send send a PING whenever we receive DATA or HEADERS, however, there are some servers which allow receiving only // a limited amount of PINGs within a given timeframe. // To deal with the conflicting requirements: // - We send an initial burst of 'InitialBurstCount' PINGs, to get a relatively good estimation fast // - Afterwards, we send PINGs with the maximum frequency of 'PingIntervalInSeconds' PINGs per second // // Threading: // OnInitialSettingsSent() is called during initialization, all other methods are triggered by HttpConnection.ProcessIncomingFramesAsync(), // therefore the assumption is that the invocation of RttEstimator's methods is sequential, and there is no race beetween them. // Http2StreamWindowManager is reading MinRtt from another concurrent thread, therefore its value has to be changed atomically. private struct RttEstimator { private enum State { Disabled, Init, Waiting, PingSent, TerminatingMayReceivePingAck } private const double PingIntervalInSeconds = 2; private const int InitialBurstCount = 4; private static readonly long PingIntervalInTicks = (long)(PingIntervalInSeconds * Stopwatch.Frequency); private State _state; private long _pingSentTimestamp; private long _pingCounter; private int _initialBurst; private long _minRtt; public TimeSpan MinRtt => new TimeSpan(_minRtt); public static RttEstimator Create() { RttEstimator e = default; e._state = GlobalHttpSettings.SocketsHttpHandler.DisableDynamicHttp2WindowSizing ? State.Disabled : State.Init; e._initialBurst = InitialBurstCount; return e; } internal void OnInitialSettingsSent() { if (_state == State.Disabled) return; _pingSentTimestamp = Stopwatch.GetTimestamp(); } internal void OnInitialSettingsAckReceived(Http2Connection connection) { if (_state == State.Disabled) return; RefreshRtt(connection); _state = State.Waiting; } internal void OnDataOrHeadersReceived(Http2Connection connection) { if (_state != State.Waiting) return; long now = Stopwatch.GetTimestamp(); bool initial = _initialBurst > 0; if (initial || now - _pingSentTimestamp > PingIntervalInTicks) { if (initial) _initialBurst--; // Send a PING _pingCounter--; if (NetEventSource.Log.IsEnabled()) connection.Trace($"[FlowControl] Sending RTT PING with payload {_pingCounter}"); connection.LogExceptions(connection.SendPingAsync(_pingCounter, isAck: false)); _pingSentTimestamp = now; _state = State.PingSent; } } internal void OnPingAckReceived(long payload, Http2Connection connection) { if (_state != State.PingSent && _state != State.TerminatingMayReceivePingAck) { if (NetEventSource.Log.IsEnabled()) connection.Trace($"[FlowControl] Unexpected PING ACK in state {_state}"); ThrowProtocolError(); } if (_state == State.TerminatingMayReceivePingAck) { _state = State.Disabled; return; } // RTT PINGs always carry negative payload, positive values indicate a response to KeepAlive PING. Debug.Assert(payload < 0); if (_pingCounter != payload) { if (NetEventSource.Log.IsEnabled()) connection.Trace($"[FlowControl] Unexpected RTT PING ACK payload {payload}, should be {_pingCounter}."); ThrowProtocolError(); } RefreshRtt(connection); _state = State.Waiting; } internal void OnGoAwayReceived() { if (_state == State.PingSent) { // We may still receive a PING ACK, but we should not send anymore PING: _state = State.TerminatingMayReceivePingAck; } else { _state = State.Disabled; } } private void RefreshRtt(Http2Connection connection) { long elapsedTicks = Stopwatch.GetTimestamp() - _pingSentTimestamp; long prevRtt = _minRtt == 0 ? long.MaxValue : _minRtt; TimeSpan currentRtt = TimeSpan.FromSeconds(elapsedTicks / (double)Stopwatch.Frequency); long minRtt = Math.Min(prevRtt, currentRtt.Ticks); Interlocked.Exchange(ref _minRtt, minRtt); // MinRtt is being queried from another thread if (NetEventSource.Log.IsEnabled()) connection.Trace($"[FlowControl] Updated MinRtt: {MinRtt.TotalMilliseconds} ms"); } } } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/libraries/System.Data.OleDb/src/System/Data/Common/NameValuePair.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; namespace System.Data.Common { internal sealed class NameValuePair { private readonly string _name; private readonly string? _value; private readonly int _length; private NameValuePair? _next; internal NameValuePair(string name, string? value, int length) { Debug.Assert(!string.IsNullOrEmpty(name), "empty keyname"); _name = name; _value = value; _length = length; } internal int Length { get { Debug.Assert(0 < _length, "NameValuePair zero Length usage"); return _length; } } internal string Name => _name; internal string? Value => _value; internal NameValuePair? Next { get { return _next; } set { if ((null != _next) || (null == value)) { throw ADP.InternalError(ADP.InternalErrorCode.NameValuePairNext); } _next = value; } } } }
// 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; namespace System.Data.Common { internal sealed class NameValuePair { private readonly string _name; private readonly string? _value; private readonly int _length; private NameValuePair? _next; internal NameValuePair(string name, string? value, int length) { Debug.Assert(!string.IsNullOrEmpty(name), "empty keyname"); _name = name; _value = value; _length = length; } internal int Length { get { Debug.Assert(0 < _length, "NameValuePair zero Length usage"); return _length; } } internal string Name => _name; internal string? Value => _value; internal NameValuePair? Next { get { return _next; } set { if ((null != _next) || (null == value)) { throw ADP.InternalError(ADP.InternalErrorCode.NameValuePairNext); } _next = value; } } } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/JIT/Performance/CodeQuality/Math/Functions/Single/Atan2Single.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 Functions { public static partial class MathTests { // Tests MathF.Atan2(float, float) over 5000 iterations for the domain y: -1, +1; x: +1, -1 private const float atan2SingleDeltaX = -0.0004f; private const float atan2SingleDeltaY = 0.0004f; private const float atan2SingleExpectedResult = 3930.14282f; public static void Atan2SingleTest() { var result = 0.0f; var valueX = 1.0f; var valueY = -1.0f; for (var iteration = 0; iteration < iterations; iteration++) { valueX += atan2SingleDeltaX; valueY += atan2SingleDeltaY; result += MathF.Atan2(valueY, valueX); } var diff = MathF.Abs(atan2SingleExpectedResult - result); if (diff > singleEpsilon) { throw new Exception($"Expected Result {atan2SingleExpectedResult,10:g9}; Actual Result {result,10:g9}"); } } } }
// 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 Functions { public static partial class MathTests { // Tests MathF.Atan2(float, float) over 5000 iterations for the domain y: -1, +1; x: +1, -1 private const float atan2SingleDeltaX = -0.0004f; private const float atan2SingleDeltaY = 0.0004f; private const float atan2SingleExpectedResult = 3930.14282f; public static void Atan2SingleTest() { var result = 0.0f; var valueX = 1.0f; var valueY = -1.0f; for (var iteration = 0; iteration < iterations; iteration++) { valueX += atan2SingleDeltaX; valueY += atan2SingleDeltaY; result += MathF.Atan2(valueY, valueX); } var diff = MathF.Abs(atan2SingleExpectedResult - result); if (diff > singleEpsilon) { throw new Exception($"Expected Result {atan2SingleExpectedResult,10:g9}; Actual Result {result,10:g9}"); } } } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/libraries/System.Private.CoreLib/src/System/Globalization/Ordinal.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.Unicode; using System.Runtime.CompilerServices; namespace System.Globalization { internal static partial class Ordinal { internal static int CompareStringIgnoreCase(ref char strA, int lengthA, ref char strB, int lengthB) { int length = Math.Min(lengthA, lengthB); int range = length; ref char charA = ref strA; ref char charB = ref strB; char maxChar = (char)0x7F; while (length != 0 && charA <= maxChar && charB <= maxChar) { // Ordinal equals or lowercase equals if the result ends up in the a-z range if (charA == charB || ((charA | 0x20) == (charB | 0x20) && (uint)((charA | 0x20) - 'a') <= (uint)('z' - 'a'))) { length--; charA = ref Unsafe.Add(ref charA, 1); charB = ref Unsafe.Add(ref charB, 1); } else { int currentA = charA; int currentB = charB; // Uppercase both chars if needed if ((uint)(charA - 'a') <= 'z' - 'a') { currentA -= 0x20; } if ((uint)(charB - 'a') <= 'z' - 'a') { currentB -= 0x20; } // Return the (case-insensitive) difference between them. return currentA - currentB; } } if (length == 0) { return lengthA - lengthB; } range -= length; return CompareStringIgnoreCaseNonAscii(ref charA, lengthA - range, ref charB, lengthB - range); } internal static int CompareStringIgnoreCaseNonAscii(ref char strA, int lengthA, ref char strB, int lengthB) { if (GlobalizationMode.Invariant) { return InvariantModeCasing.CompareStringIgnoreCase(ref strA, lengthA, ref strB, lengthB); } if (GlobalizationMode.UseNls) { return CompareInfo.NlsCompareStringOrdinalIgnoreCase(ref strA, lengthA, ref strB, lengthB); } return OrdinalCasing.CompareStringIgnoreCase(ref strA, lengthA, ref strB, lengthB); } internal static bool EqualsIgnoreCase(ref char charA, ref char charB, int length) { IntPtr byteOffset = IntPtr.Zero; #if TARGET_64BIT // Read 4 chars (64 bits) at a time from each string while ((uint)length >= 4) { ulong valueA = Unsafe.ReadUnaligned<ulong>(ref Unsafe.As<char, byte>(ref Unsafe.AddByteOffset(ref charA, byteOffset))); ulong valueB = Unsafe.ReadUnaligned<ulong>(ref Unsafe.As<char, byte>(ref Unsafe.AddByteOffset(ref charB, byteOffset))); // A 32-bit test - even with the bit-twiddling here - is more efficient than a 64-bit test. ulong temp = valueA | valueB; if (!Utf16Utility.AllCharsInUInt32AreAscii((uint)temp | (uint)(temp >> 32))) { goto NonAscii; // one of the inputs contains non-ASCII data } // Generally, the caller has likely performed a first-pass check that the input strings // are likely equal. Consider a dictionary which computes the hash code of its key before // performing a proper deep equality check of the string contents. We want to optimize for // the case where the equality check is likely to succeed, which means that we want to avoid // branching within this loop unless we're about to exit the loop, either due to failure or // due to us running out of input data. if (!Utf16Utility.UInt64OrdinalIgnoreCaseAscii(valueA, valueB)) { return false; } byteOffset += 8; length -= 4; } #endif // Read 2 chars (32 bits) at a time from each string #if TARGET_64BIT if ((uint)length >= 2) #else while ((uint)length >= 2) #endif { uint valueA = Unsafe.ReadUnaligned<uint>(ref Unsafe.As<char, byte>(ref Unsafe.AddByteOffset(ref charA, byteOffset))); uint valueB = Unsafe.ReadUnaligned<uint>(ref Unsafe.As<char, byte>(ref Unsafe.AddByteOffset(ref charB, byteOffset))); if (!Utf16Utility.AllCharsInUInt32AreAscii(valueA | valueB)) { goto NonAscii; // one of the inputs contains non-ASCII data } // Generally, the caller has likely performed a first-pass check that the input strings // are likely equal. Consider a dictionary which computes the hash code of its key before // performing a proper deep equality check of the string contents. We want to optimize for // the case where the equality check is likely to succeed, which means that we want to avoid // branching within this loop unless we're about to exit the loop, either due to failure or // due to us running out of input data. if (!Utf16Utility.UInt32OrdinalIgnoreCaseAscii(valueA, valueB)) { return false; } byteOffset += 4; length -= 2; } if (length != 0) { Debug.Assert(length == 1); uint valueA = Unsafe.AddByteOffset(ref charA, byteOffset); uint valueB = Unsafe.AddByteOffset(ref charB, byteOffset); if ((valueA | valueB) > 0x7Fu) { goto NonAscii; // one of the inputs contains non-ASCII data } if (valueA == valueB) { return true; // exact match } valueA |= 0x20u; if ((uint)(valueA - 'a') > (uint)('z' - 'a')) { return false; // not exact match, and first input isn't in [A-Za-z] } // The ternary operator below seems redundant but helps RyuJIT generate more optimal code. // See https://github.com/dotnet/runtime/issues/4207. return (valueA == (valueB | 0x20u)) ? true : false; } Debug.Assert(length == 0); return true; NonAscii: // The non-ASCII case is factored out into its own helper method so that the JIT // doesn't need to emit a complex prolog for its caller (this method). return CompareStringIgnoreCase(ref Unsafe.AddByteOffset(ref charA, byteOffset), length, ref Unsafe.AddByteOffset(ref charB, byteOffset), length) == 0; } internal static unsafe int IndexOf(string source, string value, int startIndex, int count, bool ignoreCase) { if (source == null) { ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source); } if (value == null) { ThrowHelper.ThrowArgumentNullException(ExceptionArgument.value); } if (!source.TryGetSpan(startIndex, count, out ReadOnlySpan<char> sourceSpan)) { // Bounds check failed - figure out exactly what went wrong so that we can // surface the correct argument exception. if ((uint)startIndex > (uint)source.Length) { ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.startIndex, ExceptionResource.ArgumentOutOfRange_Index); } else { ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.count, ExceptionResource.ArgumentOutOfRange_Count); } } int result = ignoreCase ? IndexOfOrdinalIgnoreCase(sourceSpan, value) : sourceSpan.IndexOf(value); return result >= 0 ? result + startIndex : result; } internal static int IndexOfOrdinalIgnoreCase(ReadOnlySpan<char> source, ReadOnlySpan<char> value) { if (value.Length == 0) { return 0; } if (value.Length > source.Length) { // A non-linguistic search compares chars directly against one another, so large // target strings can never be found inside small search spaces. This check also // handles empty 'source' spans. return -1; } if (GlobalizationMode.Invariant) { return InvariantModeCasing.IndexOfIgnoreCase(source, value); } if (GlobalizationMode.UseNls) { return CompareInfo.NlsIndexOfOrdinalCore(source, value, ignoreCase: true, fromBeginning: true); } return OrdinalCasing.IndexOf(source, value); } internal static int LastIndexOf(string source, string value, int startIndex, int count) { int result = source.AsSpan(startIndex, count).LastIndexOf(value); if (result >= 0) { result += startIndex; } // if match found, adjust 'result' by the actual start position return result; } internal static unsafe int LastIndexOf(string source, string value, int startIndex, int count, bool ignoreCase) { if (source == null) { ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source); } if (value == null) { ThrowHelper.ThrowArgumentNullException(ExceptionArgument.value); } if (value.Length == 0) { return startIndex + 1; // startIndex is the index of the last char to include in the search space } if (count == 0) { return -1; } if (GlobalizationMode.Invariant) { return ignoreCase ? InvariantModeCasing.LastIndexOfIgnoreCase(source.AsSpan().Slice(startIndex, count), value) : LastIndexOf(source, value, startIndex, count); } if (GlobalizationMode.UseNls) { return CompareInfo.NlsLastIndexOfOrdinalCore(source, value, startIndex, count, ignoreCase); } if (!ignoreCase) { LastIndexOf(source, value, startIndex, count); } if (!source.TryGetSpan(startIndex, count, out ReadOnlySpan<char> sourceSpan)) { // Bounds check failed - figure out exactly what went wrong so that we can // surface the correct argument exception. if ((uint)startIndex > (uint)source.Length) { ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.startIndex, ExceptionResource.ArgumentOutOfRange_Index); } else { ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.count, ExceptionResource.ArgumentOutOfRange_Count); } } int result = OrdinalCasing.LastIndexOf(sourceSpan, value); if (result >= 0) { result += startIndex; } return result; } internal static int LastIndexOfOrdinalIgnoreCase(ReadOnlySpan<char> source, ReadOnlySpan<char> value) { if (value.Length == 0) { return source.Length; } if (value.Length > source.Length) { // A non-linguistic search compares chars directly against one another, so large // target strings can never be found inside small search spaces. This check also // handles empty 'source' spans. return -1; } if (GlobalizationMode.Invariant) { return InvariantModeCasing.LastIndexOfIgnoreCase(source, value); } if (GlobalizationMode.UseNls) { return CompareInfo.NlsIndexOfOrdinalCore(source, value, ignoreCase: true, fromBeginning: false); } return OrdinalCasing.LastIndexOf(source, value); } internal static int ToUpperOrdinal(ReadOnlySpan<char> source, Span<char> destination) { if (source.Overlaps(destination)) throw new InvalidOperationException(SR.InvalidOperation_SpanOverlappedOperation); // Assuming that changing case does not affect length if (destination.Length < source.Length) return -1; if (GlobalizationMode.Invariant) { InvariantModeCasing.ToUpper(source, destination); return source.Length; } if (GlobalizationMode.UseNls) { TextInfo.Invariant.ChangeCaseToUpper(source, destination); // this is the best so far for NLS. return source.Length; } OrdinalCasing.ToUpperOrdinal(source, destination); return source.Length; } } }
// 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.Unicode; using System.Runtime.CompilerServices; namespace System.Globalization { internal static partial class Ordinal { internal static int CompareStringIgnoreCase(ref char strA, int lengthA, ref char strB, int lengthB) { int length = Math.Min(lengthA, lengthB); int range = length; ref char charA = ref strA; ref char charB = ref strB; char maxChar = (char)0x7F; while (length != 0 && charA <= maxChar && charB <= maxChar) { // Ordinal equals or lowercase equals if the result ends up in the a-z range if (charA == charB || ((charA | 0x20) == (charB | 0x20) && (uint)((charA | 0x20) - 'a') <= (uint)('z' - 'a'))) { length--; charA = ref Unsafe.Add(ref charA, 1); charB = ref Unsafe.Add(ref charB, 1); } else { int currentA = charA; int currentB = charB; // Uppercase both chars if needed if ((uint)(charA - 'a') <= 'z' - 'a') { currentA -= 0x20; } if ((uint)(charB - 'a') <= 'z' - 'a') { currentB -= 0x20; } // Return the (case-insensitive) difference between them. return currentA - currentB; } } if (length == 0) { return lengthA - lengthB; } range -= length; return CompareStringIgnoreCaseNonAscii(ref charA, lengthA - range, ref charB, lengthB - range); } internal static int CompareStringIgnoreCaseNonAscii(ref char strA, int lengthA, ref char strB, int lengthB) { if (GlobalizationMode.Invariant) { return InvariantModeCasing.CompareStringIgnoreCase(ref strA, lengthA, ref strB, lengthB); } if (GlobalizationMode.UseNls) { return CompareInfo.NlsCompareStringOrdinalIgnoreCase(ref strA, lengthA, ref strB, lengthB); } return OrdinalCasing.CompareStringIgnoreCase(ref strA, lengthA, ref strB, lengthB); } internal static bool EqualsIgnoreCase(ref char charA, ref char charB, int length) { IntPtr byteOffset = IntPtr.Zero; #if TARGET_64BIT // Read 4 chars (64 bits) at a time from each string while ((uint)length >= 4) { ulong valueA = Unsafe.ReadUnaligned<ulong>(ref Unsafe.As<char, byte>(ref Unsafe.AddByteOffset(ref charA, byteOffset))); ulong valueB = Unsafe.ReadUnaligned<ulong>(ref Unsafe.As<char, byte>(ref Unsafe.AddByteOffset(ref charB, byteOffset))); // A 32-bit test - even with the bit-twiddling here - is more efficient than a 64-bit test. ulong temp = valueA | valueB; if (!Utf16Utility.AllCharsInUInt32AreAscii((uint)temp | (uint)(temp >> 32))) { goto NonAscii; // one of the inputs contains non-ASCII data } // Generally, the caller has likely performed a first-pass check that the input strings // are likely equal. Consider a dictionary which computes the hash code of its key before // performing a proper deep equality check of the string contents. We want to optimize for // the case where the equality check is likely to succeed, which means that we want to avoid // branching within this loop unless we're about to exit the loop, either due to failure or // due to us running out of input data. if (!Utf16Utility.UInt64OrdinalIgnoreCaseAscii(valueA, valueB)) { return false; } byteOffset += 8; length -= 4; } #endif // Read 2 chars (32 bits) at a time from each string #if TARGET_64BIT if ((uint)length >= 2) #else while ((uint)length >= 2) #endif { uint valueA = Unsafe.ReadUnaligned<uint>(ref Unsafe.As<char, byte>(ref Unsafe.AddByteOffset(ref charA, byteOffset))); uint valueB = Unsafe.ReadUnaligned<uint>(ref Unsafe.As<char, byte>(ref Unsafe.AddByteOffset(ref charB, byteOffset))); if (!Utf16Utility.AllCharsInUInt32AreAscii(valueA | valueB)) { goto NonAscii; // one of the inputs contains non-ASCII data } // Generally, the caller has likely performed a first-pass check that the input strings // are likely equal. Consider a dictionary which computes the hash code of its key before // performing a proper deep equality check of the string contents. We want to optimize for // the case where the equality check is likely to succeed, which means that we want to avoid // branching within this loop unless we're about to exit the loop, either due to failure or // due to us running out of input data. if (!Utf16Utility.UInt32OrdinalIgnoreCaseAscii(valueA, valueB)) { return false; } byteOffset += 4; length -= 2; } if (length != 0) { Debug.Assert(length == 1); uint valueA = Unsafe.AddByteOffset(ref charA, byteOffset); uint valueB = Unsafe.AddByteOffset(ref charB, byteOffset); if ((valueA | valueB) > 0x7Fu) { goto NonAscii; // one of the inputs contains non-ASCII data } if (valueA == valueB) { return true; // exact match } valueA |= 0x20u; if ((uint)(valueA - 'a') > (uint)('z' - 'a')) { return false; // not exact match, and first input isn't in [A-Za-z] } // The ternary operator below seems redundant but helps RyuJIT generate more optimal code. // See https://github.com/dotnet/runtime/issues/4207. return (valueA == (valueB | 0x20u)) ? true : false; } Debug.Assert(length == 0); return true; NonAscii: // The non-ASCII case is factored out into its own helper method so that the JIT // doesn't need to emit a complex prolog for its caller (this method). return CompareStringIgnoreCase(ref Unsafe.AddByteOffset(ref charA, byteOffset), length, ref Unsafe.AddByteOffset(ref charB, byteOffset), length) == 0; } internal static unsafe int IndexOf(string source, string value, int startIndex, int count, bool ignoreCase) { if (source == null) { ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source); } if (value == null) { ThrowHelper.ThrowArgumentNullException(ExceptionArgument.value); } if (!source.TryGetSpan(startIndex, count, out ReadOnlySpan<char> sourceSpan)) { // Bounds check failed - figure out exactly what went wrong so that we can // surface the correct argument exception. if ((uint)startIndex > (uint)source.Length) { ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.startIndex, ExceptionResource.ArgumentOutOfRange_Index); } else { ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.count, ExceptionResource.ArgumentOutOfRange_Count); } } int result = ignoreCase ? IndexOfOrdinalIgnoreCase(sourceSpan, value) : sourceSpan.IndexOf(value); return result >= 0 ? result + startIndex : result; } internal static int IndexOfOrdinalIgnoreCase(ReadOnlySpan<char> source, ReadOnlySpan<char> value) { if (value.Length == 0) { return 0; } if (value.Length > source.Length) { // A non-linguistic search compares chars directly against one another, so large // target strings can never be found inside small search spaces. This check also // handles empty 'source' spans. return -1; } if (GlobalizationMode.Invariant) { return InvariantModeCasing.IndexOfIgnoreCase(source, value); } if (GlobalizationMode.UseNls) { return CompareInfo.NlsIndexOfOrdinalCore(source, value, ignoreCase: true, fromBeginning: true); } return OrdinalCasing.IndexOf(source, value); } internal static int LastIndexOf(string source, string value, int startIndex, int count) { int result = source.AsSpan(startIndex, count).LastIndexOf(value); if (result >= 0) { result += startIndex; } // if match found, adjust 'result' by the actual start position return result; } internal static unsafe int LastIndexOf(string source, string value, int startIndex, int count, bool ignoreCase) { if (source == null) { ThrowHelper.ThrowArgumentNullException(ExceptionArgument.source); } if (value == null) { ThrowHelper.ThrowArgumentNullException(ExceptionArgument.value); } if (value.Length == 0) { return startIndex + 1; // startIndex is the index of the last char to include in the search space } if (count == 0) { return -1; } if (GlobalizationMode.Invariant) { return ignoreCase ? InvariantModeCasing.LastIndexOfIgnoreCase(source.AsSpan().Slice(startIndex, count), value) : LastIndexOf(source, value, startIndex, count); } if (GlobalizationMode.UseNls) { return CompareInfo.NlsLastIndexOfOrdinalCore(source, value, startIndex, count, ignoreCase); } if (!ignoreCase) { LastIndexOf(source, value, startIndex, count); } if (!source.TryGetSpan(startIndex, count, out ReadOnlySpan<char> sourceSpan)) { // Bounds check failed - figure out exactly what went wrong so that we can // surface the correct argument exception. if ((uint)startIndex > (uint)source.Length) { ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.startIndex, ExceptionResource.ArgumentOutOfRange_Index); } else { ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.count, ExceptionResource.ArgumentOutOfRange_Count); } } int result = OrdinalCasing.LastIndexOf(sourceSpan, value); if (result >= 0) { result += startIndex; } return result; } internal static int LastIndexOfOrdinalIgnoreCase(ReadOnlySpan<char> source, ReadOnlySpan<char> value) { if (value.Length == 0) { return source.Length; } if (value.Length > source.Length) { // A non-linguistic search compares chars directly against one another, so large // target strings can never be found inside small search spaces. This check also // handles empty 'source' spans. return -1; } if (GlobalizationMode.Invariant) { return InvariantModeCasing.LastIndexOfIgnoreCase(source, value); } if (GlobalizationMode.UseNls) { return CompareInfo.NlsIndexOfOrdinalCore(source, value, ignoreCase: true, fromBeginning: false); } return OrdinalCasing.LastIndexOf(source, value); } internal static int ToUpperOrdinal(ReadOnlySpan<char> source, Span<char> destination) { if (source.Overlaps(destination)) throw new InvalidOperationException(SR.InvalidOperation_SpanOverlappedOperation); // Assuming that changing case does not affect length if (destination.Length < source.Length) return -1; if (GlobalizationMode.Invariant) { InvariantModeCasing.ToUpper(source, destination); return source.Length; } if (GlobalizationMode.UseNls) { TextInfo.Invariant.ChangeCaseToUpper(source, destination); // this is the best so far for NLS. return source.Length; } OrdinalCasing.ToUpperOrdinal(source, destination); return source.Length; } } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/JIT/Regression/Dev11/External/Dev11_243742/app.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>PdbOnly</DebugType> <Optimize>False</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="app.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="dll.csproj" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>PdbOnly</DebugType> <Optimize>False</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="app.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="dll.csproj" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/libraries/System.Text.Json/src/System/Text/Json/Writer/Utf8JsonWriter.WriteValues.Literal.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; namespace System.Text.Json { public sealed partial class Utf8JsonWriter { /// <summary> /// Writes the JSON literal "null" as an element of a JSON array. /// </summary> /// <exception cref="InvalidOperationException"> /// Thrown if this would result in invalid JSON being written (while validation is enabled). /// </exception> public void WriteNullValue() { WriteLiteralByOptions(JsonConstants.NullValue); SetFlagToAddListSeparatorBeforeNextItem(); _tokenType = JsonTokenType.Null; } /// <summary> /// Writes the <see cref="bool"/> value (as a JSON literal "true" or "false") as an element of a JSON array. /// </summary> /// <param name="value">The value write.</param> /// <exception cref="InvalidOperationException"> /// Thrown if this would result in invalid JSON being written (while validation is enabled). /// </exception> public void WriteBooleanValue(bool value) { if (value) { WriteLiteralByOptions(JsonConstants.TrueValue); _tokenType = JsonTokenType.True; } else { WriteLiteralByOptions(JsonConstants.FalseValue); _tokenType = JsonTokenType.False; } SetFlagToAddListSeparatorBeforeNextItem(); } private void WriteLiteralByOptions(ReadOnlySpan<byte> utf8Value) { if (!_options.SkipValidation) { ValidateWritingValue(); } if (_options.Indented) { WriteLiteralIndented(utf8Value); } else { WriteLiteralMinimized(utf8Value); } } private void WriteLiteralMinimized(ReadOnlySpan<byte> utf8Value) { Debug.Assert(utf8Value.Length <= 5); int maxRequired = utf8Value.Length + 1; // Optionally, 1 list separator if (_memory.Length - BytesPending < maxRequired) { Grow(maxRequired); } Span<byte> output = _memory.Span; if (_currentDepth < 0) { output[BytesPending++] = JsonConstants.ListSeparator; } utf8Value.CopyTo(output.Slice(BytesPending)); BytesPending += utf8Value.Length; } private void WriteLiteralIndented(ReadOnlySpan<byte> utf8Value) { int indent = Indentation; Debug.Assert(indent <= 2 * _options.MaxDepth); Debug.Assert(utf8Value.Length <= 5); int maxRequired = indent + utf8Value.Length + 1 + s_newLineLength; // Optionally, 1 list separator and 1-2 bytes for new line if (_memory.Length - BytesPending < maxRequired) { Grow(maxRequired); } Span<byte> output = _memory.Span; if (_currentDepth < 0) { output[BytesPending++] = JsonConstants.ListSeparator; } if (_tokenType != JsonTokenType.PropertyName) { if (_tokenType != JsonTokenType.None) { WriteNewLine(output); } JsonWriterHelper.WriteIndentation(output.Slice(BytesPending), indent); BytesPending += indent; } utf8Value.CopyTo(output.Slice(BytesPending)); BytesPending += utf8Value.Length; } } }
// 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; namespace System.Text.Json { public sealed partial class Utf8JsonWriter { /// <summary> /// Writes the JSON literal "null" as an element of a JSON array. /// </summary> /// <exception cref="InvalidOperationException"> /// Thrown if this would result in invalid JSON being written (while validation is enabled). /// </exception> public void WriteNullValue() { WriteLiteralByOptions(JsonConstants.NullValue); SetFlagToAddListSeparatorBeforeNextItem(); _tokenType = JsonTokenType.Null; } /// <summary> /// Writes the <see cref="bool"/> value (as a JSON literal "true" or "false") as an element of a JSON array. /// </summary> /// <param name="value">The value write.</param> /// <exception cref="InvalidOperationException"> /// Thrown if this would result in invalid JSON being written (while validation is enabled). /// </exception> public void WriteBooleanValue(bool value) { if (value) { WriteLiteralByOptions(JsonConstants.TrueValue); _tokenType = JsonTokenType.True; } else { WriteLiteralByOptions(JsonConstants.FalseValue); _tokenType = JsonTokenType.False; } SetFlagToAddListSeparatorBeforeNextItem(); } private void WriteLiteralByOptions(ReadOnlySpan<byte> utf8Value) { if (!_options.SkipValidation) { ValidateWritingValue(); } if (_options.Indented) { WriteLiteralIndented(utf8Value); } else { WriteLiteralMinimized(utf8Value); } } private void WriteLiteralMinimized(ReadOnlySpan<byte> utf8Value) { Debug.Assert(utf8Value.Length <= 5); int maxRequired = utf8Value.Length + 1; // Optionally, 1 list separator if (_memory.Length - BytesPending < maxRequired) { Grow(maxRequired); } Span<byte> output = _memory.Span; if (_currentDepth < 0) { output[BytesPending++] = JsonConstants.ListSeparator; } utf8Value.CopyTo(output.Slice(BytesPending)); BytesPending += utf8Value.Length; } private void WriteLiteralIndented(ReadOnlySpan<byte> utf8Value) { int indent = Indentation; Debug.Assert(indent <= 2 * _options.MaxDepth); Debug.Assert(utf8Value.Length <= 5); int maxRequired = indent + utf8Value.Length + 1 + s_newLineLength; // Optionally, 1 list separator and 1-2 bytes for new line if (_memory.Length - BytesPending < maxRequired) { Grow(maxRequired); } Span<byte> output = _memory.Span; if (_currentDepth < 0) { output[BytesPending++] = JsonConstants.ListSeparator; } if (_tokenType != JsonTokenType.PropertyName) { if (_tokenType != JsonTokenType.None) { WriteNewLine(output); } JsonWriterHelper.WriteIndentation(output.Slice(BytesPending), indent); BytesPending += indent; } utf8Value.CopyTo(output.Slice(BytesPending)); BytesPending += utf8Value.Length; } } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/libraries/System.Linq.Queryable/src/System/Linq/Queryable.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.CodeAnalysis; using System.Linq.Expressions; namespace System.Linq { public static class Queryable { internal const string InMemoryQueryableExtensionMethodsRequiresUnreferencedCode = "Enumerating in-memory collections as IQueryable can require unreferenced code because expressions referencing IQueryable extension methods can get rebound to IEnumerable extension methods. The IEnumerable extension methods could be trimmed causing the application to fail at runtime."; [RequiresUnreferencedCode(InMemoryQueryableExtensionMethodsRequiresUnreferencedCode)] public static IQueryable<TElement> AsQueryable<TElement>(this IEnumerable<TElement> source!!) => source as IQueryable<TElement> ?? new EnumerableQuery<TElement>(source); [RequiresUnreferencedCode(InMemoryQueryableExtensionMethodsRequiresUnreferencedCode)] public static IQueryable AsQueryable(this IEnumerable source!!) { if (source is IQueryable queryable) { return queryable; } Type? enumType = TypeHelper.FindGenericType(typeof(IEnumerable<>), source.GetType()); if (enumType == null) { throw Error.ArgumentNotIEnumerableGeneric(nameof(source)); } return EnumerableQuery.Create(enumType.GenericTypeArguments[0], source); } [DynamicDependency("Where`1", typeof(Enumerable))] public static IQueryable<TSource> Where<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, bool>> predicate!!) => source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.Where_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(predicate) )); [DynamicDependency("Where`1", typeof(Enumerable))] public static IQueryable<TSource> Where<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, int, bool>> predicate!!) => source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.Where_Index_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(predicate) )); [DynamicDependency("OfType`1", typeof(Enumerable))] public static IQueryable<TResult> OfType<TResult>(this IQueryable source!!) => source.Provider.CreateQuery<TResult>( Expression.Call( null, CachedReflectionInfo.OfType_TResult_1(typeof(TResult)), source.Expression)); [DynamicDependency("Cast`1", typeof(Enumerable))] public static IQueryable<TResult> Cast<TResult>(this IQueryable source!!) => source.Provider.CreateQuery<TResult>( Expression.Call( null, CachedReflectionInfo.Cast_TResult_1(typeof(TResult)), source.Expression)); [DynamicDependency("Select`2", typeof(Enumerable))] public static IQueryable<TResult> Select<TSource, TResult>(this IQueryable<TSource> source!!, Expression<Func<TSource, TResult>> selector!!) => source.Provider.CreateQuery<TResult>( Expression.Call( null, CachedReflectionInfo.Select_TSource_TResult_2(typeof(TSource), typeof(TResult)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("Select`2", typeof(Enumerable))] public static IQueryable<TResult> Select<TSource, TResult>(this IQueryable<TSource> source!!, Expression<Func<TSource, int, TResult>> selector!!) => source.Provider.CreateQuery<TResult>( Expression.Call( null, CachedReflectionInfo.Select_Index_TSource_TResult_2(typeof(TSource), typeof(TResult)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("SelectMany`2", typeof(Enumerable))] public static IQueryable<TResult> SelectMany<TSource, TResult>(this IQueryable<TSource> source!!, Expression<Func<TSource, IEnumerable<TResult>>> selector!!) => source.Provider.CreateQuery<TResult>( Expression.Call( null, CachedReflectionInfo.SelectMany_TSource_TResult_2(typeof(TSource), typeof(TResult)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("SelectMany`2", typeof(Enumerable))] public static IQueryable<TResult> SelectMany<TSource, TResult>(this IQueryable<TSource> source!!, Expression<Func<TSource, int, IEnumerable<TResult>>> selector!!) => source.Provider.CreateQuery<TResult>( Expression.Call( null, CachedReflectionInfo.SelectMany_Index_TSource_TResult_2(typeof(TSource), typeof(TResult)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("SelectMany`3", typeof(Enumerable))] public static IQueryable<TResult> SelectMany<TSource, TCollection, TResult>(this IQueryable<TSource> source!!, Expression<Func<TSource, int, IEnumerable<TCollection>>> collectionSelector!!, Expression<Func<TSource, TCollection, TResult>> resultSelector!!) => source.Provider.CreateQuery<TResult>( Expression.Call( null, CachedReflectionInfo.SelectMany_Index_TSource_TCollection_TResult_3(typeof(TSource), typeof(TCollection), typeof(TResult)), source.Expression, Expression.Quote(collectionSelector), Expression.Quote(resultSelector) )); [DynamicDependency("SelectMany`3", typeof(Enumerable))] public static IQueryable<TResult> SelectMany<TSource, TCollection, TResult>(this IQueryable<TSource> source!!, Expression<Func<TSource, IEnumerable<TCollection>>> collectionSelector!!, Expression<Func<TSource, TCollection, TResult>> resultSelector!!) => source.Provider.CreateQuery<TResult>( Expression.Call( null, CachedReflectionInfo.SelectMany_TSource_TCollection_TResult_3(typeof(TSource), typeof(TCollection), typeof(TResult)), source.Expression, Expression.Quote(collectionSelector), Expression.Quote(resultSelector) )); private static Expression GetSourceExpression<TSource>(IEnumerable<TSource> source) { IQueryable<TSource>? q = source as IQueryable<TSource>; return q != null ? q.Expression : Expression.Constant(source, typeof(IEnumerable<TSource>)); } [DynamicDependency("Join`4", typeof(Enumerable))] public static IQueryable<TResult> Join<TOuter, TInner, TKey, TResult>(this IQueryable<TOuter> outer!!, IEnumerable<TInner> inner!!, Expression<Func<TOuter, TKey>> outerKeySelector!!, Expression<Func<TInner, TKey>> innerKeySelector!!, Expression<Func<TOuter, TInner, TResult>> resultSelector!!) => outer.Provider.CreateQuery<TResult>( Expression.Call( null, CachedReflectionInfo.Join_TOuter_TInner_TKey_TResult_5(typeof(TOuter), typeof(TInner), typeof(TKey), typeof(TResult)), outer.Expression, GetSourceExpression(inner), Expression.Quote(outerKeySelector), Expression.Quote(innerKeySelector), Expression.Quote(resultSelector))); [DynamicDependency("Join`4", typeof(Enumerable))] public static IQueryable<TResult> Join<TOuter, TInner, TKey, TResult>(this IQueryable<TOuter> outer!!, IEnumerable<TInner> inner!!, Expression<Func<TOuter, TKey>> outerKeySelector!!, Expression<Func<TInner, TKey>> innerKeySelector!!, Expression<Func<TOuter, TInner, TResult>> resultSelector!!, IEqualityComparer<TKey>? comparer) => outer.Provider.CreateQuery<TResult>( Expression.Call( null, CachedReflectionInfo.Join_TOuter_TInner_TKey_TResult_6(typeof(TOuter), typeof(TInner), typeof(TKey), typeof(TResult)), outer.Expression, GetSourceExpression(inner), Expression.Quote(outerKeySelector), Expression.Quote(innerKeySelector), Expression.Quote(resultSelector), Expression.Constant(comparer, typeof(IEqualityComparer<TKey>)))); [DynamicDependency("GroupJoin`4", typeof(Enumerable))] public static IQueryable<TResult> GroupJoin<TOuter, TInner, TKey, TResult>(this IQueryable<TOuter> outer!!, IEnumerable<TInner> inner!!, Expression<Func<TOuter, TKey>> outerKeySelector!!, Expression<Func<TInner, TKey>> innerKeySelector!!, Expression<Func<TOuter, IEnumerable<TInner>, TResult>> resultSelector!!) => outer.Provider.CreateQuery<TResult>( Expression.Call( null, CachedReflectionInfo.GroupJoin_TOuter_TInner_TKey_TResult_5(typeof(TOuter), typeof(TInner), typeof(TKey), typeof(TResult)), outer.Expression, GetSourceExpression(inner), Expression.Quote(outerKeySelector), Expression.Quote(innerKeySelector), Expression.Quote(resultSelector))); [DynamicDependency("GroupJoin`4", typeof(Enumerable))] public static IQueryable<TResult> GroupJoin<TOuter, TInner, TKey, TResult>(this IQueryable<TOuter> outer!!, IEnumerable<TInner> inner!!, Expression<Func<TOuter, TKey>> outerKeySelector!!, Expression<Func<TInner, TKey>> innerKeySelector!!, Expression<Func<TOuter, IEnumerable<TInner>, TResult>> resultSelector!!, IEqualityComparer<TKey>? comparer) => outer.Provider.CreateQuery<TResult>( Expression.Call( null, CachedReflectionInfo.GroupJoin_TOuter_TInner_TKey_TResult_6(typeof(TOuter), typeof(TInner), typeof(TKey), typeof(TResult)), outer.Expression, GetSourceExpression(inner), Expression.Quote(outerKeySelector), Expression.Quote(innerKeySelector), Expression.Quote(resultSelector), Expression.Constant(comparer, typeof(IEqualityComparer<TKey>)))); [DynamicDependency("OrderBy`2", typeof(Enumerable))] public static IOrderedQueryable<TSource> OrderBy<TSource, TKey>(this IQueryable<TSource> source!!, Expression<Func<TSource, TKey>> keySelector!!) => (IOrderedQueryable<TSource>)source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.OrderBy_TSource_TKey_2(typeof(TSource), typeof(TKey)), source.Expression, Expression.Quote(keySelector) )); [DynamicDependency("OrderBy`2", typeof(Enumerable))] public static IOrderedQueryable<TSource> OrderBy<TSource, TKey>(this IQueryable<TSource> source!!, Expression<Func<TSource, TKey>> keySelector!!, IComparer<TKey>? comparer) => (IOrderedQueryable<TSource>)source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.OrderBy_TSource_TKey_3(typeof(TSource), typeof(TKey)), source.Expression, Expression.Quote(keySelector), Expression.Constant(comparer, typeof(IComparer<TKey>)) )); [DynamicDependency("OrderByDescending`2", typeof(Enumerable))] public static IOrderedQueryable<TSource> OrderByDescending<TSource, TKey>(this IQueryable<TSource> source!!, Expression<Func<TSource, TKey>> keySelector!!) => (IOrderedQueryable<TSource>)source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.OrderByDescending_TSource_TKey_2(typeof(TSource), typeof(TKey)), source.Expression, Expression.Quote(keySelector) )); [DynamicDependency("OrderByDescending`2", typeof(Enumerable))] public static IOrderedQueryable<TSource> OrderByDescending<TSource, TKey>(this IQueryable<TSource> source!!, Expression<Func<TSource, TKey>> keySelector!!, IComparer<TKey>? comparer) => (IOrderedQueryable<TSource>)source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.OrderByDescending_TSource_TKey_3(typeof(TSource), typeof(TKey)), source.Expression, Expression.Quote(keySelector), Expression.Constant(comparer, typeof(IComparer<TKey>)) )); [DynamicDependency("ThenBy`2", typeof(Enumerable))] public static IOrderedQueryable<TSource> ThenBy<TSource, TKey>(this IOrderedQueryable<TSource> source!!, Expression<Func<TSource, TKey>> keySelector!!) => (IOrderedQueryable<TSource>)source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.ThenBy_TSource_TKey_2(typeof(TSource), typeof(TKey)), source.Expression, Expression.Quote(keySelector) )); [DynamicDependency("ThenBy`2", typeof(Enumerable))] public static IOrderedQueryable<TSource> ThenBy<TSource, TKey>(this IOrderedQueryable<TSource> source!!, Expression<Func<TSource, TKey>> keySelector!!, IComparer<TKey>? comparer) => (IOrderedQueryable<TSource>)source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.ThenBy_TSource_TKey_3(typeof(TSource), typeof(TKey)), source.Expression, Expression.Quote(keySelector), Expression.Constant(comparer, typeof(IComparer<TKey>)) )); [DynamicDependency("ThenByDescending`2", typeof(Enumerable))] public static IOrderedQueryable<TSource> ThenByDescending<TSource, TKey>(this IOrderedQueryable<TSource> source!!, Expression<Func<TSource, TKey>> keySelector!!) => (IOrderedQueryable<TSource>)source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.ThenByDescending_TSource_TKey_2(typeof(TSource), typeof(TKey)), source.Expression, Expression.Quote(keySelector) )); [DynamicDependency("ThenByDescending`2", typeof(Enumerable))] public static IOrderedQueryable<TSource> ThenByDescending<TSource, TKey>(this IOrderedQueryable<TSource> source!!, Expression<Func<TSource, TKey>> keySelector!!, IComparer<TKey>? comparer) => (IOrderedQueryable<TSource>)source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.ThenByDescending_TSource_TKey_3(typeof(TSource), typeof(TKey)), source.Expression, Expression.Quote(keySelector), Expression.Constant(comparer, typeof(IComparer<TKey>)) )); [DynamicDependency("Take`1", typeof(Enumerable))] public static IQueryable<TSource> Take<TSource>(this IQueryable<TSource> source!!, int count) => source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.Take_Int32_TSource_2(typeof(TSource)), source.Expression, Expression.Constant(count) )); /// <summary>Returns a specified range of contiguous elements from a sequence.</summary> /// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam> /// <param name="source">The sequence to return elements from.</param> /// <param name="range">The range of elements to return, which has start and end indexes either from the start or the end.</param> /// <exception cref="ArgumentNullException"><paramref name="source" /> is <see langword="null" />.</exception> /// <returns>An <see cref="IQueryable{T}" /> that contains the specified <paramref name="range" /> of elements from the <paramref name="source" /> sequence.</returns> [DynamicDependency("Take`1", typeof(Enumerable))] public static IQueryable<TSource> Take<TSource>(this IQueryable<TSource> source!!, Range range) => source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.Take_Range_TSource_2(typeof(TSource)), source.Expression, Expression.Constant(range) )); [DynamicDependency("TakeWhile`1", typeof(Enumerable))] public static IQueryable<TSource> TakeWhile<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, bool>> predicate!!) => source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.TakeWhile_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(predicate) )); [DynamicDependency("TakeWhile`1", typeof(Enumerable))] public static IQueryable<TSource> TakeWhile<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, int, bool>> predicate!!) => source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.TakeWhile_Index_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(predicate) )); [DynamicDependency("Skip`1", typeof(Enumerable))] public static IQueryable<TSource> Skip<TSource>(this IQueryable<TSource> source!!, int count) => source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.Skip_TSource_2(typeof(TSource)), source.Expression, Expression.Constant(count) )); [DynamicDependency("SkipWhile`1", typeof(Enumerable))] public static IQueryable<TSource> SkipWhile<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, bool>> predicate!!) => source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.SkipWhile_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(predicate) )); [DynamicDependency("SkipWhile`1", typeof(Enumerable))] public static IQueryable<TSource> SkipWhile<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, int, bool>> predicate!!) => source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.SkipWhile_Index_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(predicate) )); [DynamicDependency("GroupBy`2", typeof(Enumerable))] public static IQueryable<IGrouping<TKey, TSource>> GroupBy<TSource, TKey>(this IQueryable<TSource> source!!, Expression<Func<TSource, TKey>> keySelector!!) => source.Provider.CreateQuery<IGrouping<TKey, TSource>>( Expression.Call( null, CachedReflectionInfo.GroupBy_TSource_TKey_2(typeof(TSource), typeof(TKey)), source.Expression, Expression.Quote(keySelector) )); [DynamicDependency("GroupBy`3", typeof(Enumerable))] public static IQueryable<IGrouping<TKey, TElement>> GroupBy<TSource, TKey, TElement>(this IQueryable<TSource> source!!, Expression<Func<TSource, TKey>> keySelector!!, Expression<Func<TSource, TElement>> elementSelector!!) => source.Provider.CreateQuery<IGrouping<TKey, TElement>>( Expression.Call( null, CachedReflectionInfo.GroupBy_TSource_TKey_TElement_3(typeof(TSource), typeof(TKey), typeof(TElement)), source.Expression, Expression.Quote(keySelector), Expression.Quote(elementSelector) )); [DynamicDependency("GroupBy`2", typeof(Enumerable))] public static IQueryable<IGrouping<TKey, TSource>> GroupBy<TSource, TKey>(this IQueryable<TSource> source!!, Expression<Func<TSource, TKey>> keySelector!!, IEqualityComparer<TKey>? comparer) => source.Provider.CreateQuery<IGrouping<TKey, TSource>>( Expression.Call( null, CachedReflectionInfo.GroupBy_TSource_TKey_3(typeof(TSource), typeof(TKey)), source.Expression, Expression.Quote(keySelector), Expression.Constant(comparer, typeof(IEqualityComparer<TKey>)) )); [DynamicDependency("GroupBy`3", typeof(Enumerable))] public static IQueryable<IGrouping<TKey, TElement>> GroupBy<TSource, TKey, TElement>(this IQueryable<TSource> source!!, Expression<Func<TSource, TKey>> keySelector!!, Expression<Func<TSource, TElement>> elementSelector!!, IEqualityComparer<TKey>? comparer) => source.Provider.CreateQuery<IGrouping<TKey, TElement>>( Expression.Call( null, CachedReflectionInfo.GroupBy_TSource_TKey_TElement_4(typeof(TSource), typeof(TKey), typeof(TElement)), source.Expression, Expression.Quote(keySelector), Expression.Quote(elementSelector), Expression.Constant(comparer, typeof(IEqualityComparer<TKey>)))); [DynamicDependency("GroupBy`4", typeof(Enumerable))] public static IQueryable<TResult> GroupBy<TSource, TKey, TElement, TResult>(this IQueryable<TSource> source!!, Expression<Func<TSource, TKey>> keySelector!!, Expression<Func<TSource, TElement>> elementSelector!!, Expression<Func<TKey, IEnumerable<TElement>, TResult>> resultSelector!!) => source.Provider.CreateQuery<TResult>( Expression.Call( null, CachedReflectionInfo.GroupBy_TSource_TKey_TElement_TResult_4(typeof(TSource), typeof(TKey), typeof(TElement), typeof(TResult)), source.Expression, Expression.Quote(keySelector), Expression.Quote(elementSelector), Expression.Quote(resultSelector))); [DynamicDependency("GroupBy`3", typeof(Enumerable))] public static IQueryable<TResult> GroupBy<TSource, TKey, TResult>(this IQueryable<TSource> source!!, Expression<Func<TSource, TKey>> keySelector!!, Expression<Func<TKey, IEnumerable<TSource>, TResult>> resultSelector!!) => source.Provider.CreateQuery<TResult>( Expression.Call( null, CachedReflectionInfo.GroupBy_TSource_TKey_TResult_3(typeof(TSource), typeof(TKey), typeof(TResult)), source.Expression, Expression.Quote(keySelector), Expression.Quote(resultSelector) )); [DynamicDependency("GroupBy`3", typeof(Enumerable))] public static IQueryable<TResult> GroupBy<TSource, TKey, TResult>(this IQueryable<TSource> source!!, Expression<Func<TSource, TKey>> keySelector!!, Expression<Func<TKey, IEnumerable<TSource>, TResult>> resultSelector!!, IEqualityComparer<TKey>? comparer) => source.Provider.CreateQuery<TResult>( Expression.Call( null, CachedReflectionInfo.GroupBy_TSource_TKey_TResult_4(typeof(TSource), typeof(TKey), typeof(TResult)), source.Expression, Expression.Quote(keySelector), Expression.Quote(resultSelector), Expression.Constant(comparer, typeof(IEqualityComparer<TKey>)))); [DynamicDependency("GroupBy`4", typeof(Enumerable))] public static IQueryable<TResult> GroupBy<TSource, TKey, TElement, TResult>(this IQueryable<TSource> source!!, Expression<Func<TSource, TKey>> keySelector!!, Expression<Func<TSource, TElement>> elementSelector!!, Expression<Func<TKey, IEnumerable<TElement>, TResult>> resultSelector!!, IEqualityComparer<TKey>? comparer) => source.Provider.CreateQuery<TResult>( Expression.Call( null, CachedReflectionInfo.GroupBy_TSource_TKey_TElement_TResult_5(typeof(TSource), typeof(TKey), typeof(TElement), typeof(TResult)), source.Expression, Expression.Quote(keySelector), Expression.Quote(elementSelector), Expression.Quote(resultSelector), Expression.Constant(comparer, typeof(IEqualityComparer<TKey>)))); [DynamicDependency("Distinct`1", typeof(Enumerable))] public static IQueryable<TSource> Distinct<TSource>(this IQueryable<TSource> source!!) => source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.Distinct_TSource_1(typeof(TSource)), source.Expression)); [DynamicDependency("Distinct`1", typeof(Enumerable))] public static IQueryable<TSource> Distinct<TSource>(this IQueryable<TSource> source!!, IEqualityComparer<TSource>? comparer) => source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.Distinct_TSource_2(typeof(TSource)), source.Expression, Expression.Constant(comparer, typeof(IEqualityComparer<TSource>)) )); /// <summary>Returns distinct elements from a sequence according to a specified key selector function.</summary> /// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam> /// <typeparam name="TKey">The type of key to distinguish elements by.</typeparam> /// <param name="source">The sequence to remove duplicate elements from.</param> /// <param name="keySelector">A function to extract the key for each element.</param> /// <returns>An <see cref="IQueryable{T}" /> that contains distinct elements from the source sequence.</returns> /// <exception cref="ArgumentNullException"><paramref name="source" /> is <see langword="null" />.</exception> [DynamicDependency("DistinctBy`2", typeof(Enumerable))] public static IQueryable<TSource> DistinctBy<TSource, TKey>(this IQueryable<TSource> source!!, Expression<Func<TSource, TKey>> keySelector!!) => source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.DistinctBy_TSource_TKey_2(typeof(TSource), typeof(TKey)), source.Expression, Expression.Quote(keySelector) )); /// <summary>Returns distinct elements from a sequence according to a specified key selector function.</summary> /// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam> /// <typeparam name="TKey">The type of key to distinguish elements by.</typeparam> /// <param name="source">The sequence to remove duplicate elements from.</param> /// <param name="keySelector">A function to extract the key for each element.</param> /// <param name="comparer">An <see cref="IEqualityComparer{TKey}" /> to compare keys.</param> /// <returns>An <see cref="IQueryable{T}" /> that contains distinct elements from the source sequence.</returns> /// <exception cref="ArgumentNullException"><paramref name="source" /> is <see langword="null" />.</exception> [DynamicDependency("DistinctBy`2", typeof(Enumerable))] public static IQueryable<TSource> DistinctBy<TSource, TKey>(this IQueryable<TSource> source!!, Expression<Func<TSource, TKey>> keySelector!!, IEqualityComparer<TKey>? comparer) => source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.DistinctBy_TSource_TKey_3(typeof(TSource), typeof(TKey)), source.Expression, Expression.Quote(keySelector), Expression.Constant(comparer, typeof(IEqualityComparer<TKey>)) )); /// <summary>Split the elements of a sequence into chunks of size at most <paramref name="size"/>.</summary> /// <param name="source">An <see cref="IEnumerable{T}"/> whose elements to chunk.</param> /// <param name="size">Maximum size of each chunk.</param> /// <typeparam name="TSource">The type of the elements of source.</typeparam> /// <returns>An <see cref="IQueryable{T}"/> that contains the elements the input sequence split into chunks of size <paramref name="size"/>.</returns> /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception> /// <exception cref="ArgumentOutOfRangeException"><paramref name="size"/> is below 1.</exception> /// <remarks> /// <para>Every chunk except the last will be of size <paramref name="size"/>.</para> /// <para>The last chunk will contain the remaining elements and may be of a smaller size.</para> /// </remarks> [DynamicDependency("Chunk`1", typeof(Enumerable))] public static IQueryable<TSource[]> Chunk<TSource>(this IQueryable<TSource> source!!, int size) => source.Provider.CreateQuery<TSource[]>( Expression.Call( null, CachedReflectionInfo.Chunk_TSource_1(typeof(TSource)), source.Expression, Expression.Constant(size) )); [DynamicDependency("Concat`1", typeof(Enumerable))] public static IQueryable<TSource> Concat<TSource>(this IQueryable<TSource> source1!!, IEnumerable<TSource> source2!!) => source1.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.Concat_TSource_2(typeof(TSource)), source1.Expression, GetSourceExpression(source2) )); [DynamicDependency("Zip`2", typeof(Enumerable))] public static IQueryable<(TFirst First, TSecond Second)> Zip<TFirst, TSecond>(this IQueryable<TFirst> source1!!, IEnumerable<TSecond> source2!!) => source1.Provider.CreateQuery<(TFirst, TSecond)>( Expression.Call( null, CachedReflectionInfo.Zip_TFirst_TSecond_2(typeof(TFirst), typeof(TSecond)), source1.Expression, GetSourceExpression(source2))); [DynamicDependency("Zip`3", typeof(Enumerable))] public static IQueryable<TResult> Zip<TFirst, TSecond, TResult>(this IQueryable<TFirst> source1!!, IEnumerable<TSecond> source2!!, Expression<Func<TFirst, TSecond, TResult>> resultSelector!!) => source1.Provider.CreateQuery<TResult>( Expression.Call( null, CachedReflectionInfo.Zip_TFirst_TSecond_TResult_3(typeof(TFirst), typeof(TSecond), typeof(TResult)), source1.Expression, GetSourceExpression(source2), Expression.Quote(resultSelector) )); /// <summary> /// Produces a sequence of tuples with elements from the three specified sequences. /// </summary> /// <typeparam name="TFirst">The type of the elements of the first input sequence.</typeparam> /// <typeparam name="TSecond">The type of the elements of the second input sequence.</typeparam> /// <typeparam name="TThird">The type of the elements of the third input sequence.</typeparam> /// <param name="source1">The first sequence to merge.</param> /// <param name="source2">The second sequence to merge.</param> /// <param name="source3">The third sequence to merge.</param> /// <returns>A sequence of tuples with elements taken from the first, second and third sequences, in that order.</returns> [DynamicDependency("Zip`3", typeof(Enumerable))] public static IQueryable<(TFirst First, TSecond Second, TThird Third)> Zip<TFirst, TSecond, TThird>(this IQueryable<TFirst> source1!!, IEnumerable<TSecond> source2!!, IEnumerable<TThird> source3!!) => source1.Provider.CreateQuery<(TFirst, TSecond, TThird)>( Expression.Call( null, CachedReflectionInfo.Zip_TFirst_TSecond_TThird_3(typeof(TFirst), typeof(TSecond), typeof(TThird)), source1.Expression, GetSourceExpression(source2), GetSourceExpression(source3) )); [DynamicDependency("Union`1", typeof(Enumerable))] public static IQueryable<TSource> Union<TSource>(this IQueryable<TSource> source1!!, IEnumerable<TSource> source2!!) => source1.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.Union_TSource_2(typeof(TSource)), source1.Expression, GetSourceExpression(source2) )); [DynamicDependency("Union`1", typeof(Enumerable))] public static IQueryable<TSource> Union<TSource>(this IQueryable<TSource> source1!!, IEnumerable<TSource> source2!!, IEqualityComparer<TSource>? comparer) => source1.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.Union_TSource_3(typeof(TSource)), source1.Expression, GetSourceExpression(source2), Expression.Constant(comparer, typeof(IEqualityComparer<TSource>)) )); /// <summary>Produces the set union of two sequences according to a specified key selector function.</summary> /// <typeparam name="TSource">The type of the elements of the input sequences.</typeparam> /// <typeparam name="TKey">The type of key to identify elements by.</typeparam> /// <param name="source1">An <see cref="IQueryable{T}" /> whose distinct elements form the first set for the union.</param> /// <param name="source2">An <see cref="IEnumerable{T}" /> whose distinct elements form the second set for the union.</param> /// <param name="keySelector">A function to extract the key for each element.</param> /// <returns>An <see cref="IQueryable{T}" /> that contains the elements from both input sequences, excluding duplicates.</returns> /// <exception cref="ArgumentNullException"><paramref name="source1" /> or <paramref name="source2" /> is <see langword="null" />.</exception> [DynamicDependency("UnionBy`2", typeof(Enumerable))] public static IQueryable<TSource> UnionBy<TSource, TKey>(this IQueryable<TSource> source1!!, IEnumerable<TSource> source2!!, Expression<Func<TSource, TKey>> keySelector!!) => source1.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.UnionBy_TSource_TKey_3(typeof(TSource), typeof(TKey)), source1.Expression, GetSourceExpression(source2), Expression.Quote(keySelector) )); /// <summary>Produces the set union of two sequences according to a specified key selector function.</summary> /// <typeparam name="TSource">The type of the elements of the input sequences.</typeparam> /// <typeparam name="TKey">The type of key to identify elements by.</typeparam> /// <param name="source1">An <see cref="IQueryable{T}" /> whose distinct elements form the first set for the union.</param> /// <param name="source2">An <see cref="IEnumerable{T}" /> whose distinct elements form the second set for the union.</param> /// <param name="keySelector">A function to extract the key for each element.</param> /// <param name="comparer">The <see cref="IEqualityComparer{T}" /> to compare values.</param> /// <returns>An <see cref="IQueryable{T}" /> that contains the elements from both input sequences, excluding duplicates.</returns> /// <exception cref="ArgumentNullException"><paramref name="source1" /> or <paramref name="source2" /> is <see langword="null" />.</exception> [DynamicDependency("UnionBy`2", typeof(Enumerable))] public static IQueryable<TSource> UnionBy<TSource, TKey>(this IQueryable<TSource> source1!!, IEnumerable<TSource> source2!!, Expression<Func<TSource, TKey>> keySelector!!, IEqualityComparer<TKey>? comparer) => source1.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.UnionBy_TSource_TKey_4(typeof(TSource), typeof(TKey)), source1.Expression, GetSourceExpression(source2), Expression.Quote(keySelector), Expression.Constant(comparer, typeof(IEqualityComparer<TKey>)) )); [DynamicDependency("Intersect`1", typeof(Enumerable))] public static IQueryable<TSource> Intersect<TSource>(this IQueryable<TSource> source1!!, IEnumerable<TSource> source2!!) => source1.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.Intersect_TSource_2(typeof(TSource)), source1.Expression, GetSourceExpression(source2) )); [DynamicDependency("Intersect`1", typeof(Enumerable))] public static IQueryable<TSource> Intersect<TSource>(this IQueryable<TSource> source1!!, IEnumerable<TSource> source2!!, IEqualityComparer<TSource>? comparer) => source1.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.Intersect_TSource_3(typeof(TSource)), source1.Expression, GetSourceExpression(source2), Expression.Constant(comparer, typeof(IEqualityComparer<TSource>)) )); /// <summary>Produces the set intersection of two sequences according to a specified key selector function.</summary> /// <typeparam name="TSource">The type of the elements of the input sequences.</typeparam> /// <typeparam name="TKey">The type of key to identify elements by.</typeparam> /// <param name="source1">An <see cref="IQueryable{T}" /> whose distinct elements that also appear in <paramref name="source2" /> will be returned.</param> /// <param name="source2">An <see cref="IEnumerable{T}" /> whose distinct elements that also appear in the first sequence will be returned.</param> /// <param name="keySelector">A function to extract the key for each element.</param> /// <returns>A sequence that contains the elements that form the set intersection of two sequences.</returns> /// <exception cref="ArgumentNullException"><paramref name="source1" /> or <paramref name="source2" /> is <see langword="null" />.</exception> [DynamicDependency("IntersectBy`2", typeof(Enumerable))] public static IQueryable<TSource> IntersectBy<TSource, TKey>(this IQueryable<TSource> source1!!, IEnumerable<TKey> source2!!, Expression<Func<TSource, TKey>> keySelector!!) => source1.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.IntersectBy_TSource_TKey_3(typeof(TSource), typeof(TKey)), source1.Expression, GetSourceExpression(source2), Expression.Quote(keySelector) )); /// <summary>Produces the set intersection of two sequences according to a specified key selector function.</summary> /// <typeparam name="TSource">The type of the elements of the input sequences.</typeparam> /// <typeparam name="TKey">The type of key to identify elements by.</typeparam> /// <param name="source1">An <see cref="IQueryable{T}" /> whose distinct elements that also appear in <paramref name="source2" /> will be returned.</param> /// <param name="source2">An <see cref="IEnumerable{T}" /> whose distinct elements that also appear in the first sequence will be returned.</param> /// <param name="keySelector">A function to extract the key for each element.</param> /// <param name="comparer">An <see cref="IEqualityComparer{TKey}" /> to compare keys.</param> /// <returns>A sequence that contains the elements that form the set intersection of two sequences.</returns> /// <exception cref="ArgumentNullException"><paramref name="source1" /> or <paramref name="source2" /> is <see langword="null" />.</exception> [DynamicDependency("IntersectBy`2", typeof(Enumerable))] public static IQueryable<TSource> IntersectBy<TSource, TKey>(this IQueryable<TSource> source1!!, IEnumerable<TKey> source2!!, Expression<Func<TSource, TKey>> keySelector!!, IEqualityComparer<TKey>? comparer) => source1.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.IntersectBy_TSource_TKey_4(typeof(TSource), typeof(TKey)), source1.Expression, GetSourceExpression(source2), Expression.Quote(keySelector), Expression.Constant(comparer, typeof(IEqualityComparer<TKey>)) )); [DynamicDependency("Except`1", typeof(Enumerable))] public static IQueryable<TSource> Except<TSource>(this IQueryable<TSource> source1!!, IEnumerable<TSource> source2!!) => source1.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.Except_TSource_2(typeof(TSource)), source1.Expression, GetSourceExpression(source2) )); [DynamicDependency("Except`1", typeof(Enumerable))] public static IQueryable<TSource> Except<TSource>(this IQueryable<TSource> source1!!, IEnumerable<TSource> source2!!, IEqualityComparer<TSource>? comparer) => source1.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.Except_TSource_3(typeof(TSource)), source1.Expression, GetSourceExpression(source2), Expression.Constant(comparer, typeof(IEqualityComparer<TSource>)) )); /// <summary> /// Produces the set difference of two sequences according to a specified key selector function. /// </summary> /// <typeparam name="TSource">The type of the elements of the input sequence.</typeparam> /// <typeparam name="TKey">The type of key to identify elements by.</typeparam> /// <param name="source1">An <see cref="IQueryable{TSource}" /> whose keys that are not also in <paramref name="source2"/> will be returned.</param> /// <param name="source2">An <see cref="IEnumerable{TKey}" /> whose keys that also occur in the first sequence will cause those elements to be removed from the returned sequence.</param> /// <param name="keySelector">A function to extract the key for each element.</param> /// <returns>A <see cref="IQueryable{TSource}" /> that contains the set difference of the elements of two sequences.</returns> [DynamicDependency("ExceptBy`2", typeof(Enumerable))] public static IQueryable<TSource> ExceptBy<TSource, TKey>(this IQueryable<TSource> source1!!, IEnumerable<TKey> source2!!, Expression<Func<TSource, TKey>> keySelector!!) => source1.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.ExceptBy_TSource_TKey_3(typeof(TSource), typeof(TKey)), source1.Expression, GetSourceExpression(source2), Expression.Quote(keySelector) )); /// <summary> /// Produces the set difference of two sequences according to a specified key selector function. /// </summary> /// <typeparam name="TSource">The type of the elements of the input sequence.</typeparam> /// <typeparam name="TKey">The type of key to identify elements by.</typeparam> /// <param name="source1">An <see cref="IQueryable{TSource}" /> whose keys that are not also in <paramref name="source2"/> will be returned.</param> /// <param name="source2">An <see cref="IEnumerable{TKey}" /> whose keys that also occur in the first sequence will cause those elements to be removed from the returned sequence.</param> /// <param name="keySelector">A function to extract the key for each element.</param> /// <param name="comparer">An <see cref="IEqualityComparer{TKey}" /> to compare keys.</param> /// <returns>A <see cref="IQueryable{TSource}" /> that contains the set difference of the elements of two sequences.</returns> [DynamicDependency("ExceptBy`2", typeof(Enumerable))] public static IQueryable<TSource> ExceptBy<TSource, TKey>(this IQueryable<TSource> source1!!, IEnumerable<TKey> source2!!, Expression<Func<TSource, TKey>> keySelector!!, IEqualityComparer<TKey>? comparer) => source1.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.ExceptBy_TSource_TKey_4(typeof(TSource), typeof(TKey)), source1.Expression, GetSourceExpression(source2), Expression.Quote(keySelector), Expression.Constant(comparer, typeof(IEqualityComparer<TKey>)) )); [DynamicDependency("First`1", typeof(Enumerable))] public static TSource First<TSource>(this IQueryable<TSource> source!!) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.First_TSource_1(typeof(TSource)), source.Expression)); [DynamicDependency("First`1", typeof(Enumerable))] public static TSource First<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, bool>> predicate!!) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.First_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(predicate) )); [DynamicDependency("FirstOrDefault`1", typeof(Enumerable))] public static TSource? FirstOrDefault<TSource>(this IQueryable<TSource> source!!) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.FirstOrDefault_TSource_1(typeof(TSource)), source.Expression)); /// <summary>Returns the first element of a sequence, or a default value if the sequence contains no elements.</summary> /// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam> /// <param name="source">The <see cref="IEnumerable{T}" /> to return the first element of.</param> /// <param name="defaultValue">The default value to return if the sequence is empty.</param> /// <returns><paramref name="defaultValue" /> if <paramref name="source" /> is empty; otherwise, the first element in <paramref name="source" />.</returns> /// <exception cref="ArgumentNullException"><paramref name="source" /> is <see langword="null" />.</exception> [DynamicDependency("FirstOrDefault`1", typeof(Enumerable))] public static TSource FirstOrDefault<TSource>(this IQueryable<TSource> source!!, TSource defaultValue) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.FirstOrDefault_TSource_3(typeof(TSource)), source.Expression, Expression.Constant(defaultValue, typeof(TSource)))); [DynamicDependency("FirstOrDefault`1", typeof(Enumerable))] public static TSource? FirstOrDefault<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, bool>> predicate!!) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.FirstOrDefault_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(predicate) )); /// <summary>Returns the first element of the sequence that satisfies a condition or a default value if no such element is found.</summary> /// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam> /// <param name="source">An <see cref="IEnumerable{T}" /> to return an element from.</param> /// <param name="predicate">A function to test each element for a condition.</param> /// <param name="defaultValue">The default value to return if the sequence is empty.</param> /// <returns><paramref name="defaultValue" /> if <paramref name="source" /> is empty or if no element passes the test specified by <paramref name="predicate" />; otherwise, the first element in <paramref name="source" /> that passes the test specified by <paramref name="predicate" />.</returns> /// <exception cref="ArgumentNullException"><paramref name="source" /> or <paramref name="predicate" /> is <see langword="null" />.</exception> [DynamicDependency("FirstOrDefault`1", typeof(Enumerable))] public static TSource FirstOrDefault<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, bool>> predicate!!, TSource defaultValue) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.FirstOrDefault_TSource_4(typeof(TSource)), source.Expression, Expression.Quote(predicate), Expression.Constant(defaultValue, typeof(TSource)) )); [DynamicDependency("Last`1", typeof(Enumerable))] public static TSource Last<TSource>(this IQueryable<TSource> source!!) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.Last_TSource_1(typeof(TSource)), source.Expression)); [DynamicDependency("Last`1", typeof(Enumerable))] public static TSource Last<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, bool>> predicate!!) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.Last_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(predicate) )); [DynamicDependency("LastOrDefault`1", typeof(Enumerable))] public static TSource? LastOrDefault<TSource>(this IQueryable<TSource> source!!) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.LastOrDefault_TSource_1(typeof(TSource)), source.Expression)); /// <summary>Returns the last element of a sequence, or a default value if the sequence contains no elements.</summary> /// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam> /// <param name="source">An <see cref="IEnumerable{T}" /> to return the last element of.</param> /// <param name="defaultValue">The default value to return if the sequence is empty.</param> /// <returns><paramref name="defaultValue" /> if the source sequence is empty; otherwise, the last element in the <see cref="IEnumerable{T}" />.</returns> /// <exception cref="ArgumentNullException"><paramref name="source" /> is <see langword="null" />.</exception> [DynamicDependency("LastOrDefault`1", typeof(Enumerable))] public static TSource LastOrDefault<TSource>(this IQueryable<TSource> source!!, TSource defaultValue) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.LastOrDefault_TSource_3(typeof(TSource)), source.Expression, Expression.Constant(defaultValue, typeof(TSource)))); [DynamicDependency("LastOrDefault`1", typeof(Enumerable))] public static TSource? LastOrDefault<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, bool>> predicate!!) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.LastOrDefault_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(predicate) )); /// <summary>Returns the last element of a sequence that satisfies a condition or a default value if no such element is found.</summary> /// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam> /// <param name="source">An <see cref="IEnumerable{T}" /> to return an element from.</param> /// <param name="predicate">A function to test each element for a condition.</param> /// <param name="defaultValue">The default value to return if the sequence is empty.</param> /// <returns><paramref name="defaultValue" /> if the sequence is empty or if no elements pass the test in the predicate function; otherwise, the last element that passes the test in the predicate function.</returns> /// <exception cref="ArgumentNullException"><paramref name="source" /> or <paramref name="predicate" /> is <see langword="null" />.</exception> [DynamicDependency("LastOrDefault`1", typeof(Enumerable))] public static TSource LastOrDefault<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, bool>> predicate!!, TSource defaultValue) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.LastOrDefault_TSource_4(typeof(TSource)), source.Expression, Expression.Quote(predicate), Expression.Constant(defaultValue, typeof(TSource)) )); [DynamicDependency("Single`1", typeof(Enumerable))] public static TSource Single<TSource>(this IQueryable<TSource> source!!) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.Single_TSource_1(typeof(TSource)), source.Expression)); [DynamicDependency("Single`1", typeof(Enumerable))] public static TSource Single<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, bool>> predicate!!) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.Single_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(predicate) )); [DynamicDependency("SingleOrDefault`1", typeof(Enumerable))] public static TSource? SingleOrDefault<TSource>(this IQueryable<TSource> source!!) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.SingleOrDefault_TSource_1(typeof(TSource)), source.Expression)); /// <summary>Returns the only element of a sequence, or a default value if the sequence is empty; this method throws an exception if there is more than one element in the sequence.</summary> /// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam> /// <param name="source">An <see cref="IEnumerable{T}" /> to return the single element of.</param> /// <param name="defaultValue">The default value to return if the sequence is empty.</param> /// <returns>The single element of the input sequence, or <paramref name="defaultValue" /> if the sequence contains no elements.</returns> /// <exception cref="ArgumentNullException"><paramref name="source" /> is <see langword="null" />.</exception> /// <exception cref="InvalidOperationException">The input sequence contains more than one element.</exception> [DynamicDependency("SingleOrDefault`1", typeof(Enumerable))] public static TSource SingleOrDefault<TSource>(this IQueryable<TSource> source!!, TSource defaultValue) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.SingleOrDefault_TSource_3(typeof(TSource)), source.Expression, Expression.Constant(defaultValue, typeof(TSource)))); [DynamicDependency("SingleOrDefault`1", typeof(Enumerable))] public static TSource? SingleOrDefault<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, bool>> predicate!!) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.SingleOrDefault_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(predicate) )); /// <summary>Returns the only element of a sequence that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition.</summary> /// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam> /// <param name="source">An <see cref="IEnumerable{T}" /> to return a single element from.</param> /// <param name="predicate">A function to test an element for a condition.</param> /// <param name="defaultValue">The default value to return if the sequence is empty.</param> /// <returns>The single element of the input sequence that satisfies the condition, or <paramref name="defaultValue" /> if no such element is found.</returns> /// <exception cref="ArgumentNullException"><paramref name="source" /> or <paramref name="predicate" /> is <see langword="null" />.</exception> /// <exception cref="InvalidOperationException">More than one element satisfies the condition in <paramref name="predicate" />.</exception> [DynamicDependency("SingleOrDefault`1", typeof(Enumerable))] public static TSource SingleOrDefault<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, bool>> predicate!!, TSource defaultValue) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.SingleOrDefault_TSource_4(typeof(TSource)), source.Expression, Expression.Quote(predicate), Expression.Constant(defaultValue, typeof(TSource)) )); [DynamicDependency("ElementAt`1", typeof(Enumerable))] public static TSource ElementAt<TSource>(this IQueryable<TSource> source!!, int index) { if (index < 0) throw Error.ArgumentOutOfRange(nameof(index)); return source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.ElementAt_Int32_TSource_2(typeof(TSource)), source.Expression, Expression.Constant(index) )); } /// <summary>Returns the element at a specified index in a sequence.</summary> /// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam> /// <param name="source">An <see cref="IQueryable{T}" /> to return an element from.</param> /// <param name="index">The index of the element to retrieve, which is either from the start or the end.</param> /// <exception cref="ArgumentNullException"><paramref name="source" /> is <see langword="null" />.</exception> /// <exception cref="ArgumentOutOfRangeException"><paramref name="index" /> is outside the bounds of the <paramref name="source" /> sequence.</exception> /// <returns>The element at the specified position in the <paramref name="source" /> sequence.</returns> [DynamicDependency("ElementAt`1", typeof(Enumerable))] public static TSource ElementAt<TSource>(this IQueryable<TSource> source!!, Index index) { if (index.IsFromEnd && index.Value == 0) throw Error.ArgumentOutOfRange(nameof(index)); return source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.ElementAt_Index_TSource_2(typeof(TSource)), source.Expression, Expression.Constant(index) )); } [DynamicDependency("ElementAtOrDefault`1", typeof(Enumerable))] public static TSource? ElementAtOrDefault<TSource>(this IQueryable<TSource> source!!, int index) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.ElementAtOrDefault_Int32_TSource_2(typeof(TSource)), source.Expression, Expression.Constant(index) )); /// <summary>Returns the element at a specified index in a sequence or a default value if the index is out of range.</summary> /// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam> /// <param name="source">An <see cref="IQueryable{T}" /> to return an element from.</param> /// <param name="index">The index of the element to retrieve, which is either from the start or the end.</param> /// <exception cref="ArgumentNullException"><paramref name="source" /> is <see langword="null" />.</exception> /// <returns><see langword="default" /> if <paramref name="index" /> is outside the bounds of the <paramref name="source" /> sequence; otherwise, the element at the specified position in the <paramref name="source" /> sequence.</returns> [DynamicDependency("ElementAtOrDefault`1", typeof(Enumerable))] public static TSource? ElementAtOrDefault<TSource>(this IQueryable<TSource> source!!, Index index) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.ElementAtOrDefault_Index_TSource_2(typeof(TSource)), source.Expression, Expression.Constant(index) )); [DynamicDependency("DefaultIfEmpty`1", typeof(Enumerable))] public static IQueryable<TSource> DefaultIfEmpty<TSource>(this IQueryable<TSource> source!!) => source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.DefaultIfEmpty_TSource_1(typeof(TSource)), source.Expression)); [DynamicDependency("DefaultIfEmpty`1", typeof(Enumerable))] public static IQueryable<TSource> DefaultIfEmpty<TSource>(this IQueryable<TSource> source!!, TSource defaultValue) => source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.DefaultIfEmpty_TSource_2(typeof(TSource)), source.Expression, Expression.Constant(defaultValue, typeof(TSource)) )); [DynamicDependency("Contains`1", typeof(Enumerable))] public static bool Contains<TSource>(this IQueryable<TSource> source!!, TSource item) => source.Provider.Execute<bool>( Expression.Call( null, CachedReflectionInfo.Contains_TSource_2(typeof(TSource)), source.Expression, Expression.Constant(item, typeof(TSource)) )); [DynamicDependency("Contains`1", typeof(Enumerable))] public static bool Contains<TSource>(this IQueryable<TSource> source!!, TSource item, IEqualityComparer<TSource>? comparer) => source.Provider.Execute<bool>( Expression.Call( null, CachedReflectionInfo.Contains_TSource_3(typeof(TSource)), source.Expression, Expression.Constant(item, typeof(TSource)), Expression.Constant(comparer, typeof(IEqualityComparer<TSource>)) )); [DynamicDependency("Reverse`1", typeof(Enumerable))] public static IQueryable<TSource> Reverse<TSource>(this IQueryable<TSource> source!!) => source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.Reverse_TSource_1(typeof(TSource)), source.Expression)); [DynamicDependency("SequenceEqual`1", typeof(Enumerable))] public static bool SequenceEqual<TSource>(this IQueryable<TSource> source1!!, IEnumerable<TSource> source2!!) => source1.Provider.Execute<bool>( Expression.Call( null, CachedReflectionInfo.SequenceEqual_TSource_2(typeof(TSource)), source1.Expression, GetSourceExpression(source2) )); [DynamicDependency("SequenceEqual`1", typeof(Enumerable))] public static bool SequenceEqual<TSource>(this IQueryable<TSource> source1!!, IEnumerable<TSource> source2!!, IEqualityComparer<TSource>? comparer) => source1.Provider.Execute<bool>( Expression.Call( null, CachedReflectionInfo.SequenceEqual_TSource_3(typeof(TSource)), source1.Expression, GetSourceExpression(source2), Expression.Constant(comparer, typeof(IEqualityComparer<TSource>)) )); [DynamicDependency("Any`1", typeof(Enumerable))] public static bool Any<TSource>(this IQueryable<TSource> source!!) => source.Provider.Execute<bool>( Expression.Call( null, CachedReflectionInfo.Any_TSource_1(typeof(TSource)), source.Expression)); [DynamicDependency("Any`1", typeof(Enumerable))] public static bool Any<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, bool>> predicate!!) => source.Provider.Execute<bool>( Expression.Call( null, CachedReflectionInfo.Any_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(predicate) )); [DynamicDependency("All`1", typeof(Enumerable))] public static bool All<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, bool>> predicate!!) => source.Provider.Execute<bool>( Expression.Call( null, CachedReflectionInfo.All_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(predicate) )); [DynamicDependency("Count`1", typeof(Enumerable))] public static int Count<TSource>(this IQueryable<TSource> source!!) => source.Provider.Execute<int>( Expression.Call( null, CachedReflectionInfo.Count_TSource_1(typeof(TSource)), source.Expression)); [DynamicDependency("Count`1", typeof(Enumerable))] public static int Count<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, bool>> predicate!!) => source.Provider.Execute<int>( Expression.Call( null, CachedReflectionInfo.Count_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(predicate) )); [DynamicDependency("LongCount`1", typeof(Enumerable))] public static long LongCount<TSource>(this IQueryable<TSource> source!!) => source.Provider.Execute<long>( Expression.Call( null, CachedReflectionInfo.LongCount_TSource_1(typeof(TSource)), source.Expression)); [DynamicDependency("LongCount`1", typeof(Enumerable))] public static long LongCount<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, bool>> predicate!!) => source.Provider.Execute<long>( Expression.Call( null, CachedReflectionInfo.LongCount_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(predicate) )); [DynamicDependency("Min`1", typeof(Enumerable))] public static TSource? Min<TSource>(this IQueryable<TSource> source!!) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.Min_TSource_1(typeof(TSource)), source.Expression)); /// <summary>Returns the minimum value in a generic <see cref="System.Linq.IQueryable{T}" />.</summary> /// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam> /// <param name="source">A sequence of values to determine the minimum value of.</param> /// <param name="comparer">The <see cref="IComparer{T}" /> to compare values.</param> /// <returns>The minimum value in the sequence.</returns> /// <exception cref="ArgumentNullException"><paramref name="source" /> is <see langword="null" />.</exception> /// <exception cref="ArgumentException">No object in <paramref name="source" /> implements the <see cref="System.IComparable" /> or <see cref="System.IComparable{T}" /> interface.</exception> [DynamicDependency("Min`1", typeof(Enumerable))] public static TSource? Min<TSource>(this IQueryable<TSource> source!!, IComparer<TSource>? comparer) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.Min_TSource_2(typeof(TSource)), source.Expression, Expression.Constant(comparer, typeof(IComparer<TSource>)) )); [DynamicDependency("Min`2", typeof(Enumerable))] public static TResult? Min<TSource, TResult>(this IQueryable<TSource> source!!, Expression<Func<TSource, TResult>> selector!!) => source.Provider.Execute<TResult>( Expression.Call( null, CachedReflectionInfo.Min_TSource_TResult_2(typeof(TSource), typeof(TResult)), source.Expression, Expression.Quote(selector) )); /// <summary>Returns the minimum value in a generic <see cref="IQueryable{T}"/> according to a specified key selector function.</summary> /// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam> /// <typeparam name="TKey">The type of key to compare elements by.</typeparam> /// <param name="source">A sequence of values to determine the minimum value of.</param> /// <param name="keySelector">A function to extract the key for each element.</param> /// <returns>The value with the minimum key in the sequence.</returns> /// <exception cref="ArgumentNullException"><paramref name="source" /> is <see langword="null" />.</exception> /// <exception cref="ArgumentException">No key extracted from <paramref name="source" /> implements the <see cref="IComparable" /> or <see cref="IComparable{TKey}" /> interface.</exception> [DynamicDependency("MinBy`2", typeof(Enumerable))] public static TSource? MinBy<TSource, TKey>(this IQueryable<TSource> source!!, Expression<Func<TSource, TKey>> keySelector!!) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.MinBy_TSource_TKey_2(typeof(TSource), typeof(TKey)), source.Expression, Expression.Quote(keySelector) )); /// <summary>Returns the minimum value in a generic <see cref="IQueryable{T}"/> according to a specified key selector function.</summary> /// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam> /// <typeparam name="TKey">The type of key to compare elements by.</typeparam> /// <param name="source">A sequence of values to determine the minimum value of.</param> /// <param name="keySelector">A function to extract the key for each element.</param> /// <param name="comparer">The <see cref="IComparer{TKey}" /> to compare keys.</param> /// <returns>The value with the minimum key in the sequence.</returns> /// <exception cref="ArgumentNullException"><paramref name="source" /> is <see langword="null" />.</exception> /// <exception cref="ArgumentException">No key extracted from <paramref name="source" /> implements the <see cref="IComparable" /> or <see cref="IComparable{TKey}" /> interface.</exception> [DynamicDependency("MinBy`2", typeof(Enumerable))] public static TSource? MinBy<TSource, TKey>(this IQueryable<TSource> source!!, Expression<Func<TSource, TKey>> keySelector!!, IComparer<TSource>? comparer) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.MinBy_TSource_TKey_3(typeof(TSource), typeof(TKey)), source.Expression, Expression.Quote(keySelector), Expression.Constant(comparer, typeof(IComparer<TSource>)) )); [DynamicDependency("Max`1", typeof(Enumerable))] public static TSource? Max<TSource>(this IQueryable<TSource> source!!) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.Max_TSource_1(typeof(TSource)), source.Expression)); /// <summary>Returns the maximum value in a generic <see cref="System.Linq.IQueryable{T}" />.</summary> /// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam> /// <param name="source">A sequence of values to determine the maximum value of.</param> /// <param name="comparer">The <see cref="IComparer{T}" /> to compare values.</param> /// <returns>The maximum value in the sequence.</returns> /// <exception cref="ArgumentNullException"><paramref name="source" /> is <see langword="null" />.</exception> [DynamicDependency("Max`1", typeof(Enumerable))] public static TSource? Max<TSource>(this IQueryable<TSource> source!!, IComparer<TSource>? comparer) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.Max_TSource_2(typeof(TSource)), source.Expression, Expression.Constant(comparer, typeof(IComparer<TSource>)) )); [DynamicDependency("Max`2", typeof(Enumerable))] public static TResult? Max<TSource, TResult>(this IQueryable<TSource> source!!, Expression<Func<TSource, TResult>> selector!!) => source.Provider.Execute<TResult>( Expression.Call( null, CachedReflectionInfo.Max_TSource_TResult_2(typeof(TSource), typeof(TResult)), source.Expression, Expression.Quote(selector) )); /// <summary>Returns the maximum value in a generic <see cref="IQueryable{T}"/> according to a specified key selector function.</summary> /// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam> /// <typeparam name="TKey">The type of key to compare elements by.</typeparam> /// <param name="source">A sequence of values to determine the maximum value of.</param> /// <param name="keySelector">A function to extract the key for each element.</param> /// <returns>The value with the maximum key in the sequence.</returns> /// <exception cref="ArgumentNullException"><paramref name="source" /> is <see langword="null" />.</exception> /// <exception cref="ArgumentException">No key extracted from <paramref name="source" /> implements the <see cref="IComparable" /> or <see cref="IComparable{TKey}" /> interface.</exception> [DynamicDependency("MaxBy`2", typeof(Enumerable))] public static TSource? MaxBy<TSource, TKey>(this IQueryable<TSource> source!!, Expression<Func<TSource, TKey>> keySelector!!) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.MaxBy_TSource_TKey_2(typeof(TSource), typeof(TKey)), source.Expression, Expression.Quote(keySelector) )); /// <summary>Returns the maximum value in a generic <see cref="IQueryable{T}"/> according to a specified key selector function.</summary> /// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam> /// <typeparam name="TKey">The type of key to compare elements by.</typeparam> /// <param name="source">A sequence of values to determine the maximum value of.</param> /// <param name="keySelector">A function to extract the key for each element.</param> /// <param name="comparer">The <see cref="IComparer{TKey}" /> to compare keys.</param> /// <returns>The value with the maximum key in the sequence.</returns> /// <exception cref="ArgumentNullException"><paramref name="source" /> is <see langword="null" />.</exception> /// <exception cref="ArgumentException">No key extracted from <paramref name="source" /> implements the <see cref="IComparable" /> or <see cref="IComparable{TKey}" /> interface.</exception> [DynamicDependency("MaxBy`2", typeof(Enumerable))] public static TSource? MaxBy<TSource, TKey>(this IQueryable<TSource> source!!, Expression<Func<TSource, TKey>> keySelector!!, IComparer<TSource>? comparer) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.MaxBy_TSource_TKey_3(typeof(TSource), typeof(TKey)), source.Expression, Expression.Quote(keySelector), Expression.Constant(comparer, typeof(IComparer<TSource>)) )); [DynamicDependency("Sum", typeof(Enumerable))] public static int Sum(this IQueryable<int> source!!) => source.Provider.Execute<int>( Expression.Call( null, CachedReflectionInfo.Sum_Int32_1, source.Expression)); [DynamicDependency("Sum", typeof(Enumerable))] public static int? Sum(this IQueryable<int?> source!!) => source.Provider.Execute<int?>( Expression.Call( null, CachedReflectionInfo.Sum_NullableInt32_1, source.Expression)); [DynamicDependency("Sum", typeof(Enumerable))] public static long Sum(this IQueryable<long> source!!) => source.Provider.Execute<long>( Expression.Call( null, CachedReflectionInfo.Sum_Int64_1, source.Expression)); [DynamicDependency("Sum", typeof(Enumerable))] public static long? Sum(this IQueryable<long?> source!!) => source.Provider.Execute<long?>( Expression.Call( null, CachedReflectionInfo.Sum_NullableInt64_1, source.Expression)); [DynamicDependency("Sum", typeof(Enumerable))] public static float Sum(this IQueryable<float> source!!) => source.Provider.Execute<float>( Expression.Call( null, CachedReflectionInfo.Sum_Single_1, source.Expression)); [DynamicDependency("Sum", typeof(Enumerable))] public static float? Sum(this IQueryable<float?> source!!) => source.Provider.Execute<float?>( Expression.Call( null, CachedReflectionInfo.Sum_NullableSingle_1, source.Expression)); [DynamicDependency("Sum", typeof(Enumerable))] public static double Sum(this IQueryable<double> source!!) => source.Provider.Execute<double>( Expression.Call( null, CachedReflectionInfo.Sum_Double_1, source.Expression)); [DynamicDependency("Sum", typeof(Enumerable))] public static double? Sum(this IQueryable<double?> source!!) => source.Provider.Execute<double?>( Expression.Call( null, CachedReflectionInfo.Sum_NullableDouble_1, source.Expression)); [DynamicDependency("Sum", typeof(Enumerable))] public static decimal Sum(this IQueryable<decimal> source!!) => source.Provider.Execute<decimal>( Expression.Call( null, CachedReflectionInfo.Sum_Decimal_1, source.Expression)); [DynamicDependency("Sum", typeof(Enumerable))] public static decimal? Sum(this IQueryable<decimal?> source!!) => source.Provider.Execute<decimal?>( Expression.Call( null, CachedReflectionInfo.Sum_NullableDecimal_1, source.Expression)); [DynamicDependency("Sum`1", typeof(Enumerable))] public static int Sum<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, int>> selector!!) => source.Provider.Execute<int>( Expression.Call( null, CachedReflectionInfo.Sum_Int32_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("Sum`1", typeof(Enumerable))] public static int? Sum<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, int?>> selector!!) => source.Provider.Execute<int?>( Expression.Call( null, CachedReflectionInfo.Sum_NullableInt32_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("Sum`1", typeof(Enumerable))] public static long Sum<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, long>> selector!!) => source.Provider.Execute<long>( Expression.Call( null, CachedReflectionInfo.Sum_Int64_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("Sum`1", typeof(Enumerable))] public static long? Sum<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, long?>> selector!!) => source.Provider.Execute<long?>( Expression.Call( null, CachedReflectionInfo.Sum_NullableInt64_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("Sum`1", typeof(Enumerable))] public static float Sum<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, float>> selector!!) => source.Provider.Execute<float>( Expression.Call( null, CachedReflectionInfo.Sum_Single_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("Sum`1", typeof(Enumerable))] public static float? Sum<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, float?>> selector!!) => source.Provider.Execute<float?>( Expression.Call( null, CachedReflectionInfo.Sum_NullableSingle_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("Sum`1", typeof(Enumerable))] public static double Sum<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, double>> selector!!) => source.Provider.Execute<double>( Expression.Call( null, CachedReflectionInfo.Sum_Double_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("Sum`1", typeof(Enumerable))] public static double? Sum<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, double?>> selector!!) => source.Provider.Execute<double?>( Expression.Call( null, CachedReflectionInfo.Sum_NullableDouble_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("Sum`1", typeof(Enumerable))] public static decimal Sum<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, decimal>> selector!!) => source.Provider.Execute<decimal>( Expression.Call( null, CachedReflectionInfo.Sum_Decimal_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("Sum`1", typeof(Enumerable))] public static decimal? Sum<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, decimal?>> selector!!) => source.Provider.Execute<decimal?>( Expression.Call( null, CachedReflectionInfo.Sum_NullableDecimal_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("Average", typeof(Enumerable))] public static double Average(this IQueryable<int> source!!) => source.Provider.Execute<double>( Expression.Call( null, CachedReflectionInfo.Average_Int32_1, source.Expression)); [DynamicDependency("Average", typeof(Enumerable))] public static double? Average(this IQueryable<int?> source!!) => source.Provider.Execute<double?>( Expression.Call( null, CachedReflectionInfo.Average_NullableInt32_1, source.Expression)); [DynamicDependency("Average", typeof(Enumerable))] public static double Average(this IQueryable<long> source!!) => source.Provider.Execute<double>( Expression.Call( null, CachedReflectionInfo.Average_Int64_1, source.Expression)); [DynamicDependency("Average", typeof(Enumerable))] public static double? Average(this IQueryable<long?> source!!) => source.Provider.Execute<double?>( Expression.Call( null, CachedReflectionInfo.Average_NullableInt64_1, source.Expression)); [DynamicDependency("Average", typeof(Enumerable))] public static float Average(this IQueryable<float> source!!) => source.Provider.Execute<float>( Expression.Call( null, CachedReflectionInfo.Average_Single_1, source.Expression)); [DynamicDependency("Average", typeof(Enumerable))] public static float? Average(this IQueryable<float?> source!!) => source.Provider.Execute<float?>( Expression.Call( null, CachedReflectionInfo.Average_NullableSingle_1, source.Expression)); [DynamicDependency("Average", typeof(Enumerable))] public static double Average(this IQueryable<double> source!!) => source.Provider.Execute<double>( Expression.Call( null, CachedReflectionInfo.Average_Double_1, source.Expression)); [DynamicDependency("Average", typeof(Enumerable))] public static double? Average(this IQueryable<double?> source!!) => source.Provider.Execute<double?>( Expression.Call( null, CachedReflectionInfo.Average_NullableDouble_1, source.Expression)); [DynamicDependency("Average", typeof(Enumerable))] public static decimal Average(this IQueryable<decimal> source!!) => source.Provider.Execute<decimal>( Expression.Call( null, CachedReflectionInfo.Average_Decimal_1, source.Expression)); [DynamicDependency("Average", typeof(Enumerable))] public static decimal? Average(this IQueryable<decimal?> source!!) => source.Provider.Execute<decimal?>( Expression.Call( null, CachedReflectionInfo.Average_NullableDecimal_1, source.Expression)); [DynamicDependency("Average`1", typeof(Enumerable))] public static double Average<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, int>> selector!!) => source.Provider.Execute<double>( Expression.Call( null, CachedReflectionInfo.Average_Int32_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("Average`1", typeof(Enumerable))] public static double? Average<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, int?>> selector!!) => source.Provider.Execute<double?>( Expression.Call( null, CachedReflectionInfo.Average_NullableInt32_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("Average`1", typeof(Enumerable))] public static float Average<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, float>> selector!!) => source.Provider.Execute<float>( Expression.Call( null, CachedReflectionInfo.Average_Single_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("Average`1", typeof(Enumerable))] public static float? Average<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, float?>> selector!!) => source.Provider.Execute<float?>( Expression.Call( null, CachedReflectionInfo.Average_NullableSingle_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("Average`1", typeof(Enumerable))] public static double Average<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, long>> selector!!) => source.Provider.Execute<double>( Expression.Call( null, CachedReflectionInfo.Average_Int64_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("Average`1", typeof(Enumerable))] public static double? Average<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, long?>> selector!!) => source.Provider.Execute<double?>( Expression.Call( null, CachedReflectionInfo.Average_NullableInt64_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("Average`1", typeof(Enumerable))] public static double Average<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, double>> selector!!) => source.Provider.Execute<double>( Expression.Call( null, CachedReflectionInfo.Average_Double_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("Average`1", typeof(Enumerable))] public static double? Average<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, double?>> selector!!) => source.Provider.Execute<double?>( Expression.Call( null, CachedReflectionInfo.Average_NullableDouble_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("Average`1", typeof(Enumerable))] public static decimal Average<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, decimal>> selector!!) => source.Provider.Execute<decimal>( Expression.Call( null, CachedReflectionInfo.Average_Decimal_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("Average`1", typeof(Enumerable))] public static decimal? Average<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, decimal?>> selector!!) => source.Provider.Execute<decimal?>( Expression.Call( null, CachedReflectionInfo.Average_NullableDecimal_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("Aggregate`1", typeof(Enumerable))] public static TSource Aggregate<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, TSource, TSource>> func!!) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.Aggregate_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(func) )); [DynamicDependency("Aggregate`2", typeof(Enumerable))] public static TAccumulate Aggregate<TSource, TAccumulate>(this IQueryable<TSource> source!!, TAccumulate seed, Expression<Func<TAccumulate, TSource, TAccumulate>> func!!) => source.Provider.Execute<TAccumulate>( Expression.Call( null, CachedReflectionInfo.Aggregate_TSource_TAccumulate_3(typeof(TSource), typeof(TAccumulate)), source.Expression, Expression.Constant(seed), Expression.Quote(func) )); [DynamicDependency("Aggregate`3", typeof(Enumerable))] public static TResult Aggregate<TSource, TAccumulate, TResult>(this IQueryable<TSource> source!!, TAccumulate seed, Expression<Func<TAccumulate, TSource, TAccumulate>> func!!, Expression<Func<TAccumulate, TResult>> selector!!) => source.Provider.Execute<TResult>( Expression.Call( null, CachedReflectionInfo.Aggregate_TSource_TAccumulate_TResult_4(typeof(TSource), typeof(TAccumulate), typeof(TResult)), source.Expression, Expression.Constant(seed), Expression.Quote(func), Expression.Quote(selector))); [DynamicDependency("SkipLast`1", typeof(Enumerable))] public static IQueryable<TSource> SkipLast<TSource>(this IQueryable<TSource> source!!, int count) => source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.SkipLast_TSource_2(typeof(TSource)), source.Expression, Expression.Constant(count) )); [DynamicDependency("TakeLast`1", typeof(Enumerable))] public static IQueryable<TSource> TakeLast<TSource>(this IQueryable<TSource> source!!, int count) => source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.TakeLast_TSource_2(typeof(TSource)), source.Expression, Expression.Constant(count) )); [DynamicDependency("Append`1", typeof(Enumerable))] public static IQueryable<TSource> Append<TSource>(this IQueryable<TSource> source!!, TSource element) => source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.Append_TSource_2(typeof(TSource)), source.Expression, Expression.Constant(element) )); [DynamicDependency("Prepend`1", typeof(Enumerable))] public static IQueryable<TSource> Prepend<TSource>(this IQueryable<TSource> source!!, TSource element) => source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.Prepend_TSource_2(typeof(TSource)), source.Expression, Expression.Constant(element) )); } }
// 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.CodeAnalysis; using System.Linq.Expressions; namespace System.Linq { public static class Queryable { internal const string InMemoryQueryableExtensionMethodsRequiresUnreferencedCode = "Enumerating in-memory collections as IQueryable can require unreferenced code because expressions referencing IQueryable extension methods can get rebound to IEnumerable extension methods. The IEnumerable extension methods could be trimmed causing the application to fail at runtime."; [RequiresUnreferencedCode(InMemoryQueryableExtensionMethodsRequiresUnreferencedCode)] public static IQueryable<TElement> AsQueryable<TElement>(this IEnumerable<TElement> source!!) => source as IQueryable<TElement> ?? new EnumerableQuery<TElement>(source); [RequiresUnreferencedCode(InMemoryQueryableExtensionMethodsRequiresUnreferencedCode)] public static IQueryable AsQueryable(this IEnumerable source!!) { if (source is IQueryable queryable) { return queryable; } Type? enumType = TypeHelper.FindGenericType(typeof(IEnumerable<>), source.GetType()); if (enumType == null) { throw Error.ArgumentNotIEnumerableGeneric(nameof(source)); } return EnumerableQuery.Create(enumType.GenericTypeArguments[0], source); } [DynamicDependency("Where`1", typeof(Enumerable))] public static IQueryable<TSource> Where<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, bool>> predicate!!) => source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.Where_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(predicate) )); [DynamicDependency("Where`1", typeof(Enumerable))] public static IQueryable<TSource> Where<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, int, bool>> predicate!!) => source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.Where_Index_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(predicate) )); [DynamicDependency("OfType`1", typeof(Enumerable))] public static IQueryable<TResult> OfType<TResult>(this IQueryable source!!) => source.Provider.CreateQuery<TResult>( Expression.Call( null, CachedReflectionInfo.OfType_TResult_1(typeof(TResult)), source.Expression)); [DynamicDependency("Cast`1", typeof(Enumerable))] public static IQueryable<TResult> Cast<TResult>(this IQueryable source!!) => source.Provider.CreateQuery<TResult>( Expression.Call( null, CachedReflectionInfo.Cast_TResult_1(typeof(TResult)), source.Expression)); [DynamicDependency("Select`2", typeof(Enumerable))] public static IQueryable<TResult> Select<TSource, TResult>(this IQueryable<TSource> source!!, Expression<Func<TSource, TResult>> selector!!) => source.Provider.CreateQuery<TResult>( Expression.Call( null, CachedReflectionInfo.Select_TSource_TResult_2(typeof(TSource), typeof(TResult)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("Select`2", typeof(Enumerable))] public static IQueryable<TResult> Select<TSource, TResult>(this IQueryable<TSource> source!!, Expression<Func<TSource, int, TResult>> selector!!) => source.Provider.CreateQuery<TResult>( Expression.Call( null, CachedReflectionInfo.Select_Index_TSource_TResult_2(typeof(TSource), typeof(TResult)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("SelectMany`2", typeof(Enumerable))] public static IQueryable<TResult> SelectMany<TSource, TResult>(this IQueryable<TSource> source!!, Expression<Func<TSource, IEnumerable<TResult>>> selector!!) => source.Provider.CreateQuery<TResult>( Expression.Call( null, CachedReflectionInfo.SelectMany_TSource_TResult_2(typeof(TSource), typeof(TResult)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("SelectMany`2", typeof(Enumerable))] public static IQueryable<TResult> SelectMany<TSource, TResult>(this IQueryable<TSource> source!!, Expression<Func<TSource, int, IEnumerable<TResult>>> selector!!) => source.Provider.CreateQuery<TResult>( Expression.Call( null, CachedReflectionInfo.SelectMany_Index_TSource_TResult_2(typeof(TSource), typeof(TResult)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("SelectMany`3", typeof(Enumerable))] public static IQueryable<TResult> SelectMany<TSource, TCollection, TResult>(this IQueryable<TSource> source!!, Expression<Func<TSource, int, IEnumerable<TCollection>>> collectionSelector!!, Expression<Func<TSource, TCollection, TResult>> resultSelector!!) => source.Provider.CreateQuery<TResult>( Expression.Call( null, CachedReflectionInfo.SelectMany_Index_TSource_TCollection_TResult_3(typeof(TSource), typeof(TCollection), typeof(TResult)), source.Expression, Expression.Quote(collectionSelector), Expression.Quote(resultSelector) )); [DynamicDependency("SelectMany`3", typeof(Enumerable))] public static IQueryable<TResult> SelectMany<TSource, TCollection, TResult>(this IQueryable<TSource> source!!, Expression<Func<TSource, IEnumerable<TCollection>>> collectionSelector!!, Expression<Func<TSource, TCollection, TResult>> resultSelector!!) => source.Provider.CreateQuery<TResult>( Expression.Call( null, CachedReflectionInfo.SelectMany_TSource_TCollection_TResult_3(typeof(TSource), typeof(TCollection), typeof(TResult)), source.Expression, Expression.Quote(collectionSelector), Expression.Quote(resultSelector) )); private static Expression GetSourceExpression<TSource>(IEnumerable<TSource> source) { IQueryable<TSource>? q = source as IQueryable<TSource>; return q != null ? q.Expression : Expression.Constant(source, typeof(IEnumerable<TSource>)); } [DynamicDependency("Join`4", typeof(Enumerable))] public static IQueryable<TResult> Join<TOuter, TInner, TKey, TResult>(this IQueryable<TOuter> outer!!, IEnumerable<TInner> inner!!, Expression<Func<TOuter, TKey>> outerKeySelector!!, Expression<Func<TInner, TKey>> innerKeySelector!!, Expression<Func<TOuter, TInner, TResult>> resultSelector!!) => outer.Provider.CreateQuery<TResult>( Expression.Call( null, CachedReflectionInfo.Join_TOuter_TInner_TKey_TResult_5(typeof(TOuter), typeof(TInner), typeof(TKey), typeof(TResult)), outer.Expression, GetSourceExpression(inner), Expression.Quote(outerKeySelector), Expression.Quote(innerKeySelector), Expression.Quote(resultSelector))); [DynamicDependency("Join`4", typeof(Enumerable))] public static IQueryable<TResult> Join<TOuter, TInner, TKey, TResult>(this IQueryable<TOuter> outer!!, IEnumerable<TInner> inner!!, Expression<Func<TOuter, TKey>> outerKeySelector!!, Expression<Func<TInner, TKey>> innerKeySelector!!, Expression<Func<TOuter, TInner, TResult>> resultSelector!!, IEqualityComparer<TKey>? comparer) => outer.Provider.CreateQuery<TResult>( Expression.Call( null, CachedReflectionInfo.Join_TOuter_TInner_TKey_TResult_6(typeof(TOuter), typeof(TInner), typeof(TKey), typeof(TResult)), outer.Expression, GetSourceExpression(inner), Expression.Quote(outerKeySelector), Expression.Quote(innerKeySelector), Expression.Quote(resultSelector), Expression.Constant(comparer, typeof(IEqualityComparer<TKey>)))); [DynamicDependency("GroupJoin`4", typeof(Enumerable))] public static IQueryable<TResult> GroupJoin<TOuter, TInner, TKey, TResult>(this IQueryable<TOuter> outer!!, IEnumerable<TInner> inner!!, Expression<Func<TOuter, TKey>> outerKeySelector!!, Expression<Func<TInner, TKey>> innerKeySelector!!, Expression<Func<TOuter, IEnumerable<TInner>, TResult>> resultSelector!!) => outer.Provider.CreateQuery<TResult>( Expression.Call( null, CachedReflectionInfo.GroupJoin_TOuter_TInner_TKey_TResult_5(typeof(TOuter), typeof(TInner), typeof(TKey), typeof(TResult)), outer.Expression, GetSourceExpression(inner), Expression.Quote(outerKeySelector), Expression.Quote(innerKeySelector), Expression.Quote(resultSelector))); [DynamicDependency("GroupJoin`4", typeof(Enumerable))] public static IQueryable<TResult> GroupJoin<TOuter, TInner, TKey, TResult>(this IQueryable<TOuter> outer!!, IEnumerable<TInner> inner!!, Expression<Func<TOuter, TKey>> outerKeySelector!!, Expression<Func<TInner, TKey>> innerKeySelector!!, Expression<Func<TOuter, IEnumerable<TInner>, TResult>> resultSelector!!, IEqualityComparer<TKey>? comparer) => outer.Provider.CreateQuery<TResult>( Expression.Call( null, CachedReflectionInfo.GroupJoin_TOuter_TInner_TKey_TResult_6(typeof(TOuter), typeof(TInner), typeof(TKey), typeof(TResult)), outer.Expression, GetSourceExpression(inner), Expression.Quote(outerKeySelector), Expression.Quote(innerKeySelector), Expression.Quote(resultSelector), Expression.Constant(comparer, typeof(IEqualityComparer<TKey>)))); [DynamicDependency("OrderBy`2", typeof(Enumerable))] public static IOrderedQueryable<TSource> OrderBy<TSource, TKey>(this IQueryable<TSource> source!!, Expression<Func<TSource, TKey>> keySelector!!) => (IOrderedQueryable<TSource>)source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.OrderBy_TSource_TKey_2(typeof(TSource), typeof(TKey)), source.Expression, Expression.Quote(keySelector) )); [DynamicDependency("OrderBy`2", typeof(Enumerable))] public static IOrderedQueryable<TSource> OrderBy<TSource, TKey>(this IQueryable<TSource> source!!, Expression<Func<TSource, TKey>> keySelector!!, IComparer<TKey>? comparer) => (IOrderedQueryable<TSource>)source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.OrderBy_TSource_TKey_3(typeof(TSource), typeof(TKey)), source.Expression, Expression.Quote(keySelector), Expression.Constant(comparer, typeof(IComparer<TKey>)) )); [DynamicDependency("OrderByDescending`2", typeof(Enumerable))] public static IOrderedQueryable<TSource> OrderByDescending<TSource, TKey>(this IQueryable<TSource> source!!, Expression<Func<TSource, TKey>> keySelector!!) => (IOrderedQueryable<TSource>)source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.OrderByDescending_TSource_TKey_2(typeof(TSource), typeof(TKey)), source.Expression, Expression.Quote(keySelector) )); [DynamicDependency("OrderByDescending`2", typeof(Enumerable))] public static IOrderedQueryable<TSource> OrderByDescending<TSource, TKey>(this IQueryable<TSource> source!!, Expression<Func<TSource, TKey>> keySelector!!, IComparer<TKey>? comparer) => (IOrderedQueryable<TSource>)source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.OrderByDescending_TSource_TKey_3(typeof(TSource), typeof(TKey)), source.Expression, Expression.Quote(keySelector), Expression.Constant(comparer, typeof(IComparer<TKey>)) )); [DynamicDependency("ThenBy`2", typeof(Enumerable))] public static IOrderedQueryable<TSource> ThenBy<TSource, TKey>(this IOrderedQueryable<TSource> source!!, Expression<Func<TSource, TKey>> keySelector!!) => (IOrderedQueryable<TSource>)source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.ThenBy_TSource_TKey_2(typeof(TSource), typeof(TKey)), source.Expression, Expression.Quote(keySelector) )); [DynamicDependency("ThenBy`2", typeof(Enumerable))] public static IOrderedQueryable<TSource> ThenBy<TSource, TKey>(this IOrderedQueryable<TSource> source!!, Expression<Func<TSource, TKey>> keySelector!!, IComparer<TKey>? comparer) => (IOrderedQueryable<TSource>)source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.ThenBy_TSource_TKey_3(typeof(TSource), typeof(TKey)), source.Expression, Expression.Quote(keySelector), Expression.Constant(comparer, typeof(IComparer<TKey>)) )); [DynamicDependency("ThenByDescending`2", typeof(Enumerable))] public static IOrderedQueryable<TSource> ThenByDescending<TSource, TKey>(this IOrderedQueryable<TSource> source!!, Expression<Func<TSource, TKey>> keySelector!!) => (IOrderedQueryable<TSource>)source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.ThenByDescending_TSource_TKey_2(typeof(TSource), typeof(TKey)), source.Expression, Expression.Quote(keySelector) )); [DynamicDependency("ThenByDescending`2", typeof(Enumerable))] public static IOrderedQueryable<TSource> ThenByDescending<TSource, TKey>(this IOrderedQueryable<TSource> source!!, Expression<Func<TSource, TKey>> keySelector!!, IComparer<TKey>? comparer) => (IOrderedQueryable<TSource>)source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.ThenByDescending_TSource_TKey_3(typeof(TSource), typeof(TKey)), source.Expression, Expression.Quote(keySelector), Expression.Constant(comparer, typeof(IComparer<TKey>)) )); [DynamicDependency("Take`1", typeof(Enumerable))] public static IQueryable<TSource> Take<TSource>(this IQueryable<TSource> source!!, int count) => source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.Take_Int32_TSource_2(typeof(TSource)), source.Expression, Expression.Constant(count) )); /// <summary>Returns a specified range of contiguous elements from a sequence.</summary> /// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam> /// <param name="source">The sequence to return elements from.</param> /// <param name="range">The range of elements to return, which has start and end indexes either from the start or the end.</param> /// <exception cref="ArgumentNullException"><paramref name="source" /> is <see langword="null" />.</exception> /// <returns>An <see cref="IQueryable{T}" /> that contains the specified <paramref name="range" /> of elements from the <paramref name="source" /> sequence.</returns> [DynamicDependency("Take`1", typeof(Enumerable))] public static IQueryable<TSource> Take<TSource>(this IQueryable<TSource> source!!, Range range) => source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.Take_Range_TSource_2(typeof(TSource)), source.Expression, Expression.Constant(range) )); [DynamicDependency("TakeWhile`1", typeof(Enumerable))] public static IQueryable<TSource> TakeWhile<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, bool>> predicate!!) => source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.TakeWhile_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(predicate) )); [DynamicDependency("TakeWhile`1", typeof(Enumerable))] public static IQueryable<TSource> TakeWhile<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, int, bool>> predicate!!) => source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.TakeWhile_Index_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(predicate) )); [DynamicDependency("Skip`1", typeof(Enumerable))] public static IQueryable<TSource> Skip<TSource>(this IQueryable<TSource> source!!, int count) => source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.Skip_TSource_2(typeof(TSource)), source.Expression, Expression.Constant(count) )); [DynamicDependency("SkipWhile`1", typeof(Enumerable))] public static IQueryable<TSource> SkipWhile<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, bool>> predicate!!) => source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.SkipWhile_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(predicate) )); [DynamicDependency("SkipWhile`1", typeof(Enumerable))] public static IQueryable<TSource> SkipWhile<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, int, bool>> predicate!!) => source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.SkipWhile_Index_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(predicate) )); [DynamicDependency("GroupBy`2", typeof(Enumerable))] public static IQueryable<IGrouping<TKey, TSource>> GroupBy<TSource, TKey>(this IQueryable<TSource> source!!, Expression<Func<TSource, TKey>> keySelector!!) => source.Provider.CreateQuery<IGrouping<TKey, TSource>>( Expression.Call( null, CachedReflectionInfo.GroupBy_TSource_TKey_2(typeof(TSource), typeof(TKey)), source.Expression, Expression.Quote(keySelector) )); [DynamicDependency("GroupBy`3", typeof(Enumerable))] public static IQueryable<IGrouping<TKey, TElement>> GroupBy<TSource, TKey, TElement>(this IQueryable<TSource> source!!, Expression<Func<TSource, TKey>> keySelector!!, Expression<Func<TSource, TElement>> elementSelector!!) => source.Provider.CreateQuery<IGrouping<TKey, TElement>>( Expression.Call( null, CachedReflectionInfo.GroupBy_TSource_TKey_TElement_3(typeof(TSource), typeof(TKey), typeof(TElement)), source.Expression, Expression.Quote(keySelector), Expression.Quote(elementSelector) )); [DynamicDependency("GroupBy`2", typeof(Enumerable))] public static IQueryable<IGrouping<TKey, TSource>> GroupBy<TSource, TKey>(this IQueryable<TSource> source!!, Expression<Func<TSource, TKey>> keySelector!!, IEqualityComparer<TKey>? comparer) => source.Provider.CreateQuery<IGrouping<TKey, TSource>>( Expression.Call( null, CachedReflectionInfo.GroupBy_TSource_TKey_3(typeof(TSource), typeof(TKey)), source.Expression, Expression.Quote(keySelector), Expression.Constant(comparer, typeof(IEqualityComparer<TKey>)) )); [DynamicDependency("GroupBy`3", typeof(Enumerable))] public static IQueryable<IGrouping<TKey, TElement>> GroupBy<TSource, TKey, TElement>(this IQueryable<TSource> source!!, Expression<Func<TSource, TKey>> keySelector!!, Expression<Func<TSource, TElement>> elementSelector!!, IEqualityComparer<TKey>? comparer) => source.Provider.CreateQuery<IGrouping<TKey, TElement>>( Expression.Call( null, CachedReflectionInfo.GroupBy_TSource_TKey_TElement_4(typeof(TSource), typeof(TKey), typeof(TElement)), source.Expression, Expression.Quote(keySelector), Expression.Quote(elementSelector), Expression.Constant(comparer, typeof(IEqualityComparer<TKey>)))); [DynamicDependency("GroupBy`4", typeof(Enumerable))] public static IQueryable<TResult> GroupBy<TSource, TKey, TElement, TResult>(this IQueryable<TSource> source!!, Expression<Func<TSource, TKey>> keySelector!!, Expression<Func<TSource, TElement>> elementSelector!!, Expression<Func<TKey, IEnumerable<TElement>, TResult>> resultSelector!!) => source.Provider.CreateQuery<TResult>( Expression.Call( null, CachedReflectionInfo.GroupBy_TSource_TKey_TElement_TResult_4(typeof(TSource), typeof(TKey), typeof(TElement), typeof(TResult)), source.Expression, Expression.Quote(keySelector), Expression.Quote(elementSelector), Expression.Quote(resultSelector))); [DynamicDependency("GroupBy`3", typeof(Enumerable))] public static IQueryable<TResult> GroupBy<TSource, TKey, TResult>(this IQueryable<TSource> source!!, Expression<Func<TSource, TKey>> keySelector!!, Expression<Func<TKey, IEnumerable<TSource>, TResult>> resultSelector!!) => source.Provider.CreateQuery<TResult>( Expression.Call( null, CachedReflectionInfo.GroupBy_TSource_TKey_TResult_3(typeof(TSource), typeof(TKey), typeof(TResult)), source.Expression, Expression.Quote(keySelector), Expression.Quote(resultSelector) )); [DynamicDependency("GroupBy`3", typeof(Enumerable))] public static IQueryable<TResult> GroupBy<TSource, TKey, TResult>(this IQueryable<TSource> source!!, Expression<Func<TSource, TKey>> keySelector!!, Expression<Func<TKey, IEnumerable<TSource>, TResult>> resultSelector!!, IEqualityComparer<TKey>? comparer) => source.Provider.CreateQuery<TResult>( Expression.Call( null, CachedReflectionInfo.GroupBy_TSource_TKey_TResult_4(typeof(TSource), typeof(TKey), typeof(TResult)), source.Expression, Expression.Quote(keySelector), Expression.Quote(resultSelector), Expression.Constant(comparer, typeof(IEqualityComparer<TKey>)))); [DynamicDependency("GroupBy`4", typeof(Enumerable))] public static IQueryable<TResult> GroupBy<TSource, TKey, TElement, TResult>(this IQueryable<TSource> source!!, Expression<Func<TSource, TKey>> keySelector!!, Expression<Func<TSource, TElement>> elementSelector!!, Expression<Func<TKey, IEnumerable<TElement>, TResult>> resultSelector!!, IEqualityComparer<TKey>? comparer) => source.Provider.CreateQuery<TResult>( Expression.Call( null, CachedReflectionInfo.GroupBy_TSource_TKey_TElement_TResult_5(typeof(TSource), typeof(TKey), typeof(TElement), typeof(TResult)), source.Expression, Expression.Quote(keySelector), Expression.Quote(elementSelector), Expression.Quote(resultSelector), Expression.Constant(comparer, typeof(IEqualityComparer<TKey>)))); [DynamicDependency("Distinct`1", typeof(Enumerable))] public static IQueryable<TSource> Distinct<TSource>(this IQueryable<TSource> source!!) => source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.Distinct_TSource_1(typeof(TSource)), source.Expression)); [DynamicDependency("Distinct`1", typeof(Enumerable))] public static IQueryable<TSource> Distinct<TSource>(this IQueryable<TSource> source!!, IEqualityComparer<TSource>? comparer) => source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.Distinct_TSource_2(typeof(TSource)), source.Expression, Expression.Constant(comparer, typeof(IEqualityComparer<TSource>)) )); /// <summary>Returns distinct elements from a sequence according to a specified key selector function.</summary> /// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam> /// <typeparam name="TKey">The type of key to distinguish elements by.</typeparam> /// <param name="source">The sequence to remove duplicate elements from.</param> /// <param name="keySelector">A function to extract the key for each element.</param> /// <returns>An <see cref="IQueryable{T}" /> that contains distinct elements from the source sequence.</returns> /// <exception cref="ArgumentNullException"><paramref name="source" /> is <see langword="null" />.</exception> [DynamicDependency("DistinctBy`2", typeof(Enumerable))] public static IQueryable<TSource> DistinctBy<TSource, TKey>(this IQueryable<TSource> source!!, Expression<Func<TSource, TKey>> keySelector!!) => source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.DistinctBy_TSource_TKey_2(typeof(TSource), typeof(TKey)), source.Expression, Expression.Quote(keySelector) )); /// <summary>Returns distinct elements from a sequence according to a specified key selector function.</summary> /// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam> /// <typeparam name="TKey">The type of key to distinguish elements by.</typeparam> /// <param name="source">The sequence to remove duplicate elements from.</param> /// <param name="keySelector">A function to extract the key for each element.</param> /// <param name="comparer">An <see cref="IEqualityComparer{TKey}" /> to compare keys.</param> /// <returns>An <see cref="IQueryable{T}" /> that contains distinct elements from the source sequence.</returns> /// <exception cref="ArgumentNullException"><paramref name="source" /> is <see langword="null" />.</exception> [DynamicDependency("DistinctBy`2", typeof(Enumerable))] public static IQueryable<TSource> DistinctBy<TSource, TKey>(this IQueryable<TSource> source!!, Expression<Func<TSource, TKey>> keySelector!!, IEqualityComparer<TKey>? comparer) => source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.DistinctBy_TSource_TKey_3(typeof(TSource), typeof(TKey)), source.Expression, Expression.Quote(keySelector), Expression.Constant(comparer, typeof(IEqualityComparer<TKey>)) )); /// <summary>Split the elements of a sequence into chunks of size at most <paramref name="size"/>.</summary> /// <param name="source">An <see cref="IEnumerable{T}"/> whose elements to chunk.</param> /// <param name="size">Maximum size of each chunk.</param> /// <typeparam name="TSource">The type of the elements of source.</typeparam> /// <returns>An <see cref="IQueryable{T}"/> that contains the elements the input sequence split into chunks of size <paramref name="size"/>.</returns> /// <exception cref="ArgumentNullException"><paramref name="source"/> is null.</exception> /// <exception cref="ArgumentOutOfRangeException"><paramref name="size"/> is below 1.</exception> /// <remarks> /// <para>Every chunk except the last will be of size <paramref name="size"/>.</para> /// <para>The last chunk will contain the remaining elements and may be of a smaller size.</para> /// </remarks> [DynamicDependency("Chunk`1", typeof(Enumerable))] public static IQueryable<TSource[]> Chunk<TSource>(this IQueryable<TSource> source!!, int size) => source.Provider.CreateQuery<TSource[]>( Expression.Call( null, CachedReflectionInfo.Chunk_TSource_1(typeof(TSource)), source.Expression, Expression.Constant(size) )); [DynamicDependency("Concat`1", typeof(Enumerable))] public static IQueryable<TSource> Concat<TSource>(this IQueryable<TSource> source1!!, IEnumerable<TSource> source2!!) => source1.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.Concat_TSource_2(typeof(TSource)), source1.Expression, GetSourceExpression(source2) )); [DynamicDependency("Zip`2", typeof(Enumerable))] public static IQueryable<(TFirst First, TSecond Second)> Zip<TFirst, TSecond>(this IQueryable<TFirst> source1!!, IEnumerable<TSecond> source2!!) => source1.Provider.CreateQuery<(TFirst, TSecond)>( Expression.Call( null, CachedReflectionInfo.Zip_TFirst_TSecond_2(typeof(TFirst), typeof(TSecond)), source1.Expression, GetSourceExpression(source2))); [DynamicDependency("Zip`3", typeof(Enumerable))] public static IQueryable<TResult> Zip<TFirst, TSecond, TResult>(this IQueryable<TFirst> source1!!, IEnumerable<TSecond> source2!!, Expression<Func<TFirst, TSecond, TResult>> resultSelector!!) => source1.Provider.CreateQuery<TResult>( Expression.Call( null, CachedReflectionInfo.Zip_TFirst_TSecond_TResult_3(typeof(TFirst), typeof(TSecond), typeof(TResult)), source1.Expression, GetSourceExpression(source2), Expression.Quote(resultSelector) )); /// <summary> /// Produces a sequence of tuples with elements from the three specified sequences. /// </summary> /// <typeparam name="TFirst">The type of the elements of the first input sequence.</typeparam> /// <typeparam name="TSecond">The type of the elements of the second input sequence.</typeparam> /// <typeparam name="TThird">The type of the elements of the third input sequence.</typeparam> /// <param name="source1">The first sequence to merge.</param> /// <param name="source2">The second sequence to merge.</param> /// <param name="source3">The third sequence to merge.</param> /// <returns>A sequence of tuples with elements taken from the first, second and third sequences, in that order.</returns> [DynamicDependency("Zip`3", typeof(Enumerable))] public static IQueryable<(TFirst First, TSecond Second, TThird Third)> Zip<TFirst, TSecond, TThird>(this IQueryable<TFirst> source1!!, IEnumerable<TSecond> source2!!, IEnumerable<TThird> source3!!) => source1.Provider.CreateQuery<(TFirst, TSecond, TThird)>( Expression.Call( null, CachedReflectionInfo.Zip_TFirst_TSecond_TThird_3(typeof(TFirst), typeof(TSecond), typeof(TThird)), source1.Expression, GetSourceExpression(source2), GetSourceExpression(source3) )); [DynamicDependency("Union`1", typeof(Enumerable))] public static IQueryable<TSource> Union<TSource>(this IQueryable<TSource> source1!!, IEnumerable<TSource> source2!!) => source1.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.Union_TSource_2(typeof(TSource)), source1.Expression, GetSourceExpression(source2) )); [DynamicDependency("Union`1", typeof(Enumerable))] public static IQueryable<TSource> Union<TSource>(this IQueryable<TSource> source1!!, IEnumerable<TSource> source2!!, IEqualityComparer<TSource>? comparer) => source1.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.Union_TSource_3(typeof(TSource)), source1.Expression, GetSourceExpression(source2), Expression.Constant(comparer, typeof(IEqualityComparer<TSource>)) )); /// <summary>Produces the set union of two sequences according to a specified key selector function.</summary> /// <typeparam name="TSource">The type of the elements of the input sequences.</typeparam> /// <typeparam name="TKey">The type of key to identify elements by.</typeparam> /// <param name="source1">An <see cref="IQueryable{T}" /> whose distinct elements form the first set for the union.</param> /// <param name="source2">An <see cref="IEnumerable{T}" /> whose distinct elements form the second set for the union.</param> /// <param name="keySelector">A function to extract the key for each element.</param> /// <returns>An <see cref="IQueryable{T}" /> that contains the elements from both input sequences, excluding duplicates.</returns> /// <exception cref="ArgumentNullException"><paramref name="source1" /> or <paramref name="source2" /> is <see langword="null" />.</exception> [DynamicDependency("UnionBy`2", typeof(Enumerable))] public static IQueryable<TSource> UnionBy<TSource, TKey>(this IQueryable<TSource> source1!!, IEnumerable<TSource> source2!!, Expression<Func<TSource, TKey>> keySelector!!) => source1.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.UnionBy_TSource_TKey_3(typeof(TSource), typeof(TKey)), source1.Expression, GetSourceExpression(source2), Expression.Quote(keySelector) )); /// <summary>Produces the set union of two sequences according to a specified key selector function.</summary> /// <typeparam name="TSource">The type of the elements of the input sequences.</typeparam> /// <typeparam name="TKey">The type of key to identify elements by.</typeparam> /// <param name="source1">An <see cref="IQueryable{T}" /> whose distinct elements form the first set for the union.</param> /// <param name="source2">An <see cref="IEnumerable{T}" /> whose distinct elements form the second set for the union.</param> /// <param name="keySelector">A function to extract the key for each element.</param> /// <param name="comparer">The <see cref="IEqualityComparer{T}" /> to compare values.</param> /// <returns>An <see cref="IQueryable{T}" /> that contains the elements from both input sequences, excluding duplicates.</returns> /// <exception cref="ArgumentNullException"><paramref name="source1" /> or <paramref name="source2" /> is <see langword="null" />.</exception> [DynamicDependency("UnionBy`2", typeof(Enumerable))] public static IQueryable<TSource> UnionBy<TSource, TKey>(this IQueryable<TSource> source1!!, IEnumerable<TSource> source2!!, Expression<Func<TSource, TKey>> keySelector!!, IEqualityComparer<TKey>? comparer) => source1.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.UnionBy_TSource_TKey_4(typeof(TSource), typeof(TKey)), source1.Expression, GetSourceExpression(source2), Expression.Quote(keySelector), Expression.Constant(comparer, typeof(IEqualityComparer<TKey>)) )); [DynamicDependency("Intersect`1", typeof(Enumerable))] public static IQueryable<TSource> Intersect<TSource>(this IQueryable<TSource> source1!!, IEnumerable<TSource> source2!!) => source1.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.Intersect_TSource_2(typeof(TSource)), source1.Expression, GetSourceExpression(source2) )); [DynamicDependency("Intersect`1", typeof(Enumerable))] public static IQueryable<TSource> Intersect<TSource>(this IQueryable<TSource> source1!!, IEnumerable<TSource> source2!!, IEqualityComparer<TSource>? comparer) => source1.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.Intersect_TSource_3(typeof(TSource)), source1.Expression, GetSourceExpression(source2), Expression.Constant(comparer, typeof(IEqualityComparer<TSource>)) )); /// <summary>Produces the set intersection of two sequences according to a specified key selector function.</summary> /// <typeparam name="TSource">The type of the elements of the input sequences.</typeparam> /// <typeparam name="TKey">The type of key to identify elements by.</typeparam> /// <param name="source1">An <see cref="IQueryable{T}" /> whose distinct elements that also appear in <paramref name="source2" /> will be returned.</param> /// <param name="source2">An <see cref="IEnumerable{T}" /> whose distinct elements that also appear in the first sequence will be returned.</param> /// <param name="keySelector">A function to extract the key for each element.</param> /// <returns>A sequence that contains the elements that form the set intersection of two sequences.</returns> /// <exception cref="ArgumentNullException"><paramref name="source1" /> or <paramref name="source2" /> is <see langword="null" />.</exception> [DynamicDependency("IntersectBy`2", typeof(Enumerable))] public static IQueryable<TSource> IntersectBy<TSource, TKey>(this IQueryable<TSource> source1!!, IEnumerable<TKey> source2!!, Expression<Func<TSource, TKey>> keySelector!!) => source1.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.IntersectBy_TSource_TKey_3(typeof(TSource), typeof(TKey)), source1.Expression, GetSourceExpression(source2), Expression.Quote(keySelector) )); /// <summary>Produces the set intersection of two sequences according to a specified key selector function.</summary> /// <typeparam name="TSource">The type of the elements of the input sequences.</typeparam> /// <typeparam name="TKey">The type of key to identify elements by.</typeparam> /// <param name="source1">An <see cref="IQueryable{T}" /> whose distinct elements that also appear in <paramref name="source2" /> will be returned.</param> /// <param name="source2">An <see cref="IEnumerable{T}" /> whose distinct elements that also appear in the first sequence will be returned.</param> /// <param name="keySelector">A function to extract the key for each element.</param> /// <param name="comparer">An <see cref="IEqualityComparer{TKey}" /> to compare keys.</param> /// <returns>A sequence that contains the elements that form the set intersection of two sequences.</returns> /// <exception cref="ArgumentNullException"><paramref name="source1" /> or <paramref name="source2" /> is <see langword="null" />.</exception> [DynamicDependency("IntersectBy`2", typeof(Enumerable))] public static IQueryable<TSource> IntersectBy<TSource, TKey>(this IQueryable<TSource> source1!!, IEnumerable<TKey> source2!!, Expression<Func<TSource, TKey>> keySelector!!, IEqualityComparer<TKey>? comparer) => source1.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.IntersectBy_TSource_TKey_4(typeof(TSource), typeof(TKey)), source1.Expression, GetSourceExpression(source2), Expression.Quote(keySelector), Expression.Constant(comparer, typeof(IEqualityComparer<TKey>)) )); [DynamicDependency("Except`1", typeof(Enumerable))] public static IQueryable<TSource> Except<TSource>(this IQueryable<TSource> source1!!, IEnumerable<TSource> source2!!) => source1.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.Except_TSource_2(typeof(TSource)), source1.Expression, GetSourceExpression(source2) )); [DynamicDependency("Except`1", typeof(Enumerable))] public static IQueryable<TSource> Except<TSource>(this IQueryable<TSource> source1!!, IEnumerable<TSource> source2!!, IEqualityComparer<TSource>? comparer) => source1.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.Except_TSource_3(typeof(TSource)), source1.Expression, GetSourceExpression(source2), Expression.Constant(comparer, typeof(IEqualityComparer<TSource>)) )); /// <summary> /// Produces the set difference of two sequences according to a specified key selector function. /// </summary> /// <typeparam name="TSource">The type of the elements of the input sequence.</typeparam> /// <typeparam name="TKey">The type of key to identify elements by.</typeparam> /// <param name="source1">An <see cref="IQueryable{TSource}" /> whose keys that are not also in <paramref name="source2"/> will be returned.</param> /// <param name="source2">An <see cref="IEnumerable{TKey}" /> whose keys that also occur in the first sequence will cause those elements to be removed from the returned sequence.</param> /// <param name="keySelector">A function to extract the key for each element.</param> /// <returns>A <see cref="IQueryable{TSource}" /> that contains the set difference of the elements of two sequences.</returns> [DynamicDependency("ExceptBy`2", typeof(Enumerable))] public static IQueryable<TSource> ExceptBy<TSource, TKey>(this IQueryable<TSource> source1!!, IEnumerable<TKey> source2!!, Expression<Func<TSource, TKey>> keySelector!!) => source1.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.ExceptBy_TSource_TKey_3(typeof(TSource), typeof(TKey)), source1.Expression, GetSourceExpression(source2), Expression.Quote(keySelector) )); /// <summary> /// Produces the set difference of two sequences according to a specified key selector function. /// </summary> /// <typeparam name="TSource">The type of the elements of the input sequence.</typeparam> /// <typeparam name="TKey">The type of key to identify elements by.</typeparam> /// <param name="source1">An <see cref="IQueryable{TSource}" /> whose keys that are not also in <paramref name="source2"/> will be returned.</param> /// <param name="source2">An <see cref="IEnumerable{TKey}" /> whose keys that also occur in the first sequence will cause those elements to be removed from the returned sequence.</param> /// <param name="keySelector">A function to extract the key for each element.</param> /// <param name="comparer">An <see cref="IEqualityComparer{TKey}" /> to compare keys.</param> /// <returns>A <see cref="IQueryable{TSource}" /> that contains the set difference of the elements of two sequences.</returns> [DynamicDependency("ExceptBy`2", typeof(Enumerable))] public static IQueryable<TSource> ExceptBy<TSource, TKey>(this IQueryable<TSource> source1!!, IEnumerable<TKey> source2!!, Expression<Func<TSource, TKey>> keySelector!!, IEqualityComparer<TKey>? comparer) => source1.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.ExceptBy_TSource_TKey_4(typeof(TSource), typeof(TKey)), source1.Expression, GetSourceExpression(source2), Expression.Quote(keySelector), Expression.Constant(comparer, typeof(IEqualityComparer<TKey>)) )); [DynamicDependency("First`1", typeof(Enumerable))] public static TSource First<TSource>(this IQueryable<TSource> source!!) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.First_TSource_1(typeof(TSource)), source.Expression)); [DynamicDependency("First`1", typeof(Enumerable))] public static TSource First<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, bool>> predicate!!) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.First_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(predicate) )); [DynamicDependency("FirstOrDefault`1", typeof(Enumerable))] public static TSource? FirstOrDefault<TSource>(this IQueryable<TSource> source!!) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.FirstOrDefault_TSource_1(typeof(TSource)), source.Expression)); /// <summary>Returns the first element of a sequence, or a default value if the sequence contains no elements.</summary> /// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam> /// <param name="source">The <see cref="IEnumerable{T}" /> to return the first element of.</param> /// <param name="defaultValue">The default value to return if the sequence is empty.</param> /// <returns><paramref name="defaultValue" /> if <paramref name="source" /> is empty; otherwise, the first element in <paramref name="source" />.</returns> /// <exception cref="ArgumentNullException"><paramref name="source" /> is <see langword="null" />.</exception> [DynamicDependency("FirstOrDefault`1", typeof(Enumerable))] public static TSource FirstOrDefault<TSource>(this IQueryable<TSource> source!!, TSource defaultValue) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.FirstOrDefault_TSource_3(typeof(TSource)), source.Expression, Expression.Constant(defaultValue, typeof(TSource)))); [DynamicDependency("FirstOrDefault`1", typeof(Enumerable))] public static TSource? FirstOrDefault<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, bool>> predicate!!) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.FirstOrDefault_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(predicate) )); /// <summary>Returns the first element of the sequence that satisfies a condition or a default value if no such element is found.</summary> /// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam> /// <param name="source">An <see cref="IEnumerable{T}" /> to return an element from.</param> /// <param name="predicate">A function to test each element for a condition.</param> /// <param name="defaultValue">The default value to return if the sequence is empty.</param> /// <returns><paramref name="defaultValue" /> if <paramref name="source" /> is empty or if no element passes the test specified by <paramref name="predicate" />; otherwise, the first element in <paramref name="source" /> that passes the test specified by <paramref name="predicate" />.</returns> /// <exception cref="ArgumentNullException"><paramref name="source" /> or <paramref name="predicate" /> is <see langword="null" />.</exception> [DynamicDependency("FirstOrDefault`1", typeof(Enumerable))] public static TSource FirstOrDefault<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, bool>> predicate!!, TSource defaultValue) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.FirstOrDefault_TSource_4(typeof(TSource)), source.Expression, Expression.Quote(predicate), Expression.Constant(defaultValue, typeof(TSource)) )); [DynamicDependency("Last`1", typeof(Enumerable))] public static TSource Last<TSource>(this IQueryable<TSource> source!!) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.Last_TSource_1(typeof(TSource)), source.Expression)); [DynamicDependency("Last`1", typeof(Enumerable))] public static TSource Last<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, bool>> predicate!!) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.Last_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(predicate) )); [DynamicDependency("LastOrDefault`1", typeof(Enumerable))] public static TSource? LastOrDefault<TSource>(this IQueryable<TSource> source!!) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.LastOrDefault_TSource_1(typeof(TSource)), source.Expression)); /// <summary>Returns the last element of a sequence, or a default value if the sequence contains no elements.</summary> /// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam> /// <param name="source">An <see cref="IEnumerable{T}" /> to return the last element of.</param> /// <param name="defaultValue">The default value to return if the sequence is empty.</param> /// <returns><paramref name="defaultValue" /> if the source sequence is empty; otherwise, the last element in the <see cref="IEnumerable{T}" />.</returns> /// <exception cref="ArgumentNullException"><paramref name="source" /> is <see langword="null" />.</exception> [DynamicDependency("LastOrDefault`1", typeof(Enumerable))] public static TSource LastOrDefault<TSource>(this IQueryable<TSource> source!!, TSource defaultValue) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.LastOrDefault_TSource_3(typeof(TSource)), source.Expression, Expression.Constant(defaultValue, typeof(TSource)))); [DynamicDependency("LastOrDefault`1", typeof(Enumerable))] public static TSource? LastOrDefault<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, bool>> predicate!!) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.LastOrDefault_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(predicate) )); /// <summary>Returns the last element of a sequence that satisfies a condition or a default value if no such element is found.</summary> /// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam> /// <param name="source">An <see cref="IEnumerable{T}" /> to return an element from.</param> /// <param name="predicate">A function to test each element for a condition.</param> /// <param name="defaultValue">The default value to return if the sequence is empty.</param> /// <returns><paramref name="defaultValue" /> if the sequence is empty or if no elements pass the test in the predicate function; otherwise, the last element that passes the test in the predicate function.</returns> /// <exception cref="ArgumentNullException"><paramref name="source" /> or <paramref name="predicate" /> is <see langword="null" />.</exception> [DynamicDependency("LastOrDefault`1", typeof(Enumerable))] public static TSource LastOrDefault<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, bool>> predicate!!, TSource defaultValue) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.LastOrDefault_TSource_4(typeof(TSource)), source.Expression, Expression.Quote(predicate), Expression.Constant(defaultValue, typeof(TSource)) )); [DynamicDependency("Single`1", typeof(Enumerable))] public static TSource Single<TSource>(this IQueryable<TSource> source!!) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.Single_TSource_1(typeof(TSource)), source.Expression)); [DynamicDependency("Single`1", typeof(Enumerable))] public static TSource Single<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, bool>> predicate!!) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.Single_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(predicate) )); [DynamicDependency("SingleOrDefault`1", typeof(Enumerable))] public static TSource? SingleOrDefault<TSource>(this IQueryable<TSource> source!!) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.SingleOrDefault_TSource_1(typeof(TSource)), source.Expression)); /// <summary>Returns the only element of a sequence, or a default value if the sequence is empty; this method throws an exception if there is more than one element in the sequence.</summary> /// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam> /// <param name="source">An <see cref="IEnumerable{T}" /> to return the single element of.</param> /// <param name="defaultValue">The default value to return if the sequence is empty.</param> /// <returns>The single element of the input sequence, or <paramref name="defaultValue" /> if the sequence contains no elements.</returns> /// <exception cref="ArgumentNullException"><paramref name="source" /> is <see langword="null" />.</exception> /// <exception cref="InvalidOperationException">The input sequence contains more than one element.</exception> [DynamicDependency("SingleOrDefault`1", typeof(Enumerable))] public static TSource SingleOrDefault<TSource>(this IQueryable<TSource> source!!, TSource defaultValue) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.SingleOrDefault_TSource_3(typeof(TSource)), source.Expression, Expression.Constant(defaultValue, typeof(TSource)))); [DynamicDependency("SingleOrDefault`1", typeof(Enumerable))] public static TSource? SingleOrDefault<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, bool>> predicate!!) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.SingleOrDefault_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(predicate) )); /// <summary>Returns the only element of a sequence that satisfies a specified condition or a default value if no such element exists; this method throws an exception if more than one element satisfies the condition.</summary> /// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam> /// <param name="source">An <see cref="IEnumerable{T}" /> to return a single element from.</param> /// <param name="predicate">A function to test an element for a condition.</param> /// <param name="defaultValue">The default value to return if the sequence is empty.</param> /// <returns>The single element of the input sequence that satisfies the condition, or <paramref name="defaultValue" /> if no such element is found.</returns> /// <exception cref="ArgumentNullException"><paramref name="source" /> or <paramref name="predicate" /> is <see langword="null" />.</exception> /// <exception cref="InvalidOperationException">More than one element satisfies the condition in <paramref name="predicate" />.</exception> [DynamicDependency("SingleOrDefault`1", typeof(Enumerable))] public static TSource SingleOrDefault<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, bool>> predicate!!, TSource defaultValue) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.SingleOrDefault_TSource_4(typeof(TSource)), source.Expression, Expression.Quote(predicate), Expression.Constant(defaultValue, typeof(TSource)) )); [DynamicDependency("ElementAt`1", typeof(Enumerable))] public static TSource ElementAt<TSource>(this IQueryable<TSource> source!!, int index) { if (index < 0) throw Error.ArgumentOutOfRange(nameof(index)); return source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.ElementAt_Int32_TSource_2(typeof(TSource)), source.Expression, Expression.Constant(index) )); } /// <summary>Returns the element at a specified index in a sequence.</summary> /// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam> /// <param name="source">An <see cref="IQueryable{T}" /> to return an element from.</param> /// <param name="index">The index of the element to retrieve, which is either from the start or the end.</param> /// <exception cref="ArgumentNullException"><paramref name="source" /> is <see langword="null" />.</exception> /// <exception cref="ArgumentOutOfRangeException"><paramref name="index" /> is outside the bounds of the <paramref name="source" /> sequence.</exception> /// <returns>The element at the specified position in the <paramref name="source" /> sequence.</returns> [DynamicDependency("ElementAt`1", typeof(Enumerable))] public static TSource ElementAt<TSource>(this IQueryable<TSource> source!!, Index index) { if (index.IsFromEnd && index.Value == 0) throw Error.ArgumentOutOfRange(nameof(index)); return source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.ElementAt_Index_TSource_2(typeof(TSource)), source.Expression, Expression.Constant(index) )); } [DynamicDependency("ElementAtOrDefault`1", typeof(Enumerable))] public static TSource? ElementAtOrDefault<TSource>(this IQueryable<TSource> source!!, int index) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.ElementAtOrDefault_Int32_TSource_2(typeof(TSource)), source.Expression, Expression.Constant(index) )); /// <summary>Returns the element at a specified index in a sequence or a default value if the index is out of range.</summary> /// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam> /// <param name="source">An <see cref="IQueryable{T}" /> to return an element from.</param> /// <param name="index">The index of the element to retrieve, which is either from the start or the end.</param> /// <exception cref="ArgumentNullException"><paramref name="source" /> is <see langword="null" />.</exception> /// <returns><see langword="default" /> if <paramref name="index" /> is outside the bounds of the <paramref name="source" /> sequence; otherwise, the element at the specified position in the <paramref name="source" /> sequence.</returns> [DynamicDependency("ElementAtOrDefault`1", typeof(Enumerable))] public static TSource? ElementAtOrDefault<TSource>(this IQueryable<TSource> source!!, Index index) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.ElementAtOrDefault_Index_TSource_2(typeof(TSource)), source.Expression, Expression.Constant(index) )); [DynamicDependency("DefaultIfEmpty`1", typeof(Enumerable))] public static IQueryable<TSource> DefaultIfEmpty<TSource>(this IQueryable<TSource> source!!) => source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.DefaultIfEmpty_TSource_1(typeof(TSource)), source.Expression)); [DynamicDependency("DefaultIfEmpty`1", typeof(Enumerable))] public static IQueryable<TSource> DefaultIfEmpty<TSource>(this IQueryable<TSource> source!!, TSource defaultValue) => source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.DefaultIfEmpty_TSource_2(typeof(TSource)), source.Expression, Expression.Constant(defaultValue, typeof(TSource)) )); [DynamicDependency("Contains`1", typeof(Enumerable))] public static bool Contains<TSource>(this IQueryable<TSource> source!!, TSource item) => source.Provider.Execute<bool>( Expression.Call( null, CachedReflectionInfo.Contains_TSource_2(typeof(TSource)), source.Expression, Expression.Constant(item, typeof(TSource)) )); [DynamicDependency("Contains`1", typeof(Enumerable))] public static bool Contains<TSource>(this IQueryable<TSource> source!!, TSource item, IEqualityComparer<TSource>? comparer) => source.Provider.Execute<bool>( Expression.Call( null, CachedReflectionInfo.Contains_TSource_3(typeof(TSource)), source.Expression, Expression.Constant(item, typeof(TSource)), Expression.Constant(comparer, typeof(IEqualityComparer<TSource>)) )); [DynamicDependency("Reverse`1", typeof(Enumerable))] public static IQueryable<TSource> Reverse<TSource>(this IQueryable<TSource> source!!) => source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.Reverse_TSource_1(typeof(TSource)), source.Expression)); [DynamicDependency("SequenceEqual`1", typeof(Enumerable))] public static bool SequenceEqual<TSource>(this IQueryable<TSource> source1!!, IEnumerable<TSource> source2!!) => source1.Provider.Execute<bool>( Expression.Call( null, CachedReflectionInfo.SequenceEqual_TSource_2(typeof(TSource)), source1.Expression, GetSourceExpression(source2) )); [DynamicDependency("SequenceEqual`1", typeof(Enumerable))] public static bool SequenceEqual<TSource>(this IQueryable<TSource> source1!!, IEnumerable<TSource> source2!!, IEqualityComparer<TSource>? comparer) => source1.Provider.Execute<bool>( Expression.Call( null, CachedReflectionInfo.SequenceEqual_TSource_3(typeof(TSource)), source1.Expression, GetSourceExpression(source2), Expression.Constant(comparer, typeof(IEqualityComparer<TSource>)) )); [DynamicDependency("Any`1", typeof(Enumerable))] public static bool Any<TSource>(this IQueryable<TSource> source!!) => source.Provider.Execute<bool>( Expression.Call( null, CachedReflectionInfo.Any_TSource_1(typeof(TSource)), source.Expression)); [DynamicDependency("Any`1", typeof(Enumerable))] public static bool Any<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, bool>> predicate!!) => source.Provider.Execute<bool>( Expression.Call( null, CachedReflectionInfo.Any_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(predicate) )); [DynamicDependency("All`1", typeof(Enumerable))] public static bool All<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, bool>> predicate!!) => source.Provider.Execute<bool>( Expression.Call( null, CachedReflectionInfo.All_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(predicate) )); [DynamicDependency("Count`1", typeof(Enumerable))] public static int Count<TSource>(this IQueryable<TSource> source!!) => source.Provider.Execute<int>( Expression.Call( null, CachedReflectionInfo.Count_TSource_1(typeof(TSource)), source.Expression)); [DynamicDependency("Count`1", typeof(Enumerable))] public static int Count<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, bool>> predicate!!) => source.Provider.Execute<int>( Expression.Call( null, CachedReflectionInfo.Count_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(predicate) )); [DynamicDependency("LongCount`1", typeof(Enumerable))] public static long LongCount<TSource>(this IQueryable<TSource> source!!) => source.Provider.Execute<long>( Expression.Call( null, CachedReflectionInfo.LongCount_TSource_1(typeof(TSource)), source.Expression)); [DynamicDependency("LongCount`1", typeof(Enumerable))] public static long LongCount<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, bool>> predicate!!) => source.Provider.Execute<long>( Expression.Call( null, CachedReflectionInfo.LongCount_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(predicate) )); [DynamicDependency("Min`1", typeof(Enumerable))] public static TSource? Min<TSource>(this IQueryable<TSource> source!!) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.Min_TSource_1(typeof(TSource)), source.Expression)); /// <summary>Returns the minimum value in a generic <see cref="System.Linq.IQueryable{T}" />.</summary> /// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam> /// <param name="source">A sequence of values to determine the minimum value of.</param> /// <param name="comparer">The <see cref="IComparer{T}" /> to compare values.</param> /// <returns>The minimum value in the sequence.</returns> /// <exception cref="ArgumentNullException"><paramref name="source" /> is <see langword="null" />.</exception> /// <exception cref="ArgumentException">No object in <paramref name="source" /> implements the <see cref="System.IComparable" /> or <see cref="System.IComparable{T}" /> interface.</exception> [DynamicDependency("Min`1", typeof(Enumerable))] public static TSource? Min<TSource>(this IQueryable<TSource> source!!, IComparer<TSource>? comparer) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.Min_TSource_2(typeof(TSource)), source.Expression, Expression.Constant(comparer, typeof(IComparer<TSource>)) )); [DynamicDependency("Min`2", typeof(Enumerable))] public static TResult? Min<TSource, TResult>(this IQueryable<TSource> source!!, Expression<Func<TSource, TResult>> selector!!) => source.Provider.Execute<TResult>( Expression.Call( null, CachedReflectionInfo.Min_TSource_TResult_2(typeof(TSource), typeof(TResult)), source.Expression, Expression.Quote(selector) )); /// <summary>Returns the minimum value in a generic <see cref="IQueryable{T}"/> according to a specified key selector function.</summary> /// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam> /// <typeparam name="TKey">The type of key to compare elements by.</typeparam> /// <param name="source">A sequence of values to determine the minimum value of.</param> /// <param name="keySelector">A function to extract the key for each element.</param> /// <returns>The value with the minimum key in the sequence.</returns> /// <exception cref="ArgumentNullException"><paramref name="source" /> is <see langword="null" />.</exception> /// <exception cref="ArgumentException">No key extracted from <paramref name="source" /> implements the <see cref="IComparable" /> or <see cref="IComparable{TKey}" /> interface.</exception> [DynamicDependency("MinBy`2", typeof(Enumerable))] public static TSource? MinBy<TSource, TKey>(this IQueryable<TSource> source!!, Expression<Func<TSource, TKey>> keySelector!!) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.MinBy_TSource_TKey_2(typeof(TSource), typeof(TKey)), source.Expression, Expression.Quote(keySelector) )); /// <summary>Returns the minimum value in a generic <see cref="IQueryable{T}"/> according to a specified key selector function.</summary> /// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam> /// <typeparam name="TKey">The type of key to compare elements by.</typeparam> /// <param name="source">A sequence of values to determine the minimum value of.</param> /// <param name="keySelector">A function to extract the key for each element.</param> /// <param name="comparer">The <see cref="IComparer{TKey}" /> to compare keys.</param> /// <returns>The value with the minimum key in the sequence.</returns> /// <exception cref="ArgumentNullException"><paramref name="source" /> is <see langword="null" />.</exception> /// <exception cref="ArgumentException">No key extracted from <paramref name="source" /> implements the <see cref="IComparable" /> or <see cref="IComparable{TKey}" /> interface.</exception> [DynamicDependency("MinBy`2", typeof(Enumerable))] public static TSource? MinBy<TSource, TKey>(this IQueryable<TSource> source!!, Expression<Func<TSource, TKey>> keySelector!!, IComparer<TSource>? comparer) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.MinBy_TSource_TKey_3(typeof(TSource), typeof(TKey)), source.Expression, Expression.Quote(keySelector), Expression.Constant(comparer, typeof(IComparer<TSource>)) )); [DynamicDependency("Max`1", typeof(Enumerable))] public static TSource? Max<TSource>(this IQueryable<TSource> source!!) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.Max_TSource_1(typeof(TSource)), source.Expression)); /// <summary>Returns the maximum value in a generic <see cref="System.Linq.IQueryable{T}" />.</summary> /// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam> /// <param name="source">A sequence of values to determine the maximum value of.</param> /// <param name="comparer">The <see cref="IComparer{T}" /> to compare values.</param> /// <returns>The maximum value in the sequence.</returns> /// <exception cref="ArgumentNullException"><paramref name="source" /> is <see langword="null" />.</exception> [DynamicDependency("Max`1", typeof(Enumerable))] public static TSource? Max<TSource>(this IQueryable<TSource> source!!, IComparer<TSource>? comparer) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.Max_TSource_2(typeof(TSource)), source.Expression, Expression.Constant(comparer, typeof(IComparer<TSource>)) )); [DynamicDependency("Max`2", typeof(Enumerable))] public static TResult? Max<TSource, TResult>(this IQueryable<TSource> source!!, Expression<Func<TSource, TResult>> selector!!) => source.Provider.Execute<TResult>( Expression.Call( null, CachedReflectionInfo.Max_TSource_TResult_2(typeof(TSource), typeof(TResult)), source.Expression, Expression.Quote(selector) )); /// <summary>Returns the maximum value in a generic <see cref="IQueryable{T}"/> according to a specified key selector function.</summary> /// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam> /// <typeparam name="TKey">The type of key to compare elements by.</typeparam> /// <param name="source">A sequence of values to determine the maximum value of.</param> /// <param name="keySelector">A function to extract the key for each element.</param> /// <returns>The value with the maximum key in the sequence.</returns> /// <exception cref="ArgumentNullException"><paramref name="source" /> is <see langword="null" />.</exception> /// <exception cref="ArgumentException">No key extracted from <paramref name="source" /> implements the <see cref="IComparable" /> or <see cref="IComparable{TKey}" /> interface.</exception> [DynamicDependency("MaxBy`2", typeof(Enumerable))] public static TSource? MaxBy<TSource, TKey>(this IQueryable<TSource> source!!, Expression<Func<TSource, TKey>> keySelector!!) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.MaxBy_TSource_TKey_2(typeof(TSource), typeof(TKey)), source.Expression, Expression.Quote(keySelector) )); /// <summary>Returns the maximum value in a generic <see cref="IQueryable{T}"/> according to a specified key selector function.</summary> /// <typeparam name="TSource">The type of the elements of <paramref name="source" />.</typeparam> /// <typeparam name="TKey">The type of key to compare elements by.</typeparam> /// <param name="source">A sequence of values to determine the maximum value of.</param> /// <param name="keySelector">A function to extract the key for each element.</param> /// <param name="comparer">The <see cref="IComparer{TKey}" /> to compare keys.</param> /// <returns>The value with the maximum key in the sequence.</returns> /// <exception cref="ArgumentNullException"><paramref name="source" /> is <see langword="null" />.</exception> /// <exception cref="ArgumentException">No key extracted from <paramref name="source" /> implements the <see cref="IComparable" /> or <see cref="IComparable{TKey}" /> interface.</exception> [DynamicDependency("MaxBy`2", typeof(Enumerable))] public static TSource? MaxBy<TSource, TKey>(this IQueryable<TSource> source!!, Expression<Func<TSource, TKey>> keySelector!!, IComparer<TSource>? comparer) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.MaxBy_TSource_TKey_3(typeof(TSource), typeof(TKey)), source.Expression, Expression.Quote(keySelector), Expression.Constant(comparer, typeof(IComparer<TSource>)) )); [DynamicDependency("Sum", typeof(Enumerable))] public static int Sum(this IQueryable<int> source!!) => source.Provider.Execute<int>( Expression.Call( null, CachedReflectionInfo.Sum_Int32_1, source.Expression)); [DynamicDependency("Sum", typeof(Enumerable))] public static int? Sum(this IQueryable<int?> source!!) => source.Provider.Execute<int?>( Expression.Call( null, CachedReflectionInfo.Sum_NullableInt32_1, source.Expression)); [DynamicDependency("Sum", typeof(Enumerable))] public static long Sum(this IQueryable<long> source!!) => source.Provider.Execute<long>( Expression.Call( null, CachedReflectionInfo.Sum_Int64_1, source.Expression)); [DynamicDependency("Sum", typeof(Enumerable))] public static long? Sum(this IQueryable<long?> source!!) => source.Provider.Execute<long?>( Expression.Call( null, CachedReflectionInfo.Sum_NullableInt64_1, source.Expression)); [DynamicDependency("Sum", typeof(Enumerable))] public static float Sum(this IQueryable<float> source!!) => source.Provider.Execute<float>( Expression.Call( null, CachedReflectionInfo.Sum_Single_1, source.Expression)); [DynamicDependency("Sum", typeof(Enumerable))] public static float? Sum(this IQueryable<float?> source!!) => source.Provider.Execute<float?>( Expression.Call( null, CachedReflectionInfo.Sum_NullableSingle_1, source.Expression)); [DynamicDependency("Sum", typeof(Enumerable))] public static double Sum(this IQueryable<double> source!!) => source.Provider.Execute<double>( Expression.Call( null, CachedReflectionInfo.Sum_Double_1, source.Expression)); [DynamicDependency("Sum", typeof(Enumerable))] public static double? Sum(this IQueryable<double?> source!!) => source.Provider.Execute<double?>( Expression.Call( null, CachedReflectionInfo.Sum_NullableDouble_1, source.Expression)); [DynamicDependency("Sum", typeof(Enumerable))] public static decimal Sum(this IQueryable<decimal> source!!) => source.Provider.Execute<decimal>( Expression.Call( null, CachedReflectionInfo.Sum_Decimal_1, source.Expression)); [DynamicDependency("Sum", typeof(Enumerable))] public static decimal? Sum(this IQueryable<decimal?> source!!) => source.Provider.Execute<decimal?>( Expression.Call( null, CachedReflectionInfo.Sum_NullableDecimal_1, source.Expression)); [DynamicDependency("Sum`1", typeof(Enumerable))] public static int Sum<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, int>> selector!!) => source.Provider.Execute<int>( Expression.Call( null, CachedReflectionInfo.Sum_Int32_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("Sum`1", typeof(Enumerable))] public static int? Sum<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, int?>> selector!!) => source.Provider.Execute<int?>( Expression.Call( null, CachedReflectionInfo.Sum_NullableInt32_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("Sum`1", typeof(Enumerable))] public static long Sum<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, long>> selector!!) => source.Provider.Execute<long>( Expression.Call( null, CachedReflectionInfo.Sum_Int64_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("Sum`1", typeof(Enumerable))] public static long? Sum<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, long?>> selector!!) => source.Provider.Execute<long?>( Expression.Call( null, CachedReflectionInfo.Sum_NullableInt64_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("Sum`1", typeof(Enumerable))] public static float Sum<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, float>> selector!!) => source.Provider.Execute<float>( Expression.Call( null, CachedReflectionInfo.Sum_Single_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("Sum`1", typeof(Enumerable))] public static float? Sum<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, float?>> selector!!) => source.Provider.Execute<float?>( Expression.Call( null, CachedReflectionInfo.Sum_NullableSingle_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("Sum`1", typeof(Enumerable))] public static double Sum<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, double>> selector!!) => source.Provider.Execute<double>( Expression.Call( null, CachedReflectionInfo.Sum_Double_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("Sum`1", typeof(Enumerable))] public static double? Sum<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, double?>> selector!!) => source.Provider.Execute<double?>( Expression.Call( null, CachedReflectionInfo.Sum_NullableDouble_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("Sum`1", typeof(Enumerable))] public static decimal Sum<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, decimal>> selector!!) => source.Provider.Execute<decimal>( Expression.Call( null, CachedReflectionInfo.Sum_Decimal_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("Sum`1", typeof(Enumerable))] public static decimal? Sum<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, decimal?>> selector!!) => source.Provider.Execute<decimal?>( Expression.Call( null, CachedReflectionInfo.Sum_NullableDecimal_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("Average", typeof(Enumerable))] public static double Average(this IQueryable<int> source!!) => source.Provider.Execute<double>( Expression.Call( null, CachedReflectionInfo.Average_Int32_1, source.Expression)); [DynamicDependency("Average", typeof(Enumerable))] public static double? Average(this IQueryable<int?> source!!) => source.Provider.Execute<double?>( Expression.Call( null, CachedReflectionInfo.Average_NullableInt32_1, source.Expression)); [DynamicDependency("Average", typeof(Enumerable))] public static double Average(this IQueryable<long> source!!) => source.Provider.Execute<double>( Expression.Call( null, CachedReflectionInfo.Average_Int64_1, source.Expression)); [DynamicDependency("Average", typeof(Enumerable))] public static double? Average(this IQueryable<long?> source!!) => source.Provider.Execute<double?>( Expression.Call( null, CachedReflectionInfo.Average_NullableInt64_1, source.Expression)); [DynamicDependency("Average", typeof(Enumerable))] public static float Average(this IQueryable<float> source!!) => source.Provider.Execute<float>( Expression.Call( null, CachedReflectionInfo.Average_Single_1, source.Expression)); [DynamicDependency("Average", typeof(Enumerable))] public static float? Average(this IQueryable<float?> source!!) => source.Provider.Execute<float?>( Expression.Call( null, CachedReflectionInfo.Average_NullableSingle_1, source.Expression)); [DynamicDependency("Average", typeof(Enumerable))] public static double Average(this IQueryable<double> source!!) => source.Provider.Execute<double>( Expression.Call( null, CachedReflectionInfo.Average_Double_1, source.Expression)); [DynamicDependency("Average", typeof(Enumerable))] public static double? Average(this IQueryable<double?> source!!) => source.Provider.Execute<double?>( Expression.Call( null, CachedReflectionInfo.Average_NullableDouble_1, source.Expression)); [DynamicDependency("Average", typeof(Enumerable))] public static decimal Average(this IQueryable<decimal> source!!) => source.Provider.Execute<decimal>( Expression.Call( null, CachedReflectionInfo.Average_Decimal_1, source.Expression)); [DynamicDependency("Average", typeof(Enumerable))] public static decimal? Average(this IQueryable<decimal?> source!!) => source.Provider.Execute<decimal?>( Expression.Call( null, CachedReflectionInfo.Average_NullableDecimal_1, source.Expression)); [DynamicDependency("Average`1", typeof(Enumerable))] public static double Average<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, int>> selector!!) => source.Provider.Execute<double>( Expression.Call( null, CachedReflectionInfo.Average_Int32_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("Average`1", typeof(Enumerable))] public static double? Average<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, int?>> selector!!) => source.Provider.Execute<double?>( Expression.Call( null, CachedReflectionInfo.Average_NullableInt32_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("Average`1", typeof(Enumerable))] public static float Average<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, float>> selector!!) => source.Provider.Execute<float>( Expression.Call( null, CachedReflectionInfo.Average_Single_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("Average`1", typeof(Enumerable))] public static float? Average<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, float?>> selector!!) => source.Provider.Execute<float?>( Expression.Call( null, CachedReflectionInfo.Average_NullableSingle_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("Average`1", typeof(Enumerable))] public static double Average<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, long>> selector!!) => source.Provider.Execute<double>( Expression.Call( null, CachedReflectionInfo.Average_Int64_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("Average`1", typeof(Enumerable))] public static double? Average<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, long?>> selector!!) => source.Provider.Execute<double?>( Expression.Call( null, CachedReflectionInfo.Average_NullableInt64_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("Average`1", typeof(Enumerable))] public static double Average<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, double>> selector!!) => source.Provider.Execute<double>( Expression.Call( null, CachedReflectionInfo.Average_Double_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("Average`1", typeof(Enumerable))] public static double? Average<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, double?>> selector!!) => source.Provider.Execute<double?>( Expression.Call( null, CachedReflectionInfo.Average_NullableDouble_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("Average`1", typeof(Enumerable))] public static decimal Average<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, decimal>> selector!!) => source.Provider.Execute<decimal>( Expression.Call( null, CachedReflectionInfo.Average_Decimal_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("Average`1", typeof(Enumerable))] public static decimal? Average<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, decimal?>> selector!!) => source.Provider.Execute<decimal?>( Expression.Call( null, CachedReflectionInfo.Average_NullableDecimal_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(selector) )); [DynamicDependency("Aggregate`1", typeof(Enumerable))] public static TSource Aggregate<TSource>(this IQueryable<TSource> source!!, Expression<Func<TSource, TSource, TSource>> func!!) => source.Provider.Execute<TSource>( Expression.Call( null, CachedReflectionInfo.Aggregate_TSource_2(typeof(TSource)), source.Expression, Expression.Quote(func) )); [DynamicDependency("Aggregate`2", typeof(Enumerable))] public static TAccumulate Aggregate<TSource, TAccumulate>(this IQueryable<TSource> source!!, TAccumulate seed, Expression<Func<TAccumulate, TSource, TAccumulate>> func!!) => source.Provider.Execute<TAccumulate>( Expression.Call( null, CachedReflectionInfo.Aggregate_TSource_TAccumulate_3(typeof(TSource), typeof(TAccumulate)), source.Expression, Expression.Constant(seed), Expression.Quote(func) )); [DynamicDependency("Aggregate`3", typeof(Enumerable))] public static TResult Aggregate<TSource, TAccumulate, TResult>(this IQueryable<TSource> source!!, TAccumulate seed, Expression<Func<TAccumulate, TSource, TAccumulate>> func!!, Expression<Func<TAccumulate, TResult>> selector!!) => source.Provider.Execute<TResult>( Expression.Call( null, CachedReflectionInfo.Aggregate_TSource_TAccumulate_TResult_4(typeof(TSource), typeof(TAccumulate), typeof(TResult)), source.Expression, Expression.Constant(seed), Expression.Quote(func), Expression.Quote(selector))); [DynamicDependency("SkipLast`1", typeof(Enumerable))] public static IQueryable<TSource> SkipLast<TSource>(this IQueryable<TSource> source!!, int count) => source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.SkipLast_TSource_2(typeof(TSource)), source.Expression, Expression.Constant(count) )); [DynamicDependency("TakeLast`1", typeof(Enumerable))] public static IQueryable<TSource> TakeLast<TSource>(this IQueryable<TSource> source!!, int count) => source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.TakeLast_TSource_2(typeof(TSource)), source.Expression, Expression.Constant(count) )); [DynamicDependency("Append`1", typeof(Enumerable))] public static IQueryable<TSource> Append<TSource>(this IQueryable<TSource> source!!, TSource element) => source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.Append_TSource_2(typeof(TSource)), source.Expression, Expression.Constant(element) )); [DynamicDependency("Prepend`1", typeof(Enumerable))] public static IQueryable<TSource> Prepend<TSource>(this IQueryable<TSource> source!!, TSource element) => source.Provider.CreateQuery<TSource>( Expression.Call( null, CachedReflectionInfo.Prepend_TSource_2(typeof(TSource)), source.Expression, Expression.Constant(element) )); } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/libraries/System.DirectoryServices.AccountManagement/src/System/DirectoryServices/AccountManagement/ValueCollection.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.Collections; using System.Collections.Generic; namespace System.DirectoryServices.AccountManagement { public class PrincipalValueCollection<T> : IList<T>, IList // T must be a ValueType or immutable ref type (such as string) { // // IList // bool IList.IsFixedSize { get { return IsFixedSize; } } bool IList.IsReadOnly { get { return IsReadOnly; } } int IList.Add(object value) { if (value == null) throw new ArgumentNullException(nameof(value)); _inner.Add((T)value); return Count; } void IList.Clear() { Clear(); } bool IList.Contains(object value) { if (value == null) throw new ArgumentNullException(nameof(value)); return _inner.Contains((T)value); } int IList.IndexOf(object value) { if (value == null) throw new ArgumentNullException(nameof(value)); return IndexOf((T)value); } void IList.Insert(int index, object value) { if (value == null) throw new ArgumentNullException(nameof(value)); Insert(index, (T)value); } void IList.Remove(object value) { if (value == null) throw new ArgumentNullException(nameof(value)); _inner.Remove((T)value); } void IList.RemoveAt(int index) { RemoveAt(index); } object IList.this[int index] { get { return this[index]; } set { if (value == null) throw new ArgumentNullException(nameof(value)); this[index] = (T)value; } } // // ICollection // void ICollection.CopyTo(Array array, int index) { ((ICollection)_inner).CopyTo(array, index); } int ICollection.Count { get { return _inner.Count; } } bool ICollection.IsSynchronized { get { return IsSynchronized; } } object ICollection.SyncRoot { get { return SyncRoot; } } public bool IsSynchronized { get { return ((ICollection)_inner).IsSynchronized; } } public object SyncRoot { get { return this; } } // // IEnumerable // IEnumerator IEnumerable.GetEnumerator() { return (IEnumerator)GetEnumerator(); } // // IList<T> // public bool IsFixedSize { get { return false; } } public bool IsReadOnly { get { return false; } } // Adds obj to the end of the list by inserting it into insertedValues. public void Add(T value) { if (value == null) throw new ArgumentNullException(nameof(value)); _inner.Add(value); } public void Clear() { _inner.Clear(); } public bool Contains(T value) { if (value == null) throw new ArgumentNullException(nameof(value)); return _inner.Contains(value); } public int IndexOf(T value) { if (value == null) throw new ArgumentNullException(nameof(value)); int index = 0; foreach (TrackedCollection<T>.ValueEl el in _inner.combinedValues) { if (el.isInserted && el.insertedValue.Equals(value)) { GlobalDebug.WriteLineIf(GlobalDebug.Info, "PrincipalValueCollection", "IndexOf: found {0} on inserted at {1}", value, index); return index; } if (!el.isInserted && el.originalValue.Right.Equals(value)) { GlobalDebug.WriteLineIf(GlobalDebug.Info, "PrincipalValueCollection", "IndexOf: found {0} on original at {1}", value, index); return index; } index++; } return -1; } public void Insert(int index, T value) { _inner.MarkChange(); if (value == null) throw new ArgumentNullException(nameof(value)); if ((index < 0) || (index > _inner.combinedValues.Count)) { GlobalDebug.WriteLineIf(GlobalDebug.Warn, "PrincipalValueCollection", "Insert({0}): out of range (count={1})", index, _inner.combinedValues.Count); throw new ArgumentOutOfRangeException(nameof(index)); } TrackedCollection<T>.ValueEl el = new TrackedCollection<T>.ValueEl(); el.isInserted = true; el.insertedValue = value; _inner.combinedValues.Insert(index, el); } public bool Remove(T value) { if (value == null) throw new ArgumentNullException(nameof(value)); return _inner.Remove(value); } public void RemoveAt(int index) { _inner.MarkChange(); if ((index < 0) || (index >= _inner.combinedValues.Count)) { GlobalDebug.WriteLineIf(GlobalDebug.Warn, "PrincipalValueCollection", "RemoveAt({0}): out of range (count={1})", index, _inner.combinedValues.Count); throw new ArgumentOutOfRangeException(nameof(index)); } TrackedCollection<T>.ValueEl el = _inner.combinedValues[index]; if (el.isInserted) { // We're removing an inserted value. GlobalDebug.WriteLineIf(GlobalDebug.Info, "PrincipalValueCollection", "RemoveAt({0}): removing inserted", index); _inner.combinedValues.RemoveAt(index); } else { // We're removing an original value. GlobalDebug.WriteLineIf(GlobalDebug.Info, "PrincipalValueCollection", "RemoveAt({0}): removing original", index); Pair<T, T> pair = _inner.combinedValues[index].originalValue; _inner.combinedValues.RemoveAt(index); _inner.removedValues.Add(pair.Left); } } public T this[int index] { get { if ((index < 0) || (index >= _inner.combinedValues.Count)) { GlobalDebug.WriteLineIf(GlobalDebug.Warn, "PrincipalValueCollection", "this[{0}].get: out of range (count={1})", index, _inner.combinedValues.Count); throw new ArgumentOutOfRangeException(nameof(index)); } TrackedCollection<T>.ValueEl el = _inner.combinedValues[index]; if (el.isInserted) { GlobalDebug.WriteLineIf(GlobalDebug.Info, "PrincipalValueCollection", "this[{0}].get: is inserted {1}", index, el.insertedValue); return el.insertedValue; } else { GlobalDebug.WriteLineIf(GlobalDebug.Info, "PrincipalValueCollection", "this[{0}].get: is original {1}", index, el.originalValue.Right); return el.originalValue.Right; // Right == current value } } set { _inner.MarkChange(); if ((index < 0) || (index >= _inner.combinedValues.Count)) { GlobalDebug.WriteLineIf(GlobalDebug.Warn, "PrincipalValueCollection", "this[{0}].set: out of range (count={1})", index, _inner.combinedValues.Count); throw new ArgumentOutOfRangeException(nameof(index)); } if (value == null) throw new ArgumentNullException(nameof(value)); TrackedCollection<T>.ValueEl el = _inner.combinedValues[index]; if (el.isInserted) { GlobalDebug.WriteLineIf(GlobalDebug.Info, "PrincipalValueCollection", "this[{0}].set: is inserted {1}", index, value); el.insertedValue = value; } else { GlobalDebug.WriteLineIf(GlobalDebug.Info, "PrincipalValueCollection", "this[{0}].set: is original {1}", index, value); el.originalValue.Right = value; } } } // // ICollection<T> // public void CopyTo(T[] array, int index) { ((ICollection)this).CopyTo((Array)array, index); } public int Count { get { return _inner.Count; } } // // IEnumerable<T> // public IEnumerator<T> GetEnumerator() { return new ValueCollectionEnumerator<T>(_inner, _inner.combinedValues); } // // Private implementation // private readonly TrackedCollection<T> _inner = new TrackedCollection<T>(); // // Internal constructor // internal PrincipalValueCollection() { GlobalDebug.WriteLineIf(GlobalDebug.Info, "PrincipalValueCollection", "Ctor"); // Nothing to do here } // // Load/Store implementation // internal void Load(List<T> values) { GlobalDebug.WriteLineIf(GlobalDebug.Info, "PrincipalValueCollection", "Load, count={0}", values.Count); // To support reload _inner.combinedValues.Clear(); _inner.removedValues.Clear(); foreach (T value in values) { // If T was a mutable reference type, would need to make a copy of value // for the left-side of the Pair, so that changes to the value in the // right-side wouldn't also change the left-side value (due to aliasing). // However, we constrain T to be either a value type or a immutable ref type (e.g., string) // to avoid this problem. TrackedCollection<T>.ValueEl el = new TrackedCollection<T>.ValueEl(); el.isInserted = false; el.originalValue = new Pair<T, T>(value, value); _inner.combinedValues.Add(el); } } internal List<T> Inserted { get { return _inner.Inserted; } } internal List<T> Removed { get { return _inner.Removed; } } internal List<Pair<T, T>> ChangedValues { get { return _inner.ChangedValues; } } internal bool Changed { get { return _inner.Changed; } } // Resets the change-tracking of the collection to 'unchanged', by clearing out the removedValues, // changing inserted values into original values, and for all Pairs<T,T> in originalValues for which // the left-side does not equal the right-side, copying the right-side over the left-side internal void ResetTracking() { GlobalDebug.WriteLineIf(GlobalDebug.Info, "PrincipalValueCollection", "Entering ResetTracking"); _inner.removedValues.Clear(); foreach (TrackedCollection<T>.ValueEl el in _inner.combinedValues) { if (el.isInserted) { GlobalDebug.WriteLineIf( GlobalDebug.Info, "PrincipalValueCollection", "ResetTracking: moving {0} (type {1}) from inserted to original", el.insertedValue, el.insertedValue.GetType()); el.isInserted = false; el.originalValue = new Pair<T, T>(el.insertedValue, el.insertedValue); //el.insertedValue = T.default; } else { Pair<T, T> pair = el.originalValue; if (!pair.Left.Equals(pair.Right)) { GlobalDebug.WriteLineIf( GlobalDebug.Info, "PrincipalValueCollection", "ResetTracking: found changed original, left={0}, right={1}, type={2}", pair.Left, pair.Right, pair.Left.GetType()); pair.Left = pair.Right; } } } } } }
// 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.Collections; using System.Collections.Generic; namespace System.DirectoryServices.AccountManagement { public class PrincipalValueCollection<T> : IList<T>, IList // T must be a ValueType or immutable ref type (such as string) { // // IList // bool IList.IsFixedSize { get { return IsFixedSize; } } bool IList.IsReadOnly { get { return IsReadOnly; } } int IList.Add(object value) { if (value == null) throw new ArgumentNullException(nameof(value)); _inner.Add((T)value); return Count; } void IList.Clear() { Clear(); } bool IList.Contains(object value) { if (value == null) throw new ArgumentNullException(nameof(value)); return _inner.Contains((T)value); } int IList.IndexOf(object value) { if (value == null) throw new ArgumentNullException(nameof(value)); return IndexOf((T)value); } void IList.Insert(int index, object value) { if (value == null) throw new ArgumentNullException(nameof(value)); Insert(index, (T)value); } void IList.Remove(object value) { if (value == null) throw new ArgumentNullException(nameof(value)); _inner.Remove((T)value); } void IList.RemoveAt(int index) { RemoveAt(index); } object IList.this[int index] { get { return this[index]; } set { if (value == null) throw new ArgumentNullException(nameof(value)); this[index] = (T)value; } } // // ICollection // void ICollection.CopyTo(Array array, int index) { ((ICollection)_inner).CopyTo(array, index); } int ICollection.Count { get { return _inner.Count; } } bool ICollection.IsSynchronized { get { return IsSynchronized; } } object ICollection.SyncRoot { get { return SyncRoot; } } public bool IsSynchronized { get { return ((ICollection)_inner).IsSynchronized; } } public object SyncRoot { get { return this; } } // // IEnumerable // IEnumerator IEnumerable.GetEnumerator() { return (IEnumerator)GetEnumerator(); } // // IList<T> // public bool IsFixedSize { get { return false; } } public bool IsReadOnly { get { return false; } } // Adds obj to the end of the list by inserting it into insertedValues. public void Add(T value) { if (value == null) throw new ArgumentNullException(nameof(value)); _inner.Add(value); } public void Clear() { _inner.Clear(); } public bool Contains(T value) { if (value == null) throw new ArgumentNullException(nameof(value)); return _inner.Contains(value); } public int IndexOf(T value) { if (value == null) throw new ArgumentNullException(nameof(value)); int index = 0; foreach (TrackedCollection<T>.ValueEl el in _inner.combinedValues) { if (el.isInserted && el.insertedValue.Equals(value)) { GlobalDebug.WriteLineIf(GlobalDebug.Info, "PrincipalValueCollection", "IndexOf: found {0} on inserted at {1}", value, index); return index; } if (!el.isInserted && el.originalValue.Right.Equals(value)) { GlobalDebug.WriteLineIf(GlobalDebug.Info, "PrincipalValueCollection", "IndexOf: found {0} on original at {1}", value, index); return index; } index++; } return -1; } public void Insert(int index, T value) { _inner.MarkChange(); if (value == null) throw new ArgumentNullException(nameof(value)); if ((index < 0) || (index > _inner.combinedValues.Count)) { GlobalDebug.WriteLineIf(GlobalDebug.Warn, "PrincipalValueCollection", "Insert({0}): out of range (count={1})", index, _inner.combinedValues.Count); throw new ArgumentOutOfRangeException(nameof(index)); } TrackedCollection<T>.ValueEl el = new TrackedCollection<T>.ValueEl(); el.isInserted = true; el.insertedValue = value; _inner.combinedValues.Insert(index, el); } public bool Remove(T value) { if (value == null) throw new ArgumentNullException(nameof(value)); return _inner.Remove(value); } public void RemoveAt(int index) { _inner.MarkChange(); if ((index < 0) || (index >= _inner.combinedValues.Count)) { GlobalDebug.WriteLineIf(GlobalDebug.Warn, "PrincipalValueCollection", "RemoveAt({0}): out of range (count={1})", index, _inner.combinedValues.Count); throw new ArgumentOutOfRangeException(nameof(index)); } TrackedCollection<T>.ValueEl el = _inner.combinedValues[index]; if (el.isInserted) { // We're removing an inserted value. GlobalDebug.WriteLineIf(GlobalDebug.Info, "PrincipalValueCollection", "RemoveAt({0}): removing inserted", index); _inner.combinedValues.RemoveAt(index); } else { // We're removing an original value. GlobalDebug.WriteLineIf(GlobalDebug.Info, "PrincipalValueCollection", "RemoveAt({0}): removing original", index); Pair<T, T> pair = _inner.combinedValues[index].originalValue; _inner.combinedValues.RemoveAt(index); _inner.removedValues.Add(pair.Left); } } public T this[int index] { get { if ((index < 0) || (index >= _inner.combinedValues.Count)) { GlobalDebug.WriteLineIf(GlobalDebug.Warn, "PrincipalValueCollection", "this[{0}].get: out of range (count={1})", index, _inner.combinedValues.Count); throw new ArgumentOutOfRangeException(nameof(index)); } TrackedCollection<T>.ValueEl el = _inner.combinedValues[index]; if (el.isInserted) { GlobalDebug.WriteLineIf(GlobalDebug.Info, "PrincipalValueCollection", "this[{0}].get: is inserted {1}", index, el.insertedValue); return el.insertedValue; } else { GlobalDebug.WriteLineIf(GlobalDebug.Info, "PrincipalValueCollection", "this[{0}].get: is original {1}", index, el.originalValue.Right); return el.originalValue.Right; // Right == current value } } set { _inner.MarkChange(); if ((index < 0) || (index >= _inner.combinedValues.Count)) { GlobalDebug.WriteLineIf(GlobalDebug.Warn, "PrincipalValueCollection", "this[{0}].set: out of range (count={1})", index, _inner.combinedValues.Count); throw new ArgumentOutOfRangeException(nameof(index)); } if (value == null) throw new ArgumentNullException(nameof(value)); TrackedCollection<T>.ValueEl el = _inner.combinedValues[index]; if (el.isInserted) { GlobalDebug.WriteLineIf(GlobalDebug.Info, "PrincipalValueCollection", "this[{0}].set: is inserted {1}", index, value); el.insertedValue = value; } else { GlobalDebug.WriteLineIf(GlobalDebug.Info, "PrincipalValueCollection", "this[{0}].set: is original {1}", index, value); el.originalValue.Right = value; } } } // // ICollection<T> // public void CopyTo(T[] array, int index) { ((ICollection)this).CopyTo((Array)array, index); } public int Count { get { return _inner.Count; } } // // IEnumerable<T> // public IEnumerator<T> GetEnumerator() { return new ValueCollectionEnumerator<T>(_inner, _inner.combinedValues); } // // Private implementation // private readonly TrackedCollection<T> _inner = new TrackedCollection<T>(); // // Internal constructor // internal PrincipalValueCollection() { GlobalDebug.WriteLineIf(GlobalDebug.Info, "PrincipalValueCollection", "Ctor"); // Nothing to do here } // // Load/Store implementation // internal void Load(List<T> values) { GlobalDebug.WriteLineIf(GlobalDebug.Info, "PrincipalValueCollection", "Load, count={0}", values.Count); // To support reload _inner.combinedValues.Clear(); _inner.removedValues.Clear(); foreach (T value in values) { // If T was a mutable reference type, would need to make a copy of value // for the left-side of the Pair, so that changes to the value in the // right-side wouldn't also change the left-side value (due to aliasing). // However, we constrain T to be either a value type or a immutable ref type (e.g., string) // to avoid this problem. TrackedCollection<T>.ValueEl el = new TrackedCollection<T>.ValueEl(); el.isInserted = false; el.originalValue = new Pair<T, T>(value, value); _inner.combinedValues.Add(el); } } internal List<T> Inserted { get { return _inner.Inserted; } } internal List<T> Removed { get { return _inner.Removed; } } internal List<Pair<T, T>> ChangedValues { get { return _inner.ChangedValues; } } internal bool Changed { get { return _inner.Changed; } } // Resets the change-tracking of the collection to 'unchanged', by clearing out the removedValues, // changing inserted values into original values, and for all Pairs<T,T> in originalValues for which // the left-side does not equal the right-side, copying the right-side over the left-side internal void ResetTracking() { GlobalDebug.WriteLineIf(GlobalDebug.Info, "PrincipalValueCollection", "Entering ResetTracking"); _inner.removedValues.Clear(); foreach (TrackedCollection<T>.ValueEl el in _inner.combinedValues) { if (el.isInserted) { GlobalDebug.WriteLineIf( GlobalDebug.Info, "PrincipalValueCollection", "ResetTracking: moving {0} (type {1}) from inserted to original", el.insertedValue, el.insertedValue.GetType()); el.isInserted = false; el.originalValue = new Pair<T, T>(el.insertedValue, el.insertedValue); //el.insertedValue = T.default; } else { Pair<T, T> pair = el.originalValue; if (!pair.Left.Equals(pair.Right)) { GlobalDebug.WriteLineIf( GlobalDebug.Info, "PrincipalValueCollection", "ResetTracking: found changed original, left={0}, right={1}, type={2}", pair.Left, pair.Right, pair.Left.GetType()); pair.Left = pair.Right; } } } } } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/Loader/classloader/generics/GenericMethods/VSW491668.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // test has a generic type with 10,000 generic type arguments and a generic method with 10,000 generic type arguments. // VSW 491668 using System; public class Test_VSW491668 { public static int Main() { MyClass<int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int> obj = new MyClass<int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int>(); obj.method1<int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int>(); Console.WriteLine("PASS"); return 100; } } public class MyClass<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, T46, T47, T48, T49, T50, T51, T52, T53, T54, T55, T56, T57, T58, T59, T60, T61, T62, T63, T64, T65, T66, T67, T68, T69, T70, T71, T72, T73, T74, T75, T76, T77, T78, T79, T80, T81, T82, T83, T84, T85, T86, T87, T88, T89, T90, T91, T92, T93, T94, T95, T96, T97, T98, T99, T100, T101, T102, T103, T104, T105, T106, T107, T108, T109, T110, T111, T112, T113, T114, T115, T116, T117, T118, T119, T120, T121, T122, T123, T124, T125, T126, T127, T128, T129, T130, T131, T132, T133, T134, T135, T136, T137, T138, T139, T140, T141, T142, T143, T144, T145, T146, T147, T148, T149, T150, T151, T152, T153, T154, T155, T156, T157, T158, T159, T160, T161, T162, T163, T164, T165, T166, T167, T168, T169, T170, T171, T172, T173, T174, T175, T176, T177, T178, T179, T180, T181, T182, T183, T184, T185, T186, T187, T188, T189, T190, T191, T192, T193, T194, T195, T196, T197, T198, T199, T200, T201, T202, T203, T204, T205, T206, T207, T208, T209, T210, T211, T212, T213, T214, T215, T216, T217, T218, T219, T220, T221, T222, T223, T224, T225, T226, T227, T228, T229, T230, T231, T232, T233, T234, T235, T236, T237, T238, T239, T240, T241, T242, T243, T244, T245, T246, T247, T248, T249, T250, T251, T252, T253, T254, T255, T256, T257, T258, T259, T260, T261, T262, T263, T264, T265, T266, T267, T268, T269, T270, T271, T272, T273, T274, T275, T276, T277, T278, T279, T280, T281, T282, T283, T284, T285, T286, T287, T288, T289, T290, T291, T292, T293, T294, T295, T296, T297, T298, T299, T300, T301, T302, T303, T304, T305, T306, T307, T308, T309, T310, T311, T312, T313, T314, T315, T316, T317, T318, T319, T320, T321, T322, T323, T324, T325, T326, T327, T328, T329, T330, T331, T332, T333, T334, T335, T336, T337, T338, T339, T340, T341, T342, T343, T344, T345, T346, T347, T348, T349, T350, T351, T352, T353, T354, T355, T356, T357, T358, T359, T360, T361, T362, T363, T364, T365, T366, T367, T368, T369, T370, T371, T372, T373, T374, T375, T376, T377, T378, T379, T380, T381, T382, T383, T384, T385, T386, T387, T388, T389, T390, T391, T392, T393, T394, T395, T396, T397, T398, T399, T400, T401, T402, T403, T404, T405, T406, T407, T408, T409, T410, T411, T412, T413, T414, T415, T416, T417, T418, T419, T420, T421, T422, T423, T424, T425, T426, T427, T428, T429, T430, T431, T432, T433, T434, T435, T436, T437, T438, T439, T440, T441, T442, T443, T444, T445, T446, T447, T448, T449, T450, T451, T452, T453, T454, T455, T456, T457, T458, T459, T460, T461, T462, T463, T464, T465, T466, T467, T468, T469, T470, T471, T472, T473, T474, T475, T476, T477, T478, T479, T480, T481, T482, T483, T484, T485, T486, T487, T488, T489, T490, T491, T492, T493, T494, T495, T496, T497, T498, T499, T500, T501, T502, T503, T504, T505, T506, T507, T508, T509, T510, T511, T512, T513, T514, T515, T516, T517, T518, T519, T520, T521, T522, T523, T524, T525, T526, T527, T528, T529, T530, T531, T532, T533, T534, T535, T536, T537, T538, T539, T540, T541, T542, T543, T544, T545, T546, T547, T548, T549, T550, T551, T552, T553, T554, T555, T556, T557, T558, T559, T560, T561, T562, T563, T564, T565, T566, T567, T568, T569, T570, T571, T572, T573, T574, T575, T576, T577, T578, T579, T580, T581, T582, T583, T584, T585, T586, T587, T588, T589, T590, T591, T592, T593, T594, T595, T596, T597, T598, T599, T600, T601, T602, T603, T604, T605, T606, T607, T608, T609, T610, T611, T612, T613, T614, T615, T616, T617, T618, T619, T620, T621, T622, T623, T624, T625, T626, T627, T628, T629, T630, T631, T632, T633, T634, T635, T636, T637, T638, T639, T640, T641, T642, T643, T644, T645, T646, T647, T648, T649, T650, T651, T652, T653, T654, T655, T656, T657, T658, T659, T660, T661, T662, T663, T664, T665, T666, T667, T668, T669, T670, T671, T672, T673, T674, T675, T676, T677, T678, T679, T680, T681, T682, T683, T684, T685, T686, T687, T688, T689, T690, T691, T692, T693, T694, T695, T696, T697, T698, T699, T700, T701, T702, T703, T704, T705, T706, T707, T708, T709, T710, T711, T712, T713, T714, T715, T716, T717, T718, T719, T720, T721, T722, T723, T724, T725, T726, T727, T728, T729, T730, T731, T732, T733, T734, T735, T736, T737, T738, T739, T740, T741, T742, T743, T744, T745, T746, T747, T748, T749, T750, T751, T752, T753, T754, T755, T756, T757, T758, T759, T760, T761, T762, T763, T764, T765, T766, T767, T768, T769, T770, T771, T772, T773, T774, T775, T776, T777, T778, T779, T780, T781, T782, T783, T784, T785, T786, T787, T788, T789, T790, T791, T792, T793, T794, T795, T796, T797, T798, T799, T800, T801, T802, T803, T804, T805, T806, T807, T808, T809, T810, T811, T812, T813, T814, T815, T816, T817, T818, T819, T820, T821, T822, T823, T824, T825, T826, T827, T828, T829, T830, T831, T832, T833, T834, T835, T836, T837, T838, T839, T840, T841, T842, T843, T844, T845, T846, T847, T848, T849, T850, T851, T852, T853, T854, T855, T856, T857, T858, T859, T860, T861, T862, T863, T864, T865, T866, T867, T868, T869, T870, T871, T872, T873, T874, T875, T876, T877, T878, T879, T880, T881, T882, T883, T884, T885, T886, T887, T888, T889, T890, T891, T892, T893, T894, T895, T896, T897, T898, T899, T900, T901, T902, T903, T904, T905, T906, T907, T908, T909, T910, T911, T912, T913, T914, T915, T916, T917, T918, T919, T920, T921, T922, T923, T924, T925, T926, T927, T928, T929, T930, T931, T932, T933, T934, T935, T936, T937, T938, T939, T940, T941, T942, T943, T944, T945, T946, T947, T948, T949, T950, T951, T952, T953, T954, T955, T956, T957, T958, T959, T960, T961, T962, T963, T964, T965, T966, T967, T968, T969, T970, T971, T972, T973, T974, T975, T976, T977, T978, T979, T980, T981, T982, T983, T984, T985, T986, T987, T988, T989, T990, T991, T992, T993, T994, T995, T996, T997, T998, T999, T1000, T1001, T1002, T1003, T1004, T1005, T1006, T1007, T1008, T1009, T1010, T1011, T1012, T1013, T1014, T1015, T1016, T1017, T1018, T1019, T1020, T1021, T1022, T1023, T1024, T1025, T1026, T1027, T1028, T1029, T1030, T1031, T1032, T1033, T1034, T1035, T1036, T1037, T1038, T1039, T1040, T1041, T1042, T1043, T1044, T1045, T1046, T1047, T1048, T1049, T1050, T1051, T1052, T1053, T1054, T1055, T1056, T1057, T1058, T1059, T1060, T1061, T1062, T1063, T1064, T1065, T1066, T1067, T1068, T1069, T1070, T1071, T1072, T1073, T1074, T1075, T1076, T1077, T1078, T1079, T1080, T1081, T1082, T1083, T1084, T1085, T1086, T1087, T1088, T1089, T1090, T1091, T1092, T1093, T1094, T1095, T1096, T1097, T1098, T1099, T1100, T1101, T1102, T1103, T1104, T1105, T1106, T1107, T1108, T1109, T1110, T1111, T1112, T1113, T1114, T1115, T1116, T1117, T1118, T1119, T1120, T1121, T1122, T1123, T1124, T1125, T1126, T1127, T1128, T1129, T1130, T1131, T1132, T1133, T1134, T1135, T1136, T1137, T1138, T1139, T1140, T1141, T1142, T1143, T1144, T1145, T1146, T1147, T1148, T1149, T1150, T1151, T1152, T1153, T1154, T1155, T1156, T1157, T1158, T1159, T1160, T1161, T1162, T1163, T1164, T1165, T1166, T1167, T1168, T1169, T1170, T1171, T1172, T1173, T1174, T1175, T1176, T1177, T1178, T1179, T1180, T1181, T1182, T1183, T1184, T1185, T1186, T1187, T1188, T1189, T1190, T1191, T1192, T1193, T1194, T1195, T1196, T1197, T1198, T1199, T1200, T1201, T1202, T1203, T1204, T1205, T1206, T1207, T1208, T1209, T1210, T1211, T1212, T1213, T1214, T1215, T1216, T1217, T1218, T1219, T1220, T1221, T1222, T1223, T1224, T1225, T1226, T1227, T1228, T1229, T1230, T1231, T1232, T1233, T1234, T1235, T1236, T1237, T1238, T1239, T1240, T1241, T1242, T1243, T1244, T1245, T1246, T1247, T1248, T1249, T1250, T1251, T1252, T1253, T1254, T1255, T1256, T1257, T1258, T1259, T1260, T1261, T1262, T1263, T1264, T1265, T1266, T1267, T1268, T1269, T1270, T1271, T1272, T1273, T1274, T1275, T1276, T1277, T1278, T1279, T1280, T1281, T1282, T1283, T1284, T1285, T1286, T1287, T1288, T1289, T1290, T1291, T1292, T1293, T1294, T1295, T1296, T1297, T1298, T1299, T1300, T1301, T1302, T1303, T1304, T1305, T1306, T1307, T1308, T1309, T1310, T1311, T1312, T1313, T1314, T1315, T1316, T1317, T1318, T1319, T1320, T1321, T1322, T1323, T1324, T1325, T1326, T1327, T1328, T1329, T1330, T1331, T1332, T1333, T1334, T1335, T1336, T1337, T1338, T1339, T1340, T1341, T1342, T1343, T1344, T1345, T1346, T1347, T1348, T1349, T1350, T1351, T1352, T1353, T1354, T1355, T1356, T1357, T1358, T1359, T1360, T1361, T1362, T1363, T1364, T1365, T1366, T1367, T1368, T1369, T1370, T1371, T1372, T1373, T1374, T1375, T1376, T1377, T1378, T1379, T1380, T1381, T1382, T1383, T1384, T1385, T1386, T1387, T1388, T1389, T1390, T1391, T1392, T1393, T1394, T1395, T1396, T1397, T1398, T1399, T1400, T1401, T1402, T1403, T1404, T1405, T1406, T1407, T1408, T1409, T1410, T1411, T1412, T1413, T1414, T1415, T1416, T1417, T1418, T1419, T1420, T1421, T1422, T1423, T1424, T1425, T1426, T1427, T1428, T1429, T1430, T1431, T1432, T1433, T1434, T1435, T1436, T1437, T1438, T1439, T1440, T1441, T1442, T1443, T1444, T1445, T1446, T1447, T1448, T1449, T1450, T1451, T1452, T1453, T1454, T1455, T1456, T1457, T1458, T1459, T1460, T1461, T1462, T1463, T1464, T1465, T1466, T1467, T1468, T1469, T1470, T1471, T1472, T1473, T1474, T1475, T1476, T1477, T1478, T1479, T1480, T1481, T1482, T1483, T1484, T1485, T1486, T1487, T1488, T1489, T1490, T1491, T1492, T1493, T1494, T1495, T1496, T1497, T1498, T1499, T1500, T1501, T1502, T1503, T1504, T1505, T1506, T1507, T1508, T1509, T1510, T1511, T1512, T1513, T1514, T1515, T1516, T1517, T1518, T1519, T1520, T1521, T1522, T1523, T1524, T1525, T1526, T1527, T1528, T1529, T1530, T1531, T1532, T1533, T1534, T1535, T1536, T1537, T1538, T1539, T1540, T1541, T1542, T1543, T1544, T1545, T1546, T1547, T1548, T1549, T1550, T1551, T1552, T1553, T1554, T1555, T1556, T1557, T1558, T1559, T1560, T1561, T1562, T1563, T1564, T1565, T1566, T1567, T1568, T1569, T1570, T1571, T1572, T1573, T1574, T1575, T1576, T1577, T1578, T1579, T1580, T1581, T1582, T1583, T1584, T1585, T1586, T1587, T1588, T1589, T1590, T1591, T1592, T1593, T1594, T1595, T1596, T1597, T1598, T1599, T1600, T1601, T1602, T1603, T1604, T1605, T1606, T1607, T1608, T1609, T1610, T1611, T1612, T1613, T1614, T1615, T1616, T1617, T1618, T1619, T1620, T1621, T1622, T1623, T1624, T1625, T1626, T1627, T1628, T1629, T1630, T1631, T1632, T1633, T1634, T1635, T1636, T1637, T1638, T1639, T1640, T1641, T1642, T1643, T1644, T1645, T1646, T1647, T1648, T1649, T1650, T1651, T1652, T1653, T1654, T1655, T1656, T1657, T1658, T1659, T1660, T1661, T1662, T1663, T1664, T1665, T1666, T1667, T1668, T1669, T1670, T1671, T1672, T1673, T1674, T1675, T1676, T1677, T1678, T1679, T1680, T1681, T1682, T1683, T1684, T1685, T1686, T1687, T1688, T1689, T1690, T1691, T1692, T1693, T1694, T1695, T1696, T1697, T1698, T1699, T1700, T1701, T1702, T1703, T1704, T1705, T1706, T1707, T1708, T1709, T1710, T1711, T1712, T1713, T1714, T1715, T1716, T1717, T1718, T1719, T1720, T1721, T1722, T1723, T1724, T1725, T1726, T1727, T1728, T1729, T1730, T1731, T1732, T1733, T1734, T1735, T1736, T1737, T1738, T1739, T1740, T1741, T1742, T1743, T1744, T1745, T1746, T1747, T1748, T1749, T1750, T1751, T1752, T1753, T1754, T1755, T1756, T1757, T1758, T1759, T1760, T1761, T1762, T1763, T1764, T1765, T1766, T1767, T1768, T1769, T1770, T1771, T1772, T1773, T1774, T1775, T1776, T1777, T1778, T1779, T1780, T1781, T1782, T1783, T1784, T1785, T1786, T1787, T1788, T1789, T1790, T1791, T1792, T1793, T1794, T1795, T1796, T1797, T1798, T1799, T1800, T1801, T1802, T1803, T1804, T1805, T1806, T1807, T1808, T1809, T1810, T1811, T1812, T1813, T1814, T1815, T1816, T1817, T1818, T1819, T1820, T1821, T1822, T1823, T1824, T1825, T1826, T1827, T1828, T1829, T1830, T1831, T1832, T1833, T1834, T1835, T1836, T1837, T1838, T1839, T1840, T1841, T1842, T1843, T1844, T1845, T1846, T1847, T1848, T1849, T1850, T1851, T1852, T1853, T1854, T1855, T1856, T1857, T1858, T1859, T1860, T1861, T1862, T1863, T1864, T1865, T1866, T1867, T1868, T1869, T1870, T1871, T1872, T1873, T1874, T1875, T1876, T1877, T1878, T1879, T1880, T1881, T1882, T1883, T1884, T1885, T1886, T1887, T1888, T1889, T1890, T1891, T1892, T1893, T1894, T1895, T1896, T1897, T1898, T1899, T1900, T1901, T1902, T1903, T1904, T1905, T1906, T1907, T1908, T1909, T1910, T1911, T1912, T1913, T1914, T1915, T1916, T1917, T1918, T1919, T1920, T1921, T1922, T1923, T1924, T1925, T1926, T1927, T1928, T1929, T1930, T1931, T1932, T1933, T1934, T1935, T1936, T1937, T1938, T1939, T1940, T1941, T1942, T1943, T1944, T1945, T1946, T1947, T1948, T1949, T1950, T1951, T1952, T1953, T1954, T1955, T1956, T1957, T1958, T1959, T1960, T1961, T1962, T1963, T1964, T1965, T1966, T1967, T1968, T1969, T1970, T1971, T1972, T1973, T1974, T1975, T1976, T1977, T1978, T1979, T1980, T1981, T1982, T1983, T1984, T1985, T1986, T1987, T1988, T1989, T1990, T1991, T1992, T1993, T1994, T1995, T1996, T1997, T1998, T1999, T2000, T2001, T2002, T2003, T2004, T2005, T2006, T2007, T2008, T2009, T2010, T2011, T2012, T2013, T2014, T2015, T2016, T2017, T2018, T2019, T2020, T2021, T2022, T2023, T2024, T2025, T2026, T2027, T2028, T2029, T2030, T2031, T2032, T2033, T2034, T2035, T2036, T2037, T2038, T2039, T2040, T2041, T2042, T2043, T2044, T2045, T2046, T2047, T2048, T2049, T2050, T2051, T2052, T2053, T2054, T2055, T2056, T2057, T2058, T2059, T2060, T2061, T2062, T2063, T2064, T2065, T2066, T2067, T2068, T2069, T2070, T2071, T2072, T2073, T2074, T2075, T2076, T2077, T2078, T2079, T2080, T2081, T2082, T2083, T2084, T2085, T2086, T2087, T2088, T2089, T2090, T2091, T2092, T2093, T2094, T2095, T2096, T2097, T2098, T2099, T2100, T2101, T2102, T2103, T2104, T2105, T2106, T2107, T2108, T2109, T2110, T2111, T2112, T2113, T2114, T2115, T2116, T2117, T2118, T2119, T2120, T2121, T2122, T2123, T2124, T2125, T2126, T2127, T2128, T2129, T2130, T2131, T2132, T2133, T2134, T2135, T2136, T2137, T2138, T2139, T2140, T2141, T2142, T2143, T2144, T2145, T2146, T2147, T2148, T2149, T2150, T2151, T2152, T2153, T2154, T2155, T2156, T2157, T2158, T2159, T2160, T2161, T2162, T2163, T2164, T2165, T2166, T2167, T2168, T2169, T2170, T2171, T2172, T2173, T2174, T2175, T2176, T2177, T2178, T2179, T2180, T2181, T2182, T2183, T2184, T2185, T2186, T2187, T2188, T2189, T2190, T2191, T2192, T2193, T2194, T2195, T2196, T2197, T2198, T2199, T2200, T2201, T2202, T2203, T2204, T2205, T2206, T2207, T2208, T2209, T2210, T2211, T2212, T2213, T2214, T2215, T2216, T2217, T2218, T2219, T2220, T2221, T2222, T2223, T2224, T2225, T2226, T2227, T2228, T2229, T2230, T2231, T2232, T2233, T2234, T2235, T2236, T2237, T2238, T2239, T2240, T2241, T2242, T2243, T2244, T2245, T2246, T2247, T2248, T2249, T2250, T2251, T2252, T2253, T2254, T2255, T2256, T2257, T2258, T2259, T2260, T2261, T2262, T2263, T2264, T2265, T2266, T2267, T2268, T2269, T2270, T2271, T2272, T2273, T2274, T2275, T2276, T2277, T2278, T2279, T2280, T2281, T2282, T2283, T2284, T2285, T2286, T2287, T2288, T2289, T2290, T2291, T2292, T2293, T2294, T2295, T2296, T2297, T2298, T2299, T2300, T2301, T2302, T2303, T2304, T2305, T2306, T2307, T2308, T2309, T2310, T2311, T2312, T2313, T2314, T2315, T2316, T2317, T2318, T2319, T2320, T2321, T2322, T2323, T2324, T2325, T2326, T2327, T2328, T2329, T2330, T2331, T2332, T2333, T2334, T2335, T2336, T2337, T2338, T2339, T2340, T2341, T2342, T2343, T2344, T2345, T2346, T2347, T2348, T2349, T2350, T2351, T2352, T2353, T2354, T2355, T2356, T2357, T2358, T2359, T2360, T2361, T2362, T2363, T2364, T2365, T2366, T2367, T2368, T2369, T2370, T2371, T2372, T2373, T2374, T2375, T2376, T2377, T2378, T2379, T2380, T2381, T2382, T2383, T2384, T2385, T2386, T2387, T2388, T2389, T2390, T2391, T2392, T2393, T2394, T2395, T2396, T2397, T2398, T2399, T2400, T2401, T2402, T2403, T2404, T2405, T2406, T2407, T2408, T2409, T2410, T2411, T2412, T2413, T2414, T2415, T2416, T2417, T2418, T2419, T2420, T2421, T2422, T2423, T2424, T2425, T2426, T2427, T2428, T2429, T2430, T2431, T2432, T2433, T2434, T2435, T2436, T2437, T2438, T2439, T2440, T2441, T2442, T2443, T2444, T2445, T2446, T2447, T2448, T2449, T2450, T2451, T2452, T2453, T2454, T2455, T2456, T2457, T2458, T2459, T2460, T2461, T2462, T2463, T2464, T2465, T2466, T2467, T2468, T2469, T2470, T2471, T2472, T2473, T2474, T2475, T2476, T2477, T2478, T2479, T2480, T2481, T2482, T2483, T2484, T2485, T2486, T2487, T2488, T2489, T2490, T2491, T2492, T2493, T2494, T2495, T2496, T2497, T2498, T2499, T2500, T2501, T2502, T2503, T2504, T2505, T2506, T2507, T2508, T2509, T2510, T2511, T2512, T2513, T2514, T2515, T2516, T2517, T2518, T2519, T2520, T2521, T2522, T2523, T2524, T2525, T2526, T2527, T2528, T2529, T2530, T2531, T2532, T2533, T2534, T2535, T2536, T2537, T2538, T2539, T2540, T2541, T2542, T2543, T2544, T2545, T2546, T2547, T2548, T2549, T2550, T2551, T2552, T2553, T2554, T2555, T2556, T2557, T2558, T2559, T2560, T2561, T2562, T2563, T2564, T2565, T2566, T2567, T2568, T2569, T2570, T2571, T2572, T2573, T2574, T2575, T2576, T2577, T2578, T2579, T2580, T2581, T2582, T2583, T2584, T2585, T2586, T2587, T2588, T2589, T2590, T2591, T2592, T2593, T2594, T2595, T2596, T2597, T2598, T2599, T2600, T2601, T2602, T2603, T2604, T2605, T2606, T2607, T2608, T2609, T2610, T2611, T2612, T2613, T2614, T2615, T2616, T2617, T2618, T2619, T2620, T2621, T2622, T2623, T2624, T2625, T2626, T2627, T2628, T2629, T2630, T2631, T2632, T2633, T2634, T2635, T2636, T2637, T2638, T2639, T2640, T2641, T2642, T2643, T2644, T2645, T2646, T2647, T2648, T2649, T2650, T2651, T2652, T2653, T2654, T2655, T2656, T2657, T2658, T2659, T2660, T2661, T2662, T2663, T2664, T2665, T2666, T2667, T2668, T2669, T2670, T2671, T2672, T2673, T2674, T2675, T2676, T2677, T2678, T2679, T2680, T2681, T2682, T2683, T2684, T2685, T2686, T2687, T2688, T2689, T2690, T2691, T2692, T2693, T2694, T2695, T2696, T2697, T2698, T2699, T2700, T2701, T2702, T2703, T2704, T2705, T2706, T2707, T2708, T2709, T2710, T2711, T2712, T2713, T2714, T2715, T2716, T2717, T2718, T2719, T2720, T2721, T2722, T2723, T2724, T2725, T2726, T2727, T2728, T2729, T2730, T2731, T2732, T2733, T2734, T2735, T2736, T2737, T2738, T2739, T2740, T2741, T2742, T2743, T2744, T2745, T2746, T2747, T2748, T2749, T2750, T2751, T2752, T2753, T2754, T2755, T2756, T2757, T2758, T2759, T2760, T2761, T2762, T2763, T2764, T2765, T2766, T2767, T2768, T2769, T2770, T2771, T2772, T2773, T2774, T2775, T2776, T2777, T2778, T2779, T2780, T2781, T2782, T2783, T2784, T2785, T2786, T2787, T2788, T2789, T2790, T2791, T2792, T2793, T2794, T2795, T2796, T2797, T2798, T2799, T2800, T2801, T2802, T2803, T2804, T2805, T2806, T2807, T2808, T2809, T2810, T2811, T2812, T2813, T2814, T2815, T2816, T2817, T2818, T2819, T2820, T2821, T2822, T2823, T2824, T2825, T2826, T2827, T2828, T2829, T2830, T2831, T2832, T2833, T2834, T2835, T2836, T2837, T2838, T2839, T2840, T2841, T2842, T2843, T2844, T2845, T2846, T2847, T2848, T2849, T2850, T2851, T2852, T2853, T2854, T2855, T2856, T2857, T2858, T2859, T2860, T2861, T2862, T2863, T2864, T2865, T2866, T2867, T2868, T2869, T2870, T2871, T2872, T2873, T2874, T2875, T2876, T2877, T2878, T2879, T2880, T2881, T2882, T2883, T2884, T2885, T2886, T2887, T2888, T2889, T2890, T2891, T2892, T2893, T2894, T2895, T2896, T2897, T2898, T2899, T2900, T2901, T2902, T2903, T2904, T2905, T2906, T2907, T2908, T2909, T2910, T2911, T2912, T2913, T2914, T2915, T2916, T2917, T2918, T2919, T2920, T2921, T2922, T2923, T2924, T2925, T2926, T2927, T2928, T2929, T2930, T2931, T2932, T2933, T2934, T2935, T2936, T2937, T2938, T2939, T2940, T2941, T2942, T2943, T2944, T2945, T2946, T2947, T2948, T2949, T2950, T2951, T2952, T2953, T2954, T2955, T2956, T2957, T2958, T2959, T2960, T2961, T2962, T2963, T2964, T2965, T2966, T2967, T2968, T2969, T2970, T2971, T2972, T2973, T2974, T2975, T2976, T2977, T2978, T2979, T2980, T2981, T2982, T2983, T2984, T2985, T2986, T2987, T2988, T2989, T2990, T2991, T2992, T2993, T2994, T2995, T2996, T2997, T2998, T2999, T3000, T3001, T3002, T3003, T3004, T3005, T3006, T3007, T3008, T3009, T3010, T3011, T3012, T3013, T3014, T3015, T3016, T3017, T3018, T3019, T3020, T3021, T3022, T3023, T3024, T3025, T3026, T3027, T3028, T3029, T3030, T3031, T3032, T3033, T3034, T3035, T3036, T3037, T3038, T3039, T3040, T3041, T3042, T3043, T3044, T3045, T3046, T3047, T3048, T3049, T3050, T3051, T3052, T3053, T3054, T3055, T3056, T3057, T3058, T3059, T3060, T3061, T3062, T3063, T3064, T3065, T3066, T3067, T3068, T3069, T3070, T3071, T3072, T3073, T3074, T3075, T3076, T3077, T3078, T3079, T3080, T3081, T3082, T3083, T3084, T3085, T3086, T3087, T3088, T3089, T3090, T3091, T3092, T3093, T3094, T3095, T3096, T3097, T3098, T3099, T3100, T3101, T3102, T3103, T3104, T3105, T3106, T3107, T3108, T3109, T3110, T3111, T3112, T3113, T3114, T3115, T3116, T3117, T3118, T3119, T3120, T3121, T3122, T3123, T3124, T3125, T3126, T3127, T3128, T3129, T3130, T3131, T3132, T3133, T3134, T3135, T3136, T3137, T3138, T3139, T3140, T3141, T3142, T3143, T3144, T3145, T3146, T3147, T3148, T3149, T3150, T3151, T3152, T3153, T3154, T3155, T3156, T3157, T3158, T3159, T3160, T3161, T3162, T3163, T3164, T3165, T3166, T3167, T3168, T3169, T3170, T3171, T3172, T3173, T3174, T3175, T3176, T3177, T3178, T3179, T3180, T3181, T3182, T3183, T3184, T3185, T3186, T3187, T3188, T3189, T3190, T3191, T3192, T3193, T3194, T3195, T3196, T3197, T3198, T3199, T3200, T3201, T3202, T3203, T3204, T3205, T3206, T3207, T3208, T3209, T3210, T3211, T3212, T3213, T3214, T3215, T3216, T3217, T3218, T3219, T3220, T3221, T3222, T3223, T3224, T3225, T3226, T3227, T3228, T3229, T3230, T3231, T3232, T3233, T3234, T3235, T3236, T3237, T3238, T3239, T3240, T3241, T3242, T3243, T3244, T3245, T3246, T3247, T3248, T3249, T3250, T3251, T3252, T3253, T3254, T3255, T3256, T3257, T3258, T3259, T3260, T3261, T3262, T3263, T3264, T3265, T3266, T3267, T3268, T3269, T3270, T3271, T3272, T3273, T3274, T3275, T3276, T3277, T3278, T3279, T3280, T3281, T3282, T3283, T3284, T3285, T3286, T3287, T3288, T3289, T3290, T3291, T3292, T3293, T3294, T3295, T3296, T3297, T3298, T3299, T3300, T3301, T3302, T3303, T3304, T3305, T3306, T3307, T3308, T3309, T3310, T3311, T3312, T3313, T3314, T3315, T3316, T3317, T3318, T3319, T3320, T3321, T3322, T3323, T3324, T3325, T3326, T3327, T3328, T3329, T3330, T3331, T3332, T3333, T3334, T3335, T3336, T3337, T3338, T3339, T3340, T3341, T3342, T3343, T3344, T3345, T3346, T3347, T3348, T3349, T3350, T3351, T3352, T3353, T3354, T3355, T3356, T3357, T3358, T3359, T3360, T3361, T3362, T3363, T3364, T3365, T3366, T3367, T3368, T3369, T3370, T3371, T3372, T3373, T3374, T3375, T3376, T3377, T3378, T3379, T3380, T3381, T3382, T3383, T3384, T3385, T3386, T3387, T3388, T3389, T3390, T3391, T3392, T3393, T3394, T3395, T3396, T3397, T3398, T3399, T3400, T3401, T3402, T3403, T3404, T3405, T3406, T3407, T3408, T3409, T3410, T3411, T3412, T3413, T3414, T3415, T3416, T3417, T3418, T3419, T3420, T3421, T3422, T3423, T3424, T3425, T3426, T3427, T3428, T3429, T3430, T3431, T3432, T3433, T3434, T3435, T3436, T3437, T3438, T3439, T3440, T3441, T3442, T3443, T3444, T3445, T3446, T3447, T3448, T3449, T3450, T3451, T3452, T3453, T3454, T3455, T3456, T3457, T3458, T3459, T3460, T3461, T3462, T3463, T3464, T3465, T3466, T3467, T3468, T3469, T3470, T3471, T3472, T3473, T3474, T3475, T3476, T3477, T3478, T3479, T3480, T3481, T3482, T3483, T3484, T3485, T3486, T3487, T3488, T3489, T3490, T3491, T3492, T3493, T3494, T3495, T3496, T3497, T3498, T3499, T3500, T3501, T3502, T3503, T3504, T3505, T3506, T3507, T3508, T3509, T3510, T3511, T3512, T3513, T3514, T3515, T3516, T3517, T3518, T3519, T3520, T3521, T3522, T3523, T3524, T3525, T3526, T3527, T3528, T3529, T3530, T3531, T3532, T3533, T3534, T3535, T3536, T3537, T3538, T3539, T3540, T3541, T3542, T3543, T3544, T3545, T3546, T3547, T3548, T3549, T3550, T3551, T3552, T3553, T3554, T3555, T3556, T3557, T3558, T3559, T3560, T3561, T3562, T3563, T3564, T3565, T3566, T3567, T3568, T3569, T3570, T3571, T3572, T3573, T3574, T3575, T3576, T3577, T3578, T3579, T3580, T3581, T3582, T3583, T3584, T3585, T3586, T3587, T3588, T3589, T3590, T3591, T3592, T3593, T3594, T3595, T3596, T3597, T3598, T3599, T3600, T3601, T3602, T3603, T3604, T3605, T3606, T3607, T3608, T3609, T3610, T3611, T3612, T3613, T3614, T3615, T3616, T3617, T3618, T3619, T3620, T3621, T3622, T3623, T3624, T3625, T3626, T3627, T3628, T3629, T3630, T3631, T3632, T3633, T3634, T3635, T3636, T3637, T3638, T3639, T3640, T3641, T3642, T3643, T3644, T3645, T3646, T3647, T3648, T3649, T3650, T3651, T3652, T3653, T3654, T3655, T3656, T3657, T3658, T3659, T3660, T3661, T3662, T3663, T3664, T3665, T3666, T3667, T3668, T3669, T3670, T3671, T3672, T3673, T3674, T3675, T3676, T3677, T3678, T3679, T3680, T3681, T3682, T3683, T3684, T3685, T3686, T3687, T3688, T3689, T3690, T3691, T3692, T3693, T3694, T3695, T3696, T3697, T3698, T3699, T3700, T3701, T3702, T3703, T3704, T3705, T3706, T3707, T3708, T3709, T3710, T3711, T3712, T3713, T3714, T3715, T3716, T3717, T3718, T3719, T3720, T3721, T3722, T3723, T3724, T3725, T3726, T3727, T3728, T3729, T3730, T3731, T3732, T3733, T3734, T3735, T3736, T3737, T3738, T3739, T3740, T3741, T3742, T3743, T3744, T3745, T3746, T3747, T3748, T3749, T3750, T3751, T3752, T3753, T3754, T3755, T3756, T3757, T3758, T3759, T3760, T3761, T3762, T3763, T3764, T3765, T3766, T3767, T3768, T3769, T3770, T3771, T3772, T3773, T3774, T3775, T3776, T3777, T3778, T3779, T3780, T3781, T3782, T3783, T3784, T3785, T3786, T3787, T3788, T3789, T3790, T3791, T3792, T3793, T3794, T3795, T3796, T3797, T3798, T3799, T3800, T3801, T3802, T3803, T3804, T3805, T3806, T3807, T3808, T3809, T3810, T3811, T3812, T3813, T3814, T3815, T3816, T3817, T3818, T3819, T3820, T3821, T3822, T3823, T3824, T3825, T3826, T3827, T3828, T3829, T3830, T3831, T3832, T3833, T3834, T3835, T3836, T3837, T3838, T3839, T3840, T3841, T3842, T3843, T3844, T3845, T3846, T3847, T3848, T3849, T3850, T3851, T3852, T3853, T3854, T3855, T3856, T3857, T3858, T3859, T3860, T3861, T3862, T3863, T3864, T3865, T3866, T3867, T3868, T3869, T3870, T3871, T3872, T3873, T3874, T3875, T3876, T3877, T3878, T3879, T3880, T3881, T3882, T3883, T3884, T3885, T3886, T3887, T3888, T3889, T3890, T3891, T3892, T3893, T3894, T3895, T3896, T3897, T3898, T3899, T3900, T3901, T3902, T3903, T3904, T3905, T3906, T3907, T3908, T3909, T3910, T3911, T3912, T3913, T3914, T3915, T3916, T3917, T3918, T3919, T3920, T3921, T3922, T3923, T3924, T3925, T3926, T3927, T3928, T3929, T3930, T3931, T3932, T3933, T3934, T3935, T3936, T3937, T3938, T3939, T3940, T3941, T3942, T3943, T3944, T3945, T3946, T3947, T3948, T3949, T3950, T3951, T3952, T3953, T3954, T3955, T3956, T3957, T3958, T3959, T3960, T3961, T3962, T3963, T3964, T3965, T3966, T3967, T3968, T3969, T3970, T3971, T3972, T3973, T3974, T3975, T3976, T3977, T3978, T3979, T3980, T3981, T3982, T3983, T3984, T3985, T3986, T3987, T3988, T3989, T3990, T3991, T3992, T3993, T3994, T3995, T3996, T3997, T3998, T3999, T4000, T4001, T4002, T4003, T4004, T4005, T4006, T4007, T4008, T4009, T4010, T4011, T4012, T4013, T4014, T4015, T4016, T4017, T4018, T4019, T4020, T4021, T4022, T4023, T4024, T4025, T4026, T4027, T4028, T4029, T4030, T4031, T4032, T4033, T4034, T4035, T4036, T4037, T4038, T4039, T4040, T4041, T4042, T4043, T4044, T4045, T4046, T4047, T4048, T4049, T4050, T4051, T4052, T4053, T4054, T4055, T4056, T4057, T4058, T4059, T4060, T4061, T4062, T4063, T4064, T4065, T4066, T4067, T4068, T4069, T4070, T4071, T4072, T4073, T4074, T4075, T4076, T4077, T4078, T4079, T4080, T4081, T4082, T4083, T4084, T4085, T4086, T4087, T4088, T4089, T4090, T4091, T4092, T4093, T4094, T4095, T4096, T4097, T4098, T4099, T4100, T4101, T4102, T4103, T4104, T4105, T4106, T4107, T4108, T4109, T4110, T4111, T4112, T4113, T4114, T4115, T4116, T4117, T4118, T4119, T4120, T4121, T4122, T4123, T4124, T4125, T4126, T4127, T4128, T4129, T4130, T4131, T4132, T4133, T4134, T4135, T4136, T4137, T4138, T4139, T4140, T4141, T4142, T4143, T4144, T4145, T4146, T4147, T4148, T4149, T4150, T4151, T4152, T4153, T4154, T4155, T4156, T4157, T4158, T4159, T4160, T4161, T4162, T4163, T4164, T4165, T4166, T4167, T4168, T4169, T4170, T4171, T4172, T4173, T4174, T4175, T4176, T4177, T4178, T4179, T4180, T4181, T4182, T4183, T4184, T4185, T4186, T4187, T4188, T4189, T4190, T4191, T4192, T4193, T4194, T4195, T4196, T4197, T4198, T4199, T4200, T4201, T4202, T4203, T4204, T4205, T4206, T4207, T4208, T4209, T4210, T4211, T4212, T4213, T4214, T4215, T4216, T4217, T4218, T4219, T4220, T4221, T4222, T4223, T4224, T4225, T4226, T4227, T4228, T4229, T4230, T4231, T4232, T4233, T4234, T4235, T4236, T4237, T4238, T4239, T4240, T4241, T4242, T4243, T4244, T4245, T4246, T4247, T4248, T4249, T4250, T4251, T4252, T4253, T4254, T4255, T4256, T4257, T4258, T4259, T4260, T4261, T4262, T4263, T4264, T4265, T4266, T4267, T4268, T4269, T4270, T4271, T4272, T4273, T4274, T4275, T4276, T4277, T4278, T4279, T4280, T4281, T4282, T4283, T4284, T4285, T4286, T4287, T4288, T4289, T4290, T4291, T4292, T4293, T4294, T4295, T4296, T4297, T4298, T4299, T4300, T4301, T4302, T4303, T4304, T4305, T4306, T4307, T4308, T4309, T4310, T4311, T4312, T4313, T4314, T4315, T4316, T4317, T4318, T4319, T4320, T4321, T4322, T4323, T4324, T4325, T4326, T4327, T4328, T4329, T4330, T4331, T4332, T4333, T4334, T4335, T4336, T4337, T4338, T4339, T4340, T4341, T4342, T4343, T4344, T4345, T4346, T4347, T4348, T4349, T4350, T4351, T4352, T4353, T4354, T4355, T4356, T4357, T4358, T4359, T4360, T4361, T4362, T4363, T4364, T4365, T4366, T4367, T4368, T4369, T4370, T4371, T4372, T4373, T4374, T4375, T4376, T4377, T4378, T4379, T4380, T4381, T4382, T4383, T4384, T4385, T4386, T4387, T4388, T4389, T4390, T4391, T4392, T4393, T4394, T4395, T4396, T4397, T4398, T4399, T4400, T4401, T4402, T4403, T4404, T4405, T4406, T4407, T4408, T4409, T4410, T4411, T4412, T4413, T4414, T4415, T4416, T4417, T4418, T4419, T4420, T4421, T4422, T4423, T4424, T4425, T4426, T4427, T4428, T4429, T4430, T4431, T4432, T4433, T4434, T4435, T4436, T4437, T4438, T4439, T4440, T4441, T4442, T4443, T4444, T4445, T4446, T4447, T4448, T4449, T4450, T4451, T4452, T4453, T4454, T4455, T4456, T4457, T4458, T4459, T4460, T4461, T4462, T4463, T4464, T4465, T4466, T4467, T4468, T4469, T4470, T4471, T4472, T4473, T4474, T4475, T4476, T4477, T4478, T4479, T4480, T4481, T4482, T4483, T4484, T4485, T4486, T4487, T4488, T4489, T4490, T4491, T4492, T4493, T4494, T4495, T4496, T4497, T4498, T4499, T4500, T4501, T4502, T4503, T4504, T4505, T4506, T4507, T4508, T4509, T4510, T4511, T4512, T4513, T4514, T4515, T4516, T4517, T4518, T4519, T4520, T4521, T4522, T4523, T4524, T4525, T4526, T4527, T4528, T4529, T4530, T4531, T4532, T4533, T4534, T4535, T4536, T4537, T4538, T4539, T4540, T4541, T4542, T4543, T4544, T4545, T4546, T4547, T4548, T4549, T4550, T4551, T4552, T4553, T4554, T4555, T4556, T4557, T4558, T4559, T4560, T4561, T4562, T4563, T4564, T4565, T4566, T4567, T4568, T4569, T4570, T4571, T4572, T4573, T4574, T4575, T4576, T4577, T4578, T4579, T4580, T4581, T4582, T4583, T4584, T4585, T4586, T4587, T4588, T4589, T4590, T4591, T4592, T4593, T4594, T4595, T4596, T4597, T4598, T4599, T4600, T4601, T4602, T4603, T4604, T4605, T4606, T4607, T4608, T4609, T4610, T4611, T4612, T4613, T4614, T4615, T4616, T4617, T4618, T4619, T4620, T4621, T4622, T4623, T4624, T4625, T4626, T4627, T4628, T4629, T4630, T4631, T4632, T4633, T4634, T4635, T4636, T4637, T4638, T4639, T4640, T4641, T4642, T4643, T4644, T4645, T4646, T4647, T4648, T4649, T4650, T4651, T4652, T4653, T4654, T4655, T4656, T4657, T4658, T4659, T4660, T4661, T4662, T4663, T4664, T4665, T4666, T4667, T4668, T4669, T4670, T4671, T4672, T4673, T4674, T4675, T4676, T4677, T4678, T4679, T4680, T4681, T4682, T4683, T4684, T4685, T4686, T4687, T4688, T4689, T4690, T4691, T4692, T4693, T4694, T4695, T4696, T4697, T4698, T4699, T4700, T4701, T4702, T4703, T4704, T4705, T4706, T4707, T4708, T4709, T4710, T4711, T4712, T4713, T4714, T4715, T4716, T4717, T4718, T4719, T4720, T4721, T4722, T4723, T4724, T4725, T4726, T4727, T4728, T4729, T4730, T4731, T4732, T4733, T4734, T4735, T4736, T4737, T4738, T4739, T4740, T4741, T4742, T4743, T4744, T4745, T4746, T4747, T4748, T4749, T4750, T4751, T4752, T4753, T4754, T4755, T4756, T4757, T4758, T4759, T4760, T4761, T4762, T4763, T4764, T4765, T4766, T4767, T4768, T4769, T4770, T4771, T4772, T4773, T4774, T4775, T4776, T4777, T4778, T4779, T4780, T4781, T4782, T4783, T4784, T4785, T4786, T4787, T4788, T4789, T4790, T4791, T4792, T4793, T4794, T4795, T4796, T4797, T4798, T4799, T4800, T4801, T4802, T4803, T4804, T4805, T4806, T4807, T4808, T4809, T4810, T4811, T4812, T4813, T4814, T4815, T4816, T4817, T4818, T4819, T4820, T4821, T4822, T4823, T4824, T4825, T4826, T4827, T4828, T4829, T4830, T4831, T4832, T4833, T4834, T4835, T4836, T4837, T4838, T4839, T4840, T4841, T4842, T4843, T4844, T4845, T4846, T4847, T4848, T4849, T4850, T4851, T4852, T4853, T4854, T4855, T4856, T4857, T4858, T4859, T4860, T4861, T4862, T4863, T4864, T4865, T4866, T4867, T4868, T4869, T4870, T4871, T4872, T4873, T4874, T4875, T4876, T4877, T4878, T4879, T4880, T4881, T4882, T4883, T4884, T4885, T4886, T4887, T4888, T4889, T4890, T4891, T4892, T4893, T4894, T4895, T4896, T4897, T4898, T4899, T4900, T4901, T4902, T4903, T4904, T4905, T4906, T4907, T4908, T4909, T4910, T4911, T4912, T4913, T4914, T4915, T4916, T4917, T4918, T4919, T4920, T4921, T4922, T4923, T4924, T4925, T4926, T4927, T4928, T4929, T4930, T4931, T4932, T4933, T4934, T4935, T4936, T4937, T4938, T4939, T4940, T4941, T4942, T4943, T4944, T4945, T4946, T4947, T4948, T4949, T4950, T4951, T4952, T4953, T4954, T4955, T4956, T4957, T4958, T4959, T4960, T4961, T4962, T4963, T4964, T4965, T4966, T4967, T4968, T4969, T4970, T4971, T4972, T4973, T4974, T4975, T4976, T4977, T4978, T4979, T4980, T4981, T4982, T4983, T4984, T4985, T4986, T4987, T4988, T4989, T4990, T4991, T4992, T4993, T4994, T4995, T4996, T4997, T4998, T4999, T5000, T5001, T5002, T5003, T5004, T5005, T5006, T5007, T5008, T5009, T5010, T5011, T5012, T5013, T5014, T5015, T5016, T5017, T5018, T5019, T5020, T5021, T5022, T5023, T5024, T5025, T5026, T5027, T5028, T5029, T5030, T5031, T5032, T5033, T5034, T5035, T5036, T5037, T5038, T5039, T5040, T5041, T5042, T5043, T5044, T5045, T5046, T5047, T5048, T5049, T5050, T5051, T5052, T5053, T5054, T5055, T5056, T5057, T5058, T5059, T5060, T5061, T5062, T5063, T5064, T5065, T5066, T5067, T5068, T5069, T5070, T5071, T5072, T5073, T5074, T5075, T5076, T5077, T5078, T5079, T5080, T5081, T5082, T5083, T5084, T5085, T5086, T5087, T5088, T5089, T5090, T5091, T5092, T5093, T5094, T5095, T5096, T5097, T5098, T5099, T5100, T5101, T5102, T5103, T5104, T5105, T5106, T5107, T5108, T5109, T5110, T5111, T5112, T5113, T5114, T5115, T5116, T5117, T5118, T5119, T5120, T5121, T5122, T5123, T5124, T5125, T5126, T5127, T5128, T5129, T5130, T5131, T5132, T5133, T5134, T5135, T5136, T5137, T5138, T5139, T5140, T5141, T5142, T5143, T5144, T5145, T5146, T5147, T5148, T5149, T5150, T5151, T5152, T5153, T5154, T5155, T5156, T5157, T5158, T5159, T5160, T5161, T5162, T5163, T5164, T5165, T5166, T5167, T5168, T5169, T5170, T5171, T5172, T5173, T5174, T5175, T5176, T5177, T5178, T5179, T5180, T5181, T5182, T5183, T5184, T5185, T5186, T5187, T5188, T5189, T5190, T5191, T5192, T5193, T5194, T5195, T5196, T5197, T5198, T5199, T5200, T5201, T5202, T5203, T5204, T5205, T5206, T5207, T5208, T5209, T5210, T5211, T5212, T5213, T5214, T5215, T5216, T5217, T5218, T5219, T5220, T5221, T5222, T5223, T5224, T5225, T5226, T5227, T5228, T5229, T5230, T5231, T5232, T5233, T5234, T5235, T5236, T5237, T5238, T5239, T5240, T5241, T5242, T5243, T5244, T5245, T5246, T5247, T5248, T5249, T5250, T5251, T5252, T5253, T5254, T5255, T5256, T5257, T5258, T5259, T5260, T5261, T5262, T5263, T5264, T5265, T5266, T5267, T5268, T5269, T5270, T5271, T5272, T5273, T5274, T5275, T5276, T5277, T5278, T5279, T5280, T5281, T5282, T5283, T5284, T5285, T5286, T5287, T5288, T5289, T5290, T5291, T5292, T5293, T5294, T5295, T5296, T5297, T5298, T5299, T5300, T5301, T5302, T5303, T5304, T5305, T5306, T5307, T5308, T5309, T5310, T5311, T5312, T5313, T5314, T5315, T5316, T5317, T5318, T5319, T5320, T5321, T5322, T5323, T5324, T5325, T5326, T5327, T5328, T5329, T5330, T5331, T5332, T5333, T5334, T5335, T5336, T5337, T5338, T5339, T5340, T5341, T5342, T5343, T5344, T5345, T5346, T5347, T5348, T5349, T5350, T5351, T5352, T5353, T5354, T5355, T5356, T5357, T5358, T5359, T5360, T5361, T5362, T5363, T5364, T5365, T5366, T5367, T5368, T5369, T5370, T5371, T5372, T5373, T5374, T5375, T5376, T5377, T5378, T5379, T5380, T5381, T5382, T5383, T5384, T5385, T5386, T5387, T5388, T5389, T5390, T5391, T5392, T5393, T5394, T5395, T5396, T5397, T5398, T5399, T5400, T5401, T5402, T5403, T5404, T5405, T5406, T5407, T5408, T5409, T5410, T5411, T5412, T5413, T5414, T5415, T5416, T5417, T5418, T5419, T5420, T5421, T5422, T5423, T5424, T5425, T5426, T5427, T5428, T5429, T5430, T5431, T5432, T5433, T5434, T5435, T5436, T5437, T5438, T5439, T5440, T5441, T5442, T5443, T5444, T5445, T5446, T5447, T5448, T5449, T5450, T5451, T5452, T5453, T5454, T5455, T5456, T5457, T5458, T5459, T5460, T5461, T5462, T5463, T5464, T5465, T5466, T5467, T5468, T5469, T5470, T5471, T5472, T5473, T5474, T5475, T5476, T5477, T5478, T5479, T5480, T5481, T5482, T5483, T5484, T5485, T5486, T5487, T5488, T5489, T5490, T5491, T5492, T5493, T5494, T5495, T5496, T5497, T5498, T5499, T5500, T5501, T5502, T5503, T5504, T5505, T5506, T5507, T5508, T5509, T5510, T5511, T5512, T5513, T5514, T5515, T5516, T5517, T5518, T5519, T5520, T5521, T5522, T5523, T5524, T5525, T5526, T5527, T5528, T5529, T5530, T5531, T5532, T5533, T5534, T5535, T5536, T5537, T5538, T5539, T5540, T5541, T5542, T5543, T5544, T5545, T5546, T5547, T5548, T5549, T5550, T5551, T5552, T5553, T5554, T5555, T5556, T5557, T5558, T5559, T5560, T5561, T5562, T5563, T5564, T5565, T5566, T5567, T5568, T5569, T5570, T5571, T5572, T5573, T5574, T5575, T5576, T5577, T5578, T5579, T5580, T5581, T5582, T5583, T5584, T5585, T5586, T5587, T5588, T5589, T5590, T5591, T5592, T5593, T5594, T5595, T5596, T5597, T5598, T5599, T5600, T5601, T5602, T5603, T5604, T5605, T5606, T5607, T5608, T5609, T5610, T5611, T5612, T5613, T5614, T5615, T5616, T5617, T5618, T5619, T5620, T5621, T5622, T5623, T5624, T5625, T5626, T5627, T5628, T5629, T5630, T5631, T5632, T5633, T5634, T5635, T5636, T5637, T5638, T5639, T5640, T5641, T5642, T5643, T5644, T5645, T5646, T5647, T5648, T5649, T5650, T5651, T5652, T5653, T5654, T5655, T5656, T5657, T5658, T5659, T5660, T5661, T5662, T5663, T5664, T5665, T5666, T5667, T5668, T5669, T5670, T5671, T5672, T5673, T5674, T5675, T5676, T5677, T5678, T5679, T5680, T5681, T5682, T5683, T5684, T5685, T5686, T5687, T5688, T5689, T5690, T5691, T5692, T5693, T5694, T5695, T5696, T5697, T5698, T5699, T5700, T5701, T5702, T5703, T5704, T5705, T5706, T5707, T5708, T5709, T5710, T5711, T5712, T5713, T5714, T5715, T5716, T5717, T5718, T5719, T5720, T5721, T5722, T5723, T5724, T5725, T5726, T5727, T5728, T5729, T5730, T5731, T5732, T5733, T5734, T5735, T5736, T5737, T5738, T5739, T5740, T5741, T5742, T5743, T5744, T5745, T5746, T5747, T5748, T5749, T5750, T5751, T5752, T5753, T5754, T5755, T5756, T5757, T5758, T5759, T5760, T5761, T5762, T5763, T5764, T5765, T5766, T5767, T5768, T5769, T5770, T5771, T5772, T5773, T5774, T5775, T5776, T5777, T5778, T5779, T5780, T5781, T5782, T5783, T5784, T5785, T5786, T5787, T5788, T5789, T5790, T5791, T5792, T5793, T5794, T5795, T5796, T5797, T5798, T5799, T5800, T5801, T5802, T5803, T5804, T5805, T5806, T5807, T5808, T5809, T5810, T5811, T5812, T5813, T5814, T5815, T5816, T5817, T5818, T5819, T5820, T5821, T5822, T5823, T5824, T5825, T5826, T5827, T5828, T5829, T5830, T5831, T5832, T5833, T5834, T5835, T5836, T5837, T5838, T5839, T5840, T5841, T5842, T5843, T5844, T5845, T5846, T5847, T5848, T5849, T5850, T5851, T5852, T5853, T5854, T5855, T5856, T5857, T5858, T5859, T5860, T5861, T5862, T5863, T5864, T5865, T5866, T5867, T5868, T5869, T5870, T5871, T5872, T5873, T5874, T5875, T5876, T5877, T5878, T5879, T5880, T5881, T5882, T5883, T5884, T5885, T5886, T5887, T5888, T5889, T5890, T5891, T5892, T5893, T5894, T5895, T5896, T5897, T5898, T5899, T5900, T5901, T5902, T5903, T5904, T5905, T5906, T5907, T5908, T5909, T5910, T5911, T5912, T5913, T5914, T5915, T5916, T5917, T5918, T5919, T5920, T5921, T5922, T5923, T5924, T5925, T5926, T5927, T5928, T5929, T5930, T5931, T5932, T5933, T5934, T5935, T5936, T5937, T5938, T5939, T5940, T5941, T5942, T5943, T5944, T5945, T5946, T5947, T5948, T5949, T5950, T5951, T5952, T5953, T5954, T5955, T5956, T5957, T5958, T5959, T5960, T5961, T5962, T5963, T5964, T5965, T5966, T5967, T5968, T5969, T5970, T5971, T5972, T5973, T5974, T5975, T5976, T5977, T5978, T5979, T5980, T5981, T5982, T5983, T5984, T5985, T5986, T5987, T5988, T5989, T5990, T5991, T5992, T5993, T5994, T5995, T5996, T5997, T5998, T5999, T6000, T6001, T6002, T6003, T6004, T6005, T6006, T6007, T6008, T6009, T6010, T6011, T6012, T6013, T6014, T6015, T6016, T6017, T6018, T6019, T6020, T6021, T6022, T6023, T6024, T6025, T6026, T6027, T6028, T6029, T6030, T6031, T6032, T6033, T6034, T6035, T6036, T6037, T6038, T6039, T6040, T6041, T6042, T6043, T6044, T6045, T6046, T6047, T6048, T6049, T6050, T6051, T6052, T6053, T6054, T6055, T6056, T6057, T6058, T6059, T6060, T6061, T6062, T6063, T6064, T6065, T6066, T6067, T6068, T6069, T6070, T6071, T6072, T6073, T6074, T6075, T6076, T6077, T6078, T6079, T6080, T6081, T6082, T6083, T6084, T6085, T6086, T6087, T6088, T6089, T6090, T6091, T6092, T6093, T6094, T6095, T6096, T6097, T6098, T6099, T6100, T6101, T6102, T6103, T6104, T6105, T6106, T6107, T6108, T6109, T6110, T6111, T6112, T6113, T6114, T6115, T6116, T6117, T6118, T6119, T6120, T6121, T6122, T6123, T6124, T6125, T6126, T6127, T6128, T6129, T6130, T6131, T6132, T6133, T6134, T6135, T6136, T6137, T6138, T6139, T6140, T6141, T6142, T6143, T6144, T6145, T6146, T6147, T6148, T6149, T6150, T6151, T6152, T6153, T6154, T6155, T6156, T6157, T6158, T6159, T6160, T6161, T6162, T6163, T6164, T6165, T6166, T6167, T6168, T6169, T6170, T6171, T6172, T6173, T6174, T6175, T6176, T6177, T6178, T6179, T6180, T6181, T6182, T6183, T6184, T6185, T6186, T6187, T6188, T6189, T6190, T6191, T6192, T6193, T6194, T6195, T6196, T6197, T6198, T6199, T6200, T6201, T6202, T6203, T6204, T6205, T6206, T6207, T6208, T6209, T6210, T6211, T6212, T6213, T6214, T6215, T6216, T6217, T6218, T6219, T6220, T6221, T6222, T6223, T6224, T6225, T6226, T6227, T6228, T6229, T6230, T6231, T6232, T6233, T6234, T6235, T6236, T6237, T6238, T6239, T6240, T6241, T6242, T6243, T6244, T6245, T6246, T6247, T6248, T6249, T6250, T6251, T6252, T6253, T6254, T6255, T6256, T6257, T6258, T6259, T6260, T6261, T6262, T6263, T6264, T6265, T6266, T6267, T6268, T6269, T6270, T6271, T6272, T6273, T6274, T6275, T6276, T6277, T6278, T6279, T6280, T6281, T6282, T6283, T6284, T6285, T6286, T6287, T6288, T6289, T6290, T6291, T6292, T6293, T6294, T6295, T6296, T6297, T6298, T6299, T6300, T6301, T6302, T6303, T6304, T6305, T6306, T6307, T6308, T6309, T6310, T6311, T6312, T6313, T6314, T6315, T6316, T6317, T6318, T6319, T6320, T6321, T6322, T6323, T6324, T6325, T6326, T6327, T6328, T6329, T6330, T6331, T6332, T6333, T6334, T6335, T6336, T6337, T6338, T6339, T6340, T6341, T6342, T6343, T6344, T6345, T6346, T6347, T6348, T6349, T6350, T6351, T6352, T6353, T6354, T6355, T6356, T6357, T6358, T6359, T6360, T6361, T6362, T6363, T6364, T6365, T6366, T6367, T6368, T6369, T6370, T6371, T6372, T6373, T6374, T6375, T6376, T6377, T6378, T6379, T6380, T6381, T6382, T6383, T6384, T6385, T6386, T6387, T6388, T6389, T6390, T6391, T6392, T6393, T6394, T6395, T6396, T6397, T6398, T6399, T6400, T6401, T6402, T6403, T6404, T6405, T6406, T6407, T6408, T6409, T6410, T6411, T6412, T6413, T6414, T6415, T6416, T6417, T6418, T6419, T6420, T6421, T6422, T6423, T6424, T6425, T6426, T6427, T6428, T6429, T6430, T6431, T6432, T6433, T6434, T6435, T6436, T6437, T6438, T6439, T6440, T6441, T6442, T6443, T6444, T6445, T6446, T6447, T6448, T6449, T6450, T6451, T6452, T6453, T6454, T6455, T6456, T6457, T6458, T6459, T6460, T6461, T6462, T6463, T6464, T6465, T6466, T6467, T6468, T6469, T6470, T6471, T6472, T6473, T6474, T6475, T6476, T6477, T6478, T6479, T6480, T6481, T6482, T6483, T6484, T6485, T6486, T6487, T6488, T6489, T6490, T6491, T6492, T6493, T6494, T6495, T6496, T6497, T6498, T6499, T6500, T6501, T6502, T6503, T6504, T6505, T6506, T6507, T6508, T6509, T6510, T6511, T6512, T6513, T6514, T6515, T6516, T6517, T6518, T6519, T6520, T6521, T6522, T6523, T6524, T6525, T6526, T6527, T6528, T6529, T6530, T6531, T6532, T6533, T6534, T6535, T6536, T6537, T6538, T6539, T6540, T6541, T6542, T6543, T6544, T6545, T6546, T6547, T6548, T6549, T6550, T6551, T6552, T6553, T6554, T6555, T6556, T6557, T6558, T6559, T6560, T6561, T6562, T6563, T6564, T6565, T6566, T6567, T6568, T6569, T6570, T6571, T6572, T6573, T6574, T6575, T6576, T6577, T6578, T6579, T6580, T6581, T6582, T6583, T6584, T6585, T6586, T6587, T6588, T6589, T6590, T6591, T6592, T6593, T6594, T6595, T6596, T6597, T6598, T6599, T6600, T6601, T6602, T6603, T6604, T6605, T6606, T6607, T6608, T6609, T6610, T6611, T6612, T6613, T6614, T6615, T6616, T6617, T6618, T6619, T6620, T6621, T6622, T6623, T6624, T6625, T6626, T6627, T6628, T6629, T6630, T6631, T6632, T6633, T6634, T6635, T6636, T6637, T6638, T6639, T6640, T6641, T6642, T6643, T6644, T6645, T6646, T6647, T6648, T6649, T6650, T6651, T6652, T6653, T6654, T6655, T6656, T6657, T6658, T6659, T6660, T6661, T6662, T6663, T6664, T6665, T6666, T6667, T6668, T6669, T6670, T6671, T6672, T6673, T6674, T6675, T6676, T6677, T6678, T6679, T6680, T6681, T6682, T6683, T6684, T6685, T6686, T6687, T6688, T6689, T6690, T6691, T6692, T6693, T6694, T6695, T6696, T6697, T6698, T6699, T6700, T6701, T6702, T6703, T6704, T6705, T6706, T6707, T6708, T6709, T6710, T6711, T6712, T6713, T6714, T6715, T6716, T6717, T6718, T6719, T6720, T6721, T6722, T6723, T6724, T6725, T6726, T6727, T6728, T6729, T6730, T6731, T6732, T6733, T6734, T6735, T6736, T6737, T6738, T6739, T6740, T6741, T6742, T6743, T6744, T6745, T6746, T6747, T6748, T6749, T6750, T6751, T6752, T6753, T6754, T6755, T6756, T6757, T6758, T6759, T6760, T6761, T6762, T6763, T6764, T6765, T6766, T6767, T6768, T6769, T6770, T6771, T6772, T6773, T6774, T6775, T6776, T6777, T6778, T6779, T6780, T6781, T6782, T6783, T6784, T6785, T6786, T6787, T6788, T6789, T6790, T6791, T6792, T6793, T6794, T6795, T6796, T6797, T6798, T6799, T6800, T6801, T6802, T6803, T6804, T6805, T6806, T6807, T6808, T6809, T6810, T6811, T6812, T6813, T6814, T6815, T6816, T6817, T6818, T6819, T6820, T6821, T6822, T6823, T6824, T6825, T6826, T6827, T6828, T6829, T6830, T6831, T6832, T6833, T6834, T6835, T6836, T6837, T6838, T6839, T6840, T6841, T6842, T6843, T6844, T6845, T6846, T6847, T6848, T6849, T6850, T6851, T6852, T6853, T6854, T6855, T6856, T6857, T6858, T6859, T6860, T6861, T6862, T6863, T6864, T6865, T6866, T6867, T6868, T6869, T6870, T6871, T6872, T6873, T6874, T6875, T6876, T6877, T6878, T6879, T6880, T6881, T6882, T6883, T6884, T6885, T6886, T6887, T6888, T6889, T6890, T6891, T6892, T6893, T6894, T6895, T6896, T6897, T6898, T6899, T6900, T6901, T6902, T6903, T6904, T6905, T6906, T6907, T6908, T6909, T6910, T6911, T6912, T6913, T6914, T6915, T6916, T6917, T6918, T6919, T6920, T6921, T6922, T6923, T6924, T6925, T6926, T6927, T6928, T6929, T6930, T6931, T6932, T6933, T6934, T6935, T6936, T6937, T6938, T6939, T6940, T6941, T6942, T6943, T6944, T6945, T6946, T6947, T6948, T6949, T6950, T6951, T6952, T6953, T6954, T6955, T6956, T6957, T6958, T6959, T6960, T6961, T6962, T6963, T6964, T6965, T6966, T6967, T6968, T6969, T6970, T6971, T6972, T6973, T6974, T6975, T6976, T6977, T6978, T6979, T6980, T6981, T6982, T6983, T6984, T6985, T6986, T6987, T6988, T6989, T6990, T6991, T6992, T6993, T6994, T6995, T6996, T6997, T6998, T6999, T7000, T7001, T7002, T7003, T7004, T7005, T7006, T7007, T7008, T7009, T7010, T7011, T7012, T7013, T7014, T7015, T7016, T7017, T7018, T7019, T7020, T7021, T7022, T7023, T7024, T7025, T7026, T7027, T7028, T7029, T7030, T7031, T7032, T7033, T7034, T7035, T7036, T7037, T7038, T7039, T7040, T7041, T7042, T7043, T7044, T7045, T7046, T7047, T7048, T7049, T7050, T7051, T7052, T7053, T7054, T7055, T7056, T7057, T7058, T7059, T7060, T7061, T7062, T7063, T7064, T7065, T7066, T7067, T7068, T7069, T7070, T7071, T7072, T7073, T7074, T7075, T7076, T7077, T7078, T7079, T7080, T7081, T7082, T7083, T7084, T7085, T7086, T7087, T7088, T7089, T7090, T7091, T7092, T7093, T7094, T7095, T7096, T7097, T7098, T7099, T7100, T7101, T7102, T7103, T7104, T7105, T7106, T7107, T7108, T7109, T7110, T7111, T7112, T7113, T7114, T7115, T7116, T7117, T7118, T7119, T7120, T7121, T7122, T7123, T7124, T7125, T7126, T7127, T7128, T7129, T7130, T7131, T7132, T7133, T7134, T7135, T7136, T7137, T7138, T7139, T7140, T7141, T7142, T7143, T7144, T7145, T7146, T7147, T7148, T7149, T7150, T7151, T7152, T7153, T7154, T7155, T7156, T7157, T7158, T7159, T7160, T7161, T7162, T7163, T7164, T7165, T7166, T7167, T7168, T7169, T7170, T7171, T7172, T7173, T7174, T7175, T7176, T7177, T7178, T7179, T7180, T7181, T7182, T7183, T7184, T7185, T7186, T7187, T7188, T7189, T7190, T7191, T7192, T7193, T7194, T7195, T7196, T7197, T7198, T7199, T7200, T7201, T7202, T7203, T7204, T7205, T7206, T7207, T7208, T7209, T7210, T7211, T7212, T7213, T7214, T7215, T7216, T7217, T7218, T7219, T7220, T7221, T7222, T7223, T7224, T7225, T7226, T7227, T7228, T7229, T7230, T7231, T7232, T7233, T7234, T7235, T7236, T7237, T7238, T7239, T7240, T7241, T7242, T7243, T7244, T7245, T7246, T7247, T7248, T7249, T7250, T7251, T7252, T7253, T7254, T7255, T7256, T7257, T7258, T7259, T7260, T7261, T7262, T7263, T7264, T7265, T7266, T7267, T7268, T7269, T7270, T7271, T7272, T7273, T7274, T7275, T7276, T7277, T7278, T7279, T7280, T7281, T7282, T7283, T7284, T7285, T7286, T7287, T7288, T7289, T7290, T7291, T7292, T7293, T7294, T7295, T7296, T7297, T7298, T7299, T7300, T7301, T7302, T7303, T7304, T7305, T7306, T7307, T7308, T7309, T7310, T7311, T7312, T7313, T7314, T7315, T7316, T7317, T7318, T7319, T7320, T7321, T7322, T7323, T7324, T7325, T7326, T7327, T7328, T7329, T7330, T7331, T7332, T7333, T7334, T7335, T7336, T7337, T7338, T7339, T7340, T7341, T7342, T7343, T7344, T7345, T7346, T7347, T7348, T7349, T7350, T7351, T7352, T7353, T7354, T7355, T7356, T7357, T7358, T7359, T7360, T7361, T7362, T7363, T7364, T7365, T7366, T7367, T7368, T7369, T7370, T7371, T7372, T7373, T7374, T7375, T7376, T7377, T7378, T7379, T7380, T7381, T7382, T7383, T7384, T7385, T7386, T7387, T7388, T7389, T7390, T7391, T7392, T7393, T7394, T7395, T7396, T7397, T7398, T7399, T7400, T7401, T7402, T7403, T7404, T7405, T7406, T7407, T7408, T7409, T7410, T7411, T7412, T7413, T7414, T7415, T7416, T7417, T7418, T7419, T7420, T7421, T7422, T7423, T7424, T7425, T7426, T7427, T7428, T7429, T7430, T7431, T7432, T7433, T7434, T7435, T7436, T7437, T7438, T7439, T7440, T7441, T7442, T7443, T7444, T7445, T7446, T7447, T7448, T7449, T7450, T7451, T7452, T7453, T7454, T7455, T7456, T7457, T7458, T7459, T7460, T7461, T7462, T7463, T7464, T7465, T7466, T7467, T7468, T7469, T7470, T7471, T7472, T7473, T7474, T7475, T7476, T7477, T7478, T7479, T7480, T7481, T7482, T7483, T7484, T7485, T7486, T7487, T7488, T7489, T7490, T7491, T7492, T7493, T7494, T7495, T7496, T7497, T7498, T7499, T7500, T7501, T7502, T7503, T7504, T7505, T7506, T7507, T7508, T7509, T7510, T7511, T7512, T7513, T7514, T7515, T7516, T7517, T7518, T7519, T7520, T7521, T7522, T7523, T7524, T7525, T7526, T7527, T7528, T7529, T7530, T7531, T7532, T7533, T7534, T7535, T7536, T7537, T7538, T7539, T7540, T7541, T7542, T7543, T7544, T7545, T7546, T7547, T7548, T7549, T7550, T7551, T7552, T7553, T7554, T7555, T7556, T7557, T7558, T7559, T7560, T7561, T7562, T7563, T7564, T7565, T7566, T7567, T7568, T7569, T7570, T7571, T7572, T7573, T7574, T7575, T7576, T7577, T7578, T7579, T7580, T7581, T7582, T7583, T7584, T7585, T7586, T7587, T7588, T7589, T7590, T7591, T7592, T7593, T7594, T7595, T7596, T7597, T7598, T7599, T7600, T7601, T7602, T7603, T7604, T7605, T7606, T7607, T7608, T7609, T7610, T7611, T7612, T7613, T7614, T7615, T7616, T7617, T7618, T7619, T7620, T7621, T7622, T7623, T7624, T7625, T7626, T7627, T7628, T7629, T7630, T7631, T7632, T7633, T7634, T7635, T7636, T7637, T7638, T7639, T7640, T7641, T7642, T7643, T7644, T7645, T7646, T7647, T7648, T7649, T7650, T7651, T7652, T7653, T7654, T7655, T7656, T7657, T7658, T7659, T7660, T7661, T7662, T7663, T7664, T7665, T7666, T7667, T7668, T7669, T7670, T7671, T7672, T7673, T7674, T7675, T7676, T7677, T7678, T7679, T7680, T7681, T7682, T7683, T7684, T7685, T7686, T7687, T7688, T7689, T7690, T7691, T7692, T7693, T7694, T7695, T7696, T7697, T7698, T7699, T7700, T7701, T7702, T7703, T7704, T7705, T7706, T7707, T7708, T7709, T7710, T7711, T7712, T7713, T7714, T7715, T7716, T7717, T7718, T7719, T7720, T7721, T7722, T7723, T7724, T7725, T7726, T7727, T7728, T7729, T7730, T7731, T7732, T7733, T7734, T7735, T7736, T7737, T7738, T7739, T7740, T7741, T7742, T7743, T7744, T7745, T7746, T7747, T7748, T7749, T7750, T7751, T7752, T7753, T7754, T7755, T7756, T7757, T7758, T7759, T7760, T7761, T7762, T7763, T7764, T7765, T7766, T7767, T7768, T7769, T7770, T7771, T7772, T7773, T7774, T7775, T7776, T7777, T7778, T7779, T7780, T7781, T7782, T7783, T7784, T7785, T7786, T7787, T7788, T7789, T7790, T7791, T7792, T7793, T7794, T7795, T7796, T7797, T7798, T7799, T7800, T7801, T7802, T7803, T7804, T7805, T7806, T7807, T7808, T7809, T7810, T7811, T7812, T7813, T7814, T7815, T7816, T7817, T7818, T7819, T7820, T7821, T7822, T7823, T7824, T7825, T7826, T7827, T7828, T7829, T7830, T7831, T7832, T7833, T7834, T7835, T7836, T7837, T7838, T7839, T7840, T7841, T7842, T7843, T7844, T7845, T7846, T7847, T7848, T7849, T7850, T7851, T7852, T7853, T7854, T7855, T7856, T7857, T7858, T7859, T7860, T7861, T7862, T7863, T7864, T7865, T7866, T7867, T7868, T7869, T7870, T7871, T7872, T7873, T7874, T7875, T7876, T7877, T7878, T7879, T7880, T7881, T7882, T7883, T7884, T7885, T7886, T7887, T7888, T7889, T7890, T7891, T7892, T7893, T7894, T7895, T7896, T7897, T7898, T7899, T7900, T7901, T7902, T7903, T7904, T7905, T7906, T7907, T7908, T7909, T7910, T7911, T7912, T7913, T7914, T7915, T7916, T7917, T7918, T7919, T7920, T7921, T7922, T7923, T7924, T7925, T7926, T7927, T7928, T7929, T7930, T7931, T7932, T7933, T7934, T7935, T7936, T7937, T7938, T7939, T7940, T7941, T7942, T7943, T7944, T7945, T7946, T7947, T7948, T7949, T7950, T7951, T7952, T7953, T7954, T7955, T7956, T7957, T7958, T7959, T7960, T7961, T7962, T7963, T7964, T7965, T7966, T7967, T7968, T7969, T7970, T7971, T7972, T7973, T7974, T7975, T7976, T7977, T7978, T7979, T7980, T7981, T7982, T7983, T7984, T7985, T7986, T7987, T7988, T7989, T7990, T7991, T7992, T7993, T7994, T7995, T7996, T7997, T7998, T7999, T8000, T8001, T8002, T8003, T8004, T8005, T8006, T8007, T8008, T8009, T8010, T8011, T8012, T8013, T8014, T8015, T8016, T8017, T8018, T8019, T8020, T8021, T8022, T8023, T8024, T8025, T8026, T8027, T8028, T8029, T8030, T8031, T8032, T8033, T8034, T8035, T8036, T8037, T8038, T8039, T8040, T8041, T8042, T8043, T8044, T8045, T8046, T8047, T8048, T8049, T8050, T8051, T8052, T8053, T8054, T8055, T8056, T8057, T8058, T8059, T8060, T8061, T8062, T8063, T8064, T8065, T8066, T8067, T8068, T8069, T8070, T8071, T8072, T8073, T8074, T8075, T8076, T8077, T8078, T8079, T8080, T8081, T8082, T8083, T8084, T8085, T8086, T8087, T8088, T8089, T8090, T8091, T8092, T8093, T8094, T8095, T8096, T8097, T8098, T8099, T8100, T8101, T8102, T8103, T8104, T8105, T8106, T8107, T8108, T8109, T8110, T8111, T8112, T8113, T8114, T8115, T8116, T8117, T8118, T8119, T8120, T8121, T8122, T8123, T8124, T8125, T8126, T8127, T8128, T8129, T8130, T8131, T8132, T8133, T8134, T8135, T8136, T8137, T8138, T8139, T8140, T8141, T8142, T8143, T8144, T8145, T8146, T8147, T8148, T8149, T8150, T8151, T8152, T8153, T8154, T8155, T8156, T8157, T8158, T8159, T8160, T8161, T8162, T8163, T8164, T8165, T8166, T8167, T8168, T8169, T8170, T8171, T8172, T8173, T8174, T8175, T8176, T8177, T8178, T8179, T8180, T8181, T8182, T8183, T8184, T8185, T8186, T8187, T8188, T8189, T8190, T8191, T8192, T8193, T8194, T8195, T8196, T8197, T8198, T8199, T8200, T8201, T8202, T8203, T8204, T8205, T8206, T8207, T8208, T8209, T8210, T8211, T8212, T8213, T8214, T8215, T8216, T8217, T8218, T8219, T8220, T8221, T8222, T8223, T8224, T8225, T8226, T8227, T8228, T8229, T8230, T8231, T8232, T8233, T8234, T8235, T8236, T8237, T8238, T8239, T8240, T8241, T8242, T8243, T8244, T8245, T8246, T8247, T8248, T8249, T8250, T8251, T8252, T8253, T8254, T8255, T8256, T8257, T8258, T8259, T8260, T8261, T8262, T8263, T8264, T8265, T8266, T8267, T8268, T8269, T8270, T8271, T8272, T8273, T8274, T8275, T8276, T8277, T8278, T8279, T8280, T8281, T8282, T8283, T8284, T8285, T8286, T8287, T8288, T8289, T8290, T8291, T8292, T8293, T8294, T8295, T8296, T8297, T8298, T8299, T8300, T8301, T8302, T8303, T8304, T8305, T8306, T8307, T8308, T8309, T8310, T8311, T8312, T8313, T8314, T8315, T8316, T8317, T8318, T8319, T8320, T8321, T8322, T8323, T8324, T8325, T8326, T8327, T8328, T8329, T8330, T8331, T8332, T8333, T8334, T8335, T8336, T8337, T8338, T8339, T8340, T8341, T8342, T8343, T8344, T8345, T8346, T8347, T8348, T8349, T8350, T8351, T8352, T8353, T8354, T8355, T8356, T8357, T8358, T8359, T8360, T8361, T8362, T8363, T8364, T8365, T8366, T8367, T8368, T8369, T8370, T8371, T8372, T8373, T8374, T8375, T8376, T8377, T8378, T8379, T8380, T8381, T8382, T8383, T8384, T8385, T8386, T8387, T8388, T8389, T8390, T8391, T8392, T8393, T8394, T8395, T8396, T8397, T8398, T8399, T8400, T8401, T8402, T8403, T8404, T8405, T8406, T8407, T8408, T8409, T8410, T8411, T8412, T8413, T8414, T8415, T8416, T8417, T8418, T8419, T8420, T8421, T8422, T8423, T8424, T8425, T8426, T8427, T8428, T8429, T8430, T8431, T8432, T8433, T8434, T8435, T8436, T8437, T8438, T8439, T8440, T8441, T8442, T8443, T8444, T8445, T8446, T8447, T8448, T8449, T8450, T8451, T8452, T8453, T8454, T8455, T8456, T8457, T8458, T8459, T8460, T8461, T8462, T8463, T8464, T8465, T8466, T8467, T8468, T8469, T8470, T8471, T8472, T8473, T8474, T8475, T8476, T8477, T8478, T8479, T8480, T8481, T8482, T8483, T8484, T8485, T8486, T8487, T8488, T8489, T8490, T8491, T8492, T8493, T8494, T8495, T8496, T8497, T8498, T8499, T8500, T8501, T8502, T8503, T8504, T8505, T8506, T8507, T8508, T8509, T8510, T8511, T8512, T8513, T8514, T8515, T8516, T8517, T8518, T8519, T8520, T8521, T8522, T8523, T8524, T8525, T8526, T8527, T8528, T8529, T8530, T8531, T8532, T8533, T8534, T8535, T8536, T8537, T8538, T8539, T8540, T8541, T8542, T8543, T8544, T8545, T8546, T8547, T8548, T8549, T8550, T8551, T8552, T8553, T8554, T8555, T8556, T8557, T8558, T8559, T8560, T8561, T8562, T8563, T8564, T8565, T8566, T8567, T8568, T8569, T8570, T8571, T8572, T8573, T8574, T8575, T8576, T8577, T8578, T8579, T8580, T8581, T8582, T8583, T8584, T8585, T8586, T8587, T8588, T8589, T8590, T8591, T8592, T8593, T8594, T8595, T8596, T8597, T8598, T8599, T8600, T8601, T8602, T8603, T8604, T8605, T8606, T8607, T8608, T8609, T8610, T8611, T8612, T8613, T8614, T8615, T8616, T8617, T8618, T8619, T8620, T8621, T8622, T8623, T8624, T8625, T8626, T8627, T8628, T8629, T8630, T8631, T8632, T8633, T8634, T8635, T8636, T8637, T8638, T8639, T8640, T8641, T8642, T8643, T8644, T8645, T8646, T8647, T8648, T8649, T8650, T8651, T8652, T8653, T8654, T8655, T8656, T8657, T8658, T8659, T8660, T8661, T8662, T8663, T8664, T8665, T8666, T8667, T8668, T8669, T8670, T8671, T8672, T8673, T8674, T8675, T8676, T8677, T8678, T8679, T8680, T8681, T8682, T8683, T8684, T8685, T8686, T8687, T8688, T8689, T8690, T8691, T8692, T8693, T8694, T8695, T8696, T8697, T8698, T8699, T8700, T8701, T8702, T8703, T8704, T8705, T8706, T8707, T8708, T8709, T8710, T8711, T8712, T8713, T8714, T8715, T8716, T8717, T8718, T8719, T8720, T8721, T8722, T8723, T8724, T8725, T8726, T8727, T8728, T8729, T8730, T8731, T8732, T8733, T8734, T8735, T8736, T8737, T8738, T8739, T8740, T8741, T8742, T8743, T8744, T8745, T8746, T8747, T8748, T8749, T8750, T8751, T8752, T8753, T8754, T8755, T8756, T8757, T8758, T8759, T8760, T8761, T8762, T8763, T8764, T8765, T8766, T8767, T8768, T8769, T8770, T8771, T8772, T8773, T8774, T8775, T8776, T8777, T8778, T8779, T8780, T8781, T8782, T8783, T8784, T8785, T8786, T8787, T8788, T8789, T8790, T8791, T8792, T8793, T8794, T8795, T8796, T8797, T8798, T8799, T8800, T8801, T8802, T8803, T8804, T8805, T8806, T8807, T8808, T8809, T8810, T8811, T8812, T8813, T8814, T8815, T8816, T8817, T8818, T8819, T8820, T8821, T8822, T8823, T8824, T8825, T8826, T8827, T8828, T8829, T8830, T8831, T8832, T8833, T8834, T8835, T8836, T8837, T8838, T8839, T8840, T8841, T8842, T8843, T8844, T8845, T8846, T8847, T8848, T8849, T8850, T8851, T8852, T8853, T8854, T8855, T8856, T8857, T8858, T8859, T8860, T8861, T8862, T8863, T8864, T8865, T8866, T8867, T8868, T8869, T8870, T8871, T8872, T8873, T8874, T8875, T8876, T8877, T8878, T8879, T8880, T8881, T8882, T8883, T8884, T8885, T8886, T8887, T8888, T8889, T8890, T8891, T8892, T8893, T8894, T8895, T8896, T8897, T8898, T8899, T8900, T8901, T8902, T8903, T8904, T8905, T8906, T8907, T8908, T8909, T8910, T8911, T8912, T8913, T8914, T8915, T8916, T8917, T8918, T8919, T8920, T8921, T8922, T8923, T8924, T8925, T8926, T8927, T8928, T8929, T8930, T8931, T8932, T8933, T8934, T8935, T8936, T8937, T8938, T8939, T8940, T8941, T8942, T8943, T8944, T8945, T8946, T8947, T8948, T8949, T8950, T8951, T8952, T8953, T8954, T8955, T8956, T8957, T8958, T8959, T8960, T8961, T8962, T8963, T8964, T8965, T8966, T8967, T8968, T8969, T8970, T8971, T8972, T8973, T8974, T8975, T8976, T8977, T8978, T8979, T8980, T8981, T8982, T8983, T8984, T8985, T8986, T8987, T8988, T8989, T8990, T8991, T8992, T8993, T8994, T8995, T8996, T8997, T8998, T8999, T9000, T9001, T9002, T9003, T9004, T9005, T9006, T9007, T9008, T9009, T9010, T9011, T9012, T9013, T9014, T9015, T9016, T9017, T9018, T9019, T9020, T9021, T9022, T9023, T9024, T9025, T9026, T9027, T9028, T9029, T9030, T9031, T9032, T9033, T9034, T9035, T9036, T9037, T9038, T9039, T9040, T9041, T9042, T9043, T9044, T9045, T9046, T9047, T9048, T9049, T9050, T9051, T9052, T9053, T9054, T9055, T9056, T9057, T9058, T9059, T9060, T9061, T9062, T9063, T9064, T9065, T9066, T9067, T9068, T9069, T9070, T9071, T9072, T9073, T9074, T9075, T9076, T9077, T9078, T9079, T9080, T9081, T9082, T9083, T9084, T9085, T9086, T9087, T9088, T9089, T9090, T9091, T9092, T9093, T9094, T9095, T9096, T9097, T9098, T9099, T9100, T9101, T9102, T9103, T9104, T9105, T9106, T9107, T9108, T9109, T9110, T9111, T9112, T9113, T9114, T9115, T9116, T9117, T9118, T9119, T9120, T9121, T9122, T9123, T9124, T9125, T9126, T9127, T9128, T9129, T9130, T9131, T9132, T9133, T9134, T9135, T9136, T9137, T9138, T9139, T9140, T9141, T9142, T9143, T9144, T9145, T9146, T9147, T9148, T9149, T9150, T9151, T9152, T9153, T9154, T9155, T9156, T9157, T9158, T9159, T9160, T9161, T9162, T9163, T9164, T9165, T9166, T9167, T9168, T9169, T9170, T9171, T9172, T9173, T9174, T9175, T9176, T9177, T9178, T9179, T9180, T9181, T9182, T9183, T9184, T9185, T9186, T9187, T9188, T9189, T9190, T9191, T9192, T9193, T9194, T9195, T9196, T9197, T9198, T9199, T9200, T9201, T9202, T9203, T9204, T9205, T9206, T9207, T9208, T9209, T9210, T9211, T9212, T9213, T9214, T9215, T9216, T9217, T9218, T9219, T9220, T9221, T9222, T9223, T9224, T9225, T9226, T9227, T9228, T9229, T9230, T9231, T9232, T9233, T9234, T9235, T9236, T9237, T9238, T9239, T9240, T9241, T9242, T9243, T9244, T9245, T9246, T9247, T9248, T9249, T9250, T9251, T9252, T9253, T9254, T9255, T9256, T9257, T9258, T9259, T9260, T9261, T9262, T9263, T9264, T9265, T9266, T9267, T9268, T9269, T9270, T9271, T9272, T9273, T9274, T9275, T9276, T9277, T9278, T9279, T9280, T9281, T9282, T9283, T9284, T9285, T9286, T9287, T9288, T9289, T9290, T9291, T9292, T9293, T9294, T9295, T9296, T9297, T9298, T9299, T9300, T9301, T9302, T9303, T9304, T9305, T9306, T9307, T9308, T9309, T9310, T9311, T9312, T9313, T9314, T9315, T9316, T9317, T9318, T9319, T9320, T9321, T9322, T9323, T9324, T9325, T9326, T9327, T9328, T9329, T9330, T9331, T9332, T9333, T9334, T9335, T9336, T9337, T9338, T9339, T9340, T9341, T9342, T9343, T9344, T9345, T9346, T9347, T9348, T9349, T9350, T9351, T9352, T9353, T9354, T9355, T9356, T9357, T9358, T9359, T9360, T9361, T9362, T9363, T9364, T9365, T9366, T9367, T9368, T9369, T9370, T9371, T9372, T9373, T9374, T9375, T9376, T9377, T9378, T9379, T9380, T9381, T9382, T9383, T9384, T9385, T9386, T9387, T9388, T9389, T9390, T9391, T9392, T9393, T9394, T9395, T9396, T9397, T9398, T9399, T9400, T9401, T9402, T9403, T9404, T9405, T9406, T9407, T9408, T9409, T9410, T9411, T9412, T9413, T9414, T9415, T9416, T9417, T9418, T9419, T9420, T9421, T9422, T9423, T9424, T9425, T9426, T9427, T9428, T9429, T9430, T9431, T9432, T9433, T9434, T9435, T9436, T9437, T9438, T9439, T9440, T9441, T9442, T9443, T9444, T9445, T9446, T9447, T9448, T9449, T9450, T9451, T9452, T9453, T9454, T9455, T9456, T9457, T9458, T9459, T9460, T9461, T9462, T9463, T9464, T9465, T9466, T9467, T9468, T9469, T9470, T9471, T9472, T9473, T9474, T9475, T9476, T9477, T9478, T9479, T9480, T9481, T9482, T9483, T9484, T9485, T9486, T9487, T9488, T9489, T9490, T9491, T9492, T9493, T9494, T9495, T9496, T9497, T9498, T9499, T9500, T9501, T9502, T9503, T9504, T9505, T9506, T9507, T9508, T9509, T9510, T9511, T9512, T9513, T9514, T9515, T9516, T9517, T9518, T9519, T9520, T9521, T9522, T9523, T9524, T9525, T9526, T9527, T9528, T9529, T9530, T9531, T9532, T9533, T9534, T9535, T9536, T9537, T9538, T9539, T9540, T9541, T9542, T9543, T9544, T9545, T9546, T9547, T9548, T9549, T9550, T9551, T9552, T9553, T9554, T9555, T9556, T9557, T9558, T9559, T9560, T9561, T9562, T9563, T9564, T9565, T9566, T9567, T9568, T9569, T9570, T9571, T9572, T9573, T9574, T9575, T9576, T9577, T9578, T9579, T9580, T9581, T9582, T9583, T9584, T9585, T9586, T9587, T9588, T9589, T9590, T9591, T9592, T9593, T9594, T9595, T9596, T9597, T9598, T9599, T9600, T9601, T9602, T9603, T9604, T9605, T9606, T9607, T9608, T9609, T9610, T9611, T9612, T9613, T9614, T9615, T9616, T9617, T9618, T9619, T9620, T9621, T9622, T9623, T9624, T9625, T9626, T9627, T9628, T9629, T9630, T9631, T9632, T9633, T9634, T9635, T9636, T9637, T9638, T9639, T9640, T9641, T9642, T9643, T9644, T9645, T9646, T9647, T9648, T9649, T9650, T9651, T9652, T9653, T9654, T9655, T9656, T9657, T9658, T9659, T9660, T9661, T9662, T9663, T9664, T9665, T9666, T9667, T9668, T9669, T9670, T9671, T9672, T9673, T9674, T9675, T9676, T9677, T9678, T9679, T9680, T9681, T9682, T9683, T9684, T9685, T9686, T9687, T9688, T9689, T9690, T9691, T9692, T9693, T9694, T9695, T9696, T9697, T9698, T9699, T9700, T9701, T9702, T9703, T9704, T9705, T9706, T9707, T9708, T9709, T9710, T9711, T9712, T9713, T9714, T9715, T9716, T9717, T9718, T9719, T9720, T9721, T9722, T9723, T9724, T9725, T9726, T9727, T9728, T9729, T9730, T9731, T9732, T9733, T9734, T9735, T9736, T9737, T9738, T9739, T9740, T9741, T9742, T9743, T9744, T9745, T9746, T9747, T9748, T9749, T9750, T9751, T9752, T9753, T9754, T9755, T9756, T9757, T9758, T9759, T9760, T9761, T9762, T9763, T9764, T9765, T9766, T9767, T9768, T9769, T9770, T9771, T9772, T9773, T9774, T9775, T9776, T9777, T9778, T9779, T9780, T9781, T9782, T9783, T9784, T9785, T9786, T9787, T9788, T9789, T9790, T9791, T9792, T9793, T9794, T9795, T9796, T9797, T9798, T9799, T9800, T9801, T9802, T9803, T9804, T9805, T9806, T9807, T9808, T9809, T9810, T9811, T9812, T9813, T9814, T9815, T9816, T9817, T9818, T9819, T9820, T9821, T9822, T9823, T9824, T9825, T9826, T9827, T9828, T9829, T9830, T9831, T9832, T9833, T9834, T9835, T9836, T9837, T9838, T9839, T9840, T9841, T9842, T9843, T9844, T9845, T9846, T9847, T9848, T9849, T9850, T9851, T9852, T9853, T9854, T9855, T9856, T9857, T9858, T9859, T9860, T9861, T9862, T9863, T9864, T9865, T9866, T9867, T9868, T9869, T9870, T9871, T9872, T9873, T9874, T9875, T9876, T9877, T9878, T9879, T9880, T9881, T9882, T9883, T9884, T9885, T9886, T9887, T9888, T9889, T9890, T9891, T9892, T9893, T9894, T9895, T9896, T9897, T9898, T9899, T9900, T9901, T9902, T9903, T9904, T9905, T9906, T9907, T9908, T9909, T9910, T9911, T9912, T9913, T9914, T9915, T9916, T9917, T9918, T9919, T9920, T9921, T9922, T9923, T9924, T9925, T9926, T9927, T9928, T9929, T9930, T9931, T9932, T9933, T9934, T9935, T9936, T9937, T9938, T9939, T9940, T9941, T9942, T9943, T9944, T9945, T9946, T9947, T9948, T9949, T9950, T9951, T9952, T9953, T9954, T9955, T9956, T9957, T9958, T9959, T9960, T9961, T9962, T9963, T9964, T9965, T9966, T9967, T9968, T9969, T9970, T9971, T9972, T9973, T9974, T9975, T9976, T9977, T9978, T9979, T9980, T9981, T9982, T9983, T9984, T9985, T9986, T9987, T9988, T9989, T9990, T9991, T9992, T9993, T9994, T9995, T9996, T9997, T9998, T9999>{ public void method1<M0, M1, M2, M3, M4, M5, M6, M7, M8, M9, M10, M11, M12, M13, M14, M15, M16, M17, M18, M19, M20, M21, M22, M23, M24, M25, M26, M27, M28, M29, M30, M31, M32, M33, M34, M35, M36, M37, M38, M39, M40, M41, M42, M43, M44, M45, M46, M47, M48, M49, M50, M51, M52, M53, M54, M55, M56, M57, M58, M59, M60, M61, M62, M63, M64, M65, M66, M67, M68, M69, M70, M71, M72, M73, M74, M75, M76, M77, M78, M79, M80, M81, M82, M83, M84, M85, M86, M87, M88, M89, M90, M91, M92, M93, M94, M95, M96, M97, M98, M99, M100, M101, M102, M103, M104, M105, M106, M107, M108, M109, M110, M111, M112, M113, M114, M115, M116, M117, M118, M119, M120, M121, M122, M123, M124, M125, M126, M127, M128, M129, M130, M131, M132, M133, M134, M135, M136, M137, M138, M139, M140, M141, M142, M143, M144, M145, M146, M147, M148, M149, M150, M151, M152, M153, M154, M155, M156, M157, M158, M159, M160, M161, M162, M163, M164, M165, M166, M167, M168, M169, M170, M171, M172, M173, M174, M175, M176, M177, M178, M179, M180, M181, M182, M183, M184, M185, M186, M187, M188, M189, M190, M191, M192, M193, M194, M195, M196, M197, M198, M199, M200, M201, M202, M203, M204, M205, M206, M207, M208, M209, M210, M211, M212, M213, M214, M215, M216, M217, M218, M219, M220, M221, M222, M223, M224, M225, M226, M227, M228, M229, M230, M231, M232, M233, M234, M235, M236, M237, M238, M239, M240, M241, M242, M243, M244, M245, M246, M247, M248, M249, M250, M251, M252, M253, M254, M255, M256, M257, M258, M259, M260, M261, M262, M263, M264, M265, M266, M267, M268, M269, M270, M271, M272, M273, M274, M275, M276, M277, M278, M279, M280, M281, M282, M283, M284, M285, M286, M287, M288, M289, M290, M291, M292, M293, M294, M295, M296, M297, M298, M299, M300, M301, M302, M303, M304, M305, M306, M307, M308, M309, M310, M311, M312, M313, M314, M315, M316, M317, M318, M319, M320, M321, M322, M323, M324, M325, M326, M327, M328, M329, M330, M331, M332, M333, M334, M335, M336, M337, M338, M339, M340, M341, M342, M343, M344, M345, M346, M347, M348, M349, M350, M351, M352, M353, M354, M355, M356, M357, M358, M359, M360, M361, M362, M363, M364, M365, M366, M367, M368, M369, M370, M371, M372, M373, M374, M375, M376, M377, M378, M379, M380, M381, M382, M383, M384, M385, M386, M387, M388, M389, M390, M391, M392, M393, M394, M395, M396, M397, M398, M399, M400, M401, M402, M403, M404, M405, M406, M407, M408, M409, M410, M411, M412, M413, M414, M415, M416, M417, M418, M419, M420, M421, M422, M423, M424, M425, M426, M427, M428, M429, M430, M431, M432, M433, M434, M435, M436, M437, M438, M439, M440, M441, M442, M443, M444, M445, M446, M447, M448, M449, M450, M451, M452, M453, M454, M455, M456, M457, M458, M459, M460, M461, M462, M463, M464, M465, M466, M467, M468, M469, M470, M471, M472, M473, M474, M475, M476, M477, M478, M479, M480, M481, M482, M483, M484, M485, M486, M487, M488, M489, M490, M491, M492, M493, M494, M495, M496, M497, M498, M499, M500, M501, M502, M503, M504, M505, M506, M507, M508, M509, M510, M511, M512, M513, M514, M515, M516, M517, M518, M519, M520, M521, M522, M523, M524, M525, M526, M527, M528, M529, M530, M531, M532, M533, M534, M535, M536, M537, M538, M539, M540, M541, M542, M543, M544, M545, M546, M547, M548, M549, M550, M551, M552, M553, M554, M555, M556, M557, M558, M559, M560, M561, M562, M563, M564, M565, M566, M567, M568, M569, M570, M571, M572, M573, M574, M575, M576, M577, M578, M579, M580, M581, M582, M583, M584, M585, M586, M587, M588, M589, M590, M591, M592, M593, M594, M595, M596, M597, M598, M599, M600, M601, M602, M603, M604, M605, M606, M607, M608, M609, M610, M611, M612, M613, M614, M615, M616, M617, M618, M619, M620, M621, M622, M623, M624, M625, M626, M627, M628, M629, M630, M631, M632, M633, M634, M635, M636, M637, M638, M639, M640, M641, M642, M643, M644, M645, M646, M647, M648, M649, M650, M651, M652, M653, M654, M655, M656, M657, M658, M659, M660, M661, M662, M663, M664, M665, M666, M667, M668, M669, M670, M671, M672, M673, M674, M675, M676, M677, M678, M679, M680, M681, M682, M683, M684, M685, M686, M687, M688, M689, M690, M691, M692, M693, M694, M695, M696, M697, M698, M699, M700, M701, M702, M703, M704, M705, M706, M707, M708, M709, M710, M711, M712, M713, M714, M715, M716, M717, M718, M719, M720, M721, M722, M723, M724, M725, M726, M727, M728, M729, M730, M731, M732, M733, M734, M735, M736, M737, M738, M739, M740, M741, M742, M743, M744, M745, M746, M747, M748, M749, M750, M751, M752, M753, M754, M755, M756, M757, M758, M759, M760, M761, M762, M763, M764, M765, M766, M767, M768, M769, M770, M771, M772, M773, M774, M775, M776, M777, M778, M779, M780, M781, M782, M783, M784, M785, M786, M787, M788, M789, M790, M791, M792, M793, M794, M795, M796, M797, M798, M799, M800, M801, M802, M803, M804, M805, M806, M807, M808, M809, M810, M811, M812, M813, M814, M815, M816, M817, M818, M819, M820, M821, M822, M823, M824, M825, M826, M827, M828, M829, M830, M831, M832, M833, M834, M835, M836, M837, M838, M839, M840, M841, M842, M843, M844, M845, M846, M847, M848, M849, M850, M851, M852, M853, M854, M855, M856, M857, M858, M859, M860, M861, M862, M863, M864, M865, M866, M867, M868, M869, M870, M871, M872, M873, M874, M875, M876, M877, M878, M879, M880, M881, M882, M883, M884, M885, M886, M887, M888, M889, M890, M891, M892, M893, M894, M895, M896, M897, M898, M899, M900, M901, M902, M903, M904, M905, M906, M907, M908, M909, M910, M911, M912, M913, M914, M915, M916, M917, M918, M919, M920, M921, M922, M923, M924, M925, M926, M927, M928, M929, M930, M931, M932, M933, M934, M935, M936, M937, M938, M939, M940, M941, M942, M943, M944, M945, M946, M947, M948, M949, M950, M951, M952, M953, M954, M955, M956, M957, M958, M959, M960, M961, M962, M963, M964, M965, M966, M967, M968, M969, M970, M971, M972, M973, M974, M975, M976, M977, M978, M979, M980, M981, M982, M983, M984, M985, M986, M987, M988, M989, M990, M991, M992, M993, M994, M995, M996, M997, M998, M999, M1000, M1001, M1002, M1003, M1004, M1005, M1006, M1007, M1008, M1009, M1010, M1011, M1012, M1013, M1014, M1015, M1016, M1017, M1018, M1019, M1020, M1021, M1022, M1023, M1024, M1025, M1026, M1027, M1028, M1029, M1030, M1031, M1032, M1033, M1034, M1035, M1036, M1037, M1038, M1039, M1040, M1041, M1042, M1043, M1044, M1045, M1046, M1047, M1048, M1049, M1050, M1051, M1052, M1053, M1054, M1055, M1056, M1057, M1058, M1059, M1060, M1061, M1062, M1063, M1064, M1065, M1066, M1067, M1068, M1069, M1070, M1071, M1072, M1073, M1074, M1075, M1076, M1077, M1078, M1079, M1080, M1081, M1082, M1083, M1084, M1085, M1086, M1087, M1088, M1089, M1090, M1091, M1092, M1093, M1094, M1095, M1096, M1097, M1098, M1099, M1100, M1101, M1102, M1103, M1104, M1105, M1106, M1107, M1108, M1109, M1110, M1111, M1112, M1113, M1114, M1115, M1116, M1117, M1118, M1119, M1120, M1121, M1122, M1123, M1124, M1125, M1126, M1127, M1128, M1129, M1130, M1131, M1132, M1133, M1134, M1135, M1136, M1137, M1138, M1139, M1140, M1141, M1142, M1143, M1144, M1145, M1146, M1147, M1148, M1149, M1150, M1151, M1152, M1153, M1154, M1155, M1156, M1157, M1158, M1159, M1160, M1161, M1162, M1163, M1164, M1165, M1166, M1167, M1168, M1169, M1170, M1171, M1172, M1173, M1174, M1175, M1176, M1177, M1178, M1179, M1180, M1181, M1182, M1183, M1184, M1185, M1186, M1187, M1188, M1189, M1190, M1191, M1192, M1193, M1194, M1195, M1196, M1197, M1198, M1199, M1200, M1201, M1202, M1203, M1204, M1205, M1206, M1207, M1208, M1209, M1210, M1211, M1212, M1213, M1214, M1215, M1216, M1217, M1218, M1219, M1220, M1221, M1222, M1223, M1224, M1225, M1226, M1227, M1228, M1229, M1230, M1231, M1232, M1233, M1234, M1235, M1236, M1237, M1238, M1239, M1240, M1241, M1242, M1243, M1244, M1245, M1246, M1247, M1248, M1249, M1250, M1251, M1252, M1253, M1254, M1255, M1256, M1257, M1258, M1259, M1260, M1261, M1262, M1263, M1264, M1265, M1266, M1267, M1268, M1269, M1270, M1271, M1272, M1273, M1274, M1275, M1276, M1277, M1278, M1279, M1280, M1281, M1282, M1283, M1284, M1285, M1286, M1287, M1288, M1289, M1290, M1291, M1292, M1293, M1294, M1295, M1296, M1297, M1298, M1299, M1300, M1301, M1302, M1303, M1304, M1305, M1306, M1307, M1308, M1309, M1310, M1311, M1312, M1313, M1314, M1315, M1316, M1317, M1318, M1319, M1320, M1321, M1322, M1323, M1324, M1325, M1326, M1327, M1328, M1329, M1330, M1331, M1332, M1333, M1334, M1335, M1336, M1337, M1338, M1339, M1340, M1341, M1342, M1343, M1344, M1345, M1346, M1347, M1348, M1349, M1350, M1351, M1352, M1353, M1354, M1355, M1356, M1357, M1358, M1359, M1360, M1361, M1362, M1363, M1364, M1365, M1366, M1367, M1368, M1369, M1370, M1371, M1372, M1373, M1374, M1375, M1376, M1377, M1378, M1379, M1380, M1381, M1382, M1383, M1384, M1385, M1386, M1387, M1388, M1389, M1390, M1391, M1392, M1393, M1394, M1395, M1396, M1397, M1398, M1399, M1400, M1401, M1402, M1403, M1404, M1405, M1406, M1407, M1408, M1409, M1410, M1411, M1412, M1413, M1414, M1415, M1416, M1417, M1418, M1419, M1420, M1421, M1422, M1423, M1424, M1425, M1426, M1427, M1428, M1429, M1430, M1431, M1432, M1433, M1434, M1435, M1436, M1437, M1438, M1439, M1440, M1441, M1442, M1443, M1444, M1445, M1446, M1447, M1448, M1449, M1450, M1451, M1452, M1453, M1454, M1455, M1456, M1457, M1458, M1459, M1460, M1461, M1462, M1463, M1464, M1465, M1466, M1467, M1468, M1469, M1470, M1471, M1472, M1473, M1474, M1475, M1476, M1477, M1478, M1479, M1480, M1481, M1482, M1483, M1484, M1485, M1486, M1487, M1488, M1489, M1490, M1491, M1492, M1493, M1494, M1495, M1496, M1497, M1498, M1499, M1500, M1501, M1502, M1503, M1504, M1505, M1506, M1507, M1508, M1509, M1510, M1511, M1512, M1513, M1514, M1515, M1516, M1517, M1518, M1519, M1520, M1521, M1522, M1523, M1524, M1525, M1526, M1527, M1528, M1529, M1530, M1531, M1532, M1533, M1534, M1535, M1536, M1537, M1538, M1539, M1540, M1541, M1542, M1543, M1544, M1545, M1546, M1547, M1548, M1549, M1550, M1551, M1552, M1553, M1554, M1555, M1556, M1557, M1558, M1559, M1560, M1561, M1562, M1563, M1564, M1565, M1566, M1567, M1568, M1569, M1570, M1571, M1572, M1573, M1574, M1575, M1576, M1577, M1578, M1579, M1580, M1581, M1582, M1583, M1584, M1585, M1586, M1587, M1588, M1589, M1590, M1591, M1592, M1593, M1594, M1595, M1596, M1597, M1598, M1599, M1600, M1601, M1602, M1603, M1604, M1605, M1606, M1607, M1608, M1609, M1610, M1611, M1612, M1613, M1614, M1615, M1616, M1617, M1618, M1619, M1620, M1621, M1622, M1623, M1624, M1625, M1626, M1627, M1628, M1629, M1630, M1631, M1632, M1633, M1634, M1635, M1636, M1637, M1638, M1639, M1640, M1641, M1642, M1643, M1644, M1645, M1646, M1647, M1648, M1649, M1650, M1651, M1652, M1653, M1654, M1655, M1656, M1657, M1658, M1659, M1660, M1661, M1662, M1663, M1664, M1665, M1666, M1667, M1668, M1669, M1670, M1671, M1672, M1673, M1674, M1675, M1676, M1677, M1678, M1679, M1680, M1681, M1682, M1683, M1684, M1685, M1686, M1687, M1688, M1689, M1690, M1691, M1692, M1693, M1694, M1695, M1696, M1697, M1698, M1699, M1700, M1701, M1702, M1703, M1704, M1705, M1706, M1707, M1708, M1709, M1710, M1711, M1712, M1713, M1714, M1715, M1716, M1717, M1718, M1719, M1720, M1721, M1722, M1723, M1724, M1725, M1726, M1727, M1728, M1729, M1730, M1731, M1732, M1733, M1734, M1735, M1736, M1737, M1738, M1739, M1740, M1741, M1742, M1743, M1744, M1745, M1746, M1747, M1748, M1749, M1750, M1751, M1752, M1753, M1754, M1755, M1756, M1757, M1758, M1759, M1760, M1761, M1762, M1763, M1764, M1765, M1766, M1767, M1768, M1769, M1770, M1771, M1772, M1773, M1774, M1775, M1776, M1777, M1778, M1779, M1780, M1781, M1782, M1783, M1784, M1785, M1786, M1787, M1788, M1789, M1790, M1791, M1792, M1793, M1794, M1795, M1796, M1797, M1798, M1799, M1800, M1801, M1802, M1803, M1804, M1805, M1806, M1807, M1808, M1809, M1810, M1811, M1812, M1813, M1814, M1815, M1816, M1817, M1818, M1819, M1820, M1821, M1822, M1823, M1824, M1825, M1826, M1827, M1828, M1829, M1830, M1831, M1832, M1833, M1834, M1835, M1836, M1837, M1838, M1839, M1840, M1841, M1842, M1843, M1844, M1845, M1846, M1847, M1848, M1849, M1850, M1851, M1852, M1853, M1854, M1855, M1856, M1857, M1858, M1859, M1860, M1861, M1862, M1863, M1864, M1865, M1866, M1867, M1868, M1869, M1870, M1871, M1872, M1873, M1874, M1875, M1876, M1877, M1878, M1879, M1880, M1881, M1882, M1883, M1884, M1885, M1886, M1887, M1888, M1889, M1890, M1891, M1892, M1893, M1894, M1895, M1896, M1897, M1898, M1899, M1900, M1901, M1902, M1903, M1904, M1905, M1906, M1907, M1908, M1909, M1910, M1911, M1912, M1913, M1914, M1915, M1916, M1917, M1918, M1919, M1920, M1921, M1922, M1923, M1924, M1925, M1926, M1927, M1928, M1929, M1930, M1931, M1932, M1933, M1934, M1935, M1936, M1937, M1938, M1939, M1940, M1941, M1942, M1943, M1944, M1945, M1946, M1947, M1948, M1949, M1950, M1951, M1952, M1953, M1954, M1955, M1956, M1957, M1958, M1959, M1960, M1961, M1962, M1963, M1964, M1965, M1966, M1967, M1968, M1969, M1970, M1971, M1972, M1973, M1974, M1975, M1976, M1977, M1978, M1979, M1980, M1981, M1982, M1983, M1984, M1985, M1986, M1987, M1988, M1989, M1990, M1991, M1992, M1993, M1994, M1995, M1996, M1997, M1998, M1999, M2000, M2001, M2002, M2003, M2004, M2005, M2006, M2007, M2008, M2009, M2010, M2011, M2012, M2013, M2014, M2015, M2016, M2017, M2018, M2019, M2020, M2021, M2022, M2023, M2024, M2025, M2026, M2027, M2028, M2029, M2030, M2031, M2032, M2033, M2034, M2035, M2036, M2037, M2038, M2039, M2040, M2041, M2042, M2043, M2044, M2045, M2046, M2047, M2048, M2049, M2050, M2051, M2052, M2053, M2054, M2055, M2056, M2057, M2058, M2059, M2060, M2061, M2062, M2063, M2064, M2065, M2066, M2067, M2068, M2069, M2070, M2071, M2072, M2073, M2074, M2075, M2076, M2077, M2078, M2079, M2080, M2081, M2082, M2083, M2084, M2085, M2086, M2087, M2088, M2089, M2090, M2091, M2092, M2093, M2094, M2095, M2096, M2097, M2098, M2099, M2100, M2101, M2102, M2103, M2104, M2105, M2106, M2107, M2108, M2109, M2110, M2111, M2112, M2113, M2114, M2115, M2116, M2117, M2118, M2119, M2120, M2121, M2122, M2123, M2124, M2125, M2126, M2127, M2128, M2129, M2130, M2131, M2132, M2133, M2134, M2135, M2136, M2137, M2138, M2139, M2140, M2141, M2142, M2143, M2144, M2145, M2146, M2147, M2148, M2149, M2150, M2151, M2152, M2153, M2154, M2155, M2156, M2157, M2158, M2159, M2160, M2161, M2162, M2163, M2164, M2165, M2166, M2167, M2168, M2169, M2170, M2171, M2172, M2173, M2174, M2175, M2176, M2177, M2178, M2179, M2180, M2181, M2182, M2183, M2184, M2185, M2186, M2187, M2188, M2189, M2190, M2191, M2192, M2193, M2194, M2195, M2196, M2197, M2198, M2199, M2200, M2201, M2202, M2203, M2204, M2205, M2206, M2207, M2208, M2209, M2210, M2211, M2212, M2213, M2214, M2215, M2216, M2217, M2218, M2219, M2220, M2221, M2222, M2223, M2224, M2225, M2226, M2227, M2228, M2229, M2230, M2231, M2232, M2233, M2234, M2235, M2236, M2237, M2238, M2239, M2240, M2241, M2242, M2243, M2244, M2245, M2246, M2247, M2248, M2249, M2250, M2251, M2252, M2253, M2254, M2255, M2256, M2257, M2258, M2259, M2260, M2261, M2262, M2263, M2264, M2265, M2266, M2267, M2268, M2269, M2270, M2271, M2272, M2273, M2274, M2275, M2276, M2277, M2278, M2279, M2280, M2281, M2282, M2283, M2284, M2285, M2286, M2287, M2288, M2289, M2290, M2291, M2292, M2293, M2294, M2295, M2296, M2297, M2298, M2299, M2300, M2301, M2302, M2303, M2304, M2305, M2306, M2307, M2308, M2309, M2310, M2311, M2312, M2313, M2314, M2315, M2316, M2317, M2318, M2319, M2320, M2321, M2322, M2323, M2324, M2325, M2326, M2327, M2328, M2329, M2330, M2331, M2332, M2333, M2334, M2335, M2336, M2337, M2338, M2339, M2340, M2341, M2342, M2343, M2344, M2345, M2346, M2347, M2348, M2349, M2350, M2351, M2352, M2353, M2354, M2355, M2356, M2357, M2358, M2359, M2360, M2361, M2362, M2363, M2364, M2365, M2366, M2367, M2368, M2369, M2370, M2371, M2372, M2373, M2374, M2375, M2376, M2377, M2378, M2379, M2380, M2381, M2382, M2383, M2384, M2385, M2386, M2387, M2388, M2389, M2390, M2391, M2392, M2393, M2394, M2395, M2396, M2397, M2398, M2399, M2400, M2401, M2402, M2403, M2404, M2405, M2406, M2407, M2408, M2409, M2410, M2411, M2412, M2413, M2414, M2415, M2416, M2417, M2418, M2419, M2420, M2421, M2422, M2423, M2424, M2425, M2426, M2427, M2428, M2429, M2430, M2431, M2432, M2433, M2434, M2435, M2436, M2437, M2438, M2439, M2440, M2441, M2442, M2443, M2444, M2445, M2446, M2447, M2448, M2449, M2450, M2451, M2452, M2453, M2454, M2455, M2456, M2457, M2458, M2459, M2460, M2461, M2462, M2463, M2464, M2465, M2466, M2467, M2468, M2469, M2470, M2471, M2472, M2473, M2474, M2475, M2476, M2477, M2478, M2479, M2480, M2481, M2482, M2483, M2484, M2485, M2486, M2487, M2488, M2489, M2490, M2491, M2492, M2493, M2494, M2495, M2496, M2497, M2498, M2499, M2500, M2501, M2502, M2503, M2504, M2505, M2506, M2507, M2508, M2509, M2510, M2511, M2512, M2513, M2514, M2515, M2516, M2517, M2518, M2519, M2520, M2521, M2522, M2523, M2524, M2525, M2526, M2527, M2528, M2529, M2530, M2531, M2532, M2533, M2534, M2535, M2536, M2537, M2538, M2539, M2540, M2541, M2542, M2543, M2544, M2545, M2546, M2547, M2548, M2549, M2550, M2551, M2552, M2553, M2554, M2555, M2556, M2557, M2558, M2559, M2560, M2561, M2562, M2563, M2564, M2565, M2566, M2567, M2568, M2569, M2570, M2571, M2572, M2573, M2574, M2575, M2576, M2577, M2578, M2579, M2580, M2581, M2582, M2583, M2584, M2585, M2586, M2587, M2588, M2589, M2590, M2591, M2592, M2593, M2594, M2595, M2596, M2597, M2598, M2599, M2600, M2601, M2602, M2603, M2604, M2605, M2606, M2607, M2608, M2609, M2610, M2611, M2612, M2613, M2614, M2615, M2616, M2617, M2618, M2619, M2620, M2621, M2622, M2623, M2624, M2625, M2626, M2627, M2628, M2629, M2630, M2631, M2632, M2633, M2634, M2635, M2636, M2637, M2638, M2639, M2640, M2641, M2642, M2643, M2644, M2645, M2646, M2647, M2648, M2649, M2650, M2651, M2652, M2653, M2654, M2655, M2656, M2657, M2658, M2659, M2660, M2661, M2662, M2663, M2664, M2665, M2666, M2667, M2668, M2669, M2670, M2671, M2672, M2673, M2674, M2675, M2676, M2677, M2678, M2679, M2680, M2681, M2682, M2683, M2684, M2685, M2686, M2687, M2688, M2689, M2690, M2691, M2692, M2693, M2694, M2695, M2696, M2697, M2698, M2699, M2700, M2701, M2702, M2703, M2704, M2705, M2706, M2707, M2708, M2709, M2710, M2711, M2712, M2713, M2714, M2715, M2716, M2717, M2718, M2719, M2720, M2721, M2722, M2723, M2724, M2725, M2726, M2727, M2728, M2729, M2730, M2731, M2732, M2733, M2734, M2735, M2736, M2737, M2738, M2739, M2740, M2741, M2742, M2743, M2744, M2745, M2746, M2747, M2748, M2749, M2750, M2751, M2752, M2753, M2754, M2755, M2756, M2757, M2758, M2759, M2760, M2761, M2762, M2763, M2764, M2765, M2766, M2767, M2768, M2769, M2770, M2771, M2772, M2773, M2774, M2775, M2776, M2777, M2778, M2779, M2780, M2781, M2782, M2783, M2784, M2785, M2786, M2787, M2788, M2789, M2790, M2791, M2792, M2793, M2794, M2795, M2796, M2797, M2798, M2799, M2800, M2801, M2802, M2803, M2804, M2805, M2806, M2807, M2808, M2809, M2810, M2811, M2812, M2813, M2814, M2815, M2816, M2817, M2818, M2819, M2820, M2821, M2822, M2823, M2824, M2825, M2826, M2827, M2828, M2829, M2830, M2831, M2832, M2833, M2834, M2835, M2836, M2837, M2838, M2839, M2840, M2841, M2842, M2843, M2844, M2845, M2846, M2847, M2848, M2849, M2850, M2851, M2852, M2853, M2854, M2855, M2856, M2857, M2858, M2859, M2860, M2861, M2862, M2863, M2864, M2865, M2866, M2867, M2868, M2869, M2870, M2871, M2872, M2873, M2874, M2875, M2876, M2877, M2878, M2879, M2880, M2881, M2882, M2883, M2884, M2885, M2886, M2887, M2888, M2889, M2890, M2891, M2892, M2893, M2894, M2895, M2896, M2897, M2898, M2899, M2900, M2901, M2902, M2903, M2904, M2905, M2906, M2907, M2908, M2909, M2910, M2911, M2912, M2913, M2914, M2915, M2916, M2917, M2918, M2919, M2920, M2921, M2922, M2923, M2924, M2925, M2926, M2927, M2928, M2929, M2930, M2931, M2932, M2933, M2934, M2935, M2936, M2937, M2938, M2939, M2940, M2941, M2942, M2943, M2944, M2945, M2946, M2947, M2948, M2949, M2950, M2951, M2952, M2953, M2954, M2955, M2956, M2957, M2958, M2959, M2960, M2961, M2962, M2963, M2964, M2965, M2966, M2967, M2968, M2969, M2970, M2971, M2972, M2973, M2974, M2975, M2976, M2977, M2978, M2979, M2980, M2981, M2982, M2983, M2984, M2985, M2986, M2987, M2988, M2989, M2990, M2991, M2992, M2993, M2994, M2995, M2996, M2997, M2998, M2999, M3000, M3001, M3002, M3003, M3004, M3005, M3006, M3007, M3008, M3009, M3010, M3011, M3012, M3013, M3014, M3015, M3016, M3017, M3018, M3019, M3020, M3021, M3022, M3023, M3024, M3025, M3026, M3027, M3028, M3029, M3030, M3031, M3032, M3033, M3034, M3035, M3036, M3037, M3038, M3039, M3040, M3041, M3042, M3043, M3044, M3045, M3046, M3047, M3048, M3049, M3050, M3051, M3052, M3053, M3054, M3055, M3056, M3057, M3058, M3059, M3060, M3061, M3062, M3063, M3064, M3065, M3066, M3067, M3068, M3069, M3070, M3071, M3072, M3073, M3074, M3075, M3076, M3077, M3078, M3079, M3080, M3081, M3082, M3083, M3084, M3085, M3086, M3087, M3088, M3089, M3090, M3091, M3092, M3093, M3094, M3095, M3096, M3097, M3098, M3099, M3100, M3101, M3102, M3103, M3104, M3105, M3106, M3107, M3108, M3109, M3110, M3111, M3112, M3113, M3114, M3115, M3116, M3117, M3118, M3119, M3120, M3121, M3122, M3123, M3124, M3125, M3126, M3127, M3128, M3129, M3130, M3131, M3132, M3133, M3134, M3135, M3136, M3137, M3138, M3139, M3140, M3141, M3142, M3143, M3144, M3145, M3146, M3147, M3148, M3149, M3150, M3151, M3152, M3153, M3154, M3155, M3156, M3157, M3158, M3159, M3160, M3161, M3162, M3163, M3164, M3165, M3166, M3167, M3168, M3169, M3170, M3171, M3172, M3173, M3174, M3175, M3176, M3177, M3178, M3179, M3180, M3181, M3182, M3183, M3184, M3185, M3186, M3187, M3188, M3189, M3190, M3191, M3192, M3193, M3194, M3195, M3196, M3197, M3198, M3199, M3200, M3201, M3202, M3203, M3204, M3205, M3206, M3207, M3208, M3209, M3210, M3211, M3212, M3213, M3214, M3215, M3216, M3217, M3218, M3219, M3220, M3221, M3222, M3223, M3224, M3225, M3226, M3227, M3228, M3229, M3230, M3231, M3232, M3233, M3234, M3235, M3236, M3237, M3238, M3239, M3240, M3241, M3242, M3243, M3244, M3245, M3246, M3247, M3248, M3249, M3250, M3251, M3252, M3253, M3254, M3255, M3256, M3257, M3258, M3259, M3260, M3261, M3262, M3263, M3264, M3265, M3266, M3267, M3268, M3269, M3270, M3271, M3272, M3273, M3274, M3275, M3276, M3277, M3278, M3279, M3280, M3281, M3282, M3283, M3284, M3285, M3286, M3287, M3288, M3289, M3290, M3291, M3292, M3293, M3294, M3295, M3296, M3297, M3298, M3299, M3300, M3301, M3302, M3303, M3304, M3305, M3306, M3307, M3308, M3309, M3310, M3311, M3312, M3313, M3314, M3315, M3316, M3317, M3318, M3319, M3320, M3321, M3322, M3323, M3324, M3325, M3326, M3327, M3328, M3329, M3330, M3331, M3332, M3333, M3334, M3335, M3336, M3337, M3338, M3339, M3340, M3341, M3342, M3343, M3344, M3345, M3346, M3347, M3348, M3349, M3350, M3351, M3352, M3353, M3354, M3355, M3356, M3357, M3358, M3359, M3360, M3361, M3362, M3363, M3364, M3365, M3366, M3367, M3368, M3369, M3370, M3371, M3372, M3373, M3374, M3375, M3376, M3377, M3378, M3379, M3380, M3381, M3382, M3383, M3384, M3385, M3386, M3387, M3388, M3389, M3390, M3391, M3392, M3393, M3394, M3395, M3396, M3397, M3398, M3399, M3400, M3401, M3402, M3403, M3404, M3405, M3406, M3407, M3408, M3409, M3410, M3411, M3412, M3413, M3414, M3415, M3416, M3417, M3418, M3419, M3420, M3421, M3422, M3423, M3424, M3425, M3426, M3427, M3428, M3429, M3430, M3431, M3432, M3433, M3434, M3435, M3436, M3437, M3438, M3439, M3440, M3441, M3442, M3443, M3444, M3445, M3446, M3447, M3448, M3449, M3450, M3451, M3452, M3453, M3454, M3455, M3456, M3457, M3458, M3459, M3460, M3461, M3462, M3463, M3464, M3465, M3466, M3467, M3468, M3469, M3470, M3471, M3472, M3473, M3474, M3475, M3476, M3477, M3478, M3479, M3480, M3481, M3482, M3483, M3484, M3485, M3486, M3487, M3488, M3489, M3490, M3491, M3492, M3493, M3494, M3495, M3496, M3497, M3498, M3499, M3500, M3501, M3502, M3503, M3504, M3505, M3506, M3507, M3508, M3509, M3510, M3511, M3512, M3513, M3514, M3515, M3516, M3517, M3518, M3519, M3520, M3521, M3522, M3523, M3524, M3525, M3526, M3527, M3528, M3529, M3530, M3531, M3532, M3533, M3534, M3535, M3536, M3537, M3538, M3539, M3540, M3541, M3542, M3543, M3544, M3545, M3546, M3547, M3548, M3549, M3550, M3551, M3552, M3553, M3554, M3555, M3556, M3557, M3558, M3559, M3560, M3561, M3562, M3563, M3564, M3565, M3566, M3567, M3568, M3569, M3570, M3571, M3572, M3573, M3574, M3575, M3576, M3577, M3578, M3579, M3580, M3581, M3582, M3583, M3584, M3585, M3586, M3587, M3588, M3589, M3590, M3591, M3592, M3593, M3594, M3595, M3596, M3597, M3598, M3599, M3600, M3601, M3602, M3603, M3604, M3605, M3606, M3607, M3608, M3609, M3610, M3611, M3612, M3613, M3614, M3615, M3616, M3617, M3618, M3619, M3620, M3621, M3622, M3623, M3624, M3625, M3626, M3627, M3628, M3629, M3630, M3631, M3632, M3633, M3634, M3635, M3636, M3637, M3638, M3639, M3640, M3641, M3642, M3643, M3644, M3645, M3646, M3647, M3648, M3649, M3650, M3651, M3652, M3653, M3654, M3655, M3656, M3657, M3658, M3659, M3660, M3661, M3662, M3663, M3664, M3665, M3666, M3667, M3668, M3669, M3670, M3671, M3672, M3673, M3674, M3675, M3676, M3677, M3678, M3679, M3680, M3681, M3682, M3683, M3684, M3685, M3686, M3687, M3688, M3689, M3690, M3691, M3692, M3693, M3694, M3695, M3696, M3697, M3698, M3699, M3700, M3701, M3702, M3703, M3704, M3705, M3706, M3707, M3708, M3709, M3710, M3711, M3712, M3713, M3714, M3715, M3716, M3717, M3718, M3719, M3720, M3721, M3722, M3723, M3724, M3725, M3726, M3727, M3728, M3729, M3730, M3731, M3732, M3733, M3734, M3735, M3736, M3737, M3738, M3739, M3740, M3741, M3742, M3743, M3744, M3745, M3746, M3747, M3748, M3749, M3750, M3751, M3752, M3753, M3754, M3755, M3756, M3757, M3758, M3759, M3760, M3761, M3762, M3763, M3764, M3765, M3766, M3767, M3768, M3769, M3770, M3771, M3772, M3773, M3774, M3775, M3776, M3777, M3778, M3779, M3780, M3781, M3782, M3783, M3784, M3785, M3786, M3787, M3788, M3789, M3790, M3791, M3792, M3793, M3794, M3795, M3796, M3797, M3798, M3799, M3800, M3801, M3802, M3803, M3804, M3805, M3806, M3807, M3808, M3809, M3810, M3811, M3812, M3813, M3814, M3815, M3816, M3817, M3818, M3819, M3820, M3821, M3822, M3823, M3824, M3825, M3826, M3827, M3828, M3829, M3830, M3831, M3832, M3833, M3834, M3835, M3836, M3837, M3838, M3839, M3840, M3841, M3842, M3843, M3844, M3845, M3846, M3847, M3848, M3849, M3850, M3851, M3852, M3853, M3854, M3855, M3856, M3857, M3858, M3859, M3860, M3861, M3862, M3863, M3864, M3865, M3866, M3867, M3868, M3869, M3870, M3871, M3872, M3873, M3874, M3875, M3876, M3877, M3878, M3879, M3880, M3881, M3882, M3883, M3884, M3885, M3886, M3887, M3888, M3889, M3890, M3891, M3892, M3893, M3894, M3895, M3896, M3897, M3898, M3899, M3900, M3901, M3902, M3903, M3904, M3905, M3906, M3907, M3908, M3909, M3910, M3911, M3912, M3913, M3914, M3915, M3916, M3917, M3918, M3919, M3920, M3921, M3922, M3923, M3924, M3925, M3926, M3927, M3928, M3929, M3930, M3931, M3932, M3933, M3934, M3935, M3936, M3937, M3938, M3939, M3940, M3941, M3942, M3943, M3944, M3945, M3946, M3947, M3948, M3949, M3950, M3951, M3952, M3953, M3954, M3955, M3956, M3957, M3958, M3959, M3960, M3961, M3962, M3963, M3964, M3965, M3966, M3967, M3968, M3969, M3970, M3971, M3972, M3973, M3974, M3975, M3976, M3977, M3978, M3979, M3980, M3981, M3982, M3983, M3984, M3985, M3986, M3987, M3988, M3989, M3990, M3991, M3992, M3993, M3994, M3995, M3996, M3997, M3998, M3999, M4000, M4001, M4002, M4003, M4004, M4005, M4006, M4007, M4008, M4009, M4010, M4011, M4012, M4013, M4014, M4015, M4016, M4017, M4018, M4019, M4020, M4021, M4022, M4023, M4024, M4025, M4026, M4027, M4028, M4029, M4030, M4031, M4032, M4033, M4034, M4035, M4036, M4037, M4038, M4039, M4040, M4041, M4042, M4043, M4044, M4045, M4046, M4047, M4048, M4049, M4050, M4051, M4052, M4053, M4054, M4055, M4056, M4057, M4058, M4059, M4060, M4061, M4062, M4063, M4064, M4065, M4066, M4067, M4068, M4069, M4070, M4071, M4072, M4073, M4074, M4075, M4076, M4077, M4078, M4079, M4080, M4081, M4082, M4083, M4084, M4085, M4086, M4087, M4088, M4089, M4090, M4091, M4092, M4093, M4094, M4095, M4096, M4097, M4098, M4099, M4100, M4101, M4102, M4103, M4104, M4105, M4106, M4107, M4108, M4109, M4110, M4111, M4112, M4113, M4114, M4115, M4116, M4117, M4118, M4119, M4120, M4121, M4122, M4123, M4124, M4125, M4126, M4127, M4128, M4129, M4130, M4131, M4132, M4133, M4134, M4135, M4136, M4137, M4138, M4139, M4140, M4141, M4142, M4143, M4144, M4145, M4146, M4147, M4148, M4149, M4150, M4151, M4152, M4153, M4154, M4155, M4156, M4157, M4158, M4159, M4160, M4161, M4162, M4163, M4164, M4165, M4166, M4167, M4168, M4169, M4170, M4171, M4172, M4173, M4174, M4175, M4176, M4177, M4178, M4179, M4180, M4181, M4182, M4183, M4184, M4185, M4186, M4187, M4188, M4189, M4190, M4191, M4192, M4193, M4194, M4195, M4196, M4197, M4198, M4199, M4200, M4201, M4202, M4203, M4204, M4205, M4206, M4207, M4208, M4209, M4210, M4211, M4212, M4213, M4214, M4215, M4216, M4217, M4218, M4219, M4220, M4221, M4222, M4223, M4224, M4225, M4226, M4227, M4228, M4229, M4230, M4231, M4232, M4233, M4234, M4235, M4236, M4237, M4238, M4239, M4240, M4241, M4242, M4243, M4244, M4245, M4246, M4247, M4248, M4249, M4250, M4251, M4252, M4253, M4254, M4255, M4256, M4257, M4258, M4259, M4260, M4261, M4262, M4263, M4264, M4265, M4266, M4267, M4268, M4269, M4270, M4271, M4272, M4273, M4274, M4275, M4276, M4277, M4278, M4279, M4280, M4281, M4282, M4283, M4284, M4285, M4286, M4287, M4288, M4289, M4290, M4291, M4292, M4293, M4294, M4295, M4296, M4297, M4298, M4299, M4300, M4301, M4302, M4303, M4304, M4305, M4306, M4307, M4308, M4309, M4310, M4311, M4312, M4313, M4314, M4315, M4316, M4317, M4318, M4319, M4320, M4321, M4322, M4323, M4324, M4325, M4326, M4327, M4328, M4329, M4330, M4331, M4332, M4333, M4334, M4335, M4336, M4337, M4338, M4339, M4340, M4341, M4342, M4343, M4344, M4345, M4346, M4347, M4348, M4349, M4350, M4351, M4352, M4353, M4354, M4355, M4356, M4357, M4358, M4359, M4360, M4361, M4362, M4363, M4364, M4365, M4366, M4367, M4368, M4369, M4370, M4371, M4372, M4373, M4374, M4375, M4376, M4377, M4378, M4379, M4380, M4381, M4382, M4383, M4384, M4385, M4386, M4387, M4388, M4389, M4390, M4391, M4392, M4393, M4394, M4395, M4396, M4397, M4398, M4399, M4400, M4401, M4402, M4403, M4404, M4405, M4406, M4407, M4408, M4409, M4410, M4411, M4412, M4413, M4414, M4415, M4416, M4417, M4418, M4419, M4420, M4421, M4422, M4423, M4424, M4425, M4426, M4427, M4428, M4429, M4430, M4431, M4432, M4433, M4434, M4435, M4436, M4437, M4438, M4439, M4440, M4441, M4442, M4443, M4444, M4445, M4446, M4447, M4448, M4449, M4450, M4451, M4452, M4453, M4454, M4455, M4456, M4457, M4458, M4459, M4460, M4461, M4462, M4463, M4464, M4465, M4466, M4467, M4468, M4469, M4470, M4471, M4472, M4473, M4474, M4475, M4476, M4477, M4478, M4479, M4480, M4481, M4482, M4483, M4484, M4485, M4486, M4487, M4488, M4489, M4490, M4491, M4492, M4493, M4494, M4495, M4496, M4497, M4498, M4499, M4500, M4501, M4502, M4503, M4504, M4505, M4506, M4507, M4508, M4509, M4510, M4511, M4512, M4513, M4514, M4515, M4516, M4517, M4518, M4519, M4520, M4521, M4522, M4523, M4524, M4525, M4526, M4527, M4528, M4529, M4530, M4531, M4532, M4533, M4534, M4535, M4536, M4537, M4538, M4539, M4540, M4541, M4542, M4543, M4544, M4545, M4546, M4547, M4548, M4549, M4550, M4551, M4552, M4553, M4554, M4555, M4556, M4557, M4558, M4559, M4560, M4561, M4562, M4563, M4564, M4565, M4566, M4567, M4568, M4569, M4570, M4571, M4572, M4573, M4574, M4575, M4576, M4577, M4578, M4579, M4580, M4581, M4582, M4583, M4584, M4585, M4586, M4587, M4588, M4589, M4590, M4591, M4592, M4593, M4594, M4595, M4596, M4597, M4598, M4599, M4600, M4601, M4602, M4603, M4604, M4605, M4606, M4607, M4608, M4609, M4610, M4611, M4612, M4613, M4614, M4615, M4616, M4617, M4618, M4619, M4620, M4621, M4622, M4623, M4624, M4625, M4626, M4627, M4628, M4629, M4630, M4631, M4632, M4633, M4634, M4635, M4636, M4637, M4638, M4639, M4640, M4641, M4642, M4643, M4644, M4645, M4646, M4647, M4648, M4649, M4650, M4651, M4652, M4653, M4654, M4655, M4656, M4657, M4658, M4659, M4660, M4661, M4662, M4663, M4664, M4665, M4666, M4667, M4668, M4669, M4670, M4671, M4672, M4673, M4674, M4675, M4676, M4677, M4678, M4679, M4680, M4681, M4682, M4683, M4684, M4685, M4686, M4687, M4688, M4689, M4690, M4691, M4692, M4693, M4694, M4695, M4696, M4697, M4698, M4699, M4700, M4701, M4702, M4703, M4704, M4705, M4706, M4707, M4708, M4709, M4710, M4711, M4712, M4713, M4714, M4715, M4716, M4717, M4718, M4719, M4720, M4721, M4722, M4723, M4724, M4725, M4726, M4727, M4728, M4729, M4730, M4731, M4732, M4733, M4734, M4735, M4736, M4737, M4738, M4739, M4740, M4741, M4742, M4743, M4744, M4745, M4746, M4747, M4748, M4749, M4750, M4751, M4752, M4753, M4754, M4755, M4756, M4757, M4758, M4759, M4760, M4761, M4762, M4763, M4764, M4765, M4766, M4767, M4768, M4769, M4770, M4771, M4772, M4773, M4774, M4775, M4776, M4777, M4778, M4779, M4780, M4781, M4782, M4783, M4784, M4785, M4786, M4787, M4788, M4789, M4790, M4791, M4792, M4793, M4794, M4795, M4796, M4797, M4798, M4799, M4800, M4801, M4802, M4803, M4804, M4805, M4806, M4807, M4808, M4809, M4810, M4811, M4812, M4813, M4814, M4815, M4816, M4817, M4818, M4819, M4820, M4821, M4822, M4823, M4824, M4825, M4826, M4827, M4828, M4829, M4830, M4831, M4832, M4833, M4834, M4835, M4836, M4837, M4838, M4839, M4840, M4841, M4842, M4843, M4844, M4845, M4846, M4847, M4848, M4849, M4850, M4851, M4852, M4853, M4854, M4855, M4856, M4857, M4858, M4859, M4860, M4861, M4862, M4863, M4864, M4865, M4866, M4867, M4868, M4869, M4870, M4871, M4872, M4873, M4874, M4875, M4876, M4877, M4878, M4879, M4880, M4881, M4882, M4883, M4884, M4885, M4886, M4887, M4888, M4889, M4890, M4891, M4892, M4893, M4894, M4895, M4896, M4897, M4898, M4899, M4900, M4901, M4902, M4903, M4904, M4905, M4906, M4907, M4908, M4909, M4910, M4911, M4912, M4913, M4914, M4915, M4916, M4917, M4918, M4919, M4920, M4921, M4922, M4923, M4924, M4925, M4926, M4927, M4928, M4929, M4930, M4931, M4932, M4933, M4934, M4935, M4936, M4937, M4938, M4939, M4940, M4941, M4942, M4943, M4944, M4945, M4946, M4947, M4948, M4949, M4950, M4951, M4952, M4953, M4954, M4955, M4956, M4957, M4958, M4959, M4960, M4961, M4962, M4963, M4964, M4965, M4966, M4967, M4968, M4969, M4970, M4971, M4972, M4973, M4974, M4975, M4976, M4977, M4978, M4979, M4980, M4981, M4982, M4983, M4984, M4985, M4986, M4987, M4988, M4989, M4990, M4991, M4992, M4993, M4994, M4995, M4996, M4997, M4998, M4999, M5000, M5001, M5002, M5003, M5004, M5005, M5006, M5007, M5008, M5009, M5010, M5011, M5012, M5013, M5014, M5015, M5016, M5017, M5018, M5019, M5020, M5021, M5022, M5023, M5024, M5025, M5026, M5027, M5028, M5029, M5030, M5031, M5032, M5033, M5034, M5035, M5036, M5037, M5038, M5039, M5040, M5041, M5042, M5043, M5044, M5045, M5046, M5047, M5048, M5049, M5050, M5051, M5052, M5053, M5054, M5055, M5056, M5057, M5058, M5059, M5060, M5061, M5062, M5063, M5064, M5065, M5066, M5067, M5068, M5069, M5070, M5071, M5072, M5073, M5074, M5075, M5076, M5077, M5078, M5079, M5080, M5081, M5082, M5083, M5084, M5085, M5086, M5087, M5088, M5089, M5090, M5091, M5092, M5093, M5094, M5095, M5096, M5097, M5098, M5099, M5100, M5101, M5102, M5103, M5104, M5105, M5106, M5107, M5108, M5109, M5110, M5111, M5112, M5113, M5114, M5115, M5116, M5117, M5118, M5119, M5120, M5121, M5122, M5123, M5124, M5125, M5126, M5127, M5128, M5129, M5130, M5131, M5132, M5133, M5134, M5135, M5136, M5137, M5138, M5139, M5140, M5141, M5142, M5143, M5144, M5145, M5146, M5147, M5148, M5149, M5150, M5151, M5152, M5153, M5154, M5155, M5156, M5157, M5158, M5159, M5160, M5161, M5162, M5163, M5164, M5165, M5166, M5167, M5168, M5169, M5170, M5171, M5172, M5173, M5174, M5175, M5176, M5177, M5178, M5179, M5180, M5181, M5182, M5183, M5184, M5185, M5186, M5187, M5188, M5189, M5190, M5191, M5192, M5193, M5194, M5195, M5196, M5197, M5198, M5199, M5200, M5201, M5202, M5203, M5204, M5205, M5206, M5207, M5208, M5209, M5210, M5211, M5212, M5213, M5214, M5215, M5216, M5217, M5218, M5219, M5220, M5221, M5222, M5223, M5224, M5225, M5226, M5227, M5228, M5229, M5230, M5231, M5232, M5233, M5234, M5235, M5236, M5237, M5238, M5239, M5240, M5241, M5242, M5243, M5244, M5245, M5246, M5247, M5248, M5249, M5250, M5251, M5252, M5253, M5254, M5255, M5256, M5257, M5258, M5259, M5260, M5261, M5262, M5263, M5264, M5265, M5266, M5267, M5268, M5269, M5270, M5271, M5272, M5273, M5274, M5275, M5276, M5277, M5278, M5279, M5280, M5281, M5282, M5283, M5284, M5285, M5286, M5287, M5288, M5289, M5290, M5291, M5292, M5293, M5294, M5295, M5296, M5297, M5298, M5299, M5300, M5301, M5302, M5303, M5304, M5305, M5306, M5307, M5308, M5309, M5310, M5311, M5312, M5313, M5314, M5315, M5316, M5317, M5318, M5319, M5320, M5321, M5322, M5323, M5324, M5325, M5326, M5327, M5328, M5329, M5330, M5331, M5332, M5333, M5334, M5335, M5336, M5337, M5338, M5339, M5340, M5341, M5342, M5343, M5344, M5345, M5346, M5347, M5348, M5349, M5350, M5351, M5352, M5353, M5354, M5355, M5356, M5357, M5358, M5359, M5360, M5361, M5362, M5363, M5364, M5365, M5366, M5367, M5368, M5369, M5370, M5371, M5372, M5373, M5374, M5375, M5376, M5377, M5378, M5379, M5380, M5381, M5382, M5383, M5384, M5385, M5386, M5387, M5388, M5389, M5390, M5391, M5392, M5393, M5394, M5395, M5396, M5397, M5398, M5399, M5400, M5401, M5402, M5403, M5404, M5405, M5406, M5407, M5408, M5409, M5410, M5411, M5412, M5413, M5414, M5415, M5416, M5417, M5418, M5419, M5420, M5421, M5422, M5423, M5424, M5425, M5426, M5427, M5428, M5429, M5430, M5431, M5432, M5433, M5434, M5435, M5436, M5437, M5438, M5439, M5440, M5441, M5442, M5443, M5444, M5445, M5446, M5447, M5448, M5449, M5450, M5451, M5452, M5453, M5454, M5455, M5456, M5457, M5458, M5459, M5460, M5461, M5462, M5463, M5464, M5465, M5466, M5467, M5468, M5469, M5470, M5471, M5472, M5473, M5474, M5475, M5476, M5477, M5478, M5479, M5480, M5481, M5482, M5483, M5484, M5485, M5486, M5487, M5488, M5489, M5490, M5491, M5492, M5493, M5494, M5495, M5496, M5497, M5498, M5499, M5500, M5501, M5502, M5503, M5504, M5505, M5506, M5507, M5508, M5509, M5510, M5511, M5512, M5513, M5514, M5515, M5516, M5517, M5518, M5519, M5520, M5521, M5522, M5523, M5524, M5525, M5526, M5527, M5528, M5529, M5530, M5531, M5532, M5533, M5534, M5535, M5536, M5537, M5538, M5539, M5540, M5541, M5542, M5543, M5544, M5545, M5546, M5547, M5548, M5549, M5550, M5551, M5552, M5553, M5554, M5555, M5556, M5557, M5558, M5559, M5560, M5561, M5562, M5563, M5564, M5565, M5566, M5567, M5568, M5569, M5570, M5571, M5572, M5573, M5574, M5575, M5576, M5577, M5578, M5579, M5580, M5581, M5582, M5583, M5584, M5585, M5586, M5587, M5588, M5589, M5590, M5591, M5592, M5593, M5594, M5595, M5596, M5597, M5598, M5599, M5600, M5601, M5602, M5603, M5604, M5605, M5606, M5607, M5608, M5609, M5610, M5611, M5612, M5613, M5614, M5615, M5616, M5617, M5618, M5619, M5620, M5621, M5622, M5623, M5624, M5625, M5626, M5627, M5628, M5629, M5630, M5631, M5632, M5633, M5634, M5635, M5636, M5637, M5638, M5639, M5640, M5641, M5642, M5643, M5644, M5645, M5646, M5647, M5648, M5649, M5650, M5651, M5652, M5653, M5654, M5655, M5656, M5657, M5658, M5659, M5660, M5661, M5662, M5663, M5664, M5665, M5666, M5667, M5668, M5669, M5670, M5671, M5672, M5673, M5674, M5675, M5676, M5677, M5678, M5679, M5680, M5681, M5682, M5683, M5684, M5685, M5686, M5687, M5688, M5689, M5690, M5691, M5692, M5693, M5694, M5695, M5696, M5697, M5698, M5699, M5700, M5701, M5702, M5703, M5704, M5705, M5706, M5707, M5708, M5709, M5710, M5711, M5712, M5713, M5714, M5715, M5716, M5717, M5718, M5719, M5720, M5721, M5722, M5723, M5724, M5725, M5726, M5727, M5728, M5729, M5730, M5731, M5732, M5733, M5734, M5735, M5736, M5737, M5738, M5739, M5740, M5741, M5742, M5743, M5744, M5745, M5746, M5747, M5748, M5749, M5750, M5751, M5752, M5753, M5754, M5755, M5756, M5757, M5758, M5759, M5760, M5761, M5762, M5763, M5764, M5765, M5766, M5767, M5768, M5769, M5770, M5771, M5772, M5773, M5774, M5775, M5776, M5777, M5778, M5779, M5780, M5781, M5782, M5783, M5784, M5785, M5786, M5787, M5788, M5789, M5790, M5791, M5792, M5793, M5794, M5795, M5796, M5797, M5798, M5799, M5800, M5801, M5802, M5803, M5804, M5805, M5806, M5807, M5808, M5809, M5810, M5811, M5812, M5813, M5814, M5815, M5816, M5817, M5818, M5819, M5820, M5821, M5822, M5823, M5824, M5825, M5826, M5827, M5828, M5829, M5830, M5831, M5832, M5833, M5834, M5835, M5836, M5837, M5838, M5839, M5840, M5841, M5842, M5843, M5844, M5845, M5846, M5847, M5848, M5849, M5850, M5851, M5852, M5853, M5854, M5855, M5856, M5857, M5858, M5859, M5860, M5861, M5862, M5863, M5864, M5865, M5866, M5867, M5868, M5869, M5870, M5871, M5872, M5873, M5874, M5875, M5876, M5877, M5878, M5879, M5880, M5881, M5882, M5883, M5884, M5885, M5886, M5887, M5888, M5889, M5890, M5891, M5892, M5893, M5894, M5895, M5896, M5897, M5898, M5899, M5900, M5901, M5902, M5903, M5904, M5905, M5906, M5907, M5908, M5909, M5910, M5911, M5912, M5913, M5914, M5915, M5916, M5917, M5918, M5919, M5920, M5921, M5922, M5923, M5924, M5925, M5926, M5927, M5928, M5929, M5930, M5931, M5932, M5933, M5934, M5935, M5936, M5937, M5938, M5939, M5940, M5941, M5942, M5943, M5944, M5945, M5946, M5947, M5948, M5949, M5950, M5951, M5952, M5953, M5954, M5955, M5956, M5957, M5958, M5959, M5960, M5961, M5962, M5963, M5964, M5965, M5966, M5967, M5968, M5969, M5970, M5971, M5972, M5973, M5974, M5975, M5976, M5977, M5978, M5979, M5980, M5981, M5982, M5983, M5984, M5985, M5986, M5987, M5988, M5989, M5990, M5991, M5992, M5993, M5994, M5995, M5996, M5997, M5998, M5999, M6000, M6001, M6002, M6003, M6004, M6005, M6006, M6007, M6008, M6009, M6010, M6011, M6012, M6013, M6014, M6015, M6016, M6017, M6018, M6019, M6020, M6021, M6022, M6023, M6024, M6025, M6026, M6027, M6028, M6029, M6030, M6031, M6032, M6033, M6034, M6035, M6036, M6037, M6038, M6039, M6040, M6041, M6042, M6043, M6044, M6045, M6046, M6047, M6048, M6049, M6050, M6051, M6052, M6053, M6054, M6055, M6056, M6057, M6058, M6059, M6060, M6061, M6062, M6063, M6064, M6065, M6066, M6067, M6068, M6069, M6070, M6071, M6072, M6073, M6074, M6075, M6076, M6077, M6078, M6079, M6080, M6081, M6082, M6083, M6084, M6085, M6086, M6087, M6088, M6089, M6090, M6091, M6092, M6093, M6094, M6095, M6096, M6097, M6098, M6099, M6100, M6101, M6102, M6103, M6104, M6105, M6106, M6107, M6108, M6109, M6110, M6111, M6112, M6113, M6114, M6115, M6116, M6117, M6118, M6119, M6120, M6121, M6122, M6123, M6124, M6125, M6126, M6127, M6128, M6129, M6130, M6131, M6132, M6133, M6134, M6135, M6136, M6137, M6138, M6139, M6140, M6141, M6142, M6143, M6144, M6145, M6146, M6147, M6148, M6149, M6150, M6151, M6152, M6153, M6154, M6155, M6156, M6157, M6158, M6159, M6160, M6161, M6162, M6163, M6164, M6165, M6166, M6167, M6168, M6169, M6170, M6171, M6172, M6173, M6174, M6175, M6176, M6177, M6178, M6179, M6180, M6181, M6182, M6183, M6184, M6185, M6186, M6187, M6188, M6189, M6190, M6191, M6192, M6193, M6194, M6195, M6196, M6197, M6198, M6199, M6200, M6201, M6202, M6203, M6204, M6205, M6206, M6207, M6208, M6209, M6210, M6211, M6212, M6213, M6214, M6215, M6216, M6217, M6218, M6219, M6220, M6221, M6222, M6223, M6224, M6225, M6226, M6227, M6228, M6229, M6230, M6231, M6232, M6233, M6234, M6235, M6236, M6237, M6238, M6239, M6240, M6241, M6242, M6243, M6244, M6245, M6246, M6247, M6248, M6249, M6250, M6251, M6252, M6253, M6254, M6255, M6256, M6257, M6258, M6259, M6260, M6261, M6262, M6263, M6264, M6265, M6266, M6267, M6268, M6269, M6270, M6271, M6272, M6273, M6274, M6275, M6276, M6277, M6278, M6279, M6280, M6281, M6282, M6283, M6284, M6285, M6286, M6287, M6288, M6289, M6290, M6291, M6292, M6293, M6294, M6295, M6296, M6297, M6298, M6299, M6300, M6301, M6302, M6303, M6304, M6305, M6306, M6307, M6308, M6309, M6310, M6311, M6312, M6313, M6314, M6315, M6316, M6317, M6318, M6319, M6320, M6321, M6322, M6323, M6324, M6325, M6326, M6327, M6328, M6329, M6330, M6331, M6332, M6333, M6334, M6335, M6336, M6337, M6338, M6339, M6340, M6341, M6342, M6343, M6344, M6345, M6346, M6347, M6348, M6349, M6350, M6351, M6352, M6353, M6354, M6355, M6356, M6357, M6358, M6359, M6360, M6361, M6362, M6363, M6364, M6365, M6366, M6367, M6368, M6369, M6370, M6371, M6372, M6373, M6374, M6375, M6376, M6377, M6378, M6379, M6380, M6381, M6382, M6383, M6384, M6385, M6386, M6387, M6388, M6389, M6390, M6391, M6392, M6393, M6394, M6395, M6396, M6397, M6398, M6399, M6400, M6401, M6402, M6403, M6404, M6405, M6406, M6407, M6408, M6409, M6410, M6411, M6412, M6413, M6414, M6415, M6416, M6417, M6418, M6419, M6420, M6421, M6422, M6423, M6424, M6425, M6426, M6427, M6428, M6429, M6430, M6431, M6432, M6433, M6434, M6435, M6436, M6437, M6438, M6439, M6440, M6441, M6442, M6443, M6444, M6445, M6446, M6447, M6448, M6449, M6450, M6451, M6452, M6453, M6454, M6455, M6456, M6457, M6458, M6459, M6460, M6461, M6462, M6463, M6464, M6465, M6466, M6467, M6468, M6469, M6470, M6471, M6472, M6473, M6474, M6475, M6476, M6477, M6478, M6479, M6480, M6481, M6482, M6483, M6484, M6485, M6486, M6487, M6488, M6489, M6490, M6491, M6492, M6493, M6494, M6495, M6496, M6497, M6498, M6499, M6500, M6501, M6502, M6503, M6504, M6505, M6506, M6507, M6508, M6509, M6510, M6511, M6512, M6513, M6514, M6515, M6516, M6517, M6518, M6519, M6520, M6521, M6522, M6523, M6524, M6525, M6526, M6527, M6528, M6529, M6530, M6531, M6532, M6533, M6534, M6535, M6536, M6537, M6538, M6539, M6540, M6541, M6542, M6543, M6544, M6545, M6546, M6547, M6548, M6549, M6550, M6551, M6552, M6553, M6554, M6555, M6556, M6557, M6558, M6559, M6560, M6561, M6562, M6563, M6564, M6565, M6566, M6567, M6568, M6569, M6570, M6571, M6572, M6573, M6574, M6575, M6576, M6577, M6578, M6579, M6580, M6581, M6582, M6583, M6584, M6585, M6586, M6587, M6588, M6589, M6590, M6591, M6592, M6593, M6594, M6595, M6596, M6597, M6598, M6599, M6600, M6601, M6602, M6603, M6604, M6605, M6606, M6607, M6608, M6609, M6610, M6611, M6612, M6613, M6614, M6615, M6616, M6617, M6618, M6619, M6620, M6621, M6622, M6623, M6624, M6625, M6626, M6627, M6628, M6629, M6630, M6631, M6632, M6633, M6634, M6635, M6636, M6637, M6638, M6639, M6640, M6641, M6642, M6643, M6644, M6645, M6646, M6647, M6648, M6649, M6650, M6651, M6652, M6653, M6654, M6655, M6656, M6657, M6658, M6659, M6660, M6661, M6662, M6663, M6664, M6665, M6666, M6667, M6668, M6669, M6670, M6671, M6672, M6673, M6674, M6675, M6676, M6677, M6678, M6679, M6680, M6681, M6682, M6683, M6684, M6685, M6686, M6687, M6688, M6689, M6690, M6691, M6692, M6693, M6694, M6695, M6696, M6697, M6698, M6699, M6700, M6701, M6702, M6703, M6704, M6705, M6706, M6707, M6708, M6709, M6710, M6711, M6712, M6713, M6714, M6715, M6716, M6717, M6718, M6719, M6720, M6721, M6722, M6723, M6724, M6725, M6726, M6727, M6728, M6729, M6730, M6731, M6732, M6733, M6734, M6735, M6736, M6737, M6738, M6739, M6740, M6741, M6742, M6743, M6744, M6745, M6746, M6747, M6748, M6749, M6750, M6751, M6752, M6753, M6754, M6755, M6756, M6757, M6758, M6759, M6760, M6761, M6762, M6763, M6764, M6765, M6766, M6767, M6768, M6769, M6770, M6771, M6772, M6773, M6774, M6775, M6776, M6777, M6778, M6779, M6780, M6781, M6782, M6783, M6784, M6785, M6786, M6787, M6788, M6789, M6790, M6791, M6792, M6793, M6794, M6795, M6796, M6797, M6798, M6799, M6800, M6801, M6802, M6803, M6804, M6805, M6806, M6807, M6808, M6809, M6810, M6811, M6812, M6813, M6814, M6815, M6816, M6817, M6818, M6819, M6820, M6821, M6822, M6823, M6824, M6825, M6826, M6827, M6828, M6829, M6830, M6831, M6832, M6833, M6834, M6835, M6836, M6837, M6838, M6839, M6840, M6841, M6842, M6843, M6844, M6845, M6846, M6847, M6848, M6849, M6850, M6851, M6852, M6853, M6854, M6855, M6856, M6857, M6858, M6859, M6860, M6861, M6862, M6863, M6864, M6865, M6866, M6867, M6868, M6869, M6870, M6871, M6872, M6873, M6874, M6875, M6876, M6877, M6878, M6879, M6880, M6881, M6882, M6883, M6884, M6885, M6886, M6887, M6888, M6889, M6890, M6891, M6892, M6893, M6894, M6895, M6896, M6897, M6898, M6899, M6900, M6901, M6902, M6903, M6904, M6905, M6906, M6907, M6908, M6909, M6910, M6911, M6912, M6913, M6914, M6915, M6916, M6917, M6918, M6919, M6920, M6921, M6922, M6923, M6924, M6925, M6926, M6927, M6928, M6929, M6930, M6931, M6932, M6933, M6934, M6935, M6936, M6937, M6938, M6939, M6940, M6941, M6942, M6943, M6944, M6945, M6946, M6947, M6948, M6949, M6950, M6951, M6952, M6953, M6954, M6955, M6956, M6957, M6958, M6959, M6960, M6961, M6962, M6963, M6964, M6965, M6966, M6967, M6968, M6969, M6970, M6971, M6972, M6973, M6974, M6975, M6976, M6977, M6978, M6979, M6980, M6981, M6982, M6983, M6984, M6985, M6986, M6987, M6988, M6989, M6990, M6991, M6992, M6993, M6994, M6995, M6996, M6997, M6998, M6999, M7000, M7001, M7002, M7003, M7004, M7005, M7006, M7007, M7008, M7009, M7010, M7011, M7012, M7013, M7014, M7015, M7016, M7017, M7018, M7019, M7020, M7021, M7022, M7023, M7024, M7025, M7026, M7027, M7028, M7029, M7030, M7031, M7032, M7033, M7034, M7035, M7036, M7037, M7038, M7039, M7040, M7041, M7042, M7043, M7044, M7045, M7046, M7047, M7048, M7049, M7050, M7051, M7052, M7053, M7054, M7055, M7056, M7057, M7058, M7059, M7060, M7061, M7062, M7063, M7064, M7065, M7066, M7067, M7068, M7069, M7070, M7071, M7072, M7073, M7074, M7075, M7076, M7077, M7078, M7079, M7080, M7081, M7082, M7083, M7084, M7085, M7086, M7087, M7088, M7089, M7090, M7091, M7092, M7093, M7094, M7095, M7096, M7097, M7098, M7099, M7100, M7101, M7102, M7103, M7104, M7105, M7106, M7107, M7108, M7109, M7110, M7111, M7112, M7113, M7114, M7115, M7116, M7117, M7118, M7119, M7120, M7121, M7122, M7123, M7124, M7125, M7126, M7127, M7128, M7129, M7130, M7131, M7132, M7133, M7134, M7135, M7136, M7137, M7138, M7139, M7140, M7141, M7142, M7143, M7144, M7145, M7146, M7147, M7148, M7149, M7150, M7151, M7152, M7153, M7154, M7155, M7156, M7157, M7158, M7159, M7160, M7161, M7162, M7163, M7164, M7165, M7166, M7167, M7168, M7169, M7170, M7171, M7172, M7173, M7174, M7175, M7176, M7177, M7178, M7179, M7180, M7181, M7182, M7183, M7184, M7185, M7186, M7187, M7188, M7189, M7190, M7191, M7192, M7193, M7194, M7195, M7196, M7197, M7198, M7199, M7200, M7201, M7202, M7203, M7204, M7205, M7206, M7207, M7208, M7209, M7210, M7211, M7212, M7213, M7214, M7215, M7216, M7217, M7218, M7219, M7220, M7221, M7222, M7223, M7224, M7225, M7226, M7227, M7228, M7229, M7230, M7231, M7232, M7233, M7234, M7235, M7236, M7237, M7238, M7239, M7240, M7241, M7242, M7243, M7244, M7245, M7246, M7247, M7248, M7249, M7250, M7251, M7252, M7253, M7254, M7255, M7256, M7257, M7258, M7259, M7260, M7261, M7262, M7263, M7264, M7265, M7266, M7267, M7268, M7269, M7270, M7271, M7272, M7273, M7274, M7275, M7276, M7277, M7278, M7279, M7280, M7281, M7282, M7283, M7284, M7285, M7286, M7287, M7288, M7289, M7290, M7291, M7292, M7293, M7294, M7295, M7296, M7297, M7298, M7299, M7300, M7301, M7302, M7303, M7304, M7305, M7306, M7307, M7308, M7309, M7310, M7311, M7312, M7313, M7314, M7315, M7316, M7317, M7318, M7319, M7320, M7321, M7322, M7323, M7324, M7325, M7326, M7327, M7328, M7329, M7330, M7331, M7332, M7333, M7334, M7335, M7336, M7337, M7338, M7339, M7340, M7341, M7342, M7343, M7344, M7345, M7346, M7347, M7348, M7349, M7350, M7351, M7352, M7353, M7354, M7355, M7356, M7357, M7358, M7359, M7360, M7361, M7362, M7363, M7364, M7365, M7366, M7367, M7368, M7369, M7370, M7371, M7372, M7373, M7374, M7375, M7376, M7377, M7378, M7379, M7380, M7381, M7382, M7383, M7384, M7385, M7386, M7387, M7388, M7389, M7390, M7391, M7392, M7393, M7394, M7395, M7396, M7397, M7398, M7399, M7400, M7401, M7402, M7403, M7404, M7405, M7406, M7407, M7408, M7409, M7410, M7411, M7412, M7413, M7414, M7415, M7416, M7417, M7418, M7419, M7420, M7421, M7422, M7423, M7424, M7425, M7426, M7427, M7428, M7429, M7430, M7431, M7432, M7433, M7434, M7435, M7436, M7437, M7438, M7439, M7440, M7441, M7442, M7443, M7444, M7445, M7446, M7447, M7448, M7449, M7450, M7451, M7452, M7453, M7454, M7455, M7456, M7457, M7458, M7459, M7460, M7461, M7462, M7463, M7464, M7465, M7466, M7467, M7468, M7469, M7470, M7471, M7472, M7473, M7474, M7475, M7476, M7477, M7478, M7479, M7480, M7481, M7482, M7483, M7484, M7485, M7486, M7487, M7488, M7489, M7490, M7491, M7492, M7493, M7494, M7495, M7496, M7497, M7498, M7499, M7500, M7501, M7502, M7503, M7504, M7505, M7506, M7507, M7508, M7509, M7510, M7511, M7512, M7513, M7514, M7515, M7516, M7517, M7518, M7519, M7520, M7521, M7522, M7523, M7524, M7525, M7526, M7527, M7528, M7529, M7530, M7531, M7532, M7533, M7534, M7535, M7536, M7537, M7538, M7539, M7540, M7541, M7542, M7543, M7544, M7545, M7546, M7547, M7548, M7549, M7550, M7551, M7552, M7553, M7554, M7555, M7556, M7557, M7558, M7559, M7560, M7561, M7562, M7563, M7564, M7565, M7566, M7567, M7568, M7569, M7570, M7571, M7572, M7573, M7574, M7575, M7576, M7577, M7578, M7579, M7580, M7581, M7582, M7583, M7584, M7585, M7586, M7587, M7588, M7589, M7590, M7591, M7592, M7593, M7594, M7595, M7596, M7597, M7598, M7599, M7600, M7601, M7602, M7603, M7604, M7605, M7606, M7607, M7608, M7609, M7610, M7611, M7612, M7613, M7614, M7615, M7616, M7617, M7618, M7619, M7620, M7621, M7622, M7623, M7624, M7625, M7626, M7627, M7628, M7629, M7630, M7631, M7632, M7633, M7634, M7635, M7636, M7637, M7638, M7639, M7640, M7641, M7642, M7643, M7644, M7645, M7646, M7647, M7648, M7649, M7650, M7651, M7652, M7653, M7654, M7655, M7656, M7657, M7658, M7659, M7660, M7661, M7662, M7663, M7664, M7665, M7666, M7667, M7668, M7669, M7670, M7671, M7672, M7673, M7674, M7675, M7676, M7677, M7678, M7679, M7680, M7681, M7682, M7683, M7684, M7685, M7686, M7687, M7688, M7689, M7690, M7691, M7692, M7693, M7694, M7695, M7696, M7697, M7698, M7699, M7700, M7701, M7702, M7703, M7704, M7705, M7706, M7707, M7708, M7709, M7710, M7711, M7712, M7713, M7714, M7715, M7716, M7717, M7718, M7719, M7720, M7721, M7722, M7723, M7724, M7725, M7726, M7727, M7728, M7729, M7730, M7731, M7732, M7733, M7734, M7735, M7736, M7737, M7738, M7739, M7740, M7741, M7742, M7743, M7744, M7745, M7746, M7747, M7748, M7749, M7750, M7751, M7752, M7753, M7754, M7755, M7756, M7757, M7758, M7759, M7760, M7761, M7762, M7763, M7764, M7765, M7766, M7767, M7768, M7769, M7770, M7771, M7772, M7773, M7774, M7775, M7776, M7777, M7778, M7779, M7780, M7781, M7782, M7783, M7784, M7785, M7786, M7787, M7788, M7789, M7790, M7791, M7792, M7793, M7794, M7795, M7796, M7797, M7798, M7799, M7800, M7801, M7802, M7803, M7804, M7805, M7806, M7807, M7808, M7809, M7810, M7811, M7812, M7813, M7814, M7815, M7816, M7817, M7818, M7819, M7820, M7821, M7822, M7823, M7824, M7825, M7826, M7827, M7828, M7829, M7830, M7831, M7832, M7833, M7834, M7835, M7836, M7837, M7838, M7839, M7840, M7841, M7842, M7843, M7844, M7845, M7846, M7847, M7848, M7849, M7850, M7851, M7852, M7853, M7854, M7855, M7856, M7857, M7858, M7859, M7860, M7861, M7862, M7863, M7864, M7865, M7866, M7867, M7868, M7869, M7870, M7871, M7872, M7873, M7874, M7875, M7876, M7877, M7878, M7879, M7880, M7881, M7882, M7883, M7884, M7885, M7886, M7887, M7888, M7889, M7890, M7891, M7892, M7893, M7894, M7895, M7896, M7897, M7898, M7899, M7900, M7901, M7902, M7903, M7904, M7905, M7906, M7907, M7908, M7909, M7910, M7911, M7912, M7913, M7914, M7915, M7916, M7917, M7918, M7919, M7920, M7921, M7922, M7923, M7924, M7925, M7926, M7927, M7928, M7929, M7930, M7931, M7932, M7933, M7934, M7935, M7936, M7937, M7938, M7939, M7940, M7941, M7942, M7943, M7944, M7945, M7946, M7947, M7948, M7949, M7950, M7951, M7952, M7953, M7954, M7955, M7956, M7957, M7958, M7959, M7960, M7961, M7962, M7963, M7964, M7965, M7966, M7967, M7968, M7969, M7970, M7971, M7972, M7973, M7974, M7975, M7976, M7977, M7978, M7979, M7980, M7981, M7982, M7983, M7984, M7985, M7986, M7987, M7988, M7989, M7990, M7991, M7992, M7993, M7994, M7995, M7996, M7997, M7998, M7999, M8000, M8001, M8002, M8003, M8004, M8005, M8006, M8007, M8008, M8009, M8010, M8011, M8012, M8013, M8014, M8015, M8016, M8017, M8018, M8019, M8020, M8021, M8022, M8023, M8024, M8025, M8026, M8027, M8028, M8029, M8030, M8031, M8032, M8033, M8034, M8035, M8036, M8037, M8038, M8039, M8040, M8041, M8042, M8043, M8044, M8045, M8046, M8047, M8048, M8049, M8050, M8051, M8052, M8053, M8054, M8055, M8056, M8057, M8058, M8059, M8060, M8061, M8062, M8063, M8064, M8065, M8066, M8067, M8068, M8069, M8070, M8071, M8072, M8073, M8074, M8075, M8076, M8077, M8078, M8079, M8080, M8081, M8082, M8083, M8084, M8085, M8086, M8087, M8088, M8089, M8090, M8091, M8092, M8093, M8094, M8095, M8096, M8097, M8098, M8099, M8100, M8101, M8102, M8103, M8104, M8105, M8106, M8107, M8108, M8109, M8110, M8111, M8112, M8113, M8114, M8115, M8116, M8117, M8118, M8119, M8120, M8121, M8122, M8123, M8124, M8125, M8126, M8127, M8128, M8129, M8130, M8131, M8132, M8133, M8134, M8135, M8136, M8137, M8138, M8139, M8140, M8141, M8142, M8143, M8144, M8145, M8146, M8147, M8148, M8149, M8150, M8151, M8152, M8153, M8154, M8155, M8156, M8157, M8158, M8159, M8160, M8161, M8162, M8163, M8164, M8165, M8166, M8167, M8168, M8169, M8170, M8171, M8172, M8173, M8174, M8175, M8176, M8177, M8178, M8179, M8180, M8181, M8182, M8183, M8184, M8185, M8186, M8187, M8188, M8189, M8190, M8191, M8192, M8193, M8194, M8195, M8196, M8197, M8198, M8199, M8200, M8201, M8202, M8203, M8204, M8205, M8206, M8207, M8208, M8209, M8210, M8211, M8212, M8213, M8214, M8215, M8216, M8217, M8218, M8219, M8220, M8221, M8222, M8223, M8224, M8225, M8226, M8227, M8228, M8229, M8230, M8231, M8232, M8233, M8234, M8235, M8236, M8237, M8238, M8239, M8240, M8241, M8242, M8243, M8244, M8245, M8246, M8247, M8248, M8249, M8250, M8251, M8252, M8253, M8254, M8255, M8256, M8257, M8258, M8259, M8260, M8261, M8262, M8263, M8264, M8265, M8266, M8267, M8268, M8269, M8270, M8271, M8272, M8273, M8274, M8275, M8276, M8277, M8278, M8279, M8280, M8281, M8282, M8283, M8284, M8285, M8286, M8287, M8288, M8289, M8290, M8291, M8292, M8293, M8294, M8295, M8296, M8297, M8298, M8299, M8300, M8301, M8302, M8303, M8304, M8305, M8306, M8307, M8308, M8309, M8310, M8311, M8312, M8313, M8314, M8315, M8316, M8317, M8318, M8319, M8320, M8321, M8322, M8323, M8324, M8325, M8326, M8327, M8328, M8329, M8330, M8331, M8332, M8333, M8334, M8335, M8336, M8337, M8338, M8339, M8340, M8341, M8342, M8343, M8344, M8345, M8346, M8347, M8348, M8349, M8350, M8351, M8352, M8353, M8354, M8355, M8356, M8357, M8358, M8359, M8360, M8361, M8362, M8363, M8364, M8365, M8366, M8367, M8368, M8369, M8370, M8371, M8372, M8373, M8374, M8375, M8376, M8377, M8378, M8379, M8380, M8381, M8382, M8383, M8384, M8385, M8386, M8387, M8388, M8389, M8390, M8391, M8392, M8393, M8394, M8395, M8396, M8397, M8398, M8399, M8400, M8401, M8402, M8403, M8404, M8405, M8406, M8407, M8408, M8409, M8410, M8411, M8412, M8413, M8414, M8415, M8416, M8417, M8418, M8419, M8420, M8421, M8422, M8423, M8424, M8425, M8426, M8427, M8428, M8429, M8430, M8431, M8432, M8433, M8434, M8435, M8436, M8437, M8438, M8439, M8440, M8441, M8442, M8443, M8444, M8445, M8446, M8447, M8448, M8449, M8450, M8451, M8452, M8453, M8454, M8455, M8456, M8457, M8458, M8459, M8460, M8461, M8462, M8463, M8464, M8465, M8466, M8467, M8468, M8469, M8470, M8471, M8472, M8473, M8474, M8475, M8476, M8477, M8478, M8479, M8480, M8481, M8482, M8483, M8484, M8485, M8486, M8487, M8488, M8489, M8490, M8491, M8492, M8493, M8494, M8495, M8496, M8497, M8498, M8499, M8500, M8501, M8502, M8503, M8504, M8505, M8506, M8507, M8508, M8509, M8510, M8511, M8512, M8513, M8514, M8515, M8516, M8517, M8518, M8519, M8520, M8521, M8522, M8523, M8524, M8525, M8526, M8527, M8528, M8529, M8530, M8531, M8532, M8533, M8534, M8535, M8536, M8537, M8538, M8539, M8540, M8541, M8542, M8543, M8544, M8545, M8546, M8547, M8548, M8549, M8550, M8551, M8552, M8553, M8554, M8555, M8556, M8557, M8558, M8559, M8560, M8561, M8562, M8563, M8564, M8565, M8566, M8567, M8568, M8569, M8570, M8571, M8572, M8573, M8574, M8575, M8576, M8577, M8578, M8579, M8580, M8581, M8582, M8583, M8584, M8585, M8586, M8587, M8588, M8589, M8590, M8591, M8592, M8593, M8594, M8595, M8596, M8597, M8598, M8599, M8600, M8601, M8602, M8603, M8604, M8605, M8606, M8607, M8608, M8609, M8610, M8611, M8612, M8613, M8614, M8615, M8616, M8617, M8618, M8619, M8620, M8621, M8622, M8623, M8624, M8625, M8626, M8627, M8628, M8629, M8630, M8631, M8632, M8633, M8634, M8635, M8636, M8637, M8638, M8639, M8640, M8641, M8642, M8643, M8644, M8645, M8646, M8647, M8648, M8649, M8650, M8651, M8652, M8653, M8654, M8655, M8656, M8657, M8658, M8659, M8660, M8661, M8662, M8663, M8664, M8665, M8666, M8667, M8668, M8669, M8670, M8671, M8672, M8673, M8674, M8675, M8676, M8677, M8678, M8679, M8680, M8681, M8682, M8683, M8684, M8685, M8686, M8687, M8688, M8689, M8690, M8691, M8692, M8693, M8694, M8695, M8696, M8697, M8698, M8699, M8700, M8701, M8702, M8703, M8704, M8705, M8706, M8707, M8708, M8709, M8710, M8711, M8712, M8713, M8714, M8715, M8716, M8717, M8718, M8719, M8720, M8721, M8722, M8723, M8724, M8725, M8726, M8727, M8728, M8729, M8730, M8731, M8732, M8733, M8734, M8735, M8736, M8737, M8738, M8739, M8740, M8741, M8742, M8743, M8744, M8745, M8746, M8747, M8748, M8749, M8750, M8751, M8752, M8753, M8754, M8755, M8756, M8757, M8758, M8759, M8760, M8761, M8762, M8763, M8764, M8765, M8766, M8767, M8768, M8769, M8770, M8771, M8772, M8773, M8774, M8775, M8776, M8777, M8778, M8779, M8780, M8781, M8782, M8783, M8784, M8785, M8786, M8787, M8788, M8789, M8790, M8791, M8792, M8793, M8794, M8795, M8796, M8797, M8798, M8799, M8800, M8801, M8802, M8803, M8804, M8805, M8806, M8807, M8808, M8809, M8810, M8811, M8812, M8813, M8814, M8815, M8816, M8817, M8818, M8819, M8820, M8821, M8822, M8823, M8824, M8825, M8826, M8827, M8828, M8829, M8830, M8831, M8832, M8833, M8834, M8835, M8836, M8837, M8838, M8839, M8840, M8841, M8842, M8843, M8844, M8845, M8846, M8847, M8848, M8849, M8850, M8851, M8852, M8853, M8854, M8855, M8856, M8857, M8858, M8859, M8860, M8861, M8862, M8863, M8864, M8865, M8866, M8867, M8868, M8869, M8870, M8871, M8872, M8873, M8874, M8875, M8876, M8877, M8878, M8879, M8880, M8881, M8882, M8883, M8884, M8885, M8886, M8887, M8888, M8889, M8890, M8891, M8892, M8893, M8894, M8895, M8896, M8897, M8898, M8899, M8900, M8901, M8902, M8903, M8904, M8905, M8906, M8907, M8908, M8909, M8910, M8911, M8912, M8913, M8914, M8915, M8916, M8917, M8918, M8919, M8920, M8921, M8922, M8923, M8924, M8925, M8926, M8927, M8928, M8929, M8930, M8931, M8932, M8933, M8934, M8935, M8936, M8937, M8938, M8939, M8940, M8941, M8942, M8943, M8944, M8945, M8946, M8947, M8948, M8949, M8950, M8951, M8952, M8953, M8954, M8955, M8956, M8957, M8958, M8959, M8960, M8961, M8962, M8963, M8964, M8965, M8966, M8967, M8968, M8969, M8970, M8971, M8972, M8973, M8974, M8975, M8976, M8977, M8978, M8979, M8980, M8981, M8982, M8983, M8984, M8985, M8986, M8987, M8988, M8989, M8990, M8991, M8992, M8993, M8994, M8995, M8996, M8997, M8998, M8999, M9000, M9001, M9002, M9003, M9004, M9005, M9006, M9007, M9008, M9009, M9010, M9011, M9012, M9013, M9014, M9015, M9016, M9017, M9018, M9019, M9020, M9021, M9022, M9023, M9024, M9025, M9026, M9027, M9028, M9029, M9030, M9031, M9032, M9033, M9034, M9035, M9036, M9037, M9038, M9039, M9040, M9041, M9042, M9043, M9044, M9045, M9046, M9047, M9048, M9049, M9050, M9051, M9052, M9053, M9054, M9055, M9056, M9057, M9058, M9059, M9060, M9061, M9062, M9063, M9064, M9065, M9066, M9067, M9068, M9069, M9070, M9071, M9072, M9073, M9074, M9075, M9076, M9077, M9078, M9079, M9080, M9081, M9082, M9083, M9084, M9085, M9086, M9087, M9088, M9089, M9090, M9091, M9092, M9093, M9094, M9095, M9096, M9097, M9098, M9099, M9100, M9101, M9102, M9103, M9104, M9105, M9106, M9107, M9108, M9109, M9110, M9111, M9112, M9113, M9114, M9115, M9116, M9117, M9118, M9119, M9120, M9121, M9122, M9123, M9124, M9125, M9126, M9127, M9128, M9129, M9130, M9131, M9132, M9133, M9134, M9135, M9136, M9137, M9138, M9139, M9140, M9141, M9142, M9143, M9144, M9145, M9146, M9147, M9148, M9149, M9150, M9151, M9152, M9153, M9154, M9155, M9156, M9157, M9158, M9159, M9160, M9161, M9162, M9163, M9164, M9165, M9166, M9167, M9168, M9169, M9170, M9171, M9172, M9173, M9174, M9175, M9176, M9177, M9178, M9179, M9180, M9181, M9182, M9183, M9184, M9185, M9186, M9187, M9188, M9189, M9190, M9191, M9192, M9193, M9194, M9195, M9196, M9197, M9198, M9199, M9200, M9201, M9202, M9203, M9204, M9205, M9206, M9207, M9208, M9209, M9210, M9211, M9212, M9213, M9214, M9215, M9216, M9217, M9218, M9219, M9220, M9221, M9222, M9223, M9224, M9225, M9226, M9227, M9228, M9229, M9230, M9231, M9232, M9233, M9234, M9235, M9236, M9237, M9238, M9239, M9240, M9241, M9242, M9243, M9244, M9245, M9246, M9247, M9248, M9249, M9250, M9251, M9252, M9253, M9254, M9255, M9256, M9257, M9258, M9259, M9260, M9261, M9262, M9263, M9264, M9265, M9266, M9267, M9268, M9269, M9270, M9271, M9272, M9273, M9274, M9275, M9276, M9277, M9278, M9279, M9280, M9281, M9282, M9283, M9284, M9285, M9286, M9287, M9288, M9289, M9290, M9291, M9292, M9293, M9294, M9295, M9296, M9297, M9298, M9299, M9300, M9301, M9302, M9303, M9304, M9305, M9306, M9307, M9308, M9309, M9310, M9311, M9312, M9313, M9314, M9315, M9316, M9317, M9318, M9319, M9320, M9321, M9322, M9323, M9324, M9325, M9326, M9327, M9328, M9329, M9330, M9331, M9332, M9333, M9334, M9335, M9336, M9337, M9338, M9339, M9340, M9341, M9342, M9343, M9344, M9345, M9346, M9347, M9348, M9349, M9350, M9351, M9352, M9353, M9354, M9355, M9356, M9357, M9358, M9359, M9360, M9361, M9362, M9363, M9364, M9365, M9366, M9367, M9368, M9369, M9370, M9371, M9372, M9373, M9374, M9375, M9376, M9377, M9378, M9379, M9380, M9381, M9382, M9383, M9384, M9385, M9386, M9387, M9388, M9389, M9390, M9391, M9392, M9393, M9394, M9395, M9396, M9397, M9398, M9399, M9400, M9401, M9402, M9403, M9404, M9405, M9406, M9407, M9408, M9409, M9410, M9411, M9412, M9413, M9414, M9415, M9416, M9417, M9418, M9419, M9420, M9421, M9422, M9423, M9424, M9425, M9426, M9427, M9428, M9429, M9430, M9431, M9432, M9433, M9434, M9435, M9436, M9437, M9438, M9439, M9440, M9441, M9442, M9443, M9444, M9445, M9446, M9447, M9448, M9449, M9450, M9451, M9452, M9453, M9454, M9455, M9456, M9457, M9458, M9459, M9460, M9461, M9462, M9463, M9464, M9465, M9466, M9467, M9468, M9469, M9470, M9471, M9472, M9473, M9474, M9475, M9476, M9477, M9478, M9479, M9480, M9481, M9482, M9483, M9484, M9485, M9486, M9487, M9488, M9489, M9490, M9491, M9492, M9493, M9494, M9495, M9496, M9497, M9498, M9499, M9500, M9501, M9502, M9503, M9504, M9505, M9506, M9507, M9508, M9509, M9510, M9511, M9512, M9513, M9514, M9515, M9516, M9517, M9518, M9519, M9520, M9521, M9522, M9523, M9524, M9525, M9526, M9527, M9528, M9529, M9530, M9531, M9532, M9533, M9534, M9535, M9536, M9537, M9538, M9539, M9540, M9541, M9542, M9543, M9544, M9545, M9546, M9547, M9548, M9549, M9550, M9551, M9552, M9553, M9554, M9555, M9556, M9557, M9558, M9559, M9560, M9561, M9562, M9563, M9564, M9565, M9566, M9567, M9568, M9569, M9570, M9571, M9572, M9573, M9574, M9575, M9576, M9577, M9578, M9579, M9580, M9581, M9582, M9583, M9584, M9585, M9586, M9587, M9588, M9589, M9590, M9591, M9592, M9593, M9594, M9595, M9596, M9597, M9598, M9599, M9600, M9601, M9602, M9603, M9604, M9605, M9606, M9607, M9608, M9609, M9610, M9611, M9612, M9613, M9614, M9615, M9616, M9617, M9618, M9619, M9620, M9621, M9622, M9623, M9624, M9625, M9626, M9627, M9628, M9629, M9630, M9631, M9632, M9633, M9634, M9635, M9636, M9637, M9638, M9639, M9640, M9641, M9642, M9643, M9644, M9645, M9646, M9647, M9648, M9649, M9650, M9651, M9652, M9653, M9654, M9655, M9656, M9657, M9658, M9659, M9660, M9661, M9662, M9663, M9664, M9665, M9666, M9667, M9668, M9669, M9670, M9671, M9672, M9673, M9674, M9675, M9676, M9677, M9678, M9679, M9680, M9681, M9682, M9683, M9684, M9685, M9686, M9687, M9688, M9689, M9690, M9691, M9692, M9693, M9694, M9695, M9696, M9697, M9698, M9699, M9700, M9701, M9702, M9703, M9704, M9705, M9706, M9707, M9708, M9709, M9710, M9711, M9712, M9713, M9714, M9715, M9716, M9717, M9718, M9719, M9720, M9721, M9722, M9723, M9724, M9725, M9726, M9727, M9728, M9729, M9730, M9731, M9732, M9733, M9734, M9735, M9736, M9737, M9738, M9739, M9740, M9741, M9742, M9743, M9744, M9745, M9746, M9747, M9748, M9749, M9750, M9751, M9752, M9753, M9754, M9755, M9756, M9757, M9758, M9759, M9760, M9761, M9762, M9763, M9764, M9765, M9766, M9767, M9768, M9769, M9770, M9771, M9772, M9773, M9774, M9775, M9776, M9777, M9778, M9779, M9780, M9781, M9782, M9783, M9784, M9785, M9786, M9787, M9788, M9789, M9790, M9791, M9792, M9793, M9794, M9795, M9796, M9797, M9798, M9799, M9800, M9801, M9802, M9803, M9804, M9805, M9806, M9807, M9808, M9809, M9810, M9811, M9812, M9813, M9814, M9815, M9816, M9817, M9818, M9819, M9820, M9821, M9822, M9823, M9824, M9825, M9826, M9827, M9828, M9829, M9830, M9831, M9832, M9833, M9834, M9835, M9836, M9837, M9838, M9839, M9840, M9841, M9842, M9843, M9844, M9845, M9846, M9847, M9848, M9849, M9850, M9851, M9852, M9853, M9854, M9855, M9856, M9857, M9858, M9859, M9860, M9861, M9862, M9863, M9864, M9865, M9866, M9867, M9868, M9869, M9870, M9871, M9872, M9873, M9874, M9875, M9876, M9877, M9878, M9879, M9880, M9881, M9882, M9883, M9884, M9885, M9886, M9887, M9888, M9889, M9890, M9891, M9892, M9893, M9894, M9895, M9896, M9897, M9898, M9899, M9900, M9901, M9902, M9903, M9904, M9905, M9906, M9907, M9908, M9909, M9910, M9911, M9912, M9913, M9914, M9915, M9916, M9917, M9918, M9919, M9920, M9921, M9922, M9923, M9924, M9925, M9926, M9927, M9928, M9929, M9930, M9931, M9932, M9933, M9934, M9935, M9936, M9937, M9938, M9939, M9940, M9941, M9942, M9943, M9944, M9945, M9946, M9947, M9948, M9949, M9950, M9951, M9952, M9953, M9954, M9955, M9956, M9957, M9958, M9959, M9960, M9961, M9962, M9963, M9964, M9965, M9966, M9967, M9968, M9969, M9970, M9971, M9972, M9973, M9974, M9975, M9976, M9977, M9978, M9979, M9980, M9981, M9982, M9983, M9984, M9985, M9986, M9987, M9988, M9989, M9990, M9991, M9992, M9993, M9994, M9995, M9996, M9997, M9998, M9999>(){ } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // test has a generic type with 10,000 generic type arguments and a generic method with 10,000 generic type arguments. // VSW 491668 using System; public class Test_VSW491668 { public static int Main() { MyClass<int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int> obj = new MyClass<int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int>(); obj.method1<int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int,int>(); Console.WriteLine("PASS"); return 100; } } public class MyClass<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16, T17, T18, T19, T20, T21, T22, T23, T24, T25, T26, T27, T28, T29, T30, T31, T32, T33, T34, T35, T36, T37, T38, T39, T40, T41, T42, T43, T44, T45, T46, T47, T48, T49, T50, T51, T52, T53, T54, T55, T56, T57, T58, T59, T60, T61, T62, T63, T64, T65, T66, T67, T68, T69, T70, T71, T72, T73, T74, T75, T76, T77, T78, T79, T80, T81, T82, T83, T84, T85, T86, T87, T88, T89, T90, T91, T92, T93, T94, T95, T96, T97, T98, T99, T100, T101, T102, T103, T104, T105, T106, T107, T108, T109, T110, T111, T112, T113, T114, T115, T116, T117, T118, T119, T120, T121, T122, T123, T124, T125, T126, T127, T128, T129, T130, T131, T132, T133, T134, T135, T136, T137, T138, T139, T140, T141, T142, T143, T144, T145, T146, T147, T148, T149, T150, T151, T152, T153, T154, T155, T156, T157, T158, T159, T160, T161, T162, T163, T164, T165, T166, T167, T168, T169, T170, T171, T172, T173, T174, T175, T176, T177, T178, T179, T180, T181, T182, T183, T184, T185, T186, T187, T188, T189, T190, T191, T192, T193, T194, T195, T196, T197, T198, T199, T200, T201, T202, T203, T204, T205, T206, T207, T208, T209, T210, T211, T212, T213, T214, T215, T216, T217, T218, T219, T220, T221, T222, T223, T224, T225, T226, T227, T228, T229, T230, T231, T232, T233, T234, T235, T236, T237, T238, T239, T240, T241, T242, T243, T244, T245, T246, T247, T248, T249, T250, T251, T252, T253, T254, T255, T256, T257, T258, T259, T260, T261, T262, T263, T264, T265, T266, T267, T268, T269, T270, T271, T272, T273, T274, T275, T276, T277, T278, T279, T280, T281, T282, T283, T284, T285, T286, T287, T288, T289, T290, T291, T292, T293, T294, T295, T296, T297, T298, T299, T300, T301, T302, T303, T304, T305, T306, T307, T308, T309, T310, T311, T312, T313, T314, T315, T316, T317, T318, T319, T320, T321, T322, T323, T324, T325, T326, T327, T328, T329, T330, T331, T332, T333, T334, T335, T336, T337, T338, T339, T340, T341, T342, T343, T344, T345, T346, T347, T348, T349, T350, T351, T352, T353, T354, T355, T356, T357, T358, T359, T360, T361, T362, T363, T364, T365, T366, T367, T368, T369, T370, T371, T372, T373, T374, T375, T376, T377, T378, T379, T380, T381, T382, T383, T384, T385, T386, T387, T388, T389, T390, T391, T392, T393, T394, T395, T396, T397, T398, T399, T400, T401, T402, T403, T404, T405, T406, T407, T408, T409, T410, T411, T412, T413, T414, T415, T416, T417, T418, T419, T420, T421, T422, T423, T424, T425, T426, T427, T428, T429, T430, T431, T432, T433, T434, T435, T436, T437, T438, T439, T440, T441, T442, T443, T444, T445, T446, T447, T448, T449, T450, T451, T452, T453, T454, T455, T456, T457, T458, T459, T460, T461, T462, T463, T464, T465, T466, T467, T468, T469, T470, T471, T472, T473, T474, T475, T476, T477, T478, T479, T480, T481, T482, T483, T484, T485, T486, T487, T488, T489, T490, T491, T492, T493, T494, T495, T496, T497, T498, T499, T500, T501, T502, T503, T504, T505, T506, T507, T508, T509, T510, T511, T512, T513, T514, T515, T516, T517, T518, T519, T520, T521, T522, T523, T524, T525, T526, T527, T528, T529, T530, T531, T532, T533, T534, T535, T536, T537, T538, T539, T540, T541, T542, T543, T544, T545, T546, T547, T548, T549, T550, T551, T552, T553, T554, T555, T556, T557, T558, T559, T560, T561, T562, T563, T564, T565, T566, T567, T568, T569, T570, T571, T572, T573, T574, T575, T576, T577, T578, T579, T580, T581, T582, T583, T584, T585, T586, T587, T588, T589, T590, T591, T592, T593, T594, T595, T596, T597, T598, T599, T600, T601, T602, T603, T604, T605, T606, T607, T608, T609, T610, T611, T612, T613, T614, T615, T616, T617, T618, T619, T620, T621, T622, T623, T624, T625, T626, T627, T628, T629, T630, T631, T632, T633, T634, T635, T636, T637, T638, T639, T640, T641, T642, T643, T644, T645, T646, T647, T648, T649, T650, T651, T652, T653, T654, T655, T656, T657, T658, T659, T660, T661, T662, T663, T664, T665, T666, T667, T668, T669, T670, T671, T672, T673, T674, T675, T676, T677, T678, T679, T680, T681, T682, T683, T684, T685, T686, T687, T688, T689, T690, T691, T692, T693, T694, T695, T696, T697, T698, T699, T700, T701, T702, T703, T704, T705, T706, T707, T708, T709, T710, T711, T712, T713, T714, T715, T716, T717, T718, T719, T720, T721, T722, T723, T724, T725, T726, T727, T728, T729, T730, T731, T732, T733, T734, T735, T736, T737, T738, T739, T740, T741, T742, T743, T744, T745, T746, T747, T748, T749, T750, T751, T752, T753, T754, T755, T756, T757, T758, T759, T760, T761, T762, T763, T764, T765, T766, T767, T768, T769, T770, T771, T772, T773, T774, T775, T776, T777, T778, T779, T780, T781, T782, T783, T784, T785, T786, T787, T788, T789, T790, T791, T792, T793, T794, T795, T796, T797, T798, T799, T800, T801, T802, T803, T804, T805, T806, T807, T808, T809, T810, T811, T812, T813, T814, T815, T816, T817, T818, T819, T820, T821, T822, T823, T824, T825, T826, T827, T828, T829, T830, T831, T832, T833, T834, T835, T836, T837, T838, T839, T840, T841, T842, T843, T844, T845, T846, T847, T848, T849, T850, T851, T852, T853, T854, T855, T856, T857, T858, T859, T860, T861, T862, T863, T864, T865, T866, T867, T868, T869, T870, T871, T872, T873, T874, T875, T876, T877, T878, T879, T880, T881, T882, T883, T884, T885, T886, T887, T888, T889, T890, T891, T892, T893, T894, T895, T896, T897, T898, T899, T900, T901, T902, T903, T904, T905, T906, T907, T908, T909, T910, T911, T912, T913, T914, T915, T916, T917, T918, T919, T920, T921, T922, T923, T924, T925, T926, T927, T928, T929, T930, T931, T932, T933, T934, T935, T936, T937, T938, T939, T940, T941, T942, T943, T944, T945, T946, T947, T948, T949, T950, T951, T952, T953, T954, T955, T956, T957, T958, T959, T960, T961, T962, T963, T964, T965, T966, T967, T968, T969, T970, T971, T972, T973, T974, T975, T976, T977, T978, T979, T980, T981, T982, T983, T984, T985, T986, T987, T988, T989, T990, T991, T992, T993, T994, T995, T996, T997, T998, T999, T1000, T1001, T1002, T1003, T1004, T1005, T1006, T1007, T1008, T1009, T1010, T1011, T1012, T1013, T1014, T1015, T1016, T1017, T1018, T1019, T1020, T1021, T1022, T1023, T1024, T1025, T1026, T1027, T1028, T1029, T1030, T1031, T1032, T1033, T1034, T1035, T1036, T1037, T1038, T1039, T1040, T1041, T1042, T1043, T1044, T1045, T1046, T1047, T1048, T1049, T1050, T1051, T1052, T1053, T1054, T1055, T1056, T1057, T1058, T1059, T1060, T1061, T1062, T1063, T1064, T1065, T1066, T1067, T1068, T1069, T1070, T1071, T1072, T1073, T1074, T1075, T1076, T1077, T1078, T1079, T1080, T1081, T1082, T1083, T1084, T1085, T1086, T1087, T1088, T1089, T1090, T1091, T1092, T1093, T1094, T1095, T1096, T1097, T1098, T1099, T1100, T1101, T1102, T1103, T1104, T1105, T1106, T1107, T1108, T1109, T1110, T1111, T1112, T1113, T1114, T1115, T1116, T1117, T1118, T1119, T1120, T1121, T1122, T1123, T1124, T1125, T1126, T1127, T1128, T1129, T1130, T1131, T1132, T1133, T1134, T1135, T1136, T1137, T1138, T1139, T1140, T1141, T1142, T1143, T1144, T1145, T1146, T1147, T1148, T1149, T1150, T1151, T1152, T1153, T1154, T1155, T1156, T1157, T1158, T1159, T1160, T1161, T1162, T1163, T1164, T1165, T1166, T1167, T1168, T1169, T1170, T1171, T1172, T1173, T1174, T1175, T1176, T1177, T1178, T1179, T1180, T1181, T1182, T1183, T1184, T1185, T1186, T1187, T1188, T1189, T1190, T1191, T1192, T1193, T1194, T1195, T1196, T1197, T1198, T1199, T1200, T1201, T1202, T1203, T1204, T1205, T1206, T1207, T1208, T1209, T1210, T1211, T1212, T1213, T1214, T1215, T1216, T1217, T1218, T1219, T1220, T1221, T1222, T1223, T1224, T1225, T1226, T1227, T1228, T1229, T1230, T1231, T1232, T1233, T1234, T1235, T1236, T1237, T1238, T1239, T1240, T1241, T1242, T1243, T1244, T1245, T1246, T1247, T1248, T1249, T1250, T1251, T1252, T1253, T1254, T1255, T1256, T1257, T1258, T1259, T1260, T1261, T1262, T1263, T1264, T1265, T1266, T1267, T1268, T1269, T1270, T1271, T1272, T1273, T1274, T1275, T1276, T1277, T1278, T1279, T1280, T1281, T1282, T1283, T1284, T1285, T1286, T1287, T1288, T1289, T1290, T1291, T1292, T1293, T1294, T1295, T1296, T1297, T1298, T1299, T1300, T1301, T1302, T1303, T1304, T1305, T1306, T1307, T1308, T1309, T1310, T1311, T1312, T1313, T1314, T1315, T1316, T1317, T1318, T1319, T1320, T1321, T1322, T1323, T1324, T1325, T1326, T1327, T1328, T1329, T1330, T1331, T1332, T1333, T1334, T1335, T1336, T1337, T1338, T1339, T1340, T1341, T1342, T1343, T1344, T1345, T1346, T1347, T1348, T1349, T1350, T1351, T1352, T1353, T1354, T1355, T1356, T1357, T1358, T1359, T1360, T1361, T1362, T1363, T1364, T1365, T1366, T1367, T1368, T1369, T1370, T1371, T1372, T1373, T1374, T1375, T1376, T1377, T1378, T1379, T1380, T1381, T1382, T1383, T1384, T1385, T1386, T1387, T1388, T1389, T1390, T1391, T1392, T1393, T1394, T1395, T1396, T1397, T1398, T1399, T1400, T1401, T1402, T1403, T1404, T1405, T1406, T1407, T1408, T1409, T1410, T1411, T1412, T1413, T1414, T1415, T1416, T1417, T1418, T1419, T1420, T1421, T1422, T1423, T1424, T1425, T1426, T1427, T1428, T1429, T1430, T1431, T1432, T1433, T1434, T1435, T1436, T1437, T1438, T1439, T1440, T1441, T1442, T1443, T1444, T1445, T1446, T1447, T1448, T1449, T1450, T1451, T1452, T1453, T1454, T1455, T1456, T1457, T1458, T1459, T1460, T1461, T1462, T1463, T1464, T1465, T1466, T1467, T1468, T1469, T1470, T1471, T1472, T1473, T1474, T1475, T1476, T1477, T1478, T1479, T1480, T1481, T1482, T1483, T1484, T1485, T1486, T1487, T1488, T1489, T1490, T1491, T1492, T1493, T1494, T1495, T1496, T1497, T1498, T1499, T1500, T1501, T1502, T1503, T1504, T1505, T1506, T1507, T1508, T1509, T1510, T1511, T1512, T1513, T1514, T1515, T1516, T1517, T1518, T1519, T1520, T1521, T1522, T1523, T1524, T1525, T1526, T1527, T1528, T1529, T1530, T1531, T1532, T1533, T1534, T1535, T1536, T1537, T1538, T1539, T1540, T1541, T1542, T1543, T1544, T1545, T1546, T1547, T1548, T1549, T1550, T1551, T1552, T1553, T1554, T1555, T1556, T1557, T1558, T1559, T1560, T1561, T1562, T1563, T1564, T1565, T1566, T1567, T1568, T1569, T1570, T1571, T1572, T1573, T1574, T1575, T1576, T1577, T1578, T1579, T1580, T1581, T1582, T1583, T1584, T1585, T1586, T1587, T1588, T1589, T1590, T1591, T1592, T1593, T1594, T1595, T1596, T1597, T1598, T1599, T1600, T1601, T1602, T1603, T1604, T1605, T1606, T1607, T1608, T1609, T1610, T1611, T1612, T1613, T1614, T1615, T1616, T1617, T1618, T1619, T1620, T1621, T1622, T1623, T1624, T1625, T1626, T1627, T1628, T1629, T1630, T1631, T1632, T1633, T1634, T1635, T1636, T1637, T1638, T1639, T1640, T1641, T1642, T1643, T1644, T1645, T1646, T1647, T1648, T1649, T1650, T1651, T1652, T1653, T1654, T1655, T1656, T1657, T1658, T1659, T1660, T1661, T1662, T1663, T1664, T1665, T1666, T1667, T1668, T1669, T1670, T1671, T1672, T1673, T1674, T1675, T1676, T1677, T1678, T1679, T1680, T1681, T1682, T1683, T1684, T1685, T1686, T1687, T1688, T1689, T1690, T1691, T1692, T1693, T1694, T1695, T1696, T1697, T1698, T1699, T1700, T1701, T1702, T1703, T1704, T1705, T1706, T1707, T1708, T1709, T1710, T1711, T1712, T1713, T1714, T1715, T1716, T1717, T1718, T1719, T1720, T1721, T1722, T1723, T1724, T1725, T1726, T1727, T1728, T1729, T1730, T1731, T1732, T1733, T1734, T1735, T1736, T1737, T1738, T1739, T1740, T1741, T1742, T1743, T1744, T1745, T1746, T1747, T1748, T1749, T1750, T1751, T1752, T1753, T1754, T1755, T1756, T1757, T1758, T1759, T1760, T1761, T1762, T1763, T1764, T1765, T1766, T1767, T1768, T1769, T1770, T1771, T1772, T1773, T1774, T1775, T1776, T1777, T1778, T1779, T1780, T1781, T1782, T1783, T1784, T1785, T1786, T1787, T1788, T1789, T1790, T1791, T1792, T1793, T1794, T1795, T1796, T1797, T1798, T1799, T1800, T1801, T1802, T1803, T1804, T1805, T1806, T1807, T1808, T1809, T1810, T1811, T1812, T1813, T1814, T1815, T1816, T1817, T1818, T1819, T1820, T1821, T1822, T1823, T1824, T1825, T1826, T1827, T1828, T1829, T1830, T1831, T1832, T1833, T1834, T1835, T1836, T1837, T1838, T1839, T1840, T1841, T1842, T1843, T1844, T1845, T1846, T1847, T1848, T1849, T1850, T1851, T1852, T1853, T1854, T1855, T1856, T1857, T1858, T1859, T1860, T1861, T1862, T1863, T1864, T1865, T1866, T1867, T1868, T1869, T1870, T1871, T1872, T1873, T1874, T1875, T1876, T1877, T1878, T1879, T1880, T1881, T1882, T1883, T1884, T1885, T1886, T1887, T1888, T1889, T1890, T1891, T1892, T1893, T1894, T1895, T1896, T1897, T1898, T1899, T1900, T1901, T1902, T1903, T1904, T1905, T1906, T1907, T1908, T1909, T1910, T1911, T1912, T1913, T1914, T1915, T1916, T1917, T1918, T1919, T1920, T1921, T1922, T1923, T1924, T1925, T1926, T1927, T1928, T1929, T1930, T1931, T1932, T1933, T1934, T1935, T1936, T1937, T1938, T1939, T1940, T1941, T1942, T1943, T1944, T1945, T1946, T1947, T1948, T1949, T1950, T1951, T1952, T1953, T1954, T1955, T1956, T1957, T1958, T1959, T1960, T1961, T1962, T1963, T1964, T1965, T1966, T1967, T1968, T1969, T1970, T1971, T1972, T1973, T1974, T1975, T1976, T1977, T1978, T1979, T1980, T1981, T1982, T1983, T1984, T1985, T1986, T1987, T1988, T1989, T1990, T1991, T1992, T1993, T1994, T1995, T1996, T1997, T1998, T1999, T2000, T2001, T2002, T2003, T2004, T2005, T2006, T2007, T2008, T2009, T2010, T2011, T2012, T2013, T2014, T2015, T2016, T2017, T2018, T2019, T2020, T2021, T2022, T2023, T2024, T2025, T2026, T2027, T2028, T2029, T2030, T2031, T2032, T2033, T2034, T2035, T2036, T2037, T2038, T2039, T2040, T2041, T2042, T2043, T2044, T2045, T2046, T2047, T2048, T2049, T2050, T2051, T2052, T2053, T2054, T2055, T2056, T2057, T2058, T2059, T2060, T2061, T2062, T2063, T2064, T2065, T2066, T2067, T2068, T2069, T2070, T2071, T2072, T2073, T2074, T2075, T2076, T2077, T2078, T2079, T2080, T2081, T2082, T2083, T2084, T2085, T2086, T2087, T2088, T2089, T2090, T2091, T2092, T2093, T2094, T2095, T2096, T2097, T2098, T2099, T2100, T2101, T2102, T2103, T2104, T2105, T2106, T2107, T2108, T2109, T2110, T2111, T2112, T2113, T2114, T2115, T2116, T2117, T2118, T2119, T2120, T2121, T2122, T2123, T2124, T2125, T2126, T2127, T2128, T2129, T2130, T2131, T2132, T2133, T2134, T2135, T2136, T2137, T2138, T2139, T2140, T2141, T2142, T2143, T2144, T2145, T2146, T2147, T2148, T2149, T2150, T2151, T2152, T2153, T2154, T2155, T2156, T2157, T2158, T2159, T2160, T2161, T2162, T2163, T2164, T2165, T2166, T2167, T2168, T2169, T2170, T2171, T2172, T2173, T2174, T2175, T2176, T2177, T2178, T2179, T2180, T2181, T2182, T2183, T2184, T2185, T2186, T2187, T2188, T2189, T2190, T2191, T2192, T2193, T2194, T2195, T2196, T2197, T2198, T2199, T2200, T2201, T2202, T2203, T2204, T2205, T2206, T2207, T2208, T2209, T2210, T2211, T2212, T2213, T2214, T2215, T2216, T2217, T2218, T2219, T2220, T2221, T2222, T2223, T2224, T2225, T2226, T2227, T2228, T2229, T2230, T2231, T2232, T2233, T2234, T2235, T2236, T2237, T2238, T2239, T2240, T2241, T2242, T2243, T2244, T2245, T2246, T2247, T2248, T2249, T2250, T2251, T2252, T2253, T2254, T2255, T2256, T2257, T2258, T2259, T2260, T2261, T2262, T2263, T2264, T2265, T2266, T2267, T2268, T2269, T2270, T2271, T2272, T2273, T2274, T2275, T2276, T2277, T2278, T2279, T2280, T2281, T2282, T2283, T2284, T2285, T2286, T2287, T2288, T2289, T2290, T2291, T2292, T2293, T2294, T2295, T2296, T2297, T2298, T2299, T2300, T2301, T2302, T2303, T2304, T2305, T2306, T2307, T2308, T2309, T2310, T2311, T2312, T2313, T2314, T2315, T2316, T2317, T2318, T2319, T2320, T2321, T2322, T2323, T2324, T2325, T2326, T2327, T2328, T2329, T2330, T2331, T2332, T2333, T2334, T2335, T2336, T2337, T2338, T2339, T2340, T2341, T2342, T2343, T2344, T2345, T2346, T2347, T2348, T2349, T2350, T2351, T2352, T2353, T2354, T2355, T2356, T2357, T2358, T2359, T2360, T2361, T2362, T2363, T2364, T2365, T2366, T2367, T2368, T2369, T2370, T2371, T2372, T2373, T2374, T2375, T2376, T2377, T2378, T2379, T2380, T2381, T2382, T2383, T2384, T2385, T2386, T2387, T2388, T2389, T2390, T2391, T2392, T2393, T2394, T2395, T2396, T2397, T2398, T2399, T2400, T2401, T2402, T2403, T2404, T2405, T2406, T2407, T2408, T2409, T2410, T2411, T2412, T2413, T2414, T2415, T2416, T2417, T2418, T2419, T2420, T2421, T2422, T2423, T2424, T2425, T2426, T2427, T2428, T2429, T2430, T2431, T2432, T2433, T2434, T2435, T2436, T2437, T2438, T2439, T2440, T2441, T2442, T2443, T2444, T2445, T2446, T2447, T2448, T2449, T2450, T2451, T2452, T2453, T2454, T2455, T2456, T2457, T2458, T2459, T2460, T2461, T2462, T2463, T2464, T2465, T2466, T2467, T2468, T2469, T2470, T2471, T2472, T2473, T2474, T2475, T2476, T2477, T2478, T2479, T2480, T2481, T2482, T2483, T2484, T2485, T2486, T2487, T2488, T2489, T2490, T2491, T2492, T2493, T2494, T2495, T2496, T2497, T2498, T2499, T2500, T2501, T2502, T2503, T2504, T2505, T2506, T2507, T2508, T2509, T2510, T2511, T2512, T2513, T2514, T2515, T2516, T2517, T2518, T2519, T2520, T2521, T2522, T2523, T2524, T2525, T2526, T2527, T2528, T2529, T2530, T2531, T2532, T2533, T2534, T2535, T2536, T2537, T2538, T2539, T2540, T2541, T2542, T2543, T2544, T2545, T2546, T2547, T2548, T2549, T2550, T2551, T2552, T2553, T2554, T2555, T2556, T2557, T2558, T2559, T2560, T2561, T2562, T2563, T2564, T2565, T2566, T2567, T2568, T2569, T2570, T2571, T2572, T2573, T2574, T2575, T2576, T2577, T2578, T2579, T2580, T2581, T2582, T2583, T2584, T2585, T2586, T2587, T2588, T2589, T2590, T2591, T2592, T2593, T2594, T2595, T2596, T2597, T2598, T2599, T2600, T2601, T2602, T2603, T2604, T2605, T2606, T2607, T2608, T2609, T2610, T2611, T2612, T2613, T2614, T2615, T2616, T2617, T2618, T2619, T2620, T2621, T2622, T2623, T2624, T2625, T2626, T2627, T2628, T2629, T2630, T2631, T2632, T2633, T2634, T2635, T2636, T2637, T2638, T2639, T2640, T2641, T2642, T2643, T2644, T2645, T2646, T2647, T2648, T2649, T2650, T2651, T2652, T2653, T2654, T2655, T2656, T2657, T2658, T2659, T2660, T2661, T2662, T2663, T2664, T2665, T2666, T2667, T2668, T2669, T2670, T2671, T2672, T2673, T2674, T2675, T2676, T2677, T2678, T2679, T2680, T2681, T2682, T2683, T2684, T2685, T2686, T2687, T2688, T2689, T2690, T2691, T2692, T2693, T2694, T2695, T2696, T2697, T2698, T2699, T2700, T2701, T2702, T2703, T2704, T2705, T2706, T2707, T2708, T2709, T2710, T2711, T2712, T2713, T2714, T2715, T2716, T2717, T2718, T2719, T2720, T2721, T2722, T2723, T2724, T2725, T2726, T2727, T2728, T2729, T2730, T2731, T2732, T2733, T2734, T2735, T2736, T2737, T2738, T2739, T2740, T2741, T2742, T2743, T2744, T2745, T2746, T2747, T2748, T2749, T2750, T2751, T2752, T2753, T2754, T2755, T2756, T2757, T2758, T2759, T2760, T2761, T2762, T2763, T2764, T2765, T2766, T2767, T2768, T2769, T2770, T2771, T2772, T2773, T2774, T2775, T2776, T2777, T2778, T2779, T2780, T2781, T2782, T2783, T2784, T2785, T2786, T2787, T2788, T2789, T2790, T2791, T2792, T2793, T2794, T2795, T2796, T2797, T2798, T2799, T2800, T2801, T2802, T2803, T2804, T2805, T2806, T2807, T2808, T2809, T2810, T2811, T2812, T2813, T2814, T2815, T2816, T2817, T2818, T2819, T2820, T2821, T2822, T2823, T2824, T2825, T2826, T2827, T2828, T2829, T2830, T2831, T2832, T2833, T2834, T2835, T2836, T2837, T2838, T2839, T2840, T2841, T2842, T2843, T2844, T2845, T2846, T2847, T2848, T2849, T2850, T2851, T2852, T2853, T2854, T2855, T2856, T2857, T2858, T2859, T2860, T2861, T2862, T2863, T2864, T2865, T2866, T2867, T2868, T2869, T2870, T2871, T2872, T2873, T2874, T2875, T2876, T2877, T2878, T2879, T2880, T2881, T2882, T2883, T2884, T2885, T2886, T2887, T2888, T2889, T2890, T2891, T2892, T2893, T2894, T2895, T2896, T2897, T2898, T2899, T2900, T2901, T2902, T2903, T2904, T2905, T2906, T2907, T2908, T2909, T2910, T2911, T2912, T2913, T2914, T2915, T2916, T2917, T2918, T2919, T2920, T2921, T2922, T2923, T2924, T2925, T2926, T2927, T2928, T2929, T2930, T2931, T2932, T2933, T2934, T2935, T2936, T2937, T2938, T2939, T2940, T2941, T2942, T2943, T2944, T2945, T2946, T2947, T2948, T2949, T2950, T2951, T2952, T2953, T2954, T2955, T2956, T2957, T2958, T2959, T2960, T2961, T2962, T2963, T2964, T2965, T2966, T2967, T2968, T2969, T2970, T2971, T2972, T2973, T2974, T2975, T2976, T2977, T2978, T2979, T2980, T2981, T2982, T2983, T2984, T2985, T2986, T2987, T2988, T2989, T2990, T2991, T2992, T2993, T2994, T2995, T2996, T2997, T2998, T2999, T3000, T3001, T3002, T3003, T3004, T3005, T3006, T3007, T3008, T3009, T3010, T3011, T3012, T3013, T3014, T3015, T3016, T3017, T3018, T3019, T3020, T3021, T3022, T3023, T3024, T3025, T3026, T3027, T3028, T3029, T3030, T3031, T3032, T3033, T3034, T3035, T3036, T3037, T3038, T3039, T3040, T3041, T3042, T3043, T3044, T3045, T3046, T3047, T3048, T3049, T3050, T3051, T3052, T3053, T3054, T3055, T3056, T3057, T3058, T3059, T3060, T3061, T3062, T3063, T3064, T3065, T3066, T3067, T3068, T3069, T3070, T3071, T3072, T3073, T3074, T3075, T3076, T3077, T3078, T3079, T3080, T3081, T3082, T3083, T3084, T3085, T3086, T3087, T3088, T3089, T3090, T3091, T3092, T3093, T3094, T3095, T3096, T3097, T3098, T3099, T3100, T3101, T3102, T3103, T3104, T3105, T3106, T3107, T3108, T3109, T3110, T3111, T3112, T3113, T3114, T3115, T3116, T3117, T3118, T3119, T3120, T3121, T3122, T3123, T3124, T3125, T3126, T3127, T3128, T3129, T3130, T3131, T3132, T3133, T3134, T3135, T3136, T3137, T3138, T3139, T3140, T3141, T3142, T3143, T3144, T3145, T3146, T3147, T3148, T3149, T3150, T3151, T3152, T3153, T3154, T3155, T3156, T3157, T3158, T3159, T3160, T3161, T3162, T3163, T3164, T3165, T3166, T3167, T3168, T3169, T3170, T3171, T3172, T3173, T3174, T3175, T3176, T3177, T3178, T3179, T3180, T3181, T3182, T3183, T3184, T3185, T3186, T3187, T3188, T3189, T3190, T3191, T3192, T3193, T3194, T3195, T3196, T3197, T3198, T3199, T3200, T3201, T3202, T3203, T3204, T3205, T3206, T3207, T3208, T3209, T3210, T3211, T3212, T3213, T3214, T3215, T3216, T3217, T3218, T3219, T3220, T3221, T3222, T3223, T3224, T3225, T3226, T3227, T3228, T3229, T3230, T3231, T3232, T3233, T3234, T3235, T3236, T3237, T3238, T3239, T3240, T3241, T3242, T3243, T3244, T3245, T3246, T3247, T3248, T3249, T3250, T3251, T3252, T3253, T3254, T3255, T3256, T3257, T3258, T3259, T3260, T3261, T3262, T3263, T3264, T3265, T3266, T3267, T3268, T3269, T3270, T3271, T3272, T3273, T3274, T3275, T3276, T3277, T3278, T3279, T3280, T3281, T3282, T3283, T3284, T3285, T3286, T3287, T3288, T3289, T3290, T3291, T3292, T3293, T3294, T3295, T3296, T3297, T3298, T3299, T3300, T3301, T3302, T3303, T3304, T3305, T3306, T3307, T3308, T3309, T3310, T3311, T3312, T3313, T3314, T3315, T3316, T3317, T3318, T3319, T3320, T3321, T3322, T3323, T3324, T3325, T3326, T3327, T3328, T3329, T3330, T3331, T3332, T3333, T3334, T3335, T3336, T3337, T3338, T3339, T3340, T3341, T3342, T3343, T3344, T3345, T3346, T3347, T3348, T3349, T3350, T3351, T3352, T3353, T3354, T3355, T3356, T3357, T3358, T3359, T3360, T3361, T3362, T3363, T3364, T3365, T3366, T3367, T3368, T3369, T3370, T3371, T3372, T3373, T3374, T3375, T3376, T3377, T3378, T3379, T3380, T3381, T3382, T3383, T3384, T3385, T3386, T3387, T3388, T3389, T3390, T3391, T3392, T3393, T3394, T3395, T3396, T3397, T3398, T3399, T3400, T3401, T3402, T3403, T3404, T3405, T3406, T3407, T3408, T3409, T3410, T3411, T3412, T3413, T3414, T3415, T3416, T3417, T3418, T3419, T3420, T3421, T3422, T3423, T3424, T3425, T3426, T3427, T3428, T3429, T3430, T3431, T3432, T3433, T3434, T3435, T3436, T3437, T3438, T3439, T3440, T3441, T3442, T3443, T3444, T3445, T3446, T3447, T3448, T3449, T3450, T3451, T3452, T3453, T3454, T3455, T3456, T3457, T3458, T3459, T3460, T3461, T3462, T3463, T3464, T3465, T3466, T3467, T3468, T3469, T3470, T3471, T3472, T3473, T3474, T3475, T3476, T3477, T3478, T3479, T3480, T3481, T3482, T3483, T3484, T3485, T3486, T3487, T3488, T3489, T3490, T3491, T3492, T3493, T3494, T3495, T3496, T3497, T3498, T3499, T3500, T3501, T3502, T3503, T3504, T3505, T3506, T3507, T3508, T3509, T3510, T3511, T3512, T3513, T3514, T3515, T3516, T3517, T3518, T3519, T3520, T3521, T3522, T3523, T3524, T3525, T3526, T3527, T3528, T3529, T3530, T3531, T3532, T3533, T3534, T3535, T3536, T3537, T3538, T3539, T3540, T3541, T3542, T3543, T3544, T3545, T3546, T3547, T3548, T3549, T3550, T3551, T3552, T3553, T3554, T3555, T3556, T3557, T3558, T3559, T3560, T3561, T3562, T3563, T3564, T3565, T3566, T3567, T3568, T3569, T3570, T3571, T3572, T3573, T3574, T3575, T3576, T3577, T3578, T3579, T3580, T3581, T3582, T3583, T3584, T3585, T3586, T3587, T3588, T3589, T3590, T3591, T3592, T3593, T3594, T3595, T3596, T3597, T3598, T3599, T3600, T3601, T3602, T3603, T3604, T3605, T3606, T3607, T3608, T3609, T3610, T3611, T3612, T3613, T3614, T3615, T3616, T3617, T3618, T3619, T3620, T3621, T3622, T3623, T3624, T3625, T3626, T3627, T3628, T3629, T3630, T3631, T3632, T3633, T3634, T3635, T3636, T3637, T3638, T3639, T3640, T3641, T3642, T3643, T3644, T3645, T3646, T3647, T3648, T3649, T3650, T3651, T3652, T3653, T3654, T3655, T3656, T3657, T3658, T3659, T3660, T3661, T3662, T3663, T3664, T3665, T3666, T3667, T3668, T3669, T3670, T3671, T3672, T3673, T3674, T3675, T3676, T3677, T3678, T3679, T3680, T3681, T3682, T3683, T3684, T3685, T3686, T3687, T3688, T3689, T3690, T3691, T3692, T3693, T3694, T3695, T3696, T3697, T3698, T3699, T3700, T3701, T3702, T3703, T3704, T3705, T3706, T3707, T3708, T3709, T3710, T3711, T3712, T3713, T3714, T3715, T3716, T3717, T3718, T3719, T3720, T3721, T3722, T3723, T3724, T3725, T3726, T3727, T3728, T3729, T3730, T3731, T3732, T3733, T3734, T3735, T3736, T3737, T3738, T3739, T3740, T3741, T3742, T3743, T3744, T3745, T3746, T3747, T3748, T3749, T3750, T3751, T3752, T3753, T3754, T3755, T3756, T3757, T3758, T3759, T3760, T3761, T3762, T3763, T3764, T3765, T3766, T3767, T3768, T3769, T3770, T3771, T3772, T3773, T3774, T3775, T3776, T3777, T3778, T3779, T3780, T3781, T3782, T3783, T3784, T3785, T3786, T3787, T3788, T3789, T3790, T3791, T3792, T3793, T3794, T3795, T3796, T3797, T3798, T3799, T3800, T3801, T3802, T3803, T3804, T3805, T3806, T3807, T3808, T3809, T3810, T3811, T3812, T3813, T3814, T3815, T3816, T3817, T3818, T3819, T3820, T3821, T3822, T3823, T3824, T3825, T3826, T3827, T3828, T3829, T3830, T3831, T3832, T3833, T3834, T3835, T3836, T3837, T3838, T3839, T3840, T3841, T3842, T3843, T3844, T3845, T3846, T3847, T3848, T3849, T3850, T3851, T3852, T3853, T3854, T3855, T3856, T3857, T3858, T3859, T3860, T3861, T3862, T3863, T3864, T3865, T3866, T3867, T3868, T3869, T3870, T3871, T3872, T3873, T3874, T3875, T3876, T3877, T3878, T3879, T3880, T3881, T3882, T3883, T3884, T3885, T3886, T3887, T3888, T3889, T3890, T3891, T3892, T3893, T3894, T3895, T3896, T3897, T3898, T3899, T3900, T3901, T3902, T3903, T3904, T3905, T3906, T3907, T3908, T3909, T3910, T3911, T3912, T3913, T3914, T3915, T3916, T3917, T3918, T3919, T3920, T3921, T3922, T3923, T3924, T3925, T3926, T3927, T3928, T3929, T3930, T3931, T3932, T3933, T3934, T3935, T3936, T3937, T3938, T3939, T3940, T3941, T3942, T3943, T3944, T3945, T3946, T3947, T3948, T3949, T3950, T3951, T3952, T3953, T3954, T3955, T3956, T3957, T3958, T3959, T3960, T3961, T3962, T3963, T3964, T3965, T3966, T3967, T3968, T3969, T3970, T3971, T3972, T3973, T3974, T3975, T3976, T3977, T3978, T3979, T3980, T3981, T3982, T3983, T3984, T3985, T3986, T3987, T3988, T3989, T3990, T3991, T3992, T3993, T3994, T3995, T3996, T3997, T3998, T3999, T4000, T4001, T4002, T4003, T4004, T4005, T4006, T4007, T4008, T4009, T4010, T4011, T4012, T4013, T4014, T4015, T4016, T4017, T4018, T4019, T4020, T4021, T4022, T4023, T4024, T4025, T4026, T4027, T4028, T4029, T4030, T4031, T4032, T4033, T4034, T4035, T4036, T4037, T4038, T4039, T4040, T4041, T4042, T4043, T4044, T4045, T4046, T4047, T4048, T4049, T4050, T4051, T4052, T4053, T4054, T4055, T4056, T4057, T4058, T4059, T4060, T4061, T4062, T4063, T4064, T4065, T4066, T4067, T4068, T4069, T4070, T4071, T4072, T4073, T4074, T4075, T4076, T4077, T4078, T4079, T4080, T4081, T4082, T4083, T4084, T4085, T4086, T4087, T4088, T4089, T4090, T4091, T4092, T4093, T4094, T4095, T4096, T4097, T4098, T4099, T4100, T4101, T4102, T4103, T4104, T4105, T4106, T4107, T4108, T4109, T4110, T4111, T4112, T4113, T4114, T4115, T4116, T4117, T4118, T4119, T4120, T4121, T4122, T4123, T4124, T4125, T4126, T4127, T4128, T4129, T4130, T4131, T4132, T4133, T4134, T4135, T4136, T4137, T4138, T4139, T4140, T4141, T4142, T4143, T4144, T4145, T4146, T4147, T4148, T4149, T4150, T4151, T4152, T4153, T4154, T4155, T4156, T4157, T4158, T4159, T4160, T4161, T4162, T4163, T4164, T4165, T4166, T4167, T4168, T4169, T4170, T4171, T4172, T4173, T4174, T4175, T4176, T4177, T4178, T4179, T4180, T4181, T4182, T4183, T4184, T4185, T4186, T4187, T4188, T4189, T4190, T4191, T4192, T4193, T4194, T4195, T4196, T4197, T4198, T4199, T4200, T4201, T4202, T4203, T4204, T4205, T4206, T4207, T4208, T4209, T4210, T4211, T4212, T4213, T4214, T4215, T4216, T4217, T4218, T4219, T4220, T4221, T4222, T4223, T4224, T4225, T4226, T4227, T4228, T4229, T4230, T4231, T4232, T4233, T4234, T4235, T4236, T4237, T4238, T4239, T4240, T4241, T4242, T4243, T4244, T4245, T4246, T4247, T4248, T4249, T4250, T4251, T4252, T4253, T4254, T4255, T4256, T4257, T4258, T4259, T4260, T4261, T4262, T4263, T4264, T4265, T4266, T4267, T4268, T4269, T4270, T4271, T4272, T4273, T4274, T4275, T4276, T4277, T4278, T4279, T4280, T4281, T4282, T4283, T4284, T4285, T4286, T4287, T4288, T4289, T4290, T4291, T4292, T4293, T4294, T4295, T4296, T4297, T4298, T4299, T4300, T4301, T4302, T4303, T4304, T4305, T4306, T4307, T4308, T4309, T4310, T4311, T4312, T4313, T4314, T4315, T4316, T4317, T4318, T4319, T4320, T4321, T4322, T4323, T4324, T4325, T4326, T4327, T4328, T4329, T4330, T4331, T4332, T4333, T4334, T4335, T4336, T4337, T4338, T4339, T4340, T4341, T4342, T4343, T4344, T4345, T4346, T4347, T4348, T4349, T4350, T4351, T4352, T4353, T4354, T4355, T4356, T4357, T4358, T4359, T4360, T4361, T4362, T4363, T4364, T4365, T4366, T4367, T4368, T4369, T4370, T4371, T4372, T4373, T4374, T4375, T4376, T4377, T4378, T4379, T4380, T4381, T4382, T4383, T4384, T4385, T4386, T4387, T4388, T4389, T4390, T4391, T4392, T4393, T4394, T4395, T4396, T4397, T4398, T4399, T4400, T4401, T4402, T4403, T4404, T4405, T4406, T4407, T4408, T4409, T4410, T4411, T4412, T4413, T4414, T4415, T4416, T4417, T4418, T4419, T4420, T4421, T4422, T4423, T4424, T4425, T4426, T4427, T4428, T4429, T4430, T4431, T4432, T4433, T4434, T4435, T4436, T4437, T4438, T4439, T4440, T4441, T4442, T4443, T4444, T4445, T4446, T4447, T4448, T4449, T4450, T4451, T4452, T4453, T4454, T4455, T4456, T4457, T4458, T4459, T4460, T4461, T4462, T4463, T4464, T4465, T4466, T4467, T4468, T4469, T4470, T4471, T4472, T4473, T4474, T4475, T4476, T4477, T4478, T4479, T4480, T4481, T4482, T4483, T4484, T4485, T4486, T4487, T4488, T4489, T4490, T4491, T4492, T4493, T4494, T4495, T4496, T4497, T4498, T4499, T4500, T4501, T4502, T4503, T4504, T4505, T4506, T4507, T4508, T4509, T4510, T4511, T4512, T4513, T4514, T4515, T4516, T4517, T4518, T4519, T4520, T4521, T4522, T4523, T4524, T4525, T4526, T4527, T4528, T4529, T4530, T4531, T4532, T4533, T4534, T4535, T4536, T4537, T4538, T4539, T4540, T4541, T4542, T4543, T4544, T4545, T4546, T4547, T4548, T4549, T4550, T4551, T4552, T4553, T4554, T4555, T4556, T4557, T4558, T4559, T4560, T4561, T4562, T4563, T4564, T4565, T4566, T4567, T4568, T4569, T4570, T4571, T4572, T4573, T4574, T4575, T4576, T4577, T4578, T4579, T4580, T4581, T4582, T4583, T4584, T4585, T4586, T4587, T4588, T4589, T4590, T4591, T4592, T4593, T4594, T4595, T4596, T4597, T4598, T4599, T4600, T4601, T4602, T4603, T4604, T4605, T4606, T4607, T4608, T4609, T4610, T4611, T4612, T4613, T4614, T4615, T4616, T4617, T4618, T4619, T4620, T4621, T4622, T4623, T4624, T4625, T4626, T4627, T4628, T4629, T4630, T4631, T4632, T4633, T4634, T4635, T4636, T4637, T4638, T4639, T4640, T4641, T4642, T4643, T4644, T4645, T4646, T4647, T4648, T4649, T4650, T4651, T4652, T4653, T4654, T4655, T4656, T4657, T4658, T4659, T4660, T4661, T4662, T4663, T4664, T4665, T4666, T4667, T4668, T4669, T4670, T4671, T4672, T4673, T4674, T4675, T4676, T4677, T4678, T4679, T4680, T4681, T4682, T4683, T4684, T4685, T4686, T4687, T4688, T4689, T4690, T4691, T4692, T4693, T4694, T4695, T4696, T4697, T4698, T4699, T4700, T4701, T4702, T4703, T4704, T4705, T4706, T4707, T4708, T4709, T4710, T4711, T4712, T4713, T4714, T4715, T4716, T4717, T4718, T4719, T4720, T4721, T4722, T4723, T4724, T4725, T4726, T4727, T4728, T4729, T4730, T4731, T4732, T4733, T4734, T4735, T4736, T4737, T4738, T4739, T4740, T4741, T4742, T4743, T4744, T4745, T4746, T4747, T4748, T4749, T4750, T4751, T4752, T4753, T4754, T4755, T4756, T4757, T4758, T4759, T4760, T4761, T4762, T4763, T4764, T4765, T4766, T4767, T4768, T4769, T4770, T4771, T4772, T4773, T4774, T4775, T4776, T4777, T4778, T4779, T4780, T4781, T4782, T4783, T4784, T4785, T4786, T4787, T4788, T4789, T4790, T4791, T4792, T4793, T4794, T4795, T4796, T4797, T4798, T4799, T4800, T4801, T4802, T4803, T4804, T4805, T4806, T4807, T4808, T4809, T4810, T4811, T4812, T4813, T4814, T4815, T4816, T4817, T4818, T4819, T4820, T4821, T4822, T4823, T4824, T4825, T4826, T4827, T4828, T4829, T4830, T4831, T4832, T4833, T4834, T4835, T4836, T4837, T4838, T4839, T4840, T4841, T4842, T4843, T4844, T4845, T4846, T4847, T4848, T4849, T4850, T4851, T4852, T4853, T4854, T4855, T4856, T4857, T4858, T4859, T4860, T4861, T4862, T4863, T4864, T4865, T4866, T4867, T4868, T4869, T4870, T4871, T4872, T4873, T4874, T4875, T4876, T4877, T4878, T4879, T4880, T4881, T4882, T4883, T4884, T4885, T4886, T4887, T4888, T4889, T4890, T4891, T4892, T4893, T4894, T4895, T4896, T4897, T4898, T4899, T4900, T4901, T4902, T4903, T4904, T4905, T4906, T4907, T4908, T4909, T4910, T4911, T4912, T4913, T4914, T4915, T4916, T4917, T4918, T4919, T4920, T4921, T4922, T4923, T4924, T4925, T4926, T4927, T4928, T4929, T4930, T4931, T4932, T4933, T4934, T4935, T4936, T4937, T4938, T4939, T4940, T4941, T4942, T4943, T4944, T4945, T4946, T4947, T4948, T4949, T4950, T4951, T4952, T4953, T4954, T4955, T4956, T4957, T4958, T4959, T4960, T4961, T4962, T4963, T4964, T4965, T4966, T4967, T4968, T4969, T4970, T4971, T4972, T4973, T4974, T4975, T4976, T4977, T4978, T4979, T4980, T4981, T4982, T4983, T4984, T4985, T4986, T4987, T4988, T4989, T4990, T4991, T4992, T4993, T4994, T4995, T4996, T4997, T4998, T4999, T5000, T5001, T5002, T5003, T5004, T5005, T5006, T5007, T5008, T5009, T5010, T5011, T5012, T5013, T5014, T5015, T5016, T5017, T5018, T5019, T5020, T5021, T5022, T5023, T5024, T5025, T5026, T5027, T5028, T5029, T5030, T5031, T5032, T5033, T5034, T5035, T5036, T5037, T5038, T5039, T5040, T5041, T5042, T5043, T5044, T5045, T5046, T5047, T5048, T5049, T5050, T5051, T5052, T5053, T5054, T5055, T5056, T5057, T5058, T5059, T5060, T5061, T5062, T5063, T5064, T5065, T5066, T5067, T5068, T5069, T5070, T5071, T5072, T5073, T5074, T5075, T5076, T5077, T5078, T5079, T5080, T5081, T5082, T5083, T5084, T5085, T5086, T5087, T5088, T5089, T5090, T5091, T5092, T5093, T5094, T5095, T5096, T5097, T5098, T5099, T5100, T5101, T5102, T5103, T5104, T5105, T5106, T5107, T5108, T5109, T5110, T5111, T5112, T5113, T5114, T5115, T5116, T5117, T5118, T5119, T5120, T5121, T5122, T5123, T5124, T5125, T5126, T5127, T5128, T5129, T5130, T5131, T5132, T5133, T5134, T5135, T5136, T5137, T5138, T5139, T5140, T5141, T5142, T5143, T5144, T5145, T5146, T5147, T5148, T5149, T5150, T5151, T5152, T5153, T5154, T5155, T5156, T5157, T5158, T5159, T5160, T5161, T5162, T5163, T5164, T5165, T5166, T5167, T5168, T5169, T5170, T5171, T5172, T5173, T5174, T5175, T5176, T5177, T5178, T5179, T5180, T5181, T5182, T5183, T5184, T5185, T5186, T5187, T5188, T5189, T5190, T5191, T5192, T5193, T5194, T5195, T5196, T5197, T5198, T5199, T5200, T5201, T5202, T5203, T5204, T5205, T5206, T5207, T5208, T5209, T5210, T5211, T5212, T5213, T5214, T5215, T5216, T5217, T5218, T5219, T5220, T5221, T5222, T5223, T5224, T5225, T5226, T5227, T5228, T5229, T5230, T5231, T5232, T5233, T5234, T5235, T5236, T5237, T5238, T5239, T5240, T5241, T5242, T5243, T5244, T5245, T5246, T5247, T5248, T5249, T5250, T5251, T5252, T5253, T5254, T5255, T5256, T5257, T5258, T5259, T5260, T5261, T5262, T5263, T5264, T5265, T5266, T5267, T5268, T5269, T5270, T5271, T5272, T5273, T5274, T5275, T5276, T5277, T5278, T5279, T5280, T5281, T5282, T5283, T5284, T5285, T5286, T5287, T5288, T5289, T5290, T5291, T5292, T5293, T5294, T5295, T5296, T5297, T5298, T5299, T5300, T5301, T5302, T5303, T5304, T5305, T5306, T5307, T5308, T5309, T5310, T5311, T5312, T5313, T5314, T5315, T5316, T5317, T5318, T5319, T5320, T5321, T5322, T5323, T5324, T5325, T5326, T5327, T5328, T5329, T5330, T5331, T5332, T5333, T5334, T5335, T5336, T5337, T5338, T5339, T5340, T5341, T5342, T5343, T5344, T5345, T5346, T5347, T5348, T5349, T5350, T5351, T5352, T5353, T5354, T5355, T5356, T5357, T5358, T5359, T5360, T5361, T5362, T5363, T5364, T5365, T5366, T5367, T5368, T5369, T5370, T5371, T5372, T5373, T5374, T5375, T5376, T5377, T5378, T5379, T5380, T5381, T5382, T5383, T5384, T5385, T5386, T5387, T5388, T5389, T5390, T5391, T5392, T5393, T5394, T5395, T5396, T5397, T5398, T5399, T5400, T5401, T5402, T5403, T5404, T5405, T5406, T5407, T5408, T5409, T5410, T5411, T5412, T5413, T5414, T5415, T5416, T5417, T5418, T5419, T5420, T5421, T5422, T5423, T5424, T5425, T5426, T5427, T5428, T5429, T5430, T5431, T5432, T5433, T5434, T5435, T5436, T5437, T5438, T5439, T5440, T5441, T5442, T5443, T5444, T5445, T5446, T5447, T5448, T5449, T5450, T5451, T5452, T5453, T5454, T5455, T5456, T5457, T5458, T5459, T5460, T5461, T5462, T5463, T5464, T5465, T5466, T5467, T5468, T5469, T5470, T5471, T5472, T5473, T5474, T5475, T5476, T5477, T5478, T5479, T5480, T5481, T5482, T5483, T5484, T5485, T5486, T5487, T5488, T5489, T5490, T5491, T5492, T5493, T5494, T5495, T5496, T5497, T5498, T5499, T5500, T5501, T5502, T5503, T5504, T5505, T5506, T5507, T5508, T5509, T5510, T5511, T5512, T5513, T5514, T5515, T5516, T5517, T5518, T5519, T5520, T5521, T5522, T5523, T5524, T5525, T5526, T5527, T5528, T5529, T5530, T5531, T5532, T5533, T5534, T5535, T5536, T5537, T5538, T5539, T5540, T5541, T5542, T5543, T5544, T5545, T5546, T5547, T5548, T5549, T5550, T5551, T5552, T5553, T5554, T5555, T5556, T5557, T5558, T5559, T5560, T5561, T5562, T5563, T5564, T5565, T5566, T5567, T5568, T5569, T5570, T5571, T5572, T5573, T5574, T5575, T5576, T5577, T5578, T5579, T5580, T5581, T5582, T5583, T5584, T5585, T5586, T5587, T5588, T5589, T5590, T5591, T5592, T5593, T5594, T5595, T5596, T5597, T5598, T5599, T5600, T5601, T5602, T5603, T5604, T5605, T5606, T5607, T5608, T5609, T5610, T5611, T5612, T5613, T5614, T5615, T5616, T5617, T5618, T5619, T5620, T5621, T5622, T5623, T5624, T5625, T5626, T5627, T5628, T5629, T5630, T5631, T5632, T5633, T5634, T5635, T5636, T5637, T5638, T5639, T5640, T5641, T5642, T5643, T5644, T5645, T5646, T5647, T5648, T5649, T5650, T5651, T5652, T5653, T5654, T5655, T5656, T5657, T5658, T5659, T5660, T5661, T5662, T5663, T5664, T5665, T5666, T5667, T5668, T5669, T5670, T5671, T5672, T5673, T5674, T5675, T5676, T5677, T5678, T5679, T5680, T5681, T5682, T5683, T5684, T5685, T5686, T5687, T5688, T5689, T5690, T5691, T5692, T5693, T5694, T5695, T5696, T5697, T5698, T5699, T5700, T5701, T5702, T5703, T5704, T5705, T5706, T5707, T5708, T5709, T5710, T5711, T5712, T5713, T5714, T5715, T5716, T5717, T5718, T5719, T5720, T5721, T5722, T5723, T5724, T5725, T5726, T5727, T5728, T5729, T5730, T5731, T5732, T5733, T5734, T5735, T5736, T5737, T5738, T5739, T5740, T5741, T5742, T5743, T5744, T5745, T5746, T5747, T5748, T5749, T5750, T5751, T5752, T5753, T5754, T5755, T5756, T5757, T5758, T5759, T5760, T5761, T5762, T5763, T5764, T5765, T5766, T5767, T5768, T5769, T5770, T5771, T5772, T5773, T5774, T5775, T5776, T5777, T5778, T5779, T5780, T5781, T5782, T5783, T5784, T5785, T5786, T5787, T5788, T5789, T5790, T5791, T5792, T5793, T5794, T5795, T5796, T5797, T5798, T5799, T5800, T5801, T5802, T5803, T5804, T5805, T5806, T5807, T5808, T5809, T5810, T5811, T5812, T5813, T5814, T5815, T5816, T5817, T5818, T5819, T5820, T5821, T5822, T5823, T5824, T5825, T5826, T5827, T5828, T5829, T5830, T5831, T5832, T5833, T5834, T5835, T5836, T5837, T5838, T5839, T5840, T5841, T5842, T5843, T5844, T5845, T5846, T5847, T5848, T5849, T5850, T5851, T5852, T5853, T5854, T5855, T5856, T5857, T5858, T5859, T5860, T5861, T5862, T5863, T5864, T5865, T5866, T5867, T5868, T5869, T5870, T5871, T5872, T5873, T5874, T5875, T5876, T5877, T5878, T5879, T5880, T5881, T5882, T5883, T5884, T5885, T5886, T5887, T5888, T5889, T5890, T5891, T5892, T5893, T5894, T5895, T5896, T5897, T5898, T5899, T5900, T5901, T5902, T5903, T5904, T5905, T5906, T5907, T5908, T5909, T5910, T5911, T5912, T5913, T5914, T5915, T5916, T5917, T5918, T5919, T5920, T5921, T5922, T5923, T5924, T5925, T5926, T5927, T5928, T5929, T5930, T5931, T5932, T5933, T5934, T5935, T5936, T5937, T5938, T5939, T5940, T5941, T5942, T5943, T5944, T5945, T5946, T5947, T5948, T5949, T5950, T5951, T5952, T5953, T5954, T5955, T5956, T5957, T5958, T5959, T5960, T5961, T5962, T5963, T5964, T5965, T5966, T5967, T5968, T5969, T5970, T5971, T5972, T5973, T5974, T5975, T5976, T5977, T5978, T5979, T5980, T5981, T5982, T5983, T5984, T5985, T5986, T5987, T5988, T5989, T5990, T5991, T5992, T5993, T5994, T5995, T5996, T5997, T5998, T5999, T6000, T6001, T6002, T6003, T6004, T6005, T6006, T6007, T6008, T6009, T6010, T6011, T6012, T6013, T6014, T6015, T6016, T6017, T6018, T6019, T6020, T6021, T6022, T6023, T6024, T6025, T6026, T6027, T6028, T6029, T6030, T6031, T6032, T6033, T6034, T6035, T6036, T6037, T6038, T6039, T6040, T6041, T6042, T6043, T6044, T6045, T6046, T6047, T6048, T6049, T6050, T6051, T6052, T6053, T6054, T6055, T6056, T6057, T6058, T6059, T6060, T6061, T6062, T6063, T6064, T6065, T6066, T6067, T6068, T6069, T6070, T6071, T6072, T6073, T6074, T6075, T6076, T6077, T6078, T6079, T6080, T6081, T6082, T6083, T6084, T6085, T6086, T6087, T6088, T6089, T6090, T6091, T6092, T6093, T6094, T6095, T6096, T6097, T6098, T6099, T6100, T6101, T6102, T6103, T6104, T6105, T6106, T6107, T6108, T6109, T6110, T6111, T6112, T6113, T6114, T6115, T6116, T6117, T6118, T6119, T6120, T6121, T6122, T6123, T6124, T6125, T6126, T6127, T6128, T6129, T6130, T6131, T6132, T6133, T6134, T6135, T6136, T6137, T6138, T6139, T6140, T6141, T6142, T6143, T6144, T6145, T6146, T6147, T6148, T6149, T6150, T6151, T6152, T6153, T6154, T6155, T6156, T6157, T6158, T6159, T6160, T6161, T6162, T6163, T6164, T6165, T6166, T6167, T6168, T6169, T6170, T6171, T6172, T6173, T6174, T6175, T6176, T6177, T6178, T6179, T6180, T6181, T6182, T6183, T6184, T6185, T6186, T6187, T6188, T6189, T6190, T6191, T6192, T6193, T6194, T6195, T6196, T6197, T6198, T6199, T6200, T6201, T6202, T6203, T6204, T6205, T6206, T6207, T6208, T6209, T6210, T6211, T6212, T6213, T6214, T6215, T6216, T6217, T6218, T6219, T6220, T6221, T6222, T6223, T6224, T6225, T6226, T6227, T6228, T6229, T6230, T6231, T6232, T6233, T6234, T6235, T6236, T6237, T6238, T6239, T6240, T6241, T6242, T6243, T6244, T6245, T6246, T6247, T6248, T6249, T6250, T6251, T6252, T6253, T6254, T6255, T6256, T6257, T6258, T6259, T6260, T6261, T6262, T6263, T6264, T6265, T6266, T6267, T6268, T6269, T6270, T6271, T6272, T6273, T6274, T6275, T6276, T6277, T6278, T6279, T6280, T6281, T6282, T6283, T6284, T6285, T6286, T6287, T6288, T6289, T6290, T6291, T6292, T6293, T6294, T6295, T6296, T6297, T6298, T6299, T6300, T6301, T6302, T6303, T6304, T6305, T6306, T6307, T6308, T6309, T6310, T6311, T6312, T6313, T6314, T6315, T6316, T6317, T6318, T6319, T6320, T6321, T6322, T6323, T6324, T6325, T6326, T6327, T6328, T6329, T6330, T6331, T6332, T6333, T6334, T6335, T6336, T6337, T6338, T6339, T6340, T6341, T6342, T6343, T6344, T6345, T6346, T6347, T6348, T6349, T6350, T6351, T6352, T6353, T6354, T6355, T6356, T6357, T6358, T6359, T6360, T6361, T6362, T6363, T6364, T6365, T6366, T6367, T6368, T6369, T6370, T6371, T6372, T6373, T6374, T6375, T6376, T6377, T6378, T6379, T6380, T6381, T6382, T6383, T6384, T6385, T6386, T6387, T6388, T6389, T6390, T6391, T6392, T6393, T6394, T6395, T6396, T6397, T6398, T6399, T6400, T6401, T6402, T6403, T6404, T6405, T6406, T6407, T6408, T6409, T6410, T6411, T6412, T6413, T6414, T6415, T6416, T6417, T6418, T6419, T6420, T6421, T6422, T6423, T6424, T6425, T6426, T6427, T6428, T6429, T6430, T6431, T6432, T6433, T6434, T6435, T6436, T6437, T6438, T6439, T6440, T6441, T6442, T6443, T6444, T6445, T6446, T6447, T6448, T6449, T6450, T6451, T6452, T6453, T6454, T6455, T6456, T6457, T6458, T6459, T6460, T6461, T6462, T6463, T6464, T6465, T6466, T6467, T6468, T6469, T6470, T6471, T6472, T6473, T6474, T6475, T6476, T6477, T6478, T6479, T6480, T6481, T6482, T6483, T6484, T6485, T6486, T6487, T6488, T6489, T6490, T6491, T6492, T6493, T6494, T6495, T6496, T6497, T6498, T6499, T6500, T6501, T6502, T6503, T6504, T6505, T6506, T6507, T6508, T6509, T6510, T6511, T6512, T6513, T6514, T6515, T6516, T6517, T6518, T6519, T6520, T6521, T6522, T6523, T6524, T6525, T6526, T6527, T6528, T6529, T6530, T6531, T6532, T6533, T6534, T6535, T6536, T6537, T6538, T6539, T6540, T6541, T6542, T6543, T6544, T6545, T6546, T6547, T6548, T6549, T6550, T6551, T6552, T6553, T6554, T6555, T6556, T6557, T6558, T6559, T6560, T6561, T6562, T6563, T6564, T6565, T6566, T6567, T6568, T6569, T6570, T6571, T6572, T6573, T6574, T6575, T6576, T6577, T6578, T6579, T6580, T6581, T6582, T6583, T6584, T6585, T6586, T6587, T6588, T6589, T6590, T6591, T6592, T6593, T6594, T6595, T6596, T6597, T6598, T6599, T6600, T6601, T6602, T6603, T6604, T6605, T6606, T6607, T6608, T6609, T6610, T6611, T6612, T6613, T6614, T6615, T6616, T6617, T6618, T6619, T6620, T6621, T6622, T6623, T6624, T6625, T6626, T6627, T6628, T6629, T6630, T6631, T6632, T6633, T6634, T6635, T6636, T6637, T6638, T6639, T6640, T6641, T6642, T6643, T6644, T6645, T6646, T6647, T6648, T6649, T6650, T6651, T6652, T6653, T6654, T6655, T6656, T6657, T6658, T6659, T6660, T6661, T6662, T6663, T6664, T6665, T6666, T6667, T6668, T6669, T6670, T6671, T6672, T6673, T6674, T6675, T6676, T6677, T6678, T6679, T6680, T6681, T6682, T6683, T6684, T6685, T6686, T6687, T6688, T6689, T6690, T6691, T6692, T6693, T6694, T6695, T6696, T6697, T6698, T6699, T6700, T6701, T6702, T6703, T6704, T6705, T6706, T6707, T6708, T6709, T6710, T6711, T6712, T6713, T6714, T6715, T6716, T6717, T6718, T6719, T6720, T6721, T6722, T6723, T6724, T6725, T6726, T6727, T6728, T6729, T6730, T6731, T6732, T6733, T6734, T6735, T6736, T6737, T6738, T6739, T6740, T6741, T6742, T6743, T6744, T6745, T6746, T6747, T6748, T6749, T6750, T6751, T6752, T6753, T6754, T6755, T6756, T6757, T6758, T6759, T6760, T6761, T6762, T6763, T6764, T6765, T6766, T6767, T6768, T6769, T6770, T6771, T6772, T6773, T6774, T6775, T6776, T6777, T6778, T6779, T6780, T6781, T6782, T6783, T6784, T6785, T6786, T6787, T6788, T6789, T6790, T6791, T6792, T6793, T6794, T6795, T6796, T6797, T6798, T6799, T6800, T6801, T6802, T6803, T6804, T6805, T6806, T6807, T6808, T6809, T6810, T6811, T6812, T6813, T6814, T6815, T6816, T6817, T6818, T6819, T6820, T6821, T6822, T6823, T6824, T6825, T6826, T6827, T6828, T6829, T6830, T6831, T6832, T6833, T6834, T6835, T6836, T6837, T6838, T6839, T6840, T6841, T6842, T6843, T6844, T6845, T6846, T6847, T6848, T6849, T6850, T6851, T6852, T6853, T6854, T6855, T6856, T6857, T6858, T6859, T6860, T6861, T6862, T6863, T6864, T6865, T6866, T6867, T6868, T6869, T6870, T6871, T6872, T6873, T6874, T6875, T6876, T6877, T6878, T6879, T6880, T6881, T6882, T6883, T6884, T6885, T6886, T6887, T6888, T6889, T6890, T6891, T6892, T6893, T6894, T6895, T6896, T6897, T6898, T6899, T6900, T6901, T6902, T6903, T6904, T6905, T6906, T6907, T6908, T6909, T6910, T6911, T6912, T6913, T6914, T6915, T6916, T6917, T6918, T6919, T6920, T6921, T6922, T6923, T6924, T6925, T6926, T6927, T6928, T6929, T6930, T6931, T6932, T6933, T6934, T6935, T6936, T6937, T6938, T6939, T6940, T6941, T6942, T6943, T6944, T6945, T6946, T6947, T6948, T6949, T6950, T6951, T6952, T6953, T6954, T6955, T6956, T6957, T6958, T6959, T6960, T6961, T6962, T6963, T6964, T6965, T6966, T6967, T6968, T6969, T6970, T6971, T6972, T6973, T6974, T6975, T6976, T6977, T6978, T6979, T6980, T6981, T6982, T6983, T6984, T6985, T6986, T6987, T6988, T6989, T6990, T6991, T6992, T6993, T6994, T6995, T6996, T6997, T6998, T6999, T7000, T7001, T7002, T7003, T7004, T7005, T7006, T7007, T7008, T7009, T7010, T7011, T7012, T7013, T7014, T7015, T7016, T7017, T7018, T7019, T7020, T7021, T7022, T7023, T7024, T7025, T7026, T7027, T7028, T7029, T7030, T7031, T7032, T7033, T7034, T7035, T7036, T7037, T7038, T7039, T7040, T7041, T7042, T7043, T7044, T7045, T7046, T7047, T7048, T7049, T7050, T7051, T7052, T7053, T7054, T7055, T7056, T7057, T7058, T7059, T7060, T7061, T7062, T7063, T7064, T7065, T7066, T7067, T7068, T7069, T7070, T7071, T7072, T7073, T7074, T7075, T7076, T7077, T7078, T7079, T7080, T7081, T7082, T7083, T7084, T7085, T7086, T7087, T7088, T7089, T7090, T7091, T7092, T7093, T7094, T7095, T7096, T7097, T7098, T7099, T7100, T7101, T7102, T7103, T7104, T7105, T7106, T7107, T7108, T7109, T7110, T7111, T7112, T7113, T7114, T7115, T7116, T7117, T7118, T7119, T7120, T7121, T7122, T7123, T7124, T7125, T7126, T7127, T7128, T7129, T7130, T7131, T7132, T7133, T7134, T7135, T7136, T7137, T7138, T7139, T7140, T7141, T7142, T7143, T7144, T7145, T7146, T7147, T7148, T7149, T7150, T7151, T7152, T7153, T7154, T7155, T7156, T7157, T7158, T7159, T7160, T7161, T7162, T7163, T7164, T7165, T7166, T7167, T7168, T7169, T7170, T7171, T7172, T7173, T7174, T7175, T7176, T7177, T7178, T7179, T7180, T7181, T7182, T7183, T7184, T7185, T7186, T7187, T7188, T7189, T7190, T7191, T7192, T7193, T7194, T7195, T7196, T7197, T7198, T7199, T7200, T7201, T7202, T7203, T7204, T7205, T7206, T7207, T7208, T7209, T7210, T7211, T7212, T7213, T7214, T7215, T7216, T7217, T7218, T7219, T7220, T7221, T7222, T7223, T7224, T7225, T7226, T7227, T7228, T7229, T7230, T7231, T7232, T7233, T7234, T7235, T7236, T7237, T7238, T7239, T7240, T7241, T7242, T7243, T7244, T7245, T7246, T7247, T7248, T7249, T7250, T7251, T7252, T7253, T7254, T7255, T7256, T7257, T7258, T7259, T7260, T7261, T7262, T7263, T7264, T7265, T7266, T7267, T7268, T7269, T7270, T7271, T7272, T7273, T7274, T7275, T7276, T7277, T7278, T7279, T7280, T7281, T7282, T7283, T7284, T7285, T7286, T7287, T7288, T7289, T7290, T7291, T7292, T7293, T7294, T7295, T7296, T7297, T7298, T7299, T7300, T7301, T7302, T7303, T7304, T7305, T7306, T7307, T7308, T7309, T7310, T7311, T7312, T7313, T7314, T7315, T7316, T7317, T7318, T7319, T7320, T7321, T7322, T7323, T7324, T7325, T7326, T7327, T7328, T7329, T7330, T7331, T7332, T7333, T7334, T7335, T7336, T7337, T7338, T7339, T7340, T7341, T7342, T7343, T7344, T7345, T7346, T7347, T7348, T7349, T7350, T7351, T7352, T7353, T7354, T7355, T7356, T7357, T7358, T7359, T7360, T7361, T7362, T7363, T7364, T7365, T7366, T7367, T7368, T7369, T7370, T7371, T7372, T7373, T7374, T7375, T7376, T7377, T7378, T7379, T7380, T7381, T7382, T7383, T7384, T7385, T7386, T7387, T7388, T7389, T7390, T7391, T7392, T7393, T7394, T7395, T7396, T7397, T7398, T7399, T7400, T7401, T7402, T7403, T7404, T7405, T7406, T7407, T7408, T7409, T7410, T7411, T7412, T7413, T7414, T7415, T7416, T7417, T7418, T7419, T7420, T7421, T7422, T7423, T7424, T7425, T7426, T7427, T7428, T7429, T7430, T7431, T7432, T7433, T7434, T7435, T7436, T7437, T7438, T7439, T7440, T7441, T7442, T7443, T7444, T7445, T7446, T7447, T7448, T7449, T7450, T7451, T7452, T7453, T7454, T7455, T7456, T7457, T7458, T7459, T7460, T7461, T7462, T7463, T7464, T7465, T7466, T7467, T7468, T7469, T7470, T7471, T7472, T7473, T7474, T7475, T7476, T7477, T7478, T7479, T7480, T7481, T7482, T7483, T7484, T7485, T7486, T7487, T7488, T7489, T7490, T7491, T7492, T7493, T7494, T7495, T7496, T7497, T7498, T7499, T7500, T7501, T7502, T7503, T7504, T7505, T7506, T7507, T7508, T7509, T7510, T7511, T7512, T7513, T7514, T7515, T7516, T7517, T7518, T7519, T7520, T7521, T7522, T7523, T7524, T7525, T7526, T7527, T7528, T7529, T7530, T7531, T7532, T7533, T7534, T7535, T7536, T7537, T7538, T7539, T7540, T7541, T7542, T7543, T7544, T7545, T7546, T7547, T7548, T7549, T7550, T7551, T7552, T7553, T7554, T7555, T7556, T7557, T7558, T7559, T7560, T7561, T7562, T7563, T7564, T7565, T7566, T7567, T7568, T7569, T7570, T7571, T7572, T7573, T7574, T7575, T7576, T7577, T7578, T7579, T7580, T7581, T7582, T7583, T7584, T7585, T7586, T7587, T7588, T7589, T7590, T7591, T7592, T7593, T7594, T7595, T7596, T7597, T7598, T7599, T7600, T7601, T7602, T7603, T7604, T7605, T7606, T7607, T7608, T7609, T7610, T7611, T7612, T7613, T7614, T7615, T7616, T7617, T7618, T7619, T7620, T7621, T7622, T7623, T7624, T7625, T7626, T7627, T7628, T7629, T7630, T7631, T7632, T7633, T7634, T7635, T7636, T7637, T7638, T7639, T7640, T7641, T7642, T7643, T7644, T7645, T7646, T7647, T7648, T7649, T7650, T7651, T7652, T7653, T7654, T7655, T7656, T7657, T7658, T7659, T7660, T7661, T7662, T7663, T7664, T7665, T7666, T7667, T7668, T7669, T7670, T7671, T7672, T7673, T7674, T7675, T7676, T7677, T7678, T7679, T7680, T7681, T7682, T7683, T7684, T7685, T7686, T7687, T7688, T7689, T7690, T7691, T7692, T7693, T7694, T7695, T7696, T7697, T7698, T7699, T7700, T7701, T7702, T7703, T7704, T7705, T7706, T7707, T7708, T7709, T7710, T7711, T7712, T7713, T7714, T7715, T7716, T7717, T7718, T7719, T7720, T7721, T7722, T7723, T7724, T7725, T7726, T7727, T7728, T7729, T7730, T7731, T7732, T7733, T7734, T7735, T7736, T7737, T7738, T7739, T7740, T7741, T7742, T7743, T7744, T7745, T7746, T7747, T7748, T7749, T7750, T7751, T7752, T7753, T7754, T7755, T7756, T7757, T7758, T7759, T7760, T7761, T7762, T7763, T7764, T7765, T7766, T7767, T7768, T7769, T7770, T7771, T7772, T7773, T7774, T7775, T7776, T7777, T7778, T7779, T7780, T7781, T7782, T7783, T7784, T7785, T7786, T7787, T7788, T7789, T7790, T7791, T7792, T7793, T7794, T7795, T7796, T7797, T7798, T7799, T7800, T7801, T7802, T7803, T7804, T7805, T7806, T7807, T7808, T7809, T7810, T7811, T7812, T7813, T7814, T7815, T7816, T7817, T7818, T7819, T7820, T7821, T7822, T7823, T7824, T7825, T7826, T7827, T7828, T7829, T7830, T7831, T7832, T7833, T7834, T7835, T7836, T7837, T7838, T7839, T7840, T7841, T7842, T7843, T7844, T7845, T7846, T7847, T7848, T7849, T7850, T7851, T7852, T7853, T7854, T7855, T7856, T7857, T7858, T7859, T7860, T7861, T7862, T7863, T7864, T7865, T7866, T7867, T7868, T7869, T7870, T7871, T7872, T7873, T7874, T7875, T7876, T7877, T7878, T7879, T7880, T7881, T7882, T7883, T7884, T7885, T7886, T7887, T7888, T7889, T7890, T7891, T7892, T7893, T7894, T7895, T7896, T7897, T7898, T7899, T7900, T7901, T7902, T7903, T7904, T7905, T7906, T7907, T7908, T7909, T7910, T7911, T7912, T7913, T7914, T7915, T7916, T7917, T7918, T7919, T7920, T7921, T7922, T7923, T7924, T7925, T7926, T7927, T7928, T7929, T7930, T7931, T7932, T7933, T7934, T7935, T7936, T7937, T7938, T7939, T7940, T7941, T7942, T7943, T7944, T7945, T7946, T7947, T7948, T7949, T7950, T7951, T7952, T7953, T7954, T7955, T7956, T7957, T7958, T7959, T7960, T7961, T7962, T7963, T7964, T7965, T7966, T7967, T7968, T7969, T7970, T7971, T7972, T7973, T7974, T7975, T7976, T7977, T7978, T7979, T7980, T7981, T7982, T7983, T7984, T7985, T7986, T7987, T7988, T7989, T7990, T7991, T7992, T7993, T7994, T7995, T7996, T7997, T7998, T7999, T8000, T8001, T8002, T8003, T8004, T8005, T8006, T8007, T8008, T8009, T8010, T8011, T8012, T8013, T8014, T8015, T8016, T8017, T8018, T8019, T8020, T8021, T8022, T8023, T8024, T8025, T8026, T8027, T8028, T8029, T8030, T8031, T8032, T8033, T8034, T8035, T8036, T8037, T8038, T8039, T8040, T8041, T8042, T8043, T8044, T8045, T8046, T8047, T8048, T8049, T8050, T8051, T8052, T8053, T8054, T8055, T8056, T8057, T8058, T8059, T8060, T8061, T8062, T8063, T8064, T8065, T8066, T8067, T8068, T8069, T8070, T8071, T8072, T8073, T8074, T8075, T8076, T8077, T8078, T8079, T8080, T8081, T8082, T8083, T8084, T8085, T8086, T8087, T8088, T8089, T8090, T8091, T8092, T8093, T8094, T8095, T8096, T8097, T8098, T8099, T8100, T8101, T8102, T8103, T8104, T8105, T8106, T8107, T8108, T8109, T8110, T8111, T8112, T8113, T8114, T8115, T8116, T8117, T8118, T8119, T8120, T8121, T8122, T8123, T8124, T8125, T8126, T8127, T8128, T8129, T8130, T8131, T8132, T8133, T8134, T8135, T8136, T8137, T8138, T8139, T8140, T8141, T8142, T8143, T8144, T8145, T8146, T8147, T8148, T8149, T8150, T8151, T8152, T8153, T8154, T8155, T8156, T8157, T8158, T8159, T8160, T8161, T8162, T8163, T8164, T8165, T8166, T8167, T8168, T8169, T8170, T8171, T8172, T8173, T8174, T8175, T8176, T8177, T8178, T8179, T8180, T8181, T8182, T8183, T8184, T8185, T8186, T8187, T8188, T8189, T8190, T8191, T8192, T8193, T8194, T8195, T8196, T8197, T8198, T8199, T8200, T8201, T8202, T8203, T8204, T8205, T8206, T8207, T8208, T8209, T8210, T8211, T8212, T8213, T8214, T8215, T8216, T8217, T8218, T8219, T8220, T8221, T8222, T8223, T8224, T8225, T8226, T8227, T8228, T8229, T8230, T8231, T8232, T8233, T8234, T8235, T8236, T8237, T8238, T8239, T8240, T8241, T8242, T8243, T8244, T8245, T8246, T8247, T8248, T8249, T8250, T8251, T8252, T8253, T8254, T8255, T8256, T8257, T8258, T8259, T8260, T8261, T8262, T8263, T8264, T8265, T8266, T8267, T8268, T8269, T8270, T8271, T8272, T8273, T8274, T8275, T8276, T8277, T8278, T8279, T8280, T8281, T8282, T8283, T8284, T8285, T8286, T8287, T8288, T8289, T8290, T8291, T8292, T8293, T8294, T8295, T8296, T8297, T8298, T8299, T8300, T8301, T8302, T8303, T8304, T8305, T8306, T8307, T8308, T8309, T8310, T8311, T8312, T8313, T8314, T8315, T8316, T8317, T8318, T8319, T8320, T8321, T8322, T8323, T8324, T8325, T8326, T8327, T8328, T8329, T8330, T8331, T8332, T8333, T8334, T8335, T8336, T8337, T8338, T8339, T8340, T8341, T8342, T8343, T8344, T8345, T8346, T8347, T8348, T8349, T8350, T8351, T8352, T8353, T8354, T8355, T8356, T8357, T8358, T8359, T8360, T8361, T8362, T8363, T8364, T8365, T8366, T8367, T8368, T8369, T8370, T8371, T8372, T8373, T8374, T8375, T8376, T8377, T8378, T8379, T8380, T8381, T8382, T8383, T8384, T8385, T8386, T8387, T8388, T8389, T8390, T8391, T8392, T8393, T8394, T8395, T8396, T8397, T8398, T8399, T8400, T8401, T8402, T8403, T8404, T8405, T8406, T8407, T8408, T8409, T8410, T8411, T8412, T8413, T8414, T8415, T8416, T8417, T8418, T8419, T8420, T8421, T8422, T8423, T8424, T8425, T8426, T8427, T8428, T8429, T8430, T8431, T8432, T8433, T8434, T8435, T8436, T8437, T8438, T8439, T8440, T8441, T8442, T8443, T8444, T8445, T8446, T8447, T8448, T8449, T8450, T8451, T8452, T8453, T8454, T8455, T8456, T8457, T8458, T8459, T8460, T8461, T8462, T8463, T8464, T8465, T8466, T8467, T8468, T8469, T8470, T8471, T8472, T8473, T8474, T8475, T8476, T8477, T8478, T8479, T8480, T8481, T8482, T8483, T8484, T8485, T8486, T8487, T8488, T8489, T8490, T8491, T8492, T8493, T8494, T8495, T8496, T8497, T8498, T8499, T8500, T8501, T8502, T8503, T8504, T8505, T8506, T8507, T8508, T8509, T8510, T8511, T8512, T8513, T8514, T8515, T8516, T8517, T8518, T8519, T8520, T8521, T8522, T8523, T8524, T8525, T8526, T8527, T8528, T8529, T8530, T8531, T8532, T8533, T8534, T8535, T8536, T8537, T8538, T8539, T8540, T8541, T8542, T8543, T8544, T8545, T8546, T8547, T8548, T8549, T8550, T8551, T8552, T8553, T8554, T8555, T8556, T8557, T8558, T8559, T8560, T8561, T8562, T8563, T8564, T8565, T8566, T8567, T8568, T8569, T8570, T8571, T8572, T8573, T8574, T8575, T8576, T8577, T8578, T8579, T8580, T8581, T8582, T8583, T8584, T8585, T8586, T8587, T8588, T8589, T8590, T8591, T8592, T8593, T8594, T8595, T8596, T8597, T8598, T8599, T8600, T8601, T8602, T8603, T8604, T8605, T8606, T8607, T8608, T8609, T8610, T8611, T8612, T8613, T8614, T8615, T8616, T8617, T8618, T8619, T8620, T8621, T8622, T8623, T8624, T8625, T8626, T8627, T8628, T8629, T8630, T8631, T8632, T8633, T8634, T8635, T8636, T8637, T8638, T8639, T8640, T8641, T8642, T8643, T8644, T8645, T8646, T8647, T8648, T8649, T8650, T8651, T8652, T8653, T8654, T8655, T8656, T8657, T8658, T8659, T8660, T8661, T8662, T8663, T8664, T8665, T8666, T8667, T8668, T8669, T8670, T8671, T8672, T8673, T8674, T8675, T8676, T8677, T8678, T8679, T8680, T8681, T8682, T8683, T8684, T8685, T8686, T8687, T8688, T8689, T8690, T8691, T8692, T8693, T8694, T8695, T8696, T8697, T8698, T8699, T8700, T8701, T8702, T8703, T8704, T8705, T8706, T8707, T8708, T8709, T8710, T8711, T8712, T8713, T8714, T8715, T8716, T8717, T8718, T8719, T8720, T8721, T8722, T8723, T8724, T8725, T8726, T8727, T8728, T8729, T8730, T8731, T8732, T8733, T8734, T8735, T8736, T8737, T8738, T8739, T8740, T8741, T8742, T8743, T8744, T8745, T8746, T8747, T8748, T8749, T8750, T8751, T8752, T8753, T8754, T8755, T8756, T8757, T8758, T8759, T8760, T8761, T8762, T8763, T8764, T8765, T8766, T8767, T8768, T8769, T8770, T8771, T8772, T8773, T8774, T8775, T8776, T8777, T8778, T8779, T8780, T8781, T8782, T8783, T8784, T8785, T8786, T8787, T8788, T8789, T8790, T8791, T8792, T8793, T8794, T8795, T8796, T8797, T8798, T8799, T8800, T8801, T8802, T8803, T8804, T8805, T8806, T8807, T8808, T8809, T8810, T8811, T8812, T8813, T8814, T8815, T8816, T8817, T8818, T8819, T8820, T8821, T8822, T8823, T8824, T8825, T8826, T8827, T8828, T8829, T8830, T8831, T8832, T8833, T8834, T8835, T8836, T8837, T8838, T8839, T8840, T8841, T8842, T8843, T8844, T8845, T8846, T8847, T8848, T8849, T8850, T8851, T8852, T8853, T8854, T8855, T8856, T8857, T8858, T8859, T8860, T8861, T8862, T8863, T8864, T8865, T8866, T8867, T8868, T8869, T8870, T8871, T8872, T8873, T8874, T8875, T8876, T8877, T8878, T8879, T8880, T8881, T8882, T8883, T8884, T8885, T8886, T8887, T8888, T8889, T8890, T8891, T8892, T8893, T8894, T8895, T8896, T8897, T8898, T8899, T8900, T8901, T8902, T8903, T8904, T8905, T8906, T8907, T8908, T8909, T8910, T8911, T8912, T8913, T8914, T8915, T8916, T8917, T8918, T8919, T8920, T8921, T8922, T8923, T8924, T8925, T8926, T8927, T8928, T8929, T8930, T8931, T8932, T8933, T8934, T8935, T8936, T8937, T8938, T8939, T8940, T8941, T8942, T8943, T8944, T8945, T8946, T8947, T8948, T8949, T8950, T8951, T8952, T8953, T8954, T8955, T8956, T8957, T8958, T8959, T8960, T8961, T8962, T8963, T8964, T8965, T8966, T8967, T8968, T8969, T8970, T8971, T8972, T8973, T8974, T8975, T8976, T8977, T8978, T8979, T8980, T8981, T8982, T8983, T8984, T8985, T8986, T8987, T8988, T8989, T8990, T8991, T8992, T8993, T8994, T8995, T8996, T8997, T8998, T8999, T9000, T9001, T9002, T9003, T9004, T9005, T9006, T9007, T9008, T9009, T9010, T9011, T9012, T9013, T9014, T9015, T9016, T9017, T9018, T9019, T9020, T9021, T9022, T9023, T9024, T9025, T9026, T9027, T9028, T9029, T9030, T9031, T9032, T9033, T9034, T9035, T9036, T9037, T9038, T9039, T9040, T9041, T9042, T9043, T9044, T9045, T9046, T9047, T9048, T9049, T9050, T9051, T9052, T9053, T9054, T9055, T9056, T9057, T9058, T9059, T9060, T9061, T9062, T9063, T9064, T9065, T9066, T9067, T9068, T9069, T9070, T9071, T9072, T9073, T9074, T9075, T9076, T9077, T9078, T9079, T9080, T9081, T9082, T9083, T9084, T9085, T9086, T9087, T9088, T9089, T9090, T9091, T9092, T9093, T9094, T9095, T9096, T9097, T9098, T9099, T9100, T9101, T9102, T9103, T9104, T9105, T9106, T9107, T9108, T9109, T9110, T9111, T9112, T9113, T9114, T9115, T9116, T9117, T9118, T9119, T9120, T9121, T9122, T9123, T9124, T9125, T9126, T9127, T9128, T9129, T9130, T9131, T9132, T9133, T9134, T9135, T9136, T9137, T9138, T9139, T9140, T9141, T9142, T9143, T9144, T9145, T9146, T9147, T9148, T9149, T9150, T9151, T9152, T9153, T9154, T9155, T9156, T9157, T9158, T9159, T9160, T9161, T9162, T9163, T9164, T9165, T9166, T9167, T9168, T9169, T9170, T9171, T9172, T9173, T9174, T9175, T9176, T9177, T9178, T9179, T9180, T9181, T9182, T9183, T9184, T9185, T9186, T9187, T9188, T9189, T9190, T9191, T9192, T9193, T9194, T9195, T9196, T9197, T9198, T9199, T9200, T9201, T9202, T9203, T9204, T9205, T9206, T9207, T9208, T9209, T9210, T9211, T9212, T9213, T9214, T9215, T9216, T9217, T9218, T9219, T9220, T9221, T9222, T9223, T9224, T9225, T9226, T9227, T9228, T9229, T9230, T9231, T9232, T9233, T9234, T9235, T9236, T9237, T9238, T9239, T9240, T9241, T9242, T9243, T9244, T9245, T9246, T9247, T9248, T9249, T9250, T9251, T9252, T9253, T9254, T9255, T9256, T9257, T9258, T9259, T9260, T9261, T9262, T9263, T9264, T9265, T9266, T9267, T9268, T9269, T9270, T9271, T9272, T9273, T9274, T9275, T9276, T9277, T9278, T9279, T9280, T9281, T9282, T9283, T9284, T9285, T9286, T9287, T9288, T9289, T9290, T9291, T9292, T9293, T9294, T9295, T9296, T9297, T9298, T9299, T9300, T9301, T9302, T9303, T9304, T9305, T9306, T9307, T9308, T9309, T9310, T9311, T9312, T9313, T9314, T9315, T9316, T9317, T9318, T9319, T9320, T9321, T9322, T9323, T9324, T9325, T9326, T9327, T9328, T9329, T9330, T9331, T9332, T9333, T9334, T9335, T9336, T9337, T9338, T9339, T9340, T9341, T9342, T9343, T9344, T9345, T9346, T9347, T9348, T9349, T9350, T9351, T9352, T9353, T9354, T9355, T9356, T9357, T9358, T9359, T9360, T9361, T9362, T9363, T9364, T9365, T9366, T9367, T9368, T9369, T9370, T9371, T9372, T9373, T9374, T9375, T9376, T9377, T9378, T9379, T9380, T9381, T9382, T9383, T9384, T9385, T9386, T9387, T9388, T9389, T9390, T9391, T9392, T9393, T9394, T9395, T9396, T9397, T9398, T9399, T9400, T9401, T9402, T9403, T9404, T9405, T9406, T9407, T9408, T9409, T9410, T9411, T9412, T9413, T9414, T9415, T9416, T9417, T9418, T9419, T9420, T9421, T9422, T9423, T9424, T9425, T9426, T9427, T9428, T9429, T9430, T9431, T9432, T9433, T9434, T9435, T9436, T9437, T9438, T9439, T9440, T9441, T9442, T9443, T9444, T9445, T9446, T9447, T9448, T9449, T9450, T9451, T9452, T9453, T9454, T9455, T9456, T9457, T9458, T9459, T9460, T9461, T9462, T9463, T9464, T9465, T9466, T9467, T9468, T9469, T9470, T9471, T9472, T9473, T9474, T9475, T9476, T9477, T9478, T9479, T9480, T9481, T9482, T9483, T9484, T9485, T9486, T9487, T9488, T9489, T9490, T9491, T9492, T9493, T9494, T9495, T9496, T9497, T9498, T9499, T9500, T9501, T9502, T9503, T9504, T9505, T9506, T9507, T9508, T9509, T9510, T9511, T9512, T9513, T9514, T9515, T9516, T9517, T9518, T9519, T9520, T9521, T9522, T9523, T9524, T9525, T9526, T9527, T9528, T9529, T9530, T9531, T9532, T9533, T9534, T9535, T9536, T9537, T9538, T9539, T9540, T9541, T9542, T9543, T9544, T9545, T9546, T9547, T9548, T9549, T9550, T9551, T9552, T9553, T9554, T9555, T9556, T9557, T9558, T9559, T9560, T9561, T9562, T9563, T9564, T9565, T9566, T9567, T9568, T9569, T9570, T9571, T9572, T9573, T9574, T9575, T9576, T9577, T9578, T9579, T9580, T9581, T9582, T9583, T9584, T9585, T9586, T9587, T9588, T9589, T9590, T9591, T9592, T9593, T9594, T9595, T9596, T9597, T9598, T9599, T9600, T9601, T9602, T9603, T9604, T9605, T9606, T9607, T9608, T9609, T9610, T9611, T9612, T9613, T9614, T9615, T9616, T9617, T9618, T9619, T9620, T9621, T9622, T9623, T9624, T9625, T9626, T9627, T9628, T9629, T9630, T9631, T9632, T9633, T9634, T9635, T9636, T9637, T9638, T9639, T9640, T9641, T9642, T9643, T9644, T9645, T9646, T9647, T9648, T9649, T9650, T9651, T9652, T9653, T9654, T9655, T9656, T9657, T9658, T9659, T9660, T9661, T9662, T9663, T9664, T9665, T9666, T9667, T9668, T9669, T9670, T9671, T9672, T9673, T9674, T9675, T9676, T9677, T9678, T9679, T9680, T9681, T9682, T9683, T9684, T9685, T9686, T9687, T9688, T9689, T9690, T9691, T9692, T9693, T9694, T9695, T9696, T9697, T9698, T9699, T9700, T9701, T9702, T9703, T9704, T9705, T9706, T9707, T9708, T9709, T9710, T9711, T9712, T9713, T9714, T9715, T9716, T9717, T9718, T9719, T9720, T9721, T9722, T9723, T9724, T9725, T9726, T9727, T9728, T9729, T9730, T9731, T9732, T9733, T9734, T9735, T9736, T9737, T9738, T9739, T9740, T9741, T9742, T9743, T9744, T9745, T9746, T9747, T9748, T9749, T9750, T9751, T9752, T9753, T9754, T9755, T9756, T9757, T9758, T9759, T9760, T9761, T9762, T9763, T9764, T9765, T9766, T9767, T9768, T9769, T9770, T9771, T9772, T9773, T9774, T9775, T9776, T9777, T9778, T9779, T9780, T9781, T9782, T9783, T9784, T9785, T9786, T9787, T9788, T9789, T9790, T9791, T9792, T9793, T9794, T9795, T9796, T9797, T9798, T9799, T9800, T9801, T9802, T9803, T9804, T9805, T9806, T9807, T9808, T9809, T9810, T9811, T9812, T9813, T9814, T9815, T9816, T9817, T9818, T9819, T9820, T9821, T9822, T9823, T9824, T9825, T9826, T9827, T9828, T9829, T9830, T9831, T9832, T9833, T9834, T9835, T9836, T9837, T9838, T9839, T9840, T9841, T9842, T9843, T9844, T9845, T9846, T9847, T9848, T9849, T9850, T9851, T9852, T9853, T9854, T9855, T9856, T9857, T9858, T9859, T9860, T9861, T9862, T9863, T9864, T9865, T9866, T9867, T9868, T9869, T9870, T9871, T9872, T9873, T9874, T9875, T9876, T9877, T9878, T9879, T9880, T9881, T9882, T9883, T9884, T9885, T9886, T9887, T9888, T9889, T9890, T9891, T9892, T9893, T9894, T9895, T9896, T9897, T9898, T9899, T9900, T9901, T9902, T9903, T9904, T9905, T9906, T9907, T9908, T9909, T9910, T9911, T9912, T9913, T9914, T9915, T9916, T9917, T9918, T9919, T9920, T9921, T9922, T9923, T9924, T9925, T9926, T9927, T9928, T9929, T9930, T9931, T9932, T9933, T9934, T9935, T9936, T9937, T9938, T9939, T9940, T9941, T9942, T9943, T9944, T9945, T9946, T9947, T9948, T9949, T9950, T9951, T9952, T9953, T9954, T9955, T9956, T9957, T9958, T9959, T9960, T9961, T9962, T9963, T9964, T9965, T9966, T9967, T9968, T9969, T9970, T9971, T9972, T9973, T9974, T9975, T9976, T9977, T9978, T9979, T9980, T9981, T9982, T9983, T9984, T9985, T9986, T9987, T9988, T9989, T9990, T9991, T9992, T9993, T9994, T9995, T9996, T9997, T9998, T9999>{ public void method1<M0, M1, M2, M3, M4, M5, M6, M7, M8, M9, M10, M11, M12, M13, M14, M15, M16, M17, M18, M19, M20, M21, M22, M23, M24, M25, M26, M27, M28, M29, M30, M31, M32, M33, M34, M35, M36, M37, M38, M39, M40, M41, M42, M43, M44, M45, M46, M47, M48, M49, M50, M51, M52, M53, M54, M55, M56, M57, M58, M59, M60, M61, M62, M63, M64, M65, M66, M67, M68, M69, M70, M71, M72, M73, M74, M75, M76, M77, M78, M79, M80, M81, M82, M83, M84, M85, M86, M87, M88, M89, M90, M91, M92, M93, M94, M95, M96, M97, M98, M99, M100, M101, M102, M103, M104, M105, M106, M107, M108, M109, M110, M111, M112, M113, M114, M115, M116, M117, M118, M119, M120, M121, M122, M123, M124, M125, M126, M127, M128, M129, M130, M131, M132, M133, M134, M135, M136, M137, M138, M139, M140, M141, M142, M143, M144, M145, M146, M147, M148, M149, M150, M151, M152, M153, M154, M155, M156, M157, M158, M159, M160, M161, M162, M163, M164, M165, M166, M167, M168, M169, M170, M171, M172, M173, M174, M175, M176, M177, M178, M179, M180, M181, M182, M183, M184, M185, M186, M187, M188, M189, M190, M191, M192, M193, M194, M195, M196, M197, M198, M199, M200, M201, M202, M203, M204, M205, M206, M207, M208, M209, M210, M211, M212, M213, M214, M215, M216, M217, M218, M219, M220, M221, M222, M223, M224, M225, M226, M227, M228, M229, M230, M231, M232, M233, M234, M235, M236, M237, M238, M239, M240, M241, M242, M243, M244, M245, M246, M247, M248, M249, M250, M251, M252, M253, M254, M255, M256, M257, M258, M259, M260, M261, M262, M263, M264, M265, M266, M267, M268, M269, M270, M271, M272, M273, M274, M275, M276, M277, M278, M279, M280, M281, M282, M283, M284, M285, M286, M287, M288, M289, M290, M291, M292, M293, M294, M295, M296, M297, M298, M299, M300, M301, M302, M303, M304, M305, M306, M307, M308, M309, M310, M311, M312, M313, M314, M315, M316, M317, M318, M319, M320, M321, M322, M323, M324, M325, M326, M327, M328, M329, M330, M331, M332, M333, M334, M335, M336, M337, M338, M339, M340, M341, M342, M343, M344, M345, M346, M347, M348, M349, M350, M351, M352, M353, M354, M355, M356, M357, M358, M359, M360, M361, M362, M363, M364, M365, M366, M367, M368, M369, M370, M371, M372, M373, M374, M375, M376, M377, M378, M379, M380, M381, M382, M383, M384, M385, M386, M387, M388, M389, M390, M391, M392, M393, M394, M395, M396, M397, M398, M399, M400, M401, M402, M403, M404, M405, M406, M407, M408, M409, M410, M411, M412, M413, M414, M415, M416, M417, M418, M419, M420, M421, M422, M423, M424, M425, M426, M427, M428, M429, M430, M431, M432, M433, M434, M435, M436, M437, M438, M439, M440, M441, M442, M443, M444, M445, M446, M447, M448, M449, M450, M451, M452, M453, M454, M455, M456, M457, M458, M459, M460, M461, M462, M463, M464, M465, M466, M467, M468, M469, M470, M471, M472, M473, M474, M475, M476, M477, M478, M479, M480, M481, M482, M483, M484, M485, M486, M487, M488, M489, M490, M491, M492, M493, M494, M495, M496, M497, M498, M499, M500, M501, M502, M503, M504, M505, M506, M507, M508, M509, M510, M511, M512, M513, M514, M515, M516, M517, M518, M519, M520, M521, M522, M523, M524, M525, M526, M527, M528, M529, M530, M531, M532, M533, M534, M535, M536, M537, M538, M539, M540, M541, M542, M543, M544, M545, M546, M547, M548, M549, M550, M551, M552, M553, M554, M555, M556, M557, M558, M559, M560, M561, M562, M563, M564, M565, M566, M567, M568, M569, M570, M571, M572, M573, M574, M575, M576, M577, M578, M579, M580, M581, M582, M583, M584, M585, M586, M587, M588, M589, M590, M591, M592, M593, M594, M595, M596, M597, M598, M599, M600, M601, M602, M603, M604, M605, M606, M607, M608, M609, M610, M611, M612, M613, M614, M615, M616, M617, M618, M619, M620, M621, M622, M623, M624, M625, M626, M627, M628, M629, M630, M631, M632, M633, M634, M635, M636, M637, M638, M639, M640, M641, M642, M643, M644, M645, M646, M647, M648, M649, M650, M651, M652, M653, M654, M655, M656, M657, M658, M659, M660, M661, M662, M663, M664, M665, M666, M667, M668, M669, M670, M671, M672, M673, M674, M675, M676, M677, M678, M679, M680, M681, M682, M683, M684, M685, M686, M687, M688, M689, M690, M691, M692, M693, M694, M695, M696, M697, M698, M699, M700, M701, M702, M703, M704, M705, M706, M707, M708, M709, M710, M711, M712, M713, M714, M715, M716, M717, M718, M719, M720, M721, M722, M723, M724, M725, M726, M727, M728, M729, M730, M731, M732, M733, M734, M735, M736, M737, M738, M739, M740, M741, M742, M743, M744, M745, M746, M747, M748, M749, M750, M751, M752, M753, M754, M755, M756, M757, M758, M759, M760, M761, M762, M763, M764, M765, M766, M767, M768, M769, M770, M771, M772, M773, M774, M775, M776, M777, M778, M779, M780, M781, M782, M783, M784, M785, M786, M787, M788, M789, M790, M791, M792, M793, M794, M795, M796, M797, M798, M799, M800, M801, M802, M803, M804, M805, M806, M807, M808, M809, M810, M811, M812, M813, M814, M815, M816, M817, M818, M819, M820, M821, M822, M823, M824, M825, M826, M827, M828, M829, M830, M831, M832, M833, M834, M835, M836, M837, M838, M839, M840, M841, M842, M843, M844, M845, M846, M847, M848, M849, M850, M851, M852, M853, M854, M855, M856, M857, M858, M859, M860, M861, M862, M863, M864, M865, M866, M867, M868, M869, M870, M871, M872, M873, M874, M875, M876, M877, M878, M879, M880, M881, M882, M883, M884, M885, M886, M887, M888, M889, M890, M891, M892, M893, M894, M895, M896, M897, M898, M899, M900, M901, M902, M903, M904, M905, M906, M907, M908, M909, M910, M911, M912, M913, M914, M915, M916, M917, M918, M919, M920, M921, M922, M923, M924, M925, M926, M927, M928, M929, M930, M931, M932, M933, M934, M935, M936, M937, M938, M939, M940, M941, M942, M943, M944, M945, M946, M947, M948, M949, M950, M951, M952, M953, M954, M955, M956, M957, M958, M959, M960, M961, M962, M963, M964, M965, M966, M967, M968, M969, M970, M971, M972, M973, M974, M975, M976, M977, M978, M979, M980, M981, M982, M983, M984, M985, M986, M987, M988, M989, M990, M991, M992, M993, M994, M995, M996, M997, M998, M999, M1000, M1001, M1002, M1003, M1004, M1005, M1006, M1007, M1008, M1009, M1010, M1011, M1012, M1013, M1014, M1015, M1016, M1017, M1018, M1019, M1020, M1021, M1022, M1023, M1024, M1025, M1026, M1027, M1028, M1029, M1030, M1031, M1032, M1033, M1034, M1035, M1036, M1037, M1038, M1039, M1040, M1041, M1042, M1043, M1044, M1045, M1046, M1047, M1048, M1049, M1050, M1051, M1052, M1053, M1054, M1055, M1056, M1057, M1058, M1059, M1060, M1061, M1062, M1063, M1064, M1065, M1066, M1067, M1068, M1069, M1070, M1071, M1072, M1073, M1074, M1075, M1076, M1077, M1078, M1079, M1080, M1081, M1082, M1083, M1084, M1085, M1086, M1087, M1088, M1089, M1090, M1091, M1092, M1093, M1094, M1095, M1096, M1097, M1098, M1099, M1100, M1101, M1102, M1103, M1104, M1105, M1106, M1107, M1108, M1109, M1110, M1111, M1112, M1113, M1114, M1115, M1116, M1117, M1118, M1119, M1120, M1121, M1122, M1123, M1124, M1125, M1126, M1127, M1128, M1129, M1130, M1131, M1132, M1133, M1134, M1135, M1136, M1137, M1138, M1139, M1140, M1141, M1142, M1143, M1144, M1145, M1146, M1147, M1148, M1149, M1150, M1151, M1152, M1153, M1154, M1155, M1156, M1157, M1158, M1159, M1160, M1161, M1162, M1163, M1164, M1165, M1166, M1167, M1168, M1169, M1170, M1171, M1172, M1173, M1174, M1175, M1176, M1177, M1178, M1179, M1180, M1181, M1182, M1183, M1184, M1185, M1186, M1187, M1188, M1189, M1190, M1191, M1192, M1193, M1194, M1195, M1196, M1197, M1198, M1199, M1200, M1201, M1202, M1203, M1204, M1205, M1206, M1207, M1208, M1209, M1210, M1211, M1212, M1213, M1214, M1215, M1216, M1217, M1218, M1219, M1220, M1221, M1222, M1223, M1224, M1225, M1226, M1227, M1228, M1229, M1230, M1231, M1232, M1233, M1234, M1235, M1236, M1237, M1238, M1239, M1240, M1241, M1242, M1243, M1244, M1245, M1246, M1247, M1248, M1249, M1250, M1251, M1252, M1253, M1254, M1255, M1256, M1257, M1258, M1259, M1260, M1261, M1262, M1263, M1264, M1265, M1266, M1267, M1268, M1269, M1270, M1271, M1272, M1273, M1274, M1275, M1276, M1277, M1278, M1279, M1280, M1281, M1282, M1283, M1284, M1285, M1286, M1287, M1288, M1289, M1290, M1291, M1292, M1293, M1294, M1295, M1296, M1297, M1298, M1299, M1300, M1301, M1302, M1303, M1304, M1305, M1306, M1307, M1308, M1309, M1310, M1311, M1312, M1313, M1314, M1315, M1316, M1317, M1318, M1319, M1320, M1321, M1322, M1323, M1324, M1325, M1326, M1327, M1328, M1329, M1330, M1331, M1332, M1333, M1334, M1335, M1336, M1337, M1338, M1339, M1340, M1341, M1342, M1343, M1344, M1345, M1346, M1347, M1348, M1349, M1350, M1351, M1352, M1353, M1354, M1355, M1356, M1357, M1358, M1359, M1360, M1361, M1362, M1363, M1364, M1365, M1366, M1367, M1368, M1369, M1370, M1371, M1372, M1373, M1374, M1375, M1376, M1377, M1378, M1379, M1380, M1381, M1382, M1383, M1384, M1385, M1386, M1387, M1388, M1389, M1390, M1391, M1392, M1393, M1394, M1395, M1396, M1397, M1398, M1399, M1400, M1401, M1402, M1403, M1404, M1405, M1406, M1407, M1408, M1409, M1410, M1411, M1412, M1413, M1414, M1415, M1416, M1417, M1418, M1419, M1420, M1421, M1422, M1423, M1424, M1425, M1426, M1427, M1428, M1429, M1430, M1431, M1432, M1433, M1434, M1435, M1436, M1437, M1438, M1439, M1440, M1441, M1442, M1443, M1444, M1445, M1446, M1447, M1448, M1449, M1450, M1451, M1452, M1453, M1454, M1455, M1456, M1457, M1458, M1459, M1460, M1461, M1462, M1463, M1464, M1465, M1466, M1467, M1468, M1469, M1470, M1471, M1472, M1473, M1474, M1475, M1476, M1477, M1478, M1479, M1480, M1481, M1482, M1483, M1484, M1485, M1486, M1487, M1488, M1489, M1490, M1491, M1492, M1493, M1494, M1495, M1496, M1497, M1498, M1499, M1500, M1501, M1502, M1503, M1504, M1505, M1506, M1507, M1508, M1509, M1510, M1511, M1512, M1513, M1514, M1515, M1516, M1517, M1518, M1519, M1520, M1521, M1522, M1523, M1524, M1525, M1526, M1527, M1528, M1529, M1530, M1531, M1532, M1533, M1534, M1535, M1536, M1537, M1538, M1539, M1540, M1541, M1542, M1543, M1544, M1545, M1546, M1547, M1548, M1549, M1550, M1551, M1552, M1553, M1554, M1555, M1556, M1557, M1558, M1559, M1560, M1561, M1562, M1563, M1564, M1565, M1566, M1567, M1568, M1569, M1570, M1571, M1572, M1573, M1574, M1575, M1576, M1577, M1578, M1579, M1580, M1581, M1582, M1583, M1584, M1585, M1586, M1587, M1588, M1589, M1590, M1591, M1592, M1593, M1594, M1595, M1596, M1597, M1598, M1599, M1600, M1601, M1602, M1603, M1604, M1605, M1606, M1607, M1608, M1609, M1610, M1611, M1612, M1613, M1614, M1615, M1616, M1617, M1618, M1619, M1620, M1621, M1622, M1623, M1624, M1625, M1626, M1627, M1628, M1629, M1630, M1631, M1632, M1633, M1634, M1635, M1636, M1637, M1638, M1639, M1640, M1641, M1642, M1643, M1644, M1645, M1646, M1647, M1648, M1649, M1650, M1651, M1652, M1653, M1654, M1655, M1656, M1657, M1658, M1659, M1660, M1661, M1662, M1663, M1664, M1665, M1666, M1667, M1668, M1669, M1670, M1671, M1672, M1673, M1674, M1675, M1676, M1677, M1678, M1679, M1680, M1681, M1682, M1683, M1684, M1685, M1686, M1687, M1688, M1689, M1690, M1691, M1692, M1693, M1694, M1695, M1696, M1697, M1698, M1699, M1700, M1701, M1702, M1703, M1704, M1705, M1706, M1707, M1708, M1709, M1710, M1711, M1712, M1713, M1714, M1715, M1716, M1717, M1718, M1719, M1720, M1721, M1722, M1723, M1724, M1725, M1726, M1727, M1728, M1729, M1730, M1731, M1732, M1733, M1734, M1735, M1736, M1737, M1738, M1739, M1740, M1741, M1742, M1743, M1744, M1745, M1746, M1747, M1748, M1749, M1750, M1751, M1752, M1753, M1754, M1755, M1756, M1757, M1758, M1759, M1760, M1761, M1762, M1763, M1764, M1765, M1766, M1767, M1768, M1769, M1770, M1771, M1772, M1773, M1774, M1775, M1776, M1777, M1778, M1779, M1780, M1781, M1782, M1783, M1784, M1785, M1786, M1787, M1788, M1789, M1790, M1791, M1792, M1793, M1794, M1795, M1796, M1797, M1798, M1799, M1800, M1801, M1802, M1803, M1804, M1805, M1806, M1807, M1808, M1809, M1810, M1811, M1812, M1813, M1814, M1815, M1816, M1817, M1818, M1819, M1820, M1821, M1822, M1823, M1824, M1825, M1826, M1827, M1828, M1829, M1830, M1831, M1832, M1833, M1834, M1835, M1836, M1837, M1838, M1839, M1840, M1841, M1842, M1843, M1844, M1845, M1846, M1847, M1848, M1849, M1850, M1851, M1852, M1853, M1854, M1855, M1856, M1857, M1858, M1859, M1860, M1861, M1862, M1863, M1864, M1865, M1866, M1867, M1868, M1869, M1870, M1871, M1872, M1873, M1874, M1875, M1876, M1877, M1878, M1879, M1880, M1881, M1882, M1883, M1884, M1885, M1886, M1887, M1888, M1889, M1890, M1891, M1892, M1893, M1894, M1895, M1896, M1897, M1898, M1899, M1900, M1901, M1902, M1903, M1904, M1905, M1906, M1907, M1908, M1909, M1910, M1911, M1912, M1913, M1914, M1915, M1916, M1917, M1918, M1919, M1920, M1921, M1922, M1923, M1924, M1925, M1926, M1927, M1928, M1929, M1930, M1931, M1932, M1933, M1934, M1935, M1936, M1937, M1938, M1939, M1940, M1941, M1942, M1943, M1944, M1945, M1946, M1947, M1948, M1949, M1950, M1951, M1952, M1953, M1954, M1955, M1956, M1957, M1958, M1959, M1960, M1961, M1962, M1963, M1964, M1965, M1966, M1967, M1968, M1969, M1970, M1971, M1972, M1973, M1974, M1975, M1976, M1977, M1978, M1979, M1980, M1981, M1982, M1983, M1984, M1985, M1986, M1987, M1988, M1989, M1990, M1991, M1992, M1993, M1994, M1995, M1996, M1997, M1998, M1999, M2000, M2001, M2002, M2003, M2004, M2005, M2006, M2007, M2008, M2009, M2010, M2011, M2012, M2013, M2014, M2015, M2016, M2017, M2018, M2019, M2020, M2021, M2022, M2023, M2024, M2025, M2026, M2027, M2028, M2029, M2030, M2031, M2032, M2033, M2034, M2035, M2036, M2037, M2038, M2039, M2040, M2041, M2042, M2043, M2044, M2045, M2046, M2047, M2048, M2049, M2050, M2051, M2052, M2053, M2054, M2055, M2056, M2057, M2058, M2059, M2060, M2061, M2062, M2063, M2064, M2065, M2066, M2067, M2068, M2069, M2070, M2071, M2072, M2073, M2074, M2075, M2076, M2077, M2078, M2079, M2080, M2081, M2082, M2083, M2084, M2085, M2086, M2087, M2088, M2089, M2090, M2091, M2092, M2093, M2094, M2095, M2096, M2097, M2098, M2099, M2100, M2101, M2102, M2103, M2104, M2105, M2106, M2107, M2108, M2109, M2110, M2111, M2112, M2113, M2114, M2115, M2116, M2117, M2118, M2119, M2120, M2121, M2122, M2123, M2124, M2125, M2126, M2127, M2128, M2129, M2130, M2131, M2132, M2133, M2134, M2135, M2136, M2137, M2138, M2139, M2140, M2141, M2142, M2143, M2144, M2145, M2146, M2147, M2148, M2149, M2150, M2151, M2152, M2153, M2154, M2155, M2156, M2157, M2158, M2159, M2160, M2161, M2162, M2163, M2164, M2165, M2166, M2167, M2168, M2169, M2170, M2171, M2172, M2173, M2174, M2175, M2176, M2177, M2178, M2179, M2180, M2181, M2182, M2183, M2184, M2185, M2186, M2187, M2188, M2189, M2190, M2191, M2192, M2193, M2194, M2195, M2196, M2197, M2198, M2199, M2200, M2201, M2202, M2203, M2204, M2205, M2206, M2207, M2208, M2209, M2210, M2211, M2212, M2213, M2214, M2215, M2216, M2217, M2218, M2219, M2220, M2221, M2222, M2223, M2224, M2225, M2226, M2227, M2228, M2229, M2230, M2231, M2232, M2233, M2234, M2235, M2236, M2237, M2238, M2239, M2240, M2241, M2242, M2243, M2244, M2245, M2246, M2247, M2248, M2249, M2250, M2251, M2252, M2253, M2254, M2255, M2256, M2257, M2258, M2259, M2260, M2261, M2262, M2263, M2264, M2265, M2266, M2267, M2268, M2269, M2270, M2271, M2272, M2273, M2274, M2275, M2276, M2277, M2278, M2279, M2280, M2281, M2282, M2283, M2284, M2285, M2286, M2287, M2288, M2289, M2290, M2291, M2292, M2293, M2294, M2295, M2296, M2297, M2298, M2299, M2300, M2301, M2302, M2303, M2304, M2305, M2306, M2307, M2308, M2309, M2310, M2311, M2312, M2313, M2314, M2315, M2316, M2317, M2318, M2319, M2320, M2321, M2322, M2323, M2324, M2325, M2326, M2327, M2328, M2329, M2330, M2331, M2332, M2333, M2334, M2335, M2336, M2337, M2338, M2339, M2340, M2341, M2342, M2343, M2344, M2345, M2346, M2347, M2348, M2349, M2350, M2351, M2352, M2353, M2354, M2355, M2356, M2357, M2358, M2359, M2360, M2361, M2362, M2363, M2364, M2365, M2366, M2367, M2368, M2369, M2370, M2371, M2372, M2373, M2374, M2375, M2376, M2377, M2378, M2379, M2380, M2381, M2382, M2383, M2384, M2385, M2386, M2387, M2388, M2389, M2390, M2391, M2392, M2393, M2394, M2395, M2396, M2397, M2398, M2399, M2400, M2401, M2402, M2403, M2404, M2405, M2406, M2407, M2408, M2409, M2410, M2411, M2412, M2413, M2414, M2415, M2416, M2417, M2418, M2419, M2420, M2421, M2422, M2423, M2424, M2425, M2426, M2427, M2428, M2429, M2430, M2431, M2432, M2433, M2434, M2435, M2436, M2437, M2438, M2439, M2440, M2441, M2442, M2443, M2444, M2445, M2446, M2447, M2448, M2449, M2450, M2451, M2452, M2453, M2454, M2455, M2456, M2457, M2458, M2459, M2460, M2461, M2462, M2463, M2464, M2465, M2466, M2467, M2468, M2469, M2470, M2471, M2472, M2473, M2474, M2475, M2476, M2477, M2478, M2479, M2480, M2481, M2482, M2483, M2484, M2485, M2486, M2487, M2488, M2489, M2490, M2491, M2492, M2493, M2494, M2495, M2496, M2497, M2498, M2499, M2500, M2501, M2502, M2503, M2504, M2505, M2506, M2507, M2508, M2509, M2510, M2511, M2512, M2513, M2514, M2515, M2516, M2517, M2518, M2519, M2520, M2521, M2522, M2523, M2524, M2525, M2526, M2527, M2528, M2529, M2530, M2531, M2532, M2533, M2534, M2535, M2536, M2537, M2538, M2539, M2540, M2541, M2542, M2543, M2544, M2545, M2546, M2547, M2548, M2549, M2550, M2551, M2552, M2553, M2554, M2555, M2556, M2557, M2558, M2559, M2560, M2561, M2562, M2563, M2564, M2565, M2566, M2567, M2568, M2569, M2570, M2571, M2572, M2573, M2574, M2575, M2576, M2577, M2578, M2579, M2580, M2581, M2582, M2583, M2584, M2585, M2586, M2587, M2588, M2589, M2590, M2591, M2592, M2593, M2594, M2595, M2596, M2597, M2598, M2599, M2600, M2601, M2602, M2603, M2604, M2605, M2606, M2607, M2608, M2609, M2610, M2611, M2612, M2613, M2614, M2615, M2616, M2617, M2618, M2619, M2620, M2621, M2622, M2623, M2624, M2625, M2626, M2627, M2628, M2629, M2630, M2631, M2632, M2633, M2634, M2635, M2636, M2637, M2638, M2639, M2640, M2641, M2642, M2643, M2644, M2645, M2646, M2647, M2648, M2649, M2650, M2651, M2652, M2653, M2654, M2655, M2656, M2657, M2658, M2659, M2660, M2661, M2662, M2663, M2664, M2665, M2666, M2667, M2668, M2669, M2670, M2671, M2672, M2673, M2674, M2675, M2676, M2677, M2678, M2679, M2680, M2681, M2682, M2683, M2684, M2685, M2686, M2687, M2688, M2689, M2690, M2691, M2692, M2693, M2694, M2695, M2696, M2697, M2698, M2699, M2700, M2701, M2702, M2703, M2704, M2705, M2706, M2707, M2708, M2709, M2710, M2711, M2712, M2713, M2714, M2715, M2716, M2717, M2718, M2719, M2720, M2721, M2722, M2723, M2724, M2725, M2726, M2727, M2728, M2729, M2730, M2731, M2732, M2733, M2734, M2735, M2736, M2737, M2738, M2739, M2740, M2741, M2742, M2743, M2744, M2745, M2746, M2747, M2748, M2749, M2750, M2751, M2752, M2753, M2754, M2755, M2756, M2757, M2758, M2759, M2760, M2761, M2762, M2763, M2764, M2765, M2766, M2767, M2768, M2769, M2770, M2771, M2772, M2773, M2774, M2775, M2776, M2777, M2778, M2779, M2780, M2781, M2782, M2783, M2784, M2785, M2786, M2787, M2788, M2789, M2790, M2791, M2792, M2793, M2794, M2795, M2796, M2797, M2798, M2799, M2800, M2801, M2802, M2803, M2804, M2805, M2806, M2807, M2808, M2809, M2810, M2811, M2812, M2813, M2814, M2815, M2816, M2817, M2818, M2819, M2820, M2821, M2822, M2823, M2824, M2825, M2826, M2827, M2828, M2829, M2830, M2831, M2832, M2833, M2834, M2835, M2836, M2837, M2838, M2839, M2840, M2841, M2842, M2843, M2844, M2845, M2846, M2847, M2848, M2849, M2850, M2851, M2852, M2853, M2854, M2855, M2856, M2857, M2858, M2859, M2860, M2861, M2862, M2863, M2864, M2865, M2866, M2867, M2868, M2869, M2870, M2871, M2872, M2873, M2874, M2875, M2876, M2877, M2878, M2879, M2880, M2881, M2882, M2883, M2884, M2885, M2886, M2887, M2888, M2889, M2890, M2891, M2892, M2893, M2894, M2895, M2896, M2897, M2898, M2899, M2900, M2901, M2902, M2903, M2904, M2905, M2906, M2907, M2908, M2909, M2910, M2911, M2912, M2913, M2914, M2915, M2916, M2917, M2918, M2919, M2920, M2921, M2922, M2923, M2924, M2925, M2926, M2927, M2928, M2929, M2930, M2931, M2932, M2933, M2934, M2935, M2936, M2937, M2938, M2939, M2940, M2941, M2942, M2943, M2944, M2945, M2946, M2947, M2948, M2949, M2950, M2951, M2952, M2953, M2954, M2955, M2956, M2957, M2958, M2959, M2960, M2961, M2962, M2963, M2964, M2965, M2966, M2967, M2968, M2969, M2970, M2971, M2972, M2973, M2974, M2975, M2976, M2977, M2978, M2979, M2980, M2981, M2982, M2983, M2984, M2985, M2986, M2987, M2988, M2989, M2990, M2991, M2992, M2993, M2994, M2995, M2996, M2997, M2998, M2999, M3000, M3001, M3002, M3003, M3004, M3005, M3006, M3007, M3008, M3009, M3010, M3011, M3012, M3013, M3014, M3015, M3016, M3017, M3018, M3019, M3020, M3021, M3022, M3023, M3024, M3025, M3026, M3027, M3028, M3029, M3030, M3031, M3032, M3033, M3034, M3035, M3036, M3037, M3038, M3039, M3040, M3041, M3042, M3043, M3044, M3045, M3046, M3047, M3048, M3049, M3050, M3051, M3052, M3053, M3054, M3055, M3056, M3057, M3058, M3059, M3060, M3061, M3062, M3063, M3064, M3065, M3066, M3067, M3068, M3069, M3070, M3071, M3072, M3073, M3074, M3075, M3076, M3077, M3078, M3079, M3080, M3081, M3082, M3083, M3084, M3085, M3086, M3087, M3088, M3089, M3090, M3091, M3092, M3093, M3094, M3095, M3096, M3097, M3098, M3099, M3100, M3101, M3102, M3103, M3104, M3105, M3106, M3107, M3108, M3109, M3110, M3111, M3112, M3113, M3114, M3115, M3116, M3117, M3118, M3119, M3120, M3121, M3122, M3123, M3124, M3125, M3126, M3127, M3128, M3129, M3130, M3131, M3132, M3133, M3134, M3135, M3136, M3137, M3138, M3139, M3140, M3141, M3142, M3143, M3144, M3145, M3146, M3147, M3148, M3149, M3150, M3151, M3152, M3153, M3154, M3155, M3156, M3157, M3158, M3159, M3160, M3161, M3162, M3163, M3164, M3165, M3166, M3167, M3168, M3169, M3170, M3171, M3172, M3173, M3174, M3175, M3176, M3177, M3178, M3179, M3180, M3181, M3182, M3183, M3184, M3185, M3186, M3187, M3188, M3189, M3190, M3191, M3192, M3193, M3194, M3195, M3196, M3197, M3198, M3199, M3200, M3201, M3202, M3203, M3204, M3205, M3206, M3207, M3208, M3209, M3210, M3211, M3212, M3213, M3214, M3215, M3216, M3217, M3218, M3219, M3220, M3221, M3222, M3223, M3224, M3225, M3226, M3227, M3228, M3229, M3230, M3231, M3232, M3233, M3234, M3235, M3236, M3237, M3238, M3239, M3240, M3241, M3242, M3243, M3244, M3245, M3246, M3247, M3248, M3249, M3250, M3251, M3252, M3253, M3254, M3255, M3256, M3257, M3258, M3259, M3260, M3261, M3262, M3263, M3264, M3265, M3266, M3267, M3268, M3269, M3270, M3271, M3272, M3273, M3274, M3275, M3276, M3277, M3278, M3279, M3280, M3281, M3282, M3283, M3284, M3285, M3286, M3287, M3288, M3289, M3290, M3291, M3292, M3293, M3294, M3295, M3296, M3297, M3298, M3299, M3300, M3301, M3302, M3303, M3304, M3305, M3306, M3307, M3308, M3309, M3310, M3311, M3312, M3313, M3314, M3315, M3316, M3317, M3318, M3319, M3320, M3321, M3322, M3323, M3324, M3325, M3326, M3327, M3328, M3329, M3330, M3331, M3332, M3333, M3334, M3335, M3336, M3337, M3338, M3339, M3340, M3341, M3342, M3343, M3344, M3345, M3346, M3347, M3348, M3349, M3350, M3351, M3352, M3353, M3354, M3355, M3356, M3357, M3358, M3359, M3360, M3361, M3362, M3363, M3364, M3365, M3366, M3367, M3368, M3369, M3370, M3371, M3372, M3373, M3374, M3375, M3376, M3377, M3378, M3379, M3380, M3381, M3382, M3383, M3384, M3385, M3386, M3387, M3388, M3389, M3390, M3391, M3392, M3393, M3394, M3395, M3396, M3397, M3398, M3399, M3400, M3401, M3402, M3403, M3404, M3405, M3406, M3407, M3408, M3409, M3410, M3411, M3412, M3413, M3414, M3415, M3416, M3417, M3418, M3419, M3420, M3421, M3422, M3423, M3424, M3425, M3426, M3427, M3428, M3429, M3430, M3431, M3432, M3433, M3434, M3435, M3436, M3437, M3438, M3439, M3440, M3441, M3442, M3443, M3444, M3445, M3446, M3447, M3448, M3449, M3450, M3451, M3452, M3453, M3454, M3455, M3456, M3457, M3458, M3459, M3460, M3461, M3462, M3463, M3464, M3465, M3466, M3467, M3468, M3469, M3470, M3471, M3472, M3473, M3474, M3475, M3476, M3477, M3478, M3479, M3480, M3481, M3482, M3483, M3484, M3485, M3486, M3487, M3488, M3489, M3490, M3491, M3492, M3493, M3494, M3495, M3496, M3497, M3498, M3499, M3500, M3501, M3502, M3503, M3504, M3505, M3506, M3507, M3508, M3509, M3510, M3511, M3512, M3513, M3514, M3515, M3516, M3517, M3518, M3519, M3520, M3521, M3522, M3523, M3524, M3525, M3526, M3527, M3528, M3529, M3530, M3531, M3532, M3533, M3534, M3535, M3536, M3537, M3538, M3539, M3540, M3541, M3542, M3543, M3544, M3545, M3546, M3547, M3548, M3549, M3550, M3551, M3552, M3553, M3554, M3555, M3556, M3557, M3558, M3559, M3560, M3561, M3562, M3563, M3564, M3565, M3566, M3567, M3568, M3569, M3570, M3571, M3572, M3573, M3574, M3575, M3576, M3577, M3578, M3579, M3580, M3581, M3582, M3583, M3584, M3585, M3586, M3587, M3588, M3589, M3590, M3591, M3592, M3593, M3594, M3595, M3596, M3597, M3598, M3599, M3600, M3601, M3602, M3603, M3604, M3605, M3606, M3607, M3608, M3609, M3610, M3611, M3612, M3613, M3614, M3615, M3616, M3617, M3618, M3619, M3620, M3621, M3622, M3623, M3624, M3625, M3626, M3627, M3628, M3629, M3630, M3631, M3632, M3633, M3634, M3635, M3636, M3637, M3638, M3639, M3640, M3641, M3642, M3643, M3644, M3645, M3646, M3647, M3648, M3649, M3650, M3651, M3652, M3653, M3654, M3655, M3656, M3657, M3658, M3659, M3660, M3661, M3662, M3663, M3664, M3665, M3666, M3667, M3668, M3669, M3670, M3671, M3672, M3673, M3674, M3675, M3676, M3677, M3678, M3679, M3680, M3681, M3682, M3683, M3684, M3685, M3686, M3687, M3688, M3689, M3690, M3691, M3692, M3693, M3694, M3695, M3696, M3697, M3698, M3699, M3700, M3701, M3702, M3703, M3704, M3705, M3706, M3707, M3708, M3709, M3710, M3711, M3712, M3713, M3714, M3715, M3716, M3717, M3718, M3719, M3720, M3721, M3722, M3723, M3724, M3725, M3726, M3727, M3728, M3729, M3730, M3731, M3732, M3733, M3734, M3735, M3736, M3737, M3738, M3739, M3740, M3741, M3742, M3743, M3744, M3745, M3746, M3747, M3748, M3749, M3750, M3751, M3752, M3753, M3754, M3755, M3756, M3757, M3758, M3759, M3760, M3761, M3762, M3763, M3764, M3765, M3766, M3767, M3768, M3769, M3770, M3771, M3772, M3773, M3774, M3775, M3776, M3777, M3778, M3779, M3780, M3781, M3782, M3783, M3784, M3785, M3786, M3787, M3788, M3789, M3790, M3791, M3792, M3793, M3794, M3795, M3796, M3797, M3798, M3799, M3800, M3801, M3802, M3803, M3804, M3805, M3806, M3807, M3808, M3809, M3810, M3811, M3812, M3813, M3814, M3815, M3816, M3817, M3818, M3819, M3820, M3821, M3822, M3823, M3824, M3825, M3826, M3827, M3828, M3829, M3830, M3831, M3832, M3833, M3834, M3835, M3836, M3837, M3838, M3839, M3840, M3841, M3842, M3843, M3844, M3845, M3846, M3847, M3848, M3849, M3850, M3851, M3852, M3853, M3854, M3855, M3856, M3857, M3858, M3859, M3860, M3861, M3862, M3863, M3864, M3865, M3866, M3867, M3868, M3869, M3870, M3871, M3872, M3873, M3874, M3875, M3876, M3877, M3878, M3879, M3880, M3881, M3882, M3883, M3884, M3885, M3886, M3887, M3888, M3889, M3890, M3891, M3892, M3893, M3894, M3895, M3896, M3897, M3898, M3899, M3900, M3901, M3902, M3903, M3904, M3905, M3906, M3907, M3908, M3909, M3910, M3911, M3912, M3913, M3914, M3915, M3916, M3917, M3918, M3919, M3920, M3921, M3922, M3923, M3924, M3925, M3926, M3927, M3928, M3929, M3930, M3931, M3932, M3933, M3934, M3935, M3936, M3937, M3938, M3939, M3940, M3941, M3942, M3943, M3944, M3945, M3946, M3947, M3948, M3949, M3950, M3951, M3952, M3953, M3954, M3955, M3956, M3957, M3958, M3959, M3960, M3961, M3962, M3963, M3964, M3965, M3966, M3967, M3968, M3969, M3970, M3971, M3972, M3973, M3974, M3975, M3976, M3977, M3978, M3979, M3980, M3981, M3982, M3983, M3984, M3985, M3986, M3987, M3988, M3989, M3990, M3991, M3992, M3993, M3994, M3995, M3996, M3997, M3998, M3999, M4000, M4001, M4002, M4003, M4004, M4005, M4006, M4007, M4008, M4009, M4010, M4011, M4012, M4013, M4014, M4015, M4016, M4017, M4018, M4019, M4020, M4021, M4022, M4023, M4024, M4025, M4026, M4027, M4028, M4029, M4030, M4031, M4032, M4033, M4034, M4035, M4036, M4037, M4038, M4039, M4040, M4041, M4042, M4043, M4044, M4045, M4046, M4047, M4048, M4049, M4050, M4051, M4052, M4053, M4054, M4055, M4056, M4057, M4058, M4059, M4060, M4061, M4062, M4063, M4064, M4065, M4066, M4067, M4068, M4069, M4070, M4071, M4072, M4073, M4074, M4075, M4076, M4077, M4078, M4079, M4080, M4081, M4082, M4083, M4084, M4085, M4086, M4087, M4088, M4089, M4090, M4091, M4092, M4093, M4094, M4095, M4096, M4097, M4098, M4099, M4100, M4101, M4102, M4103, M4104, M4105, M4106, M4107, M4108, M4109, M4110, M4111, M4112, M4113, M4114, M4115, M4116, M4117, M4118, M4119, M4120, M4121, M4122, M4123, M4124, M4125, M4126, M4127, M4128, M4129, M4130, M4131, M4132, M4133, M4134, M4135, M4136, M4137, M4138, M4139, M4140, M4141, M4142, M4143, M4144, M4145, M4146, M4147, M4148, M4149, M4150, M4151, M4152, M4153, M4154, M4155, M4156, M4157, M4158, M4159, M4160, M4161, M4162, M4163, M4164, M4165, M4166, M4167, M4168, M4169, M4170, M4171, M4172, M4173, M4174, M4175, M4176, M4177, M4178, M4179, M4180, M4181, M4182, M4183, M4184, M4185, M4186, M4187, M4188, M4189, M4190, M4191, M4192, M4193, M4194, M4195, M4196, M4197, M4198, M4199, M4200, M4201, M4202, M4203, M4204, M4205, M4206, M4207, M4208, M4209, M4210, M4211, M4212, M4213, M4214, M4215, M4216, M4217, M4218, M4219, M4220, M4221, M4222, M4223, M4224, M4225, M4226, M4227, M4228, M4229, M4230, M4231, M4232, M4233, M4234, M4235, M4236, M4237, M4238, M4239, M4240, M4241, M4242, M4243, M4244, M4245, M4246, M4247, M4248, M4249, M4250, M4251, M4252, M4253, M4254, M4255, M4256, M4257, M4258, M4259, M4260, M4261, M4262, M4263, M4264, M4265, M4266, M4267, M4268, M4269, M4270, M4271, M4272, M4273, M4274, M4275, M4276, M4277, M4278, M4279, M4280, M4281, M4282, M4283, M4284, M4285, M4286, M4287, M4288, M4289, M4290, M4291, M4292, M4293, M4294, M4295, M4296, M4297, M4298, M4299, M4300, M4301, M4302, M4303, M4304, M4305, M4306, M4307, M4308, M4309, M4310, M4311, M4312, M4313, M4314, M4315, M4316, M4317, M4318, M4319, M4320, M4321, M4322, M4323, M4324, M4325, M4326, M4327, M4328, M4329, M4330, M4331, M4332, M4333, M4334, M4335, M4336, M4337, M4338, M4339, M4340, M4341, M4342, M4343, M4344, M4345, M4346, M4347, M4348, M4349, M4350, M4351, M4352, M4353, M4354, M4355, M4356, M4357, M4358, M4359, M4360, M4361, M4362, M4363, M4364, M4365, M4366, M4367, M4368, M4369, M4370, M4371, M4372, M4373, M4374, M4375, M4376, M4377, M4378, M4379, M4380, M4381, M4382, M4383, M4384, M4385, M4386, M4387, M4388, M4389, M4390, M4391, M4392, M4393, M4394, M4395, M4396, M4397, M4398, M4399, M4400, M4401, M4402, M4403, M4404, M4405, M4406, M4407, M4408, M4409, M4410, M4411, M4412, M4413, M4414, M4415, M4416, M4417, M4418, M4419, M4420, M4421, M4422, M4423, M4424, M4425, M4426, M4427, M4428, M4429, M4430, M4431, M4432, M4433, M4434, M4435, M4436, M4437, M4438, M4439, M4440, M4441, M4442, M4443, M4444, M4445, M4446, M4447, M4448, M4449, M4450, M4451, M4452, M4453, M4454, M4455, M4456, M4457, M4458, M4459, M4460, M4461, M4462, M4463, M4464, M4465, M4466, M4467, M4468, M4469, M4470, M4471, M4472, M4473, M4474, M4475, M4476, M4477, M4478, M4479, M4480, M4481, M4482, M4483, M4484, M4485, M4486, M4487, M4488, M4489, M4490, M4491, M4492, M4493, M4494, M4495, M4496, M4497, M4498, M4499, M4500, M4501, M4502, M4503, M4504, M4505, M4506, M4507, M4508, M4509, M4510, M4511, M4512, M4513, M4514, M4515, M4516, M4517, M4518, M4519, M4520, M4521, M4522, M4523, M4524, M4525, M4526, M4527, M4528, M4529, M4530, M4531, M4532, M4533, M4534, M4535, M4536, M4537, M4538, M4539, M4540, M4541, M4542, M4543, M4544, M4545, M4546, M4547, M4548, M4549, M4550, M4551, M4552, M4553, M4554, M4555, M4556, M4557, M4558, M4559, M4560, M4561, M4562, M4563, M4564, M4565, M4566, M4567, M4568, M4569, M4570, M4571, M4572, M4573, M4574, M4575, M4576, M4577, M4578, M4579, M4580, M4581, M4582, M4583, M4584, M4585, M4586, M4587, M4588, M4589, M4590, M4591, M4592, M4593, M4594, M4595, M4596, M4597, M4598, M4599, M4600, M4601, M4602, M4603, M4604, M4605, M4606, M4607, M4608, M4609, M4610, M4611, M4612, M4613, M4614, M4615, M4616, M4617, M4618, M4619, M4620, M4621, M4622, M4623, M4624, M4625, M4626, M4627, M4628, M4629, M4630, M4631, M4632, M4633, M4634, M4635, M4636, M4637, M4638, M4639, M4640, M4641, M4642, M4643, M4644, M4645, M4646, M4647, M4648, M4649, M4650, M4651, M4652, M4653, M4654, M4655, M4656, M4657, M4658, M4659, M4660, M4661, M4662, M4663, M4664, M4665, M4666, M4667, M4668, M4669, M4670, M4671, M4672, M4673, M4674, M4675, M4676, M4677, M4678, M4679, M4680, M4681, M4682, M4683, M4684, M4685, M4686, M4687, M4688, M4689, M4690, M4691, M4692, M4693, M4694, M4695, M4696, M4697, M4698, M4699, M4700, M4701, M4702, M4703, M4704, M4705, M4706, M4707, M4708, M4709, M4710, M4711, M4712, M4713, M4714, M4715, M4716, M4717, M4718, M4719, M4720, M4721, M4722, M4723, M4724, M4725, M4726, M4727, M4728, M4729, M4730, M4731, M4732, M4733, M4734, M4735, M4736, M4737, M4738, M4739, M4740, M4741, M4742, M4743, M4744, M4745, M4746, M4747, M4748, M4749, M4750, M4751, M4752, M4753, M4754, M4755, M4756, M4757, M4758, M4759, M4760, M4761, M4762, M4763, M4764, M4765, M4766, M4767, M4768, M4769, M4770, M4771, M4772, M4773, M4774, M4775, M4776, M4777, M4778, M4779, M4780, M4781, M4782, M4783, M4784, M4785, M4786, M4787, M4788, M4789, M4790, M4791, M4792, M4793, M4794, M4795, M4796, M4797, M4798, M4799, M4800, M4801, M4802, M4803, M4804, M4805, M4806, M4807, M4808, M4809, M4810, M4811, M4812, M4813, M4814, M4815, M4816, M4817, M4818, M4819, M4820, M4821, M4822, M4823, M4824, M4825, M4826, M4827, M4828, M4829, M4830, M4831, M4832, M4833, M4834, M4835, M4836, M4837, M4838, M4839, M4840, M4841, M4842, M4843, M4844, M4845, M4846, M4847, M4848, M4849, M4850, M4851, M4852, M4853, M4854, M4855, M4856, M4857, M4858, M4859, M4860, M4861, M4862, M4863, M4864, M4865, M4866, M4867, M4868, M4869, M4870, M4871, M4872, M4873, M4874, M4875, M4876, M4877, M4878, M4879, M4880, M4881, M4882, M4883, M4884, M4885, M4886, M4887, M4888, M4889, M4890, M4891, M4892, M4893, M4894, M4895, M4896, M4897, M4898, M4899, M4900, M4901, M4902, M4903, M4904, M4905, M4906, M4907, M4908, M4909, M4910, M4911, M4912, M4913, M4914, M4915, M4916, M4917, M4918, M4919, M4920, M4921, M4922, M4923, M4924, M4925, M4926, M4927, M4928, M4929, M4930, M4931, M4932, M4933, M4934, M4935, M4936, M4937, M4938, M4939, M4940, M4941, M4942, M4943, M4944, M4945, M4946, M4947, M4948, M4949, M4950, M4951, M4952, M4953, M4954, M4955, M4956, M4957, M4958, M4959, M4960, M4961, M4962, M4963, M4964, M4965, M4966, M4967, M4968, M4969, M4970, M4971, M4972, M4973, M4974, M4975, M4976, M4977, M4978, M4979, M4980, M4981, M4982, M4983, M4984, M4985, M4986, M4987, M4988, M4989, M4990, M4991, M4992, M4993, M4994, M4995, M4996, M4997, M4998, M4999, M5000, M5001, M5002, M5003, M5004, M5005, M5006, M5007, M5008, M5009, M5010, M5011, M5012, M5013, M5014, M5015, M5016, M5017, M5018, M5019, M5020, M5021, M5022, M5023, M5024, M5025, M5026, M5027, M5028, M5029, M5030, M5031, M5032, M5033, M5034, M5035, M5036, M5037, M5038, M5039, M5040, M5041, M5042, M5043, M5044, M5045, M5046, M5047, M5048, M5049, M5050, M5051, M5052, M5053, M5054, M5055, M5056, M5057, M5058, M5059, M5060, M5061, M5062, M5063, M5064, M5065, M5066, M5067, M5068, M5069, M5070, M5071, M5072, M5073, M5074, M5075, M5076, M5077, M5078, M5079, M5080, M5081, M5082, M5083, M5084, M5085, M5086, M5087, M5088, M5089, M5090, M5091, M5092, M5093, M5094, M5095, M5096, M5097, M5098, M5099, M5100, M5101, M5102, M5103, M5104, M5105, M5106, M5107, M5108, M5109, M5110, M5111, M5112, M5113, M5114, M5115, M5116, M5117, M5118, M5119, M5120, M5121, M5122, M5123, M5124, M5125, M5126, M5127, M5128, M5129, M5130, M5131, M5132, M5133, M5134, M5135, M5136, M5137, M5138, M5139, M5140, M5141, M5142, M5143, M5144, M5145, M5146, M5147, M5148, M5149, M5150, M5151, M5152, M5153, M5154, M5155, M5156, M5157, M5158, M5159, M5160, M5161, M5162, M5163, M5164, M5165, M5166, M5167, M5168, M5169, M5170, M5171, M5172, M5173, M5174, M5175, M5176, M5177, M5178, M5179, M5180, M5181, M5182, M5183, M5184, M5185, M5186, M5187, M5188, M5189, M5190, M5191, M5192, M5193, M5194, M5195, M5196, M5197, M5198, M5199, M5200, M5201, M5202, M5203, M5204, M5205, M5206, M5207, M5208, M5209, M5210, M5211, M5212, M5213, M5214, M5215, M5216, M5217, M5218, M5219, M5220, M5221, M5222, M5223, M5224, M5225, M5226, M5227, M5228, M5229, M5230, M5231, M5232, M5233, M5234, M5235, M5236, M5237, M5238, M5239, M5240, M5241, M5242, M5243, M5244, M5245, M5246, M5247, M5248, M5249, M5250, M5251, M5252, M5253, M5254, M5255, M5256, M5257, M5258, M5259, M5260, M5261, M5262, M5263, M5264, M5265, M5266, M5267, M5268, M5269, M5270, M5271, M5272, M5273, M5274, M5275, M5276, M5277, M5278, M5279, M5280, M5281, M5282, M5283, M5284, M5285, M5286, M5287, M5288, M5289, M5290, M5291, M5292, M5293, M5294, M5295, M5296, M5297, M5298, M5299, M5300, M5301, M5302, M5303, M5304, M5305, M5306, M5307, M5308, M5309, M5310, M5311, M5312, M5313, M5314, M5315, M5316, M5317, M5318, M5319, M5320, M5321, M5322, M5323, M5324, M5325, M5326, M5327, M5328, M5329, M5330, M5331, M5332, M5333, M5334, M5335, M5336, M5337, M5338, M5339, M5340, M5341, M5342, M5343, M5344, M5345, M5346, M5347, M5348, M5349, M5350, M5351, M5352, M5353, M5354, M5355, M5356, M5357, M5358, M5359, M5360, M5361, M5362, M5363, M5364, M5365, M5366, M5367, M5368, M5369, M5370, M5371, M5372, M5373, M5374, M5375, M5376, M5377, M5378, M5379, M5380, M5381, M5382, M5383, M5384, M5385, M5386, M5387, M5388, M5389, M5390, M5391, M5392, M5393, M5394, M5395, M5396, M5397, M5398, M5399, M5400, M5401, M5402, M5403, M5404, M5405, M5406, M5407, M5408, M5409, M5410, M5411, M5412, M5413, M5414, M5415, M5416, M5417, M5418, M5419, M5420, M5421, M5422, M5423, M5424, M5425, M5426, M5427, M5428, M5429, M5430, M5431, M5432, M5433, M5434, M5435, M5436, M5437, M5438, M5439, M5440, M5441, M5442, M5443, M5444, M5445, M5446, M5447, M5448, M5449, M5450, M5451, M5452, M5453, M5454, M5455, M5456, M5457, M5458, M5459, M5460, M5461, M5462, M5463, M5464, M5465, M5466, M5467, M5468, M5469, M5470, M5471, M5472, M5473, M5474, M5475, M5476, M5477, M5478, M5479, M5480, M5481, M5482, M5483, M5484, M5485, M5486, M5487, M5488, M5489, M5490, M5491, M5492, M5493, M5494, M5495, M5496, M5497, M5498, M5499, M5500, M5501, M5502, M5503, M5504, M5505, M5506, M5507, M5508, M5509, M5510, M5511, M5512, M5513, M5514, M5515, M5516, M5517, M5518, M5519, M5520, M5521, M5522, M5523, M5524, M5525, M5526, M5527, M5528, M5529, M5530, M5531, M5532, M5533, M5534, M5535, M5536, M5537, M5538, M5539, M5540, M5541, M5542, M5543, M5544, M5545, M5546, M5547, M5548, M5549, M5550, M5551, M5552, M5553, M5554, M5555, M5556, M5557, M5558, M5559, M5560, M5561, M5562, M5563, M5564, M5565, M5566, M5567, M5568, M5569, M5570, M5571, M5572, M5573, M5574, M5575, M5576, M5577, M5578, M5579, M5580, M5581, M5582, M5583, M5584, M5585, M5586, M5587, M5588, M5589, M5590, M5591, M5592, M5593, M5594, M5595, M5596, M5597, M5598, M5599, M5600, M5601, M5602, M5603, M5604, M5605, M5606, M5607, M5608, M5609, M5610, M5611, M5612, M5613, M5614, M5615, M5616, M5617, M5618, M5619, M5620, M5621, M5622, M5623, M5624, M5625, M5626, M5627, M5628, M5629, M5630, M5631, M5632, M5633, M5634, M5635, M5636, M5637, M5638, M5639, M5640, M5641, M5642, M5643, M5644, M5645, M5646, M5647, M5648, M5649, M5650, M5651, M5652, M5653, M5654, M5655, M5656, M5657, M5658, M5659, M5660, M5661, M5662, M5663, M5664, M5665, M5666, M5667, M5668, M5669, M5670, M5671, M5672, M5673, M5674, M5675, M5676, M5677, M5678, M5679, M5680, M5681, M5682, M5683, M5684, M5685, M5686, M5687, M5688, M5689, M5690, M5691, M5692, M5693, M5694, M5695, M5696, M5697, M5698, M5699, M5700, M5701, M5702, M5703, M5704, M5705, M5706, M5707, M5708, M5709, M5710, M5711, M5712, M5713, M5714, M5715, M5716, M5717, M5718, M5719, M5720, M5721, M5722, M5723, M5724, M5725, M5726, M5727, M5728, M5729, M5730, M5731, M5732, M5733, M5734, M5735, M5736, M5737, M5738, M5739, M5740, M5741, M5742, M5743, M5744, M5745, M5746, M5747, M5748, M5749, M5750, M5751, M5752, M5753, M5754, M5755, M5756, M5757, M5758, M5759, M5760, M5761, M5762, M5763, M5764, M5765, M5766, M5767, M5768, M5769, M5770, M5771, M5772, M5773, M5774, M5775, M5776, M5777, M5778, M5779, M5780, M5781, M5782, M5783, M5784, M5785, M5786, M5787, M5788, M5789, M5790, M5791, M5792, M5793, M5794, M5795, M5796, M5797, M5798, M5799, M5800, M5801, M5802, M5803, M5804, M5805, M5806, M5807, M5808, M5809, M5810, M5811, M5812, M5813, M5814, M5815, M5816, M5817, M5818, M5819, M5820, M5821, M5822, M5823, M5824, M5825, M5826, M5827, M5828, M5829, M5830, M5831, M5832, M5833, M5834, M5835, M5836, M5837, M5838, M5839, M5840, M5841, M5842, M5843, M5844, M5845, M5846, M5847, M5848, M5849, M5850, M5851, M5852, M5853, M5854, M5855, M5856, M5857, M5858, M5859, M5860, M5861, M5862, M5863, M5864, M5865, M5866, M5867, M5868, M5869, M5870, M5871, M5872, M5873, M5874, M5875, M5876, M5877, M5878, M5879, M5880, M5881, M5882, M5883, M5884, M5885, M5886, M5887, M5888, M5889, M5890, M5891, M5892, M5893, M5894, M5895, M5896, M5897, M5898, M5899, M5900, M5901, M5902, M5903, M5904, M5905, M5906, M5907, M5908, M5909, M5910, M5911, M5912, M5913, M5914, M5915, M5916, M5917, M5918, M5919, M5920, M5921, M5922, M5923, M5924, M5925, M5926, M5927, M5928, M5929, M5930, M5931, M5932, M5933, M5934, M5935, M5936, M5937, M5938, M5939, M5940, M5941, M5942, M5943, M5944, M5945, M5946, M5947, M5948, M5949, M5950, M5951, M5952, M5953, M5954, M5955, M5956, M5957, M5958, M5959, M5960, M5961, M5962, M5963, M5964, M5965, M5966, M5967, M5968, M5969, M5970, M5971, M5972, M5973, M5974, M5975, M5976, M5977, M5978, M5979, M5980, M5981, M5982, M5983, M5984, M5985, M5986, M5987, M5988, M5989, M5990, M5991, M5992, M5993, M5994, M5995, M5996, M5997, M5998, M5999, M6000, M6001, M6002, M6003, M6004, M6005, M6006, M6007, M6008, M6009, M6010, M6011, M6012, M6013, M6014, M6015, M6016, M6017, M6018, M6019, M6020, M6021, M6022, M6023, M6024, M6025, M6026, M6027, M6028, M6029, M6030, M6031, M6032, M6033, M6034, M6035, M6036, M6037, M6038, M6039, M6040, M6041, M6042, M6043, M6044, M6045, M6046, M6047, M6048, M6049, M6050, M6051, M6052, M6053, M6054, M6055, M6056, M6057, M6058, M6059, M6060, M6061, M6062, M6063, M6064, M6065, M6066, M6067, M6068, M6069, M6070, M6071, M6072, M6073, M6074, M6075, M6076, M6077, M6078, M6079, M6080, M6081, M6082, M6083, M6084, M6085, M6086, M6087, M6088, M6089, M6090, M6091, M6092, M6093, M6094, M6095, M6096, M6097, M6098, M6099, M6100, M6101, M6102, M6103, M6104, M6105, M6106, M6107, M6108, M6109, M6110, M6111, M6112, M6113, M6114, M6115, M6116, M6117, M6118, M6119, M6120, M6121, M6122, M6123, M6124, M6125, M6126, M6127, M6128, M6129, M6130, M6131, M6132, M6133, M6134, M6135, M6136, M6137, M6138, M6139, M6140, M6141, M6142, M6143, M6144, M6145, M6146, M6147, M6148, M6149, M6150, M6151, M6152, M6153, M6154, M6155, M6156, M6157, M6158, M6159, M6160, M6161, M6162, M6163, M6164, M6165, M6166, M6167, M6168, M6169, M6170, M6171, M6172, M6173, M6174, M6175, M6176, M6177, M6178, M6179, M6180, M6181, M6182, M6183, M6184, M6185, M6186, M6187, M6188, M6189, M6190, M6191, M6192, M6193, M6194, M6195, M6196, M6197, M6198, M6199, M6200, M6201, M6202, M6203, M6204, M6205, M6206, M6207, M6208, M6209, M6210, M6211, M6212, M6213, M6214, M6215, M6216, M6217, M6218, M6219, M6220, M6221, M6222, M6223, M6224, M6225, M6226, M6227, M6228, M6229, M6230, M6231, M6232, M6233, M6234, M6235, M6236, M6237, M6238, M6239, M6240, M6241, M6242, M6243, M6244, M6245, M6246, M6247, M6248, M6249, M6250, M6251, M6252, M6253, M6254, M6255, M6256, M6257, M6258, M6259, M6260, M6261, M6262, M6263, M6264, M6265, M6266, M6267, M6268, M6269, M6270, M6271, M6272, M6273, M6274, M6275, M6276, M6277, M6278, M6279, M6280, M6281, M6282, M6283, M6284, M6285, M6286, M6287, M6288, M6289, M6290, M6291, M6292, M6293, M6294, M6295, M6296, M6297, M6298, M6299, M6300, M6301, M6302, M6303, M6304, M6305, M6306, M6307, M6308, M6309, M6310, M6311, M6312, M6313, M6314, M6315, M6316, M6317, M6318, M6319, M6320, M6321, M6322, M6323, M6324, M6325, M6326, M6327, M6328, M6329, M6330, M6331, M6332, M6333, M6334, M6335, M6336, M6337, M6338, M6339, M6340, M6341, M6342, M6343, M6344, M6345, M6346, M6347, M6348, M6349, M6350, M6351, M6352, M6353, M6354, M6355, M6356, M6357, M6358, M6359, M6360, M6361, M6362, M6363, M6364, M6365, M6366, M6367, M6368, M6369, M6370, M6371, M6372, M6373, M6374, M6375, M6376, M6377, M6378, M6379, M6380, M6381, M6382, M6383, M6384, M6385, M6386, M6387, M6388, M6389, M6390, M6391, M6392, M6393, M6394, M6395, M6396, M6397, M6398, M6399, M6400, M6401, M6402, M6403, M6404, M6405, M6406, M6407, M6408, M6409, M6410, M6411, M6412, M6413, M6414, M6415, M6416, M6417, M6418, M6419, M6420, M6421, M6422, M6423, M6424, M6425, M6426, M6427, M6428, M6429, M6430, M6431, M6432, M6433, M6434, M6435, M6436, M6437, M6438, M6439, M6440, M6441, M6442, M6443, M6444, M6445, M6446, M6447, M6448, M6449, M6450, M6451, M6452, M6453, M6454, M6455, M6456, M6457, M6458, M6459, M6460, M6461, M6462, M6463, M6464, M6465, M6466, M6467, M6468, M6469, M6470, M6471, M6472, M6473, M6474, M6475, M6476, M6477, M6478, M6479, M6480, M6481, M6482, M6483, M6484, M6485, M6486, M6487, M6488, M6489, M6490, M6491, M6492, M6493, M6494, M6495, M6496, M6497, M6498, M6499, M6500, M6501, M6502, M6503, M6504, M6505, M6506, M6507, M6508, M6509, M6510, M6511, M6512, M6513, M6514, M6515, M6516, M6517, M6518, M6519, M6520, M6521, M6522, M6523, M6524, M6525, M6526, M6527, M6528, M6529, M6530, M6531, M6532, M6533, M6534, M6535, M6536, M6537, M6538, M6539, M6540, M6541, M6542, M6543, M6544, M6545, M6546, M6547, M6548, M6549, M6550, M6551, M6552, M6553, M6554, M6555, M6556, M6557, M6558, M6559, M6560, M6561, M6562, M6563, M6564, M6565, M6566, M6567, M6568, M6569, M6570, M6571, M6572, M6573, M6574, M6575, M6576, M6577, M6578, M6579, M6580, M6581, M6582, M6583, M6584, M6585, M6586, M6587, M6588, M6589, M6590, M6591, M6592, M6593, M6594, M6595, M6596, M6597, M6598, M6599, M6600, M6601, M6602, M6603, M6604, M6605, M6606, M6607, M6608, M6609, M6610, M6611, M6612, M6613, M6614, M6615, M6616, M6617, M6618, M6619, M6620, M6621, M6622, M6623, M6624, M6625, M6626, M6627, M6628, M6629, M6630, M6631, M6632, M6633, M6634, M6635, M6636, M6637, M6638, M6639, M6640, M6641, M6642, M6643, M6644, M6645, M6646, M6647, M6648, M6649, M6650, M6651, M6652, M6653, M6654, M6655, M6656, M6657, M6658, M6659, M6660, M6661, M6662, M6663, M6664, M6665, M6666, M6667, M6668, M6669, M6670, M6671, M6672, M6673, M6674, M6675, M6676, M6677, M6678, M6679, M6680, M6681, M6682, M6683, M6684, M6685, M6686, M6687, M6688, M6689, M6690, M6691, M6692, M6693, M6694, M6695, M6696, M6697, M6698, M6699, M6700, M6701, M6702, M6703, M6704, M6705, M6706, M6707, M6708, M6709, M6710, M6711, M6712, M6713, M6714, M6715, M6716, M6717, M6718, M6719, M6720, M6721, M6722, M6723, M6724, M6725, M6726, M6727, M6728, M6729, M6730, M6731, M6732, M6733, M6734, M6735, M6736, M6737, M6738, M6739, M6740, M6741, M6742, M6743, M6744, M6745, M6746, M6747, M6748, M6749, M6750, M6751, M6752, M6753, M6754, M6755, M6756, M6757, M6758, M6759, M6760, M6761, M6762, M6763, M6764, M6765, M6766, M6767, M6768, M6769, M6770, M6771, M6772, M6773, M6774, M6775, M6776, M6777, M6778, M6779, M6780, M6781, M6782, M6783, M6784, M6785, M6786, M6787, M6788, M6789, M6790, M6791, M6792, M6793, M6794, M6795, M6796, M6797, M6798, M6799, M6800, M6801, M6802, M6803, M6804, M6805, M6806, M6807, M6808, M6809, M6810, M6811, M6812, M6813, M6814, M6815, M6816, M6817, M6818, M6819, M6820, M6821, M6822, M6823, M6824, M6825, M6826, M6827, M6828, M6829, M6830, M6831, M6832, M6833, M6834, M6835, M6836, M6837, M6838, M6839, M6840, M6841, M6842, M6843, M6844, M6845, M6846, M6847, M6848, M6849, M6850, M6851, M6852, M6853, M6854, M6855, M6856, M6857, M6858, M6859, M6860, M6861, M6862, M6863, M6864, M6865, M6866, M6867, M6868, M6869, M6870, M6871, M6872, M6873, M6874, M6875, M6876, M6877, M6878, M6879, M6880, M6881, M6882, M6883, M6884, M6885, M6886, M6887, M6888, M6889, M6890, M6891, M6892, M6893, M6894, M6895, M6896, M6897, M6898, M6899, M6900, M6901, M6902, M6903, M6904, M6905, M6906, M6907, M6908, M6909, M6910, M6911, M6912, M6913, M6914, M6915, M6916, M6917, M6918, M6919, M6920, M6921, M6922, M6923, M6924, M6925, M6926, M6927, M6928, M6929, M6930, M6931, M6932, M6933, M6934, M6935, M6936, M6937, M6938, M6939, M6940, M6941, M6942, M6943, M6944, M6945, M6946, M6947, M6948, M6949, M6950, M6951, M6952, M6953, M6954, M6955, M6956, M6957, M6958, M6959, M6960, M6961, M6962, M6963, M6964, M6965, M6966, M6967, M6968, M6969, M6970, M6971, M6972, M6973, M6974, M6975, M6976, M6977, M6978, M6979, M6980, M6981, M6982, M6983, M6984, M6985, M6986, M6987, M6988, M6989, M6990, M6991, M6992, M6993, M6994, M6995, M6996, M6997, M6998, M6999, M7000, M7001, M7002, M7003, M7004, M7005, M7006, M7007, M7008, M7009, M7010, M7011, M7012, M7013, M7014, M7015, M7016, M7017, M7018, M7019, M7020, M7021, M7022, M7023, M7024, M7025, M7026, M7027, M7028, M7029, M7030, M7031, M7032, M7033, M7034, M7035, M7036, M7037, M7038, M7039, M7040, M7041, M7042, M7043, M7044, M7045, M7046, M7047, M7048, M7049, M7050, M7051, M7052, M7053, M7054, M7055, M7056, M7057, M7058, M7059, M7060, M7061, M7062, M7063, M7064, M7065, M7066, M7067, M7068, M7069, M7070, M7071, M7072, M7073, M7074, M7075, M7076, M7077, M7078, M7079, M7080, M7081, M7082, M7083, M7084, M7085, M7086, M7087, M7088, M7089, M7090, M7091, M7092, M7093, M7094, M7095, M7096, M7097, M7098, M7099, M7100, M7101, M7102, M7103, M7104, M7105, M7106, M7107, M7108, M7109, M7110, M7111, M7112, M7113, M7114, M7115, M7116, M7117, M7118, M7119, M7120, M7121, M7122, M7123, M7124, M7125, M7126, M7127, M7128, M7129, M7130, M7131, M7132, M7133, M7134, M7135, M7136, M7137, M7138, M7139, M7140, M7141, M7142, M7143, M7144, M7145, M7146, M7147, M7148, M7149, M7150, M7151, M7152, M7153, M7154, M7155, M7156, M7157, M7158, M7159, M7160, M7161, M7162, M7163, M7164, M7165, M7166, M7167, M7168, M7169, M7170, M7171, M7172, M7173, M7174, M7175, M7176, M7177, M7178, M7179, M7180, M7181, M7182, M7183, M7184, M7185, M7186, M7187, M7188, M7189, M7190, M7191, M7192, M7193, M7194, M7195, M7196, M7197, M7198, M7199, M7200, M7201, M7202, M7203, M7204, M7205, M7206, M7207, M7208, M7209, M7210, M7211, M7212, M7213, M7214, M7215, M7216, M7217, M7218, M7219, M7220, M7221, M7222, M7223, M7224, M7225, M7226, M7227, M7228, M7229, M7230, M7231, M7232, M7233, M7234, M7235, M7236, M7237, M7238, M7239, M7240, M7241, M7242, M7243, M7244, M7245, M7246, M7247, M7248, M7249, M7250, M7251, M7252, M7253, M7254, M7255, M7256, M7257, M7258, M7259, M7260, M7261, M7262, M7263, M7264, M7265, M7266, M7267, M7268, M7269, M7270, M7271, M7272, M7273, M7274, M7275, M7276, M7277, M7278, M7279, M7280, M7281, M7282, M7283, M7284, M7285, M7286, M7287, M7288, M7289, M7290, M7291, M7292, M7293, M7294, M7295, M7296, M7297, M7298, M7299, M7300, M7301, M7302, M7303, M7304, M7305, M7306, M7307, M7308, M7309, M7310, M7311, M7312, M7313, M7314, M7315, M7316, M7317, M7318, M7319, M7320, M7321, M7322, M7323, M7324, M7325, M7326, M7327, M7328, M7329, M7330, M7331, M7332, M7333, M7334, M7335, M7336, M7337, M7338, M7339, M7340, M7341, M7342, M7343, M7344, M7345, M7346, M7347, M7348, M7349, M7350, M7351, M7352, M7353, M7354, M7355, M7356, M7357, M7358, M7359, M7360, M7361, M7362, M7363, M7364, M7365, M7366, M7367, M7368, M7369, M7370, M7371, M7372, M7373, M7374, M7375, M7376, M7377, M7378, M7379, M7380, M7381, M7382, M7383, M7384, M7385, M7386, M7387, M7388, M7389, M7390, M7391, M7392, M7393, M7394, M7395, M7396, M7397, M7398, M7399, M7400, M7401, M7402, M7403, M7404, M7405, M7406, M7407, M7408, M7409, M7410, M7411, M7412, M7413, M7414, M7415, M7416, M7417, M7418, M7419, M7420, M7421, M7422, M7423, M7424, M7425, M7426, M7427, M7428, M7429, M7430, M7431, M7432, M7433, M7434, M7435, M7436, M7437, M7438, M7439, M7440, M7441, M7442, M7443, M7444, M7445, M7446, M7447, M7448, M7449, M7450, M7451, M7452, M7453, M7454, M7455, M7456, M7457, M7458, M7459, M7460, M7461, M7462, M7463, M7464, M7465, M7466, M7467, M7468, M7469, M7470, M7471, M7472, M7473, M7474, M7475, M7476, M7477, M7478, M7479, M7480, M7481, M7482, M7483, M7484, M7485, M7486, M7487, M7488, M7489, M7490, M7491, M7492, M7493, M7494, M7495, M7496, M7497, M7498, M7499, M7500, M7501, M7502, M7503, M7504, M7505, M7506, M7507, M7508, M7509, M7510, M7511, M7512, M7513, M7514, M7515, M7516, M7517, M7518, M7519, M7520, M7521, M7522, M7523, M7524, M7525, M7526, M7527, M7528, M7529, M7530, M7531, M7532, M7533, M7534, M7535, M7536, M7537, M7538, M7539, M7540, M7541, M7542, M7543, M7544, M7545, M7546, M7547, M7548, M7549, M7550, M7551, M7552, M7553, M7554, M7555, M7556, M7557, M7558, M7559, M7560, M7561, M7562, M7563, M7564, M7565, M7566, M7567, M7568, M7569, M7570, M7571, M7572, M7573, M7574, M7575, M7576, M7577, M7578, M7579, M7580, M7581, M7582, M7583, M7584, M7585, M7586, M7587, M7588, M7589, M7590, M7591, M7592, M7593, M7594, M7595, M7596, M7597, M7598, M7599, M7600, M7601, M7602, M7603, M7604, M7605, M7606, M7607, M7608, M7609, M7610, M7611, M7612, M7613, M7614, M7615, M7616, M7617, M7618, M7619, M7620, M7621, M7622, M7623, M7624, M7625, M7626, M7627, M7628, M7629, M7630, M7631, M7632, M7633, M7634, M7635, M7636, M7637, M7638, M7639, M7640, M7641, M7642, M7643, M7644, M7645, M7646, M7647, M7648, M7649, M7650, M7651, M7652, M7653, M7654, M7655, M7656, M7657, M7658, M7659, M7660, M7661, M7662, M7663, M7664, M7665, M7666, M7667, M7668, M7669, M7670, M7671, M7672, M7673, M7674, M7675, M7676, M7677, M7678, M7679, M7680, M7681, M7682, M7683, M7684, M7685, M7686, M7687, M7688, M7689, M7690, M7691, M7692, M7693, M7694, M7695, M7696, M7697, M7698, M7699, M7700, M7701, M7702, M7703, M7704, M7705, M7706, M7707, M7708, M7709, M7710, M7711, M7712, M7713, M7714, M7715, M7716, M7717, M7718, M7719, M7720, M7721, M7722, M7723, M7724, M7725, M7726, M7727, M7728, M7729, M7730, M7731, M7732, M7733, M7734, M7735, M7736, M7737, M7738, M7739, M7740, M7741, M7742, M7743, M7744, M7745, M7746, M7747, M7748, M7749, M7750, M7751, M7752, M7753, M7754, M7755, M7756, M7757, M7758, M7759, M7760, M7761, M7762, M7763, M7764, M7765, M7766, M7767, M7768, M7769, M7770, M7771, M7772, M7773, M7774, M7775, M7776, M7777, M7778, M7779, M7780, M7781, M7782, M7783, M7784, M7785, M7786, M7787, M7788, M7789, M7790, M7791, M7792, M7793, M7794, M7795, M7796, M7797, M7798, M7799, M7800, M7801, M7802, M7803, M7804, M7805, M7806, M7807, M7808, M7809, M7810, M7811, M7812, M7813, M7814, M7815, M7816, M7817, M7818, M7819, M7820, M7821, M7822, M7823, M7824, M7825, M7826, M7827, M7828, M7829, M7830, M7831, M7832, M7833, M7834, M7835, M7836, M7837, M7838, M7839, M7840, M7841, M7842, M7843, M7844, M7845, M7846, M7847, M7848, M7849, M7850, M7851, M7852, M7853, M7854, M7855, M7856, M7857, M7858, M7859, M7860, M7861, M7862, M7863, M7864, M7865, M7866, M7867, M7868, M7869, M7870, M7871, M7872, M7873, M7874, M7875, M7876, M7877, M7878, M7879, M7880, M7881, M7882, M7883, M7884, M7885, M7886, M7887, M7888, M7889, M7890, M7891, M7892, M7893, M7894, M7895, M7896, M7897, M7898, M7899, M7900, M7901, M7902, M7903, M7904, M7905, M7906, M7907, M7908, M7909, M7910, M7911, M7912, M7913, M7914, M7915, M7916, M7917, M7918, M7919, M7920, M7921, M7922, M7923, M7924, M7925, M7926, M7927, M7928, M7929, M7930, M7931, M7932, M7933, M7934, M7935, M7936, M7937, M7938, M7939, M7940, M7941, M7942, M7943, M7944, M7945, M7946, M7947, M7948, M7949, M7950, M7951, M7952, M7953, M7954, M7955, M7956, M7957, M7958, M7959, M7960, M7961, M7962, M7963, M7964, M7965, M7966, M7967, M7968, M7969, M7970, M7971, M7972, M7973, M7974, M7975, M7976, M7977, M7978, M7979, M7980, M7981, M7982, M7983, M7984, M7985, M7986, M7987, M7988, M7989, M7990, M7991, M7992, M7993, M7994, M7995, M7996, M7997, M7998, M7999, M8000, M8001, M8002, M8003, M8004, M8005, M8006, M8007, M8008, M8009, M8010, M8011, M8012, M8013, M8014, M8015, M8016, M8017, M8018, M8019, M8020, M8021, M8022, M8023, M8024, M8025, M8026, M8027, M8028, M8029, M8030, M8031, M8032, M8033, M8034, M8035, M8036, M8037, M8038, M8039, M8040, M8041, M8042, M8043, M8044, M8045, M8046, M8047, M8048, M8049, M8050, M8051, M8052, M8053, M8054, M8055, M8056, M8057, M8058, M8059, M8060, M8061, M8062, M8063, M8064, M8065, M8066, M8067, M8068, M8069, M8070, M8071, M8072, M8073, M8074, M8075, M8076, M8077, M8078, M8079, M8080, M8081, M8082, M8083, M8084, M8085, M8086, M8087, M8088, M8089, M8090, M8091, M8092, M8093, M8094, M8095, M8096, M8097, M8098, M8099, M8100, M8101, M8102, M8103, M8104, M8105, M8106, M8107, M8108, M8109, M8110, M8111, M8112, M8113, M8114, M8115, M8116, M8117, M8118, M8119, M8120, M8121, M8122, M8123, M8124, M8125, M8126, M8127, M8128, M8129, M8130, M8131, M8132, M8133, M8134, M8135, M8136, M8137, M8138, M8139, M8140, M8141, M8142, M8143, M8144, M8145, M8146, M8147, M8148, M8149, M8150, M8151, M8152, M8153, M8154, M8155, M8156, M8157, M8158, M8159, M8160, M8161, M8162, M8163, M8164, M8165, M8166, M8167, M8168, M8169, M8170, M8171, M8172, M8173, M8174, M8175, M8176, M8177, M8178, M8179, M8180, M8181, M8182, M8183, M8184, M8185, M8186, M8187, M8188, M8189, M8190, M8191, M8192, M8193, M8194, M8195, M8196, M8197, M8198, M8199, M8200, M8201, M8202, M8203, M8204, M8205, M8206, M8207, M8208, M8209, M8210, M8211, M8212, M8213, M8214, M8215, M8216, M8217, M8218, M8219, M8220, M8221, M8222, M8223, M8224, M8225, M8226, M8227, M8228, M8229, M8230, M8231, M8232, M8233, M8234, M8235, M8236, M8237, M8238, M8239, M8240, M8241, M8242, M8243, M8244, M8245, M8246, M8247, M8248, M8249, M8250, M8251, M8252, M8253, M8254, M8255, M8256, M8257, M8258, M8259, M8260, M8261, M8262, M8263, M8264, M8265, M8266, M8267, M8268, M8269, M8270, M8271, M8272, M8273, M8274, M8275, M8276, M8277, M8278, M8279, M8280, M8281, M8282, M8283, M8284, M8285, M8286, M8287, M8288, M8289, M8290, M8291, M8292, M8293, M8294, M8295, M8296, M8297, M8298, M8299, M8300, M8301, M8302, M8303, M8304, M8305, M8306, M8307, M8308, M8309, M8310, M8311, M8312, M8313, M8314, M8315, M8316, M8317, M8318, M8319, M8320, M8321, M8322, M8323, M8324, M8325, M8326, M8327, M8328, M8329, M8330, M8331, M8332, M8333, M8334, M8335, M8336, M8337, M8338, M8339, M8340, M8341, M8342, M8343, M8344, M8345, M8346, M8347, M8348, M8349, M8350, M8351, M8352, M8353, M8354, M8355, M8356, M8357, M8358, M8359, M8360, M8361, M8362, M8363, M8364, M8365, M8366, M8367, M8368, M8369, M8370, M8371, M8372, M8373, M8374, M8375, M8376, M8377, M8378, M8379, M8380, M8381, M8382, M8383, M8384, M8385, M8386, M8387, M8388, M8389, M8390, M8391, M8392, M8393, M8394, M8395, M8396, M8397, M8398, M8399, M8400, M8401, M8402, M8403, M8404, M8405, M8406, M8407, M8408, M8409, M8410, M8411, M8412, M8413, M8414, M8415, M8416, M8417, M8418, M8419, M8420, M8421, M8422, M8423, M8424, M8425, M8426, M8427, M8428, M8429, M8430, M8431, M8432, M8433, M8434, M8435, M8436, M8437, M8438, M8439, M8440, M8441, M8442, M8443, M8444, M8445, M8446, M8447, M8448, M8449, M8450, M8451, M8452, M8453, M8454, M8455, M8456, M8457, M8458, M8459, M8460, M8461, M8462, M8463, M8464, M8465, M8466, M8467, M8468, M8469, M8470, M8471, M8472, M8473, M8474, M8475, M8476, M8477, M8478, M8479, M8480, M8481, M8482, M8483, M8484, M8485, M8486, M8487, M8488, M8489, M8490, M8491, M8492, M8493, M8494, M8495, M8496, M8497, M8498, M8499, M8500, M8501, M8502, M8503, M8504, M8505, M8506, M8507, M8508, M8509, M8510, M8511, M8512, M8513, M8514, M8515, M8516, M8517, M8518, M8519, M8520, M8521, M8522, M8523, M8524, M8525, M8526, M8527, M8528, M8529, M8530, M8531, M8532, M8533, M8534, M8535, M8536, M8537, M8538, M8539, M8540, M8541, M8542, M8543, M8544, M8545, M8546, M8547, M8548, M8549, M8550, M8551, M8552, M8553, M8554, M8555, M8556, M8557, M8558, M8559, M8560, M8561, M8562, M8563, M8564, M8565, M8566, M8567, M8568, M8569, M8570, M8571, M8572, M8573, M8574, M8575, M8576, M8577, M8578, M8579, M8580, M8581, M8582, M8583, M8584, M8585, M8586, M8587, M8588, M8589, M8590, M8591, M8592, M8593, M8594, M8595, M8596, M8597, M8598, M8599, M8600, M8601, M8602, M8603, M8604, M8605, M8606, M8607, M8608, M8609, M8610, M8611, M8612, M8613, M8614, M8615, M8616, M8617, M8618, M8619, M8620, M8621, M8622, M8623, M8624, M8625, M8626, M8627, M8628, M8629, M8630, M8631, M8632, M8633, M8634, M8635, M8636, M8637, M8638, M8639, M8640, M8641, M8642, M8643, M8644, M8645, M8646, M8647, M8648, M8649, M8650, M8651, M8652, M8653, M8654, M8655, M8656, M8657, M8658, M8659, M8660, M8661, M8662, M8663, M8664, M8665, M8666, M8667, M8668, M8669, M8670, M8671, M8672, M8673, M8674, M8675, M8676, M8677, M8678, M8679, M8680, M8681, M8682, M8683, M8684, M8685, M8686, M8687, M8688, M8689, M8690, M8691, M8692, M8693, M8694, M8695, M8696, M8697, M8698, M8699, M8700, M8701, M8702, M8703, M8704, M8705, M8706, M8707, M8708, M8709, M8710, M8711, M8712, M8713, M8714, M8715, M8716, M8717, M8718, M8719, M8720, M8721, M8722, M8723, M8724, M8725, M8726, M8727, M8728, M8729, M8730, M8731, M8732, M8733, M8734, M8735, M8736, M8737, M8738, M8739, M8740, M8741, M8742, M8743, M8744, M8745, M8746, M8747, M8748, M8749, M8750, M8751, M8752, M8753, M8754, M8755, M8756, M8757, M8758, M8759, M8760, M8761, M8762, M8763, M8764, M8765, M8766, M8767, M8768, M8769, M8770, M8771, M8772, M8773, M8774, M8775, M8776, M8777, M8778, M8779, M8780, M8781, M8782, M8783, M8784, M8785, M8786, M8787, M8788, M8789, M8790, M8791, M8792, M8793, M8794, M8795, M8796, M8797, M8798, M8799, M8800, M8801, M8802, M8803, M8804, M8805, M8806, M8807, M8808, M8809, M8810, M8811, M8812, M8813, M8814, M8815, M8816, M8817, M8818, M8819, M8820, M8821, M8822, M8823, M8824, M8825, M8826, M8827, M8828, M8829, M8830, M8831, M8832, M8833, M8834, M8835, M8836, M8837, M8838, M8839, M8840, M8841, M8842, M8843, M8844, M8845, M8846, M8847, M8848, M8849, M8850, M8851, M8852, M8853, M8854, M8855, M8856, M8857, M8858, M8859, M8860, M8861, M8862, M8863, M8864, M8865, M8866, M8867, M8868, M8869, M8870, M8871, M8872, M8873, M8874, M8875, M8876, M8877, M8878, M8879, M8880, M8881, M8882, M8883, M8884, M8885, M8886, M8887, M8888, M8889, M8890, M8891, M8892, M8893, M8894, M8895, M8896, M8897, M8898, M8899, M8900, M8901, M8902, M8903, M8904, M8905, M8906, M8907, M8908, M8909, M8910, M8911, M8912, M8913, M8914, M8915, M8916, M8917, M8918, M8919, M8920, M8921, M8922, M8923, M8924, M8925, M8926, M8927, M8928, M8929, M8930, M8931, M8932, M8933, M8934, M8935, M8936, M8937, M8938, M8939, M8940, M8941, M8942, M8943, M8944, M8945, M8946, M8947, M8948, M8949, M8950, M8951, M8952, M8953, M8954, M8955, M8956, M8957, M8958, M8959, M8960, M8961, M8962, M8963, M8964, M8965, M8966, M8967, M8968, M8969, M8970, M8971, M8972, M8973, M8974, M8975, M8976, M8977, M8978, M8979, M8980, M8981, M8982, M8983, M8984, M8985, M8986, M8987, M8988, M8989, M8990, M8991, M8992, M8993, M8994, M8995, M8996, M8997, M8998, M8999, M9000, M9001, M9002, M9003, M9004, M9005, M9006, M9007, M9008, M9009, M9010, M9011, M9012, M9013, M9014, M9015, M9016, M9017, M9018, M9019, M9020, M9021, M9022, M9023, M9024, M9025, M9026, M9027, M9028, M9029, M9030, M9031, M9032, M9033, M9034, M9035, M9036, M9037, M9038, M9039, M9040, M9041, M9042, M9043, M9044, M9045, M9046, M9047, M9048, M9049, M9050, M9051, M9052, M9053, M9054, M9055, M9056, M9057, M9058, M9059, M9060, M9061, M9062, M9063, M9064, M9065, M9066, M9067, M9068, M9069, M9070, M9071, M9072, M9073, M9074, M9075, M9076, M9077, M9078, M9079, M9080, M9081, M9082, M9083, M9084, M9085, M9086, M9087, M9088, M9089, M9090, M9091, M9092, M9093, M9094, M9095, M9096, M9097, M9098, M9099, M9100, M9101, M9102, M9103, M9104, M9105, M9106, M9107, M9108, M9109, M9110, M9111, M9112, M9113, M9114, M9115, M9116, M9117, M9118, M9119, M9120, M9121, M9122, M9123, M9124, M9125, M9126, M9127, M9128, M9129, M9130, M9131, M9132, M9133, M9134, M9135, M9136, M9137, M9138, M9139, M9140, M9141, M9142, M9143, M9144, M9145, M9146, M9147, M9148, M9149, M9150, M9151, M9152, M9153, M9154, M9155, M9156, M9157, M9158, M9159, M9160, M9161, M9162, M9163, M9164, M9165, M9166, M9167, M9168, M9169, M9170, M9171, M9172, M9173, M9174, M9175, M9176, M9177, M9178, M9179, M9180, M9181, M9182, M9183, M9184, M9185, M9186, M9187, M9188, M9189, M9190, M9191, M9192, M9193, M9194, M9195, M9196, M9197, M9198, M9199, M9200, M9201, M9202, M9203, M9204, M9205, M9206, M9207, M9208, M9209, M9210, M9211, M9212, M9213, M9214, M9215, M9216, M9217, M9218, M9219, M9220, M9221, M9222, M9223, M9224, M9225, M9226, M9227, M9228, M9229, M9230, M9231, M9232, M9233, M9234, M9235, M9236, M9237, M9238, M9239, M9240, M9241, M9242, M9243, M9244, M9245, M9246, M9247, M9248, M9249, M9250, M9251, M9252, M9253, M9254, M9255, M9256, M9257, M9258, M9259, M9260, M9261, M9262, M9263, M9264, M9265, M9266, M9267, M9268, M9269, M9270, M9271, M9272, M9273, M9274, M9275, M9276, M9277, M9278, M9279, M9280, M9281, M9282, M9283, M9284, M9285, M9286, M9287, M9288, M9289, M9290, M9291, M9292, M9293, M9294, M9295, M9296, M9297, M9298, M9299, M9300, M9301, M9302, M9303, M9304, M9305, M9306, M9307, M9308, M9309, M9310, M9311, M9312, M9313, M9314, M9315, M9316, M9317, M9318, M9319, M9320, M9321, M9322, M9323, M9324, M9325, M9326, M9327, M9328, M9329, M9330, M9331, M9332, M9333, M9334, M9335, M9336, M9337, M9338, M9339, M9340, M9341, M9342, M9343, M9344, M9345, M9346, M9347, M9348, M9349, M9350, M9351, M9352, M9353, M9354, M9355, M9356, M9357, M9358, M9359, M9360, M9361, M9362, M9363, M9364, M9365, M9366, M9367, M9368, M9369, M9370, M9371, M9372, M9373, M9374, M9375, M9376, M9377, M9378, M9379, M9380, M9381, M9382, M9383, M9384, M9385, M9386, M9387, M9388, M9389, M9390, M9391, M9392, M9393, M9394, M9395, M9396, M9397, M9398, M9399, M9400, M9401, M9402, M9403, M9404, M9405, M9406, M9407, M9408, M9409, M9410, M9411, M9412, M9413, M9414, M9415, M9416, M9417, M9418, M9419, M9420, M9421, M9422, M9423, M9424, M9425, M9426, M9427, M9428, M9429, M9430, M9431, M9432, M9433, M9434, M9435, M9436, M9437, M9438, M9439, M9440, M9441, M9442, M9443, M9444, M9445, M9446, M9447, M9448, M9449, M9450, M9451, M9452, M9453, M9454, M9455, M9456, M9457, M9458, M9459, M9460, M9461, M9462, M9463, M9464, M9465, M9466, M9467, M9468, M9469, M9470, M9471, M9472, M9473, M9474, M9475, M9476, M9477, M9478, M9479, M9480, M9481, M9482, M9483, M9484, M9485, M9486, M9487, M9488, M9489, M9490, M9491, M9492, M9493, M9494, M9495, M9496, M9497, M9498, M9499, M9500, M9501, M9502, M9503, M9504, M9505, M9506, M9507, M9508, M9509, M9510, M9511, M9512, M9513, M9514, M9515, M9516, M9517, M9518, M9519, M9520, M9521, M9522, M9523, M9524, M9525, M9526, M9527, M9528, M9529, M9530, M9531, M9532, M9533, M9534, M9535, M9536, M9537, M9538, M9539, M9540, M9541, M9542, M9543, M9544, M9545, M9546, M9547, M9548, M9549, M9550, M9551, M9552, M9553, M9554, M9555, M9556, M9557, M9558, M9559, M9560, M9561, M9562, M9563, M9564, M9565, M9566, M9567, M9568, M9569, M9570, M9571, M9572, M9573, M9574, M9575, M9576, M9577, M9578, M9579, M9580, M9581, M9582, M9583, M9584, M9585, M9586, M9587, M9588, M9589, M9590, M9591, M9592, M9593, M9594, M9595, M9596, M9597, M9598, M9599, M9600, M9601, M9602, M9603, M9604, M9605, M9606, M9607, M9608, M9609, M9610, M9611, M9612, M9613, M9614, M9615, M9616, M9617, M9618, M9619, M9620, M9621, M9622, M9623, M9624, M9625, M9626, M9627, M9628, M9629, M9630, M9631, M9632, M9633, M9634, M9635, M9636, M9637, M9638, M9639, M9640, M9641, M9642, M9643, M9644, M9645, M9646, M9647, M9648, M9649, M9650, M9651, M9652, M9653, M9654, M9655, M9656, M9657, M9658, M9659, M9660, M9661, M9662, M9663, M9664, M9665, M9666, M9667, M9668, M9669, M9670, M9671, M9672, M9673, M9674, M9675, M9676, M9677, M9678, M9679, M9680, M9681, M9682, M9683, M9684, M9685, M9686, M9687, M9688, M9689, M9690, M9691, M9692, M9693, M9694, M9695, M9696, M9697, M9698, M9699, M9700, M9701, M9702, M9703, M9704, M9705, M9706, M9707, M9708, M9709, M9710, M9711, M9712, M9713, M9714, M9715, M9716, M9717, M9718, M9719, M9720, M9721, M9722, M9723, M9724, M9725, M9726, M9727, M9728, M9729, M9730, M9731, M9732, M9733, M9734, M9735, M9736, M9737, M9738, M9739, M9740, M9741, M9742, M9743, M9744, M9745, M9746, M9747, M9748, M9749, M9750, M9751, M9752, M9753, M9754, M9755, M9756, M9757, M9758, M9759, M9760, M9761, M9762, M9763, M9764, M9765, M9766, M9767, M9768, M9769, M9770, M9771, M9772, M9773, M9774, M9775, M9776, M9777, M9778, M9779, M9780, M9781, M9782, M9783, M9784, M9785, M9786, M9787, M9788, M9789, M9790, M9791, M9792, M9793, M9794, M9795, M9796, M9797, M9798, M9799, M9800, M9801, M9802, M9803, M9804, M9805, M9806, M9807, M9808, M9809, M9810, M9811, M9812, M9813, M9814, M9815, M9816, M9817, M9818, M9819, M9820, M9821, M9822, M9823, M9824, M9825, M9826, M9827, M9828, M9829, M9830, M9831, M9832, M9833, M9834, M9835, M9836, M9837, M9838, M9839, M9840, M9841, M9842, M9843, M9844, M9845, M9846, M9847, M9848, M9849, M9850, M9851, M9852, M9853, M9854, M9855, M9856, M9857, M9858, M9859, M9860, M9861, M9862, M9863, M9864, M9865, M9866, M9867, M9868, M9869, M9870, M9871, M9872, M9873, M9874, M9875, M9876, M9877, M9878, M9879, M9880, M9881, M9882, M9883, M9884, M9885, M9886, M9887, M9888, M9889, M9890, M9891, M9892, M9893, M9894, M9895, M9896, M9897, M9898, M9899, M9900, M9901, M9902, M9903, M9904, M9905, M9906, M9907, M9908, M9909, M9910, M9911, M9912, M9913, M9914, M9915, M9916, M9917, M9918, M9919, M9920, M9921, M9922, M9923, M9924, M9925, M9926, M9927, M9928, M9929, M9930, M9931, M9932, M9933, M9934, M9935, M9936, M9937, M9938, M9939, M9940, M9941, M9942, M9943, M9944, M9945, M9946, M9947, M9948, M9949, M9950, M9951, M9952, M9953, M9954, M9955, M9956, M9957, M9958, M9959, M9960, M9961, M9962, M9963, M9964, M9965, M9966, M9967, M9968, M9969, M9970, M9971, M9972, M9973, M9974, M9975, M9976, M9977, M9978, M9979, M9980, M9981, M9982, M9983, M9984, M9985, M9986, M9987, M9988, M9989, M9990, M9991, M9992, M9993, M9994, M9995, M9996, M9997, M9998, M9999>(){ } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/libraries/System.Net.Http/src/System/Net/Http/Headers/HttpHeaders.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; using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Text; namespace System.Net.Http.Headers { /// <summary> /// Key/value pairs of headers. The value is either a raw <see cref="string"/> or a <see cref="HttpHeaders.HeaderStoreItemInfo"/>. /// We're using a custom type instead of <see cref="KeyValuePair{TKey, TValue}"/> because we need ref access to fields. /// </summary> internal struct HeaderEntry { public HeaderDescriptor Key; public object Value; public HeaderEntry(HeaderDescriptor key, object value) { Key = key; Value = value; } } public abstract class HttpHeaders : IEnumerable<KeyValuePair<string, IEnumerable<string>>> { // This type is used to store a collection of headers in 'headerStore': // - A header can have multiple values. // - A header can have an associated parser which is able to parse the raw string value into a strongly typed object. // - If a header has an associated parser and the provided raw value can't be parsed, the value is considered // invalid. Invalid values are stored if added using TryAddWithoutValidation(). If the value was added using Add(), // Add() will throw FormatException. // - Since parsing header values is expensive and users usually only care about a few headers, header values are // lazily initialized. // // Given the properties above, a header value can have three states: // - 'raw': The header value was added using TryAddWithoutValidation() and it wasn't parsed yet. // - 'parsed': The header value was successfully parsed. It was either added using Add() where the value was parsed // immediately, or if added using TryAddWithoutValidation() a user already accessed a property/method triggering the // value to be parsed. // - 'invalid': The header value was parsed, but parsing failed because the value is invalid. Storing invalid values // allows users to still retrieve the value (by calling GetValues()), but it will not be exposed as strongly typed // object. E.g. the client receives a response with the following header: 'Via: 1.1 proxy, invalid' // - HttpHeaders.GetValues() will return "1.1 proxy", "invalid" // - HttpResponseHeaders.Via collection will only contain one ViaHeaderValue object with value "1.1 proxy" /// <summary>Either a <see cref="HeaderEntry"/> array or a Dictionary&lt;<see cref="HeaderDescriptor"/>, <see cref="object"/>&gt; </summary> private object? _headerStore; private int _count; private readonly HttpHeaderType _allowedHeaderTypes; private readonly HttpHeaderType _treatAsCustomHeaderTypes; protected HttpHeaders() : this(HttpHeaderType.All, HttpHeaderType.None) { } internal HttpHeaders(HttpHeaderType allowedHeaderTypes, HttpHeaderType treatAsCustomHeaderTypes) { // Should be no overlap Debug.Assert((allowedHeaderTypes & treatAsCustomHeaderTypes) == 0); _allowedHeaderTypes = allowedHeaderTypes & ~HttpHeaderType.NonTrailing; _treatAsCustomHeaderTypes = treatAsCustomHeaderTypes & ~HttpHeaderType.NonTrailing; } /// <summary>Gets a view of the contents of this headers collection that does not parse nor validate the data upon access.</summary> public HttpHeadersNonValidated NonValidated => new HttpHeadersNonValidated(this); public void Add(string name, string? value) => Add(GetHeaderDescriptor(name), value); internal void Add(HeaderDescriptor descriptor, string? value) { // We don't use GetOrCreateHeaderInfo() here, since this would create a new header in the store. If parsing // the value then throws, we would have to remove the header from the store again. So just get a // HeaderStoreItemInfo object and try to parse the value. If it works, we'll add the header. PrepareHeaderInfoForAdd(descriptor, out HeaderStoreItemInfo info, out bool addToStore); ParseAndAddValue(descriptor, info, value); // If we get here, then the value could be parsed correctly. If we created a new HeaderStoreItemInfo, add // it to the store if we added at least one value. if (addToStore && (info.ParsedValue != null)) { Debug.Assert(!ContainsKey(descriptor)); AddEntryToStore(new HeaderEntry(descriptor, info)); } } public void Add(string name, IEnumerable<string?> values) => Add(GetHeaderDescriptor(name), values); internal void Add(HeaderDescriptor descriptor, IEnumerable<string?> values!!) { PrepareHeaderInfoForAdd(descriptor, out HeaderStoreItemInfo info, out bool addToStore); try { // Note that if the first couple of values are valid followed by an invalid value, the valid values // will be added to the store before the exception for the invalid value is thrown. foreach (string? value in values) { ParseAndAddValue(descriptor, info, value); } } finally { // Even if one of the values was invalid, make sure we add the header for the valid ones. We need to be // consistent here: If values get added to an _existing_ header, then all values until the invalid one // get added. Same here: If multiple values get added to a _new_ header, make sure the header gets added // with the valid values. // However, if all values for a _new_ header were invalid, then don't add the header. if (addToStore && (info.ParsedValue != null)) { Debug.Assert(!ContainsKey(descriptor)); AddEntryToStore(new HeaderEntry(descriptor, info)); } } } public bool TryAddWithoutValidation(string name, string? value) => TryGetHeaderDescriptor(name, out HeaderDescriptor descriptor) && TryAddWithoutValidation(descriptor, value); internal bool TryAddWithoutValidation(HeaderDescriptor descriptor, string? value) { // Normalize null values to be empty values, which are allowed. If the user adds multiple // null/empty values, all of them are added to the collection. This will result in delimiter-only // values, e.g. adding two null-strings (or empty, or whitespace-only) results in "My-Header: ,". value ??= string.Empty; ref object? storeValueRef = ref GetValueRefOrAddDefault(descriptor); object? currentValue = storeValueRef; if (currentValue is null) { storeValueRef = value; } else { if (currentValue is not HeaderStoreItemInfo info) { // The header store contained a single raw string value, so promote it // to being a HeaderStoreItemInfo and add to it. Debug.Assert(currentValue is string); storeValueRef = info = new HeaderStoreItemInfo() { RawValue = currentValue }; } AddRawValue(info, value); } return true; } public bool TryAddWithoutValidation(string name, IEnumerable<string?> values) => TryGetHeaderDescriptor(name, out HeaderDescriptor descriptor) && TryAddWithoutValidation(descriptor, values); internal bool TryAddWithoutValidation(HeaderDescriptor descriptor, IEnumerable<string?> values!!) { using IEnumerator<string?> enumerator = values.GetEnumerator(); if (enumerator.MoveNext()) { TryAddWithoutValidation(descriptor, enumerator.Current); if (enumerator.MoveNext()) { ref object? storeValueRef = ref GetValueRefOrAddDefault(descriptor); Debug.Assert(storeValueRef is not null); object value = storeValueRef; if (value is not HeaderStoreItemInfo info) { Debug.Assert(value is string); storeValueRef = info = new HeaderStoreItemInfo { RawValue = value }; } do { AddRawValue(info, enumerator.Current ?? string.Empty); } while (enumerator.MoveNext()); } } return true; } public IEnumerable<string> GetValues(string name) => GetValues(GetHeaderDescriptor(name)); internal IEnumerable<string> GetValues(HeaderDescriptor descriptor) { if (TryGetValues(descriptor, out IEnumerable<string>? values)) { return values; } throw new InvalidOperationException(SR.net_http_headers_not_found); } public bool TryGetValues(string name, [NotNullWhen(true)] out IEnumerable<string>? values) { if (TryGetHeaderDescriptor(name, out HeaderDescriptor descriptor)) { return TryGetValues(descriptor, out values); } values = null; return false; } internal bool TryGetValues(HeaderDescriptor descriptor, [NotNullWhen(true)] out IEnumerable<string>? values) { if (TryGetAndParseHeaderInfo(descriptor, out HeaderStoreItemInfo? info)) { values = GetStoreValuesAsStringArray(descriptor, info); return true; } values = null; return false; } public bool Contains(string name) => Contains(GetHeaderDescriptor(name)); internal bool Contains(HeaderDescriptor descriptor) { // We can't just call headerStore.ContainsKey() since after parsing the value the header may not exist // anymore (if the value contains newline chars, we remove the header). So try to parse the // header value. return TryGetAndParseHeaderInfo(descriptor, out _); } public override string ToString() { // Return all headers as string similar to: // HeaderName1: Value1, Value2 // HeaderName2: Value1 // ... var vsb = new ValueStringBuilder(stackalloc char[512]); foreach (HeaderEntry entry in GetEntries()) { vsb.Append(entry.Key.Name); vsb.Append(": "); GetStoreValuesAsStringOrStringArray(entry.Key, entry.Value, out string? singleValue, out string[]? multiValue); Debug.Assert(singleValue is not null ^ multiValue is not null); if (singleValue is not null) { vsb.Append(singleValue); } else { // Note that if we get multiple values for a header that doesn't support multiple values, we'll // just separate the values using a comma (default separator). string? separator = entry.Key.Parser is HttpHeaderParser parser && parser.SupportsMultipleValues ? parser.Separator : HttpHeaderParser.DefaultSeparator; Debug.Assert(multiValue is not null && multiValue.Length > 0); vsb.Append(multiValue[0]); for (int i = 1; i < multiValue.Length; i++) { vsb.Append(separator); vsb.Append(multiValue[i]); } } vsb.Append(Environment.NewLine); } return vsb.ToString(); } internal string GetHeaderString(HeaderDescriptor descriptor) { if (TryGetHeaderValue(descriptor, out object? info)) { GetStoreValuesAsStringOrStringArray(descriptor, info, out string? singleValue, out string[]? multiValue); Debug.Assert(singleValue is not null ^ multiValue is not null); if (singleValue is not null) { return singleValue; } // Note that if we get multiple values for a header that doesn't support multiple values, we'll // just separate the values using a comma (default separator). string? separator = descriptor.Parser != null && descriptor.Parser.SupportsMultipleValues ? descriptor.Parser.Separator : HttpHeaderParser.DefaultSeparator; return string.Join(separator, multiValue!); } return string.Empty; } #region IEnumerable<KeyValuePair<string, IEnumerable<string>>> Members public IEnumerator<KeyValuePair<string, IEnumerable<string>>> GetEnumerator() => _count == 0 ? ((IEnumerable<KeyValuePair<string, IEnumerable<string>>>)Array.Empty<KeyValuePair<string, IEnumerable<string>>>()).GetEnumerator() : GetEnumeratorCore(); private IEnumerator<KeyValuePair<string, IEnumerable<string>>> GetEnumeratorCore() { HeaderEntry[]? entries = GetEntriesArray(); Debug.Assert(_count != 0 && entries is not null, "Caller should have validated the collection is not empty"); int count = _count; for (int i = 0; i < count; i++) { HeaderEntry entry = entries[i]; if (entry.Value is not HeaderStoreItemInfo info) { // To retain consistent semantics, we need to upgrade a raw string to a HeaderStoreItemInfo // during enumeration so that we can parse the raw value in order to a) return // the correct set of parsed values, and b) update the instance for subsequent enumerations // to reflect that parsing. info = new HeaderStoreItemInfo() { RawValue = entry.Value }; if (EntriesAreLiveView) { entries[i].Value = info; } else { Debug.Assert(ContainsKey(entry.Key)); ((Dictionary<HeaderDescriptor, object>)_headerStore!)[entry.Key] = info; } } // Make sure we parse all raw values before returning the result. Note that this has to be // done before we calculate the array length (next line): A raw value may contain a list of // values. if (!ParseRawHeaderValues(entry.Key, info)) { // We saw an invalid header value (contains newline chars) and deleted it. // If the HeaderEntry[] we are enumerating is the live header store, the entries have shifted. if (EntriesAreLiveView) { i--; count--; } } else { string[] values = GetStoreValuesAsStringArray(entry.Key, info); yield return new KeyValuePair<string, IEnumerable<string>>(entry.Key.Name, values); } } } #endregion #region IEnumerable Members Collections.IEnumerator Collections.IEnumerable.GetEnumerator() => GetEnumerator(); #endregion internal void AddParsedValue(HeaderDescriptor descriptor, object value) { Debug.Assert(value != null); Debug.Assert(descriptor.Parser != null, "Can't add parsed value if there is no parser available."); HeaderStoreItemInfo info = GetOrCreateHeaderInfo(descriptor); // If the current header has only one value, we can't add another value. The strongly typed property // must not call AddParsedValue(), but SetParsedValue(). E.g. for headers like 'Date', 'Host'. Debug.Assert(descriptor.Parser.SupportsMultipleValues, $"Header '{descriptor.Name}' doesn't support multiple values"); AddParsedValue(info, value); } internal void SetParsedValue(HeaderDescriptor descriptor, object value) { Debug.Assert(value != null); Debug.Assert(descriptor.Parser != null, "Can't add parsed value if there is no parser available."); // This method will first clear all values. This is used e.g. when setting the 'Date' or 'Host' header. // i.e. headers not supporting collections. HeaderStoreItemInfo info = GetOrCreateHeaderInfo(descriptor); info.InvalidValue = null; info.ParsedValue = null; info.RawValue = null; AddParsedValue(info, value); } internal void SetOrRemoveParsedValue(HeaderDescriptor descriptor, object? value) { if (value == null) { Remove(descriptor); } else { SetParsedValue(descriptor, value); } } public bool Remove(string name) => Remove(GetHeaderDescriptor(name)); internal bool RemoveParsedValue(HeaderDescriptor descriptor, object value) { Debug.Assert(value != null); // If we have a value for this header, then verify if we have a single value. If so, compare that // value with 'item'. If we have a list of values, then remove 'item' from the list. if (TryGetAndParseHeaderInfo(descriptor, out HeaderStoreItemInfo? info)) { Debug.Assert(descriptor.Parser != null, "Can't add parsed value if there is no parser available."); Debug.Assert(descriptor.Parser.SupportsMultipleValues, "This method should not be used for single-value headers. Use Remove(string) instead."); // If there is no entry, just return. if (info.ParsedValue == null) { return false; } bool result = false; IEqualityComparer? comparer = descriptor.Parser.Comparer; List<object>? parsedValues = info.ParsedValue as List<object>; if (parsedValues == null) { Debug.Assert(info.ParsedValue.GetType() == value.GetType(), "Stored value does not have the same type as 'value'."); if (AreEqual(value, info.ParsedValue, comparer)) { info.ParsedValue = null; result = true; } } else { foreach (object item in parsedValues) { Debug.Assert(item.GetType() == value.GetType(), "One of the stored values does not have the same type as 'value'."); if (AreEqual(value, item, comparer)) { // Remove 'item' rather than 'value', since the 'comparer' may consider two values // equal even though the default obj.Equals() may not (e.g. if 'comparer' does // case-insensitive comparison for strings, but string.Equals() is case-sensitive). result = parsedValues.Remove(item); break; } } // If we removed the last item in a list, remove the list. if (parsedValues.Count == 0) { info.ParsedValue = null; } } // If there is no value for the header left, remove the header. if (info.IsEmpty) { bool headerRemoved = Remove(descriptor); Debug.Assert(headerRemoved, $"Existing header '{descriptor.Name}' couldn't be removed."); } return result; } return false; } internal bool ContainsParsedValue(HeaderDescriptor descriptor, object value) { Debug.Assert(value != null); // If we have a value for this header, then verify if we have a single value. If so, compare that // value with 'item'. If we have a list of values, then compare each item in the list with 'item'. if (TryGetAndParseHeaderInfo(descriptor, out HeaderStoreItemInfo? info)) { Debug.Assert(descriptor.Parser != null, "Can't add parsed value if there is no parser available."); Debug.Assert(descriptor.Parser.SupportsMultipleValues, "This method should not be used for single-value headers. Use equality comparer instead."); // If there is no entry, just return. if (info.ParsedValue == null) { return false; } List<object>? parsedValues = info.ParsedValue as List<object>; IEqualityComparer? comparer = descriptor.Parser.Comparer; if (parsedValues == null) { Debug.Assert(info.ParsedValue.GetType() == value.GetType(), "Stored value does not have the same type as 'value'."); return AreEqual(value, info.ParsedValue, comparer); } else { foreach (object item in parsedValues) { Debug.Assert(item.GetType() == value.GetType(), "One of the stored values does not have the same type as 'value'."); if (AreEqual(value, item, comparer)) { return true; } } return false; } } return false; } internal virtual void AddHeaders(HttpHeaders sourceHeaders) { Debug.Assert(sourceHeaders != null); Debug.Assert(GetType() == sourceHeaders.GetType(), "Can only copy headers from an instance of the same type."); // Only add header values if they're not already set on the message. Note that we don't merge // collections: If both the default headers and the message have set some values for a certain // header, then we don't try to merge the values. if (_count == 0 && sourceHeaders._headerStore is HeaderEntry[] sourceEntries) { // If the target collection is empty, we don't have to search for existing values _count = sourceHeaders._count; if (_headerStore is not HeaderEntry[] entries || entries.Length < _count) { entries = new HeaderEntry[sourceEntries.Length]; _headerStore = entries; } for (int i = 0; i < _count && i < sourceEntries.Length; i++) { HeaderEntry entry = sourceEntries[i]; if (entry.Value is HeaderStoreItemInfo info) { entry.Value = CloneHeaderInfo(entry.Key, info); } entries[i] = entry; } } else { foreach (HeaderEntry entry in sourceHeaders.GetEntries()) { ref object? storeValueRef = ref GetValueRefOrAddDefault(entry.Key); if (storeValueRef is null) { object sourceValue = entry.Value; if (sourceValue is HeaderStoreItemInfo info) { storeValueRef = CloneHeaderInfo(entry.Key, info); } else { Debug.Assert(sourceValue is string); storeValueRef = sourceValue; } } } } } private HeaderStoreItemInfo CloneHeaderInfo(HeaderDescriptor descriptor, HeaderStoreItemInfo sourceInfo) { var destinationInfo = new HeaderStoreItemInfo { // Always copy raw values RawValue = CloneStringHeaderInfoValues(sourceInfo.RawValue) }; if (descriptor.Parser == null) { // We have custom header values. The parsed values are strings. // Custom header values are always stored as string or list of strings. Debug.Assert(sourceInfo.InvalidValue == null, "No invalid values expected for custom headers."); destinationInfo.ParsedValue = CloneStringHeaderInfoValues(sourceInfo.ParsedValue); } else { // We have a parser, so we also have to copy invalid values and clone parsed values. // Invalid values are always strings. Strings are immutable. So we only have to clone the // collection (if there is one). destinationInfo.InvalidValue = CloneStringHeaderInfoValues(sourceInfo.InvalidValue); // Now clone and add parsed values (if any). if (sourceInfo.ParsedValue != null) { List<object>? sourceValues = sourceInfo.ParsedValue as List<object>; if (sourceValues == null) { CloneAndAddValue(destinationInfo, sourceInfo.ParsedValue); } else { foreach (object item in sourceValues) { CloneAndAddValue(destinationInfo, item); } } } } return destinationInfo; } private static void CloneAndAddValue(HeaderStoreItemInfo destinationInfo, object source) { // We only have one value. Clone it and assign it to the store. if (source is ICloneable cloneableValue) { AddParsedValue(destinationInfo, cloneableValue.Clone()); } else { // If it doesn't implement ICloneable, it's a value type or an immutable type like String/Uri. AddParsedValue(destinationInfo, source); } } [return: NotNullIfNotNull("source")] private static object? CloneStringHeaderInfoValues(object? source) { if (source == null) { return null; } List<object>? sourceValues = source as List<object>; if (sourceValues == null) { // If we just have one value, return the reference to the string (strings are immutable so it's OK // to use the reference). return source; } else { // If we have a list of strings, create a new list and copy all strings to the new list. return new List<object>(sourceValues); } } private HeaderStoreItemInfo GetOrCreateHeaderInfo(HeaderDescriptor descriptor) { if (TryGetAndParseHeaderInfo(descriptor, out HeaderStoreItemInfo? info)) { return info; } else { return CreateAndAddHeaderToStore(descriptor); } } private HeaderStoreItemInfo CreateAndAddHeaderToStore(HeaderDescriptor descriptor) { Debug.Assert(!ContainsKey(descriptor)); // If we don't have the header in the store yet, add it now. HeaderStoreItemInfo result = new HeaderStoreItemInfo(); // If the descriptor header type is in _treatAsCustomHeaderTypes, it must be converted to a custom header before calling this method Debug.Assert((descriptor.HeaderType & _treatAsCustomHeaderTypes) == 0); AddEntryToStore(new HeaderEntry(descriptor, result)); return result; } internal bool TryGetHeaderValue(HeaderDescriptor descriptor, [NotNullWhen(true)] out object? value) { ref object storeValueRef = ref GetValueRefOrNullRef(descriptor); if (Unsafe.IsNullRef(ref storeValueRef)) { value = null; return false; } else { value = storeValueRef; return true; } } private bool TryGetAndParseHeaderInfo(HeaderDescriptor key, [NotNullWhen(true)] out HeaderStoreItemInfo? info) { ref object storeValueRef = ref GetValueRefOrNullRef(key); if (!Unsafe.IsNullRef(ref storeValueRef)) { object value = storeValueRef; if (value is HeaderStoreItemInfo hsi) { info = hsi; } else { Debug.Assert(value is string); storeValueRef = info = new HeaderStoreItemInfo() { RawValue = value }; } return ParseRawHeaderValues(key, info); } info = null; return false; } private bool ParseRawHeaderValues(HeaderDescriptor descriptor, HeaderStoreItemInfo info) { // Unlike TryGetHeaderInfo() this method tries to parse all non-validated header values (if any) // before returning to the caller. Debug.Assert(!info.IsEmpty); if (info.RawValue != null) { List<string>? rawValues = info.RawValue as List<string>; if (rawValues == null) { ParseSingleRawHeaderValue(descriptor, info); } else { ParseMultipleRawHeaderValues(descriptor, info, rawValues); } // At this point all values are either in info.ParsedValue, info.InvalidValue, or were removed since they // contain newline chars. Reset RawValue. info.RawValue = null; // During parsing, we removed the value since it contains newline chars. Return false to indicate that // this is an empty header. if ((info.InvalidValue == null) && (info.ParsedValue == null)) { // After parsing the raw value, no value is left because all values contain newline chars. Debug.Assert(_count > 0); Remove(descriptor); return false; } } return true; } private static void ParseMultipleRawHeaderValues(HeaderDescriptor descriptor, HeaderStoreItemInfo info, List<string> rawValues) { if (descriptor.Parser == null) { foreach (string rawValue in rawValues) { if (!ContainsNewLine(rawValue, descriptor)) { AddParsedValue(info, rawValue); } } } else { foreach (string rawValue in rawValues) { if (!TryParseAndAddRawHeaderValue(descriptor, info, rawValue, true)) { if (NetEventSource.Log.IsEnabled()) NetEventSource.Log.HeadersInvalidValue(descriptor.Name, rawValue); } } } } private static void ParseSingleRawHeaderValue(HeaderDescriptor descriptor, HeaderStoreItemInfo info) { string? rawValue = info.RawValue as string; Debug.Assert(rawValue != null, "RawValue must either be List<string> or string."); if (descriptor.Parser == null) { if (!ContainsNewLine(rawValue, descriptor)) { AddParsedValue(info, rawValue); } } else { if (!TryParseAndAddRawHeaderValue(descriptor, info, rawValue, true)) { if (NetEventSource.Log.IsEnabled()) NetEventSource.Log.HeadersInvalidValue(descriptor.Name, rawValue); } } } // See Add(name, string) internal bool TryParseAndAddValue(HeaderDescriptor descriptor, string? value) { // We don't use GetOrCreateHeaderInfo() here, since this would create a new header in the store. If parsing // the value then throws, we would have to remove the header from the store again. So just get a // HeaderStoreItemInfo object and try to parse the value. If it works, we'll add the header. HeaderStoreItemInfo info; bool addToStore; PrepareHeaderInfoForAdd(descriptor, out info, out addToStore); bool result = TryParseAndAddRawHeaderValue(descriptor, info, value, false); if (result && addToStore && (info.ParsedValue != null)) { // If we get here, then the value could be parsed correctly. If we created a new HeaderStoreItemInfo, add // it to the store if we added at least one value. Debug.Assert(!ContainsKey(descriptor)); AddEntryToStore(new HeaderEntry(descriptor, info)); } return result; } // See ParseAndAddValue private static bool TryParseAndAddRawHeaderValue(HeaderDescriptor descriptor, HeaderStoreItemInfo info, string? value, bool addWhenInvalid) { Debug.Assert(info != null); Debug.Assert(descriptor.Parser != null); // Values are added as 'invalid' if we either can't parse the value OR if we already have a value // and the current header doesn't support multiple values: e.g. trying to add a date/time value // to the 'Date' header if we already have a date/time value will result in the second value being // added to the 'invalid' header values. if (!info.CanAddParsedValue(descriptor.Parser)) { if (addWhenInvalid) { AddInvalidValue(info, value ?? string.Empty); } return false; } int index = 0; if (descriptor.Parser.TryParseValue(value, info.ParsedValue, ref index, out object? parsedValue)) { // The raw string only represented one value (which was successfully parsed). Add the value and return. if ((value == null) || (index == value.Length)) { if (parsedValue != null) { AddParsedValue(info, parsedValue); } return true; } Debug.Assert(index < value.Length, "Parser must return an index value within the string length."); // If we successfully parsed a value, but there are more left to read, store the results in a temp // list. Only when all values are parsed successfully write the list to the store. List<object> parsedValues = new List<object>(); if (parsedValue != null) { parsedValues.Add(parsedValue); } while (index < value.Length) { if (descriptor.Parser.TryParseValue(value, info.ParsedValue, ref index, out parsedValue)) { if (parsedValue != null) { parsedValues.Add(parsedValue); } } else { if (!ContainsNewLine(value, descriptor) && addWhenInvalid) { AddInvalidValue(info, value); } return false; } } // All values were parsed correctly. Copy results to the store. foreach (object item in parsedValues) { AddParsedValue(info, item); } return true; } Debug.Assert(value != null); if (!ContainsNewLine(value, descriptor) && addWhenInvalid) { AddInvalidValue(info, value ?? string.Empty); } return false; } private static void AddParsedValue(HeaderStoreItemInfo info, object value) { Debug.Assert(!(value is List<object>), "Header value types must not derive from List<object> since this type is used internally to store " + "lists of values. So we would not be able to distinguish between a single value and a list of values."); AddValueToStoreValue<object>(value, ref info.ParsedValue); } private static void AddInvalidValue(HeaderStoreItemInfo info, string value) { AddValueToStoreValue<string>(value, ref info.InvalidValue); } private static void AddRawValue(HeaderStoreItemInfo info, string value) { AddValueToStoreValue<string>(value, ref info.RawValue); } private static void AddValueToStoreValue<T>(T value, ref object? currentStoreValue) where T : class { // If there is no value set yet, then add current item as value (we don't create a list // if not required). If 'info.Value' is already assigned then make sure 'info.Value' is a // List<T> and append 'item' to the list. if (currentStoreValue == null) { currentStoreValue = value; } else { List<T>? storeValues = currentStoreValue as List<T>; if (storeValues == null) { storeValues = new List<T>(2); Debug.Assert(currentStoreValue is T); storeValues.Add((T)currentStoreValue); currentStoreValue = storeValues; } Debug.Assert(value is T); storeValues.Add((T)value); } } // Since most of the time we just have 1 value, we don't create a List<object> for one value, but we change // the return type to 'object'. The caller has to deal with the return type (object vs. List<object>). This // is to optimize the most common scenario where a header has only one value. internal object? GetParsedValues(HeaderDescriptor descriptor) { if (!TryGetAndParseHeaderInfo(descriptor, out HeaderStoreItemInfo? info)) { return null; } return info.ParsedValue; } internal virtual bool IsAllowedHeaderName(HeaderDescriptor descriptor) => true; private void PrepareHeaderInfoForAdd(HeaderDescriptor descriptor, out HeaderStoreItemInfo info, out bool addToStore) { if (!IsAllowedHeaderName(descriptor)) { throw new InvalidOperationException(SR.Format(SR.net_http_headers_not_allowed_header_name, descriptor.Name)); } addToStore = false; if (!TryGetAndParseHeaderInfo(descriptor, out info!)) { info = new HeaderStoreItemInfo(); addToStore = true; } } private void ParseAndAddValue(HeaderDescriptor descriptor, HeaderStoreItemInfo info, string? value) { Debug.Assert(info != null); if (descriptor.Parser == null) { // If we don't have a parser for the header, we consider the value valid if it doesn't contains // newline characters. We add the values as "parsed value". Note that we allow empty values. CheckContainsNewLine(value); AddParsedValue(info, value ?? string.Empty); return; } // If the header only supports 1 value, we can add the current value only if there is no // value already set. if (!info.CanAddParsedValue(descriptor.Parser)) { throw new FormatException(SR.Format(System.Globalization.CultureInfo.InvariantCulture, SR.net_http_headers_single_value_header, descriptor.Name)); } int index = 0; object parsedValue = descriptor.Parser.ParseValue(value, info.ParsedValue, ref index); // The raw string only represented one value (which was successfully parsed). Add the value and return. // If value is null we still have to first call ParseValue() to allow the parser to decide whether null is // a valid value. If it is (i.e. no exception thrown), we set the parsed value (if any) and return. if ((value == null) || (index == value.Length)) { // If the returned value is null, then it means the header accepts empty values. i.e. we don't throw // but we don't add 'null' to the store either. if (parsedValue != null) { AddParsedValue(info, parsedValue); } return; } Debug.Assert(index < value.Length, "Parser must return an index value within the string length."); // If we successfully parsed a value, but there are more left to read, store the results in a temp // list. Only when all values are parsed successfully write the list to the store. List<object> parsedValues = new List<object>(); if (parsedValue != null) { parsedValues.Add(parsedValue); } while (index < value.Length) { parsedValue = descriptor.Parser.ParseValue(value, info.ParsedValue, ref index); if (parsedValue != null) { parsedValues.Add(parsedValue); } } // All values were parsed correctly. Copy results to the store. foreach (object item in parsedValues) { AddParsedValue(info, item); } } private HeaderDescriptor GetHeaderDescriptor(string name) { if (string.IsNullOrEmpty(name)) { throw new ArgumentException(SR.net_http_argument_empty_string, nameof(name)); } if (!HeaderDescriptor.TryGet(name, out HeaderDescriptor descriptor)) { throw new FormatException(SR.net_http_headers_invalid_header_name); } if ((descriptor.HeaderType & _allowedHeaderTypes) != 0) { return descriptor; } else if ((descriptor.HeaderType & _treatAsCustomHeaderTypes) != 0) { return descriptor.AsCustomHeader(); } throw new InvalidOperationException(SR.Format(SR.net_http_headers_not_allowed_header_name, name)); } internal bool TryGetHeaderDescriptor(string name, out HeaderDescriptor descriptor) { if (string.IsNullOrEmpty(name)) { descriptor = default; return false; } if (HeaderDescriptor.TryGet(name, out descriptor)) { HttpHeaderType headerType = descriptor.HeaderType; if ((headerType & _allowedHeaderTypes) != 0) { return true; } if ((headerType & _treatAsCustomHeaderTypes) != 0) { descriptor = descriptor.AsCustomHeader(); return true; } } return false; } internal static void CheckContainsNewLine(string? value) { if (value == null) { return; } if (HttpRuleParser.ContainsNewLine(value)) { throw new FormatException(SR.net_http_headers_no_newlines); } } private static bool ContainsNewLine(string value, HeaderDescriptor descriptor) { if (HttpRuleParser.ContainsNewLine(value)) { if (NetEventSource.Log.IsEnabled()) NetEventSource.Error(null, SR.Format(SR.net_http_log_headers_no_newlines, descriptor.Name, value)); return true; } return false; } internal static string[] GetStoreValuesAsStringArray(HeaderDescriptor descriptor, HeaderStoreItemInfo info) { GetStoreValuesAsStringOrStringArray(descriptor, info, out string? singleValue, out string[]? multiValue); Debug.Assert(singleValue is not null ^ multiValue is not null); return multiValue ?? new[] { singleValue! }; } internal static void GetStoreValuesAsStringOrStringArray(HeaderDescriptor descriptor, object sourceValues, out string? singleValue, out string[]? multiValue) { HeaderStoreItemInfo? info = sourceValues as HeaderStoreItemInfo; if (info is null) { Debug.Assert(sourceValues is string); singleValue = (string)sourceValues; multiValue = null; return; } int length = GetValueCount(info); Span<string?> values; singleValue = null; if (length == 1) { multiValue = null; values = MemoryMarshal.CreateSpan(ref singleValue, 1); } else { Debug.Assert(length > 1, "The header should have been removed when it became empty"); values = multiValue = new string[length]; } int currentIndex = 0; ReadStoreValues<string?>(values, info.RawValue, null, ref currentIndex); ReadStoreValues<object?>(values, info.ParsedValue, descriptor.Parser, ref currentIndex); ReadStoreValues<string?>(values, info.InvalidValue, null, ref currentIndex); Debug.Assert(currentIndex == length); } internal static int GetStoreValuesIntoStringArray(HeaderDescriptor descriptor, object sourceValues, [NotNull] ref string[]? values) { values ??= Array.Empty<string>(); HeaderStoreItemInfo? info = sourceValues as HeaderStoreItemInfo; if (info is null) { Debug.Assert(sourceValues is string); if (values.Length == 0) { values = new string[1]; } values[0] = (string)sourceValues; return 1; } int length = GetValueCount(info); if (length > 0) { if (values.Length < length) { values = new string[length]; } int currentIndex = 0; ReadStoreValues<string?>(values, info.RawValue, null, ref currentIndex); ReadStoreValues<object?>(values, info.ParsedValue, descriptor.Parser, ref currentIndex); ReadStoreValues<string?>(values, info.InvalidValue, null, ref currentIndex); Debug.Assert(currentIndex == length); } return length; } private static int GetValueCount(HeaderStoreItemInfo info) { Debug.Assert(info != null); int valueCount = Count<string>(info.RawValue); valueCount += Count<string>(info.InvalidValue); valueCount += Count<object>(info.ParsedValue); return valueCount; static int Count<T>(object? valueStore) => valueStore is null ? 0 : valueStore is List<T> list ? list.Count : 1; } private static void ReadStoreValues<T>(Span<string?> values, object? storeValue, HttpHeaderParser? parser, ref int currentIndex) { if (storeValue != null) { List<T>? storeValues = storeValue as List<T>; if (storeValues == null) { values[currentIndex] = parser == null ? storeValue.ToString() : parser.ToString(storeValue); currentIndex++; } else { foreach (object? item in storeValues) { Debug.Assert(item != null); values[currentIndex] = parser == null ? item.ToString() : parser.ToString(item); currentIndex++; } } } } private bool AreEqual(object value, object? storeValue, IEqualityComparer? comparer) { Debug.Assert(value != null); if (comparer != null) { return comparer.Equals(value, storeValue); } // We don't have a comparer, so use the Equals() method. return value.Equals(storeValue); } internal sealed class HeaderStoreItemInfo { internal HeaderStoreItemInfo() { } internal object? RawValue; internal object? InvalidValue; internal object? ParsedValue; internal bool CanAddParsedValue(HttpHeaderParser parser) { Debug.Assert(parser != null, "There should be no reason to call CanAddValue if there is no parser for the current header."); // If the header only supports one value, and we have already a value set, then we can't add // another value. E.g. the 'Date' header only supports one value. We can't add multiple timestamps // to 'Date'. // So if this is a known header, ask the parser if it supports multiple values and check whether // we already have a (valid or invalid) value. // Note that we ignore the rawValue by purpose: E.g. we are parsing 2 raw values for a header only // supporting 1 value. When the first value gets parsed, CanAddValue returns true and we add the // parsed value to ParsedValue. When the second value is parsed, CanAddValue returns false, because // we have already a parsed value. return parser.SupportsMultipleValues || ((InvalidValue == null) && (ParsedValue == null)); } internal bool IsEmpty => (RawValue == null) && (InvalidValue == null) && (ParsedValue == null); } #region Low-level implementation details that work with _headerStore directly // Used to store the CollectionsMarshal.GetValueRefOrAddDefault out parameter. // This is a workaround for the Roslyn bug where we can't use a discard instead: // https://github.com/dotnet/roslyn/issues/56587#issuecomment-934955526 private static bool s_dictionaryGetValueRefOrAddDefaultExistsDummy; private const int InitialCapacity = 4; internal const int ArrayThreshold = 64; // Above this threshold, header ordering will not be preserved internal HeaderEntry[]? GetEntriesArray() { object? store = _headerStore; if (store is null) { return null; } else if (store is HeaderEntry[] entries) { return entries; } else { return GetEntriesFromDictionary(); } HeaderEntry[] GetEntriesFromDictionary() { var dictionary = (Dictionary<HeaderDescriptor, object>)_headerStore!; var entries = new HeaderEntry[dictionary.Count]; int i = 0; foreach (KeyValuePair<HeaderDescriptor, object> entry in dictionary) { entries[i++] = new HeaderEntry { Key = entry.Key, Value = entry.Value }; } return entries; } } internal ReadOnlySpan<HeaderEntry> GetEntries() { return new ReadOnlySpan<HeaderEntry>(GetEntriesArray(), 0, _count); } internal int Count => _count; private bool EntriesAreLiveView => _headerStore is HeaderEntry[]; private ref object GetValueRefOrNullRef(HeaderDescriptor key) { ref object valueRef = ref Unsafe.NullRef<object>(); object? store = _headerStore; if (store is HeaderEntry[] entries) { for (int i = 0; i < _count && i < entries.Length; i++) { if (key.Equals(entries[i].Key)) { valueRef = ref entries[i].Value; break; } } } else if (store is not null) { valueRef = ref CollectionsMarshal.GetValueRefOrNullRef(Unsafe.As<Dictionary<HeaderDescriptor, object>>(store), key); } return ref valueRef; } private ref object? GetValueRefOrAddDefault(HeaderDescriptor key) { object? store = _headerStore; if (store is HeaderEntry[] entries) { for (int i = 0; i < _count && i < entries.Length; i++) { if (key.Equals(entries[i].Key)) { return ref entries[i].Value!; } } int count = _count; _count++; if ((uint)count < (uint)entries.Length) { entries[count].Key = key; return ref entries[count].Value!; } return ref GrowEntriesAndAddDefault(key); } else if (store is null) { _count++; entries = new HeaderEntry[InitialCapacity]; _headerStore = entries; ref HeaderEntry firstEntry = ref MemoryMarshal.GetArrayDataReference(entries); firstEntry.Key = key; return ref firstEntry.Value!; } else { return ref DictionaryGetValueRefOrAddDefault(key); } ref object? GrowEntriesAndAddDefault(HeaderDescriptor key) { var entries = (HeaderEntry[])_headerStore!; if (entries.Length == ArrayThreshold) { return ref ConvertToDictionaryAndAddDefault(key); } else { Array.Resize(ref entries, entries.Length << 1); _headerStore = entries; ref HeaderEntry firstNewEntry = ref entries[entries.Length >> 1]; firstNewEntry.Key = key; return ref firstNewEntry.Value!; } } ref object? ConvertToDictionaryAndAddDefault(HeaderDescriptor key) { var entries = (HeaderEntry[])_headerStore!; var dictionary = new Dictionary<HeaderDescriptor, object>(ArrayThreshold); _headerStore = dictionary; foreach (HeaderEntry entry in entries) { dictionary.Add(entry.Key, entry.Value); } Debug.Assert(dictionary.Count == _count - 1); return ref CollectionsMarshal.GetValueRefOrAddDefault(dictionary, key, out s_dictionaryGetValueRefOrAddDefaultExistsDummy); } ref object? DictionaryGetValueRefOrAddDefault(HeaderDescriptor key) { var dictionary = (Dictionary<HeaderDescriptor, object>)_headerStore!; ref object? value = ref CollectionsMarshal.GetValueRefOrAddDefault(dictionary, key, out s_dictionaryGetValueRefOrAddDefaultExistsDummy); if (value is null) { _count++; } return ref value; } } private void AddEntryToStore(HeaderEntry entry) { Debug.Assert(!ContainsKey(entry.Key)); if (_headerStore is HeaderEntry[] entries) { int count = _count; if ((uint)count < (uint)entries.Length) { entries[count] = entry; _count++; return; } } GetValueRefOrAddDefault(entry.Key) = entry.Value; } internal bool ContainsKey(HeaderDescriptor key) { return !Unsafe.IsNullRef(ref GetValueRefOrNullRef(key)); } public void Clear() { if (_headerStore is HeaderEntry[] entries) { Array.Clear(entries, 0, _count); } else { _headerStore = null; } _count = 0; } internal bool Remove(HeaderDescriptor key) { bool removed = false; object? store = _headerStore; if (store is HeaderEntry[] entries) { for (int i = 0; i < _count && i < entries.Length; i++) { if (key.Equals(entries[i].Key)) { while (i + 1 < _count && (uint)(i + 1) < (uint)entries.Length) { entries[i] = entries[i + 1]; i++; } entries[i] = default; removed = true; break; } } } else if (store is not null) { removed = Unsafe.As<Dictionary<HeaderDescriptor, object>>(store).Remove(key); } if (removed) { _count--; } return removed; } #endregion // _headerStore implementation } }
// 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; using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Text; namespace System.Net.Http.Headers { /// <summary> /// Key/value pairs of headers. The value is either a raw <see cref="string"/> or a <see cref="HttpHeaders.HeaderStoreItemInfo"/>. /// We're using a custom type instead of <see cref="KeyValuePair{TKey, TValue}"/> because we need ref access to fields. /// </summary> internal struct HeaderEntry { public HeaderDescriptor Key; public object Value; public HeaderEntry(HeaderDescriptor key, object value) { Key = key; Value = value; } } public abstract class HttpHeaders : IEnumerable<KeyValuePair<string, IEnumerable<string>>> { // This type is used to store a collection of headers in 'headerStore': // - A header can have multiple values. // - A header can have an associated parser which is able to parse the raw string value into a strongly typed object. // - If a header has an associated parser and the provided raw value can't be parsed, the value is considered // invalid. Invalid values are stored if added using TryAddWithoutValidation(). If the value was added using Add(), // Add() will throw FormatException. // - Since parsing header values is expensive and users usually only care about a few headers, header values are // lazily initialized. // // Given the properties above, a header value can have three states: // - 'raw': The header value was added using TryAddWithoutValidation() and it wasn't parsed yet. // - 'parsed': The header value was successfully parsed. It was either added using Add() where the value was parsed // immediately, or if added using TryAddWithoutValidation() a user already accessed a property/method triggering the // value to be parsed. // - 'invalid': The header value was parsed, but parsing failed because the value is invalid. Storing invalid values // allows users to still retrieve the value (by calling GetValues()), but it will not be exposed as strongly typed // object. E.g. the client receives a response with the following header: 'Via: 1.1 proxy, invalid' // - HttpHeaders.GetValues() will return "1.1 proxy", "invalid" // - HttpResponseHeaders.Via collection will only contain one ViaHeaderValue object with value "1.1 proxy" /// <summary>Either a <see cref="HeaderEntry"/> array or a Dictionary&lt;<see cref="HeaderDescriptor"/>, <see cref="object"/>&gt; </summary> private object? _headerStore; private int _count; private readonly HttpHeaderType _allowedHeaderTypes; private readonly HttpHeaderType _treatAsCustomHeaderTypes; protected HttpHeaders() : this(HttpHeaderType.All, HttpHeaderType.None) { } internal HttpHeaders(HttpHeaderType allowedHeaderTypes, HttpHeaderType treatAsCustomHeaderTypes) { // Should be no overlap Debug.Assert((allowedHeaderTypes & treatAsCustomHeaderTypes) == 0); _allowedHeaderTypes = allowedHeaderTypes & ~HttpHeaderType.NonTrailing; _treatAsCustomHeaderTypes = treatAsCustomHeaderTypes & ~HttpHeaderType.NonTrailing; } /// <summary>Gets a view of the contents of this headers collection that does not parse nor validate the data upon access.</summary> public HttpHeadersNonValidated NonValidated => new HttpHeadersNonValidated(this); public void Add(string name, string? value) => Add(GetHeaderDescriptor(name), value); internal void Add(HeaderDescriptor descriptor, string? value) { // We don't use GetOrCreateHeaderInfo() here, since this would create a new header in the store. If parsing // the value then throws, we would have to remove the header from the store again. So just get a // HeaderStoreItemInfo object and try to parse the value. If it works, we'll add the header. PrepareHeaderInfoForAdd(descriptor, out HeaderStoreItemInfo info, out bool addToStore); ParseAndAddValue(descriptor, info, value); // If we get here, then the value could be parsed correctly. If we created a new HeaderStoreItemInfo, add // it to the store if we added at least one value. if (addToStore && (info.ParsedValue != null)) { Debug.Assert(!ContainsKey(descriptor)); AddEntryToStore(new HeaderEntry(descriptor, info)); } } public void Add(string name, IEnumerable<string?> values) => Add(GetHeaderDescriptor(name), values); internal void Add(HeaderDescriptor descriptor, IEnumerable<string?> values!!) { PrepareHeaderInfoForAdd(descriptor, out HeaderStoreItemInfo info, out bool addToStore); try { // Note that if the first couple of values are valid followed by an invalid value, the valid values // will be added to the store before the exception for the invalid value is thrown. foreach (string? value in values) { ParseAndAddValue(descriptor, info, value); } } finally { // Even if one of the values was invalid, make sure we add the header for the valid ones. We need to be // consistent here: If values get added to an _existing_ header, then all values until the invalid one // get added. Same here: If multiple values get added to a _new_ header, make sure the header gets added // with the valid values. // However, if all values for a _new_ header were invalid, then don't add the header. if (addToStore && (info.ParsedValue != null)) { Debug.Assert(!ContainsKey(descriptor)); AddEntryToStore(new HeaderEntry(descriptor, info)); } } } public bool TryAddWithoutValidation(string name, string? value) => TryGetHeaderDescriptor(name, out HeaderDescriptor descriptor) && TryAddWithoutValidation(descriptor, value); internal bool TryAddWithoutValidation(HeaderDescriptor descriptor, string? value) { // Normalize null values to be empty values, which are allowed. If the user adds multiple // null/empty values, all of them are added to the collection. This will result in delimiter-only // values, e.g. adding two null-strings (or empty, or whitespace-only) results in "My-Header: ,". value ??= string.Empty; ref object? storeValueRef = ref GetValueRefOrAddDefault(descriptor); object? currentValue = storeValueRef; if (currentValue is null) { storeValueRef = value; } else { if (currentValue is not HeaderStoreItemInfo info) { // The header store contained a single raw string value, so promote it // to being a HeaderStoreItemInfo and add to it. Debug.Assert(currentValue is string); storeValueRef = info = new HeaderStoreItemInfo() { RawValue = currentValue }; } AddRawValue(info, value); } return true; } public bool TryAddWithoutValidation(string name, IEnumerable<string?> values) => TryGetHeaderDescriptor(name, out HeaderDescriptor descriptor) && TryAddWithoutValidation(descriptor, values); internal bool TryAddWithoutValidation(HeaderDescriptor descriptor, IEnumerable<string?> values!!) { using IEnumerator<string?> enumerator = values.GetEnumerator(); if (enumerator.MoveNext()) { TryAddWithoutValidation(descriptor, enumerator.Current); if (enumerator.MoveNext()) { ref object? storeValueRef = ref GetValueRefOrAddDefault(descriptor); Debug.Assert(storeValueRef is not null); object value = storeValueRef; if (value is not HeaderStoreItemInfo info) { Debug.Assert(value is string); storeValueRef = info = new HeaderStoreItemInfo { RawValue = value }; } do { AddRawValue(info, enumerator.Current ?? string.Empty); } while (enumerator.MoveNext()); } } return true; } public IEnumerable<string> GetValues(string name) => GetValues(GetHeaderDescriptor(name)); internal IEnumerable<string> GetValues(HeaderDescriptor descriptor) { if (TryGetValues(descriptor, out IEnumerable<string>? values)) { return values; } throw new InvalidOperationException(SR.net_http_headers_not_found); } public bool TryGetValues(string name, [NotNullWhen(true)] out IEnumerable<string>? values) { if (TryGetHeaderDescriptor(name, out HeaderDescriptor descriptor)) { return TryGetValues(descriptor, out values); } values = null; return false; } internal bool TryGetValues(HeaderDescriptor descriptor, [NotNullWhen(true)] out IEnumerable<string>? values) { if (TryGetAndParseHeaderInfo(descriptor, out HeaderStoreItemInfo? info)) { values = GetStoreValuesAsStringArray(descriptor, info); return true; } values = null; return false; } public bool Contains(string name) => Contains(GetHeaderDescriptor(name)); internal bool Contains(HeaderDescriptor descriptor) { // We can't just call headerStore.ContainsKey() since after parsing the value the header may not exist // anymore (if the value contains newline chars, we remove the header). So try to parse the // header value. return TryGetAndParseHeaderInfo(descriptor, out _); } public override string ToString() { // Return all headers as string similar to: // HeaderName1: Value1, Value2 // HeaderName2: Value1 // ... var vsb = new ValueStringBuilder(stackalloc char[512]); foreach (HeaderEntry entry in GetEntries()) { vsb.Append(entry.Key.Name); vsb.Append(": "); GetStoreValuesAsStringOrStringArray(entry.Key, entry.Value, out string? singleValue, out string[]? multiValue); Debug.Assert(singleValue is not null ^ multiValue is not null); if (singleValue is not null) { vsb.Append(singleValue); } else { // Note that if we get multiple values for a header that doesn't support multiple values, we'll // just separate the values using a comma (default separator). string? separator = entry.Key.Parser is HttpHeaderParser parser && parser.SupportsMultipleValues ? parser.Separator : HttpHeaderParser.DefaultSeparator; Debug.Assert(multiValue is not null && multiValue.Length > 0); vsb.Append(multiValue[0]); for (int i = 1; i < multiValue.Length; i++) { vsb.Append(separator); vsb.Append(multiValue[i]); } } vsb.Append(Environment.NewLine); } return vsb.ToString(); } internal string GetHeaderString(HeaderDescriptor descriptor) { if (TryGetHeaderValue(descriptor, out object? info)) { GetStoreValuesAsStringOrStringArray(descriptor, info, out string? singleValue, out string[]? multiValue); Debug.Assert(singleValue is not null ^ multiValue is not null); if (singleValue is not null) { return singleValue; } // Note that if we get multiple values for a header that doesn't support multiple values, we'll // just separate the values using a comma (default separator). string? separator = descriptor.Parser != null && descriptor.Parser.SupportsMultipleValues ? descriptor.Parser.Separator : HttpHeaderParser.DefaultSeparator; return string.Join(separator, multiValue!); } return string.Empty; } #region IEnumerable<KeyValuePair<string, IEnumerable<string>>> Members public IEnumerator<KeyValuePair<string, IEnumerable<string>>> GetEnumerator() => _count == 0 ? ((IEnumerable<KeyValuePair<string, IEnumerable<string>>>)Array.Empty<KeyValuePair<string, IEnumerable<string>>>()).GetEnumerator() : GetEnumeratorCore(); private IEnumerator<KeyValuePair<string, IEnumerable<string>>> GetEnumeratorCore() { HeaderEntry[]? entries = GetEntriesArray(); Debug.Assert(_count != 0 && entries is not null, "Caller should have validated the collection is not empty"); int count = _count; for (int i = 0; i < count; i++) { HeaderEntry entry = entries[i]; if (entry.Value is not HeaderStoreItemInfo info) { // To retain consistent semantics, we need to upgrade a raw string to a HeaderStoreItemInfo // during enumeration so that we can parse the raw value in order to a) return // the correct set of parsed values, and b) update the instance for subsequent enumerations // to reflect that parsing. info = new HeaderStoreItemInfo() { RawValue = entry.Value }; if (EntriesAreLiveView) { entries[i].Value = info; } else { Debug.Assert(ContainsKey(entry.Key)); ((Dictionary<HeaderDescriptor, object>)_headerStore!)[entry.Key] = info; } } // Make sure we parse all raw values before returning the result. Note that this has to be // done before we calculate the array length (next line): A raw value may contain a list of // values. if (!ParseRawHeaderValues(entry.Key, info)) { // We saw an invalid header value (contains newline chars) and deleted it. // If the HeaderEntry[] we are enumerating is the live header store, the entries have shifted. if (EntriesAreLiveView) { i--; count--; } } else { string[] values = GetStoreValuesAsStringArray(entry.Key, info); yield return new KeyValuePair<string, IEnumerable<string>>(entry.Key.Name, values); } } } #endregion #region IEnumerable Members Collections.IEnumerator Collections.IEnumerable.GetEnumerator() => GetEnumerator(); #endregion internal void AddParsedValue(HeaderDescriptor descriptor, object value) { Debug.Assert(value != null); Debug.Assert(descriptor.Parser != null, "Can't add parsed value if there is no parser available."); HeaderStoreItemInfo info = GetOrCreateHeaderInfo(descriptor); // If the current header has only one value, we can't add another value. The strongly typed property // must not call AddParsedValue(), but SetParsedValue(). E.g. for headers like 'Date', 'Host'. Debug.Assert(descriptor.Parser.SupportsMultipleValues, $"Header '{descriptor.Name}' doesn't support multiple values"); AddParsedValue(info, value); } internal void SetParsedValue(HeaderDescriptor descriptor, object value) { Debug.Assert(value != null); Debug.Assert(descriptor.Parser != null, "Can't add parsed value if there is no parser available."); // This method will first clear all values. This is used e.g. when setting the 'Date' or 'Host' header. // i.e. headers not supporting collections. HeaderStoreItemInfo info = GetOrCreateHeaderInfo(descriptor); info.InvalidValue = null; info.ParsedValue = null; info.RawValue = null; AddParsedValue(info, value); } internal void SetOrRemoveParsedValue(HeaderDescriptor descriptor, object? value) { if (value == null) { Remove(descriptor); } else { SetParsedValue(descriptor, value); } } public bool Remove(string name) => Remove(GetHeaderDescriptor(name)); internal bool RemoveParsedValue(HeaderDescriptor descriptor, object value) { Debug.Assert(value != null); // If we have a value for this header, then verify if we have a single value. If so, compare that // value with 'item'. If we have a list of values, then remove 'item' from the list. if (TryGetAndParseHeaderInfo(descriptor, out HeaderStoreItemInfo? info)) { Debug.Assert(descriptor.Parser != null, "Can't add parsed value if there is no parser available."); Debug.Assert(descriptor.Parser.SupportsMultipleValues, "This method should not be used for single-value headers. Use Remove(string) instead."); // If there is no entry, just return. if (info.ParsedValue == null) { return false; } bool result = false; IEqualityComparer? comparer = descriptor.Parser.Comparer; List<object>? parsedValues = info.ParsedValue as List<object>; if (parsedValues == null) { Debug.Assert(info.ParsedValue.GetType() == value.GetType(), "Stored value does not have the same type as 'value'."); if (AreEqual(value, info.ParsedValue, comparer)) { info.ParsedValue = null; result = true; } } else { foreach (object item in parsedValues) { Debug.Assert(item.GetType() == value.GetType(), "One of the stored values does not have the same type as 'value'."); if (AreEqual(value, item, comparer)) { // Remove 'item' rather than 'value', since the 'comparer' may consider two values // equal even though the default obj.Equals() may not (e.g. if 'comparer' does // case-insensitive comparison for strings, but string.Equals() is case-sensitive). result = parsedValues.Remove(item); break; } } // If we removed the last item in a list, remove the list. if (parsedValues.Count == 0) { info.ParsedValue = null; } } // If there is no value for the header left, remove the header. if (info.IsEmpty) { bool headerRemoved = Remove(descriptor); Debug.Assert(headerRemoved, $"Existing header '{descriptor.Name}' couldn't be removed."); } return result; } return false; } internal bool ContainsParsedValue(HeaderDescriptor descriptor, object value) { Debug.Assert(value != null); // If we have a value for this header, then verify if we have a single value. If so, compare that // value with 'item'. If we have a list of values, then compare each item in the list with 'item'. if (TryGetAndParseHeaderInfo(descriptor, out HeaderStoreItemInfo? info)) { Debug.Assert(descriptor.Parser != null, "Can't add parsed value if there is no parser available."); Debug.Assert(descriptor.Parser.SupportsMultipleValues, "This method should not be used for single-value headers. Use equality comparer instead."); // If there is no entry, just return. if (info.ParsedValue == null) { return false; } List<object>? parsedValues = info.ParsedValue as List<object>; IEqualityComparer? comparer = descriptor.Parser.Comparer; if (parsedValues == null) { Debug.Assert(info.ParsedValue.GetType() == value.GetType(), "Stored value does not have the same type as 'value'."); return AreEqual(value, info.ParsedValue, comparer); } else { foreach (object item in parsedValues) { Debug.Assert(item.GetType() == value.GetType(), "One of the stored values does not have the same type as 'value'."); if (AreEqual(value, item, comparer)) { return true; } } return false; } } return false; } internal virtual void AddHeaders(HttpHeaders sourceHeaders) { Debug.Assert(sourceHeaders != null); Debug.Assert(GetType() == sourceHeaders.GetType(), "Can only copy headers from an instance of the same type."); // Only add header values if they're not already set on the message. Note that we don't merge // collections: If both the default headers and the message have set some values for a certain // header, then we don't try to merge the values. if (_count == 0 && sourceHeaders._headerStore is HeaderEntry[] sourceEntries) { // If the target collection is empty, we don't have to search for existing values _count = sourceHeaders._count; if (_headerStore is not HeaderEntry[] entries || entries.Length < _count) { entries = new HeaderEntry[sourceEntries.Length]; _headerStore = entries; } for (int i = 0; i < _count && i < sourceEntries.Length; i++) { HeaderEntry entry = sourceEntries[i]; if (entry.Value is HeaderStoreItemInfo info) { entry.Value = CloneHeaderInfo(entry.Key, info); } entries[i] = entry; } } else { foreach (HeaderEntry entry in sourceHeaders.GetEntries()) { ref object? storeValueRef = ref GetValueRefOrAddDefault(entry.Key); if (storeValueRef is null) { object sourceValue = entry.Value; if (sourceValue is HeaderStoreItemInfo info) { storeValueRef = CloneHeaderInfo(entry.Key, info); } else { Debug.Assert(sourceValue is string); storeValueRef = sourceValue; } } } } } private HeaderStoreItemInfo CloneHeaderInfo(HeaderDescriptor descriptor, HeaderStoreItemInfo sourceInfo) { var destinationInfo = new HeaderStoreItemInfo { // Always copy raw values RawValue = CloneStringHeaderInfoValues(sourceInfo.RawValue) }; if (descriptor.Parser == null) { // We have custom header values. The parsed values are strings. // Custom header values are always stored as string or list of strings. Debug.Assert(sourceInfo.InvalidValue == null, "No invalid values expected for custom headers."); destinationInfo.ParsedValue = CloneStringHeaderInfoValues(sourceInfo.ParsedValue); } else { // We have a parser, so we also have to copy invalid values and clone parsed values. // Invalid values are always strings. Strings are immutable. So we only have to clone the // collection (if there is one). destinationInfo.InvalidValue = CloneStringHeaderInfoValues(sourceInfo.InvalidValue); // Now clone and add parsed values (if any). if (sourceInfo.ParsedValue != null) { List<object>? sourceValues = sourceInfo.ParsedValue as List<object>; if (sourceValues == null) { CloneAndAddValue(destinationInfo, sourceInfo.ParsedValue); } else { foreach (object item in sourceValues) { CloneAndAddValue(destinationInfo, item); } } } } return destinationInfo; } private static void CloneAndAddValue(HeaderStoreItemInfo destinationInfo, object source) { // We only have one value. Clone it and assign it to the store. if (source is ICloneable cloneableValue) { AddParsedValue(destinationInfo, cloneableValue.Clone()); } else { // If it doesn't implement ICloneable, it's a value type or an immutable type like String/Uri. AddParsedValue(destinationInfo, source); } } [return: NotNullIfNotNull("source")] private static object? CloneStringHeaderInfoValues(object? source) { if (source == null) { return null; } List<object>? sourceValues = source as List<object>; if (sourceValues == null) { // If we just have one value, return the reference to the string (strings are immutable so it's OK // to use the reference). return source; } else { // If we have a list of strings, create a new list and copy all strings to the new list. return new List<object>(sourceValues); } } private HeaderStoreItemInfo GetOrCreateHeaderInfo(HeaderDescriptor descriptor) { if (TryGetAndParseHeaderInfo(descriptor, out HeaderStoreItemInfo? info)) { return info; } else { return CreateAndAddHeaderToStore(descriptor); } } private HeaderStoreItemInfo CreateAndAddHeaderToStore(HeaderDescriptor descriptor) { Debug.Assert(!ContainsKey(descriptor)); // If we don't have the header in the store yet, add it now. HeaderStoreItemInfo result = new HeaderStoreItemInfo(); // If the descriptor header type is in _treatAsCustomHeaderTypes, it must be converted to a custom header before calling this method Debug.Assert((descriptor.HeaderType & _treatAsCustomHeaderTypes) == 0); AddEntryToStore(new HeaderEntry(descriptor, result)); return result; } internal bool TryGetHeaderValue(HeaderDescriptor descriptor, [NotNullWhen(true)] out object? value) { ref object storeValueRef = ref GetValueRefOrNullRef(descriptor); if (Unsafe.IsNullRef(ref storeValueRef)) { value = null; return false; } else { value = storeValueRef; return true; } } private bool TryGetAndParseHeaderInfo(HeaderDescriptor key, [NotNullWhen(true)] out HeaderStoreItemInfo? info) { ref object storeValueRef = ref GetValueRefOrNullRef(key); if (!Unsafe.IsNullRef(ref storeValueRef)) { object value = storeValueRef; if (value is HeaderStoreItemInfo hsi) { info = hsi; } else { Debug.Assert(value is string); storeValueRef = info = new HeaderStoreItemInfo() { RawValue = value }; } return ParseRawHeaderValues(key, info); } info = null; return false; } private bool ParseRawHeaderValues(HeaderDescriptor descriptor, HeaderStoreItemInfo info) { // Unlike TryGetHeaderInfo() this method tries to parse all non-validated header values (if any) // before returning to the caller. Debug.Assert(!info.IsEmpty); if (info.RawValue != null) { List<string>? rawValues = info.RawValue as List<string>; if (rawValues == null) { ParseSingleRawHeaderValue(descriptor, info); } else { ParseMultipleRawHeaderValues(descriptor, info, rawValues); } // At this point all values are either in info.ParsedValue, info.InvalidValue, or were removed since they // contain newline chars. Reset RawValue. info.RawValue = null; // During parsing, we removed the value since it contains newline chars. Return false to indicate that // this is an empty header. if ((info.InvalidValue == null) && (info.ParsedValue == null)) { // After parsing the raw value, no value is left because all values contain newline chars. Debug.Assert(_count > 0); Remove(descriptor); return false; } } return true; } private static void ParseMultipleRawHeaderValues(HeaderDescriptor descriptor, HeaderStoreItemInfo info, List<string> rawValues) { if (descriptor.Parser == null) { foreach (string rawValue in rawValues) { if (!ContainsNewLine(rawValue, descriptor)) { AddParsedValue(info, rawValue); } } } else { foreach (string rawValue in rawValues) { if (!TryParseAndAddRawHeaderValue(descriptor, info, rawValue, true)) { if (NetEventSource.Log.IsEnabled()) NetEventSource.Log.HeadersInvalidValue(descriptor.Name, rawValue); } } } } private static void ParseSingleRawHeaderValue(HeaderDescriptor descriptor, HeaderStoreItemInfo info) { string? rawValue = info.RawValue as string; Debug.Assert(rawValue != null, "RawValue must either be List<string> or string."); if (descriptor.Parser == null) { if (!ContainsNewLine(rawValue, descriptor)) { AddParsedValue(info, rawValue); } } else { if (!TryParseAndAddRawHeaderValue(descriptor, info, rawValue, true)) { if (NetEventSource.Log.IsEnabled()) NetEventSource.Log.HeadersInvalidValue(descriptor.Name, rawValue); } } } // See Add(name, string) internal bool TryParseAndAddValue(HeaderDescriptor descriptor, string? value) { // We don't use GetOrCreateHeaderInfo() here, since this would create a new header in the store. If parsing // the value then throws, we would have to remove the header from the store again. So just get a // HeaderStoreItemInfo object and try to parse the value. If it works, we'll add the header. HeaderStoreItemInfo info; bool addToStore; PrepareHeaderInfoForAdd(descriptor, out info, out addToStore); bool result = TryParseAndAddRawHeaderValue(descriptor, info, value, false); if (result && addToStore && (info.ParsedValue != null)) { // If we get here, then the value could be parsed correctly. If we created a new HeaderStoreItemInfo, add // it to the store if we added at least one value. Debug.Assert(!ContainsKey(descriptor)); AddEntryToStore(new HeaderEntry(descriptor, info)); } return result; } // See ParseAndAddValue private static bool TryParseAndAddRawHeaderValue(HeaderDescriptor descriptor, HeaderStoreItemInfo info, string? value, bool addWhenInvalid) { Debug.Assert(info != null); Debug.Assert(descriptor.Parser != null); // Values are added as 'invalid' if we either can't parse the value OR if we already have a value // and the current header doesn't support multiple values: e.g. trying to add a date/time value // to the 'Date' header if we already have a date/time value will result in the second value being // added to the 'invalid' header values. if (!info.CanAddParsedValue(descriptor.Parser)) { if (addWhenInvalid) { AddInvalidValue(info, value ?? string.Empty); } return false; } int index = 0; if (descriptor.Parser.TryParseValue(value, info.ParsedValue, ref index, out object? parsedValue)) { // The raw string only represented one value (which was successfully parsed). Add the value and return. if ((value == null) || (index == value.Length)) { if (parsedValue != null) { AddParsedValue(info, parsedValue); } return true; } Debug.Assert(index < value.Length, "Parser must return an index value within the string length."); // If we successfully parsed a value, but there are more left to read, store the results in a temp // list. Only when all values are parsed successfully write the list to the store. List<object> parsedValues = new List<object>(); if (parsedValue != null) { parsedValues.Add(parsedValue); } while (index < value.Length) { if (descriptor.Parser.TryParseValue(value, info.ParsedValue, ref index, out parsedValue)) { if (parsedValue != null) { parsedValues.Add(parsedValue); } } else { if (!ContainsNewLine(value, descriptor) && addWhenInvalid) { AddInvalidValue(info, value); } return false; } } // All values were parsed correctly. Copy results to the store. foreach (object item in parsedValues) { AddParsedValue(info, item); } return true; } Debug.Assert(value != null); if (!ContainsNewLine(value, descriptor) && addWhenInvalid) { AddInvalidValue(info, value ?? string.Empty); } return false; } private static void AddParsedValue(HeaderStoreItemInfo info, object value) { Debug.Assert(!(value is List<object>), "Header value types must not derive from List<object> since this type is used internally to store " + "lists of values. So we would not be able to distinguish between a single value and a list of values."); AddValueToStoreValue<object>(value, ref info.ParsedValue); } private static void AddInvalidValue(HeaderStoreItemInfo info, string value) { AddValueToStoreValue<string>(value, ref info.InvalidValue); } private static void AddRawValue(HeaderStoreItemInfo info, string value) { AddValueToStoreValue<string>(value, ref info.RawValue); } private static void AddValueToStoreValue<T>(T value, ref object? currentStoreValue) where T : class { // If there is no value set yet, then add current item as value (we don't create a list // if not required). If 'info.Value' is already assigned then make sure 'info.Value' is a // List<T> and append 'item' to the list. if (currentStoreValue == null) { currentStoreValue = value; } else { List<T>? storeValues = currentStoreValue as List<T>; if (storeValues == null) { storeValues = new List<T>(2); Debug.Assert(currentStoreValue is T); storeValues.Add((T)currentStoreValue); currentStoreValue = storeValues; } Debug.Assert(value is T); storeValues.Add((T)value); } } // Since most of the time we just have 1 value, we don't create a List<object> for one value, but we change // the return type to 'object'. The caller has to deal with the return type (object vs. List<object>). This // is to optimize the most common scenario where a header has only one value. internal object? GetParsedValues(HeaderDescriptor descriptor) { if (!TryGetAndParseHeaderInfo(descriptor, out HeaderStoreItemInfo? info)) { return null; } return info.ParsedValue; } internal virtual bool IsAllowedHeaderName(HeaderDescriptor descriptor) => true; private void PrepareHeaderInfoForAdd(HeaderDescriptor descriptor, out HeaderStoreItemInfo info, out bool addToStore) { if (!IsAllowedHeaderName(descriptor)) { throw new InvalidOperationException(SR.Format(SR.net_http_headers_not_allowed_header_name, descriptor.Name)); } addToStore = false; if (!TryGetAndParseHeaderInfo(descriptor, out info!)) { info = new HeaderStoreItemInfo(); addToStore = true; } } private void ParseAndAddValue(HeaderDescriptor descriptor, HeaderStoreItemInfo info, string? value) { Debug.Assert(info != null); if (descriptor.Parser == null) { // If we don't have a parser for the header, we consider the value valid if it doesn't contains // newline characters. We add the values as "parsed value". Note that we allow empty values. CheckContainsNewLine(value); AddParsedValue(info, value ?? string.Empty); return; } // If the header only supports 1 value, we can add the current value only if there is no // value already set. if (!info.CanAddParsedValue(descriptor.Parser)) { throw new FormatException(SR.Format(System.Globalization.CultureInfo.InvariantCulture, SR.net_http_headers_single_value_header, descriptor.Name)); } int index = 0; object parsedValue = descriptor.Parser.ParseValue(value, info.ParsedValue, ref index); // The raw string only represented one value (which was successfully parsed). Add the value and return. // If value is null we still have to first call ParseValue() to allow the parser to decide whether null is // a valid value. If it is (i.e. no exception thrown), we set the parsed value (if any) and return. if ((value == null) || (index == value.Length)) { // If the returned value is null, then it means the header accepts empty values. i.e. we don't throw // but we don't add 'null' to the store either. if (parsedValue != null) { AddParsedValue(info, parsedValue); } return; } Debug.Assert(index < value.Length, "Parser must return an index value within the string length."); // If we successfully parsed a value, but there are more left to read, store the results in a temp // list. Only when all values are parsed successfully write the list to the store. List<object> parsedValues = new List<object>(); if (parsedValue != null) { parsedValues.Add(parsedValue); } while (index < value.Length) { parsedValue = descriptor.Parser.ParseValue(value, info.ParsedValue, ref index); if (parsedValue != null) { parsedValues.Add(parsedValue); } } // All values were parsed correctly. Copy results to the store. foreach (object item in parsedValues) { AddParsedValue(info, item); } } private HeaderDescriptor GetHeaderDescriptor(string name) { if (string.IsNullOrEmpty(name)) { throw new ArgumentException(SR.net_http_argument_empty_string, nameof(name)); } if (!HeaderDescriptor.TryGet(name, out HeaderDescriptor descriptor)) { throw new FormatException(SR.net_http_headers_invalid_header_name); } if ((descriptor.HeaderType & _allowedHeaderTypes) != 0) { return descriptor; } else if ((descriptor.HeaderType & _treatAsCustomHeaderTypes) != 0) { return descriptor.AsCustomHeader(); } throw new InvalidOperationException(SR.Format(SR.net_http_headers_not_allowed_header_name, name)); } internal bool TryGetHeaderDescriptor(string name, out HeaderDescriptor descriptor) { if (string.IsNullOrEmpty(name)) { descriptor = default; return false; } if (HeaderDescriptor.TryGet(name, out descriptor)) { HttpHeaderType headerType = descriptor.HeaderType; if ((headerType & _allowedHeaderTypes) != 0) { return true; } if ((headerType & _treatAsCustomHeaderTypes) != 0) { descriptor = descriptor.AsCustomHeader(); return true; } } return false; } internal static void CheckContainsNewLine(string? value) { if (value == null) { return; } if (HttpRuleParser.ContainsNewLine(value)) { throw new FormatException(SR.net_http_headers_no_newlines); } } private static bool ContainsNewLine(string value, HeaderDescriptor descriptor) { if (HttpRuleParser.ContainsNewLine(value)) { if (NetEventSource.Log.IsEnabled()) NetEventSource.Error(null, SR.Format(SR.net_http_log_headers_no_newlines, descriptor.Name, value)); return true; } return false; } internal static string[] GetStoreValuesAsStringArray(HeaderDescriptor descriptor, HeaderStoreItemInfo info) { GetStoreValuesAsStringOrStringArray(descriptor, info, out string? singleValue, out string[]? multiValue); Debug.Assert(singleValue is not null ^ multiValue is not null); return multiValue ?? new[] { singleValue! }; } internal static void GetStoreValuesAsStringOrStringArray(HeaderDescriptor descriptor, object sourceValues, out string? singleValue, out string[]? multiValue) { HeaderStoreItemInfo? info = sourceValues as HeaderStoreItemInfo; if (info is null) { Debug.Assert(sourceValues is string); singleValue = (string)sourceValues; multiValue = null; return; } int length = GetValueCount(info); Span<string?> values; singleValue = null; if (length == 1) { multiValue = null; values = MemoryMarshal.CreateSpan(ref singleValue, 1); } else { Debug.Assert(length > 1, "The header should have been removed when it became empty"); values = multiValue = new string[length]; } int currentIndex = 0; ReadStoreValues<string?>(values, info.RawValue, null, ref currentIndex); ReadStoreValues<object?>(values, info.ParsedValue, descriptor.Parser, ref currentIndex); ReadStoreValues<string?>(values, info.InvalidValue, null, ref currentIndex); Debug.Assert(currentIndex == length); } internal static int GetStoreValuesIntoStringArray(HeaderDescriptor descriptor, object sourceValues, [NotNull] ref string[]? values) { values ??= Array.Empty<string>(); HeaderStoreItemInfo? info = sourceValues as HeaderStoreItemInfo; if (info is null) { Debug.Assert(sourceValues is string); if (values.Length == 0) { values = new string[1]; } values[0] = (string)sourceValues; return 1; } int length = GetValueCount(info); if (length > 0) { if (values.Length < length) { values = new string[length]; } int currentIndex = 0; ReadStoreValues<string?>(values, info.RawValue, null, ref currentIndex); ReadStoreValues<object?>(values, info.ParsedValue, descriptor.Parser, ref currentIndex); ReadStoreValues<string?>(values, info.InvalidValue, null, ref currentIndex); Debug.Assert(currentIndex == length); } return length; } private static int GetValueCount(HeaderStoreItemInfo info) { Debug.Assert(info != null); int valueCount = Count<string>(info.RawValue); valueCount += Count<string>(info.InvalidValue); valueCount += Count<object>(info.ParsedValue); return valueCount; static int Count<T>(object? valueStore) => valueStore is null ? 0 : valueStore is List<T> list ? list.Count : 1; } private static void ReadStoreValues<T>(Span<string?> values, object? storeValue, HttpHeaderParser? parser, ref int currentIndex) { if (storeValue != null) { List<T>? storeValues = storeValue as List<T>; if (storeValues == null) { values[currentIndex] = parser == null ? storeValue.ToString() : parser.ToString(storeValue); currentIndex++; } else { foreach (object? item in storeValues) { Debug.Assert(item != null); values[currentIndex] = parser == null ? item.ToString() : parser.ToString(item); currentIndex++; } } } } private bool AreEqual(object value, object? storeValue, IEqualityComparer? comparer) { Debug.Assert(value != null); if (comparer != null) { return comparer.Equals(value, storeValue); } // We don't have a comparer, so use the Equals() method. return value.Equals(storeValue); } internal sealed class HeaderStoreItemInfo { internal HeaderStoreItemInfo() { } internal object? RawValue; internal object? InvalidValue; internal object? ParsedValue; internal bool CanAddParsedValue(HttpHeaderParser parser) { Debug.Assert(parser != null, "There should be no reason to call CanAddValue if there is no parser for the current header."); // If the header only supports one value, and we have already a value set, then we can't add // another value. E.g. the 'Date' header only supports one value. We can't add multiple timestamps // to 'Date'. // So if this is a known header, ask the parser if it supports multiple values and check whether // we already have a (valid or invalid) value. // Note that we ignore the rawValue by purpose: E.g. we are parsing 2 raw values for a header only // supporting 1 value. When the first value gets parsed, CanAddValue returns true and we add the // parsed value to ParsedValue. When the second value is parsed, CanAddValue returns false, because // we have already a parsed value. return parser.SupportsMultipleValues || ((InvalidValue == null) && (ParsedValue == null)); } internal bool IsEmpty => (RawValue == null) && (InvalidValue == null) && (ParsedValue == null); } #region Low-level implementation details that work with _headerStore directly // Used to store the CollectionsMarshal.GetValueRefOrAddDefault out parameter. // This is a workaround for the Roslyn bug where we can't use a discard instead: // https://github.com/dotnet/roslyn/issues/56587#issuecomment-934955526 private static bool s_dictionaryGetValueRefOrAddDefaultExistsDummy; private const int InitialCapacity = 4; internal const int ArrayThreshold = 64; // Above this threshold, header ordering will not be preserved internal HeaderEntry[]? GetEntriesArray() { object? store = _headerStore; if (store is null) { return null; } else if (store is HeaderEntry[] entries) { return entries; } else { return GetEntriesFromDictionary(); } HeaderEntry[] GetEntriesFromDictionary() { var dictionary = (Dictionary<HeaderDescriptor, object>)_headerStore!; var entries = new HeaderEntry[dictionary.Count]; int i = 0; foreach (KeyValuePair<HeaderDescriptor, object> entry in dictionary) { entries[i++] = new HeaderEntry { Key = entry.Key, Value = entry.Value }; } return entries; } } internal ReadOnlySpan<HeaderEntry> GetEntries() { return new ReadOnlySpan<HeaderEntry>(GetEntriesArray(), 0, _count); } internal int Count => _count; private bool EntriesAreLiveView => _headerStore is HeaderEntry[]; private ref object GetValueRefOrNullRef(HeaderDescriptor key) { ref object valueRef = ref Unsafe.NullRef<object>(); object? store = _headerStore; if (store is HeaderEntry[] entries) { for (int i = 0; i < _count && i < entries.Length; i++) { if (key.Equals(entries[i].Key)) { valueRef = ref entries[i].Value; break; } } } else if (store is not null) { valueRef = ref CollectionsMarshal.GetValueRefOrNullRef(Unsafe.As<Dictionary<HeaderDescriptor, object>>(store), key); } return ref valueRef; } private ref object? GetValueRefOrAddDefault(HeaderDescriptor key) { object? store = _headerStore; if (store is HeaderEntry[] entries) { for (int i = 0; i < _count && i < entries.Length; i++) { if (key.Equals(entries[i].Key)) { return ref entries[i].Value!; } } int count = _count; _count++; if ((uint)count < (uint)entries.Length) { entries[count].Key = key; return ref entries[count].Value!; } return ref GrowEntriesAndAddDefault(key); } else if (store is null) { _count++; entries = new HeaderEntry[InitialCapacity]; _headerStore = entries; ref HeaderEntry firstEntry = ref MemoryMarshal.GetArrayDataReference(entries); firstEntry.Key = key; return ref firstEntry.Value!; } else { return ref DictionaryGetValueRefOrAddDefault(key); } ref object? GrowEntriesAndAddDefault(HeaderDescriptor key) { var entries = (HeaderEntry[])_headerStore!; if (entries.Length == ArrayThreshold) { return ref ConvertToDictionaryAndAddDefault(key); } else { Array.Resize(ref entries, entries.Length << 1); _headerStore = entries; ref HeaderEntry firstNewEntry = ref entries[entries.Length >> 1]; firstNewEntry.Key = key; return ref firstNewEntry.Value!; } } ref object? ConvertToDictionaryAndAddDefault(HeaderDescriptor key) { var entries = (HeaderEntry[])_headerStore!; var dictionary = new Dictionary<HeaderDescriptor, object>(ArrayThreshold); _headerStore = dictionary; foreach (HeaderEntry entry in entries) { dictionary.Add(entry.Key, entry.Value); } Debug.Assert(dictionary.Count == _count - 1); return ref CollectionsMarshal.GetValueRefOrAddDefault(dictionary, key, out s_dictionaryGetValueRefOrAddDefaultExistsDummy); } ref object? DictionaryGetValueRefOrAddDefault(HeaderDescriptor key) { var dictionary = (Dictionary<HeaderDescriptor, object>)_headerStore!; ref object? value = ref CollectionsMarshal.GetValueRefOrAddDefault(dictionary, key, out s_dictionaryGetValueRefOrAddDefaultExistsDummy); if (value is null) { _count++; } return ref value; } } private void AddEntryToStore(HeaderEntry entry) { Debug.Assert(!ContainsKey(entry.Key)); if (_headerStore is HeaderEntry[] entries) { int count = _count; if ((uint)count < (uint)entries.Length) { entries[count] = entry; _count++; return; } } GetValueRefOrAddDefault(entry.Key) = entry.Value; } internal bool ContainsKey(HeaderDescriptor key) { return !Unsafe.IsNullRef(ref GetValueRefOrNullRef(key)); } public void Clear() { if (_headerStore is HeaderEntry[] entries) { Array.Clear(entries, 0, _count); } else { _headerStore = null; } _count = 0; } internal bool Remove(HeaderDescriptor key) { bool removed = false; object? store = _headerStore; if (store is HeaderEntry[] entries) { for (int i = 0; i < _count && i < entries.Length; i++) { if (key.Equals(entries[i].Key)) { while (i + 1 < _count && (uint)(i + 1) < (uint)entries.Length) { entries[i] = entries[i + 1]; i++; } entries[i] = default; removed = true; break; } } } else if (store is not null) { removed = Unsafe.As<Dictionary<HeaderDescriptor, object>>(store).Remove(key); } if (removed) { _count--; } return removed; } #endregion // _headerStore implementation } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/JIT/Regression/JitBlue/GitHub_23545/GitHub_23545.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; namespace GitHub_23545 { public struct TestStruct { public int value1; public override string ToString() { return this.value1.ToString(); } } class Test { public static Dictionary<TestStruct, TestStruct> StructKeyValue { get { return new Dictionary<TestStruct, TestStruct>() { { new TestStruct(){value1 = 12}, new TestStruct(){value1 = 15} } }; } } static int Main() { int value = 0; foreach (var e in StructKeyValue) { value += e.Key.value1 + e.Value.value1; Console.WriteLine(e.Key.ToString() + " " + e.Value.ToString()); } if (value != 27) { return -1; } 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; namespace GitHub_23545 { public struct TestStruct { public int value1; public override string ToString() { return this.value1.ToString(); } } class Test { public static Dictionary<TestStruct, TestStruct> StructKeyValue { get { return new Dictionary<TestStruct, TestStruct>() { { new TestStruct(){value1 = 12}, new TestStruct(){value1 = 15} } }; } } static int Main() { int value = 0; foreach (var e in StructKeyValue) { value += e.Key.value1 + e.Value.value1; Console.WriteLine(e.Key.ToString() + " " + e.Value.ToString()); } if (value != 27) { return -1; } return 100; } } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/libraries/System.Runtime.InteropServices/src/System/Runtime/InteropServices/ComTypes/IEnumFormatETC.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; namespace System.Runtime.InteropServices.ComTypes { /// <summary> /// The IEnumFORMATETC interface is used to enumerate an array of FORMATETC /// structures. IEnumFORMATETC has the same methods as all enumerator interfaces: /// Next, Skip, Reset, and Clone. /// </summary> [ComImport] [Guid("00000103-0000-0000-C000-000000000046")] [EditorBrowsable(EditorBrowsableState.Never)] [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] public interface IEnumFORMATETC { /// <summary> /// Retrieves the next celt items in the enumeration sequence. If there are /// fewer than the requested number of elements left in the sequence, it /// retrieves the remaining elements. The number of elements actually /// retrieved is returned through pceltFetched (unless the caller passed /// in NULL for that parameter). /// </summary> [PreserveSig] int Next(int celt, [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] FORMATETC[] rgelt, [Out, MarshalAs(UnmanagedType.LPArray)] int[] pceltFetched); /// <summary> /// Skips over the next specified number of elements in the enumeration sequence. /// </summary> [PreserveSig] int Skip(int celt); /// <summary> /// Resets the enumeration sequence to the beginning. /// </summary> [PreserveSig] int Reset(); /// <summary> /// Creates another enumerator that contains the same enumeration state as /// the current one. Using this function, a client can record a particular /// point in the enumeration sequence and then return to that point at a /// later time. The new enumerator supports the same interface as the original one. /// </summary> void Clone(out IEnumFORMATETC newEnum); } }
// 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; namespace System.Runtime.InteropServices.ComTypes { /// <summary> /// The IEnumFORMATETC interface is used to enumerate an array of FORMATETC /// structures. IEnumFORMATETC has the same methods as all enumerator interfaces: /// Next, Skip, Reset, and Clone. /// </summary> [ComImport] [Guid("00000103-0000-0000-C000-000000000046")] [EditorBrowsable(EditorBrowsableState.Never)] [InterfaceTypeAttribute(ComInterfaceType.InterfaceIsIUnknown)] public interface IEnumFORMATETC { /// <summary> /// Retrieves the next celt items in the enumeration sequence. If there are /// fewer than the requested number of elements left in the sequence, it /// retrieves the remaining elements. The number of elements actually /// retrieved is returned through pceltFetched (unless the caller passed /// in NULL for that parameter). /// </summary> [PreserveSig] int Next(int celt, [Out, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] FORMATETC[] rgelt, [Out, MarshalAs(UnmanagedType.LPArray)] int[] pceltFetched); /// <summary> /// Skips over the next specified number of elements in the enumeration sequence. /// </summary> [PreserveSig] int Skip(int celt); /// <summary> /// Resets the enumeration sequence to the beginning. /// </summary> [PreserveSig] int Reset(); /// <summary> /// Creates another enumerator that contains the same enumeration state as /// the current one. Using this function, a client can record a particular /// point in the enumeration sequence and then return to that point at a /// later time. The new enumerator supports the same interface as the original one. /// </summary> void Clone(out IEnumFORMATETC newEnum); } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/coreclr/tools/Common/TypeSystem/Interop/IL/NativeStructType.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 Debug = System.Diagnostics.Debug; namespace Internal.TypeSystem.Interop { public partial class NativeStructType : MetadataType { // The managed struct that this type will imitate public MetadataType ManagedStructType { get; } public override ModuleDesc Module { get; } public override string Name { get { return "__NativeType__" + ManagedStructType.Name; } } public override string DiagnosticName { get { return "__NativeType__" + ManagedStructType.DiagnosticName; } } public override string Namespace { get { return "Internal.CompilerGenerated"; } } public override string DiagnosticNamespace { get { return "Internal.CompilerGenerated"; } } public override PInvokeStringFormat PInvokeStringFormat { get { return ManagedStructType.PInvokeStringFormat; } } public override bool IsExplicitLayout { get { return ManagedStructType.IsExplicitLayout; } } public override bool IsSequentialLayout { get { return ManagedStructType.IsSequentialLayout; } } public override bool IsBeforeFieldInit { get { return ManagedStructType.IsBeforeFieldInit; } } public override DefType BaseType { get { return (DefType)Context.GetWellKnownType(WellKnownType.ValueType); } } public override MetadataType MetadataBaseType { get { return (MetadataType)Context.GetWellKnownType(WellKnownType.ValueType); } } public override bool IsSealed { get { return true; } } public override bool IsAbstract { get { return false; } } public override DefType ContainingType { get { return null; } } public override DefType[] ExplicitlyImplementedInterfaces { get { return Array.Empty<DefType>(); } } public override TypeSystemContext Context { get { return ManagedStructType.Context; } } private NativeStructField[] _fields; private InteropStateManager _interopStateManager; private bool _hasInvalidLayout; public bool HasInvalidLayout { get { return _hasInvalidLayout; } } public FieldDesc[] Fields { get { return _fields; } } public NativeStructType(ModuleDesc owningModule, MetadataType managedStructType, InteropStateManager interopStateManager) { Debug.Assert(!managedStructType.IsGenericDefinition); Module = owningModule; ManagedStructType = managedStructType; _interopStateManager = interopStateManager; _hasInvalidLayout = false; CalculateFields(); } private void CalculateFields() { bool isSequential = ManagedStructType.IsSequentialLayout; bool isAnsi = ManagedStructType.PInvokeStringFormat == PInvokeStringFormat.AnsiClass; int numFields = 0; foreach (FieldDesc field in ManagedStructType.GetFields()) { if (field.IsStatic) { continue; } numFields++; } _fields = new NativeStructField[numFields]; int index = 0; foreach (FieldDesc field in ManagedStructType.GetFields()) { if (field.IsStatic) { continue; } var managedType = field.FieldType; TypeDesc nativeType; try { nativeType = MarshalHelpers.GetNativeStructFieldType(managedType, field.GetMarshalAsDescriptor(), _interopStateManager, isAnsi); } catch (NotSupportedException) { // if marshalling is not supported for this type the generated stubs will emit appropriate // error message. We just set native type to be same as managedtype nativeType = managedType; _hasInvalidLayout = true; } _fields[index++] = new NativeStructField(nativeType, this, field); } } public override ClassLayoutMetadata GetClassLayout() { ClassLayoutMetadata layout = ManagedStructType.GetClassLayout(); ClassLayoutMetadata result; result.PackingSize = layout.PackingSize; result.Size = layout.Size; if (IsExplicitLayout) { result.Offsets = new FieldAndOffset[layout.Offsets.Length]; Debug.Assert(layout.Offsets.Length <= _fields.Length); int layoutIndex = 0; for (int index = 0; index < _fields.Length; index++) { if (_fields[index].Name == layout.Offsets[layoutIndex].Field.Name) { result.Offsets[layoutIndex] = new FieldAndOffset(_fields[index], layout.Offsets[layoutIndex].Offset); layoutIndex++; } } Debug.Assert(layoutIndex == layout.Offsets.Length); } else { result.Offsets = null; } return result; } public override bool HasCustomAttribute(string attributeNamespace, string attributeName) { return false; } public override IEnumerable<MetadataType> GetNestedTypes() { return Array.Empty<MetadataType>(); } public override MetadataType GetNestedType(string name) { return null; } protected override MethodImplRecord[] ComputeVirtualMethodImplsForType() { return Array.Empty<MethodImplRecord>(); } public override MethodImplRecord[] FindMethodsImplWithMatchingDeclName(string name) { return Array.Empty<MethodImplRecord>(); } private int _hashCode; private void InitializeHashCode() { var hashCodeBuilder = new Internal.NativeFormat.TypeHashingAlgorithms.HashCodeBuilder(Namespace); if (Namespace.Length > 0) { hashCodeBuilder.Append("."); } hashCodeBuilder.Append(Name); _hashCode = hashCodeBuilder.ToHashCode(); } public override int GetHashCode() { if (_hashCode == 0) { InitializeHashCode(); } return _hashCode; } protected override TypeFlags ComputeTypeFlags(TypeFlags mask) { TypeFlags flags = 0; if ((mask & TypeFlags.HasGenericVarianceComputed) != 0) { flags |= TypeFlags.HasGenericVarianceComputed; } if ((mask & TypeFlags.CategoryMask) != 0) { flags |= TypeFlags.ValueType; } flags |= TypeFlags.HasFinalizerComputed; flags |= TypeFlags.AttributeCacheComputed; return flags; } public override IEnumerable<FieldDesc> GetFields() { return _fields; } /// <summary> /// Synthetic field on <see cref="NativeStructType"/>. /// </summary> private partial class NativeStructField : FieldDesc { private TypeDesc _fieldType; private MetadataType _owningType; private FieldDesc _managedField; public override TypeSystemContext Context { get { return _owningType.Context; } } public override TypeDesc FieldType { get { return _fieldType; } } public override bool HasRva { get { return false; } } public override bool IsInitOnly { get { return false; } } public override bool IsLiteral { get { return false; } } public override bool IsStatic { get { return false; } } public override bool IsThreadStatic { get { return false; } } public override DefType OwningType { get { return _owningType; } } public override bool HasCustomAttribute(string attributeNamespace, string attributeName) { return false; } public override string Name { get { return _managedField.Name; } } public NativeStructField(TypeDesc nativeType, MetadataType owningType, FieldDesc managedField) { _fieldType = nativeType; _owningType = owningType; _managedField = managedField; } } } }
// 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 Debug = System.Diagnostics.Debug; namespace Internal.TypeSystem.Interop { public partial class NativeStructType : MetadataType { // The managed struct that this type will imitate public MetadataType ManagedStructType { get; } public override ModuleDesc Module { get; } public override string Name { get { return "__NativeType__" + ManagedStructType.Name; } } public override string DiagnosticName { get { return "__NativeType__" + ManagedStructType.DiagnosticName; } } public override string Namespace { get { return "Internal.CompilerGenerated"; } } public override string DiagnosticNamespace { get { return "Internal.CompilerGenerated"; } } public override PInvokeStringFormat PInvokeStringFormat { get { return ManagedStructType.PInvokeStringFormat; } } public override bool IsExplicitLayout { get { return ManagedStructType.IsExplicitLayout; } } public override bool IsSequentialLayout { get { return ManagedStructType.IsSequentialLayout; } } public override bool IsBeforeFieldInit { get { return ManagedStructType.IsBeforeFieldInit; } } public override DefType BaseType { get { return (DefType)Context.GetWellKnownType(WellKnownType.ValueType); } } public override MetadataType MetadataBaseType { get { return (MetadataType)Context.GetWellKnownType(WellKnownType.ValueType); } } public override bool IsSealed { get { return true; } } public override bool IsAbstract { get { return false; } } public override DefType ContainingType { get { return null; } } public override DefType[] ExplicitlyImplementedInterfaces { get { return Array.Empty<DefType>(); } } public override TypeSystemContext Context { get { return ManagedStructType.Context; } } private NativeStructField[] _fields; private InteropStateManager _interopStateManager; private bool _hasInvalidLayout; public bool HasInvalidLayout { get { return _hasInvalidLayout; } } public FieldDesc[] Fields { get { return _fields; } } public NativeStructType(ModuleDesc owningModule, MetadataType managedStructType, InteropStateManager interopStateManager) { Debug.Assert(!managedStructType.IsGenericDefinition); Module = owningModule; ManagedStructType = managedStructType; _interopStateManager = interopStateManager; _hasInvalidLayout = false; CalculateFields(); } private void CalculateFields() { bool isSequential = ManagedStructType.IsSequentialLayout; bool isAnsi = ManagedStructType.PInvokeStringFormat == PInvokeStringFormat.AnsiClass; int numFields = 0; foreach (FieldDesc field in ManagedStructType.GetFields()) { if (field.IsStatic) { continue; } numFields++; } _fields = new NativeStructField[numFields]; int index = 0; foreach (FieldDesc field in ManagedStructType.GetFields()) { if (field.IsStatic) { continue; } var managedType = field.FieldType; TypeDesc nativeType; try { nativeType = MarshalHelpers.GetNativeStructFieldType(managedType, field.GetMarshalAsDescriptor(), _interopStateManager, isAnsi); } catch (NotSupportedException) { // if marshalling is not supported for this type the generated stubs will emit appropriate // error message. We just set native type to be same as managedtype nativeType = managedType; _hasInvalidLayout = true; } _fields[index++] = new NativeStructField(nativeType, this, field); } } public override ClassLayoutMetadata GetClassLayout() { ClassLayoutMetadata layout = ManagedStructType.GetClassLayout(); ClassLayoutMetadata result; result.PackingSize = layout.PackingSize; result.Size = layout.Size; if (IsExplicitLayout) { result.Offsets = new FieldAndOffset[layout.Offsets.Length]; Debug.Assert(layout.Offsets.Length <= _fields.Length); int layoutIndex = 0; for (int index = 0; index < _fields.Length; index++) { if (_fields[index].Name == layout.Offsets[layoutIndex].Field.Name) { result.Offsets[layoutIndex] = new FieldAndOffset(_fields[index], layout.Offsets[layoutIndex].Offset); layoutIndex++; } } Debug.Assert(layoutIndex == layout.Offsets.Length); } else { result.Offsets = null; } return result; } public override bool HasCustomAttribute(string attributeNamespace, string attributeName) { return false; } public override IEnumerable<MetadataType> GetNestedTypes() { return Array.Empty<MetadataType>(); } public override MetadataType GetNestedType(string name) { return null; } protected override MethodImplRecord[] ComputeVirtualMethodImplsForType() { return Array.Empty<MethodImplRecord>(); } public override MethodImplRecord[] FindMethodsImplWithMatchingDeclName(string name) { return Array.Empty<MethodImplRecord>(); } private int _hashCode; private void InitializeHashCode() { var hashCodeBuilder = new Internal.NativeFormat.TypeHashingAlgorithms.HashCodeBuilder(Namespace); if (Namespace.Length > 0) { hashCodeBuilder.Append("."); } hashCodeBuilder.Append(Name); _hashCode = hashCodeBuilder.ToHashCode(); } public override int GetHashCode() { if (_hashCode == 0) { InitializeHashCode(); } return _hashCode; } protected override TypeFlags ComputeTypeFlags(TypeFlags mask) { TypeFlags flags = 0; if ((mask & TypeFlags.HasGenericVarianceComputed) != 0) { flags |= TypeFlags.HasGenericVarianceComputed; } if ((mask & TypeFlags.CategoryMask) != 0) { flags |= TypeFlags.ValueType; } flags |= TypeFlags.HasFinalizerComputed; flags |= TypeFlags.AttributeCacheComputed; return flags; } public override IEnumerable<FieldDesc> GetFields() { return _fields; } /// <summary> /// Synthetic field on <see cref="NativeStructType"/>. /// </summary> private partial class NativeStructField : FieldDesc { private TypeDesc _fieldType; private MetadataType _owningType; private FieldDesc _managedField; public override TypeSystemContext Context { get { return _owningType.Context; } } public override TypeDesc FieldType { get { return _fieldType; } } public override bool HasRva { get { return false; } } public override bool IsInitOnly { get { return false; } } public override bool IsLiteral { get { return false; } } public override bool IsStatic { get { return false; } } public override bool IsThreadStatic { get { return false; } } public override DefType OwningType { get { return _owningType; } } public override bool HasCustomAttribute(string attributeNamespace, string attributeName) { return false; } public override string Name { get { return _managedField.Name; } } public NativeStructField(TypeDesc nativeType, MetadataType owningType, FieldDesc managedField) { _fieldType = nativeType; _owningType = owningType; _managedField = managedField; } } } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/Interop/StringMarshalling/LPSTR/LPSTRTest.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.InteropServices; using System; using System.Reflection; using System.Text; using Xunit; class LPStrTest { public static int Main() { try { CommonStringTests.RunTests(); } catch (System.Exception ex) { Console.WriteLine(ex.ToString()); return 101; } 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.Runtime.InteropServices; using System; using System.Reflection; using System.Text; using Xunit; class LPStrTest { public static int Main() { try { CommonStringTests.RunTests(); } catch (System.Exception ex) { Console.WriteLine(ex.ToString()); return 101; } return 100; } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/JIT/HardwareIntrinsics/General/Vector128/Multiply.UInt32.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 MultiplyUInt32() { var test = new VectorBinaryOpTest__MultiplyUInt32(); // 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__MultiplyUInt32 { 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, UInt32[] inArray2, UInt32[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<UInt32>(); int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<UInt32>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<UInt32>(); 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<UInt32, byte>(ref inArray1[0]), (uint)sizeOfinArray1); Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<UInt32, 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<UInt32> _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.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref testStruct._fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); return testStruct; } public void RunStructFldScenario(VectorBinaryOpTest__MultiplyUInt32 testClass) { var result = Vector128.Multiply(_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<UInt32>>() / sizeof(UInt32); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32); private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32); private static UInt32[] _data1 = new UInt32[Op1ElementCount]; private static UInt32[] _data2 = new UInt32[Op2ElementCount]; private static Vector128<UInt32> _clsVar1; private static Vector128<UInt32> _clsVar2; private Vector128<UInt32> _fld1; private Vector128<UInt32> _fld2; private DataTable _dataTable; static VectorBinaryOpTest__MultiplyUInt32() { 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.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); } public VectorBinaryOpTest__MultiplyUInt32() { 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.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt32(); } _dataTable = new DataTable(_data1, _data2, new UInt32[RetElementCount], LargestVectorSize); } public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = Vector128.Multiply( Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<UInt32>>(_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.Multiply), new Type[] { typeof(Vector128<UInt32>), typeof(Vector128<UInt32>) }); if (method is null) { method = typeof(Vector128).GetMethod(nameof(Vector128.Multiply), 1, new Type[] { typeof(Vector128<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), typeof(Vector128<>).MakeGenericType(Type.MakeGenericMethodParameter(0)) }); } if (method.IsGenericMethodDefinition) { method = method.MakeGenericMethod(typeof(UInt32)); } var result = method.Invoke(null, new object[] { Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<UInt32>>(_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 = Vector128.Multiply( _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<UInt32>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray2Ptr); var result = Vector128.Multiply(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new VectorBinaryOpTest__MultiplyUInt32(); var result = Vector128.Multiply(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.Multiply(_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.Multiply(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<UInt32> op1, Vector128<UInt32> op2, void* result, [CallerMemberName] string method = "") { UInt32[] inArray1 = new UInt32[Op1ElementCount]; UInt32[] inArray2 = new UInt32[Op2ElementCount]; UInt32[] outArray = new UInt32[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), op1); Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, 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]; UInt32[] inArray2 = new UInt32[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<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); 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, UInt32[] right, UInt32[] result, [CallerMemberName] string method = "") { bool succeeded = true; if (result[0] != (uint)(left[0] * right[0])) { succeeded = false; } else { for (var i = 1; i < RetElementCount; i++) { if (result[i] != (uint)(left[i] * right[i])) { succeeded = false; break; } } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(Vector128)}.{nameof(Vector128.Multiply)}<UInt32>(Vector128<UInt32>, Vector128<UInt32>): {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 MultiplyUInt32() { var test = new VectorBinaryOpTest__MultiplyUInt32(); // 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__MultiplyUInt32 { 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, UInt32[] inArray2, UInt32[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<UInt32>(); int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<UInt32>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<UInt32>(); 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<UInt32, byte>(ref inArray1[0]), (uint)sizeOfinArray1); Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<UInt32, 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<UInt32> _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.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref testStruct._fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); return testStruct; } public void RunStructFldScenario(VectorBinaryOpTest__MultiplyUInt32 testClass) { var result = Vector128.Multiply(_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<UInt32>>() / sizeof(UInt32); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32); private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32); private static UInt32[] _data1 = new UInt32[Op1ElementCount]; private static UInt32[] _data2 = new UInt32[Op2ElementCount]; private static Vector128<UInt32> _clsVar1; private static Vector128<UInt32> _clsVar2; private Vector128<UInt32> _fld1; private Vector128<UInt32> _fld2; private DataTable _dataTable; static VectorBinaryOpTest__MultiplyUInt32() { 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.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); } public VectorBinaryOpTest__MultiplyUInt32() { 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.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt32(); } _dataTable = new DataTable(_data1, _data2, new UInt32[RetElementCount], LargestVectorSize); } public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = Vector128.Multiply( Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<UInt32>>(_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.Multiply), new Type[] { typeof(Vector128<UInt32>), typeof(Vector128<UInt32>) }); if (method is null) { method = typeof(Vector128).GetMethod(nameof(Vector128.Multiply), 1, new Type[] { typeof(Vector128<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), typeof(Vector128<>).MakeGenericType(Type.MakeGenericMethodParameter(0)) }); } if (method.IsGenericMethodDefinition) { method = method.MakeGenericMethod(typeof(UInt32)); } var result = method.Invoke(null, new object[] { Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<UInt32>>(_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 = Vector128.Multiply( _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<UInt32>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray2Ptr); var result = Vector128.Multiply(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new VectorBinaryOpTest__MultiplyUInt32(); var result = Vector128.Multiply(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.Multiply(_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.Multiply(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<UInt32> op1, Vector128<UInt32> op2, void* result, [CallerMemberName] string method = "") { UInt32[] inArray1 = new UInt32[Op1ElementCount]; UInt32[] inArray2 = new UInt32[Op2ElementCount]; UInt32[] outArray = new UInt32[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), op1); Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, 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]; UInt32[] inArray2 = new UInt32[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<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); 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, UInt32[] right, UInt32[] result, [CallerMemberName] string method = "") { bool succeeded = true; if (result[0] != (uint)(left[0] * right[0])) { succeeded = false; } else { for (var i = 1; i < RetElementCount; i++) { if (result[i] != (uint)(left[i] * right[i])) { succeeded = false; break; } } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(Vector128)}.{nameof(Vector128.Multiply)}<UInt32>(Vector128<UInt32>, Vector128<UInt32>): {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,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/JIT/CodeGenBringUpTests/DblMul_ro.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>PdbOnly</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="DblMul.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>PdbOnly</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="DblMul.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/JIT/Methodical/MDArray/DataTypes/long_cs_ro.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>None</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="long.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>None</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="long.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/libraries/System.IO/tests/BinaryWriter/BinaryWriter.EncodingTests.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.Numerics; using System.Reflection; using System.Runtime.InteropServices; using System.Text; using Xunit; namespace System.IO.Tests { public class BinaryWriter_EncodingTests { [Fact] public void Ctor_Default_UsesFastUtf8() { BinaryWriter writer = new BinaryWriter(new MemoryStream()); Assert.True(IsUsingFastUtf8(writer)); } [Fact] public void Ctor_EncodingUtf8Singleton_UsesFastUtf8() { BinaryWriter writer = new BinaryWriter(new MemoryStream(), Encoding.UTF8); Assert.True(IsUsingFastUtf8(writer)); } [Theory] [InlineData(true, true)] [InlineData(true, false)] [InlineData(false, true)] [InlineData(false, false)] public void Ctor_NewUtf8Encoding_UsesFastUtf8(bool emitIdentifier, bool throwOnInvalidBytes) { BinaryWriter writer = new BinaryWriter(new MemoryStream(), new UTF8Encoding(emitIdentifier, throwOnInvalidBytes)); Assert.True(IsUsingFastUtf8(writer)); } [Fact] public void Ctor_Utf8EncodingWithSingleCharReplacementChar_UsesFastUtf8() { Encoding encoding = Encoding.GetEncoding("utf-8", new EncoderReplacementFallback("x"), DecoderFallback.ExceptionFallback); BinaryWriter writer = new BinaryWriter(new MemoryStream(), encoding); Assert.True(IsUsingFastUtf8(writer)); } [Fact] public void Ctor_Utf8EncodingWithMultiCharReplacementChar_DoesNotUseFastUtf8() { Encoding encoding = Encoding.GetEncoding("utf-8", new EncoderReplacementFallback("xx"), DecoderFallback.ExceptionFallback); BinaryWriter writer = new BinaryWriter(new MemoryStream(), encoding); Assert.False(IsUsingFastUtf8(writer)); } [Fact] public void Ctor_NotUtf8EncodingType_DoesNotUseFastUtf8() { BinaryWriter writer = new BinaryWriter(new MemoryStream(), new UnicodeEncoding()); Assert.False(IsUsingFastUtf8(writer)); } [Fact] public void Ctor_Utf8EncodingDerivedTypeWithWrongCodePage_DoesNotUseFastUtf8() { BinaryWriter writer = new BinaryWriter(new MemoryStream(), new NotActuallyUTF8Encoding()); Assert.False(IsUsingFastUtf8(writer)); } [Fact] public void Ctor_Utf8EncodingDerivedTypeWithCorrectCodePage_DoesNotUseFastUtf8() { BinaryWriter writer = new BinaryWriter(new MemoryStream(), new MyCustomUTF8Encoding()); Assert.True(IsUsingFastUtf8(writer)); } [Theory] [InlineData('x')] // 1 UTF-8 byte [InlineData('\u00e9')] // LATIN SMALL LETTER E WITH ACUTE (2 UTF-8 bytes) [InlineData('\u2130')] // SCRIPT CAPITAL E (3 UTF-8 bytes) public void WriteSingleChar_FastUtf8(char ch) { MemoryStream stream = new MemoryStream(); BinaryWriter writer = new BinaryWriter(stream); writer.Write(ch); Assert.Equal(Encoding.UTF8.GetBytes(new char[] { ch }), stream.ToArray()); } [Theory] [InlineData('x')] // 1 UTF-8 byte [InlineData('\u00e9')] // LATIN SMALL LETTER E WITH ACUTE (2 UTF-8 bytes) [InlineData('\u2130')] // SCRIPT CAPITAL E (3 UTF-8 bytes) public void WriteSingleChar_NotUtf8NoArrayPoolRentalNeeded(char ch) { MemoryStream stream = new MemoryStream(); BinaryWriter writer = new BinaryWriter(stream, Encoding.Unicode /* little endian */); writer.Write(ch); Assert.Equal(Encoding.Unicode.GetBytes(new char[] { ch }), stream.ToArray()); } [Fact] public void WriteSingleChar_ArrayPoolRentalNeeded() { string replacementString = new string('v', 10_000); Encoding encoding = Encoding.GetEncoding("ascii", new EncoderReplacementFallback(replacementString), DecoderFallback.ExceptionFallback); MemoryStream stream = new MemoryStream(); BinaryWriter writer = new BinaryWriter(stream, encoding); writer.Write('\uFFFD'); // not ASCII Assert.Equal(Encoding.ASCII.GetBytes(replacementString), stream.ToArray()); } [Theory] [InlineData(8 * 1024)] // both char count & byte count within 64k rental boundary [InlineData(32 * 1024)] // char count within 64k rental boundary, byte count not [InlineData(256 * 1024)] // neither char count nor byte count within 64k rental boundary public void WriteChars_FastUtf8(int stringLengthInChars) { string stringToWrite = GenerateLargeUnicodeString(stringLengthInChars); byte[] expectedBytes = Encoding.UTF8.GetBytes(stringToWrite); MemoryStream stream = new MemoryStream(); BinaryWriter writer = new BinaryWriter(stream); writer.Write(stringToWrite.ToCharArray()); // writing a char buffer doesn't emit the length upfront Assert.Equal(expectedBytes, stream.GetBuffer()[..expectedBytes.Length]); } [Theory] [InlineData(24)] // within stackalloc path [InlineData(8 * 1024)] // both char count & byte count within 64k rental boundary [InlineData(32 * 1024)] // char count within 64k rental boundary, byte count not [InlineData(256 * 1024)] // neither char count nor byte count within 64k rental boundary public void WriteString_FastUtf8(int stringLengthInChars) { string stringToWrite = GenerateLargeUnicodeString(stringLengthInChars); byte[] expectedBytes = Encoding.UTF8.GetBytes(stringToWrite); MemoryStream stream = new MemoryStream(); BinaryWriter writer = new BinaryWriter(stream); writer.Write(stringToWrite); stream.Position = 0; Assert.Equal(expectedBytes.Length /* byte count */, new BinaryReader(stream).Read7BitEncodedInt()); Assert.Equal(expectedBytes, stream.GetBuffer()[Get7BitEncodedIntByteLength((uint)expectedBytes.Length)..(int)stream.Length]); } [Theory] [InlineData(127 / 3)] // within stackalloc fast path [InlineData(127 / 3 + 1)] // not within stackalloc fast path public void WriteString_FastUtf8_UsingThreeByteChars(int stringLengthInChars) { string stringToWrite = new string('\u2023', stringLengthInChars); // TRIANGULAR BULLET byte[] expectedBytes = Encoding.UTF8.GetBytes(stringToWrite); MemoryStream stream = new MemoryStream(); BinaryWriter writer = new BinaryWriter(stream); writer.Write(stringToWrite); stream.Position = 0; Assert.Equal(expectedBytes.Length /* byte count */, new BinaryReader(stream).Read7BitEncodedInt()); Assert.Equal(expectedBytes, stream.GetBuffer()[Get7BitEncodedIntByteLength((uint)expectedBytes.Length)..(int)stream.Length]); } [Theory] [InlineData(8 * 1024)] // both char count & byte count within 64k rental boundary [InlineData(48 * 1024)] // char count within 64k rental boundary, byte count not [InlineData(256 * 1024)] // neither char count nor byte count within 64k rental boundary public void WriteString_NotUtf8(int stringLengthInChars) { string stringToWrite = GenerateLargeUnicodeString(stringLengthInChars); byte[] expectedBytes = Encoding.Unicode.GetBytes(stringToWrite); MemoryStream stream = new MemoryStream(); BinaryWriter writer = new BinaryWriter(stream, Encoding.Unicode /* little endian */); writer.Write(stringToWrite); stream.Position = 0; Assert.Equal(expectedBytes.Length /* byte count */, new BinaryReader(stream).Read7BitEncodedInt()); Assert.Equal(expectedBytes, stream.GetBuffer()[Get7BitEncodedIntByteLength((uint)expectedBytes.Length)..(int)stream.Length]); } [Fact] [SkipOnPlatform(TestPlatforms.Android, "OOM on Android could be uncatchable & kill the test runner")] public unsafe void WriteChars_VeryLargeArray_DoesNotOverflow() { const nuint INPUT_LEN_IN_CHARS = 1_500_000_000; const nuint OUTPUT_LEN_IN_BYTES = 3_500_000_000; // overallocate SafeBuffer unmanagedInputBuffer = null; SafeBuffer unmanagedOutputBufer = null; try { try { unmanagedInputBuffer = SafeBufferUtil.CreateSafeBuffer(INPUT_LEN_IN_CHARS * sizeof(char)); unmanagedOutputBufer = SafeBufferUtil.CreateSafeBuffer(OUTPUT_LEN_IN_BYTES * sizeof(byte)); } catch (OutOfMemoryException) { return; // skip test in low-mem conditions } Span<char> inputSpan = new Span<char>((char*)unmanagedInputBuffer.DangerousGetHandle(), (int)INPUT_LEN_IN_CHARS); inputSpan.Fill('\u0224'); // LATIN CAPITAL LETTER Z WITH HOOK Stream outStream = new UnmanagedMemoryStream(unmanagedOutputBufer, 0, (long)unmanagedOutputBufer.ByteLength, FileAccess.ReadWrite); BinaryWriter writer = new BinaryWriter(outStream); writer.Write(inputSpan); // will write 3 billion bytes to the output Assert.Equal(3_000_000_000, outStream.Position); } finally { unmanagedInputBuffer?.Dispose(); unmanagedOutputBufer?.Dispose(); } } private static bool IsUsingFastUtf8(BinaryWriter writer) { return (bool)writer.GetType().GetField("_useFastUtf8", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(writer); } private static string GenerateLargeUnicodeString(int charCount) { return string.Create(charCount, (object)null, static (buffer, _) => { for (int i = 0; i < buffer.Length; i++) { buffer[i] = (char)((i % 0xF00) + 0x100); // U+0100..U+0FFF (mix of 2-byte and 3-byte chars) } }); } private static int Get7BitEncodedIntByteLength(uint value) => (BitOperations.Log2(value) / 7) + 1; // subclasses UTF8Encoding, but returns a non-UTF8 code page private class NotActuallyUTF8Encoding : UTF8Encoding { public override int CodePage => 65000; // UTF-7 code page } // subclasses UTF8Encoding, returns UTF-8 code page private class MyCustomUTF8Encoding : UTF8Encoding { } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Numerics; using System.Reflection; using System.Runtime.InteropServices; using System.Text; using Xunit; namespace System.IO.Tests { public class BinaryWriter_EncodingTests { [Fact] public void Ctor_Default_UsesFastUtf8() { BinaryWriter writer = new BinaryWriter(new MemoryStream()); Assert.True(IsUsingFastUtf8(writer)); } [Fact] public void Ctor_EncodingUtf8Singleton_UsesFastUtf8() { BinaryWriter writer = new BinaryWriter(new MemoryStream(), Encoding.UTF8); Assert.True(IsUsingFastUtf8(writer)); } [Theory] [InlineData(true, true)] [InlineData(true, false)] [InlineData(false, true)] [InlineData(false, false)] public void Ctor_NewUtf8Encoding_UsesFastUtf8(bool emitIdentifier, bool throwOnInvalidBytes) { BinaryWriter writer = new BinaryWriter(new MemoryStream(), new UTF8Encoding(emitIdentifier, throwOnInvalidBytes)); Assert.True(IsUsingFastUtf8(writer)); } [Fact] public void Ctor_Utf8EncodingWithSingleCharReplacementChar_UsesFastUtf8() { Encoding encoding = Encoding.GetEncoding("utf-8", new EncoderReplacementFallback("x"), DecoderFallback.ExceptionFallback); BinaryWriter writer = new BinaryWriter(new MemoryStream(), encoding); Assert.True(IsUsingFastUtf8(writer)); } [Fact] public void Ctor_Utf8EncodingWithMultiCharReplacementChar_DoesNotUseFastUtf8() { Encoding encoding = Encoding.GetEncoding("utf-8", new EncoderReplacementFallback("xx"), DecoderFallback.ExceptionFallback); BinaryWriter writer = new BinaryWriter(new MemoryStream(), encoding); Assert.False(IsUsingFastUtf8(writer)); } [Fact] public void Ctor_NotUtf8EncodingType_DoesNotUseFastUtf8() { BinaryWriter writer = new BinaryWriter(new MemoryStream(), new UnicodeEncoding()); Assert.False(IsUsingFastUtf8(writer)); } [Fact] public void Ctor_Utf8EncodingDerivedTypeWithWrongCodePage_DoesNotUseFastUtf8() { BinaryWriter writer = new BinaryWriter(new MemoryStream(), new NotActuallyUTF8Encoding()); Assert.False(IsUsingFastUtf8(writer)); } [Fact] public void Ctor_Utf8EncodingDerivedTypeWithCorrectCodePage_DoesNotUseFastUtf8() { BinaryWriter writer = new BinaryWriter(new MemoryStream(), new MyCustomUTF8Encoding()); Assert.True(IsUsingFastUtf8(writer)); } [Theory] [InlineData('x')] // 1 UTF-8 byte [InlineData('\u00e9')] // LATIN SMALL LETTER E WITH ACUTE (2 UTF-8 bytes) [InlineData('\u2130')] // SCRIPT CAPITAL E (3 UTF-8 bytes) public void WriteSingleChar_FastUtf8(char ch) { MemoryStream stream = new MemoryStream(); BinaryWriter writer = new BinaryWriter(stream); writer.Write(ch); Assert.Equal(Encoding.UTF8.GetBytes(new char[] { ch }), stream.ToArray()); } [Theory] [InlineData('x')] // 1 UTF-8 byte [InlineData('\u00e9')] // LATIN SMALL LETTER E WITH ACUTE (2 UTF-8 bytes) [InlineData('\u2130')] // SCRIPT CAPITAL E (3 UTF-8 bytes) public void WriteSingleChar_NotUtf8NoArrayPoolRentalNeeded(char ch) { MemoryStream stream = new MemoryStream(); BinaryWriter writer = new BinaryWriter(stream, Encoding.Unicode /* little endian */); writer.Write(ch); Assert.Equal(Encoding.Unicode.GetBytes(new char[] { ch }), stream.ToArray()); } [Fact] public void WriteSingleChar_ArrayPoolRentalNeeded() { string replacementString = new string('v', 10_000); Encoding encoding = Encoding.GetEncoding("ascii", new EncoderReplacementFallback(replacementString), DecoderFallback.ExceptionFallback); MemoryStream stream = new MemoryStream(); BinaryWriter writer = new BinaryWriter(stream, encoding); writer.Write('\uFFFD'); // not ASCII Assert.Equal(Encoding.ASCII.GetBytes(replacementString), stream.ToArray()); } [Theory] [InlineData(8 * 1024)] // both char count & byte count within 64k rental boundary [InlineData(32 * 1024)] // char count within 64k rental boundary, byte count not [InlineData(256 * 1024)] // neither char count nor byte count within 64k rental boundary public void WriteChars_FastUtf8(int stringLengthInChars) { string stringToWrite = GenerateLargeUnicodeString(stringLengthInChars); byte[] expectedBytes = Encoding.UTF8.GetBytes(stringToWrite); MemoryStream stream = new MemoryStream(); BinaryWriter writer = new BinaryWriter(stream); writer.Write(stringToWrite.ToCharArray()); // writing a char buffer doesn't emit the length upfront Assert.Equal(expectedBytes, stream.GetBuffer()[..expectedBytes.Length]); } [Theory] [InlineData(24)] // within stackalloc path [InlineData(8 * 1024)] // both char count & byte count within 64k rental boundary [InlineData(32 * 1024)] // char count within 64k rental boundary, byte count not [InlineData(256 * 1024)] // neither char count nor byte count within 64k rental boundary public void WriteString_FastUtf8(int stringLengthInChars) { string stringToWrite = GenerateLargeUnicodeString(stringLengthInChars); byte[] expectedBytes = Encoding.UTF8.GetBytes(stringToWrite); MemoryStream stream = new MemoryStream(); BinaryWriter writer = new BinaryWriter(stream); writer.Write(stringToWrite); stream.Position = 0; Assert.Equal(expectedBytes.Length /* byte count */, new BinaryReader(stream).Read7BitEncodedInt()); Assert.Equal(expectedBytes, stream.GetBuffer()[Get7BitEncodedIntByteLength((uint)expectedBytes.Length)..(int)stream.Length]); } [Theory] [InlineData(127 / 3)] // within stackalloc fast path [InlineData(127 / 3 + 1)] // not within stackalloc fast path public void WriteString_FastUtf8_UsingThreeByteChars(int stringLengthInChars) { string stringToWrite = new string('\u2023', stringLengthInChars); // TRIANGULAR BULLET byte[] expectedBytes = Encoding.UTF8.GetBytes(stringToWrite); MemoryStream stream = new MemoryStream(); BinaryWriter writer = new BinaryWriter(stream); writer.Write(stringToWrite); stream.Position = 0; Assert.Equal(expectedBytes.Length /* byte count */, new BinaryReader(stream).Read7BitEncodedInt()); Assert.Equal(expectedBytes, stream.GetBuffer()[Get7BitEncodedIntByteLength((uint)expectedBytes.Length)..(int)stream.Length]); } [Theory] [InlineData(8 * 1024)] // both char count & byte count within 64k rental boundary [InlineData(48 * 1024)] // char count within 64k rental boundary, byte count not [InlineData(256 * 1024)] // neither char count nor byte count within 64k rental boundary public void WriteString_NotUtf8(int stringLengthInChars) { string stringToWrite = GenerateLargeUnicodeString(stringLengthInChars); byte[] expectedBytes = Encoding.Unicode.GetBytes(stringToWrite); MemoryStream stream = new MemoryStream(); BinaryWriter writer = new BinaryWriter(stream, Encoding.Unicode /* little endian */); writer.Write(stringToWrite); stream.Position = 0; Assert.Equal(expectedBytes.Length /* byte count */, new BinaryReader(stream).Read7BitEncodedInt()); Assert.Equal(expectedBytes, stream.GetBuffer()[Get7BitEncodedIntByteLength((uint)expectedBytes.Length)..(int)stream.Length]); } [Fact] [SkipOnPlatform(TestPlatforms.Android, "OOM on Android could be uncatchable & kill the test runner")] public unsafe void WriteChars_VeryLargeArray_DoesNotOverflow() { const nuint INPUT_LEN_IN_CHARS = 1_500_000_000; const nuint OUTPUT_LEN_IN_BYTES = 3_500_000_000; // overallocate SafeBuffer unmanagedInputBuffer = null; SafeBuffer unmanagedOutputBufer = null; try { try { unmanagedInputBuffer = SafeBufferUtil.CreateSafeBuffer(INPUT_LEN_IN_CHARS * sizeof(char)); unmanagedOutputBufer = SafeBufferUtil.CreateSafeBuffer(OUTPUT_LEN_IN_BYTES * sizeof(byte)); } catch (OutOfMemoryException) { return; // skip test in low-mem conditions } Span<char> inputSpan = new Span<char>((char*)unmanagedInputBuffer.DangerousGetHandle(), (int)INPUT_LEN_IN_CHARS); inputSpan.Fill('\u0224'); // LATIN CAPITAL LETTER Z WITH HOOK Stream outStream = new UnmanagedMemoryStream(unmanagedOutputBufer, 0, (long)unmanagedOutputBufer.ByteLength, FileAccess.ReadWrite); BinaryWriter writer = new BinaryWriter(outStream); writer.Write(inputSpan); // will write 3 billion bytes to the output Assert.Equal(3_000_000_000, outStream.Position); } finally { unmanagedInputBuffer?.Dispose(); unmanagedOutputBufer?.Dispose(); } } private static bool IsUsingFastUtf8(BinaryWriter writer) { return (bool)writer.GetType().GetField("_useFastUtf8", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(writer); } private static string GenerateLargeUnicodeString(int charCount) { return string.Create(charCount, (object)null, static (buffer, _) => { for (int i = 0; i < buffer.Length; i++) { buffer[i] = (char)((i % 0xF00) + 0x100); // U+0100..U+0FFF (mix of 2-byte and 3-byte chars) } }); } private static int Get7BitEncodedIntByteLength(uint value) => (BitOperations.Log2(value) / 7) + 1; // subclasses UTF8Encoding, but returns a non-UTF8 code page private class NotActuallyUTF8Encoding : UTF8Encoding { public override int CodePage => 65000; // UTF-7 code page } // subclasses UTF8Encoding, returns UTF-8 code page private class MyCustomUTF8Encoding : UTF8Encoding { } } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/BsdIPGlobalProperties.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.Versioning; namespace System.Net.NetworkInformation { internal sealed class BsdIPGlobalProperties : UnixIPGlobalProperties { private unsafe TcpConnectionInformation[] GetTcpConnections(bool listeners) { int realCount = Interop.Sys.GetEstimatedTcpConnectionCount(); int infoCount = realCount * 2; Interop.Sys.NativeTcpConnectionInformation[] infos = new Interop.Sys.NativeTcpConnectionInformation[infoCount]; fixed (Interop.Sys.NativeTcpConnectionInformation* infosPtr = infos) { if (Interop.Sys.GetActiveTcpConnectionInfos(infosPtr, &infoCount) == -1) { throw new NetworkInformationException(SR.net_PInvokeError); } } TcpConnectionInformation[] connectionInformations = new TcpConnectionInformation[infoCount]; int nextResultIndex = 0; for (int i = 0; i < infoCount; i++) { Interop.Sys.NativeTcpConnectionInformation nativeInfo = infos[i]; TcpState state = nativeInfo.State; if (listeners != (state == TcpState.Listen)) { continue; } byte[] localBytes = new byte[nativeInfo.LocalEndPoint.NumAddressBytes]; fixed (byte* localBytesPtr = localBytes) { Buffer.MemoryCopy(nativeInfo.LocalEndPoint.AddressBytes, localBytesPtr, localBytes.Length, localBytes.Length); } IPAddress localIPAddress = new IPAddress(localBytes); IPEndPoint local = new IPEndPoint(localIPAddress, (int)nativeInfo.LocalEndPoint.Port); IPAddress remoteIPAddress; if (nativeInfo.RemoteEndPoint.NumAddressBytes == 0) { remoteIPAddress = IPAddress.Any; } else { byte[] remoteBytes = new byte[nativeInfo.RemoteEndPoint.NumAddressBytes]; fixed (byte* remoteBytesPtr = &remoteBytes[0]) { Buffer.MemoryCopy(nativeInfo.RemoteEndPoint.AddressBytes, remoteBytesPtr, remoteBytes.Length, remoteBytes.Length); } remoteIPAddress = new IPAddress(remoteBytes); } IPEndPoint remote = new IPEndPoint(remoteIPAddress, (int)nativeInfo.RemoteEndPoint.Port); connectionInformations[nextResultIndex++] = new SimpleTcpConnectionInformation(local, remote, state); } if (nextResultIndex != connectionInformations.Length) { Array.Resize(ref connectionInformations, nextResultIndex); } return connectionInformations; } public override TcpConnectionInformation[] GetActiveTcpConnections() { return GetTcpConnections(listeners:false); } public override IPEndPoint[] GetActiveTcpListeners() { TcpConnectionInformation[] allConnections = GetTcpConnections(listeners:true); var endPoints = new IPEndPoint[allConnections.Length]; for (int i = 0; i < allConnections.Length; i++) { endPoints[i] = allConnections[i].LocalEndPoint; } return endPoints; } public unsafe override IPEndPoint[] GetActiveUdpListeners() { int realCount = Interop.Sys.GetEstimatedUdpListenerCount(); int infoCount = realCount * 2; Interop.Sys.IPEndPointInfo[] infos = new Interop.Sys.IPEndPointInfo[infoCount]; fixed (Interop.Sys.IPEndPointInfo* infosPtr = infos) { if (Interop.Sys.GetActiveUdpListeners(infosPtr, &infoCount) == -1) { throw new NetworkInformationException(SR.net_PInvokeError); } } IPEndPoint[] endPoints = new IPEndPoint[infoCount]; for (int i = 0; i < infoCount; i++) { Interop.Sys.IPEndPointInfo endPointInfo = infos[i]; int port = (int)endPointInfo.Port; IPAddress ipAddress; if (endPointInfo.NumAddressBytes == 0) { ipAddress = IPAddress.Any; } else { byte[] bytes = new byte[endPointInfo.NumAddressBytes]; fixed (byte* bytesPtr = &bytes[0]) { Buffer.MemoryCopy(endPointInfo.AddressBytes, bytesPtr, bytes.Length, bytes.Length); } ipAddress = new IPAddress(bytes); } endPoints[i] = new IPEndPoint(ipAddress, port); } return endPoints; } public override IcmpV4Statistics GetIcmpV4Statistics() { return new BsdIcmpV4Statistics(); } public override IcmpV6Statistics GetIcmpV6Statistics() { return new BsdIcmpV6Statistics(); } public override IPGlobalStatistics GetIPv4GlobalStatistics() { return new BsdIPv4GlobalStatistics(); } [UnsupportedOSPlatform("osx")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("freebsd")] public override IPGlobalStatistics GetIPv6GlobalStatistics() { // Although there is a 'net.inet6.ip6.stats' sysctl variable, there // is no header for the ip6stat structure and therefore isn't available. throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform); } public override TcpStatistics GetTcpIPv4Statistics() { // OSX does not provide separated TCP-IPv4 and TCP-IPv6 stats. return new BsdTcpStatistics(); } public override TcpStatistics GetTcpIPv6Statistics() { // OSX does not provide separated TCP-IPv4 and TCP-IPv6 stats. return new BsdTcpStatistics(); } public override UdpStatistics GetUdpIPv4Statistics() { // OSX does not provide separated UDP-IPv4 and UDP-IPv6 stats. return new BsdUdpStatistics(); } public override UdpStatistics GetUdpIPv6Statistics() { // OSX does not provide separated UDP-IPv4 and UDP-IPv6 stats. return new BsdUdpStatistics(); } } }
// 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.Versioning; namespace System.Net.NetworkInformation { internal sealed class BsdIPGlobalProperties : UnixIPGlobalProperties { private unsafe TcpConnectionInformation[] GetTcpConnections(bool listeners) { int realCount = Interop.Sys.GetEstimatedTcpConnectionCount(); int infoCount = realCount * 2; Interop.Sys.NativeTcpConnectionInformation[] infos = new Interop.Sys.NativeTcpConnectionInformation[infoCount]; fixed (Interop.Sys.NativeTcpConnectionInformation* infosPtr = infos) { if (Interop.Sys.GetActiveTcpConnectionInfos(infosPtr, &infoCount) == -1) { throw new NetworkInformationException(SR.net_PInvokeError); } } TcpConnectionInformation[] connectionInformations = new TcpConnectionInformation[infoCount]; int nextResultIndex = 0; for (int i = 0; i < infoCount; i++) { Interop.Sys.NativeTcpConnectionInformation nativeInfo = infos[i]; TcpState state = nativeInfo.State; if (listeners != (state == TcpState.Listen)) { continue; } byte[] localBytes = new byte[nativeInfo.LocalEndPoint.NumAddressBytes]; fixed (byte* localBytesPtr = localBytes) { Buffer.MemoryCopy(nativeInfo.LocalEndPoint.AddressBytes, localBytesPtr, localBytes.Length, localBytes.Length); } IPAddress localIPAddress = new IPAddress(localBytes); IPEndPoint local = new IPEndPoint(localIPAddress, (int)nativeInfo.LocalEndPoint.Port); IPAddress remoteIPAddress; if (nativeInfo.RemoteEndPoint.NumAddressBytes == 0) { remoteIPAddress = IPAddress.Any; } else { byte[] remoteBytes = new byte[nativeInfo.RemoteEndPoint.NumAddressBytes]; fixed (byte* remoteBytesPtr = &remoteBytes[0]) { Buffer.MemoryCopy(nativeInfo.RemoteEndPoint.AddressBytes, remoteBytesPtr, remoteBytes.Length, remoteBytes.Length); } remoteIPAddress = new IPAddress(remoteBytes); } IPEndPoint remote = new IPEndPoint(remoteIPAddress, (int)nativeInfo.RemoteEndPoint.Port); connectionInformations[nextResultIndex++] = new SimpleTcpConnectionInformation(local, remote, state); } if (nextResultIndex != connectionInformations.Length) { Array.Resize(ref connectionInformations, nextResultIndex); } return connectionInformations; } public override TcpConnectionInformation[] GetActiveTcpConnections() { return GetTcpConnections(listeners:false); } public override IPEndPoint[] GetActiveTcpListeners() { TcpConnectionInformation[] allConnections = GetTcpConnections(listeners:true); var endPoints = new IPEndPoint[allConnections.Length]; for (int i = 0; i < allConnections.Length; i++) { endPoints[i] = allConnections[i].LocalEndPoint; } return endPoints; } public unsafe override IPEndPoint[] GetActiveUdpListeners() { int realCount = Interop.Sys.GetEstimatedUdpListenerCount(); int infoCount = realCount * 2; Interop.Sys.IPEndPointInfo[] infos = new Interop.Sys.IPEndPointInfo[infoCount]; fixed (Interop.Sys.IPEndPointInfo* infosPtr = infos) { if (Interop.Sys.GetActiveUdpListeners(infosPtr, &infoCount) == -1) { throw new NetworkInformationException(SR.net_PInvokeError); } } IPEndPoint[] endPoints = new IPEndPoint[infoCount]; for (int i = 0; i < infoCount; i++) { Interop.Sys.IPEndPointInfo endPointInfo = infos[i]; int port = (int)endPointInfo.Port; IPAddress ipAddress; if (endPointInfo.NumAddressBytes == 0) { ipAddress = IPAddress.Any; } else { byte[] bytes = new byte[endPointInfo.NumAddressBytes]; fixed (byte* bytesPtr = &bytes[0]) { Buffer.MemoryCopy(endPointInfo.AddressBytes, bytesPtr, bytes.Length, bytes.Length); } ipAddress = new IPAddress(bytes); } endPoints[i] = new IPEndPoint(ipAddress, port); } return endPoints; } public override IcmpV4Statistics GetIcmpV4Statistics() { return new BsdIcmpV4Statistics(); } public override IcmpV6Statistics GetIcmpV6Statistics() { return new BsdIcmpV6Statistics(); } public override IPGlobalStatistics GetIPv4GlobalStatistics() { return new BsdIPv4GlobalStatistics(); } [UnsupportedOSPlatform("osx")] [UnsupportedOSPlatform("ios")] [UnsupportedOSPlatform("tvos")] [UnsupportedOSPlatform("freebsd")] public override IPGlobalStatistics GetIPv6GlobalStatistics() { // Although there is a 'net.inet6.ip6.stats' sysctl variable, there // is no header for the ip6stat structure and therefore isn't available. throw new PlatformNotSupportedException(SR.net_InformationUnavailableOnPlatform); } public override TcpStatistics GetTcpIPv4Statistics() { // OSX does not provide separated TCP-IPv4 and TCP-IPv6 stats. return new BsdTcpStatistics(); } public override TcpStatistics GetTcpIPv6Statistics() { // OSX does not provide separated TCP-IPv4 and TCP-IPv6 stats. return new BsdTcpStatistics(); } public override UdpStatistics GetUdpIPv4Statistics() { // OSX does not provide separated UDP-IPv4 and UDP-IPv6 stats. return new BsdUdpStatistics(); } public override UdpStatistics GetUdpIPv6Statistics() { // OSX does not provide separated UDP-IPv4 and UDP-IPv6 stats. return new BsdUdpStatistics(); } } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/JIT/opt/ForwardSub/switchWithSideEffects.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <DebugType /> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="$(MSBuildProjectName).cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <DebugType /> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="$(MSBuildProjectName).cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/JIT/HardwareIntrinsics/General/Vector64/Negate.UInt32.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 NegateUInt32() { var test = new VectorUnaryOpTest__NegateUInt32(); // 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 VectorUnaryOpTest__NegateUInt32 { 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 != 32 && 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 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>>()); return testStruct; } public void RunStructFldScenario(VectorUnaryOpTest__NegateUInt32 testClass) { var result = Vector64.Negate(_fld1); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, 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 UInt32[] _data1 = new UInt32[Op1ElementCount]; private static Vector64<UInt32> _clsVar1; private Vector64<UInt32> _fld1; private DataTable _dataTable; static VectorUnaryOpTest__NegateUInt32() { 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>>()); } public VectorUnaryOpTest__NegateUInt32() { 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>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } _dataTable = new DataTable(_data1, new UInt32[RetElementCount], LargestVectorSize); } public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = Vector64.Negate( Unsafe.Read<Vector64<UInt32>>(_dataTable.inArray1Ptr) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var method = typeof(Vector64).GetMethod(nameof(Vector64.Negate), new Type[] { typeof(Vector64<UInt32>) }); if (method is null) { method = typeof(Vector64).GetMethod(nameof(Vector64.Negate), 1, new Type[] { typeof(Vector64<>).MakeGenericType(Type.MakeGenericMethodParameter(0)) }); } if (method.IsGenericMethodDefinition) { method = method.MakeGenericMethod(typeof(UInt32)); } var result = method.Invoke(null, new object[] { Unsafe.Read<Vector64<UInt32>>(_dataTable.inArray1Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector64<UInt32>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = Vector64.Negate( _clsVar1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _dataTable.outArrayPtr); } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector64<UInt32>>(_dataTable.inArray1Ptr); var result = Vector64.Negate(op1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new VectorUnaryOpTest__NegateUInt32(); var result = Vector64.Negate(test._fld1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, _dataTable.outArrayPtr); } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = Vector64.Negate(_fld1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _dataTable.outArrayPtr); } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = Vector64.Negate(test._fld1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } private void ValidateResult(Vector64<UInt32> op1, 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, outArray, method); } private void ValidateResult(void* op1, 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, outArray, method); } private void ValidateResult(UInt32[] firstOp, UInt32[] result, [CallerMemberName] string method = "") { bool succeeded = true; if (result[0] != (uint)(0 - firstOp[0])) { succeeded = false; } else { for (var i = 1; i < RetElementCount; i++) { if (result[i] != (uint)(0 - firstOp[i])) { succeeded = false; break; } } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(Vector64)}.{nameof(Vector64.Negate)}<UInt32>(Vector64<UInt32>): {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; namespace JIT.HardwareIntrinsics.General { public static partial class Program { private static void NegateUInt32() { var test = new VectorUnaryOpTest__NegateUInt32(); // 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 VectorUnaryOpTest__NegateUInt32 { 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 != 32 && 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 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>>()); return testStruct; } public void RunStructFldScenario(VectorUnaryOpTest__NegateUInt32 testClass) { var result = Vector64.Negate(_fld1); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, 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 UInt32[] _data1 = new UInt32[Op1ElementCount]; private static Vector64<UInt32> _clsVar1; private Vector64<UInt32> _fld1; private DataTable _dataTable; static VectorUnaryOpTest__NegateUInt32() { 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>>()); } public VectorUnaryOpTest__NegateUInt32() { 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>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } _dataTable = new DataTable(_data1, new UInt32[RetElementCount], LargestVectorSize); } public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = Vector64.Negate( Unsafe.Read<Vector64<UInt32>>(_dataTable.inArray1Ptr) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var method = typeof(Vector64).GetMethod(nameof(Vector64.Negate), new Type[] { typeof(Vector64<UInt32>) }); if (method is null) { method = typeof(Vector64).GetMethod(nameof(Vector64.Negate), 1, new Type[] { typeof(Vector64<>).MakeGenericType(Type.MakeGenericMethodParameter(0)) }); } if (method.IsGenericMethodDefinition) { method = method.MakeGenericMethod(typeof(UInt32)); } var result = method.Invoke(null, new object[] { Unsafe.Read<Vector64<UInt32>>(_dataTable.inArray1Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector64<UInt32>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = Vector64.Negate( _clsVar1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _dataTable.outArrayPtr); } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector64<UInt32>>(_dataTable.inArray1Ptr); var result = Vector64.Negate(op1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new VectorUnaryOpTest__NegateUInt32(); var result = Vector64.Negate(test._fld1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, _dataTable.outArrayPtr); } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = Vector64.Negate(_fld1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _dataTable.outArrayPtr); } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = Vector64.Negate(test._fld1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } private void ValidateResult(Vector64<UInt32> op1, 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, outArray, method); } private void ValidateResult(void* op1, 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, outArray, method); } private void ValidateResult(UInt32[] firstOp, UInt32[] result, [CallerMemberName] string method = "") { bool succeeded = true; if (result[0] != (uint)(0 - firstOp[0])) { succeeded = false; } else { for (var i = 1; i < RetElementCount; i++) { if (result[i] != (uint)(0 - firstOp[i])) { succeeded = false; break; } } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(Vector64)}.{nameof(Vector64.Negate)}<UInt32>(Vector64<UInt32>): {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,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/libraries/System.Private.CoreLib/src/System/Runtime/Versioning/ComponentGuaranteesOptions.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.Versioning { [Flags] public enum ComponentGuaranteesOptions { None = 0, Exchange = 0x1, Stable = 0x2, SideBySide = 0x4, } }
// 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.Versioning { [Flags] public enum ComponentGuaranteesOptions { None = 0, Exchange = 0x1, Stable = 0x2, SideBySide = 0x4, } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/libraries/System.Net.Primitives/tests/FunctionalTests/IPEndPointParsing.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.Net.Sockets; using Xunit; namespace System.Net.Primitives.Functional.Tests { public class IPEndPointParsing { [Theory] [MemberData(nameof(IPAddressParsing.ValidIpv4Addresses), MemberType = typeof(IPAddressParsing))] // Just borrow the list from IPAddressParsing public void Parse_ValidEndPoint_IPv4_Success(string address, string expectedAddress) { Parse_ValidEndPoint_Success(address, expectedAddress, true); } [Theory] [MemberData(nameof(ValidIpv6AddressesNoPort))] // We need our own list here to explicitly exclude port numbers and brackets without making the test overly complicated (and less valid) public void Parse_ValidEndPoint_IPv6_Success(string address, string expectedAddress) { Parse_ValidEndPoint_Success(address, expectedAddress, false); } private void Parse_ValidEndPoint_Success(string address, string expectedAddress, bool isIPv4) { // We'll parse just the address alone followed by the address with various port numbers expectedAddress = expectedAddress.ToLowerInvariant(); // This is done in the IP parse routines // TryParse should return true Assert.True(IPEndPoint.TryParse(address, out IPEndPoint result)); Assert.Equal(expectedAddress, result.Address.ToString()); Assert.Equal(0, result.Port); // Parse should give us the same result result = IPEndPoint.Parse(address); Assert.Equal(expectedAddress, result.Address.ToString()); Assert.Equal(0, result.Port); // Cover varying lengths of port number int portNumber = 1; for (int i = 0; i < 5; i++) { var addressAndPort = isIPv4 ? $"{address}:{portNumber}" : $"[{address}]:{portNumber}"; // TryParse should return true Assert.True(IPEndPoint.TryParse(addressAndPort, out result)); Assert.Equal(expectedAddress, result.Address.ToString()); Assert.Equal(portNumber, result.Port); // Parse should give us the same result result = IPEndPoint.Parse(addressAndPort); Assert.Equal(expectedAddress, result.Address.ToString()); Assert.Equal(portNumber, result.Port); // i.e.: 1; 12; 123; 1234; 12345 portNumber *= 10; portNumber += i + 2; } } [Theory] [MemberData(nameof(IPAddressParsing.InvalidIpv4Addresses), MemberType = typeof(IPAddressParsing))] [MemberData(nameof(IPAddressParsing.InvalidIpv4AddressesStandalone), MemberType = typeof(IPAddressParsing))] public void Parse_InvalidAddress_IPv4_Throws(string address) { Parse_InvalidAddress_Throws(address, true); } [Theory] [MemberData(nameof(IPAddressParsing.InvalidIpv6Addresses), MemberType = typeof(IPAddressParsing))] [MemberData(nameof(IPAddressParsing.InvalidIpv6AddressesNoInner), MemberType = typeof(IPAddressParsing))] public void Parse_InvalidAddress_IPv6_Throws(string address) { Parse_InvalidAddress_Throws(address, false); } private void Parse_InvalidAddress_Throws(string address, bool isIPv4) { // TryParse should return false and set result to null Assert.False(IPEndPoint.TryParse(address, out IPEndPoint result)); Assert.Null(result); // Parse should throw Assert.Throws<FormatException>(() => IPEndPoint.Parse(address)); int portNumber = 1; for (int i = 0; i < 5; i++) { string addressAndPort = isIPv4 ? $"{address}:{portNumber}" : $"[{address}]:{portNumber}"; // TryParse should return false and set result to null result = new IPEndPoint(IPAddress.Parse("0"), 25); Assert.False(IPEndPoint.TryParse(addressAndPort, out result)); Assert.Null(result); // Parse should throw Assert.Throws<FormatException>(() => IPEndPoint.Parse(addressAndPort)); // i.e.: 1; 12; 123; 1234; 12345 portNumber *= 10; portNumber += i + 2; } } [Theory] [MemberData(nameof(IPAddressParsing.ValidIpv4Addresses), MemberType = typeof(IPAddressParsing))] public void Parse_InvalidPort_IPv4_Throws(string address, string expectedAddress) { _ = expectedAddress; Parse_InvalidPort_Throws(address, isIPv4: true); } [Theory] [MemberData(nameof(IPAddressParsing.ValidIpv6Addresses), MemberType = typeof(IPAddressParsing))] public void Parse_InvalidPort_IPv6_Throws(string address, string expectedAddress) { _ = expectedAddress; Parse_InvalidPort_Throws(address, isIPv4: false); } private void Parse_InvalidPort_Throws(string address, bool isIPv4) { InvalidPortHelper(isIPv4 ? $"{address}:65536" : $"[{address}]:65536"); // port exceeds max InvalidPortHelper(isIPv4 ? $"{address}:-300" : $"[{address}]:-300"); // port is negative InvalidPortHelper(isIPv4 ? $"{address}:+300" : $"[{address}]:+300"); // plug sign int portNumber = 1; for (int i = 0; i < 5; i++) { InvalidPortHelper(isIPv4 ? $"{address}:a{portNumber}" : $"[{address}]:a{portNumber}"); // character at start of port InvalidPortHelper(isIPv4 ? $"{address}:{portNumber}a" : $"[{address}]:{portNumber}a"); // character at end of port InvalidPortHelper(isIPv4 ? $"{address}]:{portNumber}" : $"[{address}]]:{portNumber}"); // bracket where it should not be InvalidPortHelper(isIPv4 ? $"{address}:]{portNumber}" : $"[{address}]:]{portNumber}"); // bracket after colon InvalidPortHelper(isIPv4 ? $"{address}:{portNumber}]" : $"[{address}]:{portNumber}]"); // trailing bracket InvalidPortHelper(isIPv4 ? $"{address}:{portNumber}:" : $"[{address}]:{portNumber}:"); // trailing colon InvalidPortHelper(isIPv4 ? $"{address}:{portNumber}:{portNumber}" : $"[{address}]:{portNumber}]:{portNumber}"); // double port InvalidPortHelper(isIPv4 ? $"{address}:{portNumber}a{portNumber}" : $"[{address}]:{portNumber}a{portNumber}"); // character in the middle of numbers string addressAndPort = isIPv4 ? $"{address}::{portNumber}" : $"[{address}]::{portNumber}"; // double delimiter // Appending two colons to an address may create a valid one (e.g. "0" becomes "0::x"). // If and only if the address parsers says it's not valid then we should as well if (!IPAddress.TryParse(addressAndPort, out IPAddress ipAddress)) { InvalidPortHelper(addressAndPort); } // i.e.: 1; 12; 123; 1234; 12345 portNumber *= 10; portNumber += i + 2; } } private void InvalidPortHelper(string addressAndPort) { // TryParse should return false and set result to null Assert.False(IPEndPoint.TryParse(addressAndPort, out IPEndPoint result)); Assert.Null(result); // Parse should throw Assert.Throws<FormatException>(() => IPEndPoint.Parse(addressAndPort)); } public static readonly object[][] ValidIpv6AddressesNoPort = { new object[] { "Fe08::1", "fe08::1" }, new object[] { "0000:0000:0000:0000:0000:0000:0000:0000", "::" }, new object[] { "FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF", "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff" }, new object[] { "0:0:0:0:0:0:0:0", "::" }, new object[] { "1:0:0:0:0:0:0:0", "1::" }, new object[] { "0:1:0:0:0:0:0:0", "0:1::" }, new object[] { "0:0:1:0:0:0:0:0", "0:0:1::" }, new object[] { "0:0:0:1:0:0:0:0", "0:0:0:1::" }, new object[] { "0:0:0:0:1:0:0:0", "::1:0:0:0" }, new object[] { "0:0:0:0:0:1:0:0", "::1:0:0" }, new object[] { "0:0:0:0:0:0:1:0", "::0.1.0.0" }, new object[] { "0:0:0:0:0:0:2:0", "::0.2.0.0" }, new object[] { "0:0:0:0:0:0:F:0", "::0.15.0.0" }, new object[] { "0:0:0:0:0:0:10:0", "::0.16.0.0" }, new object[] { "0:0:0:0:0:0:A0:0", "::0.160.0.0" }, new object[] { "0:0:0:0:0:0:F0:0", "::0.240.0.0" }, new object[] { "0:0:0:0:0:0:FF:0", "::0.255.0.0" }, new object[] { "0:0:0:0:0:0:0:1", "::1" }, new object[] { "0:0:0:0:0:0:0:2", "::2" }, new object[] { "0:0:0:0:0:0:0:F", "::F" }, new object[] { "0:0:0:0:0:0:0:10", "::10" }, new object[] { "0:0:0:0:0:0:0:1A", "::1A" }, new object[] { "0:0:0:0:0:0:0:A0", "::A0" }, new object[] { "0:0:0:0:0:0:0:F0", "::F0" }, new object[] { "0:0:0:0:0:0:0:FF", "::FF" }, new object[] { "0:0:0:0:0:0:0:1001", "::1001" }, new object[] { "0:0:0:0:0:0:0:1002", "::1002" }, new object[] { "0:0:0:0:0:0:0:100F", "::100F" }, new object[] { "0:0:0:0:0:0:0:1010", "::1010" }, new object[] { "0:0:0:0:0:0:0:10A0", "::10A0" }, new object[] { "0:0:0:0:0:0:0:10F0", "::10F0" }, new object[] { "0:0:0:0:0:0:0:10FF", "::10FF" }, new object[] { "0:0:0:0:0:0:1:1", "::0.1.0.1" }, new object[] { "0:0:0:0:0:0:2:2", "::0.2.0.2" }, new object[] { "0:0:0:0:0:0:F:F", "::0.15.0.15" }, new object[] { "0:0:0:0:0:0:10:10", "::0.16.0.16" }, new object[] { "0:0:0:0:0:0:A0:A0", "::0.160.0.160" }, new object[] { "0:0:0:0:0:0:F0:F0", "::0.240.0.240" }, new object[] { "0:0:0:0:0:0:FF:FF", "::0.255.0.255" }, new object[] { "0:0:0:0:0:FFFF:0:1", "::FFFF:0:1" }, new object[] { "0:0:0:0:0:FFFF:0:2", "::FFFF:0:2" }, new object[] { "0:0:0:0:0:FFFF:0:F", "::FFFF:0:F" }, new object[] { "0:0:0:0:0:FFFF:0:10", "::FFFF:0:10" }, new object[] { "0:0:0:0:0:FFFF:0:A0", "::FFFF:0:A0" }, new object[] { "0:0:0:0:0:FFFF:0:F0", "::FFFF:0:F0" }, new object[] { "0:0:0:0:0:FFFF:0:FF", "::FFFF:0:FF" }, new object[] { "0:0:0:0:0:FFFF:1:0", "::FFFF:0.1.0.0" }, new object[] { "0:0:0:0:0:FFFF:2:0", "::FFFF:0.2.0.0" }, new object[] { "0:0:0:0:0:FFFF:F:0", "::FFFF:0.15.0.0" }, new object[] { "0:0:0:0:0:FFFF:10:0", "::FFFF:0.16.0.0" }, new object[] { "0:0:0:0:0:FFFF:A0:0", "::FFFF:0.160.0.0" }, new object[] { "0:0:0:0:0:FFFF:F0:0", "::FFFF:0.240.0.0" }, new object[] { "0:0:0:0:0:FFFF:FF:0", "::FFFF:0.255.0.0" }, new object[] { "0:0:0:0:0:FFFF:0:1001", "::FFFF:0:1001" }, new object[] { "0:0:0:0:0:FFFF:0:1002", "::FFFF:0:1002" }, new object[] { "0:0:0:0:0:FFFF:0:100F", "::FFFF:0:100F" }, new object[] { "0:0:0:0:0:FFFF:0:1010", "::FFFF:0:1010" }, new object[] { "0:0:0:0:0:FFFF:0:10A0", "::FFFF:0:10A0" }, new object[] { "0:0:0:0:0:FFFF:0:10F0", "::FFFF:0:10F0" }, new object[] { "0:0:0:0:0:FFFF:0:10FF", "::FFFF:0:10FF" }, new object[] { "0:0:0:0:0:FFFF:1:1", "::FFFF:0.1.0.1" }, new object[] { "0:0:0:0:0:FFFF:2:2", "::FFFF:0.2.0.2" }, new object[] { "0:0:0:0:0:FFFF:F:F", "::FFFF:0.15.0.15" }, new object[] { "0:0:0:0:0:FFFF:10:10", "::FFFF:0.16.0.16" }, new object[] { "0:0:0:0:0:FFFF:A0:A0", "::FFFF:0.160.0.160" }, new object[] { "0:0:0:0:0:FFFF:F0:F0", "::FFFF:0.240.0.240" }, new object[] { "0:0:0:0:0:FFFF:FF:FF", "::FFFF:0.255.0.255" }, new object[] { "0:7:7:7:7:7:7:7", "0:7:7:7:7:7:7:7" }, new object[] { "1:0:0:0:0:0:0:1", "1::1" }, new object[] { "1:1:0:0:0:0:0:0", "1:1::" }, new object[] { "2:2:0:0:0:0:0:0", "2:2::" }, new object[] { "1:1:0:0:0:0:0:1", "1:1::1" }, new object[] { "1:0:1:0:0:0:0:1", "1:0:1::1" }, new object[] { "1:0:0:1:0:0:0:1", "1:0:0:1::1" }, new object[] { "1:0:0:0:1:0:0:1", "1::1:0:0:1" }, new object[] { "1:0:0:0:0:1:0:1", "1::1:0:1" }, new object[] { "1:0:0:0:0:0:1:1", "1::1:1" }, new object[] { "1:1:0:0:1:0:0:1", "1:1::1:0:0:1" }, new object[] { "1:0:1:0:0:1:0:1", "1:0:1::1:0:1" }, new object[] { "1:0:0:1:0:0:1:1", "1::1:0:0:1:1" }, new object[] { "1:1:0:0:0:1:0:1", "1:1::1:0:1" }, new object[] { "1:0:0:0:1:0:1:1", "1::1:0:1:1" }, new object[] { "1:1:1:1:1:1:1:0", "1:1:1:1:1:1:1:0" }, new object[] { "7:7:7:7:7:7:7:0", "7:7:7:7:7:7:7:0" }, new object[] { "E:0:0:0:0:0:0:1", "E::1" }, new object[] { "E:0:0:0:0:0:2:2", "E::2:2" }, new object[] { "E:0:6:6:6:6:6:6", "E:0:6:6:6:6:6:6" }, new object[] { "E:E:0:0:0:0:0:1", "E:E::1" }, new object[] { "E:E:0:0:0:0:2:2", "E:E::2:2" }, new object[] { "E:E:0:5:5:5:5:5", "E:E:0:5:5:5:5:5" }, new object[] { "E:E:E:0:0:0:0:1", "E:E:E::1" }, new object[] { "E:E:E:0:0:0:2:2", "E:E:E::2:2" }, new object[] { "E:E:E:0:4:4:4:4", "E:E:E:0:4:4:4:4" }, new object[] { "E:E:E:E:0:0:0:1", "E:E:E:E::1" }, new object[] { "E:E:E:E:0:0:2:2", "E:E:E:E::2:2" }, new object[] { "E:E:E:E:0:3:3:3", "E:E:E:E:0:3:3:3" }, new object[] { "E:E:E:E:E:0:0:1", "E:E:E:E:E::1" }, new object[] { "E:E:E:E:E:0:2:2", "E:E:E:E:E:0:2:2" }, new object[] { "E:E:E:E:E:E:0:1", "E:E:E:E:E:E:0:1" }, new object[] { "::FFFF:192.168.0.1", "::FFFF:192.168.0.1" }, new object[] { "::FFFF:0.168.0.1", "::FFFF:0.168.0.1" }, new object[] { "::0.0.255.255", "::FFFF" }, new object[] { "::EEEE:10.0.0.1", "::EEEE:A00:1" }, new object[] { "::10.0.0.1", "::10.0.0.1" }, new object[] { "1234:0:0:0:0:1234:0:0", "1234::1234:0:0" }, new object[] { "1:0:1:0:1:0:1:0", "1:0:1:0:1:0:1:0" }, new object[] { "1:1:1:0:0:1:1:0", "1:1:1::1:1:0" }, new object[] { "0:0:0:0:0:1234:0:0", "::1234:0:0" }, new object[] { "3ffe:38e1::0100:1:0001", "3ffe:38e1::100:1:1" }, new object[] { "0:0:1:2:00:00:000:0000", "0:0:1:2::" }, new object[] { "100:0:1:2:0:0:000:abcd", "100:0:1:2::abcd" }, new object[] { "ffff:0:0:0:0:0:00:abcd", "ffff::abcd" }, new object[] { "ffff:0:0:2:0:0:00:abcd", "ffff:0:0:2::abcd" }, new object[] { "0:0:1:2:0:00:0000:0000", "0:0:1:2::" }, new object[] { "0000:0000::1:0000:0000", "::1:0:0" }, new object[] { "0:0:111:234:5:6:789A:0", "::111:234:5:6:789a:0" }, new object[] { "11:22:33:44:55:66:77:8", "11:22:33:44:55:66:77:8" }, new object[] { "::7711:ab42:1230:0:0:0", "0:0:7711:ab42:1230::" }, new object[] { "::", "::" }, new object[] { "2001:0db8::0001", "2001:db8::1" }, // leading 0s suppressed new object[] { "3731:54:65fe:2::a7", "3731:54:65fe:2::a7" }, // Unicast new object[] { "3731:54:65fe:2::a8", "3731:54:65fe:2::a8" }, // Anycast // ScopeID new object[] { "Fe08::1%13542", "fe08::1%13542" }, new object[] { "1::%1", "1::%1" }, new object[] { "::1%12", "::1%12" }, new object[] { "::%123", "::%123" }, // v4 as v6 new object[] { "FE08::192.168.0.1", "fe08::c0a8:1" }, // Output is not IPv4 mapped new object[] { "::192.168.0.1", "::192.168.0.1" }, new object[] { "::FFFF:192.168.0.1", "::ffff:192.168.0.1" }, // SIIT new object[] { "::FFFF:0:192.168.0.1", "::ffff:0:192.168.0.1" }, // SIIT new object[] { "::5EFE:192.168.0.1", "::5efe:192.168.0.1" }, // ISATAP new object[] { "1::5EFE:192.168.0.1", "1::5efe:192.168.0.1" }, // ISATAP new object[] { "::192.168.0.010", "::192.168.0.10" }, // Embedded IPv4 octal, read as decimal }; } }
// 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.Net.Sockets; using Xunit; namespace System.Net.Primitives.Functional.Tests { public class IPEndPointParsing { [Theory] [MemberData(nameof(IPAddressParsing.ValidIpv4Addresses), MemberType = typeof(IPAddressParsing))] // Just borrow the list from IPAddressParsing public void Parse_ValidEndPoint_IPv4_Success(string address, string expectedAddress) { Parse_ValidEndPoint_Success(address, expectedAddress, true); } [Theory] [MemberData(nameof(ValidIpv6AddressesNoPort))] // We need our own list here to explicitly exclude port numbers and brackets without making the test overly complicated (and less valid) public void Parse_ValidEndPoint_IPv6_Success(string address, string expectedAddress) { Parse_ValidEndPoint_Success(address, expectedAddress, false); } private void Parse_ValidEndPoint_Success(string address, string expectedAddress, bool isIPv4) { // We'll parse just the address alone followed by the address with various port numbers expectedAddress = expectedAddress.ToLowerInvariant(); // This is done in the IP parse routines // TryParse should return true Assert.True(IPEndPoint.TryParse(address, out IPEndPoint result)); Assert.Equal(expectedAddress, result.Address.ToString()); Assert.Equal(0, result.Port); // Parse should give us the same result result = IPEndPoint.Parse(address); Assert.Equal(expectedAddress, result.Address.ToString()); Assert.Equal(0, result.Port); // Cover varying lengths of port number int portNumber = 1; for (int i = 0; i < 5; i++) { var addressAndPort = isIPv4 ? $"{address}:{portNumber}" : $"[{address}]:{portNumber}"; // TryParse should return true Assert.True(IPEndPoint.TryParse(addressAndPort, out result)); Assert.Equal(expectedAddress, result.Address.ToString()); Assert.Equal(portNumber, result.Port); // Parse should give us the same result result = IPEndPoint.Parse(addressAndPort); Assert.Equal(expectedAddress, result.Address.ToString()); Assert.Equal(portNumber, result.Port); // i.e.: 1; 12; 123; 1234; 12345 portNumber *= 10; portNumber += i + 2; } } [Theory] [MemberData(nameof(IPAddressParsing.InvalidIpv4Addresses), MemberType = typeof(IPAddressParsing))] [MemberData(nameof(IPAddressParsing.InvalidIpv4AddressesStandalone), MemberType = typeof(IPAddressParsing))] public void Parse_InvalidAddress_IPv4_Throws(string address) { Parse_InvalidAddress_Throws(address, true); } [Theory] [MemberData(nameof(IPAddressParsing.InvalidIpv6Addresses), MemberType = typeof(IPAddressParsing))] [MemberData(nameof(IPAddressParsing.InvalidIpv6AddressesNoInner), MemberType = typeof(IPAddressParsing))] public void Parse_InvalidAddress_IPv6_Throws(string address) { Parse_InvalidAddress_Throws(address, false); } private void Parse_InvalidAddress_Throws(string address, bool isIPv4) { // TryParse should return false and set result to null Assert.False(IPEndPoint.TryParse(address, out IPEndPoint result)); Assert.Null(result); // Parse should throw Assert.Throws<FormatException>(() => IPEndPoint.Parse(address)); int portNumber = 1; for (int i = 0; i < 5; i++) { string addressAndPort = isIPv4 ? $"{address}:{portNumber}" : $"[{address}]:{portNumber}"; // TryParse should return false and set result to null result = new IPEndPoint(IPAddress.Parse("0"), 25); Assert.False(IPEndPoint.TryParse(addressAndPort, out result)); Assert.Null(result); // Parse should throw Assert.Throws<FormatException>(() => IPEndPoint.Parse(addressAndPort)); // i.e.: 1; 12; 123; 1234; 12345 portNumber *= 10; portNumber += i + 2; } } [Theory] [MemberData(nameof(IPAddressParsing.ValidIpv4Addresses), MemberType = typeof(IPAddressParsing))] public void Parse_InvalidPort_IPv4_Throws(string address, string expectedAddress) { _ = expectedAddress; Parse_InvalidPort_Throws(address, isIPv4: true); } [Theory] [MemberData(nameof(IPAddressParsing.ValidIpv6Addresses), MemberType = typeof(IPAddressParsing))] public void Parse_InvalidPort_IPv6_Throws(string address, string expectedAddress) { _ = expectedAddress; Parse_InvalidPort_Throws(address, isIPv4: false); } private void Parse_InvalidPort_Throws(string address, bool isIPv4) { InvalidPortHelper(isIPv4 ? $"{address}:65536" : $"[{address}]:65536"); // port exceeds max InvalidPortHelper(isIPv4 ? $"{address}:-300" : $"[{address}]:-300"); // port is negative InvalidPortHelper(isIPv4 ? $"{address}:+300" : $"[{address}]:+300"); // plug sign int portNumber = 1; for (int i = 0; i < 5; i++) { InvalidPortHelper(isIPv4 ? $"{address}:a{portNumber}" : $"[{address}]:a{portNumber}"); // character at start of port InvalidPortHelper(isIPv4 ? $"{address}:{portNumber}a" : $"[{address}]:{portNumber}a"); // character at end of port InvalidPortHelper(isIPv4 ? $"{address}]:{portNumber}" : $"[{address}]]:{portNumber}"); // bracket where it should not be InvalidPortHelper(isIPv4 ? $"{address}:]{portNumber}" : $"[{address}]:]{portNumber}"); // bracket after colon InvalidPortHelper(isIPv4 ? $"{address}:{portNumber}]" : $"[{address}]:{portNumber}]"); // trailing bracket InvalidPortHelper(isIPv4 ? $"{address}:{portNumber}:" : $"[{address}]:{portNumber}:"); // trailing colon InvalidPortHelper(isIPv4 ? $"{address}:{portNumber}:{portNumber}" : $"[{address}]:{portNumber}]:{portNumber}"); // double port InvalidPortHelper(isIPv4 ? $"{address}:{portNumber}a{portNumber}" : $"[{address}]:{portNumber}a{portNumber}"); // character in the middle of numbers string addressAndPort = isIPv4 ? $"{address}::{portNumber}" : $"[{address}]::{portNumber}"; // double delimiter // Appending two colons to an address may create a valid one (e.g. "0" becomes "0::x"). // If and only if the address parsers says it's not valid then we should as well if (!IPAddress.TryParse(addressAndPort, out IPAddress ipAddress)) { InvalidPortHelper(addressAndPort); } // i.e.: 1; 12; 123; 1234; 12345 portNumber *= 10; portNumber += i + 2; } } private void InvalidPortHelper(string addressAndPort) { // TryParse should return false and set result to null Assert.False(IPEndPoint.TryParse(addressAndPort, out IPEndPoint result)); Assert.Null(result); // Parse should throw Assert.Throws<FormatException>(() => IPEndPoint.Parse(addressAndPort)); } public static readonly object[][] ValidIpv6AddressesNoPort = { new object[] { "Fe08::1", "fe08::1" }, new object[] { "0000:0000:0000:0000:0000:0000:0000:0000", "::" }, new object[] { "FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF", "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff" }, new object[] { "0:0:0:0:0:0:0:0", "::" }, new object[] { "1:0:0:0:0:0:0:0", "1::" }, new object[] { "0:1:0:0:0:0:0:0", "0:1::" }, new object[] { "0:0:1:0:0:0:0:0", "0:0:1::" }, new object[] { "0:0:0:1:0:0:0:0", "0:0:0:1::" }, new object[] { "0:0:0:0:1:0:0:0", "::1:0:0:0" }, new object[] { "0:0:0:0:0:1:0:0", "::1:0:0" }, new object[] { "0:0:0:0:0:0:1:0", "::0.1.0.0" }, new object[] { "0:0:0:0:0:0:2:0", "::0.2.0.0" }, new object[] { "0:0:0:0:0:0:F:0", "::0.15.0.0" }, new object[] { "0:0:0:0:0:0:10:0", "::0.16.0.0" }, new object[] { "0:0:0:0:0:0:A0:0", "::0.160.0.0" }, new object[] { "0:0:0:0:0:0:F0:0", "::0.240.0.0" }, new object[] { "0:0:0:0:0:0:FF:0", "::0.255.0.0" }, new object[] { "0:0:0:0:0:0:0:1", "::1" }, new object[] { "0:0:0:0:0:0:0:2", "::2" }, new object[] { "0:0:0:0:0:0:0:F", "::F" }, new object[] { "0:0:0:0:0:0:0:10", "::10" }, new object[] { "0:0:0:0:0:0:0:1A", "::1A" }, new object[] { "0:0:0:0:0:0:0:A0", "::A0" }, new object[] { "0:0:0:0:0:0:0:F0", "::F0" }, new object[] { "0:0:0:0:0:0:0:FF", "::FF" }, new object[] { "0:0:0:0:0:0:0:1001", "::1001" }, new object[] { "0:0:0:0:0:0:0:1002", "::1002" }, new object[] { "0:0:0:0:0:0:0:100F", "::100F" }, new object[] { "0:0:0:0:0:0:0:1010", "::1010" }, new object[] { "0:0:0:0:0:0:0:10A0", "::10A0" }, new object[] { "0:0:0:0:0:0:0:10F0", "::10F0" }, new object[] { "0:0:0:0:0:0:0:10FF", "::10FF" }, new object[] { "0:0:0:0:0:0:1:1", "::0.1.0.1" }, new object[] { "0:0:0:0:0:0:2:2", "::0.2.0.2" }, new object[] { "0:0:0:0:0:0:F:F", "::0.15.0.15" }, new object[] { "0:0:0:0:0:0:10:10", "::0.16.0.16" }, new object[] { "0:0:0:0:0:0:A0:A0", "::0.160.0.160" }, new object[] { "0:0:0:0:0:0:F0:F0", "::0.240.0.240" }, new object[] { "0:0:0:0:0:0:FF:FF", "::0.255.0.255" }, new object[] { "0:0:0:0:0:FFFF:0:1", "::FFFF:0:1" }, new object[] { "0:0:0:0:0:FFFF:0:2", "::FFFF:0:2" }, new object[] { "0:0:0:0:0:FFFF:0:F", "::FFFF:0:F" }, new object[] { "0:0:0:0:0:FFFF:0:10", "::FFFF:0:10" }, new object[] { "0:0:0:0:0:FFFF:0:A0", "::FFFF:0:A0" }, new object[] { "0:0:0:0:0:FFFF:0:F0", "::FFFF:0:F0" }, new object[] { "0:0:0:0:0:FFFF:0:FF", "::FFFF:0:FF" }, new object[] { "0:0:0:0:0:FFFF:1:0", "::FFFF:0.1.0.0" }, new object[] { "0:0:0:0:0:FFFF:2:0", "::FFFF:0.2.0.0" }, new object[] { "0:0:0:0:0:FFFF:F:0", "::FFFF:0.15.0.0" }, new object[] { "0:0:0:0:0:FFFF:10:0", "::FFFF:0.16.0.0" }, new object[] { "0:0:0:0:0:FFFF:A0:0", "::FFFF:0.160.0.0" }, new object[] { "0:0:0:0:0:FFFF:F0:0", "::FFFF:0.240.0.0" }, new object[] { "0:0:0:0:0:FFFF:FF:0", "::FFFF:0.255.0.0" }, new object[] { "0:0:0:0:0:FFFF:0:1001", "::FFFF:0:1001" }, new object[] { "0:0:0:0:0:FFFF:0:1002", "::FFFF:0:1002" }, new object[] { "0:0:0:0:0:FFFF:0:100F", "::FFFF:0:100F" }, new object[] { "0:0:0:0:0:FFFF:0:1010", "::FFFF:0:1010" }, new object[] { "0:0:0:0:0:FFFF:0:10A0", "::FFFF:0:10A0" }, new object[] { "0:0:0:0:0:FFFF:0:10F0", "::FFFF:0:10F0" }, new object[] { "0:0:0:0:0:FFFF:0:10FF", "::FFFF:0:10FF" }, new object[] { "0:0:0:0:0:FFFF:1:1", "::FFFF:0.1.0.1" }, new object[] { "0:0:0:0:0:FFFF:2:2", "::FFFF:0.2.0.2" }, new object[] { "0:0:0:0:0:FFFF:F:F", "::FFFF:0.15.0.15" }, new object[] { "0:0:0:0:0:FFFF:10:10", "::FFFF:0.16.0.16" }, new object[] { "0:0:0:0:0:FFFF:A0:A0", "::FFFF:0.160.0.160" }, new object[] { "0:0:0:0:0:FFFF:F0:F0", "::FFFF:0.240.0.240" }, new object[] { "0:0:0:0:0:FFFF:FF:FF", "::FFFF:0.255.0.255" }, new object[] { "0:7:7:7:7:7:7:7", "0:7:7:7:7:7:7:7" }, new object[] { "1:0:0:0:0:0:0:1", "1::1" }, new object[] { "1:1:0:0:0:0:0:0", "1:1::" }, new object[] { "2:2:0:0:0:0:0:0", "2:2::" }, new object[] { "1:1:0:0:0:0:0:1", "1:1::1" }, new object[] { "1:0:1:0:0:0:0:1", "1:0:1::1" }, new object[] { "1:0:0:1:0:0:0:1", "1:0:0:1::1" }, new object[] { "1:0:0:0:1:0:0:1", "1::1:0:0:1" }, new object[] { "1:0:0:0:0:1:0:1", "1::1:0:1" }, new object[] { "1:0:0:0:0:0:1:1", "1::1:1" }, new object[] { "1:1:0:0:1:0:0:1", "1:1::1:0:0:1" }, new object[] { "1:0:1:0:0:1:0:1", "1:0:1::1:0:1" }, new object[] { "1:0:0:1:0:0:1:1", "1::1:0:0:1:1" }, new object[] { "1:1:0:0:0:1:0:1", "1:1::1:0:1" }, new object[] { "1:0:0:0:1:0:1:1", "1::1:0:1:1" }, new object[] { "1:1:1:1:1:1:1:0", "1:1:1:1:1:1:1:0" }, new object[] { "7:7:7:7:7:7:7:0", "7:7:7:7:7:7:7:0" }, new object[] { "E:0:0:0:0:0:0:1", "E::1" }, new object[] { "E:0:0:0:0:0:2:2", "E::2:2" }, new object[] { "E:0:6:6:6:6:6:6", "E:0:6:6:6:6:6:6" }, new object[] { "E:E:0:0:0:0:0:1", "E:E::1" }, new object[] { "E:E:0:0:0:0:2:2", "E:E::2:2" }, new object[] { "E:E:0:5:5:5:5:5", "E:E:0:5:5:5:5:5" }, new object[] { "E:E:E:0:0:0:0:1", "E:E:E::1" }, new object[] { "E:E:E:0:0:0:2:2", "E:E:E::2:2" }, new object[] { "E:E:E:0:4:4:4:4", "E:E:E:0:4:4:4:4" }, new object[] { "E:E:E:E:0:0:0:1", "E:E:E:E::1" }, new object[] { "E:E:E:E:0:0:2:2", "E:E:E:E::2:2" }, new object[] { "E:E:E:E:0:3:3:3", "E:E:E:E:0:3:3:3" }, new object[] { "E:E:E:E:E:0:0:1", "E:E:E:E:E::1" }, new object[] { "E:E:E:E:E:0:2:2", "E:E:E:E:E:0:2:2" }, new object[] { "E:E:E:E:E:E:0:1", "E:E:E:E:E:E:0:1" }, new object[] { "::FFFF:192.168.0.1", "::FFFF:192.168.0.1" }, new object[] { "::FFFF:0.168.0.1", "::FFFF:0.168.0.1" }, new object[] { "::0.0.255.255", "::FFFF" }, new object[] { "::EEEE:10.0.0.1", "::EEEE:A00:1" }, new object[] { "::10.0.0.1", "::10.0.0.1" }, new object[] { "1234:0:0:0:0:1234:0:0", "1234::1234:0:0" }, new object[] { "1:0:1:0:1:0:1:0", "1:0:1:0:1:0:1:0" }, new object[] { "1:1:1:0:0:1:1:0", "1:1:1::1:1:0" }, new object[] { "0:0:0:0:0:1234:0:0", "::1234:0:0" }, new object[] { "3ffe:38e1::0100:1:0001", "3ffe:38e1::100:1:1" }, new object[] { "0:0:1:2:00:00:000:0000", "0:0:1:2::" }, new object[] { "100:0:1:2:0:0:000:abcd", "100:0:1:2::abcd" }, new object[] { "ffff:0:0:0:0:0:00:abcd", "ffff::abcd" }, new object[] { "ffff:0:0:2:0:0:00:abcd", "ffff:0:0:2::abcd" }, new object[] { "0:0:1:2:0:00:0000:0000", "0:0:1:2::" }, new object[] { "0000:0000::1:0000:0000", "::1:0:0" }, new object[] { "0:0:111:234:5:6:789A:0", "::111:234:5:6:789a:0" }, new object[] { "11:22:33:44:55:66:77:8", "11:22:33:44:55:66:77:8" }, new object[] { "::7711:ab42:1230:0:0:0", "0:0:7711:ab42:1230::" }, new object[] { "::", "::" }, new object[] { "2001:0db8::0001", "2001:db8::1" }, // leading 0s suppressed new object[] { "3731:54:65fe:2::a7", "3731:54:65fe:2::a7" }, // Unicast new object[] { "3731:54:65fe:2::a8", "3731:54:65fe:2::a8" }, // Anycast // ScopeID new object[] { "Fe08::1%13542", "fe08::1%13542" }, new object[] { "1::%1", "1::%1" }, new object[] { "::1%12", "::1%12" }, new object[] { "::%123", "::%123" }, // v4 as v6 new object[] { "FE08::192.168.0.1", "fe08::c0a8:1" }, // Output is not IPv4 mapped new object[] { "::192.168.0.1", "::192.168.0.1" }, new object[] { "::FFFF:192.168.0.1", "::ffff:192.168.0.1" }, // SIIT new object[] { "::FFFF:0:192.168.0.1", "::ffff:0:192.168.0.1" }, // SIIT new object[] { "::5EFE:192.168.0.1", "::5efe:192.168.0.1" }, // ISATAP new object[] { "1::5EFE:192.168.0.1", "1::5efe:192.168.0.1" }, // ISATAP new object[] { "::192.168.0.010", "::192.168.0.10" }, // Embedded IPv4 octal, read as decimal }; } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/libraries/System.Numerics.Vectors/tests/PlaneTests.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.Globalization; using System.Runtime.InteropServices; using Xunit; namespace System.Numerics.Tests { public class PlaneTests { // A test for Equals (Plane) [Fact] public void PlaneEqualsTest1() { Plane a = new Plane(1.0f, 2.0f, 3.0f, 4.0f); Plane b = new Plane(1.0f, 2.0f, 3.0f, 4.0f); // case 1: compare between same values bool expected = true; bool actual = a.Equals(b); Assert.Equal(expected, actual); // case 2: compare between different values b.Normal = new Vector3(10.0f, b.Normal.Y, b.Normal.Z); expected = false; actual = a.Equals(b); Assert.Equal(expected, actual); } // A test for Equals (object) [Fact] public void PlaneEqualsTest() { Plane a = new Plane(1.0f, 2.0f, 3.0f, 4.0f); Plane b = new Plane(1.0f, 2.0f, 3.0f, 4.0f); // case 1: compare between same values object obj = b; bool expected = true; bool actual = a.Equals(obj); Assert.Equal(expected, actual); // case 2: compare between different values b.Normal = new Vector3(10.0f, b.Normal.Y, b.Normal.Z); obj = b; expected = false; actual = a.Equals(obj); Assert.Equal(expected, actual); // case 3: compare between different types. obj = new Quaternion(); expected = false; actual = a.Equals(obj); Assert.Equal(expected, actual); // case 3: compare against null. obj = null; expected = false; actual = a.Equals(obj); Assert.Equal(expected, actual); } // A test for operator != (Plane, Plane) [Fact] public void PlaneInequalityTest() { Plane a = new Plane(1.0f, 2.0f, 3.0f, 4.0f); Plane b = new Plane(1.0f, 2.0f, 3.0f, 4.0f); // case 1: compare between same values bool expected = false; bool actual = a != b; Assert.Equal(expected, actual); // case 2: compare between different values b.Normal = new Vector3(10.0f, b.Normal.Y, b.Normal.Z); expected = true; actual = a != b; Assert.Equal(expected, actual); } // A test for operator == (Plane, Plane) [Fact] public void PlaneEqualityTest() { Plane a = new Plane(1.0f, 2.0f, 3.0f, 4.0f); Plane b = new Plane(1.0f, 2.0f, 3.0f, 4.0f); // case 1: compare between same values bool expected = true; bool actual = a == b; Assert.Equal(expected, actual); // case 2: compare between different values b.Normal = new Vector3(10.0f, b.Normal.Y, b.Normal.Z); expected = false; actual = a == b; Assert.Equal(expected, actual); } // A test for GetHashCode () [Fact] public void PlaneGetHashCodeTest() { Plane target = new Plane(1.0f, 2.0f, 3.0f, 4.0f); int expected = target.Normal.GetHashCode() + target.D.GetHashCode(); int actual = target.GetHashCode(); Assert.Equal(expected, actual); } // A test for Plane (float, float, float, float) [Fact] public void PlaneConstructorTest1() { float a = 1.0f, b = 2.0f, c = 3.0f, d = 4.0f; Plane target = new Plane(a, b, c, d); Assert.True( target.Normal.X == a && target.Normal.Y == b && target.Normal.Z == c && target.D == d, "Plane.cstor did not return the expected value."); } // A test for Plane.CreateFromVertices [Fact] public void PlaneCreateFromVerticesTest() { Vector3 point1 = new Vector3(0.0f, 1.0f, 1.0f); Vector3 point2 = new Vector3(0.0f, 0.0f, 1.0f); Vector3 point3 = new Vector3(1.0f, 0.0f, 1.0f); Plane target = Plane.CreateFromVertices(point1, point2, point3); Plane expected = new Plane(new Vector3(0, 0, 1), -1.0f); Assert.Equal(target, expected); } // A test for Plane.CreateFromVertices [Fact] public void PlaneCreateFromVerticesTest2() { Vector3 point1 = new Vector3(0.0f, 0.0f, 1.0f); Vector3 point2 = new Vector3(1.0f, 0.0f, 0.0f); Vector3 point3 = new Vector3(1.0f, 1.0f, 0.0f); Plane target = Plane.CreateFromVertices(point1, point2, point3); float invRoot2 = (float)(1 / Math.Sqrt(2)); Plane expected = new Plane(new Vector3(invRoot2, 0, invRoot2), -invRoot2); Assert.True(MathHelper.Equal(target, expected), "Plane.cstor did not return the expected value."); } // A test for Plane (Vector3f, float) [Fact] public void PlaneConstructorTest3() { Vector3 normal = new Vector3(1, 2, 3); float d = 4; Plane target = new Plane(normal, d); Assert.True( target.Normal == normal && target.D == d, "Plane.cstor did not return the expected value."); } // A test for Plane (Vector4f) [Fact] public void PlaneConstructorTest() { Vector4 value = new Vector4(1.0f, 2.0f, 3.0f, 4.0f); Plane target = new Plane(value); Assert.True( target.Normal.X == value.X && target.Normal.Y == value.Y && target.Normal.Z == value.Z && target.D == value.W, "Plane.cstor did not return the expected value."); } [Fact] public void PlaneDotTest() { Plane target = new Plane(2, 3, 4, 5); Vector4 value = new Vector4(5, 4, 3, 2); float expected = 10 + 12 + 12 + 10; float actual = Plane.Dot(target, value); Assert.True(MathHelper.Equal(expected, actual), "Plane.Dot returns unexpected value."); } [Fact] public void PlaneDotCoordinateTest() { Plane target = new Plane(2, 3, 4, 5); Vector3 value = new Vector3(5, 4, 3); float expected = 10 + 12 + 12 + 5; float actual = Plane.DotCoordinate(target, value); Assert.True(MathHelper.Equal(expected, actual), "Plane.DotCoordinate returns unexpected value."); } [Fact] public void PlaneDotNormalTest() { Plane target = new Plane(2, 3, 4, 5); Vector3 value = new Vector3(5, 4, 3); float expected = 10 + 12 + 12; float actual = Plane.DotNormal(target, value); Assert.True(MathHelper.Equal(expected, actual), "Plane.DotCoordinate returns unexpected value."); } [Fact] public void PlaneNormalizeTest() { Plane target = new Plane(1, 2, 3, 4); float f = target.Normal.LengthSquared(); float invF = 1.0f / (float)Math.Sqrt(f); Plane expected = new Plane(target.Normal * invF, target.D * invF); Plane actual = Plane.Normalize(target); Assert.True(MathHelper.Equal(expected, actual), "Plane.Normalize returns unexpected value."); // normalize, normalized normal. actual = Plane.Normalize(actual); Assert.True(MathHelper.Equal(expected, actual), "Plane.Normalize returns unexpected value."); } [Fact] // Transform by matrix public void PlaneTransformTest1() { Plane target = new Plane(1, 2, 3, 4); target = Plane.Normalize(target); Matrix4x4 m = Matrix4x4.CreateRotationX(MathHelper.ToRadians(30.0f)) * Matrix4x4.CreateRotationY(MathHelper.ToRadians(30.0f)) * Matrix4x4.CreateRotationZ(MathHelper.ToRadians(30.0f)); m.M41 = 10.0f; m.M42 = 20.0f; m.M43 = 30.0f; Plane expected = new Plane(); Matrix4x4 inv; Matrix4x4.Invert(m, out inv); Matrix4x4 itm = Matrix4x4.Transpose(inv); float x = target.Normal.X, y = target.Normal.Y, z = target.Normal.Z, w = target.D; expected.Normal = new Vector3( x * itm.M11 + y * itm.M21 + z * itm.M31 + w * itm.M41, x * itm.M12 + y * itm.M22 + z * itm.M32 + w * itm.M42, x * itm.M13 + y * itm.M23 + z * itm.M33 + w * itm.M43); expected.D = x * itm.M14 + y * itm.M24 + z * itm.M34 + w * itm.M44; Plane actual; actual = Plane.Transform(target, m); Assert.True(MathHelper.Equal(expected, actual), "Plane.Transform did not return the expected value."); } [Fact] // Transform by quaternion public void PlaneTransformTest2() { Plane target = new Plane(1, 2, 3, 4); target = Plane.Normalize(target); Matrix4x4 m = Matrix4x4.CreateRotationX(MathHelper.ToRadians(30.0f)) * Matrix4x4.CreateRotationY(MathHelper.ToRadians(30.0f)) * Matrix4x4.CreateRotationZ(MathHelper.ToRadians(30.0f)); Quaternion q = Quaternion.CreateFromRotationMatrix(m); Plane expected = new Plane(); float x = target.Normal.X, y = target.Normal.Y, z = target.Normal.Z, w = target.D; expected.Normal = new Vector3( x * m.M11 + y * m.M21 + z * m.M31 + w * m.M41, x * m.M12 + y * m.M22 + z * m.M32 + w * m.M42, x * m.M13 + y * m.M23 + z * m.M33 + w * m.M43); expected.D = x * m.M14 + y * m.M24 + z * m.M34 + w * m.M44; Plane actual; actual = Plane.Transform(target, q); Assert.True(MathHelper.Equal(expected, actual), "Plane.Transform did not return the expected value."); } // A test for Plane comparison involving NaN values [Fact] public void PlaneEqualsNanTest() { Plane a = new Plane(float.NaN, 0, 0, 0); Plane b = new Plane(0, float.NaN, 0, 0); Plane c = new Plane(0, 0, float.NaN, 0); Plane d = new Plane(0, 0, 0, float.NaN); Assert.False(a == new Plane(0, 0, 0, 0)); Assert.False(b == new Plane(0, 0, 0, 0)); Assert.False(c == new Plane(0, 0, 0, 0)); Assert.False(d == new Plane(0, 0, 0, 0)); Assert.True(a != new Plane(0, 0, 0, 0)); Assert.True(b != new Plane(0, 0, 0, 0)); Assert.True(c != new Plane(0, 0, 0, 0)); Assert.True(d != new Plane(0, 0, 0, 0)); Assert.False(a.Equals(new Plane(0, 0, 0, 0))); Assert.False(b.Equals(new Plane(0, 0, 0, 0))); Assert.False(c.Equals(new Plane(0, 0, 0, 0))); Assert.False(d.Equals(new Plane(0, 0, 0, 0))); // Counterintuitive result - IEEE rules for NaN comparison are weird! Assert.False(a.Equals(a)); Assert.False(b.Equals(b)); Assert.False(c.Equals(c)); Assert.False(d.Equals(d)); } /* Enable when size of Vector3 is correct // A test to make sure these types are blittable directly into GPU buffer memory layouts [Fact] public unsafe void PlaneSizeofTest() { Assert.Equal(16, sizeof(Plane)); Assert.Equal(32, sizeof(Plane_2x)); Assert.Equal(20, sizeof(PlanePlusFloat)); Assert.Equal(40, sizeof(PlanePlusFloat_2x)); } */ [Fact] public void PlaneToStringTest() { Plane target = new Plane(1, 2, 3, 4); string expected = string.Format( CultureInfo.CurrentCulture, "{{Normal:{0:G} D:{1}}}", target.Normal, target.D); Assert.Equal(expected, target.ToString()); } [StructLayout(LayoutKind.Sequential)] struct Plane_2x { private Plane _a; private Plane _b; } [StructLayout(LayoutKind.Sequential)] struct PlanePlusFloat { private Plane _v; private float _f; } [StructLayout(LayoutKind.Sequential)] struct PlanePlusFloat_2x { private PlanePlusFloat _a; private PlanePlusFloat _b; } // A test to make sure the fields are laid out how we expect [Fact] public unsafe void PlaneFieldOffsetTest() { Plane plane = new Plane(); float* basePtr = &plane.Normal.X; // Take address of first element Plane* planePtr = &plane; // Take address of whole Plane Assert.Equal(new IntPtr(basePtr), new IntPtr(planePtr)); Assert.Equal(new IntPtr(basePtr + 0), new IntPtr(&plane.Normal)); Assert.Equal(new IntPtr(basePtr + 3), new IntPtr(&plane.D)); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Globalization; using System.Runtime.InteropServices; using Xunit; namespace System.Numerics.Tests { public class PlaneTests { // A test for Equals (Plane) [Fact] public void PlaneEqualsTest1() { Plane a = new Plane(1.0f, 2.0f, 3.0f, 4.0f); Plane b = new Plane(1.0f, 2.0f, 3.0f, 4.0f); // case 1: compare between same values bool expected = true; bool actual = a.Equals(b); Assert.Equal(expected, actual); // case 2: compare between different values b.Normal = new Vector3(10.0f, b.Normal.Y, b.Normal.Z); expected = false; actual = a.Equals(b); Assert.Equal(expected, actual); } // A test for Equals (object) [Fact] public void PlaneEqualsTest() { Plane a = new Plane(1.0f, 2.0f, 3.0f, 4.0f); Plane b = new Plane(1.0f, 2.0f, 3.0f, 4.0f); // case 1: compare between same values object obj = b; bool expected = true; bool actual = a.Equals(obj); Assert.Equal(expected, actual); // case 2: compare between different values b.Normal = new Vector3(10.0f, b.Normal.Y, b.Normal.Z); obj = b; expected = false; actual = a.Equals(obj); Assert.Equal(expected, actual); // case 3: compare between different types. obj = new Quaternion(); expected = false; actual = a.Equals(obj); Assert.Equal(expected, actual); // case 3: compare against null. obj = null; expected = false; actual = a.Equals(obj); Assert.Equal(expected, actual); } // A test for operator != (Plane, Plane) [Fact] public void PlaneInequalityTest() { Plane a = new Plane(1.0f, 2.0f, 3.0f, 4.0f); Plane b = new Plane(1.0f, 2.0f, 3.0f, 4.0f); // case 1: compare between same values bool expected = false; bool actual = a != b; Assert.Equal(expected, actual); // case 2: compare between different values b.Normal = new Vector3(10.0f, b.Normal.Y, b.Normal.Z); expected = true; actual = a != b; Assert.Equal(expected, actual); } // A test for operator == (Plane, Plane) [Fact] public void PlaneEqualityTest() { Plane a = new Plane(1.0f, 2.0f, 3.0f, 4.0f); Plane b = new Plane(1.0f, 2.0f, 3.0f, 4.0f); // case 1: compare between same values bool expected = true; bool actual = a == b; Assert.Equal(expected, actual); // case 2: compare between different values b.Normal = new Vector3(10.0f, b.Normal.Y, b.Normal.Z); expected = false; actual = a == b; Assert.Equal(expected, actual); } // A test for GetHashCode () [Fact] public void PlaneGetHashCodeTest() { Plane target = new Plane(1.0f, 2.0f, 3.0f, 4.0f); int expected = target.Normal.GetHashCode() + target.D.GetHashCode(); int actual = target.GetHashCode(); Assert.Equal(expected, actual); } // A test for Plane (float, float, float, float) [Fact] public void PlaneConstructorTest1() { float a = 1.0f, b = 2.0f, c = 3.0f, d = 4.0f; Plane target = new Plane(a, b, c, d); Assert.True( target.Normal.X == a && target.Normal.Y == b && target.Normal.Z == c && target.D == d, "Plane.cstor did not return the expected value."); } // A test for Plane.CreateFromVertices [Fact] public void PlaneCreateFromVerticesTest() { Vector3 point1 = new Vector3(0.0f, 1.0f, 1.0f); Vector3 point2 = new Vector3(0.0f, 0.0f, 1.0f); Vector3 point3 = new Vector3(1.0f, 0.0f, 1.0f); Plane target = Plane.CreateFromVertices(point1, point2, point3); Plane expected = new Plane(new Vector3(0, 0, 1), -1.0f); Assert.Equal(target, expected); } // A test for Plane.CreateFromVertices [Fact] public void PlaneCreateFromVerticesTest2() { Vector3 point1 = new Vector3(0.0f, 0.0f, 1.0f); Vector3 point2 = new Vector3(1.0f, 0.0f, 0.0f); Vector3 point3 = new Vector3(1.0f, 1.0f, 0.0f); Plane target = Plane.CreateFromVertices(point1, point2, point3); float invRoot2 = (float)(1 / Math.Sqrt(2)); Plane expected = new Plane(new Vector3(invRoot2, 0, invRoot2), -invRoot2); Assert.True(MathHelper.Equal(target, expected), "Plane.cstor did not return the expected value."); } // A test for Plane (Vector3f, float) [Fact] public void PlaneConstructorTest3() { Vector3 normal = new Vector3(1, 2, 3); float d = 4; Plane target = new Plane(normal, d); Assert.True( target.Normal == normal && target.D == d, "Plane.cstor did not return the expected value."); } // A test for Plane (Vector4f) [Fact] public void PlaneConstructorTest() { Vector4 value = new Vector4(1.0f, 2.0f, 3.0f, 4.0f); Plane target = new Plane(value); Assert.True( target.Normal.X == value.X && target.Normal.Y == value.Y && target.Normal.Z == value.Z && target.D == value.W, "Plane.cstor did not return the expected value."); } [Fact] public void PlaneDotTest() { Plane target = new Plane(2, 3, 4, 5); Vector4 value = new Vector4(5, 4, 3, 2); float expected = 10 + 12 + 12 + 10; float actual = Plane.Dot(target, value); Assert.True(MathHelper.Equal(expected, actual), "Plane.Dot returns unexpected value."); } [Fact] public void PlaneDotCoordinateTest() { Plane target = new Plane(2, 3, 4, 5); Vector3 value = new Vector3(5, 4, 3); float expected = 10 + 12 + 12 + 5; float actual = Plane.DotCoordinate(target, value); Assert.True(MathHelper.Equal(expected, actual), "Plane.DotCoordinate returns unexpected value."); } [Fact] public void PlaneDotNormalTest() { Plane target = new Plane(2, 3, 4, 5); Vector3 value = new Vector3(5, 4, 3); float expected = 10 + 12 + 12; float actual = Plane.DotNormal(target, value); Assert.True(MathHelper.Equal(expected, actual), "Plane.DotCoordinate returns unexpected value."); } [Fact] public void PlaneNormalizeTest() { Plane target = new Plane(1, 2, 3, 4); float f = target.Normal.LengthSquared(); float invF = 1.0f / (float)Math.Sqrt(f); Plane expected = new Plane(target.Normal * invF, target.D * invF); Plane actual = Plane.Normalize(target); Assert.True(MathHelper.Equal(expected, actual), "Plane.Normalize returns unexpected value."); // normalize, normalized normal. actual = Plane.Normalize(actual); Assert.True(MathHelper.Equal(expected, actual), "Plane.Normalize returns unexpected value."); } [Fact] // Transform by matrix public void PlaneTransformTest1() { Plane target = new Plane(1, 2, 3, 4); target = Plane.Normalize(target); Matrix4x4 m = Matrix4x4.CreateRotationX(MathHelper.ToRadians(30.0f)) * Matrix4x4.CreateRotationY(MathHelper.ToRadians(30.0f)) * Matrix4x4.CreateRotationZ(MathHelper.ToRadians(30.0f)); m.M41 = 10.0f; m.M42 = 20.0f; m.M43 = 30.0f; Plane expected = new Plane(); Matrix4x4 inv; Matrix4x4.Invert(m, out inv); Matrix4x4 itm = Matrix4x4.Transpose(inv); float x = target.Normal.X, y = target.Normal.Y, z = target.Normal.Z, w = target.D; expected.Normal = new Vector3( x * itm.M11 + y * itm.M21 + z * itm.M31 + w * itm.M41, x * itm.M12 + y * itm.M22 + z * itm.M32 + w * itm.M42, x * itm.M13 + y * itm.M23 + z * itm.M33 + w * itm.M43); expected.D = x * itm.M14 + y * itm.M24 + z * itm.M34 + w * itm.M44; Plane actual; actual = Plane.Transform(target, m); Assert.True(MathHelper.Equal(expected, actual), "Plane.Transform did not return the expected value."); } [Fact] // Transform by quaternion public void PlaneTransformTest2() { Plane target = new Plane(1, 2, 3, 4); target = Plane.Normalize(target); Matrix4x4 m = Matrix4x4.CreateRotationX(MathHelper.ToRadians(30.0f)) * Matrix4x4.CreateRotationY(MathHelper.ToRadians(30.0f)) * Matrix4x4.CreateRotationZ(MathHelper.ToRadians(30.0f)); Quaternion q = Quaternion.CreateFromRotationMatrix(m); Plane expected = new Plane(); float x = target.Normal.X, y = target.Normal.Y, z = target.Normal.Z, w = target.D; expected.Normal = new Vector3( x * m.M11 + y * m.M21 + z * m.M31 + w * m.M41, x * m.M12 + y * m.M22 + z * m.M32 + w * m.M42, x * m.M13 + y * m.M23 + z * m.M33 + w * m.M43); expected.D = x * m.M14 + y * m.M24 + z * m.M34 + w * m.M44; Plane actual; actual = Plane.Transform(target, q); Assert.True(MathHelper.Equal(expected, actual), "Plane.Transform did not return the expected value."); } // A test for Plane comparison involving NaN values [Fact] public void PlaneEqualsNanTest() { Plane a = new Plane(float.NaN, 0, 0, 0); Plane b = new Plane(0, float.NaN, 0, 0); Plane c = new Plane(0, 0, float.NaN, 0); Plane d = new Plane(0, 0, 0, float.NaN); Assert.False(a == new Plane(0, 0, 0, 0)); Assert.False(b == new Plane(0, 0, 0, 0)); Assert.False(c == new Plane(0, 0, 0, 0)); Assert.False(d == new Plane(0, 0, 0, 0)); Assert.True(a != new Plane(0, 0, 0, 0)); Assert.True(b != new Plane(0, 0, 0, 0)); Assert.True(c != new Plane(0, 0, 0, 0)); Assert.True(d != new Plane(0, 0, 0, 0)); Assert.False(a.Equals(new Plane(0, 0, 0, 0))); Assert.False(b.Equals(new Plane(0, 0, 0, 0))); Assert.False(c.Equals(new Plane(0, 0, 0, 0))); Assert.False(d.Equals(new Plane(0, 0, 0, 0))); // Counterintuitive result - IEEE rules for NaN comparison are weird! Assert.False(a.Equals(a)); Assert.False(b.Equals(b)); Assert.False(c.Equals(c)); Assert.False(d.Equals(d)); } /* Enable when size of Vector3 is correct // A test to make sure these types are blittable directly into GPU buffer memory layouts [Fact] public unsafe void PlaneSizeofTest() { Assert.Equal(16, sizeof(Plane)); Assert.Equal(32, sizeof(Plane_2x)); Assert.Equal(20, sizeof(PlanePlusFloat)); Assert.Equal(40, sizeof(PlanePlusFloat_2x)); } */ [Fact] public void PlaneToStringTest() { Plane target = new Plane(1, 2, 3, 4); string expected = string.Format( CultureInfo.CurrentCulture, "{{Normal:{0:G} D:{1}}}", target.Normal, target.D); Assert.Equal(expected, target.ToString()); } [StructLayout(LayoutKind.Sequential)] struct Plane_2x { private Plane _a; private Plane _b; } [StructLayout(LayoutKind.Sequential)] struct PlanePlusFloat { private Plane _v; private float _f; } [StructLayout(LayoutKind.Sequential)] struct PlanePlusFloat_2x { private PlanePlusFloat _a; private PlanePlusFloat _b; } // A test to make sure the fields are laid out how we expect [Fact] public unsafe void PlaneFieldOffsetTest() { Plane plane = new Plane(); float* basePtr = &plane.Normal.X; // Take address of first element Plane* planePtr = &plane; // Take address of whole Plane Assert.Equal(new IntPtr(basePtr), new IntPtr(planePtr)); Assert.Equal(new IntPtr(basePtr + 0), new IntPtr(&plane.Normal)); Assert.Equal(new IntPtr(basePtr + 3), new IntPtr(&plane.D)); } } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/EnumConverterTests.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.Threading.Tasks; using Xunit; namespace System.Text.Json.Serialization.Tests { public class EnumConverterTests { [Fact] public void ConvertDayOfWeek() { JsonSerializerOptions options = new JsonSerializerOptions(); options.Converters.Add(new JsonStringEnumConverter()); WhenClass when = JsonSerializer.Deserialize<WhenClass>(@"{""Day"":""Monday""}", options); Assert.Equal(DayOfWeek.Monday, when.Day); DayOfWeek day = JsonSerializer.Deserialize<DayOfWeek>(@"""Tuesday""", options); Assert.Equal(DayOfWeek.Tuesday, day); // We are case insensitive on read day = JsonSerializer.Deserialize<DayOfWeek>(@"""wednesday""", options); Assert.Equal(DayOfWeek.Wednesday, day); // Numbers work by default day = JsonSerializer.Deserialize<DayOfWeek>(@"4", options); Assert.Equal(DayOfWeek.Thursday, day); string json = JsonSerializer.Serialize(DayOfWeek.Friday, options); Assert.Equal(@"""Friday""", json); // Try a unique naming policy options = new JsonSerializerOptions(); options.Converters.Add(new JsonStringEnumConverter(new ToLowerNamingPolicy())); json = JsonSerializer.Serialize(DayOfWeek.Friday, options); Assert.Equal(@"""friday""", json); // Undefined values should come out as a number (not a string) json = JsonSerializer.Serialize((DayOfWeek)(-1), options); Assert.Equal(@"-1", json); // Not permitting integers should throw options = new JsonSerializerOptions(); options.Converters.Add(new JsonStringEnumConverter(allowIntegerValues: false)); Assert.Throws<JsonException>(() => JsonSerializer.Serialize((DayOfWeek)(-1), options)); } public class ToLowerNamingPolicy : JsonNamingPolicy { public override string ConvertName(string name) => name.ToLowerInvariant(); } public class WhenClass { public DayOfWeek Day { get; set; } } [Fact] public void ConvertFileAttributes() { JsonSerializerOptions options = new JsonSerializerOptions(); options.Converters.Add(new JsonStringEnumConverter()); FileState state = JsonSerializer.Deserialize<FileState>(@"{""Attributes"":""ReadOnly""}", options); Assert.Equal(FileAttributes.ReadOnly, state.Attributes); state = JsonSerializer.Deserialize<FileState>(@"{""Attributes"":""Directory, ReparsePoint""}", options); Assert.Equal(FileAttributes.Directory | FileAttributes.ReparsePoint, state.Attributes); FileAttributes attributes = JsonSerializer.Deserialize<FileAttributes>(@"""Normal""", options); Assert.Equal(FileAttributes.Normal, attributes); attributes = JsonSerializer.Deserialize<FileAttributes>(@"""System, SparseFile""", options); Assert.Equal(FileAttributes.System | FileAttributes.SparseFile, attributes); // We are case insensitive on read attributes = JsonSerializer.Deserialize<FileAttributes>(@"""OFFLINE""", options); Assert.Equal(FileAttributes.Offline, attributes); attributes = JsonSerializer.Deserialize<FileAttributes>(@"""compressed, notcontentindexed""", options); Assert.Equal(FileAttributes.Compressed | FileAttributes.NotContentIndexed, attributes); // Numbers are cool by default attributes = JsonSerializer.Deserialize<FileAttributes>(@"131072", options); Assert.Equal(FileAttributes.NoScrubData, attributes); attributes = JsonSerializer.Deserialize<FileAttributes>(@"3", options); Assert.Equal(FileAttributes.Hidden | FileAttributes.ReadOnly, attributes); string json = JsonSerializer.Serialize(FileAttributes.Hidden, options); Assert.Equal(@"""Hidden""", json); json = JsonSerializer.Serialize(FileAttributes.Temporary | FileAttributes.Offline, options); Assert.Equal(@"""Temporary, Offline""", json); // Try a unique casing options = new JsonSerializerOptions(); options.Converters.Add(new JsonStringEnumConverter(new ToLowerNamingPolicy())); json = JsonSerializer.Serialize(FileAttributes.NoScrubData, options); Assert.Equal(@"""noscrubdata""", json); json = JsonSerializer.Serialize(FileAttributes.System | FileAttributes.Offline, options); Assert.Equal(@"""system, offline""", json); // Undefined values should come out as a number (not a string) json = JsonSerializer.Serialize((FileAttributes)(-1), options); Assert.Equal(@"-1", json); // Not permitting integers should throw options = new JsonSerializerOptions(); options.Converters.Add(new JsonStringEnumConverter(allowIntegerValues: false)); Assert.Throws<JsonException>(() => JsonSerializer.Serialize((FileAttributes)(-1), options)); // Flag values honor naming policy correctly options = new JsonSerializerOptions(); options.Converters.Add(new JsonStringEnumConverter(new SimpleSnakeCasePolicy())); json = JsonSerializer.Serialize( FileAttributes.Directory | FileAttributes.Compressed | FileAttributes.IntegrityStream, options); Assert.Equal(@"""directory, compressed, integrity_stream""", json); json = JsonSerializer.Serialize(FileAttributes.Compressed & FileAttributes.Device, options); Assert.Equal(@"0", json); json = JsonSerializer.Serialize(FileAttributes.Directory & FileAttributes.Compressed | FileAttributes.IntegrityStream, options); Assert.Equal(@"""integrity_stream""", json); } public class FileState { public FileAttributes Attributes { get; set; } } public class Week { [JsonConverter(typeof(JsonStringEnumConverter))] public DayOfWeek WorkStart { get; set; } public DayOfWeek WorkEnd { get; set; } [JsonConverter(typeof(LowerCaseEnumConverter))] public DayOfWeek WeekEnd { get; set; } } private class LowerCaseEnumConverter : JsonStringEnumConverter { public LowerCaseEnumConverter() : base(new ToLowerNamingPolicy()) { } } [Fact] public void ConvertEnumUsingAttributes() { Week week = new Week { WorkStart = DayOfWeek.Monday, WorkEnd = DayOfWeek.Friday, WeekEnd = DayOfWeek.Saturday }; string json = JsonSerializer.Serialize(week); Assert.Equal(@"{""WorkStart"":""Monday"",""WorkEnd"":5,""WeekEnd"":""saturday""}", json); week = JsonSerializer.Deserialize<Week>(json); Assert.Equal(DayOfWeek.Monday, week.WorkStart); Assert.Equal(DayOfWeek.Friday, week.WorkEnd); Assert.Equal(DayOfWeek.Saturday, week.WeekEnd); } [Fact] public void EnumConverterComposition() { JsonSerializerOptions options = new JsonSerializerOptions { Converters = { new NoFlagsStringEnumConverter() } }; string json = JsonSerializer.Serialize(DayOfWeek.Monday, options); Assert.Equal(@"""Monday""", json); json = JsonSerializer.Serialize(FileAccess.Read); Assert.Equal(@"1", json); } public class NoFlagsStringEnumConverter : JsonConverterFactory { private static JsonStringEnumConverter s_stringEnumConverter = new JsonStringEnumConverter(); public override bool CanConvert(Type typeToConvert) => typeToConvert.IsEnum && !typeToConvert.IsDefined(typeof(FlagsAttribute), inherit: false); public override JsonConverter CreateConverter(Type typeToConvert, JsonSerializerOptions options) => s_stringEnumConverter.CreateConverter(typeToConvert, options); } [JsonConverter(typeof(JsonStringEnumConverter))] private enum MyCustomEnum { First = 1, Second = 2 } [Fact] public void EnumWithConverterAttribute() { string json = JsonSerializer.Serialize(MyCustomEnum.Second); Assert.Equal(@"""Second""", json); MyCustomEnum obj = JsonSerializer.Deserialize<MyCustomEnum>("\"Second\""); Assert.Equal(MyCustomEnum.Second, obj); obj = JsonSerializer.Deserialize<MyCustomEnum>("2"); Assert.Equal(MyCustomEnum.Second, obj); } [Fact] public static void EnumWithNoValues() { var options = new JsonSerializerOptions { Converters = { new JsonStringEnumConverter() } }; Assert.Equal("-1", JsonSerializer.Serialize((EmptyEnum)(-1), options)); Assert.Equal("1", JsonSerializer.Serialize((EmptyEnum)(1), options)); } public enum EmptyEnum { }; [Fact] public static void MoreThan64EnumValuesToSerialize() { var options = new JsonSerializerOptions { Converters = { new JsonStringEnumConverter() } }; for (int i = 0; i < 128; i++) { MyEnum value = (MyEnum)i; string asStr = value.ToString(); string expected = char.IsLetter(asStr[0]) ? $@"""{asStr}""" : asStr; Assert.Equal(expected, JsonSerializer.Serialize(value, options)); } } [Fact] public static void MoreThan64EnumValuesToSerializeWithNamingPolicy() { var options = new JsonSerializerOptions { Converters = { new JsonStringEnumConverter(new ToLowerNamingPolicy()) } }; for (int i = 0; i < 128; i++) { MyEnum value = (MyEnum)i; string asStr = value.ToString().ToLowerInvariant(); string expected = char.IsLetter(asStr[0]) ? $@"""{asStr}""" : asStr; Assert.Equal(expected, JsonSerializer.Serialize(value, options)); } } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] [OuterLoop] public static void VeryLargeAmountOfEnumsToSerialize() { // Ensure we don't throw OutOfMemoryException. var options = new JsonSerializerOptions { Converters = { new JsonStringEnumConverter() } }; const int MaxValue = 2097152; // value for MyEnum.V // Every value between 0 and MaxValue maps to a valid enum // identifier, and is a candidate to go into the name cache. // Write the first 45 values. for (int i = 1; i < 46; i++) { JsonSerializer.Serialize((MyEnum)i, options); } // At this point, there are 60 values in the name cache; // 22 cached at warm-up, the rest in the above loop. // Ensure the approximate size limit for the name cache (a concurrent dictionary) is honored. // Use multiple threads to perhaps go over the soft limit of 64, but not by more than a couple. Parallel.For(0, 8, i => JsonSerializer.Serialize((MyEnum)(46 + i), options)); // Write the remaining enum values. The cache is capped to avoid // OutOfMemoryException due to having too many cached items. for (int i = 54; i <= MaxValue; i++) { JsonSerializer.Serialize((MyEnum)i, options); } } [Flags] public enum MyEnum { A = 1 << 0, B = 1 << 1, C = 1 << 2, D = 1 << 3, E = 1 << 4, F = 1 << 5, G = 1 << 6, H = 1 << 7, I = 1 << 8, J = 1 << 9, K = 1 << 10, L = 1 << 11, M = 1 << 12, N = 1 << 13, O = 1 << 14, P = 1 << 15, Q = 1 << 16, R = 1 << 17, S = 1 << 18, T = 1 << 19, U = 1 << 20, V = 1 << 21, } [Fact, OuterLoop] [ActiveIssue("https://github.com/dotnet/runtime/issues/42677", platforms: TestPlatforms.Windows, runtimes: TestRuntimes.Mono)] public static void VeryLargeAmountOfEnumDictionaryKeysToSerialize() { // Ensure we don't throw OutOfMemoryException. const int MaxValue = (int)MyEnum.V; // Every value between 0 and MaxValue maps to a valid enum // identifier, and is a candidate to go into the name cache. // Write the first 45 values. Dictionary<MyEnum, int> dictionary; for (int i = 1; i < 46; i++) { dictionary = new Dictionary<MyEnum, int> { { (MyEnum)i, i } }; JsonSerializer.Serialize(dictionary); } // At this point, there are 60 values in the name cache; // 22 cached at warm-up, the rest in the above loop. // Ensure the approximate size limit for the name cache (a concurrent dictionary) is honored. // Use multiple threads to perhaps go over the soft limit of 64, but not by more than a couple. Parallel.For( 0, 8, i => { dictionary = new Dictionary<MyEnum, int> { { (MyEnum)(46 + i), i } }; JsonSerializer.Serialize(dictionary); } ); // Write the remaining enum values. The cache is capped to avoid // OutOfMemoryException due to having too many cached items. for (int i = 54; i <= MaxValue; i++) { dictionary = new Dictionary<MyEnum, int> { { (MyEnum)i, i } }; JsonSerializer.Serialize(dictionary); } } public abstract class NumericEnumKeyDictionaryBase<T> { public abstract Dictionary<T, int> BuildDictionary(int i); [Fact] public void SerilizeDictionaryWhenCacheIsFull() { Dictionary<T, int> dictionary; for (int i = 1; i <= 64; i++) { dictionary = BuildDictionary(i); JsonSerializer.Serialize(dictionary); } dictionary = BuildDictionary(0); string json = JsonSerializer.Serialize(dictionary); Assert.Equal($"{{\"0\":0}}", json); } } public class Int32EnumDictionary : NumericEnumKeyDictionaryBase<SampleEnumInt32> { public override Dictionary<SampleEnumInt32, int> BuildDictionary(int i) => new Dictionary<SampleEnumInt32, int> { { (SampleEnumInt32)i, i } }; } public class UInt32EnumDictionary : NumericEnumKeyDictionaryBase<SampleEnumUInt32> { public override Dictionary<SampleEnumUInt32, int> BuildDictionary(int i) => new Dictionary<SampleEnumUInt32, int> { { (SampleEnumUInt32)i, i } }; } public class UInt64EnumDictionary : NumericEnumKeyDictionaryBase<SampleEnumUInt64> { public override Dictionary<SampleEnumUInt64, int> BuildDictionary(int i) => new Dictionary<SampleEnumUInt64, int> { { (SampleEnumUInt64)i, i } }; } public class Int64EnumDictionary : NumericEnumKeyDictionaryBase<SampleEnumInt64> { public override Dictionary<SampleEnumInt64, int> BuildDictionary(int i) => new Dictionary<SampleEnumInt64, int> { { (SampleEnumInt64)i, i } }; } public class Int16EnumDictionary : NumericEnumKeyDictionaryBase<SampleEnumInt16> { public override Dictionary<SampleEnumInt16, int> BuildDictionary(int i) => new Dictionary<SampleEnumInt16, int> { { (SampleEnumInt16)i, i } }; } public class UInt16EnumDictionary : NumericEnumKeyDictionaryBase<SampleEnumUInt16> { public override Dictionary<SampleEnumUInt16, int> BuildDictionary(int i) => new Dictionary<SampleEnumUInt16, int> { { (SampleEnumUInt16)i, i } }; } public class ByteEnumDictionary : NumericEnumKeyDictionaryBase<SampleEnumByte> { public override Dictionary<SampleEnumByte, int> BuildDictionary(int i) => new Dictionary<SampleEnumByte, int> { { (SampleEnumByte)i, i } }; } public class SByteEnumDictionary : NumericEnumKeyDictionaryBase<SampleEnumSByte> { public override Dictionary<SampleEnumSByte, int> BuildDictionary(int i) => new Dictionary<SampleEnumSByte, int> { { (SampleEnumSByte)i, i } }; } [Flags] public enum SampleEnumInt32 { A = 1 << 0, B = 1 << 1, C = 1 << 2, D = 1 << 3, E = 1 << 4, F = 1 << 5, G = 1 << 6, } [Flags] public enum SampleEnumUInt32 : uint { A = 1 << 0, B = 1 << 1, C = 1 << 2, D = 1 << 3, E = 1 << 4, F = 1 << 5, G = 1 << 6, } [Flags] public enum SampleEnumUInt64 : ulong { A = 1 << 0, B = 1 << 1, C = 1 << 2, D = 1 << 3, E = 1 << 4, F = 1 << 5, G = 1 << 6, } [Flags] public enum SampleEnumInt64 : long { A = 1 << 0, B = 1 << 1, C = 1 << 2, D = 1 << 3, E = 1 << 4, F = 1 << 5, G = 1 << 6, } [Flags] public enum SampleEnumInt16 : short { A = 1 << 0, B = 1 << 1, C = 1 << 2, D = 1 << 3, E = 1 << 4, F = 1 << 5, G = 1 << 6, } [Flags] public enum SampleEnumUInt16 : ushort { A = 1 << 0, B = 1 << 1, C = 1 << 2, D = 1 << 3, E = 1 << 4, F = 1 << 5, G = 1 << 6, } [Flags] public enum SampleEnumByte : byte { A = 1 << 0, B = 1 << 1, C = 1 << 2, D = 1 << 3, E = 1 << 4, F = 1 << 5, G = 1 << 6, } [Flags] public enum SampleEnumSByte : sbyte { A = 1 << 0, B = 1 << 1, C = 1 << 2, D = 1 << 3, E = 1 << 4, F = 1 << 5, G = 1 << 6, } } }
// 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.Threading.Tasks; using Xunit; namespace System.Text.Json.Serialization.Tests { public class EnumConverterTests { [Fact] public void ConvertDayOfWeek() { JsonSerializerOptions options = new JsonSerializerOptions(); options.Converters.Add(new JsonStringEnumConverter()); WhenClass when = JsonSerializer.Deserialize<WhenClass>(@"{""Day"":""Monday""}", options); Assert.Equal(DayOfWeek.Monday, when.Day); DayOfWeek day = JsonSerializer.Deserialize<DayOfWeek>(@"""Tuesday""", options); Assert.Equal(DayOfWeek.Tuesday, day); // We are case insensitive on read day = JsonSerializer.Deserialize<DayOfWeek>(@"""wednesday""", options); Assert.Equal(DayOfWeek.Wednesday, day); // Numbers work by default day = JsonSerializer.Deserialize<DayOfWeek>(@"4", options); Assert.Equal(DayOfWeek.Thursday, day); string json = JsonSerializer.Serialize(DayOfWeek.Friday, options); Assert.Equal(@"""Friday""", json); // Try a unique naming policy options = new JsonSerializerOptions(); options.Converters.Add(new JsonStringEnumConverter(new ToLowerNamingPolicy())); json = JsonSerializer.Serialize(DayOfWeek.Friday, options); Assert.Equal(@"""friday""", json); // Undefined values should come out as a number (not a string) json = JsonSerializer.Serialize((DayOfWeek)(-1), options); Assert.Equal(@"-1", json); // Not permitting integers should throw options = new JsonSerializerOptions(); options.Converters.Add(new JsonStringEnumConverter(allowIntegerValues: false)); Assert.Throws<JsonException>(() => JsonSerializer.Serialize((DayOfWeek)(-1), options)); } public class ToLowerNamingPolicy : JsonNamingPolicy { public override string ConvertName(string name) => name.ToLowerInvariant(); } public class WhenClass { public DayOfWeek Day { get; set; } } [Fact] public void ConvertFileAttributes() { JsonSerializerOptions options = new JsonSerializerOptions(); options.Converters.Add(new JsonStringEnumConverter()); FileState state = JsonSerializer.Deserialize<FileState>(@"{""Attributes"":""ReadOnly""}", options); Assert.Equal(FileAttributes.ReadOnly, state.Attributes); state = JsonSerializer.Deserialize<FileState>(@"{""Attributes"":""Directory, ReparsePoint""}", options); Assert.Equal(FileAttributes.Directory | FileAttributes.ReparsePoint, state.Attributes); FileAttributes attributes = JsonSerializer.Deserialize<FileAttributes>(@"""Normal""", options); Assert.Equal(FileAttributes.Normal, attributes); attributes = JsonSerializer.Deserialize<FileAttributes>(@"""System, SparseFile""", options); Assert.Equal(FileAttributes.System | FileAttributes.SparseFile, attributes); // We are case insensitive on read attributes = JsonSerializer.Deserialize<FileAttributes>(@"""OFFLINE""", options); Assert.Equal(FileAttributes.Offline, attributes); attributes = JsonSerializer.Deserialize<FileAttributes>(@"""compressed, notcontentindexed""", options); Assert.Equal(FileAttributes.Compressed | FileAttributes.NotContentIndexed, attributes); // Numbers are cool by default attributes = JsonSerializer.Deserialize<FileAttributes>(@"131072", options); Assert.Equal(FileAttributes.NoScrubData, attributes); attributes = JsonSerializer.Deserialize<FileAttributes>(@"3", options); Assert.Equal(FileAttributes.Hidden | FileAttributes.ReadOnly, attributes); string json = JsonSerializer.Serialize(FileAttributes.Hidden, options); Assert.Equal(@"""Hidden""", json); json = JsonSerializer.Serialize(FileAttributes.Temporary | FileAttributes.Offline, options); Assert.Equal(@"""Temporary, Offline""", json); // Try a unique casing options = new JsonSerializerOptions(); options.Converters.Add(new JsonStringEnumConverter(new ToLowerNamingPolicy())); json = JsonSerializer.Serialize(FileAttributes.NoScrubData, options); Assert.Equal(@"""noscrubdata""", json); json = JsonSerializer.Serialize(FileAttributes.System | FileAttributes.Offline, options); Assert.Equal(@"""system, offline""", json); // Undefined values should come out as a number (not a string) json = JsonSerializer.Serialize((FileAttributes)(-1), options); Assert.Equal(@"-1", json); // Not permitting integers should throw options = new JsonSerializerOptions(); options.Converters.Add(new JsonStringEnumConverter(allowIntegerValues: false)); Assert.Throws<JsonException>(() => JsonSerializer.Serialize((FileAttributes)(-1), options)); // Flag values honor naming policy correctly options = new JsonSerializerOptions(); options.Converters.Add(new JsonStringEnumConverter(new SimpleSnakeCasePolicy())); json = JsonSerializer.Serialize( FileAttributes.Directory | FileAttributes.Compressed | FileAttributes.IntegrityStream, options); Assert.Equal(@"""directory, compressed, integrity_stream""", json); json = JsonSerializer.Serialize(FileAttributes.Compressed & FileAttributes.Device, options); Assert.Equal(@"0", json); json = JsonSerializer.Serialize(FileAttributes.Directory & FileAttributes.Compressed | FileAttributes.IntegrityStream, options); Assert.Equal(@"""integrity_stream""", json); } public class FileState { public FileAttributes Attributes { get; set; } } public class Week { [JsonConverter(typeof(JsonStringEnumConverter))] public DayOfWeek WorkStart { get; set; } public DayOfWeek WorkEnd { get; set; } [JsonConverter(typeof(LowerCaseEnumConverter))] public DayOfWeek WeekEnd { get; set; } } private class LowerCaseEnumConverter : JsonStringEnumConverter { public LowerCaseEnumConverter() : base(new ToLowerNamingPolicy()) { } } [Fact] public void ConvertEnumUsingAttributes() { Week week = new Week { WorkStart = DayOfWeek.Monday, WorkEnd = DayOfWeek.Friday, WeekEnd = DayOfWeek.Saturday }; string json = JsonSerializer.Serialize(week); Assert.Equal(@"{""WorkStart"":""Monday"",""WorkEnd"":5,""WeekEnd"":""saturday""}", json); week = JsonSerializer.Deserialize<Week>(json); Assert.Equal(DayOfWeek.Monday, week.WorkStart); Assert.Equal(DayOfWeek.Friday, week.WorkEnd); Assert.Equal(DayOfWeek.Saturday, week.WeekEnd); } [Fact] public void EnumConverterComposition() { JsonSerializerOptions options = new JsonSerializerOptions { Converters = { new NoFlagsStringEnumConverter() } }; string json = JsonSerializer.Serialize(DayOfWeek.Monday, options); Assert.Equal(@"""Monday""", json); json = JsonSerializer.Serialize(FileAccess.Read); Assert.Equal(@"1", json); } public class NoFlagsStringEnumConverter : JsonConverterFactory { private static JsonStringEnumConverter s_stringEnumConverter = new JsonStringEnumConverter(); public override bool CanConvert(Type typeToConvert) => typeToConvert.IsEnum && !typeToConvert.IsDefined(typeof(FlagsAttribute), inherit: false); public override JsonConverter CreateConverter(Type typeToConvert, JsonSerializerOptions options) => s_stringEnumConverter.CreateConverter(typeToConvert, options); } [JsonConverter(typeof(JsonStringEnumConverter))] private enum MyCustomEnum { First = 1, Second = 2 } [Fact] public void EnumWithConverterAttribute() { string json = JsonSerializer.Serialize(MyCustomEnum.Second); Assert.Equal(@"""Second""", json); MyCustomEnum obj = JsonSerializer.Deserialize<MyCustomEnum>("\"Second\""); Assert.Equal(MyCustomEnum.Second, obj); obj = JsonSerializer.Deserialize<MyCustomEnum>("2"); Assert.Equal(MyCustomEnum.Second, obj); } [Fact] public static void EnumWithNoValues() { var options = new JsonSerializerOptions { Converters = { new JsonStringEnumConverter() } }; Assert.Equal("-1", JsonSerializer.Serialize((EmptyEnum)(-1), options)); Assert.Equal("1", JsonSerializer.Serialize((EmptyEnum)(1), options)); } public enum EmptyEnum { }; [Fact] public static void MoreThan64EnumValuesToSerialize() { var options = new JsonSerializerOptions { Converters = { new JsonStringEnumConverter() } }; for (int i = 0; i < 128; i++) { MyEnum value = (MyEnum)i; string asStr = value.ToString(); string expected = char.IsLetter(asStr[0]) ? $@"""{asStr}""" : asStr; Assert.Equal(expected, JsonSerializer.Serialize(value, options)); } } [Fact] public static void MoreThan64EnumValuesToSerializeWithNamingPolicy() { var options = new JsonSerializerOptions { Converters = { new JsonStringEnumConverter(new ToLowerNamingPolicy()) } }; for (int i = 0; i < 128; i++) { MyEnum value = (MyEnum)i; string asStr = value.ToString().ToLowerInvariant(); string expected = char.IsLetter(asStr[0]) ? $@"""{asStr}""" : asStr; Assert.Equal(expected, JsonSerializer.Serialize(value, options)); } } [ConditionalFact(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] [OuterLoop] public static void VeryLargeAmountOfEnumsToSerialize() { // Ensure we don't throw OutOfMemoryException. var options = new JsonSerializerOptions { Converters = { new JsonStringEnumConverter() } }; const int MaxValue = 2097152; // value for MyEnum.V // Every value between 0 and MaxValue maps to a valid enum // identifier, and is a candidate to go into the name cache. // Write the first 45 values. for (int i = 1; i < 46; i++) { JsonSerializer.Serialize((MyEnum)i, options); } // At this point, there are 60 values in the name cache; // 22 cached at warm-up, the rest in the above loop. // Ensure the approximate size limit for the name cache (a concurrent dictionary) is honored. // Use multiple threads to perhaps go over the soft limit of 64, but not by more than a couple. Parallel.For(0, 8, i => JsonSerializer.Serialize((MyEnum)(46 + i), options)); // Write the remaining enum values. The cache is capped to avoid // OutOfMemoryException due to having too many cached items. for (int i = 54; i <= MaxValue; i++) { JsonSerializer.Serialize((MyEnum)i, options); } } [Flags] public enum MyEnum { A = 1 << 0, B = 1 << 1, C = 1 << 2, D = 1 << 3, E = 1 << 4, F = 1 << 5, G = 1 << 6, H = 1 << 7, I = 1 << 8, J = 1 << 9, K = 1 << 10, L = 1 << 11, M = 1 << 12, N = 1 << 13, O = 1 << 14, P = 1 << 15, Q = 1 << 16, R = 1 << 17, S = 1 << 18, T = 1 << 19, U = 1 << 20, V = 1 << 21, } [Fact, OuterLoop] [ActiveIssue("https://github.com/dotnet/runtime/issues/42677", platforms: TestPlatforms.Windows, runtimes: TestRuntimes.Mono)] public static void VeryLargeAmountOfEnumDictionaryKeysToSerialize() { // Ensure we don't throw OutOfMemoryException. const int MaxValue = (int)MyEnum.V; // Every value between 0 and MaxValue maps to a valid enum // identifier, and is a candidate to go into the name cache. // Write the first 45 values. Dictionary<MyEnum, int> dictionary; for (int i = 1; i < 46; i++) { dictionary = new Dictionary<MyEnum, int> { { (MyEnum)i, i } }; JsonSerializer.Serialize(dictionary); } // At this point, there are 60 values in the name cache; // 22 cached at warm-up, the rest in the above loop. // Ensure the approximate size limit for the name cache (a concurrent dictionary) is honored. // Use multiple threads to perhaps go over the soft limit of 64, but not by more than a couple. Parallel.For( 0, 8, i => { dictionary = new Dictionary<MyEnum, int> { { (MyEnum)(46 + i), i } }; JsonSerializer.Serialize(dictionary); } ); // Write the remaining enum values. The cache is capped to avoid // OutOfMemoryException due to having too many cached items. for (int i = 54; i <= MaxValue; i++) { dictionary = new Dictionary<MyEnum, int> { { (MyEnum)i, i } }; JsonSerializer.Serialize(dictionary); } } public abstract class NumericEnumKeyDictionaryBase<T> { public abstract Dictionary<T, int> BuildDictionary(int i); [Fact] public void SerilizeDictionaryWhenCacheIsFull() { Dictionary<T, int> dictionary; for (int i = 1; i <= 64; i++) { dictionary = BuildDictionary(i); JsonSerializer.Serialize(dictionary); } dictionary = BuildDictionary(0); string json = JsonSerializer.Serialize(dictionary); Assert.Equal($"{{\"0\":0}}", json); } } public class Int32EnumDictionary : NumericEnumKeyDictionaryBase<SampleEnumInt32> { public override Dictionary<SampleEnumInt32, int> BuildDictionary(int i) => new Dictionary<SampleEnumInt32, int> { { (SampleEnumInt32)i, i } }; } public class UInt32EnumDictionary : NumericEnumKeyDictionaryBase<SampleEnumUInt32> { public override Dictionary<SampleEnumUInt32, int> BuildDictionary(int i) => new Dictionary<SampleEnumUInt32, int> { { (SampleEnumUInt32)i, i } }; } public class UInt64EnumDictionary : NumericEnumKeyDictionaryBase<SampleEnumUInt64> { public override Dictionary<SampleEnumUInt64, int> BuildDictionary(int i) => new Dictionary<SampleEnumUInt64, int> { { (SampleEnumUInt64)i, i } }; } public class Int64EnumDictionary : NumericEnumKeyDictionaryBase<SampleEnumInt64> { public override Dictionary<SampleEnumInt64, int> BuildDictionary(int i) => new Dictionary<SampleEnumInt64, int> { { (SampleEnumInt64)i, i } }; } public class Int16EnumDictionary : NumericEnumKeyDictionaryBase<SampleEnumInt16> { public override Dictionary<SampleEnumInt16, int> BuildDictionary(int i) => new Dictionary<SampleEnumInt16, int> { { (SampleEnumInt16)i, i } }; } public class UInt16EnumDictionary : NumericEnumKeyDictionaryBase<SampleEnumUInt16> { public override Dictionary<SampleEnumUInt16, int> BuildDictionary(int i) => new Dictionary<SampleEnumUInt16, int> { { (SampleEnumUInt16)i, i } }; } public class ByteEnumDictionary : NumericEnumKeyDictionaryBase<SampleEnumByte> { public override Dictionary<SampleEnumByte, int> BuildDictionary(int i) => new Dictionary<SampleEnumByte, int> { { (SampleEnumByte)i, i } }; } public class SByteEnumDictionary : NumericEnumKeyDictionaryBase<SampleEnumSByte> { public override Dictionary<SampleEnumSByte, int> BuildDictionary(int i) => new Dictionary<SampleEnumSByte, int> { { (SampleEnumSByte)i, i } }; } [Flags] public enum SampleEnumInt32 { A = 1 << 0, B = 1 << 1, C = 1 << 2, D = 1 << 3, E = 1 << 4, F = 1 << 5, G = 1 << 6, } [Flags] public enum SampleEnumUInt32 : uint { A = 1 << 0, B = 1 << 1, C = 1 << 2, D = 1 << 3, E = 1 << 4, F = 1 << 5, G = 1 << 6, } [Flags] public enum SampleEnumUInt64 : ulong { A = 1 << 0, B = 1 << 1, C = 1 << 2, D = 1 << 3, E = 1 << 4, F = 1 << 5, G = 1 << 6, } [Flags] public enum SampleEnumInt64 : long { A = 1 << 0, B = 1 << 1, C = 1 << 2, D = 1 << 3, E = 1 << 4, F = 1 << 5, G = 1 << 6, } [Flags] public enum SampleEnumInt16 : short { A = 1 << 0, B = 1 << 1, C = 1 << 2, D = 1 << 3, E = 1 << 4, F = 1 << 5, G = 1 << 6, } [Flags] public enum SampleEnumUInt16 : ushort { A = 1 << 0, B = 1 << 1, C = 1 << 2, D = 1 << 3, E = 1 << 4, F = 1 << 5, G = 1 << 6, } [Flags] public enum SampleEnumByte : byte { A = 1 << 0, B = 1 << 1, C = 1 << 2, D = 1 << 3, E = 1 << 4, F = 1 << 5, G = 1 << 6, } [Flags] public enum SampleEnumSByte : sbyte { A = 1 << 0, B = 1 << 1, C = 1 << 2, D = 1 << 3, E = 1 << 4, F = 1 << 5, G = 1 << 6, } } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/libraries/System.Collections.Specialized/src/System/Collections/Specialized/StringCollection.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.Collections.Specialized { /// <devdoc> /// <para>Represents a collection of strings.</para> /// </devdoc> [Serializable] [System.Runtime.CompilerServices.TypeForwardedFrom("System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class StringCollection : IList { private readonly ArrayList data = new ArrayList(); // Do not rename (binary serialization) /// <devdoc> /// <para>Represents the entry at the specified index of the <see cref='System.Collections.Specialized.StringCollection'/>.</para> /// </devdoc> public string? this[int index] { get { return ((string?)data[index]); } set { data[index] = value; } } /// <devdoc> /// <para>Gets the number of strings in the /// <see cref='System.Collections.Specialized.StringCollection'/> .</para> /// </devdoc> public int Count { get { return data.Count; } } bool IList.IsReadOnly { get { return false; } } bool IList.IsFixedSize { get { return false; } } /// <devdoc> /// <para>Adds a string with the specified value to the /// <see cref='System.Collections.Specialized.StringCollection'/> .</para> /// </devdoc> public int Add(string? value) { return data.Add(value); } /// <devdoc> /// <para>Copies the elements of a string array to the end of the <see cref='System.Collections.Specialized.StringCollection'/>.</para> /// </devdoc> public void AddRange(string[] value!!) { data.AddRange(value); } /// <devdoc> /// <para>Removes all the strings from the /// <see cref='System.Collections.Specialized.StringCollection'/> .</para> /// </devdoc> public void Clear() { data.Clear(); } /// <devdoc> /// <para>Gets a value indicating whether the /// <see cref='System.Collections.Specialized.StringCollection'/> contains a string with the specified /// value.</para> /// </devdoc> public bool Contains(string? value) { return data.Contains(value); } /// <devdoc> /// <para>Copies the <see cref='System.Collections.Specialized.StringCollection'/> values to a one-dimensional <see cref='System.Array'/> instance at the /// specified index.</para> /// </devdoc> public void CopyTo(string[] array, int index) { data.CopyTo(array, index); } /// <devdoc> /// <para>Returns an enumerator that can iterate through /// the <see cref='System.Collections.Specialized.StringCollection'/> .</para> /// </devdoc> public StringEnumerator GetEnumerator() { return new StringEnumerator(this); } /// <devdoc> /// <para>Returns the index of the first occurrence of a string in /// the <see cref='System.Collections.Specialized.StringCollection'/> .</para> /// </devdoc> public int IndexOf(string? value) { return data.IndexOf(value); } /// <devdoc> /// <para>Inserts a string into the <see cref='System.Collections.Specialized.StringCollection'/> at the specified /// index.</para> /// </devdoc> public void Insert(int index, string? value) { data.Insert(index, value); } /// <devdoc> /// <para>Gets a value indicating whether the <see cref='System.Collections.Specialized.StringCollection'/> is read-only.</para> /// </devdoc> public bool IsReadOnly { get { return false; } } /// <devdoc> /// <para>Gets a value indicating whether access to the /// <see cref='System.Collections.Specialized.StringCollection'/> /// is synchronized (thread-safe).</para> /// </devdoc> public bool IsSynchronized { get { return false; } } /// <devdoc> /// <para> Removes a specific string from the /// <see cref='System.Collections.Specialized.StringCollection'/> .</para> /// </devdoc> public void Remove(string? value) { data.Remove(value); } /// <devdoc> /// <para>Removes the string at the specified index of the <see cref='System.Collections.Specialized.StringCollection'/>.</para> /// </devdoc> public void RemoveAt(int index) { data.RemoveAt(index); } /// <devdoc> /// <para>Gets an object that can be used to synchronize access to the <see cref='System.Collections.Specialized.StringCollection'/>.</para> /// </devdoc> public object SyncRoot { get { return data.SyncRoot; } } object? IList.this[int index] { get { return this[index]; } set { this[index] = (string?)value; } } int IList.Add(object? value) { return Add((string?)value); } bool IList.Contains(object? value) { return Contains((string?)value); } int IList.IndexOf(object? value) { return IndexOf((string?)value); } void IList.Insert(int index, object? value) { Insert(index, (string?)value); } void IList.Remove(object? value) { Remove((string?)value); } void ICollection.CopyTo(Array array, int index) { data.CopyTo(array, index); } IEnumerator IEnumerable.GetEnumerator() { return data.GetEnumerator(); } } public class StringEnumerator { private readonly System.Collections.IEnumerator _baseEnumerator; private readonly System.Collections.IEnumerable _temp; internal StringEnumerator(StringCollection mappings) { _temp = (IEnumerable)(mappings); _baseEnumerator = _temp.GetEnumerator(); } public string? Current { get { return (string?)(_baseEnumerator.Current); } } public bool MoveNext() { return _baseEnumerator.MoveNext(); } public void Reset() { _baseEnumerator.Reset(); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. namespace System.Collections.Specialized { /// <devdoc> /// <para>Represents a collection of strings.</para> /// </devdoc> [Serializable] [System.Runtime.CompilerServices.TypeForwardedFrom("System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public class StringCollection : IList { private readonly ArrayList data = new ArrayList(); // Do not rename (binary serialization) /// <devdoc> /// <para>Represents the entry at the specified index of the <see cref='System.Collections.Specialized.StringCollection'/>.</para> /// </devdoc> public string? this[int index] { get { return ((string?)data[index]); } set { data[index] = value; } } /// <devdoc> /// <para>Gets the number of strings in the /// <see cref='System.Collections.Specialized.StringCollection'/> .</para> /// </devdoc> public int Count { get { return data.Count; } } bool IList.IsReadOnly { get { return false; } } bool IList.IsFixedSize { get { return false; } } /// <devdoc> /// <para>Adds a string with the specified value to the /// <see cref='System.Collections.Specialized.StringCollection'/> .</para> /// </devdoc> public int Add(string? value) { return data.Add(value); } /// <devdoc> /// <para>Copies the elements of a string array to the end of the <see cref='System.Collections.Specialized.StringCollection'/>.</para> /// </devdoc> public void AddRange(string[] value!!) { data.AddRange(value); } /// <devdoc> /// <para>Removes all the strings from the /// <see cref='System.Collections.Specialized.StringCollection'/> .</para> /// </devdoc> public void Clear() { data.Clear(); } /// <devdoc> /// <para>Gets a value indicating whether the /// <see cref='System.Collections.Specialized.StringCollection'/> contains a string with the specified /// value.</para> /// </devdoc> public bool Contains(string? value) { return data.Contains(value); } /// <devdoc> /// <para>Copies the <see cref='System.Collections.Specialized.StringCollection'/> values to a one-dimensional <see cref='System.Array'/> instance at the /// specified index.</para> /// </devdoc> public void CopyTo(string[] array, int index) { data.CopyTo(array, index); } /// <devdoc> /// <para>Returns an enumerator that can iterate through /// the <see cref='System.Collections.Specialized.StringCollection'/> .</para> /// </devdoc> public StringEnumerator GetEnumerator() { return new StringEnumerator(this); } /// <devdoc> /// <para>Returns the index of the first occurrence of a string in /// the <see cref='System.Collections.Specialized.StringCollection'/> .</para> /// </devdoc> public int IndexOf(string? value) { return data.IndexOf(value); } /// <devdoc> /// <para>Inserts a string into the <see cref='System.Collections.Specialized.StringCollection'/> at the specified /// index.</para> /// </devdoc> public void Insert(int index, string? value) { data.Insert(index, value); } /// <devdoc> /// <para>Gets a value indicating whether the <see cref='System.Collections.Specialized.StringCollection'/> is read-only.</para> /// </devdoc> public bool IsReadOnly { get { return false; } } /// <devdoc> /// <para>Gets a value indicating whether access to the /// <see cref='System.Collections.Specialized.StringCollection'/> /// is synchronized (thread-safe).</para> /// </devdoc> public bool IsSynchronized { get { return false; } } /// <devdoc> /// <para> Removes a specific string from the /// <see cref='System.Collections.Specialized.StringCollection'/> .</para> /// </devdoc> public void Remove(string? value) { data.Remove(value); } /// <devdoc> /// <para>Removes the string at the specified index of the <see cref='System.Collections.Specialized.StringCollection'/>.</para> /// </devdoc> public void RemoveAt(int index) { data.RemoveAt(index); } /// <devdoc> /// <para>Gets an object that can be used to synchronize access to the <see cref='System.Collections.Specialized.StringCollection'/>.</para> /// </devdoc> public object SyncRoot { get { return data.SyncRoot; } } object? IList.this[int index] { get { return this[index]; } set { this[index] = (string?)value; } } int IList.Add(object? value) { return Add((string?)value); } bool IList.Contains(object? value) { return Contains((string?)value); } int IList.IndexOf(object? value) { return IndexOf((string?)value); } void IList.Insert(int index, object? value) { Insert(index, (string?)value); } void IList.Remove(object? value) { Remove((string?)value); } void ICollection.CopyTo(Array array, int index) { data.CopyTo(array, index); } IEnumerator IEnumerable.GetEnumerator() { return data.GetEnumerator(); } } public class StringEnumerator { private readonly System.Collections.IEnumerator _baseEnumerator; private readonly System.Collections.IEnumerable _temp; internal StringEnumerator(StringCollection mappings) { _temp = (IEnumerable)(mappings); _baseEnumerator = _temp.GetEnumerator(); } public string? Current { get { return (string?)(_baseEnumerator.Current); } } public bool MoveNext() { return _baseEnumerator.MoveNext(); } public void Reset() { _baseEnumerator.Reset(); } } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/libraries/Common/src/Interop/Unix/System.Native/Interop.GetDefaultTimeZone.Android.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 Sys { [GeneratedDllImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_GetDefaultTimeZone", StringMarshalling = StringMarshalling.Utf8, SetLastError = true)] internal static partial string? GetDefaultTimeZone(); } }
// 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 Sys { [GeneratedDllImport(Interop.Libraries.SystemNative, EntryPoint = "SystemNative_GetDefaultTimeZone", StringMarshalling = StringMarshalling.Utf8, SetLastError = true)] internal static partial string? GetDefaultTimeZone(); } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/JIT/Methodical/cctor/simple/precise1_cs_ro.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>None</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="precise1.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>None</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="precise1.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/JIT/Regression/CLR-x86-JIT/V1-M09/b15783/b15783.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // namespace DefaultNamespace { using System; public class jitbug { public static UInt16 f() { return UInt16.MaxValue; } public static int Main(String[] args) { Object v = ((UInt16)65535); Console.WriteLine("v.ToUInt16: " + v); Console.WriteLine("UInt16.MaxValue: " + UInt16.MaxValue); // This worked... I couldn't simplify it. if (f() != UInt16.MaxValue) Console.WriteLine("Ack! f() didn't return the correct value!"); else Console.WriteLine("ushort comparison looked good..."); if (((UInt16)v) != UInt16.MaxValue) throw new Exception("UInt16.MaxValue from Object as UInt16 wasn't right! " + (UInt16)v); Console.WriteLine("pass"); return 100; } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // namespace DefaultNamespace { using System; public class jitbug { public static UInt16 f() { return UInt16.MaxValue; } public static int Main(String[] args) { Object v = ((UInt16)65535); Console.WriteLine("v.ToUInt16: " + v); Console.WriteLine("UInt16.MaxValue: " + UInt16.MaxValue); // This worked... I couldn't simplify it. if (f() != UInt16.MaxValue) Console.WriteLine("Ack! f() didn't return the correct value!"); else Console.WriteLine("ushort comparison looked good..."); if (((UInt16)v) != UInt16.MaxValue) throw new Exception("UInt16.MaxValue from Object as UInt16 wasn't right! " + (UInt16)v); Console.WriteLine("pass"); return 100; } } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/coreclr/nativeaot/System.Private.Reflection.Core/src/System/Reflection/Runtime/TypeInfos/NativeFormat/NativeFormatRuntimeGenericParameterTypeInfoForMethods.UnificationKey.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.Reflection; using System.Diagnostics; using System.Collections.Generic; using System.Collections.Concurrent; using System.Reflection.Runtime.General; using System.Reflection.Runtime.MethodInfos; using System.Reflection.Runtime.TypeInfos; using Internal.Reflection.Tracing; using Internal.Metadata.NativeFormat; namespace System.Reflection.Runtime.TypeInfos.NativeFormat { internal sealed partial class NativeFormatRuntimeGenericParameterTypeInfoForMethods : NativeFormatRuntimeGenericParameterTypeInfo, IKeyedItem<NativeFormatRuntimeGenericParameterTypeInfoForMethods.UnificationKey> { // // Key for unification. // internal struct UnificationKey : IEquatable<UnificationKey> { public UnificationKey(RuntimeNamedMethodInfo methodOwner, MetadataReader reader, GenericParameterHandle genericParameterHandle) { MethodOwner = methodOwner; GenericParameterHandle = genericParameterHandle; Reader = reader; } public RuntimeNamedMethodInfo MethodOwner { get; } public MetadataReader Reader { get; } public GenericParameterHandle GenericParameterHandle { get; } public override bool Equals(object obj) { if (!(obj is UnificationKey other)) return false; return Equals(other); } public bool Equals(UnificationKey other) { if (!(GenericParameterHandle.Equals(other.GenericParameterHandle))) return false; if (!(Reader == other.Reader)) return false; if (!MethodOwner.Equals(other.MethodOwner)) return false; return true; } public override int GetHashCode() { return GenericParameterHandle.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.Reflection; using System.Diagnostics; using System.Collections.Generic; using System.Collections.Concurrent; using System.Reflection.Runtime.General; using System.Reflection.Runtime.MethodInfos; using System.Reflection.Runtime.TypeInfos; using Internal.Reflection.Tracing; using Internal.Metadata.NativeFormat; namespace System.Reflection.Runtime.TypeInfos.NativeFormat { internal sealed partial class NativeFormatRuntimeGenericParameterTypeInfoForMethods : NativeFormatRuntimeGenericParameterTypeInfo, IKeyedItem<NativeFormatRuntimeGenericParameterTypeInfoForMethods.UnificationKey> { // // Key for unification. // internal struct UnificationKey : IEquatable<UnificationKey> { public UnificationKey(RuntimeNamedMethodInfo methodOwner, MetadataReader reader, GenericParameterHandle genericParameterHandle) { MethodOwner = methodOwner; GenericParameterHandle = genericParameterHandle; Reader = reader; } public RuntimeNamedMethodInfo MethodOwner { get; } public MetadataReader Reader { get; } public GenericParameterHandle GenericParameterHandle { get; } public override bool Equals(object obj) { if (!(obj is UnificationKey other)) return false; return Equals(other); } public bool Equals(UnificationKey other) { if (!(GenericParameterHandle.Equals(other.GenericParameterHandle))) return false; if (!(Reader == other.Reader)) return false; if (!MethodOwner.Equals(other.MethodOwner)) return false; return true; } public override int GetHashCode() { return GenericParameterHandle.GetHashCode(); } } } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/Interop/COM/ComWrappers/GlobalInstance/GlobalInstanceTrackerSupportTests_TargetWindows.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <ApplicationManifest>App.manifest</ApplicationManifest> <UseManagedCOMServer>true</UseManagedCOMServer> <IsManagedCOMClient>true</IsManagedCOMClient> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> <DefineConstants>$(DefineConstants);Windows</DefineConstants> <!-- There is a Windows and a non-Windows version of this test to allow it to be compiled for all targets --> <CLRTestTargetUnsupported Condition="'$(TargetsWindows)' != 'true'">true</CLRTestTargetUnsupported> </PropertyGroup> <ItemGroup> <Compile Include="GlobalInstance.cs" /> <Compile Include="GlobalInstance.TrackerSupport.cs" /> <Compile Include="../Common.cs" /> <Compile Include="../../ServerContracts/Server.Contracts.cs" /> <Compile Include="../../ServerContracts/ServerGuids.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="../MockReferenceTrackerRuntime/CMakeLists.txt" /> <ProjectReference Include="../../NativeServer/CMakeLists.txt" /> <ProjectReference Include="../../NETServer/NETServer.csproj"> <ReferenceOutputAssembly>false</ReferenceOutputAssembly> <OutputItemType>Content</OutputItemType> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </ProjectReference> </ItemGroup> <ItemGroup> <None Include="CoreShim.X.manifest"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <ApplicationManifest>App.manifest</ApplicationManifest> <UseManagedCOMServer>true</UseManagedCOMServer> <IsManagedCOMClient>true</IsManagedCOMClient> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> <DefineConstants>$(DefineConstants);Windows</DefineConstants> <!-- There is a Windows and a non-Windows version of this test to allow it to be compiled for all targets --> <CLRTestTargetUnsupported Condition="'$(TargetsWindows)' != 'true'">true</CLRTestTargetUnsupported> </PropertyGroup> <ItemGroup> <Compile Include="GlobalInstance.cs" /> <Compile Include="GlobalInstance.TrackerSupport.cs" /> <Compile Include="../Common.cs" /> <Compile Include="../../ServerContracts/Server.Contracts.cs" /> <Compile Include="../../ServerContracts/ServerGuids.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="../MockReferenceTrackerRuntime/CMakeLists.txt" /> <ProjectReference Include="../../NativeServer/CMakeLists.txt" /> <ProjectReference Include="../../NETServer/NETServer.csproj"> <ReferenceOutputAssembly>false</ReferenceOutputAssembly> <OutputItemType>Content</OutputItemType> <CopyToOutputDirectory>Always</CopyToOutputDirectory> </ProjectReference> </ItemGroup> <ItemGroup> <None Include="CoreShim.X.manifest"> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> </None> </ItemGroup> </Project>
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/libraries/System.Security.Cryptography.Xml/tests/TransformTest.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // Unit tests for Transform // // Author: // Sebastien Pouliot <[email protected]> // // Copyright (C) 2008 Novell, Inc (http://www.novell.com) using System.IO; using System.Text; using System.Xml; using Xunit; namespace System.Security.Cryptography.Xml.Tests { public class ConcreteTransform : Transform { protected override XmlNodeList GetInnerXml() { throw new NotImplementedException(); } public override object GetOutput(Type type) { return new MemoryStream(); } public override object GetOutput() { throw new NotImplementedException(); } public override Type[] InputTypes { get { throw new NotImplementedException(); } } public override void LoadInnerXml(global::System.Xml.XmlNodeList nodeList) { throw new NotImplementedException(); } public override void LoadInput(object obj) { throw new NotImplementedException(); } public override Type[] OutputTypes { get { throw new NotImplementedException(); } } } public class TransformTest { [Fact] [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework)] public void Constructor() { ConcreteTransform concreteTransform = new ConcreteTransform(); Assert.Empty(concreteTransform.PropagatedNamespaces); } [Fact] public void Constructor_NoPropagatedNamespaces() { ConcreteTransform concreteTransform = new ConcreteTransform(); Assert.Null(concreteTransform.Context); Assert.Null(concreteTransform.Algorithm); } [Fact] public void GetDigestedOutput_Null() { Assert.Throws<NullReferenceException>(() => new ConcreteTransform().GetDigestedOutput(null)); } [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework)] [Theory] [InlineData(false, "<a><b><c xmlns=\"urn:foo\" /></b></a>")] [InlineData(true, "<a f=\"urn:foo\"><b><c xmlns=\"urn:foo\" /></b></a>")] public void PropagatedNamespaces_XmlDecryptionTransform(bool addPropagatedNamespace, string expectedResult) { XmlDocument baseDocument = new XmlDocument(); baseDocument.LoadXml("<a><b><c xmlns=\"urn:foo\"/></b></a>"); using (Aes aes = Aes.Create()) { EncryptedXml encryptedXml = new EncryptedXml(baseDocument); encryptedXml.AddKeyNameMapping("key", aes); XmlElement bElement = (XmlElement) baseDocument.DocumentElement.SelectSingleNode("b"); EncryptedData encryptedData = encryptedXml.Encrypt(bElement, "key"); EncryptedXml.ReplaceElement(bElement, encryptedData, false); XmlDecryptionTransform decryptionTransform = new XmlDecryptionTransform(); decryptionTransform.EncryptedXml = encryptedXml; decryptionTransform.LoadInput(baseDocument); if (addPropagatedNamespace) { decryptionTransform.PropagatedNamespaces.Add("f", "urn:foo"); } XmlDocument decryptedDocument = (XmlDocument) decryptionTransform.GetOutput(typeof(XmlDocument)); Assert.Equal(expectedResult, decryptedDocument.OuterXml); } } [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework)] [Theory] [InlineData(typeof(XmlDsigC14NTransform))] [InlineData(typeof(XmlDsigExcC14NTransform))] [InlineData(typeof(XmlDsigC14NWithCommentsTransform))] public void PropagatedNamespaces(Type type) { XmlDocument doc = new XmlDocument(); doc.AppendChild(doc.CreateElement("foo", "urn:foo")); doc.DocumentElement.AppendChild(doc.CreateElement("bar", "urn:bar")); Assert.Equal(string.Empty, doc.DocumentElement.GetAttribute("xmlns:f")); Transform transform = Activator.CreateInstance(type) as Transform; transform.LoadInput(doc); transform.PropagatedNamespaces.Add("f", "urn:foo"); transform.PropagatedNamespaces.Add("b", "urn:bar"); using (Stream stream = transform.GetOutput(typeof(Stream)) as Stream) using (StreamReader streamReader = new StreamReader(stream, Encoding.UTF8)) { string result = streamReader.ReadToEnd(); Assert.Equal("<foo xmlns=\"urn:foo\"><bar xmlns=\"urn:bar\"></bar></foo>", result); Assert.Equal("urn:foo", doc.DocumentElement.NamespaceURI); } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // Unit tests for Transform // // Author: // Sebastien Pouliot <[email protected]> // // Copyright (C) 2008 Novell, Inc (http://www.novell.com) using System.IO; using System.Text; using System.Xml; using Xunit; namespace System.Security.Cryptography.Xml.Tests { public class ConcreteTransform : Transform { protected override XmlNodeList GetInnerXml() { throw new NotImplementedException(); } public override object GetOutput(Type type) { return new MemoryStream(); } public override object GetOutput() { throw new NotImplementedException(); } public override Type[] InputTypes { get { throw new NotImplementedException(); } } public override void LoadInnerXml(global::System.Xml.XmlNodeList nodeList) { throw new NotImplementedException(); } public override void LoadInput(object obj) { throw new NotImplementedException(); } public override Type[] OutputTypes { get { throw new NotImplementedException(); } } } public class TransformTest { [Fact] [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework)] public void Constructor() { ConcreteTransform concreteTransform = new ConcreteTransform(); Assert.Empty(concreteTransform.PropagatedNamespaces); } [Fact] public void Constructor_NoPropagatedNamespaces() { ConcreteTransform concreteTransform = new ConcreteTransform(); Assert.Null(concreteTransform.Context); Assert.Null(concreteTransform.Algorithm); } [Fact] public void GetDigestedOutput_Null() { Assert.Throws<NullReferenceException>(() => new ConcreteTransform().GetDigestedOutput(null)); } [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework)] [Theory] [InlineData(false, "<a><b><c xmlns=\"urn:foo\" /></b></a>")] [InlineData(true, "<a f=\"urn:foo\"><b><c xmlns=\"urn:foo\" /></b></a>")] public void PropagatedNamespaces_XmlDecryptionTransform(bool addPropagatedNamespace, string expectedResult) { XmlDocument baseDocument = new XmlDocument(); baseDocument.LoadXml("<a><b><c xmlns=\"urn:foo\"/></b></a>"); using (Aes aes = Aes.Create()) { EncryptedXml encryptedXml = new EncryptedXml(baseDocument); encryptedXml.AddKeyNameMapping("key", aes); XmlElement bElement = (XmlElement) baseDocument.DocumentElement.SelectSingleNode("b"); EncryptedData encryptedData = encryptedXml.Encrypt(bElement, "key"); EncryptedXml.ReplaceElement(bElement, encryptedData, false); XmlDecryptionTransform decryptionTransform = new XmlDecryptionTransform(); decryptionTransform.EncryptedXml = encryptedXml; decryptionTransform.LoadInput(baseDocument); if (addPropagatedNamespace) { decryptionTransform.PropagatedNamespaces.Add("f", "urn:foo"); } XmlDocument decryptedDocument = (XmlDocument) decryptionTransform.GetOutput(typeof(XmlDocument)); Assert.Equal(expectedResult, decryptedDocument.OuterXml); } } [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework)] [Theory] [InlineData(typeof(XmlDsigC14NTransform))] [InlineData(typeof(XmlDsigExcC14NTransform))] [InlineData(typeof(XmlDsigC14NWithCommentsTransform))] public void PropagatedNamespaces(Type type) { XmlDocument doc = new XmlDocument(); doc.AppendChild(doc.CreateElement("foo", "urn:foo")); doc.DocumentElement.AppendChild(doc.CreateElement("bar", "urn:bar")); Assert.Equal(string.Empty, doc.DocumentElement.GetAttribute("xmlns:f")); Transform transform = Activator.CreateInstance(type) as Transform; transform.LoadInput(doc); transform.PropagatedNamespaces.Add("f", "urn:foo"); transform.PropagatedNamespaces.Add("b", "urn:bar"); using (Stream stream = transform.GetOutput(typeof(Stream)) as Stream) using (StreamReader streamReader = new StreamReader(stream, Encoding.UTF8)) { string result = streamReader.ReadToEnd(); Assert.Equal("<foo xmlns=\"urn:foo\"><bar xmlns=\"urn:bar\"></bar></foo>", result); Assert.Equal("urn:foo", doc.DocumentElement.NamespaceURI); } } } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/Interop/PInvoke/BestFitMapping/Assembly_False_True/PInvoke_Default.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. namespace Char { public partial class PInvoke_Default { public static void RunTest() { RunTest(bestFitMapping: false, throwOnUnmappableChar: true); } } } namespace LPStr { public partial class PInvoke_Default { public static void RunTest() { RunTest(bestFitMapping: false, throwOnUnmappableChar: true); } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. namespace Char { public partial class PInvoke_Default { public static void RunTest() { RunTest(bestFitMapping: false, throwOnUnmappableChar: true); } } } namespace LPStr { public partial class PInvoke_Default { public static void RunTest() { RunTest(bestFitMapping: false, throwOnUnmappableChar: true); } } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/libraries/System.Collections.Specialized/tests/OrderedDictionary/CaseInsensitiveEqualityComparer.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; namespace System.Collections.Specialized.Tests { internal sealed class CaseInsensitiveEqualityComparer : IEqualityComparer { public new bool Equals(object x, object y) { if (x == y) return true; if (x == null || y == null) return false; string sa = x as string; if (sa != null) { string sb = y as string; if (sb != null) { return sa.Equals(sb, StringComparison.CurrentCultureIgnoreCase); } } return x.Equals(y); } public int GetHashCode(object obj!!) { string s = obj as string; if (s != null) { return s.ToUpper().GetHashCode(); } return obj.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; namespace System.Collections.Specialized.Tests { internal sealed class CaseInsensitiveEqualityComparer : IEqualityComparer { public new bool Equals(object x, object y) { if (x == y) return true; if (x == null || y == null) return false; string sa = x as string; if (sa != null) { string sb = y as string; if (sb != null) { return sa.Equals(sb, StringComparison.CurrentCultureIgnoreCase); } } return x.Equals(y); } public int GetHashCode(object obj!!) { string s = obj as string; if (s != null) { return s.ToUpper().GetHashCode(); } return obj.GetHashCode(); } } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/libraries/Common/tests/System/RandomDataGenerator.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.Text; namespace System { public class RandomDataGenerator { private Random _rand = new Random(); private int? _seed = null; public int? Seed { get { return _seed; } set { if (!_seed.HasValue && value.HasValue) { _seed = value; _rand = new Random(value.Value); } } } // returns a byte array of random data public void GetBytes(int newSeed, byte[] buffer) { Seed = newSeed; GetBytes(buffer); } public void GetBytes(byte[] buffer) { _rand.NextBytes(buffer); } // returns a non-negative Int64 between 0 and Int64.MaxValue public long GetInt64(int newSeed) { Seed = newSeed; return GetInt64(); } public long GetInt64() { byte[] buffer = new byte[8]; GetBytes(buffer); long result = BitConverter.ToInt64(buffer, 0); return result != long.MinValue ? Math.Abs(result) : long.MaxValue; } // returns a non-negative Int32 between 0 and Int32.MaxValue public int GetInt32(int new_seed) { Seed = new_seed; return GetInt32(); } public int GetInt32() { return _rand.Next(); } // returns a non-negative Int16 between 0 and Int16.MaxValue public short GetInt16(int new_seed) { Seed = new_seed; return GetInt16(); } public short GetInt16() { return (short)_rand.Next(1 + short.MaxValue); } // returns a non-negative Byte between 0 and Byte.MaxValue public byte GetByte(int new_seed) { Seed = new_seed; return GetByte(); } public byte GetByte() { return (byte)_rand.Next(1 + byte.MaxValue); } // returns a non-negative Double between 0.0 and 1.0 public double GetDouble(int new_seed) { Seed = new_seed; return GetDouble(); } public double GetDouble() { return _rand.NextDouble(); } // returns a non-negative Single between 0.0 and 1.0 public float GetSingle(int newSeed) { Seed = newSeed; return GetSingle(); } public float GetSingle() { return (float)_rand.NextDouble(); } // returns a valid char that is a letter public char GetCharLetter(int newSeed) { Seed = newSeed; return GetCharLetter(); } public char GetCharLetter() { return GetCharLetter(allowSurrogate: true); } // returns a valid char that is a letter // if allowsurrogate is true then surrogates are valid return values public char GetCharLetter(int newSeed, bool allowSurrogate) { Seed = newSeed; return GetCharLetter(allowSurrogate); } public char GetCharLetter(bool allowSurrogate) { return GetCharLetter(allowSurrogate, allowNoWeight: true); } // returns a valid char that is a letter // if allowsurrogate is true then surrogates are valid return values // if allownoweight is true, then no-weight characters are valid return values public char GetCharLetter(int newSeed, bool allowSurrogate, bool allowNoWeight) { Seed = newSeed; return GetCharLetter(allowSurrogate, allowNoWeight); } public char GetCharLetter(bool allowSurrogate, bool allowNoWeight) { short iVal; char c = 'a'; int counter; bool loopCondition = true; // attempt to randomly find a letter counter = 100; do { counter--; iVal = GetInt16(); if (false == allowNoWeight) { throw new NotSupportedException("allownoweight = false is not supported in TestLibrary with FEATURE_NOPINVOKES"); } c = Convert.ToChar(iVal); loopCondition = allowSurrogate ? (!char.IsLetter(c)) : (!char.IsLetter(c) || char.IsSurrogate(c)); } while (loopCondition && 0 < counter); if (!char.IsLetter(c)) { // we tried and failed to get a letter // Grab an ASCII letter c = Convert.ToChar(GetInt16() % 26 + 'A'); } return c; } // returns a valid char that is a number public char GetCharNumber(int newSeed) { Seed = newSeed; return GetCharNumber(); } public char GetCharNumber() { return GetCharNumber(true); } // returns a valid char that is a number // if allownoweight is true, then no-weight characters are valid return values public char GetCharNumber(int newSeed, bool allowNoWeight) { Seed = newSeed; return GetCharNumber(allowNoWeight); } public char GetCharNumber(bool allowNoWeight) { char c = '0'; int counter; short iVal; bool loopCondition = true; // attempt to randomly find a number counter = 100; do { counter--; iVal = GetInt16(); if (false == allowNoWeight) { throw new InvalidOperationException("allownoweight = false is not supported in TestLibrary with FEATURE_NOPINVOKES"); } c = Convert.ToChar(iVal); loopCondition = !char.IsNumber(c); } while (loopCondition && 0 < counter); if (!char.IsNumber(c)) { // we tried and failed to get a letter // Grab an ASCII number c = Convert.ToChar(GetInt16() % 10 + '0'); } return c; } // returns a valid char public char GetChar(int newSeed) { Seed = newSeed; return GetChar(); } public char GetChar() { return GetChar(allowSurrogate: true); } // returns a valid char // if allowsurrogate is true then surrogates are valid return values public char GetChar(int newSeed, bool allowSurrogate) { Seed = newSeed; return GetChar(allowSurrogate); } public char GetChar(bool allowSurrogate) { return GetChar(allowSurrogate, allowNoWeight: true); } // returns a valid char // if allowsurrogate is true then surrogates are valid return values // if allownoweight characters then noweight characters are valid return values public char GetChar(int newSeed, bool allowSurrogate, bool allowNoWeight) { Seed = newSeed; return GetChar(allowSurrogate, allowNoWeight); } public char GetChar(bool allowSurrogate, bool allowNoWeight) { short iVal = GetInt16(); char c = (char)(iVal); if (!char.IsLetter(c)) { // we tried and failed to get a letter // Just grab an ASCII letter c = (char)(GetInt16() % 26 + 'A'); } return c; } // returns a string. If "validPath" is set, only valid path characters // will be included public string GetString(int newSeed, bool validPath, int minLength, int maxLength) { Seed = newSeed; return GetString(validPath, minLength, maxLength); } public string GetString(bool validPath, int minLength, int maxLength) { return GetString(validPath, true, true, minLength, maxLength); } public string GetString(int newSeed, bool validPath, bool allowNulls, int minLength, int maxLength) { Seed = newSeed; return GetString(validPath, allowNulls, minLength, maxLength); } public string GetString(bool validPath, bool allowNulls, int minLength, int maxLength) { return GetString(validPath, allowNulls, true, minLength, maxLength); } public string GetString(int newSeed, bool validPath, bool allowNulls, bool allowNoWeight, int minLength, int maxLength) { Seed = newSeed; return GetString(validPath, allowNulls, allowNoWeight, minLength, maxLength); } public string GetString(bool validPath, bool allowNulls, bool allowNoWeight, int minLength, int maxLength) { StringBuilder sVal = new StringBuilder(); char c; int length; if (0 == minLength && 0 == maxLength) return string.Empty; if (minLength > maxLength) return null; length = minLength; if (minLength != maxLength) { length = (GetInt32() % (maxLength - minLength)) + minLength; } for (int i = 0; length > i; i++) { if (validPath) { if (0 == (GetByte() % 2)) { c = GetCharLetter(true, allowNoWeight); } else { c = GetCharNumber(allowNoWeight); } } else if (!allowNulls) { do { c = GetChar(true, allowNoWeight); } while (c == '\u0000'); } else { c = GetChar(true, allowNoWeight); } sVal.Append(c); } string s = sVal.ToString(); return s; } public string[] GetStrings(int newSeed, bool validPath, int minLength, int maxLength) { Seed = newSeed; return GetStrings(validPath, minLength, maxLength); } public string[] GetStrings(bool validPath, int minLength, int maxLength) { string validString; const char c_LATIN_A = '\u0100'; const char c_LOWER_A = 'a'; const char c_UPPER_A = 'A'; const char c_ZERO_WEIGHT = '\uFEFF'; const char c_DOUBLE_WIDE_A = '\uFF21'; const string c_SURROGATE_UPPER = "\uD801\uDC00"; const string c_SURROGATE_LOWER = "\uD801\uDC28"; const char c_LOWER_SIGMA1 = (char)0x03C2; const char c_LOWER_SIGMA2 = (char)0x03C3; const char c_UPPER_SIGMA = (char)0x03A3; const char c_SPACE = ' '; if (2 >= minLength && 2 >= maxLength || minLength > maxLength) return null; validString = GetString(validPath, minLength - 1, maxLength - 1); string[] retStrings = new string[12]; retStrings[0] = GetString(validPath, minLength, maxLength); retStrings[1] = validString + c_LATIN_A; retStrings[2] = validString + c_LOWER_A; retStrings[3] = validString + c_UPPER_A; retStrings[4] = validString + c_ZERO_WEIGHT; retStrings[5] = validString + c_DOUBLE_WIDE_A; retStrings[6] = GetString(validPath, minLength - 2, maxLength - 2) + c_SURROGATE_UPPER; retStrings[7] = GetString(validPath, minLength - 2, maxLength - 2) + c_SURROGATE_LOWER; retStrings[8] = validString + c_LOWER_SIGMA1; retStrings[9] = validString + c_LOWER_SIGMA2; retStrings[10] = validString + c_UPPER_SIGMA; retStrings[11] = validString + c_SPACE; return retStrings; } public DateTime GetDateTime(int newSeed) => new DateTime(GetInt64(newSeed) % (DateTime.MaxValue.Ticks + 1)); public static void VerifyRandomDistribution(byte[] random) { // Better tests for randomness are available. For now just use a simple // check that compares the number of 0s and 1s in the bits. VerifyNeutralParity(random); } private static void VerifyNeutralParity(byte[] random) { int zeroCount = 0, oneCount = 0; for (int i = 0; i < random.Length; i++) { for (int j = 0; j < 8; j++) { if (((random[i] >> j) & 1) == 1) { oneCount++; } else { zeroCount++; } } } // Over the long run there should be about as many 1s as 0s. // This isn't a guarantee, just a statistical observation. // Allow a 7% tolerance band before considering it to have gotten out of hand. double bitDifference = Math.Abs(zeroCount - oneCount) / (double)(zeroCount + oneCount); const double AllowedTolerance = 0.07; if (bitDifference > AllowedTolerance) { throw new InvalidOperationException("Expected bitDifference < " + AllowedTolerance + ", got " + bitDifference + "."); } } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Text; namespace System { public class RandomDataGenerator { private Random _rand = new Random(); private int? _seed = null; public int? Seed { get { return _seed; } set { if (!_seed.HasValue && value.HasValue) { _seed = value; _rand = new Random(value.Value); } } } // returns a byte array of random data public void GetBytes(int newSeed, byte[] buffer) { Seed = newSeed; GetBytes(buffer); } public void GetBytes(byte[] buffer) { _rand.NextBytes(buffer); } // returns a non-negative Int64 between 0 and Int64.MaxValue public long GetInt64(int newSeed) { Seed = newSeed; return GetInt64(); } public long GetInt64() { byte[] buffer = new byte[8]; GetBytes(buffer); long result = BitConverter.ToInt64(buffer, 0); return result != long.MinValue ? Math.Abs(result) : long.MaxValue; } // returns a non-negative Int32 between 0 and Int32.MaxValue public int GetInt32(int new_seed) { Seed = new_seed; return GetInt32(); } public int GetInt32() { return _rand.Next(); } // returns a non-negative Int16 between 0 and Int16.MaxValue public short GetInt16(int new_seed) { Seed = new_seed; return GetInt16(); } public short GetInt16() { return (short)_rand.Next(1 + short.MaxValue); } // returns a non-negative Byte between 0 and Byte.MaxValue public byte GetByte(int new_seed) { Seed = new_seed; return GetByte(); } public byte GetByte() { return (byte)_rand.Next(1 + byte.MaxValue); } // returns a non-negative Double between 0.0 and 1.0 public double GetDouble(int new_seed) { Seed = new_seed; return GetDouble(); } public double GetDouble() { return _rand.NextDouble(); } // returns a non-negative Single between 0.0 and 1.0 public float GetSingle(int newSeed) { Seed = newSeed; return GetSingle(); } public float GetSingle() { return (float)_rand.NextDouble(); } // returns a valid char that is a letter public char GetCharLetter(int newSeed) { Seed = newSeed; return GetCharLetter(); } public char GetCharLetter() { return GetCharLetter(allowSurrogate: true); } // returns a valid char that is a letter // if allowsurrogate is true then surrogates are valid return values public char GetCharLetter(int newSeed, bool allowSurrogate) { Seed = newSeed; return GetCharLetter(allowSurrogate); } public char GetCharLetter(bool allowSurrogate) { return GetCharLetter(allowSurrogate, allowNoWeight: true); } // returns a valid char that is a letter // if allowsurrogate is true then surrogates are valid return values // if allownoweight is true, then no-weight characters are valid return values public char GetCharLetter(int newSeed, bool allowSurrogate, bool allowNoWeight) { Seed = newSeed; return GetCharLetter(allowSurrogate, allowNoWeight); } public char GetCharLetter(bool allowSurrogate, bool allowNoWeight) { short iVal; char c = 'a'; int counter; bool loopCondition = true; // attempt to randomly find a letter counter = 100; do { counter--; iVal = GetInt16(); if (false == allowNoWeight) { throw new NotSupportedException("allownoweight = false is not supported in TestLibrary with FEATURE_NOPINVOKES"); } c = Convert.ToChar(iVal); loopCondition = allowSurrogate ? (!char.IsLetter(c)) : (!char.IsLetter(c) || char.IsSurrogate(c)); } while (loopCondition && 0 < counter); if (!char.IsLetter(c)) { // we tried and failed to get a letter // Grab an ASCII letter c = Convert.ToChar(GetInt16() % 26 + 'A'); } return c; } // returns a valid char that is a number public char GetCharNumber(int newSeed) { Seed = newSeed; return GetCharNumber(); } public char GetCharNumber() { return GetCharNumber(true); } // returns a valid char that is a number // if allownoweight is true, then no-weight characters are valid return values public char GetCharNumber(int newSeed, bool allowNoWeight) { Seed = newSeed; return GetCharNumber(allowNoWeight); } public char GetCharNumber(bool allowNoWeight) { char c = '0'; int counter; short iVal; bool loopCondition = true; // attempt to randomly find a number counter = 100; do { counter--; iVal = GetInt16(); if (false == allowNoWeight) { throw new InvalidOperationException("allownoweight = false is not supported in TestLibrary with FEATURE_NOPINVOKES"); } c = Convert.ToChar(iVal); loopCondition = !char.IsNumber(c); } while (loopCondition && 0 < counter); if (!char.IsNumber(c)) { // we tried and failed to get a letter // Grab an ASCII number c = Convert.ToChar(GetInt16() % 10 + '0'); } return c; } // returns a valid char public char GetChar(int newSeed) { Seed = newSeed; return GetChar(); } public char GetChar() { return GetChar(allowSurrogate: true); } // returns a valid char // if allowsurrogate is true then surrogates are valid return values public char GetChar(int newSeed, bool allowSurrogate) { Seed = newSeed; return GetChar(allowSurrogate); } public char GetChar(bool allowSurrogate) { return GetChar(allowSurrogate, allowNoWeight: true); } // returns a valid char // if allowsurrogate is true then surrogates are valid return values // if allownoweight characters then noweight characters are valid return values public char GetChar(int newSeed, bool allowSurrogate, bool allowNoWeight) { Seed = newSeed; return GetChar(allowSurrogate, allowNoWeight); } public char GetChar(bool allowSurrogate, bool allowNoWeight) { short iVal = GetInt16(); char c = (char)(iVal); if (!char.IsLetter(c)) { // we tried and failed to get a letter // Just grab an ASCII letter c = (char)(GetInt16() % 26 + 'A'); } return c; } // returns a string. If "validPath" is set, only valid path characters // will be included public string GetString(int newSeed, bool validPath, int minLength, int maxLength) { Seed = newSeed; return GetString(validPath, minLength, maxLength); } public string GetString(bool validPath, int minLength, int maxLength) { return GetString(validPath, true, true, minLength, maxLength); } public string GetString(int newSeed, bool validPath, bool allowNulls, int minLength, int maxLength) { Seed = newSeed; return GetString(validPath, allowNulls, minLength, maxLength); } public string GetString(bool validPath, bool allowNulls, int minLength, int maxLength) { return GetString(validPath, allowNulls, true, minLength, maxLength); } public string GetString(int newSeed, bool validPath, bool allowNulls, bool allowNoWeight, int minLength, int maxLength) { Seed = newSeed; return GetString(validPath, allowNulls, allowNoWeight, minLength, maxLength); } public string GetString(bool validPath, bool allowNulls, bool allowNoWeight, int minLength, int maxLength) { StringBuilder sVal = new StringBuilder(); char c; int length; if (0 == minLength && 0 == maxLength) return string.Empty; if (minLength > maxLength) return null; length = minLength; if (minLength != maxLength) { length = (GetInt32() % (maxLength - minLength)) + minLength; } for (int i = 0; length > i; i++) { if (validPath) { if (0 == (GetByte() % 2)) { c = GetCharLetter(true, allowNoWeight); } else { c = GetCharNumber(allowNoWeight); } } else if (!allowNulls) { do { c = GetChar(true, allowNoWeight); } while (c == '\u0000'); } else { c = GetChar(true, allowNoWeight); } sVal.Append(c); } string s = sVal.ToString(); return s; } public string[] GetStrings(int newSeed, bool validPath, int minLength, int maxLength) { Seed = newSeed; return GetStrings(validPath, minLength, maxLength); } public string[] GetStrings(bool validPath, int minLength, int maxLength) { string validString; const char c_LATIN_A = '\u0100'; const char c_LOWER_A = 'a'; const char c_UPPER_A = 'A'; const char c_ZERO_WEIGHT = '\uFEFF'; const char c_DOUBLE_WIDE_A = '\uFF21'; const string c_SURROGATE_UPPER = "\uD801\uDC00"; const string c_SURROGATE_LOWER = "\uD801\uDC28"; const char c_LOWER_SIGMA1 = (char)0x03C2; const char c_LOWER_SIGMA2 = (char)0x03C3; const char c_UPPER_SIGMA = (char)0x03A3; const char c_SPACE = ' '; if (2 >= minLength && 2 >= maxLength || minLength > maxLength) return null; validString = GetString(validPath, minLength - 1, maxLength - 1); string[] retStrings = new string[12]; retStrings[0] = GetString(validPath, minLength, maxLength); retStrings[1] = validString + c_LATIN_A; retStrings[2] = validString + c_LOWER_A; retStrings[3] = validString + c_UPPER_A; retStrings[4] = validString + c_ZERO_WEIGHT; retStrings[5] = validString + c_DOUBLE_WIDE_A; retStrings[6] = GetString(validPath, minLength - 2, maxLength - 2) + c_SURROGATE_UPPER; retStrings[7] = GetString(validPath, minLength - 2, maxLength - 2) + c_SURROGATE_LOWER; retStrings[8] = validString + c_LOWER_SIGMA1; retStrings[9] = validString + c_LOWER_SIGMA2; retStrings[10] = validString + c_UPPER_SIGMA; retStrings[11] = validString + c_SPACE; return retStrings; } public DateTime GetDateTime(int newSeed) => new DateTime(GetInt64(newSeed) % (DateTime.MaxValue.Ticks + 1)); public static void VerifyRandomDistribution(byte[] random) { // Better tests for randomness are available. For now just use a simple // check that compares the number of 0s and 1s in the bits. VerifyNeutralParity(random); } private static void VerifyNeutralParity(byte[] random) { int zeroCount = 0, oneCount = 0; for (int i = 0; i < random.Length; i++) { for (int j = 0; j < 8; j++) { if (((random[i] >> j) & 1) == 1) { oneCount++; } else { zeroCount++; } } } // Over the long run there should be about as many 1s as 0s. // This isn't a guarantee, just a statistical observation. // Allow a 7% tolerance band before considering it to have gotten out of hand. double bitDifference = Math.Abs(zeroCount - oneCount) / (double)(zeroCount + oneCount); const double AllowedTolerance = 0.07; if (bitDifference > AllowedTolerance) { throw new InvalidOperationException("Expected bitDifference < " + AllowedTolerance + ", got " + bitDifference + "."); } } } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/JIT/Regression/VS-ia64-JIT/M00/b119026/charbug.cs
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // class test { static sbyte si8; static char sc; static int Main() { sbyte i8 = -1; char c = (char)i8; System.Console.WriteLine("{0}: {1}", c, ((ushort)c)); if (c == char.MaxValue) System.Console.WriteLine("Pass"); else System.Console.WriteLine("Fail"); si8 = -1; sc = (char)si8; System.Console.WriteLine("{0}: {1}", sc, ((ushort)sc)); if (sc == char.MaxValue) { System.Console.WriteLine("Pass"); return 100; } else { System.Console.WriteLine("Fail"); return 1; } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // class test { static sbyte si8; static char sc; static int Main() { sbyte i8 = -1; char c = (char)i8; System.Console.WriteLine("{0}: {1}", c, ((ushort)c)); if (c == char.MaxValue) System.Console.WriteLine("Pass"); else System.Console.WriteLine("Fail"); si8 = -1; sc = (char)si8; System.Console.WriteLine("{0}: {1}", sc, ((ushort)sc)); if (sc == char.MaxValue) { System.Console.WriteLine("Pass"); return 100; } else { System.Console.WriteLine("Fail"); return 1; } } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/JIT/HardwareIntrinsics/General/Vector128/ConvertToUInt64.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 ConvertToUInt64Double() { var test = new VectorUnaryOpTest__ConvertToUInt64Double(); // 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 VectorUnaryOpTest__ConvertToUInt64Double { private struct DataTable { private byte[] inArray1; private byte[] outArray; private GCHandle inHandle1; private GCHandle outHandle; private ulong alignment; public DataTable(Double[] inArray1, UInt64[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Double>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<UInt64>(); if ((alignment != 32 && 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<Double, 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 Vector128<Double> _fld1; 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>>()); return testStruct; } public void RunStructFldScenario(VectorUnaryOpTest__ConvertToUInt64Double testClass) { var result = Vector128.ConvertToUInt64(_fld1); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, testClass._dataTable.outArrayPtr); } } private static readonly int LargestVectorSize = 16; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double); private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64); private static Double[] _data1 = new Double[Op1ElementCount]; private static Vector128<Double> _clsVar1; private Vector128<Double> _fld1; private DataTable _dataTable; static VectorUnaryOpTest__ConvertToUInt64Double() { 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>>()); } public VectorUnaryOpTest__ConvertToUInt64Double() { 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 < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetDouble(); } _dataTable = new DataTable(_data1, new UInt64[RetElementCount], LargestVectorSize); } public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = Vector128.ConvertToUInt64( Unsafe.Read<Vector128<Double>>(_dataTable.inArray1Ptr) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var method = typeof(Vector128).GetMethod(nameof(Vector128.ConvertToUInt64), new Type[] { typeof(Vector128<Double>) }); if (method is null) { method = typeof(Vector128).GetMethod(nameof(Vector128.ConvertToUInt64), 1, new Type[] { typeof(Vector128<>).MakeGenericType(Type.MakeGenericMethodParameter(0)) }); } if (method.IsGenericMethodDefinition) { method = method.MakeGenericMethod(typeof(UInt64)); } var result = method.Invoke(null, new object[] { Unsafe.Read<Vector128<Double>>(_dataTable.inArray1Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt64>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = Vector128.ConvertToUInt64( _clsVar1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _dataTable.outArrayPtr); } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector128<Double>>(_dataTable.inArray1Ptr); var result = Vector128.ConvertToUInt64(op1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new VectorUnaryOpTest__ConvertToUInt64Double(); var result = Vector128.ConvertToUInt64(test._fld1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, _dataTable.outArrayPtr); } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = Vector128.ConvertToUInt64(_fld1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _dataTable.outArrayPtr); } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = Vector128.ConvertToUInt64(test._fld1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } private void ValidateResult(Vector128<Double> op1, void* result, [CallerMemberName] string method = "") { Double[] inArray1 = new Double[Op1ElementCount]; UInt64[] outArray = new UInt64[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), op1); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>()); ValidateResult(inArray1, outArray, method); } private void ValidateResult(void* op1, void* result, [CallerMemberName] string method = "") { Double[] inArray1 = new Double[Op1ElementCount]; UInt64[] outArray = new UInt64[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<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>()); ValidateResult(inArray1, outArray, method); } private void ValidateResult(Double[] firstOp, UInt64[] result, [CallerMemberName] string method = "") { bool succeeded = true; if (result[0] != (ulong)(firstOp[0])) { succeeded = false; } else { for (var i = 1; i < RetElementCount; i++) { if (result[i] != (ulong)(firstOp[i])) { succeeded = false; break; } } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(Vector128)}.{nameof(Vector128.ConvertToUInt64)}<UInt64>(Vector128<Double>): {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; namespace JIT.HardwareIntrinsics.General { public static partial class Program { private static void ConvertToUInt64Double() { var test = new VectorUnaryOpTest__ConvertToUInt64Double(); // 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 VectorUnaryOpTest__ConvertToUInt64Double { private struct DataTable { private byte[] inArray1; private byte[] outArray; private GCHandle inHandle1; private GCHandle outHandle; private ulong alignment; public DataTable(Double[] inArray1, UInt64[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Double>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<UInt64>(); if ((alignment != 32 && 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<Double, 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 Vector128<Double> _fld1; 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>>()); return testStruct; } public void RunStructFldScenario(VectorUnaryOpTest__ConvertToUInt64Double testClass) { var result = Vector128.ConvertToUInt64(_fld1); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, testClass._dataTable.outArrayPtr); } } private static readonly int LargestVectorSize = 16; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<Double>>() / sizeof(Double); private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt64>>() / sizeof(UInt64); private static Double[] _data1 = new Double[Op1ElementCount]; private static Vector128<Double> _clsVar1; private Vector128<Double> _fld1; private DataTable _dataTable; static VectorUnaryOpTest__ConvertToUInt64Double() { 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>>()); } public VectorUnaryOpTest__ConvertToUInt64Double() { 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 < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetDouble(); } _dataTable = new DataTable(_data1, new UInt64[RetElementCount], LargestVectorSize); } public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = Vector128.ConvertToUInt64( Unsafe.Read<Vector128<Double>>(_dataTable.inArray1Ptr) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var method = typeof(Vector128).GetMethod(nameof(Vector128.ConvertToUInt64), new Type[] { typeof(Vector128<Double>) }); if (method is null) { method = typeof(Vector128).GetMethod(nameof(Vector128.ConvertToUInt64), 1, new Type[] { typeof(Vector128<>).MakeGenericType(Type.MakeGenericMethodParameter(0)) }); } if (method.IsGenericMethodDefinition) { method = method.MakeGenericMethod(typeof(UInt64)); } var result = method.Invoke(null, new object[] { Unsafe.Read<Vector128<Double>>(_dataTable.inArray1Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt64>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = Vector128.ConvertToUInt64( _clsVar1 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _dataTable.outArrayPtr); } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var op1 = Unsafe.Read<Vector128<Double>>(_dataTable.inArray1Ptr); var result = Vector128.ConvertToUInt64(op1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new VectorUnaryOpTest__ConvertToUInt64Double(); var result = Vector128.ConvertToUInt64(test._fld1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, _dataTable.outArrayPtr); } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = Vector128.ConvertToUInt64(_fld1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _dataTable.outArrayPtr); } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = Vector128.ConvertToUInt64(test._fld1); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, _dataTable.outArrayPtr); } public void RunStructFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructFldScenario)); var test = TestStruct.Create(); test.RunStructFldScenario(this); } private void ValidateResult(Vector128<Double> op1, void* result, [CallerMemberName] string method = "") { Double[] inArray1 = new Double[Op1ElementCount]; UInt64[] outArray = new UInt64[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<Double, byte>(ref inArray1[0]), op1); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>()); ValidateResult(inArray1, outArray, method); } private void ValidateResult(void* op1, void* result, [CallerMemberName] string method = "") { Double[] inArray1 = new Double[Op1ElementCount]; UInt64[] outArray = new UInt64[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<UInt64, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<UInt64>>()); ValidateResult(inArray1, outArray, method); } private void ValidateResult(Double[] firstOp, UInt64[] result, [CallerMemberName] string method = "") { bool succeeded = true; if (result[0] != (ulong)(firstOp[0])) { succeeded = false; } else { for (var i = 1; i < RetElementCount; i++) { if (result[i] != (ulong)(firstOp[i])) { succeeded = false; break; } } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(Vector128)}.{nameof(Vector128.ConvertToUInt64)}<UInt64>(Vector128<Double>): {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,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/libraries/System.Net.Http/tests/UnitTests/Fakes/HttpClientHandler.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.Globalization; using System.Net.Http.Headers; using System.Threading; using System.Threading.Tasks; namespace System.Net.Http { public class HttpClientHandler : HttpMessageHandler { public const string Message = "HTTP stack not implemented"; #region Properties public virtual bool SupportsAutomaticDecompression { get { throw NotImplemented.ByDesignWithMessage(Message); } } public virtual bool SupportsProxy { get { throw NotImplemented.ByDesignWithMessage(Message); } } public virtual bool SupportsRedirectConfiguration { get { throw NotImplemented.ByDesignWithMessage(Message); } } public bool UseCookies { get { throw NotImplemented.ByDesignWithMessage(Message); } set { throw NotImplemented.ByDesignWithMessage(Message); } } public CookieContainer CookieContainer { get { throw NotImplemented.ByDesignWithMessage(Message); } set { throw NotImplemented.ByDesignWithMessage(Message); } } public ClientCertificateOption ClientCertificateOptions { get { throw NotImplemented.ByDesignWithMessage(Message); } set { throw NotImplemented.ByDesignWithMessage(Message); } } public DecompressionMethods AutomaticDecompression { get { throw NotImplemented.ByDesignWithMessage(Message); } set { throw NotImplemented.ByDesignWithMessage(Message); } } public bool UseProxy { get { throw NotImplemented.ByDesignWithMessage(Message); } set { throw NotImplemented.ByDesignWithMessage(Message); } } public IWebProxy Proxy { get { throw NotImplemented.ByDesignWithMessage(Message); } set { throw NotImplemented.ByDesignWithMessage(Message); } } public bool PreAuthenticate { get { throw NotImplemented.ByDesignWithMessage(Message); } set { throw NotImplemented.ByDesignWithMessage(Message); } } public bool UseDefaultCredentials { get { throw NotImplemented.ByDesignWithMessage(Message); } set { throw NotImplemented.ByDesignWithMessage(Message); } } public ICredentials Credentials { get { throw NotImplemented.ByDesignWithMessage(Message); } set { throw NotImplemented.ByDesignWithMessage(Message); } } public bool AllowAutoRedirect { get { throw NotImplemented.ByDesignWithMessage(Message); } set { throw NotImplemented.ByDesignWithMessage(Message); } } public int MaxAutomaticRedirections { get { throw NotImplemented.ByDesignWithMessage(Message); } set { throw NotImplemented.ByDesignWithMessage(Message); } } public long MaxRequestContentBufferSize { get { throw NotImplemented.ByDesignWithMessage(Message); } set { throw NotImplemented.ByDesignWithMessage(Message); } } #endregion Properties #region Request Execution protected internal override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { throw NotImplemented.ByDesignWithMessage(Message); } #endregion Request Execution } }
// 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.Globalization; using System.Net.Http.Headers; using System.Threading; using System.Threading.Tasks; namespace System.Net.Http { public class HttpClientHandler : HttpMessageHandler { public const string Message = "HTTP stack not implemented"; #region Properties public virtual bool SupportsAutomaticDecompression { get { throw NotImplemented.ByDesignWithMessage(Message); } } public virtual bool SupportsProxy { get { throw NotImplemented.ByDesignWithMessage(Message); } } public virtual bool SupportsRedirectConfiguration { get { throw NotImplemented.ByDesignWithMessage(Message); } } public bool UseCookies { get { throw NotImplemented.ByDesignWithMessage(Message); } set { throw NotImplemented.ByDesignWithMessage(Message); } } public CookieContainer CookieContainer { get { throw NotImplemented.ByDesignWithMessage(Message); } set { throw NotImplemented.ByDesignWithMessage(Message); } } public ClientCertificateOption ClientCertificateOptions { get { throw NotImplemented.ByDesignWithMessage(Message); } set { throw NotImplemented.ByDesignWithMessage(Message); } } public DecompressionMethods AutomaticDecompression { get { throw NotImplemented.ByDesignWithMessage(Message); } set { throw NotImplemented.ByDesignWithMessage(Message); } } public bool UseProxy { get { throw NotImplemented.ByDesignWithMessage(Message); } set { throw NotImplemented.ByDesignWithMessage(Message); } } public IWebProxy Proxy { get { throw NotImplemented.ByDesignWithMessage(Message); } set { throw NotImplemented.ByDesignWithMessage(Message); } } public bool PreAuthenticate { get { throw NotImplemented.ByDesignWithMessage(Message); } set { throw NotImplemented.ByDesignWithMessage(Message); } } public bool UseDefaultCredentials { get { throw NotImplemented.ByDesignWithMessage(Message); } set { throw NotImplemented.ByDesignWithMessage(Message); } } public ICredentials Credentials { get { throw NotImplemented.ByDesignWithMessage(Message); } set { throw NotImplemented.ByDesignWithMessage(Message); } } public bool AllowAutoRedirect { get { throw NotImplemented.ByDesignWithMessage(Message); } set { throw NotImplemented.ByDesignWithMessage(Message); } } public int MaxAutomaticRedirections { get { throw NotImplemented.ByDesignWithMessage(Message); } set { throw NotImplemented.ByDesignWithMessage(Message); } } public long MaxRequestContentBufferSize { get { throw NotImplemented.ByDesignWithMessage(Message); } set { throw NotImplemented.ByDesignWithMessage(Message); } } #endregion Properties #region Request Execution protected internal override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { throw NotImplemented.ByDesignWithMessage(Message); } #endregion Request Execution } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/JIT/HardwareIntrinsics/X86/Avx2/Shuffle.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; using System.Runtime.Intrinsics.X86; namespace JIT.HardwareIntrinsics.X86 { public static partial class Program { private static void ShuffleSByte() { var test = new SimpleBinaryOpTest__ShuffleSByte(); if (test.IsSupported) { // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); if (Avx.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 (Avx.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 (Avx.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 (Avx.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 (Avx.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 (Avx.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 (Avx.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 (Avx.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__ShuffleSByte { 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 * 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 Vector256<SByte> _fld1; public Vector256<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<Vector256<SByte>, byte>(ref testStruct._fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref testStruct._fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>()); return testStruct; } public void RunStructFldScenario(SimpleBinaryOpTest__ShuffleSByte testClass) { var result = Avx2.Shuffle(_fld1, _fld2); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } public void RunStructFldScenario_Load(SimpleBinaryOpTest__ShuffleSByte testClass) { fixed (Vector256<SByte>* pFld1 = &_fld1) fixed (Vector256<SByte>* pFld2 = &_fld2) { var result = Avx2.Shuffle( Avx.LoadVector256((SByte*)(pFld1)), Avx.LoadVector256((SByte*)(pFld2)) ); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } } } private static readonly int LargestVectorSize = 32; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte); private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte); private static SByte[] _data1 = new SByte[Op1ElementCount]; private static SByte[] _data2 = new SByte[Op2ElementCount]; private static Vector256<SByte> _clsVar1; private static Vector256<SByte> _clsVar2; private Vector256<SByte> _fld1; private Vector256<SByte> _fld2; private DataTable _dataTable; static SimpleBinaryOpTest__ShuffleSByte() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>()); } public SimpleBinaryOpTest__ShuffleSByte() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<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 IsSupported => Avx2.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = Avx2.Shuffle( Unsafe.Read<Vector256<SByte>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector256<SByte>>(_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 = Avx2.Shuffle( Avx.LoadVector256((SByte*)(_dataTable.inArray1Ptr)), Avx.LoadVector256((SByte*)(_dataTable.inArray2Ptr)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunBasicScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned)); var result = Avx2.Shuffle( Avx.LoadAlignedVector256((SByte*)(_dataTable.inArray1Ptr)), Avx.LoadAlignedVector256((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 result = typeof(Avx2).GetMethod(nameof(Avx2.Shuffle), new Type[] { typeof(Vector256<SByte>), typeof(Vector256<SByte>) }) .Invoke(null, new object[] { Unsafe.Read<Vector256<SByte>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector256<SByte>>(_dataTable.inArray2Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector256<SByte>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load)); var result = typeof(Avx2).GetMethod(nameof(Avx2.Shuffle), new Type[] { typeof(Vector256<SByte>), typeof(Vector256<SByte>) }) .Invoke(null, new object[] { Avx.LoadVector256((SByte*)(_dataTable.inArray1Ptr)), Avx.LoadVector256((SByte*)(_dataTable.inArray2Ptr)) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector256<SByte>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned)); var result = typeof(Avx2).GetMethod(nameof(Avx2.Shuffle), new Type[] { typeof(Vector256<SByte>), typeof(Vector256<SByte>) }) .Invoke(null, new object[] { Avx.LoadAlignedVector256((SByte*)(_dataTable.inArray1Ptr)), Avx.LoadAlignedVector256((SByte*)(_dataTable.inArray2Ptr)) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector256<SByte>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = Avx2.Shuffle( _clsVar1, _clsVar2 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } public void RunClsVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load)); fixed (Vector256<SByte>* pClsVar1 = &_clsVar1) fixed (Vector256<SByte>* pClsVar2 = &_clsVar2) { var result = Avx2.Shuffle( Avx.LoadVector256((SByte*)(pClsVar1)), Avx.LoadVector256((SByte*)(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<Vector256<SByte>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector256<SByte>>(_dataTable.inArray2Ptr); var result = Avx2.Shuffle(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunLclVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load)); var op1 = Avx.LoadVector256((SByte*)(_dataTable.inArray1Ptr)); var op2 = Avx.LoadVector256((SByte*)(_dataTable.inArray2Ptr)); var result = Avx2.Shuffle(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunLclVarScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned)); var op1 = Avx.LoadAlignedVector256((SByte*)(_dataTable.inArray1Ptr)); var op2 = Avx.LoadAlignedVector256((SByte*)(_dataTable.inArray2Ptr)); var result = Avx2.Shuffle(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new SimpleBinaryOpTest__ShuffleSByte(); var result = Avx2.Shuffle(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__ShuffleSByte(); fixed (Vector256<SByte>* pFld1 = &test._fld1) fixed (Vector256<SByte>* pFld2 = &test._fld2) { var result = Avx2.Shuffle( Avx.LoadVector256((SByte*)(pFld1)), Avx.LoadVector256((SByte*)(pFld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = Avx2.Shuffle(_fld1, _fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } public void RunClassFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load)); fixed (Vector256<SByte>* pFld1 = &_fld1) fixed (Vector256<SByte>* pFld2 = &_fld2) { var result = Avx2.Shuffle( Avx.LoadVector256((SByte*)(pFld1)), Avx.LoadVector256((SByte*)(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 = Avx2.Shuffle(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 = Avx2.Shuffle( Avx.LoadVector256((SByte*)(&test._fld1)), Avx.LoadVector256((SByte*)(&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(Vector256<SByte> op1, Vector256<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<Vector256<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<Vector256<SByte>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector256<SByte>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(SByte[] left, SByte[] right, SByte[] result, [CallerMemberName] string method = "") { bool succeeded = true; if (result[0] != ((right[0] < 0) ? 0 : left[right[0] & 0x0F])) { succeeded = false; } else { for (var i = 1; i < RetElementCount; i++) { if (result[i] != (i < 16 ? (right[i] < 0 ? 0 : left[right[i] & 0x0F]) : (right[i] < 0 ? 0 : left[(right[i] & 0x0F) + 16]))) { succeeded = false; break; } } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(Avx2)}.{nameof(Avx2.Shuffle)}<SByte>(Vector256<SByte>, Vector256<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; using System.Runtime.Intrinsics.X86; namespace JIT.HardwareIntrinsics.X86 { public static partial class Program { private static void ShuffleSByte() { var test = new SimpleBinaryOpTest__ShuffleSByte(); if (test.IsSupported) { // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); if (Avx.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 (Avx.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 (Avx.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 (Avx.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 (Avx.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 (Avx.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 (Avx.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 (Avx.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__ShuffleSByte { 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 * 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 Vector256<SByte> _fld1; public Vector256<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<Vector256<SByte>, byte>(ref testStruct._fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref testStruct._fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>()); return testStruct; } public void RunStructFldScenario(SimpleBinaryOpTest__ShuffleSByte testClass) { var result = Avx2.Shuffle(_fld1, _fld2); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } public void RunStructFldScenario_Load(SimpleBinaryOpTest__ShuffleSByte testClass) { fixed (Vector256<SByte>* pFld1 = &_fld1) fixed (Vector256<SByte>* pFld2 = &_fld2) { var result = Avx2.Shuffle( Avx.LoadVector256((SByte*)(pFld1)), Avx.LoadVector256((SByte*)(pFld2)) ); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } } } private static readonly int LargestVectorSize = 32; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte); private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<SByte>>() / sizeof(SByte); private static SByte[] _data1 = new SByte[Op1ElementCount]; private static SByte[] _data2 = new SByte[Op2ElementCount]; private static Vector256<SByte> _clsVar1; private static Vector256<SByte> _clsVar2; private Vector256<SByte> _fld1; private Vector256<SByte> _fld2; private DataTable _dataTable; static SimpleBinaryOpTest__ShuffleSByte() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>()); } public SimpleBinaryOpTest__ShuffleSByte() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<SByte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<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 IsSupported => Avx2.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = Avx2.Shuffle( Unsafe.Read<Vector256<SByte>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector256<SByte>>(_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 = Avx2.Shuffle( Avx.LoadVector256((SByte*)(_dataTable.inArray1Ptr)), Avx.LoadVector256((SByte*)(_dataTable.inArray2Ptr)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunBasicScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned)); var result = Avx2.Shuffle( Avx.LoadAlignedVector256((SByte*)(_dataTable.inArray1Ptr)), Avx.LoadAlignedVector256((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 result = typeof(Avx2).GetMethod(nameof(Avx2.Shuffle), new Type[] { typeof(Vector256<SByte>), typeof(Vector256<SByte>) }) .Invoke(null, new object[] { Unsafe.Read<Vector256<SByte>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector256<SByte>>(_dataTable.inArray2Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector256<SByte>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load)); var result = typeof(Avx2).GetMethod(nameof(Avx2.Shuffle), new Type[] { typeof(Vector256<SByte>), typeof(Vector256<SByte>) }) .Invoke(null, new object[] { Avx.LoadVector256((SByte*)(_dataTable.inArray1Ptr)), Avx.LoadVector256((SByte*)(_dataTable.inArray2Ptr)) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector256<SByte>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned)); var result = typeof(Avx2).GetMethod(nameof(Avx2.Shuffle), new Type[] { typeof(Vector256<SByte>), typeof(Vector256<SByte>) }) .Invoke(null, new object[] { Avx.LoadAlignedVector256((SByte*)(_dataTable.inArray1Ptr)), Avx.LoadAlignedVector256((SByte*)(_dataTable.inArray2Ptr)) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector256<SByte>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = Avx2.Shuffle( _clsVar1, _clsVar2 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } public void RunClsVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load)); fixed (Vector256<SByte>* pClsVar1 = &_clsVar1) fixed (Vector256<SByte>* pClsVar2 = &_clsVar2) { var result = Avx2.Shuffle( Avx.LoadVector256((SByte*)(pClsVar1)), Avx.LoadVector256((SByte*)(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<Vector256<SByte>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector256<SByte>>(_dataTable.inArray2Ptr); var result = Avx2.Shuffle(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunLclVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load)); var op1 = Avx.LoadVector256((SByte*)(_dataTable.inArray1Ptr)); var op2 = Avx.LoadVector256((SByte*)(_dataTable.inArray2Ptr)); var result = Avx2.Shuffle(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunLclVarScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned)); var op1 = Avx.LoadAlignedVector256((SByte*)(_dataTable.inArray1Ptr)); var op2 = Avx.LoadAlignedVector256((SByte*)(_dataTable.inArray2Ptr)); var result = Avx2.Shuffle(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new SimpleBinaryOpTest__ShuffleSByte(); var result = Avx2.Shuffle(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__ShuffleSByte(); fixed (Vector256<SByte>* pFld1 = &test._fld1) fixed (Vector256<SByte>* pFld2 = &test._fld2) { var result = Avx2.Shuffle( Avx.LoadVector256((SByte*)(pFld1)), Avx.LoadVector256((SByte*)(pFld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = Avx2.Shuffle(_fld1, _fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } public void RunClassFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load)); fixed (Vector256<SByte>* pFld1 = &_fld1) fixed (Vector256<SByte>* pFld2 = &_fld2) { var result = Avx2.Shuffle( Avx.LoadVector256((SByte*)(pFld1)), Avx.LoadVector256((SByte*)(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 = Avx2.Shuffle(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 = Avx2.Shuffle( Avx.LoadVector256((SByte*)(&test._fld1)), Avx.LoadVector256((SByte*)(&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(Vector256<SByte> op1, Vector256<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<Vector256<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<Vector256<SByte>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector256<SByte>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<SByte>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(SByte[] left, SByte[] right, SByte[] result, [CallerMemberName] string method = "") { bool succeeded = true; if (result[0] != ((right[0] < 0) ? 0 : left[right[0] & 0x0F])) { succeeded = false; } else { for (var i = 1; i < RetElementCount; i++) { if (result[i] != (i < 16 ? (right[i] < 0 ? 0 : left[right[i] & 0x0F]) : (right[i] < 0 ? 0 : left[(right[i] & 0x0F) + 16]))) { succeeded = false; break; } } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(Avx2)}.{nameof(Avx2.Shuffle)}<SByte>(Vector256<SByte>, Vector256<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,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/JIT/HardwareIntrinsics/X86/Avx2_Vector128/Blend.UInt32.85.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 BlendUInt3285() { var test = new ImmBinaryOpTest__BlendUInt3285(); 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(); // 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(); // 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(); } 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 ImmBinaryOpTest__BlendUInt3285 { private struct TestStruct { public Vector128<UInt32> _fld1; public Vector128<UInt32> _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.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref testStruct._fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); return testStruct; } public void RunStructFldScenario(ImmBinaryOpTest__BlendUInt3285 testClass) { var result = Avx2.Blend(_fld1, _fld2, 85); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } } private static readonly int LargestVectorSize = 32; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32); private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32); private static UInt32[] _data1 = new UInt32[Op1ElementCount]; private static UInt32[] _data2 = new UInt32[Op2ElementCount]; private static Vector128<UInt32> _clsVar1; private static Vector128<UInt32> _clsVar2; private Vector128<UInt32> _fld1; private Vector128<UInt32> _fld2; private SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32> _dataTable; static ImmBinaryOpTest__BlendUInt3285() { 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.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); } public ImmBinaryOpTest__BlendUInt3285() { 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.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt32(); } _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], LargestVectorSize); } public bool IsSupported => Avx2.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = Avx2.Blend( Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray2Ptr), 85 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunBasicScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load)); var result = Avx2.Blend( Sse2.LoadVector128((UInt32*)(_dataTable.inArray1Ptr)), Sse2.LoadVector128((UInt32*)(_dataTable.inArray2Ptr)), 85 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunBasicScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned)); var result = Avx2.Blend( Sse2.LoadAlignedVector128((UInt32*)(_dataTable.inArray1Ptr)), Sse2.LoadAlignedVector128((UInt32*)(_dataTable.inArray2Ptr)), 85 ); 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(Avx2).GetMethod(nameof(Avx2.Blend), new Type[] { typeof(Vector128<UInt32>), typeof(Vector128<UInt32>), typeof(byte) }) .Invoke(null, new object[] { Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray2Ptr), (byte)85 }); 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(Avx2).GetMethod(nameof(Avx2.Blend), new Type[] { typeof(Vector128<UInt32>), typeof(Vector128<UInt32>), typeof(byte) }) .Invoke(null, new object[] { Sse2.LoadVector128((UInt32*)(_dataTable.inArray1Ptr)), Sse2.LoadVector128((UInt32*)(_dataTable.inArray2Ptr)), (byte)85 }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt32>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned)); var result = typeof(Avx2).GetMethod(nameof(Avx2.Blend), new Type[] { typeof(Vector128<UInt32>), typeof(Vector128<UInt32>), typeof(byte) }) .Invoke(null, new object[] { Sse2.LoadAlignedVector128((UInt32*)(_dataTable.inArray1Ptr)), Sse2.LoadAlignedVector128((UInt32*)(_dataTable.inArray2Ptr)), (byte)85 }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt32>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = Avx2.Blend( _clsVar1, _clsVar2, 85 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var left = Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray1Ptr); var right = Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray2Ptr); var result = Avx2.Blend(left, right, 85); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(left, right, _dataTable.outArrayPtr); } public void RunLclVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load)); var left = Sse2.LoadVector128((UInt32*)(_dataTable.inArray1Ptr)); var right = Sse2.LoadVector128((UInt32*)(_dataTable.inArray2Ptr)); var result = Avx2.Blend(left, right, 85); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(left, right, _dataTable.outArrayPtr); } public void RunLclVarScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned)); var left = Sse2.LoadAlignedVector128((UInt32*)(_dataTable.inArray1Ptr)); var right = Sse2.LoadAlignedVector128((UInt32*)(_dataTable.inArray2Ptr)); var result = Avx2.Blend(left, right, 85); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(left, right, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new ImmBinaryOpTest__BlendUInt3285(); var result = Avx2.Blend(test._fld1, test._fld2, 85); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = Avx2.Blend(_fld1, _fld2, 85); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = Avx2.Blend(test._fld1, test._fld2, 85); 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 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> left, Vector128<UInt32> right, void* result, [CallerMemberName] string method = "") { UInt32[] inArray1 = new UInt32[Op1ElementCount]; UInt32[] inArray2 = new UInt32[Op2ElementCount]; UInt32[] outArray = new UInt32[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), left); Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), right); 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* left, void* right, void* result, [CallerMemberName] string method = "") { UInt32[] inArray1 = new UInt32[Op1ElementCount]; UInt32[] inArray2 = new UInt32[Op2ElementCount]; UInt32[] outArray = new UInt32[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); 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, UInt32[] right, UInt32[] result, [CallerMemberName] string method = "") { bool succeeded = true; if (result[0] != (((85 & (1 << 0)) == 0) ? left[0] : right[0])) { succeeded = false; } else { for (var i = 1; i < RetElementCount; i++) { if (result[i] != (((85 & (1 << i)) == 0) ? left[i] : right[i])) { succeeded = false; break; } } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(Avx2)}.{nameof(Avx2.Blend)}<UInt32>(Vector128<UInt32>.85, Vector128<UInt32>): {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; using System.Runtime.Intrinsics.X86; namespace JIT.HardwareIntrinsics.X86 { public static partial class Program { private static void BlendUInt3285() { var test = new ImmBinaryOpTest__BlendUInt3285(); 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(); // 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(); // 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(); } 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 ImmBinaryOpTest__BlendUInt3285 { private struct TestStruct { public Vector128<UInt32> _fld1; public Vector128<UInt32> _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.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref testStruct._fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); return testStruct; } public void RunStructFldScenario(ImmBinaryOpTest__BlendUInt3285 testClass) { var result = Avx2.Blend(_fld1, _fld2, 85); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } } private static readonly int LargestVectorSize = 32; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32); private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32); private static UInt32[] _data1 = new UInt32[Op1ElementCount]; private static UInt32[] _data2 = new UInt32[Op2ElementCount]; private static Vector128<UInt32> _clsVar1; private static Vector128<UInt32> _clsVar2; private Vector128<UInt32> _fld1; private Vector128<UInt32> _fld2; private SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32> _dataTable; static ImmBinaryOpTest__BlendUInt3285() { 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.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); } public ImmBinaryOpTest__BlendUInt3285() { 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.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt32(); } _dataTable = new SimpleBinaryOpTest__DataTable<UInt32, UInt32, UInt32>(_data1, _data2, new UInt32[RetElementCount], LargestVectorSize); } public bool IsSupported => Avx2.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = Avx2.Blend( Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray2Ptr), 85 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunBasicScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load)); var result = Avx2.Blend( Sse2.LoadVector128((UInt32*)(_dataTable.inArray1Ptr)), Sse2.LoadVector128((UInt32*)(_dataTable.inArray2Ptr)), 85 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunBasicScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned)); var result = Avx2.Blend( Sse2.LoadAlignedVector128((UInt32*)(_dataTable.inArray1Ptr)), Sse2.LoadAlignedVector128((UInt32*)(_dataTable.inArray2Ptr)), 85 ); 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(Avx2).GetMethod(nameof(Avx2.Blend), new Type[] { typeof(Vector128<UInt32>), typeof(Vector128<UInt32>), typeof(byte) }) .Invoke(null, new object[] { Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray2Ptr), (byte)85 }); 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(Avx2).GetMethod(nameof(Avx2.Blend), new Type[] { typeof(Vector128<UInt32>), typeof(Vector128<UInt32>), typeof(byte) }) .Invoke(null, new object[] { Sse2.LoadVector128((UInt32*)(_dataTable.inArray1Ptr)), Sse2.LoadVector128((UInt32*)(_dataTable.inArray2Ptr)), (byte)85 }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt32>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned)); var result = typeof(Avx2).GetMethod(nameof(Avx2.Blend), new Type[] { typeof(Vector128<UInt32>), typeof(Vector128<UInt32>), typeof(byte) }) .Invoke(null, new object[] { Sse2.LoadAlignedVector128((UInt32*)(_dataTable.inArray1Ptr)), Sse2.LoadAlignedVector128((UInt32*)(_dataTable.inArray2Ptr)), (byte)85 }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<UInt32>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = Avx2.Blend( _clsVar1, _clsVar2, 85 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var left = Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray1Ptr); var right = Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray2Ptr); var result = Avx2.Blend(left, right, 85); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(left, right, _dataTable.outArrayPtr); } public void RunLclVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load)); var left = Sse2.LoadVector128((UInt32*)(_dataTable.inArray1Ptr)); var right = Sse2.LoadVector128((UInt32*)(_dataTable.inArray2Ptr)); var result = Avx2.Blend(left, right, 85); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(left, right, _dataTable.outArrayPtr); } public void RunLclVarScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned)); var left = Sse2.LoadAlignedVector128((UInt32*)(_dataTable.inArray1Ptr)); var right = Sse2.LoadAlignedVector128((UInt32*)(_dataTable.inArray2Ptr)); var result = Avx2.Blend(left, right, 85); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(left, right, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new ImmBinaryOpTest__BlendUInt3285(); var result = Avx2.Blend(test._fld1, test._fld2, 85); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = Avx2.Blend(_fld1, _fld2, 85); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = Avx2.Blend(test._fld1, test._fld2, 85); 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 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> left, Vector128<UInt32> right, void* result, [CallerMemberName] string method = "") { UInt32[] inArray1 = new UInt32[Op1ElementCount]; UInt32[] inArray2 = new UInt32[Op2ElementCount]; UInt32[] outArray = new UInt32[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), left); Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), right); 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* left, void* right, void* result, [CallerMemberName] string method = "") { UInt32[] inArray1 = new UInt32[Op1ElementCount]; UInt32[] inArray2 = new UInt32[Op2ElementCount]; UInt32[] outArray = new UInt32[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(left), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(right), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); 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, UInt32[] right, UInt32[] result, [CallerMemberName] string method = "") { bool succeeded = true; if (result[0] != (((85 & (1 << 0)) == 0) ? left[0] : right[0])) { succeeded = false; } else { for (var i = 1; i < RetElementCount; i++) { if (result[i] != (((85 & (1 << i)) == 0) ? left[i] : right[i])) { succeeded = false; break; } } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(Avx2)}.{nameof(Avx2.Blend)}<UInt32>(Vector128<UInt32>.85, Vector128<UInt32>): {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,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/JIT/CodeGenBringUpTests/JTrueNeDbl_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="JTrueNeDbl.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="JTrueNeDbl.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableStack_1.Enumerator.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.ComponentModel; namespace System.Collections.Immutable { public sealed partial class ImmutableStack<T> { /// <summary> /// Enumerates a stack with no memory allocations. /// </summary> [EditorBrowsable(EditorBrowsableState.Advanced)] public struct Enumerator { /// <summary> /// The original stack being enumerated. /// </summary> private readonly ImmutableStack<T> _originalStack; /// <summary> /// The remaining stack not yet enumerated. /// </summary> private ImmutableStack<T>? _remainingStack; /// <summary> /// Initializes a new instance of the <see cref="Enumerator"/> struct. /// </summary> /// <param name="stack">The stack to enumerator.</param> internal Enumerator(ImmutableStack<T> stack) { Requires.NotNull(stack, nameof(stack)); _originalStack = stack; _remainingStack = null; } /// <summary> /// Gets the current element. /// </summary> public T Current { get { if (_remainingStack == null || _remainingStack.IsEmpty) { throw new InvalidOperationException(); } else { return _remainingStack.Peek(); } } } /// <summary> /// Moves to the first or next element. /// </summary> /// <returns>A value indicating whether there are any more elements.</returns> public bool MoveNext() { if (_remainingStack == null) { // initial move _remainingStack = _originalStack; } else if (!_remainingStack.IsEmpty) { _remainingStack = _remainingStack.Pop(); } return !_remainingStack.IsEmpty; } } /// <summary> /// Enumerates a stack with no memory allocations. /// </summary> private sealed class EnumeratorObject : IEnumerator<T> { /// <summary> /// The original stack being enumerated. /// </summary> private readonly ImmutableStack<T> _originalStack; /// <summary> /// The remaining stack not yet enumerated. /// </summary> private ImmutableStack<T>? _remainingStack; /// <summary> /// A flag indicating whether this enumerator has been disposed. /// </summary> private bool _disposed; /// <summary> /// Initializes a new instance of the <see cref="EnumeratorObject"/> class. /// </summary> /// <param name="stack">The stack to enumerator.</param> internal EnumeratorObject(ImmutableStack<T> stack) { Requires.NotNull(stack, nameof(stack)); _originalStack = stack; } /// <summary> /// Gets the current element. /// </summary> public T Current { get { this.ThrowIfDisposed(); if (_remainingStack == null || _remainingStack.IsEmpty) { throw new InvalidOperationException(); } else { return _remainingStack.Peek(); } } } /// <summary> /// Gets the current element. /// </summary> object? IEnumerator.Current { get { return this.Current; } } /// <summary> /// Moves to the first or next element. /// </summary> /// <returns>A value indicating whether there are any more elements.</returns> public bool MoveNext() { this.ThrowIfDisposed(); if (_remainingStack == null) { // initial move _remainingStack = _originalStack; } else if (!_remainingStack.IsEmpty) { _remainingStack = _remainingStack.Pop(); } return !_remainingStack.IsEmpty; } /// <summary> /// Resets the position to just before the first element in the list. /// </summary> public void Reset() { this.ThrowIfDisposed(); _remainingStack = null; } /// <summary> /// Disposes this instance. /// </summary> public void Dispose() { _disposed = true; } /// <summary> /// Throws an <see cref="ObjectDisposedException"/> if this /// enumerator has already been disposed. /// </summary> private void ThrowIfDisposed() { if (_disposed) { Requires.FailObjectDisposed(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.Collections.Generic; using System.ComponentModel; namespace System.Collections.Immutable { public sealed partial class ImmutableStack<T> { /// <summary> /// Enumerates a stack with no memory allocations. /// </summary> [EditorBrowsable(EditorBrowsableState.Advanced)] public struct Enumerator { /// <summary> /// The original stack being enumerated. /// </summary> private readonly ImmutableStack<T> _originalStack; /// <summary> /// The remaining stack not yet enumerated. /// </summary> private ImmutableStack<T>? _remainingStack; /// <summary> /// Initializes a new instance of the <see cref="Enumerator"/> struct. /// </summary> /// <param name="stack">The stack to enumerator.</param> internal Enumerator(ImmutableStack<T> stack) { Requires.NotNull(stack, nameof(stack)); _originalStack = stack; _remainingStack = null; } /// <summary> /// Gets the current element. /// </summary> public T Current { get { if (_remainingStack == null || _remainingStack.IsEmpty) { throw new InvalidOperationException(); } else { return _remainingStack.Peek(); } } } /// <summary> /// Moves to the first or next element. /// </summary> /// <returns>A value indicating whether there are any more elements.</returns> public bool MoveNext() { if (_remainingStack == null) { // initial move _remainingStack = _originalStack; } else if (!_remainingStack.IsEmpty) { _remainingStack = _remainingStack.Pop(); } return !_remainingStack.IsEmpty; } } /// <summary> /// Enumerates a stack with no memory allocations. /// </summary> private sealed class EnumeratorObject : IEnumerator<T> { /// <summary> /// The original stack being enumerated. /// </summary> private readonly ImmutableStack<T> _originalStack; /// <summary> /// The remaining stack not yet enumerated. /// </summary> private ImmutableStack<T>? _remainingStack; /// <summary> /// A flag indicating whether this enumerator has been disposed. /// </summary> private bool _disposed; /// <summary> /// Initializes a new instance of the <see cref="EnumeratorObject"/> class. /// </summary> /// <param name="stack">The stack to enumerator.</param> internal EnumeratorObject(ImmutableStack<T> stack) { Requires.NotNull(stack, nameof(stack)); _originalStack = stack; } /// <summary> /// Gets the current element. /// </summary> public T Current { get { this.ThrowIfDisposed(); if (_remainingStack == null || _remainingStack.IsEmpty) { throw new InvalidOperationException(); } else { return _remainingStack.Peek(); } } } /// <summary> /// Gets the current element. /// </summary> object? IEnumerator.Current { get { return this.Current; } } /// <summary> /// Moves to the first or next element. /// </summary> /// <returns>A value indicating whether there are any more elements.</returns> public bool MoveNext() { this.ThrowIfDisposed(); if (_remainingStack == null) { // initial move _remainingStack = _originalStack; } else if (!_remainingStack.IsEmpty) { _remainingStack = _remainingStack.Pop(); } return !_remainingStack.IsEmpty; } /// <summary> /// Resets the position to just before the first element in the list. /// </summary> public void Reset() { this.ThrowIfDisposed(); _remainingStack = null; } /// <summary> /// Disposes this instance. /// </summary> public void Dispose() { _disposed = true; } /// <summary> /// Throws an <see cref="ObjectDisposedException"/> if this /// enumerator has already been disposed. /// </summary> private void ThrowIfDisposed() { if (_disposed) { Requires.FailObjectDisposed(this); } } } } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/ComSourceInterfacesAttribute.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; namespace System.Runtime.InteropServices { [AttributeUsage(AttributeTargets.Class, Inherited = true)] [EditorBrowsable(EditorBrowsableState.Never)] public sealed class ComSourceInterfacesAttribute : Attribute { public ComSourceInterfacesAttribute(string sourceInterfaces) { Value = sourceInterfaces; } public ComSourceInterfacesAttribute(Type sourceInterface) { Value = sourceInterface.FullName!; } public ComSourceInterfacesAttribute(Type sourceInterface1, Type sourceInterface2) { Value = sourceInterface1.FullName + "\0" + sourceInterface2.FullName; } public ComSourceInterfacesAttribute(Type sourceInterface1, Type sourceInterface2, Type sourceInterface3) { Value = sourceInterface1.FullName + "\0" + sourceInterface2.FullName + "\0" + sourceInterface3.FullName; } public ComSourceInterfacesAttribute(Type sourceInterface1, Type sourceInterface2, Type sourceInterface3, Type sourceInterface4) { Value = sourceInterface1.FullName + "\0" + sourceInterface2.FullName + "\0" + sourceInterface3.FullName + "\0" + sourceInterface4.FullName; } public string Value { get; } } }
// 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; namespace System.Runtime.InteropServices { [AttributeUsage(AttributeTargets.Class, Inherited = true)] [EditorBrowsable(EditorBrowsableState.Never)] public sealed class ComSourceInterfacesAttribute : Attribute { public ComSourceInterfacesAttribute(string sourceInterfaces) { Value = sourceInterfaces; } public ComSourceInterfacesAttribute(Type sourceInterface) { Value = sourceInterface.FullName!; } public ComSourceInterfacesAttribute(Type sourceInterface1, Type sourceInterface2) { Value = sourceInterface1.FullName + "\0" + sourceInterface2.FullName; } public ComSourceInterfacesAttribute(Type sourceInterface1, Type sourceInterface2, Type sourceInterface3) { Value = sourceInterface1.FullName + "\0" + sourceInterface2.FullName + "\0" + sourceInterface3.FullName; } public ComSourceInterfacesAttribute(Type sourceInterface1, Type sourceInterface2, Type sourceInterface3, Type sourceInterface4) { Value = sourceInterface1.FullName + "\0" + sourceInterface2.FullName + "\0" + sourceInterface3.FullName + "\0" + sourceInterface4.FullName; } public string Value { get; } } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/JIT/Regression/JitBlue/Runtime_64657/Runtime_64657.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; using System.Runtime.CompilerServices; public unsafe class Runtime_64657 { [DllImport("kernel32")] public static extern byte* VirtualAlloc(IntPtr lpAddress, nuint dwSize, uint flAllocationType, uint flProtect); [MethodImpl(MethodImplOptions.NoInlining)] static void Validate<T>(T* c, int x) where T : unmanaged { // this nullcheck should not read more than requested T implicitNullcheck = c[x]; } public static int Main() { if (!OperatingSystem.IsWindows()) return 100; // VirtualAlloc is only for Windows uint length = (uint)Environment.SystemPageSize; byte* ptr = VirtualAlloc(IntPtr.Zero, length, 0x1000 | 0x2000 /* reserve commit */, 0x04 /*readonly guard*/); Validate((byte*)(ptr + length - sizeof(byte)), 0); Validate((sbyte*)(ptr + length - sizeof(sbyte)), 0); Validate((bool*)(ptr + length - sizeof(bool)), 0); Validate((ushort*)(ptr + length - sizeof(ushort)), 0); Validate((short*)(ptr + length - sizeof(short)), 0); Validate((uint*)(ptr + length - sizeof(uint)), 0); Validate((int*)(ptr + length - sizeof(int)), 0); Validate((ulong*)(ptr + length - sizeof(ulong)), 0); Validate((long*)(ptr + length - sizeof(long)), 0); Validate((nint*)(ptr + length - sizeof(nint)), 0); Validate((nuint*)(ptr + length - sizeof(nuint)), 0); Validate((S1*)(ptr + length - sizeof(S1)), 0); Validate((S2*)(ptr + length - sizeof(S2)), 0); Validate((S3*)(ptr + length - sizeof(S3)), 0); Validate((S4*)(ptr + length - sizeof(S4)), 0); TestStructures(); return 100; } private static void TestStructures() { S1 s1 = new S1(); TestS1_1(ref s1); TestS1_2(ref s1); S2 s2 = new S2(); TestS2_1(ref s2); TestS2_2(ref s2); S3 s3 = new S3(); TestS3_1(ref s3); TestS3_2(ref s3); S4 s4 = new S4(); TestS4_1(ref s4); TestS4_2(ref s4); S5 s5 = new S5 { a1 = "1", a2 = "2" }; TestS5_1(ref s5); TestS5_2(ref s5); } [MethodImpl(MethodImplOptions.NoInlining)] static void TestS1_1(ref S1 s) { var _ = s.a1; } [MethodImpl(MethodImplOptions.NoInlining)] static void TestS1_2(ref S1 s) { var _ = s.a2; } [MethodImpl(MethodImplOptions.NoInlining)] static void TestS2_1(ref S2 s) { var _ = s.a1; } [MethodImpl(MethodImplOptions.NoInlining)] static void TestS2_2(ref S2 s) { var _ = s.a2; } [MethodImpl(MethodImplOptions.NoInlining)] static void TestS3_1(ref S3 s) { var _ = s.a1; } [MethodImpl(MethodImplOptions.NoInlining)] static void TestS3_2(ref S3 s) { var _ = s.a2; } [MethodImpl(MethodImplOptions.NoInlining)] static void TestS4_1(ref S4 s) { var _ = s.a1; } [MethodImpl(MethodImplOptions.NoInlining)] static void TestS4_2(ref S4 s) { var _ = s.a2; } [MethodImpl(MethodImplOptions.NoInlining)] static void TestS5_1(ref S5 s) { var _ = s.a1; } [MethodImpl(MethodImplOptions.NoInlining)] static void TestS5_2(ref S5 s) { var _ = s.a2; } public struct S1 { public byte a1; public byte a2; } public struct S2 { public short a1; public short a2; } public struct S3 { public int a1; public int a2; } public struct S4 { public long a1; public long a2; } public struct S5 { public string a1; public string 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.Runtime.InteropServices; using System.Runtime.CompilerServices; public unsafe class Runtime_64657 { [DllImport("kernel32")] public static extern byte* VirtualAlloc(IntPtr lpAddress, nuint dwSize, uint flAllocationType, uint flProtect); [MethodImpl(MethodImplOptions.NoInlining)] static void Validate<T>(T* c, int x) where T : unmanaged { // this nullcheck should not read more than requested T implicitNullcheck = c[x]; } public static int Main() { if (!OperatingSystem.IsWindows()) return 100; // VirtualAlloc is only for Windows uint length = (uint)Environment.SystemPageSize; byte* ptr = VirtualAlloc(IntPtr.Zero, length, 0x1000 | 0x2000 /* reserve commit */, 0x04 /*readonly guard*/); Validate((byte*)(ptr + length - sizeof(byte)), 0); Validate((sbyte*)(ptr + length - sizeof(sbyte)), 0); Validate((bool*)(ptr + length - sizeof(bool)), 0); Validate((ushort*)(ptr + length - sizeof(ushort)), 0); Validate((short*)(ptr + length - sizeof(short)), 0); Validate((uint*)(ptr + length - sizeof(uint)), 0); Validate((int*)(ptr + length - sizeof(int)), 0); Validate((ulong*)(ptr + length - sizeof(ulong)), 0); Validate((long*)(ptr + length - sizeof(long)), 0); Validate((nint*)(ptr + length - sizeof(nint)), 0); Validate((nuint*)(ptr + length - sizeof(nuint)), 0); Validate((S1*)(ptr + length - sizeof(S1)), 0); Validate((S2*)(ptr + length - sizeof(S2)), 0); Validate((S3*)(ptr + length - sizeof(S3)), 0); Validate((S4*)(ptr + length - sizeof(S4)), 0); TestStructures(); return 100; } private static void TestStructures() { S1 s1 = new S1(); TestS1_1(ref s1); TestS1_2(ref s1); S2 s2 = new S2(); TestS2_1(ref s2); TestS2_2(ref s2); S3 s3 = new S3(); TestS3_1(ref s3); TestS3_2(ref s3); S4 s4 = new S4(); TestS4_1(ref s4); TestS4_2(ref s4); S5 s5 = new S5 { a1 = "1", a2 = "2" }; TestS5_1(ref s5); TestS5_2(ref s5); } [MethodImpl(MethodImplOptions.NoInlining)] static void TestS1_1(ref S1 s) { var _ = s.a1; } [MethodImpl(MethodImplOptions.NoInlining)] static void TestS1_2(ref S1 s) { var _ = s.a2; } [MethodImpl(MethodImplOptions.NoInlining)] static void TestS2_1(ref S2 s) { var _ = s.a1; } [MethodImpl(MethodImplOptions.NoInlining)] static void TestS2_2(ref S2 s) { var _ = s.a2; } [MethodImpl(MethodImplOptions.NoInlining)] static void TestS3_1(ref S3 s) { var _ = s.a1; } [MethodImpl(MethodImplOptions.NoInlining)] static void TestS3_2(ref S3 s) { var _ = s.a2; } [MethodImpl(MethodImplOptions.NoInlining)] static void TestS4_1(ref S4 s) { var _ = s.a1; } [MethodImpl(MethodImplOptions.NoInlining)] static void TestS4_2(ref S4 s) { var _ = s.a2; } [MethodImpl(MethodImplOptions.NoInlining)] static void TestS5_1(ref S5 s) { var _ = s.a1; } [MethodImpl(MethodImplOptions.NoInlining)] static void TestS5_2(ref S5 s) { var _ = s.a2; } public struct S1 { public byte a1; public byte a2; } public struct S2 { public short a1; public short a2; } public struct S3 { public int a1; public int a2; } public struct S4 { public long a1; public long a2; } public struct S5 { public string a1; public string a2; } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/libraries/System.ComponentModel.Composition/tests/System/Integration/ExportProviderEventTests.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.ComponentModel.Composition.Factories; using System.ComponentModel.Composition.Hosting; using System.ComponentModel.Composition.Primitives; using System.Linq; using Xunit; namespace System.ComponentModel.Composition { public class ExportProviderEventTests { [Fact] public void BatchAdd_ShouldFireEvents() { var container = ContainerFactory.Create(); var eventListener = new ExportProviderListener(container, container); var batch = new CompositionBatch(); batch.AddExportedValue<object>("MyExport", new object()); eventListener.VerifyCompose(batch); } [Fact] public void BatchRemove_ShouldFireEvents() { var container = ContainerFactory.Create(); var batch = new CompositionBatch(); var exportPart = batch.AddExportedValue<object>("MyExport", new object()); container.Compose(batch); var eventListener = new ExportProviderListener(container, container); batch = new CompositionBatch(); batch.RemovePart(exportPart); eventListener.VerifyCompose(batch); } [Fact] public void BatchAddRemove_ShouldFireEvents() { var container = ContainerFactory.Create(); var batch = new CompositionBatch(); var exportPart = batch.AddExportedValue<object>("MyExport", new object()); container.Compose(batch); var eventListener = new ExportProviderListener(container, container); batch = new CompositionBatch(); batch.RemovePart(exportPart); batch.AddExportedValue<object>("MyExport2", new object()); eventListener.VerifyCompose(batch); } [Fact] public void BatchMultipleAdds_ShouldFireEvents() { var container = ContainerFactory.Create(); var eventListener = new ExportProviderListener(container, container); var batch = new CompositionBatch(); batch.AddExportedValue<object>("MyExport", new object()); batch.AddExportedValue<object>("MyExport2", new object()); batch.AddExportedValue<object>("MyExport3", new object()); eventListener.VerifyCompose(batch); } [Fact] public void BatchNestedContainerAdds_ShouldFireEvents() { var parentContainer = ContainerFactory.Create(); var container = ContainerFactory.Create(parentContainer); var eventListener = new ExportProviderListener(parentContainer, container); var batch = new CompositionBatch(); batch.AddExportedValue<object>("MyExport", new object()); eventListener.VerifyCompose(batch); } [Export] public class SampleCatalogExport { } [Fact] public void CatalogAdd_ShouldFireEvents() { var catalog = new TypeCatalog(typeof(SampleCatalogExport)); var aggCat = new AggregateCatalog(); var container = ContainerFactory.Create(aggCat); var eventListener = new ExportProviderListener(container, container); eventListener.VerifyCatalogAdd(() => aggCat.Catalogs.Add(catalog), typeof(SampleCatalogExport)); } [Fact] public void CatalogRemove_ShouldFireEvents() { var catalog = new TypeCatalog(typeof(SampleCatalogExport)); var aggCat = new AggregateCatalog(); var container = ContainerFactory.Create(aggCat); aggCat.Catalogs.Add(catalog); var eventListener = new ExportProviderListener(container, container); eventListener.VerifyCatalogRemove(() => aggCat.Catalogs.Remove(catalog), typeof(SampleCatalogExport)); } [Fact] public void CatalogNestedContainerAdds_ShouldFireEvents() { var catalog = new TypeCatalog(typeof(SampleCatalogExport)); var aggCat = new AggregateCatalog(); var parentContainer = ContainerFactory.Create(aggCat); var container = ContainerFactory.Create(parentContainer); var eventListener = new ExportProviderListener(parentContainer, container); eventListener.VerifyCatalogAdd(() => aggCat.Catalogs.Add(catalog), typeof(SampleCatalogExport)); } public class ExportProviderListener { private CompositionContainer _container; private ExportProvider _watchedProvider; private string[] _expectedAdds; private string[] _expectedRemoves; private int _changedEventCount; private int _changingEventCount; public ExportProviderListener(CompositionContainer container, ExportProvider watchExportProvider) { watchExportProvider.ExportsChanged += OnExportsChanged; watchExportProvider.ExportsChanging += OnExportsChanging; this._watchedProvider = watchExportProvider; this._container = container; } public void VerifyCompose(CompositionBatch batch) { this._expectedAdds = GetContractNames(batch.PartsToAdd); this._expectedRemoves = GetContractNames(batch.PartsToRemove); this._container.Compose(batch); Assert.True(this._changingEventCount == 1); Assert.True(this._changedEventCount == 1); ResetState(); } public void VerifyCatalogAdd(Action doAdd, params Type[] expectedTypesAdded) { this._expectedAdds = GetContractNames(expectedTypesAdded); doAdd(); Assert.True(this._changingEventCount == 1); Assert.True(this._changedEventCount == 1); ResetState(); } public void VerifyCatalogRemove(Action doRemove, params Type[] expectedTypesRemoved) { this._expectedRemoves = GetContractNames(expectedTypesRemoved); doRemove(); Assert.True(this._changingEventCount == 1); Assert.True(this._changedEventCount == 1); ResetState(); } public void OnExportsChanging(object sender, ExportsChangeEventArgs args) { Assert.True(this._expectedAdds != null || this._expectedRemoves != null); if (this._expectedAdds == null) { Assert.Empty(args.AddedExports); } else { Assert.All(_expectedAdds, add => { Assert.False(this._container.IsPresent(add)); }); } if (this._expectedRemoves == null) { Assert.Empty(args.RemovedExports); } else { Assert.All(_expectedRemoves, remove => { Assert.True(this._container.IsPresent(remove)); }); } this._changingEventCount++; } public void OnExportsChanged(object sender, ExportsChangeEventArgs args) { Assert.True(this._expectedAdds != null || this._expectedRemoves != null); if (this._expectedAdds == null) { Assert.Empty(args.AddedExports); } else { Assert.All(_expectedAdds, add => { Assert.True(this._container.IsPresent(add)); }); } if (this._expectedRemoves == null) { Assert.Empty(args.RemovedExports); } else { Assert.All(_expectedRemoves, remove => { Assert.False(this._container.IsPresent(remove)); }); } Assert.Null(args.AtomicComposition); this._changedEventCount++; } private void ResetState() { this._expectedAdds = null; this._expectedRemoves = null; this._changedEventCount = 0; this._changingEventCount = 0; } private static string[] GetContractNames(IEnumerable<ExportDefinition> definitions) { return definitions.Select(e => e.ContractName).ToArray(); } private static string[] GetContractNames(IEnumerable<ComposablePart> parts) { return GetContractNames(parts.SelectMany(p => p.ExportDefinitions)); } private static string[] GetContractNames(IEnumerable<Type> types) { return GetContractNames(types.Select(t => AttributedModelServices.CreatePartDefinition(t, null)).SelectMany(p => p.ExportDefinitions)); } } } }
// 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.ComponentModel.Composition.Factories; using System.ComponentModel.Composition.Hosting; using System.ComponentModel.Composition.Primitives; using System.Linq; using Xunit; namespace System.ComponentModel.Composition { public class ExportProviderEventTests { [Fact] public void BatchAdd_ShouldFireEvents() { var container = ContainerFactory.Create(); var eventListener = new ExportProviderListener(container, container); var batch = new CompositionBatch(); batch.AddExportedValue<object>("MyExport", new object()); eventListener.VerifyCompose(batch); } [Fact] public void BatchRemove_ShouldFireEvents() { var container = ContainerFactory.Create(); var batch = new CompositionBatch(); var exportPart = batch.AddExportedValue<object>("MyExport", new object()); container.Compose(batch); var eventListener = new ExportProviderListener(container, container); batch = new CompositionBatch(); batch.RemovePart(exportPart); eventListener.VerifyCompose(batch); } [Fact] public void BatchAddRemove_ShouldFireEvents() { var container = ContainerFactory.Create(); var batch = new CompositionBatch(); var exportPart = batch.AddExportedValue<object>("MyExport", new object()); container.Compose(batch); var eventListener = new ExportProviderListener(container, container); batch = new CompositionBatch(); batch.RemovePart(exportPart); batch.AddExportedValue<object>("MyExport2", new object()); eventListener.VerifyCompose(batch); } [Fact] public void BatchMultipleAdds_ShouldFireEvents() { var container = ContainerFactory.Create(); var eventListener = new ExportProviderListener(container, container); var batch = new CompositionBatch(); batch.AddExportedValue<object>("MyExport", new object()); batch.AddExportedValue<object>("MyExport2", new object()); batch.AddExportedValue<object>("MyExport3", new object()); eventListener.VerifyCompose(batch); } [Fact] public void BatchNestedContainerAdds_ShouldFireEvents() { var parentContainer = ContainerFactory.Create(); var container = ContainerFactory.Create(parentContainer); var eventListener = new ExportProviderListener(parentContainer, container); var batch = new CompositionBatch(); batch.AddExportedValue<object>("MyExport", new object()); eventListener.VerifyCompose(batch); } [Export] public class SampleCatalogExport { } [Fact] public void CatalogAdd_ShouldFireEvents() { var catalog = new TypeCatalog(typeof(SampleCatalogExport)); var aggCat = new AggregateCatalog(); var container = ContainerFactory.Create(aggCat); var eventListener = new ExportProviderListener(container, container); eventListener.VerifyCatalogAdd(() => aggCat.Catalogs.Add(catalog), typeof(SampleCatalogExport)); } [Fact] public void CatalogRemove_ShouldFireEvents() { var catalog = new TypeCatalog(typeof(SampleCatalogExport)); var aggCat = new AggregateCatalog(); var container = ContainerFactory.Create(aggCat); aggCat.Catalogs.Add(catalog); var eventListener = new ExportProviderListener(container, container); eventListener.VerifyCatalogRemove(() => aggCat.Catalogs.Remove(catalog), typeof(SampleCatalogExport)); } [Fact] public void CatalogNestedContainerAdds_ShouldFireEvents() { var catalog = new TypeCatalog(typeof(SampleCatalogExport)); var aggCat = new AggregateCatalog(); var parentContainer = ContainerFactory.Create(aggCat); var container = ContainerFactory.Create(parentContainer); var eventListener = new ExportProviderListener(parentContainer, container); eventListener.VerifyCatalogAdd(() => aggCat.Catalogs.Add(catalog), typeof(SampleCatalogExport)); } public class ExportProviderListener { private CompositionContainer _container; private ExportProvider _watchedProvider; private string[] _expectedAdds; private string[] _expectedRemoves; private int _changedEventCount; private int _changingEventCount; public ExportProviderListener(CompositionContainer container, ExportProvider watchExportProvider) { watchExportProvider.ExportsChanged += OnExportsChanged; watchExportProvider.ExportsChanging += OnExportsChanging; this._watchedProvider = watchExportProvider; this._container = container; } public void VerifyCompose(CompositionBatch batch) { this._expectedAdds = GetContractNames(batch.PartsToAdd); this._expectedRemoves = GetContractNames(batch.PartsToRemove); this._container.Compose(batch); Assert.True(this._changingEventCount == 1); Assert.True(this._changedEventCount == 1); ResetState(); } public void VerifyCatalogAdd(Action doAdd, params Type[] expectedTypesAdded) { this._expectedAdds = GetContractNames(expectedTypesAdded); doAdd(); Assert.True(this._changingEventCount == 1); Assert.True(this._changedEventCount == 1); ResetState(); } public void VerifyCatalogRemove(Action doRemove, params Type[] expectedTypesRemoved) { this._expectedRemoves = GetContractNames(expectedTypesRemoved); doRemove(); Assert.True(this._changingEventCount == 1); Assert.True(this._changedEventCount == 1); ResetState(); } public void OnExportsChanging(object sender, ExportsChangeEventArgs args) { Assert.True(this._expectedAdds != null || this._expectedRemoves != null); if (this._expectedAdds == null) { Assert.Empty(args.AddedExports); } else { Assert.All(_expectedAdds, add => { Assert.False(this._container.IsPresent(add)); }); } if (this._expectedRemoves == null) { Assert.Empty(args.RemovedExports); } else { Assert.All(_expectedRemoves, remove => { Assert.True(this._container.IsPresent(remove)); }); } this._changingEventCount++; } public void OnExportsChanged(object sender, ExportsChangeEventArgs args) { Assert.True(this._expectedAdds != null || this._expectedRemoves != null); if (this._expectedAdds == null) { Assert.Empty(args.AddedExports); } else { Assert.All(_expectedAdds, add => { Assert.True(this._container.IsPresent(add)); }); } if (this._expectedRemoves == null) { Assert.Empty(args.RemovedExports); } else { Assert.All(_expectedRemoves, remove => { Assert.False(this._container.IsPresent(remove)); }); } Assert.Null(args.AtomicComposition); this._changedEventCount++; } private void ResetState() { this._expectedAdds = null; this._expectedRemoves = null; this._changedEventCount = 0; this._changingEventCount = 0; } private static string[] GetContractNames(IEnumerable<ExportDefinition> definitions) { return definitions.Select(e => e.ContractName).ToArray(); } private static string[] GetContractNames(IEnumerable<ComposablePart> parts) { return GetContractNames(parts.SelectMany(p => p.ExportDefinitions)); } private static string[] GetContractNames(IEnumerable<Type> types) { return GetContractNames(types.Select(t => AttributedModelServices.CreatePartDefinition(t, null)).SelectMany(p => p.ExportDefinitions)); } } } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/JIT/opt/OSR/livelocalstackalloc.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <DebugType /> <Optimize>True</Optimize> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> </PropertyGroup> <ItemGroup> <Compile Include="$(MSBuildProjectName).cs" /> </ItemGroup> <PropertyGroup> <CLRTestBatchPreCommands><![CDATA[ $(CLRTestBatchPreCommands) set COMPlus_TieredCompilation=1 set COMPlus_TC_QuickJitForLoops=1 set COMPlus_TC_OnStackReplacement=1 ]]></CLRTestBatchPreCommands> <BashCLRTestPreCommands><![CDATA[ $(BashCLRTestPreCommands) export COMPlus_TieredCompilation=1 export COMPlus_TC_QuickJitForLoops=1 export COMPlus_TC_OnStackReplacement=1 ]]></BashCLRTestPreCommands> </PropertyGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <DebugType /> <Optimize>True</Optimize> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> </PropertyGroup> <ItemGroup> <Compile Include="$(MSBuildProjectName).cs" /> </ItemGroup> <PropertyGroup> <CLRTestBatchPreCommands><![CDATA[ $(CLRTestBatchPreCommands) set COMPlus_TieredCompilation=1 set COMPlus_TC_QuickJitForLoops=1 set COMPlus_TC_OnStackReplacement=1 ]]></CLRTestBatchPreCommands> <BashCLRTestPreCommands><![CDATA[ $(BashCLRTestPreCommands) export COMPlus_TieredCompilation=1 export COMPlus_TC_QuickJitForLoops=1 export COMPlus_TC_OnStackReplacement=1 ]]></BashCLRTestPreCommands> </PropertyGroup> </Project>
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/libraries/System.Net.NetworkInformation/src/System/Net/NetworkInformation/SystemIPInterfaceStatistics.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.Net.NetworkInformation { internal sealed class SystemIPInterfaceStatistics : IPInterfaceStatistics { private readonly Interop.IpHlpApi.MibIfRow2 _ifRow; internal SystemIPInterfaceStatistics(long index) { _ifRow = GetIfEntry2(index); } public override long OutputQueueLength { get { return (long)_ifRow.outQLen; } } public override long BytesSent { get { return (long)_ifRow.outOctets; } } public override long BytesReceived { get { return (long)_ifRow.inOctets; } } public override long UnicastPacketsSent { get { return (long)_ifRow.outUcastPkts; } } public override long UnicastPacketsReceived { get { return (long)_ifRow.inUcastPkts; } } public override long NonUnicastPacketsSent { get { return (long)_ifRow.outNUcastPkts; } } public override long NonUnicastPacketsReceived { get { return (long)_ifRow.inNUcastPkts; } } public override long IncomingPacketsDiscarded { get { return (long)_ifRow.inDiscards; } } public override long OutgoingPacketsDiscarded { get { return (long)_ifRow.outDiscards; } } public override long IncomingPacketsWithErrors { get { return (long)_ifRow.inErrors; } } public override long OutgoingPacketsWithErrors { get { return (long)_ifRow.outErrors; } } public override long IncomingUnknownProtocolPackets { get { return (long)_ifRow.inUnknownProtos; } } internal static Interop.IpHlpApi.MibIfRow2 GetIfEntry2(long index) { Interop.IpHlpApi.MibIfRow2 ifRow = default; if (index == 0) { return ifRow; } ifRow.interfaceIndex = (uint)index; uint result = Interop.IpHlpApi.GetIfEntry2(ref ifRow); if (result != Interop.IpHlpApi.ERROR_SUCCESS) { throw new NetworkInformationException((int)result); } return ifRow; } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. namespace System.Net.NetworkInformation { internal sealed class SystemIPInterfaceStatistics : IPInterfaceStatistics { private readonly Interop.IpHlpApi.MibIfRow2 _ifRow; internal SystemIPInterfaceStatistics(long index) { _ifRow = GetIfEntry2(index); } public override long OutputQueueLength { get { return (long)_ifRow.outQLen; } } public override long BytesSent { get { return (long)_ifRow.outOctets; } } public override long BytesReceived { get { return (long)_ifRow.inOctets; } } public override long UnicastPacketsSent { get { return (long)_ifRow.outUcastPkts; } } public override long UnicastPacketsReceived { get { return (long)_ifRow.inUcastPkts; } } public override long NonUnicastPacketsSent { get { return (long)_ifRow.outNUcastPkts; } } public override long NonUnicastPacketsReceived { get { return (long)_ifRow.inNUcastPkts; } } public override long IncomingPacketsDiscarded { get { return (long)_ifRow.inDiscards; } } public override long OutgoingPacketsDiscarded { get { return (long)_ifRow.outDiscards; } } public override long IncomingPacketsWithErrors { get { return (long)_ifRow.inErrors; } } public override long OutgoingPacketsWithErrors { get { return (long)_ifRow.outErrors; } } public override long IncomingUnknownProtocolPackets { get { return (long)_ifRow.inUnknownProtos; } } internal static Interop.IpHlpApi.MibIfRow2 GetIfEntry2(long index) { Interop.IpHlpApi.MibIfRow2 ifRow = default; if (index == 0) { return ifRow; } ifRow.interfaceIndex = (uint)index; uint result = Interop.IpHlpApi.GetIfEntry2(ref ifRow); if (result != Interop.IpHlpApi.ERROR_SUCCESS) { throw new NetworkInformationException((int)result); } return ifRow; } } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/GC/Scenarios/FragMan/fragman.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <GCStressIncompatible>true</GCStressIncompatible> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <ItemGroup> <Compile Include="fragman.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <GCStressIncompatible>true</GCStressIncompatible> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <ItemGroup> <Compile Include="fragman.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/JIT/CodeGenBringUpTests/AsgSub1.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; public class BringUpTest_AsgSub1 { const int Pass = 100; const int Fail = -1; [MethodImplAttribute(MethodImplOptions.NoInlining)] public static int AsgSub1(int x) { x -= 1; return x; } public static int Main() { if (AsgSub1(1) == 0) return Pass; else return Fail; } }
// 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; public class BringUpTest_AsgSub1 { const int Pass = 100; const int Fail = -1; [MethodImplAttribute(MethodImplOptions.NoInlining)] public static int AsgSub1(int x) { x -= 1; return x; } public static int Main() { if (AsgSub1(1) == 0) return Pass; else return Fail; } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/libraries/System.Private.CoreLib/src/System/Security/SecureString.Windows.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.Runtime.InteropServices; using System.Security.Cryptography; namespace System.Security { public sealed partial class SecureString { private static int GetAlignedByteSize(int length) { int byteSize = Math.Max(length, 1) * sizeof(char); const int blockSize = (int)Interop.Crypt32.CRYPTPROTECTMEMORY_BLOCK_SIZE; return ((byteSize + (blockSize - 1)) / blockSize) * blockSize; } private void ProtectMemory() { Debug.Assert(_buffer != null); Debug.Assert(!_buffer.IsInvalid, "Invalid buffer!"); if (_decryptedLength != 0 && !_encrypted && !Interop.Crypt32.CryptProtectMemory(_buffer, (uint)_buffer.ByteLength, Interop.Crypt32.CRYPTPROTECTMEMORY_SAME_PROCESS)) { throw new CryptographicException(Marshal.GetLastPInvokeError()); } _encrypted = true; } private void UnprotectMemory() { Debug.Assert(_buffer != null); Debug.Assert(!_buffer.IsInvalid, "Invalid buffer!"); if (_decryptedLength != 0 && _encrypted && !Interop.Crypt32.CryptUnprotectMemory(_buffer, (uint)_buffer.ByteLength, Interop.Crypt32.CRYPTPROTECTMEMORY_SAME_PROCESS)) { throw new CryptographicException(Marshal.GetLastPInvokeError()); } _encrypted = 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 System.Runtime.InteropServices; using System.Security.Cryptography; namespace System.Security { public sealed partial class SecureString { private static int GetAlignedByteSize(int length) { int byteSize = Math.Max(length, 1) * sizeof(char); const int blockSize = (int)Interop.Crypt32.CRYPTPROTECTMEMORY_BLOCK_SIZE; return ((byteSize + (blockSize - 1)) / blockSize) * blockSize; } private void ProtectMemory() { Debug.Assert(_buffer != null); Debug.Assert(!_buffer.IsInvalid, "Invalid buffer!"); if (_decryptedLength != 0 && !_encrypted && !Interop.Crypt32.CryptProtectMemory(_buffer, (uint)_buffer.ByteLength, Interop.Crypt32.CRYPTPROTECTMEMORY_SAME_PROCESS)) { throw new CryptographicException(Marshal.GetLastPInvokeError()); } _encrypted = true; } private void UnprotectMemory() { Debug.Assert(_buffer != null); Debug.Assert(!_buffer.IsInvalid, "Invalid buffer!"); if (_decryptedLength != 0 && _encrypted && !Interop.Crypt32.CryptUnprotectMemory(_buffer, (uint)_buffer.ByteLength, Interop.Crypt32.CRYPTPROTECTMEMORY_SAME_PROCESS)) { throw new CryptographicException(Marshal.GetLastPInvokeError()); } _encrypted = false; } } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/JIT/Methodical/eh/basics/tryfinally_do.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>Full</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="tryfinally.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\..\..\common\eh_common.csproj" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>Full</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="tryfinally.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\..\..\common\eh_common.csproj" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/JIT/HardwareIntrinsics/Arm/Crc32/Crc32_r.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> </PropertyGroup> <PropertyGroup> <DebugType>Embedded</DebugType> <Optimize /> </PropertyGroup> <ItemGroup> <Compile Include="ComputeCrc32.Byte.cs" /> <Compile Include="ComputeCrc32.UInt16.cs" /> <Compile Include="ComputeCrc32.UInt32.cs" /> <Compile Include="ComputeCrc32C.Byte.cs" /> <Compile Include="ComputeCrc32C.UInt16.cs" /> <Compile Include="ComputeCrc32C.UInt32.cs" /> <Compile Include="Program.Crc32.cs" /> <Compile Include="..\Shared\Helpers.cs" /> <Compile Include="..\Shared\Program.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="ComputeCrc32.Byte.cs" /> <Compile Include="ComputeCrc32.UInt16.cs" /> <Compile Include="ComputeCrc32.UInt32.cs" /> <Compile Include="ComputeCrc32C.Byte.cs" /> <Compile Include="ComputeCrc32C.UInt16.cs" /> <Compile Include="ComputeCrc32C.UInt32.cs" /> <Compile Include="Program.Crc32.cs" /> <Compile Include="..\Shared\Helpers.cs" /> <Compile Include="..\Shared\Program.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/libraries/System.Data.Odbc/src/System/Data/Odbc/OdbcError.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 { [Serializable] [System.Runtime.CompilerServices.TypeForwardedFrom("System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public sealed class OdbcError { //Data internal string _message; internal string _state; internal int _nativeerror; internal string? _source; internal OdbcError(string? source, string message, string state, int nativeerror) { _source = source; _message = message; _state = state; _nativeerror = nativeerror; } public string Message { get { return ((null != _message) ? _message : string.Empty); } } public string SQLState { get { return _state; } } public int NativeError { get { return _nativeerror; } } public string Source { get { return ((null != _source) ? _source : string.Empty); } } internal void SetSource(string Source) { _source = Source; } public override string ToString() { return Message; } } }
// 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 { [Serializable] [System.Runtime.CompilerServices.TypeForwardedFrom("System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089")] public sealed class OdbcError { //Data internal string _message; internal string _state; internal int _nativeerror; internal string? _source; internal OdbcError(string? source, string message, string state, int nativeerror) { _source = source; _message = message; _state = state; _nativeerror = nativeerror; } public string Message { get { return ((null != _message) ? _message : string.Empty); } } public string SQLState { get { return _state; } } public int NativeError { get { return _nativeerror; } } public string Source { get { return ((null != _source) ? _source : string.Empty); } } internal void SetSource(string Source) { _source = Source; } public override string ToString() { return Message; } } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/common/DirectoryException.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.Text; using System.Runtime.Serialization; namespace System.DirectoryServices.Protocols { [Serializable] [System.Runtime.CompilerServices.TypeForwardedFrom("System.DirectoryServices.Protocols, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] public class DirectoryException : Exception { protected DirectoryException(SerializationInfo info, StreamingContext context) : base(info, context) { } public DirectoryException(string message, Exception inner) : base(message, inner) { } public DirectoryException(string message) : base(message) { } public DirectoryException() : base() { } } [Serializable] [System.Runtime.CompilerServices.TypeForwardedFrom("System.DirectoryServices.Protocols, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] public class DirectoryOperationException : DirectoryException, ISerializable { protected DirectoryOperationException(SerializationInfo info, StreamingContext context) : base(info, context) { } public DirectoryOperationException() : base() { } public DirectoryOperationException(string message) : base(message) { } public DirectoryOperationException(string message, Exception inner) : base(message, inner) { } public DirectoryOperationException(DirectoryResponse response) : base(CreateMessage(response, message: null)) { Response = response; } public DirectoryOperationException(DirectoryResponse response, string message) : base(CreateMessage(response, message)) { Response = response; } public DirectoryOperationException(DirectoryResponse response, string message, Exception inner) : base(CreateMessage(response, message), inner) { Response = response; } public DirectoryResponse Response { get; internal set; } private static string CreateMessage(DirectoryResponse response, string message) { string result = message ?? SR.DefaultOperationsError; if (!string.IsNullOrEmpty(response?.ErrorMessage)) { result += " " + response.ErrorMessage; } return result; } } [Serializable] [System.Runtime.CompilerServices.TypeForwardedFrom("System.DirectoryServices.Protocols, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] public class BerConversionException : DirectoryException { protected BerConversionException(SerializationInfo info, StreamingContext context) : base(info, context) { } public BerConversionException() : base(SR.BerConversionError) { } public BerConversionException(string message) : base(message) { } public BerConversionException(string message, Exception inner) : base(message, inner) { } } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Text; using System.Runtime.Serialization; namespace System.DirectoryServices.Protocols { [Serializable] [System.Runtime.CompilerServices.TypeForwardedFrom("System.DirectoryServices.Protocols, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] public class DirectoryException : Exception { protected DirectoryException(SerializationInfo info, StreamingContext context) : base(info, context) { } public DirectoryException(string message, Exception inner) : base(message, inner) { } public DirectoryException(string message) : base(message) { } public DirectoryException() : base() { } } [Serializable] [System.Runtime.CompilerServices.TypeForwardedFrom("System.DirectoryServices.Protocols, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] public class DirectoryOperationException : DirectoryException, ISerializable { protected DirectoryOperationException(SerializationInfo info, StreamingContext context) : base(info, context) { } public DirectoryOperationException() : base() { } public DirectoryOperationException(string message) : base(message) { } public DirectoryOperationException(string message, Exception inner) : base(message, inner) { } public DirectoryOperationException(DirectoryResponse response) : base(CreateMessage(response, message: null)) { Response = response; } public DirectoryOperationException(DirectoryResponse response, string message) : base(CreateMessage(response, message)) { Response = response; } public DirectoryOperationException(DirectoryResponse response, string message, Exception inner) : base(CreateMessage(response, message), inner) { Response = response; } public DirectoryResponse Response { get; internal set; } private static string CreateMessage(DirectoryResponse response, string message) { string result = message ?? SR.DefaultOperationsError; if (!string.IsNullOrEmpty(response?.ErrorMessage)) { result += " " + response.ErrorMessage; } return result; } } [Serializable] [System.Runtime.CompilerServices.TypeForwardedFrom("System.DirectoryServices.Protocols, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")] public class BerConversionException : DirectoryException { protected BerConversionException(SerializationInfo info, StreamingContext context) : base(info, context) { } public BerConversionException() : base(SR.BerConversionError) { } public BerConversionException(string message) : base(message) { } public BerConversionException(string message, Exception inner) : base(message, inner) { } } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/libraries/System.Drawing.Common/tests/PensTests.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.Drawing.Drawing2D; using System.Reflection; using Xunit; namespace System.Drawing.Tests { public class PensTests { public static IEnumerable<object[]> Pens_TestData() { yield return Pen(() => Pens.AliceBlue, Color.AliceBlue); yield return Pen(() => Pens.AntiqueWhite, Color.AntiqueWhite); yield return Pen(() => Pens.Aqua, Color.Aqua); yield return Pen(() => Pens.Aquamarine, Color.Aquamarine); yield return Pen(() => Pens.Azure, Color.Azure); yield return Pen(() => Pens.Beige, Color.Beige); yield return Pen(() => Pens.Bisque, Color.Bisque); yield return Pen(() => Pens.Black, Color.Black); yield return Pen(() => Pens.BlanchedAlmond, Color.BlanchedAlmond); yield return Pen(() => Pens.Blue, Color.Blue); yield return Pen(() => Pens.BlueViolet, Color.BlueViolet); yield return Pen(() => Pens.Brown, Color.Brown); yield return Pen(() => Pens.BurlyWood, Color.BurlyWood); yield return Pen(() => Pens.CadetBlue, Color.CadetBlue); yield return Pen(() => Pens.Chartreuse, Color.Chartreuse); yield return Pen(() => Pens.Chocolate, Color.Chocolate); yield return Pen(() => Pens.Coral, Color.Coral); yield return Pen(() => Pens.CornflowerBlue, Color.CornflowerBlue); yield return Pen(() => Pens.Cornsilk, Color.Cornsilk); yield return Pen(() => Pens.Crimson, Color.Crimson); yield return Pen(() => Pens.Cyan, Color.Cyan); yield return Pen(() => Pens.DarkBlue, Color.DarkBlue); yield return Pen(() => Pens.DarkCyan, Color.DarkCyan); yield return Pen(() => Pens.DarkGoldenrod, Color.DarkGoldenrod); yield return Pen(() => Pens.DarkGray, Color.DarkGray); yield return Pen(() => Pens.DarkGreen, Color.DarkGreen); yield return Pen(() => Pens.DarkKhaki, Color.DarkKhaki); yield return Pen(() => Pens.DarkMagenta, Color.DarkMagenta); yield return Pen(() => Pens.DarkOliveGreen, Color.DarkOliveGreen); yield return Pen(() => Pens.DarkOrange, Color.DarkOrange); yield return Pen(() => Pens.DarkOrchid, Color.DarkOrchid); yield return Pen(() => Pens.DarkRed, Color.DarkRed); yield return Pen(() => Pens.DarkSalmon, Color.DarkSalmon); yield return Pen(() => Pens.DarkSeaGreen, Color.DarkSeaGreen); yield return Pen(() => Pens.DarkSlateBlue, Color.DarkSlateBlue); yield return Pen(() => Pens.DarkSlateGray, Color.DarkSlateGray); yield return Pen(() => Pens.DarkTurquoise, Color.DarkTurquoise); yield return Pen(() => Pens.DarkViolet, Color.DarkViolet); yield return Pen(() => Pens.DeepPink, Color.DeepPink); yield return Pen(() => Pens.DeepSkyBlue, Color.DeepSkyBlue); yield return Pen(() => Pens.DimGray, Color.DimGray); yield return Pen(() => Pens.DodgerBlue, Color.DodgerBlue); yield return Pen(() => Pens.Firebrick, Color.Firebrick); yield return Pen(() => Pens.FloralWhite, Color.FloralWhite); yield return Pen(() => Pens.ForestGreen, Color.ForestGreen); yield return Pen(() => Pens.Fuchsia, Color.Fuchsia); yield return Pen(() => Pens.Gainsboro, Color.Gainsboro); yield return Pen(() => Pens.GhostWhite, Color.GhostWhite); yield return Pen(() => Pens.Gold, Color.Gold); yield return Pen(() => Pens.Goldenrod, Color.Goldenrod); yield return Pen(() => Pens.Gray, Color.Gray); yield return Pen(() => Pens.Green, Color.Green); yield return Pen(() => Pens.GreenYellow, Color.GreenYellow); yield return Pen(() => Pens.Honeydew, Color.Honeydew); yield return Pen(() => Pens.HotPink, Color.HotPink); yield return Pen(() => Pens.IndianRed, Color.IndianRed); yield return Pen(() => Pens.Indigo, Color.Indigo); yield return Pen(() => Pens.Ivory, Color.Ivory); yield return Pen(() => Pens.Khaki, Color.Khaki); yield return Pen(() => Pens.Lavender, Color.Lavender); yield return Pen(() => Pens.LavenderBlush, Color.LavenderBlush); yield return Pen(() => Pens.LawnGreen, Color.LawnGreen); yield return Pen(() => Pens.LemonChiffon, Color.LemonChiffon); yield return Pen(() => Pens.LightBlue, Color.LightBlue); yield return Pen(() => Pens.LightCoral, Color.LightCoral); yield return Pen(() => Pens.LightCyan, Color.LightCyan); yield return Pen(() => Pens.LightGoldenrodYellow, Color.LightGoldenrodYellow); yield return Pen(() => Pens.LightGray, Color.LightGray); yield return Pen(() => Pens.LightGreen, Color.LightGreen); yield return Pen(() => Pens.LightPink, Color.LightPink); yield return Pen(() => Pens.LightSalmon, Color.LightSalmon); yield return Pen(() => Pens.LightSeaGreen, Color.LightSeaGreen); yield return Pen(() => Pens.LightSkyBlue, Color.LightSkyBlue); yield return Pen(() => Pens.LightSlateGray, Color.LightSlateGray); yield return Pen(() => Pens.LightSteelBlue, Color.LightSteelBlue); yield return Pen(() => Pens.LightYellow, Color.LightYellow); yield return Pen(() => Pens.Lime, Color.Lime); yield return Pen(() => Pens.LimeGreen, Color.LimeGreen); yield return Pen(() => Pens.Linen, Color.Linen); yield return Pen(() => Pens.Magenta, Color.Magenta); yield return Pen(() => Pens.Maroon, Color.Maroon); yield return Pen(() => Pens.MediumAquamarine, Color.MediumAquamarine); yield return Pen(() => Pens.MediumBlue, Color.MediumBlue); yield return Pen(() => Pens.MediumOrchid, Color.MediumOrchid); yield return Pen(() => Pens.MediumPurple, Color.MediumPurple); yield return Pen(() => Pens.MediumSeaGreen, Color.MediumSeaGreen); yield return Pen(() => Pens.MediumSlateBlue, Color.MediumSlateBlue); yield return Pen(() => Pens.MediumSpringGreen, Color.MediumSpringGreen); yield return Pen(() => Pens.MediumTurquoise, Color.MediumTurquoise); yield return Pen(() => Pens.MediumVioletRed, Color.MediumVioletRed); yield return Pen(() => Pens.MidnightBlue, Color.MidnightBlue); yield return Pen(() => Pens.MintCream, Color.MintCream); yield return Pen(() => Pens.MistyRose, Color.MistyRose); yield return Pen(() => Pens.Moccasin, Color.Moccasin); yield return Pen(() => Pens.NavajoWhite, Color.NavajoWhite); yield return Pen(() => Pens.Navy, Color.Navy); yield return Pen(() => Pens.OldLace, Color.OldLace); yield return Pen(() => Pens.Olive, Color.Olive); yield return Pen(() => Pens.OliveDrab, Color.OliveDrab); yield return Pen(() => Pens.Orange, Color.Orange); yield return Pen(() => Pens.OrangeRed, Color.OrangeRed); yield return Pen(() => Pens.Orchid, Color.Orchid); yield return Pen(() => Pens.PaleGoldenrod, Color.PaleGoldenrod); yield return Pen(() => Pens.PaleGreen, Color.PaleGreen); yield return Pen(() => Pens.PaleTurquoise, Color.PaleTurquoise); yield return Pen(() => Pens.PaleVioletRed, Color.PaleVioletRed); yield return Pen(() => Pens.PapayaWhip, Color.PapayaWhip); yield return Pen(() => Pens.PeachPuff, Color.PeachPuff); yield return Pen(() => Pens.Peru, Color.Peru); yield return Pen(() => Pens.Pink, Color.Pink); yield return Pen(() => Pens.Plum, Color.Plum); yield return Pen(() => Pens.PowderBlue, Color.PowderBlue); yield return Pen(() => Pens.Purple, Color.Purple); yield return Pen(() => Pens.Red, Color.Red); yield return Pen(() => Pens.RosyBrown, Color.RosyBrown); yield return Pen(() => Pens.RoyalBlue, Color.RoyalBlue); yield return Pen(() => Pens.SaddleBrown, Color.SaddleBrown); yield return Pen(() => Pens.Salmon, Color.Salmon); yield return Pen(() => Pens.SandyBrown, Color.SandyBrown); yield return Pen(() => Pens.SeaGreen, Color.SeaGreen); yield return Pen(() => Pens.SeaShell, Color.SeaShell); yield return Pen(() => Pens.Sienna, Color.Sienna); yield return Pen(() => Pens.Silver, Color.Silver); yield return Pen(() => Pens.SkyBlue, Color.SkyBlue); yield return Pen(() => Pens.SlateBlue, Color.SlateBlue); yield return Pen(() => Pens.SlateGray, Color.SlateGray); yield return Pen(() => Pens.Snow, Color.Snow); yield return Pen(() => Pens.SpringGreen, Color.SpringGreen); yield return Pen(() => Pens.SteelBlue, Color.SteelBlue); yield return Pen(() => Pens.Tan, Color.Tan); yield return Pen(() => Pens.Teal, Color.Teal); yield return Pen(() => Pens.Thistle, Color.Thistle); yield return Pen(() => Pens.Tomato, Color.Tomato); yield return Pen(() => Pens.Transparent, Color.Transparent); yield return Pen(() => Pens.Turquoise, Color.Turquoise); yield return Pen(() => Pens.Violet, Color.Violet); yield return Pen(() => Pens.Wheat, Color.Wheat); yield return Pen(() => Pens.White, Color.White); yield return Pen(() => Pens.WhiteSmoke, Color.WhiteSmoke); yield return Pen(() => Pens.Yellow, Color.Yellow); yield return Pen(() => Pens.YellowGreen, Color.YellowGreen); } public static object[] Pen(Func<Pen> getPen, Color expectedColor) => new object[] { getPen, expectedColor }; [ConditionalTheory(Helpers.IsDrawingSupported)] [MemberData(nameof(Pens_TestData))] public void Pens_Get_ReturnsExpected(Func<Pen> getPen, Color expectedColor) { Pen pen = getPen(); Assert.Equal(expectedColor, pen.Color); Assert.Equal(PenType.SolidColor, pen.PenType); AssertExtensions.Throws<ArgumentException>(null, () => pen.Color = Color.AliceBlue); Assert.Same(pen, getPen()); } } }
// 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.Drawing.Drawing2D; using System.Reflection; using Xunit; namespace System.Drawing.Tests { public class PensTests { public static IEnumerable<object[]> Pens_TestData() { yield return Pen(() => Pens.AliceBlue, Color.AliceBlue); yield return Pen(() => Pens.AntiqueWhite, Color.AntiqueWhite); yield return Pen(() => Pens.Aqua, Color.Aqua); yield return Pen(() => Pens.Aquamarine, Color.Aquamarine); yield return Pen(() => Pens.Azure, Color.Azure); yield return Pen(() => Pens.Beige, Color.Beige); yield return Pen(() => Pens.Bisque, Color.Bisque); yield return Pen(() => Pens.Black, Color.Black); yield return Pen(() => Pens.BlanchedAlmond, Color.BlanchedAlmond); yield return Pen(() => Pens.Blue, Color.Blue); yield return Pen(() => Pens.BlueViolet, Color.BlueViolet); yield return Pen(() => Pens.Brown, Color.Brown); yield return Pen(() => Pens.BurlyWood, Color.BurlyWood); yield return Pen(() => Pens.CadetBlue, Color.CadetBlue); yield return Pen(() => Pens.Chartreuse, Color.Chartreuse); yield return Pen(() => Pens.Chocolate, Color.Chocolate); yield return Pen(() => Pens.Coral, Color.Coral); yield return Pen(() => Pens.CornflowerBlue, Color.CornflowerBlue); yield return Pen(() => Pens.Cornsilk, Color.Cornsilk); yield return Pen(() => Pens.Crimson, Color.Crimson); yield return Pen(() => Pens.Cyan, Color.Cyan); yield return Pen(() => Pens.DarkBlue, Color.DarkBlue); yield return Pen(() => Pens.DarkCyan, Color.DarkCyan); yield return Pen(() => Pens.DarkGoldenrod, Color.DarkGoldenrod); yield return Pen(() => Pens.DarkGray, Color.DarkGray); yield return Pen(() => Pens.DarkGreen, Color.DarkGreen); yield return Pen(() => Pens.DarkKhaki, Color.DarkKhaki); yield return Pen(() => Pens.DarkMagenta, Color.DarkMagenta); yield return Pen(() => Pens.DarkOliveGreen, Color.DarkOliveGreen); yield return Pen(() => Pens.DarkOrange, Color.DarkOrange); yield return Pen(() => Pens.DarkOrchid, Color.DarkOrchid); yield return Pen(() => Pens.DarkRed, Color.DarkRed); yield return Pen(() => Pens.DarkSalmon, Color.DarkSalmon); yield return Pen(() => Pens.DarkSeaGreen, Color.DarkSeaGreen); yield return Pen(() => Pens.DarkSlateBlue, Color.DarkSlateBlue); yield return Pen(() => Pens.DarkSlateGray, Color.DarkSlateGray); yield return Pen(() => Pens.DarkTurquoise, Color.DarkTurquoise); yield return Pen(() => Pens.DarkViolet, Color.DarkViolet); yield return Pen(() => Pens.DeepPink, Color.DeepPink); yield return Pen(() => Pens.DeepSkyBlue, Color.DeepSkyBlue); yield return Pen(() => Pens.DimGray, Color.DimGray); yield return Pen(() => Pens.DodgerBlue, Color.DodgerBlue); yield return Pen(() => Pens.Firebrick, Color.Firebrick); yield return Pen(() => Pens.FloralWhite, Color.FloralWhite); yield return Pen(() => Pens.ForestGreen, Color.ForestGreen); yield return Pen(() => Pens.Fuchsia, Color.Fuchsia); yield return Pen(() => Pens.Gainsboro, Color.Gainsboro); yield return Pen(() => Pens.GhostWhite, Color.GhostWhite); yield return Pen(() => Pens.Gold, Color.Gold); yield return Pen(() => Pens.Goldenrod, Color.Goldenrod); yield return Pen(() => Pens.Gray, Color.Gray); yield return Pen(() => Pens.Green, Color.Green); yield return Pen(() => Pens.GreenYellow, Color.GreenYellow); yield return Pen(() => Pens.Honeydew, Color.Honeydew); yield return Pen(() => Pens.HotPink, Color.HotPink); yield return Pen(() => Pens.IndianRed, Color.IndianRed); yield return Pen(() => Pens.Indigo, Color.Indigo); yield return Pen(() => Pens.Ivory, Color.Ivory); yield return Pen(() => Pens.Khaki, Color.Khaki); yield return Pen(() => Pens.Lavender, Color.Lavender); yield return Pen(() => Pens.LavenderBlush, Color.LavenderBlush); yield return Pen(() => Pens.LawnGreen, Color.LawnGreen); yield return Pen(() => Pens.LemonChiffon, Color.LemonChiffon); yield return Pen(() => Pens.LightBlue, Color.LightBlue); yield return Pen(() => Pens.LightCoral, Color.LightCoral); yield return Pen(() => Pens.LightCyan, Color.LightCyan); yield return Pen(() => Pens.LightGoldenrodYellow, Color.LightGoldenrodYellow); yield return Pen(() => Pens.LightGray, Color.LightGray); yield return Pen(() => Pens.LightGreen, Color.LightGreen); yield return Pen(() => Pens.LightPink, Color.LightPink); yield return Pen(() => Pens.LightSalmon, Color.LightSalmon); yield return Pen(() => Pens.LightSeaGreen, Color.LightSeaGreen); yield return Pen(() => Pens.LightSkyBlue, Color.LightSkyBlue); yield return Pen(() => Pens.LightSlateGray, Color.LightSlateGray); yield return Pen(() => Pens.LightSteelBlue, Color.LightSteelBlue); yield return Pen(() => Pens.LightYellow, Color.LightYellow); yield return Pen(() => Pens.Lime, Color.Lime); yield return Pen(() => Pens.LimeGreen, Color.LimeGreen); yield return Pen(() => Pens.Linen, Color.Linen); yield return Pen(() => Pens.Magenta, Color.Magenta); yield return Pen(() => Pens.Maroon, Color.Maroon); yield return Pen(() => Pens.MediumAquamarine, Color.MediumAquamarine); yield return Pen(() => Pens.MediumBlue, Color.MediumBlue); yield return Pen(() => Pens.MediumOrchid, Color.MediumOrchid); yield return Pen(() => Pens.MediumPurple, Color.MediumPurple); yield return Pen(() => Pens.MediumSeaGreen, Color.MediumSeaGreen); yield return Pen(() => Pens.MediumSlateBlue, Color.MediumSlateBlue); yield return Pen(() => Pens.MediumSpringGreen, Color.MediumSpringGreen); yield return Pen(() => Pens.MediumTurquoise, Color.MediumTurquoise); yield return Pen(() => Pens.MediumVioletRed, Color.MediumVioletRed); yield return Pen(() => Pens.MidnightBlue, Color.MidnightBlue); yield return Pen(() => Pens.MintCream, Color.MintCream); yield return Pen(() => Pens.MistyRose, Color.MistyRose); yield return Pen(() => Pens.Moccasin, Color.Moccasin); yield return Pen(() => Pens.NavajoWhite, Color.NavajoWhite); yield return Pen(() => Pens.Navy, Color.Navy); yield return Pen(() => Pens.OldLace, Color.OldLace); yield return Pen(() => Pens.Olive, Color.Olive); yield return Pen(() => Pens.OliveDrab, Color.OliveDrab); yield return Pen(() => Pens.Orange, Color.Orange); yield return Pen(() => Pens.OrangeRed, Color.OrangeRed); yield return Pen(() => Pens.Orchid, Color.Orchid); yield return Pen(() => Pens.PaleGoldenrod, Color.PaleGoldenrod); yield return Pen(() => Pens.PaleGreen, Color.PaleGreen); yield return Pen(() => Pens.PaleTurquoise, Color.PaleTurquoise); yield return Pen(() => Pens.PaleVioletRed, Color.PaleVioletRed); yield return Pen(() => Pens.PapayaWhip, Color.PapayaWhip); yield return Pen(() => Pens.PeachPuff, Color.PeachPuff); yield return Pen(() => Pens.Peru, Color.Peru); yield return Pen(() => Pens.Pink, Color.Pink); yield return Pen(() => Pens.Plum, Color.Plum); yield return Pen(() => Pens.PowderBlue, Color.PowderBlue); yield return Pen(() => Pens.Purple, Color.Purple); yield return Pen(() => Pens.Red, Color.Red); yield return Pen(() => Pens.RosyBrown, Color.RosyBrown); yield return Pen(() => Pens.RoyalBlue, Color.RoyalBlue); yield return Pen(() => Pens.SaddleBrown, Color.SaddleBrown); yield return Pen(() => Pens.Salmon, Color.Salmon); yield return Pen(() => Pens.SandyBrown, Color.SandyBrown); yield return Pen(() => Pens.SeaGreen, Color.SeaGreen); yield return Pen(() => Pens.SeaShell, Color.SeaShell); yield return Pen(() => Pens.Sienna, Color.Sienna); yield return Pen(() => Pens.Silver, Color.Silver); yield return Pen(() => Pens.SkyBlue, Color.SkyBlue); yield return Pen(() => Pens.SlateBlue, Color.SlateBlue); yield return Pen(() => Pens.SlateGray, Color.SlateGray); yield return Pen(() => Pens.Snow, Color.Snow); yield return Pen(() => Pens.SpringGreen, Color.SpringGreen); yield return Pen(() => Pens.SteelBlue, Color.SteelBlue); yield return Pen(() => Pens.Tan, Color.Tan); yield return Pen(() => Pens.Teal, Color.Teal); yield return Pen(() => Pens.Thistle, Color.Thistle); yield return Pen(() => Pens.Tomato, Color.Tomato); yield return Pen(() => Pens.Transparent, Color.Transparent); yield return Pen(() => Pens.Turquoise, Color.Turquoise); yield return Pen(() => Pens.Violet, Color.Violet); yield return Pen(() => Pens.Wheat, Color.Wheat); yield return Pen(() => Pens.White, Color.White); yield return Pen(() => Pens.WhiteSmoke, Color.WhiteSmoke); yield return Pen(() => Pens.Yellow, Color.Yellow); yield return Pen(() => Pens.YellowGreen, Color.YellowGreen); } public static object[] Pen(Func<Pen> getPen, Color expectedColor) => new object[] { getPen, expectedColor }; [ConditionalTheory(Helpers.IsDrawingSupported)] [MemberData(nameof(Pens_TestData))] public void Pens_Get_ReturnsExpected(Func<Pen> getPen, Color expectedColor) { Pen pen = getPen(); Assert.Equal(expectedColor, pen.Color); Assert.Equal(PenType.SolidColor, pen.PenType); AssertExtensions.Throws<ArgumentException>(null, () => pen.Color = Color.AliceBlue); Assert.Same(pen, getPen()); } } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/JIT/HardwareIntrinsics/Arm/AdvSimd/ShiftArithmeticRounded.Vector64.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.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 ShiftArithmeticRounded_Vector64_SByte() { var test = new SimpleBinaryOpTest__ShiftArithmeticRounded_Vector64_SByte(); 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__ShiftArithmeticRounded_Vector64_SByte { 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 != 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 Vector64<SByte> _fld1; public Vector64<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<Vector64<SByte>, byte>(ref testStruct._fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<SByte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<SByte>, byte>(ref testStruct._fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<SByte>>()); return testStruct; } public void RunStructFldScenario(SimpleBinaryOpTest__ShiftArithmeticRounded_Vector64_SByte testClass) { var result = AdvSimd.ShiftArithmeticRounded(_fld1, _fld2); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } public void RunStructFldScenario_Load(SimpleBinaryOpTest__ShiftArithmeticRounded_Vector64_SByte testClass) { fixed (Vector64<SByte>* pFld1 = &_fld1) fixed (Vector64<SByte>* pFld2 = &_fld2) { var result = AdvSimd.ShiftArithmeticRounded( AdvSimd.LoadVector64((SByte*)(pFld1)), AdvSimd.LoadVector64((SByte*)(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<SByte>>() / sizeof(SByte); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector64<SByte>>() / sizeof(SByte); private static readonly int RetElementCount = Unsafe.SizeOf<Vector64<SByte>>() / sizeof(SByte); private static SByte[] _data1 = new SByte[Op1ElementCount]; private static SByte[] _data2 = new SByte[Op2ElementCount]; private static Vector64<SByte> _clsVar1; private static Vector64<SByte> _clsVar2; private Vector64<SByte> _fld1; private Vector64<SByte> _fld2; private DataTable _dataTable; static SimpleBinaryOpTest__ShiftArithmeticRounded_Vector64_SByte() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<SByte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<SByte>>()); } public SimpleBinaryOpTest__ShiftArithmeticRounded_Vector64_SByte() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<SByte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<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 IsSupported => AdvSimd.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = AdvSimd.ShiftArithmeticRounded( Unsafe.Read<Vector64<SByte>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector64<SByte>>(_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.ShiftArithmeticRounded( AdvSimd.LoadVector64((SByte*)(_dataTable.inArray1Ptr)), AdvSimd.LoadVector64((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 result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.ShiftArithmeticRounded), new Type[] { typeof(Vector64<SByte>), typeof(Vector64<SByte>) }) .Invoke(null, new object[] { Unsafe.Read<Vector64<SByte>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector64<SByte>>(_dataTable.inArray2Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector64<SByte>)(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.ShiftArithmeticRounded), new Type[] { typeof(Vector64<SByte>), typeof(Vector64<SByte>) }) .Invoke(null, new object[] { AdvSimd.LoadVector64((SByte*)(_dataTable.inArray1Ptr)), AdvSimd.LoadVector64((SByte*)(_dataTable.inArray2Ptr)) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector64<SByte>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = AdvSimd.ShiftArithmeticRounded( _clsVar1, _clsVar2 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } public void RunClsVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load)); fixed (Vector64<SByte>* pClsVar1 = &_clsVar1) fixed (Vector64<SByte>* pClsVar2 = &_clsVar2) { var result = AdvSimd.ShiftArithmeticRounded( AdvSimd.LoadVector64((SByte*)(pClsVar1)), AdvSimd.LoadVector64((SByte*)(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<SByte>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector64<SByte>>(_dataTable.inArray2Ptr); var result = AdvSimd.ShiftArithmeticRounded(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((SByte*)(_dataTable.inArray1Ptr)); var op2 = AdvSimd.LoadVector64((SByte*)(_dataTable.inArray2Ptr)); var result = AdvSimd.ShiftArithmeticRounded(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new SimpleBinaryOpTest__ShiftArithmeticRounded_Vector64_SByte(); var result = AdvSimd.ShiftArithmeticRounded(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__ShiftArithmeticRounded_Vector64_SByte(); fixed (Vector64<SByte>* pFld1 = &test._fld1) fixed (Vector64<SByte>* pFld2 = &test._fld2) { var result = AdvSimd.ShiftArithmeticRounded( AdvSimd.LoadVector64((SByte*)(pFld1)), AdvSimd.LoadVector64((SByte*)(pFld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = AdvSimd.ShiftArithmeticRounded(_fld1, _fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } public void RunClassFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load)); fixed (Vector64<SByte>* pFld1 = &_fld1) fixed (Vector64<SByte>* pFld2 = &_fld2) { var result = AdvSimd.ShiftArithmeticRounded( AdvSimd.LoadVector64((SByte*)(pFld1)), AdvSimd.LoadVector64((SByte*)(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.ShiftArithmeticRounded(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.ShiftArithmeticRounded( AdvSimd.LoadVector64((SByte*)(&test._fld1)), AdvSimd.LoadVector64((SByte*)(&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<SByte> op1, Vector64<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<Vector64<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<Vector64<SByte>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector64<SByte>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<SByte>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(SByte[] left, SByte[] right, SByte[] result, [CallerMemberName] string method = "") { bool succeeded = true; for (var i = 0; i < RetElementCount; i++) { if (Helpers.ShiftArithmeticRounded(left[i], right[i]) != result[i]) { succeeded = false; break; } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd)}.{nameof(AdvSimd.ShiftArithmeticRounded)}<SByte>(Vector64<SByte>, Vector64<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.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 ShiftArithmeticRounded_Vector64_SByte() { var test = new SimpleBinaryOpTest__ShiftArithmeticRounded_Vector64_SByte(); 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__ShiftArithmeticRounded_Vector64_SByte { 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 != 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 Vector64<SByte> _fld1; public Vector64<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<Vector64<SByte>, byte>(ref testStruct._fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<SByte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<SByte>, byte>(ref testStruct._fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<SByte>>()); return testStruct; } public void RunStructFldScenario(SimpleBinaryOpTest__ShiftArithmeticRounded_Vector64_SByte testClass) { var result = AdvSimd.ShiftArithmeticRounded(_fld1, _fld2); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } public void RunStructFldScenario_Load(SimpleBinaryOpTest__ShiftArithmeticRounded_Vector64_SByte testClass) { fixed (Vector64<SByte>* pFld1 = &_fld1) fixed (Vector64<SByte>* pFld2 = &_fld2) { var result = AdvSimd.ShiftArithmeticRounded( AdvSimd.LoadVector64((SByte*)(pFld1)), AdvSimd.LoadVector64((SByte*)(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<SByte>>() / sizeof(SByte); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector64<SByte>>() / sizeof(SByte); private static readonly int RetElementCount = Unsafe.SizeOf<Vector64<SByte>>() / sizeof(SByte); private static SByte[] _data1 = new SByte[Op1ElementCount]; private static SByte[] _data2 = new SByte[Op2ElementCount]; private static Vector64<SByte> _clsVar1; private static Vector64<SByte> _clsVar2; private Vector64<SByte> _fld1; private Vector64<SByte> _fld2; private DataTable _dataTable; static SimpleBinaryOpTest__ShiftArithmeticRounded_Vector64_SByte() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<SByte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<SByte>, byte>(ref _clsVar2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<SByte>>()); } public SimpleBinaryOpTest__ShiftArithmeticRounded_Vector64_SByte() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<SByte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<SByte>, byte>(ref _fld2), ref Unsafe.As<SByte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<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 IsSupported => AdvSimd.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = AdvSimd.ShiftArithmeticRounded( Unsafe.Read<Vector64<SByte>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector64<SByte>>(_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.ShiftArithmeticRounded( AdvSimd.LoadVector64((SByte*)(_dataTable.inArray1Ptr)), AdvSimd.LoadVector64((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 result = typeof(AdvSimd).GetMethod(nameof(AdvSimd.ShiftArithmeticRounded), new Type[] { typeof(Vector64<SByte>), typeof(Vector64<SByte>) }) .Invoke(null, new object[] { Unsafe.Read<Vector64<SByte>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector64<SByte>>(_dataTable.inArray2Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector64<SByte>)(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.ShiftArithmeticRounded), new Type[] { typeof(Vector64<SByte>), typeof(Vector64<SByte>) }) .Invoke(null, new object[] { AdvSimd.LoadVector64((SByte*)(_dataTable.inArray1Ptr)), AdvSimd.LoadVector64((SByte*)(_dataTable.inArray2Ptr)) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector64<SByte>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = AdvSimd.ShiftArithmeticRounded( _clsVar1, _clsVar2 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } public void RunClsVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load)); fixed (Vector64<SByte>* pClsVar1 = &_clsVar1) fixed (Vector64<SByte>* pClsVar2 = &_clsVar2) { var result = AdvSimd.ShiftArithmeticRounded( AdvSimd.LoadVector64((SByte*)(pClsVar1)), AdvSimd.LoadVector64((SByte*)(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<SByte>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector64<SByte>>(_dataTable.inArray2Ptr); var result = AdvSimd.ShiftArithmeticRounded(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((SByte*)(_dataTable.inArray1Ptr)); var op2 = AdvSimd.LoadVector64((SByte*)(_dataTable.inArray2Ptr)); var result = AdvSimd.ShiftArithmeticRounded(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new SimpleBinaryOpTest__ShiftArithmeticRounded_Vector64_SByte(); var result = AdvSimd.ShiftArithmeticRounded(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__ShiftArithmeticRounded_Vector64_SByte(); fixed (Vector64<SByte>* pFld1 = &test._fld1) fixed (Vector64<SByte>* pFld2 = &test._fld2) { var result = AdvSimd.ShiftArithmeticRounded( AdvSimd.LoadVector64((SByte*)(pFld1)), AdvSimd.LoadVector64((SByte*)(pFld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = AdvSimd.ShiftArithmeticRounded(_fld1, _fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } public void RunClassFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load)); fixed (Vector64<SByte>* pFld1 = &_fld1) fixed (Vector64<SByte>* pFld2 = &_fld2) { var result = AdvSimd.ShiftArithmeticRounded( AdvSimd.LoadVector64((SByte*)(pFld1)), AdvSimd.LoadVector64((SByte*)(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.ShiftArithmeticRounded(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.ShiftArithmeticRounded( AdvSimd.LoadVector64((SByte*)(&test._fld1)), AdvSimd.LoadVector64((SByte*)(&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<SByte> op1, Vector64<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<Vector64<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<Vector64<SByte>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector64<SByte>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<SByte>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(SByte[] left, SByte[] right, SByte[] result, [CallerMemberName] string method = "") { bool succeeded = true; for (var i = 0; i < RetElementCount; i++) { if (Helpers.ShiftArithmeticRounded(left[i], right[i]) != result[i]) { succeeded = false; break; } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd)}.{nameof(AdvSimd.ShiftArithmeticRounded)}<SByte>(Vector64<SByte>, Vector64<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,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/JIT/HardwareIntrinsics/General/Vector128/CreateScalar.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\General\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 CreateScalarByte() { var test = new VectorCreate__CreateScalarByte(); // Validates basic functionality works test.RunBasicScenario(); // Validates calling via reflection works test.RunReflectionScenario(); if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class VectorCreate__CreateScalarByte { private static readonly int LargestVectorSize = 16; private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte); public bool Succeeded { get; set; } = true; public void RunBasicScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); Byte value = TestLibrary.Generator.GetByte(); Vector128<Byte> result = Vector128.CreateScalar(value); ValidateResult(result, value); } public void RunReflectionScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); Byte value = TestLibrary.Generator.GetByte(); object result = typeof(Vector128) .GetMethod(nameof(Vector128.CreateScalar), new Type[] { typeof(Byte) }) .Invoke(null, new object[] { value }); ValidateResult((Vector128<Byte>)(result), value); } private void ValidateResult(Vector128<Byte> result, Byte expectedValue, [CallerMemberName] string method = "") { Byte[] resultElements = new Byte[ElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref resultElements[0]), result); ValidateResult(resultElements, expectedValue, method); } private void ValidateResult(Byte[] resultElements, Byte expectedValue, [CallerMemberName] string method = "") { bool succeeded = true; if (resultElements[0] != expectedValue) { succeeded = false; } else { for (var i = 1; i < ElementCount; i++) { if (resultElements[i] != 0) { succeeded = false; break; } } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"Vector128.CreateScalar(Byte): {method} failed:"); TestLibrary.TestFramework.LogInformation($" value: {expectedValue}"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})"); 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\General\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 CreateScalarByte() { var test = new VectorCreate__CreateScalarByte(); // Validates basic functionality works test.RunBasicScenario(); // Validates calling via reflection works test.RunReflectionScenario(); if (!test.Succeeded) { throw new Exception("One or more scenarios did not complete as expected."); } } } public sealed unsafe class VectorCreate__CreateScalarByte { private static readonly int LargestVectorSize = 16; private static readonly int ElementCount = Unsafe.SizeOf<Vector128<Byte>>() / sizeof(Byte); public bool Succeeded { get; set; } = true; public void RunBasicScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario)); Byte value = TestLibrary.Generator.GetByte(); Vector128<Byte> result = Vector128.CreateScalar(value); ValidateResult(result, value); } public void RunReflectionScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario)); Byte value = TestLibrary.Generator.GetByte(); object result = typeof(Vector128) .GetMethod(nameof(Vector128.CreateScalar), new Type[] { typeof(Byte) }) .Invoke(null, new object[] { value }); ValidateResult((Vector128<Byte>)(result), value); } private void ValidateResult(Vector128<Byte> result, Byte expectedValue, [CallerMemberName] string method = "") { Byte[] resultElements = new Byte[ElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<Byte, byte>(ref resultElements[0]), result); ValidateResult(resultElements, expectedValue, method); } private void ValidateResult(Byte[] resultElements, Byte expectedValue, [CallerMemberName] string method = "") { bool succeeded = true; if (resultElements[0] != expectedValue) { succeeded = false; } else { for (var i = 1; i < ElementCount; i++) { if (resultElements[i] != 0) { succeeded = false; break; } } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"Vector128.CreateScalar(Byte): {method} failed:"); TestLibrary.TestFramework.LogInformation($" value: {expectedValue}"); TestLibrary.TestFramework.LogInformation($" result: ({string.Join(", ", resultElements)})"); TestLibrary.TestFramework.LogInformation(string.Empty); Succeeded = false; } } } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/JIT/HardwareIntrinsics/X86/Sse42.X64/Crc32_ro.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> </PropertyGroup> <PropertyGroup> <DebugType>Embedded</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="Crc32.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> </PropertyGroup> <PropertyGroup> <DebugType>Embedded</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="Crc32.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/JIT/Regression/Dev11/Dev11_5437/Dev11_5437.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>PdbOnly</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>PdbOnly</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="$(MSBuildProjectName).cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/JIT/HardwareIntrinsics/X86/Sse2/ShiftRightLogical.Int32.32.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 ShiftRightLogicalInt3232() { var test = new ImmUnaryOpTest__ShiftRightLogicalInt3232(); 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(); // 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(); // 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(); } 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__ShiftRightLogicalInt3232 { private struct TestStruct { public Vector128<Int32> _fld; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref testStruct._fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>()); return testStruct; } public void RunStructFldScenario(ImmUnaryOpTest__ShiftRightLogicalInt3232 testClass) { var result = Sse2.ShiftRightLogical(_fld, 32); 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<Int32>>() / sizeof(Int32); private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32); private static Int32[] _data = new Int32[Op1ElementCount]; private static Vector128<Int32> _clsVar; private Vector128<Int32> _fld; private SimpleUnaryOpTest__DataTable<Int32, Int32> _dataTable; static ImmUnaryOpTest__ShiftRightLogicalInt3232() { for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>()); } public ImmUnaryOpTest__ShiftRightLogicalInt3232() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>()); for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt32(); } _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], LargestVectorSize); } public bool IsSupported => Sse2.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = Sse2.ShiftRightLogical( Unsafe.Read<Vector128<Int32>>(_dataTable.inArrayPtr), 32 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr); } public void RunBasicScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load)); var result = Sse2.ShiftRightLogical( Sse2.LoadVector128((Int32*)(_dataTable.inArrayPtr)), 32 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr); } public void RunBasicScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned)); var result = Sse2.ShiftRightLogical( Sse2.LoadAlignedVector128((Int32*)(_dataTable.inArrayPtr)), 32 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var result = typeof(Sse2).GetMethod(nameof(Sse2.ShiftRightLogical), new Type[] { typeof(Vector128<Int32>), typeof(byte) }) .Invoke(null, new object[] { Unsafe.Read<Vector128<Int32>>(_dataTable.inArrayPtr), (byte)32 }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Int32>)(result)); ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr); } public void RunReflectionScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load)); var result = typeof(Sse2).GetMethod(nameof(Sse2.ShiftRightLogical), new Type[] { typeof(Vector128<Int32>), typeof(byte) }) .Invoke(null, new object[] { Sse2.LoadVector128((Int32*)(_dataTable.inArrayPtr)), (byte)32 }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Int32>)(result)); ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr); } public void RunReflectionScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned)); var result = typeof(Sse2).GetMethod(nameof(Sse2.ShiftRightLogical), new Type[] { typeof(Vector128<Int32>), typeof(byte) }) .Invoke(null, new object[] { Sse2.LoadAlignedVector128((Int32*)(_dataTable.inArrayPtr)), (byte)32 }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Int32>)(result)); ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = Sse2.ShiftRightLogical( _clsVar, 32 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar, _dataTable.outArrayPtr); } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var firstOp = Unsafe.Read<Vector128<Int32>>(_dataTable.inArrayPtr); var result = Sse2.ShiftRightLogical(firstOp, 32); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(firstOp, _dataTable.outArrayPtr); } public void RunLclVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load)); var firstOp = Sse2.LoadVector128((Int32*)(_dataTable.inArrayPtr)); var result = Sse2.ShiftRightLogical(firstOp, 32); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(firstOp, _dataTable.outArrayPtr); } public void RunLclVarScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned)); var firstOp = Sse2.LoadAlignedVector128((Int32*)(_dataTable.inArrayPtr)); var result = Sse2.ShiftRightLogical(firstOp, 32); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(firstOp, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new ImmUnaryOpTest__ShiftRightLogicalInt3232(); var result = Sse2.ShiftRightLogical(test._fld, 32); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld, _dataTable.outArrayPtr); } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = Sse2.ShiftRightLogical(_fld, 32); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld, _dataTable.outArrayPtr); } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = Sse2.ShiftRightLogical(test._fld, 32); 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 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> firstOp, void* result, [CallerMemberName] string method = "") { Int32[] inArray = new Int32[Op1ElementCount]; Int32[] outArray = new Int32[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>()); ValidateResult(inArray, outArray, method); } private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "") { Int32[] inArray = new Int32[Op1ElementCount]; Int32[] outArray = new Int32[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (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(inArray, outArray, method); } private void ValidateResult(Int32[] firstOp, Int32[] result, [CallerMemberName] string method = "") { bool succeeded = true; if (0 != result[0]) { succeeded = false; } else { for (var i = 1; i < RetElementCount; i++) { if (0 != result[i]) { succeeded = false; break; } } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(Sse2)}.{nameof(Sse2.ShiftRightLogical)}<Int32>(Vector128<Int32><9>): {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.X86; namespace JIT.HardwareIntrinsics.X86 { public static partial class Program { private static void ShiftRightLogicalInt3232() { var test = new ImmUnaryOpTest__ShiftRightLogicalInt3232(); 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(); // 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(); // 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(); } 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__ShiftRightLogicalInt3232 { private struct TestStruct { public Vector128<Int32> _fld; public static TestStruct Create() { var testStruct = new TestStruct(); for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref testStruct._fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>()); return testStruct; } public void RunStructFldScenario(ImmUnaryOpTest__ShiftRightLogicalInt3232 testClass) { var result = Sse2.ShiftRightLogical(_fld, 32); 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<Int32>>() / sizeof(Int32); private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<Int32>>() / sizeof(Int32); private static Int32[] _data = new Int32[Op1ElementCount]; private static Vector128<Int32> _clsVar; private Vector128<Int32> _fld; private SimpleUnaryOpTest__DataTable<Int32, Int32> _dataTable; static ImmUnaryOpTest__ShiftRightLogicalInt3232() { for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _clsVar), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>()); } public ImmUnaryOpTest__ShiftRightLogicalInt3232() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int32>, byte>(ref _fld), ref Unsafe.As<Int32, byte>(ref _data[0]), (uint)Unsafe.SizeOf<Vector128<Int32>>()); for (var i = 0; i < Op1ElementCount; i++) { _data[i] = TestLibrary.Generator.GetInt32(); } _dataTable = new SimpleUnaryOpTest__DataTable<Int32, Int32>(_data, new Int32[RetElementCount], LargestVectorSize); } public bool IsSupported => Sse2.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = Sse2.ShiftRightLogical( Unsafe.Read<Vector128<Int32>>(_dataTable.inArrayPtr), 32 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr); } public void RunBasicScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_Load)); var result = Sse2.ShiftRightLogical( Sse2.LoadVector128((Int32*)(_dataTable.inArrayPtr)), 32 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr); } public void RunBasicScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned)); var result = Sse2.ShiftRightLogical( Sse2.LoadAlignedVector128((Int32*)(_dataTable.inArrayPtr)), 32 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var result = typeof(Sse2).GetMethod(nameof(Sse2.ShiftRightLogical), new Type[] { typeof(Vector128<Int32>), typeof(byte) }) .Invoke(null, new object[] { Unsafe.Read<Vector128<Int32>>(_dataTable.inArrayPtr), (byte)32 }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Int32>)(result)); ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr); } public void RunReflectionScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load)); var result = typeof(Sse2).GetMethod(nameof(Sse2.ShiftRightLogical), new Type[] { typeof(Vector128<Int32>), typeof(byte) }) .Invoke(null, new object[] { Sse2.LoadVector128((Int32*)(_dataTable.inArrayPtr)), (byte)32 }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Int32>)(result)); ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr); } public void RunReflectionScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned)); var result = typeof(Sse2).GetMethod(nameof(Sse2.ShiftRightLogical), new Type[] { typeof(Vector128<Int32>), typeof(byte) }) .Invoke(null, new object[] { Sse2.LoadAlignedVector128((Int32*)(_dataTable.inArrayPtr)), (byte)32 }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<Int32>)(result)); ValidateResult(_dataTable.inArrayPtr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = Sse2.ShiftRightLogical( _clsVar, 32 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar, _dataTable.outArrayPtr); } public void RunLclVarScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_UnsafeRead)); var firstOp = Unsafe.Read<Vector128<Int32>>(_dataTable.inArrayPtr); var result = Sse2.ShiftRightLogical(firstOp, 32); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(firstOp, _dataTable.outArrayPtr); } public void RunLclVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load)); var firstOp = Sse2.LoadVector128((Int32*)(_dataTable.inArrayPtr)); var result = Sse2.ShiftRightLogical(firstOp, 32); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(firstOp, _dataTable.outArrayPtr); } public void RunLclVarScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned)); var firstOp = Sse2.LoadAlignedVector128((Int32*)(_dataTable.inArrayPtr)); var result = Sse2.ShiftRightLogical(firstOp, 32); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(firstOp, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new ImmUnaryOpTest__ShiftRightLogicalInt3232(); var result = Sse2.ShiftRightLogical(test._fld, 32); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld, _dataTable.outArrayPtr); } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = Sse2.ShiftRightLogical(_fld, 32); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld, _dataTable.outArrayPtr); } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = Sse2.ShiftRightLogical(test._fld, 32); 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 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> firstOp, void* result, [CallerMemberName] string method = "") { Int32[] inArray = new Int32[Op1ElementCount]; Int32[] outArray = new Int32[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), firstOp); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector128<Int32>>()); ValidateResult(inArray, outArray, method); } private void ValidateResult(void* firstOp, void* result, [CallerMemberName] string method = "") { Int32[] inArray = new Int32[Op1ElementCount]; Int32[] outArray = new Int32[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int32, byte>(ref inArray[0]), ref Unsafe.AsRef<byte>(firstOp), (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(inArray, outArray, method); } private void ValidateResult(Int32[] firstOp, Int32[] result, [CallerMemberName] string method = "") { bool succeeded = true; if (0 != result[0]) { succeeded = false; } else { for (var i = 1; i < RetElementCount; i++) { if (0 != result[i]) { succeeded = false; break; } } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(Sse2)}.{nameof(Sse2.ShiftRightLogical)}<Int32>(Vector128<Int32><9>): {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,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/JIT/Regression/JitBlue/DevDiv_816617/DevDiv_816617_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="DevDiv_816617.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="DevDiv_816617.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/libraries/Common/tests/System/Net/Prerequisites/NetCoreServer/Handlers/VersionHandler.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.IO; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; namespace NetCoreServer { public class VersionHandler { public static async Task InvokeAsync(HttpContext context) { string versionInfo = GetVersionInfo(); byte[] bytes = Encoding.UTF8.GetBytes(versionInfo); context.Response.ContentType = "text/plain"; context.Response.ContentLength = bytes.Length; await context.Response.Body.WriteAsync(bytes, 0, bytes.Length); } private static string GetVersionInfo() { Type t = typeof(VersionHandler); string path = t.Assembly.Location; FileVersionInfo fi = FileVersionInfo.GetVersionInfo(path); var buffer = new StringBuilder(); buffer.AppendLine("Information for: " + Path.GetFileName(path)); buffer.AppendLine("Location: " + Path.GetDirectoryName(path)); buffer.AppendLine("Framework: " + RuntimeInformation.FrameworkDescription); buffer.AppendLine("File Version: " + fi.FileVersion); buffer.AppendLine("Product Version: " + fi.ProductVersion); buffer.AppendLine("Creation Date: " + File.GetCreationTime(path)); buffer.AppendLine("Last Modified: " + File.GetLastWriteTime(path)); return buffer.ToString(); } } }
// 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.IO; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; using Microsoft.AspNetCore.Http; namespace NetCoreServer { public class VersionHandler { public static async Task InvokeAsync(HttpContext context) { string versionInfo = GetVersionInfo(); byte[] bytes = Encoding.UTF8.GetBytes(versionInfo); context.Response.ContentType = "text/plain"; context.Response.ContentLength = bytes.Length; await context.Response.Body.WriteAsync(bytes, 0, bytes.Length); } private static string GetVersionInfo() { Type t = typeof(VersionHandler); string path = t.Assembly.Location; FileVersionInfo fi = FileVersionInfo.GetVersionInfo(path); var buffer = new StringBuilder(); buffer.AppendLine("Information for: " + Path.GetFileName(path)); buffer.AppendLine("Location: " + Path.GetDirectoryName(path)); buffer.AppendLine("Framework: " + RuntimeInformation.FrameworkDescription); buffer.AppendLine("File Version: " + fi.FileVersion); buffer.AppendLine("Product Version: " + fi.ProductVersion); buffer.AppendLine("Creation Date: " + File.GetCreationTime(path)); buffer.AppendLine("Last Modified: " + File.GetLastWriteTime(path)); return buffer.ToString(); } } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/baseservices/exceptions/stackoverflow/stackoverflowtester.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <Optimize>false</Optimize> <!-- Fails in many GCStress jobs. https://github.com/dotnet/runtime/issues/46279 --> <GCStressIncompatible>true</GCStressIncompatible> </PropertyGroup> <ItemGroup> <Compile Include="stackoverflowtester.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <Optimize>false</Optimize> <!-- Fails in many GCStress jobs. https://github.com/dotnet/runtime/issues/46279 --> <GCStressIncompatible>true</GCStressIncompatible> </PropertyGroup> <ItemGroup> <Compile Include="stackoverflowtester.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/libraries/System.Net.Security/tests/FunctionalTests/NegotiateStreamKerberosTest.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.Globalization; using System.IO; using System.Linq; using System.Net.Sockets; using System.Net.Test.Common; using System.Security; using System.Security.Authentication; using System.Security.Principal; using System.Text; using System.Threading; using System.Threading.Tasks; using Xunit; namespace System.Net.Security.Tests { using Configuration = System.Net.Test.Common.Configuration; public class NegotiateStreamKerberosTest { public static bool IsServerAndDomainAvailable => Capability.IsDomainAvailable() && Capability.IsNegotiateServerAvailable(); public static bool IsClientAvailable => Capability.IsNegotiateClientAvailable(); public static IEnumerable<object[]> GoodCredentialsData { get { yield return new object[] { CredentialCache.DefaultNetworkCredentials }; yield return new object[] { new NetworkCredential( Configuration.Security.ActiveDirectoryUserName, Configuration.Security.ActiveDirectoryUserPassword, Configuration.Security.ActiveDirectoryName) }; yield return new object[] { new NetworkCredential( Configuration.Security.ActiveDirectoryUserName, AsSecureString(Configuration.Security.ActiveDirectoryUserPassword), Configuration.Security.ActiveDirectoryName) }; // Anonymous (with domain name). yield return new object[] { new NetworkCredential( Configuration.Security.ActiveDirectoryUserName, (string)null, Configuration.Security.ActiveDirectoryName) }; yield return new object[] { new NetworkCredential( Configuration.Security.ActiveDirectoryUserName, (SecureString)null, Configuration.Security.ActiveDirectoryName) }; // Anonymous (without domain). yield return new object[] { new NetworkCredential( Configuration.Security.ActiveDirectoryUserName, (string)null, null) }; yield return new object[] { new NetworkCredential( Configuration.Security.ActiveDirectoryUserName, (SecureString)null, null) }; } } public static IEnumerable<object[]> BadCredentialsData { get { yield return new object[] { new NetworkCredential(null, (string)null, Configuration.Security.ActiveDirectoryName) }; yield return new object[] { new NetworkCredential(null, (SecureString)null, Configuration.Security.ActiveDirectoryName) }; yield return new object[] { new NetworkCredential(null, (string)null, null) }; yield return new object[] { new NetworkCredential(null, (SecureString)null, null) }; yield return new object[] { new NetworkCredential( "baduser", (string)null, Configuration.Security.ActiveDirectoryName) }; yield return new object[] { new NetworkCredential( "baduser", (SecureString)null, Configuration.Security.ActiveDirectoryName) }; yield return new object[] { new NetworkCredential( "baduser", AsSecureString("badpassword"), Configuration.Security.ActiveDirectoryName) }; } } [OuterLoop] [ConditionalTheory(nameof(IsServerAndDomainAvailable))] [MemberData(nameof(GoodCredentialsData))] public async Task NegotiateStream_ClientAuthenticationRemote_Success(object credentialObject) { var credential = (NetworkCredential)credentialObject; await VerifyClientAuthentication(credential); } [OuterLoop] [ConditionalTheory(nameof(IsServerAndDomainAvailable))] [MemberData(nameof(BadCredentialsData))] public async Task NegotiateStream_ClientAuthenticationRemote_Fails(object credentialObject) { var credential = (NetworkCredential)credentialObject; await Assert.ThrowsAsync<AuthenticationException>(() => VerifyClientAuthentication(credential)); } private async Task VerifyClientAuthentication(NetworkCredential credential) { string serverName = Configuration.Security.NegotiateServer.Host; int port = Configuration.Security.NegotiateServer.Port; string serverSPN = "HOST/" + serverName; bool isLocalhost = await IsLocalHost(serverName); string expectedAuthenticationType = "Kerberos"; bool mutuallyAuthenticated = true; if (credential == CredentialCache.DefaultNetworkCredentials && isLocalhost) { expectedAuthenticationType = "NTLM"; } else if (credential != CredentialCache.DefaultNetworkCredentials && (string.IsNullOrEmpty(credential.UserName) || string.IsNullOrEmpty(credential.Password))) { // Anonymous authentication. expectedAuthenticationType = "NTLM"; mutuallyAuthenticated = false; } using (var client = new TcpClient()) { await client.ConnectAsync(serverName, port); NetworkStream clientStream = client.GetStream(); using (var auth = new NegotiateStream(clientStream, leaveInnerStreamOpen:false)) { await auth.AuthenticateAsClientAsync( credential, serverSPN, ProtectionLevel.EncryptAndSign, System.Security.Principal.TokenImpersonationLevel.Identification); Assert.Equal(expectedAuthenticationType, auth.RemoteIdentity.AuthenticationType); Assert.Equal(serverSPN, auth.RemoteIdentity.Name); Assert.True(auth.IsAuthenticated); Assert.True(auth.IsEncrypted); Assert.Equal(mutuallyAuthenticated, auth.IsMutuallyAuthenticated); Assert.True(auth.IsSigned); // Send a message to the server. Encode the test data into a byte array. byte[] message = Encoding.UTF8.GetBytes("Hello from the client."); await auth.WriteAsync(message, 0, message.Length); } } } [OuterLoop] [ConditionalFact(nameof(IsClientAvailable))] public async Task NegotiateStream_ServerAuthenticationRemote_Success() { string expectedUser = Configuration.Security.NegotiateClientUser; string expectedAuthenticationType = "Kerberos"; bool mutuallyAuthenticated = true; using (var controlClient = new TcpClient()) { string clientName = Configuration.Security.NegotiateClient.Host; int clientPort = Configuration.Security.NegotiateClient.Port; await controlClient.ConnectAsync(clientName, clientPort) .WaitAsync(TimeSpan.FromSeconds(15)); var serverStream = controlClient.GetStream(); using (var serverAuth = new NegotiateStream(serverStream, leaveInnerStreamOpen: false)) { await serverAuth.AuthenticateAsServerAsync( CredentialCache.DefaultNetworkCredentials, ProtectionLevel.EncryptAndSign, TokenImpersonationLevel.Identification) .WaitAsync(TimeSpan.FromSeconds(15)); Assert.True(serverAuth.IsAuthenticated, "IsAuthenticated"); Assert.True(serverAuth.IsEncrypted, "IsEncrypted"); Assert.True(serverAuth.IsSigned, "IsSigned"); Assert.Equal(mutuallyAuthenticated, serverAuth.IsMutuallyAuthenticated); Assert.Equal(expectedAuthenticationType, serverAuth.RemoteIdentity.AuthenticationType); Assert.Equal(expectedUser, serverAuth.RemoteIdentity.Name); // Receive a message from the client. var message = "Hello from the client."; using (var reader = new StreamReader(serverAuth)) { var response = await reader.ReadToEndAsync().WaitAsync(TimeSpan.FromSeconds(15)); Assert.Equal(message, response); } } } } private static async Task<bool> IsLocalHost(string hostname) { IPAddress[] hostAddresses = await Dns.GetHostAddressesAsync(hostname); IPAddress[] localHostAddresses = await Dns.GetHostAddressesAsync(Dns.GetHostName()); // Note: This returns 127.0.0.1 and ::1 but 127.0.0.0/8 which most systems consider localhost. IPAddress[] loopbackAddresses = await Dns.GetHostAddressesAsync("localhost"); int isLocalHost = hostAddresses.Intersect(localHostAddresses).Count(); int isLoopback = hostAddresses.Intersect(loopbackAddresses).Count(); return isLocalHost + isLoopback > 0; } private static SecureString AsSecureString(string str) { SecureString secureString = new SecureString(); if (string.IsNullOrEmpty(str)) { return secureString; } foreach (char ch in str) { secureString.AppendChar(ch); } return secureString; } } }
// 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.Globalization; using System.IO; using System.Linq; using System.Net.Sockets; using System.Net.Test.Common; using System.Security; using System.Security.Authentication; using System.Security.Principal; using System.Text; using System.Threading; using System.Threading.Tasks; using Xunit; namespace System.Net.Security.Tests { using Configuration = System.Net.Test.Common.Configuration; public class NegotiateStreamKerberosTest { public static bool IsServerAndDomainAvailable => Capability.IsDomainAvailable() && Capability.IsNegotiateServerAvailable(); public static bool IsClientAvailable => Capability.IsNegotiateClientAvailable(); public static IEnumerable<object[]> GoodCredentialsData { get { yield return new object[] { CredentialCache.DefaultNetworkCredentials }; yield return new object[] { new NetworkCredential( Configuration.Security.ActiveDirectoryUserName, Configuration.Security.ActiveDirectoryUserPassword, Configuration.Security.ActiveDirectoryName) }; yield return new object[] { new NetworkCredential( Configuration.Security.ActiveDirectoryUserName, AsSecureString(Configuration.Security.ActiveDirectoryUserPassword), Configuration.Security.ActiveDirectoryName) }; // Anonymous (with domain name). yield return new object[] { new NetworkCredential( Configuration.Security.ActiveDirectoryUserName, (string)null, Configuration.Security.ActiveDirectoryName) }; yield return new object[] { new NetworkCredential( Configuration.Security.ActiveDirectoryUserName, (SecureString)null, Configuration.Security.ActiveDirectoryName) }; // Anonymous (without domain). yield return new object[] { new NetworkCredential( Configuration.Security.ActiveDirectoryUserName, (string)null, null) }; yield return new object[] { new NetworkCredential( Configuration.Security.ActiveDirectoryUserName, (SecureString)null, null) }; } } public static IEnumerable<object[]> BadCredentialsData { get { yield return new object[] { new NetworkCredential(null, (string)null, Configuration.Security.ActiveDirectoryName) }; yield return new object[] { new NetworkCredential(null, (SecureString)null, Configuration.Security.ActiveDirectoryName) }; yield return new object[] { new NetworkCredential(null, (string)null, null) }; yield return new object[] { new NetworkCredential(null, (SecureString)null, null) }; yield return new object[] { new NetworkCredential( "baduser", (string)null, Configuration.Security.ActiveDirectoryName) }; yield return new object[] { new NetworkCredential( "baduser", (SecureString)null, Configuration.Security.ActiveDirectoryName) }; yield return new object[] { new NetworkCredential( "baduser", AsSecureString("badpassword"), Configuration.Security.ActiveDirectoryName) }; } } [OuterLoop] [ConditionalTheory(nameof(IsServerAndDomainAvailable))] [MemberData(nameof(GoodCredentialsData))] public async Task NegotiateStream_ClientAuthenticationRemote_Success(object credentialObject) { var credential = (NetworkCredential)credentialObject; await VerifyClientAuthentication(credential); } [OuterLoop] [ConditionalTheory(nameof(IsServerAndDomainAvailable))] [MemberData(nameof(BadCredentialsData))] public async Task NegotiateStream_ClientAuthenticationRemote_Fails(object credentialObject) { var credential = (NetworkCredential)credentialObject; await Assert.ThrowsAsync<AuthenticationException>(() => VerifyClientAuthentication(credential)); } private async Task VerifyClientAuthentication(NetworkCredential credential) { string serverName = Configuration.Security.NegotiateServer.Host; int port = Configuration.Security.NegotiateServer.Port; string serverSPN = "HOST/" + serverName; bool isLocalhost = await IsLocalHost(serverName); string expectedAuthenticationType = "Kerberos"; bool mutuallyAuthenticated = true; if (credential == CredentialCache.DefaultNetworkCredentials && isLocalhost) { expectedAuthenticationType = "NTLM"; } else if (credential != CredentialCache.DefaultNetworkCredentials && (string.IsNullOrEmpty(credential.UserName) || string.IsNullOrEmpty(credential.Password))) { // Anonymous authentication. expectedAuthenticationType = "NTLM"; mutuallyAuthenticated = false; } using (var client = new TcpClient()) { await client.ConnectAsync(serverName, port); NetworkStream clientStream = client.GetStream(); using (var auth = new NegotiateStream(clientStream, leaveInnerStreamOpen:false)) { await auth.AuthenticateAsClientAsync( credential, serverSPN, ProtectionLevel.EncryptAndSign, System.Security.Principal.TokenImpersonationLevel.Identification); Assert.Equal(expectedAuthenticationType, auth.RemoteIdentity.AuthenticationType); Assert.Equal(serverSPN, auth.RemoteIdentity.Name); Assert.True(auth.IsAuthenticated); Assert.True(auth.IsEncrypted); Assert.Equal(mutuallyAuthenticated, auth.IsMutuallyAuthenticated); Assert.True(auth.IsSigned); // Send a message to the server. Encode the test data into a byte array. byte[] message = Encoding.UTF8.GetBytes("Hello from the client."); await auth.WriteAsync(message, 0, message.Length); } } } [OuterLoop] [ConditionalFact(nameof(IsClientAvailable))] public async Task NegotiateStream_ServerAuthenticationRemote_Success() { string expectedUser = Configuration.Security.NegotiateClientUser; string expectedAuthenticationType = "Kerberos"; bool mutuallyAuthenticated = true; using (var controlClient = new TcpClient()) { string clientName = Configuration.Security.NegotiateClient.Host; int clientPort = Configuration.Security.NegotiateClient.Port; await controlClient.ConnectAsync(clientName, clientPort) .WaitAsync(TimeSpan.FromSeconds(15)); var serverStream = controlClient.GetStream(); using (var serverAuth = new NegotiateStream(serverStream, leaveInnerStreamOpen: false)) { await serverAuth.AuthenticateAsServerAsync( CredentialCache.DefaultNetworkCredentials, ProtectionLevel.EncryptAndSign, TokenImpersonationLevel.Identification) .WaitAsync(TimeSpan.FromSeconds(15)); Assert.True(serverAuth.IsAuthenticated, "IsAuthenticated"); Assert.True(serverAuth.IsEncrypted, "IsEncrypted"); Assert.True(serverAuth.IsSigned, "IsSigned"); Assert.Equal(mutuallyAuthenticated, serverAuth.IsMutuallyAuthenticated); Assert.Equal(expectedAuthenticationType, serverAuth.RemoteIdentity.AuthenticationType); Assert.Equal(expectedUser, serverAuth.RemoteIdentity.Name); // Receive a message from the client. var message = "Hello from the client."; using (var reader = new StreamReader(serverAuth)) { var response = await reader.ReadToEndAsync().WaitAsync(TimeSpan.FromSeconds(15)); Assert.Equal(message, response); } } } } private static async Task<bool> IsLocalHost(string hostname) { IPAddress[] hostAddresses = await Dns.GetHostAddressesAsync(hostname); IPAddress[] localHostAddresses = await Dns.GetHostAddressesAsync(Dns.GetHostName()); // Note: This returns 127.0.0.1 and ::1 but 127.0.0.0/8 which most systems consider localhost. IPAddress[] loopbackAddresses = await Dns.GetHostAddressesAsync("localhost"); int isLocalHost = hostAddresses.Intersect(localHostAddresses).Count(); int isLoopback = hostAddresses.Intersect(loopbackAddresses).Count(); return isLocalHost + isLoopback > 0; } private static SecureString AsSecureString(string str) { SecureString secureString = new SecureString(); if (string.IsNullOrEmpty(str)) { return secureString; } foreach (char ch in str) { secureString.AppendChar(ch); } return secureString; } } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/JIT/HardwareIntrinsics/Arm/AdvSimd/Max.Vector64.UInt32.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 Max_Vector64_UInt32() { var test = new SimpleBinaryOpTest__Max_Vector64_UInt32(); 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__Max_Vector64_UInt32 { 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, UInt32[] inArray2, UInt32[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<UInt32>(); int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<UInt32>(); 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<UInt32, 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<UInt32> _fld1; public Vector64<UInt32> _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<Vector64<UInt32>, byte>(ref testStruct._fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<UInt32>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt32>, byte>(ref testStruct._fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<UInt32>>()); return testStruct; } public void RunStructFldScenario(SimpleBinaryOpTest__Max_Vector64_UInt32 testClass) { var result = AdvSimd.Max(_fld1, _fld2); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } public void RunStructFldScenario_Load(SimpleBinaryOpTest__Max_Vector64_UInt32 testClass) { fixed (Vector64<UInt32>* pFld1 = &_fld1) fixed (Vector64<UInt32>* pFld2 = &_fld2) { var result = AdvSimd.Max( AdvSimd.LoadVector64((UInt32*)(pFld1)), AdvSimd.LoadVector64((UInt32*)(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<UInt32>>() / sizeof(UInt32); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector64<UInt32>>() / sizeof(UInt32); private static readonly int RetElementCount = Unsafe.SizeOf<Vector64<UInt32>>() / sizeof(UInt32); private static UInt32[] _data1 = new UInt32[Op1ElementCount]; private static UInt32[] _data2 = new UInt32[Op2ElementCount]; private static Vector64<UInt32> _clsVar1; private static Vector64<UInt32> _clsVar2; private Vector64<UInt32> _fld1; private Vector64<UInt32> _fld2; private DataTable _dataTable; static SimpleBinaryOpTest__Max_Vector64_UInt32() { 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>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<UInt32>>()); } public SimpleBinaryOpTest__Max_Vector64_UInt32() { 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>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<UInt32>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt32(); } _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.Max( Unsafe.Read<Vector64<UInt32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector64<UInt32>>(_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.Max( AdvSimd.LoadVector64((UInt32*)(_dataTable.inArray1Ptr)), AdvSimd.LoadVector64((UInt32*)(_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.Max), new Type[] { typeof(Vector64<UInt32>), typeof(Vector64<UInt32>) }) .Invoke(null, new object[] { Unsafe.Read<Vector64<UInt32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector64<UInt32>>(_dataTable.inArray2Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector64<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.Max), new Type[] { typeof(Vector64<UInt32>), typeof(Vector64<UInt32>) }) .Invoke(null, new object[] { AdvSimd.LoadVector64((UInt32*)(_dataTable.inArray1Ptr)), AdvSimd.LoadVector64((UInt32*)(_dataTable.inArray2Ptr)) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector64<UInt32>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = AdvSimd.Max( _clsVar1, _clsVar2 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } public void RunClsVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load)); fixed (Vector64<UInt32>* pClsVar1 = &_clsVar1) fixed (Vector64<UInt32>* pClsVar2 = &_clsVar2) { var result = AdvSimd.Max( AdvSimd.LoadVector64((UInt32*)(pClsVar1)), AdvSimd.LoadVector64((UInt32*)(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<UInt32>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector64<UInt32>>(_dataTable.inArray2Ptr); var result = AdvSimd.Max(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((UInt32*)(_dataTable.inArray1Ptr)); var op2 = AdvSimd.LoadVector64((UInt32*)(_dataTable.inArray2Ptr)); var result = AdvSimd.Max(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new SimpleBinaryOpTest__Max_Vector64_UInt32(); var result = AdvSimd.Max(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__Max_Vector64_UInt32(); fixed (Vector64<UInt32>* pFld1 = &test._fld1) fixed (Vector64<UInt32>* pFld2 = &test._fld2) { var result = AdvSimd.Max( AdvSimd.LoadVector64((UInt32*)(pFld1)), AdvSimd.LoadVector64((UInt32*)(pFld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = AdvSimd.Max(_fld1, _fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } public void RunClassFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load)); fixed (Vector64<UInt32>* pFld1 = &_fld1) fixed (Vector64<UInt32>* pFld2 = &_fld2) { var result = AdvSimd.Max( AdvSimd.LoadVector64((UInt32*)(pFld1)), AdvSimd.LoadVector64((UInt32*)(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.Max(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.Max( AdvSimd.LoadVector64((UInt32*)(&test._fld1)), AdvSimd.LoadVector64((UInt32*)(&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<UInt32> op1, Vector64<UInt32> op2, void* result, [CallerMemberName] string method = "") { UInt32[] inArray1 = new UInt32[Op1ElementCount]; UInt32[] inArray2 = new UInt32[Op2ElementCount]; UInt32[] outArray = new UInt32[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), op1); Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), op2); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<UInt32>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(void* op1, void* op2, void* result, [CallerMemberName] string method = "") { UInt32[] inArray1 = new UInt32[Op1ElementCount]; UInt32[] inArray2 = new UInt32[Op2ElementCount]; 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 inArray2[0]), ref Unsafe.AsRef<byte>(op2), (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, inArray2, outArray, method); } private void ValidateResult(UInt32[] left, UInt32[] right, UInt32[] result, [CallerMemberName] string method = "") { bool succeeded = true; for (var i = 0; i < RetElementCount; i++) { if (Helpers.Max(left[i], right[i]) != result[i]) { succeeded = false; break; } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd)}.{nameof(AdvSimd.Max)}<UInt32>(Vector64<UInt32>, Vector64<UInt32>): {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 Max_Vector64_UInt32() { var test = new SimpleBinaryOpTest__Max_Vector64_UInt32(); 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__Max_Vector64_UInt32 { 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, UInt32[] inArray2, UInt32[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<UInt32>(); int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<UInt32>(); 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<UInt32, 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<UInt32> _fld1; public Vector64<UInt32> _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<Vector64<UInt32>, byte>(ref testStruct._fld1), ref Unsafe.As<UInt32, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<UInt32>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt32>, byte>(ref testStruct._fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<UInt32>>()); return testStruct; } public void RunStructFldScenario(SimpleBinaryOpTest__Max_Vector64_UInt32 testClass) { var result = AdvSimd.Max(_fld1, _fld2); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } public void RunStructFldScenario_Load(SimpleBinaryOpTest__Max_Vector64_UInt32 testClass) { fixed (Vector64<UInt32>* pFld1 = &_fld1) fixed (Vector64<UInt32>* pFld2 = &_fld2) { var result = AdvSimd.Max( AdvSimd.LoadVector64((UInt32*)(pFld1)), AdvSimd.LoadVector64((UInt32*)(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<UInt32>>() / sizeof(UInt32); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector64<UInt32>>() / sizeof(UInt32); private static readonly int RetElementCount = Unsafe.SizeOf<Vector64<UInt32>>() / sizeof(UInt32); private static UInt32[] _data1 = new UInt32[Op1ElementCount]; private static UInt32[] _data2 = new UInt32[Op2ElementCount]; private static Vector64<UInt32> _clsVar1; private static Vector64<UInt32> _clsVar2; private Vector64<UInt32> _fld1; private Vector64<UInt32> _fld2; private DataTable _dataTable; static SimpleBinaryOpTest__Max_Vector64_UInt32() { 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>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<UInt32>>()); } public SimpleBinaryOpTest__Max_Vector64_UInt32() { 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>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector64<UInt32>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt32(); } _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.Max( Unsafe.Read<Vector64<UInt32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector64<UInt32>>(_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.Max( AdvSimd.LoadVector64((UInt32*)(_dataTable.inArray1Ptr)), AdvSimd.LoadVector64((UInt32*)(_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.Max), new Type[] { typeof(Vector64<UInt32>), typeof(Vector64<UInt32>) }) .Invoke(null, new object[] { Unsafe.Read<Vector64<UInt32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector64<UInt32>>(_dataTable.inArray2Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector64<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.Max), new Type[] { typeof(Vector64<UInt32>), typeof(Vector64<UInt32>) }) .Invoke(null, new object[] { AdvSimd.LoadVector64((UInt32*)(_dataTable.inArray1Ptr)), AdvSimd.LoadVector64((UInt32*)(_dataTable.inArray2Ptr)) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector64<UInt32>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = AdvSimd.Max( _clsVar1, _clsVar2 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } public void RunClsVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load)); fixed (Vector64<UInt32>* pClsVar1 = &_clsVar1) fixed (Vector64<UInt32>* pClsVar2 = &_clsVar2) { var result = AdvSimd.Max( AdvSimd.LoadVector64((UInt32*)(pClsVar1)), AdvSimd.LoadVector64((UInt32*)(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<UInt32>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector64<UInt32>>(_dataTable.inArray2Ptr); var result = AdvSimd.Max(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((UInt32*)(_dataTable.inArray1Ptr)); var op2 = AdvSimd.LoadVector64((UInt32*)(_dataTable.inArray2Ptr)); var result = AdvSimd.Max(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new SimpleBinaryOpTest__Max_Vector64_UInt32(); var result = AdvSimd.Max(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__Max_Vector64_UInt32(); fixed (Vector64<UInt32>* pFld1 = &test._fld1) fixed (Vector64<UInt32>* pFld2 = &test._fld2) { var result = AdvSimd.Max( AdvSimd.LoadVector64((UInt32*)(pFld1)), AdvSimd.LoadVector64((UInt32*)(pFld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = AdvSimd.Max(_fld1, _fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } public void RunClassFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load)); fixed (Vector64<UInt32>* pFld1 = &_fld1) fixed (Vector64<UInt32>* pFld2 = &_fld2) { var result = AdvSimd.Max( AdvSimd.LoadVector64((UInt32*)(pFld1)), AdvSimd.LoadVector64((UInt32*)(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.Max(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.Max( AdvSimd.LoadVector64((UInt32*)(&test._fld1)), AdvSimd.LoadVector64((UInt32*)(&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<UInt32> op1, Vector64<UInt32> op2, void* result, [CallerMemberName] string method = "") { UInt32[] inArray1 = new UInt32[Op1ElementCount]; UInt32[] inArray2 = new UInt32[Op2ElementCount]; UInt32[] outArray = new UInt32[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), op1); Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray2[0]), op2); Unsafe.CopyBlockUnaligned(ref Unsafe.As<UInt32, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector64<UInt32>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(void* op1, void* op2, void* result, [CallerMemberName] string method = "") { UInt32[] inArray1 = new UInt32[Op1ElementCount]; UInt32[] inArray2 = new UInt32[Op2ElementCount]; 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 inArray2[0]), ref Unsafe.AsRef<byte>(op2), (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, inArray2, outArray, method); } private void ValidateResult(UInt32[] left, UInt32[] right, UInt32[] result, [CallerMemberName] string method = "") { bool succeeded = true; for (var i = 0; i < RetElementCount; i++) { if (Helpers.Max(left[i], right[i]) != result[i]) { succeeded = false; break; } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd)}.{nameof(AdvSimd.Max)}<UInt32>(Vector64<UInt32>, Vector64<UInt32>): {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,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/DependencyAnalysis/CodeBasedDependencyAlgorithm.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.IL; using Internal.Text; using Internal.TypeSystem; using ILCompiler.DependencyAnalysisFramework; using ILCompiler.DependencyAnalysis; using DependencyList=ILCompiler.DependencyAnalysisFramework.DependencyNodeCore<ILCompiler.DependencyAnalysis.NodeFactory>.DependencyList; using CombinedDependencyList=System.Collections.Generic.List<ILCompiler.DependencyAnalysisFramework.DependencyNodeCore<ILCompiler.DependencyAnalysis.NodeFactory>.CombinedDependencyListEntry>; using DependencyListEntry=ILCompiler.DependencyAnalysisFramework.DependencyNodeCore<ILCompiler.DependencyAnalysis.NodeFactory>.DependencyListEntry; namespace ILCompiler.DependencyAnalysis { public static class CodeBasedDependencyAlgorithm { public static void AddDependenciesDueToMethodCodePresence(ref DependencyList dependencies, NodeFactory factory, MethodDesc method, MethodIL methodIL) { factory.MetadataManager.GetDependenciesDueToMethodCodePresence(ref dependencies, factory, method, methodIL); factory.InteropStubManager.AddDependeciesDueToPInvoke(ref dependencies, factory, method); if (method.OwningType is MetadataType mdOwningType && mdOwningType.Module.GetGlobalModuleType().GetStaticConstructor() is MethodDesc moduleCctor) { dependencies ??= new DependencyList(); dependencies.Add(factory.MethodEntrypoint(moduleCctor), "Method in a module with initializer"); } if (method.IsIntrinsic) { if (method.OwningType is MetadataType owningType) { string name = method.Name; switch (name) { // The general purpose code in Comparer/EqualityComparer Create method depends on the template // type loader being able to load the necessary types at runtime. case "Create": if (method.IsSharedByGenericInstantiations && owningType.Module == factory.TypeSystemContext.SystemModule && owningType.Namespace == "System.Collections.Generic") { TypeDesc[] templateDependencies = null; if (owningType.Name == "Comparer`1") { templateDependencies = Internal.IL.Stubs.ComparerIntrinsics.GetPotentialComparersForType( owningType.Instantiation[0]); } else if (owningType.Name == "EqualityComparer`1") { templateDependencies = Internal.IL.Stubs.ComparerIntrinsics.GetPotentialEqualityComparersForType( owningType.Instantiation[0]); } if (templateDependencies != null) { dependencies = dependencies ?? new DependencyList(); foreach (TypeDesc templateType in templateDependencies) { dependencies.Add(factory.NativeLayout.TemplateTypeLayout(templateType), "Generic comparer"); } } } break; } } } } public static bool HasConditionalDependenciesDueToMethodCodePresence(MethodDesc method) { // NICE: would be nice if the metadata managed could decide this but we don't have a way to get at it return method.HasInstantiation || method.OwningType.HasInstantiation; } public static void AddConditionalDependenciesDueToMethodCodePresence(ref CombinedDependencyList dependencies, NodeFactory factory, MethodDesc method) { factory.MetadataManager.GetConditionalDependenciesDueToMethodCodePresence(ref dependencies, factory, method); } } }
// 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.IL; using Internal.Text; using Internal.TypeSystem; using ILCompiler.DependencyAnalysisFramework; using ILCompiler.DependencyAnalysis; using DependencyList=ILCompiler.DependencyAnalysisFramework.DependencyNodeCore<ILCompiler.DependencyAnalysis.NodeFactory>.DependencyList; using CombinedDependencyList=System.Collections.Generic.List<ILCompiler.DependencyAnalysisFramework.DependencyNodeCore<ILCompiler.DependencyAnalysis.NodeFactory>.CombinedDependencyListEntry>; using DependencyListEntry=ILCompiler.DependencyAnalysisFramework.DependencyNodeCore<ILCompiler.DependencyAnalysis.NodeFactory>.DependencyListEntry; namespace ILCompiler.DependencyAnalysis { public static class CodeBasedDependencyAlgorithm { public static void AddDependenciesDueToMethodCodePresence(ref DependencyList dependencies, NodeFactory factory, MethodDesc method, MethodIL methodIL) { factory.MetadataManager.GetDependenciesDueToMethodCodePresence(ref dependencies, factory, method, methodIL); factory.InteropStubManager.AddDependeciesDueToPInvoke(ref dependencies, factory, method); if (method.OwningType is MetadataType mdOwningType && mdOwningType.Module.GetGlobalModuleType().GetStaticConstructor() is MethodDesc moduleCctor) { dependencies ??= new DependencyList(); dependencies.Add(factory.MethodEntrypoint(moduleCctor), "Method in a module with initializer"); } if (method.IsIntrinsic) { if (method.OwningType is MetadataType owningType) { string name = method.Name; switch (name) { // The general purpose code in Comparer/EqualityComparer Create method depends on the template // type loader being able to load the necessary types at runtime. case "Create": if (method.IsSharedByGenericInstantiations && owningType.Module == factory.TypeSystemContext.SystemModule && owningType.Namespace == "System.Collections.Generic") { TypeDesc[] templateDependencies = null; if (owningType.Name == "Comparer`1") { templateDependencies = Internal.IL.Stubs.ComparerIntrinsics.GetPotentialComparersForType( owningType.Instantiation[0]); } else if (owningType.Name == "EqualityComparer`1") { templateDependencies = Internal.IL.Stubs.ComparerIntrinsics.GetPotentialEqualityComparersForType( owningType.Instantiation[0]); } if (templateDependencies != null) { dependencies = dependencies ?? new DependencyList(); foreach (TypeDesc templateType in templateDependencies) { dependencies.Add(factory.NativeLayout.TemplateTypeLayout(templateType), "Generic comparer"); } } } break; } } } } public static bool HasConditionalDependenciesDueToMethodCodePresence(MethodDesc method) { // NICE: would be nice if the metadata managed could decide this but we don't have a way to get at it return method.HasInstantiation || method.OwningType.HasInstantiation; } public static void AddConditionalDependenciesDueToMethodCodePresence(ref CombinedDependencyList dependencies, NodeFactory factory, MethodDesc method) { factory.MetadataManager.GetConditionalDependenciesDueToMethodCodePresence(ref dependencies, factory, method); } } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/libraries/System.IO.MemoryMappedFiles/src/System/IO/MemoryMappedFiles/MemoryMappedFileOptions.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.IO.MemoryMappedFiles { [Flags] public enum MemoryMappedFileOptions { None = 0, DelayAllocatePages = 0x4000000 } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. namespace System.IO.MemoryMappedFiles { [Flags] public enum MemoryMappedFileOptions { None = 0, DelayAllocatePages = 0x4000000 } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/libraries/System.IO.Hashing/tests/NonCryptoHashBaseTests.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.Threading; using System.Threading.Tasks; using Test.IO.Streams; using Xunit; namespace System.IO.Hashing.Tests { public static class NonCryptoHashBaseTests { [Fact] public static void ZeroLengthHashIsInvalid() { AssertExtensions.Throws<ArgumentOutOfRangeException>( "hashLengthInBytes", () => new FlexibleAlgorithm(0)); } [Fact] public static void NegativeHashLengthIsInvalid() { AssertExtensions.Throws<ArgumentOutOfRangeException>( "hashLengthInBytes", () => new FlexibleAlgorithm(-1)); } [Fact] public static void TryGetCurrentHash_TooSmall() { Span<byte> buf = stackalloc byte[7]; FlexibleAlgorithm hash = new FlexibleAlgorithm(buf.Length + 1); Assert.True(hash.IsReset); hash.Append(buf); Assert.False(hash.IsReset); while (true) { Assert.False(hash.TryGetCurrentHash(buf, out int written)); Assert.Equal(0, written); if (buf.IsEmpty) { break; } buf = buf.Slice(1); } Assert.Equal(0, hash.GetCurrentHashCoreCallCount); Assert.False(hash.IsReset); } [Fact] public static void TryGetCurrentHash_TooBig_Succeeds() { Span<byte> buf = stackalloc byte[16]; FlexibleAlgorithm hash = new FlexibleAlgorithm(buf.Length / 2); int i = 0; hash.Append(buf); while (buf.Length > hash.HashLengthInBytes) { Assert.Equal(i, hash.GetCurrentHashCoreCallCount); // TryGetCurrentHash in turn asserts that buf got Sliced down to HashLengthInBytes. Assert.True(hash.TryGetCurrentHash(buf, out int written)); Assert.Equal(hash.HashLengthInBytes, written); buf = buf.Slice(1); i++; } Assert.Equal(i, hash.GetCurrentHashCoreCallCount); Assert.False(hash.IsReset); } [Fact] public static void GetCurrentHash_TooSmall() { byte[] buf = new byte[7]; FlexibleAlgorithm hash = new FlexibleAlgorithm(buf.Length + 1); Assert.True(hash.IsReset); hash.Append(buf); Assert.False(hash.IsReset); for (int i = 0; i <= buf.Length; i++) { AssertExtensions.Throws<ArgumentException>( "destination", () => hash.GetCurrentHash(buf.AsSpan(i))); } Assert.False(hash.IsReset); } [Fact] public static void GetCurrentHash_TooBig_Succeeds() { Span<byte> buf = stackalloc byte[16]; FlexibleAlgorithm hash = new FlexibleAlgorithm(buf.Length / 2); int i = 0; hash.Append(buf); while (buf.Length > hash.HashLengthInBytes) { Assert.Equal(i, hash.GetCurrentHashCoreCallCount); // GetCurrentHash in turn asserts that buf got Sliced down to HashLengthInBytes. int written = hash.GetCurrentHash(buf); Assert.Equal(hash.HashLengthInBytes, written); buf = buf.Slice(1); i++; } Assert.Equal(i, hash.GetCurrentHashCoreCallCount); Assert.False(hash.IsReset); } [Fact] public static void AllocatingGetCurrentHash_CorrectSize() { FlexibleAlgorithm hash = new FlexibleAlgorithm(12); byte[] ret = hash.GetCurrentHash(); Assert.Equal(hash.HashLengthInBytes, ret.Length); Assert.Equal(1, hash.GetCurrentHashCoreCallCount); } [Fact] public static void DefaultGetHashAndResetDoesWhatItSays() { Span<byte> buf = stackalloc byte[16]; FlexibleAlgorithm hash = new FlexibleAlgorithm(buf.Length); Assert.True(hash.IsReset); hash.Append(buf); Assert.False(hash.IsReset); Assert.Equal(0, hash.GetCurrentHashCoreCallCount); byte[] ret = hash.GetHashAndReset(); Assert.True(hash.IsReset); Assert.Equal(1, hash.GetCurrentHashCoreCallCount); Assert.Equal(hash.HashLengthInBytes, ret.Length); hash.Append(ret); Assert.False(hash.IsReset); Assert.True(hash.TryGetHashAndReset(buf, out int written)); Assert.True(hash.IsReset); Assert.Equal(2, hash.GetCurrentHashCoreCallCount); Assert.Equal(hash.HashLengthInBytes, written); hash.Append(ret); Assert.False(hash.IsReset); written = hash.GetHashAndReset(buf); Assert.True(hash.IsReset); Assert.Equal(3, hash.GetCurrentHashCoreCallCount); Assert.Equal(hash.HashLengthInBytes, written); } [Fact] public static void TryGetHashAndReset_TooSmall() { Span<byte> buf = stackalloc byte[7]; FlexibleAlgorithm hash = new FlexibleAlgorithm(buf.Length + 1); Assert.True(hash.IsReset); hash.Append(buf); Assert.False(hash.IsReset); while (true) { Assert.False(hash.TryGetHashAndReset(buf, out int written)); Assert.Equal(0, written); if (buf.IsEmpty) { break; } buf = buf.Slice(1); } Assert.Equal(0, hash.GetCurrentHashCoreCallCount); Assert.False(hash.IsReset); } [Fact] public static void TryGetHashAndReset_TooBig_Succeeds() { Span<byte> buf = stackalloc byte[16]; FlexibleAlgorithm hash = new FlexibleAlgorithm(buf.Length / 2); int i = 0; while (buf.Length > hash.HashLengthInBytes) { Assert.Equal(i, hash.GetCurrentHashCoreCallCount); hash.Append(buf); Assert.False(hash.IsReset); // TryGetCurrentHash in turn asserts that buf got Sliced down to HashLengthInBytes. Assert.True(hash.TryGetHashAndReset(buf, out int written)); Assert.Equal(hash.HashLengthInBytes, written); Assert.True(hash.IsReset); buf = buf.Slice(1); i++; } Assert.Equal(i, hash.GetCurrentHashCoreCallCount); Assert.True(hash.IsReset); } [Fact] public static void GetHashAndReset_TooSmall() { byte[] buf = new byte[7]; FlexibleAlgorithm hash = new FlexibleAlgorithm(buf.Length + 1); Assert.True(hash.IsReset); hash.Append(buf); Assert.False(hash.IsReset); for (int i = 0; i <= buf.Length; i++) { AssertExtensions.Throws<ArgumentException>( "destination", () => hash.GetHashAndReset(buf.AsSpan(i))); } Assert.Equal(0, hash.GetCurrentHashCoreCallCount); Assert.False(hash.IsReset); } [Fact] public static void GetHashAndReset_TooBig_Succeeds() { Span<byte> buf = stackalloc byte[16]; FlexibleAlgorithm hash = new FlexibleAlgorithm(buf.Length / 2); int i = 0; while (buf.Length > hash.HashLengthInBytes) { Assert.Equal(i, hash.GetCurrentHashCoreCallCount); hash.Append(buf); Assert.False(hash.IsReset); Assert.True(hash.TryGetHashAndReset(buf, out int written)); Assert.Equal(hash.HashLengthInBytes, written); Assert.True(hash.IsReset); buf = buf.Slice(1); i++; } Assert.Equal(i, hash.GetCurrentHashCoreCallCount); Assert.True(hash.IsReset); } [Fact] public static void AllocatingGetHashAndReset_CorrectSize() { FlexibleAlgorithm hash = new FlexibleAlgorithm(12); byte[] ret = hash.GetHashAndReset(); Assert.Equal(hash.HashLengthInBytes, ret.Length); Assert.Equal(1, hash.GetCurrentHashCoreCallCount); } [Fact] public static void OverriddenTryGetHashAndReset_TooSmall() { Span<byte> buf = stackalloc byte[7]; var hash = new FlexibleAlgorithmOverride(buf.Length + 1); Assert.True(hash.IsReset); hash.Append(buf); Assert.False(hash.IsReset); while (true) { Assert.False(hash.TryGetHashAndReset(buf, out int written)); Assert.Equal(0, written); if (buf.IsEmpty) { break; } buf = buf.Slice(1); } Assert.Equal(0, hash.GetCurrentHashCoreCallCount); Assert.Equal(0, hash.GetHashAndResetCoreCallCount); Assert.False(hash.IsReset); } [Fact] public static void OverriddenTryGetHashAndReset_TooBig_Succeeds() { Span<byte> buf = stackalloc byte[16]; var hash = new FlexibleAlgorithmOverride(buf.Length / 2); int i = 0; while (buf.Length > hash.HashLengthInBytes) { Assert.Equal(0, hash.GetCurrentHashCoreCallCount); Assert.Equal(i, hash.GetHashAndResetCoreCallCount); hash.Append(buf); Assert.False(hash.IsReset); // TryGetCurrentHash in turn asserts that buf got Sliced down to HashLengthInBytes. Assert.True(hash.TryGetHashAndReset(buf, out int written)); Assert.Equal(hash.HashLengthInBytes, written); Assert.True(hash.IsReset); buf = buf.Slice(1); i++; } Assert.Equal(0, hash.GetCurrentHashCoreCallCount); Assert.Equal(i, hash.GetHashAndResetCoreCallCount); Assert.True(hash.IsReset); } [Fact] public static void OverriddenGetHashAndReset_TooSmall() { byte[] buf = new byte[7]; var hash = new FlexibleAlgorithmOverride(buf.Length + 1); Assert.True(hash.IsReset); hash.Append(buf); Assert.False(hash.IsReset); for (int i = 0; i <= buf.Length; i++) { AssertExtensions.Throws<ArgumentException>( "destination", () => hash.GetHashAndReset(buf.AsSpan(i))); } Assert.Equal(0, hash.GetCurrentHashCoreCallCount); Assert.Equal(0, hash.GetHashAndResetCoreCallCount); Assert.False(hash.IsReset); } [Fact] public static void OverriddenGetHashAndReset_TooBig_Succeeds() { Span<byte> buf = stackalloc byte[16]; var hash = new FlexibleAlgorithmOverride(buf.Length / 2); int i = 0; while (buf.Length > hash.HashLengthInBytes) { Assert.Equal(0, hash.GetCurrentHashCoreCallCount); Assert.Equal(i, hash.GetHashAndResetCoreCallCount); hash.Append(buf); Assert.False(hash.IsReset); Assert.True(hash.TryGetHashAndReset(buf, out int written)); Assert.Equal(hash.HashLengthInBytes, written); Assert.True(hash.IsReset); buf = buf.Slice(1); i++; } Assert.Equal(0, hash.GetCurrentHashCoreCallCount); Assert.Equal(i, hash.GetHashAndResetCoreCallCount); Assert.True(hash.IsReset); } [Fact] public static void OverriddenAllocatingGetHashAndReset_CorrectSize() { var hash = new FlexibleAlgorithmOverride(12); byte[] ret = hash.GetHashAndReset(); Assert.Equal(hash.HashLengthInBytes, ret.Length); Assert.Equal(0, hash.GetCurrentHashCoreCallCount); Assert.Equal(1, hash.GetHashAndResetCoreCallCount); } [Fact] public static void AppendNullArrayThrows() { NonCryptographicHashAlgorithm hash = new FlexibleAlgorithm(5); AssertExtensions.Throws<ArgumentNullException>("source", () => hash.Append((byte[])null)); } [Fact] public static void AppendNullStreamThrows() { NonCryptographicHashAlgorithm hash = new FlexibleAlgorithm(5); AssertExtensions.Throws<ArgumentNullException>("stream", () => hash.Append((Stream)null)); } [Fact] public static void AppendAsyncNullStreamThrows_OutsideTask() { NonCryptographicHashAlgorithm hash = new FlexibleAlgorithm(5); AssertExtensions.Throws<ArgumentNullException>("stream", () => hash.AppendAsync(null)); } [Theory] [InlineData(0)] [InlineData(511)] [InlineData(4097)] [InlineData(1048581)] public static void AppendStreamSanityTest(int streamSize) { NonCryptographicHashAlgorithm hash = new CountingAlgorithm(); using (PositionValueStream stream = new PositionValueStream(streamSize)) { hash.Append(stream); } Span<byte> val = stackalloc byte[sizeof(int)]; hash.GetHashAndReset(val); int res = BinaryPrimitives.ReadInt32LittleEndian(val); Assert.Equal(streamSize, res); } [Theory] [InlineData(0)] [InlineData(511)] [InlineData(4097)] [InlineData(1048581)] public static async Task AppendStreamAsyncSanityTest(int streamSize) { NonCryptographicHashAlgorithm hash = new CountingAlgorithm(); using (PositionValueStream stream = new PositionValueStream(streamSize)) { await hash.AppendAsync(stream); } byte[] val = new byte[sizeof(int)]; hash.GetHashAndReset(val); int res = BinaryPrimitives.ReadInt32LittleEndian(val); Assert.Equal(streamSize, res); } [Fact] public static void AppendStreamAsyncSupportsCancellation() { NonCryptographicHashAlgorithm hash = new CountingAlgorithm(); using (PositionValueStream stream = new PositionValueStream(21)) using (CancellationTokenSource cts = new CancellationTokenSource()) { cts.Cancel(); Task task = hash.AppendAsync(stream, cts.Token); Assert.True(task.IsCompleted); Assert.True(task.IsCanceled); } byte[] val = new byte[sizeof(int)]; hash.GetHashAndReset(val); int res = BinaryPrimitives.ReadInt32LittleEndian(val); Assert.Equal(0, res); } [Fact] public static void GetHashCode_NotSupported() { NonCryptographicHashAlgorithm hash = new CountingAlgorithm(); Assert.Throws<NotSupportedException>(() => hash.GetHashCode()); } private sealed class CountingAlgorithm : NonCryptographicHashAlgorithm { private int _count; public CountingAlgorithm() : base(sizeof(int)) { } public override void Append(ReadOnlySpan<byte> source) { _count += source.Length; } public override void Reset() { _count = 0; } protected override void GetCurrentHashCore(Span<byte> destination) { BinaryPrimitives.WriteInt32LittleEndian(destination, _count); } } private sealed class FlexibleAlgorithm : NonCryptographicHashAlgorithm { public bool IsReset { get; private set; } public int GetCurrentHashCoreCallCount { get; private set; } public FlexibleAlgorithm(int hashLengthInBytes) : base(hashLengthInBytes) { Reset(); } public override void Append(ReadOnlySpan<byte> source) { if (source.Length > 0) { IsReset = false; } } public override void Reset() { IsReset = true; } protected override void GetCurrentHashCore(Span<byte> destination) { Assert.Equal(HashLengthInBytes, destination.Length); destination.Fill((byte)GetCurrentHashCoreCallCount); GetCurrentHashCoreCallCount++; } } private sealed class FlexibleAlgorithmOverride : NonCryptographicHashAlgorithm { public bool IsReset { get; private set; } public int GetCurrentHashCoreCallCount { get; private set; } public int GetHashAndResetCoreCallCount { get; private set; } public FlexibleAlgorithmOverride(int hashLengthInBytes) : base(hashLengthInBytes) { Reset(); } public override void Append(ReadOnlySpan<byte> source) { if (source.Length > 0) { IsReset = false; } } public override void Reset() { IsReset = true; } protected override void GetCurrentHashCore(Span<byte> destination) { Assert.Equal(HashLengthInBytes, destination.Length); destination.Fill(0xFE); GetCurrentHashCoreCallCount++; } protected override void GetHashAndResetCore(Span<byte> destination) { Assert.Equal(HashLengthInBytes, destination.Length); destination.Fill(0xFE); Reset(); GetHashAndResetCoreCallCount++; } } } }
// 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.Threading; using System.Threading.Tasks; using Test.IO.Streams; using Xunit; namespace System.IO.Hashing.Tests { public static class NonCryptoHashBaseTests { [Fact] public static void ZeroLengthHashIsInvalid() { AssertExtensions.Throws<ArgumentOutOfRangeException>( "hashLengthInBytes", () => new FlexibleAlgorithm(0)); } [Fact] public static void NegativeHashLengthIsInvalid() { AssertExtensions.Throws<ArgumentOutOfRangeException>( "hashLengthInBytes", () => new FlexibleAlgorithm(-1)); } [Fact] public static void TryGetCurrentHash_TooSmall() { Span<byte> buf = stackalloc byte[7]; FlexibleAlgorithm hash = new FlexibleAlgorithm(buf.Length + 1); Assert.True(hash.IsReset); hash.Append(buf); Assert.False(hash.IsReset); while (true) { Assert.False(hash.TryGetCurrentHash(buf, out int written)); Assert.Equal(0, written); if (buf.IsEmpty) { break; } buf = buf.Slice(1); } Assert.Equal(0, hash.GetCurrentHashCoreCallCount); Assert.False(hash.IsReset); } [Fact] public static void TryGetCurrentHash_TooBig_Succeeds() { Span<byte> buf = stackalloc byte[16]; FlexibleAlgorithm hash = new FlexibleAlgorithm(buf.Length / 2); int i = 0; hash.Append(buf); while (buf.Length > hash.HashLengthInBytes) { Assert.Equal(i, hash.GetCurrentHashCoreCallCount); // TryGetCurrentHash in turn asserts that buf got Sliced down to HashLengthInBytes. Assert.True(hash.TryGetCurrentHash(buf, out int written)); Assert.Equal(hash.HashLengthInBytes, written); buf = buf.Slice(1); i++; } Assert.Equal(i, hash.GetCurrentHashCoreCallCount); Assert.False(hash.IsReset); } [Fact] public static void GetCurrentHash_TooSmall() { byte[] buf = new byte[7]; FlexibleAlgorithm hash = new FlexibleAlgorithm(buf.Length + 1); Assert.True(hash.IsReset); hash.Append(buf); Assert.False(hash.IsReset); for (int i = 0; i <= buf.Length; i++) { AssertExtensions.Throws<ArgumentException>( "destination", () => hash.GetCurrentHash(buf.AsSpan(i))); } Assert.False(hash.IsReset); } [Fact] public static void GetCurrentHash_TooBig_Succeeds() { Span<byte> buf = stackalloc byte[16]; FlexibleAlgorithm hash = new FlexibleAlgorithm(buf.Length / 2); int i = 0; hash.Append(buf); while (buf.Length > hash.HashLengthInBytes) { Assert.Equal(i, hash.GetCurrentHashCoreCallCount); // GetCurrentHash in turn asserts that buf got Sliced down to HashLengthInBytes. int written = hash.GetCurrentHash(buf); Assert.Equal(hash.HashLengthInBytes, written); buf = buf.Slice(1); i++; } Assert.Equal(i, hash.GetCurrentHashCoreCallCount); Assert.False(hash.IsReset); } [Fact] public static void AllocatingGetCurrentHash_CorrectSize() { FlexibleAlgorithm hash = new FlexibleAlgorithm(12); byte[] ret = hash.GetCurrentHash(); Assert.Equal(hash.HashLengthInBytes, ret.Length); Assert.Equal(1, hash.GetCurrentHashCoreCallCount); } [Fact] public static void DefaultGetHashAndResetDoesWhatItSays() { Span<byte> buf = stackalloc byte[16]; FlexibleAlgorithm hash = new FlexibleAlgorithm(buf.Length); Assert.True(hash.IsReset); hash.Append(buf); Assert.False(hash.IsReset); Assert.Equal(0, hash.GetCurrentHashCoreCallCount); byte[] ret = hash.GetHashAndReset(); Assert.True(hash.IsReset); Assert.Equal(1, hash.GetCurrentHashCoreCallCount); Assert.Equal(hash.HashLengthInBytes, ret.Length); hash.Append(ret); Assert.False(hash.IsReset); Assert.True(hash.TryGetHashAndReset(buf, out int written)); Assert.True(hash.IsReset); Assert.Equal(2, hash.GetCurrentHashCoreCallCount); Assert.Equal(hash.HashLengthInBytes, written); hash.Append(ret); Assert.False(hash.IsReset); written = hash.GetHashAndReset(buf); Assert.True(hash.IsReset); Assert.Equal(3, hash.GetCurrentHashCoreCallCount); Assert.Equal(hash.HashLengthInBytes, written); } [Fact] public static void TryGetHashAndReset_TooSmall() { Span<byte> buf = stackalloc byte[7]; FlexibleAlgorithm hash = new FlexibleAlgorithm(buf.Length + 1); Assert.True(hash.IsReset); hash.Append(buf); Assert.False(hash.IsReset); while (true) { Assert.False(hash.TryGetHashAndReset(buf, out int written)); Assert.Equal(0, written); if (buf.IsEmpty) { break; } buf = buf.Slice(1); } Assert.Equal(0, hash.GetCurrentHashCoreCallCount); Assert.False(hash.IsReset); } [Fact] public static void TryGetHashAndReset_TooBig_Succeeds() { Span<byte> buf = stackalloc byte[16]; FlexibleAlgorithm hash = new FlexibleAlgorithm(buf.Length / 2); int i = 0; while (buf.Length > hash.HashLengthInBytes) { Assert.Equal(i, hash.GetCurrentHashCoreCallCount); hash.Append(buf); Assert.False(hash.IsReset); // TryGetCurrentHash in turn asserts that buf got Sliced down to HashLengthInBytes. Assert.True(hash.TryGetHashAndReset(buf, out int written)); Assert.Equal(hash.HashLengthInBytes, written); Assert.True(hash.IsReset); buf = buf.Slice(1); i++; } Assert.Equal(i, hash.GetCurrentHashCoreCallCount); Assert.True(hash.IsReset); } [Fact] public static void GetHashAndReset_TooSmall() { byte[] buf = new byte[7]; FlexibleAlgorithm hash = new FlexibleAlgorithm(buf.Length + 1); Assert.True(hash.IsReset); hash.Append(buf); Assert.False(hash.IsReset); for (int i = 0; i <= buf.Length; i++) { AssertExtensions.Throws<ArgumentException>( "destination", () => hash.GetHashAndReset(buf.AsSpan(i))); } Assert.Equal(0, hash.GetCurrentHashCoreCallCount); Assert.False(hash.IsReset); } [Fact] public static void GetHashAndReset_TooBig_Succeeds() { Span<byte> buf = stackalloc byte[16]; FlexibleAlgorithm hash = new FlexibleAlgorithm(buf.Length / 2); int i = 0; while (buf.Length > hash.HashLengthInBytes) { Assert.Equal(i, hash.GetCurrentHashCoreCallCount); hash.Append(buf); Assert.False(hash.IsReset); Assert.True(hash.TryGetHashAndReset(buf, out int written)); Assert.Equal(hash.HashLengthInBytes, written); Assert.True(hash.IsReset); buf = buf.Slice(1); i++; } Assert.Equal(i, hash.GetCurrentHashCoreCallCount); Assert.True(hash.IsReset); } [Fact] public static void AllocatingGetHashAndReset_CorrectSize() { FlexibleAlgorithm hash = new FlexibleAlgorithm(12); byte[] ret = hash.GetHashAndReset(); Assert.Equal(hash.HashLengthInBytes, ret.Length); Assert.Equal(1, hash.GetCurrentHashCoreCallCount); } [Fact] public static void OverriddenTryGetHashAndReset_TooSmall() { Span<byte> buf = stackalloc byte[7]; var hash = new FlexibleAlgorithmOverride(buf.Length + 1); Assert.True(hash.IsReset); hash.Append(buf); Assert.False(hash.IsReset); while (true) { Assert.False(hash.TryGetHashAndReset(buf, out int written)); Assert.Equal(0, written); if (buf.IsEmpty) { break; } buf = buf.Slice(1); } Assert.Equal(0, hash.GetCurrentHashCoreCallCount); Assert.Equal(0, hash.GetHashAndResetCoreCallCount); Assert.False(hash.IsReset); } [Fact] public static void OverriddenTryGetHashAndReset_TooBig_Succeeds() { Span<byte> buf = stackalloc byte[16]; var hash = new FlexibleAlgorithmOverride(buf.Length / 2); int i = 0; while (buf.Length > hash.HashLengthInBytes) { Assert.Equal(0, hash.GetCurrentHashCoreCallCount); Assert.Equal(i, hash.GetHashAndResetCoreCallCount); hash.Append(buf); Assert.False(hash.IsReset); // TryGetCurrentHash in turn asserts that buf got Sliced down to HashLengthInBytes. Assert.True(hash.TryGetHashAndReset(buf, out int written)); Assert.Equal(hash.HashLengthInBytes, written); Assert.True(hash.IsReset); buf = buf.Slice(1); i++; } Assert.Equal(0, hash.GetCurrentHashCoreCallCount); Assert.Equal(i, hash.GetHashAndResetCoreCallCount); Assert.True(hash.IsReset); } [Fact] public static void OverriddenGetHashAndReset_TooSmall() { byte[] buf = new byte[7]; var hash = new FlexibleAlgorithmOverride(buf.Length + 1); Assert.True(hash.IsReset); hash.Append(buf); Assert.False(hash.IsReset); for (int i = 0; i <= buf.Length; i++) { AssertExtensions.Throws<ArgumentException>( "destination", () => hash.GetHashAndReset(buf.AsSpan(i))); } Assert.Equal(0, hash.GetCurrentHashCoreCallCount); Assert.Equal(0, hash.GetHashAndResetCoreCallCount); Assert.False(hash.IsReset); } [Fact] public static void OverriddenGetHashAndReset_TooBig_Succeeds() { Span<byte> buf = stackalloc byte[16]; var hash = new FlexibleAlgorithmOverride(buf.Length / 2); int i = 0; while (buf.Length > hash.HashLengthInBytes) { Assert.Equal(0, hash.GetCurrentHashCoreCallCount); Assert.Equal(i, hash.GetHashAndResetCoreCallCount); hash.Append(buf); Assert.False(hash.IsReset); Assert.True(hash.TryGetHashAndReset(buf, out int written)); Assert.Equal(hash.HashLengthInBytes, written); Assert.True(hash.IsReset); buf = buf.Slice(1); i++; } Assert.Equal(0, hash.GetCurrentHashCoreCallCount); Assert.Equal(i, hash.GetHashAndResetCoreCallCount); Assert.True(hash.IsReset); } [Fact] public static void OverriddenAllocatingGetHashAndReset_CorrectSize() { var hash = new FlexibleAlgorithmOverride(12); byte[] ret = hash.GetHashAndReset(); Assert.Equal(hash.HashLengthInBytes, ret.Length); Assert.Equal(0, hash.GetCurrentHashCoreCallCount); Assert.Equal(1, hash.GetHashAndResetCoreCallCount); } [Fact] public static void AppendNullArrayThrows() { NonCryptographicHashAlgorithm hash = new FlexibleAlgorithm(5); AssertExtensions.Throws<ArgumentNullException>("source", () => hash.Append((byte[])null)); } [Fact] public static void AppendNullStreamThrows() { NonCryptographicHashAlgorithm hash = new FlexibleAlgorithm(5); AssertExtensions.Throws<ArgumentNullException>("stream", () => hash.Append((Stream)null)); } [Fact] public static void AppendAsyncNullStreamThrows_OutsideTask() { NonCryptographicHashAlgorithm hash = new FlexibleAlgorithm(5); AssertExtensions.Throws<ArgumentNullException>("stream", () => hash.AppendAsync(null)); } [Theory] [InlineData(0)] [InlineData(511)] [InlineData(4097)] [InlineData(1048581)] public static void AppendStreamSanityTest(int streamSize) { NonCryptographicHashAlgorithm hash = new CountingAlgorithm(); using (PositionValueStream stream = new PositionValueStream(streamSize)) { hash.Append(stream); } Span<byte> val = stackalloc byte[sizeof(int)]; hash.GetHashAndReset(val); int res = BinaryPrimitives.ReadInt32LittleEndian(val); Assert.Equal(streamSize, res); } [Theory] [InlineData(0)] [InlineData(511)] [InlineData(4097)] [InlineData(1048581)] public static async Task AppendStreamAsyncSanityTest(int streamSize) { NonCryptographicHashAlgorithm hash = new CountingAlgorithm(); using (PositionValueStream stream = new PositionValueStream(streamSize)) { await hash.AppendAsync(stream); } byte[] val = new byte[sizeof(int)]; hash.GetHashAndReset(val); int res = BinaryPrimitives.ReadInt32LittleEndian(val); Assert.Equal(streamSize, res); } [Fact] public static void AppendStreamAsyncSupportsCancellation() { NonCryptographicHashAlgorithm hash = new CountingAlgorithm(); using (PositionValueStream stream = new PositionValueStream(21)) using (CancellationTokenSource cts = new CancellationTokenSource()) { cts.Cancel(); Task task = hash.AppendAsync(stream, cts.Token); Assert.True(task.IsCompleted); Assert.True(task.IsCanceled); } byte[] val = new byte[sizeof(int)]; hash.GetHashAndReset(val); int res = BinaryPrimitives.ReadInt32LittleEndian(val); Assert.Equal(0, res); } [Fact] public static void GetHashCode_NotSupported() { NonCryptographicHashAlgorithm hash = new CountingAlgorithm(); Assert.Throws<NotSupportedException>(() => hash.GetHashCode()); } private sealed class CountingAlgorithm : NonCryptographicHashAlgorithm { private int _count; public CountingAlgorithm() : base(sizeof(int)) { } public override void Append(ReadOnlySpan<byte> source) { _count += source.Length; } public override void Reset() { _count = 0; } protected override void GetCurrentHashCore(Span<byte> destination) { BinaryPrimitives.WriteInt32LittleEndian(destination, _count); } } private sealed class FlexibleAlgorithm : NonCryptographicHashAlgorithm { public bool IsReset { get; private set; } public int GetCurrentHashCoreCallCount { get; private set; } public FlexibleAlgorithm(int hashLengthInBytes) : base(hashLengthInBytes) { Reset(); } public override void Append(ReadOnlySpan<byte> source) { if (source.Length > 0) { IsReset = false; } } public override void Reset() { IsReset = true; } protected override void GetCurrentHashCore(Span<byte> destination) { Assert.Equal(HashLengthInBytes, destination.Length); destination.Fill((byte)GetCurrentHashCoreCallCount); GetCurrentHashCoreCallCount++; } } private sealed class FlexibleAlgorithmOverride : NonCryptographicHashAlgorithm { public bool IsReset { get; private set; } public int GetCurrentHashCoreCallCount { get; private set; } public int GetHashAndResetCoreCallCount { get; private set; } public FlexibleAlgorithmOverride(int hashLengthInBytes) : base(hashLengthInBytes) { Reset(); } public override void Append(ReadOnlySpan<byte> source) { if (source.Length > 0) { IsReset = false; } } public override void Reset() { IsReset = true; } protected override void GetCurrentHashCore(Span<byte> destination) { Assert.Equal(HashLengthInBytes, destination.Length); destination.Fill(0xFE); GetCurrentHashCoreCallCount++; } protected override void GetHashAndResetCore(Span<byte> destination) { Assert.Equal(HashLengthInBytes, destination.Length); destination.Fill(0xFE); Reset(); GetHashAndResetCoreCallCount++; } } } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/JIT/HardwareIntrinsics/Arm/AdvSimd/ExtractNarrowingUpper.Vector128.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.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 ExtractNarrowingUpper_Vector128_SByte() { var test = new SimpleBinaryOpTest__ExtractNarrowingUpper_Vector128_SByte(); 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__ExtractNarrowingUpper_Vector128_SByte { 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, Int16[] inArray2, SByte[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<SByte>(); int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<Int16>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<SByte>(); 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<SByte, byte>(ref inArray1[0]), (uint)sizeOfinArray1); Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<Int16, 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<SByte> _fld1; public Vector128<Int16> _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<Vector64<SByte>, byte>(ref testStruct._fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<SByte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref testStruct._fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>()); return testStruct; } public void RunStructFldScenario(SimpleBinaryOpTest__ExtractNarrowingUpper_Vector128_SByte testClass) { var result = AdvSimd.ExtractNarrowingUpper(_fld1, _fld2); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } public void RunStructFldScenario_Load(SimpleBinaryOpTest__ExtractNarrowingUpper_Vector128_SByte testClass) { fixed (Vector64<SByte>* pFld1 = &_fld1) fixed (Vector128<Int16>* pFld2 = &_fld2) { var result = AdvSimd.ExtractNarrowingUpper( AdvSimd.LoadVector64((SByte*)(pFld1)), AdvSimd.LoadVector128((Int16*)(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<Vector64<SByte>>() / sizeof(SByte); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16); private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte); private static SByte[] _data1 = new SByte[Op1ElementCount]; private static Int16[] _data2 = new Int16[Op2ElementCount]; private static Vector64<SByte> _clsVar1; private static Vector128<Int16> _clsVar2; private Vector64<SByte> _fld1; private Vector128<Int16> _fld2; private DataTable _dataTable; static SimpleBinaryOpTest__ExtractNarrowingUpper_Vector128_SByte() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<SByte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>()); } public SimpleBinaryOpTest__ExtractNarrowingUpper_Vector128_SByte() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<SByte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt16(); } _dataTable = new DataTable(_data1, _data2, new SByte[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.ExtractNarrowingUpper( Unsafe.Read<Vector64<SByte>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<Int16>>(_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.ExtractNarrowingUpper( AdvSimd.LoadVector64((SByte*)(_dataTable.inArray1Ptr)), AdvSimd.LoadVector128((Int16*)(_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.ExtractNarrowingUpper), new Type[] { typeof(Vector64<SByte>), typeof(Vector128<Int16>) }) .Invoke(null, new object[] { Unsafe.Read<Vector64<SByte>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<Int16>>(_dataTable.inArray2Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<SByte>)(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.ExtractNarrowingUpper), new Type[] { typeof(Vector64<SByte>), typeof(Vector128<Int16>) }) .Invoke(null, new object[] { AdvSimd.LoadVector64((SByte*)(_dataTable.inArray1Ptr)), AdvSimd.LoadVector128((Int16*)(_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 = AdvSimd.ExtractNarrowingUpper( _clsVar1, _clsVar2 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } public void RunClsVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load)); fixed (Vector64<SByte>* pClsVar1 = &_clsVar1) fixed (Vector128<Int16>* pClsVar2 = &_clsVar2) { var result = AdvSimd.ExtractNarrowingUpper( AdvSimd.LoadVector64((SByte*)(pClsVar1)), AdvSimd.LoadVector128((Int16*)(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<SByte>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector128<Int16>>(_dataTable.inArray2Ptr); var result = AdvSimd.ExtractNarrowingUpper(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((SByte*)(_dataTable.inArray1Ptr)); var op2 = AdvSimd.LoadVector128((Int16*)(_dataTable.inArray2Ptr)); var result = AdvSimd.ExtractNarrowingUpper(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new SimpleBinaryOpTest__ExtractNarrowingUpper_Vector128_SByte(); var result = AdvSimd.ExtractNarrowingUpper(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__ExtractNarrowingUpper_Vector128_SByte(); fixed (Vector64<SByte>* pFld1 = &test._fld1) fixed (Vector128<Int16>* pFld2 = &test._fld2) { var result = AdvSimd.ExtractNarrowingUpper( AdvSimd.LoadVector64((SByte*)(pFld1)), AdvSimd.LoadVector128((Int16*)(pFld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = AdvSimd.ExtractNarrowingUpper(_fld1, _fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } public void RunClassFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load)); fixed (Vector64<SByte>* pFld1 = &_fld1) fixed (Vector128<Int16>* pFld2 = &_fld2) { var result = AdvSimd.ExtractNarrowingUpper( AdvSimd.LoadVector64((SByte*)(pFld1)), AdvSimd.LoadVector128((Int16*)(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.ExtractNarrowingUpper(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.ExtractNarrowingUpper( AdvSimd.LoadVector64((SByte*)(&test._fld1)), AdvSimd.LoadVector128((Int16*)(&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<SByte> op1, Vector128<Int16> op2, void* result, [CallerMemberName] string method = "") { SByte[] inArray1 = new SByte[Op1ElementCount]; Int16[] inArray2 = new Int16[Op2ElementCount]; SByte[] outArray = new SByte[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), op1); Unsafe.WriteUnaligned(ref Unsafe.As<Int16, 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]; Int16[] inArray2 = new Int16[Op2ElementCount]; SByte[] outArray = new SByte[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector64<SByte>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector128<Int16>>()); 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, Int16[] right, SByte[] result, [CallerMemberName] string method = "") { bool succeeded = true; for (var i = 0; i < RetElementCount; i++) { if (Helpers.ExtractNarrowingUpper(left, right, i) != result[i]) { succeeded = false; break; } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd)}.{nameof(AdvSimd.ExtractNarrowingUpper)}<SByte>(Vector64<SByte>, Vector128<Int16>): {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 ExtractNarrowingUpper_Vector128_SByte() { var test = new SimpleBinaryOpTest__ExtractNarrowingUpper_Vector128_SByte(); 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__ExtractNarrowingUpper_Vector128_SByte { 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, Int16[] inArray2, SByte[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<SByte>(); int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<Int16>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<SByte>(); 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<SByte, byte>(ref inArray1[0]), (uint)sizeOfinArray1); Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<Int16, 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<SByte> _fld1; public Vector128<Int16> _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<Vector64<SByte>, byte>(ref testStruct._fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<SByte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref testStruct._fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>()); return testStruct; } public void RunStructFldScenario(SimpleBinaryOpTest__ExtractNarrowingUpper_Vector128_SByte testClass) { var result = AdvSimd.ExtractNarrowingUpper(_fld1, _fld2); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } public void RunStructFldScenario_Load(SimpleBinaryOpTest__ExtractNarrowingUpper_Vector128_SByte testClass) { fixed (Vector64<SByte>* pFld1 = &_fld1) fixed (Vector128<Int16>* pFld2 = &_fld2) { var result = AdvSimd.ExtractNarrowingUpper( AdvSimd.LoadVector64((SByte*)(pFld1)), AdvSimd.LoadVector128((Int16*)(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<Vector64<SByte>>() / sizeof(SByte); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<Int16>>() / sizeof(Int16); private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<SByte>>() / sizeof(SByte); private static SByte[] _data1 = new SByte[Op1ElementCount]; private static Int16[] _data2 = new Int16[Op2ElementCount]; private static Vector64<SByte> _clsVar1; private static Vector128<Int16> _clsVar2; private Vector64<SByte> _fld1; private Vector128<Int16> _fld2; private DataTable _dataTable; static SimpleBinaryOpTest__ExtractNarrowingUpper_Vector128_SByte() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<SByte>, byte>(ref _clsVar1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<SByte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _clsVar2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>()); } public SimpleBinaryOpTest__ExtractNarrowingUpper_Vector128_SByte() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector64<SByte>, byte>(ref _fld1), ref Unsafe.As<SByte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector64<SByte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt16(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<Int16>, byte>(ref _fld2), ref Unsafe.As<Int16, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<Int16>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetSByte(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt16(); } _dataTable = new DataTable(_data1, _data2, new SByte[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.ExtractNarrowingUpper( Unsafe.Read<Vector64<SByte>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<Int16>>(_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.ExtractNarrowingUpper( AdvSimd.LoadVector64((SByte*)(_dataTable.inArray1Ptr)), AdvSimd.LoadVector128((Int16*)(_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.ExtractNarrowingUpper), new Type[] { typeof(Vector64<SByte>), typeof(Vector128<Int16>) }) .Invoke(null, new object[] { Unsafe.Read<Vector64<SByte>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<Int16>>(_dataTable.inArray2Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector128<SByte>)(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.ExtractNarrowingUpper), new Type[] { typeof(Vector64<SByte>), typeof(Vector128<Int16>) }) .Invoke(null, new object[] { AdvSimd.LoadVector64((SByte*)(_dataTable.inArray1Ptr)), AdvSimd.LoadVector128((Int16*)(_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 = AdvSimd.ExtractNarrowingUpper( _clsVar1, _clsVar2 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } public void RunClsVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load)); fixed (Vector64<SByte>* pClsVar1 = &_clsVar1) fixed (Vector128<Int16>* pClsVar2 = &_clsVar2) { var result = AdvSimd.ExtractNarrowingUpper( AdvSimd.LoadVector64((SByte*)(pClsVar1)), AdvSimd.LoadVector128((Int16*)(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<SByte>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector128<Int16>>(_dataTable.inArray2Ptr); var result = AdvSimd.ExtractNarrowingUpper(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((SByte*)(_dataTable.inArray1Ptr)); var op2 = AdvSimd.LoadVector128((Int16*)(_dataTable.inArray2Ptr)); var result = AdvSimd.ExtractNarrowingUpper(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new SimpleBinaryOpTest__ExtractNarrowingUpper_Vector128_SByte(); var result = AdvSimd.ExtractNarrowingUpper(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__ExtractNarrowingUpper_Vector128_SByte(); fixed (Vector64<SByte>* pFld1 = &test._fld1) fixed (Vector128<Int16>* pFld2 = &test._fld2) { var result = AdvSimd.ExtractNarrowingUpper( AdvSimd.LoadVector64((SByte*)(pFld1)), AdvSimd.LoadVector128((Int16*)(pFld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = AdvSimd.ExtractNarrowingUpper(_fld1, _fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } public void RunClassFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load)); fixed (Vector64<SByte>* pFld1 = &_fld1) fixed (Vector128<Int16>* pFld2 = &_fld2) { var result = AdvSimd.ExtractNarrowingUpper( AdvSimd.LoadVector64((SByte*)(pFld1)), AdvSimd.LoadVector128((Int16*)(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.ExtractNarrowingUpper(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.ExtractNarrowingUpper( AdvSimd.LoadVector64((SByte*)(&test._fld1)), AdvSimd.LoadVector128((Int16*)(&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<SByte> op1, Vector128<Int16> op2, void* result, [CallerMemberName] string method = "") { SByte[] inArray1 = new SByte[Op1ElementCount]; Int16[] inArray2 = new Int16[Op2ElementCount]; SByte[] outArray = new SByte[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), op1); Unsafe.WriteUnaligned(ref Unsafe.As<Int16, 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]; Int16[] inArray2 = new Int16[Op2ElementCount]; SByte[] outArray = new SByte[RetElementCount]; Unsafe.CopyBlockUnaligned(ref Unsafe.As<SByte, byte>(ref inArray1[0]), ref Unsafe.AsRef<byte>(op1), (uint)Unsafe.SizeOf<Vector64<SByte>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Int16, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector128<Int16>>()); 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, Int16[] right, SByte[] result, [CallerMemberName] string method = "") { bool succeeded = true; for (var i = 0; i < RetElementCount; i++) { if (Helpers.ExtractNarrowingUpper(left, right, i) != result[i]) { succeeded = false; break; } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(AdvSimd)}.{nameof(AdvSimd.ExtractNarrowingUpper)}<SByte>(Vector64<SByte>, Vector128<Int16>): {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,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/libraries/System.Private.CoreLib/src/System/IO/EncodingCache.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.Text; namespace System.IO { internal static class EncodingCache { internal static readonly Encoding UTF8NoBOM = new UTF8Encoding(encoderShouldEmitUTF8Identifier: false, throwOnInvalidBytes: 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.Text; namespace System.IO { internal static class EncodingCache { internal static readonly Encoding UTF8NoBOM = new UTF8Encoding(encoderShouldEmitUTF8Identifier: false, throwOnInvalidBytes: true); } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/JIT/Methodical/eh/interactions/gcincatch_r.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>None</DebugType> <Optimize>False</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="gcincatch.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\..\..\common\eh_common.csproj" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>None</DebugType> <Optimize>False</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="gcincatch.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="..\..\..\common\eh_common.csproj" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/libraries/System.Private.CoreLib/src/System/Reflection/LocalVariableInfo.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; namespace System.Reflection { public class LocalVariableInfo { public virtual Type LocalType { get { Debug.Fail("type must be set!"); return null!; } } public virtual int LocalIndex => 0; public virtual bool IsPinned => false; protected LocalVariableInfo() { } public override string ToString() => IsPinned ? $"{LocalType} ({LocalIndex}) (pinned)" : $"{LocalType} ({LocalIndex})"; } }
// 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; namespace System.Reflection { public class LocalVariableInfo { public virtual Type LocalType { get { Debug.Fail("type must be set!"); return null!; } } public virtual int LocalIndex => 0; public virtual bool IsPinned => false; protected LocalVariableInfo() { } public override string ToString() => IsPinned ? $"{LocalType} ({LocalIndex}) (pinned)" : $"{LocalType} ({LocalIndex})"; } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/Interop/PInvoke/Varargs/VarargsTest.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.Security; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; using Xunit; namespace PInvokeTests { class VarargsTest { [DllImport("VarargsNative", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] private static extern void TestVarArgs(StringBuilder builder, IntPtr bufferSize, string formatString, __arglist); [DllImport("VarargsNative", CharSet = CharSet.Unicode)] private static extern void TestArgIterator(StringBuilder builder, IntPtr bufferSize, string formatString, ArgIterator arguments); private static void TestArgIteratorWrapper(StringBuilder builder, IntPtr bufferSize, string formatString, __arglist) { TestArgIterator(builder, bufferSize, formatString, new ArgIterator(__arglist)); } private static bool AssertEqual(string lhs, string rhs) { if (lhs != rhs) { Console.WriteLine($"FAIL! \"{lhs}\" != \"{rhs}\""); return false; } return true; } public static int Main() { var passed = true; int arg1 = 10; int arg2 = 20; double arg3 = 12.5; string expected = FormattableString.Invariant($"{arg1}, {arg2}, {arg3:F1}"); StringBuilder builder; builder = new StringBuilder(30); TestVarArgs(builder, (IntPtr)30, "%i, %i, %.1f", __arglist(arg1, arg2, arg3)); passed &= AssertEqual(builder.ToString(), expected); builder = new StringBuilder(30); TestArgIteratorWrapper(builder, (IntPtr)30, "%i, %i, %.1f", __arglist(arg1, arg2, arg3)); passed &= AssertEqual(builder.ToString(), expected); return passed ? 100 : 101; } } }
// 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.Security; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; using Xunit; namespace PInvokeTests { class VarargsTest { [DllImport("VarargsNative", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)] private static extern void TestVarArgs(StringBuilder builder, IntPtr bufferSize, string formatString, __arglist); [DllImport("VarargsNative", CharSet = CharSet.Unicode)] private static extern void TestArgIterator(StringBuilder builder, IntPtr bufferSize, string formatString, ArgIterator arguments); private static void TestArgIteratorWrapper(StringBuilder builder, IntPtr bufferSize, string formatString, __arglist) { TestArgIterator(builder, bufferSize, formatString, new ArgIterator(__arglist)); } private static bool AssertEqual(string lhs, string rhs) { if (lhs != rhs) { Console.WriteLine($"FAIL! \"{lhs}\" != \"{rhs}\""); return false; } return true; } public static int Main() { var passed = true; int arg1 = 10; int arg2 = 20; double arg3 = 12.5; string expected = FormattableString.Invariant($"{arg1}, {arg2}, {arg3:F1}"); StringBuilder builder; builder = new StringBuilder(30); TestVarArgs(builder, (IntPtr)30, "%i, %i, %.1f", __arglist(arg1, arg2, arg3)); passed &= AssertEqual(builder.ToString(), expected); builder = new StringBuilder(30); TestArgIteratorWrapper(builder, (IntPtr)30, "%i, %i, %.1f", __arglist(arg1, arg2, arg3)); passed &= AssertEqual(builder.ToString(), expected); return passed ? 100 : 101; } } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/JIT/HardwareIntrinsics/X86/Avx2/Max.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\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 MaxByte() { var test = new SimpleBinaryOpTest__MaxByte(); if (test.IsSupported) { // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); if (Avx.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 (Avx.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 (Avx.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 (Avx.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 (Avx.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 (Avx.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 (Avx.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 (Avx.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__MaxByte { 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 != 32 && alignment != 16) || (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 Vector256<Byte> _fld1; public Vector256<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<Vector256<Byte>, byte>(ref testStruct._fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref testStruct._fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>()); return testStruct; } public void RunStructFldScenario(SimpleBinaryOpTest__MaxByte testClass) { var result = Avx2.Max(_fld1, _fld2); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } public void RunStructFldScenario_Load(SimpleBinaryOpTest__MaxByte testClass) { fixed (Vector256<Byte>* pFld1 = &_fld1) fixed (Vector256<Byte>* pFld2 = &_fld2) { var result = Avx2.Max( Avx.LoadVector256((Byte*)(pFld1)), Avx.LoadVector256((Byte*)(pFld2)) ); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } } } private static readonly int LargestVectorSize = 32; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte); private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte); private static Byte[] _data1 = new Byte[Op1ElementCount]; private static Byte[] _data2 = new Byte[Op2ElementCount]; private static Vector256<Byte> _clsVar1; private static Vector256<Byte> _clsVar2; private Vector256<Byte> _fld1; private Vector256<Byte> _fld2; private DataTable _dataTable; static SimpleBinaryOpTest__MaxByte() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>()); } public SimpleBinaryOpTest__MaxByte() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<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 => Avx2.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = Avx2.Max( Unsafe.Read<Vector256<Byte>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector256<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 = Avx2.Max( Avx.LoadVector256((Byte*)(_dataTable.inArray1Ptr)), Avx.LoadVector256((Byte*)(_dataTable.inArray2Ptr)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunBasicScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned)); var result = Avx2.Max( Avx.LoadAlignedVector256((Byte*)(_dataTable.inArray1Ptr)), Avx.LoadAlignedVector256((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(Avx2).GetMethod(nameof(Avx2.Max), new Type[] { typeof(Vector256<Byte>), typeof(Vector256<Byte>) }) .Invoke(null, new object[] { Unsafe.Read<Vector256<Byte>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector256<Byte>>(_dataTable.inArray2Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Byte>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load)); var result = typeof(Avx2).GetMethod(nameof(Avx2.Max), new Type[] { typeof(Vector256<Byte>), typeof(Vector256<Byte>) }) .Invoke(null, new object[] { Avx.LoadVector256((Byte*)(_dataTable.inArray1Ptr)), Avx.LoadVector256((Byte*)(_dataTable.inArray2Ptr)) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Byte>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned)); var result = typeof(Avx2).GetMethod(nameof(Avx2.Max), new Type[] { typeof(Vector256<Byte>), typeof(Vector256<Byte>) }) .Invoke(null, new object[] { Avx.LoadAlignedVector256((Byte*)(_dataTable.inArray1Ptr)), Avx.LoadAlignedVector256((Byte*)(_dataTable.inArray2Ptr)) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Byte>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = Avx2.Max( _clsVar1, _clsVar2 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } public void RunClsVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load)); fixed (Vector256<Byte>* pClsVar1 = &_clsVar1) fixed (Vector256<Byte>* pClsVar2 = &_clsVar2) { var result = Avx2.Max( Avx.LoadVector256((Byte*)(pClsVar1)), Avx.LoadVector256((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<Vector256<Byte>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector256<Byte>>(_dataTable.inArray2Ptr); var result = Avx2.Max(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunLclVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load)); var op1 = Avx.LoadVector256((Byte*)(_dataTable.inArray1Ptr)); var op2 = Avx.LoadVector256((Byte*)(_dataTable.inArray2Ptr)); var result = Avx2.Max(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunLclVarScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned)); var op1 = Avx.LoadAlignedVector256((Byte*)(_dataTable.inArray1Ptr)); var op2 = Avx.LoadAlignedVector256((Byte*)(_dataTable.inArray2Ptr)); var result = Avx2.Max(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new SimpleBinaryOpTest__MaxByte(); var result = Avx2.Max(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__MaxByte(); fixed (Vector256<Byte>* pFld1 = &test._fld1) fixed (Vector256<Byte>* pFld2 = &test._fld2) { var result = Avx2.Max( Avx.LoadVector256((Byte*)(pFld1)), Avx.LoadVector256((Byte*)(pFld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = Avx2.Max(_fld1, _fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } public void RunClassFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load)); fixed (Vector256<Byte>* pFld1 = &_fld1) fixed (Vector256<Byte>* pFld2 = &_fld2) { var result = Avx2.Max( Avx.LoadVector256((Byte*)(pFld1)), Avx.LoadVector256((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 = Avx2.Max(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 = Avx2.Max( Avx.LoadVector256((Byte*)(&test._fld1)), Avx.LoadVector256((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(Vector256<Byte> op1, Vector256<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<Vector256<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<Vector256<Byte>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector256<Byte>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(Byte[] left, Byte[] right, Byte[] result, [CallerMemberName] string method = "") { bool succeeded = true; if (result[0] != Math.Max(left[0], right[0])) { succeeded = false; } else { for (var i = 1; i < RetElementCount; i++) { if (result[i] != Math.Max(left[i], right[i])) { succeeded = false; break; } } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(Avx2)}.{nameof(Avx2.Max)}<Byte>(Vector256<Byte>, Vector256<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\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 MaxByte() { var test = new SimpleBinaryOpTest__MaxByte(); if (test.IsSupported) { // Validates basic functionality works, using Unsafe.Read test.RunBasicScenario_UnsafeRead(); if (Avx.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 (Avx.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 (Avx.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 (Avx.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 (Avx.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 (Avx.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 (Avx.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 (Avx.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__MaxByte { 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 != 32 && alignment != 16) || (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 Vector256<Byte> _fld1; public Vector256<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<Vector256<Byte>, byte>(ref testStruct._fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref testStruct._fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>()); return testStruct; } public void RunStructFldScenario(SimpleBinaryOpTest__MaxByte testClass) { var result = Avx2.Max(_fld1, _fld2); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } public void RunStructFldScenario_Load(SimpleBinaryOpTest__MaxByte testClass) { fixed (Vector256<Byte>* pFld1 = &_fld1) fixed (Vector256<Byte>* pFld2 = &_fld2) { var result = Avx2.Max( Avx.LoadVector256((Byte*)(pFld1)), Avx.LoadVector256((Byte*)(pFld2)) ); Unsafe.Write(testClass._dataTable.outArrayPtr, result); testClass.ValidateResult(_fld1, _fld2, testClass._dataTable.outArrayPtr); } } } private static readonly int LargestVectorSize = 32; private static readonly int Op1ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte); private static readonly int RetElementCount = Unsafe.SizeOf<Vector256<Byte>>() / sizeof(Byte); private static Byte[] _data1 = new Byte[Op1ElementCount]; private static Byte[] _data2 = new Byte[Op2ElementCount]; private static Vector256<Byte> _clsVar1; private static Vector256<Byte> _clsVar2; private Vector256<Byte> _fld1; private Vector256<Byte> _fld2; private DataTable _dataTable; static SimpleBinaryOpTest__MaxByte() { for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _clsVar2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>()); } public SimpleBinaryOpTest__MaxByte() { Succeeded = true; for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld1), ref Unsafe.As<Byte, byte>(ref _data1[0]), (uint)Unsafe.SizeOf<Vector256<Byte>>()); for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetByte(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector256<Byte>, byte>(ref _fld2), ref Unsafe.As<Byte, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector256<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 => Avx2.IsSupported; public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = Avx2.Max( Unsafe.Read<Vector256<Byte>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector256<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 = Avx2.Max( Avx.LoadVector256((Byte*)(_dataTable.inArray1Ptr)), Avx.LoadVector256((Byte*)(_dataTable.inArray2Ptr)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunBasicScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_LoadAligned)); var result = Avx2.Max( Avx.LoadAlignedVector256((Byte*)(_dataTable.inArray1Ptr)), Avx.LoadAlignedVector256((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(Avx2).GetMethod(nameof(Avx2.Max), new Type[] { typeof(Vector256<Byte>), typeof(Vector256<Byte>) }) .Invoke(null, new object[] { Unsafe.Read<Vector256<Byte>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector256<Byte>>(_dataTable.inArray2Ptr) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Byte>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_Load)); var result = typeof(Avx2).GetMethod(nameof(Avx2.Max), new Type[] { typeof(Vector256<Byte>), typeof(Vector256<Byte>) }) .Invoke(null, new object[] { Avx.LoadVector256((Byte*)(_dataTable.inArray1Ptr)), Avx.LoadVector256((Byte*)(_dataTable.inArray2Ptr)) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Byte>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunReflectionScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_LoadAligned)); var result = typeof(Avx2).GetMethod(nameof(Avx2.Max), new Type[] { typeof(Vector256<Byte>), typeof(Vector256<Byte>) }) .Invoke(null, new object[] { Avx.LoadAlignedVector256((Byte*)(_dataTable.inArray1Ptr)), Avx.LoadAlignedVector256((Byte*)(_dataTable.inArray2Ptr)) }); Unsafe.Write(_dataTable.outArrayPtr, (Vector256<Byte>)(result)); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, _dataTable.outArrayPtr); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = Avx2.Max( _clsVar1, _clsVar2 ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_clsVar1, _clsVar2, _dataTable.outArrayPtr); } public void RunClsVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario_Load)); fixed (Vector256<Byte>* pClsVar1 = &_clsVar1) fixed (Vector256<Byte>* pClsVar2 = &_clsVar2) { var result = Avx2.Max( Avx.LoadVector256((Byte*)(pClsVar1)), Avx.LoadVector256((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<Vector256<Byte>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector256<Byte>>(_dataTable.inArray2Ptr); var result = Avx2.Max(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunLclVarScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_Load)); var op1 = Avx.LoadVector256((Byte*)(_dataTable.inArray1Ptr)); var op2 = Avx.LoadVector256((Byte*)(_dataTable.inArray2Ptr)); var result = Avx2.Max(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunLclVarScenario_LoadAligned() { TestLibrary.TestFramework.BeginScenario(nameof(RunLclVarScenario_LoadAligned)); var op1 = Avx.LoadAlignedVector256((Byte*)(_dataTable.inArray1Ptr)); var op2 = Avx.LoadAlignedVector256((Byte*)(_dataTable.inArray2Ptr)); var result = Avx2.Max(op1, op2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(op1, op2, _dataTable.outArrayPtr); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new SimpleBinaryOpTest__MaxByte(); var result = Avx2.Max(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__MaxByte(); fixed (Vector256<Byte>* pFld1 = &test._fld1) fixed (Vector256<Byte>* pFld2 = &test._fld2) { var result = Avx2.Max( Avx.LoadVector256((Byte*)(pFld1)), Avx.LoadVector256((Byte*)(pFld2)) ); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(test._fld1, test._fld2, _dataTable.outArrayPtr); } } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = Avx2.Max(_fld1, _fld2); Unsafe.Write(_dataTable.outArrayPtr, result); ValidateResult(_fld1, _fld2, _dataTable.outArrayPtr); } public void RunClassFldScenario_Load() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario_Load)); fixed (Vector256<Byte>* pFld1 = &_fld1) fixed (Vector256<Byte>* pFld2 = &_fld2) { var result = Avx2.Max( Avx.LoadVector256((Byte*)(pFld1)), Avx.LoadVector256((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 = Avx2.Max(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 = Avx2.Max( Avx.LoadVector256((Byte*)(&test._fld1)), Avx.LoadVector256((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(Vector256<Byte> op1, Vector256<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<Vector256<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<Vector256<Byte>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector256<Byte>>()); Unsafe.CopyBlockUnaligned(ref Unsafe.As<Byte, byte>(ref outArray[0]), ref Unsafe.AsRef<byte>(result), (uint)Unsafe.SizeOf<Vector256<Byte>>()); ValidateResult(inArray1, inArray2, outArray, method); } private void ValidateResult(Byte[] left, Byte[] right, Byte[] result, [CallerMemberName] string method = "") { bool succeeded = true; if (result[0] != Math.Max(left[0], right[0])) { succeeded = false; } else { for (var i = 1; i < RetElementCount; i++) { if (result[i] != Math.Max(left[i], right[i])) { succeeded = false; break; } } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(Avx2)}.{nameof(Avx2.Max)}<Byte>(Vector256<Byte>, Vector256<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,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/libraries/Microsoft.Win32.Registry/ref/Microsoft.Win32.Registry.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>$(NetCoreAppCurrent)</TargetFramework> <Nullable>enable</Nullable> </PropertyGroup> <ItemGroup> <Compile Include="Microsoft.Win32.Registry.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="$(LibrariesProjectRoot)System.IO.Pipes.AccessControl\ref\System.IO.Pipes.AccessControl.csproj" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <TargetFramework>$(NetCoreAppCurrent)</TargetFramework> <Nullable>enable</Nullable> </PropertyGroup> <ItemGroup> <Compile Include="Microsoft.Win32.Registry.cs" /> </ItemGroup> <ItemGroup> <ProjectReference Include="$(LibrariesProjectRoot)System.IO.Pipes.AccessControl\ref\System.IO.Pipes.AccessControl.csproj" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/RuntimeInformation.Browser.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.InteropServices { public static partial class RuntimeInformation { public static string OSDescription => "Browser"; public static Architecture OSArchitecture => Architecture.Wasm; } }
// 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.InteropServices { public static partial class RuntimeInformation { public static string OSDescription => "Browser"; public static Architecture OSArchitecture => Architecture.Wasm; } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/JIT/Regression/VS-ia64-JIT/V1.2-M01/b19112/b19112a.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>PdbOnly</DebugType> </PropertyGroup> <ItemGroup> <Compile Include="divbyte.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <DebugType>PdbOnly</DebugType> </PropertyGroup> <ItemGroup> <Compile Include="divbyte.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/JIT/opt/Devirtualization/GitHub_50492.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; using System.Threading; class Base { public virtual int Test(Base b1, Base b2, bool p) => 0; public virtual int Foo() => 1; } class ClassA : Base { public override int Test(Base b1, Base b2, bool p) => p ? b2.Foo() : 42; } class ClassB : ClassA { public override int Test(Base b1, Base b2, bool p) => b1.Test(b1, b2, p); } class Program { public static int Main() { for (int i = 0; i < 100; i++) { // Make sure it doesn't assert, see https://github.com/dotnet/runtime/issues/50492 Test(new ClassB(), new ClassA(), new Base(), true); Thread.Sleep(15); } return 100; } [MethodImpl(MethodImplOptions.NoInlining)] static int Test(Base b0, Base b1, Base b2, bool p) { return b0.Test(b1, b2, p); } }
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. using System.Runtime.CompilerServices; using System.Threading; class Base { public virtual int Test(Base b1, Base b2, bool p) => 0; public virtual int Foo() => 1; } class ClassA : Base { public override int Test(Base b1, Base b2, bool p) => p ? b2.Foo() : 42; } class ClassB : ClassA { public override int Test(Base b1, Base b2, bool p) => b1.Test(b1, b2, p); } class Program { public static int Main() { for (int i = 0; i < 100; i++) { // Make sure it doesn't assert, see https://github.com/dotnet/runtime/issues/50492 Test(new ClassB(), new ClassA(), new Base(), true); Thread.Sleep(15); } return 100; } [MethodImpl(MethodImplOptions.NoInlining)] static int Test(Base b0, Base b1, Base b2, bool p) { return b0.Test(b1, b2, p); } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/libraries/System.Collections.Specialized/tests/NameValueCollection/NameValueCollection.GetKeyTests.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.Collections.Specialized.Tests { public class NameValueCollectionGetKeyTests { [Theory] [InlineData(0)] [InlineData(5)] public void Get_InvalidIndex_ThrowsArgumentOutOfRangeException(int count) { NameValueCollection nameValueCollection = Helpers.CreateNameValueCollection(count); AssertExtensions.Throws<ArgumentOutOfRangeException>("index", () => nameValueCollection.Get(-1)); AssertExtensions.Throws<ArgumentOutOfRangeException>("index", () => nameValueCollection.Get(count)); AssertExtensions.Throws<ArgumentOutOfRangeException>("index", () => nameValueCollection.Get(count + 1)); } } }
// 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.Collections.Specialized.Tests { public class NameValueCollectionGetKeyTests { [Theory] [InlineData(0)] [InlineData(5)] public void Get_InvalidIndex_ThrowsArgumentOutOfRangeException(int count) { NameValueCollection nameValueCollection = Helpers.CreateNameValueCollection(count); AssertExtensions.Throws<ArgumentOutOfRangeException>("index", () => nameValueCollection.Get(-1)); AssertExtensions.Throws<ArgumentOutOfRangeException>("index", () => nameValueCollection.Get(count)); AssertExtensions.Throws<ArgumentOutOfRangeException>("index", () => nameValueCollection.Get(count + 1)); } } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/JIT/Methodical/int64/unsigned/ldc_mulovf_ro.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> </PropertyGroup> <PropertyGroup> <DebugType>None</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="ldc_mulovf.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> </PropertyGroup> <PropertyGroup> <DebugType>None</DebugType> <Optimize>True</Optimize> </PropertyGroup> <ItemGroup> <Compile Include="ldc_mulovf.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/libraries/System.Memory/tests/Memory/CtorArray.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.MemoryTests { // // Tests for Memory<T>.ctor(T[]) // // These tests will also exercise the matching codepaths in Memory<T>.ctor(T[], int, int). This makes it easier to ensure // that these parallel tests stay consistent, and avoid excess repetition in the files devoted to those specific overloads. // public static partial class MemoryTests { [Fact] public static void CtorArrayInt() { int[] a = { 91, 92, -93, 94 }; Memory<int> memory; memory = new Memory<int>(a); memory.Validate(91, 92, -93, 94); memory = new Memory<int>(a, 0, a.Length); memory.Validate(91, 92, -93, 94); } [Fact] public static void CtorArrayLong() { long[] a = { 91, -92, 93, 94, -95 }; Memory<long> memory; memory = new Memory<long>(a); memory.Validate(91, -92, 93, 94, -95); memory = new Memory<long>(a, 0, a.Length); memory.Validate(91, -92, 93, 94, -95); } [Fact] public static void CtorArrayObject() { object o1 = new object(); object o2 = new object(); object[] a = { o1, o2 }; Memory<object> memory; memory = new Memory<object>(a); memory.ValidateReferenceType(o1, o2); memory = new Memory<object>(a, 0, a.Length); memory.ValidateReferenceType(o1, o2); } [Fact] public static void CtorArrayZeroLength() { int[] empty = Array.Empty<int>(); Memory<int> memory; memory = new Memory<int>(empty); memory.Validate(); memory = new Memory<int>(empty, 0, empty.Length); memory.Validate(); } [Fact] public static void CtorArrayNullArray() { var memory = new Memory<int>(null); memory.Validate(); Assert.Equal(default, memory); memory = new Memory<int>((int[])null, 0, 0); memory.Validate(); Assert.Equal(default, memory); } [Fact] public static void CtorArrayNullArrayNonZeroStartAndLength() { Assert.Throws<ArgumentOutOfRangeException>(() => new Memory<int>((int[])null, 1, 0)); Assert.Throws<ArgumentOutOfRangeException>(() => new Memory<int>((int[])null, 0, 1)); Assert.Throws<ArgumentOutOfRangeException>(() => new Memory<int>((int[])null, 1, 1)); Assert.Throws<ArgumentOutOfRangeException>(() => new Memory<int>((int[])null, -1, -1)); } [Fact] public static void CtorArrayWrongArrayType() { // Cannot pass variant array, if array type is not a valuetype. string[] a = { "Hello" }; Assert.Throws<ArrayTypeMismatchException>(() => new Memory<object>(a)); Assert.Throws<ArrayTypeMismatchException>(() => new Memory<object>(a, 0, a.Length)); } [Fact] public static void CtorArrayWrongValueType() { // Can pass variant array, if array type is a valuetype. uint[] a = { 42u, 0xffffffffu }; int[] aAsIntArray = (int[])(object)a; Memory<int> memory; memory = new Memory<int>(aAsIntArray); memory.Validate(42, -1); memory = new Memory<int>(aAsIntArray, 0, aAsIntArray.Length); memory.Validate(42, -1); } } }
// 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.MemoryTests { // // Tests for Memory<T>.ctor(T[]) // // These tests will also exercise the matching codepaths in Memory<T>.ctor(T[], int, int). This makes it easier to ensure // that these parallel tests stay consistent, and avoid excess repetition in the files devoted to those specific overloads. // public static partial class MemoryTests { [Fact] public static void CtorArrayInt() { int[] a = { 91, 92, -93, 94 }; Memory<int> memory; memory = new Memory<int>(a); memory.Validate(91, 92, -93, 94); memory = new Memory<int>(a, 0, a.Length); memory.Validate(91, 92, -93, 94); } [Fact] public static void CtorArrayLong() { long[] a = { 91, -92, 93, 94, -95 }; Memory<long> memory; memory = new Memory<long>(a); memory.Validate(91, -92, 93, 94, -95); memory = new Memory<long>(a, 0, a.Length); memory.Validate(91, -92, 93, 94, -95); } [Fact] public static void CtorArrayObject() { object o1 = new object(); object o2 = new object(); object[] a = { o1, o2 }; Memory<object> memory; memory = new Memory<object>(a); memory.ValidateReferenceType(o1, o2); memory = new Memory<object>(a, 0, a.Length); memory.ValidateReferenceType(o1, o2); } [Fact] public static void CtorArrayZeroLength() { int[] empty = Array.Empty<int>(); Memory<int> memory; memory = new Memory<int>(empty); memory.Validate(); memory = new Memory<int>(empty, 0, empty.Length); memory.Validate(); } [Fact] public static void CtorArrayNullArray() { var memory = new Memory<int>(null); memory.Validate(); Assert.Equal(default, memory); memory = new Memory<int>((int[])null, 0, 0); memory.Validate(); Assert.Equal(default, memory); } [Fact] public static void CtorArrayNullArrayNonZeroStartAndLength() { Assert.Throws<ArgumentOutOfRangeException>(() => new Memory<int>((int[])null, 1, 0)); Assert.Throws<ArgumentOutOfRangeException>(() => new Memory<int>((int[])null, 0, 1)); Assert.Throws<ArgumentOutOfRangeException>(() => new Memory<int>((int[])null, 1, 1)); Assert.Throws<ArgumentOutOfRangeException>(() => new Memory<int>((int[])null, -1, -1)); } [Fact] public static void CtorArrayWrongArrayType() { // Cannot pass variant array, if array type is not a valuetype. string[] a = { "Hello" }; Assert.Throws<ArrayTypeMismatchException>(() => new Memory<object>(a)); Assert.Throws<ArrayTypeMismatchException>(() => new Memory<object>(a, 0, a.Length)); } [Fact] public static void CtorArrayWrongValueType() { // Can pass variant array, if array type is a valuetype. uint[] a = { 42u, 0xffffffffu }; int[] aAsIntArray = (int[])(object)a; Memory<int> memory; memory = new Memory<int>(aAsIntArray); memory.Validate(42, -1); memory = new Memory<int>(aAsIntArray, 0, aAsIntArray.Length); memory.Validate(42, -1); } } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/JIT/HardwareIntrinsics/General/Vector128_1/op_BitwiseAnd.UInt32.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_BitwiseAndUInt32() { var test = new VectorBinaryOpTest__op_BitwiseAndUInt32(); // 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_BitwiseAndUInt32 { 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, UInt32[] inArray2, UInt32[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<UInt32>(); int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<UInt32>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<UInt32>(); 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<UInt32, byte>(ref inArray1[0]), (uint)sizeOfinArray1); Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<UInt32, 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<UInt32> _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.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref testStruct._fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); return testStruct; } public void RunStructFldScenario(VectorBinaryOpTest__op_BitwiseAndUInt32 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<UInt32>>() / sizeof(UInt32); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32); private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32); private static UInt32[] _data1 = new UInt32[Op1ElementCount]; private static UInt32[] _data2 = new UInt32[Op2ElementCount]; private static Vector128<UInt32> _clsVar1; private static Vector128<UInt32> _clsVar2; private Vector128<UInt32> _fld1; private Vector128<UInt32> _fld2; private DataTable _dataTable; static VectorBinaryOpTest__op_BitwiseAndUInt32() { 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.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); } public VectorBinaryOpTest__op_BitwiseAndUInt32() { 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.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt32(); } _dataTable = new DataTable(_data1, _data2, new UInt32[RetElementCount], LargestVectorSize); } public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray1Ptr) & Unsafe.Read<Vector128<UInt32>>(_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<UInt32>).GetMethod("op_BitwiseAnd", new Type[] { typeof(Vector128<UInt32>), typeof(Vector128<UInt32>) }) .Invoke(null, new object[] { Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<UInt32>>(_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 = _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<UInt32>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector128<UInt32>>(_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_BitwiseAndUInt32(); 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<UInt32> op1, Vector128<UInt32> op2, void* result, [CallerMemberName] string method = "") { UInt32[] inArray1 = new UInt32[Op1ElementCount]; UInt32[] inArray2 = new UInt32[Op2ElementCount]; UInt32[] outArray = new UInt32[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), op1); Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, 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]; UInt32[] inArray2 = new UInt32[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<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); 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, UInt32[] right, UInt32[] result, [CallerMemberName] string method = "") { bool succeeded = true; if (result[0] != (uint)(left[0] & right[0])) { succeeded = false; } else { for (var i = 1; i < RetElementCount; i++) { if (result[i] != (uint)(left[i] & right[i])) { succeeded = false; break; } } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(Vector128)}.op_BitwiseAnd<UInt32>(Vector128<UInt32>, Vector128<UInt32>): {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_BitwiseAndUInt32() { var test = new VectorBinaryOpTest__op_BitwiseAndUInt32(); // 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_BitwiseAndUInt32 { 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, UInt32[] inArray2, UInt32[] outArray, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<UInt32>(); int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<UInt32>(); int sizeOfoutArray = outArray.Length * Unsafe.SizeOf<UInt32>(); 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<UInt32, byte>(ref inArray1[0]), (uint)sizeOfinArray1); Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<UInt32, 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<UInt32> _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.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref testStruct._fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); return testStruct; } public void RunStructFldScenario(VectorBinaryOpTest__op_BitwiseAndUInt32 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<UInt32>>() / sizeof(UInt32); private static readonly int Op2ElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32); private static readonly int RetElementCount = Unsafe.SizeOf<Vector128<UInt32>>() / sizeof(UInt32); private static UInt32[] _data1 = new UInt32[Op1ElementCount]; private static UInt32[] _data2 = new UInt32[Op2ElementCount]; private static Vector128<UInt32> _clsVar1; private static Vector128<UInt32> _clsVar2; private Vector128<UInt32> _fld1; private Vector128<UInt32> _fld2; private DataTable _dataTable; static VectorBinaryOpTest__op_BitwiseAndUInt32() { 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.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _clsVar2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); } public VectorBinaryOpTest__op_BitwiseAndUInt32() { 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.GetUInt32(); } Unsafe.CopyBlockUnaligned(ref Unsafe.As<Vector128<UInt32>, byte>(ref _fld2), ref Unsafe.As<UInt32, byte>(ref _data2[0]), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); for (var i = 0; i < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetUInt32(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetUInt32(); } _dataTable = new DataTable(_data1, _data2, new UInt32[RetElementCount], LargestVectorSize); } public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray1Ptr) & Unsafe.Read<Vector128<UInt32>>(_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<UInt32>).GetMethod("op_BitwiseAnd", new Type[] { typeof(Vector128<UInt32>), typeof(Vector128<UInt32>) }) .Invoke(null, new object[] { Unsafe.Read<Vector128<UInt32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<UInt32>>(_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 = _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<UInt32>>(_dataTable.inArray1Ptr); var op2 = Unsafe.Read<Vector128<UInt32>>(_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_BitwiseAndUInt32(); 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<UInt32> op1, Vector128<UInt32> op2, void* result, [CallerMemberName] string method = "") { UInt32[] inArray1 = new UInt32[Op1ElementCount]; UInt32[] inArray2 = new UInt32[Op2ElementCount]; UInt32[] outArray = new UInt32[RetElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, byte>(ref inArray1[0]), op1); Unsafe.WriteUnaligned(ref Unsafe.As<UInt32, 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]; UInt32[] inArray2 = new UInt32[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<UInt32, byte>(ref inArray2[0]), ref Unsafe.AsRef<byte>(op2), (uint)Unsafe.SizeOf<Vector128<UInt32>>()); 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, UInt32[] right, UInt32[] result, [CallerMemberName] string method = "") { bool succeeded = true; if (result[0] != (uint)(left[0] & right[0])) { succeeded = false; } else { for (var i = 1; i < RetElementCount; i++) { if (result[i] != (uint)(left[i] & right[i])) { succeeded = false; break; } } } if (!succeeded) { TestLibrary.TestFramework.LogInformation($"{nameof(Vector128)}.op_BitwiseAnd<UInt32>(Vector128<UInt32>, Vector128<UInt32>): {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,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/JIT/HardwareIntrinsics/General/Vector128/LessThanOrEqualAll.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; namespace JIT.HardwareIntrinsics.General { public static partial class Program { private static void LessThanOrEqualAllInt32() { var test = new VectorBooleanBinaryOpTest__LessThanOrEqualAllInt32(); // 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__LessThanOrEqualAllInt32 { private struct DataTable { private byte[] inArray1; private byte[] inArray2; private GCHandle inHandle1; private GCHandle inHandle2; private ulong alignment; public DataTable(Int32[] inArray1, Int32[] inArray2, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Int32>(); int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<Int32>(); 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<Int32, byte>(ref inArray1[0]), (uint)sizeOfinArray1); Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<Int32, 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<Int32> _fld1; public Vector128<Int32> _fld2; 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>>()); return testStruct; } public void RunStructFldScenario(VectorBooleanBinaryOpTest__LessThanOrEqualAllInt32 testClass) { var result = Vector128.LessThanOrEqualAll(_fld1, _fld2); testClass.ValidateResult(_fld1, _fld2, result); } } 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 Int32[] _data1 = new Int32[Op1ElementCount]; private static Int32[] _data2 = new Int32[Op2ElementCount]; private static Vector128<Int32> _clsVar1; private static Vector128<Int32> _clsVar2; private Vector128<Int32> _fld1; private Vector128<Int32> _fld2; private DataTable _dataTable; static VectorBooleanBinaryOpTest__LessThanOrEqualAllInt32() { 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>>()); } public VectorBooleanBinaryOpTest__LessThanOrEqualAllInt32() { 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 < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt32(); } _dataTable = new DataTable(_data1, _data2, LargestVectorSize); } public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = Vector128.LessThanOrEqualAll( Unsafe.Read<Vector128<Int32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<Int32>>(_dataTable.inArray2Ptr) ); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, result); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var method = typeof(Vector128).GetMethod(nameof(Vector128.LessThanOrEqualAll), new Type[] { typeof(Vector128<Int32>), typeof(Vector128<Int32>) }); if (method is null) { method = typeof(Vector128).GetMethod(nameof(Vector128.LessThanOrEqualAll), 1, new Type[] { typeof(Vector128<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), typeof(Vector128<>).MakeGenericType(Type.MakeGenericMethodParameter(0)) }); } if (method.IsGenericMethodDefinition) { method = method.MakeGenericMethod(typeof(Int32)); } var result = method.Invoke(null, new object[] { Unsafe.Read<Vector128<Int32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<Int32>>(_dataTable.inArray2Ptr) }); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, (bool)(result)); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = Vector128.LessThanOrEqualAll( _clsVar1, _clsVar2 ); ValidateResult(_clsVar1, _clsVar2, result); } 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 result = Vector128.LessThanOrEqualAll(op1, op2); ValidateResult(op1, op2, result); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new VectorBooleanBinaryOpTest__LessThanOrEqualAllInt32(); var result = Vector128.LessThanOrEqualAll(test._fld1, test._fld2); ValidateResult(test._fld1, test._fld2, result); } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = Vector128.LessThanOrEqualAll(_fld1, _fld2); ValidateResult(_fld1, _fld2, result); } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = Vector128.LessThanOrEqualAll(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<Int32> op1, Vector128<Int32> op2, bool result, [CallerMemberName] string method = "") { Int32[] inArray1 = new Int32[Op1ElementCount]; Int32[] inArray2 = new Int32[Op2ElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), op1); Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), op2); ValidateResult(inArray1, inArray2, result, method); } private void ValidateResult(void* op1, void* op2, bool result, [CallerMemberName] string method = "") { Int32[] inArray1 = new Int32[Op1ElementCount]; Int32[] inArray2 = new Int32[Op2ElementCount]; 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>>()); ValidateResult(inArray1, inArray2, result, method); } private void ValidateResult(Int32[] left, Int32[] 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)}.{nameof(Vector128.LessThanOrEqualAll)}<Int32>(Vector128<Int32>, Vector128<Int32>): {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 LessThanOrEqualAllInt32() { var test = new VectorBooleanBinaryOpTest__LessThanOrEqualAllInt32(); // 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__LessThanOrEqualAllInt32 { private struct DataTable { private byte[] inArray1; private byte[] inArray2; private GCHandle inHandle1; private GCHandle inHandle2; private ulong alignment; public DataTable(Int32[] inArray1, Int32[] inArray2, int alignment) { int sizeOfinArray1 = inArray1.Length * Unsafe.SizeOf<Int32>(); int sizeOfinArray2 = inArray2.Length * Unsafe.SizeOf<Int32>(); 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<Int32, byte>(ref inArray1[0]), (uint)sizeOfinArray1); Unsafe.CopyBlockUnaligned(ref Unsafe.AsRef<byte>(inArray2Ptr), ref Unsafe.As<Int32, 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<Int32> _fld1; public Vector128<Int32> _fld2; 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>>()); return testStruct; } public void RunStructFldScenario(VectorBooleanBinaryOpTest__LessThanOrEqualAllInt32 testClass) { var result = Vector128.LessThanOrEqualAll(_fld1, _fld2); testClass.ValidateResult(_fld1, _fld2, result); } } 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 Int32[] _data1 = new Int32[Op1ElementCount]; private static Int32[] _data2 = new Int32[Op2ElementCount]; private static Vector128<Int32> _clsVar1; private static Vector128<Int32> _clsVar2; private Vector128<Int32> _fld1; private Vector128<Int32> _fld2; private DataTable _dataTable; static VectorBooleanBinaryOpTest__LessThanOrEqualAllInt32() { 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>>()); } public VectorBooleanBinaryOpTest__LessThanOrEqualAllInt32() { 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 < Op1ElementCount; i++) { _data1[i] = TestLibrary.Generator.GetInt32(); } for (var i = 0; i < Op2ElementCount; i++) { _data2[i] = TestLibrary.Generator.GetInt32(); } _dataTable = new DataTable(_data1, _data2, LargestVectorSize); } public bool Succeeded { get; set; } public void RunBasicScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunBasicScenario_UnsafeRead)); var result = Vector128.LessThanOrEqualAll( Unsafe.Read<Vector128<Int32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<Int32>>(_dataTable.inArray2Ptr) ); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, result); } public void RunReflectionScenario_UnsafeRead() { TestLibrary.TestFramework.BeginScenario(nameof(RunReflectionScenario_UnsafeRead)); var method = typeof(Vector128).GetMethod(nameof(Vector128.LessThanOrEqualAll), new Type[] { typeof(Vector128<Int32>), typeof(Vector128<Int32>) }); if (method is null) { method = typeof(Vector128).GetMethod(nameof(Vector128.LessThanOrEqualAll), 1, new Type[] { typeof(Vector128<>).MakeGenericType(Type.MakeGenericMethodParameter(0)), typeof(Vector128<>).MakeGenericType(Type.MakeGenericMethodParameter(0)) }); } if (method.IsGenericMethodDefinition) { method = method.MakeGenericMethod(typeof(Int32)); } var result = method.Invoke(null, new object[] { Unsafe.Read<Vector128<Int32>>(_dataTable.inArray1Ptr), Unsafe.Read<Vector128<Int32>>(_dataTable.inArray2Ptr) }); ValidateResult(_dataTable.inArray1Ptr, _dataTable.inArray2Ptr, (bool)(result)); } public void RunClsVarScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClsVarScenario)); var result = Vector128.LessThanOrEqualAll( _clsVar1, _clsVar2 ); ValidateResult(_clsVar1, _clsVar2, result); } 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 result = Vector128.LessThanOrEqualAll(op1, op2); ValidateResult(op1, op2, result); } public void RunClassLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassLclFldScenario)); var test = new VectorBooleanBinaryOpTest__LessThanOrEqualAllInt32(); var result = Vector128.LessThanOrEqualAll(test._fld1, test._fld2); ValidateResult(test._fld1, test._fld2, result); } public void RunClassFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunClassFldScenario)); var result = Vector128.LessThanOrEqualAll(_fld1, _fld2); ValidateResult(_fld1, _fld2, result); } public void RunStructLclFldScenario() { TestLibrary.TestFramework.BeginScenario(nameof(RunStructLclFldScenario)); var test = TestStruct.Create(); var result = Vector128.LessThanOrEqualAll(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<Int32> op1, Vector128<Int32> op2, bool result, [CallerMemberName] string method = "") { Int32[] inArray1 = new Int32[Op1ElementCount]; Int32[] inArray2 = new Int32[Op2ElementCount]; Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray1[0]), op1); Unsafe.WriteUnaligned(ref Unsafe.As<Int32, byte>(ref inArray2[0]), op2); ValidateResult(inArray1, inArray2, result, method); } private void ValidateResult(void* op1, void* op2, bool result, [CallerMemberName] string method = "") { Int32[] inArray1 = new Int32[Op1ElementCount]; Int32[] inArray2 = new Int32[Op2ElementCount]; 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>>()); ValidateResult(inArray1, inArray2, result, method); } private void ValidateResult(Int32[] left, Int32[] 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)}.{nameof(Vector128.LessThanOrEqualAll)}<Int32>(Vector128<Int32>, Vector128<Int32>): {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,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/coreclr/pal/tests/palsuite/c_runtime/isxdigit/test1/test1.cpp
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. /*============================================================================ ** ** Source: test1.c ** ** Purpose: Run through every possible character. For each time that ** isxdigit returns: ** 1, check through a list of the known hex characters to ensure that it ** is really a hex char. Also, when it returns 0, ensure that that character ** isn't a hex character. ** ** **==========================================================================*/ #include <palsuite.h> PALTEST(c_runtime_isxdigit_test1_paltest_isxdigit_test1, "c_runtime/isxdigit/test1/paltest_isxdigit_test1") { int i; /* Initialize the PAL */ if ( 0 != PAL_Initialize(argc, argv)) { return FAIL; } /* Loop through each character and call isxdigit for each character */ for (i=1; i<256; i++) { if (isxdigit(i) == 0) { if( ((i>=48) && (i<=57)) || ((i>=97) && (i<=102)) || ((i>=65) && (i<=70)) ) { Fail("ERROR: isxdigit() returns true for '%c' (%d)\n", i, i); } } else { if( ((i<48) && (i>58)) || ((i<97) && (i>102)) || ((i<65) && (i>70)) ) { Fail("ERROR: isxdigit() returns false for '%c' (%d)\n", i, i); } } } 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: test1.c ** ** Purpose: Run through every possible character. For each time that ** isxdigit returns: ** 1, check through a list of the known hex characters to ensure that it ** is really a hex char. Also, when it returns 0, ensure that that character ** isn't a hex character. ** ** **==========================================================================*/ #include <palsuite.h> PALTEST(c_runtime_isxdigit_test1_paltest_isxdigit_test1, "c_runtime/isxdigit/test1/paltest_isxdigit_test1") { int i; /* Initialize the PAL */ if ( 0 != PAL_Initialize(argc, argv)) { return FAIL; } /* Loop through each character and call isxdigit for each character */ for (i=1; i<256; i++) { if (isxdigit(i) == 0) { if( ((i>=48) && (i<=57)) || ((i>=97) && (i<=102)) || ((i>=65) && (i<=70)) ) { Fail("ERROR: isxdigit() returns true for '%c' (%d)\n", i, i); } } else { if( ((i<48) && (i>58)) || ((i<97) && (i>102)) || ((i<65) && (i>70)) ) { Fail("ERROR: isxdigit() returns false for '%c' (%d)\n", i, i); } } } PAL_Terminate(); return PASS; }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/libraries/System.Security.Permissions/System.Security.Permissions.sln
Microsoft Visual Studio Solution File, Format Version 12.00 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestUtilities", "..\Common\tests\TestUtilities\TestUtilities.csproj", "{74374CDE-23F8-4041-8F94-D5CBC23735C6}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Win32.SystemEvents", "..\Microsoft.Win32.SystemEvents\ref\Microsoft.Win32.SystemEvents.csproj", "{13782F8D-27BB-48EE-B176-859C11173158}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Win32.SystemEvents", "..\Microsoft.Win32.SystemEvents\src\Microsoft.Win32.SystemEvents.csproj", "{B5ADF0C4-33EF-4836-AF94-0F4551AE26B8}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.DirectoryServices", "..\System.DirectoryServices\ref\System.DirectoryServices.csproj", "{A629F9A5-1EA5-475F-9A49-29C81198CF34}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.DirectoryServices", "..\System.DirectoryServices\src\System.DirectoryServices.csproj", "{7E64D2D1-7ED9-490A-B658-5E2162F571D6}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Drawing.Common", "..\System.Drawing.Common\ref\System.Drawing.Common.csproj", "{E71E8D52-CF85-4713-9634-EB04CAE7F21A}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Drawing.Common", "..\System.Drawing.Common\src\System.Drawing.Common.csproj", "{53FBF7A5-CF86-435A-B20C-47BD78847CF5}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DllImportGenerator", "..\System.Runtime.InteropServices\gen\DllImportGenerator\DllImportGenerator.csproj", "{81BC7EDB-94CC-4497-9D3F-FE60BAC03FAC}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Interop.SourceGeneration", "..\System.Runtime.InteropServices\gen\Microsoft.Interop.SourceGeneration\Microsoft.Interop.SourceGeneration.csproj", "{E2926598-EE1D-4DA3-AD75-11D54F1EF318}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Security.Permissions", "ref\System.Security.Permissions.csproj", "{F238F227-522D-4886-A6B5-474948B3C660}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Security.Permissions", "src\System.Security.Permissions.csproj", "{CE88C6B8-C9B6-4695-BA23-BE8955018E26}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Security.Permissions.Tests", "tests\System.Security.Permissions.Tests.csproj", "{B9CD9B45-D3AC-433F-B316-6DB40FCCC8F1}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Windows.Extensions", "..\System.Windows.Extensions\ref\System.Windows.Extensions.csproj", "{19AB8565-1ADA-4E64-B5C8-FD2DA7525358}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Windows.Extensions", "..\System.Windows.Extensions\src\System.Windows.Extensions.csproj", "{F2FF3B73-B971-4C07-B9C9-9EA600C288BD}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{25C80847-6651-4D9D-B625-24D756EC48CA}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ref", "ref", "{97C6E424-BBBA-495D-8261-E5ADBABA2B29}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{9C0E3C0E-FFF8-4241-8942-A77093C003F1}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "gen", "gen", "{EA13AEBA-B53D-4A6C-8BA1-FB1748B87675}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {74374CDE-23F8-4041-8F94-D5CBC23735C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {74374CDE-23F8-4041-8F94-D5CBC23735C6}.Debug|Any CPU.Build.0 = Debug|Any CPU {74374CDE-23F8-4041-8F94-D5CBC23735C6}.Release|Any CPU.ActiveCfg = Release|Any CPU {74374CDE-23F8-4041-8F94-D5CBC23735C6}.Release|Any CPU.Build.0 = Release|Any CPU {13782F8D-27BB-48EE-B176-859C11173158}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {13782F8D-27BB-48EE-B176-859C11173158}.Debug|Any CPU.Build.0 = Debug|Any CPU {13782F8D-27BB-48EE-B176-859C11173158}.Release|Any CPU.ActiveCfg = Release|Any CPU {13782F8D-27BB-48EE-B176-859C11173158}.Release|Any CPU.Build.0 = Release|Any CPU {B5ADF0C4-33EF-4836-AF94-0F4551AE26B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B5ADF0C4-33EF-4836-AF94-0F4551AE26B8}.Debug|Any CPU.Build.0 = Debug|Any CPU {B5ADF0C4-33EF-4836-AF94-0F4551AE26B8}.Release|Any CPU.ActiveCfg = Release|Any CPU {B5ADF0C4-33EF-4836-AF94-0F4551AE26B8}.Release|Any CPU.Build.0 = Release|Any CPU {A629F9A5-1EA5-475F-9A49-29C81198CF34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A629F9A5-1EA5-475F-9A49-29C81198CF34}.Debug|Any CPU.Build.0 = Debug|Any CPU {A629F9A5-1EA5-475F-9A49-29C81198CF34}.Release|Any CPU.ActiveCfg = Release|Any CPU {A629F9A5-1EA5-475F-9A49-29C81198CF34}.Release|Any CPU.Build.0 = Release|Any CPU {7E64D2D1-7ED9-490A-B658-5E2162F571D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7E64D2D1-7ED9-490A-B658-5E2162F571D6}.Debug|Any CPU.Build.0 = Debug|Any CPU {7E64D2D1-7ED9-490A-B658-5E2162F571D6}.Release|Any CPU.ActiveCfg = Release|Any CPU {7E64D2D1-7ED9-490A-B658-5E2162F571D6}.Release|Any CPU.Build.0 = Release|Any CPU {E71E8D52-CF85-4713-9634-EB04CAE7F21A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E71E8D52-CF85-4713-9634-EB04CAE7F21A}.Debug|Any CPU.Build.0 = Debug|Any CPU {E71E8D52-CF85-4713-9634-EB04CAE7F21A}.Release|Any CPU.ActiveCfg = Release|Any CPU {E71E8D52-CF85-4713-9634-EB04CAE7F21A}.Release|Any CPU.Build.0 = Release|Any CPU {53FBF7A5-CF86-435A-B20C-47BD78847CF5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {53FBF7A5-CF86-435A-B20C-47BD78847CF5}.Debug|Any CPU.Build.0 = Debug|Any CPU {53FBF7A5-CF86-435A-B20C-47BD78847CF5}.Release|Any CPU.ActiveCfg = Release|Any CPU {53FBF7A5-CF86-435A-B20C-47BD78847CF5}.Release|Any CPU.Build.0 = Release|Any CPU {81BC7EDB-94CC-4497-9D3F-FE60BAC03FAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {81BC7EDB-94CC-4497-9D3F-FE60BAC03FAC}.Debug|Any CPU.Build.0 = Debug|Any CPU {81BC7EDB-94CC-4497-9D3F-FE60BAC03FAC}.Release|Any CPU.ActiveCfg = Release|Any CPU {81BC7EDB-94CC-4497-9D3F-FE60BAC03FAC}.Release|Any CPU.Build.0 = Release|Any CPU {E2926598-EE1D-4DA3-AD75-11D54F1EF318}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E2926598-EE1D-4DA3-AD75-11D54F1EF318}.Debug|Any CPU.Build.0 = Debug|Any CPU {E2926598-EE1D-4DA3-AD75-11D54F1EF318}.Release|Any CPU.ActiveCfg = Release|Any CPU {E2926598-EE1D-4DA3-AD75-11D54F1EF318}.Release|Any CPU.Build.0 = Release|Any CPU {F238F227-522D-4886-A6B5-474948B3C660}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F238F227-522D-4886-A6B5-474948B3C660}.Debug|Any CPU.Build.0 = Debug|Any CPU {F238F227-522D-4886-A6B5-474948B3C660}.Release|Any CPU.ActiveCfg = Release|Any CPU {F238F227-522D-4886-A6B5-474948B3C660}.Release|Any CPU.Build.0 = Release|Any CPU {CE88C6B8-C9B6-4695-BA23-BE8955018E26}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CE88C6B8-C9B6-4695-BA23-BE8955018E26}.Debug|Any CPU.Build.0 = Debug|Any CPU {CE88C6B8-C9B6-4695-BA23-BE8955018E26}.Release|Any CPU.ActiveCfg = Release|Any CPU {CE88C6B8-C9B6-4695-BA23-BE8955018E26}.Release|Any CPU.Build.0 = Release|Any CPU {B9CD9B45-D3AC-433F-B316-6DB40FCCC8F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B9CD9B45-D3AC-433F-B316-6DB40FCCC8F1}.Debug|Any CPU.Build.0 = Debug|Any CPU {B9CD9B45-D3AC-433F-B316-6DB40FCCC8F1}.Release|Any CPU.ActiveCfg = Release|Any CPU {B9CD9B45-D3AC-433F-B316-6DB40FCCC8F1}.Release|Any CPU.Build.0 = Release|Any CPU {19AB8565-1ADA-4E64-B5C8-FD2DA7525358}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {19AB8565-1ADA-4E64-B5C8-FD2DA7525358}.Debug|Any CPU.Build.0 = Debug|Any CPU {19AB8565-1ADA-4E64-B5C8-FD2DA7525358}.Release|Any CPU.ActiveCfg = Release|Any CPU {19AB8565-1ADA-4E64-B5C8-FD2DA7525358}.Release|Any CPU.Build.0 = Release|Any CPU {F2FF3B73-B971-4C07-B9C9-9EA600C288BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F2FF3B73-B971-4C07-B9C9-9EA600C288BD}.Debug|Any CPU.Build.0 = Debug|Any CPU {F2FF3B73-B971-4C07-B9C9-9EA600C288BD}.Release|Any CPU.ActiveCfg = Release|Any CPU {F2FF3B73-B971-4C07-B9C9-9EA600C288BD}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {74374CDE-23F8-4041-8F94-D5CBC23735C6} = {25C80847-6651-4D9D-B625-24D756EC48CA} {B9CD9B45-D3AC-433F-B316-6DB40FCCC8F1} = {25C80847-6651-4D9D-B625-24D756EC48CA} {13782F8D-27BB-48EE-B176-859C11173158} = {97C6E424-BBBA-495D-8261-E5ADBABA2B29} {A629F9A5-1EA5-475F-9A49-29C81198CF34} = {97C6E424-BBBA-495D-8261-E5ADBABA2B29} {E71E8D52-CF85-4713-9634-EB04CAE7F21A} = {97C6E424-BBBA-495D-8261-E5ADBABA2B29} {F238F227-522D-4886-A6B5-474948B3C660} = {97C6E424-BBBA-495D-8261-E5ADBABA2B29} {19AB8565-1ADA-4E64-B5C8-FD2DA7525358} = {97C6E424-BBBA-495D-8261-E5ADBABA2B29} {B5ADF0C4-33EF-4836-AF94-0F4551AE26B8} = {9C0E3C0E-FFF8-4241-8942-A77093C003F1} {7E64D2D1-7ED9-490A-B658-5E2162F571D6} = {9C0E3C0E-FFF8-4241-8942-A77093C003F1} {53FBF7A5-CF86-435A-B20C-47BD78847CF5} = {9C0E3C0E-FFF8-4241-8942-A77093C003F1} {CE88C6B8-C9B6-4695-BA23-BE8955018E26} = {9C0E3C0E-FFF8-4241-8942-A77093C003F1} {F2FF3B73-B971-4C07-B9C9-9EA600C288BD} = {9C0E3C0E-FFF8-4241-8942-A77093C003F1} {81BC7EDB-94CC-4497-9D3F-FE60BAC03FAC} = {EA13AEBA-B53D-4A6C-8BA1-FB1748B87675} {E2926598-EE1D-4DA3-AD75-11D54F1EF318} = {EA13AEBA-B53D-4A6C-8BA1-FB1748B87675} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {3A482AFF-93CE-43E0-9C2A-64424A25D364} EndGlobalSection EndGlobal
Microsoft Visual Studio Solution File, Format Version 12.00 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestUtilities", "..\Common\tests\TestUtilities\TestUtilities.csproj", "{74374CDE-23F8-4041-8F94-D5CBC23735C6}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Win32.SystemEvents", "..\Microsoft.Win32.SystemEvents\ref\Microsoft.Win32.SystemEvents.csproj", "{13782F8D-27BB-48EE-B176-859C11173158}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Win32.SystemEvents", "..\Microsoft.Win32.SystemEvents\src\Microsoft.Win32.SystemEvents.csproj", "{B5ADF0C4-33EF-4836-AF94-0F4551AE26B8}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.DirectoryServices", "..\System.DirectoryServices\ref\System.DirectoryServices.csproj", "{A629F9A5-1EA5-475F-9A49-29C81198CF34}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.DirectoryServices", "..\System.DirectoryServices\src\System.DirectoryServices.csproj", "{7E64D2D1-7ED9-490A-B658-5E2162F571D6}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Drawing.Common", "..\System.Drawing.Common\ref\System.Drawing.Common.csproj", "{E71E8D52-CF85-4713-9634-EB04CAE7F21A}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Drawing.Common", "..\System.Drawing.Common\src\System.Drawing.Common.csproj", "{53FBF7A5-CF86-435A-B20C-47BD78847CF5}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DllImportGenerator", "..\System.Runtime.InteropServices\gen\DllImportGenerator\DllImportGenerator.csproj", "{81BC7EDB-94CC-4497-9D3F-FE60BAC03FAC}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Interop.SourceGeneration", "..\System.Runtime.InteropServices\gen\Microsoft.Interop.SourceGeneration\Microsoft.Interop.SourceGeneration.csproj", "{E2926598-EE1D-4DA3-AD75-11D54F1EF318}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Security.Permissions", "ref\System.Security.Permissions.csproj", "{F238F227-522D-4886-A6B5-474948B3C660}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Security.Permissions", "src\System.Security.Permissions.csproj", "{CE88C6B8-C9B6-4695-BA23-BE8955018E26}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Security.Permissions.Tests", "tests\System.Security.Permissions.Tests.csproj", "{B9CD9B45-D3AC-433F-B316-6DB40FCCC8F1}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Windows.Extensions", "..\System.Windows.Extensions\ref\System.Windows.Extensions.csproj", "{19AB8565-1ADA-4E64-B5C8-FD2DA7525358}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Windows.Extensions", "..\System.Windows.Extensions\src\System.Windows.Extensions.csproj", "{F2FF3B73-B971-4C07-B9C9-9EA600C288BD}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{25C80847-6651-4D9D-B625-24D756EC48CA}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ref", "ref", "{97C6E424-BBBA-495D-8261-E5ADBABA2B29}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{9C0E3C0E-FFF8-4241-8942-A77093C003F1}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "gen", "gen", "{EA13AEBA-B53D-4A6C-8BA1-FB1748B87675}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {74374CDE-23F8-4041-8F94-D5CBC23735C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {74374CDE-23F8-4041-8F94-D5CBC23735C6}.Debug|Any CPU.Build.0 = Debug|Any CPU {74374CDE-23F8-4041-8F94-D5CBC23735C6}.Release|Any CPU.ActiveCfg = Release|Any CPU {74374CDE-23F8-4041-8F94-D5CBC23735C6}.Release|Any CPU.Build.0 = Release|Any CPU {13782F8D-27BB-48EE-B176-859C11173158}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {13782F8D-27BB-48EE-B176-859C11173158}.Debug|Any CPU.Build.0 = Debug|Any CPU {13782F8D-27BB-48EE-B176-859C11173158}.Release|Any CPU.ActiveCfg = Release|Any CPU {13782F8D-27BB-48EE-B176-859C11173158}.Release|Any CPU.Build.0 = Release|Any CPU {B5ADF0C4-33EF-4836-AF94-0F4551AE26B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B5ADF0C4-33EF-4836-AF94-0F4551AE26B8}.Debug|Any CPU.Build.0 = Debug|Any CPU {B5ADF0C4-33EF-4836-AF94-0F4551AE26B8}.Release|Any CPU.ActiveCfg = Release|Any CPU {B5ADF0C4-33EF-4836-AF94-0F4551AE26B8}.Release|Any CPU.Build.0 = Release|Any CPU {A629F9A5-1EA5-475F-9A49-29C81198CF34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {A629F9A5-1EA5-475F-9A49-29C81198CF34}.Debug|Any CPU.Build.0 = Debug|Any CPU {A629F9A5-1EA5-475F-9A49-29C81198CF34}.Release|Any CPU.ActiveCfg = Release|Any CPU {A629F9A5-1EA5-475F-9A49-29C81198CF34}.Release|Any CPU.Build.0 = Release|Any CPU {7E64D2D1-7ED9-490A-B658-5E2162F571D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {7E64D2D1-7ED9-490A-B658-5E2162F571D6}.Debug|Any CPU.Build.0 = Debug|Any CPU {7E64D2D1-7ED9-490A-B658-5E2162F571D6}.Release|Any CPU.ActiveCfg = Release|Any CPU {7E64D2D1-7ED9-490A-B658-5E2162F571D6}.Release|Any CPU.Build.0 = Release|Any CPU {E71E8D52-CF85-4713-9634-EB04CAE7F21A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E71E8D52-CF85-4713-9634-EB04CAE7F21A}.Debug|Any CPU.Build.0 = Debug|Any CPU {E71E8D52-CF85-4713-9634-EB04CAE7F21A}.Release|Any CPU.ActiveCfg = Release|Any CPU {E71E8D52-CF85-4713-9634-EB04CAE7F21A}.Release|Any CPU.Build.0 = Release|Any CPU {53FBF7A5-CF86-435A-B20C-47BD78847CF5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {53FBF7A5-CF86-435A-B20C-47BD78847CF5}.Debug|Any CPU.Build.0 = Debug|Any CPU {53FBF7A5-CF86-435A-B20C-47BD78847CF5}.Release|Any CPU.ActiveCfg = Release|Any CPU {53FBF7A5-CF86-435A-B20C-47BD78847CF5}.Release|Any CPU.Build.0 = Release|Any CPU {81BC7EDB-94CC-4497-9D3F-FE60BAC03FAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {81BC7EDB-94CC-4497-9D3F-FE60BAC03FAC}.Debug|Any CPU.Build.0 = Debug|Any CPU {81BC7EDB-94CC-4497-9D3F-FE60BAC03FAC}.Release|Any CPU.ActiveCfg = Release|Any CPU {81BC7EDB-94CC-4497-9D3F-FE60BAC03FAC}.Release|Any CPU.Build.0 = Release|Any CPU {E2926598-EE1D-4DA3-AD75-11D54F1EF318}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E2926598-EE1D-4DA3-AD75-11D54F1EF318}.Debug|Any CPU.Build.0 = Debug|Any CPU {E2926598-EE1D-4DA3-AD75-11D54F1EF318}.Release|Any CPU.ActiveCfg = Release|Any CPU {E2926598-EE1D-4DA3-AD75-11D54F1EF318}.Release|Any CPU.Build.0 = Release|Any CPU {F238F227-522D-4886-A6B5-474948B3C660}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F238F227-522D-4886-A6B5-474948B3C660}.Debug|Any CPU.Build.0 = Debug|Any CPU {F238F227-522D-4886-A6B5-474948B3C660}.Release|Any CPU.ActiveCfg = Release|Any CPU {F238F227-522D-4886-A6B5-474948B3C660}.Release|Any CPU.Build.0 = Release|Any CPU {CE88C6B8-C9B6-4695-BA23-BE8955018E26}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {CE88C6B8-C9B6-4695-BA23-BE8955018E26}.Debug|Any CPU.Build.0 = Debug|Any CPU {CE88C6B8-C9B6-4695-BA23-BE8955018E26}.Release|Any CPU.ActiveCfg = Release|Any CPU {CE88C6B8-C9B6-4695-BA23-BE8955018E26}.Release|Any CPU.Build.0 = Release|Any CPU {B9CD9B45-D3AC-433F-B316-6DB40FCCC8F1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {B9CD9B45-D3AC-433F-B316-6DB40FCCC8F1}.Debug|Any CPU.Build.0 = Debug|Any CPU {B9CD9B45-D3AC-433F-B316-6DB40FCCC8F1}.Release|Any CPU.ActiveCfg = Release|Any CPU {B9CD9B45-D3AC-433F-B316-6DB40FCCC8F1}.Release|Any CPU.Build.0 = Release|Any CPU {19AB8565-1ADA-4E64-B5C8-FD2DA7525358}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {19AB8565-1ADA-4E64-B5C8-FD2DA7525358}.Debug|Any CPU.Build.0 = Debug|Any CPU {19AB8565-1ADA-4E64-B5C8-FD2DA7525358}.Release|Any CPU.ActiveCfg = Release|Any CPU {19AB8565-1ADA-4E64-B5C8-FD2DA7525358}.Release|Any CPU.Build.0 = Release|Any CPU {F2FF3B73-B971-4C07-B9C9-9EA600C288BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F2FF3B73-B971-4C07-B9C9-9EA600C288BD}.Debug|Any CPU.Build.0 = Debug|Any CPU {F2FF3B73-B971-4C07-B9C9-9EA600C288BD}.Release|Any CPU.ActiveCfg = Release|Any CPU {F2FF3B73-B971-4C07-B9C9-9EA600C288BD}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {74374CDE-23F8-4041-8F94-D5CBC23735C6} = {25C80847-6651-4D9D-B625-24D756EC48CA} {B9CD9B45-D3AC-433F-B316-6DB40FCCC8F1} = {25C80847-6651-4D9D-B625-24D756EC48CA} {13782F8D-27BB-48EE-B176-859C11173158} = {97C6E424-BBBA-495D-8261-E5ADBABA2B29} {A629F9A5-1EA5-475F-9A49-29C81198CF34} = {97C6E424-BBBA-495D-8261-E5ADBABA2B29} {E71E8D52-CF85-4713-9634-EB04CAE7F21A} = {97C6E424-BBBA-495D-8261-E5ADBABA2B29} {F238F227-522D-4886-A6B5-474948B3C660} = {97C6E424-BBBA-495D-8261-E5ADBABA2B29} {19AB8565-1ADA-4E64-B5C8-FD2DA7525358} = {97C6E424-BBBA-495D-8261-E5ADBABA2B29} {B5ADF0C4-33EF-4836-AF94-0F4551AE26B8} = {9C0E3C0E-FFF8-4241-8942-A77093C003F1} {7E64D2D1-7ED9-490A-B658-5E2162F571D6} = {9C0E3C0E-FFF8-4241-8942-A77093C003F1} {53FBF7A5-CF86-435A-B20C-47BD78847CF5} = {9C0E3C0E-FFF8-4241-8942-A77093C003F1} {CE88C6B8-C9B6-4695-BA23-BE8955018E26} = {9C0E3C0E-FFF8-4241-8942-A77093C003F1} {F2FF3B73-B971-4C07-B9C9-9EA600C288BD} = {9C0E3C0E-FFF8-4241-8942-A77093C003F1} {81BC7EDB-94CC-4497-9D3F-FE60BAC03FAC} = {EA13AEBA-B53D-4A6C-8BA1-FB1748B87675} {E2926598-EE1D-4DA3-AD75-11D54F1EF318} = {EA13AEBA-B53D-4A6C-8BA1-FB1748B87675} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {3A482AFF-93CE-43E0-9C2A-64424A25D364} EndGlobalSection EndGlobal
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/tests/JIT/Directed/forceinlining/LargeNumberOfArgs.csproj
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <!-- Set to 'Full' if the Debug? column is marked in the spreadsheet. Leave blank otherwise. --> <DebugType>PdbOnly</DebugType> <NoStandardLib>True</NoStandardLib> <Noconfig>True</Noconfig> </PropertyGroup> <ItemGroup> <Compile Include="LargeNumberOfArgs.cs" /> </ItemGroup> </Project>
<Project Sdk="Microsoft.NET.Sdk"> <PropertyGroup> <OutputType>Exe</OutputType> <CLRTestPriority>1</CLRTestPriority> </PropertyGroup> <PropertyGroup> <!-- Set to 'Full' if the Debug? column is marked in the spreadsheet. Leave blank otherwise. --> <DebugType>PdbOnly</DebugType> <NoStandardLib>True</NoStandardLib> <Noconfig>True</Noconfig> </PropertyGroup> <ItemGroup> <Compile Include="LargeNumberOfArgs.cs" /> </ItemGroup> </Project>
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/coreclr/vm/i386/gmsasm.S
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. .intel_syntax noprefix #include "unixasmmacros.inc" #include "asmconstants.h" // int __fastcall LazyMachStateCaptureState(struct LazyMachState *pState); LEAF_ENTRY LazyMachStateCaptureState, _TEXT // marks that this is not yet valid mov dword ptr [ecx+MachState__pRetAddr], 0 // remember register values mov [ecx+MachState__edi], edi mov [ecx+MachState__esi], esi mov [ecx+MachState__ebx], ebx mov [ecx+LazyMachState_captureEbp], ebp mov [ecx+LazyMachState_captureEsp], esp // capture return address mov eax, [esp] mov dword ptr [ecx+LazyMachState_captureEip], eax // return 0 xor eax, eax ret LEAF_END LazyMachStateCaptureState, _TEXT
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. .intel_syntax noprefix #include "unixasmmacros.inc" #include "asmconstants.h" // int __fastcall LazyMachStateCaptureState(struct LazyMachState *pState); LEAF_ENTRY LazyMachStateCaptureState, _TEXT // marks that this is not yet valid mov dword ptr [ecx+MachState__pRetAddr], 0 // remember register values mov [ecx+MachState__edi], edi mov [ecx+MachState__esi], esi mov [ecx+MachState__ebx], ebx mov [ecx+LazyMachState_captureEbp], ebp mov [ecx+LazyMachState_captureEsp], esp // capture return address mov eax, [esp] mov dword ptr [ecx+LazyMachState_captureEip], eax // return 0 xor eax, eax ret LEAF_END LazyMachStateCaptureState, _TEXT
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/libraries/System.Runtime/tests/System/IO/DirectoryNotFoundExceptionTests.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.IO; using Xunit; using System.Tests; namespace System.IO.Tests { public static class DirectoryNotFoundExceptionTests { [Fact] public static void Ctor_Empty() { var exception = new DirectoryNotFoundException(); ExceptionHelpers.ValidateExceptionProperties(exception, hResult: HResults.COR_E_DIRECTORYNOTFOUND, validateMessage: false); } [Fact] public static void Ctor_String() { string message = "That page was missing from the directory."; var exception = new DirectoryNotFoundException(message); ExceptionHelpers.ValidateExceptionProperties(exception, hResult: HResults.COR_E_DIRECTORYNOTFOUND, message: message); } [Fact] public static void Ctor_String_Exception() { string message = "That page was missing from the directory."; var innerException = new Exception("Inner exception"); var exception = new DirectoryNotFoundException(message, innerException); ExceptionHelpers.ValidateExceptionProperties(exception, hResult: HResults.COR_E_DIRECTORYNOTFOUND, innerException: innerException, message: message); } } }
// 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.IO; using Xunit; using System.Tests; namespace System.IO.Tests { public static class DirectoryNotFoundExceptionTests { [Fact] public static void Ctor_Empty() { var exception = new DirectoryNotFoundException(); ExceptionHelpers.ValidateExceptionProperties(exception, hResult: HResults.COR_E_DIRECTORYNOTFOUND, validateMessage: false); } [Fact] public static void Ctor_String() { string message = "That page was missing from the directory."; var exception = new DirectoryNotFoundException(message); ExceptionHelpers.ValidateExceptionProperties(exception, hResult: HResults.COR_E_DIRECTORYNOTFOUND, message: message); } [Fact] public static void Ctor_String_Exception() { string message = "That page was missing from the directory."; var innerException = new Exception("Inner exception"); var exception = new DirectoryNotFoundException(message, innerException); ExceptionHelpers.ValidateExceptionProperties(exception, hResult: HResults.COR_E_DIRECTORYNOTFOUND, innerException: innerException, message: message); } } }
-1
dotnet/runtime
66,084
Add support for static virtual methods
Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
MichalStrehovsky
2022-03-02T14:32:50Z
2022-03-03T07:30:19Z
7b83da5eb2bb247e400d2b8f66bea79c41332db8
8dcfacbdec618924f36a95688173a7c1c101592f
Add support for static virtual methods. Took the type system changes from #54063 and cleaned them up, added unit tests. Hooked it up into JitInterface/ResolveConstraintMethodApprox. Using the pre-existing `ConstrainedMethodUseLookupResult` that wasn't currently getting emitted. We'll want to use it for its original purpose at some point, but I think we can make this work for both instance and static constrained calls. Missing things: * Support creating delegates to static virtual methods. This will need a RyuJIT/JitInterface change. * Type loader support. If `MakeGeneric` needs static virtuals at runtime, it will throw. But this is enough to get HttpClient working again. Fixes #65613. Contributes to dotnet/runtimelab#1665.
./src/mono/mono/tests/generic-type-builder.2.cs
/* This test case is taken verbatim from the corlib test suite. The * reason we need it here, too, is that the corlib tests don't run * with generic code sharing enabled for all code. Once that is * enabled by default in Mono, this test should be removed from the * runtime test suite. */ using System; using System.Threading; using System.Reflection; using System.Reflection.Emit; using System.IO; public class main { private static AssemblyBuilder assembly; private static ModuleBuilder module; static string ASSEMBLY_NAME = "MonoTests.System.Reflection.Emit.TypeBuilderTest"; protected static void SetUp () { AssemblyName assemblyName = new AssemblyName (); assemblyName.Name = ASSEMBLY_NAME; assembly = Thread.GetDomain ().DefineDynamicAssembly ( assemblyName, AssemblyBuilderAccess.RunAndSave, Path.GetTempPath ()); module = assembly.DefineDynamicModule ("module1"); } public static int GetField () { TypeBuilder tb = module.DefineType ("bla", TypeAttributes.Public); GenericTypeParameterBuilder [] typeParams = tb.DefineGenericParameters ("T"); ConstructorBuilder cb = tb.DefineDefaultConstructor (MethodAttributes.Public); FieldBuilder fb1 = tb.DefineField ("field1", typeParams [0], FieldAttributes.Public); Type t = tb.MakeGenericType (typeof (int)); // Chect that calling MakeArrayType () does not initialize the class // (bug #351172) t.MakeArrayType (); // Check that the instantiation of a type builder contains live data TypeBuilder.GetField (t, fb1); FieldBuilder fb2 = tb.DefineField ("field2", typeParams [0], FieldAttributes.Public); FieldInfo fi2 = TypeBuilder.GetField (t, fb1); MethodBuilder mb = tb.DefineMethod ("get_int", MethodAttributes.Public|MethodAttributes.Static, typeof (int), Type.EmptyTypes); ILGenerator ilgen = mb.GetILGenerator (); ilgen.Emit (OpCodes.Newobj, TypeBuilder.GetConstructor (t, cb)); ilgen.Emit (OpCodes.Dup); ilgen.Emit (OpCodes.Ldc_I4, 42); ilgen.Emit (OpCodes.Stfld, fi2); ilgen.Emit (OpCodes.Ldfld, fi2); ilgen.Emit (OpCodes.Ret); // Check GetField on a type instantiated with type parameters Type t3 = tb.MakeGenericType (typeParams [0]); FieldBuilder fb3 = tb.DefineField ("field3", typeParams [0], FieldAttributes.Public); FieldInfo fi3 = TypeBuilder.GetField (t3, fb3); MethodBuilder mb3 = tb.DefineMethod ("get_T", MethodAttributes.Public|MethodAttributes.Static, typeParams [0], Type.EmptyTypes); ILGenerator ilgen3 = mb3.GetILGenerator (); ilgen3.Emit (OpCodes.Newobj, TypeBuilder.GetConstructor (t3, cb)); ilgen3.Emit (OpCodes.Ldfld, fi3); ilgen3.Emit (OpCodes.Ret); Type created = tb.CreateType (); Type inst = created.MakeGenericType (typeof (object)); if ((int)(inst.GetMethod ("get_int").Invoke (null, null)) != 42) return 1; if (inst.GetMethod ("get_T").Invoke (null, null) != null) return 1; return 0; } public static int Main () { SetUp (); return GetField (); } }
/* This test case is taken verbatim from the corlib test suite. The * reason we need it here, too, is that the corlib tests don't run * with generic code sharing enabled for all code. Once that is * enabled by default in Mono, this test should be removed from the * runtime test suite. */ using System; using System.Threading; using System.Reflection; using System.Reflection.Emit; using System.IO; public class main { private static AssemblyBuilder assembly; private static ModuleBuilder module; static string ASSEMBLY_NAME = "MonoTests.System.Reflection.Emit.TypeBuilderTest"; protected static void SetUp () { AssemblyName assemblyName = new AssemblyName (); assemblyName.Name = ASSEMBLY_NAME; assembly = Thread.GetDomain ().DefineDynamicAssembly ( assemblyName, AssemblyBuilderAccess.RunAndSave, Path.GetTempPath ()); module = assembly.DefineDynamicModule ("module1"); } public static int GetField () { TypeBuilder tb = module.DefineType ("bla", TypeAttributes.Public); GenericTypeParameterBuilder [] typeParams = tb.DefineGenericParameters ("T"); ConstructorBuilder cb = tb.DefineDefaultConstructor (MethodAttributes.Public); FieldBuilder fb1 = tb.DefineField ("field1", typeParams [0], FieldAttributes.Public); Type t = tb.MakeGenericType (typeof (int)); // Chect that calling MakeArrayType () does not initialize the class // (bug #351172) t.MakeArrayType (); // Check that the instantiation of a type builder contains live data TypeBuilder.GetField (t, fb1); FieldBuilder fb2 = tb.DefineField ("field2", typeParams [0], FieldAttributes.Public); FieldInfo fi2 = TypeBuilder.GetField (t, fb1); MethodBuilder mb = tb.DefineMethod ("get_int", MethodAttributes.Public|MethodAttributes.Static, typeof (int), Type.EmptyTypes); ILGenerator ilgen = mb.GetILGenerator (); ilgen.Emit (OpCodes.Newobj, TypeBuilder.GetConstructor (t, cb)); ilgen.Emit (OpCodes.Dup); ilgen.Emit (OpCodes.Ldc_I4, 42); ilgen.Emit (OpCodes.Stfld, fi2); ilgen.Emit (OpCodes.Ldfld, fi2); ilgen.Emit (OpCodes.Ret); // Check GetField on a type instantiated with type parameters Type t3 = tb.MakeGenericType (typeParams [0]); FieldBuilder fb3 = tb.DefineField ("field3", typeParams [0], FieldAttributes.Public); FieldInfo fi3 = TypeBuilder.GetField (t3, fb3); MethodBuilder mb3 = tb.DefineMethod ("get_T", MethodAttributes.Public|MethodAttributes.Static, typeParams [0], Type.EmptyTypes); ILGenerator ilgen3 = mb3.GetILGenerator (); ilgen3.Emit (OpCodes.Newobj, TypeBuilder.GetConstructor (t3, cb)); ilgen3.Emit (OpCodes.Ldfld, fi3); ilgen3.Emit (OpCodes.Ret); Type created = tb.CreateType (); Type inst = created.MakeGenericType (typeof (object)); if ((int)(inst.GetMethod ("get_int").Invoke (null, null)) != 42) return 1; if (inst.GetMethod ("get_T").Invoke (null, null) != null) return 1; return 0; } public static int Main () { SetUp (); return GetField (); } }
-1