platform/upstream/dotnet/runtime.git
2 years agoSupport a few "shifted register" operations on Arm64 (#75823)
Tanner Gooding [Tue, 27 Sep 2022 20:30:06 +0000 (13:30 -0700)]
Support a few "shifted register" operations on Arm64 (#75823)

* Refactor Lowering::IsContainableBinaryOp so node checks are simpler

* Update Lowering::ContainCheckBinary to check both operands for a commutative oper

* Updating Lowering::IsContainableBinaryOp to support some shifted register instructions

* Resolving some build failures/asserts

* Ensure IsContainableBinaryOp checks IsSafeToContainMem

* Use parentNode not node

* Ensure shifted register instructions that set flags use the right instruction

* Ensure the shift amount is checked for smaller nodes

* Apply suggestions from code review

* Apply suggestions from code review

Co-authored-by: SingleAccretion <62474226+SingleAccretion@users.noreply.github.com>
Co-authored-by: SingleAccretion <62474226+SingleAccretion@users.noreply.github.com>
2 years agoAdd more information to host writer errors
Elinor Fung [Tue, 27 Sep 2022 20:14:24 +0000 (16:14 -0400)]
Add more information to host writer errors

2 years ago[LoongArch64] Fix the assert error for `genSetRegToIcon()` (#76164)
Qiao Pengcheng [Tue, 27 Sep 2022 18:39:02 +0000 (02:39 +0800)]
[LoongArch64] Fix the assert error for `genSetRegToIcon()` (#76164)

* [LoongArch64] Fix the assert error for `genSetRegToIcon()`

* delete the `genSetRegToIcon()` for LA64.

2 years agoEnsure CreateScalarUnsafe gets constant handling on Arm64 (#76204)
Tanner Gooding [Tue, 27 Sep 2022 18:31:13 +0000 (11:31 -0700)]
Ensure CreateScalarUnsafe gets constant handling on Arm64 (#76204)

* Ensure CreateScalarUnsafe gets constant handling on Arm64

* Clear constant reg during upper vector save

* Apply formatting patch

Co-authored-by: Kunal Pathak <Kunal.Pathak@microsoft.com>
2 years agoDisabling disasm checks under certain testing environments (#76202)
Will Smith [Tue, 27 Sep 2022 16:04:11 +0000 (09:04 -0700)]
Disabling disasm checks under certain testing environments (#76202)

* Disabling disasm checks under certain testing environments

* Add extra linux musl check

* Add JitDisasm check back

* Remove JitDisasm check

* Re-enable musl

* Do not run disasm checks under stress modes

* Feedback, force a failure

* Trying to fix targets

* Trying to fix targets

* Update Runtime_34937.cs

2 years agoImprove vectorization of Enumerable.Min/Max (#76144)
Stephen Toub [Tue, 27 Sep 2022 16:02:23 +0000 (12:02 -0400)]
Improve vectorization of Enumerable.Min/Max (#76144)

- Expand it to all supported types with `Enumerable.Min<T>`/`Max<T>`
- Combine Min/Max into a single method using a static abstract interface with generic specialization to differentiate
- Use `Vector128<T>` and `Vector256<T>` instead of `Vector<T>`
- Improve test coverage

2 years ago[mono][aot] Prefer specific instances instead of gshared for methods containing stati...
Zoltan Varga [Tue, 27 Sep 2022 15:44:40 +0000 (11:44 -0400)]
[mono][aot] Prefer specific instances instead of gshared for methods containing static virtual calls. (#76033)

These calls cannot be resolved at compile time in gshared methods, so they cannot be inlined etc.
They are used in perf sensitive BCL code like SpanHelpers. To fix this, modify the AOT compiler
so in addition to the gshared versions, it emits specific instances of these methods if possible.
This only affects a small subset of gshared methods so it doesn't lead to a noticable code size increase.

Fixes https://github.com/dotnet/runtime/issues/75801.

2 years agoFix incorrect string length calculation (#76127)
Sparin [Tue, 27 Sep 2022 15:33:33 +0000 (18:33 +0300)]
Fix incorrect string length calculation (#76127)

ANSI string depends on system encoding charset. Unix's implementation of Marshal.StringToHGlobalAnsi encodes in UTF8. UTF8 characters which are out of 8-bit range (otcet) encodes in multiple bytes (otcets). ASCII characters usually are in 0x00-0x7F range but cyrillic and other characters are not. For example, 'Зфыы123;' (eq. 'Pass123$') will be encoded in 12 bytes instead of 8

Fix #76125

2 years agoImprove IPAddress to/from bytes perf (#75872)
Stephen Toub [Tue, 27 Sep 2022 15:22:32 +0000 (11:22 -0400)]
Improve IPAddress to/from bytes perf (#75872)

* Improve IPAddress to/from bytes perf

Also cleaned up some unnecessary `!`s with `MemberNotNullWhen`.

* Address PR feedback to use shifts instead of shuffle

And also simplify fallback.

* Avoid non-portable cast for big endian

2 years agoJIT: refactor and enhance the redundant branch optimizer (#76207)
Andy Ayers [Tue, 27 Sep 2022 15:17:03 +0000 (08:17 -0700)]
JIT: refactor and enhance the redundant branch optimizer (#76207)

One more preparatory step before introducing the new phi-based
disambiguation.

* handle some cases of ambiguous preds better
* split out the jump threading pre checks into a helper
* properly support updating switch preds
* generalize retry logic a bit to handle more cases

2 years agoExtend RuntimeHelpers.IsBitwiseEquatable to more types (#75640)
Stephen Toub [Tue, 27 Sep 2022 15:15:32 +0000 (11:15 -0400)]
Extend RuntimeHelpers.IsBitwiseEquatable to more types (#75640)

* Extend RuntimeHelpers.IsBitwiseEquatable to more types

Today, RuntimeHelpers.IsBitwiseEquatable is hardcoded to a fixed list of types.  This means that almost all of the vectorization we've done with arrays and spans is limited to just those types; developers can themselves use MemoryMarshal.Cast to convert spans of other types to spans of supported one, but it doesn't naturally happen.

This extends IsBitwiseEquatable a bit more. We already have a CanCompareBitsOrUseFastGetHashCode helper used by ValueType.Equals to determine whether structs that don't override Equals can be compared with the equivalent of memcmp.  This extends that same helper to be used by IsBitwiseEquatable.  However, IsBitwiseEquatable also needs to rule out types that implement `IEquatable<T>` (the existing helper doesn't because it's about the implementation of the object.Equals override where the interface doesn't come into play).

The upside of this is APIs like Array.IndexOf will now automatically vectorize with more types.  The main downside is that types which provide their own equality implementation still don't benefit, which in turn means adding an `IEquality<T>` implementation could in the future be a deoptimization (we should consider some kind of attribute or marker interface a type can use to say "I promise my equality implementation is the same as a bitwise comparison").  We also currently constrain most of our MemoryExtensions methods to types that implement `IEquatable<T>`, so there are only a handful of public methods today that benefit from this.

* Fix contract on CanCompareBitsOrUseFastGetHashCode

* Add more SequenceEqual tests

* Remove duplicative check

* Add IsBitwiseEquatable extension to ilc

* Address PR feedback

* Update src/coreclr/tools/Common/TypeSystem/IL/Stubs/ComparerIntrinsics.cs

2 years agoFix LoggerMessageGenerator parser to check for expression bodied method (#75601)
Wei Chen [Tue, 27 Sep 2022 13:53:10 +0000 (02:53 +1300)]
Fix LoggerMessageGenerator parser to check for expression bodied method (#75601)

* Check for expression bodied method

Fixed LoggerMessageGenerator parser to check for expression bodied
method and generate a proper diagnostic message.

Fix #66080

* Fix expression body in test

Fixed invalid expression body in test

2 years agoRevert "Allocate RuntimeType objects on Frozen Object Heap (#76235)
Jan Kotas [Tue, 27 Sep 2022 13:45:01 +0000 (06:45 -0700)]
Revert "Allocate RuntimeType objects on Frozen Object Heap (#76235)

* Revert "Allocate RuntimeType objects on Frozen Object Heap (#75573)"

This reverts commit 1f1231c36a9b247aaf0111496d3c0a3b3611ef15.

* Revert "don't use write barriers for frozen objects (#76135)"

This reverts commit 315bdd4c138491df154e84b98ba7fae72ca8b83b.

2 years agoUse generated runtime.json when building shared framework packages. (#76068)
Tom Deseyn [Tue, 27 Sep 2022 11:22:50 +0000 (13:22 +0200)]
Use generated runtime.json when building shared framework packages. (#76068)

* Use generated runtime.json when building shared framework packages.

* Don't UpdateRuntimeJson on Build.

* PR feedback.

* Update Microsoft.NETCore.Platforms.csproj

Co-authored-by: Viktor Hofer <viktor.hofer@microsoft.com>
2 years agoNullable annotations for System.Security.Cryptography.Xml (#67198)
Steve Dunn [Tue, 27 Sep 2022 09:53:04 +0000 (10:53 +0100)]
Nullable annotations for System.Security.Cryptography.Xml (#67198)

* First pass

* More annotations

* Rever mistaken change to test

* More annotations

* More annotations

* More annotations

* More annotations

* More annotations

* More annotations

* More annotations

* More annotations

* More annotations

* More annotations

* More annotations

* More annotations

* Remove red flag comment

* PR feedback

* Remove 'red flag' comments

* Revert unintended changes to tests

* Revert unintended changes

* PR feedback: remove redundant !'s from things that can never return null

* Added  `[MemberNotNullWhen(true, nameof(_cachedXml))]` on implementation.

* Updated ref t ypes (with `dotnet msbuild /t:GenerateReferenceAssemblySource`)

* Updated ref assembly

* PR feedback: add `MemberNotNull` attribute on `Initialize`)

* Updated ref again

* Put `MemberNotNull` attribute on the getter rather than the property in the reference file.

* PR feedback: remove MemberNotNullWhenAttribute from ref

* PR feedback: non nullable param to match method in base class

* Fix post-merge build errors

* PR feedback

* PR feedback from @bartonjs - add [DisallowNull] and cascade

* PR feedback

* PR feedback

* PR feedback

* Fix build again, by removing the `protected internal` property `CacheValid`

* PR feedback

* Added back `CacheValid` based on PR comment

* Fix issues from recent rebase

* Add `DisallowNull` attribute to ref file and remove it from `DefaultGenApiDocIds.txt`

* PR feedback

* Fix issues from recent merge

* Remove some more extraneous damnit operators

* Fix NRT analysis errors after prior rebase

* PR feedback

* PR feedback

* PR feedback

* PR feedback

* PR feedback

* CipherReference and CipherValue made to disallow null

* Make Uri non-nullable on EnctrypedReference

* Add AllowNull attribute on EncryptedType::KeyInfo

* AllowNull on EncryptedXml::Recipient

* Made baseUri nullable

* DisallowNull on PropertlyElement

* AllowNull on SignedInfo::CanonicalizationMethod

* AllowNull on SignedXml::EncryptedXml

* Fix build after recent rebase

* Remove redundant damnit operator now that https://github.com/dotnet/runtime/pull/71860 has been merged

* PR feedback

* Fix build due to change of the CanonicalXmlElement constructor

* PR feedback

* Remove redundant damnit operators

* Fix broken tests

* Fix issues after rebase

* PR feedback

* PR feedback

2 years ago74642 change isostorage path (#75541)
Meri Khamoyan [Tue, 27 Sep 2022 07:01:57 +0000 (11:01 +0400)]
74642 change isostorage path (#75541)

* #74642 changed isolated storage path for mobile platforms

2 years ago[mono] Add Vector128 AndNot intrinsic for amd64 (#74586)
Matous Kozak [Tue, 27 Sep 2022 06:51:37 +0000 (08:51 +0200)]
[mono] Add Vector128 AndNot intrinsic for amd64 (#74586)

* Vector128 AndNot

* swap operands for Vector128, block AndNot for integer types

* fix AndNot intermediate type for Vector64

* move AndNot to XBINOP from SSE

* AndNot intrinsics move check outside ifdef

* defined macro

* use different tmp variable

* Re-use OP_SSE_ANDN code

* remove space

* missing {} in SN_AndNot case

2 years agoFix spilling of `MUL_LONG` on x86 and multi-reg HWIs (#73079)
SingleAccretion [Tue, 27 Sep 2022 06:29:58 +0000 (09:29 +0300)]
Fix spilling of `MUL_LONG` on x86 and multi-reg HWIs (#73079)

* Spilling fixes

* Unspilling fixes

* Fix multi-reg HWIs

2 years ago[main] Update dependencies from dotnet/xharness dotnet/runtime-assets dotnet/runtime...
dotnet-maestro[bot] [Tue, 27 Sep 2022 03:32:36 +0000 (03:32 +0000)]
[main] Update dependencies from dotnet/xharness dotnet/runtime-assets dotnet/runtime dotnet/emsdk (#76120)

[main] Update dependencies from dotnet/xharness dotnet/runtime-assets dotnet/runtime dotnet/emsdk

2 years agoFix bugs found from static analyzer (#76160)
Hyungju Lee [Tue, 27 Sep 2022 00:44:07 +0000 (09:44 +0900)]
Fix bugs found from static analyzer (#76160)

* Fix bugs found from static analyzer

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
2 years agoFix some incorrect SpecialFolder entries for Unix (#68610)
Miepee [Mon, 26 Sep 2022 22:49:59 +0000 (00:49 +0200)]
Fix some incorrect SpecialFolder entries for Unix (#68610)

* Fix incorrect SpecialFolder entries for Unix

This fixes an incorrect Documents/Personal for Linux+Mac entry,
incorrect Videos Mac entry,
and an incorrect (Local) ApplicationData Mac entry.

Fix #63214

* Don't make Unix tests assume Personal is Home

* Use the same value for Mac's (Local)ApplicationData

* Use NSPaths for OSX Special Folder

The Apple documentation recommends to use these instead of hardcoding the paths, so the paths that had NSPath equivalents have been replaced.

* Change System.Native CMakeLists to include OSX for SearchPath

`a17e73466ca639388a3d89f4d6be0ab9703802fc` made OSX call the native NSearchPath functions, however a stub was initially called. This fixes it to call the native functions.

2 years ago[mono][debugger] fix exception while decoding value that has a byref field (#75774)
Thays Grazia [Mon, 26 Sep 2022 19:45:50 +0000 (16:45 -0300)]
[mono][debugger] fix exception while decoding value that has a byref field (#75774)

* fix exception while decoding value that has a byref field

* Apply suggestions from code review

Co-authored-by: Larry Ewing <lewing@microsoft.com>
Co-authored-by: Larry Ewing <lewing@microsoft.com>
2 years agoFix assertion in corhlpr (#76189)
Kevin Gosse [Mon, 26 Sep 2022 19:03:04 +0000 (21:03 +0200)]
Fix assertion in corhlpr (#76189)

2 years agoDisallow TimeSpan.Zero in rate limiters (#75496)
Brennan [Mon, 26 Sep 2022 17:22:27 +0000 (10:22 -0700)]
Disallow TimeSpan.Zero in rate limiters (#75496)

2 years agoResolve missing triple-slash in Microsoft.Extensions.Primitives (#76098)
Nick Stanton [Mon, 26 Sep 2022 17:06:53 +0000 (10:06 -0700)]
Resolve missing triple-slash in Microsoft.Extensions.Primitives (#76098)

* Add triple slash in missing areas

* Apply suggestions from code review

Co-authored-by: Carlos Sanchez <1175054+carlossanlop@users.noreply.github.com>
* Rewrite StringSegmentCompare GetHashCode() summary

* implement GetHashCode() feedback

* change instances to objects

Co-authored-by: Carlos Sanchez <1175054+carlossanlop@users.noreply.github.com>
2 years agoRemove hardcoded limit in deserialization constructor arguments (#75982)
Eirik Tsarpalis [Mon, 26 Sep 2022 16:08:25 +0000 (19:08 +0300)]
Remove hardcoded limit in deserialization constructor arguments (#75982)

* Remove hardcoded limit in deserialization constructor arguments.

* Use correct opcode for indices >= 128

* Remove unneeeded changes

* Add reflection fallback in interpreted runtimes

* Revert "Add reflection fallback in interpreted runtimes"

This reverts commit e78ea20c532860d21bd0540a97ebfd1cf02370e3.

* disable test in interpreted mono

* Revert "disable test in interpreted mono"

This reverts commit 53f7a913b710471eadad18f50e962f0f967e07aa.

2 years ago[mono] Add Vector128 ConditionalSelect intrinsics for Amd64 (#75838)
Matous Kozak [Mon, 26 Sep 2022 15:22:07 +0000 (17:22 +0200)]
[mono] Add Vector128 ConditionalSelect intrinsics for Amd64 (#75838)

* Conditional Select for amd64, refactor arm64 code

* Add missing newline in mini-ops.h file

2 years agoFold SIMD-typed partial access to locals; delete base types from vector constants...
SingleAccretion [Mon, 26 Sep 2022 14:40:17 +0000 (17:40 +0300)]
Fold SIMD-typed partial access to locals; delete base types from vector constants (#74580)

* Fold local SIMD-typed indirs

* Introduce "canonical" SIMD handles

To be used for nodes which don't have a handle of their own.

* Remove base types from GenTreeVecCon

2 years agoDo it like in `OperatingSystem`. (#76172)
Ilona Tomkowicz [Mon, 26 Sep 2022 13:46:11 +0000 (15:46 +0200)]
Do it like in `OperatingSystem`. (#76172)

2 years agodon't use write barriers for frozen objects (#76135)
Egor Bogatov [Mon, 26 Sep 2022 12:57:03 +0000 (14:57 +0200)]
don't use write barriers for frozen objects (#76135)

2 years agoRemove most of string.Trim() usages in System.Private.Xml solution. (#75452)
Trayan Zapryanov [Mon, 26 Sep 2022 12:23:54 +0000 (15:23 +0300)]
Remove most of string.Trim() usages in System.Private.Xml solution. (#75452)

* Remove most of string.Trim() usages in Xml solution.

* Address feedback

* Add checks if input string is null

Co-authored-by: Traian Zaprianov <Traian.Zaprianov@docuware.com>
2 years agoperf-pipeline: Remove unnecessary jobs (#76111)
Ankit Jain [Mon, 26 Sep 2022 08:26:31 +0000 (04:26 -0400)]
perf-pipeline: Remove unnecessary jobs (#76111)

* perf-pipeline: Set default value for ExtraSetupArguments

Fixes `line 1: ExtraSetupArguments: command not found` when running
performance/scripts/ci_setup.py .

* perf pipeline: Disable unncessary scheduled builds

`dotnet-runtime-perf` runs:
1. batched builds
2. scheduled builds at 2:30am every night

For the 'scheduled' case, only wasm/jsc perf jobs are run.
And the rest are build jobs - wasm, mono, coreclr, and libraries.

The wasm/jsc runs are known to be broken right now, thus they can be
disabled. And since there are no other perf jobs, none of the remaining
builds are needed, thus the whole scheduled run can be disabled.

* perf-pipeline: Collect logs file from perf runs on dotnet-runtime-perf also

2 years ago[NativeAOT] Remove WeakReference.m_trackResurrection field (#76115)
Vladimir Sadov [Mon, 26 Sep 2022 06:11:26 +0000 (23:11 -0700)]
[NativeAOT] Remove WeakReference.m_trackResurrection field (#76115)

* remove m_trackResurrection field

* switch to GCHandle.Internal  for portability

* remove ENABLE_WINRT dead code

* move IsTrackResurrection

* TracksResurrectionBit

* native part

* move some parts of implementation to common

* tweak a comment

* tweak a comment

* use libraries naming conventions for _handleAndKind

* Apply suggestions from code review

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
* Remove Mono and NativeAOT implementations. Move the handle field to the top of the class per coding conventions

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
2 years agoEnable System.IO.FileSystem tests for native aot (#76146)
Jan Kotas [Mon, 26 Sep 2022 02:03:14 +0000 (19:03 -0700)]
Enable System.IO.FileSystem tests for native aot (#76146)

2 years agoRemove redundant tmp check (#76154)
Rose [Sun, 25 Sep 2022 21:58:38 +0000 (17:58 -0400)]
Remove redundant tmp check (#76154)

The function has an early return if tmp is ever null, so there is no need to have this check here.

2 years agoImprove List<T>.AddRange performance for enumerables (#76043)
Stephen Toub [Sun, 25 Sep 2022 21:00:36 +0000 (17:00 -0400)]
Improve List<T>.AddRange performance for enumerables (#76043)

AddRange is currently implemented as delegating to InsertRange, and InsertRange in turn has a more complicated inner loop as part of adding each item from a source enumerable into the list.  By just copying InsertRange's source into AddRange, deleting all the irrelevant stuff, and changing the Insert call to Add, throughput improves measurably.

2 years agoUpdate il range in optOptimizeBoolsUpdateTrees (#74657)
Igor Bagdamyan [Sun, 25 Sep 2022 17:06:47 +0000 (20:06 +0300)]
Update il range in optOptimizeBoolsUpdateTrees (#74657)

2 years agoDisable frequently failing CriticalFinalizer test (#76131)
Jan Kotas [Sun, 25 Sep 2022 01:34:22 +0000 (18:34 -0700)]
Disable frequently failing CriticalFinalizer test (#76131)

* Disable frequently failing CriticalFinalizer test

Contributes to #76041

* Delete coreclr specific exclusion, the test is failing everywhere

2 years agoJIT: refactor jump threading a bit (#76108)
Andy Ayers [Sun, 25 Sep 2022 00:23:29 +0000 (17:23 -0700)]
JIT: refactor jump threading a bit (#76108)

In anticipation that phi disambiguation will end up reusing the core
part of this transformation.

2 years agoDisable failing test SignedXmlTest.VerifyXmlResolver (#76129)
Karel Zikmund [Sat, 24 Sep 2022 20:58:25 +0000 (22:58 +0200)]
Disable failing test SignedXmlTest.VerifyXmlResolver (#76129)

PR #75369 tried to fix the problem and re-enabled the test, but it is still failing.
Tracked by #74115

2 years agoDelete typeof caches from CoreLib (#76126)
Jan Kotas [Sat, 24 Sep 2022 17:44:16 +0000 (10:44 -0700)]
Delete typeof caches from CoreLib (#76126)

Caching typeof is a de-optimization with frozen runtime types

2 years agoClean up of SPC to match ref assembly public surface for Mono and CoreCLR (#75954)
Marek Safar [Sat, 24 Sep 2022 17:37:02 +0000 (19:37 +0200)]
Clean up of SPC to match ref assembly public surface for Mono and CoreCLR (#75954)

* Clean up of SPC to match ref assembly public surface for Mono and CoreCLR

Contributes to #72594

* Remove TypeDependencyAttribute

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
2 years agoImplement IEEE754 totalOrder comparer (#75517)
Huo Yaoyuan [Sat, 24 Sep 2022 16:28:17 +0000 (00:28 +0800)]
Implement IEEE754 totalOrder comparer (#75517)

* Basic implementation of total order

* Add public api reference

* Add basic tests

* Apply suggestions from code review

Co-authored-by: Tanner Gooding <tagoo@outlook.com>
* Update xmldoc

* Update comparison logic to save calls

* Handle order of NaN

* Implement integer comparison semantic

* Change NaN semantic in fallback comparison

* Adjust test data

* Change to struct

* Fix ApiCompat

* Manually apply suggestion from review

* Defensive for custom float-point

* Nit

* Fix comments

* Implement Equals and GetHashCode

Co-authored-by: Tanner Gooding <tagoo@outlook.com>
2 years agoFix native aot test failures (#76114)
Jan Kotas [Sat, 24 Sep 2022 13:05:07 +0000 (06:05 -0700)]
Fix native aot test failures (#76114)

* Fix native aot test failures

* Fix test failure on NativeAOT with non-English locale

* Delete duplicate and dead files

Fixes #75699

Co-authored-by: Filip Navara <filip.navara@gmail.com>
2 years agoSPMI: Add and utilize number of contexts with diffs (#76011)
Jakob Botsch Nielsen [Sat, 24 Sep 2022 07:43:48 +0000 (09:43 +0200)]
SPMI: Add and utilize number of contexts with diffs  (#76011)

Previously, if there was any diff in a collection, that collection would
be shown in all tables (i.e. Overall, FullOpts, MinOpts). The main
reason was that we only had "has diffs" information on a per-collection
basis, not for each of the categories. This changes SPMI to communicate
back for each category how many contexts had diffs in them, and uses
this to hide tables/rows without any diffs, and to show this information
under details.

2 years agoAdd back missing conv opcodes when compiling via System.Linq.Expressions (#76024)
Vlad Brezae [Sat, 24 Sep 2022 06:23:23 +0000 (09:23 +0300)]
Add back missing conv opcodes when compiling via System.Linq.Expressions (#76024)

* Add new convert tests

With expression funcs that return int32 instead of short/byte to prevent implicit conversions.

* Add back missing conv opcodes when compiling via System.Linq.Expressions

The conversion opcodes are still necessary when the sign of the value might change, in which case the conversion opcode will do a sign/zero extend to the full i32 storage used by the IL execution stack.

For example, before this change, conversions from ushort to short were ignored. Consider expressions converting the value `ushort.MaxValue` to short (testcase ConvertUShortToShortTest). `ushort.MaxValue` will be pushed to execution stack as a i32 ldc of value 0xffff. The conv.i2 opcode would change the value on the stack to 0xffffffff so it shouldn't be omitted.

2 years agoFix impIntrinsic to not raise asserts for the AltJit scenario (#76048)
Tanner Gooding [Sat, 24 Sep 2022 02:54:54 +0000 (19:54 -0700)]
Fix impIntrinsic to not raise asserts for the AltJit scenario (#76048)

* Fix impIntrinsic to not raise asserts for the AltJit scenario

* Respond to PR feedback

* Specially handle NI_Vector64/128/256_* intrinsics where not all overloads are valid

* Change the AltJit intrinsic handling so we get no asserts

* Apply suggestions from code review

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
* Apply suggestions from code review

* Fixing a build error

* Applying formatting patch

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
2 years ago[wasm][debugger] Support create, debugging and running wasmbrowser template from...
Thays Grazia [Fri, 23 Sep 2022 23:43:24 +0000 (20:43 -0300)]
[wasm][debugger] Support create, debugging and running wasmbrowser template from VS (#75986)

* Support create, debugging and running wasmbrowser template from VS

* addings extra line in the end of the file

* remove extra spaces

* fix compilation error

* adding extra line in the end of the file

* Addressing @lewing comment.

2 years ago[tests] Skip XslCompiledTransformApi tests on iOS, tvOS, and when testing native...
Mitchell Hwang [Fri, 23 Sep 2022 23:04:21 +0000 (19:04 -0400)]
[tests] Skip XslCompiledTransformApi tests on iOS, tvOS, and when testing native AOT (#75730)

* Skip XslCompiledTransformApi tests on iOS, tvOS, and when testing native AOT

* Condition each XslCompiledTransformApi test class on IsReflectionEmitSupported

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
2 years ago[JIT] CodeGen verification testing (#75102)
Will Smith [Fri, 23 Sep 2022 22:31:05 +0000 (15:31 -0700)]
[JIT] CodeGen verification testing (#75102)

* Add test

* Add CHECKs

* Build scripts and test settings

* COMPlus -> DOTNET

* Fix filenames

* Missing >

* Missing quotes

* use %scriptPath%

* Rework properties, start two examples

* Arch demo

* Cleanup

* Remove tab

* Easier environment variables.  Undo precommand changes.

* undo blank line

* clean CHECKs

* Draft of bash

* Bash, conditionals

* More variables, start on run.cmd/sh/py

* another output

* Support in cmd/bash for RunningDisasmChecks

* copy, factor, formatting

* Initial work to include FileCheck. Added SuperFileCheck.

* Able to build SuperFileCheck

* Do not DisasmCheck TypeEquality_r for now. Update some FileChecks to follow SuperFileCheck rules.

* Partially wiring up SuperFileCheck to tests

* Piping list of method names from SuperFileCheck to JitDisasm

* Handling bash a little bit

* Moving SuperFileCheck to tests/Common

* Few tweaks

* Building SuperFileCheck as part of the test build

* Tweaking a few things

* Fixed a bug

* Moving SuperFileCheck back to src\coreclr\tools. Removed checks from TypeEquality_r.

* Restore original logic in Runtime_73681

* Trying to add CI leg for disasmchecks

* Use x64 package if x86 platform detected for JIT tools package

* Remove innerloop for disasmchecks

* Trying to fix build. Only run in Windows for now.

* Update Runtime_73681.cs

Trying to fail test

* Trying to fix build

* Update Runtime_73681.cs

* Update Runtime_73681.cs

* Fixing a few issues

* Trying to run disasmchecks as part of CI

* Trying to run disasmchecks

* Trying to run disasmchecks

* Trying to run disasmchecks

* Revert a change

* Trying to run disasmchecks

* Trying to run disasmchecks

* build SuperFileCheck on non-windows

* few tweaks

* Trying to fix CI

* Including SuperFileCheck for tests

* Cleanup

* More cleanup

* Cleanup

* Changed SuperFileCheck to not publish everything. Changed SuperFileCheck's lookup for FileCheck.

* Invoking SuperFileCheck using dotnet

* Making the test pass

* Only run disasm checks for coreclr and not mono

* Using HasBatchDisasmCheck and HasBashDisasmCheck to determine to run the check

* Enabling filecheck on linux and osx

* Added more comments

* Added ARM64 specific test. Do not run SuperFileCheck if no methods were found.

* Added documentation. Changed disasm-output.

* Minor doc tweak

* Minor doc tweak

* Minor doc tweak

* Minor doc tweak

* Minor doc tweak

* Cleanup. Trying to fix linux

* Fixing test

* Add information on additional functionality

* cleanup

* Add FileCheck snippet

* Undo environment variable changes

* Feedback from Mark

* Cleanup

* Trying to fix linux test run

* Trying to fix linux test run

* A few missing changes from the original branch

* Enable OSX for disasm checks

* cleanup / comment

* Force test failure

* Update Runtime_73681.cs

* Set env vars after errorlevel check

* Reverting back on setting environment variables in test. Added new FileCheck test for mod optimization

* Force a failure by changing the register

* Ignore native binaries for superpmi collect

* Update Runtime_34937.cs

* Force the correct failure

* Update Runtime_34937.cs

* Update Runtime_34937.cs

* Adding specific OS check prefixes. Changed dump-input context amount

* Added getting fully qualified method names with wildcards for SuperFileCheck

* More tests. Fixed a few issues with generics.

* Disabling generic support

* Error if it cannot find enclosing type declaration

* Fixing build

* Remove namespac

* Bring generics back, but in a limited form

Co-authored-by: Mark Plesko <markples@microsoft.com>
2 years ago[main] Update dependencies from dotnet/roslyn-analyzers dotnet/hotreload-utils (...
dotnet-maestro[bot] [Fri, 23 Sep 2022 22:05:14 +0000 (15:05 -0700)]
[main] Update dependencies from dotnet/roslyn-analyzers dotnet/hotreload-utils (#75965)

* Update dependencies from https://github.com/dotnet/hotreload-utils build 20220920.1

Microsoft.DotNet.HotReload.Utils.Generator.BuildTool
 From Version 1.1.0-alpha.0.22469.1 -> To Version 1.1.0-alpha.0.22470.1

* Update dependencies from https://github.com/dotnet/roslyn-analyzers build 20220921.2

Microsoft.CodeAnalysis.NetAnalyzers
 From Version 7.0.0-preview1.22466.1 -> To Version 7.0.0-preview1.22471.2

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
2 years ago[mono][interp] Remove random interp limit (#76092)
Vlad Brezae [Fri, 23 Sep 2022 21:04:05 +0000 (00:04 +0300)]
[mono][interp] Remove random interp limit (#76092)

Existing since its prototype

2 years agoCI: trigger library tests builds, when building runtime tests (#76057)
Ankit Jain [Fri, 23 Sep 2022 20:14:08 +0000 (16:14 -0400)]
CI: trigger library tests builds, when building runtime tests (#76057)

* CI: trigger library tests builds, when building runtime tests

.. as they depend on it.

* Mono product build jobs only build the runtime, so don't trigger on library changes

* CI: Exclude some eng/pipelines files from triggering pipelines

```yml
    # src/workloads is only used in runtime-official builds
    # where evaluate-paths is not used
    _always_exclude: [
        eng/pipelines/common/evaluate-default-paths.yml
        eng/pipelines/coreclr/*
        eng/pipelines/installer/*
        eng/pipelines/libraries/*
        eng/pipelines/mono/*
        eng/pipelines/runtime*
        src/workloads/*
    ]
```

* wip

* Revert "wip"

This reverts commit 0b08b8d170fbd9168f9bff3470a54f6f40daa783.

2 years ago[workloads] Work around main still targeting net7.0 (#76036)
Larry Ewing [Fri, 23 Sep 2022 20:10:05 +0000 (15:10 -0500)]
[workloads] Work around main still targeting net7.0 (#76036)

* Work around main still targeting net7.0

2 years agoDisabling finalizer tests pending investigation. (#76089)
Vladimir Sadov [Fri, 23 Sep 2022 20:05:04 +0000 (13:05 -0700)]
Disabling finalizer tests pending investigation. (#76089)

2 years agoAdapt System.CommandLine (v2) in more places (#72082)
Adeel Mujahid [Fri, 23 Sep 2022 18:26:22 +0000 (21:26 +0300)]
Adapt System.CommandLine (v2) in more places (#72082)

* Switch ilc to use System.CommandLine

* Switch cg2 to use System.CommandLine

* Fix release build

* Fix test build

* ilc: --insructionset, crossgen2: --instruction-set 🥲

* Fix a couple of defaults

* Fix repro package arguments for cg2

* ilc: rename --instructionset to --instruction-set

* Remove 'Microsoft (R)' from tools' banner

* Merge conflict typo fix

* Add -v alias for version (to match old behavior)

2 years agoDo not maintain GTF_VAR_MULTIREG before lowering (#75449)
SingleAccretion [Fri, 23 Sep 2022 17:59:06 +0000 (20:59 +0300)]
Do not maintain GTF_VAR_MULTIREG before lowering (#75449)

There is no need for this.

2 years agoDo not remove certain casts with contained operands (#74602)
SingleAccretion [Fri, 23 Sep 2022 16:59:37 +0000 (19:59 +0300)]
Do not remove certain casts with contained operands (#74602)

On ARM64, we turn the "EQ(CAST<byte>(x), 0)" into "TEST_EQ(x, 0xFF)",
to avoid materializing the cast.

However, this breaks recognition of the "cb[n]z" idiom. If "x" ends
up in a register, that's ok - we're essentially exchanging relop for a
cast. If, however, it was contained, it is better to leave it alone:

```
-            ldr     w0, [fp,#0x18]
-            tst     w0, #255
-            bne     G_M25131_IG10
-                                               ;; size=12 bbWeight=1    PerfScore 3.50
+            ldrb    w0, [fp,#0x18]
+            cbnz    w0, G_M25131_IG10
+                                               ;; size=8 bbWeight=1    PerfScore 3.00
```

2 years agoJIT: Use gtCloneExpr in fgMorphModToSubMulDiv for potentially complex trees (#76061)
Jakob Botsch Nielsen [Fri, 23 Sep 2022 16:39:52 +0000 (18:39 +0200)]
JIT: Use gtCloneExpr in fgMorphModToSubMulDiv for potentially complex trees (#76061)

We may get here for any invariant dividend/divisor but these can be
'complex' address-of trees that gtClone does not handle.

Fix #76051

2 years agoDisallow `ASG(..., IND<struct>)` before morph (#74715)
SingleAccretion [Fri, 23 Sep 2022 16:35:37 +0000 (19:35 +0300)]
Disallow `ASG(..., IND<struct>)` before morph (#74715)

* Delete IND<struct> handling from local morph

* Fix raw handle intrinsics

2 years agoJIT: Update gtHasLocalsWithAddrOp to use GenTreeVisitor (#75672)
Jakob Botsch Nielsen [Fri, 23 Sep 2022 16:32:58 +0000 (18:32 +0200)]
JIT: Update gtHasLocalsWithAddrOp to use GenTreeVisitor (#75672)

Also change it to check for any local, not just GT_LCL_VAR.

2 years agoJIT: properly update trees in optOptimizeBoolsGcStress (#75992)
Andy Ayers [Fri, 23 Sep 2022 16:01:49 +0000 (09:01 -0700)]
JIT: properly update trees in optOptimizeBoolsGcStress (#75992)

Under jit stress, `optOptimizeBoolsGcStress` will modify trees. Since this
now happens in a phase that runs after `fgSetBlockOrder`, it must also
rethread the trees.

2 years agoMove TargetsLinuxBionic property, which depends on OutputRid (#76078)
Jo Shields [Fri, 23 Sep 2022 15:28:40 +0000 (11:28 -0400)]
Move TargetsLinuxBionic property, which depends on OutputRid (#76078)

Fixes build failures in official build. Tested locally

2 years agoRe-exclude CheckProjects on llvmaot. (#76074)
Nathan Ricci [Fri, 23 Sep 2022 14:49:56 +0000 (10:49 -0400)]
Re-exclude CheckProjects on llvmaot. (#76074)

2 years agoEnable EventSource support in crossgen2 (#76053)
Michal Strehovský [Fri, 23 Sep 2022 04:51:48 +0000 (13:51 +0900)]
Enable EventSource support in crossgen2 (#76053)

This was disabled by default in #76000. I started filling out the backport template when it hit me that we want to keep it here.

We'll want to backport these in tandem.

2 years agoUpdate issues.targets for CheckProjects tests
Nathan Ricci [Fri, 23 Sep 2022 03:02:36 +0000 (23:02 -0400)]
Update issues.targets for CheckProjects tests

Better descriptions for why these tests are disabled.

2 years agoFix Dictionary perf regression for non-string ref type keys (#75663)
Stephen Toub [Fri, 23 Sep 2022 02:38:35 +0000 (22:38 -0400)]
Fix Dictionary perf regression for non-string ref type keys (#75663)

* Fix Dictionary perf regression for non-string ref type keys

Several releases ago, some performance improvements were made to Dictionary that were particularly valuable for value type keys, enabling equality comparisons to be devirtualized and possibly inlined. For non-string reference type keys, however, this can end up being a regression, as every dictionary access then needs to access `EqualityComparer<TKey>.Default`, which can be more expensive with shared generics.  The access is hoisted out of a loop, but at least one per call is still needed.

This fixes the regression by ensuring we always store a comparer in the dictionary's constructor if TKey is a reference type.  The same fix is applied to `HashSet<T>`. This also means we can delete some now unreachable code.

* Address PR feedback

* Fix one more existing TODO

* Revert previous PR feedback changes

* Address PR feedback

2 years agoDisable EventSource support in NativeAOT by default (#76000)
Michal Strehovský [Fri, 23 Sep 2022 02:08:17 +0000 (11:08 +0900)]
Disable EventSource support in NativeAOT by default (#76000)

`DiagnosticSource` is currently not AOT compatible. If a machine-wide DiagnosticSource-related event listener is enabled (such as PerfView, or possibly even a managed VS debugging session) it activates `DiagnosticSource` code paths within the executable and basically injects a runtime failure into NativeAOT processes due to the AOT-incompatibility of the code.

E.g. trying to do a `HttpClient` web request with PerfView collecting in the background causes a runtime exception to be thrown.

This uses the documented switch to disable `EventSource` support (unless the user specified a different value). Indirectly, it disables `DiagnosticSource` as well.

As a side effect, disabling `EventSource` drops the size of a NativeAOT-compiled Hello World from 3.48 MB to 2.85 MB 🥳.

2 years ago[NativeAOT] Ensure that frozen objects respect the minimum object size (#76031)
Filip Navara [Fri, 23 Sep 2022 01:16:35 +0000 (03:16 +0200)]
[NativeAOT] Ensure that frozen objects respect the minimum object size (#76031)

* Ensure that frozen objects respect the minimum object size

* Handle FrozenStringNode too

2 years agoJIT: fix issue with unreachable blocks in redundant branch opt (#76040)
Andy Ayers [Fri, 23 Sep 2022 01:12:30 +0000 (18:12 -0700)]
JIT: fix issue with unreachable blocks in redundant branch opt (#76040)

Update `fgGetDomSpeculatively` to return nullptr if the idom of a block is
unreachable, even if other preds have refs.

Fixes #72767.

2 years agoRemove usages of Ubuntu 16.04 from pipelines (#75513)
Adeel Mujahid [Thu, 22 Sep 2022 23:37:30 +0000 (02:37 +0300)]
Remove usages of Ubuntu 16.04 from pipelines (#75513)

* Remove usages of Ubuntu 16.04 from pipelines

* Delete old jenkins scripts

* Improve handling of /p:CrossBuild=true

2 years ago[PERF][MAUI] Update 6.0 dotnet install quality (#75722)
Parker Bibus [Thu, 22 Sep 2022 22:21:37 +0000 (17:21 -0500)]
[PERF][MAUI] Update 6.0 dotnet install quality (#75722)

* Updated the Maui Perf net6.0 to get the latest daily 6.0 version.

* Remove TODO comment.

* Setup for testing.

* Revert "Setup for testing."

This reverts commit 903014e269670595b05e08eca4d6de1b8edeab9f.

2 years agoImprove "vec == Vector128<>.Zero" (#75999)
Egor Bogatov [Thu, 22 Sep 2022 21:36:10 +0000 (23:36 +0200)]
Improve "vec == Vector128<>.Zero" (#75999)

2 years agoRemove locks from COM events delegate management. (#75863)
Aaron Robinson [Thu, 22 Sep 2022 19:28:31 +0000 (15:28 -0400)]
Remove locks from COM events delegate management. (#75863)

* Remove locks from COM events delegate management.

This removes locks and instead assumes the collection is immutable.

* Use array instead of List<T>

* Remove usage of `Delegate.Combine`. Upon deeper inspection there
doesn't seem to be any value to using that mechanism.

2 years agoJIT: improve scalability of optReachable (#75990)
Andy Ayers [Thu, 22 Sep 2022 19:19:36 +0000 (12:19 -0700)]
JIT: improve scalability of optReachable (#75990)

Use a bit vector to track the visited blocks. This scales much better than
using the per-block visited flags.

Fixes #44341.

2 years agoAllocate RuntimeType objects on Frozen Object Heap (#75573)
Egor Bogatov [Thu, 22 Sep 2022 16:52:57 +0000 (18:52 +0200)]
Allocate RuntimeType objects on Frozen Object Heap (#75573)

Co-authored-by: Michal Strehovský <MichalStrehovsky@users.noreply.github.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Co-authored-by: Jakob Botsch Nielsen <Jakob.botsch.nielsen@gmail.com>
2 years agoUpdate owner/mentionees for System.Transactions (#76021)
Shay Rojansky [Thu, 22 Sep 2022 15:38:42 +0000 (17:38 +0200)]
Update owner/mentionees for System.Transactions (#76021)

2 years agoUpdate area owners (#75975)
Dan Moseley [Thu, 22 Sep 2022 15:11:11 +0000 (09:11 -0600)]
Update area owners (#75975)

2 years agoConfiguring Console Json Formatting with JsonWriterOptions doesn't work with Trimming...
Eric Erhardt [Thu, 22 Sep 2022 14:45:17 +0000 (09:45 -0500)]
Configuring Console Json Formatting with JsonWriterOptions doesn't work with Trimming (#75943)

* Configuring Console Json Formatting with JsonWriterOptions doesn't work with Trimming

Ensure the correct members are preserved when trimming and add a trimming test.

Fix #73822

* Enable NativeAOT test that should work now

Fix #73436

2 years agoInitial unification of DynamicMethod to be shareable between runtimes (#75829)
Marek Safar [Thu, 22 Sep 2022 14:22:55 +0000 (16:22 +0200)]
Initial unification of DynamicMethod to be shareable between runtimes (#75829)

2 years agoDelete more verification code (#72747)
SingleAccretion [Thu, 22 Sep 2022 13:49:23 +0000 (16:49 +0300)]
Delete more verification code (#72747)

* Delete dead verification code

* Untangle verCheckTailCallConstraint

We only use it for tail call stress.

2 years agoDelete `GTF_VAR_CAST` (#74461)
SingleAccretion [Thu, 22 Sep 2022 13:43:37 +0000 (16:43 +0300)]
Delete `GTF_VAR_CAST` (#74461)

It is unused.

Tighten an assert in the ref counter.

2 years agoUpdate solution files under src/libraries (#75988)
Viktor Hofer [Thu, 22 Sep 2022 09:45:03 +0000 (11:45 +0200)]
Update solution files under src/libraries (#75988)

* Update slngen version to work with .NET 7 SDKs

* Batch update all solution files under src/libs

... by invoking the following command: "dotnet.cmd build
src/libraries/slngen.proj".

2 years agoClean-up InteropServices.JavaScript project file (#75962)
Viktor Hofer [Thu, 22 Sep 2022 09:44:37 +0000 (11:44 +0200)]
Clean-up InteropServices.JavaScript project file (#75962)

* Clean-up InteropServices.JavaScript project file

2 years ago[mono] Add Vector128 Sum intrinsic for amd64 (#75142)
Matous Kozak [Thu, 22 Sep 2022 05:45:57 +0000 (07:45 +0200)]
[mono] Add Vector128 Sum intrinsic for amd64 (#75142)

* TODO entry point for SN_sum

* Sum for Vector128 AMD64 in progress

* Vector128 Sum intrinsic (not supporting byte type)

* remove semicolon

* space in function def

* defined macro

* code style fix

* SIMD intrinsics check, code style fixes

* move ISA check after i64 code

* Fast log -1 illegal entries

2 years agoFix critical finalization test (#75952)
Anton Lapounov [Thu, 22 Sep 2022 05:31:42 +0000 (22:31 -0700)]
Fix critical finalization test (#75952)

2 years agoSet names to runtime internal threads (#75113)
Hyungju Lee [Thu, 22 Sep 2022 03:16:12 +0000 (12:16 +0900)]
Set names to runtime internal threads (#75113)

* Set names to runtime internal threads

* Fix MAC build

* Shorten ThreadPool thread names

* Fix not to return SetThreadDescription()

* Change SetThreadDescription to SetThreadName

* Set thread names inside thread functions

* Add missing name for MAC

* Move name change info thread function

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
2 years agoPreserve last error for patchpoint helpers (#75922)
Andy Ayers [Thu, 22 Sep 2022 01:28:19 +0000 (18:28 -0700)]
Preserve last error for patchpoint helpers (#75922)

In stress modes (and in normal uses, see test case) the jit may insert
patchpoint helper calls in regions where last error is live. So the helpers
need to preserve last error.

Because some invocations of the helpers may transition to OSR methods instead
of returning, we can't use the normal macros for this.

Fixes #75828.

2 years ago[Mono] Restore old code to solve the recent SpanHelpers regressions (#75917)
Adam Sitnik [Thu, 22 Sep 2022 00:33:20 +0000 (02:33 +0200)]
[Mono] Restore old code to solve the recent SpanHelpers regressions (#75917)

* bring back the old code...

* bring back more old code

* Use an ifdef around clr code instead of a separate file

* Delete SpanHelpers.Clr.cs

* Remove a remaining INumber<T> helper from mono

Co-authored-by: Jeff Handley <jeffhandley@users.noreply.github.com>
2 years agoFail-fast on SuspendThread/ResumeThread failures (#75845)
Koundinya Veluri [Wed, 21 Sep 2022 22:30:10 +0000 (15:30 -0700)]
Fail-fast on SuspendThread/ResumeThread failures (#75845)

- They would fail typically if the handle is invalid (perhaps because it was erroneously closed, or it's not a thread handle).
- In the places where they are called the handle should be a valid thread handle. Failures can lead to less desirable behaviors, like a deadlock. Added and used `ClrSuspendThread` and `ClrResumeThread` instead, which check for errors and fail-fast.

Fixes https://github.com/dotnet/runtime/issues/13327

2 years agoFix source build problem with missing intellisense xmls (#75981)
Carlos Sanchez [Wed, 21 Sep 2022 22:18:58 +0000 (15:18 -0700)]
Fix source build problem with missing intellisense xmls (#75981)

2 years agoFix x64 cross build on arm64 macOS (#75677)
Jan Vorlicek [Wed, 21 Sep 2022 22:14:47 +0000 (00:14 +0200)]
Fix x64 cross build on arm64 macOS (#75677)

* Fix x64 cross build on arm64 macOS

There were couple of minor issues that prevented successful building of x64 macOS
runtime on arm64 macOS device.
This change fixes them.

* Remove cross architecture combination check

* Reflect PR feedback

* Fix #endif comment

2 years agoEnable logging managed stack trace for AV to event log (#75721)
Jan Vorlicek [Wed, 21 Sep 2022 22:14:29 +0000 (00:14 +0200)]
Enable logging managed stack trace for AV to event log (#75721)

.NET Framework was logging managed stack trace of access violations that
happened in external native code in the event log. .NET core only logs
the address and error code of the exception, which makes it difficult
for developers to figure out which part of their managed code has called
the failing native code.
The reason why .NET core doesn't print the stack trace is that the
access violation is now handled as fail fast instead of regular
unhandled exception. And while we report managed stack traces in the
EEPolicy::FatalError for fail fasts called from our runtime and managed
code in both runtime and user code, we don't report it when we come to
that method due to the access violation.

This change enables printing the stack trace for that case too.

2 years agoMake initialization more consistent in `gc.cpp` (#75908)
Aaron Robinson [Wed, 21 Sep 2022 21:54:19 +0000 (17:54 -0400)]
Make initialization more consistent in `gc.cpp` (#75908)

* Revert previous changes to gc.cpp and make class Volatile have a default ctor

* Remove unnecessary use of memset

2 years agoAllow Hardware Intrinsics to work with the AltJit (#75912)
Tanner Gooding [Wed, 21 Sep 2022 20:48:06 +0000 (13:48 -0700)]
Allow Hardware Intrinsics to work with the AltJit (#75912)

* Fixing a case where a *.PlatformNotSupported.cs type was marked Intrinsic

* Under mismatched VM (AltJit) allow any method to be checked as an intrinsic

* Simplify some logic in impIntrinsic and move the info.compMatchedVM check higher

2 years agoFix a rare crash when creating or opening named mutexes (#75843)
Koundinya Veluri [Wed, 21 Sep 2022 20:02:52 +0000 (13:02 -0700)]
Fix a rare crash when creating or opening named mutexes (#75843)

- Refactored an error path for named mutexes to before the object is registered
- This also fixed a rare crash on error paths while creating a handle due to an extra attempt to release a reference

Fixes https://github.com/dotnet/runtime/issues/7125

2 years agoSkip ASN.1 SetOf sorting if nothing to sort
Kevin Jones [Wed, 21 Sep 2022 19:46:25 +0000 (15:46 -0400)]
Skip ASN.1 SetOf sorting if nothing to sort

2 years ago[NativeAOT] Use clock_gettime_nsec_np if available in GCToOSInterface::GetLowPrecisio...
Filip Navara [Wed, 21 Sep 2022 18:59:01 +0000 (20:59 +0200)]
[NativeAOT] Use clock_gettime_nsec_np if available in GCToOSInterface::GetLowPrecisionTimeStamp (#75862)

* Use clock_gettime_nsec_np if available in GCToOSInterface::GetLowPrecisionTimeStamp

This aligns NativeAOT implementation with the CoreCLR one.

* Change GCToOSInterface::GetLowPrecisionTimeStamp to return 64-bit value, align implementation with PalGetTickCount64, and use it in NativeAOT

2 years agoUpdate RateLimiting ref assembly (#75976)
Brennan [Wed, 21 Sep 2022 18:35:49 +0000 (11:35 -0700)]
Update RateLimiting ref assembly (#75976)

2 years agoFix visibility modifier inconsistency in TextFieldParser (#75974)
Viktor Hofer [Wed, 21 Sep 2022 18:27:15 +0000 (20:27 +0200)]
Fix visibility modifier inconsistency in TextFieldParser (#75974)

* Fix visibility modifier inconsistency in TextFieldParser

The original change brought this API over from .NET Framework without an explicit visibility modifier: https://github.com/dotnet/corefx/pull/32668/files#diff-b244839a8ccb916e708d4ea6158d8bb573e3768d6bb7a3e327a51f2ab1e37c28R641.

That member is publicly exposed on .NET Framework: https://referencesource.microsoft.com/#Microsoft.VisualBasic/Microsoft/VisualBasic/FileIO/TextFieldParser.cs,42.

Noticed during the bootstrap of the new APICompat tooling: https://github.com/dotnet/runtime/pull/73263.

* Update src/libraries/Microsoft.VisualBasic.Core/ref/Microsoft.VisualBasic.Core.cs

Co-authored-by: Stephen Toub <stoub@microsoft.com>