platform/upstream/dotnet/runtime.git
17 months agoPass resource item to workload task (#85264)
Jacques Eloff [Mon, 24 Apr 2023 23:32:16 +0000 (16:32 -0700)]
Pass resource item to workload task (#85264)

17 months agoAdd exceptions to TAR extended attribute constructors to disallow '=' and '\n' charac...
Carlos Sánchez López [Mon, 24 Apr 2023 23:24:29 +0000 (16:24 -0700)]
Add exceptions to TAR extended attribute constructors to disallow '=' and '\n' characters in keys and values. (#82812)

* Prevent adding extended attribute keys containing '=', '\n', or values containing '\n'.

* Add tests to verify that the PaxTarEntry and PaxGlobalExtendedAttributesTarEntry constructors that take an extended attributes dictionary, throw when a disallowed character is found.

* Apply CR suggestions

* Use enumerator to iterate items in the specified enumeration, and insert them to the lazily created dictionary if they pass the validations.

* Change IndexOf with Contains

---------

Co-authored-by: carlossanlop <carlossanlop@users.noreply.github.com>
17 months agoJIT: Move some BasicBlock methods into block.cpp (#85224)
Andy Ayers [Mon, 24 Apr 2023 22:48:17 +0000 (15:48 -0700)]
JIT: Move some BasicBlock methods into block.cpp (#85224)

Collect up a few `BasicBlock` methods that were scattered about in other files.

17 months agoUse double VectorTableLookup on ARM in ProbabilisticMap (#85189)
Miha Zupan [Mon, 24 Apr 2023 22:33:45 +0000 (00:33 +0200)]
Use double VectorTableLookup on ARM in ProbabilisticMap (#85189)

* Avoid scalar fallback for logical right shift on Arm

* Use double VectorTableLookup on ARM in ProbabilisticMap

* Revert 3bfd7d3f82c8256c2d7d7ce9371de679d961df96

17 months agoSkip covariant checks for ldelema T[] with T exact
Egor Bogatov [Mon, 24 Apr 2023 21:27:15 +0000 (23:27 +0200)]
Skip covariant checks for ldelema T[] with T exact

17 months ago[browser] Enable threads in Wasm SDK (#85109)
Marek Fišera [Mon, 24 Apr 2023 19:54:29 +0000 (21:54 +0200)]
[browser] Enable threads in Wasm SDK (#85109)

Co-authored-by: Aleksey Kliger (λgeek) <akliger@gmail.com>
17 months agoAdd metadata update for overrides (#85182)
Fan Yang [Mon, 24 Apr 2023 19:52:25 +0000 (15:52 -0400)]
Add metadata update for overrides (#85182)

17 months agoOptimize >>> to ShiftRightLogical on arm64 (#85258)
Egor Bogatov [Mon, 24 Apr 2023 19:35:38 +0000 (21:35 +0200)]
Optimize >>> to ShiftRightLogical on arm64 (#85258)

17 months agoAdding TimeProvider CreateCancellationTokenSource extension method (#85131)
Tarek Mahmoud Sayed [Mon, 24 Apr 2023 18:47:16 +0000 (11:47 -0700)]
Adding TimeProvider CreateCancellationTokenSource extension method (#85131)

17 months agoFix superpmi.py to not cache local MCH files (#85187)
Bruce Forstall [Mon, 24 Apr 2023 18:11:43 +0000 (11:11 -0700)]
Fix superpmi.py to not cache local MCH files (#85187)

When an MCH file is specified via the `-mch_file` argument,
if that file is local (not on a UNC Windows share, on Windows),
then don't copy it to the MCH file cache.

This behavior -- to avoid caching local files -- was altered
with https://github.com/dotnet/runtime/pull/56871, but it's
not clear from that PR if it was required for something or
was something used for testing that wasn't reverted before merge.
I'm guessing the latter since the code was simply commented out.

17 months agoExpose AVX512 variants of AVX, AVX2, and FMA instructions (#85228)
Tanner Gooding [Mon, 24 Apr 2023 18:08:17 +0000 (11:08 -0700)]
Expose AVX512 variants of AVX, AVX2, and FMA instructions (#85228)

* Expose various Broadcast methods for Avx512F, Avx512BW, and Avx512DQ

* Expose ExtractVector128/256 and InsertVector128/256 methods for Avx512F and Avx512DQ

* Expose ShiftLeftLogicalVariable, ShiftRightArithmeticVariable, and ShiftRightLogicalVariable on Avx512F and Avx512BW

* Expose various FusedMultiplyAdd APIs for Avx512F

* Expose various Permute intrinsics for Avx512F, Avx512F.VL, Avx512BW, and Avx512BW.VL

* Add a cpuid check for AVX512_VBMI

* Add various Permute intrinsics for Avx512Vbmi and Avx512Vbmi.VL

* Apply formatting patch

* Ensure Avx512Vbmi is recognized

* Fixup the InstructionSetDesc for Avx512Vbmi

* Update JIT/EE Version Identifier

* Fix casing in InstructionSetDesc

17 months ago[wasm] System.Net.WebSockets.Client.Tests timeouts (#85167)
Pavel Savara [Mon, 24 Apr 2023 16:51:08 +0000 (18:51 +0200)]
[wasm] System.Net.WebSockets.Client.Tests timeouts (#85167)

Co-authored-by: Marek Fišera <mara@neptuo.com>
17 months ago[wasm] Add PackedSimd saturating integer arith. (#85043)
Radek Doulik [Mon, 24 Apr 2023 16:50:09 +0000 (18:50 +0200)]
[wasm] Add PackedSimd saturating integer arith. (#85043)

* [wasm] Add PackedSimd saturating integer arith.

* Add doc comments

17 months ago[mono][debugger] Improving debugger functionaties (#85050)
Thays Grazia [Mon, 24 Apr 2023 16:11:24 +0000 (13:11 -0300)]
[mono][debugger] Improving debugger functionaties (#85050)

* Improve debugger functionalites

* Fix step over in the end of a method

* Implement MDBGPROT_CMD_TYPE_SET_VALUES_BY_FIELD_TOKEN

* removing unrelated change.

* Remove mscordbi from CI

* remove mscordbi from ci

* fixing tests because the behavior was changed

* Revert this change

17 months agoRemove unused code for PBKDF2 on Android (#83639)
Kevin Jones [Mon, 24 Apr 2023 15:46:05 +0000 (11:46 -0400)]
Remove unused code for PBKDF2 on Android (#83639)

17 months agoSpecial-case enums in Utf8.TryWrite handler (#85196)
Stephen Toub [Mon, 24 Apr 2023 15:37:30 +0000 (11:37 -0400)]
Special-case enums in Utf8.TryWrite handler (#85196)

Until we implement the Enum.TryFormat overload that targets UTF8, special-case enums in Utf8.TryWrite's handler to use the UTF16 TryFormat in order to avoid boxing the enum.

17 months agoUpdate dependencies from https://github.com/dotnet/roslyn-analyzers build 20230423...
dotnet-maestro[bot] [Mon, 24 Apr 2023 14:51:52 +0000 (09:51 -0500)]
Update dependencies from https://github.com/dotnet/roslyn-analyzers build 20230423.2 (#85248)

Microsoft.CodeAnalysis.Analyzers , Microsoft.CodeAnalysis.NetAnalyzers
 From Version 3.3.5-beta1.23222.2 -> To Version 3.3.5-beta1.23223.2

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
17 months agoUpdate dependencies from https://github.com/dotnet/arcade build 20230424.1 (#85247)
dotnet-maestro[bot] [Mon, 24 Apr 2023 14:50:24 +0000 (09:50 -0500)]
Update dependencies from https://github.com/dotnet/arcade build 20230424.1 (#85247)

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.23222.1 -> To Version 8.0.0-beta.23224.1

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
17 months agoUse emit-based invoke for all of WASM including DI (#85065)
Steve Harter [Mon, 24 Apr 2023 14:09:28 +0000 (09:09 -0500)]
Use emit-based invoke for all of WASM including DI (#85065)

17 months ago[mono] refactor metadata update code (#85177)
Fan Yang [Mon, 24 Apr 2023 13:33:55 +0000 (09:33 -0400)]
[mono] refactor metadata update code (#85177)

* WIP: remove mono_class_set_metadata_update_info generics blocker

* Allow GTDs to store MonoClassMetadataUpdateInfo

   allow generic type definitions to can contain added members

* [loader] Use iterator in find_method_in_class

   Instead of using a for-loop, use an interator that will also pick up added methods from hot reload.

   There's an issue here compared to the old code: the old code could cope with MonoClass:methods containing null pointers.  But the iterator approach signals that iteration is finished by returning NULL.

   Need to check whether the old code is reachable on modern .NET

* Get method add/update info for generic instance classes

* Cleanup the codepath of calling hot_reload_find_method_by_name

* Add reflection support for property of generic instance

* Fix ios build failure

* Add new capabilities

Fixes https://github.com/dotnet/runtime/issues/82792
Fixes https://github.com/dotnet/runtime/issues/82791

---------

Co-authored-by: Aleksey Kliger <alklig@microsoft.com>
17 months agoRemove common tests from the Roslyn3.11 test project. (#85165)
Eirik Tsarpalis [Mon, 24 Apr 2023 13:19:41 +0000 (14:19 +0100)]
Remove common tests from the Roslyn3.11 test project. (#85165)

* Remove shared tests from the Roslyn3.11 test project.

* Decouple Roslyn3.11 smoke tests from shared test classes.

* Fix project file order.

17 months agoFix compiling errors within LoongArch64 and RISCV64 for `ins_Move_Extend`. (#85216)
Qiao Pengcheng [Mon, 24 Apr 2023 11:08:13 +0000 (07:08 -0400)]
Fix compiling errors within LoongArch64 and RISCV64 for `ins_Move_Extend`. (#85216)

* Fix compiling errors within LA64 and RISCV64 for `ins_Move_Extend`.

* update for CR.

17 months ago[mono] remove unneeded PKG_CONFIG_PATH for FreeBSD (#84062)
Thefrank [Mon, 24 Apr 2023 10:41:57 +0000 (03:41 -0700)]
[mono] remove unneeded PKG_CONFIG_PATH for FreeBSD (#84062)

17 months agoAlmost complete sync of logic for generating DAM/RUC reflection access warnings betwe...
Vitek Karas [Mon, 24 Apr 2023 10:34:17 +0000 (03:34 -0700)]
Almost complete sync of logic for generating DAM/RUC reflection access warnings between ILLink and NativeAOT (#84770)

This enables the last of the disabled `RequiresCapability` tests for NativeAOT.

The implementation basically copies the logic from ILLink on how to produce warnings when method or field is marked due to reflection access.

We decided that producing warnings due to reflection access to compiler generated methods is more trouble than benefit and thus we won't do that anymore. See reasoning in https://github.com/dotnet/runtime/issues/85042.

Otherwise the behavior in NativeAOT fully copies the one in ILLink (small exceptions due to better method overload resolution in NativeAOT).

High-level behavior changes in NativeAOT:
* Finally allow the NativeAOT compiler to produce IL2110, IL2111, IL2113 and IL2115
* Avoid generating warnings for override methods if the warning is already generated on the base method (for DAM marking)
* Implement correct marking (and warnings) for "DAM on type" when the derived class has broader annotation than the base class/interface (this is mostly to avoid noise warnings)
* Rename a set of methods and classes in data flow scanner to "Token", because they're only used when a given entity is accessed through its token (so `ldtoken` and similar). This allows for more precise handling of the cases above.

Testing changes:
* Allow specifying tool exceptions for `SkipKepItemsValidationAttribute` - this allows to enable one of the reflection tests for its diagnostics coverage, avoiding the necessity to fix everything around Kept behavior yet.
* Couple of fixes in the test validator to correctly compare expected/actual diagnostics

This fixes final bits of https://github.com/dotnet/runtime/issues/68786
Fixes https://github.com/dotnet/runtime/issues/68688
This helps with https://github.com/dotnet/runtime/issues/82447

17 months ago[LoongArch64] fix the assertion error: 'numPlacedArgLocals < ArrLen(placedArgLocals...
Qiao Pengcheng [Mon, 24 Apr 2023 09:53:58 +0000 (05:53 -0400)]
[LoongArch64] fix the assertion error: 'numPlacedArgLocals < ArrLen(placedArgLocals)'. (#85238)

17 months ago[wasi] implement ICU bundling (#85049)
Pavel Savara [Mon, 24 Apr 2023 09:17:15 +0000 (11:17 +0200)]
[wasi] implement ICU bundling (#85049)

* InvariantGlobalization
* fix unbundled sample

17 months agoSkip libs native runtime packages build in source-index-stage job (#85239)
Viktor Hofer [Mon, 24 Apr 2023 09:15:53 +0000 (11:15 +0200)]
Skip libs native runtime packages build in source-index-stage job (#85239)

* Revert "Fix source-index-stage1 official build (#85215)"

This reverts commit e0e1085528f3c7febf757580b8cee781b986cf54.

* Skip libs native runtime packages in source-index-stage job

Fixes official build regression introduced in
21fb96b6ee011576d3db184765658bb1bc9c178d

17 months ago[LoongArch64] fix the errors for mod/div after #82924. (#85140)
Qiao Pengcheng [Mon, 24 Apr 2023 08:06:00 +0000 (04:06 -0400)]
[LoongArch64] fix the errors for mod/div after #82924. (#85140)

17 months agoUpdate ECMA-335 for function pointer changes (#84962)
Michal Strehovský [Mon, 24 Apr 2023 06:40:39 +0000 (15:40 +0900)]
Update ECMA-335 for function pointer changes (#84962)

#81006 changes the meaning of function pointer types.

17 months ago[mono] fix two call get_default_jit_mm make hotreload work in non default alc (#84247)
D.S. Qiu [Sun, 23 Apr 2023 20:38:14 +0000 (04:38 +0800)]
[mono] fix two call get_default_jit_mm make hotreload work in non default alc (#84247)

* mono_runtime_delegate_invoke wrapper with MONO_ENTER_GC_UNSAFE/MONO_EXIT_GC_UNSAFE;

mono_runtime_delegate_invoke wrapper with MONO_ENTER_GC_UNSAFE/MONO_EXIT_GC_UNSAFE;

* Update object.c

* add mono_alc_foreach

* implmented mono_alc_foreach

* Update loader-internals.h

* fix get_default_jit_mm()

* fix compiler error

* fix type cast

* fix compile error

* change mono_alc_foreach to mono_alc_get_all

* Update assembly-load-context.c

* Update interp.c

* fix

17 months agoAdd public Encoding.TryGetBytes/Chars (#85120)
Stephen Toub [Sun, 23 Apr 2023 19:12:31 +0000 (15:12 -0400)]
Add public Encoding.TryGetBytes/Chars (#85120)

17 months agoFix source-index-stage1 official build (#85215)
Viktor Hofer [Sun, 23 Apr 2023 18:16:02 +0000 (20:16 +0200)]
Fix source-index-stage1 official build (#85215)

With https://github.com/dotnet/runtime/commit/21fb96b6ee011576d3db184765658bb1bc9c178d, the libs.native subset is now required to be built as well for the source-index-stage1 leg.

17 months agoSet `GTF_GLOB_REF` in `gtNewIndir` (#85204)
SingleAccretion [Sun, 23 Apr 2023 18:08:44 +0000 (21:08 +0300)]
Set `GTF_GLOB_REF` in `gtNewIndir` (#85204)

17 months agoUpdate dependencies from https://github.com/dotnet/roslyn-analyzers build 20230422...
dotnet-maestro[bot] [Sun, 23 Apr 2023 17:46:49 +0000 (19:46 +0200)]
Update dependencies from https://github.com/dotnet/roslyn-analyzers build 20230422.2 (#85219)

Microsoft.CodeAnalysis.Analyzers , Microsoft.CodeAnalysis.NetAnalyzers
 From Version 3.3.5-beta1.23221.1 -> To Version 3.3.5-beta1.23222.2

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
17 months agoUpdate dependencies from https://github.com/dotnet/arcade build 20230422.1 (#85218)
dotnet-maestro[bot] [Sun, 23 Apr 2023 17:45:10 +0000 (19:45 +0200)]
Update dependencies from https://github.com/dotnet/arcade build 20230422.1 (#85218)

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.23221.8 -> To Version 8.0.0-beta.23222.1

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
17 months agoReturn int.MaxValue in GC.GetGeneration(nongc_obj) and same for profiler's GetObjectG...
Egor Bogatov [Sun, 23 Apr 2023 14:59:55 +0000 (16:59 +0200)]
Return int.MaxValue in GC.GetGeneration(nongc_obj) and same for profiler's GetObjectGeneration (#85017)

17 months agoAdd a test for STORE_DYN_BLK(..., IND(null), ...) (#85103)
SingleAccretion [Sun, 23 Apr 2023 10:00:36 +0000 (13:00 +0300)]
Add a test for STORE_DYN_BLK(..., IND(null), ...) (#85103)

17 months agoEnable `StripSymbols` by default (#85139)
Michal Strehovský [Sun, 23 Apr 2023 07:24:39 +0000 (16:24 +0900)]
Enable `StripSymbols` by default (#85139)

See discussion in https://github.com/dotnet/sdk/pull/31739#discussion_r1164126543.

17 months agoImprove ProbabilisticMap performance for small value sets (#85202)
Miha Zupan [Sun, 23 Apr 2023 02:41:50 +0000 (04:41 +0200)]
Improve ProbabilisticMap performance for small value sets (#85202)

17 months agoFix typo (#85210)
Joseph Musser [Sun, 23 Apr 2023 02:40:51 +0000 (19:40 -0700)]
Fix typo (#85210)

17 months agoSupport non core types for signature and other type references (#85112)
Buyaa Namnan [Sun, 23 Apr 2023 00:49:47 +0000 (17:49 -0700)]
Support non core types for signature and other type references (#85112)

* Support non core types for signature and other type references

* Add handle to TypeBuilderImpl and implement MetadataToken, remove callbacks

* Remove unnecessary MetadataHelper type

17 months agoAdding Shuffle(). (#85129)
DeepakRajendrakumaran [Sat, 22 Apr 2023 23:48:08 +0000 (16:48 -0700)]
Adding Shuffle(). (#85129)

* Adding Shuffle().

* Fixing Vector256 bug + Simplifying logic by switching to AND instead of ConditionalSelect

* Adding regression test.

17 months agoDateTimeParse: accept all white space chars in the format string for DateTimeStyles...
Tom Deseyn [Sat, 22 Apr 2023 23:09:27 +0000 (01:09 +0200)]
DateTimeParse: accept all white space chars in the format string for DateTimeStyles Allow White (#85102)

17 months agoUpdate dependencies from https://github.com/dotnet/arcade build 20230421.8 (#85194)
dotnet-maestro[bot] [Sat, 22 Apr 2023 22:56:54 +0000 (18:56 -0400)]
Update dependencies from https://github.com/dotnet/arcade build 20230421.8 (#85194)

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.23220.2 -> To Version 8.0.0-beta.23221.8

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
17 months agoAvx512: Abs, ceil, floor, min, max (#84937)
Jyothi Krishna V S [Sat, 22 Apr 2023 22:56:30 +0000 (15:56 -0700)]
Avx512: Abs, ceil, floor, min, max (#84937)

* Minmax implementation

* Fixing new instruction issues

* Abs, Ceil and Floor implementation.

* unary oprations: Sqrt, Negate, Addition

* Removing debug function for condition

* Fixing formatting issues

* fixing merge issue

* Fixing rebase formatting

* Reverting changes to fix rebase issues

* Update src/coreclr/jit/hwintrinsiclistxarch.h

Removing unnecessary HW_Flag_NoEvexSemantics flag

Co-authored-by: Tanner Gooding <tagoo@outlook.com>
* Update src/coreclr/jit/hwintrinsiclistxarch.h

Co-authored-by: Tanner Gooding <tagoo@outlook.com>
* Update src/coreclr/jit/hwintrinsiclistxarch.h

Co-authored-by: Tanner Gooding <tagoo@outlook.com>
* Update src/coreclr/jit/gentree.cpp

Co-authored-by: Tanner Gooding <tagoo@outlook.com>
* Update src/coreclr/jit/gentree.cpp

Co-authored-by: Tanner Gooding <tagoo@outlook.com>
* Addressing review comments. Merging AVX512 Abs conditions

* formatting issues

* removing AVX only flag from 512 floor

* Update src/coreclr/jit/gentree.cpp

Co-authored-by: Tanner Gooding <tagoo@outlook.com>
* adding appropriate round functions

* Reverting creating new instruction for AVX512 round and just updating the code gen part with EVEX encoding.

* Update src/coreclr/jit/instrsxarch.h

Co-authored-by: Tanner Gooding <tagoo@outlook.com>
* Fix formatting issue

---------

Co-authored-by: Tanner Gooding <tagoo@outlook.com>
17 months agoDrain ConsoleLogProcessor on Dispose (#85162)
Jan Krivanek [Sat, 22 Apr 2023 22:33:48 +0000 (00:33 +0200)]
Drain ConsoleLogProcessor on Dispose (#85162)

17 months agoUse `gtNewIndir` everywhere (#84528)
SingleAccretion [Sat, 22 Apr 2023 19:07:45 +0000 (22:07 +0300)]
Use `gtNewIndir` everywhere (#84528)

* gtNewIndir everywhere

* Add a quirk

This dramatically reduces the number of diffs (many of them regressions).

(Cause of regressions was the well-known "CSE doesn't work well
with local non-null propagation" problem)

Note that this is simply a diff quirk: there is no correctness
impact as the caller will remorph the tree and restore GTF_EXCEPT.

* Fix a correctness bug with FIELD_ADDR morphing

Indirection contexts, if used, invalidate previously set NONFAULTING bits.

* Fix the TP regression

17 months agoTweak TimeProviderTaskExtensions handling of CreateTimer (#85200)
Stephen Toub [Sat, 22 Apr 2023 19:07:04 +0000 (15:07 -0400)]
Tweak TimeProviderTaskExtensions handling of CreateTimer (#85200)

Avoid the separate Timer.Change call by tweaking how cleanup happens.

17 months agoAdd vectorization to improve CRC32 performance (#83321)
Brant Burnett [Sat, 22 Apr 2023 18:48:54 +0000 (14:48 -0400)]
Add vectorization to improve CRC32 performance (#83321)

* Add x86 intrinsics to improve CRC32 performance

This significantly improves performance for System.IO.Hashing.Crc32 for
cases where the source span is 64 bytes or larger on Intel x86/x64
architectures.

The change only applies to .NET 7 and later targets of System.IO.Hashing
because it uses some Vector128 APIs added in .NET 7.

BenchmarkDotNet=v0.13.2.2052-nightly, OS=Windows 11 (10.0.22000.1641/21H2)
Intel Core i7-10850H CPU 2.70GHz, 1 CPU, 12 logical and 6 physical cores
.NET SDK=8.0.100-preview.1.23115.2
  [Host]     : .NET 8.0.0 (8.0.23.11008), X64 RyuJIT AVX2
  Job-PBKTIR : .NET 8.0.0 (42.42.42.42424), X64 RyuJIT AVX2
  Job-TVEBLV : .NET 8.0.0 (42.42.42.42424), X64 RyuJIT AVX2

PowerPlanMode=00000000-0000-0000-0000-000000000000  IterationTime=250.0000 ms  MaxIterationCount=20
MinIterationCount=15  WarmupCount=1

| Method | Job        | BufferSize |        Mean |     Error |    StdDev |      Median |         Min |         Max | Ratio |
|------- |----------- |----------- |------------:|----------:|----------:|------------:|------------:|------------:|------:|
| Append | Current    |        128 |   228.20 ns |  2.366 ns |  2.213 ns |   228.07 ns |   225.54 ns |   232.75 ns |  1.00 |
| Append | Intrinsics |        128 |    17.62 ns |  0.096 ns |  0.075 ns |    17.59 ns |    17.56 ns |    17.80 ns |  0.08 |
|        |            |            |             |           |           |             |             |             |       |
| Append | Current    |       1024 | 1,988.07 ns | 47.120 ns | 54.264 ns | 1,990.18 ns | 1,892.83 ns | 2,089.15 ns |  1.00 |
| Append | Intrinsics |       1024 |    64.71 ns |  0.794 ns |  0.704 ns |    64.67 ns |    63.13 ns |    65.96 ns |  0.03 |

* Use vector operator overloads and ref byte indexing

* Fix error and remove ref ROS

* Drop aggressive inlining and legibility improvements

* Don't overcheck intrinsics

* First pass at ARM support

* ARM tweaks

* A bit of cleanup for legibility

* A little more cleanup

* Add license notices

* Move vector shift right to helper function

* A bit of cleanup

* Use System.Diagnostics.UnreachableException

* Use ReadUnaligned for ARM CRC

17 months agoFix generic recursion condition when calling DeserializeAsyncEnumerable in NativeAOT...
Eirik Tsarpalis [Sat, 22 Apr 2023 18:38:04 +0000 (19:38 +0100)]
Fix generic recursion condition when calling DeserializeAsyncEnumerable in NativeAOT. (#85176)

* Fix polymorphic recursion condition when calling DeserializeAsyncEnumerable in NativeAOT.

* Address feedback

17 months agoUse IndexOfAnyValues in FileProviders PathUtils (#85190)
Miha Zupan [Sat, 22 Apr 2023 17:40:37 +0000 (19:40 +0200)]
Use IndexOfAnyValues in FileProviders PathUtils (#85190)

* Use IndexOfAnyValues in FileProviders PathUtils

* Turn two fields into methods

17 months agoHandle not compatible parameters to IndexOf (#84692)
Scott Ekker [Sat, 22 Apr 2023 17:37:27 +0000 (13:37 -0400)]
Handle not compatible parameters to IndexOf (#84692)

* Handle not compatible parameters to IndexOf

Fixes ImmutableArray<T> and SortedSet<T> for the following:
* IList.IndexOf is called with a null "value" parameter
* IList.IndexOf is called with an incorrectly-typed "value" parameter

Fix #84565

* Fixed performance of IsCompatibleObject

17 months agoJIT: use blend rather then repair for profile inconsistencies (#85171)
Andy Ayers [Sat, 22 Apr 2023 14:46:22 +0000 (07:46 -0700)]
JIT: use blend rather then repair for profile inconsistencies (#85171)

If we have a partial profile then the current count reconstruction will
adjust the exit likelihood of some loop exit when it hits a capped loop.
But for multiple exit loops we might wish to see some profile flow out
of all exits, not just one.

In `ludcmp` we choose to send all the profile weights down an early return
path, leaving the bulk of the method with zero counts.

Instead of trying increasingly elaborate repair schemes, we will now use
blend mode for these sorts of problems; this gives a more balanced count
redistribution.

I also updated blend to use the same logic as repair if a block has zero
weights, since presumably whatever likelihood was assigned there during
reconstruction is not well supported.

Fixes the `ludcmp` regression with PGO over no PGO, noted in
https://github.com/dotnet/runtime/issues/84264#issuecomment-1517046280

17 months agoUpdate dependencies from https://github.com/dotnet/roslyn-analyzers build 20230421...
dotnet-maestro[bot] [Sat, 22 Apr 2023 14:39:15 +0000 (10:39 -0400)]
Update dependencies from https://github.com/dotnet/roslyn-analyzers build 20230421.1 (#85195)

Microsoft.CodeAnalysis.Analyzers , Microsoft.CodeAnalysis.NetAnalyzers
 From Version 3.3.5-beta1.23220.3 -> To Version 3.3.5-beta1.23221.1

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
17 months ago[browser][non-icu] `HybridGlobalization` checking for prefix/suffix (#85093)
Ilona Tomkowicz [Sat, 22 Apr 2023 13:30:57 +0000 (15:30 +0200)]
[browser][non-icu] `HybridGlobalization` checking for prefix/suffix (#85093)

* Implementation.

* HG does not belong to legacy code.

* No need to create new instance when existing one is exported.

* TextEncoder's behavior varies between hosts.

* Nit

* Cutting prevents us from using IgnoreSymbols.

* Fixed asserts.

* Fix.

* Match platform with behavior.

* Missing changes to prev commit.

17 months agoOptimize GDV checks for objects with known type (#84661)
Egor Bogatov [Sat, 22 Apr 2023 13:14:29 +0000 (15:14 +0200)]
Optimize GDV checks for objects with known type (#84661)

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
17 months ago[main] Update dependencies from 9 repositories (#84635)
dotnet-maestro[bot] [Sat, 22 Apr 2023 12:17:59 +0000 (08:17 -0400)]
[main] Update dependencies from 9 repositories (#84635)

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

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

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

Microsoft.DotNet.HotReload.Utils.Generator.BuildTool
 From Version 1.1.0-alpha.0.23179.3 -> To Version 8.0.0-alpha.0.23212.6

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

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

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

Microsoft.NETCore.Runtime.ICU.Transport
 From Version 8.0.0-preview.4.23203.1 -> To Version 8.0.0-preview.4.23212.1

* Use -Wno-deprecated-declarations on wasi and wasm.

* Add HAVE_UCOL_CLONE check to mono for ICU

* configure.cmake not working for wasm, bake it into mono cmake

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

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

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

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

* Bump icudt symbol

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

Microsoft.NET.Workload.Emscripten.Current.Manifest-8.0.100.Transport
 From Version 8.0.0-preview.4.23205.3 -> To Version 8.0.0-preview.4.23214.1

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

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

* Revert ICU bump

* Revert extra ICU related changes

* Update dependencies from https://github.com/dotnet/runtime build 20230418.4

Microsoft.NET.ILLink.Tasks , Microsoft.NET.Sdk.IL , Microsoft.NETCore.App.Runtime.win-x64 , Microsoft.NETCore.ILAsm , runtime.native.System.IO.Ports , System.Text.Json
 From Version 8.0.0-preview.4.23177.1 -> To Version 8.0.0-preview.4.23218.4

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

Microsoft.NET.Workload.Emscripten.Current.Manifest-8.0.100.Transport
 From Version 8.0.0-preview.4.23177.1 -> To Version 8.0.0-preview.4.23217.1

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

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

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

Microsoft.NETCore.Runtime.ICU.Transport
 From Version 8.0.0-preview.4.23177.3 -> To Version 8.0.0-preview.4.23212.1

* Update dependencies from https://github.com/dotnet/llvm-project build 20230418.2

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 14.0.0-alpha.1.23179.1 -> To Version 14.0.0-alpha.1.23218.2

* Revert to older ICU

* Update dependencies from https://github.com/dotnet/runtime-assets build 20230418.1

Microsoft.DotNet.CilStrip.Sources , System.ComponentModel.TypeConverter.TestData , System.Data.Common.TestData , System.Drawing.Common.TestData , System.Formats.Tar.TestData , System.IO.Compression.TestData , System.IO.Packaging.TestData , System.Net.TestData , System.Private.Runtime.UnicodeData , System.Runtime.Numerics.TestData , System.Runtime.TimeZoneData , System.Security.Cryptography.X509Certificates.TestData , System.Text.RegularExpressions.TestData , System.Windows.Extensions.TestData
 From Version 8.0.0-beta.23179.4 -> To Version 8.0.0-beta.23218.1

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

Microsoft.NET.Workload.Emscripten.Current.Manifest-8.0.100.Transport
 From Version 8.0.0-preview.4.23218.1 -> To Version 8.0.0-preview.4.23219.1

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

Microsoft.DotNet.HotReload.Utils.Generator.BuildTool
 From Version 1.1.0-alpha.0.23179.3 -> To Version 8.0.0-alpha.0.23219.2

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

Microsoft.DotNet.Cecil
 From Version 0.11.4-alpha.23178.1 -> To Version 0.11.4-alpha.23218.2

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

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

* Update dependencies from https://github.com/dotnet/llvm-project build 20230421.2

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 14.0.0-alpha.1.23179.1 -> To Version 14.0.0-alpha.1.23221.2

* Roll back dotnet-optimization updates

---------

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Steve Pfister <steve.pfister@microsoft.com>
Co-authored-by: Larry Ewing <lewing@microsoft.com>
Co-authored-by: Marek Safar <marek.safar@gmail.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
17 months agoMaking sure we have at least one region per gen during plan phase (#83076)
Maoni Stephens [Sat, 22 Apr 2023 07:41:29 +0000 (00:41 -0700)]
Making sure we have at least one region per gen during plan phase (#83076)

* Making sure we have at least one region per gen during plan phase

Currently we can get into the situation that we didn't have at least one region in each generation we
need to plan. And most of the time we are getting away with it because we can just get a new region
in thread_final_regions. But if we can't, it's a functional problem because we will not maintain our
at least one region per generation invariant.

This change keeps how many regions are planned in each generation and if needed we will attempt to get
new regions during plan phase. And if we can't we will go into the special sweep mode.

When we demote regions with only pinned surv, we detect the ones with no surv at all - those can be
freely planned into any generation we need. We could actually plan regions with only pinned surv to
any generation, eg, we could promote a gen0 region to gen2. However it means we'd need to set cards
on those pinned objects because we will not have a chance later. The benefit of doing this is small
in general as when we get into process_remaining_regions, it's rare we don't already have planned regions
in higher generations. So I don't think it's worth the complexicity for now. We may consider it for the future.

17 months agoAdd options to optimize for size/speed (#85133)
Michal Strehovský [Sat, 22 Apr 2023 06:52:03 +0000 (15:52 +0900)]
Add options to optimize for size/speed (#85133)

Publicly exposing the undocumented switches, adding test legs.

17 months agoAscii.Equals and Ascii.EqualsIgnoreCase (#84886)
Adam Sitnik [Sat, 22 Apr 2023 01:37:24 +0000 (03:37 +0200)]
Ascii.Equals and Ascii.EqualsIgnoreCase (#84886)

* Ascii.Equals and Ascii.EqualsIgnoreCase

* add Equals(byte, byte) and Equals(char, char)

* address code review feedback: remove ByteArrayHelpers type, use Ascii directly

* Apply suggestions from code review

Co-authored-by: Günther Foidl <gue@korporal.at>
* address code review and API review feedback

---------

Co-authored-by: Günther Foidl <gue@korporal.at>
17 months ago[mono][wasm][aot] Prevent llvm from optimizing away stack stores of valuetypes contai...
Zoltan Varga [Sat, 22 Apr 2023 00:41:55 +0000 (20:41 -0400)]
[mono][wasm][aot] Prevent llvm from optimizing away stack stores of valuetypes containing object references when they are returned from a method as a scalar. (#85152)

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

17 months agoShared Readme: expand the section on GH Actions (#85173)
Andrew Casey [Sat, 22 Apr 2023 00:23:21 +0000 (17:23 -0700)]
Shared Readme: expand the section on GH Actions (#85173)

...to clarify that dotnet->aspnetcore is automatic but aspnetcore->dotnet is manual.

Prompted by #85149

17 months agoMerge pull request #85179 from am11/feature/external-deps/update-llvm-libunwind
Jan Kotas [Sat, 22 Apr 2023 00:15:57 +0000 (17:15 -0700)]
Merge pull request #85179 from am11/feature/external-deps/update-llvm-libunwind

Update llvm-libunwind to v16.0.2

17 months agoOpt out of jitstress for profiler/multiple test (#84507)
David Mason [Sat, 22 Apr 2023 00:03:03 +0000 (17:03 -0700)]
Opt out of jitstress for profiler/multiple test (#84507)

17 months ago[browser] Enable webcil in Wasm SDK (#84977)
Marek Fišera [Fri, 21 Apr 2023 23:55:13 +0000 (01:55 +0200)]
[browser] Enable webcil in Wasm SDK (#84977)

* Webcil in WasmSDK for build

* Fix file writes. Wip on publish

* Make publish work

17 months agoEnsure ins_Copy, ins_Load, ins_Move, and ins_Store all handle TYP_MASK (#85110)
Tanner Gooding [Fri, 21 Apr 2023 22:42:26 +0000 (15:42 -0700)]
Ensure ins_Copy, ins_Load, ins_Move, and ins_Store all handle TYP_MASK (#85110)

* Ensure ins_Copy, ins_Load, ins_Move, and ins_Store all handle TYP_MASK

* Ensure REG_SP is still handled on Arm64

* Filter out TYP_MASK from Unix x86

17 months agoFix type initialization ordering under R2R (#84275)
Mark Plesko [Fri, 21 Apr 2023 22:38:04 +0000 (15:38 -0700)]
Fix type initialization ordering under R2R (#84275)

Expand the fix in #80485 to cover helpers including common ones for R2R as well as some generic helpers for JIT.

This would cause regressions (100ks code size in diffs) if done alone, so it also includes checks on whether a helper may trigger a cctor and whether it is beforefieldinit. The precise ordering of the fix is only required for a non-beforefieldinit ctor. This recovers the (small) losses from #80485 and mitigates this fix.

As before, the primary diff is moving type initialization into (for correctness) or out of (the mitigation optimization) a JIT tree. These leads to secondary effects as values may need to be preserved around the type initialization code.

The end result of the fix+mitigations is very little code size change, but viewing the diffs suggests possible future code improvements. However, the impact of any of these should be established first.
- A type initializer will never invoke itself
- When type initialization is removed/CSEed late, it is too late for forward subst/etc., so the loss of the intact tree can still impact code generation
- A custom calling convention for the static helpers (tuned to the common case of no type initialization needing to occur) could help with the impact of calling it in the middle of a calculation
- Code can use beforefieldinit in more place

Fixes #84007

17 months ago Fix some issues with null check handling (#84523)
SingleAccretion [Fri, 21 Apr 2023 21:45:36 +0000 (00:45 +0300)]
 Fix some issues with null check handling  (#84523)

* Fix some issues with null check handling

Code assumed that, given a non-null address, it
must have no side effects. This is not correct.

Fix by centralizing the logic for no-op null check
removal in morph instead of spreading it over to
places that create null checks.

This is both a CQ and TP win.

* Add a test

* Fix early prop bug

17 months agoAvoid null ref in JsonSeparatorNamingPolicy (#85002)
Layomi Akinrinade [Fri, 21 Apr 2023 21:26:56 +0000 (14:26 -0700)]
Avoid null ref in JsonSeparatorNamingPolicy (#85002)

* Avoid null ref in JsonSeparatorNamingPolicy

* Implement desired null-handling behavior

* Use throw helper for exception

* Create shared throw helper and fix CI issues

17 months ago[wasm][debugger] ActiveIssue for DebuggerTests.EvaluateOnCallFrameTests timeouts...
Pavel Savara [Fri, 21 Apr 2023 20:59:32 +0000 (22:59 +0200)]
[wasm][debugger] ActiveIssue for DebuggerTests.EvaluateOnCallFrameTests timeouts (#85169)

* active issue https://github.com/dotnet/runtime/issues/85168

* rename offender

17 months agoZlib: Add some protections to the allocator used by zlib (#84604)
Levi Broderick [Fri, 21 Apr 2023 20:56:43 +0000 (13:56 -0700)]
Zlib: Add some protections to the allocator used by zlib (#84604)

See comments in the allocator files for more information on the protections offered.

Also:
- Normalizes how we detect if we're using zlib or intel-zlib
- Updates pal_zlib includes
- Updates pal_zlib to use calloc instead of malloc

17 months agoUpdate version.txt
Adeel [Fri, 21 Apr 2023 20:43:38 +0000 (23:43 +0300)]
Update version.txt

17 months agoApply all patches
Adeel [Fri, 21 Apr 2023 20:32:36 +0000 (23:32 +0300)]
Apply all patches

17 months agoUpdate llvm-libunwind to v16
Adeel [Fri, 21 Apr 2023 20:11:09 +0000 (23:11 +0300)]
Update llvm-libunwind to v16

17 months ago[LoongArch64] fix the arg regs' loop depending. (#85085)
Qiao Pengcheng [Fri, 21 Apr 2023 19:08:20 +0000 (15:08 -0400)]
[LoongArch64] fix the arg regs' loop depending. (#85085)

* [LoongArch64] fix the arg regs' loop depending.

* amend the value naming by CR.

17 months agoUse "genActualType" in "LowerSwitch" (#85122)
SingleAccretion [Fri, 21 Apr 2023 19:07:48 +0000 (22:07 +0300)]
Use "genActualType" in "LowerSwitch" (#85122)

17 months ago[LoongArch64] revert TARGET_LOONGARCH64 which destroyed by RISCV#84584. (#85151)
Qiao Pengcheng [Fri, 21 Apr 2023 19:07:27 +0000 (15:07 -0400)]
[LoongArch64] revert TARGET_LOONGARCH64 which destroyed by RISCV#84584. (#85151)

17 months agoadd nixos ping executable path (#84997)
Badre BSAILA [Fri, 21 Apr 2023 18:54:21 +0000 (20:54 +0200)]
add nixos ping executable path (#84997)

* add nixos ping executable path

* delete useless /

17 months agoAdd NativeAOT runtime pack build for iOS/tvOS/Catalyst (#85047)
Alexander Köplinger [Fri, 21 Apr 2023 18:53:45 +0000 (20:53 +0200)]
Add NativeAOT runtime pack build for iOS/tvOS/Catalyst (#85047)

17 months agoNativeAOT ComWrappers: extend managed object lifetime based on refcount (#85087)
Austin Wise [Fri, 21 Apr 2023 18:13:35 +0000 (11:13 -0700)]
NativeAOT ComWrappers: extend managed object lifetime based on refcount (#85087)

Co-authored-by: Jeremy Koritzinsky <jkoritzinsky@gmail.com>
Co-authored-by: Andrii Kurdiumov <kant2002@gmail.com>
17 months ago[main] Update dependencies from dotnet/arcade (#85096)
dotnet-maestro[bot] [Fri, 21 Apr 2023 18:02:30 +0000 (13:02 -0500)]
[main] Update dependencies from dotnet/arcade (#85096)

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

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.23217.1 -> To Version 8.0.0-beta.23219.2

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

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.23217.1 -> To Version 8.0.0-beta.23220.2

---------

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
17 months agoUpdate dependencies from https://github.com/dotnet/roslyn-analyzers build 20230420...
dotnet-maestro[bot] [Fri, 21 Apr 2023 18:01:20 +0000 (13:01 -0500)]
Update dependencies from https://github.com/dotnet/roslyn-analyzers build 20230420.3 (#85157)

Microsoft.CodeAnalysis.Analyzers , Microsoft.CodeAnalysis.NetAnalyzers
 From Version 3.3.5-beta1.23218.1 -> To Version 3.3.5-beta1.23220.3

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
17 months agoInline function pointer composition details into MethodTable (#85141)
Michal Strehovský [Fri, 21 Apr 2023 16:57:10 +0000 (01:57 +0900)]
Inline function pointer composition details into MethodTable (#85141)

I initially placed function pointer composition info into a separate hashtable because it's not a runtime concern. Turns out this makes things really inconvenient within the type loader. We store information about runtime-constructed types in hashtables like `RuntimeTypeHandleToParameterTypeRuntimeTypeHandleHashtable`. But those are one way only (from composition to `MethodTable`). We'd need another hashtable to go from `MethodTable` to composition.

Inline the composition details into `MethodTable` instead. We have prior art - the runtime doesn't care about composition of non-variant generic types, but we still keep them as part of `MethodTable`. Similar to parameter types of pointers or byrefs. (For arrays, the runtime does care because of variance so I'm not naming those.)

17 months ago[JIT] ARM64 - Combine 'neg' and 'cmp' to 'cmn' (#84667)
Will Smith [Fri, 21 Apr 2023 16:49:50 +0000 (09:49 -0700)]
[JIT] ARM64 - Combine 'neg' and 'cmp' to 'cmn' (#84667)

* Combine compare and shift ops into a single compare op

* Fix comment

* Expanding IsContainableBinaryOp.

* Remove commented code

* Added more cases

* Initial work

* Emitting cmn

* Handle shift-version of neg and cmn

* Add optimization check

* Check for set flags

* Added extra asserts

* Renamed IsContainableBinaryOp to IsContainableUnaryOrBinaryOp. Fixed an assert.

* Remove optimizing code from TryLowerConditionToFlagsNode. Added additional check in containing NEG for a CMP or compare op.

17 months agoKeep instrumentings some intrinsics (#85130)
Egor Bogatov [Fri, 21 Apr 2023 16:02:09 +0000 (18:02 +0200)]
Keep instrumentings some intrinsics (#85130)

17 months agoSync shared code from aspnetcore (#85149)
github-actions[bot] [Fri, 21 Apr 2023 15:17:36 +0000 (08:17 -0700)]
Sync shared code from aspnetcore (#85149)

17 months ago [browser][non-icu] `HybridGlobalization` update string decoding for comparison ...
Ilona Tomkowicz [Fri, 21 Apr 2023 14:26:04 +0000 (16:26 +0200)]
 [browser][non-icu] `HybridGlobalization` update string decoding for comparison (#85098)

* Use well tested decoding in comparison.

* Fix length calculation.

17 months ago[wasm-mt] A version of LowLevelLifoSemaphore that uses callbacks on the browser ...
Aleksey Kliger (λgeek) [Fri, 21 Apr 2023 14:05:40 +0000 (10:05 -0400)]
[wasm-mt] A version of LowLevelLifoSemaphore that uses callbacks on the browser (#84491)

This is part of https://github.com/dotnet/runtime/issues/84489 - landing support for async JS interop on threadpool threads in multi-threaded WebAssembly.

This PR adds two things:

1. A new unmanaged `LifoSemaphoreAsyncWait` semaphore that can use Emscripten's ability to push C calls from one thread to another in order to implement a callback-based semaphore - when a thread wants to wait, it sets up a success callback and a timeout callback, and then can return to the JS event loop.  When the semaphore is released, Emscripten will trigger the callback to run on the waiting thread.  If the wait times out, the timeout callback will run.
2. A new managed `LowLevelLifoAsyncWaitSemaphore` that doesn't have the normal `Wait()` function, and instead needs to use the callback-based `PrepareAsyncWait()` function.  Also refactored `LowLevelLifoSemaphore` to pull out a common `LowLevelLifoSemaphoreBase` class to share with the async wait version.

* [wasm-mt][mono] Add new LifoSemaphoreAsyncWait C primitive

Add a new kind of LifoSemaphore that has a callback-based wait
function, instead of a blocking wait using Emscripten's ability to
send work from one webworker to another in C.

This will allow us to wait for a semaphore from the JS event loop in a
web worker.

* [wasm-mt][mono] split LowLevelLifoSemaphore into two kinds

A normal LowLevelLifoSemaphore that can do a synchronous wait
and another that can do a callback-based wait from the JS event loop

* Add LowLevelLifoSemaphoreBase

Move the counts to the base class

Move Release to the base class, make ReleaseCore abstract

* make a new LowLevelLifoAsyncWaitSemaphore for wasm-mt

* Revert unintentional package-lock.json changes

* fix possible null dereference

* use a separate icall for async wait InitInternal

instead of magic constants that are otherwise not needed in managed

* remove dead code; fixup comments

* LowLevelLifoSemaphore: decrement timeoutMs if we lost InterlockedCompareExchange

When a thread wakes after waiting for a semaphore to be released, if
it raced with another thread that is also trying to update the
semaphore counts and loses, it has to go back to waiting again.

In that case, decrement the remaining timeout by the elapsed wait time
so that the next wait is shorter.

* better timeout decrement code

* move timeoutMs == 0 check to PrepareAsyncWaitCore

make PrepareAsyncWaitCore static and remove a redundant argument

17 months agoFix reproNative project (#85150)
Michal Strehovský [Fri, 21 Apr 2023 08:40:59 +0000 (17:40 +0900)]
Fix reproNative project (#85150)

17 months agoTry to untangle the rid calculation. (#82832)
Tom Deseyn [Fri, 21 Apr 2023 08:02:07 +0000 (10:02 +0200)]
Try to untangle the rid calculation. (#82832)

* Try to untangle the rid calculation.

* Ignore __portableOS.

* Add back musl detection.

* Try fix AnyOS tests.

* Try fix coreclr linux_musl_arm64 job.

* src/tests/build.proj: use PackageRID for restore.

* Use RuntimeOS as an override for _packageOS.

* Remove (probably) out-dated override for non-portable ToolsRID.

* CI cross-builds for linux-musl use linux.

* Add missing arch to rid.

* Try simplified ToolsRID.

* Update comments.

* Rename OutputRid to OutputRID.

* Tweak comment.

* Move TargetsLinux{Bionic,Musl} with the other Targets properties.

* Don't use RuntimeOS for PackageRID for CrossBuilds.

* Move RuntimeOS condition to ToolsRID assignment.

* Clean up a few things.

* Fix broken Condition.

* Try fix the linux-bionic build.

* Try fix the linux-bionic build, part II.

* Try fix the linux-bionic build, part III.

* Fix PackageRID.

* Use RuntimeOS as _packageOS override.

* Remove RuntimeOS.

* Fix '-os linux-musl' mapping.

* Clean up .

* Rename __PortableOS to __PortableTargetOS.

* Extend comments.

* Extend OutputRID comment too.

* build.sh: include linux-bionic, linux-musl in usage.

* SourceBuild.props: no need to pass RuntimeOS. Only set ToolsOS, PackageOS when RuntimeOS is not empty.

* Fix comment.

* linux-bionic doesn't get built on linux-bionic.

* Unconditionally assign TargetsLinuxBionic/TargetsLinuxMusl.

* Remove SkipInferTargetOSName.

17 months agoFix System.Net.Security.Enterprise.Tests build (#84795)
Sven Boemer [Fri, 21 Apr 2023 06:49:58 +0000 (23:49 -0700)]
Fix System.Net.Security.Enterprise.Tests build (#84795)

* Fix enterprise linux build

Ensure a recent lld is available on the build host

* Remove lld

As it is now installed in the ubuntu-22.04 image

* Try enabling legacy provider

* Fix legacy under [provider_sect]

17 months agoUnsubscribe from codegen-coreclr notifications (#85124)
Kunal Pathak [Fri, 21 Apr 2023 05:32:37 +0000 (22:32 -0700)]
Unsubscribe from codegen-coreclr notifications (#85124)

17 months ago[wasm] WBT: Re-enable previously disabled test (#85009)
Ankit Jain [Fri, 21 Apr 2023 03:58:41 +0000 (23:58 -0400)]
[wasm] WBT: Re-enable previously disabled test (#85009)

17 months agoBlock Runtime_84693 with the issue #85081 (#85123)
Tomáš Rylek [Fri, 21 Apr 2023 03:24:43 +0000 (05:24 +0200)]
Block Runtime_84693 with the issue #85081 (#85123)

17 months ago[wasm] Detect constant-size cpblk copies in the jiterpreter and unroll them into...
Katelyn Gadd [Fri, 21 Apr 2023 02:43:07 +0000 (19:43 -0700)]
[wasm] Detect constant-size cpblk copies in the jiterpreter and unroll them into raw moves (#85125)

This slightly improves performance for Number.Formatting WriteXXXDigits

17 months agoLowering Vector512() methods : comparison + shift (#84942)
DeepakRajendrakumaran [Fri, 21 Apr 2023 02:40:53 +0000 (19:40 -0700)]
Lowering Vector512() methods : comparison + shift (#84942)

* LessThan(), LessThanOrEqual(), GreaterThan(), GreaterThanOrEqual() + corresponding *ANY(), *ALL() and ConditionaSelect()
ShiftLeft, ShiftRight, ShiftRightArithmetic

* Update src/coreclr/jit/lowerxarch.cpp : review comment

Co-authored-by: Kunal Pathak <Kunal.Pathak@microsoft.com>
---------

Co-authored-by: Kunal Pathak <Kunal.Pathak@microsoft.com>
Co-authored-by: Tanner Gooding <tagoo@outlook.com>
Co-authored-by: Bruce Forstall <brucefo@microsoft.com>
17 months agoJettison vxsort support in the GC when optimizing for size (#85036)
Michal Strehovský [Fri, 21 Apr 2023 00:49:36 +0000 (09:49 +0900)]
Jettison vxsort support in the GC when optimizing for size (#85036)

Vxsort comes with precomputed tables that are more than 100 kB in size.

Jettison them when optimizing for size. Hello world with optimize for size + invariant globalization is now 1.08 MB.

Fixes #84749.

17 months agoJsonConsoleFormatter: keep escaped line breaks for Exceptions #83726 (#84972)
Bernhard Danecker [Thu, 20 Apr 2023 23:38:02 +0000 (01:38 +0200)]
JsonConsoleFormatter: keep escaped line breaks for Exceptions #83726 (#84972)

17 months agoSimplify `impSIMDPopStack` and delete a quirk from `gtNewLoadValueNode` (#85070)
SingleAccretion [Thu, 20 Apr 2023 22:59:54 +0000 (01:59 +0300)]
Simplify `impSIMDPopStack` and delete a quirk from `gtNewLoadValueNode` (#85070)

17 months agoAcclerate `Vector512` multiply and divide. (#84941)
anthonycanino [Thu, 20 Apr 2023 22:27:37 +0000 (15:27 -0700)]
Acclerate `Vector512` multiply and divide. (#84941)

* Accelerate Vector512 multiply.

* Accelerate Vector512 divide.

* Small build fix.

* Fix accidental removal for Vector256_op_division.

* Review edits.

* Assert fix.

---------

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