platform/upstream/dotnet/runtime.git
17 months agoAdd basic support for folding SIMD intrinsics (#81547)
Tanner Gooding [Sat, 11 Feb 2023 23:30:05 +0000 (15:30 -0800)]
Add basic support for folding SIMD intrinsics (#81547)

* Create a helper ValueNumStore::EvalHWIntrinsicFunBinary

* Adding some basic support for folding SIMD unary and binary operations

* Refactor SIMD constant folding logic to not depend on C++ 14

* Apply formatting patch

* Handle identity folding for simd add/sub

* Add some basic tests covering SIMD constant folding

* Move genTreeOps to its own header so simd.h can use it in Evaluate*Simd

* Applying formatting patch

17 months agoUse IndexOfAnyValues in another place in System.Text.Json (#81976)
Stephen Toub [Sat, 11 Feb 2023 17:46:38 +0000 (12:46 -0500)]
Use IndexOfAnyValues in another place in System.Text.Json (#81976)

17 months agoHandle renamed compressed .mibc files gracefully in crossgen2/dotnet-pgo (#81955)
Jakob Botsch Nielsen [Sat, 11 Feb 2023 12:14:55 +0000 (13:14 +0100)]
Handle renamed compressed .mibc files gracefully in crossgen2/dotnet-pgo (#81955)

The existing logic would throw a NullReferenceException if you renamed a
compressed .mibc file and then tried to pass it to dotnet-pgo or
crossgen2. This PR adds a fallback case to look for a single .dll file
inside the archive when an entry with the expected name is not present.

In addition throw an exception with a better error message when the
lookup fails.

17 months agoUpdate dependencies from https://github.com/dotnet/llvm-project build 20230210.1...
dotnet-maestro[bot] [Sat, 11 Feb 2023 10:42:07 +0000 (02:42 -0800)]
Update dependencies from https://github.com/dotnet/llvm-project build 20230210.1 (#81994)

runtime.linux-arm64.Microsoft.NETCore.Runtime.JIT.Tools , runtime.linux-arm64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk , runtime.linux-arm64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools , runtime.linux-arm64.Microsoft.NETCore.Runtime.ObjWriter , runtime.linux-musl-arm64.Microsoft.NETCore.Runtime.JIT.Tools , runtime.linux-musl-arm64.Microsoft.NETCore.Runtime.ObjWriter , runtime.linux-musl-x64.Microsoft.NETCore.Runtime.JIT.Tools , runtime.linux-musl-x64.Microsoft.NETCore.Runtime.ObjWriter , runtime.linux-x64.Microsoft.NETCore.Runtime.JIT.Tools , runtime.linux-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk , runtime.linux-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools , runtime.linux-x64.Microsoft.NETCore.Runtime.ObjWriter , runtime.osx-arm64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk , runtime.osx-arm64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools , runtime.osx-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk , runtime.osx-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools , runtime.win-arm64.Microsoft.NETCore.Runtime.JIT.Tools , runtime.win-arm64.Microsoft.NETCore.Runtime.ObjWriter , runtime.win-x64.Microsoft.NETCore.Runtime.JIT.Tools , runtime.win-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Sdk , runtime.win-x64.Microsoft.NETCore.Runtime.Mono.LLVM.Tools , runtime.win-x64.Microsoft.NETCore.Runtime.ObjWriter
 From Version 1.0.0-alpha.1.23106.1 -> To Version 14.0.0-alpha.1.23110.1

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
17 months agoDisable RTTI on Unix (#81986)
Adeel Mujahid [Sat, 11 Feb 2023 07:07:55 +0000 (09:07 +0200)]
Disable RTTI on Unix (#81986)

* Disable RTTI on Unix

* Fix gcc build

* Fix gcc 12.2 release build

17 months agoTransform IntCon(0) to VecCon(0) for WithElement case - fixes emitter assertion for...
Will Smith [Sat, 11 Feb 2023 04:30:46 +0000 (20:30 -0800)]
Transform IntCon(0) to VecCon(0) for WithElement case - fixes emitter assertion for crossgen2 (#81981)

* Transform IntCon(0) to VecCon(0) for WithElement case

* Formatting

17 months agoAdd additional case where public signing cannot be used (#77998)
Jeff Tyson [Sat, 11 Feb 2023 02:11:36 +0000 (02:11 +0000)]
Add additional case where public signing cannot be used (#77998)

17 months agoJIT: in minimal profiling mode, ignore impact of conditional throws (#81972)
Andy Ayers [Sat, 11 Feb 2023 01:50:45 +0000 (17:50 -0800)]
JIT: in minimal profiling mode, ignore impact of conditional throws (#81972)

Omit edge probes inspired by throw blocks, if a method can also return normally.
In reconstruction, we will just assume those throws never happen.

For simple methods this effectively reduces them to straight-line flow and we
can then omit all probes.

17 months agoTweak coreclr test build script (#81975)
Bruce Forstall [Fri, 10 Feb 2023 23:58:08 +0000 (16:58 -0700)]
Tweak coreclr test build script (#81975)

1. No longer use `-priority=1` syntax: use `-priority 1` instead.
It was already documented this way, and probably works both ways on
Windows because batch scripts "eat" the `=` sign sometimes.
2. Fix a YML script to not pass the `=`. This is probably unused code
currently because we build tests in CoreCLR on Linux.
3. Add a few more `%MsgPrefix%` output lines.

17 months agoDisable failing test (#81948)
Šimon Rozsíval [Fri, 10 Feb 2023 23:22:11 +0000 (00:22 +0100)]
Disable failing test (#81948)

17 months agoFix alloc-dealloc mismatches (#81928)
Jeremy Koritzinsky [Fri, 10 Feb 2023 22:45:48 +0000 (14:45 -0800)]
Fix alloc-dealloc mismatches (#81928)

17 months agoJIT: add option to use interlocked add for PGO edge count updates (#81934)
Andy Ayers [Fri, 10 Feb 2023 22:37:12 +0000 (14:37 -0800)]
JIT: add option to use interlocked add for PGO edge count updates (#81934)

Mainly intended for use in determining what is leading to some consistency issues
with our current edge profiles. We might consider enabling this in some of our
static PGO collections.

Enabled via JitInterlockedProfile=1.

17 months ago[wasm] Clean up, and consolidate `tests.wasm.targets`, `tests.wasi.targets`, and...
Ankit Jain [Fri, 10 Feb 2023 20:33:51 +0000 (15:33 -0500)]
[wasm] Clean up, and consolidate `tests.wasm.targets`, `tests.wasi.targets`, and `tests.browser.targets` (#81918)

* [wasm] Cleanup, and consolidate tests.w*targets

* Add runtime-wasm-optional to wasm-only list

* InstallWorkloadFromArtifacts: add parameter validation

17 months agoRemove extraneous output to console from our build. (#81925)
Jeremy Koritzinsky [Fri, 10 Feb 2023 19:44:05 +0000 (11:44 -0800)]
Remove extraneous output to console from our build. (#81925)

17 months agoFix the Mono part of #81600 (#81920)
Jo Shields [Fri, 10 Feb 2023 19:34:34 +0000 (14:34 -0500)]
Fix the Mono part of #81600 (#81920)

NativeVersion.rc was being built for the Mono .lib, but not used for the .exe, where it also needed to be included in the list of sources.

17 months agoAdd star into link attributes (#81407)
Tlakaelel Axayakatl Ceja [Fri, 10 Feb 2023 19:12:25 +0000 (11:12 -0800)]
Add star into link attributes (#81407)

One of the functionalities of the LinkAttributes files is to occurrences of custom attributes on the current assembly, on top of this functionality there is a special functionality that is only permitted if it's embedded in an XML inside the System.Private.CorLib module that allows the deletion of custom attributes from all the assemblies.
Given that NativeAOT is multithreaded it cannot process all the assemblies to remove attributes as ILLink does, it also does not have a shared storage in which it can store the information about the removed attributes from System.Private.CoreLib.
This PR adds logic to process the special functionality in the embedded System.Private.CoreLib XML every time an assembly is being processed.
In order to make this more performant, an extra argument is passed to the XML reader to only look at the assembly="*" to get the set of attributes that need to be deleted from all assemblies.

* Handle the star argument in LinkAttributes files for NativeAOT
* Minor fixes to print more warnings
* Add a way to only process star/nonstar assemblies in ProcessLinkerXmlBase
* Add smoke test

17 months agoFix ConcurrentDictionary test by rooting members accessed via reflection (#81957)
Stephen Toub [Fri, 10 Feb 2023 18:40:28 +0000 (13:40 -0500)]
Fix ConcurrentDictionary test by rooting members accessed via reflection (#81957)

17 months agoFix bug introduced by preventing unwind through stack bottom (#81956)
Jan Vorlicek [Fri, 10 Feb 2023 17:48:43 +0000 (18:48 +0100)]
Fix bug introduced by preventing unwind through stack bottom (#81956)

The irecent fix to prevent unwinding through stack bottom was
incorrect for secondary threads, as it just compared the SP
being above the frame of the hosting API. However, other threads
can have their stacks anywhere in the memory, thus this
sometimes broke exception handling on secondary threads.

I have also found that there was one more case where the
unwind through the hosting API need to be checked - the
Thread::VirtualUnwindToFirstManagedCallFrame.

I have decided to use the return address of the hosting
API for the checks instead of the frame address. That
makes the check work properly.

17 months ago[main] Update dependencies from dotnet/arcade (#81953)
dotnet-maestro[bot] [Fri, 10 Feb 2023 17:46:25 +0000 (12:46 -0500)]
[main] Update dependencies from dotnet/arcade (#81953)

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.23107.1 -> To Version 8.0.0-beta.23109.5

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
17 months ago[QUIC] Added tests to check IsSupported. (#81481)
Marie Píchová [Fri, 10 Feb 2023 17:08:43 +0000 (18:08 +0100)]
[QUIC] Added tests to check IsSupported. (#81481)

* Added tests to check IsSupported.

* Use find to locate msquic lib; Use ActiveIssue to skip win test on singlefile

* Strict test for Linux containers to check where we're missing libmsquic

* Updated readme

* Some more matrix testing of msquic presence

* Suppressed failing tests against failing containers

17 months agoApply jkotas's patch to fix race condition in AllocateManagedClassObject (#81947)
Egor Bogatov [Fri, 10 Feb 2023 16:58:51 +0000 (17:58 +0100)]
Apply jkotas's patch to fix race condition in AllocateManagedClassObject (#81947)

17 months agoFix major performance regression in legacy struct marshalling APIs (#81941)
Jan Kotas [Fri, 10 Feb 2023 16:57:30 +0000 (08:57 -0800)]
Fix major performance regression in legacy struct marshalling APIs (#81941)

* Fix major performance regression in legacy struct marshalling APIs

This change adds a simple cache for the marshalling stubs. This cache improves performance of the test mentioned in the issue by 20+x.

Fixes #45100

Co-authored-by: Aaron Robinson <arobins@microsoft.com>
17 months agoUpdate area-owners.md (#81958)
Marek Safar [Fri, 10 Feb 2023 16:27:31 +0000 (17:27 +0100)]
Update area-owners.md (#81958)

Co-authored-by: Theodore Tsirpanis <teo@tsirpanis.gr>
17 months ago[wasm] Reimplement jiterpreter float-to-int conversions (#81923)
Katelyn Gadd [Fri, 10 Feb 2023 16:24:45 +0000 (08:24 -0800)]
[wasm] Reimplement jiterpreter float-to-int conversions (#81923)

Reimplement float-to-int conversions in the jiterpreter by generating a series of conditional checks that match what clang does, in order to work around the wasm conversion opcode being unspecified for nan/inf.
Fix bug in jiterpreter instrumentation that would suppress the dumped module blob and error message if an unhandled error occurred while generating a block.
Fixes #81900

17 months agoFix `getMethodSig` for array methods (#81942)
Michal Strehovský [Fri, 10 Feb 2023 14:43:15 +0000 (23:43 +0900)]
Fix `getMethodSig` for array methods (#81942)

Found by JIT tests. This also affects crossgen2, wonder why we haven't seen it.

17 months ago[mono] Move mono.mscordbi subset off the offical build (#81917)
Steve Pfister [Fri, 10 Feb 2023 11:47:22 +0000 (06:47 -0500)]
[mono] Move mono.mscordbi subset off the offical build (#81917)

Co-authored-by: Steve Pfister <steve.pfister@microsoft.com>
17 months ago[main] Update dependencies from dotnet/roslyn-analyzers (#81885)
dotnet-maestro[bot] [Fri, 10 Feb 2023 11:45:39 +0000 (12:45 +0100)]
[main] Update dependencies from dotnet/roslyn-analyzers (#81885)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
17 months agoRemove contention from HandleHistogramProfileRand (#81932)
Egor Bogatov [Fri, 10 Feb 2023 11:28:13 +0000 (12:28 +0100)]
Remove contention from HandleHistogramProfileRand (#81932)

17 months agoJIT: Pick some low-hanging fruit in LSRA throughput (#81916)
Jakob Botsch Nielsen [Fri, 10 Feb 2023 10:14:34 +0000 (11:14 +0100)]
JIT: Pick some low-hanging fruit in LSRA throughput (#81916)

* Remove LinearScan::RegisterSelection::score

* Remove currentLocation from state

* Remove nextRefPos from state

* Remove rangeEndRefPosition

* Remove lastLocation

* Remove prevRegRec from state

* Remove unused field

* Reorder zero initialization

* Stop resetting foundRegBit

17 months agoMake DotNetBuildFromSource work in more cases. (#81480)
Tom Deseyn [Fri, 10 Feb 2023 10:03:07 +0000 (11:03 +0100)]
Make DotNetBuildFromSource work in more cases. (#81480)

* Make DotNetBuildFromSource work in more cases.

DotNetBuildFromSource is mostly used when this repository is built as part of source-build.

With these changes the flag works in more cases, making it easier to reproduce the
source-build behavior when building the runtime repository directly.

* Microsoft.NETCore.Platforms.Tests: use  for .NET Framwork.

* Remove redundant PortableBuild property.

* eng/SourceBuild.props: remove DotNetBuildFromSource defaults.

* PR feedback.

* Use a proper default RuntimeOS and OutputRid when DotNetBuildFromSource is true.

* SourceBuild.props: move KeepNativeSymbols to repo, remove BuildDepPackage.

* SourceBuild.props: add comment describing what properties go where.

17 months ago[Android] Enable two networking tests (#81895)
Šimon Rozsíval [Fri, 10 Feb 2023 09:24:50 +0000 (10:24 +0100)]
[Android] Enable two networking tests (#81895)

* Avoid crashing when AndroidCryptoNative_RegisterRemoteCertificateValidationCallback is called more than once

* Enable GetAsync_IPv6LinkLocalAddressUri_Success test on Android

* Enable supported cases of SslStream_ServerCallbackNotSet_UsesLocalCertificateSelection on Android

17 months agoFix. (#81879)
Ilona Tomkowicz [Fri, 10 Feb 2023 08:30:00 +0000 (09:30 +0100)]
Fix. (#81879)

17 months agoValidate the Kept attribute against the presence of EEType in NativeAOT (#81830)
Vitek Karas [Fri, 10 Feb 2023 08:29:04 +0000 (00:29 -0800)]
Validate the Kept attribute against the presence of EEType in NativeAOT (#81830)

Previously we validated the Kept on types against the presence of constructed EEType. But the compiler avoids constructed types as much as possible and the tests do use cases where the type in question is never instantiated (or fully static type). Validating against the presence of EEType (basically a method table) is much closer to the ILLink behavior which validates the presence of the type in IL metadata.

Fixes #80408

17 months agoFix compiler crashes for invalid IL sequences (#81940)
Michal Strehovský [Fri, 10 Feb 2023 08:15:47 +0000 (17:15 +0900)]
Fix compiler crashes for invalid IL sequences (#81940)

The JIT test tree has many tests that test invalid IL. We were crashing on some of them in optimized builds.

The problem is that optimized builds look at the program twice - first time when building whole program view, and second time for codegen. The whole program view building doesn't look at the IL in detail and doesn't need to detect invalid IL like "filter block that doesn't end with endfilter". At the same time, scanning phase must precompute the whole world, including situations when invalid code is going to be replaced by a call to a throw helper.

We were ending up in situations where the throw helper was not predicted and we didn't even know how the vtable of `InvalidProgramException` should look like (because it wasn't scanned). A simple fix is to always generate the helper. It's a bit of garbage 99% of time, but probably fine.

17 months agoChange the default createdump memory enumeration to the fast path (#81922)
Mike McLaughlin [Fri, 10 Feb 2023 05:54:38 +0000 (21:54 -0800)]
Change the default createdump memory enumeration to the fast path (#81922)

* Change the default createdump memory enumeration to the fast path

Also reduces the memory createdump uses generating a dump.

Setting DOTNET_EnableFastHeapDumps=0 opts out going back to the
slow/high memory usage generation.

Issue: https://github.com/dotnet/runtime/issues/72148

* Update src/coreclr/debug/createdump/crashinfo.cpp

Co-authored-by: Noah Falk <noahfalk@users.noreply.github.com>
---------

Co-authored-by: Noah Falk <noahfalk@users.noreply.github.com>
17 months agoRemove dead code (#81927)
Jeremy Koritzinsky [Fri, 10 Feb 2023 04:01:16 +0000 (20:01 -0800)]
Remove dead code (#81927)

17 months agoSet the last error in MAPMapPEFile when it fails (#81929)
Jeremy Koritzinsky [Fri, 10 Feb 2023 04:01:02 +0000 (20:01 -0800)]
Set the last error in MAPMapPEFile when it fails (#81929)

17 months agoDeclare CoreClrPgoDataArg variable in CI script (#80324)
Adeel Mujahid [Thu, 9 Feb 2023 23:32:54 +0000 (01:32 +0200)]
Declare CoreClrPgoDataArg variable in CI script (#80324)

Co-authored-by: Jeremy Koritzinsky <jkoritzinsky@gmail.com>
Co-authored-by: Jeremy Koritzinsky <jekoritz@microsoft.com>
17 months agoRemove a number of unnecessary intermediate allocations in JsonMetadataServices....
Eirik Tsarpalis [Thu, 9 Feb 2023 23:23:42 +0000 (23:23 +0000)]
Remove a number of unnecessary intermediate allocations in JsonMetadataServices. (#81903)

17 months ago[main] Update dependencies from dotnet/icu dotnet/xharness dotnet/emsdk dotnet/msquic...
dotnet-maestro[bot] [Thu, 9 Feb 2023 22:33:30 +0000 (16:33 -0600)]
[main] Update dependencies from dotnet/icu dotnet/xharness dotnet/emsdk dotnet/msquic (#81827)

* Update dependencies from https://github.com/dotnet/xharness build 20230208.1

Microsoft.DotNet.XHarness.CLI , Microsoft.DotNet.XHarness.TestRunners.Common , Microsoft.DotNet.XHarness.TestRunners.Xunit
 From Version 1.0.0-prerelease.23106.1 -> To Version 1.0.0-prerelease.23108.1

* Update dependencies from https://github.com/dotnet/emsdk build 20230207.2

Microsoft.NET.Workload.Emscripten.Current.Manifest-8.0.100-preview.2
 From Version 8.0.0-preview.2.23107.1 -> To Version 8.0.0-preview.2.23107.2

* Update dependencies from https://github.com/dotnet/msquic build 20230207.1

System.Net.MsQuic.Transport
 From Version 8.0.0-alpha.1.23106.6 -> To Version 8.0.0-alpha.1.23107.1

* Update dependencies from https://github.com/dotnet/emsdk build 20230208.1

Microsoft.NET.Workload.Emscripten.Current.Manifest-8.0.100-preview.2
 From Version 8.0.0-preview.2.23107.1 -> To Version 8.0.0-preview.2.23108.1

* Update dependencies from https://github.com/dotnet/icu build 20230208.2

Microsoft.NETCore.Runtime.ICU.Transport
 From Version 8.0.0-preview.2.23106.1 -> To Version 8.0.0-preview.2.23108.2

---------

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Ankit Jain <radical@gmail.com>
17 months ago[wasm] Optimize out redundant null checks in the jiterpreter (#81811)
Katelyn Gadd [Thu, 9 Feb 2023 22:24:28 +0000 (14:24 -0800)]
[wasm] Optimize out redundant null checks in the jiterpreter (#81811)

* Optimize out duplicate null checks in the jiterpreter
* Fix the last opcode of a jiterpreter trace sometimes executing again after the end of the trace

17 months agoDisable EnsureCleanEnvironment on wasm since it can't possibly work (#81893)
Katelyn Gadd [Thu, 9 Feb 2023 19:28:55 +0000 (11:28 -0800)]
Disable EnsureCleanEnvironment on wasm since it can't possibly work (#81893)

The related test is also skipped on CI thanks to https://github.com/dotnet/runtime/pull/81860

17 months agoAdd Host.CreateEmptyApplicationBuilder (#81728)
Eric Erhardt [Thu, 9 Feb 2023 18:59:14 +0000 (12:59 -0600)]
Add Host.CreateEmptyApplicationBuilder (#81728)

* Add Host.CreateEmptyApplicationBuilder

Introduce a way to create an "empty" HostApplicationBuilder that doesn't bring any optional/unnecessary dependencies into the app's closure. This has the same functional behavior as DisableDefaults=true while allowing for the unused code to be trimmed.

Also add CreateApplicationBuilder(HostApplicationBuilderSettings settings) overload to make the Host factory methods complete.

Fix #81280

17 months agoFix vector set_Item (#81898)
Radek Doulik [Thu, 9 Feb 2023 18:56:20 +0000 (19:56 +0100)]
Fix vector set_Item (#81898)

Store the xinsert result when needed.

Fixes `System.Numerics.Tests.Matrix4x4Tests.Matrix4x4IndexerSetTest`
test.

17 months agoCache copies of register sets and data that varies with AVX512 (#81868)
Bruce Forstall [Thu, 9 Feb 2023 18:43:05 +0000 (11:43 -0700)]
Cache copies of register sets and data that varies with AVX512 (#81868)

* Cache copies of register sets and data that varies with AVX512

1. Fix availableRegCount to only be stored in LSRA, where it is used.
2. Make copies of rbmAllFloat/rbmFltCalleeTrash to CodeGen and LSRA
classes during construction, so access is "closer", in case TP is
impacted. (This also makes it possible to define inline accessors in
the `emitter` class.)

* Fix initialization ordering

17 months ago[browser] improve asset loading (#81886)
Pavel Savara [Thu, 9 Feb 2023 18:39:48 +0000 (19:39 +0100)]
[browser] improve asset loading (#81886)

* new `enableDownloadRetry` configuration
* fix for actual_downloaded_assets_count assert in use case with `asset.pendingDownload`
* make `AssetEntry` mutable and pass it back to `downloadResource` API callback

Co-authored-by: Marek Fišera <mara@neptuo.com>
17 months agoFix AllocateRegularStaticBox for FOH (#81857)
Egor Bogatov [Thu, 9 Feb 2023 18:34:05 +0000 (19:34 +0100)]
Fix AllocateRegularStaticBox for FOH (#81857)

Co-authored-by: SingleAccretion <62474226+SingleAccretion@users.noreply.github.com>
17 months agoIntroduce insGroup/instrDesc backwards navigation (#80840)
Bruce Forstall [Thu, 9 Feb 2023 17:53:37 +0000 (10:53 -0700)]
Introduce insGroup/instrDesc backwards navigation (#80840)

* Introduce insGroup/instrDesc backwards navigation

Currently, it is only possible to walk forwards in insGroup/instrDesc
data: insGroup are in a single-linked list, and variable-sized
instrDesc are packed into a memory array where function `emitSizeOfInsDsc()`
can tell you the size of an instrDesc, and `emitAdvanceInstrDesc()`
can advance an `instrDesc*` forward, but there is no facility for
walking to the previous instrDesc.

This change introduces a `igPrev` pointer so the insGroup list is
doubly-linked. Also, each instrDesc is annotated with 4 or 5 bits of
data indicating how large the previous instruction in the buffer is,
so it is possible to find it by subtracting that size from a `instrDesc*`.
Also, each insGroup maintains an `igLastIns` pointer to the last instruction
in the group, to allow seeding the backwards walk.

The instrDesc backwards walk data is taken from the "small constant" area,
so some small constants get pushed to using larger instrDesc sizes.

Walking backwards is done using `emitGetLastIns()` to find the last
instruction in the function, and `emitPrevID()` to walk to the previous one.

This information is currently only used in the JitDump.

Basic measurement of the benchmarks SPMI collection showed about a 2.5% increase
in emitter memory usage.

* Fix one type

* Put code under EMIT_BACKWARDS_NAVIGATION define

* Disable backwards navigation

17 months ago[mono] Fix SIMD multiplication by scalar (#81888)
Radek Doulik [Thu, 9 Feb 2023 17:49:10 +0000 (18:49 +0100)]
[mono] Fix SIMD multiplication by scalar (#81888)

OP_XBINOP_BYSCALAR expects scalar as second argument.

Fixes `System.Numerics.Tests.GenericVectorTests.TestMultiplicationWithScalar<T>()`
tests.

17 months ago[JIT] X64 - Peephole optimization to skip emitting `movsxd` (#81721)
Will Smith [Thu, 9 Feb 2023 17:45:54 +0000 (09:45 -0800)]
[JIT] X64 - Peephole optimization to skip emitting `movsxd` (#81721)

* Allow GT_CAST for long to small types on 64bit

* Check unsigned

* Minor cleanup

* Added AreUpper32BitsSigned for peephole optimization

* Renamed to AreUpper32BitsFFFF. Simplified check.

* comments

* Formatting::

* Feedback. Added disasm test.

17 months agoXmlWriter respects NewLineOnAttributes when writing xmlns (#81822)
devsko [Thu, 9 Feb 2023 17:45:39 +0000 (18:45 +0100)]
XmlWriter respects NewLineOnAttributes when writing xmlns (#81822)

* XmlWriter respects NewLineOnAttributes when writing xmlns

* formatting

17 months agoJIT: Transform SELECT(relop, 1/0, 0/1) to relop (#81880)
Jakob Botsch Nielsen [Thu, 9 Feb 2023 17:30:00 +0000 (18:30 +0100)]
JIT: Transform SELECT(relop, 1/0, 0/1) to relop (#81880)

Fix #81479

17 months agoImprove ConcurrentDictionary performance, in particular for strings (#81557)
Stephen Toub [Thu, 9 Feb 2023 16:10:34 +0000 (11:10 -0500)]
Improve ConcurrentDictionary performance, in particular for strings (#81557)

* Improve ConcurrentDictionary performance, in particular for strings

- By default, string hash codes are randomized.  This is an important defense-in-depth security measure, but it also adds some overhead when strings are used as keys in dictionaries.  `Dictionary<>` addresses that overhead by starting out with using non-randomized comparers, and then upgrades to randomized comparers only once enough collisions have been detected. This PR updates `ConcurrentDictionary<>` with similar tricks.  The comparer is moved from being stored on the dictionary itself to instead be stored on the Tables object that's atomically swapped when the table grows; that way, the comparer always remains in sync with the hashcodes stored in the nodes in that table.  When we enumerate a bucket looking for an existing key as part of an add, we count how many items we traverse, and if that resulting number is larger than the allowed threshold and we're currently using a non-randomized comparer, we force a rehash; that rehash will replace the non-randomized comparer with the equivalent randomized one.
- The `ConcurrentDictionary<>` ctor is improved to presize based on the size of a collection being passed in; otherwise, it might resize multiple times as it's populating the dictionary.  The sizing logic is also changed to use the same prime bucket selection size as does `Dictionary<>`.
- The method we were using to compute the bucket for a key wasn't being inlined for reference type keys due to the generic context; that method has been moved to the outer type as a static to avoid the non-inlined call and extra generic dictionary lookup.
- For all key types, we were also paying for a non-inlined ldelema helper call when reading the head node of a bucket; that's been addressed via a struct wrapper with a volatile node field, rather than using Volatile.Read to access the array element.
- We were inconsistent in whether checked math was used in computing the size of the table.  In some situations it would be possible to overflow without it being detected, or for it to be detected and manifest in various ways.  This simplifies to just always use checked for computing the counts.
- Remove unnecessary try/finally blocks that are leftover from CERs and thread abort protection.
- Deduped some code with calls to helper functions.

* Address PR feedback

* Address PR feedback

* Address PR feedback

17 months agoEnable same set of analyzers for C# tools that are used by the repo (#81073)
Marek Safar [Thu, 9 Feb 2023 16:07:14 +0000 (17:07 +0100)]
Enable same set of analyzers for C# tools that are used by the repo (#81073)

Co-authored-by: Tlakaelel Axayakatl Ceja <tlakaelel.ceja@microsoft.com>
17 months agoFix a couple of JsonConstructor bugs & clean up JsonParameterInfo implementation...
Eirik Tsarpalis [Thu, 9 Feb 2023 15:37:47 +0000 (15:37 +0000)]
Fix a couple of JsonConstructor bugs & clean up JsonParameterInfo implementation. (#81842)

* Fix a couple of JsonConstructor bugs & clean up JsonParameterInfo implementation.

* add test coverage for ignored null values

* fix whitespace

17 months agoForce building of Mono manifest packages when building via source-build (#81790)
Jo Shields [Thu, 9 Feb 2023 13:41:04 +0000 (08:41 -0500)]
Force building of Mono manifest packages when building via source-build (#81790)

* We can't pass source-build properties externally, they need to come via locally defined properties.
* Indicate that we can consume emsdk manifest via source-build.

17 months agoFix vector's Narrow intrinsics (#81843)
Radek Doulik [Thu, 9 Feb 2023 12:40:40 +0000 (13:40 +0100)]
Fix vector's Narrow intrinsics (#81843)

The BCL Vector classes have non-saturating Narrow methods, while wasm instructions are saturating. AFAIK wasm does not have non-saturating narrow instructions. So instead of

    i8x16.narrow_i16x8_s
    i8x16.narrow_i16x8_u
    i16x8.narrow_i32x4_s
    i16x8.narrow_i32x4_u

use `v8x16.shuffle` instruction to implement the extract narrow operation.

This fixes `System.Numerics.Tests.GenericVectorTests.Narrow[U]Int*` tests.

17 months agohandle PDB files as asset type (#81828)
Pavel Savara [Thu, 9 Feb 2023 11:41:07 +0000 (12:41 +0100)]
handle PDB files as asset type (#81828)

17 months agoJIT: Support containing compares in GT_SELECT for xarch (i.e. start emitting cmov...
Jakob Botsch Nielsen [Thu, 9 Feb 2023 10:16:05 +0000 (11:16 +0100)]
JIT: Support containing compares in GT_SELECT for xarch (i.e. start emitting cmov instructions) (#81267)

This adds support for contained compares in GT_SELECT nodes for xarch.
As part of this, also enables if-conversion on xarch.

17 months agoFix range check in LdelemaRef (#81748)
Michal Strehovský [Thu, 9 Feb 2023 07:49:19 +0000 (16:49 +0900)]
Fix range check in LdelemaRef (#81748)

Also made `LdelemaRef` look closer to how it looks like on the CoreCLR-JIT side.

Found by Pri0 tests.

17 months agoRemove unused PHASE_COMPUTE_PREDS (#81863)
Bruce Forstall [Thu, 9 Feb 2023 04:27:10 +0000 (21:27 -0700)]
Remove unused PHASE_COMPUTE_PREDS (#81863)

17 months agoSkip `tracing/eventpipe/simpleprovidervalidation/` on wasm (#81860)
Ankit Jain [Thu, 9 Feb 2023 02:59:35 +0000 (21:59 -0500)]
Skip `tracing/eventpipe/simpleprovidervalidation/` on wasm (#81860)

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

17 months agoJIT: add concept of edge likelihood (#81738)
Andy Ayers [Thu, 9 Feb 2023 02:41:40 +0000 (18:41 -0800)]
JIT: add concept of edge likelihood (#81738)

Now that FlowEdges are created early and persist, decorate them with likelihood
information early, if we have edge-based PGO data.

We don't use the likelihood for anything yet, but I need to get it in circulation
so I can start working on refining both initial and subsequent consistency of
the data.

Also add a diagnostic checker for likelhood, and a way to enable it. All of
this is off by default.

17 months agoevaluate-default-paths.yml: Add paths for wasi (#81817)
Ankit Jain [Thu, 9 Feb 2023 01:20:08 +0000 (20:20 -0500)]
evaluate-default-paths.yml: Add paths for wasi (#81817)

* evaluate-default-paths.yml: Add paths for wasi

.. and exclude wasm specific paths from coreclr.

* disable runtime-wasm-optional automatic trigger for PRs

* CI: skip debugger tests on runtime-wasm if they run on runtime pipeline

.. too.

* fix condition

* address review feedback from @kg

* Fix yml issue

Using `Was?Runner*` failed to validate on azdo with:

`/eng/pipelines/common/evaluate-default-paths.yml (Line: 10, Col: 24): While parsing a flow sequence, did not find expected ',' or ']'.`

* fix syntax error in yml

17 months agoFix src/tests/build.sh argument processing (#81836)
Sven Boemer [Thu, 9 Feb 2023 00:12:10 +0000 (16:12 -0800)]
Fix src/tests/build.sh argument processing (#81836)

The logic to process test filter args isn't working correctly
because the `shift` happens inside a sourced script, and doesn't
actually shift the outer arguments. The right way to do this is
via `__ShiftArgs`.

Without this fix, `tree nativeaot` was working because
`nativeaot` happened to be a supported argument as well. With the
fix, other test subtrees work as expected.

17 months agoEnable AVX512 Additional 16 SIMD Registers (#79544)
anthonycanino [Wed, 8 Feb 2023 23:10:39 +0000 (15:10 -0800)]
Enable AVX512 Additional 16 SIMD Registers (#79544)

* Change regMask_enum and regMaskTP to unsigned __int64_t on AMD64.

This allows for more registers to be encoded in the register allocator.

* Add upper 16 SIMD registers to allocator.

Commit includes refactoring code to use `const instrDesc *` instead of `instruction`
so information about when EVEX is needed (due to high SIMD registers) is
available to the emitter.

* Limit high SIMD reg to compatible intrinsics lsra build.

* Limit high SIMD reg to compatible intrinsics lsra build.

* Limit high SIMD reg to compatible intrinsics and gentree nodes.

Commit constrains certain hw intrinsics and gentree nodes to use
lower SIMD registers even if upper SIMD registers are available due
to limitations of EVEX encoding for certain instructions.

For example, SSE `Reciprocal` lowers to `rcpps` which does not have an
EVEX encoding form, hence, we cannot allow that hw intrincis node to use
a high SIMD register.

These intrinsics are marked with `HW_Flag_NoEvexSemantics`. Other such
intructions related to masking (typically marked with
`HW_Flag_ReturnsPerElementMask`) also have similar issues (though they
can be replaced with the EVEX k registers and associated masking when
implemented).

In addition, the callee/calleer save registers have also been adjusted
to properly handle the presence and absence of AVX512 upper simd
registers at runtime.

* Fix for X86 throughput.

* Add upper simd stress test to the AVX512 testing pipeline.

* Formatting.

* Fix wrong-sized attr for simd mov instruction.

* Fix non-AMD64 LSRA stress mask.

* Update src/coreclr/jit/compiler.h

Co-authored-by: Bruce Forstall <brucefo@microsoft.com>
* Update src/coreclr/jit/compiler.cpp

Co-authored-by: Bruce Forstall <brucefo@microsoft.com>
* Update src/coreclr/jit/gentree.cpp

Co-authored-by: Bruce Forstall <brucefo@microsoft.com>
* Update src/coreclr/jit/hwintrinsic.h

Co-authored-by: Bruce Forstall <brucefo@microsoft.com>
* Update src/coreclr/jit/target.h

Co-authored-by: Bruce Forstall <brucefo@microsoft.com>
* Update src/coreclr/jit/emitxarch.cpp

Co-authored-by: Bruce Forstall <brucefo@microsoft.com>
* Remove unneeded vars

* Address PR comments.

* Allow `emitinl.h` access to the `rbm` variables.

* Replace RBM_LOWSIMD with `BuildEvexIncompatibleMask`.

* Move AVX512 dependent `targetamd.h` vars into compiler object.

* Fixing some edge cases for `targetamd.h` variables.

* Fix a merge/rebase bug.

* Update src/coreclr/jit/compiler.h

Co-authored-by: Bruce Forstall <brucefo@microsoft.com>
* Update src/coreclr/jit/lsra.cpp

Co-authored-by: Bruce Forstall <brucefo@microsoft.com>
* Update src/coreclr/jit/compiler.h

Co-authored-by: Bruce Forstall <brucefo@microsoft.com>
* Fix nits.

* Trying VM changes.

* VM hack.

* VM hack.

* Revert "VM hack."

This reverts commit 91cf3db9115e94ca1d759045fe4da6a496228cfc.

* Adjust ACTUAL_REG_COUNT based on availability of AVX512.

* Use inline accessor functions instead of macros

Convert from macros to accessor functions for
RBM_ALLFLOAT, RBM_FLT_CALLEE_TRASH, CNT_CALLEE_TRASH_FLOAT.
Convert LSRA use of ACTUAL_REG_COUNT to AVAILABLE_REG_COUNT,
and create an accessor for that value for AMD64 as well.

* Clearifying comments.

---------

Co-authored-by: Bruce Forstall <brucefo@microsoft.com>
Co-authored-by: Kunal Pathak <Kunal.Pathak@microsoft.com>
17 months agoRefine corerun instructions. Improve argument parsing in src/tests/build. (#81733)
Jeff Handley [Wed, 8 Feb 2023 21:41:21 +0000 (13:41 -0800)]
Refine corerun instructions. Improve argument parsing in src/tests/build. (#81733)

* Refine corerun instructions. Improve arg parsing in src/tests/build.

* Revert the libraries configuration default. Refine usage and docs.

* Exit argument processing at first unrecognized arg per existing pipeline usage

17 months agoAllow source-build to set UsingToolMicrosoftNetCompilers property (#81180)
Nikola Milosavljevic [Wed, 8 Feb 2023 21:08:50 +0000 (13:08 -0800)]
Allow source-build to set UsingToolMicrosoftNetCompilers property (#81180)

* Allow source-build to set UsingToolMicrosoftNetCompilers property

* Update condition to detect full source-build

17 months ago[Mono] Fix typo in arm64-codegen.h (#81845)
Fan Yang [Wed, 8 Feb 2023 20:58:22 +0000 (15:58 -0500)]
[Mono] Fix typo in arm64-codegen.h (#81845)

Remove extra `)`

17 months agoJIT: Handle promoted struct liveness updates in forward sub (#81789)
Jakob Botsch Nielsen [Wed, 8 Feb 2023 20:54:47 +0000 (21:54 +0100)]
JIT: Handle promoted struct liveness updates in forward sub (#81789)

This logic needed to be updated together with 7131ef9, without the
update we have a correctness bug.

The new correct and more precise unmarking also allows us to remove a
case from fgMakeOutgoingStructArgCopy. The case is covered by the
last-use optimization one now (specifically it was only happening for
some undone promotion cases).

17 months ago[main] Update dependencies from dotnet/arcade (#81634)
dotnet-maestro[bot] [Wed, 8 Feb 2023 20:20:01 +0000 (15:20 -0500)]
[main] Update dependencies from dotnet/arcade (#81634)

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

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.23102.4 -> To Version 8.0.0-beta.23103.1

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

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

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

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.23102.4 -> To Version 8.0.0-beta.23107.1

---------

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
17 months agodon't send server_name when literal IP (#81631)
Tomas Weinfurt [Wed, 8 Feb 2023 20:14:31 +0000 (12:14 -0800)]
don't send server_name when literal IP (#81631)

* don't send server_name when literal IP

* fix unit test

17 months agoSupport use of fast-path serialization in combined JsonSerializerContexts. (#80741)
Eirik Tsarpalis [Wed, 8 Feb 2023 19:44:45 +0000 (19:44 +0000)]
Support use of fast-path serialization in combined JsonSerializerContexts. (#80741)

* Support use of fast-path serialization in combined JsonSerializerContexts.

* Strengthen assertions in the nested JsonTypeInfo accessors.

17 months agoMinimally light up Quaternion and Plane for Mono SIMD (#81541)
Tanner Gooding [Wed, 8 Feb 2023 19:37:50 +0000 (11:37 -0800)]
Minimally light up Quaternion and Plane for Mono SIMD (#81541)

* Add support for Quaternion

* Add support for Plane

17 months agoEnsure CNS_VEC and BLK are handled for `setLclRelatedToSIMDIntrinsic` (#81760)
Tanner Gooding [Wed, 8 Feb 2023 19:09:09 +0000 (11:09 -0800)]
Ensure CNS_VEC and BLK are handled for `setLclRelatedToSIMDIntrinsic` (#81760)

17 months agoHandle crash when [out] parameter of type int is passed to delegate (#81276)
Giridhar Trivedi [Wed, 8 Feb 2023 16:45:44 +0000 (22:15 +0530)]
Handle crash when [out] parameter of type int is passed to delegate (#81276)

When a delegate is passed an [out] parameter of type "int" it will crash
since this data type is not handled in emit_managed_wrapper_ilgen.
This will lead to a crash. With this fix [out] parameter of type "int"
is handled after adding an addition case statement to handle MONO_TYPE_I
in emit_managed_wrapper_ilgen. Supporting UT is added.

Co-authored-by: Giridhar Trivedi <giridhar.trivedi@ibm.com>
17 months agoInitial work to port EventPipe library to NativeAOT (#80382)
Lakshan Fernando [Wed, 8 Feb 2023 15:55:57 +0000 (07:55 -0800)]
Initial work to port EventPipe library to NativeAOT (#80382)

* CoreCLR shim files renamed to AOT

* change coreclr references to aot

* Native AOT runtime implementation

* hooks to EP library from AOT

* Container code

* Maanged to Native hooks

* build artifacts

* required changes to NativeAOT to support EP

* changes to common EP source

* sample EventSource test app

* Add EventPipe lib to the linker

* Additional conditions to include the EventPipe library

* Fixing the Checked and Release and Linux builds

* separating maanged and native EventSource switches

* Update src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets

Co-authored-by: Michal Strehovský <MichalStrehovsky@users.noreply.github.com>
* FB, build break and test fixes

* fix non-windows build breaks and using paldebugbreak for TODOs

* trying another option to get arounf inttypes.h and PRIu64

* reverting the changes in ep-json file in common code

* Add an NativeAOT EventSource test

* FB and only enabling FEATURE_PERFTRACING in Windows

* fix DiagnosticEventSource test

* FB

* Update src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Windows.targets

Co-authored-by: Michal Strehovský <MichalStrehovsky@users.noreply.github.com>
* Added GuardCF version and a standalone test

* Moving NativeAOT headers away from EventPipe common code

* fix linux build break

* missed a needed definition in Linux

* inline eventpipe common source code

* Adding Evenpipe lib to a lib test

* Small cleanups

* Undo unnecessary changes
* Make sure runtime can build without FEATURE_PERFTRACING

* Fix linux build

---------

Co-authored-by: Michal Strehovský <MichalStrehovsky@users.noreply.github.com>
17 months agoJIT: Avoid omitting copies for struct fields passed implicitly byrefs (#81787)
Jakob Botsch Nielsen [Wed, 8 Feb 2023 15:38:24 +0000 (16:38 +0100)]
JIT: Avoid omitting copies for struct fields passed implicitly byrefs (#81787)

The code does not properly mark the parent struct as address exposed,
but also doing so would completely disable any tracking/optimization for
these locals which we do not want to do.

Fix #81739

17 months agoFix race condition when accessing nested JsonTypeInfo metadata (#81821)
Eirik Tsarpalis [Wed, 8 Feb 2023 14:10:17 +0000 (14:10 +0000)]
Fix race condition when accessing nested JsonTypeInfo metadata (#81821)

* Fix race condition when accessing nested JsonTypeInfo metadata

* Improve wording in comments.

* Remove DEBUG conditional

17 months ago[json] Use S.R.I vectors in JsonReaderHelper (#81758)
Radek Doulik [Wed, 8 Feb 2023 12:20:29 +0000 (13:20 +0100)]
[json] Use S.R.I vectors in JsonReaderHelper (#81758)

* [json] Use S.R.I vectors in JsonReaderHelper

wasm performance improvement

| measurement | new simd | old simd | nosimd |
|-:|-:|-:|-:|
|       Json, non-ASCII text deserialize |     0.4234ms |     0.4280ms |     0.4234ms |
|                Json, small deserialize |     0.0376ms |     0.0402ms |     0.0397ms |
|                Json, large deserialize |    10.4231ms |    11.1614ms |    11.0021ms |

microbenchmarks perf

    --filter *Text.Json*Read*
    summary:
    better: 170, geomean: 1.120
    worse: 15, geomean: 1.080
    total diff: 185

* Use SRI vectors only on net7 and later

17 months agoUpdate version of Microsoft.DotNet.ApiCompat.Task (#81772)
Viktor Hofer [Wed, 8 Feb 2023 10:48:55 +0000 (11:48 +0100)]
Update version of Microsoft.DotNet.ApiCompat.Task (#81772)

* Update version of Microsoft.DotNet.ApiCompat.Task

* Update Version.Details.xml

17 months agoSPMI: Warn when comparing throughput of JITs compiled with native PGO (#81716)
Jakob Botsch Nielsen [Wed, 8 Feb 2023 10:39:03 +0000 (11:39 +0100)]
SPMI: Warn when comparing throughput of JITs compiled with native PGO (#81716)

Fix #81690

17 months agoLocalized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 210773...
dotnet bot [Wed, 8 Feb 2023 08:07:32 +0000 (00:07 -0800)]
Localized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 2107735 (#81700)

* Localized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 2105824

* Localized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 2107383

* Localized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 2107383

17 months agoFix handling of the generic byreflike constraint (#81684)
Michal Strehovský [Wed, 8 Feb 2023 06:34:39 +0000 (15:34 +0900)]
Fix handling of the generic byreflike constraint (#81684)

Some support for NativeAOT was written in #67783 but the test didn't actually pass because of these missing pieces.

17 months ago[wasm] Pin the version of chrome used for tests - `109.0.5414.119` (#81814)
Ankit Jain [Wed, 8 Feb 2023 06:12:15 +0000 (01:12 -0500)]
[wasm] Pin the version of chrome used for tests - `109.0.5414.119` (#81814)

* [wasm] Pin the version of chrome used for tests

Related: https://github.com/dotnet/runtime/issues/81792

The debugger tests are breaking with the latest stable chrome version
`110.0.5481.77`. As a temporary workaround to keep the CI green, pin the
version to the previous working one.

* fix windows url

17 months ago[mono][aot] Optimize constrained calls made from gsharedvt methods. (#79339)
Zoltan Varga [Wed, 8 Feb 2023 04:01:29 +0000 (23:01 -0500)]
[mono][aot] Optimize constrained calls made from gsharedvt methods. (#79339)

The calls are of the form:
.constrained T_GSHAREDVT
callvirt <method>

Whenever T_GSHAREDVT is a reference or value type is only known at runtime.

Previously these were handled by passing the arguments to a JIT icall which
computed the target method and did a runtime invoke.

Added 2 optimizations:
* Precompute the data which depends only on the type and the method,
  store it in an rgctx slot and pass it to the JIT icall.
* Add a fastpath for simpler cases which makes an indirect call
  from generated code.

17 months agoAdd an optimized C implementation of STFLD_O that uses the correct kind of write...
Katelyn Gadd [Wed, 8 Feb 2023 03:54:38 +0000 (19:54 -0800)]
Add an optimized C implementation of STFLD_O that uses the correct kind of write barrier (#81806)

This PR moves most of the jiterpreter's STFLD_O implementation into a C function that is responsible for also doing the null check. As a bonus that function is able to use the correct kind of write barrier (though it's not clear to me whether the previous one was broken in any way).

17 months ago[main] Update dependencies from dotnet/cecil (#81756)
dotnet-maestro[bot] [Wed, 8 Feb 2023 01:43:43 +0000 (17:43 -0800)]
[main] Update dependencies from dotnet/cecil (#81756)

* Update dependencies from https://github.com/dotnet/cecil build 20230206.4

Microsoft.DotNet.Cecil
 From Version 0.11.4-alpha.23080.1 -> To Version 0.11.4-alpha.23106.4

* Remove Microsoft.DotNet.Cecil.Pdb from being referenced since it now is part of Microsoft.DotNet.Cecil package

---------

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Tlakollo <tlcejava@microsoft.com>
17 months agoPrevent unwinding through stack bottom (#81770)
Jan Vorlicek [Wed, 8 Feb 2023 00:47:32 +0000 (01:47 +0100)]
Prevent unwinding through stack bottom (#81770)

When processing unhandled exception on the most recent Alpine 3.17,
the libunwind doesn't stop at the bottom
frame of the main thread (the caller of `main`) and tries to unwind
further. The reason is that the method is missing dwarf unwind
information, so the libunwind falls back to using RBP chain, but the RBP
points to a garbage and so it ends up crashing with SIGSEGV.

While the missing DWARF unwind info seems to be a bug in the Alpine 3.17
(older ones work fine), we can prevent issues like this by stopping at
the hosting API boundary and not trying to unwind past that. This is
what this PR does.

17 months ago[Jiterpreter] Add support for TryGetHashCode intrinsic (#81644)
Austin Wise [Tue, 7 Feb 2023 23:50:01 +0000 (15:50 -0800)]
[Jiterpreter] Add support for TryGetHashCode intrinsic (#81644)

#80520 added support in the Jiterpreter for the intrinsic that underlies RuntimeHelpers.GetHashCode. This PR adds similar support for the intrinsic that underlies RuntimeHelpers.TryGetHashCode.

For reference RuntimeHelpers.TryGetHashCode was added in #80059. It is currently only used in ConditionalWeakTable.TryGetValue.

17 months agoBaseline most of the Pri0 test suite (#81685)
Michal Strehovský [Tue, 7 Feb 2023 23:48:09 +0000 (08:48 +0900)]
Baseline most of the Pri0 test suite (#81685)

I made a pass over all Pri0 tests except the JIT directory.

17 months agoRevert "Fix generic parameter data flow validation in NativeAOT (#81532)" (#81783)
Vitek Karas [Tue, 7 Feb 2023 23:23:05 +0000 (15:23 -0800)]
Revert "Fix generic parameter data flow validation in NativeAOT (#81532)" (#81783)

This reverts commit e71a4fb10d7ea6b502dd5efe7a8fcefa2b9c1550.

17 months agoFix condition for module registration export (#81765)
Adeel Mujahid [Tue, 7 Feb 2023 23:14:12 +0000 (01:14 +0200)]
Fix condition for module registration export (#81765)

* FIx condition for module registration export

* Typo

17 months agoFix two compilation constants for .NET 8 (#81775)
Stephen Toub [Tue, 7 Feb 2023 22:47:28 +0000 (17:47 -0500)]
Fix two compilation constants for .NET 8 (#81775)

17 months agoEnableAotAnalyzer for System.Diagnostics.EventLog (#81724)
Eric Erhardt [Tue, 7 Feb 2023 22:28:15 +0000 (16:28 -0600)]
EnableAotAnalyzer for System.Diagnostics.EventLog (#81724)

* EnableAotAnalyzer for System.Diagnostics.EventLog

Contributes to #75480

* EnableAotAnalyzer for System.Diagnostics.PerformanceCounters

* Avoid boxing T.

17 months agoFix EncodingExtensions.Convert for sliced single segment ROSequence (#81665)
devsko [Tue, 7 Feb 2023 21:39:47 +0000 (22:39 +0100)]
Fix EncodingExtensions.Convert for sliced single segment ROSequence (#81665)

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

17 months agoUse MiniDumpWriteDump to create dumps on Windows (#81509)
Jeremy Koritzinsky [Tue, 7 Feb 2023 21:19:13 +0000 (13:19 -0800)]
Use MiniDumpWriteDump to create dumps on Windows (#81509)

17 months agoImprove CI path-changes-based-triggers to work better (#79127)
Ankit Jain [Tue, 7 Feb 2023 20:49:22 +0000 (15:49 -0500)]
Improve CI path-changes-based-triggers to work better (#79127)

 ## Background:

`eng/pipelines/common/evaluate-default-paths.yml` is used to specify named subsets of paths, and `evaluate-changed-paths.sh` decides which subsets have "changed files". And these subsets are used in conditions for the various jobs to determine when they should be run.

---
`evaluate-changed-paths.sh: Add support for include+exclude combined`

 ## Problem

This script currently supports `--include`, and `--exclude`
parameters to determine if we have any changed paths.

```
Scenarios:
1. exclude paths are specified
    Will include all paths except the ones in the exclude list.
2. include paths are specified
    Will only include paths specified in the list.
1st we evaluate changes for all paths except ones in excluded list. If we can not find
any applicable changes like that, then we evaluate changes for included paths
if any of these two finds changes, then a variable will be set to true.
```

As described above, these two are evaluated exclusively.
For example:

```
include: [ '/a/b/*' ], exclude: [ '/a/b/d.txt' ]
```

- This would return true if there are changes:
  - `[ '/a/b/c.txt' ]` - caught by `include`
  - or `[ '/r/s.txt' ]` - caught by `exclude`

- but it would also return true for `[ '/a/b/d.txt' ]` because `include`
does not consider the `exclude` list.

 ## Solution:

- This commit adds a new `--combined` parameter which essentially supports
`$include - $exclude`. Thus allowing exact more constrained path
specification.

- It is passed in addition to `include`, and `exclude`.

Given:
```
include: [ '/a/b/*' ], exclude: [ '/a/b/d.txt' ]
```

- For the following path changes:
  - `[ '/a/b/c.txt' ]` - `true`
  - `[ '/r/s.txt' ]` - `false` because this does not fall in
    `$include - $exclude`
  - `[ '/a/b/d.txt' ]` - `false` - excluded in `$include - $exclude`

The implementation is trivially implemented by passing both the lists to
`git diff` which supports this already.

---

- Track subset name changes in the ymls
- Update `wasm` jobs to have tighter trigger conditions

- This results in wasm specific changes only triggering relevant wasm jobs. For example, if there are wasm debugger changes then only the wasm debugger jobs will be triggered. Or if there are only workload manifest[1] changes then Wasm.Build.Tests will be triggered only.

17 months ago[wasm][debug] Avoid pausing on breakpoint while invoking methods. (#81162)
Thays Grazia [Tue, 7 Feb 2023 20:17:02 +0000 (17:17 -0300)]
[wasm][debug] Avoid pausing on breakpoint while invoking methods. (#81162)

* Trying to avoid pausing on breakpoint while invoking methods.

* Adding test case for it as discussed with @radical offline.

* Creating new tests and fixing its behavior.

* Addressing @radical comments offline.

* same behavior for stepping, disable global_stepping while evaluating expression.

* Renaming function as suggested by @radical

17 months agolibnuma-dev (#81764)
Marie Píchová [Tue, 7 Feb 2023 19:52:36 +0000 (20:52 +0100)]
libnuma-dev (#81764)

Fix #81706