platform/upstream/dotnet/runtime.git
23 months ago[main] Update dependencies from dotnet/arcade (#75929)
dotnet-maestro[bot] [Mon, 3 Oct 2022 16:07:34 +0000 (11:07 -0500)]
[main] Update dependencies from dotnet/arcade (#75929)

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

Microsoft.DotNet.ApiCompat , 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.22469.1 -> To Version 8.0.0-beta.22470.1

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

Microsoft.DotNet.ApiCompat , 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.22469.1 -> To Version 8.0.0-beta.22470.3

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

Microsoft.DotNet.ApiCompat , 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.22469.1 -> To Version 8.0.0-beta.22471.2

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

Microsoft.DotNet.ApiCompat , 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.22469.1 -> To Version 8.0.0-beta.22472.1

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

Microsoft.DotNet.ApiCompat , 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.22469.1 -> To Version 8.0.0-beta.22473.1

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

Microsoft.DotNet.ApiCompat , 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.22469.1 -> To Version 8.0.0-beta.22476.4

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

Microsoft.DotNet.ApiCompat , 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.22469.1 -> To Version 8.0.0-beta.22477.1

* InstallWorkloadFromArtifacts: Remove hack because we have an updated sdk now

* [wasm] WBT: Make project names unique

* [wasm] WBT: Use a clean NUGET_PACKAGES dir separate from the project directory

* [wasm] WBT: Fixes to work with latest sdk

- Use only one source of which tfm to use
- Allow a different tfm for blazor
- Add `dotnet8` nuget feed for tests
- Support more than one choice for nuget.config, like for net7, or net8

* Revert to test projects created in bindir, instead of a temp one

This was necessary because on windows the tmp path is very long, causing
the test project paths to become too long causing build failures.

* [wasm] fix weird build failures

`MSBuildSDKsPath` is set by runtime repo, and that interferes with the
test projects. To avoid this the `MSBuildSDKsPath` was set to `""` in
the test environment. But even that can negatively affect the build
because msbuild treats environment variables as "global properties" that
cannot be changed. This manifests when running:

`$ dotnet run --no-build`

.. it would fail with `/foo/bar.csproj is not a valid project file`.

Instead, explicitly *remove* `MSBuildSDKsPath` from the environment when
invoking the process.

* PInvokeTableGenerator: Find path to WasmAppBuilder.dll at test time

.. instead of depending on *one* runtime pack version. This is needed
when we have more than one workload installed.

* WasmAppHost: allow rollForward to work with newer sdks

* Don't use the nuget packages directory as fallback.

.. because we explicitly set `NUGET_PACKAGES` envvar now.

* [wasm] Use the latest sdk for Wasm.Build.Tests

* Add missing nuget8.config

* WBT: workaround for https://github.com/dotnet/runtime/issues/76201

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

Microsoft.DotNet.ApiCompat , 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.22469.1 -> To Version 8.0.0-beta.22478.2

* Revert "WBT: workaround for https://github.com/dotnet/runtime/issues/76201"

This reverts commit 33e367920f106c5e01c3f488174ff2b50471ff6f.

* Revert "Add missing nuget8.config"

This reverts commit dec9861de6002f77471ecf8deafd7b94c9f5001e.

* Revert "[wasm] Use the latest sdk for Wasm.Build.Tests"

This reverts commit 3a15bdf787af5a75bf07b9f8afcea3d77b010870.

* Revert "Don't use the nuget packages directory as fallback."

This reverts commit 785504e474f7fd3fc6c07027e59edf1c476844a1.

* Revert "WasmAppHost: allow rollForward to work with newer sdks"

This reverts commit 28cfbcd190b09c9b0f7f6046e91ef4eeffac5b71.

* Revert "PInvokeTableGenerator: Find path to WasmAppBuilder.dll at test time"

This reverts commit 33dbf9892500e2a6375728f0b5c5eea062dd65bc.

* Revert "[wasm] fix weird build failures"

This reverts commit 1a731fb70c36b227359012fbceb622623b768d79.

* Revert "Revert to test projects created in bindir, instead of a temp one"

This reverts commit 57ff0dd4883469f5fa39b158017f48b1c101c338.

* Revert "[wasm] WBT: Fixes to work with latest sdk"

This reverts commit 0aa1b5a9813d3815754e9f9fd201044c33e7b31c.

* Revert "[wasm] WBT: Use a clean NUGET_PACKAGES dir separate from the project directory"

This reverts commit 0678940b38ccb2f10509bc6b5e674ba67cb4de10.

* Revert "[wasm] WBT: Make project names unique"

This reverts commit 55120ac60c3b53bdadd7f8a2348abe33c9db037b.

* Revert "InstallWorkloadFromArtifacts: Remove hack because we have an updated sdk now"

This reverts commit 60e9f8c1a938c4fc0dab2a66fcc8d8af579ffd98.

* Fix Wasm.Build.Tests failures

- Use latest sdk for testing
- Add dotnet8 feed, needed by blazorwasm templates

- Workaround a bug in 7.0 templates which will be fixed by
https://github.com/dotnet/runtime/pull/76373 . And this can be removed
once we have packages with that.

* WasmAppHost: Set rollForward=latestMajor to work with newer sdks

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

Microsoft.DotNet.ApiCompat , 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.22469.1 -> To Version 8.0.0-beta.22479.2

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

Microsoft.DotNet.ApiCompat , 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.22469.1 -> To Version 8.0.0-beta.22480.2

* Revert changes to source-build.yml

It was missing https://github.com/dotnet/arcade/pull/10782

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

Microsoft.DotNet.ApiCompat , 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.22469.1 -> To Version 8.0.0-beta.22480.2

* Revert changes again

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Ankit Jain <radical@gmail.com>
Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
23 months agoJIT: don't forward sub qmarks to LCL_FLD assignments (#76524)
Andy Ayers [Mon, 3 Oct 2022 16:04:17 +0000 (09:04 -0700)]
JIT: don't forward sub qmarks to LCL_FLD assignments (#76524)

Morph is not quite ready for this yet.

Closes #76509.

23 months agoFix illumos-x64 build (#76497)
Adeel Mujahid [Mon, 3 Oct 2022 15:18:16 +0000 (18:18 +0300)]
Fix illumos-x64 build (#76497)

23 months ago[Android] Fix NetworkInterface.GetAllNetworkInterfaces (#76370)
Simon Rozsival [Mon, 3 Oct 2022 13:11:02 +0000 (15:11 +0200)]
[Android] Fix NetworkInterface.GetAllNetworkInterfaces (#76370)

* Revert "[Android] Port getifaddrs implementation from Xamarin.Android (#71943)"

This reverts commit 1de4a5ca073da24211fc4d427b2224da2212f372.

* Fix allocating memory block for interfaces and addresses on recent Android SDKs

* Detect loopback interface on Android

* Add comment with explanation

* Simplify the changes to be closer to the original code

* Fix build

* Fix typos

Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
* Improve comment

* Indent using spaces instead of tabs

* Remove check for ifaddrs.h

* Add ANDROID_GETIFADDRS_WORKAROUND

* Update comment

Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
23 months ago[mono][sgen] Update memory load information after world is resumed (#76400)
Vlad Brezae [Mon, 3 Oct 2022 12:41:26 +0000 (15:41 +0300)]
[mono][sgen] Update memory load information after world is resumed (#76400)

Following recent cgroup support (https://github.com/dotnet/runtime/pull/74237), mono_determine_physical_ram_size is no longer safe to call during GC.

23 months agoEnsure NI_Vector256_GetLower has the right simdSize and improve codegen slightly...
Tanner Gooding [Mon, 3 Oct 2022 12:22:24 +0000 (05:22 -0700)]
Ensure NI_Vector256_GetLower has the right simdSize and improve codegen slightly (#76456)

23 months ago[wasm] add missing API xml doc (#76196)
Pavel Savara [Mon, 3 Oct 2022 11:00:05 +0000 (13:00 +0200)]
[wasm] add missing API xml doc (#76196)

* add missing xml doc
Co-authored-by: Carlos Sanchez <1175054+carlossanlop@users.noreply.github.com>
23 months ago[mono][arm] Fix rethrow instruction size (#76387)
Vlad Brezae [Mon, 3 Oct 2022 08:26:24 +0000 (11:26 +0300)]
[mono][arm] Fix rethrow instruction size (#76387)

It is the same as throw

23 months agoUse System.CommandLine (v2) in dotnet-pgo (#76467)
Adeel Mujahid [Mon, 3 Oct 2022 05:29:39 +0000 (08:29 +0300)]
Use System.CommandLine (v2) in dotnet-pgo (#76467)

* Use System.CommandLine (v2) in dotnet-pgo

* Delete internal CommandLine implementation

* Fix release build

* Use BuildPathDictionay helper in input options

* Restore string[] in compare-mibc

* Fix ILVerify build

* Add BuildPathList helper

Co-authored-by: Jakob Botsch Nielsen <Jakob.botsch.nielsen@gmail.com>
23 months agoReduce OrderBy overheads for default comparer (#76418)
Stephen Toub [Mon, 3 Oct 2022 02:18:04 +0000 (22:18 -0400)]
Reduce OrderBy overheads for default comparer (#76418)

* Reduce OrderBy overheads for default comparer

If OrderBy is used with a value type key and and a default or no comparer is specified, we can use `Comparer<TKey>.Default.Compare` to avoid the interface dispatch.  This optimization can be taken further, but for now it handles a common set of cases.

* Address PR feedback

23 months agoDelete security object from GCInfo encoder/decoder (#76487)
Jan Kotas [Sun, 2 Oct 2022 23:57:04 +0000 (16:57 -0700)]
Delete security object from GCInfo encoder/decoder (#76487)

Fixes #76482

23 months agoEnsure NI_Vector128_AsVector128 (aka `Vector128<T> AsVector128(this Vector<T> value...
Tanner Gooding [Sun, 2 Oct 2022 16:42:49 +0000 (09:42 -0700)]
Ensure NI_Vector128_AsVector128 (aka `Vector128<T> AsVector128(this Vector<T> value)`) doesn't have a side-effect in its assert (#76460)

* Ensure NI_Vector128_AsVector128 (aka `Vector128<T> AsVector128(this Vector<T> value)`) doesn't have a side-effect in its assert

* CorInfoType no var_types

23 months agoJIT: A small CQ improvement for Equals/StartsWith unrolling (#76439)
Egor Bogatov [Sun, 2 Oct 2022 16:34:38 +0000 (18:34 +0200)]
JIT: A small CQ improvement for Equals/StartsWith unrolling (#76439)

23 months agoProcess primitives in local morph (#76155)
SingleAccretion [Sun, 2 Oct 2022 16:08:26 +0000 (19:08 +0300)]
Process primitives in local morph (#76155)

* Process primitives in local morph

* Delete folding code from morph

* Enable BITCAST folding

Only for RETURN users for now.

* Fix BOOL <-> UBYTE mismatch

We should really delete TYP_BOOL.

* Disable const prop for local fields

The code isn't actually set up for this. No diffs.

* Remove incorrect asserts

23 months agoAttempt to fix native AOT with CryptoKit (#76499)
Kevin Jones [Sun, 2 Oct 2022 05:38:34 +0000 (01:38 -0400)]
Attempt to fix native AOT with CryptoKit (#76499)

23 months agoRe-enable DynamicGenerics test on OSX (#76489)
Jan Kotas [Sun, 2 Oct 2022 04:08:45 +0000 (21:08 -0700)]
Re-enable DynamicGenerics test on OSX (#76489)

Fixes #73299

23 months agoRevert change in AddInternedString (#76496)
Egor Bogatov [Sun, 2 Oct 2022 04:07:48 +0000 (06:07 +0200)]
Revert change in AddInternedString (#76496)

* Restore all logic for AddInternedString

Fixes #76494

23 months agoReinstate strict prototypes warning (#76463)
yowl [Sat, 1 Oct 2022 19:19:07 +0000 (14:19 -0500)]
Reinstate strict prototypes warning (#76463)

* reinstate strict-prototype warning

* More fixes

* Need to keep the warning disabled for zlib

https://github.com/madler/zlib/issues/633

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
23 months agoFix SuperPMI unit test error checking (#76411)
Bruce Forstall [Sat, 1 Oct 2022 18:48:43 +0000 (11:48 -0700)]
Fix SuperPMI unit test error checking (#76411)

* Fix SuperPMI unit test error checking

We were ignoring test failures, and even ignoring if the test
we wanted to run under collection actually existed. This means
that at some point during recent test reconfigurations, we
stopped building 10w5d_cs_do.cmd/sh but we didn't notice. Because
Bytemark kept being built as before, we got at least some .mc
files.

Add more checking that the programs we want to run exist, and
that the tests we invoke pass.

* Adjust superpmi unit test collection tests

Add CscBench to get better C# coverage.

Disable 10w5d_cs_do.csproj due to https://github.com/dotnet/runtime/issues/76421

23 months ago[JIT] Fix potential division by zero in fgopt.cpp (#76424)
Gilles Grospellier [Sat, 1 Oct 2022 16:32:12 +0000 (18:32 +0200)]
[JIT] Fix potential division by zero in fgopt.cpp (#76424)

Division by zero in C++ is undefined behavior on some architecture and
should be avoided.

Co-authored-by: Andy Ayers <andya@microsoft.com>
23 months agoImplement ChaCha20Poly1305 with CryptoKit on macOS
Kevin Jones [Sat, 1 Oct 2022 16:02:03 +0000 (12:02 -0400)]
Implement ChaCha20Poly1305 with CryptoKit on macOS

Co-authored-by: Filip Navara <filip.navara@gmail.com>
23 months agoJIT: allow forward sub of QMARK nodes (#76476)
Andy Ayers [Sat, 1 Oct 2022 15:16:53 +0000 (08:16 -0700)]
JIT: allow forward sub of QMARK nodes (#76476)

There is often a single-def single use temp consuming a QMARK (which in
turn often comes from expansion of `isinst` and friends). This temp
assignment tends to stay around and can inhibit redundant branch opts
in a number of interesting cases. It may also serve as an attractive
nuisance for copy prop.

While it would be ideal to generalize RBO to handle assignment side
effects, doing so appears quite challenging, as we would need to rewrite
possibly large chunks of the SSA and VN graphs. Forward sub eliminates
the temp and so clears the way for the existing RBO to remove more branches.

Addresses aspects of the "side effect" enhancements for RBO (see #48115).

23 months agoUpdate jitrollingbuild.py (#76472)
Bruce Forstall [Sat, 1 Oct 2022 14:31:50 +0000 (07:31 -0700)]
Update jitrollingbuild.py (#76472)

Pick up changes made to superpmi.py for more general finding of
`main` branch.

Make "list" choose a default git hash if not specified.

Change `list --all` to show all the JITs for a particular git hash.

Add new `list --global_all` to show all JITs for all git hashes
(this was previously `list --all`).

Fix obsoleted `logging.warn`; use `logging.warning` instead.

23 months agoImprove early bail-out logic in GCInfoDecoder (#76359)
Filip Navara [Sat, 1 Oct 2022 14:12:54 +0000 (16:12 +0200)]
Improve early bail-out logic in GCInfoDecoder (#76359)

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
23 months agoJIT: Avoid internal register allocation when possible for PUTARG_SPLIT (#76443)
Jakob Botsch Nielsen [Sat, 1 Oct 2022 09:48:16 +0000 (11:48 +0200)]
JIT: Avoid internal register allocation when possible for PUTARG_SPLIT (#76443)

We can almost always avoid allocating an internal register, which may be
expensive if LR is picked since we cannot use thumb encoding for it.

The only case where we need an internal register is when we have a
source that is in a register, and we have a single taget register to
place that conflicts with that source register. The to-stack copies then
need an intermediate scratch register to avoid clobbering the source
register.

23 months agoFix DEBUG/non-DEBUG SuperPMI asm diffs (#76470)
Bruce Forstall [Sat, 1 Oct 2022 03:26:37 +0000 (20:26 -0700)]
Fix DEBUG/non-DEBUG SuperPMI asm diffs (#76470)

Recorded SPMI method contexts include configuration environment variables
such as `COMPlus_JITMinOpts` that are replayed. However, when doing
asmdiffs replays to compare a Release to a Checked compiler (non-DEBUG
to DEBUG), there may be codegen-altering configuration variables
such as JitStress that are only read and interpreted by the DEBUG
compiler. This leads to asm diffs.

Introduce a `-ignoreStoredConfig` argument to superpmi.exe, and use it
in superpmi.py when doing Checked/Release asm diffs, that pretends there
are no stored config variables. This assumes that the stored config variables
only alter JIT behavior but that they JIT will succeed with or without them.
This is also slightly more than necessary: if there is a config variable
that the Release compiler knows about, we won't use that, either. However,
we have no easy way (currently) to distinguish which variables are DEBUG
and which are both DEBUG and non-DEBUG available.

Contributes to https://github.com/dotnet/runtime/issues/76347

23 months agoRemove `IDispatchImplAttribute` API (#76416)
Aaron Robinson [Sat, 1 Oct 2022 00:04:49 +0000 (17:04 -0700)]
Remove `IDispatchImplAttribute` API (#76416)

* Remove IDispatchImplAttribute API

This type has never been supported on .NET Core.
Removing all supporting code paths.

23 months agoSuperPMI collections: exclude more files/directories (#76384)
Bruce Forstall [Fri, 30 Sep 2022 23:37:04 +0000 (16:37 -0700)]
SuperPMI collections: exclude more files/directories (#76384)

* SuperPMI collections: exclude more files/directories

Exclude a few more native code files and the 'runtimes' directory
that contains uninteresting files, including native code files,
to reduce the number of PMI exceptions during collections.

* Use python 'list' constructor to avoid modifying global lists

23 months agoUse BCrypt for ephemeral RSA on Windows
Jeremy Barton [Fri, 30 Sep 2022 23:30:51 +0000 (16:30 -0700)]
Use BCrypt for ephemeral RSA on Windows

Windows CNG has two different libraries: bcrypt.dll (`BCrypt*` functions) for in-memory/ephemeral operations, and ncrypt.dll (`NCrypt*` functions) for persisted key operations.  Since the NCrypt functions can also operate on ephemeral keys our cryptographic operations have generally been done in terms of NCrypt.

NCrypt's flexibility (to also work with persisted keys) comes at a cost.  All key operations are done out-of-process (in lsass.exe), and that requires an (L)RPC call for every operation.  It also means there are simply more moving parts, and thus more room for error.

With this change we will use BCrypt for RSA operations on Windows from `RSA.Create()` and `cert.GetRSAPublicKey()`.  ECDSA/ECDH/DSA can any/all be changed to follow suit later.

For keys created from RSA.Create() a verification operation currently looks like

* Virtual invoke to RSAWrapper.VerifyHash
* Maybe-devirtualized invoke to RSACng.VerifyHash
* P/Invoke to NCryptVerifySignature
* "Virtual" invoke to MSKSPVerifySignature (or whatever it's really called)
* LRPC call
* Find key in the MRU ring
* Effectively a call to BCryptVerifySignature

After this change it is instead

* Virtual invoke to RSABCrypt.VerifyHash
* P/Invoke to BCryptVerifySignature

Removing all of those other indirections removes about 40us from a 50us operation (on my primary devbox).

As part of making some code be shared between RSACng and RSABCrypt, some allocating code changed to pooling code and some array code got spanified.

23 months ago[metadata] Skip null vtable entries when checking covariant return overrides (#76323)
Aleksey Kliger (λgeek) [Fri, 30 Sep 2022 23:20:55 +0000 (19:20 -0400)]
[metadata] Skip null vtable entries when checking covariant return overrides (#76323)

* Add test for covariant reabstraction

* [metadata] Skip null vtable entires when checking covariant overrides

When there are covariant return overrides, we check the vtable slot in every
parent class for signature compatability with the proposed override.

However if one of the ancestor classes is abstract, it could have an
abstract override for hte method:

    class Base {
      public virtual Base Method() => this;
    }
    public abstract Intermediate : Base {
      public override abstract Base Method();
    }
    public Leaf : Intermediate {
      public override Leaf Method() => this;
    }

In this case when we're checking that Leaf.Method is compatible with
the vtable slot in Intermediate, we will see a null method (since
Intermediate is abstract).  In such cases we can skip over the class
and continue with its parent.

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

23 months ago[NativeAOT] Enable CI for macOS x64/arm64 (#75421)
Filip Navara [Fri, 30 Sep 2022 21:31:11 +0000 (23:31 +0200)]
[NativeAOT] Enable CI for macOS x64/arm64 (#75421)

* [NativeAOT] Enable CI for macOS x64/arm64

* Update CppCompilerAndLinker condition

* Enable NativeAOT osx-arm64 build in regular runtime pipeline

* Enable cross-compilation on macOS

* Fix HAVE_SHM_OPEN_THAT_WORKS_WELL_ENOUGH_WITH_MMAP when cross-compiling

* Update OSVersion_ValidVersion_OSX test on NativeAOT

The test tries to validate Environment.OSVersion.Version which works correctly. RuntimeInformation.RuntimeIdentifier, however, doesn't use versioned RIDs when NativeAOT is used.

* Add hack to stop linker from corrupting DWARF CFI, bump darwin version in triple to get compact unwinding tables generated

* Bump ObjWriter packages

* Disable MessageSendTests on NativeAOT

Co-authored-by: Adeel <3840695+am11@users.noreply.github.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
23 months agoQuick disasm check CI JitStress fix (#76417)
Will Smith [Fri, 30 Sep 2022 20:08:17 +0000 (13:08 -0700)]
Quick disasm check CI JitStress fix (#76417)

Runtime_33972 was failing in ARM64 in JitStress because it turns off HWIntrinsic - so I force the test to enable it.

23 months agoIncrease timeouts for runtime-dev-innerloop legs (#76453)
Jan Kotas [Fri, 30 Sep 2022 20:00:15 +0000 (13:00 -0700)]
Increase timeouts for runtime-dev-innerloop legs (#76453)

Increase timeouts for runtime-dev-innerloop legs to compensate for intermittently slow build machines.

Fixes https://github.com/dotnet/arcade/issues/11072

23 months agoNativeAOT: Conversion for opcode conv_u4 is unsigned (#76386)
yowl [Fri, 30 Sep 2022 18:30:54 +0000 (13:30 -0500)]
NativeAOT: Conversion for opcode conv_u4 is unsigned (#76386)

* fix probable type for conv_u4 to match conv_u8 regards unsigned conversion

* Fix conv_u as well

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
23 months agoRemove reliance on deactivated A64 queue (#76457)
Drew Scoggins [Fri, 30 Sep 2022 17:41:46 +0000 (10:41 -0700)]
Remove reliance on deactivated A64 queue (#76457)

23 months agoAlways expose parents of exposed promoted fields (#76181)
SingleAccretion [Fri, 30 Sep 2022 15:36:35 +0000 (18:36 +0300)]
Always expose parents of exposed promoted fields (#76181)

* Remove the special case

* Simplify code

* Add tests

23 months agoRemoving short name column from compphases.h (#76030)
Brian Bohe [Fri, 30 Sep 2022 15:30:19 +0000 (08:30 -0700)]
Removing short name column from compphases.h (#76030)

* Avoiding the use of JIT phases shorName

* Removing shortName from JIT phases description

* Avoiding memory allocation

* Renaming variable

23 months agoJIT: increase slop tolerance when computing edge weights (#76409)
Andy Ayers [Fri, 30 Sep 2022 15:18:57 +0000 (08:18 -0700)]
JIT: increase slop tolerance when computing edge weights (#76409)

Up the tolerance a bit to get past some jit stress errors we're seeing.

Fixes the main case in #74169.

23 months ago[mono] Fix iOS/tvOS build with Xcode 14 (#76433)
Alexander Köplinger [Fri, 30 Sep 2022 14:11:13 +0000 (16:11 +0200)]
[mono] Fix iOS/tvOS build with Xcode 14 (#76433)

Before Xcode 14 the `objc_super` struct definition in the SDK headers looked like this:

```
#if !defined(__cplusplus)  &&  !__OBJC2__
    /* For compatibility with old objc-runtime.h header */
    __unsafe_unretained _Nonnull Class class;
#else
    __unsafe_unretained _Nonnull Class super_class;
#endif
```

With Xcode 14 however the iOS/tvOS SDK header was changed to only define `super_class`, but the MacOSX SDK stayed the same.

Added CMake detection of this case so we can compile both on older and newer Xcode SDKs across platforms.

23 months agoSupport running Reflection tests within Visual Studio (#75915)
Steve Harter [Fri, 30 Sep 2022 13:51:44 +0000 (08:51 -0500)]
Support running Reflection tests within Visual Studio (#75915)

23 months agoImplement AuthenticationTagMismatchException exception
Kevin Jones [Fri, 30 Sep 2022 12:56:57 +0000 (08:56 -0400)]
Implement AuthenticationTagMismatchException exception

Co-authored-by: Filip Navara <filip.navara@gmail.com>
23 months ago[wasm] Add a workaround for issue#76429 to fix CI (#76432)
Ankit Jain [Fri, 30 Sep 2022 12:37:41 +0000 (08:37 -0400)]
[wasm] Add a workaround for issue#76429 to fix CI (#76432)

23 months agoAdd QuicError.AlpnInUse member (#74754)
Radek Zikmund [Fri, 30 Sep 2022 12:19:03 +0000 (14:19 +0200)]
Add QuicError.AlpnInUse member (#74754)

* Import new MsQuic interop

* Detect the new QUIC status

* Use correct values for ALPN_IN_USE in interop shim

* Update alpine-3.14-helix-amd64 image to newer

23 months ago[wasm] Pass --web-server-use-cop for threading samples (#76419)
Ankit Jain [Fri, 30 Sep 2022 08:27:04 +0000 (04:27 -0400)]
[wasm] Pass --web-server-use-cop for threading samples (#76419)

* [wasm] Pass --web-server-use-cop for threading samples

* CI: Add wasm samples to wasm specific paths list

23 months agoFix filtered exceptions when checking for ip forwarding (#76383)
Radek Zikmund [Fri, 30 Sep 2022 08:21:58 +0000 (10:21 +0200)]
Fix filtered exceptions when checking for ip forwarding (#76383)

23 months agoFix edit and continue in VS with hardware exceptions (#76401)
Jan Vorlicek [Fri, 30 Sep 2022 08:00:01 +0000 (10:00 +0200)]
Fix edit and continue in VS with hardware exceptions (#76401)

There is a subtle bug in hardware exception handling in the runtime
that causes the debugged process to crash when a user tries to use the
"unwind to this frame" on the frame where the exception happened.
This issue was introduced by the recent changes that modified hardware
exception handling.

The problem turned out to be in how we update the exception and context
records in the HandleManagedFaultFilter when we re-raise the exception
using RaiseException from the VEH. Updating the context is both not
necessary and wrong. All we need to update is the `ExceptionAddress` in
the `EXCEPTION_RECORD`, since the RaiseException puts the address of
itself there and we need the address of the original access violation to
be there.
The context should stay untouched as we are unwinding from the
RaiseException.

The context copying was originally made to mimick the code in the
`NakedThrowHelper` used before the exception handling change. That one
needed the context update, as it was used to fix unwinding over the
NakedThrowHelper that was a hijack helper. In the current state, nothing
like that is needed.

With this fix, the VS debugger works as expected.

23 months agoDistributed transaction fixes (#76310)
Shay Rojansky [Fri, 30 Sep 2022 07:15:06 +0000 (09:15 +0200)]
Distributed transaction fixes (#76310)

* Retake lock when using a dependent transaction from a
  TransactionScope (#76010).
* Reset TransactionTransmitter and Receiver before reusing them
  (#76010).
* Increase MSDTC startup timeout from 2.5 to 30 seconds (#75822)

Fixes #76010
Fixes #75822

23 months ago[mono] Add Vector128 Negate and OnesComplement intrinsics for amd64 (#74993)
Matous Kozak [Fri, 30 Sep 2022 06:04:40 +0000 (08:04 +0200)]
[mono] Add Vector128 Negate and OnesComplement intrinsics for amd64 (#74993)

* Vector128 Negate intrinsics (two's complement)

* AMD64 OnesComplement intrinsics for Vector128/64

* Negate + OnesComplement operands,fix missing break

* Simplify OP_AMD64_NEGATION

* Conditional Select for amd64, refactor arm64 code

* Re-use Arm64 code for Negate and OnesComplement

* rename ones complement

* Update src/mono/mono/mini/mini-ops.h remove space

Co-authored-by: Fan Yang <52458914+fanyang-mono@users.noreply.github.com>
* remove space mini-ops.hs

* remove blank line

Co-authored-by: Fan Yang <52458914+fanyang-mono@users.noreply.github.com>
23 months agoRemove the GenericComPlusCall mechanism (#76415)
Aaron Robinson [Fri, 30 Sep 2022 05:00:13 +0000 (22:00 -0700)]
Remove the GenericComPlusCall mechanism (#76415)

Remove unused asm constants.
Remove comments about context-bound objects and remoting.
Use common constants for VtblGap concept.

23 months ago[NativeAOT] Fix System.Runtime.InteropServices tests (#75669)
Michal Strehovský [Fri, 30 Sep 2022 04:49:26 +0000 (13:49 +0900)]
[NativeAOT] Fix System.Runtime.InteropServices tests (#75669)

23 months ago[mono][jit] For beforefieldinit classes, only field accesses trigger initialization...
Zoltan Varga [Fri, 30 Sep 2022 02:28:26 +0000 (22:28 -0400)]
[mono][jit] For beforefieldinit classes, only field accesses trigger initialization. (#76335)

23 months agoRemove some dead code from Array.IndexOf (#76388)
Stephen Toub [Fri, 30 Sep 2022 02:14:30 +0000 (22:14 -0400)]
Remove some dead code from Array.IndexOf (#76388)

23 months agoRemove GT_ADDEX and replace with more generalized containment handling (#76273)
Tanner Gooding [Fri, 30 Sep 2022 01:24:23 +0000 (18:24 -0700)]
Remove GT_ADDEX and replace with more generalized containment handling (#76273)

* Remove GT_ADDEX and replace with more generalized containment handling

* Handle small types for (extended register) instructions

* Remember to handle IsRegOptional

* Applying formatting patch

* Preference containing the CAST of `ADD(op1, CAST(op2))` rather than the op2 of CAST

* Update src/coreclr/jit/lowerarmarch.cpp

* Adding a test covering the caught fuzzlyn scenario

* Ensure the new test returns 100

* Skip a Fuzzlyn generated regression test on Mono wasm/llvmaot/llvmfullaot

23 months agoDisable gen 1 budget accounting fix for segments, so the segments implementation...
Peter Sollich [Thu, 29 Sep 2022 23:27:21 +0000 (01:27 +0200)]
Disable gen 1 budget accounting fix for segments, so the segments implementation of GC behaves like .NET 6.0 did. (#76365)

23 months ago[tests] Disable source generator tests mobile (#75609)
Mitchell Hwang [Thu, 29 Sep 2022 20:01:59 +0000 (16:01 -0400)]
[tests] Disable source generator tests mobile (#75609)

* Disable Source generator tests on all mobile platforms

* Remove redundant source generator test suite exclusions

23 months agoJIT: optimize redundant branches by looking through phis (#76283)
Andy Ayers [Thu, 29 Sep 2022 18:03:53 +0000 (11:03 -0700)]
JIT: optimize redundant branches by looking through phis (#76283)

In some cases the value of a block's branch predicate is correlated with the
predecessor of the block. Often this correlation is hinted at by the presence
of phis in the predicate's tree and/or phi VNs in in the predicate's VN graph.

For each predecessor of a block, we evaluate the predicate value number using
the values brought to the block by that predecessor. If we find correlations,
we use them to drive the existing jump threading optimization.

Make sure that when we search local PHIs we also match the ssa def
number to ensure we're looking at the right PHI.

Also, if we end up partially disambiguating such that there is just one
remaining predecessor, update the value number of the predicate to reflect
the values that flow in from that predecessor.

Fixes #75944.
Contributes to #48115.

23 months agoEnsure that StoreInd for contained HWIntrinsics has the constant "fit in byte" (...
Tanner Gooding [Thu, 29 Sep 2022 17:56:28 +0000 (10:56 -0700)]
Ensure that StoreInd for contained HWIntrinsics has the constant "fit in byte" (#76385)

23 months agoSPMI: Improve speed significantly for large diffs (#76238)
Jakob Botsch Nielsen [Thu, 29 Sep 2022 17:24:34 +0000 (19:24 +0200)]
SPMI: Improve speed significantly for large diffs (#76238)

This starts communicating more information about diffs back from
superpmi and starts using it in the driver. The current information is
the base size, diff size, base instructions, diff instructions and
context size.

The driver uses the base size/diff size to pick a small number of
interesting contexts and only creates disassembly for these contexts.
jit-analyze is then also invoked on only these contexts, but the
contexts are picked so that they overlap with what jit-analyze would
display. Additionally, we also pick the top 20 smallest contexts (in
terms of context size) -- I frequently use the smallest contexts with
diffs to investigate my change.

The new behavior is only enabled when no custom metrics are specified.
If custom metrics are specified we fall back to producing all
disassembly files and leave it up to jit-analyze to extract and analyze
the metrics specified.

Also, the retainTopFilesOnly option is no longer necessary since our CI
pipeline will at most produce 100 .dasm files now. Another benefit is that
this means that all contexts mentioned in the jit-analyze output will now be
part of the artifacts.

The net result is that we can now get SPMI diffs for changes with even
hundreds of thousands of diffs in the same time as it takes to get diffs
for a small change.

Fix #76178

23 months agoReturn s_defaultResultTask from Task.FromResult in more cases (#76349)
Stephen Toub [Thu, 29 Sep 2022 16:44:23 +0000 (12:44 -0400)]
Return s_defaultResultTask from Task.FromResult in more cases (#76349)

* Return s_defaultResultTask from Task.FromResult in more cases

Today we return a cached task from Task.FromResult when the TResult is a primitive and its value is 0.  But it needn't be constrained to only being a primitive; what matters is that we need to be able to efficiently compare its bit pattern to 0.  And we can do that easily now by using Unsafe.SizeOf to check if the size is the same as a primitive, Unsafe casting to that primitive, and then comparing against 0.

* Update tests

23 months agoremove explicit LangVersion from a few projects (#75806)
kasperk81 [Thu, 29 Sep 2022 16:24:02 +0000 (19:24 +0300)]
remove explicit LangVersion from a few projects (#75806)

* remove explicit LangVersion from a few projects

* feedback

* net7.0

* net7.0

Co-authored-by: kasperk81 <kasperk81 83082615+kasperk81@users.noreply.github.com>
Co-authored-by: kasperk81 <kasperk81 kasperk81 83082615+kasperk81@users.noreply.github.com>
23 months agoDelete malformed package.json used for tests, it confuses Component Governance toolin...
Alexander Köplinger [Thu, 29 Sep 2022 16:19:45 +0000 (18:19 +0200)]
Delete malformed package.json used for tests, it confuses Component Governance tooling (#76309)

23 months agoUpdating owners (#76330)
Eric StJohn [Thu, 29 Sep 2022 15:34:51 +0000 (08:34 -0700)]
Updating owners (#76330)

23 months agoRemove some extra static arrays used in Split() (#76003)
Ilya [Thu, 29 Sep 2022 15:23:24 +0000 (20:23 +0500)]
Remove some extra static arrays used in Split() (#76003)

* Remove some extra static arrays used in Split
* Remove const

23 months agoFix using DependencyGraphViewer with AOT compilers (#76357)
Michal Strehovský [Thu, 29 Sep 2022 14:35:34 +0000 (23:35 +0900)]
Fix using DependencyGraphViewer with AOT compilers (#76357)

The `readonly` addition was one of the 3600 diffs in #74825. `MarkStrategy` can have mutable state that was getting lost because Roslyn considers it valid to put `_marker` into a temporary before calling instance methods on it.

This resulted in DependencyGraphViewer hanging after seeing tens of thousands of new graphs being added.

23 months agoFix value type with static method fails to load (#76262)
James S. Wang [Thu, 29 Sep 2022 14:18:09 +0000 (10:18 -0400)]
Fix value type with static method fails to load (#76262)

* Allow static methods if checking type equivalence

* Add test for loading value type with static method

* Add test in which loading a value type with an instance method should throw a TypeLoadException

23 months agoGenerate single interface dispatch map per canonical form (#76362)
Michal Strehovský [Thu, 29 Sep 2022 14:17:23 +0000 (23:17 +0900)]
Generate single interface dispatch map per canonical form (#76362)

The dispatch maps are identical because canonically-equivalent types have the same vtable layouts.

23 months agoMake KeysCollection.Contains methods public. (#76319)
Eirik Tsarpalis [Thu, 29 Sep 2022 14:05:52 +0000 (17:05 +0300)]
Make KeysCollection.Contains methods public. (#76319)

23 months agoBring back ReadOnlySpan in QuicStream (#76088)
Ilya [Thu, 29 Sep 2022 13:36:12 +0000 (18:36 +0500)]
Bring back ReadOnlySpan in QuicStream (#76088)

23 months agoIssue #75070 - Add PriorityQueue DequeueEnqueue Method (#75993)
Ryan Thomas [Thu, 29 Sep 2022 12:34:24 +0000 (07:34 -0500)]
Issue #75070 - Add PriorityQueue DequeueEnqueue Method (#75993)

* Issue #75070 - Add a DequeueEnqueue method to the System.Collections.Generic.PriorityQueue public api and unit test cases for the new method

* Issue #75070 - Remove unnecessary PriorityQueue DequeueEnqueue property test case and update DequeueEnqueue test assertion and xunit attribute

* Item #75070 - Revert the unnecessary name changes to the PriorityQueue.PropertyTests.cs test case method names

23 months agoReduce Enum.GetEnumName overheads (#76162)
Stephen Toub [Thu, 29 Sep 2022 11:37:41 +0000 (07:37 -0400)]
Reduce Enum.GetEnumName overheads (#76162)

* Reduce Enum.GetEnumName overheads

This also helps Enum.ToString(), Enum.IsDefined, etc.  Many enums are composed of sequential values starting at 0 (half of all enums in corelib, for example, meet this criteria).  Today when looking up a value, we search the array of values, but if an enum is known to have such sequential values, we can instead just index into the array at the appropriate location.

* Address PR feedback

23 months agoReduce allocations around empty ReadOnlyCollections (#76097)
Stephen Toub [Thu, 29 Sep 2022 11:37:10 +0000 (07:37 -0400)]
Reduce allocations around empty ReadOnlyCollections (#76097)

* Reduce allocations around empty ReadOnlyCollections

- Add an internal (for now) `ReadOnlyCollection<T>.Empty`
- Return the singleton `ReadOnlyCollection<T>.Empty` from `Array.AsReadOnly` when the source is empty
- Return a singleton empty enumerator from an empty `ReadOnlyCollection<T>`
- Fix up some reflection code to avoid unnecessary `ReadOnlyCollection<T>` allocations (e.g. just to wrap empty arrays)
- Fix a null reference bug in RuntimeCustomAttributeData.NamedArguments (I don't know if it's actually reachable, but this property shouldn't be returning null)
- Avoid a few unnecessary allocations in TimeZoneInfo.GetSystemTimeZones

* Address feedback, fix faulty tests, improve ConcurrentDictionary

* Fix reflection test expecting specific type for IList

* Address PR feedback

23 months ago[wasm] Update templates to work for multiple versions (#76124)
Ankit Jain [Thu, 29 Sep 2022 09:44:43 +0000 (05:44 -0400)]
[wasm] Update templates to work for multiple versions (#76124)

23 months agoFix distribute free regions (#74916)
Peter Sollich [Thu, 29 Sep 2022 09:09:01 +0000 (11:09 +0200)]
Fix distribute free regions (#74916)

As it turns out, distribute_free_regions does not do a very good job distributing free regions if there are fewer than the budget demands. There are several reasons:

- there is a bug in the adjustment_per_heap computation that causes the value to be too large - that is because dividing a negative number already rounds towards zero, and hence towards positive infinity, thus adding (n_heaps-1) before dividing is wrong.
- if the overall budget is not a multiple of the number of heaps, trying to fill each heap to the budget will allow heaps with higher numbers to have significant shortfalls.
- if the budget is not enough to cover the higher generations, heaps with high budget in these generations may cause other heaps to be unable to even cover their gen 0 budget.

The fix addresses these shortcomings:
- once we cover the budget for a generation, this is considered the minimum, higher generation budgets on other heaps are not allowed to reduce it below that minimum. So lower generations take priority, we are essentially trying to delay running out of budget as long as possible.
- we use a better algorithm to distribute a budget shortfall or surplus over all heaps. there is still a slight tendency for the last heap to receive fewer regions in the case of a shortfall.

23 months ago[wasm][debugger] Tests for static inherited members. (#75512)
Ilona Tomkowicz [Thu, 29 Sep 2022 08:56:31 +0000 (10:56 +0200)]
[wasm][debugger] Tests for static inherited members. (#75512)

* New tests: static inherited + fixed logic for them.

* Remove internal option after merge with main.

* Missing after-merge change.

Co-authored-by: Ankit Jain <radical@gmail.com>
23 months ago[mono] Fix missing defined and SIMD checks in Sqrt, Floor, Ceiling intrinsics (#76177)
Matous Kozak [Thu, 29 Sep 2022 08:15:54 +0000 (10:15 +0200)]
[mono] Fix missing defined and SIMD checks in Sqrt, Floor, Ceiling intrinsics (#76177)

* add missing defined

* SSE intrinsics check

* fix typo

* remove spaces

* add missing defined

* remove SSE and SSE2 checks

23 months ago[wasm] Templates nits (#76182)
Marek Fišera [Thu, 29 Sep 2022 07:42:19 +0000 (09:42 +0200)]
[wasm] Templates nits (#76182)

- Add template descriptions.
- Unify string quotes.

23 months ago[wasm] new unit test for duplicate call to ImportAsync (#76179)
Pavel Savara [Thu, 29 Sep 2022 07:17:19 +0000 (09:17 +0200)]
[wasm] new unit test for duplicate call to ImportAsync (#76179)

* new unit test

23 months ago[Mono] Implement eager finalization of WeakReference (#76173)
Filip Navara [Thu, 29 Sep 2022 07:06:28 +0000 (09:06 +0200)]
[Mono] Implement eager finalization of WeakReference (#76173)

* [Mono] Implement eager finalization of WeakReference

* Make the finalization really eager

* Move the eager finalization a bit earlier - to sgen_finalize_in_range  (PR suggestion)

Co-authored-by: vsadov <8218165+VSadov@users.noreply.github.com>
23 months agoFix not to create unnecessary `thread_params` (#76007)
Hyungju Lee [Thu, 29 Sep 2022 05:02:34 +0000 (14:02 +0900)]
Fix not to create unnecessary `thread_params` (#76007)

23 months agoAdding a debug only config knob for testing loop unrolling limits (#76288)
Tanner Gooding [Thu, 29 Sep 2022 04:28:21 +0000 (21:28 -0700)]
Adding a debug only config knob for testing loop unrolling limits (#76288)

* Adding a debug only config knob for testing loop unrolling limits

* Responding to PR feedback

* Fix a name

* Fixing the name of the JitConfig knob

* Apply formatting patch

23 months ago[Mono][Test]Disable failing iossimulator tests (#74889)
Nathan Ricci [Thu, 29 Sep 2022 02:21:18 +0000 (22:21 -0400)]
[Mono][Test]Disable failing iossimulator tests (#74889)

Disable Added failing ioosimulator tests.

23 months agoAdd List<T> AddRange, InsertRange, and CopyTo extensions for spans (#76274)
Stephen Toub [Thu, 29 Sep 2022 02:11:08 +0000 (22:11 -0400)]
Add List<T> AddRange, InsertRange, and CopyTo extensions for spans (#76274)

* Move CollectionExtensions to corelib

* Add CollectionExtensions.AddRange/InsertRange/CopyTo

* Update src/libraries/System.Private.CoreLib/src/System/Collections/Generic/CollectionExtensions.cs

Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>
* Update src/libraries/System.Private.CoreLib/src/System/Collections/Generic/CollectionExtensions.cs

Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>
Co-authored-by: Eirik Tsarpalis <eirik.tsarpalis@gmail.com>
23 months agoDispose of key when importing X.509 certificate from PEM
Kevin Jones [Thu, 29 Sep 2022 01:59:00 +0000 (21:59 -0400)]
Dispose of key when importing X.509 certificate from PEM

23 months agoAdd custom ResponseFile handler (#76271)
Adeel Mujahid [Thu, 29 Sep 2022 00:14:35 +0000 (03:14 +0300)]
Add custom ResponseFile handler (#76271)

* Add custom ResponseFile handler

* Move handler to helpers and use in CG2

* Strip leading and trailing quotes from value

Co-authored-by: Jon Sequeira <jonsequeira@gmail.com>
23 months agoFix DiagnosticSource to work with NativeAOT (#76109)
Eric Erhardt [Wed, 28 Sep 2022 21:30:44 +0000 (16:30 -0500)]
Fix DiagnosticSource to work with NativeAOT (#76109)

* Fix DiagnosticSource to work with NativeAOT

There were 2 problems:

1. The use of MakeGenericType doesn't work when a property is a ValueType.
An app will crash when a listener is enabled and DiagnosticSourceEventSource tries
writing values.
2. The properties on KeyValuePair were not being preserved correctly, so the Arguments
of the DiagnosticSourceEventSource methods were not being serialized correctly.

Add test (and infrastructure) to ensure DiagnosticSource works in a NativeAOT app

Fix #75945

* Enable new NativeAotTests in CI

- Only run them in Release configuration
- Suppress IL2026 warning

* Don't run NativeAot published app tests on OSX since it isn't supported

Set EventSourceSupport only on the projects that need it.

23 months ago[mono][interp] Replace sign extending moves to normal moves (#75837)
Vlad Brezae [Wed, 28 Sep 2022 21:08:11 +0000 (00:08 +0300)]
[mono][interp] Replace sign extending moves to normal moves (#75837)

* [mono][interp] Replace sign extending moves to normal moves

If the source var doesn't have its address taken. These opcodes are very frequent (even over 5%) and they cannot be optimized out and block copy propagation.

* [mono][interp] Add implicit conversions when returning short ints

* [mono][interp] Make sure ret.i4.imm correctly handles short int returns

23 months agoMore disasm check CI fixes (#76276)
Will Smith [Wed, 28 Sep 2022 21:07:01 +0000 (14:07 -0700)]
More disasm check CI fixes (#76276)

* More disasm check CI fixes

* Quick fix

* More fixes. Force failure.

* Update Runtime_34937.cs

23 months agoDon't run superpmi unit test if it appears a SPMI collection is in progress (#76311)
Bruce Forstall [Wed, 28 Sep 2022 21:03:32 +0000 (14:03 -0700)]
Don't run superpmi unit test if it appears a SPMI collection is in progress (#76311)

23 months agofix div by zero (#76294)
Maoni Stephens [Wed, 28 Sep 2022 20:40:05 +0000 (13:40 -0700)]
fix div by zero (#76294)

for regions generation size can be 0 since we don't have the gen start object anymore.

fixes #76257.

23 months agoReplace GetFile() with GetPEAssembly() call in gdb (#76293)
Anthony Shaw [Wed, 28 Sep 2022 18:40:13 +0000 (04:40 +1000)]
Replace GetFile() with GetPEAssembly() call in gdb (#76293)

Fixes #76291

23 months agoUse UTF8 encoding on Tar string fields (#75902)
David Cantú [Wed, 28 Sep 2022 18:39:44 +0000 (13:39 -0500)]
Use UTF8 encoding on Tar string fields (#75902)

* Use UTF8 encoding on Tar string fields

* Slice destination on Checksum

* Use Encoding.GetByteCount as fast path

* Use escape sequences on hardcoded UTF8 characters

* Fix ustar prefix logic and throw if name would be truncated

* Address feedback

* Fix truncation and prefix logic

* Fix nits

* Add async tests

* Add tests for unseekable streams

* Address feedback

23 months agoRemove duplicate length words from xmldoc (#76315)
Ken Dale [Wed, 28 Sep 2022 18:20:24 +0000 (14:20 -0400)]
Remove duplicate length words from xmldoc (#76315)

23 months agoAdd missing xml documentation (#76191)
Eirik Tsarpalis [Wed, 28 Sep 2022 17:57:48 +0000 (20:57 +0300)]
Add missing xml documentation (#76191)

23 months agoCache KeySizes array for EC types
Kevin Jones [Wed, 28 Sep 2022 15:03:11 +0000 (11:03 -0400)]
Cache KeySizes array for EC types

Individual KeySizes instances themselves are immutable, so we can re-use instances there.
Arrays are mutable, so continue to return a copy of the array each time.

23 months agoUpdate disasm-checks documentation (#76286)
Will Smith [Wed, 28 Sep 2022 14:51:36 +0000 (07:51 -0700)]
Update disasm-checks documentation (#76286)

* Update disasm-checks documentation with limitations and future improvements

* Include not about anchors

* Update disasm-checks.md

23 months agoAdd `$schema` to `cgmanifest.json` (#74933)
Jamie Magee [Wed, 28 Sep 2022 14:51:15 +0000 (07:51 -0700)]
Add `$schema` to `cgmanifest.json` (#74933)

Co-authored-by: Jamie Magee <jamie.magee@microsoft.com>
23 months agoGradual decommit in wks (#73620)
Peter Sollich [Wed, 28 Sep 2022 14:33:11 +0000 (16:33 +0200)]
Gradual decommit in wks (#73620)

* Initial version of gradual decommit for WKS.

This is the regions version modeled after the behavior of the segments version.

Idea is simply to limit the amount of decommitted memory based on the time since the last GC.

* Change decommit_step to take a step_milliseconds parameter - this makes the logic for the WKS decommit more straightforward.

* Only do decommits at most every 100 milliseconds to limit the number of decommitted regions.

* Address code review feedback: disable the logic in decommit_ephemeral_segment_pages for WKS, some changes in distribute_free_regions as a consequence.

* Remove unused static field ephemeral_elapsed.

* Fix typo in comment.

23 months agoUse existing variable for SpecialFolder.UserProfile (#76299)
Alexander Köplinger [Wed, 28 Sep 2022 14:28:21 +0000 (16:28 +0200)]
Use existing variable for SpecialFolder.UserProfile (#76299)

While looking at https://github.com/dotnet/runtime/pull/76250 I noticed that we were querying the HOME env variable for SpecialFolder.UserProfile but we're already doing that in PersistedFiles.GetHomeDirectory()

23 months agoFix #76260 Add nullable annotation to INumberBase<>.TryParse (#76272)
Michał Bryłka [Wed, 28 Sep 2022 14:17:26 +0000 (16:17 +0200)]
Fix #76260 Add nullable annotation to INumberBase<>.TryParse (#76272)

23 months agoMake "Personal" on Android also point to a Documents folder (#76250)
Miepee [Wed, 28 Sep 2022 11:19:50 +0000 (13:19 +0200)]
Make "Personal" on Android also point to a Documents folder (#76250)

#68610 moved `Personal`/`MyDocuments` on Unix systems from HOME to the documents folder.
However, it didn't do so for Android systems, which was only noticed after tests later failed. This fixes it.