platform/upstream/dotnet/runtime.git
2 years agoMark EncryptionPolicy.NoEncryption and EncryptionPolicy.AllowNoEncryption as obsolete...
Radek Zikmund [Tue, 8 Mar 2022 17:44:17 +0000 (18:44 +0100)]
Mark EncryptionPolicy.NoEncryption and EncryptionPolicy.AllowNoEncryption as obsolete (#66292)

Fixes #65545

2 years agoAdd tests for `ijwhost` (#66308)
Elinor Fung [Tue, 8 Mar 2022 17:14:43 +0000 (09:14 -0800)]
Add tests for `ijwhost` (#66308)

2 years agouse the name of the header when throwing exception for invalid chars (#66250)
Badre BSAILA [Tue, 8 Mar 2022 16:15:18 +0000 (17:15 +0100)]
use the name of the header when throwing exception for invalid chars (#66250)

* use the name of the header when throwing exception for invalid chars

* delete VS code cleanups

* delete VS code cleanups 2

* add suggested changes 1

* delete VS code cleanups 3

* delete VS code cleanups 4

* delete VS code cleanups 5

2 years ago[Mono] Enable generating SIMD intrinsics for System.Numerics.Vector on Arm64 (#65486)
Fan Yang [Tue, 8 Mar 2022 15:20:59 +0000 (10:20 -0500)]
[Mono] Enable generating SIMD intrinsics for System.Numerics.Vector on Arm64 (#65486)

* Enable SIMD intrinsics for System.Numerics.Vector on Arm64

* Minor adjustment

* Use the correct op code for BitwiseAnd, BitwiseOr and Xor

* Check if vector element type is a primitive type or not

* Remove dead code and fix constant formet

* Add type checks for each method and refactor

* Remove extra condition check

* Loose the type check for vector creation methods

* Remove type checks for Create* functions

* Remove some of the type checks

2 years ago[mono][jit] Remove OP_FCONV_TO_I/OP_RCONV_TO_I from the back ends, convert them to...
Zoltan Varga [Tue, 8 Mar 2022 15:18:15 +0000 (10:18 -0500)]
[mono][jit] Remove OP_FCONV_TO_I/OP_RCONV_TO_I from the back ends, convert them to TO_I4/TO_I8 in the front end. (#66268)

2 years ago[mono][jit] Disable deopt in gsharedvt methods. (#66322)
Zoltan Varga [Tue, 8 Mar 2022 15:17:55 +0000 (10:17 -0500)]
[mono][jit] Disable deopt in gsharedvt methods. (#66322)

The deopt code can't handle the gsharedvt return value convention.

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

2 years ago[mono] Put WeakAttribute support under an ifdef (#66213)
Aleksey Kliger (λgeek) [Tue, 8 Mar 2022 14:08:40 +0000 (09:08 -0500)]
[mono] Put WeakAttribute support under an ifdef (#66213)

This code has been effectively dead in .NET 6 on all platforms since
System.WeakAttribute is not in CoreLib.

Not everything is removed:

- MonoClass:has_weak_fields bit is still present (and always 0).

- the AOT compiler still emits a (size 0) weak_field_indexes symbol (but the
  AOT runtime reader code is under an ifdef).  Likewise the AOT table
  definitions, etc are still there.  It seemed unnecessary to perturb the AOT
  format.

2 years agoAdd MultiModule test to issues.targets (#66289)
Michal Strehovský [Tue, 8 Mar 2022 05:51:58 +0000 (06:51 +0100)]
Add MultiModule test to issues.targets (#66289)

Hitting https://github.com/dotnet/runtime/issues/66191 in the CI.

2 years agoDisable failing bindhandleinvalid tests (#66303)
Bruce Forstall [Tue, 8 Mar 2022 01:43:56 +0000 (17:43 -0800)]
Disable failing bindhandleinvalid tests (#66303)

* Disable failing bindhandleinvalid tests

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

* Also disable bindhandlenull

Tracking: #66274

2 years agoAdding Count(ReadOnlySpan<char>) Overloads (#66026)
Jose Perez Rodriguez [Tue, 8 Mar 2022 01:39:21 +0000 (17:39 -0800)]
Adding Count(ReadOnlySpan<char>) Overloads (#66026)

* Adding Count(ReadOnlySpan<char>) Overloads

* Address PR Feedback

2 years agoFix ConditionalFactAttribute instances in ILPROJ tests (#66312)
Tomáš Rylek [Tue, 8 Mar 2022 01:22:08 +0000 (02:22 +0100)]
Fix ConditionalFactAttribute instances in ILPROJ tests (#66312)

I have found out that the change I originally made by changing
reference assembly for System.Type from System.Runtime to mscorlib
was incorrect - the Roslyn XUnit wrapper source generator started
failing with a nullref. I have experimentally identified that I can
fix this problem by explicitly specifying public key tokens of
the System.Runtime and Microsoft.DotNet.XUnitExtensions assembly
references and by adding a reference to the TestLibrary.

As I had to update System.Runtime references in all affected modules,
I also put back the System.Runtime assembly as the home for
System.Type as was the original state I copied from a C# compilation
disassembly, I changed them to mscorlib because I didn't know
I would need to specify the System.Runtime reference.

Thanks

Tomas

2 years agoAdd partial to the enclosing types when running the ConvertToGeneratedDllImport fixer...
Jeremy Koritzinsky [Tue, 8 Mar 2022 01:14:30 +0000 (17:14 -0800)]
Add partial to the enclosing types when running the ConvertToGeneratedDllImport fixer (#65452)

2 years agoTry additional nuget retries (#66306)
Bruce Forstall [Tue, 8 Mar 2022 00:33:13 +0000 (16:33 -0800)]
Try additional nuget retries (#66306)

After adding NUGET_EXPERIMENTAL_CHAIN_BUILD_RETRY_POLICY, we still see
some benchmarks SPMI collection runs fail with the same nuget errors.

In case this is actually a potential workaround, try increasing the
number of retries and delay between them.

Also, print out the environment used so we can verify it, and see if
there are any other relevant variables set.

2 years agoJIT: Optimize movzx after setcc (#66245)
Egor Bogatov [Mon, 7 Mar 2022 23:22:14 +0000 (02:22 +0300)]
JIT: Optimize movzx after setcc (#66245)

2 years agoRevisiting nullable annotations on caching (#66215)
Maryam Ariyan [Mon, 7 Mar 2022 22:45:01 +0000 (17:45 -0500)]
Revisiting nullable annotations on caching (#66215)

* Revisiting nullable annotations on caching

* Fix up more nullablity mismatches

2 years ago[wasm] Rename `$(EmccInitialMemory)` to `$(EmccInitialHeapSize)` (#66233)
Ankit Jain [Mon, 7 Mar 2022 22:33:42 +0000 (17:33 -0500)]
[wasm] Rename `$(EmccInitialMemory)` to `$(EmccInitialHeapSize)` (#66233)

.. to better represent what it is.

2 years ago[wasm][aot] Disable `System.Text.RegularExpressions.Unit.Tests` (#66311)
Ankit Jain [Mon, 7 Mar 2022 22:08:49 +0000 (17:08 -0500)]
[wasm][aot] Disable `System.Text.RegularExpressions.Unit.Tests` (#66311)

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

2 years agoFix compatibility with NTLM authentication to McAfee Web Gateway (#66305)
Filip Navara [Mon, 7 Mar 2022 22:00:02 +0000 (23:00 +0100)]
Fix compatibility with NTLM authentication to McAfee Web Gateway (#66305)

2 years agoFix missing StringSyntax attribute in Regex ref assembly (#66309)
Stephen Toub [Mon, 7 Mar 2022 21:53:12 +0000 (16:53 -0500)]
Fix missing StringSyntax attribute in Regex ref assembly (#66309)

2 years agoEnable RegexOptions.RightToLeft and lookbehinds in compiler / source generator (...
Stephen Toub [Mon, 7 Mar 2022 21:52:38 +0000 (16:52 -0500)]
Enable RegexOptions.RightToLeft and lookbehinds in compiler / source generator (#66280)

* Enable RegexOptions.RightToLeft and lookbehinds in compiler / source generator

For .NET 7 we rewrote RegexCompiler as we were writing the source generator, and in doing so we left out support for RegexOptions.RightToLeft as well as lookbehinds (which are implemented via RightToLeft).  This adds support for both.  I initially started incrementally adding in support for various constructs in lookbehinds, but from a testing perspective it made more sense to just add it all, as then all of the RightToLeft tests are used to validate the constructs that are also in lookbehinds.

* Address PR feedback

2 years agoUse runtime and targeting pack version of System.Diagnostics.DiagnosticSource in...
AraHaan [Mon, 7 Mar 2022 21:45:42 +0000 (16:45 -0500)]
Use runtime and targeting pack version of System.Diagnostics.DiagnosticSource in Microsoft.Extensions.Logging. (#66284)

* Use runtime and targeting pack version of System.Diagnostics.DiagnosticSource.

This removes the copy of System.Diagnostics.DiagnosticSource when using the Microsoft.Extensions.Logging package on .NET Core.

Co-authored-by: Eric Erhardt <eric.erhardt@microsoft.com>
2 years agoUse RegexGenerator in applicable tests (#66179)
Stephen A. Imhoff [Mon, 7 Mar 2022 21:04:10 +0000 (13:04 -0800)]
Use RegexGenerator in applicable tests (#66179)

2 years ago[Mono] Intrinsify Convert* for Vector{64, 128} on ARM64 (#65946)
Fan Yang [Mon, 7 Mar 2022 20:12:57 +0000 (15:12 -0500)]
[Mono] Intrinsify Convert* for Vector{64, 128} on ARM64 (#65946)

* Intrinsify Convert*

* Test - comment out my change

* Enable ConvertToDouble

* Enable ConvertToInt32 and ConvertToUInt32

* Enable ConvertToInt64 and ConvertToUInt64

* Disable ConvertToInt64 and ConvertToUInt64, but enable ConvertToSingle

* Remove the support for ConvertToInt64, ConvertToUInt64 and ConvertToSingle

2 years agoFix issues related to JsonSerializerOptions mutation and caching. (#66248)
Eirik Tsarpalis [Mon, 7 Mar 2022 19:44:14 +0000 (19:44 +0000)]
Fix issues related to JsonSerializerOptions mutation and caching. (#66248)

* Fix issues related to JsonSerializerOptions mutation and caching. (#65863)

* Fix issues related to JsonSerializerOptions mutation and caching.

* fix test style

* fix linker warning

* disable failing tests in netfx

2 years ago[main] Update dependencies from 9 repositories (#65843)
dotnet-maestro[bot] [Mon, 7 Mar 2022 19:10:18 +0000 (19:10 +0000)]
[main] Update dependencies from 9 repositories (#65843)

[main] Update dependencies from 9 repositories

 - Merge branch 'main' into darc-main-69c88284-a4b6-425e-834c-f89f194a9041

 - Merge branch 'main' into darc-main-69c88284-a4b6-425e-834c-f89f194a9041

 - Merge branch 'main' into darc-main-69c88284-a4b6-425e-834c-f89f194a9041

2 years agoFix a couple issues with GTF_GLOB_REF setting (#66247)
SingleAccretion [Mon, 7 Mar 2022 18:10:39 +0000 (21:10 +0300)]
Fix a couple issues with GTF_GLOB_REF setting (#66247)

Add it to INDs and BLKs off of exposed ADDRs in addition to OBJs.

Remove code from args morphing which was re-deriving the side effects
flags for an OBJ argument, it was:

 a) Unnecessary, as morph has already done all the work.
 b) Incorrect, as it lost GTF_GLOB_REF for OBJ(ADDR(LCL (AX)))-like trees.

2 years ago remove invalid System.IO.FileSystem.Watcher tests (#66296)
Adam Sitnik [Mon, 7 Mar 2022 17:39:04 +0000 (18:39 +0100)]
 remove invalid System.IO.FileSystem.Watcher tests (#66296)

2 years agoBackport docs fixes for Cbor (#66180)
Genevieve Warren [Mon, 7 Mar 2022 17:33:11 +0000 (09:33 -0800)]
Backport docs fixes for Cbor (#66180)

2 years agoAnnotating Native CoreLib library to be AOT friendly (#66112)
Lakshan Fernando [Mon, 7 Mar 2022 17:02:19 +0000 (09:02 -0800)]
Annotating Native CoreLib library to be AOT friendly (#66112)

* Annotating Native CoreLib to be AOT friendly

* change array attribute msg

* FB

* Update src/libraries/System.Private.CoreLib/src/Internal/Runtime/InteropServices/ComponentActivator.cs

Co-authored-by: Jan Kotas <jkotas@microsoft.com>
Co-authored-by: Jan Kotas <jkotas@microsoft.com>
2 years agoFix clash between tentative method optimizations (#66145)
Michal Strehovský [Mon, 7 Mar 2022 16:49:50 +0000 (17:49 +0100)]
Fix clash between tentative method optimizations (#66145)

When we were in the situation of the newly added test, we would try to generate method body on the abstract class. Such method body is not actually reachable.

2 years agoFix workaround for static virtual methods (#66290)
Michal Strehovský [Mon, 7 Mar 2022 15:58:30 +0000 (16:58 +0100)]
Fix workaround for static virtual methods (#66290)

The workaround for reflection invoking static virtual methods wasn't working around well enough. Fixes #66028.

The repro case also hit a scanning failure due to scanner not scanning a throw helper. Those are more of asserts, so add them to the collection of throw helpers to ignore.

2 years agoMerikhamoyan vector intrinsics operators (#66002)
Meri Khamoyan [Mon, 7 Mar 2022 15:35:12 +0000 (19:35 +0400)]
Merikhamoyan vector intrinsics operators (#66002)

* Added addition and subtraction operator intrinsics

2 years agoDecommit region tails (#66008)
Peter Sollich [Mon, 7 Mar 2022 13:02:48 +0000 (14:02 +0100)]
Decommit region tails (#66008)

I observed that with gen 1 regions, we often get into the situation that gen 1 is much smaller per heap than a region. So it makes sense to decommit the tail end of the last region in an ephemeral generation guided by the budget for that generation.

To implement this, I reactivated decommit_target for regions and have decommit_step call decommit_ephemeral_segment_pages_step which in the regions case needs to synchronize with the allocator. This is done by taking the more space lock.

Note that with default settings, this decommitting logic will usually only apply to gen 1 because normally gen 0 is larger than a region. It can still happen for gen 0 though if gen 0 has pins and thus already has enough space to satisfy the budget. Then we will decommit the tail end of the last region in gen 0.

2 years agoCount `OBJ/BLK` as memory uses (#66135)
SingleAccretion [Mon, 7 Mar 2022 10:58:04 +0000 (13:58 +0300)]
Count `OBJ/BLK` as memory uses (#66135)

* Fix memory liveness for OBJ/BLK

We need to count OBJ/BLK as uses, otherwise SSA can
fail to insert a memory PHI where one is needed.

* Add a test

2 years agoDo not create small constants while morphing cascading addition (#66270)
SingleAccretion [Mon, 7 Mar 2022 09:54:35 +0000 (12:54 +0300)]
Do not create small constants while morphing cascading addition (#66270)

* Do not create small constants

* Add a test

2 years agoFix address exposure + fsub (#66253)
Egor Bogatov [Mon, 7 Mar 2022 08:53:34 +0000 (11:53 +0300)]
Fix address exposure + fsub (#66253)

2 years agoFix performance regression in SSL handshake (#66077)
Radek Zikmund [Mon, 7 Mar 2022 08:16:45 +0000 (09:16 +0100)]
Fix performance regression in SSL handshake (#66077)

2 years ago[main] Update dependencies from dotnet/linker (#66081)
dotnet-maestro[bot] [Mon, 7 Mar 2022 00:49:56 +0000 (01:49 +0100)]
[main] Update dependencies from dotnet/linker (#66081)

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
2 years agoAdd missing regex position check after BOL optimization (#66216)
Stephen Toub [Mon, 7 Mar 2022 00:13:14 +0000 (19:13 -0500)]
Add missing regex position check after BOL optimization (#66216)

* Add missing regex position check after BOL optimization

* Address PR feedback

2 years agoTry to remove "-" and "'" from HighCharTable (#66200)
Dennis Yemelyanov [Sun, 6 Mar 2022 22:40:24 +0000 (14:40 -0800)]
Try to remove "-" and "'" from HighCharTable (#66200)

2 years ago[crossgen2] Promote single byref aot. (#65682)
Sergey Andreenko [Sun, 6 Mar 2022 21:32:10 +0000 (16:32 -0500)]
[crossgen2] Promote single byref aot. (#65682)

* Rename `CORINFO_FLG_DONT_PROMOTE` to `CORINFO_FLG_DONT_DIG_FIELDS`.

* Support promotion of `struct{ 1 gcref; }` outside of version bubble.

2 years agoJIT: fix scalability issue in redundant branch optimizer (#66259)
Andy Ayers [Sun, 6 Mar 2022 16:27:35 +0000 (08:27 -0800)]
JIT: fix scalability issue in redundant branch optimizer (#66259)

In methods with long skinny dominator trees and lots of redundant branches
the jit can spend too much time trying to optimize the branches.

Place a limit on the number of redundant branches with matching VNs that
the jit will consider for a given branch.

Fixes #66067.

2 years agoJIT: add OSR patchpoint strategy, inhibit tail duplication (#66208)
Andy Ayers [Sun, 6 Mar 2022 16:26:43 +0000 (08:26 -0800)]
JIT: add OSR patchpoint strategy, inhibit tail duplication (#66208)

Two changes for OSR:
* add new strategies for placing patchpoints -- either at
  backedge sources (instead of targets) or adaptive. depending
  on number of backedges. Change default to adaptive, since this
  works better with the flow we see from C# `for` loops.
* inhibit tail duplication for OSR as it may end up interfering
  with loop recognition.

We may not be able to place patchpoints at sources, for various reasons;
if so we fall back to placing them at targets.

We also can't place patchpoints unless block entries are also stack empty
ponts. This means forgoing patchpoints in some IL cases..

2 years agoLocalized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 164729...
dotnet bot [Sun, 6 Mar 2022 13:47:20 +0000 (05:47 -0800)]
Localized file check-in by OneLocBuild Task: Build definition ID 679: Build ID 1647296 (#66130)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

2 years ago[mono] Remove SkipVerification support from the runtime (#66211)
Alexander Köplinger [Sun, 6 Mar 2022 13:44:33 +0000 (14:44 +0100)]
[mono] Remove SkipVerification support from the runtime (#66211)

CAS support was removed in .NET Core. This allows us removing a bunch of code that is unused, e.g. the dependency on libiconv.

2 years agoRemove unnecessary return (#66252)
Sajad Samiizadeh [Sun, 6 Mar 2022 00:59:26 +0000 (04:29 +0330)]
Remove unnecessary return (#66252)

2 years ago[mono][llvm] Fix crashes when methods fail LLVM compilation. (#65391)
Zoltan Varga [Sat, 5 Mar 2022 16:59:51 +0000 (11:59 -0500)]
[mono][llvm] Fix crashes when methods fail LLVM compilation. (#65391)

Calling LLVMDeleteBasicBlock () seems to cause crashes, so
call LLVMRemoveBasicBlockFromParent () instead.

2 years agoRevert "Fix issues related to JsonSerializerOptions mutation and caching. (#65863...
Jan Kotas [Sat, 5 Mar 2022 14:08:07 +0000 (06:08 -0800)]
Revert "Fix issues related to JsonSerializerOptions mutation and caching. (#65863)" (#66235)

This reverts commit 11b79618faf1023ba4ea26b4037f495f81070d79.

2 years agoReplace TargetFrameworks with TargetFramework where possible (#66198)
Jan Kotas [Sat, 5 Mar 2022 06:21:59 +0000 (22:21 -0800)]
Replace TargetFrameworks with TargetFramework where possible (#66198)

2 years agoAddress feedback on fabricbot config for area pods (#66137)
Jeff Handley [Sat, 5 Mar 2022 05:05:01 +0000 (21:05 -0800)]
Address feedback on fabricbot config for area pods (#66137)

Automatically remove the `untriaged` label when a triage action is performed. When an issue/PR is moved to another area, consider it done on the original board instead of removing it.

2 years agoReplace CngCommon hash with OneShotHashHelpers.
Kevin Jones [Sat, 5 Mar 2022 03:49:08 +0000 (22:49 -0500)]
Replace CngCommon hash with OneShotHashHelpers.

2 years agoRename classes in p/invoke generator to be `LibraryImport` (#66217)
Elinor Fung [Sat, 5 Mar 2022 03:42:33 +0000 (19:42 -0800)]
Rename classes in p/invoke generator to be `LibraryImport` (#66217)

2 years agoUse CMakeProjectReference instead of ProjectReference (#66202)
Aaron Robinson [Sat, 5 Mar 2022 03:40:27 +0000 (19:40 -0800)]
Use CMakeProjectReference instead of ProjectReference (#66202)

* Use CMakeProjectReference instead of ProjectReference

Changing this permits usage of "\runtime\dotnet.cmd build" as opposed
  to forcing users to use "\runtime\dotnet.cmd msbuild".

2 years ago[wasm] Add support for symbolicating native traces from JS, using a symbols file...
Ankit Jain [Sat, 5 Mar 2022 02:38:26 +0000 (21:38 -0500)]
[wasm] Add support for symbolicating native traces from JS, using a symbols file (#66042)

* [wasm] Fix run command lines for samples

* [wasm] Export FS_readFile

* [wasm] Add support for symbolicating traces in console errors, or

.. warnings. The regex patterns are hardcoded in `debug.ts`. And the
symbols are loaded from `dotnet.js.symbols`.

We try to symbolicate wherever possible.

* [wasm] Enable symbolicating for non-aot test builds by default

* [wasm] Enable symbol map for debugger tests

* Address feedback from @pavelsavara

* [wasm] Add a `mono_wasm_symbolicate_string` function

.. and use that to symbolicate traces marshaled as C# exceptions (thanks
to @pavelsavara for the suggestion).

2 years agoAdd HostApplicationBuilder (#65109)
Stephen Halter [Sat, 5 Mar 2022 01:15:17 +0000 (17:15 -0800)]
Add HostApplicationBuilder (#65109)

2 years agoDelete compUnsafeCastUsed (#66204)
SingleAccretion [Fri, 4 Mar 2022 22:59:19 +0000 (01:59 +0300)]
Delete compUnsafeCastUsed (#66204)

2 years agoSlightly more aggressive ASG reversal (#65920)
SingleAccretion [Fri, 4 Mar 2022 22:06:37 +0000 (01:06 +0300)]
Slightly more aggressive ASG reversal (#65920)

Allows us to reverse "ASG(IND(const), ...)".

2 years agoKeep the volatility of CLS_VARs in rationalize (#65919)
SingleAccretion [Fri, 4 Mar 2022 21:38:48 +0000 (00:38 +0300)]
Keep the volatility of CLS_VARs in rationalize (#65919)

2 years agoFix source generated regex compilation failure due to mismatched notion of atomic...
Stephen Toub [Fri, 4 Mar 2022 20:45:33 +0000 (15:45 -0500)]
Fix source generated regex compilation failure due to mismatched notion of atomic (#66195)

During and post-parsing, we apply various optimizations to the regex node tree, in particular trying to annotate as much as possible as atomic in order to eliminate unnecessary backtracking.  Then later when RegexCompiler and the source generator view the final tree, they also compute for every node whether a child may backtrack, as doing so enables avoiding unnecessary backtracking-related code generation if the child is known to not backtrack (e.g. because it's now marked as atomic).  However, things can go awry if the compiler / source generator's view of what's atomic differs from what's actually generated.  Because of how optimizations are applied to the node tree, it's possible for a late optimization to make a transformation that then would enable a node to be made atomic, but we don't run that phase of the optimizer again, and thus the node is left non-atomic.  Then the source generator comes along, does its analysis, and sees that the node should be treated as atomic.  That leads to problems, because the node itself will have unnecessary backtracking code generated but the parent will rightly assume there wasn't anyway and won't generate the code necessary to compensate for it, or alternatively will generate code that causes problems (e.g. the source generator uses this information to determine whether it can output scopes).

Our outer loop tests that source gen our full regex corpus caught a case where this was happening.  A couple fixes, either of which on their own is sufficient to address this particular case, but each of which also brings other benefits:
1. When rendering a single-char loop, it consults the computed atomicity table to determine whether the rest of the source generation views it as atomic.  If it does, it instead does an atomic rendering.
2. When we do our ending backtracking elimination pass (i.e. walking down the right-hand side of atomic nodes to make anything that ends them also be atomic), we should also recur into lookarounds.

This also removes some duplicated code for reducing lookarounds, and renames some stale method names.

2 years agoClean up stale use of runtextbeg/end in RegexInterpreter (#66178)
Stephen Toub [Fri, 4 Mar 2022 20:33:55 +0000 (15:33 -0500)]
Clean up stale use of runtextbeg/end in RegexInterpreter (#66178)

2 years ago[wasm] Use INITIAL_MEMORY instead of TOTAL_MEMORY (#65790)
Radek Doulik [Fri, 4 Mar 2022 19:36:48 +0000 (20:36 +0100)]
[wasm] Use INITIAL_MEMORY instead of TOTAL_MEMORY (#65790)

* [wasm] Use INITIAL_MEMORY instead of TOTAL_MEMORY

It was renamed in emscripten 1.39.9:

    - Rename `TOTAL_MEMORY` to `INITIAL_MEMORY` and `WASM_MEM_MAX` to `MAXIMUM_MEMORY`,
      which are more accurate and match wasm conventions. The old names are still
      supported as aliases.

* Add EmccInitialMemory property

2 years agoFix catching of generic exception in crossgened shared generic code (#66162)
Jan Kotas [Fri, 4 Mar 2022 19:13:54 +0000 (11:13 -0800)]
Fix catching of generic exception in crossgened shared generic code  (#66162)

* Add regression test

Fixes #66005

Co-authored-by: Michal Strehovský <MichalStrehovsky@users.noreply.github.com>
2 years agoAdd support for Windows IO completions to the portable thread pool (#64834)
Koundinya Veluri [Fri, 4 Mar 2022 18:47:48 +0000 (10:47 -0800)]
Add support for Windows IO completions to the portable thread pool (#64834)

* Add support for Windows IO completions to the portable thread pool

- Added an implementation for BindHandle
- Polling for IO completions is done in batches on separate threads similarly to what is done on Unixes
- Added a high-priority work item queue to have IO completion work items run at higher priority
- Removed the time-sensitive work item queue, used the high-priority queue instead

2 years agoMake sure that StressLogAnalyzer works with filtering 64 bit addresses (#64594)
Andrew Au [Fri, 4 Mar 2022 18:07:01 +0000 (10:07 -0800)]
Make sure that StressLogAnalyzer works with filtering 64 bit addresses (#64594)

2 years agoUpdate files to remove imhameed (#66160)
Sam Patel [Fri, 4 Mar 2022 17:15:58 +0000 (12:15 -0500)]
Update files to remove imhameed (#66160)

* Update Codeowners to remove imhameed

* Update area-owners.md to remove imhameed

* Update fabricbot.json file to remove imhameed

* update codeowners file to remove alexrp

* update codeowners to remove Egor from Mono files

* remove merp related entries from CODEOWNERS

Co-authored-by: Aleksey Kliger (λgeek) <alklig@microsoft.com>
Co-authored-by: Aleksey Kliger (λgeek) <alklig@microsoft.com>
2 years agoMake ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's (#66169)
Eirik Tsarpalis [Fri, 4 Mar 2022 16:48:09 +0000 (16:48 +0000)]
Make ReadStack.JsonTypeInfo derivation logic consistent with WriteStack's (#66169)

* Make ReadStack.JsonTypeInfo derivation consistent with WriteStack

* remove duplicated assignment

2 years agoFix issues related to JsonSerializerOptions mutation and caching. (#65863)
Eirik Tsarpalis [Fri, 4 Mar 2022 16:17:01 +0000 (16:17 +0000)]
Fix issues related to JsonSerializerOptions mutation and caching. (#65863)

* Fix issues related to JsonSerializerOptions mutation and caching.

* fix test style

* fix linker warning

2 years agoFix DebuggerDisplay for serializer types (#65971)
Eirik Tsarpalis [Fri, 4 Mar 2022 16:14:36 +0000 (16:14 +0000)]
Fix DebuggerDisplay for serializer types (#65971)

* Fix DebuggerDisplay for serializer types

* Update src/libraries/System.Text.Json/src/System/Text/Json/Serialization/WriteStack.cs

2 years agoSome more clean up for RegexOptions.NonBacktracking (#66018)
Stephen Toub [Fri, 4 Mar 2022 15:52:45 +0000 (10:52 -0500)]
Some more clean up for RegexOptions.NonBacktracking (#66018)

* Remove some dead code

* Remove Algebras folder

* Delete more dead code

* Clean up BV

* Change GenerateMinterms to accept a HashSet rather than IEnumerable

* Remove more unnecessary enumerable iteration

* Delete more dead code

* A little more BitVector cleanup

* Address PR feedback

2 years ago[mono] Remove support for nint/nuint/nfloat from mini-native-types.c (#65967)
Alexander Köplinger [Fri, 4 Mar 2022 15:32:56 +0000 (16:32 +0100)]
[mono] Remove support for nint/nuint/nfloat from mini-native-types.c (#65967)

The Xamarin.iOS types were replaced by the BCL versions.

2 years ago delete the test file with custom security settings when it's being closed (#66192)
Adam Sitnik [Fri, 4 Mar 2022 15:07:03 +0000 (16:07 +0100)]
 delete the test file with custom security settings when it's being closed (#66192)

2 years agoRename unixinterface.cpp -> exports.cpp (#66190)
Aaron Robinson [Fri, 4 Mar 2022 14:50:07 +0000 (06:50 -0800)]
Rename unixinterface.cpp -> exports.cpp (#66190)

2 years agoRemove the multitarget from ILCompiler.Reflection.R2r (#66175)
Andy Gocke [Fri, 4 Mar 2022 14:49:12 +0000 (06:49 -0800)]
Remove the multitarget from ILCompiler.Reflection.R2r (#66175)

2 years ago[tests] Add MonoApi runtime tests (#65221)
Aleksey Kliger (λgeek) [Fri, 4 Mar 2022 13:46:02 +0000 (08:46 -0500)]
[tests] Add MonoApi runtime tests (#65221)

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

Create a new directory src/tests/Interop/MonoAPI for tests that use the mono embedding API.

Move the mono libtest.c native library along with managed tests: InstallEHCallback.cs, PInvokeDetach.cs and Thunks.cs to src/tests/Interop/MonoAPI/...

The native library (now called mono-embedding-api-test.c) builds on all platforms where we build native support libraries for the runtime tests.

The managed tests only run on desktop mono configurations for now.

* copy libtest.c from mono to src/tests and add cmake builds

* Make it build with the monoapi project

* remove mono-compiler.h dependency

* Remove dependency on gmodule.h

   Had to copy the w32_find_symbol code that searches for a symbol in every module.

* Remove test library eglib dependency

   Delete some unrunnable tests.

   Copy some basic eglib utilities into the test.

* Move native embedding API test lib to Interop/MonoAPI/Native

* Move install_eh_callback test to src/tests/Interop/MonoAPI/MonoMono

* add issues.targets excludes for MonoAPI tests

  Not expected to run on coreclr or mono on wasm or mobile, for now.

* Add PInvokeDetach MonoAPI test

* Return exit code 100 on success

* Change test class names to be unique

* fix win32 and gcc builds

* simplify managed code

* put all the MonoMono tests in a single directory

* Use the new MONO_API_FUNCTION monoapi headers

* compile the native library as C, not C++, same as libtest.c in the past

* delete many unused test functions

* delete unused utilities

* Add Thunks.cs tests

* Use a common setup method to probe for symbols

* simplify the native test library

* Make the PInvokeDetach native code sleep less

* add MIT banner

* skip Thunks test on AOT

   In the mono/mono repo that test was not expected to work with AOT

2 years agoUse RegexGenerator in System.Private.Xml (#66142)
Stephen Toub [Fri, 4 Mar 2022 11:33:07 +0000 (06:33 -0500)]
Use RegexGenerator in System.Private.Xml (#66142)

2 years agoUpdate Traversal msbuild SDK (#66165)
Viktor Hofer [Fri, 4 Mar 2022 10:53:13 +0000 (11:53 +0100)]
Update Traversal msbuild SDK (#66165)

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

2 years agoOnly register composite R2R native image code range once (#65623)
Tomáš Rylek [Fri, 4 Mar 2022 10:51:57 +0000 (11:51 +0100)]
Only register composite R2R native image code range once (#65623)

As David Wrighton noticed during an independent investigation,
today CoreCLR runtime logic ends up registering composite image
code range with the execution manager the number of times equal
to the number of component modules of the composite image
accessed at runtime, i.e. ultimately up to over 200 times in case
of the composite framework. This change fixes that by slightly
shuffling the initialization housekeeping chores.

Thanks

Tomas

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

2 years agoDon't add TestLibrary as a reference to all runtime tests (#66157)
Tomáš Rylek [Fri, 4 Mar 2022 10:50:50 +0000 (11:50 +0100)]
Don't add TestLibrary as a reference to all runtime tests (#66157)

When I was tagging several architecture-dependent runtime tests
with the ConditionalFact attribute, I added CoreCLRTestLibrary
as a general reference. This started causing timeouts in Mono AOT
tests because the library needs to be compiled many times.
As there's only a small number of architecture-dependent tests,
I have modified the change so that the test library is only added
explicitly to architecture-dependent tests.

Fixes: #66083

Thanks

Tomas

2 years agoImprove ICU missing msg for Alpine (#66150)
Dan Moseley [Fri, 4 Mar 2022 10:28:00 +0000 (03:28 -0700)]
Improve ICU missing msg for Alpine (#66150)

2 years agodocs(jsonPropertyOrder): correct ctor xmldocs (#66173)
Jay Harris [Fri, 4 Mar 2022 10:03:18 +0000 (02:03 -0800)]
docs(jsonPropertyOrder): correct ctor xmldocs (#66173)

Change the ctor XML docs on JsonPropertyOrderAttribute to property self-reference the JsonPropertyOrderAttribute type.

2 years agoSkip Upper vector save/restore for blocks that THROW (#66109)
Kunal Pathak [Fri, 4 Mar 2022 07:00:20 +0000 (23:00 -0800)]
Skip Upper vector save/restore for blocks that THROW (#66109)

* Skip upper vector save/restore if the call doesn't return or the block is a THROW block

* Revert "Disable SuperPMI replay jobs until #65332 is fixed (#66062)"

This reverts commit eb2fea80c6a4ff8117930b4003391d737f05c686.

* Just skip restore for BBJ_THROW

* Use skipSaveRestore to avoid extra save/restores

* jit format

2 years agoRename `DllImportGenerator` project to `LibraryImportGenerator` (#66029)
Elinor Fung [Fri, 4 Mar 2022 06:17:23 +0000 (22:17 -0800)]
Rename `DllImportGenerator` project to `LibraryImportGenerator` (#66029)

2 years agoAvoid Attribute.GetCustomAttributes() returning null for open generic type (#65237)
madelson [Fri, 4 Mar 2022 04:19:52 +0000 (23:19 -0500)]
Avoid Attribute.GetCustomAttributes() returning null for open generic type (#65237)

* Avoid Attribute.GetCustomAttributes() returning null for open generic type.

Fix #64335

2 years agoretire DummyTcpServer from SslStream tests (#65876)
Tomas Weinfurt [Fri, 4 Mar 2022 04:15:52 +0000 (20:15 -0800)]
retire DummyTcpServer from SslStream tests (#65876)

* retire DummyTcpServer from SslStream test

* fix build

* feedback from review

2 years agoFix System.IO.Ports native package not getting published any longer after the oob...
Jose Perez Rodriguez [Fri, 4 Mar 2022 03:56:22 +0000 (19:56 -0800)]
Fix System.IO.Ports native package not getting published any longer after the oob + sfx split (#66176)

2 years agoUpdate the StubManager for better debugger stepping. (#65947)
Aaron Robinson [Fri, 4 Mar 2022 01:10:06 +0000 (17:10 -0800)]
Update the StubManager for better debugger stepping. (#65947)

* Update various comments and logging

* The StubManager is now aware of InstantiatingMethods in IL Stub
  and StubLink scenarios
Created the concept of a "StepThroughStub". This handles cases where
  the stub should be treated like as an implementation details and
  simply forward to the appropriate target.
Updates to various logging mechanisms.

* Reorganize the ILStubType logic between DynamicMethodDesc and ILStubResolver.

2 years agoAdd RIDs for MIRACLE LINUX 8 and 9 (#61304)
Matthias Kruk [Fri, 4 Mar 2022 00:09:12 +0000 (09:09 +0900)]
Add RIDs for MIRACLE LINUX 8 and 9 (#61304)

Whenever we build dotnet RPMs for MIRACLE LINUX 8 (formerly Asianux Server 8) we have to
apply patches that add RIDs for MIRACLE LINUX. To streamline the build process, we would
like to add our RIDs to the upstream sources, in the same way CentOS and other RHEL-
derivatives do.

This commit adds the following runtime IDs:
 - "miraclelinux"
 - "miraclelinux-x64"
 - "miraclelinux.8"
 - "miraclelinux.8-x64"
 - "miraclelinux.9"
 - "miraclelinux.9-x64"

2 years agoFix copy propagation (#66070)
SingleAccretion [Thu, 3 Mar 2022 22:59:13 +0000 (01:59 +0300)]
Fix copy propagation (#66070)

Now that we don't push defs for shadowed parameters, we don't want to pop them as well.

2 years agoUse a unique EventId for Verbose in NetEventSource.Common (#66158)
Miha Zupan [Thu, 3 Mar 2022 22:57:56 +0000 (14:57 -0800)]
Use a unique EventId for Verbose in NetEventSource.Common (#66158)

2 years agoRun trim analyzer (#65870)
Sven Boemer [Thu, 3 Mar 2022 22:22:30 +0000 (14:22 -0800)]
Run trim analyzer (#65870)

* Use SDK logic for IsTrimmable

* Address some analyzer warnings

* Disable analyzer when baseline suppressions exist

* Don't mark unannotated test project as trimmable

* Add nativeaot annotations

* Add suppression in windows-only code

* Import illink.targets only when trimming mobile tests

* Don't run analyzer on unannotated windows OOBs

* PR feedback

Use pragma instead of UnconditionalSuppressMessage

2 years agoattempt to fix up EnterpriseTests (#65981)
Tomas Weinfurt [Thu, 3 Mar 2022 22:16:04 +0000 (14:16 -0800)]
attempt to fix up EnterpriseTests (#65981)

* attemp to fix up EnterpriseTests

* fix text

* increase timoeout on build step

* fix temeout

* add jobs

* update job

* fix formating

* fix name

* update server check

* restore original resolver before tests

* fix path

* experiment

2 years agoRemove leftover runtextbeg/end references from RegexCompiler / source generator ...
Stephen Toub [Thu, 3 Mar 2022 22:01:58 +0000 (17:01 -0500)]
Remove leftover runtextbeg/end references from RegexCompiler / source generator (#66129)

Now that we're operating over a span that represents the full input from beginning to end, we no longer need to access runtextbeg/runtextend, we can use inputSpan.Slice(pos) instead of inputSpan.Slice(pos, end - pos), etc.

2 years agoremove MemoryManagerPinLargeArray test, as it tests something that we don't ship...
Adam Sitnik [Thu, 3 Mar 2022 19:35:51 +0000 (20:35 +0100)]
remove MemoryManagerPinLargeArray test, as it tests something that we don't ship and causes trouble as it needs 2 GB of memory (#66152)

2 years agoavoid unnecessary base.Dispose call, as the base implementation does nothing (#66140)
Adam Sitnik [Thu, 3 Mar 2022 19:34:16 +0000 (20:34 +0100)]
avoid unnecessary base.Dispose call, as the base implementation does nothing (#66140)

2 years agoFix test failure due to conflicting merged PRs in DllImportGenerator tests. (#66156)
Jeremy Koritzinsky [Thu, 3 Mar 2022 19:21:34 +0000 (11:21 -0800)]
Fix test failure due to conflicting merged PRs in DllImportGenerator tests. (#66156)

Fixes #66143

2 years agoAdd a comment in source-generated regexes explaining why they cannot have optimized...
Theodore Tsirpanis [Thu, 3 Mar 2022 16:26:18 +0000 (18:26 +0200)]
Add a comment in source-generated regexes explaining why they cannot have optimized code. (#66114)

* Add a comment in source-generated regexes explaining why they cannot have optimized code.

* Apply suggestions from code review

Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
2 years agoFix handling of atomic nodes in RegexCompiler / source generator (#66046)
Stephen Toub [Thu, 3 Mar 2022 16:24:39 +0000 (11:24 -0500)]
Fix handling of atomic nodes in RegexCompiler / source generator (#66046)

* Fix handling of atomic nodes in RegexCompiler / source generator

We weren't properly resetting the stack position, so if we had an atomic group that contained something that backtracked, any backtracking positions left on the stack by that nested construct would then be consumed by a previous backtracking construct and lead to it reading the wrong state.

* Fix atomic handling for positive/negative lookaheads as well

2 years ago[mono][jit] Fix an assert in the local register allocator. (#66054)
Zoltan Varga [Thu, 3 Mar 2022 15:43:49 +0000 (10:43 -0500)]
[mono][jit] Fix an assert in the local register allocator. (#66054)

The assertion is hit when an instruction has a fixed sreg
(like shifts on x86) which was spilled to the stack.

2 years ago[monoapi] Add mono_method_get_unmanaged_callers_only_ftnptr (#66007)
Aleksey Kliger (λgeek) [Thu, 3 Mar 2022 15:38:37 +0000 (10:38 -0500)]
[monoapi] Add mono_method_get_unmanaged_callers_only_ftnptr (#66007)

Like `RuntimeMethodHandle.GetFunctionPointer`, but callable from native code

2 years agoImprove formatting of host test errors (#65730)
Vitek Karas [Thu, 3 Mar 2022 14:39:39 +0000 (06:39 -0800)]
Improve formatting of host test errors (#65730)

The host tests use FluentAssertions which has its own implementation of string formatting, for things like `Print("Some {0}", "message\r\nline")`. Instead of taking the string replacement as-is, it formats it by wrapping it in double quotes and replaces newlines with escaped values, so the above would output:
```
Some "message\r\nline"
```

This makes the test output quite hard to read without formatting it back (by unescaping the newlines).

Unfortunately FluentAssertions tries hard to always run the value through its own formatter. So even if we preformat everything and instead call `Print($"Some {"message\r\nline"})` it only works sometimes. The string is still parsed and the parser may fail if it finds for example only an open `{` without a closing one. This makes it nest to useless as we would have to make sure to somehow escape everything we feed in.

So this change introduces a new extension method FailWithPreformatted which circumvents the automatic formatting and uses the underlying AddFailure method which will not format anything.