diff options
author | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2022-08-29 21:33:20 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-29 21:33:20 +0300 |
commit | 099304f300f7d5b919c542c5e4a6dbfdcbe07557 (patch) | |
tree | c5015b7ffb7c8c638e52dede501ddacd47f91f18 | |
parent | fe99c441fd6169725366d61d0ba4b8a4d4a11ecf (diff) |
[release/7.0] Use System.Numerics.IEqualityOperators.op_Equality in SpanHelper.T.cs where possible. (#74738)
* Use System.Numerics.IEqualityOperators.op_Equality in SpanHelper.T.cs.
Workaround crash hit by https://github.com/dotnet/runtime/issues/74179
making sure we avoid hitting codepath emitting this null pointer checks.
The full fix includes codegen fixes as well, but will be performed
in separate PR. There are still locations in SpanHelper.T.cs that uses
Equal virtual call on value types that could be managed pointers to
value types, but that code has remained the same for the last
4 years to 15 months and have not hit this issue in the past.
* Re-enable globalization tests disabled in #74433.
Co-authored-by: lateralusX <lateralusx.github@gmail.com>
3 files changed, 2 insertions, 5 deletions
diff --git a/src/libraries/System.Globalization/tests/CompareInfo/CompareInfoTests.IndexOf.cs b/src/libraries/System.Globalization/tests/CompareInfo/CompareInfoTests.IndexOf.cs index fa12fb9cec5..58d66e93be6 100644 --- a/src/libraries/System.Globalization/tests/CompareInfo/CompareInfoTests.IndexOf.cs +++ b/src/libraries/System.Globalization/tests/CompareInfo/CompareInfoTests.IndexOf.cs @@ -183,7 +183,6 @@ namespace System.Globalization.Tests [MemberData(nameof(IndexOf_TestData))] [MemberData(nameof(IndexOf_Aesc_Ligature_TestData))] [MemberData(nameof(IndexOf_U_WithDiaeresis_TestData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/74179", TestRuntimes.Mono)] public void IndexOf_String(CompareInfo compareInfo, string source, string value, int startIndex, int count, CompareOptions options, int expected, int expectedMatchLength) { if (value.Length == 1) diff --git a/src/libraries/System.Globalization/tests/Invariant/InvariantMode.cs b/src/libraries/System.Globalization/tests/Invariant/InvariantMode.cs index 8416d0e3f7b..361c39ec427 100644 --- a/src/libraries/System.Globalization/tests/Invariant/InvariantMode.cs +++ b/src/libraries/System.Globalization/tests/Invariant/InvariantMode.cs @@ -864,7 +864,6 @@ namespace System.Globalization.Tests [ConditionalTheory(nameof(PredefinedCulturesOnlyIsDisabled))] [MemberData(nameof(IndexOf_TestData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/74179", TestRuntimes.Mono)] public void TestIndexOf(string source, string value, int startIndex, int count, CompareOptions options, int result) { foreach (string cul in s_cultureNames) @@ -912,7 +911,6 @@ namespace System.Globalization.Tests [ConditionalTheory(nameof(PredefinedCulturesOnlyIsDisabled))] [MemberData(nameof(LastIndexOf_TestData))] - [ActiveIssue("https://github.com/dotnet/runtime/issues/74179", TestRuntimes.Mono)] public void TestLastIndexOf(string source, string value, int startIndex, int count, CompareOptions options, int result) { foreach (string cul in s_cultureNames) diff --git a/src/libraries/System.Private.CoreLib/src/System/SpanHelpers.T.cs b/src/libraries/System.Private.CoreLib/src/System/SpanHelpers.T.cs index b093cb11a29..877c2131187 100644 --- a/src/libraries/System.Private.CoreLib/src/System/SpanHelpers.T.cs +++ b/src/libraries/System.Private.CoreLib/src/System/SpanHelpers.T.cs @@ -1498,7 +1498,7 @@ namespace System { length -= 1; - if (TNegator.NegateIfNeeded(Unsafe.Add(ref searchSpace, offset).Equals(value))) return (int)offset; + if (TNegator.NegateIfNeeded(Unsafe.Add(ref searchSpace, offset) == value)) return (int)offset; offset += 1; } @@ -2145,7 +2145,7 @@ namespace System { length -= 1; - if (TNegator.NegateIfNeeded(Unsafe.Add(ref searchSpace, offset).Equals(value))) return (int)offset; + if (TNegator.NegateIfNeeded(Unsafe.Add(ref searchSpace, offset) == value)) return (int)offset; offset -= 1; } |