platform/upstream/dotnet/runtime.git
17 months agoUpdate dependencies from https://github.com/dotnet/arcade build 20230512.5 (#86205)
dotnet-maestro[bot] [Mon, 15 May 2023 13:18:04 +0000 (08:18 -0500)]
Update dependencies from https://github.com/dotnet/arcade build 20230512.5 (#86205)

Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Build.Tasks.Archives , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.TargetFramework , Microsoft.DotNet.Build.Tasks.Templating , Microsoft.DotNet.Build.Tasks.Workloads , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.GenAPI , Microsoft.DotNet.GenFacades , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.PackageTesting , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.SharedFramework.Sdk , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.XUnitExtensions
 From Version 8.0.0-beta.23261.4 -> To Version 8.0.0-beta.23262.5

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
17 months agoUse /INCREMENTAL:NO for Debug (#86170)
Kunal Pathak [Mon, 15 May 2023 12:42:28 +0000 (05:42 -0700)]
Use /INCREMENTAL:NO for Debug (#86170)

* Use /INCREMENTAL:NO for Debug when using Visual Studio generator

---------

Co-authored-by: Juan Hoyos <19413848+hoyosjs@users.noreply.github.com>
Co-authored-by: Aaron Robinson <arobins@microsoft.com>
Co-authored-by: Jasper <jasper-d@users.noreply.github.com>
17 months ago[browser] Fix asset loading in boot config scenario (#86240)
Marek Fišera [Mon, 15 May 2023 12:19:47 +0000 (14:19 +0200)]
[browser] Fix asset loading in boot config scenario (#86240)

- Fix using downloadResource
- Fix loading boot config with startupOptions.loadBootResource

17 months agoRun fgValueNumberConstLoad for invariant loads (#86154)
Egor Bogatov [Mon, 15 May 2023 11:15:01 +0000 (13:15 +0200)]
Run fgValueNumberConstLoad for invariant loads (#86154)

17 months ago[wasm] Add fp <--> int conversions to PackedSimd (#86143)
Radek Doulik [Mon, 15 May 2023 09:18:21 +0000 (11:18 +0200)]
[wasm] Add fp <--> int conversions to PackedSimd (#86143)

17 months agoUpdate Base64StringAttribute.cs (#86221)
Weihan Li [Sun, 14 May 2023 19:30:23 +0000 (03:30 +0800)]
Update Base64StringAttribute.cs (#86221)

17 months agoFor Wasi build on windows, do not set CLR_CMAKE_TARGET_WIN32 (#86208)
yowl [Sun, 14 May 2023 05:56:01 +0000 (00:56 -0500)]
For Wasi build on windows, do not set CLR_CMAKE_TARGET_WIN32 (#86208)

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
17 months agoAdd ImmutableArray.Contains overload that accepts an IEqualityComparer<T> (#86210)
RaymondHuy [Sun, 14 May 2023 01:47:19 +0000 (08:47 +0700)]
Add ImmutableArray.Contains overload that accepts an IEqualityComparer<T> (#86210)

17 months agoJIT: do early block merging in more cases (#86157)
Andy Ayers [Sat, 13 May 2023 14:42:33 +0000 (07:42 -0700)]
JIT: do early block merging in more cases (#86157)

OSR and PGO both rely on the fact that the early flowgraph the JIT builds is
the same flowgraph as the one seen in a previous JIT complation of that method,
since there is metadata (patchpoint offset, pgo schema) that refers to the
flowgraph. Previous work here (#85860) didn't ensure this for enough cases.

In particular if Tier0 does not do early block merging, but OSR does, it's possible
for the OSR entry point to fall within a merged block range, which the JIT is not
prepared to handle. This lead to the asserts seen in #86125.

The fix is to enable early block merging unless we're truly in a minopts or
debug codegen mode (previous to this Tier0 would not merge unless it also
was instrumenting; now it will always merge).

An alternative fix would be to find the block containing the OSR entry IL
offset, scan its statements, and split the block at the right spot, but that
seemed more involved.

Fixes #86125.

17 months agoRemove char[] allocation from TarHeader (#86201)
Stephen Toub [Sat, 13 May 2023 06:35:24 +0000 (02:35 -0400)]
Remove char[] allocation from TarHeader (#86201)

17 months ago[JIT]: Inline TLS field access for GC type (#85619)
Kunal Pathak [Sat, 13 May 2023 02:36:22 +0000 (19:36 -0700)]
[JIT]: Inline TLS field access for GC type (#85619)

* Add CORINFO_HELP_GETSHARED_GCTHREADSTATIC_BASE_NOCTOR_OPTIMIZED

* Working prototype

* Rename ThreadStaticBlock to NonGCThreadStaticBlock

* Add GCThreadStaticBlock

* fix linux build

* Restrict the optimization to non-generics

* Update the guid

* Add canOptimizeHelper check

* Rename and related methods from typeIDMap to NonGCTypeID

* Introduce GCTypeIDMap and getGCThreadLocalFieldInfo()

* Use GCThreadLocalFieldInfo()

* fix the bug about gc tracking

* resolve merge conflicts

* remove the commented code

* add comment

* Unify some of the non-gc/gc methods

* fix missing methods

* update the comments

* Track gc for derefernce of object handle

* fix the superpmi methods

* review feedback

17 months agoRemove static modifiers from ThreadPool events in NativeRuntimeEventSource.PortableTh...
Nickolas McDonald [Sat, 13 May 2023 01:49:08 +0000 (21:49 -0400)]
Remove static modifiers from ThreadPool events in NativeRuntimeEventSource.PortableThreadPool.NativeSinks.cs (#85563)

* remove static modifiers

remove static modifiers from lines:
 - 156
 - 191
in:
src\libraries\System.Private.CoreLib\src\System\Threading\NativeRuntimeEventSource.PortableThreadPool.NativeSinks.cs

* Update NativeRuntimeEventSourceTest.cs

* Test NativeRuntimeEventSourceTest.cs

* Remove static modifiers

17 months ago[wasm] InstallWorkloadFromArtifacts: remove unnecessary workaround (#86191)
Ankit Jain [Sat, 13 May 2023 01:45:00 +0000 (21:45 -0400)]
[wasm] InstallWorkloadFromArtifacts: remove unnecessary workaround (#86191)

Prompted by WBT failing with:
```
/Users/ankj/dev/r2/eng/testing/workloads-testing.targets(191,5): error : Could not find IncludedWorkloadManifests.txt in /Users/ankj/dev/r2/artifacts/bin/dotnet-none/
```

.. which seems to been renamed to `KnownWorkloadManifests.txt`.

17 months agoAvoid NRE in networking EventSources (#86171)
Miha Zupan [Fri, 12 May 2023 23:53:06 +0000 (01:53 +0200)]
Avoid NRE in networking EventSources (#86171)

17 months agoFix the test build error (#86176)
Kunal Pathak [Fri, 12 May 2023 22:49:29 +0000 (15:49 -0700)]
Fix the test build error (#86176)

Remove outputtype=exe, mark test as [Fact]
---------

Co-authored-by: Mark Plesko <markples@microsoft.com>
17 months agoUpdate debugging-runtime.md to mention nativeprereqs (#86174)
Juan Hoyos [Fri, 12 May 2023 22:02:15 +0000 (15:02 -0700)]
Update debugging-runtime.md to mention nativeprereqs (#86174)

17 months agoWrite generic method, write complex signatures like array/pointer/generics (#86026)
Buyaa Namnan [Fri, 12 May 2023 21:12:45 +0000 (14:12 -0700)]
Write generic method, write complex signatures like array/pointer/generics (#86026)

* Write generic method, write complex signatures like array/pointer/generics

* Update src/libraries/System.Reflection.Emit/src/System/Reflection/Emit/MethodBuilderImpl.cs

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
* Update src/libraries/System.Reflection.Emit/src/System/Reflection/Emit/MethodBuilderImpl.cs

---------

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
17 months agoConvert JIT/Performance to a merged test group (#85851)
Mark Plesko [Fri, 12 May 2023 21:04:01 +0000 (14:04 -0700)]
Convert JIT/Performance to a merged test group (#85851)

See https://github.com/markples/utils/tree/for-PR-dotnet-runtime-85847-others for ILTransform tool.

* Manual removal of C# Main args
* [ILTransform -prociso] Set RequiresProcessIsolation when needed by other properties
* [ILTransform -public] Make test entrypoints accessible
* [ILTransform -ilfact] Main->TestEntryPoint, [Fact], remove OutputType=Exe
* Manual fixes for xUnit1013 - internal methods, disable for region
* Add merged group

17 months agoAdd tests for RUC warnings on override methods (#86015)
Vitek Karas [Fri, 12 May 2023 20:31:25 +0000 (13:31 -0700)]
Add tests for RUC warnings on override methods (#86015)

These are tests for bug https://github.com/dotnet/runtime/issues/86008.

I also restructured the test file into nested classes some more as it's easier to navigate this way.

Also adds a test for https://github.com/dotnet/runtime/issues/86032.

17 months agoAdd ICorProfiler API to allow profiler created providers to have a callback when...
David Mason [Fri, 12 May 2023 19:41:28 +0000 (12:41 -0700)]
Add ICorProfiler API to allow profiler created providers to have a callback when a session enables them (#80528)

17 months agoUse unique IL assembly names instead of automatic renaming (#85185)
Mark Plesko [Fri, 12 May 2023 19:22:03 +0000 (12:22 -0700)]
Use unique IL assembly names instead of automatic renaming (#85185)

The main motivation for this is that I got stuck trying to write documentation for test merging and test suffixes. We have _il_d for IL and both _d and _cs_d for C# (and similar for _r and others - I'll use _d to denote all such tests here). Only the IL files needed to be separated into different merged groups, yet we split the C# as well.

This change renames the _il_d to just _d (unless there is already an existing _d, likely for a C# version of the test). It then replaces .assembly <name> with .assembly ASSEMBLY_NAME and adds per-configuration "prefix" IL source files with #define ASSEMBLY_NAME <name>_d. Then the rules are simple - tests have unique assembly names and no build-time renaming is required.

This lets me remove the 4 Regression merged groups with ~10 tests each in them. I rebalanced the merged groups where the number of _d tests were larger except HardwareIntrinsics (a unique directory) and Methodical (most of the tests are _d).

17 months agoremove wrap_trace_function (#86158)
Pavel Savara [Fri, 12 May 2023 19:17:54 +0000 (21:17 +0200)]
remove wrap_trace_function (#86158)

17 months agoConvert JIT/SIMD to a merged test group (#85852)
Mark Plesko [Fri, 12 May 2023 18:49:51 +0000 (11:49 -0700)]
Convert JIT/SIMD to a merged test group (#85852)

See https://github.com/markples/utils/tree/for-PR-dotnet-runtime-85847-others for ILTransform tool.

* [ILTransform -prociso] Set RequiresProcessIsolation when needed by other properties
* [ILTransform -public] Make test entrypoints accessible
* Manual fixes for [ILTransform -public] - public partial classes
* [ILTransform -ilfact] Main->TestEntryPoint, [Fact], remove OutputType=Exe
* Remove DOTNET_JitFuncInfoLogFile/SIMD.log from JIT/SIMD
* Manual fixes for xUnit1013 - internal methods
* Manually fix case of accessibility of test in nested type
* Add merged group

17 months agoConvert JIT/opt to a merged test group (#85850)
Mark Plesko [Fri, 12 May 2023 18:49:10 +0000 (11:49 -0700)]
Convert JIT/opt to a merged test group (#85850)

See https://github.com/markples/utils/tree/for-PR-dotnet-runtime-85847-others for ILTransform tool. In this group, I was a bit more aggressive in converting individual tests in [Fact]s and [Theory]s when needing to make manual changes. This required a change to the wrapper generator.

* Manual removal of C# Main args
* Mark async Main test as RPI
* Manual removal of IL Main arg
* Manual fix for badcallee
* [ILTransform -p] Remove _il from project name
* [ILTransform -n] Unique project names
* [ILTransform -m] Remove .module from IL tests
* Rename GitHub_42719: _r means not DebugType=Full, _o for optimize
* [ILTransform -a] Match IL .assembly names to project names
* [ILTransform -prociso] Set RequiresProcessIsolation when needed by other properties
* [ILTransform -sr] Use canonical form for .assembly extern System.Runtime
* [ILTransform -ilfact] Main->TestEntryPoint, [Fact], remove OutputType=Exe
* [ILTransform -public] Make test entrypoints accessible
* Manual fixes for [ILTransform -public] - internal methods to handle internal parameter types
* Handle float constants for InlineData in XUnitWrapperGenerator
* Manual fixes for xUnit1013 - internal methods, convert to [Theory]
* Manual fixes for xUnit1013 - internal methods, disable region
* Add merged group
* Fix mismatch{32,64} by putting the test methods in classes

17 months agoConvert JIT/Generics to a merged test group (#85849)
Mark Plesko [Fri, 12 May 2023 18:48:13 +0000 (11:48 -0700)]
Convert JIT/Generics to a merged test group (#85849)

See https://github.com/markples/utils/tree/for-PR-dotnet-runtime-85847-others for ILTransform tool.

* [ILTransform -p] Remove _il from project names
* [ILTransform -n] Unique project names
* [ILTransform -a] Match IL .assembly names to project names
* [ILTransform -prociso] Set RequiresProcessIsolation when needed by other properties
* [ILTransform -public] Make test entrypoints accessible
* Manual fixes for [ILTransform -public] - internal methods to handle internal parameter types
* [ILTransform -sr] Use canonical form for .assembly extern System.Runtime
* [ILTransform -ilfact] Main->TestEntryPoint, [Fact], remove OutputType=Exe
* Manually created unique project names that were missed due to casing
* Add merged group

17 months ago[main] Update dependencies from dotnet/roslyn-analyzers (#86093)
dotnet-maestro[bot] [Fri, 12 May 2023 17:53:34 +0000 (12:53 -0500)]
[main] Update dependencies from dotnet/roslyn-analyzers (#86093)

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

Microsoft.CodeAnalysis.Analyzers , Microsoft.CodeAnalysis.NetAnalyzers
 From Version 3.3.5-beta1.23258.1 -> To Version 3.3.5-beta1.23260.2

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

Microsoft.CodeAnalysis.Analyzers , Microsoft.CodeAnalysis.NetAnalyzers
 From Version 3.3.5-beta1.23258.1 -> To Version 3.3.5-beta1.23262.1

---------

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
17 months ago[wasm] Unify boot config location (#85763)
Marek Fišera [Fri, 12 May 2023 17:52:09 +0000 (19:52 +0200)]
[wasm] Unify boot config location (#85763)

Load mono-config.json and blazor.boot.json from the same location

17 months agoMake the STJ source generator cache friendly (#86121)
Eirik Tsarpalis [Fri, 12 May 2023 17:47:47 +0000 (18:47 +0100)]
Make the STJ source generator cache friendly (#86121)

* Make the STJ source generator cache friendly.

* Address feedback

* Fix GetHashCode implementation.

* Update src/libraries/System.Text.Json/gen/JsonSourceGenerator.Emitter.cs

Co-authored-by: Stephen Toub <stoub@microsoft.com>
* Remove TODO comment.

* Remove TODO comment.

* Update src/libraries/System.Text.Json/gen/Model/ImmutableEquatableArray.cs

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

* Address feedback

* Expand incremental compilation unit test coverage to include Roslyn tracking.

---------

Co-authored-by: Stephen Toub <stoub@microsoft.com>
17 months ago[main] Update dependencies from dotnet/arcade (#86091)
dotnet-maestro[bot] [Fri, 12 May 2023 17:40:34 +0000 (12:40 -0500)]
[main] Update dependencies from dotnet/arcade (#86091)

* Update dependencies from https://github.com/dotnet/arcade build 20230510.3

Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Build.Tasks.Archives , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.TargetFramework , Microsoft.DotNet.Build.Tasks.Templating , Microsoft.DotNet.Build.Tasks.Workloads , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.GenAPI , Microsoft.DotNet.GenFacades , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.PackageTesting , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.SharedFramework.Sdk , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.XUnitExtensions
 From Version 8.0.0-beta.23259.5 -> To Version 8.0.0-beta.23260.3

* Update dependencies from https://github.com/dotnet/arcade build 20230511.4

Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Build.Tasks.Archives , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.TargetFramework , Microsoft.DotNet.Build.Tasks.Templating , Microsoft.DotNet.Build.Tasks.Workloads , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.GenAPI , Microsoft.DotNet.GenFacades , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.PackageTesting , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.SharedFramework.Sdk , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.XUnitExtensions
 From Version 8.0.0-beta.23259.5 -> To Version 8.0.0-beta.23261.4

---------

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
17 months agoRemove unused multi-dimensional array code (#86133)
Bruce Forstall [Fri, 12 May 2023 17:01:37 +0000 (10:01 -0700)]
Remove unused multi-dimensional array code (#86133)

MD array processing in the JIT changed with https://github.com/dotnet/runtime/pull/70271,
making all the code that implemented the old processing method unused.

Remove all this unused code.

Fixes #71678

17 months agoFix createdump --crashreport option error (#86137)
Mike McLaughlin [Fri, 12 May 2023 17:01:21 +0000 (10:01 -0700)]
Fix createdump --crashreport option error (#86137)

17 months agoTemplatize `enregisterLocalVars` in various methods of LSRA (#85144)
Kunal Pathak [Fri, 12 May 2023 16:52:59 +0000 (09:52 -0700)]
Templatize `enregisterLocalVars` in various methods of LSRA (#85144)

* Optimize identifyCandidates()

* Optimize isRegCandidate()

* Optimize initVarRegMaps()

* Optimize processBlockEndAllocation() and processBlockStartLocations()

* Optimize resolveRegisters()

* jit format

* Revert change for initVarRegMask()

* Remove the unneeded assert

* Optimize buildIntervals()

* Fix the revert I did previously

* review feedback

17 months ago[PERF] Reorder urllib and remove --force-reinstall but keep pinned version (#86128)
Parker Bibus [Fri, 12 May 2023 16:35:31 +0000 (09:35 -0700)]
[PERF] Reorder urllib and remove --force-reinstall but keep pinned version  (#86128)

* Move scenario urllib imports to the last install position.

* Remove force-reinstall from all pip installs in the scenarios-job.yml files.

17 months agoTweak new OutOfMemory_StringTooLong exception message (#86150)
Stephen Toub [Fri, 12 May 2023 16:33:06 +0000 (12:33 -0400)]
Tweak new OutOfMemory_StringTooLong exception message (#86150)

* Tweak new OutOfMemory_StringTooLong exception message

Add a period, fix the tense (the string isn't created yet), and clarify what it means to be too long.

* Update src/libraries/System.Private.CoreLib/src/Resources/Strings.resx

17 months agoFix official build of cross DAC components (#86138)
Jan Kotas [Fri, 12 May 2023 16:18:46 +0000 (09:18 -0700)]
Fix official build of cross DAC components (#86138)

* Fix official build of cross DAC components

Revert changes that broke build of the cross DAC linux-arm components

Fixes #86073

Co-authored-by: Juan Hoyos <19413848+hoyosjs@users.noreply.github.com>
17 months agoExpose remaining Avx512 integer intrinsics which don't require VectorMask (#86130)
Tanner Gooding [Fri, 12 May 2023 15:17:49 +0000 (08:17 -0700)]
Expose remaining Avx512 integer intrinsics which don't require VectorMask (#86130)

* Expose Shuffle2x128 and Shuffle4x128 in Avx512F

* Expose various PermuteVar#x#x2 APIs in Avx512F, Avx512BW, and Avx512Vbmi

* Apply formatting patch

* Fix unix build failure

17 months agoImprove Ascii (and Utf8) encoding (#85266)
Daniel Svensson [Fri, 12 May 2023 10:43:40 +0000 (12:43 +0200)]
Improve Ascii (and Utf8) encoding (#85266)

* Improve writing of lower vector part in ascii convertion

* from 10 /17 to 1 instruction for 64/32 bit x86

* Add [MethodImpl(MethodImplOptions.AggressiveInlining)] to NarrowUtf16ToAscii_Intrinsified

* rewrite StoreLower without Sse2.StoreScalar

* move helper to Vector128 and call in case conversion

* remove unused helpers

17 months ago[RISC-V] Fix emitOutputInstr (#86078)
Dong-Heon Jung [Fri, 12 May 2023 10:27:47 +0000 (19:27 +0900)]
[RISC-V] Fix emitOutputInstr (#86078)

- Fix to use instruction code not INS_

17 months agoDelete more code around reflection blocking (#86139)
Michal Strehovský [Fri, 12 May 2023 08:37:10 +0000 (17:37 +0900)]
Delete more code around reflection blocking (#86139)

We had a bunch of code to carefully compute names in situations where the metadata/names might not be available. Such situations no longer exist.

17 months agoRemove last `!` from Caching.Abstractions (#85918)
hrrrrustic [Fri, 12 May 2023 08:15:23 +0000 (11:15 +0300)]
Remove last `!` from Caching.Abstractions (#85918)

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
Co-authored-by: Christopher Watford <132389385+watfordkcf@users.noreply.github.com>
17 months agoFix spurious SuperPMI asm diffs (#86132)
Bruce Forstall [Fri, 12 May 2023 04:02:48 +0000 (21:02 -0700)]
Fix spurious SuperPMI asm diffs (#86132)

Under ELT profiler stress, we encode the un-relocated address
of the `DummyProfilerELTStub` function in the JIT codebase into
the generated code. This can lead to spurious diffs if the address
is different between base and diff JITs (which is likely).

To avoid this, under SuperPMI replay (which we only know in DEBUG
builds currently), use a fixed constant for this address. The code
isn't executed during SuperPMI replay, so it doesn't need to be a
valid code address.

17 months agoUpdate portable linux source-build legs to use AlmaLinux to better represent building...
Jeremy Koritzinsky [Fri, 12 May 2023 02:01:50 +0000 (19:01 -0700)]
Update portable linux source-build legs to use AlmaLinux to better represent building on RHEL8 (#86114)

17 months agoFix an SSA bug from the `ASG` refactoring (#86108)
SingleAccretion [Fri, 12 May 2023 01:48:53 +0000 (04:48 +0300)]
Fix an SSA bug from the `ASG` refactoring (#86108)

* Add a test

* Fix an SSA bug from the GT_ASG refactoring

Recording PHIs from analyzable stores is a correctness requirement.

17 months agoClean up shared ArrayPool naming and add some env var config (#86109)
Stephen Toub [Thu, 11 May 2023 23:56:43 +0000 (19:56 -0400)]
Clean up shared ArrayPool naming and add some env var config (#86109)

* Clean up shared ArrayPool naming and add some env var config

We've had several requests to be able to tweak / experiment with how many arrays the shared array pool might store.  This adds two environment variables, one that controls the number of partitions the shared pool uses, and one that controls the number of arrays cacheable in each partition.  Previously these values were constants.

As part of doing that, I needed to choose names that were a bit more palatable for external consumption, and I renamed thngs in the implementation accordingly.

* Rename file to SharedArrayPool.cs

* Fix naming scheme

* Avoid using globalization

* Avoid using Environment.GetEnvironmentVariable

* Move nopool env var into Environment

* Move static readonly fields to statics type

17 months ago[wasm] [jiterp] Fix jit calls and interp entry wrappers (#86120)
Katelyn Gadd [Thu, 11 May 2023 23:18:48 +0000 (16:18 -0700)]
[wasm] [jiterp] Fix jit calls and interp entry wrappers (#86120)

17 months agoAdd necessary subset of wide char APIs to minipal (#86055)
Aaron Robinson [Thu, 11 May 2023 21:15:05 +0000 (14:15 -0700)]
Add necessary subset of wide char APIs to minipal (#86055)

* Update minipal with UTF-16 functions

* Remove function redefines from PAL header

* Remove need of PAL_wcslen from LTTNG
generator.

* Remove specified calling conventions for x86

17 months agoSupport ConfigurationBinder.GetValue in source-gen (#86076)
Layomi Akinrinade [Thu, 11 May 2023 21:03:01 +0000 (14:03 -0700)]
Support ConfigurationBinder.GetValue in source-gen (#86076)

* Support ConfigurationBinder.GetValue in source-gen

* Address feedback

17 months agoHardcode the path to libclang from Mariner, not Clang 9 on CentOS 7 (#86096)
Jo Shields [Thu, 11 May 2023 20:09:12 +0000 (16:09 -0400)]
Hardcode the path to libclang from Mariner, not Clang 9 on CentOS 7 (#86096)

* Hardcode the path to libclang from Mariner, not Clang 9 on CentOS 7

17 months agoEnsure DecomposeRotate correctly orders parameters. (#86066)
Tanner Gooding [Thu, 11 May 2023 19:10:03 +0000 (12:10 -0700)]
Ensure DecomposeRotate correctly orders parameters. (#86066)

* Add a regression test for dotnet/runtime#86207

* Ensure RotateRight and RotateLeft decomposition orders parameters correctly

* Add explicit tests covering the other two DecomposeRotate paths

* Ensure other code paths that create GT_RSH_LO nodes aren't broken

17 months agoMake casting helpers look more like in CoreCLR (#86029)
Michal Strehovský [Thu, 11 May 2023 19:07:15 +0000 (04:07 +0900)]
Make casting helpers look more like in CoreCLR (#86029)

* Make casting helpers look more like in CoreCLR

Speeds up casting to interfaces by about 50%. Speeds up casting to classes by about 20%.

There are small differences compared to CoreCLR:
* NativeAOT runtime considers interfaces implementable by arrays to be variant. We don't need to special case casting arrays to non-variant (in IL sense) interfaces because those naturally take the variant paths.
* The base type field on arrays holds the array element type so we need to check for the array case before starting to chase the base hierarchy.

Otherwise the top level helpers now look mostly the same as the CoreCLR ones.

* Make it tailcallable

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
17 months ago[browser] loader ES6 module (#85730)
Pavel Savara [Thu, 11 May 2023 19:02:02 +0000 (21:02 +0200)]
[browser] loader ES6 module (#85730)

17 months agoUpdate dependencies from https://dev.azure.com/dnceng/internal/_git/dotnet-optimizati...
dotnet-maestro[bot] [Thu, 11 May 2023 18:53:47 +0000 (13:53 -0500)]
Update dependencies from https://dev.azure.com/dnceng/internal/_git/dotnet-optimization build 20230510.3 (#86090)

optimization.linux-arm64.MIBC.Runtime , optimization.linux-x64.MIBC.Runtime , optimization.windows_nt-arm64.MIBC.Runtime , optimization.windows_nt-x64.MIBC.Runtime , optimization.windows_nt-x86.MIBC.Runtime , optimization.PGO.CoreCLR
 From Version 1.0.0-prerelease.23258.3 -> To Version 1.0.0-prerelease.23260.3

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
17 months agoFix printing of arcs for local stores (#86098)
SingleAccretion [Thu, 11 May 2023 17:30:45 +0000 (20:30 +0300)]
Fix printing of arcs for local stores (#86098)

17 months agoSet SelfContained=true for browser-wasm runtimes (#86102)
Larry Ewing [Thu, 11 May 2023 17:02:01 +0000 (12:02 -0500)]
Set SelfContained=true for browser-wasm runtimes (#86102)

17 months agoSkip ProcessStartInfoTests.TestWindowStyle if COM interop is not supported (#85813)
Alexander Köplinger [Thu, 11 May 2023 16:58:09 +0000 (18:58 +0200)]
Skip ProcessStartInfoTests.TestWindowStyle if COM interop is not supported (#85813)

* Skip ProcessStartInfoTests.TestWindowStyle if COM interop is not supported

This happens on e.g. Mono or NativeAOT and results in this exception:

```
    System.Diagnostics.Tests.ProcessStartInfoTests.TestWindowStyle(windowStyle: Normal, useShellExecute: True) [FAIL]
      System.PlatformNotSupportedException : COM Interop is not supported on this platform.
      Stack Trace:
        /_/src/mono/System.Private.CoreLib/src/System/Threading/Thread.Mono.cs(262,0): at System.Threading.Thread.SetApartmentStateUnchecked(ApartmentState state, Boolean throwOnError)
        /_/src/libraries/System.Private.CoreLib/src/System/Threading/Thread.cs(521,0): at System.Threading.Thread.SetApartmentState(ApartmentState state, Boolean throwOnError)
        /_/src/libraries/System.Private.CoreLib/src/System/Threading/Thread.cs(499,0): at System.Threading.Thread.SetApartmentState(ApartmentState state)
        /_/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Win32.cs(177,0): at System.Diagnostics.Process.ShellExecuteHelper.ShellExecuteOnSTAThread()
        /_/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Win32.cs(74,0): at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)
        /_/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.Win32.cs(25,0): at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
        /_/src/libraries/System.Diagnostics.Process/src/System/Diagnostics/Process.cs(1282,0): at System.Diagnostics.Process.Start()
        /_/src/libraries/System.Diagnostics.Process/tests/ProcessStartInfoTests.Windows.cs(108,0): at System.Diagnostics.Tests.ProcessStartInfoTests.TestWindowStyle(ProcessWindowStyle windowStyle, Boolean useShellExecute)
        /_/src/mono/System.Private.CoreLib/src/System/Reflection/MethodInvoker.Mono.cs(30,0): at System.Reflection.MethodInvoker.InterpretedInvoke(Object obj, IntPtr* args)
        /_/src/libraries/System.Private.CoreLib/src/System/Reflection/MethodInvoker.cs(59,0): at System.Reflection.MethodInvoker.Invoke(Object obj, IntPtr* args, BindingFlags invokeAttr)
```

* Only skip test on mono

17 months agoOptimizations for Ascii.Equals and Ascii.EqualsIgnoreCase (#85926)
Günther Foidl [Thu, 11 May 2023 16:48:04 +0000 (18:48 +0200)]
Optimizations for Ascii.Equals and Ascii.EqualsIgnoreCase (#85926)

17 months ago[NativeAOT] Another attempt to prevent stripping exported symbols from executables...
Ivan Povazan [Thu, 11 May 2023 14:52:57 +0000 (16:52 +0200)]
[NativeAOT] Another attempt to prevent stripping exported symbols from executables when explicitly specified (#86050)

17 months agoFix some nullable annotations / null handling in System.Text.Json (#86077)
Stephen Toub [Thu, 11 May 2023 13:19:27 +0000 (09:19 -0400)]
Fix some nullable annotations / null handling in System.Text.Json (#86077)

The `JsonConverter<T>`s for reference type `T`s need to be able to deal with null. Fix the nullable annotations accordingly. This then led to highlghting that the implementation can null ref if a dictionary returns a null key, so adding appropriate validation of that, too.

17 months agoRemove generated locals in RegexCompiler.LoadSearchValues (#86010)
Stephen Toub [Thu, 11 May 2023 13:12:28 +0000 (09:12 -0400)]
Remove generated locals in RegexCompiler.LoadSearchValues (#86010)

Rely instead of improvements to JIT's recognition of Unsafe.As.

17 months agoJIT: Fold typeof(T).TypeHandle.Value (#85804)
Egor Bogatov [Thu, 11 May 2023 12:35:16 +0000 (14:35 +0200)]
JIT: Fold typeof(T).TypeHandle.Value (#85804)

Co-authored-by: Andy Ayers <andya@microsoft.com>
17 months agoEnabling RuntimeEventSource in NativeAOT (#85424)
Lakshan Fernando [Thu, 11 May 2023 12:11:29 +0000 (05:11 -0700)]
Enabling RuntimeEventSource in NativeAOT (#85424)

* Enabling RuntimeEventSource for counters

* enable exception and assembly count

* FB

* make the exception count thread safe

* revert reflection blocking workaround and open an issue for the CoreCLR exceptioncount fix

* Missed syncing to branch before syncing with main

* Update src/coreclr/nativeaot/System.Private.CoreLib/src/System/Reflection/Assembly.NativeAot.cs

Co-authored-by: Michal Strehovský <MichalStrehovsky@users.noreply.github.com>
* FB

* Removing unnecessary whitespace chang

---------

Co-authored-by: Michal Strehovský <MichalStrehovsky@users.noreply.github.com>
17 months agoHandle cctor dependency on RVA static access (#86081)
Michal Strehovský [Thu, 11 May 2023 10:01:37 +0000 (19:01 +0900)]
Handle cctor dependency on RVA static access (#86081)

Contributes to #68278.

17 months agoChange IsolatedStorageFile path for mobile (#83380)
Meri Khamoyan [Thu, 11 May 2023 09:33:40 +0000 (13:33 +0400)]
Change IsolatedStorageFile path for mobile (#83380)

 Updated isolated storage root path for mobile platforms
---------
Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
17 months agoAdd integration tests for PreserveSig and use the MemberFunction calling convention...
Jeremy Koritzinsky [Thu, 11 May 2023 08:09:14 +0000 (01:09 -0700)]
Add integration tests for PreserveSig and use the MemberFunction calling convention by default in the ComInterfaceGenerator (#86072)

17 months ago[wasm] Docs on overriding runtime pack in blazor wasm (#85455)
Marek Fišera [Thu, 11 May 2023 07:55:10 +0000 (09:55 +0200)]
[wasm] Docs on overriding runtime pack in blazor wasm (#85455)

17 months ago[mono][llvm] Fix the emission of nonnull metadata on loads. (#86071)
Zoltan Varga [Thu, 11 May 2023 06:32:08 +0000 (23:32 -0700)]
[mono][llvm] Fix the emission of nonnull metadata on loads. (#86071)

Fixes llvm verification errors in newer llvm versions:
```
nonnull metadata must be empty
   %49 = load ptr, ptr @aotconst_ldstr_21, align 8, !nonnull !1
```

17 months ago[mono] Move most runtime callbacks into the MonoRuntimeCallbacks structure. (#86080)
Zoltan Varga [Thu, 11 May 2023 06:31:51 +0000 (23:31 -0700)]
[mono] Move most runtime callbacks into the MonoRuntimeCallbacks structure. (#86080)

17 months ago[mono][wasm] Allow linking out some runtime code on wasm. (#86079)
Zoltan Varga [Thu, 11 May 2023 06:14:03 +0000 (23:14 -0700)]
[mono][wasm] Allow linking out some runtime code on wasm. (#86079)

17 months agoFix official build after removing win-arm runtime build (#86074)
Bruce Forstall [Thu, 11 May 2023 04:41:38 +0000 (21:41 -0700)]
Fix official build after removing win-arm runtime build (#86074)

win-arm CI builds were removed with https://github.com/dotnet/runtime/pull/85947

17 months ago[JIT] X64 - Centralize peephole optimization for removing redundant `mov` instruction...
Will Smith [Thu, 11 May 2023 04:39:02 +0000 (21:39 -0700)]
[JIT] X64 - Centralize peephole optimization for removing redundant `mov` instructions (#85780)

17 months agoDelete Windows arm32 support (#86065)
Jan Kotas [Thu, 11 May 2023 03:02:38 +0000 (20:02 -0700)]
Delete Windows arm32 support (#86065)

17 months ago[mono][aot] Fix an assert. (#86054)
Zoltan Varga [Wed, 10 May 2023 22:36:48 +0000 (15:36 -0700)]
[mono][aot] Fix an assert. (#86054)

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

17 months agoUpdate dependencies from https://github.com/dotnet/roslyn-analyzers build 20230508...
dotnet-maestro[bot] [Wed, 10 May 2023 21:51:35 +0000 (16:51 -0500)]
Update dependencies from https://github.com/dotnet/roslyn-analyzers build 20230508.1 (#85972)

Microsoft.CodeAnalysis.Analyzers , Microsoft.CodeAnalysis.NetAnalyzers
 From Version 3.3.5-beta1.23256.1 -> To Version 3.3.5-beta1.23258.1

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
17 months agoAdd linux-x64 hosted tpdiff to superpmi-diffs pipeline (#86021)
Bruce Forstall [Wed, 10 May 2023 21:42:26 +0000 (14:42 -0700)]
Add linux-x64 hosted tpdiff to superpmi-diffs pipeline (#86021)

* Add linux-x64 hosted tpdiff to superpmi-diffs pipeline

With this, we get instruction count diffs based on clang compiled
native JITs.

* Fix some variables

Also, fix some Python 'lint' issues.

* Fix more path issues, Windows targeting global var

* Feedback

1. Make `determine_jit_name` a utility library function.
All 3 versions were different, so required some adjustments.
jitrollingbuild.py had not previously used `jitutil` so added use
and removed additional duplicated code.
2. Renamed partitions to not use `unix` name. This is purely an internal
name, not exposed.
3. Simplified some FileSeparatorChar usage.
4. Fixed more pylint complaints

17 months ago[PERF] Add arm64 dynamic pgo runs (#86014)
Parker Bibus [Wed, 10 May 2023 21:18:05 +0000 (14:18 -0700)]
[PERF] Add arm64 dynamic pgo runs (#86014)

* Add DynamicPGO arm64 linux and windows runs.
* Added parity to performance-setup.sh for pgo (no, dynamic, full) runs.
* Pass the pgoRunType through to the performance (Unix) setup script as well in performance-job.yml.
* Add Linux x64 dynamic pgo.

17 months agoILLink should keep parameter names for methods which are used to create a delagate...
Vitek Karas [Wed, 10 May 2023 21:01:12 +0000 (14:01 -0700)]
ILLink should keep parameter names for methods which are used to create a delagate (#85831)

This is a fix for https://github.com/dotnet/linker/issues/3061.

If the app creates a delegate over a method and later on access the `Delegate.Method` property it can get a `MethodInfo` which it can use to inspect some aspects of the method, specifically parameter names.

NativeAOT already handles this correctly, but ILLink doesn't and will trim the parameter names away. The correct behavior is to treat such method as reflection accessible (we really don't want to mark the `Delegate.Method` property as trim incompatible).

The ideal way to implement this is to perform full data flow on method addresses, which would allow us to detect which method is the delegate created for. (this is what NativeAOT ends up doing through JIT)

But that is rather complex, an easier solution is to treat any method which address is accessed as reflection enabled. This covers all delegates. It might mark more methods as reflection enabled, but it's very uncommon.

So this change does that, it will mark all methods accessed via `ldftn` (or similar) as reflection enabled.
Additionally this cleans up marking of reflection enabled members in the MarkStep. Specifically there was a distinction between reflection accessed and indirect accessed methods, but the latter only kicked in for the obsolete preserve attributes. It's better to reflection mark those as well. This might cause a small size regression, but it's very unlikely to be even observable.

This requires lot more test changes to enable sane testing:
* In the ILC test infra, track if method was kept with or without reflection metadata (as that is the difference in NativeAOT which will provide parameter names or not)
* Teach both the ILLink and ILC test infras how to handle compiler generated code with the `Kept` attribute validation
  * This is in no way complete, but it's an improvement
  * Mostly it means that we don't fail the test if a compiler generated code is kept without it being marked with the `Kept` attribute (as that's not always possible)
  * Note that we have some support for this for things like backing fields and private implementation details, but nothing which can handle state machines, and closure types for lambdas. These should now be workable, without the ability to verify that they were indeed kept (and how)
  * Finally adds tests verifying the new functionality.

17 months agoAdd ArgumentException.ThrowIfNullOrWhiteSpace (#86007)
Stephen Toub [Wed, 10 May 2023 20:49:47 +0000 (16:49 -0400)]
Add ArgumentException.ThrowIfNullOrWhiteSpace (#86007)

* Add ArgumentException.ThrowIfNullOrWhiteSpace

* Fix tests

17 months agoCapture remaining binding Bind & Get methods for source generator support (#85843)
Layomi Akinrinade [Wed, 10 May 2023 20:19:12 +0000 (13:19 -0700)]
Capture remaining binding Bind & Get methods for source generator support (#85843)

* Capture remaining binding methods for source generator support

* Capture remaining binding methods for source generator support

* Implement method emission

* Restore binder implemenation

* Complete currently unsupported test annotation

* Clean up method gen implementation

* Refactor for ideal emitted code (for baseline tests)

* Clean up

17 months agoUpdate linux build instructions (#86062)
Sven Boemer [Wed, 10 May 2023 19:54:40 +0000 (12:54 -0700)]
Update linux build instructions (#86062)

To reflect recent series of changes to our official build. This
updates the mentioned images to use floating tags, and clarifies
that the new official build containers all are designed for
cross-building.

17 months agoRevert "let user know working directory will be used as content root path by default...
Steve Harter [Wed, 10 May 2023 19:15:12 +0000 (14:15 -0500)]
Revert "let user know working directory will be used as content root path by default (#82445)" (#86057)

This reverts commit c958573654937f9582b6a23522b2ad16cd7dbf96.

17 months agoUpdate dependencies from https://dev.azure.com/dnceng/internal/_git/dotnet-optimizati...
dotnet-maestro[bot] [Wed, 10 May 2023 19:06:18 +0000 (14:06 -0500)]
Update dependencies from https://dev.azure.com/dnceng/internal/_git/dotnet-optimization build 20230508.3 (#85968)

optimization.linux-arm64.MIBC.Runtime , optimization.linux-x64.MIBC.Runtime , optimization.windows_nt-arm64.MIBC.Runtime , optimization.windows_nt-x64.MIBC.Runtime , optimization.windows_nt-x86.MIBC.Runtime , optimization.PGO.CoreCLR
 From Version 1.0.0-prerelease.23256.3 -> To Version 1.0.0-prerelease.23258.3

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
17 months agoUpdate dependencies from https://github.com/dotnet/roslyn build 20230509.11 (#86036)
dotnet-maestro[bot] [Wed, 10 May 2023 19:05:24 +0000 (14:05 -0500)]
Update dependencies from https://github.com/dotnet/roslyn build 20230509.11 (#86036)

Microsoft.CodeAnalysis , Microsoft.CodeAnalysis.CSharp , Microsoft.Net.Compilers.Toolset
 From Version 4.7.0-1.23254.5 -> To Version 4.7.0-1.23259.11

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
17 months agoUpdate dependencies from https://github.com/dotnet/arcade build 20230509.5 (#86034)
dotnet-maestro[bot] [Wed, 10 May 2023 19:04:50 +0000 (14:04 -0500)]
Update dependencies from https://github.com/dotnet/arcade build 20230509.5 (#86034)

Microsoft.DotNet.Arcade.Sdk , Microsoft.DotNet.Build.Tasks.Archives , Microsoft.DotNet.Build.Tasks.Feed , Microsoft.DotNet.Build.Tasks.Installers , Microsoft.DotNet.Build.Tasks.Packaging , Microsoft.DotNet.Build.Tasks.TargetFramework , Microsoft.DotNet.Build.Tasks.Templating , Microsoft.DotNet.Build.Tasks.Workloads , Microsoft.DotNet.CodeAnalysis , Microsoft.DotNet.GenAPI , Microsoft.DotNet.GenFacades , Microsoft.DotNet.Helix.Sdk , Microsoft.DotNet.PackageTesting , Microsoft.DotNet.RemoteExecutor , Microsoft.DotNet.SharedFramework.Sdk , Microsoft.DotNet.VersionTools.Tasks , Microsoft.DotNet.XUnitConsoleRunner , Microsoft.DotNet.XUnitExtensions
 From Version 8.0.0-beta.23255.2 -> To Version 8.0.0-beta.23259.5

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
17 months agoFix null handling of built-in converters. (#86056)
Eirik Tsarpalis [Wed, 10 May 2023 18:18:38 +0000 (21:18 +0300)]
Fix null handling of built-in converters. (#86056)

17 months agoAdd PreserveSig support to ComInterfaceGenerator (#85941)
Jeremy Koritzinsky [Wed, 10 May 2023 18:09:44 +0000 (11:09 -0700)]
Add PreserveSig support to ComInterfaceGenerator (#85941)

17 months agoUpdate mariner images to latest with LLVM 16 (#84676)
Sven Boemer [Wed, 10 May 2023 17:09:52 +0000 (10:09 -0700)]
Update mariner images to latest with LLVM 16 (#84676)

This pulls in the updates from
https://github.com/dotnet/dotnet-buildtools-prereqs-docker/commit/53fee55b4115616c7029782c9733055db1bc565a
and moves to floating tags for the mariner images, which now
build the product with LLVM 16.

Once this flows to dotnet-optimization, this will require updates
to make the LLVM 16 tools available there. Before the opt data
collected with new LLVM flows into runtime, I plan to fix
https://github.com/dotnet/runtime/issues/85785 so that local
builds won't by default require clang-16.

17 months agoRemove Windows arm32 support (#85947)
Bruce Forstall [Wed, 10 May 2023 16:59:15 +0000 (09:59 -0700)]
Remove Windows arm32 support (#85947)

* Remove Windows arm32 support

Mostly, remove the CI runs. Windows arm32 product support was removed
before .NET 6.

* Restore a few files

Only change YML files to remove windows_arm runs.

Don't build Windows arm cross components.

Don't touch mono files.

Changing scripts to remove builds, and remove code, can follow.

17 months agoDisable autovectorization on wasm (#86038)
Katelyn Gadd [Wed, 10 May 2023 16:28:21 +0000 (09:28 -0700)]
Disable autovectorization on wasm (#86038)

7c75cbf added the -msimd128 flag to cmakelists so that the interpreter could use wasm vector intrinsics. That option appears to imply enabling all sorts of auto-vectorization, which may be responsible for the regressions in dotnet/perf-autofiling-issues#17570

17 months agoExpose various integer intrinsics for Avx512F, Avx512BW, and Avx512CD (#85833)
Tanner Gooding [Wed, 10 May 2023 16:04:09 +0000 (09:04 -0700)]
Expose various integer intrinsics for Avx512F, Avx512BW, and Avx512CD (#85833)

* Expose AlignRight32 and AlignRight64 on Avx512F

* Expose RotateLeft and RotateRight for Avx512F

* Expose SumAbsoluteDifferencesInBlock32 for Avx512BW + DetectConflicts and LeadingZeroCOunt for Avx512DQ

* Exponse TernaryLogic for Avx512F

* Apply formatting patch

* Ensure side effects are preserved when optimizing certain intrinsic imports

* Ensure the instruction code has the SIMD prefix before trying to encode the register

* Ensure side effects have been accounted for before swapping operands

* Move the complex ternary logic simplification logic to import, since the JIT will never produce such nodes itself

* Ensure gtNewSimdUnOpNode(GT_NOT) uses an in range constant for TernaryLogic

* Remove a new assert added to AND_NOT, logging an issue instead

* Add a missing `break;` statement

* Ensure val1/2/3 are GenTree** so swapping works and add a comment explaining the TernaryLogic table

* Fix formatting of a comment

* Don't double encode the 'vvvv' bits for `emitOutputAM`

* Avoid an assert in gtNewSimdCreateBroadcastNode for TYP_LONG on 32-bit

* Ensure we use CHECK_SPILL_ALL

* Ensure mustExpand is handled for `RotateLeft(Vector###<long>)` on 32-bit

* Make sure all tests are actually running and handle the "maybe no jmp table fallback"

* Handle a couple test issues  and ensure we set the constant when normalizing ~B | C

* Ensure ValidateRemaining uses firstOp[i]

17 months agoAdd instructions for running the runtime tests on iOS platforms (#86045)
Milos Kotlar [Wed, 10 May 2023 15:21:43 +0000 (17:21 +0200)]
Add instructions for running the runtime tests on iOS platforms (#86045)

17 months agoFix BigInteger parse hex strings on negative numbers (#84792)
Alexander Speshilov [Wed, 10 May 2023 14:36:50 +0000 (17:36 +0300)]
Fix BigInteger parse hex strings on negative numbers (#84792)

fixes dotnet#74758

17 months agofix JsonNode deserialising from null (#85463)
adj123 [Wed, 10 May 2023 14:00:36 +0000 (15:00 +0100)]
fix JsonNode deserialising from null (#85463)

* fix JsonNode deserialising from null

* add further tests for more null-deserialising scenarios

---------

Co-authored-by: Adam Jones <ajones@drwuk.com>
17 months agoFix mismatched types in native host test error messaging (#85995)
Elinor Fung [Wed, 10 May 2023 13:15:05 +0000 (15:15 +0200)]
Fix mismatched types in native host test error messaging (#85995)

17 months agoFix NativeLibraryTests for ilasm round-trip (#85991)
Elinor Fung [Wed, 10 May 2023 13:05:29 +0000 (15:05 +0200)]
Fix NativeLibraryTests for ilasm round-trip (#85991)

17 months agoJIT: Seed stress modes by string hash (#83771)
Jakob Botsch Nielsen [Wed, 10 May 2023 11:15:15 +0000 (13:15 +0200)]
JIT: Seed stress modes by string hash (#83771)

Instead of using the numeric value of each stress mode inside the enum,
calculate a hash based on the string name. This has the benefit that it
won't change based on new members being added/reordered and reduces
correlation of which stress modes get enabled together.

Fix #83733

17 months agoJIT: Peel offsets from spilled addresses for store decomposition (#85889)
Jakob Botsch Nielsen [Wed, 10 May 2023 10:59:54 +0000 (12:59 +0200)]
JIT: Peel offsets from spilled addresses for store decomposition (#85889)

For a block operation like

```
▌  ASG       struct (copy)
├──▌  BLK       struct<System.Nullable`1, 8>
│  └──▌  ADD       byref
│     ├──▌  LCL_VAR   ref    V00 this
│     └──▌  CNS_INT   long   40 Fseq[<unknown field>]
└──▌  LCL_VAR   struct<System.Nullable`1, 8>(P) V06 tmp2
└──▌    bool   V06.<unknown class>:hasValue (offs=0x00) -> V12 tmp8          (last use)
└──▌    int    V06.<unknown class>:value (offs=0x04) -> V13 tmp9          (last use)
```

We would previously spill the ADD(V00, 40) to a local and end up
producing:

```
▌  COMMA     void
├──▌  COMMA     void
│  ├──▌  ASG       byref
│  │  ├──▌  LCL_VAR   byref  V15 tmp11
│  │  └──▌  ADD       byref
│  │     ├──▌  LCL_VAR   ref    V00 this
│  │     └──▌  CNS_INT   long   40 Fseq[<unknown field>]
│  └──▌  ASG       bool
│     ├──▌  IND       bool
│     │  └──▌  LCL_VAR   byref  V15 tmp11
│     └──▌  LCL_VAR   bool   V12 tmp8
└──▌  ASG       int
   ├──▌  IND       int
   │  └──▌  ADD       byref
   │     ├──▌  LCL_VAR   byref  V15 tmp11
   │     └──▌  CNS_INT   long   4
   └──▌  LCL_VAR   int    V13 tmp9
```

Instead of this we can include the offsets with the field offsets. In
many cases that allows us to avoid any temporary locals, while in other
cases it usually allows us to avoid an instruction in favor of two
larger containments. In this case we instead end up with:

```
▌  COMMA     void
├──▌  ASG       bool
│  ├──▌  IND       bool
│  │  └──▌  ADD       byref
│  │     ├──▌  LCL_VAR   ref    V00 this
│  │     └──▌  CNS_INT   long   40 Fseq[<unknown field>]
│  └──▌  LCL_VAR   bool   V12 tmp8
└──▌  ASG       int
   ├──▌  IND       int
   │  └──▌  ADD       byref
   │     ├──▌  LCL_VAR   ref    V00 this
   │     └──▌  CNS_INT   long   44 Fseq[<unknown field>, 4]
   └──▌  LCL_VAR   int    V13 tmp9
```

17 months agoDisable HugeArray1 for crossgen2 x86 (#86020)
Bruce Forstall [Wed, 10 May 2023 06:05:58 +0000 (23:05 -0700)]
Disable HugeArray1 for crossgen2 x86 (#86020)

Tracking: https://github.com/dotnet/runtime/issues/85747

17 months agoMisc LSRA throughput improvements (#85842)
Kunal Pathak [Wed, 10 May 2023 05:00:45 +0000 (22:00 -0700)]
Misc LSRA throughput improvements (#85842)

* Use BitOperations in few hot methods

* Do not pass RegisterType for non-arm sarchitectures

* Add clearAssignedInterval()

* Consume clearAssignedInterval()

* Do not pass RegisterType for updateInterval()

* Revert the change in genFindLowestBit()

* Revert "Use BitOperations in few hot methods"

This reverts commit a75a7da436fe616d8226d8f2a4c5d50c0f447827.

* Add the missing case for clearAssignedInterval()

* Remove logging

* jit formatting

* Use popcount intrinsics

* Revert "Use popcount intrinsics"

This reverts commit 0b3da210a8b754521de29d40e01072fb1b01adc7.

* revert unintentional change from superpmi.py

* Revert "Do not pass RegisterType for non-arm sarchitectures"

This reverts commit 46d4d3d88704beca5f0817db3a6e48fc1a14dac6.

* fix the merge conflicts

17 months agoAllow set GC configuration in NativeAOT (#85921)
Andrii Kurdiumov [Wed, 10 May 2023 04:58:03 +0000 (10:58 +0600)]
Allow set GC configuration in NativeAOT (#85921)

Currently NativeAOT uses `uint32_t` for storing configuration values.
There assumption that configuration would take 8 characters in configuration.
If we set value which has 9 characters it would be silently ignored.
For example: `$env:DOTNET_GCHeapHardLimit="100000000"` which is 4Gb.
On CoreCLR GC uses `uint64_t` so it does not make sense to limit NativeAOT cofiguration
to 32-bit values here

17 months agoDelete rarely used bashing methods and add some documentation on bashing (#85925)
SingleAccretion [Wed, 10 May 2023 04:57:43 +0000 (07:57 +0300)]
Delete rarely used bashing methods and add some documentation on bashing (#85925)