platform/upstream/dotnet/runtime.git
3 years agoUpdate clrjit.natvis to cover GT_SIMD and GT_HWINTRINSIC (#53470)
Tanner Gooding [Sun, 30 May 2021 18:42:10 +0000 (11:42 -0700)]
Update clrjit.natvis to cover GT_SIMD and GT_HWINTRINSIC (#53470)

3 years agoremove WSL checks in tests (#53475)
Geoff Kizer [Sun, 30 May 2021 11:28:37 +0000 (04:28 -0700)]
remove WSL checks in tests (#53475)

Co-authored-by: Geoffrey Kizer <geoffrek@windows.microsoft.com>
3 years agoAlways spawn message loop thread for SystemEvents (#53467)
Stephen Toub [Sun, 30 May 2021 11:16:29 +0000 (07:16 -0400)]
Always spawn message loop thread for SystemEvents (#53467)

* Always spawn message loop thread for SystemEvents

* Update src/libraries/Microsoft.Win32.SystemEvents/tests/SystemEvents.InvokeOnEventsThread.cs

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
3 years agoadd AcceptAsync cancellation overloads (#53340)
Geoff Kizer [Sat, 29 May 2021 19:10:10 +0000 (12:10 -0700)]
add AcceptAsync cancellation overloads (#53340)

* add AcceptAsync cancellation overloads

* pass cancellationToken to AcceptAsync in Unix NamedPipe impl

* add TcpListener overloads too

* enable pipe cancellation test on Unix

Co-authored-by: Geoffrey Kizer <geoffrek@windows.microsoft.com>
3 years agoRemove unnecessary reference to iOS workload pack in the Mono workload (#53425)
Steve Pfister [Sat, 29 May 2021 16:16:02 +0000 (12:16 -0400)]
Remove unnecessary reference to iOS workload pack in the Mono workload (#53425)

The pack no longer exists and will cause an error when trying to import.

3 years agoAdd CookieContainer.GetAllCookies (#53441)
Stephen Toub [Sat, 29 May 2021 13:10:48 +0000 (09:10 -0400)]
Add CookieContainer.GetAllCookies (#53441)

3 years agoRemove DynamicallyAccessedMembers on JsonSerializer (#53235)
Eric Erhardt [Sat, 29 May 2021 01:55:56 +0000 (20:55 -0500)]
Remove DynamicallyAccessedMembers on JsonSerializer  (#53235)

* Remove DynamicallyAccessedMembers on JsonSerializer

Fix #52268

* Remove DynamicallyAccessedMembers from System.Net.Http.Json

These are no longer required since System.Text.Json doesn't have these annotations anymore.

* Update PreviousNetCoreApp baseline for attribute removal

* Fix trimming tests on browser-wasm

* Fix Json tests on EnableAggressiveTrimming leg

3 years ago[wasm] Re-enable Wasm.Build.Tests (#53433)
Ankit Jain [Sat, 29 May 2021 01:30:36 +0000 (21:30 -0400)]
[wasm] Re-enable Wasm.Build.Tests (#53433)

3 years ago[libraries] Move library tests Feature Switches defaults to Functional tests (#53253)
Mitchell Hwang [Sat, 29 May 2021 00:07:13 +0000 (20:07 -0400)]
[libraries] Move library tests Feature Switches defaults to Functional tests (#53253)

* [libraries] Remove UseSystemResourceKeys true default

* [libraries] Remove UseSystemResourceKeys for iOS

* [libraries] Resolve WebSockets System resource keys activeissue

* [tests] Move default feature switches from libraries to functional tests

* [tests] Move Browser wasm default switches into FuntionalTests scope

* Add Browser OS condition

* Move DefaultFeatureSwitches initialization to FunctionalTests project

* Consolidate trimming framework library features and condition for libraries with EnableAggressiveTrimming

* [testing][EAT] Revert trimming framework library features to browser defaults for enable aggressive trimming

* [tests] Add Xamarin Android, Xamarin Mac/iOS, and Wasm feature defaults to Functional tests

* Fixup tabs to spaces

* Add common feature switches, links, and cleanup

* Cleanup Xamarin Android link

Co-authored-by: Mitchell Hwang <mitchell.hwang@microsoft.com>
3 years agoFix SuperPMI collect with getIntConfigValue (#53442)
Bruce Forstall [Fri, 28 May 2021 23:47:12 +0000 (16:47 -0700)]
Fix SuperPMI collect with getIntConfigValue (#53442)

* Fix SuperPMI collect with getIntConfigValue

PR #52427 introduced a per-compilation call to getIntConfigValue
on "SuperPMIMethodContextNumber". This pseudo-config should not
be collected. It exposed a pre-existing multi-threading issue in
the superpmi collector shim. I got rid of the per-compilation
override of the jithost MethodContext, which is problematic, and
currently unneeded, but documented the considerations around collecting
per-compilation data.

Fixes #53440

* Update src/coreclr/ToolBox/superpmi/superpmi-shim-collector/jithost.cpp

Co-authored-by: Kunal Pathak <Kunal.Pathak@microsoft.com>
Co-authored-by: Kunal Pathak <Kunal.Pathak@microsoft.com>
3 years agoUse IsReferenceOrContainsReferences in ConcurrentQueue/Bag (#53438)
Stephen Toub [Fri, 28 May 2021 22:40:53 +0000 (18:40 -0400)]
Use IsReferenceOrContainsReferences in ConcurrentQueue/Bag (#53438)

3 years agoFix `Task.Delay()` `<exception>` XML comments (#53392)
James Thomson [Fri, 28 May 2021 22:01:40 +0000 (23:01 +0100)]
Fix `Task.Delay()` `<exception>` XML comments (#53392)

* Fix `Task.Delay()` `<exception>` XML comments

Fix `ObjectDisposedException` comments to state that the exception is
thrown when the `CancellationTokenSource` of the `CancellationToken` is
disposed, and not the `CancellationToken` itself.

* Use suggested message

Co-authored-by: Sam Harwell <sam@tunnelvisionlabs.com>
* Use suggested message

Co-authored-by: Sam Harwell <sam@tunnelvisionlabs.com>
3 years agoMerged PR 13255: [5.0 MSRC] Ensure that extracted bundle does not use preexisting...
Vladimir Sadov [Fri, 28 May 2021 21:57:37 +0000 (14:57 -0700)]
Merged PR 13255: [5.0 MSRC] Ensure that extracted bundle does not use preexisting files. (#53374)

Changed location of the extraction root directory on Unix:
-  from ` $TMPDIR\.net\ `     typical path is   ` \var\tmp\.net\userName\AppName\App.ID\stuff `
-  to  ` $HOME\.net\ `          typical path is   ` \home\userName\.net\AppName\App.ID\stuff `

3 years agoAdd new devirt reason. (#53334)
Andy Ayers [Fri, 28 May 2021 19:00:01 +0000 (12:00 -0700)]
Add new devirt reason. (#53334)

3 years agoEnable recently added Microsoft.CodeAnalysis.NetAnalyzers rules (#53158)
Stephen Toub [Fri, 28 May 2021 18:46:46 +0000 (14:46 -0400)]
Enable recently added Microsoft.CodeAnalysis.NetAnalyzers rules (#53158)

3 years agoFix GetLoadContextForDynamicAssembly GC Stress Fail (#53341)
Nikitin A. Kirill [Fri, 28 May 2021 18:42:44 +0000 (22:42 +0400)]
Fix GetLoadContextForDynamicAssembly GC Stress Fail (#53341)

3 years agoDo not assume about another half regrec (#53412)
Kunal Pathak [Fri, 28 May 2021 18:42:23 +0000 (11:42 -0700)]
Do not assume about another half regrec (#53412)

3 years agoFix #48579 (#49387)
Nikitin A. Kirill [Fri, 28 May 2021 18:42:08 +0000 (22:42 +0400)]
Fix #48579 (#49387)

3 years agoFix Time Zone Id Conversion with Lowercased Regions (#53315)
Tarek Mahmoud Sayed [Fri, 28 May 2021 17:46:02 +0000 (10:46 -0700)]
Fix Time Zone Id Conversion with Lowercased Regions (#53315)

Co-authored-by: Martin Costello <martin@martincostello.com>
3 years ago[main] Update dependencies from mono/linker (#53144)
dotnet-maestro[bot] [Fri, 28 May 2021 15:48:31 +0000 (15:48 +0000)]
[main] Update dependencies from mono/linker (#53144)

[main] Update dependencies from mono/linker

3 years agoConsole.Unix: fix, make CancelKeyPress work when input is redirected. (#52891)
Tom Deseyn [Fri, 28 May 2021 15:09:13 +0000 (17:09 +0200)]
Console.Unix: fix, make CancelKeyPress work when input is redirected. (#52891)

* Console.Unix: fix, make SIGINT work when input is redirected.

* Fix misplaced s_initialized assignment

3 years agoDisable flaky CodeDom tests (#53419)
Juan Hoyos [Fri, 28 May 2021 12:44:27 +0000 (05:44 -0700)]
Disable flaky CodeDom tests (#53419)

3 years agoUpgrading netcoreapp2.x and NCA3.0 to netcoreapp3.1 (#53358)
Viktor Hofer [Fri, 28 May 2021 11:11:03 +0000 (13:11 +0200)]
Upgrading netcoreapp2.x and NCA3.0 to netcoreapp3.1 (#53358)

Upgrading the netcoreapp2.x and netcoreapp3.0 build configurations in
projects to netcoreapp3.1 and cleaning up conditions so that future
tfm upgrades require less project file changes.

Adding NETStandardError markers to prevent available netstandard2.0
assets being picked instead, same as already done for System.Speech
and others.

For more details please see the reasoning in the linked issue.

Contributes to #53282

3 years agoWasm.Build.Tests should not use local targeting runtime pack, fixes #53405 (#53410)
Adam Sitnik [Fri, 28 May 2021 08:08:42 +0000 (10:08 +0200)]
Wasm.Build.Tests should not use local targeting runtime pack, fixes #53405 (#53410)

3 years ago[wasm][xharness] install development SSL certificate on Helix agent before xharness...
Pavel Savara [Fri, 28 May 2021 05:12:59 +0000 (07:12 +0200)]
[wasm][xharness] install development SSL certificate on Helix agent before xharness run via SDK or powershell (#53280)

Co-authored-by: Ankit Jain <radical@gmail.com>
Caused by #53180, #53225

- The original approach to install certificates didn't work because we don't have dotnet SDK, just runtime on Helix agents.
- dotnet dev-certs https needs user interaction with a dialog. Instead, using powershelgl to install certs
- Wasm.Build.Tests are being disabled here because of #53405

Fixes #53207

3 years agoExpose Array.Clear(Array) as public API (#53388)
Levi Broderick [Fri, 28 May 2021 04:08:53 +0000 (21:08 -0700)]
Expose Array.Clear(Array) as public API (#53388)

3 years agoUse HELIX_WORKITEM_UPLOAD_ROOT as the output dir (#53384)
Fan Yang [Fri, 28 May 2021 00:45:19 +0000 (20:45 -0400)]
Use HELIX_WORKITEM_UPLOAD_ROOT as the output dir (#53384)

3 years agoAddress the feedback left on the Introducing Metrics APIs PR (#53324)
Tarek Mahmoud Sayed [Fri, 28 May 2021 00:44:41 +0000 (17:44 -0700)]
Address the feedback left on the Introducing Metrics APIs PR (#53324)

3 years ago[main] Update dependencies from dotnet/runtime dotnet/arcade dotnet/icu dotnet/xharne...
dotnet-maestro[bot] [Fri, 28 May 2021 00:40:40 +0000 (20:40 -0400)]
[main] Update dependencies from dotnet/runtime dotnet/arcade dotnet/icu dotnet/xharness dotnet/runtime-assets dotnet/hotreload-utils (#53171)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Ankit Jain <radical@gmail.com>
Co-authored-by: David Wrighton <davidwr@microsoft.com>
3 years ago[wasm] Use rsp file for emcc default flags, and a props file instead of txt (#52941)
Ankit Jain [Fri, 28 May 2021 00:21:04 +0000 (20:21 -0400)]
[wasm] Use rsp file for emcc default flags, and a props file instead of txt (#52941)

Co-authored-by: Larry Ewing <lewing@microsoft.com>
`emcc-default.rsp`:
- this replaces `emcc-flags.txt` which was generated at wasm build time
  as the default set of flags.

`Emcc.props`:
- this replaces `emcc-version.txt` which was generated at wasm build
  time, and contained the output of `emcc --version`, eg:

  `emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 2.0.12 (d0e647bf266caad50943e78c9841e05e9c499a5d)`

- Instead of this, we now generate `Emcc.props`, which has:

    `$(RuntimeEmccVersionRaw)`  - full version string (`emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 2.0.12 (d0e647bf266caad50943e78c9841e05e9c499a5d)`)
    `$(RuntimeEmccVersion)`     - parsed version (`2.0.12`)
    `$(RuntimeEmccVersionHash)` - parsed hash (`d0e647bf266caad50943e78c9841e05e9c499a5d`)

- these might be useful for nugets with native libraries for use with
  wasm, for example

- Also, extracted `WasmApp.Native.targets` from `WasmApp.targets`

3 years agoShow PID when using debug attach flag with corerun (#53385)
Aaron Robinson [Fri, 28 May 2021 00:07:07 +0000 (17:07 -0700)]
Show PID when using debug attach flag with corerun (#53385)

3 years ago[Mono] Disable failing tests on Android (#53357)
Fan Yang [Fri, 28 May 2021 00:03:20 +0000 (20:03 -0400)]
[Mono] Disable failing tests on Android (#53357)

This PR contians change disabling 3 failing tests and one long running tests, which fails sporadically. Long running tests will be marked correctly via #53386

3 years agoMarshal.PtrToStructure fixes (#53360)
Jan Kotas [Thu, 27 May 2021 23:42:12 +0000 (16:42 -0700)]
Marshal.PtrToStructure fixes (#53360)

- Fix reflection annotations. PtrToStructure calls private constructors.
- Move PtrToStructure overload that creates objects to shared CoreLib.
- Fix Mono implementation to call private constructor.
- Fix Mono error handling to match CoreCLR.

3 years agoAdd root store directory fallback on Linux/Unix.
Jeremy Barton [Thu, 27 May 2021 21:47:21 +0000 (14:47 -0700)]
Add root store directory fallback on Linux/Unix.

When reading the root store directory for the first time, if
the read produced no data and the SSL_CERT_DIR environment
variable wasn't set, see if /etc/ssl/certs gives a different answer.

This change also changes the LastWriteTime model for caching
to not pin the symlink target on the first read, and support the
bundle file being a symlink (and the target being updated to
trigger refresh).

3 years agoRemove System.Text.Json's DynamicDependencies on Collections.Immutable (#53317)
Eric Erhardt [Thu, 27 May 2021 20:25:17 +0000 (15:25 -0500)]
Remove System.Text.Json's DynamicDependencies on Collections.Immutable (#53317)

This saves roughly 28 KB compressed in a default blazor wasm app.

Fix #53256

3 years agoCheck that 'lvDoNotEnregister' is set as necessary. (#52802)
Sergey Andreenko [Thu, 27 May 2021 20:20:11 +0000 (13:20 -0700)]
Check that 'lvDoNotEnregister' is set as necessary.  (#52802)

* add a repro test.

* LclVar which addresses are taken should be marked as doNotEnreg.

Check that we don't have independently promoted LCL_VAR that are references after lowering.
Check that all LclVars that have ADDR() on top of them are marked as doNotEnreg.

In the past when we did not enregister structs we were allocating them on the stack even without doNotEnreg set.

3 years agoRemove a failing unnecessary test (#53342)
Jakob Botsch Nielsen [Thu, 27 May 2021 19:20:59 +0000 (21:20 +0200)]
Remove a failing unnecessary test (#53342)

3 years agoArea owners fixes (#53377)
Immo Landwerth [Thu, 27 May 2021 19:11:46 +0000 (12:11 -0700)]
Area owners fixes (#53377)

* Fix indentation

* Fix casing

3 years agoDisable FileSystemWatcher_DirectorySymbolicLink_TargetsFile_Fails (#53368)
Jan Jahoda [Thu, 27 May 2021 18:05:35 +0000 (20:05 +0200)]
Disable FileSystemWatcher_DirectorySymbolicLink_TargetsFile_Fails (#53368)

3 years agoFix GC safety in mono_llvm_load_exceptions (). (#53318)
Zoltan Varga [Thu, 27 May 2021 12:57:19 +0000 (08:57 -0400)]
Fix GC safety in mono_llvm_load_exceptions (). (#53318)

3 years agoFold System.IO.FileSystem into CoreLib (#53231)
Adam Sitnik [Thu, 27 May 2021 10:56:30 +0000 (12:56 +0200)]
Fold System.IO.FileSystem into CoreLib (#53231)

* move Queue<T> to System.Private.CoreLib

* fold System.IO.FileSystem into System.Private.CoreLib

3 years agoAdd JSON source-gen mode that emits serialization logic (#53212)
Layomi Akinrinade [Thu, 27 May 2021 06:38:01 +0000 (02:38 -0400)]
Add JSON source-gen mode that emits serialization logic (#53212)

* Add JSON source-gen mode that emits serialization logic

* Fix System.Net.Http.Json test issues

* Fix System.Text.Json test issues

* Make check to determine if fast-path can be used more efficient

* Address review feedback

* Improve derived-JsonSerializerContext detection and support

* Address review feedback; reenable tests, and simplify object metadata
init

* Fix formatting

3 years agoRemove netframework assets older than net461 from builds and packaging (#53319)
Viktor Hofer [Thu, 27 May 2021 06:17:21 +0000 (08:17 +0200)]
Remove netframework assets older than net461 from builds and packaging (#53319)

Only a very few number of projects still built for net45-net46.
This PR trims out these assets from the build which of course
results in them not being packaged (as there is no harvesting
mechanism in the repository present anymore).

Suppressing the package warnings for the intentionally dropped
assets and cleaning up conditions in the project file as well.

For more details please see the reasoning in the linked issue.

Contributes to #53282

3 years agoimplement cancellation support for SendFileAsync and DisconnectAsync (#53062)
Geoff Kizer [Thu, 27 May 2021 05:58:37 +0000 (22:58 -0700)]
implement cancellation support for SendFileAsync and DisconnectAsync (#53062)

implement cancellation support for SendFileAsync and DisconnectAsync, and rework some internal async logic to support this and reduce code duplication

3 years agoUse Stopwatch.StartNew() in ImageAnimator (#53330)
Jeff Handley [Thu, 27 May 2021 05:00:23 +0000 (22:00 -0700)]
Use Stopwatch.StartNew() in ImageAnimator (#53330)

3 years agoAdd pgo testing to outerloop (#53301)
Andy Ayers [Thu, 27 May 2021 03:01:30 +0000 (20:01 -0700)]
Add pgo testing to outerloop (#53301)

Also update jit-experimental to no longer run PGO or EH WriteThru.

3 years agoRemove phi nodes during rationalize. (#53269)
Sergey Andreenko [Thu, 27 May 2021 02:24:01 +0000 (19:24 -0700)]
Remove phi nodes during rationalize. (#53269)

* Delete references to `GT_PHI_ARG/GT_PHI` after rat.

* Delete references after Rat.

* add check that we don't see them.

3 years agoRename superpmi tests collection names (#53108)
Kunal Pathak [Wed, 26 May 2021 23:58:20 +0000 (16:58 -0700)]
Rename superpmi tests collection names (#53108)

* Rename tests collection names

- Rename tests.pmi to coreclr_tests.pmi
- Rename tests_libraries.pmi to libraries_tests.pmi

* changes in superpmi.py

3 years agoAdd WebKit (javascriptcore) WASM runs (#53257)
Drew Scoggins [Wed, 26 May 2021 22:03:58 +0000 (15:03 -0700)]
Add WebKit (javascriptcore) WASM runs (#53257)

* Add javascript engine selection and runs

* Fixup runs

* Testing

* Fix spacing

* Change jsc to javascriptcore

* Remove testing comments

* Add back V8 runs

3 years agoBuild support for s390x: Fix a few paltests (#53288)
Ulrich Weigand [Wed, 26 May 2021 20:06:54 +0000 (22:06 +0200)]
Build support for s390x: Fix a few paltests (#53288)

* Accommodate platforms (like s390x) where the SIGSEGV fault address
  is only provided on a page granularity by the HW/OS

* All paltests now pass on s390x

3 years agoRemove NS1.x assets from building and packaging (#53283)
Viktor Hofer [Wed, 26 May 2021 19:51:12 +0000 (21:51 +0200)]
Remove NS1.x assets from building and packaging (#53283)

* Remove NS1.x assets from build and packaging

These ten projects still built for netstandard1.x. This PR
trims out these assets from both the build which also results
in them not being packaged anymore as there is no harvesting
mechanism in the repository anymore.

Suppressing the package warnings for the intentionally dropped
assets and cleaning up conditions in the project file as well.

For more details please see the reasoning in the linked issue.

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

3 years ago[main] Update dependencies from dnceng/internal/dotnet-optimization (#53222)
dotnet-maestro[bot] [Wed, 26 May 2021 19:39:37 +0000 (21:39 +0200)]
[main] Update dependencies from dnceng/internal/dotnet-optimization (#53222)

* Update dependencies from https://dev.azure.com/dnceng/internal/_git/dotnet-optimization build 20210524.6

optimization.linux-x64.MIBC.Runtime , optimization.windows_nt-x64.MIBC.Runtime , optimization.windows_nt-x86.MIBC.Runtime , optimization.PGO.CoreCLR
 From Version 1.0.0-prerelease.21273.4 -> To Version 1.0.0-prerelease.21274.6

* Update dependencies from https://dev.azure.com/dnceng/internal/_git/dotnet-optimization build 20210525.7

optimization.linux-x64.MIBC.Runtime , optimization.windows_nt-x64.MIBC.Runtime , optimization.windows_nt-x86.MIBC.Runtime , optimization.PGO.CoreCLR
 From Version 1.0.0-prerelease.21273.4 -> To Version 1.0.0-prerelease.21275.7

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
3 years agoUse literals instead of static readonly for HostFactoryResolver.cs (#53295)
Pranav K [Wed, 26 May 2021 18:33:58 +0000 (11:33 -0700)]
Use literals instead of static readonly for HostFactoryResolver.cs (#53295)

The type is internal + part of a source-only package, so there shouldn't be any harm in this change. Also lets us remove [a workaround](https://github.com/dotnet/aspnetcore/blob/main/.editorconfig#L100-L102) in the AspNetCore repo.

3 years agoUpdate XML comment for MetadataUpdateHandlerAttribute (#53262)
Stephen Toub [Wed, 26 May 2021 18:23:36 +0000 (14:23 -0400)]
Update XML comment for MetadataUpdateHandlerAttribute (#53262)

3 years ago"Fold overflow operations in value numbering" (second attempt after revert) (#51440)
SingleAccretion [Wed, 26 May 2021 18:17:23 +0000 (21:17 +0300)]
"Fold overflow operations in value numbering" (second attempt after revert) (#51440)

* Added a missing license header

* Added a test verifying that checked arithmetic is correct

* Added a test verifying that checked casts are correct

* Disabled the test for checked casts on Mono

* Refactored VNEvalShouldFold

* Refactored gtFoldExprConst to use helpers and follow the common code style

* Fixed the comment stating TYP_BYREF has no zero value

* Moved checking of overflow for arithmetic operations from gtFoldExprConst into a separate namespace

* Implemented folding of overflow arithmetic in value numbering

* Fixed some typos in valuenum.cpp/h

* Added identity-based evaluation for overflow arithmetic

* Made the definition of var_types a standalone header so that it can be safely #included'ed in utils.h

* Refactored gtFoldExpr some more, moved the overflow checking logic to CheckedOps, implemented overflow checking for floating point -> integer casts

* Implemented folding of checked casts in value numbering

* Demote the tests to Tier1

They throw and catch quite a few exceptions.

* Fixed a comment

UINT32 -> UINT64

* Made arithmetic CheckedOps functions templated

Reduces code duplication and obviates the need for
some conditions and casts.

They use the implementation from the Long* variants of
the old functions, except for "SubOverflows", where some
instantiations, unreachable at runtime, were using "size_t" as the
type argument and causing warnings. The relevant part of "AddOverflows"
has been inlined into "SubOverflows".

* Move the locals under "if" to avoid shadowing

* Use ClrSafeInt instead of custom code

* Fix a copy and paste mistake

Co-authored-by: Anton Lapounov <anton.lapounov@microsoft.com>
* Update src/coreclr/jit/utils.cpp

* Apply suggestions from code review

Co-authored-by: Anton Lapounov <anton.lapounov@microsoft.com>
* Assert type != TYP_BYREF in VNEvalShouldFold

The method is not prepared to handle them.
Also add a note about that to the header.
Also delete TODO-Review about it.

Right now the only caller of VNEvalShouldFold guards against
TYP_BYREF folding, so this assert is a safety measure against
future callers not taking byrefs into account.

* Drop the MAX_ prefix from MIN

Co-authored-by: Anton Lapounov <anton.lapounov@microsoft.com>
3 years agoFix devirtualization in shared generic context
David Wrighton [Wed, 26 May 2021 18:06:39 +0000 (11:06 -0700)]
Fix devirtualization in shared generic context

In circumstances where the JIT doesn't provide exact enough details about the impl type and interface method to identify exactly which method should be called

- In particular, when the impl class implements multiple copies of the target interface, and they are canonically compatible with the interface method that is to be called
- Simply disable devirtualization for these scenarios

Fixes #51982

3 years agoExpose the UseLocalTargetingRuntimePack property (#53290)
Viktor Hofer [Wed, 26 May 2021 17:57:04 +0000 (19:57 +0200)]
Expose the UseLocalTargetingRuntimePack property (#53290)

* Expose the UseLocalTargetingRuntimePack property

and use it in the Microsoft.NETCore.Platforms package to avoid a dependency on the live built targeting and runtime pack / shared framework.

* Update Microsoft.NETCore.Platforms.csproj

3 years agoAdd different pgo data runs (#52780)
Drew Scoggins [Wed, 26 May 2021 17:52:41 +0000 (10:52 -0700)]
Add different pgo data runs (#52780)

* Add different pgo data runs

* Fix if else formatting

* Update log artifact name

* Turn off failing tests for these runs

* Remove filter

* Fix config order

* Remove testing comments

3 years agoRemove -O=-float32 from Default AOT process arguments (#53209)
Steve Pfister [Wed, 26 May 2021 17:16:59 +0000 (13:16 -0400)]
Remove -O=-float32 from Default AOT process arguments (#53209)

Addresses https://github.com/dotnet/runtime/issues/51992

3 years agoMove Android x64 to normal pipeline (#53237)
Fan Yang [Wed, 26 May 2021 16:35:29 +0000 (12:35 -0400)]
Move Android x64 to normal pipeline (#53237)

3 years ago[QUIC] Handle connection abort in streams (#52776)
Natalia Kondratyeva [Wed, 26 May 2021 16:08:25 +0000 (18:08 +0200)]
[QUIC] Handle connection abort in streams (#52776)

This leverages newly added flag to SHUTDOWN_COMPLETED event, which means that's not a user-initiated stream shutdown, but a connection abort.

Fixes #32050

3 years agoJIT: pgo/devirt diagnostic improvements (#53247)
Andy Ayers [Wed, 26 May 2021 15:56:09 +0000 (08:56 -0700)]
JIT: pgo/devirt diagnostic improvements (#53247)

Several changes to help better diagnose PGO and devirtualization issues:
* Report the source of the PGO data to the jit
* Report the reason for a devirtualization failure to the jit
* Add checking mode that compares result of devirtualization to class profile
* Add reporting mode to assess overall rates of devirtualization failure
  when the jit has exact type information.

Also fix a loophole where in some case we'd still devirtualize if not
optimizing.

Note crossgen2 does not yet set devirtualization failure reasons.

3 years agoJIT into scratch buffer (#53173)
Jan Vorlicek [Wed, 26 May 2021 15:19:57 +0000 (17:19 +0200)]
JIT into scratch buffer (#53173)

* Generate JITted code into a scratch buffer

Copy it to the final location after the JITing is done.

* Put also the code header and real code header into the buffer

* Disable the scratch buffer usage until we enable W^X

3 years agoFix platform-specific substitutions (#53179)
Sven Boemer [Wed, 26 May 2021 15:00:22 +0000 (08:00 -0700)]
Fix platform-specific substitutions (#53179)

* These feature switches are dead code on non-windows. They were causing
linker warnings because the substitutions weren't being resolved.

See https://github.com/dotnet/sdk/pull/17676

* Fix condition

Check OS, not Platform. Use the same pattern as we do for other
Windows-specific XMLs.

3 years agoAllow watch of symbolic links to folders on Unix (#52679)
David Cantú [Wed, 26 May 2021 14:47:05 +0000 (09:47 -0500)]
Allow watch of symbolic links to folders on Unix (#52679)

* Allow watch of symbolic links to folders on Unix

* Add logic to repeat directory tests with symlinks

* Remove whitespace

Co-authored-by: Carlos Sanchez <1175054+carlossanlop@users.noreply.github.com>
* Avoid follow symlinks by default in subdirectories

* Add Symbolic Link tests

* Revert "Add logic to repeat directory tests with symlinks"

This reverts commit 5b44eb0195c2e5824ac375862765ea5a2cdeb0ad.

* Exclude test from win7 and 8.1

* Avoid running Process.Start in iOS, tvOS and MacCatalyst

* Apply suggestions from code review

Co-authored-by: Carlos Sanchez <1175054+carlossanlop@users.noreply.github.com>
Co-authored-by: Carlos Sanchez <1175054+carlossanlop@users.noreply.github.com>
3 years agoMono runtime dynamic component support. (#53221)
Johan Lorensson [Wed, 26 May 2021 14:10:44 +0000 (16:10 +0200)]
Mono runtime dynamic component support. (#53221)

3 years agoUpdate area owners to reflect current state (#53232)
Jeff Schwartz [Wed, 26 May 2021 14:00:30 +0000 (07:00 -0700)]
Update area owners to reflect current state (#53232)

3 years agoUpdate HttpClientFactory lead (#53270)
Karel Zikmund [Wed, 26 May 2021 13:57:48 +0000 (15:57 +0200)]
Update HttpClientFactory lead (#53270)

3 years agoDelete invalid assert in GetFileMuiPath (#53276)
Stephen Toub [Wed, 26 May 2021 13:57:31 +0000 (09:57 -0400)]
Delete invalid assert in GetFileMuiPath (#53276)

3 years agoFix FlushAsyncInternal when emitting BOM (#52812)
Gérald Barré [Wed, 26 May 2021 10:58:03 +0000 (06:58 -0400)]
Fix FlushAsyncInternal when emitting BOM (#52812)

* Fix FlushAsyncInternal when emitting BOM

Update StreamWriter.WriteTests.cs
Update StreamWriter.WriteTests.cs

* Remove temporary variable

3 years agoFix ActivityContext.TryParse null handling (#53265)
Stephen Toub [Wed, 26 May 2021 10:51:39 +0000 (06:51 -0400)]
Fix ActivityContext.TryParse null handling (#53265)

3 years agoMake String.{Try}CopyTo public (#53246)
Stephen Toub [Wed, 26 May 2021 10:51:21 +0000 (06:51 -0400)]
Make String.{Try}CopyTo public (#53246)

3 years agoGenerate targets files that throws for unsupported netstandard applicable tfms (...
Viktor Hofer [Wed, 26 May 2021 10:09:00 +0000 (12:09 +0200)]
Generate targets files that throws for unsupported netstandard applicable tfms (#53244)

* Generate targets files that throw for unsupported NS tfm

For S.D.Common, S.Speech and S.Sec.Crypto.Pkcs we manually added a
targets file to mark the .NETStandard asset as not applicable.
This was done to allow defining a minimum supported .NETCoreApp
version, even though a compatible .NETStandard asset is available.
This commit automatically generates that targets file based on
items.

3 years agoFix #53181. AssemblyLoadContext incorrectly validates name of dynamic assembly when...
Nikitin A. Kirill [Wed, 26 May 2021 07:46:28 +0000 (11:46 +0400)]
Fix #53181. AssemblyLoadContext incorrectly validates name of dynamic assembly when returned from Load (#53219)

See #53181

3 years agoRemove indirection in DependencyInjection (#52140)
Pavel Krymets [Wed, 26 May 2021 06:52:11 +0000 (23:52 -0700)]
Remove indirection in DependencyInjection (#52140)

- Remove indirection
- Get rid of scope state and lock on ResolvedServices
- Don't run customer code under the lock
- No public API changes

3 years agoDisable workload resolver until we support it (#53226)
Viktor Hofer [Wed, 26 May 2021 06:19:30 +0000 (08:19 +0200)]
Disable workload resolver until we support it (#53226)

Unblock Preview 4 SDK usage in the repo.

3 years agoSynchronize Metrics Events (#53204)
Tarek Mahmoud Sayed [Wed, 26 May 2021 05:09:43 +0000 (22:09 -0700)]
Synchronize Metrics Events (#53204)

3 years agoDelete some unused functions & one define (#53130)
SingleAccretion [Wed, 26 May 2021 02:44:12 +0000 (05:44 +0300)]
Delete some unused functions & one define (#53130)

3 years agoFix no struct promotion condition for long vars on 32bit platforms. (#53067)
Sergey Andreenko [Wed, 26 May 2021 02:36:32 +0000 (19:36 -0700)]
Fix no struct promotion condition for long vars on 32bit platforms. (#53067)

* fix a condition.

* Move `PromoteLongVars` to `DecomposeLongs`.

* response review

3 years agoRemoving unnecessary nowarns from trimming tests (#53251)
Jose Perez Rodriguez [Wed, 26 May 2021 01:02:27 +0000 (18:02 -0700)]
Removing unnecessary nowarns from trimming tests (#53251)

* Removing unnecessary nowarns from trimming tests

* Also change the way we mark managedassemblies to link

* Remove target and instead use TrimmerDefaultAction

* Adding the suppression of warnings from the linker

3 years agoFix a couple issues with Vector128.Get/WithElement (#52985)
Tanner Gooding [Tue, 25 May 2021 23:07:52 +0000 (16:07 -0700)]
Fix a couple issues with Vector128.Get/WithElement (#52985)

* Fix an issue with Vector128.WithElement around unused nodes for pre SSE4.1

* Fixing the expected exception for a structreturn test

* Ensure we check if the baseline SIMD ISAs are supported in morph

* Ensure TYP_SIMD12 LclVar can be cloned in lowering

* Fixing up the non SSE41 path for WithElement

* Applying formatting patch

* Ensure ReplaceWithLclVar lowers the created LclVar and assignment

* Don't check the JitLog for compiled methods when the baseline ISAs aren't supported

* Address PR feedback

* Responding to more PR feedback

* Applying formatting patch

* Fixing the more PR review feedback

3 years agoAddress post-merge feedback on TimeZoneInfo display names PR (#53229)
Stephen Toub [Tue, 25 May 2021 22:11:02 +0000 (18:11 -0400)]
Address post-merge feedback on TimeZoneInfo display names PR (#53229)

3 years agoUpdate interpolated string handler based on API reviews / LDM decisions (#53153)
Stephen Toub [Tue, 25 May 2021 21:50:49 +0000 (17:50 -0400)]
Update interpolated string handler based on API reviews / LDM decisions (#53153)

3 years agoFix JsonElement.ToString nullable annotation (#53243)
Stephen Toub [Tue, 25 May 2021 21:49:31 +0000 (17:49 -0400)]
Fix JsonElement.ToString nullable annotation (#53243)

3 years agoAdd PreAllocatedOverlapped.UnsafeCreate / UnsafeAllocateNativeOverlapped (#53196)
Stephen Toub [Tue, 25 May 2021 21:49:10 +0000 (17:49 -0400)]
Add PreAllocatedOverlapped.UnsafeCreate / UnsafeAllocateNativeOverlapped (#53196)

3 years agoAdd support for OpenBSD/arm64 (#53233)
monojenkins [Tue, 25 May 2021 21:24:40 +0000 (17:24 -0400)]
Add support for OpenBSD/arm64 (#53233)

There are three changes required to build mono on OpenBSD/arm64.

- The first one is to provide the UCONTEXT macros, which for OpenBSD simply map to sigcontext.
- Furthermore as stated in issue mono/mono#21005, https://github.com/mono/boringssl/compare/mono...bluerise:obsd is necessary for boringssl so that it can be built.
- And last, bdwgc needs to be patches as well: https://github.com/Unity-Technologies/bdwgc/pull/62

Co-authored-by: bluerise <bluerise@users.noreply.github.com>
3 years agoMaking singlefile apps work when wrapped in an OSX universal binary (#52997)
Vladimir Sadov [Tue, 25 May 2021 20:56:45 +0000 (13:56 -0700)]
Making singlefile apps work when wrapped in an OSX universal binary (#52997)

* singlefile support for universal binaries

* Update src/native/corehost/bundle/reader.h

Co-authored-by: Vitek Karas <vitek.karas@microsoft.com>
* tests for OSX universal apps

* Added a comment about testing strategy

Co-authored-by: Vitek Karas <vitek.karas@microsoft.com>
3 years ago[wasm] Improve exception handling measurements (#52846)
Radek Doulik [Tue, 25 May 2021 20:46:45 +0000 (22:46 +0200)]
[wasm] Improve exception handling measurements (#52846)

Add conditional throw to the leaf methods to avoid optimizing out the
exception handling code in `TryCatch` measurement.

Add new `NoExceptionHandling` measurement to measure case when no
exception handling is involved.

Example measurement, chrome/amd64:

| measurement | AOT | interp |
|-:|-:|-:|
|  Exceptions, NoExceptionHandling |     0.0164us |     0.0558us |
|             Exceptions, TryCatch |     0.1400us |     0.0592us |
|        Exceptions, TryCatchThrow |     0.0064ms |     0.0028ms |
|       Exceptions, TryCatchFilter |     0.4415us |     0.0645us |
| Exceptions, TryCatchFilterInline |     0.1263us |     0.0527us |
|   Json, non-ASCII text serialize |     1.4475ms |     8.6952ms |
| Json, non-ASCII text deserialize |     6.5332ms |    12.2220ms |
|            Json, small serialize |     0.2020ms |     0.2362ms |
|          Json, small deserialize |     0.2293ms |     0.3614ms |
|            Json, large serialize |    53.3021ms |    68.0000ms |
|          Json, large deserialize |    61.5176ms |   100.0377ms |

3 years agoEnable use of RuntimeVariant to exclude runtime tests (#51522)
Nathan Ricci [Tue, 25 May 2021 20:16:56 +0000 (16:16 -0400)]
Enable use of RuntimeVariant to exclude runtime tests (#51522)

Allow filtering of runtime tests based on runtimevariant.

3 years agoReduce DefaultPooledConnectionIdleTimeout default (#52687)
Stephen Halter [Tue, 25 May 2021 19:46:40 +0000 (12:46 -0700)]
Reduce DefaultPooledConnectionIdleTimeout default (#52687)

* Reduce DefaultPooledConnectionIdleTimeout default

- Change DefaultPooledConnectionIdleTimeout from 120 seconds to 60 seconds
- This should reduce the occurrence of socket errors when connected to IIS or Kestrel

3 years ago[wasm][testing] create dev cert via powershell on helix (#53225)
Pavel Savara [Tue, 25 May 2021 16:25:54 +0000 (18:25 +0200)]
[wasm][testing] create dev cert via powershell on helix (#53225)

create SSL dev cert via powershell on helix

3 years agoClosing opened handles to avoid resource leak. (#51950)
Artem Kliatchkine [Tue, 25 May 2021 16:11:50 +0000 (18:11 +0200)]
Closing opened handles to avoid resource leak. (#51950)

SymReader::InitializeFromFile opens file handles which were not closed causing resource leaks on each call.

Fix #50422

Co-authored-by: Artem Kliatchkine <eldog@rambler.ru>
3 years agoRemove unused code from old IJW path (#53190)
Elinor Fung [Tue, 25 May 2021 16:06:52 +0000 (09:06 -0700)]
Remove unused code from old IJW path (#53190)

3 years agoCleanup internal ComWrappers cache when object enters Finalization queue (#52771)
Aaron Robinson [Tue, 25 May 2021 15:15:39 +0000 (08:15 -0700)]
Cleanup internal ComWrappers cache when object enters Finalization queue (#52771)

* Clean up the ExternalObjectContext cache for ComWrappers' RCWs.

* Add testing for verifying internal cache clean up.

3 years agoIntegrate selected changes from nativeaot branch (#53185)
Jan Kotas [Tue, 25 May 2021 15:02:16 +0000 (08:02 -0700)]
Integrate selected changes from nativeaot branch (#53185)

- More code sharing for System.Exception
- Some support for default interface methods
- Move callling convention helpers around to avoid duplication
- Unify Environment.StackTrace

3 years ago[Android] Revert arm and arm64 device PR runs (#53210)
Steve Pfister [Tue, 25 May 2021 14:30:35 +0000 (10:30 -0400)]
[Android] Revert arm and arm64 device PR runs (#53210)

We're still having capacity issues even after doubling the number of devices.  Only run device tests on the rolling build for the time being.

Co-authored-by: Steve Pfister <steve.pfister@microsoft.com>
3 years agoDeterministic bundling issue 3601 (#52930)
Jan Krivanek [Tue, 25 May 2021 13:49:29 +0000 (15:49 +0200)]
Deterministic bundling issue 3601 (#52930)

https://github.com/dotnet/runtime/issues/3601
Bundling should generate id based on the content in order to secure unique but reproducible ids

3 years agoFix missing nullable enable in Microsoft.Extensions.Logging.Abstractions ref (#53199)
Stephen Toub [Tue, 25 May 2021 12:22:40 +0000 (08:22 -0400)]
Fix missing nullable enable in Microsoft.Extensions.Logging.Abstractions ref (#53199)

3 years agomake networking easier to debug with console (#53178)
Tomas Weinfurt [Tue, 25 May 2021 09:16:32 +0000 (11:16 +0200)]
make networking easier to debug with console (#53178)

3 years agoEmit JITStarting, MethodLoad, ModuleLoad and AssemblyLoad EventPipe events on Mono...
Johan Lorensson [Tue, 25 May 2021 08:32:44 +0000 (10:32 +0200)]
Emit JITStarting, MethodLoad, ModuleLoad and AssemblyLoad EventPipe events on Mono. (#53020)

* Add native JIT event into EventPipe.

* Emit module/assembly load native events into EventPipe.

* Emit MethodDCEnd_V1 and MethodILToNativeMap EventPipe events.